@puddle-code/cli 0.0.9 → 0.0.11

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +51 -11
  2. package/dist/index.js +157 -36
  3. package/dist/public/assets/Dashboard-kSBMMJl-.js +1 -0
  4. package/dist/public/assets/{EditorTabClose-CnJvqROE.js → EditorTabClose-AQGPNeQZ.js} +1 -1
  5. package/dist/public/assets/LazyTerminal-yvOIwEDK.js +2 -0
  6. package/dist/public/assets/{ModelRefcount-DxceM9Ni.js → ModelRefcount-BQMI3Vu-.js} +1 -1
  7. package/dist/public/assets/PaneEditorBody-mk4tny45.js +66 -0
  8. package/dist/public/assets/SettingsDialog-CkttcYNN.js +1 -0
  9. package/dist/public/assets/{Terminal-DwGMsU4j.js → Terminal-Gbu8EGSD.js} +2 -2
  10. package/dist/public/assets/Workspace-Da28EOc_.js +6 -0
  11. package/dist/public/assets/api-CNOSFtPh.js +73 -0
  12. package/dist/public/assets/{buffer-store-BLJJ5bBb.js → buffer-store-B6LPaCyf.js} +2 -2
  13. package/dist/public/assets/context-menu-Bsz8Kf7T.js +1 -0
  14. package/dist/public/assets/{cssMode-BRkqXiJB.js → cssMode-Cb9x7qHj.js} +1 -1
  15. package/dist/public/assets/editor-tabs-D36ZKi_c.js +1 -0
  16. package/dist/public/assets/{htmlMode-BqZkTR1f.js → htmlMode-B24wJNmk.js} +1 -1
  17. package/dist/public/assets/index-Ckwo55p_.css +2 -0
  18. package/dist/public/assets/index-DVjqBrui.js +10 -0
  19. package/dist/public/assets/{jsonMode-CyukyrLW.js → jsonMode-CzL1xPlh.js} +1 -1
  20. package/dist/public/assets/session-seed-DFIaOrWq.js +1 -0
  21. package/dist/public/assets/ssh-mode-B1KdLV_0.js +1 -0
  22. package/dist/public/assets/{tsMode-ClBkYZNn.js → tsMode-hBn59dP5.js} +1 -1
  23. package/dist/public/index.html +4 -3
  24. package/package.json +1 -1
  25. package/dist/public/assets/Dashboard-CAM3cXGU.js +0 -1
  26. package/dist/public/assets/PaneEditorBody-Xz_NA7oS.js +0 -1
  27. package/dist/public/assets/SettingsDialog-CGLXP6AW.js +0 -1
  28. package/dist/public/assets/Workspace-vM9qSoWV.js +0 -7
  29. package/dist/public/assets/api-MnOKfpqf.js +0 -73
  30. package/dist/public/assets/context-menu-DDQiarCp.js +0 -1
  31. package/dist/public/assets/editor-tabs-DHrvhXUq.js +0 -1
  32. package/dist/public/assets/index-B3xVOA2-.css +0 -2
  33. package/dist/public/assets/index-QU4DiDhV.js +0 -10
  34. package/dist/public/assets/session-seed-CRfTF2sq.js +0 -1
  35. package/dist/public/assets/ssh-mode-d5hq-vUb.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,20 +7,60 @@ Past releases: see docs/changelogs/.
7
7
 
8
8
  # Changelog
9
9
 
10
- ## [0.0.9] — 2026-07-21
10
+ ## [0.0.11] — 2026-07-28
11
11
 
12
12
  ### Added
13
13
 
14
- - **Settings Sync**: export a profile's machine-agnostic settings (Appearance, Profile glyph, Sessions, Editor, Hotkeys — never accounts, repos, or paths) as one opaque string and import it on another machine, updating only the fields it carries. A collapsible checklist chooses what to include; the string is gzip+base64 with a CRC-32 integrity check and a random Caesar shuffle (decoded via the known gzip `H` prefix).
15
- - Customisable **keyboard shortcuts** (Settings Hotkeys), stored per profile. Rebind the global/layout actions command palette, close tab (⌃⌥W), toggle left/right sidebar (⌥⌘, / ⌥⌘.), open a navigator (⌥⌘E/F/V/B), new agent (⌃⌥\`), new terminal (⌃\`), toggle Scratchpad (⌥⌘S), editor save/word-wrap — with a key recorder, reset-to-default, and conflict + browser-reserved warnings. Filetree and terminal line-edit keys stay fixed. (protocol 7.6)
16
- - The session lifecycle menu gains "Spawn agent in worktree" — a submenu of the profile's logged-in accounts (the default account first, so opening it and pressing Enter spawns the default) that starts an agent joining the session's existing worktree, alongside the existing "Open terminal in worktree".
17
- - The homescreen gains two action tiles in the projects grid: "Open project" (the new-project dialogue) and "Open terminal" — a shell at `~` on the daemon host in a heading-less bottom pane that exists only on the homescreen, for cloning repositories before opening them as projects. One shell at a time: while it lives, opening reattaches to it (the tile reads "Close terminal", which ends it). Protocol 7.5: the `home` PTY stream and the `kill-shell` WS message.
18
- - Storm-navy is now a profile icon colour (the theme-aware primary ink — navy in light, near-white in dark).
14
+ - Host display name: `config.json` gains `displayName` (Settings Host), shown
15
+ in place of the OS hostname across the UInotably the top-left home button.
16
+ `GET /api/host` reports it; ssh-forward commands keep the real hostname.
17
+ Protocol 9.2.
18
+ - Folder drag-and-drop upload: dropping a directory onto the file explorer now
19
+ uploads its whole tree (walked in the browser; each file travels under its
20
+ relative path and the daemon creates the intermediate directories — empty
21
+ directories are skipped). On a pre-9.2 daemon folders are still rejected with
22
+ the zip-first toast, feature-detected via `GET /api/version`. Protocol 9.2.
23
+ - Settings sync spans more: `captureSessionEnv`, notification preferences
24
+ (desktop + sound; per-project mutes stay host-local — stripped on export,
25
+ preserved through import), and the profile's profile-wide Scratchpad entries.
26
+ Scratchpad import never overrides: an incoming entry is added unless an
27
+ existing one matches exactly on title, body, tags, and agent association.
28
+ - "Sync locally" (Settings → Sync, default off): mirrors the selected sync
29
+ groups through a machine-shared store (`~/.puddle/local-sync.json`, served
30
+ by every cockpit at `GET/PUT /cockpit/local-sync`), keyed by profile name —
31
+ so all puddle windows on the machine stay in step across UI ports and
32
+ daemons. While enabled, the one checklist governs imports and exports alike.
19
33
 
20
34
  ### Changed
21
35
 
22
- - Protocol bumped to **8.0** (a deliberate major bump with no schema change) so every connected daemon hits a major mismatch on the next handshake and auto-upgrades onto this build, picking up the accumulated 7.x daemon-side changes.
23
- - The profile icon picker is now a small curated set of ~60 lucide glyphs in a simple grid, all statically imported no lazy-loaded per-icon chunks, no search, no scroll. This replaces the full searchable set, which relied on lazy chunks that could 404 behind a stale shell and never scrolled reliably in the popover.
24
- - The profile icon "Default" now renders a neutral grey glyph rather than the navy heading ink (navy is its own explicit swatch), and the near-duplicate amber and accent swatches were dropped from the picker.
25
- - Scratchpad entries drag from anywhere on the row (the grip handle is gone, reclaiming the left gutter), and editing now happens in a modal opened by clicking the row (or the `+`/pencil) rather than expanding inline.
26
- - Deleting a Scratchpad entry now asks for confirmation inline a warning line with Delete/Cancel — instead of removing it on the first click, since there is no undo.
36
+ - The Scratchpad is now a top-bar popover between Settings and the profile
37
+ buttonfloating and scrollable like the profile panel, available on the
38
+ dashboard too instead of a right-sidebar view. Entries read text-first
39
+ (title, roomy body preview) with scope, tags, and always-visible tools on a
40
+ line below, so hovering reflows nothing; create/edit happen inline in the
41
+ list through a spacious composer — the old cramped modal is gone.
42
+ - Settings export is one click: "Export & copy" builds the string, shows it,
43
+ and puts it on the clipboard — no separate copy button.
44
+ - Markdown/HTML preview (SPEC §8): both previews now resolve worktree asset
45
+ references — relative to the document or `/`-absolute from the worktree
46
+ root. The sandboxed HTML iframe inlines its assets (images, scripts,
47
+ stylesheets, icons, media) as data URIs through the authed API; markdown
48
+ images keep the object-URL path. Ctrl/⌘-click on a worktree link in a
49
+ markdown preview opens that file as an editor tab, with markdown/HTML
50
+ targets landing straight in their rendered view.
51
+
52
+ ### Fixed
53
+
54
+ - File explorer: the inline input for New File… / New Folder… / Rename… now
55
+ reliably takes focus — the closing context menu used to steal it back, so
56
+ typing straight after creating went nowhere.
57
+ - Stored workspace snapshots no longer grow a spurious `right_panel: 'sessions'`
58
+ key on every write — the retired field went optional-without-default in the
59
+ ui_state schema (protocol 9.2), which also un-breaks the e2e round-trip test.
60
+ - Large uploads: folder drops are split into ~64 MiB requests client-side, the
61
+ daemon's per-request cap rose 100 → 512 MiB (it now only binds on a single
62
+ huge file), and the over-cap error reads in MB instead of raw bytes.
63
+ - New agent/terminal dialog: the "Directory to join" select no longer overflows
64
+ the dialog — the collapsed trigger shows just the directory name, and the open
65
+ list shows the `~`-compressed path (full path on hover) with the menu capped
66
+ to the viewport.
package/dist/index.js CHANGED
@@ -4148,7 +4148,7 @@ function argvFor(command) {
4148
4148
  // src/cli/run.ts
4149
4149
  init_attach();
4150
4150
  import { existsSync as existsSync3 } from "node:fs";
4151
- import { dirname as dirname5, join as join6 } from "node:path";
4151
+ import { dirname as dirname6, join as join8 } from "node:path";
4152
4152
  import { fileURLToPath as fileURLToPath3 } from "node:url";
4153
4153
 
4154
4154
  // src/lib/browser.ts
@@ -4166,8 +4166,11 @@ function openBrowser(url2, platform = process.platform) {
4166
4166
  }
4167
4167
  }
4168
4168
 
4169
+ // src/lib/connect.ts
4170
+ import { join as join5 } from "node:path";
4171
+
4169
4172
  // ../shared/src/protocol.ts
4170
- var PROTOCOL_VERSION = { major: 8, minor: 0 };
4173
+ var PROTOCOL_VERSION = { major: 9, minor: 2 };
4171
4174
 
4172
4175
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
4173
4176
  var external_exports = {};
@@ -18720,7 +18723,13 @@ var fields = {
18720
18723
  * expands to the daemon user's home. Covers Claude Code's native-installer
18721
18724
  * location (`~/.local/bin`). Takes effect on the next daemon start.
18722
18725
  */
18723
- agentPath: external_exports.string()
18726
+ agentPath: external_exports.string(),
18727
+ /**
18728
+ * User-chosen label for this host, shown across the UI in place of the OS
18729
+ * hostname when non-empty (surfaced via GET /api/host as `displayName`).
18730
+ * Purely cosmetic — never used for ssh commands or anything transport-level.
18731
+ */
18732
+ displayName: external_exports.string().max(64)
18724
18733
  };
18725
18734
  var daemonConfigSchema = external_exports.object({
18726
18735
  port: fields.port.default(7434),
@@ -18729,7 +18738,8 @@ var daemonConfigSchema = external_exports.object({
18729
18738
  logMaxBytes: fields.logMaxBytes.default(10 * 1024 * 1024),
18730
18739
  replayBytes: fields.replayBytes.default(256 * 1024),
18731
18740
  uiStateRetentionDays: fields.uiStateRetentionDays.default(90),
18732
- agentPath: fields.agentPath.default("~/.local/bin:~/bin:/opt/homebrew/bin:/usr/local/bin")
18741
+ agentPath: fields.agentPath.default("~/.local/bin:~/bin:/opt/homebrew/bin:/usr/local/bin"),
18742
+ displayName: fields.displayName.default("")
18733
18743
  });
18734
18744
  var daemonConfigPatchSchema = external_exports.object(fields).partial();
18735
18745
 
@@ -18748,7 +18758,13 @@ var hostInfoSchema = external_exports.object({
18748
18758
  username: external_exports.string(),
18749
18759
  hostname: external_exports.string(),
18750
18760
  /** The daemon user's home directory, for ~-compressing displayed paths. */
18751
- home: external_exports.string()
18761
+ home: external_exports.string(),
18762
+ /**
18763
+ * The user-chosen host label (config.json `displayName`), present when
18764
+ * non-empty. Display-only: the UI shows it wherever the host is named, but
18765
+ * ssh commands always use the real `hostname`.
18766
+ */
18767
+ displayName: external_exports.string().optional()
18752
18768
  });
18753
18769
 
18754
18770
  // ../shared/src/api/profiles.ts
@@ -18797,6 +18813,12 @@ var sessionDefaultsSchema = external_exports.looseObject({
18797
18813
  });
18798
18814
  var profileSettingsSchema = external_exports.looseObject({
18799
18815
  allowSkipPermissions: external_exports.boolean().default(false),
18816
+ /**
18817
+ * Captured session environment (SPEC §4): whether this profile's session
18818
+ * shells carry the capture hook and whether captured vars are re-injected at
18819
+ * PTY spawn. Off pauses the whole feature; stored maps are kept untouched.
18820
+ */
18821
+ captureSessionEnv: external_exports.boolean().default(true),
18800
18822
  /**
18801
18823
  * Launch-text templates (SPEC §4). A key that is ABSENT falls back to the
18802
18824
  * daemon's built-in default; an EMPTY string is an intentional empty preamble.
@@ -19079,6 +19101,16 @@ var createSessionRequestSchema = external_exports.object({
19079
19101
  });
19080
19102
  var patchSessionRequestSchema = external_exports.object({ title: external_exports.string().max(200) });
19081
19103
  var migrateSessionRequestSchema = external_exports.object({ account_id: rowId });
19104
+ var sessionEnvVarSchema = external_exports.object({
19105
+ name: external_exports.string(),
19106
+ bytes: external_exports.number().int().nonnegative()
19107
+ });
19108
+ var sessionEnvResponseSchema = external_exports.object({
19109
+ vars: external_exports.array(sessionEnvVarSchema)
19110
+ });
19111
+ var clearSessionEnvResponseSchema = external_exports.object({
19112
+ cleared: external_exports.number().int().nonnegative()
19113
+ });
19082
19114
  var archiveRequestSchema = external_exports.object({
19083
19115
  force: external_exports.boolean().default(false),
19084
19116
  /**
@@ -19158,7 +19190,14 @@ var editorTabRefSchema = external_exports.object({
19158
19190
  session: sessionId,
19159
19191
  path: external_exports.string(),
19160
19192
  kind: external_exports.enum(["file", "diff", "commit"]).optional(),
19161
- sha: external_exports.string().optional()
19193
+ sha: external_exports.string().optional(),
19194
+ /**
19195
+ * How a `file` tab renders: Monaco (`source`, the default when absent) or a
19196
+ * rendered `preview` — meaningful only for previewable types (markdown,
19197
+ * HTML; SPEC §8). Not part of the tab's identity: toggling rewrites the tab
19198
+ * ref in place.
19199
+ */
19200
+ view: external_exports.enum(["source", "preview"]).optional()
19162
19201
  });
19163
19202
  var tabRefSchema = external_exports.discriminatedUnion("type", [
19164
19203
  external_exports.object({ type: external_exports.literal("editor"), tab: editorTabRefSchema }),
@@ -19205,11 +19244,13 @@ var uiStateSnapshotSchema = external_exports.looseObject({
19205
19244
  /** Whether the right sessions sidebar is collapsed to a slim rail. */
19206
19245
  sessions_collapsed: external_exports.boolean().default(false),
19207
19246
  /**
19208
- * Which view the right sidebar shows: the session list or the Scratchpad
19209
- * panel (SPEC §8/§11). A loose extension key an older daemon that omits it
19210
- * reads as `sessions`.
19247
+ * RETIRED (the Scratchpad moved to a top-bar popover SPEC §11): nothing
19248
+ * reads or writes this any more. The key stays in the schema, optional and
19249
+ * defaultless, so snapshots from older clients round-trip byte-faithfully
19250
+ * without a major protocol bump (the old default-injection made every PUT
19251
+ * grow the field, which nothing wanted).
19211
19252
  */
19212
- right_panel: external_exports.enum(["sessions", "scratchpad"]).default("sessions"),
19253
+ right_panel: external_exports.enum(["sessions", "scratchpad"]).optional(),
19213
19254
  /**
19214
19255
  * User-chosen order of the sessions sidebar (session ids). Sessions not
19215
19256
  * listed here (newly created ones) sort to the top; the list is otherwise
@@ -19606,7 +19647,7 @@ import { readFileSync } from "node:fs";
19606
19647
  import { dirname, join as join2 } from "node:path";
19607
19648
  import { fileURLToPath } from "node:url";
19608
19649
  function cliVersion() {
19609
- if (true) return "0.0.9";
19650
+ if (true) return "0.0.11";
19610
19651
  const here = dirname(fileURLToPath(import.meta.url));
19611
19652
  for (const candidate of [
19612
19653
  join2(here, "..", "..", "package.json"),
@@ -19859,6 +19900,77 @@ function isLocalOrigin(origin) {
19859
19900
  }
19860
19901
  }
19861
19902
 
19903
+ // src/lib/serve/local-sync.ts
19904
+ import { mkdirSync, readFileSync as readFileSync3, renameSync, writeFileSync } from "node:fs";
19905
+ import { dirname as dirname3 } from "node:path";
19906
+ var MAX_BODY_BYTES = 5 * 1024 * 1024;
19907
+ function readStore(file2) {
19908
+ try {
19909
+ const raw = JSON.parse(readFileSync3(file2, "utf8"));
19910
+ if (raw && typeof raw === "object" && raw.profiles && typeof raw.profiles === "object") {
19911
+ return { version: 1, profiles: raw.profiles };
19912
+ }
19913
+ } catch {
19914
+ }
19915
+ return { version: 1, profiles: {} };
19916
+ }
19917
+ function writeStore(file2, store) {
19918
+ mkdirSync(dirname3(file2), { recursive: true });
19919
+ const tmp = `${file2}.tmp-${process.pid}`;
19920
+ writeFileSync(tmp, JSON.stringify(store, null, 2) + "\n");
19921
+ renameSync(tmp, file2);
19922
+ }
19923
+ function readBody(req) {
19924
+ return new Promise((resolve3, reject) => {
19925
+ let size = 0;
19926
+ const chunks = [];
19927
+ req.on("data", (chunk) => {
19928
+ size += chunk.length;
19929
+ if (size > MAX_BODY_BYTES) {
19930
+ reject(new Error("body_too_large"));
19931
+ req.destroy();
19932
+ return;
19933
+ }
19934
+ chunks.push(chunk);
19935
+ });
19936
+ req.on("end", () => resolve3(Buffer.concat(chunks).toString("utf8")));
19937
+ req.on("error", reject);
19938
+ });
19939
+ }
19940
+ function handleLocalSync(req, res, opts) {
19941
+ const send = (status, body) => {
19942
+ res.writeHead(status, { "content-type": "application/json", "cache-control": "no-store" });
19943
+ res.end(JSON.stringify(body));
19944
+ };
19945
+ const fail = (status, code, message) => send(status, { error: { code, message } });
19946
+ if (!isLocalHostHeader(req.headers.host) || !isLocalOrigin(req.headers.origin)) {
19947
+ return fail(403, "forbidden_host", "requests must address localhost");
19948
+ }
19949
+ if (opts === void 0) {
19950
+ return fail(404, "local_sync_unavailable", "this cockpit has no local sync store");
19951
+ }
19952
+ if (req.headers.authorization !== `Bearer ${opts.token}`) {
19953
+ return fail(401, "unauthorised", "missing or invalid token");
19954
+ }
19955
+ if (req.method === "GET") return send(200, readStore(opts.file));
19956
+ if (req.method === "PUT") {
19957
+ void readBody(req).then((text) => {
19958
+ const body = JSON.parse(text);
19959
+ if (typeof body.profile !== "string" || body.profile === "" || body.entry === void 0) {
19960
+ return fail(400, "bad_request", "expected { profile: string, entry: object }");
19961
+ }
19962
+ const store = readStore(opts.file);
19963
+ store.profiles[body.profile] = body.entry;
19964
+ writeStore(opts.file, store);
19965
+ return send(200, store);
19966
+ }).catch(
19967
+ (e) => e instanceof Error && e.message === "body_too_large" ? fail(413, "body_too_large", "sync entry exceeds the size cap") : fail(400, "bad_request", "body must be JSON")
19968
+ );
19969
+ return;
19970
+ }
19971
+ return fail(405, "method_not_allowed", "use GET or PUT");
19972
+ }
19973
+
19862
19974
  // src/lib/serve/proxy-recovery.ts
19863
19975
  var PROXY_PAGE = /^\/proxy\/([^/]+)\/(\d+)(?:\/|$)/;
19864
19976
  function recoverProxiedPath(referer, requestUrl) {
@@ -20090,6 +20202,10 @@ async function startUiServer(opts) {
20090
20202
  handleRefresh(req, res, opts.control);
20091
20203
  return;
20092
20204
  }
20205
+ if ((url2.split("?")[0] ?? "") === "/cockpit/local-sync") {
20206
+ handleLocalSync(req, res, opts.localSync);
20207
+ return;
20208
+ }
20093
20209
  if (isProxiedPath(url2)) {
20094
20210
  if (!isLocalHostHeader(req.headers.host) || !isLocalOrigin(req.headers.origin)) {
20095
20211
  res.writeHead(403, { "content-type": "application/json" });
@@ -20336,8 +20452,8 @@ async function openTunnel(ssh, remotePort, opts = {}) {
20336
20452
 
20337
20453
  // src/lib/transport/local.ts
20338
20454
  import { spawn as spawn3 } from "node:child_process";
20339
- import { copyFileSync, mkdirSync, readFileSync as readFileSync3 } from "node:fs";
20340
- import { dirname as dirname3 } from "node:path";
20455
+ import { copyFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "node:fs";
20456
+ import { dirname as dirname4 } from "node:path";
20341
20457
  var LocalTransport = class {
20342
20458
  kind = "local";
20343
20459
  label = "this machine";
@@ -20371,14 +20487,14 @@ var LocalTransport = class {
20371
20487
  }
20372
20488
  readFile(path) {
20373
20489
  try {
20374
- return Promise.resolve(readFileSync3(expandHome(path), "utf8"));
20490
+ return Promise.resolve(readFileSync4(expandHome(path), "utf8"));
20375
20491
  } catch {
20376
20492
  return Promise.resolve(null);
20377
20493
  }
20378
20494
  }
20379
20495
  copyTo(localPath, destPath) {
20380
20496
  const dest = expandHome(destPath);
20381
- mkdirSync(dirname3(dest), { recursive: true });
20497
+ mkdirSync2(dirname4(dest), { recursive: true });
20382
20498
  copyFileSync(localPath, dest);
20383
20499
  return Promise.resolve();
20384
20500
  }
@@ -20391,7 +20507,7 @@ function expandHome(path) {
20391
20507
 
20392
20508
  // src/lib/transport/ssh.ts
20393
20509
  import { spawn as spawn4 } from "node:child_process";
20394
- import { mkdirSync as mkdirSync2 } from "node:fs";
20510
+ import { mkdirSync as mkdirSync3 } from "node:fs";
20395
20511
  init_types();
20396
20512
  var SshTransport = class {
20397
20513
  constructor(host, opts = {}) {
@@ -20404,7 +20520,7 @@ var SshTransport = class {
20404
20520
  this.controlArgs = [];
20405
20521
  } else {
20406
20522
  const home = clientHome();
20407
- mkdirSync2(home, { recursive: true });
20523
+ mkdirSync3(home, { recursive: true });
20408
20524
  this.controlArgs = [
20409
20525
  "-o",
20410
20526
  "ControlMaster=auto",
@@ -20578,7 +20694,10 @@ async function connectRemote(opts) {
20578
20694
  // a preferred port stays non-strict
20579
20695
  avoidPort,
20580
20696
  target: { host: "127.0.0.1", port: tunnel.localPort },
20581
- ...opts.onRefreshRequest !== void 0 ? { control: { token: endpoint.token, onRefresh: opts.onRefreshRequest } } : {}
20697
+ ...opts.onRefreshRequest !== void 0 ? { control: { token: endpoint.token, onRefresh: opts.onRefreshRequest } } : {},
20698
+ // The store lives on the CLIENT machine — every cockpit here shares it,
20699
+ // whichever remote daemon each one drives.
20700
+ localSync: { token: endpoint.token, file: join5(clientHome(), "local-sync.json") }
20582
20701
  });
20583
20702
  tunnel.onPortChange((port) => ui.setTarget({ host: "127.0.0.1", port }));
20584
20703
  const eventCbs = /* @__PURE__ */ new Set();
@@ -20628,29 +20747,29 @@ async function showLogs(transport, opts) {
20628
20747
  }
20629
20748
 
20630
20749
  // src/lib/registry.ts
20631
- import { mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync4, rmSync, writeFileSync } from "node:fs";
20632
- import { join as join5 } from "node:path";
20750
+ import { mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync5, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
20751
+ import { join as join6 } from "node:path";
20633
20752
  function cockpitsDir(env) {
20634
- return join5(clientHome(env), "cockpits");
20753
+ return join6(clientHome(env), "cockpits");
20635
20754
  }
20636
20755
  function slug(target) {
20637
20756
  return target.replace(/[^A-Za-z0-9@._-]/g, "_");
20638
20757
  }
20639
20758
  function cockpitRecordPath(target) {
20640
- return join5(cockpitsDir(), `${slug(target)}.json`);
20759
+ return join6(cockpitsDir(), `${slug(target)}.json`);
20641
20760
  }
20642
20761
  function cockpitLogPath(target) {
20643
- return join5(clientHome(), "logs", `cockpit-${slug(target)}.log`);
20762
+ return join6(clientHome(), "logs", `cockpit-${slug(target)}.log`);
20644
20763
  }
20645
20764
  function writeCockpitRecord(record2) {
20646
- mkdirSync3(cockpitsDir(), { recursive: true, mode: 448 });
20647
- writeFileSync(cockpitRecordPath(record2.target), JSON.stringify(record2, null, 2) + "\n", {
20765
+ mkdirSync4(cockpitsDir(), { recursive: true, mode: 448 });
20766
+ writeFileSync2(cockpitRecordPath(record2.target), JSON.stringify(record2, null, 2) + "\n", {
20648
20767
  mode: 384
20649
20768
  });
20650
20769
  }
20651
20770
  function readCockpitRecord(target) {
20652
20771
  try {
20653
- return JSON.parse(readFileSync4(cockpitRecordPath(target), "utf8"));
20772
+ return JSON.parse(readFileSync5(cockpitRecordPath(target), "utf8"));
20654
20773
  } catch {
20655
20774
  return null;
20656
20775
  }
@@ -20669,7 +20788,7 @@ function listCockpitRecords() {
20669
20788
  for (const name of names) {
20670
20789
  if (!name.endsWith(".json")) continue;
20671
20790
  try {
20672
- records.push(JSON.parse(readFileSync4(join5(cockpitsDir(), name), "utf8")));
20791
+ records.push(JSON.parse(readFileSync5(join6(cockpitsDir(), name), "utf8")));
20673
20792
  } catch {
20674
20793
  }
20675
20794
  }
@@ -20701,6 +20820,7 @@ async function checkCockpit(record2) {
20701
20820
  }
20702
20821
 
20703
20822
  // src/lib/start.ts
20823
+ import { join as join7 } from "node:path";
20704
20824
  init_types();
20705
20825
  async function startLocal(opts) {
20706
20826
  const logger = opts.logger ?? silentLogger;
@@ -20722,7 +20842,8 @@ async function startLocal(opts) {
20722
20842
  avoidPort: endpoint.port,
20723
20843
  // never squat the daemon's own port
20724
20844
  target: { host: "127.0.0.1", port: endpoint.port },
20725
- ...opts.onRefreshRequest !== void 0 ? { control: { token: endpoint.token, onRefresh: opts.onRefreshRequest } } : {}
20845
+ ...opts.onRefreshRequest !== void 0 ? { control: { token: endpoint.token, onRefresh: opts.onRefreshRequest } } : {},
20846
+ localSync: { token: endpoint.token, file: join7(clientHome(), "local-sync.json") }
20726
20847
  });
20727
20848
  const eventCbs = /* @__PURE__ */ new Set();
20728
20849
  return {
@@ -20785,8 +20906,8 @@ async function upgradeDaemon(transport, opts = {}) {
20785
20906
 
20786
20907
  // src/cli/detach.ts
20787
20908
  import { spawn as spawn5 } from "node:child_process";
20788
- import { closeSync, mkdirSync as mkdirSync4, openSync, readFileSync as readFileSync5 } from "node:fs";
20789
- import { dirname as dirname4 } from "node:path";
20909
+ import { closeSync, mkdirSync as mkdirSync5, openSync, readFileSync as readFileSync6 } from "node:fs";
20910
+ import { dirname as dirname5 } from "node:path";
20790
20911
  init_types();
20791
20912
  var COCKPIT_CHILD_ENV = "PUDDLE_COCKPIT_CHILD";
20792
20913
  var READY_TIMEOUT_MS = 3e5;
@@ -20827,7 +20948,7 @@ async function launchDetached(opts) {
20827
20948
  }
20828
20949
  if (target !== "local") await new SshTransport(target).open();
20829
20950
  const logFile = cockpitLogPath(target);
20830
- mkdirSync4(dirname4(logFile), { recursive: true });
20951
+ mkdirSync5(dirname5(logFile), { recursive: true });
20831
20952
  const fd = openSync(logFile, "w");
20832
20953
  const argv = opts.argv ?? process.argv.slice(2);
20833
20954
  const child = spawn5(process.execPath, [process.argv[1] ?? "", ...argv], {
@@ -20867,7 +20988,7 @@ async function followStartup(target, childPid, logFile) {
20867
20988
  let offset = 0;
20868
20989
  const relay = () => {
20869
20990
  try {
20870
- const buf = readFileSync5(logFile);
20991
+ const buf = readFileSync6(logFile);
20871
20992
  if (buf.length > offset) {
20872
20993
  process.stderr.write(buf.subarray(offset));
20873
20994
  offset = buf.length;
@@ -20892,7 +21013,7 @@ async function followStartup(target, childPid, logFile) {
20892
21013
  }
20893
21014
  function spawnDetachedRefresh(target, argv) {
20894
21015
  const logFile = cockpitLogPath(target);
20895
- mkdirSync4(dirname4(logFile), { recursive: true });
21016
+ mkdirSync5(dirname5(logFile), { recursive: true });
20896
21017
  const fd = openSync(logFile, "a");
20897
21018
  const env = { ...process.env };
20898
21019
  delete env[COCKPIT_CHILD_ENV];
@@ -20949,9 +21070,9 @@ function timestampedLogger() {
20949
21070
 
20950
21071
  // src/cli/run.ts
20951
21072
  function assetsDir() {
20952
- const here = dirname5(fileURLToPath3(import.meta.url));
20953
- for (const candidate of [join6(here, "public"), join6(here, "..", "..", "dist", "public")]) {
20954
- if (existsSync3(join6(candidate, "index.html"))) return candidate;
21073
+ const here = dirname6(fileURLToPath3(import.meta.url));
21074
+ for (const candidate of [join8(here, "public"), join8(here, "..", "..", "dist", "public")]) {
21075
+ if (existsSync3(join8(candidate, "index.html"))) return candidate;
20955
21076
  }
20956
21077
  throw new CliError(
20957
21078
  "not_installed",
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,x as i}from"./api-CNOSFtPh.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{$ as d,B as f,I as p,J as m,L as h,U as g,nt as _,o as v,s as y,t as b,tt as x}from"./LazyTerminal-yvOIwEDK.js";import{t as S}from"./utils-B6KiDbIe.js";import{A as C,O as w,c as T,j as E,k as D,n as O,r as k,t as A}from"./context-menu-Bsz8Kf7T.js";import{i as j,r as M}from"./dist-VDiYuPKw.js";import{M as N,P,W as F,X as I,ct as L}from"./index-DVjqBrui.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return P.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&P.killShell(r,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(b,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=d(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:d,onDragEnd:f,onDragOver:p}){let m=h(),[g,v]=(0,R.useState)(!1),[b,w]=(0,R.useState)(e.name),D=t=>m.mutate({id:e.id,archived:t},{onError:e=>i.error(e.message)}),j=()=>{let t=b.trim();if(!t||t===e.name){v(!1);return}m.mutate({id:e.id,name:t},{onSuccess:()=>v(!1),onError:e=>i.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:d,onDragEnd:f,onDragOver:p,className:S(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:E,label:`Reopen project`,onClick:()=>D(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:y,label:`Rename project`,onClick:()=>{w(e.name),v(!0)}}),(0,z.jsx)(G,{icon:C,label:`Archive project`,onClick:()=>D(!0)})]})})]})}),(0,z.jsx)(O,{children:e.archived?(0,z.jsxs)(k,{onSelect:()=>D(!1),children:[(0,z.jsx)(E,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(k,{onSelect:()=>{w(e.name),v(!0)},children:[(0,z.jsx)(y,{}),` Rename`]}),(0,z.jsxs)(k,{onSelect:()=>D(!0),children:[(0,z.jsx)(C,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:g,onOpenChange:v,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,z.jsx)(_,{value:b,onChange:e=>w(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(x,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>v(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!b.trim()||m.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=v(),t=g(e??void 0),n=m(),r=f(e??void 0),i=p(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),d=V(),h=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],y=r.data?.projectOrder??[],b=w(_.filter(e=>!e.archived),y),x=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&i.mutate({projectOrder:D(b.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(M,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[b.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&T(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:F,label:d.open?`Close terminal`:`Open terminal`,hint:d.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:d.toggle})]}),x.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(j,{className:S(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(C,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:x.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:x.map(e=>(0,z.jsx)(K,{project:e,repoPath:h(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),d.open&&(0,z.jsx)(H,{term:d.term,onExit:d.onExit}),e!==null&&(0,z.jsx)(N,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-BLJJ5bBb.js";import{s as h,t as g}from"./editor-sync-F3Wyveaa.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t){let n=m(e,t);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(n,e),[n]),()=>p(n))}function x({session:e,path:t,kind:n,label:d,onClose:f}){let p=b(e,t)&&n!==`commit`,[m,x]=(0,v.useState)(!1),S=()=>p?x(!0):f();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${d}`,children:p?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_,{className:`size-2 fill-current group-hover:hidden`}),(0,y.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,y.jsx)(a,{className:`size-3 opacity-0 group-hover:opacity-100`})}),(0,y.jsx)(u,{open:m,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,d,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t),g(e,t),x(!1),f()},children:`Discard`})]})]})})]})}export{x as EditorTabClose};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-B6LPaCyf.js";import{s as h,t as g}from"./editor-sync-F3Wyveaa.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t){let n=m(e,t);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(n,e),[n]),()=>p(n))}function x({session:e,path:t,kind:n,label:d,onClose:f}){let p=b(e,t)&&n!==`commit`,[m,x]=(0,v.useState)(!1),S=()=>p?x(!0):f();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${d}`,children:p?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_,{className:`size-2 fill-current group-hover:hidden`}),(0,y.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,y.jsx)(a,{className:`size-3 opacity-0 group-hover:opacity-100`})}),(0,y.jsx)(u,{open:m,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,d,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t),g(e,t),x(!1),f()},children:`Discard`})]})]})})]})}export{x as EditorTabClose};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-Gbu8EGSD.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-CNOSFtPh.js","assets/utils-B6KiDbIe.js","assets/index-DVjqBrui.js","assets/useMutation-Da9b4jwS.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-Ckwo55p_.css","assets/ssh-mode-B1KdLV_0.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{a as i,n as a,t as o}from"./useMutation-Da9b4jwS.js";import{t as s}from"./preload-helper-Czpn1I53.js";import{n as c,y as l}from"./api-CNOSFtPh.js";import{A as u,C as d,O as f,w as p,x as m}from"./dialog-B43iKmfK.js";import{t as h}from"./utils-B6KiDbIe.js";import{t as g}from"./createLucideIcon-DyMAgLa3.js";var _=e(t(),1),v=[`top`,`right`,`bottom`,`left`],y=Math.min,b=Math.max,x=Math.round,S=Math.floor,C=e=>({x:e,y:e}),w={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function T(e,t,n){return b(e,y(t,n))}function E(e,t){return typeof e==`function`?e(t):e}function D(e){return e.split(`-`)[0]}function O(e){return e.split(`-`)[1]}function k(e){return e===`x`?`y`:`x`}function A(e){return e===`y`?`height`:`width`}function j(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function M(e){return k(j(e))}function N(e,t,n){n===void 0&&(n=!1);let r=O(e),i=M(e),a=A(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function P(e){let t=B(e);return[F(e),t,F(t)]}function F(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var I=[`left`,`right`],L=[`right`,`left`],R=[`top`,`bottom`],z=[`bottom`,`top`];function ee(e,t,n){switch(e){case`top`:case`bottom`:return n?t?L:I:t?I:L;case`left`:case`right`:return t?R:z;default:return[]}}function te(e,t,n,r){let i=O(e),a=ee(D(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(F)))),a}function B(e){let t=D(e);return w[t]+e.slice(t.length)}function ne(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function re(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ne(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ie(e,t,n){let{reference:r,floating:i}=e,a=j(t),o=M(t),s=A(o),c=D(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=O(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ae(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=E(t,e),p=re(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oe=50,se=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ae},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ie(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ie(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ce=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=E(e,t)||{};if(l==null)return{};let d=re(u),f={x:n,y:r},p=M(i),m=A(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,b=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[b]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[b]||a.floating[m]);let D=x/2-S/2,k=w/2-h[m]/2-1,j=y(d[_],k),N=y(d[v],k),P=w-h[m]-N,F=w/2-h[m]/2+D,I=T(j,F,P),L=!c.arrow&&O(i)!=null&&F!==I&&a.reference[m]/2-(F<j?j:N)-h[m]/2<0,R=L?F<j?F-j:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),le=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=E(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=D(r),_=j(o),v=D(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:P(o)),x=p!==`none`;!d&&x&&b.push(...te(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=N(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==j(t))||T.every(e=>j(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=j(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ue(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function de(e){return v.some(t=>e[t]>=0)}var fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=E(e,t);switch(i){case`referenceHidden`:{let e=ue(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:de(e)}}}case`escaped`:{let e=ue(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:de(e)}}}default:return{}}}}},pe=new Set([`left`,`top`]);async function me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=D(n),s=O(n),c=j(n)===`y`,l=pe.has(o)?-1:1,u=a&&c?-1:1,d=E(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var he=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ge=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=E(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=j(i),p=k(f),m=u[p],h=u[f],g=(e,t)=>T(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},_e=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=E(e,t),u={x:n,y:r},d=j(i),f=k(d),p=u[f],m=u[d],h=E(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=pe.has(D(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=E(e,t),c=await i.detectOverflow(t,s),l=D(n),u=O(n),d=j(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=y(p-c[m],g),x=y(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=x;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*b(c.left,c.right):w=p-2*b(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let k=await i.getDimensions(a.floating);return f!==k.width||p!==k.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<`u`}function H(e){return be(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((be(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function be(e){return ye()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return ye()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return ye()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function xe(e){return!ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Se(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ce(e){return/^(table|td|th)$/.test(H(e))}function we(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Te=/transform|translate|scale|rotate|perspective|filter/,Ee=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,De;function Oe(e){let t=G(e)?J(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Ae()&&(q(t.backdropFilter)||q(t.filter))||Te.test(t.willChange||``)||Ee.test(t.contain||``)}function ke(e){let t=Y(e);for(;K(t)&&!je(t);){if(Oe(t))return t;if(we(t))return null;t=Y(t)}return null}function Ae(){return De??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),De}function je(e){return/^(html|body|#document)$/.test(H(e))}function J(e){return U(e).getComputedStyle(e)}function Me(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||xe(e)&&e.host||W(e);return xe(t)?t.host:t}function Ne(e){let t=Y(e);return je(t)?(e.ownerDocument||e).body:K(t)&&Se(t)?t:Ne(t)}function Pe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ne(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Fe(a);return t.concat(a,a.visualViewport||[],Se(r)?r:[],e&&n?Pe(e):[])}else return t.concat(r,Pe(r,[],n))}function Fe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ie(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=x(n)!==a||x(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Le(e){return G(e)?e:e.contextElement}function X(e){let t=Le(e);if(!K(t))return C(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ie(t),o=(a?x(n.width):n.width)/r,s=(a?x(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Re=C(0);function ze(e){let t=U(e);return!Ae()||!t.visualViewport?Re:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Be(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Le(e),o=C(1);t&&(r?G(r)&&(o=X(r)):o=X(e));let s=Be(a,n,r)?ze(a):C(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Fe(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Fe(n)}}return V({width:u,height:d,x:c,y:l})}function Ve(e,t){let n=Me(e).scrollLeft;return t?t.left+n:Z(W(e)).left+n}function He(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ve(e,n),y:n.top+t.scrollTop}}function Ue(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?we(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=C(1),u=C(0),d=K(r);if((d||!a)&&((H(r)!==`body`||Se(o))&&(c=Me(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?He(o,c):C(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function We(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ge(e){let t=Me(e),n=e.ownerDocument.body,r=b(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=b(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ve(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=b(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ke=25;function qe(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ae()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ve(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Ke&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Je(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ye(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=qe(e,n,t);else if(t===`document`)r=Ge(W(e));else if(G(t))r=Je(t,n);else{let n=ze(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function Xe(e,t){let n=t.get(e);if(n)return n;let r=Pe(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;G(o)&&!je(o);){let e=J(o),t=Oe(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Ze(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?we(t)?[]:Xe(t,this._c):[].concat(n),r],o=Ye(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ye(t,a[e],i);s=b(n.top,s),c=y(n.right,c),l=y(n.bottom,l),u=b(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qe(e){let{width:t,height:n}=Ie(e);return{width:t,height:n}}function $e(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=C(0);if((r||!a)&&((H(t)!==`body`||Se(i))&&(s=Me(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ve(i));let l=i&&!r&&!a?He(i,s):C(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function et(e){return J(e).position===`static`}function tt(e,t){if(!K(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function nt(e,t){let n=U(e);if(we(e))return n;if(!K(e)){let t=Y(e);for(;t&&!je(t);){if(G(t)&&!et(t))return t;t=Y(t)}return n}let r=tt(e,t);for(;r&&Ce(r)&&et(r);)r=tt(r,t);return r&&je(r)&&et(r)&&!Oe(r)?n:r||ke(e)||n}var rt=async function(e){let t=this.getOffsetParent||nt,n=this.getDimensions,r=await n(e.floating);return{reference:$e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function it(e){return J(e).direction===`rtl`}var at={convertOffsetParentRelativeRectToViewportRelativeRect:Ue,getDocumentElement:W,getClippingRect:Ze,getOffsetParent:nt,getElementRects:rt,getClientRects:We,getDimensions:Qe,getScale:X,isElement:G,isRTL:it};function ot(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function st(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=S(d),h=S(a.clientWidth-(u+f)),g=S(a.clientHeight-(d+p)),_=S(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:b(0,y(1,c))||1},x=!0;function C(t){let n=t[0].intersectionRatio;if(!ot(l,e.getBoundingClientRect()))return s();if(n!==c){if(!x)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{r=new IntersectionObserver(C,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,v)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ct(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Le(e),u=i||a?[...l?Pe(l):[],...t?Pe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?st(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!ot(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var lt=he,ut=ge,dt=le,ft=ve,pt=fe,mt=ce,ht=_e,gt=(e,t,n)=>{let r=new Map,i=n??{},a={...at,...i.platform,_c:r};return se(e,t,{...i,platform:a})},_t=e(n(),1),vt=typeof document<`u`?_.useLayoutEffect:function(){};function yt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!yt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function bt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xt(e,t){let n=bt(e);return Math.round(t*n)/n}function St(e){let t=_.useRef(e);return vt(()=>{t.current=e}),t}function Ct(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);yt(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=St(c),O=St(i),k=St(l),A=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),gt(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!yt(T.current,t)&&(T.current=t,_t.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);vt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=_.useRef(!1);vt(()=>(j.current=!0,()=>{j.current=!1}),[]),vt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=_.useMemo(()=>({reference:x,floating:S}),[x,S]),P=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=xt(N.floating,u.x),r=xt(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...bt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var wt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:mt({element:r.current,padding:i}).fn(n):r?mt({element:r,padding:i}).fn(n):{}}}},Tt=(e,t)=>{let n=lt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>({fn:ht(e).fn,options:[e,t]}),Ot=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=wt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Mt=`Arrow`,Nt=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(p.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Nt.displayName=Mt;var Pt=Nt;function Ft(e){let[t,n]=_.useState(void 0);return m(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var It=`Popper`,[Lt,Rt]=f(It),[zt,Bt]=Lt(It),Vt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null),[a,o]=_.useState(void 0);return(0,Q.jsx)(zt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Vt.displayName=It;var Ht=`PopperAnchor`,Ut=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Bt(Ht,n),o=_.useRef(null),s=a.onAnchorChange,c=u(t,_.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=_.useRef(null);_.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let d=a.placementState&&$t(a.placementState),f=d?.[0],m=d?.[1];return r?null:(0,Q.jsx)(p.div,{"data-radix-popper-side":f,"data-radix-popper-align":m,...i,ref:c})});Ut.displayName=Ht;var Wt=`PopperContent`,[Gt,Kt]=Lt(Wt),qt=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:v=`optimized`,onPlaced:y,...b}=e,x=Bt(Wt,n),[S,C]=_.useState(null),w=u(t,C),[T,E]=_.useState(null),D=Ft(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Zt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=Ct({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>ct(...e,{animationFrame:v===`always`}),elements:{reference:x.anchor},middleware:[Tt({mainAxis:i+k,alignmentAxis:o}),c&&Et({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?Dt():void 0,...P}),c&&Ot({...P}),kt({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&jt({element:T,padding:s}),Qt({arrowWidth:O,arrowHeight:k}),g&&At({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;m(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,B]=$t(L),ne=d(y);m(()=>{R&&ne?.()},[R,ne]);let re=z.arrow?.x,V=z.arrow?.y,ie=z.arrow?.centerOffset!==0,[ae,oe]=_.useState();return m(()=>{S&&oe(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Gt,{scope:n,placedSide:te,placedAlign:B,onArrowChange:E,arrowX:re,arrowY:V,shouldHideArrow:ie,children:(0,Q.jsx)(p.div,{"data-side":te,"data-align":B,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});qt.displayName=Wt;var Jt=`PopperArrow`,Yt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Xt=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Kt(Jt,n),a=Yt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Pt,{...r,ref:t,style:{...r.style,display:`block`}})})});Xt.displayName=Jt;function Zt(e){return e!==null}var Qt=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=$t(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function $t(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var en=Vt,tn=Ut,nn=qt,rn=Xt,an=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,on=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,sn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,cn=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function ln({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:h(`flex h-8 w-full px-2.5`,an,e),...n})}function un({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:h(`flex min-h-16 w-full px-2.5 py-2`,an,e),...t})}var dn=`Label`,fn=_.forwardRef((e,t)=>(0,Q.jsx)(p.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));fn.displayName=dn;var pn=fn;function mn({className:e,...t}){return(0,Q.jsx)(pn,{className:h(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function hn(){return a({queryKey:[`profiles`],queryFn:()=>c(`GET`,`/api/profiles`)})}function gn(e){return a({queryKey:[`profile-settings`,e],queryFn:()=>c(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function _n(e){return a({queryKey:[`accounts`,e],queryFn:()=>c(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function vn(e){return a({queryKey:[`account-usage`,e],queryFn:()=>c(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function yn(){return a({queryKey:[`repos`],queryFn:()=>c(`GET`,`/api/repos`)})}function bn(e){return a({queryKey:[`projects`,e??`all`],queryFn:()=>c(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function xn(e){return a({queryKey:[`project`,e],queryFn:()=>c(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Sn(e){return a({queryKey:[`sessions`,e],queryFn:()=>c(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}function Cn(){return a({queryKey:[`sessions`,`all`],queryFn:()=>c(`GET`,`/api/sessions`)})}function wn(){return a({queryKey:[`config`],queryFn:()=>c(`GET`,`/api/config`)})}function Tn(e){return a({queryKey:[`repo-branches`,e],queryFn:()=>c(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function En(e){return a({queryKey:[`repo-worktrees`,e],queryFn:()=>c(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function Dn(e,t){let n=i();return o({mutationFn:t=>c(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function On(e,t){let n=i();return o({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),c(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function kn(e){return a({queryKey:[`fs-dirs`,e],queryFn:()=>c(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function An(){return a({queryKey:[`version`],queryFn:()=>c(`GET`,`/api/version`),staleTime:1/0})}function jn(){return a({queryKey:[`host`],queryFn:()=>c(`GET`,`/api/host`),staleTime:1/0})}function Mn(){return a({queryKey:[`agents`],queryFn:()=>c(`GET`,`/api/agents`),staleTime:1/0})}function Nn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Pn(e){let t=i();return o({mutationFn:t=>c(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function Fn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function In(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function Ln(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Rn(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function zn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Bn(){return o({mutationFn:e=>c(`POST`,`/api/accounts/${e}/login`)})}function Vn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Hn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Un(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Wn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Gn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Kn(e,t){return a({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>c(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function qn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Jn(){let e=i();return o({mutationFn:({id:e,...t})=>c(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Yn(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Xn(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function Zn(e){let t=i();return o({mutationFn:t=>c(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function Qn(){let e=i();return o({mutationFn:({sessionId:e,accountId:t})=>c(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function $n(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function er(){let e=i();return o({mutationFn:e=>c(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function tr(){let e=i();return o({mutationFn:({sessionId:e,title:t})=>c(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function nr(){let e=i();return o({mutationFn:e=>c(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function rr(e){try{return await c(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function ir(e,t){return c(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function ar(e,t){return a({queryKey:[`ports`,e],queryFn:()=>c(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:5e3,refetchIntervalInBackground:!1})}function or(e,t){return a({queryKey:[`session-env`,e],queryFn:()=>c(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:5e3,refetchIntervalInBackground:!1})}function sr(){let e=i();return o({mutationFn:e=>c(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var cr=g(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),lr=l(`puddle.profile-id`);function ur(){let e=(0,_.useSyncExternalStore)(lr.subscribe,lr.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function dr(e){lr.set(e)}function fr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(ln,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:h(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:h(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var pr=(0,_.lazy)(()=>s(()=>import(`./Terminal-Gbu8EGSD.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),mr=null;async function hr(){mr=(await s(()=>import(`./Terminal-Gbu8EGSD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function gr(e){return mr?(0,Q.jsx)(mr,{...e}):(0,Q.jsx)(_.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(pr,{...e})})}export{Sn as $,jn as A,gn as B,An as C,Yn as D,Ln as E,Fn as F,tr as G,xn as H,Pn as I,yn as J,Tn as K,Gn as L,Qn as M,In as N,kn as O,nr as P,ar as Q,Hn as R,Xn as S,On as T,bn as U,hn as V,Dn as W,Zn as X,Kn as Y,or as Z,zn as _,dr as a,cn as at,Vn as b,rr as c,tn as ct,_n as d,en as dt,er as et,Mn as f,Rt as ft,wn as g,sr as h,lr as i,an as it,Bn as j,Un as k,ir as l,rn as lt,$n as m,hr as n,ln as nt,ur as o,sn as ot,Cn as p,Ft as pt,En as q,fr as r,un as rt,cr as s,on as st,gr as t,mn as tt,vn as u,nn as ut,Nn as v,Rn as w,qn as x,Wn as y,Jn as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-BLJJ5bBb.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-B6LPaCyf.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};