rivet-design 0.14.6 → 0.14.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgC3E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EAAE,KACb,OAAO,CAAC,gBAAgB,CAgD1B,CAAC"}
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/reference.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2G3E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EAAE,KACb,OAAO,CAAC,gBAAgB,CA2E1B,CAAC"}
@@ -32,11 +32,69 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.handleReferenceFetch = void 0;
40
+ const fs_1 = __importDefault(require("fs"));
41
+ const path_1 = __importDefault(require("path"));
37
42
  const envelope_1 = require("../envelope");
38
43
  const shared_1 = require("./shared");
39
44
  const COMMAND = 'reference.fetch';
45
+ /** Cap image downloads per fetch so a large board stays fast and bounded. */
46
+ const MAX_IMAGE_DOWNLOADS = 12;
47
+ const IMAGE_DOWNLOAD_TIMEOUT_MS = 15_000;
48
+ /**
49
+ * Agent-actionable messages for the proxy's stable failure reasons. The
50
+ * pin-not-accessible one matters most: Pinterest's API only exposes pins
51
+ * saved to the connected account, and the fix is a 5-second user action.
52
+ */
53
+ const FAILURE_GUIDANCE = {
54
+ pin_not_accessible: 'Pinterest only lets Rivet read pins saved to the connected account, and this pin has no readable public data. Ask the user to save the pin to any of their Pinterest boards, then retry this command.',
55
+ unsupported_url: 'This link does not resolve to a Pinterest pin or board URL.',
56
+ board_not_owned: 'This board belongs to a different Pinterest account than the one connected to Rivet. Boards can only be read from the connected account.',
57
+ board_owner_unverified: 'The connected Pinterest account has no stored username, so Rivet cannot verify this board belongs to it. Ask the user to reconnect Pinterest from the Rivet editor, then retry.',
58
+ board_not_found: 'No board with this name was found on the connected Pinterest account.',
59
+ };
60
+ /**
61
+ * Download each pin's largest image into `.rivet/references/` and stamp
62
+ * `local_path` on the pin, so host agents can view the reference natively
63
+ * (Read tool) and pass it to variant workers via `--context-images` without
64
+ * relaying URLs. Failures are per-pin and non-fatal — the URLs remain.
65
+ */
66
+ const downloadPinImages = async (projectPath, pins) => {
67
+ const dir = path_1.default.join(projectPath, '.rivet', 'references');
68
+ const localPaths = [];
69
+ let dirReady = false;
70
+ for (const pin of pins.slice(0, MAX_IMAGE_DOWNLOADS)) {
71
+ const imageUrl = pin.image_urls[pin.image_urls.length - 1];
72
+ if (!imageUrl || !pin.id) {
73
+ continue;
74
+ }
75
+ try {
76
+ const response = await fetch(imageUrl, {
77
+ signal: AbortSignal.timeout(IMAGE_DOWNLOAD_TIMEOUT_MS),
78
+ });
79
+ if (!response.ok) {
80
+ continue;
81
+ }
82
+ if (!dirReady) {
83
+ fs_1.default.mkdirSync(dir, { recursive: true });
84
+ dirReady = true;
85
+ }
86
+ const ext = path_1.default.extname(new URL(imageUrl).pathname).toLowerCase() || '.jpg';
87
+ const filePath = path_1.default.join(dir, `pinterest-${pin.id.replace(/[^a-zA-Z0-9_-]/g, '')}${ext}`);
88
+ fs_1.default.writeFileSync(filePath, Buffer.from(await response.arrayBuffer()));
89
+ pin.local_path = filePath;
90
+ localPaths.push(filePath);
91
+ }
92
+ catch {
93
+ // Keep going — a failed download leaves the pin with URLs only.
94
+ }
95
+ }
96
+ return localPaths;
97
+ };
40
98
  /**
41
99
  * Map a reference URL to its provider by host: Pinterest (pinterest.com /
42
100
  * pin.it, including subdomains) or Are.na. Unsupported hosts are reported in
@@ -88,9 +146,25 @@ const handleReferenceFetch = async (args) => {
88
146
  const { IntegrationsClient } = await Promise.resolve().then(() => __importStar(require('../../services/IntegrationsClient')));
89
147
  const client = new IntegrationsClient();
90
148
  try {
91
- const result = provider === 'pinterest'
92
- ? await client.fetchPinterest(url)
93
- : await client.fetchArena(url);
149
+ if (provider === 'pinterest') {
150
+ const result = await client.fetchPinterest(url);
151
+ // Failed fetches are real failures: exit non-zero with actionable
152
+ // guidance instead of burying the error inside an ok envelope.
153
+ if (result.status === 'error') {
154
+ return (0, envelope_1.errorResult)(COMMAND, 'OPERATION_FAILED', result.reason ? FAILURE_GUIDANCE[result.reason] : result.message, { reason: result.reason, providerMessage: result.message });
155
+ }
156
+ // Download reference images locally so agents can view them natively
157
+ // and hand them to variant workers as context-images paths.
158
+ if (result.status === 'ok') {
159
+ const images = await downloadPinImages(context.projectPath, result.pins);
160
+ return (0, envelope_1.okResult)(COMMAND, { provider, ...result, images });
161
+ }
162
+ return (0, envelope_1.okResult)(COMMAND, { provider, ...result });
163
+ }
164
+ const result = await client.fetchArena(url);
165
+ if (result.status === 'error') {
166
+ return (0, envelope_1.errorResult)(COMMAND, 'OPERATION_FAILED', result.message);
167
+ }
94
168
  return (0, envelope_1.okResult)(COMMAND, { provider, ...result });
95
169
  }
96
170
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/cli/commands/reference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2E;AAC3E,qCAAgE;AAEhE,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAIlC;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,GAAW,EAA4B,EAAE;IAC/D,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IA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OAAO,CAAC,WAAW,EACnB,MAAM,CAAC,IAAI,CACZ,CAAC;gBACF,OAAO,IAAA,mBAAQ,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5D,CAAC;YAED,OAAO,IAAA,mBAAQ,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC9B,OAAO,IAAA,sBAAW,EAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAA,mBAAQ,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAChB,OAAO,EACP,kBAAkB,EAClB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAClE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA7EW,QAAA,oBAAoB,wBA6E/B"}
@@ -8,6 +8,8 @@ export type NormalizedPin = {
8
8
  description: string | null;
9
9
  alt_text: string | null;
10
10
  link: string | null;
11
+ /** Absolute path of the downloaded image (set by `rivet reference fetch`). */
12
+ local_path?: string;
11
13
  };
12
14
  export type NormalizedBoard = {
13
15
  id: string;
@@ -50,6 +52,8 @@ export type NormalizedAreNaMeta = {
50
52
  * not-connected result. The caller prompts the user to connect Pinterest from
51
53
  * the "Connect design references" dialog in the Rivet editor.
52
54
  */
55
+ /** Stable failure reasons the proxy reports for known Pinterest fetch failures. */
56
+ export type PinterestFetchFailureReason = 'pin_not_accessible' | 'unsupported_url' | 'board_not_owned' | 'board_owner_unverified' | 'board_not_found';
53
57
  export type PinterestFetchResult = {
54
58
  status: 'ok';
55
59
  type: 'pin';
@@ -64,6 +68,7 @@ export type PinterestFetchResult = {
64
68
  } | {
65
69
  status: 'error';
66
70
  message: string;
71
+ reason?: PinterestFetchFailureReason;
67
72
  };
68
73
  export type AreNaFetchResult = {
69
74
  status: 'ok';
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrationsClient.d.ts","sourceRoot":"","sources":["../../src/services/IntegrationsClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAA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AAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,IAAI,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;YACjD,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAClE,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAnRD,gDAmRC"}
@@ -6,5 +6,5 @@
6
6
  export declare const CLAUDE_SKILL_VERSION = 50;
7
7
  export declare const CLAUDE_SKILL_DIR = "rivet";
8
8
  export declare const CLAUDE_SKILL_FILENAME = "SKILL.md";
9
- export declare const CLAUDE_SKILL_CONTENT = "---\nname: rivet\ndescription: Rivet \u2014 explore multiple design directions for your web app (\"/rivet\", \"use rivet\", \"explore with rivet\", \"create variants of X\", \"show me options for X\", \"open rivet\", \"open the visual editor\"). Drive it with `rivet` CLI commands.\n---\n\n[//]: # (rivet-skill-version: 50)\n[//]: # (rivet-cli-guidance-version: 23)\n# Rivet\n\nRivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account.\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.\n";
9
+ export declare const CLAUDE_SKILL_CONTENT = "---\nname: rivet\ndescription: Rivet \u2014 explore multiple design directions for your web app (\"/rivet\", \"use rivet\", \"explore with rivet\", \"create variants of X\", \"show me options for X\", \"open rivet\", \"open the visual editor\"). Drive it with `rivet` CLI commands.\n---\n\n[//]: # (rivet-skill-version: 50)\n[//]: # (rivet-cli-guidance-version: 23)\n# Rivet\n\nRivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account. Accepts full pin/board URLs and `pin.it` share links. Pinterest images are downloaded into `.rivet/references/` and returned as absolute paths (`data.images`, plus `local_path` per pin) \u2014 view them directly and pass them to variants via `--context-images` instead of relaying URLs. On failure the error message says exactly what to tell the user (e.g. save the pin to a board first).\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.\n";
10
10
  //# sourceMappingURL=claude-skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-skill.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB,m3bAUhC,CAAC"}
1
+ {"version":3,"file":"claude-skill.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB,wvcAUhC,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * registration: an agent can ignore them.
7
7
  */
8
8
  export declare const CLI_GUIDANCE_VERSION = 23;
9
- export declare const CLI_GUIDANCE_BODY = "Rivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account.\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.";
9
+ export declare const CLI_GUIDANCE_BODY = "Rivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account. Accepts full pin/board URLs and `pin.it` share links. Pinterest images are downloaded into `.rivet/references/` and returned as absolute paths (`data.images`, plus `local_path` per pin) \u2014 view them directly and pass them to variants via `--context-images` instead of relaying URLs. On failure the error message says exactly what to tell the user (e.g. save the pin to a board first).\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.";
10
10
  /** One-line description used in host frontmatter/description fields. */
11
11
  export declare const CLI_GUIDANCE_DESCRIPTION = "Rivet \u2014 explore multiple design directions for your web app (\"/rivet\", \"use rivet\", \"explore with rivet\", \"create variants of X\", \"show me options for X\", \"open rivet\", \"open the visual editor\"). Drive it with `rivet` CLI commands.";
12
12
  //# sourceMappingURL=cli-guidance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-guidance.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cli-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,iBAAiB,u/aA+Cmc,CAAC;AAEle,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,+PACsM,CAAC"}
1
+ {"version":3,"file":"cli-guidance.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cli-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,iBAAiB,43bA+Cmc,CAAC;AAEle,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,+PACsM,CAAC"}
@@ -33,7 +33,7 @@ exports.CLI_GUIDANCE_BODY = `Rivet helps you **explore multiple design direction
33
33
  - \`rivet variants commit <variantId> --project <path> [--session <id>]\` — send the chosen direction to the project.
34
34
  - \`rivet variants cancel <sessionId> --project <path>\` — cancel a running variants session.
35
35
  - \`rivet evidence capture --url <url>\` — rendered design evidence (root variables, element styles, fonts) for a reference URL.
36
- - \`rivet reference fetch <url>\` — Pinterest / Are.na reference data via the user's connected account.
36
+ - \`rivet reference fetch <url>\` — Pinterest / Are.na reference data via the user's connected account. Accepts full pin/board URLs and \`pin.it\` share links. Pinterest images are downloaded into \`.rivet/references/\` and returned as absolute paths (\`data.images\`, plus \`local_path\` per pin) — view them directly and pass them to variants via \`--context-images\` instead of relaying URLs. On failure the error message says exactly what to tell the user (e.g. save the pin to a board first).
37
37
  - \`rivet auth status\` — signed-in state. If \`authenticated: false\`, tell the user to run \`rivet login\` themselves — never run login for them.
38
38
  - \`rivet stop [--project <path>]\` — stop the CLI-owned server.
39
39
 
@@ -6,5 +6,5 @@
6
6
  */
7
7
  export declare const CURSOR_RULES_VERSION = 47;
8
8
  export declare const CURSOR_RULES_FILENAME = "rivet.mdc";
9
- export declare const CURSOR_RULES_CONTENT = "---\ndescription: Rivet \u2014 explore multiple design directions for your web app (\"/rivet\", \"use rivet\", \"explore with rivet\", \"create variants of X\", \"show me options for X\", \"open rivet\", \"open the visual editor\"). Drive it with `rivet` CLI commands.\nalwaysApply: false\n---\n<!-- rivet-rules-version: 47 -->\n<!-- rivet-cli-guidance-version: 23 -->\n# Rivet\n\nRivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account.\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.\n";
9
+ export declare const CURSOR_RULES_CONTENT = "---\ndescription: Rivet \u2014 explore multiple design directions for your web app (\"/rivet\", \"use rivet\", \"explore with rivet\", \"create variants of X\", \"show me options for X\", \"open rivet\", \"open the visual editor\"). Drive it with `rivet` CLI commands.\nalwaysApply: false\n---\n<!-- rivet-rules-version: 47 -->\n<!-- rivet-cli-guidance-version: 23 -->\n# Rivet\n\nRivet helps you **explore multiple design directions** for a web app. You drive it by running `rivet` CLI commands. Every command prints exactly one JSON envelope on stdout (`{ schemaVersion, ok, command, data | error }`), routes progress to stderr, and never prompts for input.\n\n**Exit codes:** 0 ok \u00B7 1 operation failed (see `error.code`) \u00B7 2 usage error \u00B7 3 auth required \u00B7 4 no server for the project \u00B7 5 `rivet wait` timeout (work still pending or running \u2014 not a failure; the envelope's `state` says which).\n\n**Identify yourself (handoff).** Add these flags to every invocation so Rivet can attribute work: `--caller-agent claude|codex|cursor`, `--caller-model <your model>`, and `--caller-session <your chat session id>` when you have one. Human-direct invocations omit handoff flags. Never wrap or chain `rivet` with other commands (`&&`, pipes) \u2014 plain invocations are what the host allowlist covers.\n\n**Project path.** Prefer explicit `--project <absolute path>` on every command so follow-up chats attach to the same workspace. For an existing app, pass its repo/app root. For a fresh app, create or use an empty directory first, then open Rivet there and start variants with `--fresh`.\n\n**Browser behavior.** For interactive user workflows, run `rivet open` without `--no-browser` so the Rivet UI opens in the browser. Use `--no-browser` only for headless/background automation, CI/e2e checks, or when the user explicitly asks not to open a browser; in those cases, report the returned `editorUrl`.\n\n**MCP tools (opt-in).** If this host has Rivet MCP tools registered (`rivet_status`, `rivet_variants`, `rivet_design_context` \u2014 the user opted in via `rivet install --mcp`), prefer them over shelling out for status, variants, and design-context work: they drive the same control plane and return the same JSON envelopes, without per-call process cost. Lifecycle and auth stay CLI-only on purpose \u2014 `rivet open`, `rivet stop`, `rivet wait`, and `rivet login` have no MCP tools. There is no blocking/watch tool either: start work with `rivet_variants`; if the result contains `nextAction.action=\"complete_host_variant_work\"`, execute it yourself with parallel subagents when available.\n\n## Commands\n\n- `rivet open [--project <path>] [--agent claude|codex|cursor] [--rivet-port N] [--user-port N] [--framework nextjs|vite|cra|remix|svelte|static] [--entry <path>] [--no-browser] [--no-git]` \u2014 start or attach the project's editor server (idempotent; returns `editorUrl`). It detects the app, attaches to an already-running dev server, or starts one from the app's standard `dev`/`start`/`serve` script when possible. Omit `--no-browser` for interactive work so the UI opens for the user.\n- `rivet variants start --project <path> --instruction <text> [--run-label <text>] [--briefs <json>] [--count N] [--fidelity low|medium|high] [--element <selector>] [--files <json>] [--fresh] [--context-images <json>] [--reference-pages <json>] [--reference-videos <json>] [--target <sessionId>:<variantId>]` \u2014 explore design directions. For existing-app and `--target` starts, agent invocations MUST pass an AI-authored 1\u20133 word batch label through `rivet_variants` `runLabel` or CLI `--run-label`, plus one AI-authored brief per direction; `briefs.length` sets the count. FRESH (`--fresh`) starts are different: OMIT briefs and run-label and pass `--count` \u2014 Rivet prepares all reference context and authors the directions server-side, which starts workers immediately. Use `--files` for already-known project paths and `--target` to Vary an existing direction. Returns a `workId` and `nextAction` after workspace provisioning.\n- `rivet variants complete <workId> --project <path> [--session <sessionId>] [--status succeeded|failed|cancelled] [--output <json>] [--error <message>]` \u2014 report one host-agent work item complete after you edit its assigned workspace. Static artifacts are read from disk; do not send them through `--output`.\n- `rivet wait <workId> --project <path> [--timeout <seconds>]` \u2014 bounded block until a work id settles (exit 5 on timeout; re-issue or check status).\n- `rivet status --project <path> [--watch]` \u2014 session, resolved runner, active run, and the variants snapshot. `--watch` streams NDJSON.\n- `rivet variants status --project <path>` / `rivet variants list --project <path> [--history]` \u2014 inspect live or past directions.\n- `rivet variants get <sessionId>:<variantId> --project <path>` \u2014 retrieve one exact variant, including its local artifact path or diff, from a reference copied by the editor.\n- `rivet variants commit <variantId> --project <path> [--session <id>]` \u2014 send the chosen direction to the project.\n- `rivet variants cancel <sessionId> --project <path>` \u2014 cancel a running variants session.\n- `rivet evidence capture --url <url>` \u2014 rendered design evidence (root variables, element styles, fonts) for a reference URL.\n- `rivet reference fetch <url>` \u2014 Pinterest / Are.na reference data via the user's connected account. Accepts full pin/board URLs and `pin.it` share links. Pinterest images are downloaded into `.rivet/references/` and returned as absolute paths (`data.images`, plus `local_path` per pin) \u2014 view them directly and pass them to variants via `--context-images` instead of relaying URLs. On failure the error message says exactly what to tell the user (e.g. save the pin to a board first).\n- `rivet auth status` \u2014 signed-in state. If `authenticated: false`, tell the user to run `rivet login` themselves \u2014 never run login for them.\n- `rivet stop [--project <path>]` \u2014 stop the CLI-owned server.\n\n**Fidelity (capture the user's intent).** Design fidelity is a function of the authoring model, which correlates with latency \u2014 so the choice belongs to the user. On every `variants start` (CLI `--fidelity`, or the `rivet_variants` `fidelity` field), translate the user's ask into a fidelity level: `low` when they want speed or throwaway exploration (\"quick ideas\", \"rough sketches\", \"just show me options fast\") \u2014 sketch-grade workers, results in ~1.5\u20132 minutes; `high` when they want craft (\"polished\", \"pixel-perfect\", \"high fidelity\", \"final\", \"production-ready\", \"take your time\") \u2014 frontier-model authorship that can take a few minutes per direction. OMIT the flag when the user expressed no speed/quality intent \u2014 Rivet's default (`medium`) balances both. Never ask the user to pick a level; infer it from their words and mention the choice in your summary so they can redirect.\n\n## Typical flows\n\nBefore every agent-initiated EXISTING-APP or `--target` variants start, author a 1\u20133 word batch label plus one or more direction briefs as `[{\"label\":\"\u2026\",\"body\":\"\u2026\"}]`. (Fresh `--fresh` starts skip this entirely \u2014 see the fresh flow below.) The batch label summarizes the shared request and is passed through `runLabel` (MCP) or `--run-label` (CLI). Each brief `label` is an AI-authored direction title: 1\u20135 plain-English words naming what that direction concretely changes, not a vibe or numbered placeholder. Each `body` is a concise plain-English subtitle of at most 10 words describing that direction. Add an optional `notes` string per brief for richer implementation intent (design tokens, motion specs, constraints) \u2014 it is delivered verbatim to that direction's worker and never shown in UI chips. Use one brief for a single visualization when the user wants Rivet's visualization framework without divergent ideas. For multiple directions, make every brief meaningfully different. Pass the array through the `rivet_variants` `briefs` field or CLI `--briefs <json>`, and omit `--count` because the array length is authoritative. Human-direct CLI calls may omit the batch label and briefs and use Rivet's deterministic fallback.\n\nExisting app:\n1. `rivet open --project <path> --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `editorUrl`, `sessionId`, and `resolvedRunner`.\n2. Author a batch label and three distinct title/subtitle briefs, then call `rivet variants start --project <path> --instruction \"try three hero layouts\" --run-label \"Hero layouts\" --briefs '[{\"label\":\"Split hero\",\"body\":\"Moves supporting proof beside the primary call to action.\"},{\"label\":\"Layered hero\",\"body\":\"Stacks product imagery behind a compact centered headline.\"},{\"label\":\"Product-led hero\",\"body\":\"Lets the product preview dominate the opening composition.\"}]' --caller-agent cursor --caller-model <model> --caller-session <id>` \u2192 note `workId`.\n3. Rivet normally builds the directions with its OWN workers (the server executor): if the start response shows variants in flight but NO `nextAction`, do not implement anything \u2014 check `rivet status --project <path>` periodically (foreground waits only) until every variant is terminal, then present the results. Only when a response carries `nextAction.action=\"complete_host_variant_work\"` (executor unavailable on this machine) does the host implement, as follows. Each work item carries a server-authored `workerPrompt` pointing at its briefing file \u2014 the full packet (direction, mode contract, boundaries, completion command). Follow `nextAction.parallelism` exactly: one item \u2192 follow its `workerPrompt` yourself in the current host; multiple items \u2192 spawn every worker in that same turn as background subagents, passing each item's `workerPrompt` VERBATIM as the entire worker prompt \u2014 compose nothing, and never re-plan or elaborate briefs before spawning. When `nextAction.worker.agentType` is set (Claude Code: `rivet-worker`, installed by `rivet install` with tuned model/effort defaults), spawn each worker AS that subagent type; fall back to your default subagent type only if it is not registered. For `mode=\"vary\"` the workspace entry already contains the source direction's finished code: read it first, apply the requested delta with targeted `Edit` operations in place, and never rewrite or re-emit the full file \u2014 unchanged sections must remain untouched. For `workspace.kind=\"artifact_directory\"` the deliverable is `workspace.rootPath/workspace.entryPath` (write it in full only when it starts empty, i.e. `mode=\"create\"`); for `workspace.kind=\"git_worktree\"`, edit the app under `workspace.projectPath`.\n4. The briefing file ends with the item's exact `completeCommand`: the worker runs `rivet variants complete <workId> --project <path> --session <sessionId>` itself as its final step, the moment its workspace is done. Completions are never held back or batched by the coordinator \u2014 and because workers self-report, the coordinator does NOT poll status while workers run: check `rivet status` once after workers return (or on a single \u226560s wakeup), only to confirm terminal states and surface failures. Rivet reads static HTML from `workspace.entryPath` and captures git-worktree changes itself. Do not send inline HTML or repeat project context in the completion payload. If the result says `requeuedForRegeneration`, poll status for the renewed lease, address its QA summary, and complete that item once more. If a worker cannot complete it, use `--status failed --error <message>`.\n5. Show the user the `editorUrl` to compare directions; `rivet variants commit <variantId> --project <path>` when they pick one.\n\nFresh 0-to-1 (the fast path \u2014 go straight to the start call): create or use an empty directory, run `rivet open --project <path> ...`, then IMMEDIATELY run `rivet variants start --project <path> --fresh --instruction \"build a SaaS landing page\" --count 3 ...` with the user's references passed raw. OMIT `--briefs` and `--run-label`: Rivet authors the directions server-side, and every second you spend reading references or writing briefs delays the build. Pass local reference images via `--context-images '[\"/abs/path.png\"]'` (`rivet_variants` `contextImages`) \u2014 Rivet copies them into the run context and every worker views them natively. Pass reference page URLs via `--reference-pages '[\"https://example.com\"]'` (`referencePages`) \u2014 Rivet renders each page server-side for design evidence + a screenshot; never capture evidence or screenshot pages yourself. Pass local reference videos via `--reference-videos '[\"/abs/clip.mp4\"]'` (`referenceVideos`) \u2014 Rivet samples keyframes server-side; never run ffmpeg yourself. Never substitute a prose description of media you can pass directly.\n\nVary an existing direction: after status/list gives you `sessionId` and `variantId`, author a batch label and two distinct delta briefs by default, then run `rivet variants start --project <path> --target <sessionId>:<variantId> --instruction \"make this calmer\" --run-label \"Calmer direction\" --briefs '<json>' ...`. Include `--files '[\"src/known-target.tsx\"]'` when the relevant files are already known. Explicit briefs/counts remain authoritative.\n\nRivet owns orchestration; the host agent owns implementation. Do not wait for Rivet to spawn a separate agent. When `rivet variants start`, `rivet status`, `rivet_variants`, or `rivet_status` returns `nextAction.action=\"complete_host_variant_work\"`, complete those work items from the current host session. Avoid subagent startup for one item. For multiple items, spawn one background worker per isolated workspace in the same turn, and have each worker report its own completion immediately via its `completeCommand` (or `rivet_variants` action `complete`) \u2014 a variant's completion must never wait for its siblings.\n\n**Never cancel to unblock.** If `variants start` is rejected with `start_in_flight`, a start is still provisioning (status reports `variants.starting: true` \u2014 can take minutes); poll status and retry once it clears. If rejected with `active_session`, the user has live work: report the conflict and let them decide, or refine the active session with `--target`. Cancelling a session destroys the user's in-progress exploration \u2014 only do it when the user explicitly asks.\n";
10
10
  //# sourceMappingURL=cursor-rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-rules.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAGjD,eAAO,MAAM,oBAAoB,s3bAShC,CAAC"}
1
+ {"version":3,"file":"cursor-rules.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAGjD,eAAO,MAAM,oBAAoB,2vcAShC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivet-design",
3
- "version": "0.14.6",
3
+ "version": "0.14.7",
4
4
  "description": "Local visual web development tool with AI-powered code modification",
5
5
  "main": "dist/index.js",
6
6
  "workspaces": [
@@ -111,7 +111,7 @@ function useAtomValueWithDelay<Value>(
111
111
  `);if(!t.reference)return e;const n=((a=t.projectPath)==null?void 0:a.trim())??"",r=n?` --project '${n.replace(/'/g,"'\\''")}'`:"",s=[`Rivet variant: ${t.reference}`,"To inspect the full variant context, run:",`rivet variants get ${t.reference}${r}`].join(`
112
112
  `);return e?`${e}
113
113
 
114
- ${s}`:s},tG=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy:s,editingKey:i,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:d,onPastPointerDown:h,onHover:p,onRemove:m,onRemovePast:y,onStartRename:w,onCommitRename:_,onCancelRename:x,onCopyVariantContext:E,activeSessionId:k,projectPath:P})=>{const T=v.useRef(null),{activeIndex:A,itemRects:L,sessionRef:O,handlers:R,registerItem:M}=w5(T),N=(s==null?void 0:s.kind)==="switch",j=A!==null?L[A]:null;return S.jsxs("div",{ref:T,className:"relative",onMouseEnter:R.onMouseEnter,onMouseMove:R.onMouseMove,onMouseLeave:R.onMouseLeave,children:[S.jsx(Ji,{children:j&&S.jsx(fl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:j.top,left:j.left,width:j.width,height:j.height},animate:{opacity:1,top:j.top,left:j.left,width:j.width,height:j.height},exit:{opacity:0,transition:{duration:.06}},transition:{...qd.fast,opacity:{duration:.08}}},O.current)}),S.jsx("ul",{className:"relative",children:t.map((F,q)=>{const G=YW(F);let W=!1;return F.kind==="active"?W=F.variant.workItemId===e:F.kind==="past"?W=`${F.entry.sessionId}:${F.entry.variantId}`===n:W=r,S.jsx(nG,{rowKey:G,row:F,index:q,isSelected:W,isEditing:i===G,isSwitchInFlight:N,busy:s,registerItem:M,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:d,onPastPointerDown:h,onHover:p,onRemove:m,onRemovePast:y,onStartRename:w,onCommitRename:_,onCancelRename:x,onCopyVariantContext:E,activeSessionId:k,projectPath:P},G)})})]})},nG=({rowKey:t,row:e,index:n,isSelected:r,isEditing:s,isSwitchInFlight:i,busy:a,registerItem:u,onSelectActive:c,onSelectPast:d,onSelectOriginal:h,onActivePointerDown:p,onPastPointerDown:m,onHover:y,onRemove:w,onRemovePast:_,onStartRename:x,onCommitRename:E,onCancelRename:k,onCopyVariantContext:P,activeSessionId:T,projectPath:A})=>{var Ce,oe;const L=v.useRef(null);fU(u,n,L);const O=e.kind==="active",R=e.kind==="original",M=e.kind==="active"?e.variant:null,N=e.kind==="past"?e.entry:null,j=O?M.status==="succeeded":!0,F=O?Za(M):!0,q=O?PR(M):!1,G=O&&(M.status==="pending"||M.status==="running"),W=O?j&&(F||q)||G:!0,K=O&&M.status==="failed",X=O&&M.status==="cancelled",$=O&&(!W||i),ee=O&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,z=O&&(((Ce=M.refinement)==null?void 0:Ce.status)==="pending"||((oe=M.refinement)==null?void 0:oe.status)==="running");let D=Tw;O?D=M.label||`Direction ${n+1}`:N&&(D=N.label.trim()||"Untitled direction");let Y;O?Y=M.runLabel:N&&(Y=N.runLabel);let te=Rw;O?te=M.description:N&&(te=N.brief);const ie=te?QW(te):null,ae=JW(e,T),ue=ae?"Copy variant reference":"Copy description";return s?S.jsx("li",{ref:L,"data-proximity-index":n,className:"group relative z-10",children:S.jsx("div",{className:"bg-main-input flex w-full items-start gap-2 rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsx(rG,{initial:D,onCommit:se=>E(e,se),onCancel:k}),ie&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:ie})]})})}):S.jsxs("li",{ref:L,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:W?0:-1,"data-variant-id":O?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if($)return;const se=window.getSelection();se&&!se.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?d(e.entry):h())},onKeyDown:se=>{$||(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?d(e.entry):h())},onPointerDown:se=>{$||(e.kind==="active"?j&&p(e.variant.workItemId,se):e.kind==="past"&&m(e.entry,se))},"aria-pressed":W?r:void 0,"aria-disabled":O?!W:void 0,"aria-busy":G||z,onMouseEnter:O?()=>y(M.workItemId):void 0,onMouseLeave:O?()=>y(null):void 0,className:dr("focus-visible:ring-content-muted/40 flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors focus:outline-none focus-visible:ring-1",r&&"bg-main-input ring-content-muted/40 ring-1 ring-inset",j&&F&&"cursor-grab active:cursor-grabbing",(G||q)&&"cursor-pointer",!j&&!G&&!q&&"cursor-not-allowed opacity-60",$&&"cursor-not-allowed opacity-50"),style:j?{touchAction:"none"}:void 0,children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[(G||z)&&S.jsx(pw,{className:"text-content-muted shrink-0 text-sm","data-testid":z&&!G?"variant-refining":void 0}),S.jsx(Bo,{label:"Double-click to rename",disabled:R,children:S.jsx("span",{onDoubleClick:se=>{se.stopPropagation(),R||x(t)},className:dr("min-w-0 flex-1 truncate text-sm font-medium select-text",R?"cursor-default":"cursor-text",j||r?"text-content":"text-content-muted"),children:D})}),K&&S.jsx(ck,{label:"Failed"}),X&&S.jsx(ck,{label:"Cancelled"}),Y&&S.jsx("span",{className:"ml-auto max-w-[8rem] shrink-0 truncate rounded px-1.5 py-0.5 text-[10px] font-medium opacity-100 transition-opacity duration-150 group-hover:opacity-0 group-has-[:focus-visible]:opacity-0",style:_5(Y),children:Y})]}),ie&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:ie})]})}),S.jsxs("div",{className:dr("absolute top-1.5 right-2 flex items-center gap-0.5 transition-opacity duration-150","pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100"),children:[te||ae?S.jsx(Bo,{label:ue,children:S.jsx("button",{type:"button","aria-label":ue,onClick:se=>{se.stopPropagation(),P(eG({label:D,description:te,reference:ae,projectPath:A}))},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(Zd,{size:13,weight:"bold"})})}):null,!R&&S.jsx(Bo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:se=>{se.stopPropagation(),x(t)},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(gz,{size:13,weight:"bold"})})}),!R&&S.jsx(Bo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:ee,onClick:se=>{se.stopPropagation(),e.kind==="active"?w(e.variant):_(e.entry)},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(_z,{size:13,weight:"bold"})})})]})]})},rG=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=v.useState(t),i=v.useRef(!1),a=v.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},ck=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),sG=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx(Zd,{size:12,weight:"bold"}):null,a]})]})},iG={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},oG={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},aG=({artifacts:t})=>{const[e,n]=v.useState(null),r=v.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(lG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},lG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=oG[t.kind],s=t.source?iG[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(uG,{artifact:t})}):null]})},uG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),cG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:d,deployedUrl:h})=>{var O,R,M,N;const p=t?((R=(O=t.actions)==null?void 0:O.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,m=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),w=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",x=!i||!p||e!==null,E=a&&c>0,P=w?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":d?"Copy canvas link":"Share canvas",L=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(dR,{primaryLabel:P,primaryIcon:h&&!w?Zd:void 0,primaryAction:()=>{t&&r(t)},isDisabled:x,isDropdownDisabled:e!==null,isLoading:w,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:d&&!_?Zd:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!m,title:(N=(M=t==null?void 0:t.actions)==null?void 0:M.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:L}):null]})]})},TR=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(pw,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),dG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(TR,{},`${e.requestId}-${r}`)))}),fG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(TR,{},e))}),hG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),dk="Try different ways to create a dropdown that feels fluid and dynamic",pG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=v.useState(!1),s=FU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(dk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",dk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(WT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx(Zd,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},mG=({onClose:t})=>{const e=Qe(P5);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Bo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(vz,{className:"h-4 w-4",weight:"bold"})})})]}):null},gG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',vG=({itemSelector:t=gG,loop:e=!1}={})=>{const n=v.useRef(null),r=v.useRef(null),s=v.useCallback(a=>{var u;n.current=a,a?r.current=DU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=v.useCallback(a=>{var w;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const d=Array.from(c.querySelectorAll(t));if(d.length===0)return;a.preventDefault(),a.stopPropagation();const h=d.indexOf(document.activeElement),p=d.length-1,m=_=>{if(h===-1)return _===1?0:p;const x=h+_;return e?(x+d.length)%d.length:Math.min(Math.max(x,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=m(1):y=m(-1),(w=d[y])==null||w.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},fk="/assets/arena-Db0j1set.png",yG=vs("useIntegrations"),hk=["integrations"],_G="rivet:connect-result",wG=t=>typeof t=="object"&&t!==null&&t.type===_G,xG=tt(null),bG=()=>{const t=T8(),[e,n]=wP(xG),r=B1({queryKey:hk,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=v.useCallback(()=>t.invalidateQueries({queryKey:hk}),[t]),i=v.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const d=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await d.json().catch(()=>({}));if(!d.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const m=()=>{window.removeEventListener("message",y),clearInterval(w),s(),p()},y=_=>{wG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&yG.warn(`Connect failed for ${u}:`,_.data.message),m())};window.addEventListener("message",y);const w=setInterval(()=>{c.closed&&m()},500)})}finally{n(null)}},[s,n]),a=v.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},bu=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(Pw,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},pk=vs("ConnectorsModal"),SG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),EG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${fk})`,maskImage:`url(${fk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),CG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(SG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(EG,{})}],kG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(WT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},P_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:d}=bG(),[h,p]=v.useState(null),m=x=>s.find(E=>E.provider===x),y=v.useCallback(x=>{c(x).catch(E=>{const k=E instanceof Error?E.message:"Could not connect.";pk.warn(`Connect error for ${x}:`,k),ht.error(k)})},[c]),w=v.useCallback(x=>{d(x).catch(E=>{const k=E instanceof Error?E.message:"Could not disconnect.";pk.warn(`Disconnect error for ${x}:`,k),ht.error(k)})},[d]),_=n==="onboarding";return S.jsx(sw,{open:t,onOpenChange:x=>!x&&e(),children:S.jsxs(iw,{children:[S.jsx(ow,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(aw,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(SR,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(lw,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(bu,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(r5,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(uw,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:CG.map(x=>S.jsx(kG,{meta:x,integration:m(x.provider),isPending:i||u===x.provider,isHighlighted:r===x.provider,onConnect:()=>y(x.provider),onDisconnect:()=>w(x.provider)},x.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},mk=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),PG=vs("SupportTicketModal"),gk=5e3,f1="feedback",TG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},RG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=TG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},AG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=cD(),[s,i]=v.useState(""),[a,u]=v.useState(!1),[c,d]=v.useState(null),h=v.useCallback(()=>{i("")},[]),p=v.useCallback(()=>{a||(h(),e())},[a,e,h]),m=v.useCallback(async()=>{const x=s.trim();if(!(!x||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,k=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:f1,message:x,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:k??void 0,appVersion:"0.14.6",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await RG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:f1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const k=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:f1,error:k}),PG.error("Failed to submit support ticket:",k),ht.error("Could not send feedback",{description:k})}finally{u(!1)}}},[n,a,s,e,r,h]),y=v.useCallback(x=>{x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),m())},[m]),w=gk-s.length,_=a||s.trim().length===0;return S.jsx(sw,{open:t,onOpenChange:x=>!x&&p(),children:S.jsxs(iw,{children:[S.jsx(ow,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(aw,{ref:d,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(SR,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(lw,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(bu,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(r5,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(uw,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:x=>i(x.target.value),onKeyDown:y,maxLength:gk,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[w<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:w}),S.jsx(bu,{onClick:m,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(r0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(fz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},IG=vs("ProfileAvatar"),RR=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},MG=(t,e)=>RR(t,e).charAt(0).toUpperCase(),OG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Qe(R5),i=Qe(N5),a=Qe(L5),[u,c]=v.useState(!1),[d,h]=v.useState(!1),[p,m]=v.useState(!1),[y,w]=v.useState(!1),{containerRef:_,onKeyDown:x}=vG(),E=Qe(Pf),k=MG(r,s);if(!k)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(mk,{className:"h-7 w-7 rounded-full"}),S.jsx(mk,{className:"h-3 w-16"})]}):null;const P=RR(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,L=async()=>{w(!0);try{const O=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!O.ok)throw new Error(`Logout failed: ${O.status}`)}catch(O){IG.warn("Logout request failed",O),ht.error("Could not log out. Please try again."),w(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(aR,{open:u,onOpenChange:c,children:[S.jsx(lR,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:k}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(uR,{children:S.jsxs(cR,{ref:_,onKeyDown:x,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(e5,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),m(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(pz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:L,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(yz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(P_,{isOpen:d,onClose:()=>h(!1)}),S.jsx(AG,{isOpen:p,onClose:()=>m(!1),contactEmail:s??void 0})]})},LG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(mG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(KW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(OG,{side:"top",align:"start"})})]}),NG=vs("useServerConfig"),DG=()=>{const[t,e]=v.useState(null),[n,r]=v.useState(!0),[s,i]=v.useState(null),a=v.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const d=await c.json();if(!d.framework)throw new Error("Server did not return framework information");const h={userPort:((u=d.ports)==null?void 0:u.userDevServer)||3e3,framework:d.framework};return e(h),h}catch(c){const d=c instanceof Error?c.message:"Failed to fetch server config";throw i(d),NG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},jG="#1C1C20",Ni=[118,118,124],vk=.85,FG=3,VG=.15,dp=36,$G=4.4,HG=.7,zG=3.5,UG=.8,yk=9,BG=11,WG=[1.35,1.12,.95,.85],GG=[0,1.1,2.3,3.1],KG=[0,.35,.16,.13],ZG=[.9,.5,.4,.35],Fa=3,h1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],fp=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Dp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Va=(t,e)=>(Math.round(t/e-.5)+.5)*e,qG=Math.sin(Math.PI/3),_k=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*qG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},YG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-yk}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-yk}return Dp(.5-r/(2*BG))},AR=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(T5),r=v.useRef(null),s=v.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],d=0,h=0,p=dp,m=dp,y=null,w=null,_=0,x=-1;const E=new Array(33),k=j=>{const F=Math.round(j*32);let q=E[F];if(!q){const G=F/32,W=Math.round(Ni[0]+(255-Ni[0])*G),K=Math.round(Ni[1]+(255-Ni[1])*G),X=Math.round(Ni[2]+(255-Ni[2])*G);q=`rgba(${W}, ${K}, ${X}, ${vk})`,E[F]=q}return q},P=j=>{const F=1-.35*j,q=Math.round(Ni[0]*F),G=Math.round(Ni[1]*F),W=Math.round(Ni[2]*F);return`rgba(${q}, ${G}, ${W}, ${vk})`},T=j=>{let F=Math.floor(Math.random()*h1.length);F===x&&(F=(F+1)%h1.length),x=F;const q=[0,0,0,0],G=h1[F].map((D,Y)=>{const te=D.level,ie=q[te]++,ae=GG[te]+ie*KG[te],ue=ZG[te]+fp(F*131+Y*17+5)*.2;if(D.hline){const se=Va((D.y??0)*h,m);return{hline:!0,x1:Va(D.x1*d,p),x2:Va(D.x2*d,p),y1:se,y2:se,level:te,start:ae,dur:ue}}const Ce=Va(D.x1*d,p),oe=Va((D.y1??0)*h,m);return{hline:!1,x1:Ce,y1:oe,x2:Math.max(Va(D.x2*d,p),Ce+p),y2:Math.max(Va((D.y2??0)*h,m),oe+m),level:te,start:ae,dur:ue}}),W=G.reduce((D,Y)=>Math.max(D,Y.start+Y.dur),0),K=c.length,X=new Float32Array(K*Fa),$=new Int16Array(K*Fa).fill(-1),ee=new Uint8Array(K),z=G[0];for(let D=0;D<K;D++){const Y=c[D];Y.x>z.x1&&Y.x<z.x2&&Y.y>z.y1&&Y.y<z.y2&&(ee[D]=1);const te=D*Fa;for(let ie=0;ie<G.length;ie++){const ae=YG(Y.x,Y.y,G[ie]);if(ae<=.02)continue;let ue=te;for(let Ce=te;Ce<te+Fa;Ce++){if($[Ce]===-1){ue=Ce;break}X[Ce]<X[ue]&&(ue=Ce)}($[ue]===-1||ae>X[ue])&&(X[ue]=ae,$[ue]=ie)}}return{startT:j,buildEnd:W,els:G,frame:z,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();d=Math.max(1,j.width),h=Math.max(1,j.height);const F=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(d*F),i.height=Math.round(h*F),a.setTransform(F,0,0,F,0,0);const q=Math.max(8,Math.round(d/dp)),G=Math.max(6,Math.round(h/dp));p=d/q,m=h/G,c=[];for(let W=0;W<G;W++){const K=G>1?W/(G-1):.5,X=$G*(1+HG*.4*(K*2-1));for(let $=0;$<q;$++){const ee=W*8191+$*131+1,z={x:($+.5)*p,y:(W+.5)*m,size:X,seed:ee,phase:fp(ee),kind:0};z.kind=Math.floor(fp(ee*97)*3),c.push(z)}}w=null,y=null},L=new Float32Array(32),O=j=>{a.fillStyle=jG,a.fillRect(0,0,d,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+zG&&(w=y,_=j,y=T(j+.2));let F=0;w&&(F=1-Dp((j-_)/UG),F<=0&&(w=null));const q=y;for(let z=0;z<q.els.length;z++){const D=q.els[z];L[z]=Dp(Math.min(1,Math.max(0,(j-q.startT-D.start)/D.dur)))}const G=L[0],W=P(0),K=P(G),X=F>0?P(F):W,$=F>0?P(Math.max(G,F)):K,ee=c.length;for(let z=0;z<ee;z++){const D=c[z];let Y=0,te=0;const ie=z*Fa;for(let Pe=ie;Pe<ie+Fa;Pe++){const be=q.cellEl[Pe];if(be<0)break;const $e=q.cellQ[Pe]*L[be];$e>Y&&(Y=$e,te=q.els[be].level)}if(w)for(let Pe=ie;Pe<ie+Fa;Pe++){const be=w.cellEl[Pe];if(be<0)break;const $e=w.cellQ[Pe]*F;$e>Y&&(Y=$e,te=w.els[be].level)}const ae=j/FG+D.phase,ue=Math.floor(ae),Ce=ae-ue,oe=Dp(Math.min(Ce,1-Ce)/VG),se=Math.floor(fp(D.seed*97+ue*7919)*3);se!==D.kind&&Y<.02&&oe<.05&&(D.kind=se);const he=Math.max(oe*(1-Y),Y);if(!(he<.01))if(Y<.02){const Pe=q.inFrame[z]===1,be=w?w.inFrame[z]===1:!1;Pe?a.fillStyle=be?$:K:a.fillStyle=be?X:W;const $e=Math.max(Pe?G:0,be?F:0);_k(a,D.kind,D.x,D.y,D.size*he*(1-.2*$e))}else{a.fillStyle=k(Y);const Pe=1+(WG[te]-1)*Y;_k(a,D.kind,D.x,D.y,D.size*he*Pe)}}};A();let R=0;if(u)y=T(-100),O(0);else{const j=performance.now(),F=q=>{O((q-j)/1e3),R=requestAnimationFrame(F)};R=requestAnimationFrame(F)}const M=new ResizeObserver(()=>{A(),u&&(y=T(-100),O(0))});M.observe(i),r.current=()=>{cancelAnimationFrame(R),M.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},XG=async(t=null)=>{if(t)return QG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return hp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return hp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:hp()},QG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},hp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},wk=vs("usePreviewUpstreamHealth"),JG=500,eK=4e3,tK=15e3,nK=(t,e={})=>{const n=v.useRef(null),r=v.useRef(null),s=e.probeMsWhileDown??JG,i=e.probeMsWhileUp??eK,a=e.firstUnreachableCaptureAfterMs??tK,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,d=e.skip??!1,[h,p]=v.useState(t==="static"),[m,y]=v.useState(0),[w,_]=v.useState(null),[x,E]=v.useState(0),[k,P]=v.useState(!1),[T,A]=v.useState(!1),[L,O]=v.useState(t==="static"?null:"upstream_unreachable");return v.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),O(null);return}if(d){p(!1),_(null),E(0),P(!1),A(!0),O("upstream_unreachable"),n.current=null;return}let R=!0;const M=Date.now();_(M),E(0),P(!1),p(!1),A(!1),O("upstream_unreachable");const N={current:!1},j={current:!1},F={current:!1},q={current:null},G={current:!1};let W=null;const K=()=>{F.current||(F.current=!0,R&&A(!0))},X=()=>{W!==null&&(clearTimeout(W),W=null)},$=(z,D)=>{X(),W=setTimeout(D,z)},ee=async()=>{if(!R)return;E(ie=>ie+1);const{isOk:z,unavailableReason:D}=await XG(c);if(!R)return;if(K(),z){const ie=!G.current;G.current=!0,p(!0),O(null),q.current=null,j.current=!1,P(!1),N.current?ie&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-M})),$(i,ee);return}const Y=G.current;G.current=!1,p(!1),O(D),q.current===null&&(q.current=Date.now(),j.current=!1,P(!1)),Y&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(ie=>ie+1),wk.warn("Preview upstream became unavailable after it was ready"));const te=Date.now()-q.current;te>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:te}),wk.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,d]),v.useEffect(()=>{var M;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((M=n.current)==null||M.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:m,probeStartedAt:w,probeAttemptCount:x,isFirstUnreachableWindowExceeded:k,initialProbeComplete:T,unavailableReason:L}};function rK(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const IR=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},MR=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${IR(t)}${e}`:e,sK="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",iK=t=>sK,oK=vs("PreviewSurface"),xk=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",OR=({target:t,src:e,framework:n,remountKey:r})=>(Qe(s0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:iK(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:xk(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:xk(e,t),framework:n})),oK.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),aK="modulepreload",lK=function(t){return"/"+t},bk={},uK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(d=>{if(d=lK(d),d in bk)return;bk[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":aK,h||(m.as="script"),m.crossOrigin="",m.href=d,c&&m.setAttribute("nonce",c),document.head.appendChild(m),h)return new Promise((y,w)=>{m.addEventListener("load",y),m.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},cK=v.lazy(()=>uK(()=>Promise.resolve().then(()=>zZ),void 0)),dK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},fK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},hK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},Td=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:d,role:h="status",busy:p=!1,className:m=""})=>{const y=v.useCallback(_=>{_&&d&&(Te==null||Te.capture("status_surface_shown",{state:d,tone:i,fill:a}))},[d,i,a]),w=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${dK[a]} ${m}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":d,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,w?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:fK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:hK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},T_=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(Td,{...r,size:n,busy:!0,backdrop:S.jsx(AR,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(Td,{...r,size:n,busy:!0,backdrop:S.jsx(v.Suspense,{fallback:null,children:S.jsx(cK,{className:"absolute inset-0"})})}):S.jsx(Td,{...r,size:n,busy:!0,media:S.jsx(r0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),LR=({icon:t,...e})=>S.jsx(Td,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Nm=t=>S.jsx(Td,{...t,tone:"error",role:"alert"}),Sk="/static/",pK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(Sk)}catch{return t.endsWith(Sk)}},mK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Qe(g_),a=st(g_),u=Qe(Am),c=st(Am),d=Qe(kf),h=Qe(s0),p=Qe(v_),m=Qe(y_),y=Qe(A5),w=Qe(I5),_=st(y_),x=Qe(na),E=Qe(w_),k=st(v_),P=d.active&&d.projectContext.kind==="fresh",T=Qe(__),A=d.active?d.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&(!je.previewUnavailable||je.previewUnavailable.reason==="idle_timeout")))??null:null,L=d.active&&d.variants.some(je=>je.status==="pending"||je.status==="running"),O=P||L,R=d.active?d.variants.find(je=>{var Je;return je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable&&((Je=je.previewUnavailable)==null?void 0:Je.reason)!=="idle_timeout"})??null:null,M=e==="static"&&u!==null&&pK(u);v.useEffect(()=>{d.active||k(!1)},[d.active,k]);const N=v.useRef(!1);v.useEffect(()=>{const je=!!(x!=null&&x.left||x!=null&&x.right),Je=je&&!N.current;N.current=je;const it=d.active?d.sessionId:null;!it||!rK({enteringSplit:Je,isExistingSession:d.active&&d.projectContext.kind==="existing",hasActiveVariantProxy:p&&m!==null})||(k(!1),_(null),a(Ze=>Ze+1),fetch(`/api/variants/${encodeURIComponent(it)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[x,d,p,m,k,_,a]);const F=v.useMemo(()=>{var xn;if(p||u&&!M||!d.active)return null;const{stage:je,variants:Je}=d,it=je==="ready"||je==="degraded",Ze=Je.some(jt=>{var An,zn;return((An=jt.refinement)==null?void 0:An.status)==="pending"||((zn=jt.refinement)==null?void 0:zn.status)==="running"});if(!it&&!Ze)return null;const _t=Je.find(jt=>{var An;return jt.status==="succeeded"&&((An=jt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=_t==null?void 0:_t.preview)==null?void 0:xn.kind)==="static_artifact"?_t.preview.url:null},[M,u,p,d])??u,q=v.useMemo(()=>!d.active||!F?null:d.variants.find(je=>{var Je;return((Je=je.preview)==null?void 0:Je.kind)==="static_artifact"&&F.startsWith(je.preview.url)})??null,[F,d]),G=v.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!d.active)return Rm;if(q)return{kind:"variant",sessionId:d.sessionId,variantId:q.workItemId};if(F){const Je=F.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),it=Je!=null&&Je[1]?decodeURIComponent(Je[1]):null,Ze=Je!=null&&Je[2]?decodeURIComponent(Je[2]):null;if(it===d.sessionId&&Ze&&d.variants.some(jt=>jt.workItemId===Ze))return{kind:"variant",sessionId:d.sessionId,variantId:Ze};const _t=F.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=_t!=null&&_t[1]?decodeURIComponent(_t[1]):null;if(xn&&d.variants.some(jt=>jt.workItemId===xn))return{kind:"variant",sessionId:d.sessionId,variantId:xn}}const je=!!(x!=null&&x.left||x!=null&&x.right);return(!je||P)&&!F&&p&&m&&d.variants.some(Je=>Je.workItemId===m)?{kind:"variant",sessionId:d.sessionId,variantId:m}:(!je||P)&&!F&&T&&d.variants.some(Je=>Je.workItemId===T)?{kind:"variant",sessionId:d.sessionId,variantId:T}:Rm},[E,q,d,p,m,F,x,P,T]),W=v.useRef(null);v.useEffect(()=>{var Ze,_t;if(!q||((Ze=q.preview)==null?void 0:Ze.kind)!=="static_artifact"||((_t=q.refinement)==null?void 0:_t.status)!=="succeeded")return;const je=`${q.workItemId}:${q.refinement.workItemId}`;if(W.current===je)return;W.current=je;const Je=q.preview.url.includes("?")?"&":"?",it=`${q.preview.url}${Je}refinement=${encodeURIComponent(q.refinement.workItemId)}`;F!==it&&(c(it),a(xn=>xn+1))},[F,q,a,c,d]);const K=F!==null&&$W(F),X=F!==null&&!K||P&&!p&&!K,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:z,initialProbeComplete:D}=nK(e,{rerunProbeImmediatelyOnVersion:i,probePath:K?F:null,skip:X}),[Y,te]=v.useState(()=>y&&$?i:null),ie=v.useRef(null);v.useEffect(()=>{if(!y){ie.current=null,te(null);return}if(Y===i){ie.current=null;return}const je=ie.current;if(!je||je.remountKey!==i){ie.current={remountKey:i,probeAttemptCount:z};return}$&&z>je.probeAttemptCount&&(ie.current=null,te(i))},[Y,i,y,z,$]);const ue=F!==null&&!K||$,oe=w||y&&Y!==i||y&&!ue,se=`${ee}:${i}`,he=r?`/try/${encodeURIComponent(r)}`:"",Pe=CR(window.location.pathname),be=e==="static"?`${he}/static${Pe??"/"}`:`${he}${Pe??"/"}`,$e=IR(h);let ot=null;F&&(ot=MR({agentApplyMode:h,url:F}));const ge=A||oe?"about:blank":(K&&!ue?"about:blank":ot)??(s||!ue?"about:blank":`${$e}${be}`),gt=!!A||!!R||!ue&&D;let dt=null;return oe?dt=S.jsx(T_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?dt=S.jsx(T_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?dt=S.jsx(Nm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):gt&&(dt=O?S.jsx(LR,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Nm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[dt,S.jsx(OR,{target:G,src:ge,framework:e,remountKey:se})]})};function Ek({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(na),c=Qe(kf),d=Qe(s0),h=v.useRef(!1),p=v.useCallback(()=>{h.current||(h.current=!0,sf({source:i,sessionId:e,variantId:n}))},[i,e,n]),m=v.useCallback(()=>{if(a){u(null);return}p(),u(k=>{if(!k)return null;const P={...k};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=v.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),w=v.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(k=>k.workItemId===n)??null,[e,n,c]),_=v.useMemo(()=>{var P,T;let k=r;if(((P=w==null?void 0:w.preview)==null?void 0:P.kind)==="static_artifact"&&((T=w.refinement)==null?void 0:T.status)==="succeeded"){const A=w.preview.url.includes("?")?"&":"?";k=`${w.preview.url}${A}refinement=${encodeURIComponent(w.refinement.workItemId)}`}return MR({agentApplyMode:d,url:k})},[d,w,r]),x=((E=w==null?void 0:w.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${w.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Bo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:m,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(OR,{target:y,src:_,framework:"static",remountKey:x})})]})}const Ck=240;function gK(){const t=Qe(Jd),e=Qe(hw),n=v.useRef(null);return v.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-Ck/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:Ck},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:_5(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function vK(){const t=Qe(Jd),e=Qe(hw),n=Qe(na),r=st(Jd),s=st(na),i=v.useRef(null),[a,u]=v.useState(null),[c,d]=v.useState("hidden");v.useEffect(()=>{if(!t){d("hidden"),u(null);return}const m=requestAnimationFrame(()=>d("visible"));return()=>cancelAnimationFrame(m)},[t]);const h=v.useCallback((m,y)=>{const w=i.current;if(!w)return null;const _=w.getBoundingClientRect();return m<_.left||m>_.right||y<_.top||y>_.bottom?null:m<(_.left+_.right)/2?"left":"right"},[]);if(v.useEffect(()=>{if(!t||!e)return;const m=h(e.x,e.y);u(y=>y===m?y:m)},[t,e,h]),v.useEffect(()=>{if(!t)return;const m=y=>{const w=h(y.clientX,y.clientY);if(w&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},x=n==null?void 0:n[w];x&&(x.sessionId!==_.sessionId||x.variantId!==_.variantId)&&sf(x),s(E=>({...E??{},[w]:_})),d("exiting"),window.setTimeout(()=>r(null),220)}else sf(t),d("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(kk,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(kk,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function kk({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const NR=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},Pk=(t,e)=>{if(!t)return;const n=NR(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},yK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(AR,{trackGlobalLoaderCount:!1})})}),_K=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=DG();return v.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(yK,{}):u||!s?S.jsx(Nm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(wK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function wK(t){const e=Qe(na),n=Qe(Jd),r=Qe(kf),s=Qe(Am),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=v.useMemo(()=>{var A,L;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,x=r.variants.filter(O=>{var R;return O.status==="succeeded"&&((R=O.preview)==null?void 0:R.kind)==="static_artifact"&&O.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=x.find(O=>{var R;return((R=O.preview)==null?void 0:R.kind)==="static_artifact"&&O.preview.url===E})??x[0];if(((L=P==null?void 0:P.preview)==null?void 0:L.kind)!=="static_artifact")return;const T=NR(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=Pk(i,r)??(a?u:void 0),d=Pk(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!d,m=!!(c||d),y=S.jsx(mK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${m?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(Ek,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&d)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),d&&S.jsx(Ek,{side:"right",sessionId:d.sessionId,variantId:d.variantId,url:d.url,label:d.label,source:d.source,isFallback:p},`right-${d.sessionId}:${d.variantId}:${d.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(vK,{}),S.jsx(gK,{})]})})}const DR=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(r0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function Ui(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jR(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
114
+ ${s}`:s},tG=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy:s,editingKey:i,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:d,onPastPointerDown:h,onHover:p,onRemove:m,onRemovePast:y,onStartRename:w,onCommitRename:_,onCancelRename:x,onCopyVariantContext:E,activeSessionId:k,projectPath:P})=>{const T=v.useRef(null),{activeIndex:A,itemRects:L,sessionRef:O,handlers:R,registerItem:M}=w5(T),N=(s==null?void 0:s.kind)==="switch",j=A!==null?L[A]:null;return S.jsxs("div",{ref:T,className:"relative",onMouseEnter:R.onMouseEnter,onMouseMove:R.onMouseMove,onMouseLeave:R.onMouseLeave,children:[S.jsx(Ji,{children:j&&S.jsx(fl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:j.top,left:j.left,width:j.width,height:j.height},animate:{opacity:1,top:j.top,left:j.left,width:j.width,height:j.height},exit:{opacity:0,transition:{duration:.06}},transition:{...qd.fast,opacity:{duration:.08}}},O.current)}),S.jsx("ul",{className:"relative",children:t.map((F,q)=>{const G=YW(F);let W=!1;return F.kind==="active"?W=F.variant.workItemId===e:F.kind==="past"?W=`${F.entry.sessionId}:${F.entry.variantId}`===n:W=r,S.jsx(nG,{rowKey:G,row:F,index:q,isSelected:W,isEditing:i===G,isSwitchInFlight:N,busy:s,registerItem:M,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:d,onPastPointerDown:h,onHover:p,onRemove:m,onRemovePast:y,onStartRename:w,onCommitRename:_,onCancelRename:x,onCopyVariantContext:E,activeSessionId:k,projectPath:P},G)})})]})},nG=({rowKey:t,row:e,index:n,isSelected:r,isEditing:s,isSwitchInFlight:i,busy:a,registerItem:u,onSelectActive:c,onSelectPast:d,onSelectOriginal:h,onActivePointerDown:p,onPastPointerDown:m,onHover:y,onRemove:w,onRemovePast:_,onStartRename:x,onCommitRename:E,onCancelRename:k,onCopyVariantContext:P,activeSessionId:T,projectPath:A})=>{var Ce,oe;const L=v.useRef(null);fU(u,n,L);const O=e.kind==="active",R=e.kind==="original",M=e.kind==="active"?e.variant:null,N=e.kind==="past"?e.entry:null,j=O?M.status==="succeeded":!0,F=O?Za(M):!0,q=O?PR(M):!1,G=O&&(M.status==="pending"||M.status==="running"),W=O?j&&(F||q)||G:!0,K=O&&M.status==="failed",X=O&&M.status==="cancelled",$=O&&(!W||i),ee=O&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,z=O&&(((Ce=M.refinement)==null?void 0:Ce.status)==="pending"||((oe=M.refinement)==null?void 0:oe.status)==="running");let D=Tw;O?D=M.label||`Direction ${n+1}`:N&&(D=N.label.trim()||"Untitled direction");let Y;O?Y=M.runLabel:N&&(Y=N.runLabel);let te=Rw;O?te=M.description:N&&(te=N.brief);const ie=te?QW(te):null,ae=JW(e,T),ue=ae?"Copy variant reference":"Copy description";return s?S.jsx("li",{ref:L,"data-proximity-index":n,className:"group relative z-10",children:S.jsx("div",{className:"bg-main-input flex w-full items-start gap-2 rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsx(rG,{initial:D,onCommit:se=>E(e,se),onCancel:k}),ie&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:ie})]})})}):S.jsxs("li",{ref:L,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:W?0:-1,"data-variant-id":O?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if($)return;const se=window.getSelection();se&&!se.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?d(e.entry):h())},onKeyDown:se=>{$||(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?d(e.entry):h())},onPointerDown:se=>{$||(e.kind==="active"?j&&p(e.variant.workItemId,se):e.kind==="past"&&m(e.entry,se))},"aria-pressed":W?r:void 0,"aria-disabled":O?!W:void 0,"aria-busy":G||z,onMouseEnter:O?()=>y(M.workItemId):void 0,onMouseLeave:O?()=>y(null):void 0,className:dr("focus-visible:ring-content-muted/40 flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors focus:outline-none focus-visible:ring-1",r&&"bg-main-input ring-content-muted/40 ring-1 ring-inset",j&&F&&"cursor-grab active:cursor-grabbing",(G||q)&&"cursor-pointer",!j&&!G&&!q&&"cursor-not-allowed opacity-60",$&&"cursor-not-allowed opacity-50"),style:j?{touchAction:"none"}:void 0,children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[(G||z)&&S.jsx(pw,{className:"text-content-muted shrink-0 text-sm","data-testid":z&&!G?"variant-refining":void 0}),S.jsx(Bo,{label:"Double-click to rename",disabled:R,children:S.jsx("span",{onDoubleClick:se=>{se.stopPropagation(),R||x(t)},className:dr("min-w-0 flex-1 truncate text-sm font-medium select-text",R?"cursor-default":"cursor-text",j||r?"text-content":"text-content-muted"),children:D})}),K&&S.jsx(ck,{label:"Failed"}),X&&S.jsx(ck,{label:"Cancelled"}),Y&&S.jsx("span",{className:"ml-auto max-w-[8rem] shrink-0 truncate rounded px-1.5 py-0.5 text-[10px] font-medium opacity-100 transition-opacity duration-150 group-hover:opacity-0 group-has-[:focus-visible]:opacity-0",style:_5(Y),children:Y})]}),ie&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:ie})]})}),S.jsxs("div",{className:dr("absolute top-1.5 right-2 flex items-center gap-0.5 transition-opacity duration-150","pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100"),children:[te||ae?S.jsx(Bo,{label:ue,children:S.jsx("button",{type:"button","aria-label":ue,onClick:se=>{se.stopPropagation(),P(eG({label:D,description:te,reference:ae,projectPath:A}))},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(Zd,{size:13,weight:"bold"})})}):null,!R&&S.jsx(Bo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:se=>{se.stopPropagation(),x(t)},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(gz,{size:13,weight:"bold"})})}),!R&&S.jsx(Bo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:ee,onClick:se=>{se.stopPropagation(),e.kind==="active"?w(e.variant):_(e.entry)},onPointerDown:se=>se.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(_z,{size:13,weight:"bold"})})})]})]})},rG=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=v.useState(t),i=v.useRef(!1),a=v.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},ck=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),sG=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx(Zd,{size:12,weight:"bold"}):null,a]})]})},iG={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},oG={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},aG=({artifacts:t})=>{const[e,n]=v.useState(null),r=v.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(lG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},lG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=oG[t.kind],s=t.source?iG[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(uG,{artifact:t})}):null]})},uG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),cG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:d,deployedUrl:h})=>{var O,R,M,N;const p=t?((R=(O=t.actions)==null?void 0:O.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,m=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),w=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",x=!i||!p||e!==null,E=a&&c>0,P=w?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":d?"Copy canvas link":"Share canvas",L=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(dR,{primaryLabel:P,primaryIcon:h&&!w?Zd:void 0,primaryAction:()=>{t&&r(t)},isDisabled:x,isDropdownDisabled:e!==null,isLoading:w,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:d&&!_?Zd:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!m,title:(N=(M=t==null?void 0:t.actions)==null?void 0:M.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:L}):null]})]})},TR=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(pw,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),dG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(TR,{},`${e.requestId}-${r}`)))}),fG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(TR,{},e))}),hG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),dk="Try different ways to create a dropdown that feels fluid and dynamic",pG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=v.useState(!1),s=FU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(dk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",dk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(WT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx(Zd,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},mG=({onClose:t})=>{const e=Qe(P5);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Bo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(vz,{className:"h-4 w-4",weight:"bold"})})})]}):null},gG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',vG=({itemSelector:t=gG,loop:e=!1}={})=>{const n=v.useRef(null),r=v.useRef(null),s=v.useCallback(a=>{var u;n.current=a,a?r.current=DU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=v.useCallback(a=>{var w;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const d=Array.from(c.querySelectorAll(t));if(d.length===0)return;a.preventDefault(),a.stopPropagation();const h=d.indexOf(document.activeElement),p=d.length-1,m=_=>{if(h===-1)return _===1?0:p;const x=h+_;return e?(x+d.length)%d.length:Math.min(Math.max(x,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=m(1):y=m(-1),(w=d[y])==null||w.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},fk="/assets/arena-Db0j1set.png",yG=vs("useIntegrations"),hk=["integrations"],_G="rivet:connect-result",wG=t=>typeof t=="object"&&t!==null&&t.type===_G,xG=tt(null),bG=()=>{const t=T8(),[e,n]=wP(xG),r=B1({queryKey:hk,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=v.useCallback(()=>t.invalidateQueries({queryKey:hk}),[t]),i=v.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const d=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await d.json().catch(()=>({}));if(!d.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const m=()=>{window.removeEventListener("message",y),clearInterval(w),s(),p()},y=_=>{wG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&yG.warn(`Connect failed for ${u}:`,_.data.message),m())};window.addEventListener("message",y);const w=setInterval(()=>{c.closed&&m()},500)})}finally{n(null)}},[s,n]),a=v.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},bu=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(Pw,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},pk=vs("ConnectorsModal"),SG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),EG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${fk})`,maskImage:`url(${fk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),CG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(SG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(EG,{})}],kG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(WT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},P_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:d}=bG(),[h,p]=v.useState(null),m=x=>s.find(E=>E.provider===x),y=v.useCallback(x=>{c(x).catch(E=>{const k=E instanceof Error?E.message:"Could not connect.";pk.warn(`Connect error for ${x}:`,k),ht.error(k)})},[c]),w=v.useCallback(x=>{d(x).catch(E=>{const k=E instanceof Error?E.message:"Could not disconnect.";pk.warn(`Disconnect error for ${x}:`,k),ht.error(k)})},[d]),_=n==="onboarding";return S.jsx(sw,{open:t,onOpenChange:x=>!x&&e(),children:S.jsxs(iw,{children:[S.jsx(ow,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(aw,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(SR,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(lw,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(bu,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(r5,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(uw,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:CG.map(x=>S.jsx(kG,{meta:x,integration:m(x.provider),isPending:i||u===x.provider,isHighlighted:r===x.provider,onConnect:()=>y(x.provider),onDisconnect:()=>w(x.provider)},x.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},mk=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),PG=vs("SupportTicketModal"),gk=5e3,f1="feedback",TG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},RG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=TG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},AG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=cD(),[s,i]=v.useState(""),[a,u]=v.useState(!1),[c,d]=v.useState(null),h=v.useCallback(()=>{i("")},[]),p=v.useCallback(()=>{a||(h(),e())},[a,e,h]),m=v.useCallback(async()=>{const x=s.trim();if(!(!x||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,k=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:f1,message:x,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:k??void 0,appVersion:"0.14.7",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await RG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:f1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const k=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:f1,error:k}),PG.error("Failed to submit support ticket:",k),ht.error("Could not send feedback",{description:k})}finally{u(!1)}}},[n,a,s,e,r,h]),y=v.useCallback(x=>{x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),m())},[m]),w=gk-s.length,_=a||s.trim().length===0;return S.jsx(sw,{open:t,onOpenChange:x=>!x&&p(),children:S.jsxs(iw,{children:[S.jsx(ow,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(aw,{ref:d,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(SR,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(lw,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(bu,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(r5,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(uw,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:x=>i(x.target.value),onKeyDown:y,maxLength:gk,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[w<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:w}),S.jsx(bu,{onClick:m,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(r0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(fz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},IG=vs("ProfileAvatar"),RR=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},MG=(t,e)=>RR(t,e).charAt(0).toUpperCase(),OG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Qe(R5),i=Qe(N5),a=Qe(L5),[u,c]=v.useState(!1),[d,h]=v.useState(!1),[p,m]=v.useState(!1),[y,w]=v.useState(!1),{containerRef:_,onKeyDown:x}=vG(),E=Qe(Pf),k=MG(r,s);if(!k)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(mk,{className:"h-7 w-7 rounded-full"}),S.jsx(mk,{className:"h-3 w-16"})]}):null;const P=RR(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,L=async()=>{w(!0);try{const O=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!O.ok)throw new Error(`Logout failed: ${O.status}`)}catch(O){IG.warn("Logout request failed",O),ht.error("Could not log out. Please try again."),w(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(aR,{open:u,onOpenChange:c,children:[S.jsx(lR,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:k}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(uR,{children:S.jsxs(cR,{ref:_,onKeyDown:x,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(e5,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),m(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(pz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:L,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(yz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(P_,{isOpen:d,onClose:()=>h(!1)}),S.jsx(AG,{isOpen:p,onClose:()=>m(!1),contactEmail:s??void 0})]})},LG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(mG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(KW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(OG,{side:"top",align:"start"})})]}),NG=vs("useServerConfig"),DG=()=>{const[t,e]=v.useState(null),[n,r]=v.useState(!0),[s,i]=v.useState(null),a=v.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const d=await c.json();if(!d.framework)throw new Error("Server did not return framework information");const h={userPort:((u=d.ports)==null?void 0:u.userDevServer)||3e3,framework:d.framework};return e(h),h}catch(c){const d=c instanceof Error?c.message:"Failed to fetch server config";throw i(d),NG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},jG="#1C1C20",Ni=[118,118,124],vk=.85,FG=3,VG=.15,dp=36,$G=4.4,HG=.7,zG=3.5,UG=.8,yk=9,BG=11,WG=[1.35,1.12,.95,.85],GG=[0,1.1,2.3,3.1],KG=[0,.35,.16,.13],ZG=[.9,.5,.4,.35],Fa=3,h1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],fp=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Dp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Va=(t,e)=>(Math.round(t/e-.5)+.5)*e,qG=Math.sin(Math.PI/3),_k=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*qG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},YG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-yk}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-yk}return Dp(.5-r/(2*BG))},AR=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(T5),r=v.useRef(null),s=v.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],d=0,h=0,p=dp,m=dp,y=null,w=null,_=0,x=-1;const E=new Array(33),k=j=>{const F=Math.round(j*32);let q=E[F];if(!q){const G=F/32,W=Math.round(Ni[0]+(255-Ni[0])*G),K=Math.round(Ni[1]+(255-Ni[1])*G),X=Math.round(Ni[2]+(255-Ni[2])*G);q=`rgba(${W}, ${K}, ${X}, ${vk})`,E[F]=q}return q},P=j=>{const F=1-.35*j,q=Math.round(Ni[0]*F),G=Math.round(Ni[1]*F),W=Math.round(Ni[2]*F);return`rgba(${q}, ${G}, ${W}, ${vk})`},T=j=>{let F=Math.floor(Math.random()*h1.length);F===x&&(F=(F+1)%h1.length),x=F;const q=[0,0,0,0],G=h1[F].map((D,Y)=>{const te=D.level,ie=q[te]++,ae=GG[te]+ie*KG[te],ue=ZG[te]+fp(F*131+Y*17+5)*.2;if(D.hline){const se=Va((D.y??0)*h,m);return{hline:!0,x1:Va(D.x1*d,p),x2:Va(D.x2*d,p),y1:se,y2:se,level:te,start:ae,dur:ue}}const Ce=Va(D.x1*d,p),oe=Va((D.y1??0)*h,m);return{hline:!1,x1:Ce,y1:oe,x2:Math.max(Va(D.x2*d,p),Ce+p),y2:Math.max(Va((D.y2??0)*h,m),oe+m),level:te,start:ae,dur:ue}}),W=G.reduce((D,Y)=>Math.max(D,Y.start+Y.dur),0),K=c.length,X=new Float32Array(K*Fa),$=new Int16Array(K*Fa).fill(-1),ee=new Uint8Array(K),z=G[0];for(let D=0;D<K;D++){const Y=c[D];Y.x>z.x1&&Y.x<z.x2&&Y.y>z.y1&&Y.y<z.y2&&(ee[D]=1);const te=D*Fa;for(let ie=0;ie<G.length;ie++){const ae=YG(Y.x,Y.y,G[ie]);if(ae<=.02)continue;let ue=te;for(let Ce=te;Ce<te+Fa;Ce++){if($[Ce]===-1){ue=Ce;break}X[Ce]<X[ue]&&(ue=Ce)}($[ue]===-1||ae>X[ue])&&(X[ue]=ae,$[ue]=ie)}}return{startT:j,buildEnd:W,els:G,frame:z,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();d=Math.max(1,j.width),h=Math.max(1,j.height);const F=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(d*F),i.height=Math.round(h*F),a.setTransform(F,0,0,F,0,0);const q=Math.max(8,Math.round(d/dp)),G=Math.max(6,Math.round(h/dp));p=d/q,m=h/G,c=[];for(let W=0;W<G;W++){const K=G>1?W/(G-1):.5,X=$G*(1+HG*.4*(K*2-1));for(let $=0;$<q;$++){const ee=W*8191+$*131+1,z={x:($+.5)*p,y:(W+.5)*m,size:X,seed:ee,phase:fp(ee),kind:0};z.kind=Math.floor(fp(ee*97)*3),c.push(z)}}w=null,y=null},L=new Float32Array(32),O=j=>{a.fillStyle=jG,a.fillRect(0,0,d,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+zG&&(w=y,_=j,y=T(j+.2));let F=0;w&&(F=1-Dp((j-_)/UG),F<=0&&(w=null));const q=y;for(let z=0;z<q.els.length;z++){const D=q.els[z];L[z]=Dp(Math.min(1,Math.max(0,(j-q.startT-D.start)/D.dur)))}const G=L[0],W=P(0),K=P(G),X=F>0?P(F):W,$=F>0?P(Math.max(G,F)):K,ee=c.length;for(let z=0;z<ee;z++){const D=c[z];let Y=0,te=0;const ie=z*Fa;for(let Pe=ie;Pe<ie+Fa;Pe++){const be=q.cellEl[Pe];if(be<0)break;const $e=q.cellQ[Pe]*L[be];$e>Y&&(Y=$e,te=q.els[be].level)}if(w)for(let Pe=ie;Pe<ie+Fa;Pe++){const be=w.cellEl[Pe];if(be<0)break;const $e=w.cellQ[Pe]*F;$e>Y&&(Y=$e,te=w.els[be].level)}const ae=j/FG+D.phase,ue=Math.floor(ae),Ce=ae-ue,oe=Dp(Math.min(Ce,1-Ce)/VG),se=Math.floor(fp(D.seed*97+ue*7919)*3);se!==D.kind&&Y<.02&&oe<.05&&(D.kind=se);const he=Math.max(oe*(1-Y),Y);if(!(he<.01))if(Y<.02){const Pe=q.inFrame[z]===1,be=w?w.inFrame[z]===1:!1;Pe?a.fillStyle=be?$:K:a.fillStyle=be?X:W;const $e=Math.max(Pe?G:0,be?F:0);_k(a,D.kind,D.x,D.y,D.size*he*(1-.2*$e))}else{a.fillStyle=k(Y);const Pe=1+(WG[te]-1)*Y;_k(a,D.kind,D.x,D.y,D.size*he*Pe)}}};A();let R=0;if(u)y=T(-100),O(0);else{const j=performance.now(),F=q=>{O((q-j)/1e3),R=requestAnimationFrame(F)};R=requestAnimationFrame(F)}const M=new ResizeObserver(()=>{A(),u&&(y=T(-100),O(0))});M.observe(i),r.current=()=>{cancelAnimationFrame(R),M.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},XG=async(t=null)=>{if(t)return QG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return hp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return hp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:hp()},QG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},hp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},wk=vs("usePreviewUpstreamHealth"),JG=500,eK=4e3,tK=15e3,nK=(t,e={})=>{const n=v.useRef(null),r=v.useRef(null),s=e.probeMsWhileDown??JG,i=e.probeMsWhileUp??eK,a=e.firstUnreachableCaptureAfterMs??tK,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,d=e.skip??!1,[h,p]=v.useState(t==="static"),[m,y]=v.useState(0),[w,_]=v.useState(null),[x,E]=v.useState(0),[k,P]=v.useState(!1),[T,A]=v.useState(!1),[L,O]=v.useState(t==="static"?null:"upstream_unreachable");return v.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),O(null);return}if(d){p(!1),_(null),E(0),P(!1),A(!0),O("upstream_unreachable"),n.current=null;return}let R=!0;const M=Date.now();_(M),E(0),P(!1),p(!1),A(!1),O("upstream_unreachable");const N={current:!1},j={current:!1},F={current:!1},q={current:null},G={current:!1};let W=null;const K=()=>{F.current||(F.current=!0,R&&A(!0))},X=()=>{W!==null&&(clearTimeout(W),W=null)},$=(z,D)=>{X(),W=setTimeout(D,z)},ee=async()=>{if(!R)return;E(ie=>ie+1);const{isOk:z,unavailableReason:D}=await XG(c);if(!R)return;if(K(),z){const ie=!G.current;G.current=!0,p(!0),O(null),q.current=null,j.current=!1,P(!1),N.current?ie&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-M})),$(i,ee);return}const Y=G.current;G.current=!1,p(!1),O(D),q.current===null&&(q.current=Date.now(),j.current=!1,P(!1)),Y&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(ie=>ie+1),wk.warn("Preview upstream became unavailable after it was ready"));const te=Date.now()-q.current;te>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:te}),wk.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,d]),v.useEffect(()=>{var M;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((M=n.current)==null||M.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:m,probeStartedAt:w,probeAttemptCount:x,isFirstUnreachableWindowExceeded:k,initialProbeComplete:T,unavailableReason:L}};function rK(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const IR=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},MR=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${IR(t)}${e}`:e,sK="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",iK=t=>sK,oK=vs("PreviewSurface"),xk=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",OR=({target:t,src:e,framework:n,remountKey:r})=>(Qe(s0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:iK(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:xk(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:xk(e,t),framework:n})),oK.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),aK="modulepreload",lK=function(t){return"/"+t},bk={},uK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(d=>{if(d=lK(d),d in bk)return;bk[d]=!0;const h=d.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":aK,h||(m.as="script"),m.crossOrigin="",m.href=d,c&&m.setAttribute("nonce",c),document.head.appendChild(m),h)return new Promise((y,w)=>{m.addEventListener("load",y),m.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},cK=v.lazy(()=>uK(()=>Promise.resolve().then(()=>zZ),void 0)),dK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},fK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},hK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},Td=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:d,role:h="status",busy:p=!1,className:m=""})=>{const y=v.useCallback(_=>{_&&d&&(Te==null||Te.capture("status_surface_shown",{state:d,tone:i,fill:a}))},[d,i,a]),w=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${dK[a]} ${m}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":d,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,w?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:fK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:hK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},T_=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(Td,{...r,size:n,busy:!0,backdrop:S.jsx(AR,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(Td,{...r,size:n,busy:!0,backdrop:S.jsx(v.Suspense,{fallback:null,children:S.jsx(cK,{className:"absolute inset-0"})})}):S.jsx(Td,{...r,size:n,busy:!0,media:S.jsx(r0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),LR=({icon:t,...e})=>S.jsx(Td,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Nm=t=>S.jsx(Td,{...t,tone:"error",role:"alert"}),Sk="/static/",pK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(Sk)}catch{return t.endsWith(Sk)}},mK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Qe(g_),a=st(g_),u=Qe(Am),c=st(Am),d=Qe(kf),h=Qe(s0),p=Qe(v_),m=Qe(y_),y=Qe(A5),w=Qe(I5),_=st(y_),x=Qe(na),E=Qe(w_),k=st(v_),P=d.active&&d.projectContext.kind==="fresh",T=Qe(__),A=d.active?d.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&(!je.previewUnavailable||je.previewUnavailable.reason==="idle_timeout")))??null:null,L=d.active&&d.variants.some(je=>je.status==="pending"||je.status==="running"),O=P||L,R=d.active?d.variants.find(je=>{var Je;return je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable&&((Je=je.previewUnavailable)==null?void 0:Je.reason)!=="idle_timeout"})??null:null,M=e==="static"&&u!==null&&pK(u);v.useEffect(()=>{d.active||k(!1)},[d.active,k]);const N=v.useRef(!1);v.useEffect(()=>{const je=!!(x!=null&&x.left||x!=null&&x.right),Je=je&&!N.current;N.current=je;const it=d.active?d.sessionId:null;!it||!rK({enteringSplit:Je,isExistingSession:d.active&&d.projectContext.kind==="existing",hasActiveVariantProxy:p&&m!==null})||(k(!1),_(null),a(Ze=>Ze+1),fetch(`/api/variants/${encodeURIComponent(it)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[x,d,p,m,k,_,a]);const F=v.useMemo(()=>{var xn;if(p||u&&!M||!d.active)return null;const{stage:je,variants:Je}=d,it=je==="ready"||je==="degraded",Ze=Je.some(jt=>{var An,zn;return((An=jt.refinement)==null?void 0:An.status)==="pending"||((zn=jt.refinement)==null?void 0:zn.status)==="running"});if(!it&&!Ze)return null;const _t=Je.find(jt=>{var An;return jt.status==="succeeded"&&((An=jt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=_t==null?void 0:_t.preview)==null?void 0:xn.kind)==="static_artifact"?_t.preview.url:null},[M,u,p,d])??u,q=v.useMemo(()=>!d.active||!F?null:d.variants.find(je=>{var Je;return((Je=je.preview)==null?void 0:Je.kind)==="static_artifact"&&F.startsWith(je.preview.url)})??null,[F,d]),G=v.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!d.active)return Rm;if(q)return{kind:"variant",sessionId:d.sessionId,variantId:q.workItemId};if(F){const Je=F.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),it=Je!=null&&Je[1]?decodeURIComponent(Je[1]):null,Ze=Je!=null&&Je[2]?decodeURIComponent(Je[2]):null;if(it===d.sessionId&&Ze&&d.variants.some(jt=>jt.workItemId===Ze))return{kind:"variant",sessionId:d.sessionId,variantId:Ze};const _t=F.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=_t!=null&&_t[1]?decodeURIComponent(_t[1]):null;if(xn&&d.variants.some(jt=>jt.workItemId===xn))return{kind:"variant",sessionId:d.sessionId,variantId:xn}}const je=!!(x!=null&&x.left||x!=null&&x.right);return(!je||P)&&!F&&p&&m&&d.variants.some(Je=>Je.workItemId===m)?{kind:"variant",sessionId:d.sessionId,variantId:m}:(!je||P)&&!F&&T&&d.variants.some(Je=>Je.workItemId===T)?{kind:"variant",sessionId:d.sessionId,variantId:T}:Rm},[E,q,d,p,m,F,x,P,T]),W=v.useRef(null);v.useEffect(()=>{var Ze,_t;if(!q||((Ze=q.preview)==null?void 0:Ze.kind)!=="static_artifact"||((_t=q.refinement)==null?void 0:_t.status)!=="succeeded")return;const je=`${q.workItemId}:${q.refinement.workItemId}`;if(W.current===je)return;W.current=je;const Je=q.preview.url.includes("?")?"&":"?",it=`${q.preview.url}${Je}refinement=${encodeURIComponent(q.refinement.workItemId)}`;F!==it&&(c(it),a(xn=>xn+1))},[F,q,a,c,d]);const K=F!==null&&$W(F),X=F!==null&&!K||P&&!p&&!K,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:z,initialProbeComplete:D}=nK(e,{rerunProbeImmediatelyOnVersion:i,probePath:K?F:null,skip:X}),[Y,te]=v.useState(()=>y&&$?i:null),ie=v.useRef(null);v.useEffect(()=>{if(!y){ie.current=null,te(null);return}if(Y===i){ie.current=null;return}const je=ie.current;if(!je||je.remountKey!==i){ie.current={remountKey:i,probeAttemptCount:z};return}$&&z>je.probeAttemptCount&&(ie.current=null,te(i))},[Y,i,y,z,$]);const ue=F!==null&&!K||$,oe=w||y&&Y!==i||y&&!ue,se=`${ee}:${i}`,he=r?`/try/${encodeURIComponent(r)}`:"",Pe=CR(window.location.pathname),be=e==="static"?`${he}/static${Pe??"/"}`:`${he}${Pe??"/"}`,$e=IR(h);let ot=null;F&&(ot=MR({agentApplyMode:h,url:F}));const ge=A||oe?"about:blank":(K&&!ue?"about:blank":ot)??(s||!ue?"about:blank":`${$e}${be}`),gt=!!A||!!R||!ue&&D;let dt=null;return oe?dt=S.jsx(T_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?dt=S.jsx(T_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?dt=S.jsx(Nm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):gt&&(dt=O?S.jsx(LR,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Nm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[dt,S.jsx(OR,{target:G,src:ge,framework:e,remountKey:se})]})};function Ek({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(na),c=Qe(kf),d=Qe(s0),h=v.useRef(!1),p=v.useCallback(()=>{h.current||(h.current=!0,sf({source:i,sessionId:e,variantId:n}))},[i,e,n]),m=v.useCallback(()=>{if(a){u(null);return}p(),u(k=>{if(!k)return null;const P={...k};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=v.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),w=v.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(k=>k.workItemId===n)??null,[e,n,c]),_=v.useMemo(()=>{var P,T;let k=r;if(((P=w==null?void 0:w.preview)==null?void 0:P.kind)==="static_artifact"&&((T=w.refinement)==null?void 0:T.status)==="succeeded"){const A=w.preview.url.includes("?")?"&":"?";k=`${w.preview.url}${A}refinement=${encodeURIComponent(w.refinement.workItemId)}`}return MR({agentApplyMode:d,url:k})},[d,w,r]),x=((E=w==null?void 0:w.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${w.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Bo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:m,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(OR,{target:y,src:_,framework:"static",remountKey:x})})]})}const Ck=240;function gK(){const t=Qe(Jd),e=Qe(hw),n=v.useRef(null);return v.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-Ck/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:Ck},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:_5(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function vK(){const t=Qe(Jd),e=Qe(hw),n=Qe(na),r=st(Jd),s=st(na),i=v.useRef(null),[a,u]=v.useState(null),[c,d]=v.useState("hidden");v.useEffect(()=>{if(!t){d("hidden"),u(null);return}const m=requestAnimationFrame(()=>d("visible"));return()=>cancelAnimationFrame(m)},[t]);const h=v.useCallback((m,y)=>{const w=i.current;if(!w)return null;const _=w.getBoundingClientRect();return m<_.left||m>_.right||y<_.top||y>_.bottom?null:m<(_.left+_.right)/2?"left":"right"},[]);if(v.useEffect(()=>{if(!t||!e)return;const m=h(e.x,e.y);u(y=>y===m?y:m)},[t,e,h]),v.useEffect(()=>{if(!t)return;const m=y=>{const w=h(y.clientX,y.clientY);if(w&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},x=n==null?void 0:n[w];x&&(x.sessionId!==_.sessionId||x.variantId!==_.variantId)&&sf(x),s(E=>({...E??{},[w]:_})),d("exiting"),window.setTimeout(()=>r(null),220)}else sf(t),d("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(kk,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(kk,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function kk({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const NR=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},Pk=(t,e)=>{if(!t)return;const n=NR(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},yK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(AR,{trackGlobalLoaderCount:!1})})}),_K=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=DG();return v.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(yK,{}):u||!s?S.jsx(Nm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(wK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function wK(t){const e=Qe(na),n=Qe(Jd),r=Qe(kf),s=Qe(Am),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=v.useMemo(()=>{var A,L;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,x=r.variants.filter(O=>{var R;return O.status==="succeeded"&&((R=O.preview)==null?void 0:R.kind)==="static_artifact"&&O.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=x.find(O=>{var R;return((R=O.preview)==null?void 0:R.kind)==="static_artifact"&&O.preview.url===E})??x[0];if(((L=P==null?void 0:P.preview)==null?void 0:L.kind)!=="static_artifact")return;const T=NR(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=Pk(i,r)??(a?u:void 0),d=Pk(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!d,m=!!(c||d),y=S.jsx(mK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${m?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(Ek,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&d)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),d&&S.jsx(Ek,{side:"right",sessionId:d.sessionId,variantId:d.variantId,url:d.url,label:d.label,source:d.source,isFallback:p},`right-${d.sessionId}:${d.variantId}:${d.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(vK,{}),S.jsx(gK,{})]})})}const DR=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(r0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function Ui(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jR(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
115
115
  * GSAP 3.15.0
116
116
  * https://gsap.com
117
117
  *
@@ -419,4 +419,4 @@ ${s}`:s},tG=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy
419
419
  <body>
420
420
  <div class="panel">${s8}</div>
421
421
  </body>
422
- </html>`,UQ="Too many people are trying Rivet right now. Please try again in a few minutes.",vI="Failed to start an isolated demo session.",BQ=async t=>{if(t.status===429)return UQ;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return vI},K_=274,Wm=395,R1=Math.min(Wm,Math.round((K_+Wm)/2*1.1)),o8="rivet:panelWidth:v2",WQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},GQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:d=!1})=>{const h=Qe(T5)>0,[p,m]=wP(k5),y=qV(),[w,_]=v.useState(()=>{if(typeof window>"u")return R1;const G=Number(window.localStorage.getItem(o8));return Number.isFinite(G)&&G>=K_&&G<=Wm?G:R1}),[x,E]=v.useState(!1),[k,P]=v.useState(sq),T=p?w:0,[A,L]=v.useState(p);v.useEffect(()=>{if(!p){L(!1);return}P(G=>rq({position:G,boundsLeftPx:w}))},[p,w]),v.useEffect(()=>{window.localStorage.setItem(o8,String(w))},[w]),v.useEffect(()=>{if(!p)return;const G=W=>{W.key==="Escape"&&(WQ(W.target)||(W.preventDefault(),m(!1)))};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[p,m]);const O=v.useCallback(G=>{G.preventDefault(),G.stopPropagation();const W=G.clientX,K=w;E(!0);const X=ee=>{const z=Math.min(Wm,Math.max(K_,K+(ee.clientX-W)));_(z)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[w]),R=v.useCallback(()=>_(R1),[]),M=vq(),N=Qe(Pf);wq({enabled:!N});const j=M.isProcessing?"Completing authentication...":a,F=j!==null,q=st(O5);return v.useEffect(()=>{q(t??null)},[t,q]),v.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(fl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(BZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(OA,{isSigningIn:s||F,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(_K,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(DR,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!d&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?w:0},children:S.jsxs(fl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-w},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&L(!0)},style:{width:w,willChange:"transform"},children:[S.jsx(LG,{onClose:()=>m(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:O,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${x?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),x&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(aq,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:k,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>m(G=>!G)})]}):null}),S.jsx(S$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},Z_="rivet_connect_deep_link",KQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(Z_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(Z_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},ZQ=KQ(),qQ=()=>{const[t,e]=v.useState(window.location.hash),[n]=v.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Hp)==="1"),[r,s]=v.useState(!1),[i,a]=v.useState(ZQ);v.useEffect(()=>{n&&window.sessionStorage.removeItem(Hp)},[n]);const{config:u,refetchConfig:c,loading:d,error:h}=mq(),p=st(Pf),[m,y]=v.useState(!1),[w,_]=v.useState(null),[x,E]=v.useState(!1),[k,P]=v.useState(!1),[T,A]=v.useState(null),[L,O]=v.useState(!1),R=v.useRef(!1),M=v.useRef(!1),N=FQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,F=N??T??j,q=v.useMemo(()=>LQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,F),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,F]),G=v.useMemo(()=>OQ({configLoading:d,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,d,N,T,j]);v.useLayoutEffect(()=>{if(!G){O(!1);return}O(!0)},[G]);const W=L,K=v.useMemo(()=>NQ(W),[W]),X=(u==null?void 0:u.demoMode)===!0&&W,$=v.useRef(null);$.current=F;const ee=v.useCallback(async()=>{if(!R.current)return;A(null);const he=await c();if((he==null?void 0:he.demoMode)===!0&&he.agentModeAvailable!==!0){P(!1);return}(he==null?void 0:he.demoMode)===!0&&P(!0)},[c]);v.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return RQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),v.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const he=window.fetch.bind(window);return MQ({nativeFetch:he,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),v.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const z=v.useCallback(async he=>{const Pe=$.current;if(!(he!=null&&he.forceRefresh)&&Pe)return Pe;if(M.current)return"";M.current=!0;try{const be=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!be.ok){const ot=await BQ(be);throw new Error(ot)}const $e=await be.json();if(!$e.sessionId)throw new Error("Demo session response missing session id.");return A($e.sessionId),$e.sessionId}finally{M.current=!1}},[]);v.useEffect(()=>{j&&A(j)},[j]),v.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),v.useEffect(()=>{if(!u)return;const he=!!u.demoMode,Pe=he?F:null;Te.register({source:he?"tryout":"core",demo_mode:he,...Pe?{demo_session_id:Pe}:{}})},[u,F]);const D=v.useCallback(async()=>{var Pe;y(!0),_(null);let he=null;try{if(he=window.open("","_blank"),!he)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{he.document.open(),he.document.write(zQ),he.document.close()}catch(ot){T1.warn("Failed to render loading state in auth popup:",ot)}const be=await fetch(`${i8}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),$e=await be.json();if(!be.ok||!$e.success||!$e.authUrl||!$e.sessionId||!$e.pollSecret)throw new Error($e.error||$e.message||"Failed to start Google login");if(he.closed)throw new Error("Sign-in window was closed before Google login started.");he.location.href=$e.authUrl;for(let ot=0;ot<HQ;ot+=1){if(he.closed)throw new Error("Sign-in window was closed before authentication completed.");const ge=await(await fetch(`${i8}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:$e.sessionId,pollSecret:$e.pollSecret})})).json();if(ge.success&&ge.token&&((Pe=ge.user)!=null&&Pe.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:ge.user.email,token:ge.token,refreshToken:ge.refreshToken,userId:ge.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(he.close(),window.sessionStorage.setItem(Hp,"1"),(u==null?void 0:u.demoMode)===!0){await z({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(ge.error&&ge.error!=="Pending")throw new Error(ge.error||"Google login failed");await new Promise(gt=>setTimeout(gt,$Q))}throw new Error("Authentication timed out. Please try again.")}catch(be){he&&!he.closed&&he.close();const $e=be instanceof Error?be.message:"Failed to start login flow";T1.warn("Hosted login failed:",$e),_($e),y(!1)}},[u==null?void 0:u.demoMode,z]),Y=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||k||m),te=u!=null&&u.agentModeAvailable!==!0,ie=VQ(t),ae=v.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(v.useEffect(()=>{if(!G)return;let he=!1;return z({forceRefresh:!0}).catch(Pe=>{const be=Pe instanceof Error?Pe.message:vI;T1.warn("Hosted session bootstrap failed:",be),_(be),ht.error(be)}).finally(()=>{he||O(!1)}),()=>{he=!0}},[G,z]),v.useEffect(()=>{const he=()=>{const Pe=window.location.hash;e(Pe)};return window.addEventListener("hashchange",he),()=>window.removeEventListener("hashchange",he)},[]),ie==="design-system")return S.jsx(CQ,{});const ue={pathname:window.location.pathname,configLoading:d,hasConfig:u!==null,isRetryingConfig:x};if(jQ(ue)){const he=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:he}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{ae()},children:"Retry"})]})})}if(te)return S.jsx(OA,{isSigningIn:m,onStartSignIn:()=>{D()},errorMessage:w,displayMode:"full"});const oe=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,se=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!oe;return S.jsxs(S.Fragment,{children:[S.jsx(GQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:q,showLoginGate:Y,onStartLogin:D,isStartingLogin:m,loginError:w,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&m?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:W,hostedTryoutPreviewHoldMessage:K,deferInspectorUntilPreviewReady:X}),S.jsx(P_,{context:"onboarding",isOpen:se,onClose:()=>s(!0)}),S.jsx(P_,{context:"menu",isOpen:oe,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(Z_),a(null)}})]})},YQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",XQ=new PO,QQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},JQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});wD.createRoot(document.getElementById("root")).render(S.jsx(_e.StrictMode,{children:S.jsx(uD,{apiKey:YQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...QQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.14.6",env:"production"})}},children:S.jsx(pD,{fallback:S.jsx(JQ,{}),children:S.jsx(TO,{client:XQ,children:S.jsx(DW,{defaultShape:"rounded",children:S.jsx(GX,{defaultLibrary:"lucide",children:S.jsx(qQ,{})})})})})})}));
422
+ </html>`,UQ="Too many people are trying Rivet right now. Please try again in a few minutes.",vI="Failed to start an isolated demo session.",BQ=async t=>{if(t.status===429)return UQ;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return vI},K_=274,Wm=395,R1=Math.min(Wm,Math.round((K_+Wm)/2*1.1)),o8="rivet:panelWidth:v2",WQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},GQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:d=!1})=>{const h=Qe(T5)>0,[p,m]=wP(k5),y=qV(),[w,_]=v.useState(()=>{if(typeof window>"u")return R1;const G=Number(window.localStorage.getItem(o8));return Number.isFinite(G)&&G>=K_&&G<=Wm?G:R1}),[x,E]=v.useState(!1),[k,P]=v.useState(sq),T=p?w:0,[A,L]=v.useState(p);v.useEffect(()=>{if(!p){L(!1);return}P(G=>rq({position:G,boundsLeftPx:w}))},[p,w]),v.useEffect(()=>{window.localStorage.setItem(o8,String(w))},[w]),v.useEffect(()=>{if(!p)return;const G=W=>{W.key==="Escape"&&(WQ(W.target)||(W.preventDefault(),m(!1)))};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[p,m]);const O=v.useCallback(G=>{G.preventDefault(),G.stopPropagation();const W=G.clientX,K=w;E(!0);const X=ee=>{const z=Math.min(Wm,Math.max(K_,K+(ee.clientX-W)));_(z)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[w]),R=v.useCallback(()=>_(R1),[]),M=vq(),N=Qe(Pf);wq({enabled:!N});const j=M.isProcessing?"Completing authentication...":a,F=j!==null,q=st(O5);return v.useEffect(()=>{q(t??null)},[t,q]),v.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(fl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(BZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(OA,{isSigningIn:s||F,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(_K,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(DR,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!d&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?w:0},children:S.jsxs(fl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-w},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&L(!0)},style:{width:w,willChange:"transform"},children:[S.jsx(LG,{onClose:()=>m(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:O,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${x?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),x&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(aq,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:k,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>m(G=>!G)})]}):null}),S.jsx(S$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},Z_="rivet_connect_deep_link",KQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(Z_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(Z_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},ZQ=KQ(),qQ=()=>{const[t,e]=v.useState(window.location.hash),[n]=v.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Hp)==="1"),[r,s]=v.useState(!1),[i,a]=v.useState(ZQ);v.useEffect(()=>{n&&window.sessionStorage.removeItem(Hp)},[n]);const{config:u,refetchConfig:c,loading:d,error:h}=mq(),p=st(Pf),[m,y]=v.useState(!1),[w,_]=v.useState(null),[x,E]=v.useState(!1),[k,P]=v.useState(!1),[T,A]=v.useState(null),[L,O]=v.useState(!1),R=v.useRef(!1),M=v.useRef(!1),N=FQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,F=N??T??j,q=v.useMemo(()=>LQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,F),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,F]),G=v.useMemo(()=>OQ({configLoading:d,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,d,N,T,j]);v.useLayoutEffect(()=>{if(!G){O(!1);return}O(!0)},[G]);const W=L,K=v.useMemo(()=>NQ(W),[W]),X=(u==null?void 0:u.demoMode)===!0&&W,$=v.useRef(null);$.current=F;const ee=v.useCallback(async()=>{if(!R.current)return;A(null);const he=await c();if((he==null?void 0:he.demoMode)===!0&&he.agentModeAvailable!==!0){P(!1);return}(he==null?void 0:he.demoMode)===!0&&P(!0)},[c]);v.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return RQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),v.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const he=window.fetch.bind(window);return MQ({nativeFetch:he,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),v.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const z=v.useCallback(async he=>{const Pe=$.current;if(!(he!=null&&he.forceRefresh)&&Pe)return Pe;if(M.current)return"";M.current=!0;try{const be=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!be.ok){const ot=await BQ(be);throw new Error(ot)}const $e=await be.json();if(!$e.sessionId)throw new Error("Demo session response missing session id.");return A($e.sessionId),$e.sessionId}finally{M.current=!1}},[]);v.useEffect(()=>{j&&A(j)},[j]),v.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),v.useEffect(()=>{if(!u)return;const he=!!u.demoMode,Pe=he?F:null;Te.register({source:he?"tryout":"core",demo_mode:he,...Pe?{demo_session_id:Pe}:{}})},[u,F]);const D=v.useCallback(async()=>{var Pe;y(!0),_(null);let he=null;try{if(he=window.open("","_blank"),!he)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{he.document.open(),he.document.write(zQ),he.document.close()}catch(ot){T1.warn("Failed to render loading state in auth popup:",ot)}const be=await fetch(`${i8}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),$e=await be.json();if(!be.ok||!$e.success||!$e.authUrl||!$e.sessionId||!$e.pollSecret)throw new Error($e.error||$e.message||"Failed to start Google login");if(he.closed)throw new Error("Sign-in window was closed before Google login started.");he.location.href=$e.authUrl;for(let ot=0;ot<HQ;ot+=1){if(he.closed)throw new Error("Sign-in window was closed before authentication completed.");const ge=await(await fetch(`${i8}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:$e.sessionId,pollSecret:$e.pollSecret})})).json();if(ge.success&&ge.token&&((Pe=ge.user)!=null&&Pe.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:ge.user.email,token:ge.token,refreshToken:ge.refreshToken,userId:ge.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(he.close(),window.sessionStorage.setItem(Hp,"1"),(u==null?void 0:u.demoMode)===!0){await z({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(ge.error&&ge.error!=="Pending")throw new Error(ge.error||"Google login failed");await new Promise(gt=>setTimeout(gt,$Q))}throw new Error("Authentication timed out. Please try again.")}catch(be){he&&!he.closed&&he.close();const $e=be instanceof Error?be.message:"Failed to start login flow";T1.warn("Hosted login failed:",$e),_($e),y(!1)}},[u==null?void 0:u.demoMode,z]),Y=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||k||m),te=u!=null&&u.agentModeAvailable!==!0,ie=VQ(t),ae=v.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(v.useEffect(()=>{if(!G)return;let he=!1;return z({forceRefresh:!0}).catch(Pe=>{const be=Pe instanceof Error?Pe.message:vI;T1.warn("Hosted session bootstrap failed:",be),_(be),ht.error(be)}).finally(()=>{he||O(!1)}),()=>{he=!0}},[G,z]),v.useEffect(()=>{const he=()=>{const Pe=window.location.hash;e(Pe)};return window.addEventListener("hashchange",he),()=>window.removeEventListener("hashchange",he)},[]),ie==="design-system")return S.jsx(CQ,{});const ue={pathname:window.location.pathname,configLoading:d,hasConfig:u!==null,isRetryingConfig:x};if(jQ(ue)){const he=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:he}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{ae()},children:"Retry"})]})})}if(te)return S.jsx(OA,{isSigningIn:m,onStartSignIn:()=>{D()},errorMessage:w,displayMode:"full"});const oe=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,se=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!oe;return S.jsxs(S.Fragment,{children:[S.jsx(GQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:q,showLoginGate:Y,onStartLogin:D,isStartingLogin:m,loginError:w,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&m?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:W,hostedTryoutPreviewHoldMessage:K,deferInspectorUntilPreviewReady:X}),S.jsx(P_,{context:"onboarding",isOpen:se,onClose:()=>s(!0)}),S.jsx(P_,{context:"menu",isOpen:oe,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(Z_),a(null)}})]})},YQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",XQ=new PO,QQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},JQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});wD.createRoot(document.getElementById("root")).render(S.jsx(_e.StrictMode,{children:S.jsx(uD,{apiKey:YQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...QQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.14.7",env:"production"})}},children:S.jsx(pD,{fallback:S.jsx(JQ,{}),children:S.jsx(TO,{client:XQ,children:S.jsx(DW,{defaultShape:"rounded",children:S.jsx(GX,{defaultLibrary:"lucide",children:S.jsx(qQ,{})})})})})})}));
@@ -7,7 +7,7 @@
7
7
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
9
  <title>Rivet - The visual editor for design</title>
10
- <script type="module" crossorigin src="/assets/main-Dms3EyUm.js"></script>
10
+ <script type="module" crossorigin src="/assets/main-BqM5p5EF.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/main-CobdEReL.css">
12
12
  </head>
13
13
  <body>