stashes 0.1.47 → 0.1.49

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.js CHANGED
@@ -40,6 +40,10 @@ var DEFAULT_STASH_COUNT = 3;
40
40
  var APP_PROXY_PORT = STASHES_PORT + 1;
41
41
  var STASH_PORT_START = 4010;
42
42
  var STASH_PORT_END = 4030;
43
+ var STASH_PORT_OFFSET = 10;
44
+ var STASH_PORT_RANGE = 20;
45
+ var PORT_SLOT_SIZE = 100;
46
+ var MAX_PORT_SLOTS = 10;
43
47
  var MAX_PREVIEW_SERVERS = 5;
44
48
  var PREVIEW_TTL_MS = 300000;
45
49
  var PREVIEW_REAPER_INTERVAL = 30000;
@@ -625,6 +629,12 @@ class PersistenceService {
625
629
  const data = readJson(filePath, { chat: this.getChat(projectId, chatId), messages: [] });
626
630
  writeJson(filePath, { ...data, messages: [...data.messages, message] });
627
631
  }
632
+ updateChatMessage(projectId, chatId, messageId, patch) {
633
+ const filePath = join4(this.basePath, "projects", projectId, "chats", `${chatId}.json`);
634
+ const data = readJson(filePath, { chat: this.getChat(projectId, chatId), messages: [] });
635
+ const messages = data.messages.map((m) => m.id === messageId ? { ...m, ...patch } : m);
636
+ writeJson(filePath, { ...data, messages });
637
+ }
628
638
  migrateOldChat(projectId) {
629
639
  const oldPath = join4(this.basePath, "projects", projectId, "chat.json");
630
640
  if (!existsSync4(oldPath))
@@ -1683,14 +1693,18 @@ class PreviewPool {
1683
1693
  usedPorts = new Set;
1684
1694
  maxSize;
1685
1695
  ttlMs;
1696
+ portStart;
1697
+ portEnd;
1686
1698
  worktreeManager;
1687
1699
  broadcast;
1688
1700
  reaperInterval;
1689
- constructor(worktreeManager, broadcast, maxSize = MAX_PREVIEW_SERVERS, ttlMs = PREVIEW_TTL_MS) {
1701
+ constructor(worktreeManager, broadcast, maxSize = MAX_PREVIEW_SERVERS, ttlMs = PREVIEW_TTL_MS, portStart = STASH_PORT_START, portEnd = STASH_PORT_END) {
1690
1702
  this.worktreeManager = worktreeManager;
1691
1703
  this.broadcast = broadcast;
1692
1704
  this.maxSize = maxSize;
1693
1705
  this.ttlMs = ttlMs;
1706
+ this.portStart = portStart;
1707
+ this.portEnd = portEnd;
1694
1708
  this.reaperInterval = setInterval(() => this.reap(), PREVIEW_REAPER_INTERVAL);
1695
1709
  }
1696
1710
  async getOrStart(stashId) {
@@ -1834,12 +1848,12 @@ class PreviewPool {
1834
1848
  }
1835
1849
  }
1836
1850
  allocatePort() {
1837
- for (let port = STASH_PORT_START;port <= STASH_PORT_END; port++) {
1851
+ for (let port = this.portStart;port <= this.portEnd; port++) {
1838
1852
  if (!this.usedPorts.has(port)) {
1839
1853
  return port;
1840
1854
  }
1841
1855
  }
1842
- throw new Error(`No available ports in range ${STASH_PORT_START}-${STASH_PORT_END}`);
1856
+ throw new Error(`No available ports in range ${this.portStart}-${this.portEnd}`);
1843
1857
  }
1844
1858
  killEntry(entry) {
1845
1859
  try {
@@ -1877,16 +1891,23 @@ class StashService {
1877
1891
  chatSessions = new Map;
1878
1892
  stashPollTimer = null;
1879
1893
  knownStashIds = new Set;
1880
- constructor(projectPath, worktreeManager, persistence, broadcast) {
1894
+ pendingComponentResolve = null;
1895
+ constructor(projectPath, worktreeManager, persistence, broadcast, stashPortStart, stashPortEnd) {
1881
1896
  this.projectPath = projectPath;
1882
1897
  this.worktreeManager = worktreeManager;
1883
1898
  this.persistence = persistence;
1884
1899
  this.broadcast = broadcast;
1885
- this.previewPool = new PreviewPool(worktreeManager, broadcast);
1900
+ this.previewPool = new PreviewPool(worktreeManager, broadcast, undefined, undefined, stashPortStart, stashPortEnd);
1886
1901
  }
1887
1902
  getActiveChatId() {
1888
1903
  return this.activeChatId;
1889
1904
  }
1905
+ getSelectedComponent() {
1906
+ return this.selectedComponent;
1907
+ }
1908
+ setPendingComponentResolve(projectId, chatId, messageId) {
1909
+ this.pendingComponentResolve = { projectId, chatId, messageId };
1910
+ }
1890
1911
  setSelectedComponent(component) {
1891
1912
  this.selectedComponent = component;
1892
1913
  if (component.filePath === "auto-detect") {
@@ -1909,7 +1930,7 @@ class StashService {
1909
1930
  "Reply with ONLY the file path relative to the project root."
1910
1931
  ].join(`
1911
1932
  `);
1912
- const aiProcess = startAiProcess("resolve-component", prompt, this.projectPath);
1933
+ const aiProcess = startAiProcess("resolve-component", prompt, this.projectPath, undefined, "claude-haiku-4-5-20251001");
1913
1934
  let resolvedPath = "";
1914
1935
  try {
1915
1936
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -1922,13 +1943,30 @@ class StashService {
1922
1943
  }
1923
1944
  const match = resolvedPath.match(/(?:src\/[^\s\n"`']+\.(?:tsx|ts|jsx|js))/);
1924
1945
  if (match) {
1925
- this.selectedComponent = { ...component, filePath: match[0] };
1946
+ const filePath = match[0];
1947
+ this.selectedComponent = { ...component, filePath };
1926
1948
  this.broadcast({
1927
1949
  type: "component:resolved",
1928
- filePath: match[0],
1950
+ filePath,
1929
1951
  name: component.name,
1930
1952
  domSelector: component.domSelector
1931
1953
  });
1954
+ const pending = this.pendingComponentResolve;
1955
+ if (pending) {
1956
+ this.pendingComponentResolve = null;
1957
+ const messages = this.persistence.getChatMessages(pending.projectId, pending.chatId);
1958
+ const msg = messages.find((m) => m.id === pending.messageId);
1959
+ if (msg?.componentContext && !msg.componentContext.filePath) {
1960
+ this.persistence.updateChatMessage(pending.projectId, pending.chatId, pending.messageId, {
1961
+ componentContext: { ...msg.componentContext, filePath }
1962
+ });
1963
+ this.broadcast({
1964
+ type: "message:updated",
1965
+ messageId: pending.messageId,
1966
+ componentContext: { ...msg.componentContext, filePath }
1967
+ });
1968
+ }
1969
+ }
1932
1970
  }
1933
1971
  }
1934
1972
  async message(projectId, chatId, message, referenceStashIds, componentContext) {
@@ -2295,10 +2333,10 @@ function broadcast(event) {
2295
2333
  function getPersistenceFromWs() {
2296
2334
  return persistence;
2297
2335
  }
2298
- function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2336
+ function createWebSocketHandler(projectPath, userDevPort, appProxyPort, stashPortStart, stashPortEnd) {
2299
2337
  worktreeManager = new WorktreeManager(projectPath);
2300
2338
  persistence = new PersistenceService(projectPath);
2301
- stashService = new StashService(projectPath, worktreeManager, persistence, broadcast);
2339
+ stashService = new StashService(projectPath, worktreeManager, persistence, broadcast, stashPortStart, stashPortEnd);
2302
2340
  return {
2303
2341
  open(ws) {
2304
2342
  clients.add(ws);
@@ -2335,15 +2373,26 @@ function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2335
2373
  break;
2336
2374
  case "message": {
2337
2375
  const isFirstMessage = persistence.getChatMessages(event.projectId, event.chatId).length === 0;
2376
+ let componentContext = event.componentContext;
2377
+ if (componentContext) {
2378
+ const resolved = stashService.getSelectedComponent();
2379
+ if (resolved?.filePath && resolved.filePath !== "auto-detect") {
2380
+ componentContext = { ...componentContext, filePath: resolved.filePath };
2381
+ }
2382
+ }
2383
+ const messageId = crypto.randomUUID();
2338
2384
  persistence.saveChatMessage(event.projectId, event.chatId, {
2339
- id: crypto.randomUUID(),
2385
+ id: messageId,
2340
2386
  role: "user",
2341
2387
  content: event.message,
2342
2388
  type: "text",
2343
2389
  createdAt: new Date().toISOString(),
2344
2390
  referenceStashIds: event.referenceStashIds,
2345
- componentContext: event.componentContext
2391
+ componentContext
2346
2392
  });
2393
+ if (componentContext && !componentContext.filePath) {
2394
+ stashService.setPendingComponentResolve(event.projectId, event.chatId, messageId);
2395
+ }
2347
2396
  if (isFirstMessage) {
2348
2397
  const chat = persistence.getChat(event.projectId, event.chatId);
2349
2398
  if (chat) {
@@ -2351,7 +2400,7 @@ function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2351
2400
  persistence.saveChat({ ...chat, title });
2352
2401
  }
2353
2402
  }
2354
- await stashService.message(event.projectId, event.chatId, event.message, event.referenceStashIds, event.componentContext);
2403
+ await stashService.message(event.projectId, event.chatId, event.message, event.referenceStashIds, componentContext);
2355
2404
  break;
2356
2405
  }
2357
2406
  case "interact":
@@ -2432,17 +2481,37 @@ app2.get("/*", async (c) => {
2432
2481
  headers: { "content-type": "application/json" }
2433
2482
  });
2434
2483
  });
2435
- function startServer(projectPath, userDevPort, port = STASHES_PORT) {
2484
+ async function isPortAvailable(port) {
2485
+ try {
2486
+ const server = Bun.serve({ port, fetch: () => new Response("") });
2487
+ server.stop(true);
2488
+ return true;
2489
+ } catch {
2490
+ return false;
2491
+ }
2492
+ }
2493
+ async function findAvailablePort(requestedPort) {
2494
+ for (let slot = 0;slot < MAX_PORT_SLOTS; slot++) {
2495
+ const port = requestedPort + slot * PORT_SLOT_SIZE;
2496
+ if (await isPortAvailable(port))
2497
+ return port;
2498
+ }
2499
+ throw new Error(`No available port found. Tried ${MAX_PORT_SLOTS} slots starting from ${requestedPort} (step ${PORT_SLOT_SIZE}).`);
2500
+ }
2501
+ async function startServer(projectPath, userDevPort, requestedPort = STASHES_PORT) {
2502
+ const port = await findAvailablePort(requestedPort);
2503
+ const appProxyPort = port + 1;
2504
+ const stashPortStart = port + STASH_PORT_OFFSET;
2505
+ const stashPortEnd = port + STASH_PORT_OFFSET + STASH_PORT_RANGE;
2436
2506
  serverState = { projectPath, userDevPort };
2437
2507
  initLogFile(projectPath);
2438
- const appProxyPort = port + 1;
2439
2508
  startAppProxy(userDevPort, appProxyPort, injectOverlayScript);
2440
- const wsHandler = createWebSocketHandler(projectPath, userDevPort, appProxyPort);
2441
- const server = Bun.serve({
2509
+ const wsHandler = createWebSocketHandler(projectPath, userDevPort, appProxyPort, stashPortStart, stashPortEnd);
2510
+ Bun.serve({
2442
2511
  port,
2443
- fetch(req, server2) {
2512
+ fetch(req, server) {
2444
2513
  if (req.headers.get("upgrade") === "websocket") {
2445
- const success = server2.upgrade(req, {
2514
+ const success = server.upgrade(req, {
2446
2515
  data: { projectPath, userDevPort }
2447
2516
  });
2448
2517
  if (success)
@@ -2455,7 +2524,10 @@ function startServer(projectPath, userDevPort, port = STASHES_PORT) {
2455
2524
  logger.info("server", `Stashes running at http://localhost:${port}`);
2456
2525
  logger.info("server", `Proxying user app from http://localhost:${userDevPort}`);
2457
2526
  logger.info("server", `Project: ${projectPath}`);
2458
- return server;
2527
+ if (port !== requestedPort) {
2528
+ logger.info("server", `Port ${requestedPort} was in use, using ${port} instead`);
2529
+ }
2530
+ return { port, appProxyPort, stashPortStart, stashPortEnd };
2459
2531
  }
2460
2532
 
2461
2533
  // ../server/dist/services/detector.js
@@ -2535,7 +2607,7 @@ function findConfig(projectPath, candidates) {
2535
2607
  // src/commands/start.ts
2536
2608
  async function startCommand(path, options) {
2537
2609
  const projectPath = resolve(path || ".");
2538
- const port = parseInt(options.port, 10);
2610
+ const requestedPort = parseInt(options.port, 10);
2539
2611
  console.log("");
2540
2612
  console.log(" \u2554\u2550\u2557\u2554\u2566\u2557\u2554\u2550\u2557\u2554\u2550\u2557\u2566 \u2566\u2554\u2550\u2557\u2554\u2550\u2557");
2541
2613
  console.log(" \u255A\u2550\u2557 \u2551 \u2560\u2550\u2563\u255A\u2550\u2557\u2560\u2550\u2563\u2551\u2563 \u255A\u2550\u2557");
@@ -2546,17 +2618,20 @@ async function startCommand(path, options) {
2546
2618
  console.log(` Project: ${projectPath}`);
2547
2619
  console.log(` Framework: ${detected.framework}`);
2548
2620
  console.log(` Dev server: http://localhost:${devPort}`);
2549
- console.log(` Stashes: http://localhost:${port}`);
2550
- console.log("");
2551
2621
  const isDevRunning = await checkPort(devPort);
2552
2622
  if (!isDevRunning) {
2623
+ console.log("");
2553
2624
  console.log(` ! Your dev server is not running on port ${devPort}`);
2554
2625
  console.log(` Start it with: ${detected.devCommand}`);
2555
- console.log("");
2556
2626
  }
2557
- startServer(projectPath, devPort, port);
2627
+ const result = await startServer(projectPath, devPort, requestedPort);
2628
+ console.log(` Stashes: http://localhost:${result.port}`);
2629
+ if (result.port !== requestedPort) {
2630
+ console.log(` (port ${requestedPort} was in use, using ${result.port})`);
2631
+ }
2632
+ console.log("");
2558
2633
  if (options.open !== false) {
2559
- await open(`http://localhost:${port}`);
2634
+ await open(`http://localhost:${result.port}`);
2560
2635
  }
2561
2636
  }
2562
2637
  async function checkPort(port) {
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAMA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BrF"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAMA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCrF"}
@@ -4,7 +4,7 @@ import { startServer } from '@stashes/server';
4
4
  import { detectFramework } from '@stashes/server/services/detector';
5
5
  export async function startCommand(path, options) {
6
6
  const projectPath = resolve(path || '.');
7
- const port = parseInt(options.port, 10);
7
+ const requestedPort = parseInt(options.port, 10);
8
8
  console.log('');
9
9
  console.log(' ╔═╗╔╦╗╔═╗╔═╗╦ ╦╔═╗╔═╗');
10
10
  console.log(' ╚═╗ ║ ╠═╣╚═╗╠═╣║╣ ╚═╗');
@@ -15,17 +15,20 @@ export async function startCommand(path, options) {
15
15
  console.log(` Project: ${projectPath}`);
16
16
  console.log(` Framework: ${detected.framework}`);
17
17
  console.log(` Dev server: http://localhost:${devPort}`);
18
- console.log(` Stashes: http://localhost:${port}`);
19
- console.log('');
20
18
  const isDevRunning = await checkPort(devPort);
21
19
  if (!isDevRunning) {
20
+ console.log('');
22
21
  console.log(` ! Your dev server is not running on port ${devPort}`);
23
22
  console.log(` Start it with: ${detected.devCommand}`);
24
- console.log('');
25
23
  }
26
- startServer(projectPath, devPort, port);
24
+ const result = await startServer(projectPath, devPort, requestedPort);
25
+ console.log(` Stashes: http://localhost:${result.port}`);
26
+ if (result.port !== requestedPort) {
27
+ console.log(` (port ${requestedPort} was in use, using ${result.port})`);
28
+ }
29
+ console.log('');
27
30
  if (options.open !== false) {
28
- await open(`http://localhost:${port}`);
31
+ await open(`http://localhost:${result.port}`);
29
32
  }
30
33
  }
31
34
  async function checkPort(port) {
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AASpE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,OAAqB;IACpE,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAExC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAE1E,OAAO,CAAC,GAAG,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,8CAA8C,OAAO,EAAE,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,sBAAsB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAExC,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,IAAI,EAAE,EAAE;YACvD,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AASpE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,OAAqB;IACpE,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IACzC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEjD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAE1E,OAAO,CAAC,GAAG,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,8CAA8C,OAAO,EAAE,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,sBAAsB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,OAAO,CAAC,GAAG,CAAC,kCAAkC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,WAAW,aAAa,sBAAsB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,oBAAoB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,IAAI,EAAE,EAAE;YACvD,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
package/dist/mcp.js CHANGED
@@ -36,6 +36,10 @@ var DEFAULT_STASH_COUNT = 3;
36
36
  var APP_PROXY_PORT = STASHES_PORT + 1;
37
37
  var STASH_PORT_START = 4010;
38
38
  var STASH_PORT_END = 4030;
39
+ var STASH_PORT_OFFSET = 10;
40
+ var STASH_PORT_RANGE = 20;
41
+ var PORT_SLOT_SIZE = 100;
42
+ var MAX_PORT_SLOTS = 10;
39
43
  var MAX_PREVIEW_SERVERS = 5;
40
44
  var PREVIEW_TTL_MS = 300000;
41
45
  var PREVIEW_REAPER_INTERVAL = 30000;
@@ -477,6 +481,12 @@ class PersistenceService {
477
481
  const data = readJson(filePath, { chat: this.getChat(projectId, chatId), messages: [] });
478
482
  writeJson(filePath, { ...data, messages: [...data.messages, message] });
479
483
  }
484
+ updateChatMessage(projectId, chatId, messageId, patch) {
485
+ const filePath = join3(this.basePath, "projects", projectId, "chats", `${chatId}.json`);
486
+ const data = readJson(filePath, { chat: this.getChat(projectId, chatId), messages: [] });
487
+ const messages = data.messages.map((m) => m.id === messageId ? { ...m, ...patch } : m);
488
+ writeJson(filePath, { ...data, messages });
489
+ }
480
490
  migrateOldChat(projectId) {
481
491
  const oldPath = join3(this.basePath, "projects", projectId, "chat.json");
482
492
  if (!existsSync3(oldPath))
@@ -1879,14 +1889,18 @@ class PreviewPool {
1879
1889
  usedPorts = new Set;
1880
1890
  maxSize;
1881
1891
  ttlMs;
1892
+ portStart;
1893
+ portEnd;
1882
1894
  worktreeManager;
1883
1895
  broadcast;
1884
1896
  reaperInterval;
1885
- constructor(worktreeManager, broadcast, maxSize = MAX_PREVIEW_SERVERS, ttlMs = PREVIEW_TTL_MS) {
1897
+ constructor(worktreeManager, broadcast, maxSize = MAX_PREVIEW_SERVERS, ttlMs = PREVIEW_TTL_MS, portStart = STASH_PORT_START, portEnd = STASH_PORT_END) {
1886
1898
  this.worktreeManager = worktreeManager;
1887
1899
  this.broadcast = broadcast;
1888
1900
  this.maxSize = maxSize;
1889
1901
  this.ttlMs = ttlMs;
1902
+ this.portStart = portStart;
1903
+ this.portEnd = portEnd;
1890
1904
  this.reaperInterval = setInterval(() => this.reap(), PREVIEW_REAPER_INTERVAL);
1891
1905
  }
1892
1906
  async getOrStart(stashId) {
@@ -2030,12 +2044,12 @@ class PreviewPool {
2030
2044
  }
2031
2045
  }
2032
2046
  allocatePort() {
2033
- for (let port = STASH_PORT_START;port <= STASH_PORT_END; port++) {
2047
+ for (let port = this.portStart;port <= this.portEnd; port++) {
2034
2048
  if (!this.usedPorts.has(port)) {
2035
2049
  return port;
2036
2050
  }
2037
2051
  }
2038
- throw new Error(`No available ports in range ${STASH_PORT_START}-${STASH_PORT_END}`);
2052
+ throw new Error(`No available ports in range ${this.portStart}-${this.portEnd}`);
2039
2053
  }
2040
2054
  killEntry(entry) {
2041
2055
  try {
@@ -2073,16 +2087,23 @@ class StashService {
2073
2087
  chatSessions = new Map;
2074
2088
  stashPollTimer = null;
2075
2089
  knownStashIds = new Set;
2076
- constructor(projectPath, worktreeManager, persistence, broadcast) {
2090
+ pendingComponentResolve = null;
2091
+ constructor(projectPath, worktreeManager, persistence, broadcast, stashPortStart, stashPortEnd) {
2077
2092
  this.projectPath = projectPath;
2078
2093
  this.worktreeManager = worktreeManager;
2079
2094
  this.persistence = persistence;
2080
2095
  this.broadcast = broadcast;
2081
- this.previewPool = new PreviewPool(worktreeManager, broadcast);
2096
+ this.previewPool = new PreviewPool(worktreeManager, broadcast, undefined, undefined, stashPortStart, stashPortEnd);
2082
2097
  }
2083
2098
  getActiveChatId() {
2084
2099
  return this.activeChatId;
2085
2100
  }
2101
+ getSelectedComponent() {
2102
+ return this.selectedComponent;
2103
+ }
2104
+ setPendingComponentResolve(projectId, chatId, messageId) {
2105
+ this.pendingComponentResolve = { projectId, chatId, messageId };
2106
+ }
2086
2107
  setSelectedComponent(component) {
2087
2108
  this.selectedComponent = component;
2088
2109
  if (component.filePath === "auto-detect") {
@@ -2105,7 +2126,7 @@ class StashService {
2105
2126
  "Reply with ONLY the file path relative to the project root."
2106
2127
  ].join(`
2107
2128
  `);
2108
- const aiProcess = startAiProcess("resolve-component", prompt, this.projectPath);
2129
+ const aiProcess = startAiProcess("resolve-component", prompt, this.projectPath, undefined, "claude-haiku-4-5-20251001");
2109
2130
  let resolvedPath = "";
2110
2131
  try {
2111
2132
  for await (const chunk of parseClaudeStream(aiProcess.process)) {
@@ -2118,13 +2139,30 @@ class StashService {
2118
2139
  }
2119
2140
  const match = resolvedPath.match(/(?:src\/[^\s\n"`']+\.(?:tsx|ts|jsx|js))/);
2120
2141
  if (match) {
2121
- this.selectedComponent = { ...component, filePath: match[0] };
2142
+ const filePath = match[0];
2143
+ this.selectedComponent = { ...component, filePath };
2122
2144
  this.broadcast({
2123
2145
  type: "component:resolved",
2124
- filePath: match[0],
2146
+ filePath,
2125
2147
  name: component.name,
2126
2148
  domSelector: component.domSelector
2127
2149
  });
2150
+ const pending = this.pendingComponentResolve;
2151
+ if (pending) {
2152
+ this.pendingComponentResolve = null;
2153
+ const messages = this.persistence.getChatMessages(pending.projectId, pending.chatId);
2154
+ const msg = messages.find((m) => m.id === pending.messageId);
2155
+ if (msg?.componentContext && !msg.componentContext.filePath) {
2156
+ this.persistence.updateChatMessage(pending.projectId, pending.chatId, pending.messageId, {
2157
+ componentContext: { ...msg.componentContext, filePath }
2158
+ });
2159
+ this.broadcast({
2160
+ type: "message:updated",
2161
+ messageId: pending.messageId,
2162
+ componentContext: { ...msg.componentContext, filePath }
2163
+ });
2164
+ }
2165
+ }
2128
2166
  }
2129
2167
  }
2130
2168
  async message(projectId, chatId, message, referenceStashIds, componentContext) {
@@ -2491,10 +2529,10 @@ function broadcast(event) {
2491
2529
  function getPersistenceFromWs() {
2492
2530
  return persistence;
2493
2531
  }
2494
- function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2532
+ function createWebSocketHandler(projectPath, userDevPort, appProxyPort, stashPortStart, stashPortEnd) {
2495
2533
  worktreeManager = new WorktreeManager(projectPath);
2496
2534
  persistence = new PersistenceService(projectPath);
2497
- stashService = new StashService(projectPath, worktreeManager, persistence, broadcast);
2535
+ stashService = new StashService(projectPath, worktreeManager, persistence, broadcast, stashPortStart, stashPortEnd);
2498
2536
  return {
2499
2537
  open(ws) {
2500
2538
  clients.add(ws);
@@ -2531,15 +2569,26 @@ function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2531
2569
  break;
2532
2570
  case "message": {
2533
2571
  const isFirstMessage = persistence.getChatMessages(event.projectId, event.chatId).length === 0;
2572
+ let componentContext = event.componentContext;
2573
+ if (componentContext) {
2574
+ const resolved = stashService.getSelectedComponent();
2575
+ if (resolved?.filePath && resolved.filePath !== "auto-detect") {
2576
+ componentContext = { ...componentContext, filePath: resolved.filePath };
2577
+ }
2578
+ }
2579
+ const messageId = crypto.randomUUID();
2534
2580
  persistence.saveChatMessage(event.projectId, event.chatId, {
2535
- id: crypto.randomUUID(),
2581
+ id: messageId,
2536
2582
  role: "user",
2537
2583
  content: event.message,
2538
2584
  type: "text",
2539
2585
  createdAt: new Date().toISOString(),
2540
2586
  referenceStashIds: event.referenceStashIds,
2541
- componentContext: event.componentContext
2587
+ componentContext
2542
2588
  });
2589
+ if (componentContext && !componentContext.filePath) {
2590
+ stashService.setPendingComponentResolve(event.projectId, event.chatId, messageId);
2591
+ }
2543
2592
  if (isFirstMessage) {
2544
2593
  const chat = persistence.getChat(event.projectId, event.chatId);
2545
2594
  if (chat) {
@@ -2547,7 +2596,7 @@ function createWebSocketHandler(projectPath, userDevPort, appProxyPort) {
2547
2596
  persistence.saveChat({ ...chat, title });
2548
2597
  }
2549
2598
  }
2550
- await stashService.message(event.projectId, event.chatId, event.message, event.referenceStashIds, event.componentContext);
2599
+ await stashService.message(event.projectId, event.chatId, event.message, event.referenceStashIds, componentContext);
2551
2600
  break;
2552
2601
  }
2553
2602
  case "interact":
@@ -2628,17 +2677,37 @@ app2.get("/*", async (c) => {
2628
2677
  headers: { "content-type": "application/json" }
2629
2678
  });
2630
2679
  });
2631
- function startServer(projectPath, userDevPort, port = STASHES_PORT) {
2680
+ async function isPortAvailable(port) {
2681
+ try {
2682
+ const server = Bun.serve({ port, fetch: () => new Response("") });
2683
+ server.stop(true);
2684
+ return true;
2685
+ } catch {
2686
+ return false;
2687
+ }
2688
+ }
2689
+ async function findAvailablePort(requestedPort) {
2690
+ for (let slot = 0;slot < MAX_PORT_SLOTS; slot++) {
2691
+ const port = requestedPort + slot * PORT_SLOT_SIZE;
2692
+ if (await isPortAvailable(port))
2693
+ return port;
2694
+ }
2695
+ throw new Error(`No available port found. Tried ${MAX_PORT_SLOTS} slots starting from ${requestedPort} (step ${PORT_SLOT_SIZE}).`);
2696
+ }
2697
+ async function startServer(projectPath, userDevPort, requestedPort = STASHES_PORT) {
2698
+ const port = await findAvailablePort(requestedPort);
2699
+ const appProxyPort = port + 1;
2700
+ const stashPortStart = port + STASH_PORT_OFFSET;
2701
+ const stashPortEnd = port + STASH_PORT_OFFSET + STASH_PORT_RANGE;
2632
2702
  serverState = { projectPath, userDevPort };
2633
2703
  initLogFile(projectPath);
2634
- const appProxyPort = port + 1;
2635
2704
  startAppProxy(userDevPort, appProxyPort, injectOverlayScript);
2636
- const wsHandler = createWebSocketHandler(projectPath, userDevPort, appProxyPort);
2637
- const server = Bun.serve({
2705
+ const wsHandler = createWebSocketHandler(projectPath, userDevPort, appProxyPort, stashPortStart, stashPortEnd);
2706
+ Bun.serve({
2638
2707
  port,
2639
- fetch(req, server2) {
2708
+ fetch(req, server) {
2640
2709
  if (req.headers.get("upgrade") === "websocket") {
2641
- const success = server2.upgrade(req, {
2710
+ const success = server.upgrade(req, {
2642
2711
  data: { projectPath, userDevPort }
2643
2712
  });
2644
2713
  if (success)
@@ -2651,7 +2720,10 @@ function startServer(projectPath, userDevPort, port = STASHES_PORT) {
2651
2720
  logger.info("server", `Stashes running at http://localhost:${port}`);
2652
2721
  logger.info("server", `Proxying user app from http://localhost:${userDevPort}`);
2653
2722
  logger.info("server", `Project: ${projectPath}`);
2654
- return server;
2723
+ if (port !== requestedPort) {
2724
+ logger.info("server", `Port ${requestedPort} was in use, using ${port} instead`);
2725
+ }
2726
+ return { port, appProxyPort, stashPortStart, stashPortEnd };
2655
2727
  }
2656
2728
 
2657
2729
  // ../mcp/src/tools/browse.ts
@@ -57,7 +57,7 @@ Error generating stack: `+o.message+`
57
57
  * @license MIT
58
58
  */var nv="popstate";function av(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function vk(e={}){function a(l,s){var f;let u=(f=s.state)==null?void 0:f.masked,{pathname:c,search:p,hash:g}=u||l.location;return sd("",{pathname:c,search:p,hash:g},s.state&&s.state.usr||null,s.state&&s.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,s){return typeof s=="string"?s:el(s)}return xk(a,r,null,e)}function Ke(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function vn(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Tk(){return Math.random().toString(36).substring(2,10)}function rv(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function sd(e,a,r=null,l,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?zr(a):a,state:r,key:a&&a.key||l||Tk(),unstable_mask:s}}function el({pathname:e="/",search:a="",hash:r=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function zr(e){let a={};if(e){let r=e.indexOf("#");r>=0&&(a.hash=e.substring(r),e=e.substring(0,r));let l=e.indexOf("?");l>=0&&(a.search=e.substring(l),e=e.substring(0,l)),e&&(a.pathname=e)}return a}function xk(e,a,r,l={}){let{window:s=document.defaultView,v5Compat:u=!1}=l,c=s.history,p="POP",g=null,f=b();f==null&&(f=0,c.replaceState({...c.state,idx:f},""));function b(){return(c.state||{idx:null}).idx}function h(){p="POP";let A=b(),k=A==null?null:A-f;f=A,g&&g({action:p,location:_.location,delta:k})}function E(A,k){p="PUSH";let C=av(A)?A:sd(_.location,A,k);f=b()+1;let I=rv(C,f),P=_.createHref(C.unstable_mask||C);try{c.pushState(I,"",P)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;s.location.assign(P)}u&&g&&g({action:p,location:_.location,delta:1})}function S(A,k){p="REPLACE";let C=av(A)?A:sd(_.location,A,k);f=b();let I=rv(C,f),P=_.createHref(C.unstable_mask||C);c.replaceState(I,"",P),u&&g&&g({action:p,location:_.location,delta:0})}function T(A){return Ak(A)}let _={get action(){return p},get location(){return e(s,c)},listen(A){if(g)throw new Error("A history only accepts one active listener");return s.addEventListener(nv,h),g=A,()=>{s.removeEventListener(nv,h),g=null}},createHref(A){return a(s,A)},createURL:T,encodeLocation(A){let k=T(A);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:E,replace:S,go(A){return c.go(A)}};return _}function Ak(e,a=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ke(r,"No window.location.(origin|href) available to create URL");let l=typeof e=="string"?e:el(e);return l=l.replace(/ $/,"%20"),!a&&l.startsWith("//")&&(l=r+l),new URL(l,r)}function fT(e,a,r="/"){return wk(e,a,r,!1)}function wk(e,a,r,l){let s=typeof a=="string"?zr(a):a,u=qn(s.pathname||"/",r);if(u==null)return null;let c=gT(e);kk(c);let p=null;for(let g=0;p==null&&g<c.length;++g){let f=Bk(u);p=Mk(c[g],f,l)}return p}function gT(e,a=[],r=[],l="",s=!1){let u=(c,p,g=s,f)=>{let b={relativePath:f===void 0?c.path||"":f,caseSensitive:c.caseSensitive===!0,childrenIndex:p,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(l)&&g)return;Ke(b.relativePath.startsWith(l),`Absolute route path "${b.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(l.length)}let h=Sn([l,b.relativePath]),E=r.concat(b);c.children&&c.children.length>0&&(Ke(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),gT(c.children,a,E,h,g)),!(c.path==null&&!c.index)&&a.push({path:h,score:Lk(h,c.index),routesMeta:E})};return e.forEach((c,p)=>{var g;if(c.path===""||!((g=c.path)!=null&&g.includes("?")))u(c,p);else for(let f of mT(c.path))u(c,p,!0,f)}),a}function mT(e){let a=e.split("/");if(a.length===0)return[];let[r,...l]=a,s=r.endsWith("?"),u=r.replace(/\?$/,"");if(l.length===0)return s?[u,""]:[u];let c=mT(l.join("/")),p=[];return p.push(...c.map(g=>g===""?u:[u,g].join("/"))),s&&p.push(...c),p.map(g=>e.startsWith("/")&&g===""?"/":g)}function kk(e){e.sort((a,r)=>a.score!==r.score?r.score-a.score:Dk(a.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var _k=/^:[\w-]+$/,Nk=3,Rk=2,Ck=1,Ik=10,Ok=-2,iv=e=>e==="*";function Lk(e,a){let r=e.split("/"),l=r.length;return r.some(iv)&&(l+=Ok),a&&(l+=Rk),r.filter(s=>!iv(s)).reduce((s,u)=>s+(_k.test(u)?Nk:u===""?Ck:Ik),l)}function Dk(e,a){return e.length===a.length&&e.slice(0,-1).every((l,s)=>l===a[s])?e[e.length-1]-a[a.length-1]:0}function Mk(e,a,r=!1){let{routesMeta:l}=e,s={},u="/",c=[];for(let p=0;p<l.length;++p){let g=l[p],f=p===l.length-1,b=u==="/"?a:a.slice(u.length)||"/",h=Qo({path:g.relativePath,caseSensitive:g.caseSensitive,end:f},b),E=g.route;if(!h&&f&&r&&!l[l.length-1].route.index&&(h=Qo({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},b)),!h)return null;Object.assign(s,h.params),c.push({params:s,pathname:Sn([u,h.pathname]),pathnameBase:Gk(Sn([u,h.pathnameBase])),route:E}),h.pathnameBase!=="/"&&(u=Sn([u,h.pathnameBase]))}return c}function Qo(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=Uk(e.path,e.caseSensitive,e.end),s=a.match(r);if(!s)return null;let u=s[0],c=u.replace(/(.)\/+$/,"$1"),p=s.slice(1);return{params:l.reduce((f,{paramName:b,isOptional:h},E)=>{if(b==="*"){let T=p[E]||"";c=u.slice(0,u.length-T.length).replace(/(.)\/+$/,"$1")}const S=p[E];return h&&!S?f[b]=void 0:f[b]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:u,pathnameBase:c,pattern:e}}function Uk(e,a=!1,r=!0){vn(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 l=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,p,g,f,b)=>{if(l.push({paramName:p,isOptional:g!=null}),g){let h=b.charAt(f+c.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,a?void 0:"i"),l]}function Bk(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return vn(!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 (${a}).`),e}}function qn(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,l=e.charAt(r);return l&&l!=="/"?null:e.slice(r)||"/"}var Fk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function zk(e,a="/"){let{pathname:r,search:l="",hash:s=""}=typeof e=="string"?zr(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=lv(r.substring(1),"/"):u=lv(r,a)):u=a,{pathname:u,search:$k(l),hash:Hk(s)}}function lv(e,a){let r=a.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Gc(e,a,r,l){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jk(e){return e.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function hT(e){let a=jk(e);return a.map((r,l)=>l===a.length-1?r.pathname:r.pathnameBase)}function _d(e,a,r,l=!1){let s;typeof e=="string"?s=zr(e):(s={...e},Ke(!s.pathname||!s.pathname.includes("?"),Gc("?","pathname","search",s)),Ke(!s.pathname||!s.pathname.includes("#"),Gc("#","pathname","hash",s)),Ke(!s.search||!s.search.includes("#"),Gc("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,p;if(c==null)p=r;else{let h=a.length-1;if(!l&&c.startsWith("..")){let E=c.split("/");for(;E[0]==="..";)E.shift(),h-=1;s.pathname=E.join("/")}p=h>=0?a[h]:"/"}let g=zk(s,p),f=c&&c!=="/"&&c.endsWith("/"),b=(u||c===".")&&r.endsWith("/");return!g.pathname.endsWith("/")&&(f||b)&&(g.pathname+="/"),g}var Sn=e=>e.join("/").replace(/\/\/+/g,"/"),Gk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$k=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Pk=class{constructor(e,a,r,l=!1){this.status=e,this.statusText=a||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function qk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Vk(e){return e.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var bT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yT(e,a){let r=e;if(typeof r!="string"||!Fk.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,s=!1;if(bT)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),p=qn(c.pathname,a);c.origin===u.origin&&p!=null?r=p+c.search+c.hash:s=!0}catch{vn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ET=["POST","PUT","PATCH","DELETE"];new Set(ET);var Yk=["GET",...ET];new Set(Yk);var jr=F.createContext(null);jr.displayName="DataRouter";var as=F.createContext(null);as.displayName="DataRouterState";var Wk=F.createContext(!1),ST=F.createContext({isTransitioning:!1});ST.displayName="ViewTransition";var Xk=F.createContext(new Map);Xk.displayName="Fetchers";var Zk=F.createContext(null);Zk.displayName="Await";var sn=F.createContext(null);sn.displayName="Navigation";var ll=F.createContext(null);ll.displayName="Location";var Tn=F.createContext({outlet:null,matches:[],isDataRoute:!1});Tn.displayName="Route";var Nd=F.createContext(null);Nd.displayName="RouteError";var vT="REACT_ROUTER_ERROR",Kk="REDIRECT",Qk="ROUTE_ERROR_RESPONSE";function Jk(e){if(e.startsWith(`${vT}:${Kk}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function e_(e){if(e.startsWith(`${vT}:${Qk}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new Pk(a.status,a.statusText,a.data)}catch{}}function t_(e,{relative:a}={}){Ke(ol(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=F.useContext(sn),{hash:s,pathname:u,search:c}=ul(e,{relative:a}),p=u;return r!=="/"&&(p=u==="/"?r:Sn([r,u])),l.createHref({pathname:p,search:c,hash:s})}function ol(){return F.useContext(ll)!=null}function Sa(){return Ke(ol(),"useLocation() may be used only in the context of a <Router> component."),F.useContext(ll).location}var TT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function xT(e){F.useContext(sn).static||F.useLayoutEffect(e)}function sl(){let{isDataRoute:e}=F.useContext(Tn);return e?m_():n_()}function n_(){Ke(ol(),"useNavigate() may be used only in the context of a <Router> component.");let e=F.useContext(jr),{basename:a,navigator:r}=F.useContext(sn),{matches:l}=F.useContext(Tn),{pathname:s}=Sa(),u=JSON.stringify(hT(l)),c=F.useRef(!1);return xT(()=>{c.current=!0}),F.useCallback((g,f={})=>{if(vn(c.current,TT),!c.current)return;if(typeof g=="number"){r.go(g);return}let b=_d(g,JSON.parse(u),s,f.relative==="path");e==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:Sn([a,b.pathname])),(f.replace?r.replace:r.push)(b,f.state,f)},[a,r,u,s,e])}F.createContext(null);function a_(){let{matches:e}=F.useContext(Tn),a=e[e.length-1];return a?a.params:{}}function ul(e,{relative:a}={}){let{matches:r}=F.useContext(Tn),{pathname:l}=Sa(),s=JSON.stringify(hT(r));return F.useMemo(()=>_d(e,JSON.parse(s),l,a==="path"),[e,s,l,a])}function r_(e,a){return AT(e,a)}function AT(e,a,r){var A;Ke(ol(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=F.useContext(sn),{matches:s}=F.useContext(Tn),u=s[s.length-1],c=u?u.params:{},p=u?u.pathname:"/",g=u?u.pathnameBase:"/",f=u&&u.route;{let k=f&&f.path||"";kT(p,!f||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${k}">) 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.
59
59
 
60
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let b=Sa(),h;if(a){let k=typeof a=="string"?zr(a):a;Ke(g==="/"||((A=k.pathname)==null?void 0:A.startsWith(g)),`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 "${g}" but pathname "${k.pathname}" was given in the \`location\` prop.`),h=k}else h=b;let E=h.pathname||"/",S=E;if(g!=="/"){let k=g.replace(/^\//,"").split("/");S="/"+E.replace(/^\//,"").split("/").slice(k.length).join("/")}let T=fT(e,{pathname:S});vn(f||T!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.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 _=u_(T&&T.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Sn([g,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?g:Sn([g,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,r);return a&&_?F.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function i_(){let e=g_(),a=qk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=F.createElement(F.Fragment,null,F.createElement("p",null,"💿 Hey developer 👋"),F.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",F.createElement("code",{style:u},"ErrorBoundary")," or"," ",F.createElement("code",{style:u},"errorElement")," prop on your route.")),F.createElement(F.Fragment,null,F.createElement("h2",null,"Unexpected Application Error!"),F.createElement("h3",{style:{fontStyle:"italic"}},a),r?F.createElement("pre",{style:s},r):null,c)}var l_=F.createElement(i_,null),wT=class extends F.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,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):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"){const r=e_(e.digest);r&&(e=r)}let a=e!==void 0?F.createElement(Tn.Provider,{value:this.props.routeContext},F.createElement(Nd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?F.createElement(o_,{error:e},a):a}};wT.contextType=Wk;var $c=new WeakMap;function o_({children:e,error:a}){let{basename:r}=F.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Jk(a.digest);if(l){let s=$c.get(a);if(s)throw s;let u=yT(l.location,r);if(bT&&!$c.get(a))if(u.isExternal||l.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw $c.set(a,c),c}return F.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function s_({routeContext:e,match:a,children:r}){let l=F.useContext(jr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),F.createElement(Tn.Provider,{value:e},r)}function u_(e,a=[],r){let l=r==null?void 0:r.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let s=e,u=l==null?void 0:l.errors;if(u!=null){let b=s.findIndex(h=>h.route.id&&(u==null?void 0:u[h.route.id])!==void 0);Ke(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,b+1))}let c=!1,p=-1;if(r&&l){c=l.renderFallback;for(let b=0;b<s.length;b++){let h=s[b];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(p=b),h.route.id){let{loaderData:E,errors:S}=l,T=h.route.loader&&!E.hasOwnProperty(h.route.id)&&(!S||S[h.route.id]===void 0);if(h.route.lazy||T){r.isStatic&&(c=!0),p>=0?s=s.slice(0,p+1):s=[s[0]];break}}}}let g=r==null?void 0:r.onError,f=l&&g?(b,h)=>{var E,S;g(b,{location:l.location,params:((S=(E=l.matches)==null?void 0:E[0])==null?void 0:S.params)??{},unstable_pattern:Vk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,E)=>{let S,T=!1,_=null,A=null;l&&(S=u&&h.route.id?u[h.route.id]:void 0,_=h.route.errorElement||l_,c&&(p<0&&E===0?(kT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,A=null):p===E&&(T=!0,A=h.route.hydrateFallbackElement||null)));let k=a.concat(s.slice(0,E+1)),C=()=>{let I;return S?I=_:T?I=A:h.route.Component?I=F.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,F.createElement(s_,{match:h,routeContext:{outlet:b,matches:k,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||E===0)?F.createElement(wT,{location:l.location,revalidation:l.revalidation,component:_,error:S,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:f}):C()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c_(e){let a=F.useContext(jr);return Ke(a,Rd(e)),a}function d_(e){let a=F.useContext(as);return Ke(a,Rd(e)),a}function p_(e){let a=F.useContext(Tn);return Ke(a,Rd(e)),a}function Cd(e){let a=p_(e),r=a.matches[a.matches.length-1];return Ke(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function f_(){return Cd("useRouteId")}function g_(){var l;let e=F.useContext(Nd),a=d_("useRouteError"),r=Cd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function m_(){let{router:e}=c_("useNavigate"),a=Cd("useNavigate"),r=F.useRef(!1);return xT(()=>{r.current=!0}),F.useCallback(async(s,u={})=>{vn(r.current,TT),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var ov={};function kT(e,a,r){!a&&!ov[e]&&(ov[e]=!0,vn(!1,r))}F.memo(h_);function h_({routes:e,future:a,state:r,isStatic:l,onError:s}){return AT(e,void 0,{state:r,isStatic:l,onError:s})}function Xi(e){Ke(!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 b_({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),g=F.useMemo(()=>({basename:p,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[p,s,u,c]);typeof r=="string"&&(r=zr(r));let{pathname:f="/",search:b="",hash:h="",state:E=null,key:S="default",unstable_mask:T}=r,_=F.useMemo(()=>{let A=qn(f,p);return A==null?null:{location:{pathname:A,search:b,hash:h,state:E,key:S,unstable_mask:T},navigationType:l}},[p,f,b,h,E,S,l,T]);return vn(_!=null,`<Router basename="${p}"> is not able to match the URL "${f}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:F.createElement(sn.Provider,{value:g},F.createElement(ll.Provider,{children:a,value:_}))}function y_({children:e,location:a}){return r_(ud(e),a)}function ud(e,a=[]){let r=[];return F.Children.forEach(e,(l,s)=>{if(!F.isValidElement(l))return;let u=[...a,s];if(l.type===F.Fragment){r.push.apply(r,ud(l.props.children,u));return}Ke(l.type===Xi,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!l.props.index||!l.props.children,"An index route cannot have child routes.");let c={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=ud(l.props.children,u)),r.push(c)}),r}var Yo="get",Wo="application/x-www-form-urlencoded";function rs(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function E_(e){return rs(e)&&e.tagName.toLowerCase()==="button"}function S_(e){return rs(e)&&e.tagName.toLowerCase()==="form"}function v_(e){return rs(e)&&e.tagName.toLowerCase()==="input"}function T_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function x_(e,a){return e.button===0&&(!a||a==="_self")&&!T_(e)}var zo=null;function A_(){if(zo===null)try{new FormData(document.createElement("form"),0),zo=!1}catch{zo=!0}return zo}var w_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hc(e){return e!=null&&!w_.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function k_(e,a){let r,l,s,u,c;if(S_(e)){let p=e.getAttribute("action");l=p?qn(p,a):null,r=e.getAttribute("method")||Yo,s=Hc(e.getAttribute("enctype"))||Wo,u=new FormData(e)}else if(E_(e)||v_(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=e.getAttribute("formaction")||p.getAttribute("action");if(l=g?qn(g,a):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||Yo,s=Hc(e.getAttribute("formenctype"))||Hc(p.getAttribute("enctype"))||Wo,u=new FormData(p,e),!A_()){let{name:f,type:b,value:h}=e;if(b==="image"){let E=f?`${f}.`:"";u.append(`${E}x`,"0"),u.append(`${E}y`,"0")}else f&&u.append(f,h)}}else{if(rs(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Yo,l=null,s=Wo,c=e}return u&&s==="text/plain"&&(c=u,u=void 0),{action:l,method:r.toLowerCase(),encType:s,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Id(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function __(e,a,r,l){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${l}`:s.pathname=`${s.pathname}.${l}`:s.pathname==="/"?s.pathname=`_root.${l}`:a&&qn(s.pathname,a)==="/"?s.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${l}`,s}async function N_(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function R_(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 C_(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await N_(u,r);return c.links?c.links():[]}return[]}));return D_(l.flat(1).filter(R_).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function sv(e,a,r,l,s,u){let c=(g,f)=>r[f]?g.route.id!==r[f].route.id:!0,p=(g,f)=>{var b;return r[f].pathname!==g.pathname||((b=r[f].route.path)==null?void 0:b.endsWith("*"))&&r[f].params["*"]!==g.params["*"]};return u==="assets"?a.filter((g,f)=>c(g,f)||p(g,f)):u==="data"?a.filter((g,f)=>{var h;let b=l.routes[g.route.id];if(!b||!b.hasLoader)return!1;if(c(g,f)||p(g,f))return!0;if(g.route.shouldRevalidate){let E=g.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof E=="boolean")return E}return!0}):[]}function I_(e,a,{includeHydrateFallback:r}={}){return O_(e.map(l=>{let s=a.routes[l.route.id];if(!s)return[];let u=[s.module];return s.clientActionModule&&(u=u.concat(s.clientActionModule)),s.clientLoaderModule&&(u=u.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(u=u.concat(s.hydrateFallbackModule)),s.imports&&(u=u.concat(s.imports)),u}).flat(1))}function O_(e){return[...new Set(e)]}function L_(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function D_(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(L_(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function _T(){let e=F.useContext(jr);return Id(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function M_(){let e=F.useContext(as);return Id(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=F.createContext(void 0);Od.displayName="FrameworkContext";function NT(){let e=F.useContext(Od);return Id(e,"You must render this element inside a <HydratedRouter> element"),e}function U_(e,a){let r=F.useContext(Od),[l,s]=F.useState(!1),[u,c]=F.useState(!1),{onFocus:p,onBlur:g,onMouseEnter:f,onMouseLeave:b,onTouchStart:h}=a,E=F.useRef(null);F.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let _=k=>{k.forEach(C=>{c(C.isIntersecting)})},A=new IntersectionObserver(_,{threshold:.5});return E.current&&A.observe(E.current),()=>{A.disconnect()}}},[e]),F.useEffect(()=>{if(l){let _=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(_)}}},[l]);let S=()=>{s(!0)},T=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,E,{}]:[u,E,{onFocus:Pi(p,S),onBlur:Pi(g,T),onMouseEnter:Pi(f,S),onMouseLeave:Pi(b,T),onTouchStart:Pi(h,S)}]:[!1,E,{}]}function Pi(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function B_({page:e,...a}){let{router:r}=_T(),l=F.useMemo(()=>fT(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?F.createElement(z_,{page:e,matches:l,...a}):null}function F_(e){let{manifest:a,routeModules:r}=NT(),[l,s]=F.useState([]);return F.useEffect(()=>{let u=!1;return C_(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function z_({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=NT(),{basename:p}=_T(),{loaderData:g,matches:f}=M_(),b=F.useMemo(()=>sv(e,a,f,u,l,"data"),[e,a,f,u,l]),h=F.useMemo(()=>sv(e,a,f,u,l,"assets"),[e,a,f,u,l]),E=F.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let _=new Set,A=!1;if(a.forEach(C=>{var P;let I=u.routes[C.route.id];!I||!I.hasLoader||(!b.some(q=>q.route.id===C.route.id)&&C.route.id in g&&((P=c[C.route.id])!=null&&P.shouldRevalidate)||I.hasClientLoader?A=!0:_.add(C.route.id))}),_.size===0)return[];let k=__(e,p,s.unstable_trailingSlashAwareDataRequests,"data");return A&&_.size>0&&k.searchParams.set("_routes",a.filter(C=>_.has(C.route.id)).map(C=>C.route.id).join(",")),[k.pathname+k.search]},[p,s.unstable_trailingSlashAwareDataRequests,g,l,u,b,a,e,c]),S=F.useMemo(()=>I_(h,u),[h,u]),T=F_(h);return F.createElement(F.Fragment,null,E.map(_=>F.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...r})),S.map(_=>F.createElement("link",{key:_,rel:"modulepreload",href:_,...r})),T.map(({key:_,link:A})=>F.createElement("link",{key:_,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function j_(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var G_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{G_&&(window.__reactRouterVersion="7.13.2")}catch{}function $_({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=F.useRef();s.current==null&&(s.current=vk({window:l,v5Compat:!0}));let u=s.current,[c,p]=F.useState({action:u.action,location:u.location}),g=F.useCallback(f=>{r===!1?p(f):F.startTransition(()=>p(f))},[r]);return F.useLayoutEffect(()=>u.listen(g),[u,g]),F.createElement(b_,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var RT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Br=F.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:p,state:g,target:f,to:b,preventScrollReset:h,viewTransition:E,unstable_defaultShouldRevalidate:S,...T},_){let{basename:A,navigator:k,unstable_useTransitions:C}=F.useContext(sn),I=typeof b=="string"&&RT.test(b),P=yT(b,A);b=P.to;let q=t_(b,{relative:s}),U=Sa(),W=null;if(p){let te=_d(p,[],U.unstable_mask?U.unstable_mask.pathname:"/",!0);A!=="/"&&(te.pathname=te.pathname==="/"?A:Sn([A,te.pathname])),W=k.createHref(te)}let[ae,le,M]=U_(l,T),$=V_(b,{replace:c,unstable_mask:p,state:g,target:f,preventScrollReset:h,relative:s,viewTransition:E,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function K(te){a&&a(te),te.defaultPrevented||$(te)}let ne=!(P.isExternal||u),re=F.createElement("a",{...T,...M,href:(ne?W:void 0)||P.absoluteURL||q,onClick:ne?K:a,ref:j_(_,le),target:f,"data-discover":!I&&r==="render"?"true":void 0});return ae&&!I?F.createElement(F.Fragment,null,re,F.createElement(B_,{page:q})):re});Br.displayName="Link";var H_=F.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:p,children:g,...f},b){let h=ul(c,{relative:f.relative}),E=Sa(),S=F.useContext(as),{navigator:T,basename:_}=F.useContext(sn),A=S!=null&&K_(h)&&p===!0,k=T.encodeLocation?T.encodeLocation(h).pathname:h.pathname,C=E.pathname,I=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;r||(C=C.toLowerCase(),I=I?I.toLowerCase():null,k=k.toLowerCase()),I&&_&&(I=qn(I,_)||I);const P=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let q=C===k||!s&&C.startsWith(k)&&C.charAt(P)==="/",U=I!=null&&(I===k||!s&&I.startsWith(k)&&I.charAt(k.length)==="/"),W={isActive:q,isPending:U,isTransitioning:A},ae=q?a:void 0,le;typeof l=="function"?le=l(W):le=[l,q?"active":null,U?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let M=typeof u=="function"?u(W):u;return F.createElement(Br,{...f,"aria-current":ae,className:le,ref:b,style:M,to:c,viewTransition:p},typeof g=="function"?g(W):g)});H_.displayName="NavLink";var P_=F.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Yo,action:p,onSubmit:g,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:E,...S},T)=>{let{unstable_useTransitions:_}=F.useContext(sn),A=X_(),k=Z_(p,{relative:f}),C=c.toLowerCase()==="get"?"get":"post",I=typeof p=="string"&&RT.test(p),P=q=>{if(g&&g(q),q.defaultPrevented)return;q.preventDefault();let U=q.nativeEvent.submitter,W=(U==null?void 0:U.getAttribute("formmethod"))||c,ae=()=>A(U||q.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:E});_&&r!==!1?F.startTransition(()=>ae()):ae()};return F.createElement("form",{ref:T,method:C,action:k,onSubmit:l?g:P,...S,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function q_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CT(e){let a=F.useContext(jr);return Ke(a,q_(e)),a}function V_(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:g,unstable_useTransitions:f}={}){let b=sl(),h=Sa(),E=ul(e,{relative:c});return F.useCallback(S=>{if(x_(S,a)){S.preventDefault();let T=r!==void 0?r:el(h)===el(E),_=()=>b(e,{replace:T,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:g});f?F.startTransition(()=>_()):_()}},[h,b,E,r,l,s,a,e,u,c,p,g,f])}var Y_=0,W_=()=>`__${String(++Y_)}__`;function X_(){let{router:e}=CT("useSubmit"),{basename:a}=F.useContext(sn),r=f_(),l=e.fetch,s=e.navigate;return F.useCallback(async(u,c={})=>{let{action:p,method:g,encType:f,formData:b,body:h}=k_(u,a);if(c.navigate===!1){let E=c.fetcherKey||W_();await l(E,r,c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||g,formEncType:c.encType||f,flushSync:c.flushSync})}else await s(c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||g,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function Z_(e,{relative:a}={}){let{basename:r}=F.useContext(sn),l=F.useContext(Tn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ul(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let p=new URLSearchParams(u.search),g=p.getAll("index");if(g.some(b=>b==="")){p.delete("index"),g.filter(h=>h).forEach(h=>p.append("index",h));let b=p.toString();u.search=b?`?${b}`:""}}return(!e||e===".")&&s.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Sn([r,u.pathname])),el(u)}function K_(e,{relative:a}={}){let r=F.useContext(ST);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=CT("useViewTransitionState"),s=ul(e,{relative:a});if(!r.isTransitioning)return!1;let u=qn(r.currentLocation.pathname,l)||r.currentLocation.pathname,c=qn(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Qo(s.pathname,c)!=null||Qo(s.pathname,u)!=null}const uv=e=>{let a;const r=new Set,l=(f,b)=>{const h=typeof f=="function"?f(a):f;if(!Object.is(h,a)){const E=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(S=>S(a,E))}},s=()=>a,p={setState:l,getState:s,getInitialState:()=>g,subscribe:f=>(r.add(f),()=>r.delete(f))},g=a=e(l,s,p);return p},Q_=(e=>e?uv(e):uv),J_=e=>e;function eN(e,a=J_){const r=on.useSyncExternalStore(e.subscribe,on.useCallback(()=>a(e.getState()),[e,a]),on.useCallback(()=>a(e.getInitialState()),[e,a]));return on.useDebugValue(r),r}const cv=e=>{const a=Q_(e),r=l=>eN(a,l);return Object.assign(r,a),r},tN=(e=>e?cv(e):cv),bt=tN((e,a)=>({ws:null,connected:!1,viewMode:"preview",pickerEnabled:!1,selectedComponent:null,userDevPort:null,appProxyPort:null,iframeUrl:"/",messages:[],isProcessing:!1,chatCollapsed:!1,rightPanelCollapsed:!1,stashes:new Map,selectedStashIds:new Set,referencedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,projectId:null,projectName:null,chats:[],currentChatId:null,connect(){const r=`ws://${window.location.host}`,l=new WebSocket(r);l.onopen=()=>e({connected:!0}),l.onclose=()=>e({connected:!1,ws:null}),l.onmessage=s=>{const u=JSON.parse(s.data);switch(u.type){case"server_ready":e({userDevPort:u.port,appProxyPort:u.appProxyPort,projectId:u.projectId,projectName:u.projectName});break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);g?p.set(u.stashId,{...g,status:u.status,originChatId:g.originChatId||c.currentChatId||void 0}):p.set(u.stashId,{id:u.stashId,number:u.number??p.size+1,projectId:c.projectId??"",originChatId:c.currentChatId??void 0,prompt:"",branch:"",worktreePath:"",port:null,screenshotUrl:null,screenshots:[],status:u.status,error:null,relatedTo:[],createdAt:new Date().toISOString()});const f=c.viewMode==="preview"?"grid":c.viewMode;return{stashes:p,viewMode:f}});break;case"stash:screenshot":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);return g&&p.set(u.stashId,{...g,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:g.screenshots}),{stashes:p}});break;case"stash:port":e(c=>{const p=new Map(c.previewPorts);p.set(u.stashId,u.port);const g=c.activeStashId===u.stashId;return{previewPorts:p,previewPort:g?u.port:c.previewPort,...g?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const p=new Map(c.previewPorts);return p.delete(u.stashId),{previewPorts:p}});break;case"stash:error":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);return g&&p.set(u.stashId,{...g,status:"error",error:u.error}),{stashes:p}});break;case"ai_stream":u.source==="chat"&&e({isProcessing:!1}),a().addMessage({role:u.source==="system"?"system":"assistant",content:u.content,type:u.streamType,toolName:u.toolName,toolParams:u.toolParams,toolStatus:u.toolStatus,toolResult:u.toolResult});break;case"component:resolved":{const c=a().selectedComponent;c&&e({selectedComponent:{...c,filePath:u.filePath}});break}case"stash:applied":a().addMessage({role:"system",content:"Stash applied and merged into your project. Refresh your app to see changes.",type:"text"}),e({viewMode:"preview",stashes:new Map,selectedStashIds:new Set,activeStashId:null,previewPorts:new Map,previewPort:null,stashServerReady:!1});break}},e({ws:l})},disconnect(){var r;(r=a().ws)==null||r.close(),e({ws:null,connected:!1})},send(r){var l;(l=a().ws)==null||l.send(JSON.stringify(r))},selectComponent(r){var c;const l=a().selectedComponent,s=l&&l.domSelector===r.domSelector;e({selectedComponent:r,pickerEnabled:!1});const u=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(c=u==null?void 0:u.contentWindow)==null||c.postMessage({type:"stashes:toggle_picker",enabled:!1},"*"),s||a().send({type:"select_component",component:r})},clearComponent(){e({selectedComponent:null})},setViewMode(r){e({viewMode:r})},togglePicker(){var s;const r=!a().pickerEnabled;e({pickerEnabled:r});const l=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(s=l==null?void 0:l.contentWindow)==null||s.postMessage({type:"stashes:toggle_picker",enabled:r},"*")},setIframeUrl(r){e({iframeUrl:r})},addMessage(r){e(l=>({messages:[...l.messages,{...r,id:crypto.randomUUID(),createdAt:new Date().toISOString()}]}))},async loadChats(){try{const r=await fetch("/api/chats"),{data:l}=await r.json(),s=new Map;for(const u of l.stashes??[])s.set(u.id,u);e({projectId:l.project.id,projectName:l.project.name,chats:l.chats??[],stashes:s})}catch{}},async loadChat(r){try{const l=await fetch(`/api/chats/${r}`),{data:s}=await l.json(),u=new Map(a().stashes),c=s.stashes??[];for(const f of c)u.set(f.id,f);const p=c.length>0,g=a().currentChatId===r;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:g?a().viewMode:p?"grid":"preview",selectedStashIds:g?a().selectedStashIds:new Set,referencedStashIds:g?a().referencedStashIds:new Set(s.referencedStashIds??[]),activeStashId:g?a().activeStashId:null})}catch{}},async newChat(r){const l=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:r})}),{data:s}=await l.json();return e(u=>({chats:[s,...u.chats],currentChatId:s.id,messages:[],viewMode:"preview",selectedStashIds:new Set,referencedStashIds:new Set(r??[]),activeStashId:null})),s.id},async deleteChat(r){try{await fetch(`/api/chats/${r}`,{method:"DELETE"}),e(l=>({chats:l.chats.filter(s=>s.id!==r),stashes:new Map([...l.stashes].filter(([,s])=>s.originChatId!==r))}))}catch{}},sendMessage(r){const l=a().projectId,s=a().currentChatId;if(!l||!s)return;const u=[...a().selectedStashIds],c=a().selectedComponent,p=c?{name:c.name,filePath:c.filePath&&c.filePath!=="auto-detect"?c.filePath:void 0,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:p}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...p?{componentContext:p}:{}}),c&&e({selectedComponent:null})},toggleChatCollapsed(){e(r=>({chatCollapsed:!r.chatCollapsed}))},toggleRightPanelCollapsed(){e(r=>({rightPanelCollapsed:!r.rightPanelCollapsed}))},toggleStashSelection(r){e(l=>{const s=new Set(l.selectedStashIds);return s.has(r)?s.delete(r):s.add(r),{selectedStashIds:s}})},clearStashSelection(){e({selectedStashIds:new Set})},addReferencedStashIds(r){const l=a().currentChatId;e(s=>{const u=new Set(s.referencedStashIds);for(const c of r)u.add(c);return l&&fetch(`/api/chats/${l}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:[...u]})}),{referencedStashIds:u}})},interactStash(r){const l=a().previewPorts.get(r),s=[...a().stashes.values()].sort((u,c)=>u.createdAt.localeCompare(c.createdAt)).map(u=>u.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:s})},applyStash(r){a().send({type:"apply_stash",stashId:r})},deleteStash(r){a().send({type:"delete_stash",stashId:r}),e(l=>{const s=new Map(l.stashes);s.delete(r);const u=new Set(l.selectedStashIds);return u.delete(r),{stashes:s,selectedStashIds:u}})}}));function IT({stash:e,index:a,isSelected:r,onSelect:l,onClick:s,onDelete:u}){const[c,p]=F.useState(!1),g=F.useRef(null);F.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);function f(S){S.stopPropagation(),p(!0),g.current=setTimeout(()=>p(!1),5e3)}function b(S){S.stopPropagation(),g.current&&clearTimeout(g.current),p(!1),u(e.id)}function h(S){S.stopPropagation(),g.current&&clearTimeout(g.current),p(!1)}function E(S){S.target.closest("button")||s(e)}return v.jsxs("div",{onClick:E,className:`bg-[var(--stashes-surface)] border-2 rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group ${r?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${a*40}ms`},children:[v.jsxs("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:[e.screenshotUrl?v.jsx("img",{src:e.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):v.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"}),v.jsx("div",{className:`absolute top-2.5 left-2.5 z-10 transition-opacity duration-200 ${r?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:S=>{S.stopPropagation(),l(e.id)},className:`w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all ${r?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"bg-black/40 border-white/60 hover:border-white backdrop-blur-sm"}`,children:r&&v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:`absolute top-2.5 right-2.5 z-10 flex items-center gap-1 transition-opacity duration-200 ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:c?v.jsxs(v.Fragment,{children:[v.jsx("button",{onClick:b,className:"w-6 h-6 rounded-full bg-red-500/80 backdrop-blur-sm border border-red-400/60 flex items-center justify-center hover:bg-red-500 transition-all",title:"Confirm delete",children:v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.jsx("button",{onClick:h,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-white/20 transition-all",title:"Cancel",children:v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:v.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):v.jsx("button",{onClick:f,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-red-500/80 hover:border-red-400/60 transition-all",title:"Delete stash",children:v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"white",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),v.jsx("div",{className:"p-2.5",children:v.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[v.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",e.number]})," ",e.prompt]})})]})}function OT({onDelete:e,className:a=""}){const[r,l]=F.useState(!1),s=F.useRef(null);F.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);function u(g){g.stopPropagation(),l(!0),s.current=setTimeout(()=>l(!1),5e3)}function c(g){g.stopPropagation(),s.current&&clearTimeout(s.current),l(!1),e()}function p(g){g.stopPropagation(),s.current&&clearTimeout(s.current),l(!1)}return r?v.jsxs("div",{className:`flex items-center gap-1 ${a}`,children:[v.jsx("button",{onClick:c,className:"text-red-400 hover:text-red-300 transition-colors p-1 rounded",title:"Confirm delete",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.jsx("button",{onClick:p,className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors p-1 rounded",title:"Cancel",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 10 10",fill:"none",children:v.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):v.jsx("button",{onClick:u,className:`text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded ${a}`,title:"Delete",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})}const dv=8,pv=5;function nN(){const e=sl(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c,deleteStash:p}=bt(),[g,f]=F.useState(new Set),[b,h]=F.useState(new Set),[E,S]=F.useState(!1),T=[...r.values()].filter($=>$.status==="ready").sort(($,K)=>new Date(K.createdAt).getTime()-new Date($.createdAt).getTime()),_=T.slice(0,dv),A=a.slice(0,pv),k=g.size>0||b.size>0;F.useEffect(()=>{s()},[s]);const C=F.useCallback($=>{f(K=>{const ne=new Set(K);return ne.has($)?ne.delete($):ne.add($),ne})},[]),I=F.useCallback($=>{h(K=>{const ne=new Set(K);return ne.has($)?ne.delete($):ne.add($),ne})},[]);function P(){f(new Set),h(new Set),S(!1)}async function q(){const $=await u();e(`/chat/${$}`)}async function U($){const K=await u([$.id]),ne=bt.getState();ne.toggleStashSelection($.id),ne.interactStash($.id),e(`/chat/${K}`)}async function W(){const $=[...g],K=await u($),ne=bt.getState();for(const re of $)ne.toggleStashSelection(re);P(),e(`/chat/${K}`)}function ae(){for(const $ of g)p($);for(const $ of b)c($);P()}function le($){const K=new Date($),re=new Date().getTime()-K.getTime(),te=Math.floor(re/6e4);if(te<1)return"just now";if(te<60)return`${te}m ago`;const z=Math.floor(te/60);if(z<24)return`${z}h ago`;const ee=Math.floor(z/24);return ee<7?`${ee}d ago`:K.toLocaleDateString()}function M(){const $=[];return g.size>0&&$.push(`${g.size} stash${g.size!==1?"es":""}`),b.size>0&&$.push(`${b.size} chat${b.size!==1?"s":""}`),$.join(", ")+" selected"}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),v.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),v.jsx("div",{onClick:q,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),T.length>0&&v.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Stashes (",T.length,")"]}),T.length>dv&&v.jsx(Br,{to:"/stashes",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),v.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:_.map(($,K)=>v.jsx(IT,{stash:$,index:K,isSelected:g.has($.id),onSelect:C,onClick:U,onDelete:ne=>{p(ne),f(re=>{const te=new Set(re);return te.delete(ne),te})}},$.id))})]}),a.length>0&&v.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Conversations (",a.length,")"]}),a.length>pv&&v.jsx(Br,{to:"/chats",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),v.jsx("div",{className:"space-y-2",children:A.map(($,K)=>{const ne=b.has($.id);return v.jsxs("div",{onClick:()=>e(`/chat/${$.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${ne?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${K*40}ms`},children:[v.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${ne?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:re=>{re.stopPropagation(),I($.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${ne?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:ne&&v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:"min-w-0 flex-1",children:v.jsx("div",{className:"font-semibold text-sm truncate",children:$.title})}),v.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[v.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:le($.updatedAt)}),v.jsx(OT,{onDelete:()=>c($.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},$.id)})})]})]}),k&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsx("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:M()}),v.jsx("button",{onClick:P,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),g.size>0&&b.size===0&&v.jsx("button",{onClick:W,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),E?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:ae,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>S(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>S(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function aN(){const e=sl(),{stashes:a,projectName:r,loadChats:l,newChat:s,deleteStash:u}=bt(),[c,p]=F.useState(new Set),[g,f]=F.useState(!1),b=[...a.values()].filter(_=>_.status==="ready").sort((_,A)=>new Date(A.createdAt).getTime()-new Date(_.createdAt).getTime());F.useEffect(()=>{l()},[l]);const h=F.useCallback(_=>{p(A=>{const k=new Set(A);return k.has(_)?k.delete(_):k.add(_),k})},[]);async function E(_){const A=await s([_.id]),k=bt.getState();k.toggleStashSelection(_.id),k.interactStash(_.id),e(`/chat/${A}`)}async function S(){const _=[...c],A=await s(_),k=bt.getState();for(const C of _)k.toggleStashSelection(C);p(new Set),e(`/chat/${A}`)}function T(){for(const _ of c)u(_);p(new Set),f(!1)}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Stashes"}),v.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[b.length," design exploration",b.length!==1?"s":""]})]}),b.length>0?v.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:b.map((_,A)=>v.jsx(IT,{stash:_,index:A,isSelected:c.has(_.id),onSelect:h,onClick:E,onDelete:k=>{u(k),p(C=>{const I=new Set(C);return I.delete(k),I})}},_.id))}):v.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No stashes yet. Start a conversation to generate design explorations."})]}),c.size>0&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," stash",c.size!==1?"es":""," selected"]}),v.jsx("button",{onClick:()=>{p(new Set),f(!1)},className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),v.jsx("button",{onClick:S,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),g?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:T,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>f(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>f(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function rN(e){const a=new Date(e),l=new Date().getTime()-a.getTime(),s=Math.floor(l/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const u=Math.floor(s/60);if(u<24)return`${u}h ago`;const c=Math.floor(u/24);return c<7?`${c}d ago`:a.toLocaleDateString()}function iN(){const e=sl(),{chats:a,projectName:r,loadChats:l,newChat:s,deleteChat:u}=bt(),[c,p]=F.useState(new Set),[g,f]=F.useState(!1);F.useEffect(()=>{l()},[l]);const b=F.useCallback(T=>{p(_=>{const A=new Set(_);return A.has(T)?A.delete(T):A.add(T),A})},[]);function h(){p(new Set),f(!1)}function E(){for(const T of c)u(T);h()}async function S(){const T=await s();e(`/chat/${T}`)}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Conversations"}),v.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[a.length," conversation",a.length!==1?"s":""]})]}),v.jsx("div",{onClick:S,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),a.length>0?v.jsx("div",{className:"space-y-2",children:a.map((T,_)=>{const A=c.has(T.id);return v.jsxs("div",{onClick:()=>e(`/chat/${T.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${A?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${_*40}ms`},children:[v.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${A?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:k=>{k.stopPropagation(),b(T.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${A?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:A&&v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:"min-w-0 flex-1",children:v.jsx("div",{className:"font-semibold text-sm truncate",children:T.title})}),v.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[v.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:rN(T.updatedAt)}),v.jsx(OT,{onDelete:()=>u(T.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},T.id)})}):v.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No conversations yet. Start one to begin designing."})]}),c.size>0&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," chat",c.size!==1?"s":""," selected"]}),v.jsx("button",{onClick:h,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),g?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:E,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>f(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>f(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function fv(e){const a=[],r=String(e||"");let l=r.indexOf(","),s=0,u=!1;for(;!u;){l===-1&&(l=r.length,u=!0);const c=r.slice(s,l).trim();(c||!u)&&a.push(c),s=l+1,l=r.indexOf(",",s)}return a}function lN(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uN={};function gv(e,a){return(uN.jsx?sN:oN).test(e)}const cN=/[ \t\n\f\r]/g;function dN(e){return typeof e=="object"?e.type==="text"?mv(e.value):!1:mv(e)}function mv(e){return e.replace(cN,"")===""}class cl{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}cl.prototype.normal={};cl.prototype.property={};cl.prototype.space=void 0;function LT(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new cl(r,l,a)}function tl(e){return e.toLowerCase()}class Ft{constructor(a,r){this.attribute=r,this.property=a}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let pN=0;const Te=$a(),lt=$a(),cd=$a(),ie=$a(),Ye=$a(),Ur=$a(),Yt=$a();function $a(){return 2**++pN}const dd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:Ur,number:ie,overloadedBoolean:cd,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),Pc=Object.keys(dd);class Ld extends Ft{constructor(a,r,l,s){let u=-1;if(super(a,r),hv(this,"space",s),typeof l=="number")for(;++u<Pc.length;){const c=Pc[u];hv(this,Pc[u],(l&dd[c])===dd[c])}}}Ld.prototype.defined=!0;function hv(e,a,r){r&&(e[a]=r)}function Gr(e){const a={},r={};for(const[l,s]of Object.entries(e.properties)){const u=new Ld(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[tl(l)]=l,r[tl(u.attribute)]=l}return new cl(a,r,e.space)}const DT=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:Ye,ariaCurrent:null,ariaDescribedBy:Ye,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ye,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ye,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ye,ariaLevel:ie,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:lt,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function MT(e,a){return a in e?e[a]:a}function UT(e,a){return MT(e,a.toLowerCase())}const fN=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Ye,accessKey:Ye,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ye,autoFocus:Te,autoPlay:Te,blocking:Ye,capture:null,charSet:null,checked:Te,cite:null,className:Ye,cols:ie,colSpan:null,content:null,contentEditable:lt,controls:Te,controlsList:Ye,coords:ie|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:cd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ye,height:ie,hidden:cd,high:ie,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:Te,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:ie,pattern:null,ping:Ye,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ye,required:Te,reversed:Te,rows:ie,rowSpan:ie,sandbox:Ye,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:UT}),gN=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:Ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:MT}),BT=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),FT=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:UT}),zT=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),mN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},hN=/[A-Z]/g,bv=/-[a-z]/g,bN=/^data[-\w.:]+$/i;function jT(e,a){const r=tl(a);let l=a,s=Ft;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bN.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(bv,EN);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!bv.test(u)){let c=u.replace(hN,yN);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Ld}return new s(l,a)}function yN(e){return"-"+e.toLowerCase()}function EN(e){return e.charAt(1).toUpperCase()}const GT=LT([DT,fN,BT,FT,zT],"html"),is=LT([DT,gN,BT,FT,zT],"svg");function yv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function SN(e){return e.join(" ").trim()}var Or={},qc,Ev;function vN(){if(Ev)return qc;Ev=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,g=`
60
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let b=Sa(),h;if(a){let k=typeof a=="string"?zr(a):a;Ke(g==="/"||((A=k.pathname)==null?void 0:A.startsWith(g)),`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 "${g}" but pathname "${k.pathname}" was given in the \`location\` prop.`),h=k}else h=b;let E=h.pathname||"/",S=E;if(g!=="/"){let k=g.replace(/^\//,"").split("/");S="/"+E.replace(/^\//,"").split("/").slice(k.length).join("/")}let T=fT(e,{pathname:S});vn(f||T!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),vn(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.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 _=u_(T&&T.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Sn([g,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?g:Sn([g,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,r);return a&&_?F.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function i_(){let e=g_(),a=qk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=F.createElement(F.Fragment,null,F.createElement("p",null,"💿 Hey developer 👋"),F.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",F.createElement("code",{style:u},"ErrorBoundary")," or"," ",F.createElement("code",{style:u},"errorElement")," prop on your route.")),F.createElement(F.Fragment,null,F.createElement("h2",null,"Unexpected Application Error!"),F.createElement("h3",{style:{fontStyle:"italic"}},a),r?F.createElement("pre",{style:s},r):null,c)}var l_=F.createElement(i_,null),wT=class extends F.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,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):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"){const r=e_(e.digest);r&&(e=r)}let a=e!==void 0?F.createElement(Tn.Provider,{value:this.props.routeContext},F.createElement(Nd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?F.createElement(o_,{error:e},a):a}};wT.contextType=Wk;var $c=new WeakMap;function o_({children:e,error:a}){let{basename:r}=F.useContext(sn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=Jk(a.digest);if(l){let s=$c.get(a);if(s)throw s;let u=yT(l.location,r);if(bT&&!$c.get(a))if(u.isExternal||l.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw $c.set(a,c),c}return F.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function s_({routeContext:e,match:a,children:r}){let l=F.useContext(jr);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),F.createElement(Tn.Provider,{value:e},r)}function u_(e,a=[],r){let l=r==null?void 0:r.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let s=e,u=l==null?void 0:l.errors;if(u!=null){let b=s.findIndex(h=>h.route.id&&(u==null?void 0:u[h.route.id])!==void 0);Ke(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,b+1))}let c=!1,p=-1;if(r&&l){c=l.renderFallback;for(let b=0;b<s.length;b++){let h=s[b];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(p=b),h.route.id){let{loaderData:E,errors:S}=l,T=h.route.loader&&!E.hasOwnProperty(h.route.id)&&(!S||S[h.route.id]===void 0);if(h.route.lazy||T){r.isStatic&&(c=!0),p>=0?s=s.slice(0,p+1):s=[s[0]];break}}}}let g=r==null?void 0:r.onError,f=l&&g?(b,h)=>{var E,S;g(b,{location:l.location,params:((S=(E=l.matches)==null?void 0:E[0])==null?void 0:S.params)??{},unstable_pattern:Vk(l.matches),errorInfo:h})}:void 0;return s.reduceRight((b,h,E)=>{let S,T=!1,_=null,A=null;l&&(S=u&&h.route.id?u[h.route.id]:void 0,_=h.route.errorElement||l_,c&&(p<0&&E===0?(kT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,A=null):p===E&&(T=!0,A=h.route.hydrateFallbackElement||null)));let k=a.concat(s.slice(0,E+1)),C=()=>{let I;return S?I=_:T?I=A:h.route.Component?I=F.createElement(h.route.Component,null):h.route.element?I=h.route.element:I=b,F.createElement(s_,{match:h,routeContext:{outlet:b,matches:k,isDataRoute:l!=null},children:I})};return l&&(h.route.ErrorBoundary||h.route.errorElement||E===0)?F.createElement(wT,{location:l.location,revalidation:l.revalidation,component:_,error:S,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:f}):C()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c_(e){let a=F.useContext(jr);return Ke(a,Rd(e)),a}function d_(e){let a=F.useContext(as);return Ke(a,Rd(e)),a}function p_(e){let a=F.useContext(Tn);return Ke(a,Rd(e)),a}function Cd(e){let a=p_(e),r=a.matches[a.matches.length-1];return Ke(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function f_(){return Cd("useRouteId")}function g_(){var l;let e=F.useContext(Nd),a=d_("useRouteError"),r=Cd("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[r]}function m_(){let{router:e}=c_("useNavigate"),a=Cd("useNavigate"),r=F.useRef(!1);return xT(()=>{r.current=!0}),F.useCallback(async(s,u={})=>{vn(r.current,TT),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var ov={};function kT(e,a,r){!a&&!ov[e]&&(ov[e]=!0,vn(!1,r))}F.memo(h_);function h_({routes:e,future:a,state:r,isStatic:l,onError:s}){return AT(e,void 0,{state:r,isStatic:l,onError:s})}function Xi(e){Ke(!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 b_({basename:e="/",children:a=null,location:r,navigationType:l="POP",navigator:s,static:u=!1,unstable_useTransitions:c}){Ke(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),g=F.useMemo(()=>({basename:p,navigator:s,static:u,unstable_useTransitions:c,future:{}}),[p,s,u,c]);typeof r=="string"&&(r=zr(r));let{pathname:f="/",search:b="",hash:h="",state:E=null,key:S="default",unstable_mask:T}=r,_=F.useMemo(()=>{let A=qn(f,p);return A==null?null:{location:{pathname:A,search:b,hash:h,state:E,key:S,unstable_mask:T},navigationType:l}},[p,f,b,h,E,S,l,T]);return vn(_!=null,`<Router basename="${p}"> is not able to match the URL "${f}${b}${h}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:F.createElement(sn.Provider,{value:g},F.createElement(ll.Provider,{children:a,value:_}))}function y_({children:e,location:a}){return r_(ud(e),a)}function ud(e,a=[]){let r=[];return F.Children.forEach(e,(l,s)=>{if(!F.isValidElement(l))return;let u=[...a,s];if(l.type===F.Fragment){r.push.apply(r,ud(l.props.children,u));return}Ke(l.type===Xi,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!l.props.index||!l.props.children,"An index route cannot have child routes.");let c={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=ud(l.props.children,u)),r.push(c)}),r}var Yo="get",Wo="application/x-www-form-urlencoded";function rs(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function E_(e){return rs(e)&&e.tagName.toLowerCase()==="button"}function S_(e){return rs(e)&&e.tagName.toLowerCase()==="form"}function v_(e){return rs(e)&&e.tagName.toLowerCase()==="input"}function T_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function x_(e,a){return e.button===0&&(!a||a==="_self")&&!T_(e)}var zo=null;function A_(){if(zo===null)try{new FormData(document.createElement("form"),0),zo=!1}catch{zo=!0}return zo}var w_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hc(e){return e!=null&&!w_.has(e)?(vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function k_(e,a){let r,l,s,u,c;if(S_(e)){let p=e.getAttribute("action");l=p?qn(p,a):null,r=e.getAttribute("method")||Yo,s=Hc(e.getAttribute("enctype"))||Wo,u=new FormData(e)}else if(E_(e)||v_(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=e.getAttribute("formaction")||p.getAttribute("action");if(l=g?qn(g,a):null,r=e.getAttribute("formmethod")||p.getAttribute("method")||Yo,s=Hc(e.getAttribute("formenctype"))||Hc(p.getAttribute("enctype"))||Wo,u=new FormData(p,e),!A_()){let{name:f,type:b,value:h}=e;if(b==="image"){let E=f?`${f}.`:"";u.append(`${E}x`,"0"),u.append(`${E}y`,"0")}else f&&u.append(f,h)}}else{if(rs(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Yo,l=null,s=Wo,c=e}return u&&s==="text/plain"&&(c=u,u=void 0),{action:l,method:r.toLowerCase(),encType:s,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Id(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function __(e,a,r,l){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${l}`:s.pathname=`${s.pathname}.${l}`:s.pathname==="/"?s.pathname=`_root.${l}`:a&&qn(s.pathname,a)==="/"?s.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${l}`,s}async function N_(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function R_(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 C_(e,a,r){let l=await Promise.all(e.map(async s=>{let u=a.routes[s.route.id];if(u){let c=await N_(u,r);return c.links?c.links():[]}return[]}));return D_(l.flat(1).filter(R_).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function sv(e,a,r,l,s,u){let c=(g,f)=>r[f]?g.route.id!==r[f].route.id:!0,p=(g,f)=>{var b;return r[f].pathname!==g.pathname||((b=r[f].route.path)==null?void 0:b.endsWith("*"))&&r[f].params["*"]!==g.params["*"]};return u==="assets"?a.filter((g,f)=>c(g,f)||p(g,f)):u==="data"?a.filter((g,f)=>{var h;let b=l.routes[g.route.id];if(!b||!b.hasLoader)return!1;if(c(g,f)||p(g,f))return!0;if(g.route.shouldRevalidate){let E=g.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof E=="boolean")return E}return!0}):[]}function I_(e,a,{includeHydrateFallback:r}={}){return O_(e.map(l=>{let s=a.routes[l.route.id];if(!s)return[];let u=[s.module];return s.clientActionModule&&(u=u.concat(s.clientActionModule)),s.clientLoaderModule&&(u=u.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(u=u.concat(s.hydrateFallbackModule)),s.imports&&(u=u.concat(s.imports)),u}).flat(1))}function O_(e){return[...new Set(e)]}function L_(e){let a={},r=Object.keys(e).sort();for(let l of r)a[l]=e[l];return a}function D_(e,a){let r=new Set;return new Set(a),e.reduce((l,s)=>{let u=JSON.stringify(L_(s));return r.has(u)||(r.add(u),l.push({key:u,link:s})),l},[])}function _T(){let e=F.useContext(jr);return Id(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function M_(){let e=F.useContext(as);return Id(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=F.createContext(void 0);Od.displayName="FrameworkContext";function NT(){let e=F.useContext(Od);return Id(e,"You must render this element inside a <HydratedRouter> element"),e}function U_(e,a){let r=F.useContext(Od),[l,s]=F.useState(!1),[u,c]=F.useState(!1),{onFocus:p,onBlur:g,onMouseEnter:f,onMouseLeave:b,onTouchStart:h}=a,E=F.useRef(null);F.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let _=k=>{k.forEach(C=>{c(C.isIntersecting)})},A=new IntersectionObserver(_,{threshold:.5});return E.current&&A.observe(E.current),()=>{A.disconnect()}}},[e]),F.useEffect(()=>{if(l){let _=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(_)}}},[l]);let S=()=>{s(!0)},T=()=>{s(!1),c(!1)};return r?e!=="intent"?[u,E,{}]:[u,E,{onFocus:Pi(p,S),onBlur:Pi(g,T),onMouseEnter:Pi(f,S),onMouseLeave:Pi(b,T),onTouchStart:Pi(h,S)}]:[!1,E,{}]}function Pi(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function B_({page:e,...a}){let{router:r}=_T(),l=F.useMemo(()=>fT(r.routes,e,r.basename),[r.routes,e,r.basename]);return l?F.createElement(z_,{page:e,matches:l,...a}):null}function F_(e){let{manifest:a,routeModules:r}=NT(),[l,s]=F.useState([]);return F.useEffect(()=>{let u=!1;return C_(e,a,r).then(c=>{u||s(c)}),()=>{u=!0}},[e,a,r]),l}function z_({page:e,matches:a,...r}){let l=Sa(),{future:s,manifest:u,routeModules:c}=NT(),{basename:p}=_T(),{loaderData:g,matches:f}=M_(),b=F.useMemo(()=>sv(e,a,f,u,l,"data"),[e,a,f,u,l]),h=F.useMemo(()=>sv(e,a,f,u,l,"assets"),[e,a,f,u,l]),E=F.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let _=new Set,A=!1;if(a.forEach(C=>{var P;let I=u.routes[C.route.id];!I||!I.hasLoader||(!b.some(q=>q.route.id===C.route.id)&&C.route.id in g&&((P=c[C.route.id])!=null&&P.shouldRevalidate)||I.hasClientLoader?A=!0:_.add(C.route.id))}),_.size===0)return[];let k=__(e,p,s.unstable_trailingSlashAwareDataRequests,"data");return A&&_.size>0&&k.searchParams.set("_routes",a.filter(C=>_.has(C.route.id)).map(C=>C.route.id).join(",")),[k.pathname+k.search]},[p,s.unstable_trailingSlashAwareDataRequests,g,l,u,b,a,e,c]),S=F.useMemo(()=>I_(h,u),[h,u]),T=F_(h);return F.createElement(F.Fragment,null,E.map(_=>F.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...r})),S.map(_=>F.createElement("link",{key:_,rel:"modulepreload",href:_,...r})),T.map(({key:_,link:A})=>F.createElement("link",{key:_,nonce:r.nonce,...A,crossOrigin:A.crossOrigin??r.crossOrigin})))}function j_(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var G_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{G_&&(window.__reactRouterVersion="7.13.2")}catch{}function $_({basename:e,children:a,unstable_useTransitions:r,window:l}){let s=F.useRef();s.current==null&&(s.current=vk({window:l,v5Compat:!0}));let u=s.current,[c,p]=F.useState({action:u.action,location:u.location}),g=F.useCallback(f=>{r===!1?p(f):F.startTransition(()=>p(f))},[r]);return F.useLayoutEffect(()=>u.listen(g),[u,g]),F.createElement(b_,{basename:e,children:a,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var RT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Br=F.forwardRef(function({onClick:a,discover:r="render",prefetch:l="none",relative:s,reloadDocument:u,replace:c,unstable_mask:p,state:g,target:f,to:b,preventScrollReset:h,viewTransition:E,unstable_defaultShouldRevalidate:S,...T},_){let{basename:A,navigator:k,unstable_useTransitions:C}=F.useContext(sn),I=typeof b=="string"&&RT.test(b),P=yT(b,A);b=P.to;let q=t_(b,{relative:s}),U=Sa(),W=null;if(p){let te=_d(p,[],U.unstable_mask?U.unstable_mask.pathname:"/",!0);A!=="/"&&(te.pathname=te.pathname==="/"?A:Sn([A,te.pathname])),W=k.createHref(te)}let[ae,le,M]=U_(l,T),$=V_(b,{replace:c,unstable_mask:p,state:g,target:f,preventScrollReset:h,relative:s,viewTransition:E,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function K(te){a&&a(te),te.defaultPrevented||$(te)}let ne=!(P.isExternal||u),re=F.createElement("a",{...T,...M,href:(ne?W:void 0)||P.absoluteURL||q,onClick:ne?K:a,ref:j_(_,le),target:f,"data-discover":!I&&r==="render"?"true":void 0});return ae&&!I?F.createElement(F.Fragment,null,re,F.createElement(B_,{page:q})):re});Br.displayName="Link";var H_=F.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:l="",end:s=!1,style:u,to:c,viewTransition:p,children:g,...f},b){let h=ul(c,{relative:f.relative}),E=Sa(),S=F.useContext(as),{navigator:T,basename:_}=F.useContext(sn),A=S!=null&&K_(h)&&p===!0,k=T.encodeLocation?T.encodeLocation(h).pathname:h.pathname,C=E.pathname,I=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;r||(C=C.toLowerCase(),I=I?I.toLowerCase():null,k=k.toLowerCase()),I&&_&&(I=qn(I,_)||I);const P=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let q=C===k||!s&&C.startsWith(k)&&C.charAt(P)==="/",U=I!=null&&(I===k||!s&&I.startsWith(k)&&I.charAt(k.length)==="/"),W={isActive:q,isPending:U,isTransitioning:A},ae=q?a:void 0,le;typeof l=="function"?le=l(W):le=[l,q?"active":null,U?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let M=typeof u=="function"?u(W):u;return F.createElement(Br,{...f,"aria-current":ae,className:le,ref:b,style:M,to:c,viewTransition:p},typeof g=="function"?g(W):g)});H_.displayName="NavLink";var P_=F.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:l,replace:s,state:u,method:c=Yo,action:p,onSubmit:g,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:E,...S},T)=>{let{unstable_useTransitions:_}=F.useContext(sn),A=X_(),k=Z_(p,{relative:f}),C=c.toLowerCase()==="get"?"get":"post",I=typeof p=="string"&&RT.test(p),P=q=>{if(g&&g(q),q.defaultPrevented)return;q.preventDefault();let U=q.nativeEvent.submitter,W=(U==null?void 0:U.getAttribute("formmethod"))||c,ae=()=>A(U||q.currentTarget,{fetcherKey:a,method:W,navigate:r,replace:s,state:u,relative:f,preventScrollReset:b,viewTransition:h,unstable_defaultShouldRevalidate:E});_&&r!==!1?F.startTransition(()=>ae()):ae()};return F.createElement("form",{ref:T,method:C,action:k,onSubmit:l?g:P,...S,"data-discover":!I&&e==="render"?"true":void 0})});P_.displayName="Form";function q_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CT(e){let a=F.useContext(jr);return Ke(a,q_(e)),a}function V_(e,{target:a,replace:r,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:g,unstable_useTransitions:f}={}){let b=sl(),h=Sa(),E=ul(e,{relative:c});return F.useCallback(S=>{if(x_(S,a)){S.preventDefault();let T=r!==void 0?r:el(h)===el(E),_=()=>b(e,{replace:T,unstable_mask:l,state:s,preventScrollReset:u,relative:c,viewTransition:p,unstable_defaultShouldRevalidate:g});f?F.startTransition(()=>_()):_()}},[h,b,E,r,l,s,a,e,u,c,p,g,f])}var Y_=0,W_=()=>`__${String(++Y_)}__`;function X_(){let{router:e}=CT("useSubmit"),{basename:a}=F.useContext(sn),r=f_(),l=e.fetch,s=e.navigate;return F.useCallback(async(u,c={})=>{let{action:p,method:g,encType:f,formData:b,body:h}=k_(u,a);if(c.navigate===!1){let E=c.fetcherKey||W_();await l(E,r,c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||g,formEncType:c.encType||f,flushSync:c.flushSync})}else await s(c.action||p,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:h,formMethod:c.method||g,formEncType:c.encType||f,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[l,s,a,r])}function Z_(e,{relative:a}={}){let{basename:r}=F.useContext(sn),l=F.useContext(Tn);Ke(l,"useFormAction must be used inside a RouteContext");let[s]=l.matches.slice(-1),u={...ul(e||".",{relative:a})},c=Sa();if(e==null){u.search=c.search;let p=new URLSearchParams(u.search),g=p.getAll("index");if(g.some(b=>b==="")){p.delete("index"),g.filter(h=>h).forEach(h=>p.append("index",h));let b=p.toString();u.search=b?`?${b}`:""}}return(!e||e===".")&&s.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Sn([r,u.pathname])),el(u)}function K_(e,{relative:a}={}){let r=F.useContext(ST);Ke(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=CT("useViewTransitionState"),s=ul(e,{relative:a});if(!r.isTransitioning)return!1;let u=qn(r.currentLocation.pathname,l)||r.currentLocation.pathname,c=qn(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Qo(s.pathname,c)!=null||Qo(s.pathname,u)!=null}const uv=e=>{let a;const r=new Set,l=(f,b)=>{const h=typeof f=="function"?f(a):f;if(!Object.is(h,a)){const E=a;a=b??(typeof h!="object"||h===null)?h:Object.assign({},a,h),r.forEach(S=>S(a,E))}},s=()=>a,p={setState:l,getState:s,getInitialState:()=>g,subscribe:f=>(r.add(f),()=>r.delete(f))},g=a=e(l,s,p);return p},Q_=(e=>e?uv(e):uv),J_=e=>e;function eN(e,a=J_){const r=on.useSyncExternalStore(e.subscribe,on.useCallback(()=>a(e.getState()),[e,a]),on.useCallback(()=>a(e.getInitialState()),[e,a]));return on.useDebugValue(r),r}const cv=e=>{const a=Q_(e),r=l=>eN(a,l);return Object.assign(r,a),r},tN=(e=>e?cv(e):cv),bt=tN((e,a)=>({ws:null,connected:!1,viewMode:"preview",pickerEnabled:!1,selectedComponent:null,userDevPort:null,appProxyPort:null,iframeUrl:"/",messages:[],isProcessing:!1,chatCollapsed:!1,rightPanelCollapsed:!1,stashes:new Map,selectedStashIds:new Set,referencedStashIds:new Set,activeStashId:null,stashServerReady:!1,previewPort:null,previewPorts:new Map,projectId:null,projectName:null,chats:[],currentChatId:null,connect(){const r=`ws://${window.location.host}`,l=new WebSocket(r);l.onopen=()=>e({connected:!0}),l.onclose=()=>e({connected:!1,ws:null}),l.onmessage=s=>{const u=JSON.parse(s.data);switch(u.type){case"server_ready":e({userDevPort:u.port,appProxyPort:u.appProxyPort,projectId:u.projectId,projectName:u.projectName});break;case"processing":u.chatId===a().currentChatId&&e({isProcessing:!0});break;case"stash:status":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);g?p.set(u.stashId,{...g,status:u.status,originChatId:g.originChatId||c.currentChatId||void 0}):p.set(u.stashId,{id:u.stashId,number:u.number??p.size+1,projectId:c.projectId??"",originChatId:c.currentChatId??void 0,prompt:"",branch:"",worktreePath:"",port:null,screenshotUrl:null,screenshots:[],status:u.status,error:null,relatedTo:[],createdAt:new Date().toISOString()});const f=c.viewMode==="preview"?"grid":c.viewMode;return{stashes:p,viewMode:f}});break;case"stash:screenshot":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);return g&&p.set(u.stashId,{...g,screenshotUrl:u.url,screenshots:"screenshots"in u&&u.screenshots?u.screenshots:g.screenshots}),{stashes:p}});break;case"stash:port":e(c=>{const p=new Map(c.previewPorts);p.set(u.stashId,u.port);const g=c.activeStashId===u.stashId;return{previewPorts:p,previewPort:g?u.port:c.previewPort,...g?{stashServerReady:!0}:{}}});break;case"stash:preview_stopped":e(c=>{const p=new Map(c.previewPorts);return p.delete(u.stashId),{previewPorts:p}});break;case"stash:error":e(c=>{const p=new Map(c.stashes),g=p.get(u.stashId);return g&&p.set(u.stashId,{...g,status:"error",error:u.error}),{stashes:p}});break;case"ai_stream":u.source==="chat"&&e({isProcessing:!1}),a().addMessage({role:u.source==="system"?"system":"assistant",content:u.content,type:u.streamType,toolName:u.toolName,toolParams:u.toolParams,toolStatus:u.toolStatus,toolResult:u.toolResult});break;case"component:resolved":{const c=a().selectedComponent;c&&e({selectedComponent:{...c,filePath:u.filePath}});break}case"message:updated":{e(c=>({messages:c.messages.map(p=>p.id===u.messageId?{...p,componentContext:u.componentContext}:p)}));break}case"stash:applied":a().addMessage({role:"system",content:"Stash applied and merged into your project. Refresh your app to see changes.",type:"text"}),e({viewMode:"preview",stashes:new Map,selectedStashIds:new Set,activeStashId:null,previewPorts:new Map,previewPort:null,stashServerReady:!1});break}},e({ws:l})},disconnect(){var r;(r=a().ws)==null||r.close(),e({ws:null,connected:!1})},send(r){var l;(l=a().ws)==null||l.send(JSON.stringify(r))},selectComponent(r){var c;const l=a().selectedComponent,s=l&&l.domSelector===r.domSelector;e({selectedComponent:r,pickerEnabled:!1});const u=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(c=u==null?void 0:u.contentWindow)==null||c.postMessage({type:"stashes:toggle_picker",enabled:!1},"*"),s||a().send({type:"select_component",component:r})},clearComponent(){e({selectedComponent:null})},setViewMode(r){e({viewMode:r})},togglePicker(){var s;const r=!a().pickerEnabled;e({pickerEnabled:r});const l=document.querySelector('iframe[title="App Preview"], iframe[title="Stash Preview"]');(s=l==null?void 0:l.contentWindow)==null||s.postMessage({type:"stashes:toggle_picker",enabled:r},"*")},setIframeUrl(r){e({iframeUrl:r})},addMessage(r){e(l=>({messages:[...l.messages,{...r,id:crypto.randomUUID(),createdAt:new Date().toISOString()}]}))},async loadChats(){try{const r=await fetch("/api/chats"),{data:l}=await r.json(),s=new Map;for(const u of l.stashes??[])s.set(u.id,u);e({projectId:l.project.id,projectName:l.project.name,chats:l.chats??[],stashes:s})}catch{}},async loadChat(r){try{const l=await fetch(`/api/chats/${r}`),{data:s}=await l.json(),u=new Map(a().stashes),c=s.stashes??[];for(const f of c)u.set(f.id,f);const p=c.length>0,g=a().currentChatId===r;e({currentChatId:r,messages:s.messages??[],stashes:u,viewMode:g?a().viewMode:p?"grid":"preview",selectedStashIds:g?a().selectedStashIds:new Set,referencedStashIds:g?a().referencedStashIds:new Set(s.referencedStashIds??[]),activeStashId:g?a().activeStashId:null})}catch{}},async newChat(r){const l=await fetch("/api/chats",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:r})}),{data:s}=await l.json();return e(u=>({chats:[s,...u.chats],currentChatId:s.id,messages:[],viewMode:"preview",selectedStashIds:new Set,referencedStashIds:new Set(r??[]),activeStashId:null})),s.id},async deleteChat(r){try{await fetch(`/api/chats/${r}`,{method:"DELETE"}),e(l=>({chats:l.chats.filter(s=>s.id!==r),stashes:new Map([...l.stashes].filter(([,s])=>s.originChatId!==r))}))}catch{}},sendMessage(r){const l=a().projectId,s=a().currentChatId;if(!l||!s)return;const u=[...a().selectedStashIds],c=a().selectedComponent,p=c?{name:c.name,filePath:c.filePath&&c.filePath!=="auto-detect"?c.filePath:void 0,sourceStashId:void 0}:void 0;e({isProcessing:!0}),a().addMessage({role:"user",content:r,type:"text",referenceStashIds:u.length>0?u:void 0,componentContext:p}),a().send({type:"message",projectId:l,chatId:s,message:r,...u.length>0?{referenceStashIds:u}:{},...p?{componentContext:p}:{}}),c&&e({selectedComponent:null})},toggleChatCollapsed(){e(r=>({chatCollapsed:!r.chatCollapsed}))},toggleRightPanelCollapsed(){e(r=>({rightPanelCollapsed:!r.rightPanelCollapsed}))},toggleStashSelection(r){e(l=>{const s=new Set(l.selectedStashIds);return s.has(r)?s.delete(r):s.add(r),{selectedStashIds:s}})},clearStashSelection(){e({selectedStashIds:new Set})},addReferencedStashIds(r){const l=a().currentChatId;e(s=>{const u=new Set(s.referencedStashIds);for(const c of r)u.add(c);return l&&fetch(`/api/chats/${l}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({referencedStashIds:[...u]})}),{referencedStashIds:u}})},interactStash(r){const l=a().previewPorts.get(r),s=[...a().stashes.values()].sort((u,c)=>u.createdAt.localeCompare(c.createdAt)).map(u=>u.id);e({activeStashId:r,viewMode:"interact",stashServerReady:!!l,previewPort:l??null}),a().send({type:"interact",stashId:r,sortedStashIds:s})},applyStash(r){a().send({type:"apply_stash",stashId:r})},deleteStash(r){a().send({type:"delete_stash",stashId:r}),e(l=>{const s=new Map(l.stashes);s.delete(r);const u=new Set(l.selectedStashIds);return u.delete(r),{stashes:s,selectedStashIds:u}})}}));function IT({stash:e,index:a,isSelected:r,onSelect:l,onClick:s,onDelete:u}){const[c,p]=F.useState(!1),g=F.useRef(null);F.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);function f(S){S.stopPropagation(),p(!0),g.current=setTimeout(()=>p(!1),5e3)}function b(S){S.stopPropagation(),g.current&&clearTimeout(g.current),p(!1),u(e.id)}function h(S){S.stopPropagation(),g.current&&clearTimeout(g.current),p(!1)}function E(S){S.target.closest("button")||s(e)}return v.jsxs("div",{onClick:E,className:`bg-[var(--stashes-surface)] border-2 rounded-xl overflow-hidden cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group ${r?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${a*40}ms`},children:[v.jsxs("div",{className:"aspect-video bg-[var(--stashes-bg)] relative overflow-hidden",children:[e.screenshotUrl?v.jsx("img",{src:e.screenshotUrl,alt:"",className:"w-full h-full object-cover object-top transition-transform duration-300 group-hover:scale-[1.02]"}):v.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-[var(--stashes-text-muted)]",children:"No preview"}),v.jsx("div",{className:`absolute top-2.5 left-2.5 z-10 transition-opacity duration-200 ${r?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:S=>{S.stopPropagation(),l(e.id)},className:`w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all ${r?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"bg-black/40 border-white/60 hover:border-white backdrop-blur-sm"}`,children:r&&v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:`absolute top-2.5 right-2.5 z-10 flex items-center gap-1 transition-opacity duration-200 ${c?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:c?v.jsxs(v.Fragment,{children:[v.jsx("button",{onClick:b,className:"w-6 h-6 rounded-full bg-red-500/80 backdrop-blur-sm border border-red-400/60 flex items-center justify-center hover:bg-red-500 transition-all",title:"Confirm delete",children:v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.jsx("button",{onClick:h,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-white/20 transition-all",title:"Cancel",children:v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:v.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):v.jsx("button",{onClick:f,className:"w-6 h-6 rounded-full bg-black/40 backdrop-blur-sm border border-white/20 flex items-center justify-center hover:bg-red-500/80 hover:border-red-400/60 transition-all",title:"Delete stash",children:v.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"white",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})})]}),v.jsx("div",{className:"p-2.5",children:v.jsxs("p",{className:"text-[11px] text-[var(--stashes-text-muted)] line-clamp-2 leading-relaxed",children:[v.jsxs("span",{className:"font-semibold text-[var(--stashes-text)]",children:["#",e.number]})," ",e.prompt]})})]})}function OT({onDelete:e,className:a=""}){const[r,l]=F.useState(!1),s=F.useRef(null);F.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);function u(g){g.stopPropagation(),l(!0),s.current=setTimeout(()=>l(!1),5e3)}function c(g){g.stopPropagation(),s.current&&clearTimeout(s.current),l(!1),e()}function p(g){g.stopPropagation(),s.current&&clearTimeout(s.current),l(!1)}return r?v.jsxs("div",{className:`flex items-center gap-1 ${a}`,children:[v.jsx("button",{onClick:c,className:"text-red-400 hover:text-red-300 transition-colors p-1 rounded",title:"Confirm delete",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.jsx("button",{onClick:p,className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors p-1 rounded",title:"Cancel",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 10 10",fill:"none",children:v.jsx("path",{d:"M2 2L8 8M8 2L2 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):v.jsx("button",{onClick:u,className:`text-[var(--stashes-text-muted)] hover:text-red-400 transition-all p-1 rounded ${a}`,title:"Delete",children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2 3H10M4 3V2H8V3M5 5V9M7 5V9M3 3V10.5C3 10.776 3.224 11 3.5 11H8.5C8.776 11 9 10.776 9 10.5V3",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})})}const dv=8,pv=5;function nN(){const e=sl(),{chats:a,stashes:r,projectName:l,loadChats:s,newChat:u,deleteChat:c,deleteStash:p}=bt(),[g,f]=F.useState(new Set),[b,h]=F.useState(new Set),[E,S]=F.useState(!1),T=[...r.values()].filter($=>$.status==="ready").sort(($,K)=>new Date(K.createdAt).getTime()-new Date($.createdAt).getTime()),_=T.slice(0,dv),A=a.slice(0,pv),k=g.size>0||b.size>0;F.useEffect(()=>{s()},[s]);const C=F.useCallback($=>{f(K=>{const ne=new Set(K);return ne.has($)?ne.delete($):ne.add($),ne})},[]),I=F.useCallback($=>{h(K=>{const ne=new Set(K);return ne.has($)?ne.delete($):ne.add($),ne})},[]);function P(){f(new Set),h(new Set),S(!1)}async function q(){const $=await u();e(`/chat/${$}`)}async function U($){const K=await u([$.id]),ne=bt.getState();ne.toggleStashSelection($.id),ne.interactStash($.id),e(`/chat/${K}`)}async function W(){const $=[...g],K=await u($),ne=bt.getState();for(const re of $)ne.toggleStashSelection(re);P(),e(`/chat/${K}`)}function ae(){for(const $ of g)p($);for(const $ of b)c($);P()}function le($){const K=new Date($),re=new Date().getTime()-K.getTime(),te=Math.floor(re/6e4);if(te<1)return"just now";if(te<60)return`${te}m ago`;const z=Math.floor(te/60);if(z<24)return`${z}h ago`;const ee=Math.floor(z/24);return ee<7?`${ee}d ago`:K.toLocaleDateString()}function M(){const $=[];return g.size>0&&$.push(`${g.size} stash${g.size!==1?"es":""}`),b.size>0&&$.push(`${b.size} chat${b.size!==1?"s":""}`),$.join(", ")+" selected"}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:l??"Stashes"}),v.jsx("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:"Design explorations for your app"})]}),v.jsx("div",{onClick:q,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),T.length>0&&v.jsxs("div",{className:"mb-10",style:{animation:"fadeIn 0.5s ease-out 0.1s both"},children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Stashes (",T.length,")"]}),T.length>dv&&v.jsx(Br,{to:"/stashes",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),v.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:_.map(($,K)=>v.jsx(IT,{stash:$,index:K,isSelected:g.has($.id),onSelect:C,onClick:U,onDelete:ne=>{p(ne),f(re=>{const te=new Set(re);return te.delete(ne),te})}},$.id))})]}),a.length>0&&v.jsxs("div",{style:{animation:"fadeIn 0.5s ease-out 0.2s both"},children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("h2",{className:"text-sm font-semibold text-[var(--stashes-text-muted)] uppercase tracking-wider",children:["Conversations (",a.length,")"]}),a.length>pv&&v.jsx(Br,{to:"/chats",className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-primary)] transition-colors",children:"View all →"})]}),v.jsx("div",{className:"space-y-2",children:A.map(($,K)=>{const ne=b.has($.id);return v.jsxs("div",{onClick:()=>e(`/chat/${$.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${ne?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${K*40}ms`},children:[v.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${ne?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:re=>{re.stopPropagation(),I($.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${ne?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:ne&&v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:"min-w-0 flex-1",children:v.jsx("div",{className:"font-semibold text-sm truncate",children:$.title})}),v.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[v.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:le($.updatedAt)}),v.jsx(OT,{onDelete:()=>c($.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},$.id)})})]})]}),k&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsx("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:M()}),v.jsx("button",{onClick:P,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),g.size>0&&b.size===0&&v.jsx("button",{onClick:W,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),E?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:ae,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>S(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>S(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function aN(){const e=sl(),{stashes:a,projectName:r,loadChats:l,newChat:s,deleteStash:u}=bt(),[c,p]=F.useState(new Set),[g,f]=F.useState(!1),b=[...a.values()].filter(_=>_.status==="ready").sort((_,A)=>new Date(A.createdAt).getTime()-new Date(_.createdAt).getTime());F.useEffect(()=>{l()},[l]);const h=F.useCallback(_=>{p(A=>{const k=new Set(A);return k.has(_)?k.delete(_):k.add(_),k})},[]);async function E(_){const A=await s([_.id]),k=bt.getState();k.toggleStashSelection(_.id),k.interactStash(_.id),e(`/chat/${A}`)}async function S(){const _=[...c],A=await s(_),k=bt.getState();for(const C of _)k.toggleStashSelection(C);p(new Set),e(`/chat/${A}`)}function T(){for(const _ of c)u(_);p(new Set),f(!1)}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Stashes"}),v.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[b.length," design exploration",b.length!==1?"s":""]})]}),b.length>0?v.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:b.map((_,A)=>v.jsx(IT,{stash:_,index:A,isSelected:c.has(_.id),onSelect:h,onClick:E,onDelete:k=>{u(k),p(C=>{const I=new Set(C);return I.delete(k),I})}},_.id))}):v.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No stashes yet. Start a conversation to generate design explorations."})]}),c.size>0&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," stash",c.size!==1?"es":""," selected"]}),v.jsx("button",{onClick:()=>{p(new Set),f(!1)},className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),v.jsx("button",{onClick:S,className:"bg-[var(--stashes-primary)] hover:brightness-110 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Start chat"}),g?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:T,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>f(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>f(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function rN(e){const a=new Date(e),l=new Date().getTime()-a.getTime(),s=Math.floor(l/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const u=Math.floor(s/60);if(u<24)return`${u}h ago`;const c=Math.floor(u/24);return c<7?`${c}d ago`:a.toLocaleDateString()}function iN(){const e=sl(),{chats:a,projectName:r,loadChats:l,newChat:s,deleteChat:u}=bt(),[c,p]=F.useState(new Set),[g,f]=F.useState(!1);F.useEffect(()=>{l()},[l]);const b=F.useCallback(T=>{p(_=>{const A=new Set(_);return A.has(T)?A.delete(T):A.add(T),A})},[]);function h(){p(new Set),f(!1)}function E(){for(const T of c)u(T);h()}async function S(){const T=await s();e(`/chat/${T}`)}return v.jsxs("div",{className:"min-h-screen bg-[var(--stashes-bg)] p-6 md:p-10 lg:p-12",children:[v.jsxs("div",{className:"max-w-5xl mx-auto",children:[v.jsxs("div",{className:"mb-8",style:{animation:"fadeIn 0.4s ease-out"},children:[v.jsxs(Br,{to:"/",className:"text-sm text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors mb-3 inline-flex items-center gap-1.5",children:[v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M10 12L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),r??"Home"]}),v.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"All Conversations"}),v.jsxs("p",{className:"text-[var(--stashes-text-muted)] mt-1.5 text-sm",children:[a.length," conversation",a.length!==1?"s":""]})]}),v.jsx("div",{onClick:S,className:"mb-8 border-2 border-dashed border-[var(--stashes-border)] rounded-xl cursor-pointer hover:border-[var(--stashes-primary)] hover:bg-[var(--stashes-primary-dim)] transition-all duration-200 flex items-center justify-center py-5 group",style:{animation:"slideUp 0.4s ease-out both"},children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"w-6 h-6 rounded-full border-2 border-[var(--stashes-border)] group-hover:border-[var(--stashes-primary)] flex items-center justify-center transition-colors",children:v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-primary)] text-sm leading-none transition-colors",children:"+"})}),v.jsx("span",{className:"text-[var(--stashes-text-muted)] group-hover:text-[var(--stashes-text)] text-sm font-medium transition-colors",children:"New conversation"})]})}),a.length>0?v.jsx("div",{className:"space-y-2",children:a.map((T,_)=>{const A=c.has(T.id);return v.jsxs("div",{onClick:()=>e(`/chat/${T.id}`),className:`bg-[var(--stashes-surface)] border-2 rounded-xl px-5 py-4 cursor-pointer transition-all duration-200 hover:-translate-y-0.5 stash-shadow group flex items-center justify-between ${A?"border-[var(--stashes-primary)] ring-1 ring-[var(--stashes-ring)]":"border-[var(--stashes-border)] hover:border-[var(--stashes-border-hover)]"}`,style:{animation:"slideUp 0.4s ease-out both",animationDelay:`${_*40}ms`},children:[v.jsx("div",{className:`flex-shrink-0 mr-3 transition-opacity duration-200 ${A?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:v.jsx("button",{onClick:k=>{k.stopPropagation(),b(T.id)},className:`w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all ${A?"bg-[var(--stashes-primary)] border-[var(--stashes-primary)]":"border-[var(--stashes-border-hover)] hover:border-[var(--stashes-text-muted)]"}`,children:A&&v.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:v.jsx("path",{d:"M2.5 6L5 8.5L9.5 3.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),v.jsx("div",{className:"min-w-0 flex-1",children:v.jsx("div",{className:"font-semibold text-sm truncate",children:T.title})}),v.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 ml-4",children:[v.jsx("span",{className:"text-[11px] text-[var(--stashes-text-muted)] tabular-nums",children:rN(T.updatedAt)}),v.jsx(OT,{onDelete:()=>u(T.id),className:"opacity-0 group-hover:opacity-100 focus-within:opacity-100"})]})]},T.id)})}):v.jsx("div",{className:"text-center py-16 text-[var(--stashes-text-muted)] text-sm",children:"No conversations yet. Start one to begin designing."})]}),c.size>0&&v.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",style:{animation:"slideUp 0.25s ease-out"},children:v.jsxs("div",{className:"bg-[var(--stashes-surface)] border border-[var(--stashes-border)] rounded-xl px-5 py-3 shadow-2xl flex items-center gap-4",children:[v.jsxs("span",{className:"text-sm text-[var(--stashes-text-muted)]",children:[c.size," chat",c.size!==1?"s":""," selected"]}),v.jsx("button",{onClick:h,className:"text-xs text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] transition-colors",children:"Clear"}),g?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:E,className:"bg-red-500 hover:bg-red-600 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-all",children:"Confirm"}),v.jsx("button",{onClick:()=>f(!1),className:"text-[var(--stashes-text-muted)] hover:text-[var(--stashes-text)] text-sm px-2 py-1.5 transition-colors",children:"Cancel"})]}):v.jsx("button",{onClick:()=>f(!0),className:"text-red-400 hover:text-red-300 text-sm font-medium px-4 py-1.5 rounded-lg border border-red-400/30 hover:border-red-400/50 transition-all",children:"Delete"})]})})]})}function fv(e){const a=[],r=String(e||"");let l=r.indexOf(","),s=0,u=!1;for(;!u;){l===-1&&(l=r.length,u=!0);const c=r.slice(s,l).trim();(c||!u)&&a.push(c),s=l+1,l=r.indexOf(",",s)}return a}function lN(e,a){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uN={};function gv(e,a){return(uN.jsx?sN:oN).test(e)}const cN=/[ \t\n\f\r]/g;function dN(e){return typeof e=="object"?e.type==="text"?mv(e.value):!1:mv(e)}function mv(e){return e.replace(cN,"")===""}class cl{constructor(a,r,l){this.normal=r,this.property=a,l&&(this.space=l)}}cl.prototype.normal={};cl.prototype.property={};cl.prototype.space=void 0;function LT(e,a){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new cl(r,l,a)}function tl(e){return e.toLowerCase()}class Ft{constructor(a,r){this.attribute=r,this.property=a}}Ft.prototype.attribute="";Ft.prototype.booleanish=!1;Ft.prototype.boolean=!1;Ft.prototype.commaOrSpaceSeparated=!1;Ft.prototype.commaSeparated=!1;Ft.prototype.defined=!1;Ft.prototype.mustUseProperty=!1;Ft.prototype.number=!1;Ft.prototype.overloadedBoolean=!1;Ft.prototype.property="";Ft.prototype.spaceSeparated=!1;Ft.prototype.space=void 0;let pN=0;const Te=$a(),lt=$a(),cd=$a(),ie=$a(),Ye=$a(),Ur=$a(),Yt=$a();function $a(){return 2**++pN}const dd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:Ur,number:ie,overloadedBoolean:cd,spaceSeparated:Ye},Symbol.toStringTag,{value:"Module"})),Pc=Object.keys(dd);class Ld extends Ft{constructor(a,r,l,s){let u=-1;if(super(a,r),hv(this,"space",s),typeof l=="number")for(;++u<Pc.length;){const c=Pc[u];hv(this,Pc[u],(l&dd[c])===dd[c])}}}Ld.prototype.defined=!0;function hv(e,a,r){r&&(e[a]=r)}function Gr(e){const a={},r={};for(const[l,s]of Object.entries(e.properties)){const u=new Ld(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,r[tl(l)]=l,r[tl(u.attribute)]=l}return new cl(a,r,e.space)}const DT=Gr({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:Ye,ariaCurrent:null,ariaDescribedBy:Ye,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ye,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ye,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ye,ariaLevel:ie,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ye,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ye,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:lt,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function MT(e,a){return a in e?e[a]:a}function UT(e,a){return MT(e,a.toLowerCase())}const fN=Gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ur,acceptCharset:Ye,accessKey:Ye,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Ye,autoFocus:Te,autoPlay:Te,blocking:Ye,capture:null,charSet:null,checked:Te,cite:null,className:Ye,cols:ie,colSpan:null,content:null,contentEditable:lt,controls:Te,controlsList:Ye,coords:ie|Ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:cd,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Ye,height:ie,hidden:cd,high:ie,href:null,hrefLang:null,htmlFor:Ye,httpEquiv:Ye,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Ye,itemRef:Ye,itemScope:Te,itemType:Ye,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:ie,pattern:null,ping:Ye,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Ye,required:Te,reversed:Te,rows:ie,rowSpan:ie,sandbox:Ye,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:lt,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ye,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:UT}),gN=Gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:Ye,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ur,g2:Ur,glyphName:Ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ye,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:MT}),BT=Gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),FT=Gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:UT}),zT=Gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),mN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},hN=/[A-Z]/g,bv=/-[a-z]/g,bN=/^data[-\w.:]+$/i;function jT(e,a){const r=tl(a);let l=a,s=Ft;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bN.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(bv,EN);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!bv.test(u)){let c=u.replace(hN,yN);c.charAt(0)!=="-"&&(c="-"+c),a="data"+c}}s=Ld}return new s(l,a)}function yN(e){return"-"+e.toLowerCase()}function EN(e){return e.charAt(1).toUpperCase()}const GT=LT([DT,fN,BT,FT,zT],"html"),is=LT([DT,gN,BT,FT,zT],"svg");function yv(e){const a=String(e||"").trim();return a?a.split(/[ \t\n\r\f]+/g):[]}function SN(e){return e.join(" ").trim()}var Or={},qc,Ev;function vN(){if(Ev)return qc;Ev=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,g=`
61
61
  `,f="/",b="*",h="",E="comment",S="declaration";function T(A,k){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];k=k||{};var C=1,I=1;function P(re){var te=re.match(a);te&&(C+=te.length);var z=re.lastIndexOf(g);I=~z?re.length-z:I+re.length}function q(){var re={line:C,column:I};return function(te){return te.position=new U(re),le(),te}}function U(re){this.start=re,this.end={line:C,column:I},this.source=k.source}U.prototype.content=A;function W(re){var te=new Error(k.source+":"+C+":"+I+": "+re);if(te.reason=re,te.filename=k.source,te.line=C,te.column=I,te.source=A,!k.silent)throw te}function ae(re){var te=re.exec(A);if(te){var z=te[0];return P(z),A=A.slice(z.length),te}}function le(){ae(r)}function M(re){var te;for(re=re||[];te=$();)te!==!1&&re.push(te);return re}function $(){var re=q();if(!(f!=A.charAt(0)||b!=A.charAt(1))){for(var te=2;h!=A.charAt(te)&&(b!=A.charAt(te)||f!=A.charAt(te+1));)++te;if(te+=2,h===A.charAt(te-1))return W("End of comment missing");var z=A.slice(2,te-2);return I+=2,P(z),A=A.slice(te),I+=2,re({type:E,comment:z})}}function K(){var re=q(),te=ae(l);if(te){if($(),!ae(s))return W("property missing ':'");var z=ae(u),ee=re({type:S,property:_(te[0].replace(e,h)),value:z?_(z[0].replace(e,h)):h});return ae(c),ee}}function ne(){var re=[];M(re);for(var te;te=K();)te!==!1&&(re.push(te),M(re));return re}return le(),ne()}function _(A){return A?A.replace(p,h):h}return qc=T,qc}var Sv;function TN(){if(Sv)return Or;Sv=1;var e=Or&&Or.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Or,"__esModule",{value:!0}),Or.default=r;const a=e(vN());function r(l,s){let u=null;if(!l||typeof l!="string")return u;const c=(0,a.default)(l),p=typeof s=="function";return c.forEach(g=>{if(g.type!=="declaration")return;const{property:f,value:b}=g;p?s(f,b,g):b&&(u=u||{},u[f]=b)}),u}return Or}var qi={},vv;function xN(){if(vv)return qi;vv=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,u=function(f){return!f||r.test(f)||e.test(f)},c=function(f,b){return b.toUpperCase()},p=function(f,b){return"".concat(b,"-")},g=function(f,b){return b===void 0&&(b={}),u(f)?f:(f=f.toLowerCase(),b.reactCompat?f=f.replace(s,p):f=f.replace(l,p),f.replace(a,c))};return qi.camelCase=g,qi}var Vi,Tv;function AN(){if(Tv)return Vi;Tv=1;var e=Vi&&Vi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},a=e(TN()),r=xN();function l(s,u){var c={};return!s||typeof s!="string"||(0,a.default)(s,function(p,g){p&&g&&(c[(0,r.camelCase)(p,u)]=g)}),c}return l.default=l,Vi=l,Vi}var wN=AN();const kN=wd(wN),$T=HT("end"),Dd=HT("start");function HT(e){return a;function a(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function _N(e){const a=Dd(e),r=$T(e);if(a&&r)return{start:a,end:r}}function Zi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xv(e.position):"start"in e||"end"in e?xv(e):"line"in e||"column"in e?pd(e):""}function pd(e){return Av(e&&e.line)+":"+Av(e&&e.column)}function xv(e){return pd(e&&e.start)+"-"+pd(e&&e.end)}function Av(e){return e&&typeof e=="number"?e:1}class vt extends Error{constructor(a,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let s="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof a=="string"?s=a:!u.cause&&a&&(c=!0,s=a.message,u.cause=a),!u.ruleId&&!u.source&&typeof l=="string"){const g=l.indexOf(":");g===-1?u.ruleId=l:(u.source=l.slice(0,g),u.ruleId=l.slice(g+1))}if(!u.place&&u.ancestors&&u.ancestors){const g=u.ancestors[u.ancestors.length-1];g&&(u.place=g.position)}const p=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=p?p.line:void 0,this.name=Zi(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const Md={}.hasOwnProperty,NN=new Map,RN=/[A-Z]/g,CN=new Set(["table","tbody","thead","tfoot","tr"]),IN=new Set(["td","th"]),PT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ON(e,a){if(!a||a.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=a.filePath||void 0;let l;if(a.development){if(typeof a.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=jN(r,a.jsxDEV)}else{if(typeof a.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof a.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=zN(r,a.jsx,a.jsxs)}const s={Fragment:a.Fragment,ancestors:[],components:a.components||{},create:l,elementAttributeNameCase:a.elementAttributeNameCase||"react",evaluater:a.createEvaluater?a.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:a.ignoreInvalidStyle||!1,passKeys:a.passKeys!==!1,passNode:a.passNode||!1,schema:a.space==="svg"?is:GT,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},u=qT(s,e,void 0);return u&&typeof u!="string"?u:s.create(e,s.Fragment,{children:u||void 0},void 0)}function qT(e,a,r){if(a.type==="element")return LN(e,a,r);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return DN(e,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return UN(e,a,r);if(a.type==="mdxjsEsm")return MN(e,a);if(a.type==="root")return BN(e,a,r);if(a.type==="text")return FN(e,a)}function LN(e,a,r){const l=e.schema;let s=l;a.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=is,e.schema=s),e.ancestors.push(a);const u=YT(e,a.tagName,!1),c=GN(e,a);let p=Bd(e,a);return CN.has(a.tagName)&&(p=p.filter(function(g){return typeof g=="string"?!dN(g):!0})),VT(e,c,u,a),Ud(c,p),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function DN(e,a){if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}nl(e,a.position)}function MN(e,a){if(a.data&&a.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(a.data.estree);nl(e,a.position)}function UN(e,a,r){const l=e.schema;let s=l;a.name==="svg"&&l.space==="html"&&(s=is,e.schema=s),e.ancestors.push(a);const u=a.name===null?e.Fragment:YT(e,a.name,!0),c=$N(e,a),p=Bd(e,a);return VT(e,c,u,a),Ud(c,p),e.ancestors.pop(),e.schema=l,e.create(a,u,c,r)}function BN(e,a,r){const l={};return Ud(l,Bd(e,a)),e.create(a,e.Fragment,l,r)}function FN(e,a){return a.value}function VT(e,a,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(a.node=l)}function Ud(e,a){if(a.length>0){const r=a.length>1?a:a[0];r&&(e.children=r)}}function zN(e,a,r){return l;function l(s,u,c,p){const f=Array.isArray(c.children)?r:a;return p?f(u,c,p):f(u,c)}}function jN(e,a){return r;function r(l,s,u,c){const p=Array.isArray(u.children),g=Dd(l);return a(s,u,c,p,{columnNumber:g?g.column-1:void 0,fileName:e,lineNumber:g?g.line:void 0},void 0)}}function GN(e,a){const r={};let l,s;for(s in a.properties)if(s!=="children"&&Md.call(a.properties,s)){const u=HN(e,s,a.properties[s]);if(u){const[c,p]=u;e.tableCellAlignToStyle&&c==="align"&&typeof p=="string"&&IN.has(a.tagName)?l=p:r[c]=p}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function $N(e,a){const r={};for(const l of a.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const c=u.expression;c.type;const p=c.properties[0];p.type,Object.assign(r,e.evaluater.evaluateExpression(p.argument))}else nl(e,a.position);else{const s=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const p=l.value.data.estree.body[0];p.type,u=e.evaluater.evaluateExpression(p.expression)}else nl(e,a.position);else u=l.value===null?!0:l.value;r[s]=u}return r}function Bd(e,a){const r=[];let l=-1;const s=e.passKeys?new Map:NN;for(;++l<a.children.length;){const u=a.children[l];let c;if(e.passKeys){const g=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(g){const f=s.get(g)||0;c=g+"-"+f,s.set(g,f+1)}}const p=qT(e,u,c);p!==void 0&&r.push(p)}return r}function HN(e,a,r){const l=jT(e.schema,a);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?lN(r):SN(r)),l.property==="style"){let s=typeof r=="object"?r:PN(e,String(r));return e.stylePropertyNameCase==="css"&&(s=qN(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&l.space?mN[l.property]||l.property:l.attribute,r]}}function PN(e,a){try{return kN(a,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,s=new vt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=PT+"#cannot-parse-style-attribute",s}}function YT(e,a,r){let l;if(!r)l={type:"Literal",value:a};else if(a.includes(".")){const s=a.split(".");let u=-1,c;for(;++u<s.length;){const p=gv(s[u])?{type:"Identifier",name:s[u]}:{type:"Literal",value:s[u]};c=c?{type:"MemberExpression",object:c,property:p,computed:!!(u&&p.type==="Literal"),optional:!1}:p}l=c}else l=gv(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(l.type==="Literal"){const s=l.value;return Md.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(l);nl(e)}function nl(e,a){const r=new vt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:a,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=PT+"#cannot-handle-mdx-estrees-without-createevaluater",r}function qN(e){const a={};let r;for(r in e)Md.call(e,r)&&(a[VN(r)]=e[r]);return a}function VN(e){let a=e.replace(RN,YN);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function YN(e){return"-"+e.toLowerCase()}const Vc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WN={};function Fd(e,a){const r=WN,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return WT(e,l,s)}function WT(e,a,r){if(XN(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(a&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wv(e.children,a,r)}return Array.isArray(e)?wv(e,a,r):""}function wv(e,a,r){const l=[];let s=-1;for(;++s<e.length;)l[s]=WT(e[s],a,r);return l.join("")}function XN(e){return!!(e&&typeof e=="object")}const kv=document.createElement("i");function al(e){const a="&"+e+";";kv.innerHTML=a;const r=kv.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===a?!1:r}function Wt(e,a,r,l){const s=e.length;let u=0,c;if(a<0?a=-a>s?0:s+a:a=a>s?s:a,r=r>0?r:0,l.length<1e4)c=Array.from(l),c.unshift(a,r),e.splice(...c);else for(r&&e.splice(a,r);u<l.length;)c=l.slice(u,u+1e4),c.unshift(a,0),e.splice(...c),u+=1e4,a+=1e4}function ln(e,a){return e.length>0?(Wt(e,e.length,0,a),e):a}const _v={}.hasOwnProperty;function XT(e){const a={};let r=-1;for(;++r<e.length;)ZN(a,e[r]);return a}function ZN(e,a){let r;for(r in a){const s=(_v.call(e,r)?e[r]:void 0)||(e[r]={}),u=a[r];let c;if(u)for(c in u){_v.call(s,c)||(s[c]=[]);const p=u[c];KN(s[c],Array.isArray(p)?p:p?[p]:[])}}}function KN(e,a){let r=-1;const l=[];for(;++r<a.length;)(a[r].add==="after"?e:l).push(a[r]);Wt(e,0,0,l)}function ZT(e,a){const r=Number.parseInt(e,a);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function gn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _t=va(/[A-Za-z]/),St=va(/[\dA-Za-z]/),QN=va(/[#-'*+\--9=?A-Z^-~]/);function Jo(e){return e!==null&&(e<32||e===127)}const fd=va(/\d/),JN=va(/[\dA-Fa-f]/),eR=va(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Ve(e){return e!==null&&(e<0||e===32)}function _e(e){return e===-2||e===-1||e===32}const ls=va(new RegExp("\\p{P}|\\p{S}","u")),Ga=va(/\s/);function va(e){return a;function a(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $r(e){const a=[];let r=-1,l=0,s=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&St(e.charCodeAt(r+1))&&St(e.charCodeAt(r+2)))s=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const p=e.charCodeAt(r+1);u<56320&&p>56319&&p<57344?(c=String.fromCharCode(u,p),s=1):c="�"}else c=String.fromCharCode(u);c&&(a.push(e.slice(l,r),encodeURIComponent(c)),l=r+s+1,c=""),s&&(r+=s,s=0)}return a.join("")+e.slice(l)}function Oe(e,a,r,l){const s=l?l-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(g){return _e(g)?(e.enter(r),p(g)):a(g)}function p(g){return _e(g)&&u++<s?(e.consume(g),p):(e.exit(r),a(g))}}const tR={tokenize:nR};function nR(e){const a=e.attempt(this.parser.constructs.contentInitial,l,s);let r;return a;function l(p){if(p===null){e.consume(p);return}return e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Oe(e,a,"linePrefix")}function s(p){return e.enter("paragraph"),u(p)}function u(p){const g=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=g),r=g,c(p)}function c(p){if(p===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(p);return}return me(p)?(e.consume(p),e.exit("chunkText"),u):(e.consume(p),c)}}const aR={tokenize:rR},Nv={tokenize:iR};function rR(e){const a=this,r=[];let l=0,s,u,c;return p;function p(I){if(l<r.length){const P=r[l];return a.containerState=P[1],e.attempt(P[0].continuation,g,f)(I)}return f(I)}function g(I){if(l++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,s&&C();const P=a.events.length;let q=P,U;for(;q--;)if(a.events[q][0]==="exit"&&a.events[q][1].type==="chunkFlow"){U=a.events[q][1].end;break}k(l);let W=P;for(;W<a.events.length;)a.events[W][1].end={...U},W++;return Wt(a.events,q+1,0,a.events.slice(P)),a.events.length=W,f(I)}return p(I)}function f(I){if(l===r.length){if(!s)return E(I);if(s.currentConstruct&&s.currentConstruct.concrete)return T(I);a.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(Nv,b,h)(I)}function b(I){return s&&C(),k(l),E(I)}function h(I){return a.parser.lazy[a.now().line]=l!==r.length,c=a.now().offset,T(I)}function E(I){return a.containerState={},e.attempt(Nv,S,T)(I)}function S(I){return l++,r.push([a.currentConstruct,a.containerState]),E(I)}function T(I){if(I===null){s&&C(),k(0),e.consume(I);return}return s=s||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:u}),_(I)}function _(I){if(I===null){A(e.exit("chunkFlow"),!0),k(0),e.consume(I);return}return me(I)?(e.consume(I),A(e.exit("chunkFlow")),l=0,a.interrupt=void 0,p):(e.consume(I),_)}function A(I,P){const q=a.sliceStream(I);if(P&&q.push(null),I.previous=u,u&&(u.next=I),u=I,s.defineSkip(I.start),s.write(q),a.parser.lazy[I.start.line]){let U=s.events.length;for(;U--;)if(s.events[U][1].start.offset<c&&(!s.events[U][1].end||s.events[U][1].end.offset>c))return;const W=a.events.length;let ae=W,le,M;for(;ae--;)if(a.events[ae][0]==="exit"&&a.events[ae][1].type==="chunkFlow"){if(le){M=a.events[ae][1].end;break}le=!0}for(k(l),U=W;U<a.events.length;)a.events[U][1].end={...M},U++;Wt(a.events,ae+1,0,a.events.slice(W)),a.events.length=U}}function k(I){let P=r.length;for(;P-- >I;){const q=r[P];a.containerState=q[1],q[0].exit.call(a,e)}r.length=I}function C(){s.write([null]),u=void 0,s=void 0,a.containerState._closeFlow=void 0}}function iR(e,a,r){return Oe(e,e.attempt(this.parser.constructs.document,a,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fr(e){if(e===null||Ve(e)||Ga(e))return 1;if(ls(e))return 2}function os(e,a,r){const l=[];let s=-1;for(;++s<e.length;){const u=e[s].resolveAll;u&&!l.includes(u)&&(a=u(a,r),l.push(u))}return a}const gd={name:"attention",resolveAll:lR,tokenize:oR};function lR(e,a){let r=-1,l,s,u,c,p,g,f,b;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&a.sliceSerialize(e[l][1]).charCodeAt(0)===a.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;g=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[l][1].end},E={...e[r][1].start};Rv(h,-g),Rv(E,g),c={type:g>1?"strongSequence":"emphasisSequence",start:h,end:{...e[l][1].end}},p={type:g>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:E},u={type:g>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},s={type:g>1?"strong":"emphasis",start:{...c.start},end:{...p.end}},e[l][1].end={...c.start},e[r][1].start={...p.end},f=[],e[l][1].end.offset-e[l][1].start.offset&&(f=ln(f,[["enter",e[l][1],a],["exit",e[l][1],a]])),f=ln(f,[["enter",s,a],["enter",c,a],["exit",c,a],["enter",u,a]]),f=ln(f,os(a.parser.constructs.insideSpan.null,e.slice(l+1,r),a)),f=ln(f,[["exit",u,a],["enter",p,a],["exit",p,a],["exit",s,a]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,f=ln(f,[["enter",e[r][1],a],["exit",e[r][1],a]])):b=0,Wt(e,l-1,r-l+3,f),r=l+f.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function oR(e,a){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,s=Fr(l);let u;return c;function c(g){return u=g,e.enter("attentionSequence"),p(g)}function p(g){if(g===u)return e.consume(g),p;const f=e.exit("attentionSequence"),b=Fr(g),h=!b||b===2&&s||r.includes(g),E=!s||s===2&&b||r.includes(l);return f._open=!!(u===42?h:h&&(s||!E)),f._close=!!(u===42?E:E&&(b||!h)),a(g)}}function Rv(e,a){e.column+=a,e.offset+=a,e._bufferIndex+=a}const sR={name:"autolink",tokenize:uR};function uR(e,a,r){let l=0;return s;function s(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(S){return _t(S)?(e.consume(S),c):S===64?r(S):f(S)}function c(S){return S===43||S===45||S===46||St(S)?(l=1,p(S)):f(S)}function p(S){return S===58?(e.consume(S),l=0,g):(S===43||S===45||S===46||St(S))&&l++<32?(e.consume(S),p):(l=0,f(S))}function g(S){return S===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),a):S===null||S===32||S===60||Jo(S)?r(S):(e.consume(S),g)}function f(S){return S===64?(e.consume(S),b):QN(S)?(e.consume(S),f):r(S)}function b(S){return St(S)?h(S):r(S)}function h(S){return S===46?(e.consume(S),l=0,b):S===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),a):E(S)}function E(S){if((S===45||St(S))&&l++<63){const T=S===45?E:h;return e.consume(S),T}return r(S)}}const dl={partial:!0,tokenize:cR};function cR(e,a,r){return l;function l(u){return _e(u)?Oe(e,s,"linePrefix")(u):s(u)}function s(u){return u===null||me(u)?a(u):r(u)}}const KT={continuation:{tokenize:pR},exit:fR,name:"blockQuote",tokenize:dR};function dR(e,a,r){const l=this;return s;function s(c){if(c===62){const p=l.containerState;return p.open||(e.enter("blockQuote",{_container:!0}),p.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return _e(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),a):(e.exit("blockQuotePrefix"),a(c))}}function pR(e,a,r){const l=this;return s;function s(c){return _e(c)?Oe(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(KT,a,r)(c)}}function fR(e){e.exit("blockQuote")}const QT={name:"characterEscape",tokenize:gR};function gR(e,a,r){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),s}function s(u){return eR(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),a):r(u)}}const JT={name:"characterReference",tokenize:mR};function mR(e,a,r){const l=this;let s=0,u,c;return p;function p(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),g}function g(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,c=St,b(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=JN,b):(e.enter("characterReferenceValue"),u=7,c=fd,b(h))}function b(h){if(h===59&&s){const E=e.exit("characterReferenceValue");return c===St&&!al(l.sliceSerialize(E))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),a)}return c(h)&&s++<u?(e.consume(h),b):r(h)}}const Cv={partial:!0,tokenize:bR},Iv={concrete:!0,name:"codeFenced",tokenize:hR};function hR(e,a,r){const l=this,s={partial:!0,tokenize:q};let u=0,c=0,p;return g;function g(U){return f(U)}function f(U){const W=l.events[l.events.length-1];return u=W&&W[1].type==="linePrefix"?W[2].sliceSerialize(W[1],!0).length:0,p=U,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(U)}function b(U){return U===p?(c++,e.consume(U),b):c<3?r(U):(e.exit("codeFencedFenceSequence"),_e(U)?Oe(e,h,"whitespace")(U):h(U))}function h(U){return U===null||me(U)?(e.exit("codeFencedFence"),l.interrupt?a(U):e.check(Cv,_,P)(U)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),E(U))}function E(U){return U===null||me(U)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(U)):_e(U)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Oe(e,S,"whitespace")(U)):U===96&&U===p?r(U):(e.consume(U),E)}function S(U){return U===null||me(U)?h(U):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),T(U))}function T(U){return U===null||me(U)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(U)):U===96&&U===p?r(U):(e.consume(U),T)}function _(U){return e.attempt(s,P,A)(U)}function A(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),k}function k(U){return u>0&&_e(U)?Oe(e,C,"linePrefix",u+1)(U):C(U)}function C(U){return U===null||me(U)?e.check(Cv,_,P)(U):(e.enter("codeFlowValue"),I(U))}function I(U){return U===null||me(U)?(e.exit("codeFlowValue"),C(U)):(e.consume(U),I)}function P(U){return e.exit("codeFenced"),a(U)}function q(U,W,ae){let le=0;return M;function M(te){return U.enter("lineEnding"),U.consume(te),U.exit("lineEnding"),$}function $(te){return U.enter("codeFencedFence"),_e(te)?Oe(U,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):K(te)}function K(te){return te===p?(U.enter("codeFencedFenceSequence"),ne(te)):ae(te)}function ne(te){return te===p?(le++,U.consume(te),ne):le>=c?(U.exit("codeFencedFenceSequence"),_e(te)?Oe(U,re,"whitespace")(te):re(te)):ae(te)}function re(te){return te===null||me(te)?(U.exit("codeFencedFence"),W(te)):ae(te)}}}function bR(e,a,r){const l=this;return s;function s(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return l.parser.lazy[l.now().line]?r(c):a(c)}}const Yc={name:"codeIndented",tokenize:ER},yR={partial:!0,tokenize:SR};function ER(e,a,r){const l=this;return s;function s(f){return e.enter("codeIndented"),Oe(e,u,"linePrefix",5)(f)}function u(f){const b=l.events[l.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(f):r(f)}function c(f){return f===null?g(f):me(f)?e.attempt(yR,c,g)(f):(e.enter("codeFlowValue"),p(f))}function p(f){return f===null||me(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),p)}function g(f){return e.exit("codeIndented"),a(f)}}function SR(e,a,r){const l=this;return s;function s(c){return l.parser.lazy[l.now().line]?r(c):me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):Oe(e,u,"linePrefix",5)(c)}function u(c){const p=l.events[l.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(c):me(c)?s(c):r(c)}}const vR={name:"codeText",previous:xR,resolve:TR,tokenize:AR};function TR(e){let a=e.length-4,r=3,l,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[a][1].type==="lineEnding"||e[a][1].type==="space")){for(l=r;++l<a;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[a][1].type="codeTextPadding",r+=2,a-=2;break}}for(l=r-1,a++;++l<=a;)s===void 0?l!==a&&e[l][1].type!=="lineEnding"&&(s=l):(l===a||e[l][1].type==="lineEnding")&&(e[s][1].type="codeTextData",l!==s+2&&(e[s][1].end=e[l-1][1].end,e.splice(s+2,l-s-2),a-=l-s-2,l=s+2),s=void 0);return e}function xR(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function AR(e,a,r){let l=0,s,u;return c;function c(h){return e.enter("codeText"),e.enter("codeTextSequence"),p(h)}function p(h){return h===96?(e.consume(h),l++,p):(e.exit("codeTextSequence"),g(h))}function g(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),g):h===96?(u=e.enter("codeTextSequence"),s=0,b(h)):me(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),g):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||me(h)?(e.exit("codeTextData"),g(h)):(e.consume(h),f)}function b(h){return h===96?(e.consume(h),s++,b):s===l?(e.exit("codeTextSequence"),e.exit("codeText"),a(h)):(u.type="codeTextData",f(h))}}class wR{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,r){const l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(a,l):a>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(a,r,l){const s=r||0;this.setCursor(Math.trunc(a));const u=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return l&&Yi(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(a){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(a)}pushMany(a){this.setCursor(Number.POSITIVE_INFINITY),Yi(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),Yi(this.right,a.reverse())}setCursor(a){if(!(a===this.left.length||a>this.left.length&&this.right.length===0||a<0&&this.left.length===0))if(a<this.left.length){const r=this.left.splice(a,Number.POSITIVE_INFINITY);Yi(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);Yi(this.left,r.reverse())}}}function Yi(e,a){let r=0;if(a.length<1e4)e.push(...a);else for(;r<a.length;)e.push(...a.slice(r,r+1e4)),r+=1e4}function ex(e){const a={};let r=-1,l,s,u,c,p,g,f;const b=new wR(e);for(;++r<b.length;){for(;r in a;)r=a[r];if(l=b.get(r),r&&l[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(g=l[1]._tokenizer.events,u=0,u<g.length&&g[u][1].type==="lineEndingBlank"&&(u+=2),u<g.length&&g[u][1].type==="content"))for(;++u<g.length&&g[u][1].type!=="content";)g[u][1].type==="chunkText"&&(g[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(a,kR(b,r)),r=a[r],f=!0);else if(l[1]._container){for(u=r,s=void 0;u--;)if(c=b.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(b.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(l[1].end={...b.get(s)[1].start},p=b.slice(s,r),p.unshift(l),b.splice(s,r-s+1,p))}}return Wt(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!f}function kR(e,a){const r=e.get(a)[1],l=e.get(a)[2];let s=a-1;const u=[];let c=r._tokenizer;c||(c=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const p=c.events,g=[],f={};let b,h,E=-1,S=r,T=0,_=0;const A=[_];for(;S;){for(;e.get(++s)[1]!==S;);u.push(s),S._tokenizer||(b=l.sliceStream(S),S.next||b.push(null),h&&c.defineSkip(S.start),S._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),S._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),h=S,S=S.next}for(S=r;++E<p.length;)p[E][0]==="exit"&&p[E-1][0]==="enter"&&p[E][1].type===p[E-1][1].type&&p[E][1].start.line!==p[E][1].end.line&&(_=E+1,A.push(_),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(c.events=[],S?(S._tokenizer=void 0,S.previous=void 0):A.pop(),E=A.length;E--;){const k=p.slice(A[E],A[E+1]),C=u.pop();g.push([C,C+k.length-1]),e.splice(C,2,k)}for(g.reverse(),E=-1;++E<g.length;)f[T+g[E][0]]=T+g[E][1],T+=g[E][1]-g[E][0]-1;return f}const _R={resolve:RR,tokenize:CR},NR={partial:!0,tokenize:IR};function RR(e){return ex(e),e}function CR(e,a){let r;return l;function l(p){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(p)}function s(p){return p===null?u(p):me(p)?e.check(NR,c,u)(p):(e.consume(p),s)}function u(p){return e.exit("chunkContent"),e.exit("content"),a(p)}function c(p){return e.consume(p),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function IR(e,a,r){const l=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Oe(e,u,"linePrefix")}function u(c){if(c===null||me(c))return r(c);const p=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(c):e.interrupt(l.parser.constructs.flow,r,a)(c)}}function tx(e,a,r,l,s,u,c,p,g){const f=g||Number.POSITIVE_INFINITY;let b=0;return h;function h(k){return k===60?(e.enter(l),e.enter(s),e.enter(u),e.consume(k),e.exit(u),E):k===null||k===32||k===41||Jo(k)?r(k):(e.enter(l),e.enter(c),e.enter(p),e.enter("chunkString",{contentType:"string"}),_(k))}function E(k){return k===62?(e.enter(u),e.consume(k),e.exit(u),e.exit(s),e.exit(l),a):(e.enter(p),e.enter("chunkString",{contentType:"string"}),S(k))}function S(k){return k===62?(e.exit("chunkString"),e.exit(p),E(k)):k===null||k===60||me(k)?r(k):(e.consume(k),k===92?T:S)}function T(k){return k===60||k===62||k===92?(e.consume(k),S):S(k)}function _(k){return!b&&(k===null||k===41||Ve(k))?(e.exit("chunkString"),e.exit(p),e.exit(c),e.exit(l),a(k)):b<f&&k===40?(e.consume(k),b++,_):k===41?(e.consume(k),b--,_):k===null||k===32||k===40||Jo(k)?r(k):(e.consume(k),k===92?A:_)}function A(k){return k===40||k===41||k===92?(e.consume(k),_):_(k)}}function nx(e,a,r,l,s,u){const c=this;let p=0,g;return f;function f(S){return e.enter(l),e.enter(s),e.consume(S),e.exit(s),e.enter(u),b}function b(S){return p>999||S===null||S===91||S===93&&!g||S===94&&!p&&"_hiddenFootnoteSupport"in c.parser.constructs?r(S):S===93?(e.exit(u),e.enter(s),e.consume(S),e.exit(s),e.exit(l),a):me(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||S===91||S===93||me(S)||p++>999?(e.exit("chunkString"),b(S)):(e.consume(S),g||(g=!_e(S)),S===92?E:h)}function E(S){return S===91||S===92||S===93?(e.consume(S),p++,h):h(S)}}function ax(e,a,r,l,s,u){let c;return p;function p(E){return E===34||E===39||E===40?(e.enter(l),e.enter(s),e.consume(E),e.exit(s),c=E===40?41:E,g):r(E)}function g(E){return E===c?(e.enter(s),e.consume(E),e.exit(s),e.exit(l),a):(e.enter(u),f(E))}function f(E){return E===c?(e.exit(u),g(c)):E===null?r(E):me(E)?(e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),Oe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===c||E===null||me(E)?(e.exit("chunkString"),f(E)):(e.consume(E),E===92?h:b)}function h(E){return E===c||E===92?(e.consume(E),b):b(E)}}function Ki(e,a){let r;return l;function l(s){return me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,l):_e(s)?Oe(e,l,r?"linePrefix":"lineSuffix")(s):a(s)}}const OR={name:"definition",tokenize:DR},LR={partial:!0,tokenize:MR};function DR(e,a,r){const l=this;let s;return u;function u(S){return e.enter("definition"),c(S)}function c(S){return nx.call(l,e,p,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function p(S){return s=gn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),g):r(S)}function g(S){return Ve(S)?Ki(e,f)(S):f(S)}function f(S){return tx(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function b(S){return e.attempt(LR,h,h)(S)}function h(S){return _e(S)?Oe(e,E,"whitespace")(S):E(S)}function E(S){return S===null||me(S)?(e.exit("definition"),l.parser.defined.push(s),a(S)):r(S)}}function MR(e,a,r){return l;function l(p){return Ve(p)?Ki(e,s)(p):r(p)}function s(p){return ax(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function u(p){return _e(p)?Oe(e,c,"whitespace")(p):c(p)}function c(p){return p===null||me(p)?a(p):r(p)}}const UR={name:"hardBreakEscape",tokenize:BR};function BR(e,a,r){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),s}function s(u){return me(u)?(e.exit("hardBreakEscape"),a(u)):r(u)}}const FR={name:"headingAtx",resolve:zR,tokenize:jR};function zR(e,a){let r=e.length-2,l=3,s,u;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(s={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},u={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Wt(e,l,r-l+1,[["enter",s,a],["enter",u,a],["exit",u,a],["exit",s,a]])),e}function jR(e,a,r){let l=0;return s;function s(b){return e.enter("atxHeading"),u(b)}function u(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&l++<6?(e.consume(b),c):b===null||Ve(b)?(e.exit("atxHeadingSequence"),p(b)):r(b)}function p(b){return b===35?(e.enter("atxHeadingSequence"),g(b)):b===null||me(b)?(e.exit("atxHeading"),a(b)):_e(b)?Oe(e,p,"whitespace")(b):(e.enter("atxHeadingText"),f(b))}function g(b){return b===35?(e.consume(b),g):(e.exit("atxHeadingSequence"),p(b))}function f(b){return b===null||b===35||Ve(b)?(e.exit("atxHeadingText"),p(b)):(e.consume(b),f)}}const GR=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ov=["pre","script","style","textarea"],$R={concrete:!0,name:"htmlFlow",resolveTo:qR,tokenize:VR},HR={partial:!0,tokenize:WR},PR={partial:!0,tokenize:YR};function qR(e){let a=e.length;for(;a--&&!(e[a][0]==="enter"&&e[a][1].type==="htmlFlow"););return a>1&&e[a-2][1].type==="linePrefix"&&(e[a][1].start=e[a-2][1].start,e[a+1][1].start=e[a-2][1].start,e.splice(a-2,2)),e}function VR(e,a,r){const l=this;let s,u,c,p,g;return f;function f(N){return b(N)}function b(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),h}function h(N){return N===33?(e.consume(N),E):N===47?(e.consume(N),u=!0,_):N===63?(e.consume(N),s=3,l.interrupt?a:R):_t(N)?(e.consume(N),c=String.fromCharCode(N),A):r(N)}function E(N){return N===45?(e.consume(N),s=2,S):N===91?(e.consume(N),s=5,p=0,T):_t(N)?(e.consume(N),s=4,l.interrupt?a:R):r(N)}function S(N){return N===45?(e.consume(N),l.interrupt?a:R):r(N)}function T(N){const se="CDATA[";return N===se.charCodeAt(p++)?(e.consume(N),p===se.length?l.interrupt?a:K:T):r(N)}function _(N){return _t(N)?(e.consume(N),c=String.fromCharCode(N),A):r(N)}function A(N){if(N===null||N===47||N===62||Ve(N)){const se=N===47,ge=c.toLowerCase();return!se&&!u&&Ov.includes(ge)?(s=1,l.interrupt?a(N):K(N)):GR.includes(c.toLowerCase())?(s=6,se?(e.consume(N),k):l.interrupt?a(N):K(N)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(N):u?C(N):I(N))}return N===45||St(N)?(e.consume(N),c+=String.fromCharCode(N),A):r(N)}function k(N){return N===62?(e.consume(N),l.interrupt?a:K):r(N)}function C(N){return _e(N)?(e.consume(N),C):M(N)}function I(N){return N===47?(e.consume(N),M):N===58||N===95||_t(N)?(e.consume(N),P):_e(N)?(e.consume(N),I):M(N)}function P(N){return N===45||N===46||N===58||N===95||St(N)?(e.consume(N),P):q(N)}function q(N){return N===61?(e.consume(N),U):_e(N)?(e.consume(N),q):I(N)}function U(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),g=N,W):_e(N)?(e.consume(N),U):ae(N)}function W(N){return N===g?(e.consume(N),g=null,le):N===null||me(N)?r(N):(e.consume(N),W)}function ae(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Ve(N)?q(N):(e.consume(N),ae)}function le(N){return N===47||N===62||_e(N)?I(N):r(N)}function M(N){return N===62?(e.consume(N),$):r(N)}function $(N){return N===null||me(N)?K(N):_e(N)?(e.consume(N),$):r(N)}function K(N){return N===45&&s===2?(e.consume(N),z):N===60&&s===1?(e.consume(N),ee):N===62&&s===4?(e.consume(N),L):N===63&&s===3?(e.consume(N),R):N===93&&s===5?(e.consume(N),be):me(N)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(HR,Y,ne)(N)):N===null||me(N)?(e.exit("htmlFlowData"),ne(N)):(e.consume(N),K)}function ne(N){return e.check(PR,re,Y)(N)}function re(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),te}function te(N){return N===null||me(N)?ne(N):(e.enter("htmlFlowData"),K(N))}function z(N){return N===45?(e.consume(N),R):K(N)}function ee(N){return N===47?(e.consume(N),c="",ue):K(N)}function ue(N){if(N===62){const se=c.toLowerCase();return Ov.includes(se)?(e.consume(N),L):K(N)}return _t(N)&&c.length<8?(e.consume(N),c+=String.fromCharCode(N),ue):K(N)}function be(N){return N===93?(e.consume(N),R):K(N)}function R(N){return N===62?(e.consume(N),L):N===45&&s===2?(e.consume(N),R):K(N)}function L(N){return N===null||me(N)?(e.exit("htmlFlowData"),Y(N)):(e.consume(N),L)}function Y(N){return e.exit("htmlFlow"),a(N)}}function YR(e,a,r){const l=this;return s;function s(c){return me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return l.parser.lazy[l.now().line]?r(c):a(c)}}function WR(e,a,r){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(dl,a,r)}}const XR={name:"htmlText",tokenize:ZR};function ZR(e,a,r){const l=this;let s,u,c;return p;function p(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),g}function g(R){return R===33?(e.consume(R),f):R===47?(e.consume(R),q):R===63?(e.consume(R),I):_t(R)?(e.consume(R),ae):r(R)}function f(R){return R===45?(e.consume(R),b):R===91?(e.consume(R),u=0,T):_t(R)?(e.consume(R),C):r(R)}function b(R){return R===45?(e.consume(R),S):r(R)}function h(R){return R===null?r(R):R===45?(e.consume(R),E):me(R)?(c=h,ee(R)):(e.consume(R),h)}function E(R){return R===45?(e.consume(R),S):h(R)}function S(R){return R===62?z(R):R===45?E(R):h(R)}function T(R){const L="CDATA[";return R===L.charCodeAt(u++)?(e.consume(R),u===L.length?_:T):r(R)}function _(R){return R===null?r(R):R===93?(e.consume(R),A):me(R)?(c=_,ee(R)):(e.consume(R),_)}function A(R){return R===93?(e.consume(R),k):_(R)}function k(R){return R===62?z(R):R===93?(e.consume(R),k):_(R)}function C(R){return R===null||R===62?z(R):me(R)?(c=C,ee(R)):(e.consume(R),C)}function I(R){return R===null?r(R):R===63?(e.consume(R),P):me(R)?(c=I,ee(R)):(e.consume(R),I)}function P(R){return R===62?z(R):I(R)}function q(R){return _t(R)?(e.consume(R),U):r(R)}function U(R){return R===45||St(R)?(e.consume(R),U):W(R)}function W(R){return me(R)?(c=W,ee(R)):_e(R)?(e.consume(R),W):z(R)}function ae(R){return R===45||St(R)?(e.consume(R),ae):R===47||R===62||Ve(R)?le(R):r(R)}function le(R){return R===47?(e.consume(R),z):R===58||R===95||_t(R)?(e.consume(R),M):me(R)?(c=le,ee(R)):_e(R)?(e.consume(R),le):z(R)}function M(R){return R===45||R===46||R===58||R===95||St(R)?(e.consume(R),M):$(R)}function $(R){return R===61?(e.consume(R),K):me(R)?(c=$,ee(R)):_e(R)?(e.consume(R),$):le(R)}function K(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),s=R,ne):me(R)?(c=K,ee(R)):_e(R)?(e.consume(R),K):(e.consume(R),re)}function ne(R){return R===s?(e.consume(R),s=void 0,te):R===null?r(R):me(R)?(c=ne,ee(R)):(e.consume(R),ne)}function re(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||Ve(R)?le(R):(e.consume(R),re)}function te(R){return R===47||R===62||Ve(R)?le(R):r(R)}function z(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),a):r(R)}function ee(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ue}function ue(R){return _e(R)?Oe(e,be,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):be(R)}function be(R){return e.enter("htmlTextData"),c(R)}}const zd={name:"labelEnd",resolveAll:eC,resolveTo:tC,tokenize:nC},KR={tokenize:aC},QR={tokenize:rC},JR={tokenize:iC};function eC(e){let a=-1;const r=[];for(;++a<e.length;){const l=e[a][1];if(r.push(e[a]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const s=l.type==="labelImage"?4:2;l.type="data",a+=s}}return e.length!==r.length&&Wt(e,0,e.length,r),e}function tC(e,a){let r=e.length,l=0,s,u,c,p;for(;r--;)if(s=e[r][1],u){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(u=r,s.type!=="labelLink")){l=2;break}}else s.type==="labelEnd"&&(c=r);const g={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},b={type:"labelText",start:{...e[u+l+2][1].end},end:{...e[c-2][1].start}};return p=[["enter",g,a],["enter",f,a]],p=ln(p,e.slice(u+1,u+l+3)),p=ln(p,[["enter",b,a]]),p=ln(p,os(a.parser.constructs.insideSpan.null,e.slice(u+l+4,c-3),a)),p=ln(p,[["exit",b,a],e[c-2],e[c-1],["exit",f,a]]),p=ln(p,e.slice(c+1)),p=ln(p,[["exit",g,a]]),Wt(e,u,e.length,p),e}function nC(e,a,r){const l=this;let s=l.events.length,u,c;for(;s--;)if((l.events[s][1].type==="labelImage"||l.events[s][1].type==="labelLink")&&!l.events[s][1]._balanced){u=l.events[s][1];break}return p;function p(E){return u?u._inactive?h(E):(c=l.parser.defined.includes(gn(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(E),e.exit("labelMarker"),e.exit("labelEnd"),g):r(E)}function g(E){return E===40?e.attempt(KR,b,c?b:h)(E):E===91?e.attempt(QR,b,c?f:h)(E):c?b(E):h(E)}function f(E){return e.attempt(JR,b,h)(E)}function b(E){return a(E)}function h(E){return u._balanced=!0,r(E)}}function aC(e,a,r){return l;function l(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return Ve(h)?Ki(e,u)(h):u(h)}function u(h){return h===41?b(h):tx(e,c,p,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function c(h){return Ve(h)?Ki(e,g)(h):b(h)}function p(h){return r(h)}function g(h){return h===34||h===39||h===40?ax(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):b(h)}function f(h){return Ve(h)?Ki(e,b)(h):b(h)}function b(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),a):r(h)}}function rC(e,a,r){const l=this;return s;function s(p){return nx.call(l,e,u,c,"reference","referenceMarker","referenceString")(p)}function u(p){return l.parser.defined.includes(gn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?a(p):r(p)}function c(p){return r(p)}}function iC(e,a,r){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),s}function s(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),a):r(u)}}const lC={name:"labelStartImage",resolveAll:zd.resolveAll,tokenize:oC};function oC(e,a,r){const l=this;return s;function s(p){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(p),e.exit("labelImageMarker"),u}function u(p){return p===91?(e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelImage"),c):r(p)}function c(p){return p===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(p):a(p)}}const sC={name:"labelStartLink",resolveAll:zd.resolveAll,tokenize:uC};function uC(e,a,r){const l=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(c):a(c)}}const Wc={name:"lineEnding",tokenize:cC};function cC(e,a){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Oe(e,a,"linePrefix")}}const Xo={name:"thematicBreak",tokenize:dC};function dC(e,a,r){let l=0,s;return u;function u(f){return e.enter("thematicBreak"),c(f)}function c(f){return s=f,p(f)}function p(f){return f===s?(e.enter("thematicBreakSequence"),g(f)):l>=3&&(f===null||me(f))?(e.exit("thematicBreak"),a(f)):r(f)}function g(f){return f===s?(e.consume(f),l++,g):(e.exit("thematicBreakSequence"),_e(f)?Oe(e,p,"whitespace")(f):p(f))}}const Bt={continuation:{tokenize:mC},exit:bC,name:"list",tokenize:gC},pC={partial:!0,tokenize:yC},fC={partial:!0,tokenize:hC};function gC(e,a,r){const l=this,s=l.events[l.events.length-1];let u=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return p;function p(S){const T=l.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(T==="listUnordered"?!l.containerState.marker||S===l.containerState.marker:fd(S)){if(l.containerState.type||(l.containerState.type=T,e.enter(T,{_container:!0})),T==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(Xo,r,f)(S):f(S);if(!l.interrupt||S===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),g(S)}return r(S)}function g(S){return fd(S)&&++c<10?(e.consume(S),g):(!l.interrupt||c<2)&&(l.containerState.marker?S===l.containerState.marker:S===41||S===46)?(e.exit("listItemValue"),f(S)):r(S)}function f(S){return e.enter("listItemMarker"),e.consume(S),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||S,e.check(dl,l.interrupt?r:b,e.attempt(pC,E,h))}function b(S){return l.containerState.initialBlankLine=!0,u++,E(S)}function h(S){return _e(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),E):r(S)}function E(S){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,a(S)}}function mC(e,a,r){const l=this;return l.containerState._closeFlow=void 0,e.check(dl,s,u);function s(p){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Oe(e,a,"listItemIndent",l.containerState.size+1)(p)}function u(p){return l.containerState.furtherBlankLines||!_e(p)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,c(p)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(fC,a,c)(p))}function c(p){return l.containerState._closeFlow=!0,l.interrupt=void 0,Oe(e,e.attempt(Bt,a,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function hC(e,a,r){const l=this;return Oe(e,s,"listItemIndent",l.containerState.size+1);function s(u){const c=l.events[l.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===l.containerState.size?a(u):r(u)}}function bC(e){e.exit(this.containerState.type)}function yC(e,a,r){const l=this;return Oe(e,s,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(u){const c=l.events[l.events.length-1];return!_e(u)&&c&&c[1].type==="listItemPrefixWhitespace"?a(u):r(u)}}const Lv={name:"setextUnderline",resolveTo:EC,tokenize:SC};function EC(e,a){let r=e.length,l,s,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",u?(e.splice(s,0,["enter",c,a]),e.splice(u+1,0,["exit",e[l][1],a]),e[l][1].end={...e[u][1].end}):e[l][1]=c,e.push(["exit",c,a]),e}function SC(e,a,r){const l=this;let s;return u;function u(f){let b=l.events.length,h;for(;b--;)if(l.events[b][1].type!=="lineEnding"&&l.events[b][1].type!=="linePrefix"&&l.events[b][1].type!=="content"){h=l.events[b][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||h)?(e.enter("setextHeadingLine"),s=f,c(f)):r(f)}function c(f){return e.enter("setextHeadingLineSequence"),p(f)}function p(f){return f===s?(e.consume(f),p):(e.exit("setextHeadingLineSequence"),_e(f)?Oe(e,g,"lineSuffix")(f):g(f))}function g(f){return f===null||me(f)?(e.exit("setextHeadingLine"),a(f)):r(f)}}const vC={tokenize:TC};function TC(e){const a=this,r=e.attempt(dl,l,e.attempt(this.parser.constructs.flowInitial,s,Oe(e,e.attempt(this.parser.constructs.flow,s,e.attempt(_R,s)),"linePrefix")));return r;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),a.currentConstruct=void 0,r}function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a.currentConstruct=void 0,r}}const xC={resolveAll:ix()},AC=rx("string"),wC=rx("text");function rx(e){return{resolveAll:ix(e==="text"?kC:void 0),tokenize:a};function a(r){const l=this,s=this.parser.constructs[e],u=r.attempt(s,c,p);return c;function c(b){return f(b)?u(b):p(b)}function p(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),g}function g(b){return f(b)?(r.exit("data"),u(b)):(r.consume(b),g)}function f(b){if(b===null)return!0;const h=s[b];let E=-1;if(h)for(;++E<h.length;){const S=h[E];if(!S.previous||S.previous.call(l,l.previous))return!0}return!1}}}function ix(e){return a;function a(r,l){let s=-1,u;for(;++s<=r.length;)u===void 0?r[s]&&r[s][1].type==="data"&&(u=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==u+2&&(r[u][1].end=r[s-1][1].end,r.splice(u+2,s-u-2),s=u+2),u=void 0);return e?e(r,l):r}}function kC(e,a){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],s=a.sliceStream(l);let u=s.length,c=-1,p=0,g;for(;u--;){const f=s[u];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)p++,c--;if(c)break;c=-1}else if(f===-2)g=!0,p++;else if(f!==-1){u++;break}}if(a._contentTypeTextTrailing&&r===e.length&&(p=0),p){const f={type:r===e.length||g||p<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:l.start._bufferIndex+c,_index:l.start._index+u,line:l.end.line,column:l.end.column-p,offset:l.end.offset-p},end:{...l.end}};l.end={...f.start},l.start.offset===l.end.offset?Object.assign(l,f):(e.splice(r,0,["enter",f,a],["exit",f,a]),r+=2)}r++}return e}const _C={42:Bt,43:Bt,45:Bt,48:Bt,49:Bt,50:Bt,51:Bt,52:Bt,53:Bt,54:Bt,55:Bt,56:Bt,57:Bt,62:KT},NC={91:OR},RC={[-2]:Yc,[-1]:Yc,32:Yc},CC={35:FR,42:Xo,45:[Lv,Xo],60:$R,61:Lv,95:Xo,96:Iv,126:Iv},IC={38:JT,92:QT},OC={[-5]:Wc,[-4]:Wc,[-3]:Wc,33:lC,38:JT,42:gd,60:[sR,XR],91:sC,92:[UR,QT],93:zd,95:gd,96:vR},LC={null:[gd,xC]},DC={null:[42,95]},MC={null:[]},UC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:DC,contentInitial:NC,disable:MC,document:_C,flow:CC,flowInitial:RC,insideSpan:LC,string:IC,text:OC},Symbol.toStringTag,{value:"Module"}));function BC(e,a,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},u=[];let c=[],p=[];const g={attempt:W(q),check:W(U),consume:C,enter:I,exit:P,interrupt:W(U,{interrupt:!0})},f={code:null,containerState:{},defineSkip:_,events:[],now:T,parser:e,previous:null,sliceSerialize:E,sliceStream:S,write:h};let b=a.tokenize.call(f,g);return a.resolveAll&&u.push(a),f;function h($){return c=ln(c,$),A(),c[c.length-1]!==null?[]:(ae(a,0),f.events=os(u,f.events,f),f.events)}function E($,K){return zC(S($),K)}function S($){return FC(c,$)}function T(){const{_bufferIndex:$,_index:K,line:ne,column:re,offset:te}=l;return{_bufferIndex:$,_index:K,line:ne,column:re,offset:te}}function _($){s[$.line]=$.column,M()}function A(){let $;for(;l._index<c.length;){const K=c[l._index];if(typeof K=="string")for($=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===$&&l._bufferIndex<K.length;)k(K.charCodeAt(l._bufferIndex));else k(K)}}function k($){b=b($)}function C($){me($)?(l.line++,l.column=1,l.offset+=$===-3?2:1,M()):$!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===c[l._index].length&&(l._bufferIndex=-1,l._index++)),f.previous=$}function I($,K){const ne=K||{};return ne.type=$,ne.start=T(),f.events.push(["enter",ne,f]),p.push(ne),ne}function P($){const K=p.pop();return K.end=T(),f.events.push(["exit",K,f]),K}function q($,K){ae($,K.from)}function U($,K){K.restore()}function W($,K){return ne;function ne(re,te,z){let ee,ue,be,R;return Array.isArray(re)?Y(re):"tokenize"in re?Y([re]):L(re);function L(pe){return xe;function xe(je){const Ue=je!==null&&pe[je],Nt=je!==null&&pe.null,un=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(Nt)?Nt:Nt?[Nt]:[]];return Y(un)(je)}}function Y(pe){return ee=pe,ue=0,pe.length===0?z:N(pe[ue])}function N(pe){return xe;function xe(je){return R=le(),be=pe,pe.partial||(f.currentConstruct=pe),pe.name&&f.parser.constructs.disable.null.includes(pe.name)?ge():pe.tokenize.call(K?Object.assign(Object.create(f),K):f,g,se,ge)(je)}}function se(pe){return $(be,R),te}function ge(pe){return R.restore(),++ue<ee.length?N(ee[ue]):z}}}function ae($,K){$.resolveAll&&!u.includes($)&&u.push($),$.resolve&&Wt(f.events,K,f.events.length-K,$.resolve(f.events.slice(K),f)),$.resolveTo&&(f.events=$.resolveTo(f.events,f))}function le(){const $=T(),K=f.previous,ne=f.currentConstruct,re=f.events.length,te=Array.from(p);return{from:re,restore:z};function z(){l=$,f.previous=K,f.currentConstruct=ne,f.events.length=re,p=te,M()}}function M(){l.line in s&&l.column<2&&(l.column=s[l.line],l.offset+=s[l.line]-1)}}function FC(e,a){const r=a.start._index,l=a.start._bufferIndex,s=a.end._index,u=a.end._bufferIndex;let c;if(r===s)c=[e[r].slice(l,u)];else{if(c=e.slice(r,s),l>-1){const p=c[0];typeof p=="string"?c[0]=p.slice(l):c.shift()}u>0&&c.push(e[s].slice(0,u))}return c}function zC(e,a){let r=-1;const l=[];let s;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
62
62
  `;break}case-3:{c=`\r
63
63
  `;break}case-2:{c=a?" ":" ";break}case-1:{if(!a&&s)continue;c=" ";break}default:c=String.fromCharCode(u)}s=u===-2,l.push(c)}return l.join("")}function jC(e){const l={constructs:XT([UC,...(e||{}).extensions||[]]),content:s(tR),defined:[],document:s(aR),flow:s(vC),lazy:{},string:s(AC),text:s(wC)};return l;function s(u){return c;function c(p){return BC(l,u,p)}}}function GC(e){for(;!ex(e););return e}const Dv=/[\0\t\n\r]/g;function $C(){let e=1,a="",r=!0,l;return s;function s(u,c,p){const g=[];let f,b,h,E,S;for(u=a+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),h=0,a="",r&&(u.charCodeAt(0)===65279&&h++,r=void 0);h<u.length;){if(Dv.lastIndex=h,f=Dv.exec(u),E=f&&f.index!==void 0?f.index:u.length,S=u.charCodeAt(E),!f){a=u.slice(h);break}if(S===10&&h===E&&l)g.push(-3),l=void 0;else switch(l&&(g.push(-5),l=void 0),h<E&&(g.push(u.slice(h,E)),e+=E-h),S){case 0:{g.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,g.push(-2);e++<b;)g.push(-1);break}case 10:{g.push(-4),e=1;break}default:l=!0,e=1}h=E+1}return p&&(l&&g.push(-5),a&&g.push(a),g.push(null)),g}}const HC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function PC(e){return e.replace(HC,qC)}function qC(e,a,r){if(a)return a;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),u=s===120||s===88;return ZT(r.slice(u?2:1),u?16:10)}return al(r)||e}const lx={}.hasOwnProperty;function VC(e,a,r){return a&&typeof a=="object"&&(r=a,a=void 0),YC(r)(GC(jC(r).document().write($C()(e,a,!0))))}function YC(e){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Va),autolinkProtocol:le,autolinkEmail:le,atxHeading:u(Pa),blockQuote:u(Nt),characterEscape:le,characterReference:le,codeFenced:u(un),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(un,c),codeText:u(Xr,c),codeTextData:le,data:le,codeFlowValue:le,definition:u(El),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(wn),hardBreakEscape:u(qa),hardBreakTrailing:u(qa),htmlFlow:u(Sl,c),htmlFlowData:le,htmlText:u(Sl,c),htmlTextData:le,image:u(vl),label:c,link:u(Va),listItem:u(Zr),listItemValue:E,listOrdered:u(Ya,h),listUnordered:u(Ya),paragraph:u(Ss),reference:N,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Pa),strong:u(vs),thematicBreak:u(Ts)},exit:{atxHeading:g(),atxHeadingSequence:q,autolink:g(),autolinkEmail:Ue,autolinkProtocol:je,blockQuote:g(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:pe,characterReference:xe,codeFenced:g(A),codeFencedFence:_,codeFencedFenceInfo:S,codeFencedFenceMeta:T,codeFlowValue:M,codeIndented:g(k),codeText:g(te),codeTextData:M,data:M,definition:g(),definitionDestinationString:P,definitionLabelString:C,definitionTitleString:I,emphasis:g(),hardBreakEscape:g(K),hardBreakTrailing:g(K),htmlFlow:g(ne),htmlFlowData:M,htmlText:g(re),htmlTextData:M,image:g(ee),label:be,labelText:ue,lineEnding:$,link:g(z),listItem:g(),listOrdered:g(),listUnordered:g(),paragraph:g(),referenceString:se,resourceDestinationString:R,resourceTitleString:L,resource:Y,setextHeading:g(ae),setextHeadingLineSequence:W,setextHeadingText:U,strong:g(),thematicBreak:g()}};ox(a,(e||{}).mdastExtensions||[]);const r={};return l;function l(Z){let oe={type:"root",children:[]};const ye={stack:[oe],tokenStack:[],config:a,enter:p,exit:f,buffer:c,resume:b,data:r},Ae=[];let Be=-1;for(;++Be<Z.length;)if(Z[Be][1].type==="listOrdered"||Z[Be][1].type==="listUnordered")if(Z[Be][0]==="enter")Ae.push(Be);else{const zt=Ae.pop();Be=s(Z,zt,Be)}for(Be=-1;++Be<Z.length;){const zt=a[Z[Be][0]];lx.call(zt,Z[Be][1].type)&&zt[Z[Be][1].type].call(Object.assign({sliceSerialize:Z[Be][2].sliceSerialize},ye),Z[Be][1])}if(ye.tokenStack.length>0){const zt=ye.tokenStack[ye.tokenStack.length-1];(zt[1]||Mv).call(ye,void 0,zt[0])}for(oe.position={start:ya(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:ya(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Be=-1;++Be<a.transforms.length;)oe=a.transforms[Be](oe)||oe;return oe}function s(Z,oe,ye){let Ae=oe-1,Be=-1,zt=!1,kn,wt,ot,Rt;for(;++Ae<=ye;){const Pe=Z[Ae];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Be++:Be--,Rt=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(kn&&!Rt&&!Be&&!ot&&(ot=Ae),Rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rt=void 0}if(!Be&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Be===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(kn){let Yn=Ae;for(wt=void 0;Yn--;){const cn=Z[Yn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;wt&&(Z[wt][1].type="lineEndingBlank",zt=!0),cn[1].type="lineEnding",wt=Yn}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}ot&&(!wt||ot<wt)&&(kn._spread=!0),kn.end=Object.assign({},wt?Z[wt][1].start:Pe[1].end),Z.splice(wt||Ae,0,["exit",kn,Pe[2]]),Ae++,ye++}if(Pe[1].type==="listItemPrefix"){const Yn={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};kn=Yn,Z.splice(Ae,0,["enter",Yn,Pe[2]]),Ae++,ye++,ot=void 0,Rt=!0}}}return Z[oe][1]._spread=zt,ye}function u(Z,oe){return ye;function ye(Ae){p.call(this,Z(Ae),Ae),oe&&oe.call(this,Ae)}}function c(){this.stack.push({type:"fragment",children:[]})}function p(Z,oe,ye){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,ye||void 0]),Z.position={start:ya(oe.start),end:void 0}}function g(Z){return oe;function oe(ye){Z&&Z.call(this,ye),f.call(this,ye)}}function f(Z,oe){const ye=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==Z.type&&(oe?oe.call(this,Z,Ae[0]):(Ae[1]||Mv).call(this,Z,Ae[0]));else throw new Error("Cannot close `"+Z.type+"` ("+Zi({start:Z.start,end:Z.end})+"): it’s not open");ye.position.end=ya(Z.end)}function b(){return Fd(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function E(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function S(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function T(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function A(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function C(Z){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.label=oe,ye.identifier=gn(this.sliceSerialize(Z)).toLowerCase()}function I(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function P(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function q(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ye=this.sliceSerialize(Z).length;oe.depth=ye}}function U(){this.data.setextHeadingSlurpLineEnding=!0}function W(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function le(Z){const ye=this.stack[this.stack.length-1].children;let Ae=ye[ye.length-1];(!Ae||Ae.type!=="text")&&(Ae=At(),Ae.position={start:ya(Z.start),end:void 0},ye.push(Ae)),this.stack.push(Ae)}function M(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=ya(Z.end)}function $(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=oe.children[oe.children.length-1];ye.position.end=ya(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(oe.type)&&(le.call(this,Z),M.call(this,Z))}function K(){this.data.atHardBreak=!0}function ne(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function re(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function te(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function z(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function ee(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function ue(Z){const oe=this.sliceSerialize(Z),ye=this.stack[this.stack.length-2];ye.label=PC(oe),ye.identifier=gn(oe).toLowerCase()}function be(){const Z=this.stack[this.stack.length-1],oe=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const Ae=Z.children;ye.children=Ae}else ye.alt=oe}function R(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function L(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function Y(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function se(Z){const oe=this.resume(),ye=this.stack[this.stack.length-1];ye.label=oe,ye.identifier=gn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function ge(Z){this.data.characterReferenceType=Z.type}function pe(Z){const oe=this.sliceSerialize(Z),ye=this.data.characterReferenceType;let Ae;ye?(Ae=ZT(oe,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=al(oe);const Be=this.stack[this.stack.length-1];Be.value+=Ae}function xe(Z){const oe=this.stack.pop();oe.position.end=ya(Z.end)}function je(Z){M.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function Ue(Z){M.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function Nt(){return{type:"blockquote",children:[]}}function un(){return{type:"code",lang:null,meta:null,value:""}}function Xr(){return{type:"inlineCode",value:""}}function El(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function wn(){return{type:"emphasis",children:[]}}function Pa(){return{type:"heading",depth:0,children:[]}}function qa(){return{type:"break"}}function Sl(){return{type:"html",value:""}}function vl(){return{type:"image",title:null,url:"",alt:null}}function Va(){return{type:"link",title:null,url:"",children:[]}}function Ya(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Zr(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Ss(){return{type:"paragraph",children:[]}}function vs(){return{type:"strong",children:[]}}function At(){return{type:"text",value:""}}function Ts(){return{type:"thematicBreak"}}}function ya(e){return{line:e.line,column:e.column,offset:e.offset}}function ox(e,a){let r=-1;for(;++r<a.length;){const l=a[r];Array.isArray(l)?ox(e,l):WC(e,l)}}function WC(e,a){let r;for(r in a)if(lx.call(a,r))switch(r){case"canContainEols":{const l=a[r];l&&e[r].push(...l);break}case"transforms":{const l=a[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=a[r];l&&Object.assign(e[r],l);break}}}function Mv(e,a){throw e?new Error("Cannot close `"+e.type+"` ("+Zi({start:e.start,end:e.end})+"): a different token (`"+a.type+"`, "+Zi({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+Zi({start:a.start,end:a.end})+") is still open")}function XC(e){const a=this;a.parser=r;function r(l){return VC(l,{...a.data("settings"),...e,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function ZC(e,a){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(a),!0)};return e.patch(a,r),e.applyData(a,r)}function KC(e,a){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(a,r),[e.applyData(a,r),{type:"text",value:`
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8
8
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300..700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
9
9
  <title>Stashes</title>
10
- <script type="module" crossorigin src="/assets/index-r7ZweAxm.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-BBoSS6Rd.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-DXopYbWS.css">
12
12
  </head>
13
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stashes",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "description": "Generate AI-powered UI design explorations in your project",
6
6
  "keywords": [