@codeyam-editor/codeyam-editor 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm/cloud.js +308 -52
- package/npm/compose-conflict.js +59 -0
- package/npm/fleet-add-failure.js +174 -18
- package/npm/fleet-cleanup.js +129 -0
- package/npm/fleet-job-badge.js +28 -12
- package/npm/fleet-memory.js +73 -4
- package/npm/fleet-probe-transport.js +155 -0
- package/npm/fleet-queue.js +141 -0
- package/npm/fleet-revision.js +104 -0
- package/npm/fleet-running-plan.js +37 -7
- package/npm/fleet-vm-access.js +162 -0
- package/npm/ingress-invoke.js +46 -2
- package/npm/launch-config.js +163 -4
- package/npm/scenario-check.js +63 -19
- package/npm/scenario-handlers.js +18 -0
- package/npm/scenario-issues.js +11 -0
- package/npm/scenario-mocks.js +245 -39
- package/npm/scenario-playwright.js +114 -22
- package/package.json +5 -5
- package/ui/dist/assets/{ContainerInspector-DgM0pTAx.js → ContainerInspector-DSVZvEkB.js} +1 -1
- package/ui/dist/assets/EditorShell-DnXdHrar.js +256 -0
- package/ui/dist/assets/EditorShell-FvbXyqqD.css +1 -0
- package/ui/dist/assets/ProjectLauncherScreen-E0NYYiwy.js +1 -0
- package/ui/dist/assets/ScenarioDataPanel-6qJE-0lA.js +15 -0
- package/ui/dist/assets/{ScenarioDataPanelFullPage-BLqRCxQX.js → ScenarioDataPanelFullPage-Cyk6efiI.js} +1 -1
- package/ui/dist/assets/ScenarioRenderer-Uyt54vHI.js +21 -0
- package/ui/dist/assets/{index-DCHqRrwO.js → index-BPLKgwon.js} +9 -9
- package/ui/dist/assets/index-DKpgJLo3.css +1 -0
- package/ui/dist/assets/useServerIdentity-CVuHTzjg.js +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/EditorShell-B7Q06uJ_.js +0 -252
- package/ui/dist/assets/EditorShell-DP5UY20G.css +0 -1
- package/ui/dist/assets/ProjectLauncherScreen-BRrEr8Ng.js +0 -1
- package/ui/dist/assets/ScenarioDataPanel-BeQfa28g.js +0 -9
- package/ui/dist/assets/ScenarioRenderer-CIAxfHPh.js +0 -21
- package/ui/dist/assets/index-BygCiJSb.css +0 -1
- package/ui/dist/assets/useServerIdentity-B7rI0u3O.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.fact-fresh{display:inline-flex;align-items:center;margin-left:.4em;padding:.05em .45em;border-radius:999px;font-size:.72em;font-weight:600;letter-spacing:.01em;line-height:1.5;white-space:nowrap;color:#5b6472;background:#636e7d1a;cursor:help;vertical-align:middle}.fact-fresh.stale{color:#9a5b00;background:#d68a0029}.home-landing,.learn-screen,.hosting-screen,.lib-group,.lib-row{--bg: var(--surface-page);--panel: var(--surface-panel);--panel-2: var(--surface-card);--panel-3: var(--surface-raised);--line: var(--line-subtle);--line-2: var(--line-hair);--text: var(--text-strong);--text-2: var(--text-body);--text-3: var(--text-faint);--text-4: var(--text-subtle);--lime: var(--lime-300);--lime-dim: var(--lime-400);--blue: var(--blue-300);--green: var(--green-300);--amber: var(--amber-300);--mono: "IBM Plex Mono", monospace;--sans: "IBM Plex Sans", sans-serif;font-family:var(--sans);color:var(--text);-webkit-font-smoothing:antialiased}.home-landing *,.learn-screen *,.hosting-screen *,.lib-group *,.lib-row *{box-sizing:border-box}@keyframes home-spin{to{transform:rotate(360deg)}}@keyframes home-pulse{0%,to{opacity:1}50%{opacity:.35}}@keyframes home-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}.home-landing{padding:30px 10% 50px}.home-landing .hello{font-size:13px;color:var(--text-3);margin-bottom:5px}.home-landing .project{font-size:27px;font-weight:700;letter-spacing:-.02em;margin-bottom:24px;line-height:1.15}.home-landing .seclabel{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--text-4);margin:0 2px 14px}.home-landing .pnopreview{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#ffffff09;color:var(--text-4);font-size:12px;font-family:var(--mono)}.home-landing .exdoor{border:.5px solid var(--line);border-radius:18px;background:var(--panel-2);overflow:hidden;margin-bottom:15px}.home-landing .exhead{display:flex;align-items:center;gap:12px;padding:20px 22px 0;width:100%;text-align:left;background:none;border:0;font:inherit;color:inherit;cursor:pointer}.home-landing .exhead:hover .dname{text-decoration:underline}.home-landing .exhead .dic{width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:21px;flex-shrink:0;background:var(--blue-soft);color:var(--blue-300)}.home-landing .exhead .grow{flex:1;min-width:0}.home-landing .exhead .dname{font-size:16.5px;font-weight:600}.home-landing .exhead .ddesc{font-size:13px;color:var(--text-3);margin-top:2px}.home-landing .exhead .open{font-size:12.5px;font-weight:600;color:var(--blue);cursor:pointer;display:flex;align-items:center;gap:5px;white-space:nowrap;background:none;border:none;font-family:inherit}.home-landing .exhead .open:hover{text-decoration:underline}.home-landing .rail{display:flex;gap:13px;padding:18px 22px 22px;overflow-x:auto}.home-landing .rail::-webkit-scrollbar{height:7px}.home-landing .rail::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:4px}.home-landing .pcard{flex-shrink:0;width:158px;cursor:pointer;background:none;border:none;padding:0;text-align:left;font-family:inherit;color:inherit}.home-landing .pthumb{width:158px;height:108px;border-radius:10px;border:.5px solid var(--line-2);overflow:hidden;position:relative;transition:.15s}.home-landing .pcard:hover .pthumb{border-color:var(--blue);transform:translateY(-3px)}.home-landing .pshot{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:contain;background:#141414}.home-landing .pcount{position:absolute;bottom:7px;right:7px;font-size:9px;color:var(--text-2);background:#000000a6;border-radius:5px;padding:2px 7px}.home-landing .pname{font-size:13px;font-weight:600;margin-top:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.home-landing .allcard{flex-shrink:0;width:90px;display:flex;align-items:center}.home-landing .alltile{width:90px;height:108px;border-radius:10px;border:.5px dashed var(--line-2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;color:var(--text-3);cursor:pointer;transition:.15s;background:none;font-family:inherit}.home-landing .alltile:hover{border-color:var(--blue);color:var(--blue)}.home-landing .alltile .n{font-size:18px;font-weight:700}.home-landing .alltile .l{font-size:10px}.home-landing .railempty{font-size:13px;color:var(--text-3);padding:4px 0 8px}.home-landing .ic-plan{background:var(--lime-soft);color:var(--lime-300)}.home-landing .ic-learn{background:var(--amber-soft);color:var(--amber-300)}.home-landing .doorrows{display:flex;flex-direction:column;gap:10px}.home-landing .doorrows .exdoor{margin-bottom:0}.home-landing .drow{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:14px;padding:15px 18px;background:var(--panel-2);cursor:pointer;transition:.18s;width:100%;text-align:left;font-family:inherit;color:var(--text)}.home-landing .drow:hover{border-color:var(--line-2);background:var(--panel-3);transform:translateY(-1px)}.home-landing .drow .dic{width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:19px;flex-shrink:0;background:var(--panel-3)}.home-landing .drow .dmain{flex:1;min-width:0}.home-landing .drow .dname{font-size:15px;font-weight:600;display:flex;align-items:center;gap:8px}.home-landing .drow .ddesc{font-size:12.5px;color:var(--text-3);line-height:1.45;margin-top:2px}.home-landing .drow .ddesc b{color:var(--text);font-weight:600}.home-landing .drow .dright{display:flex;align-items:center;gap:13px;flex-shrink:0}.home-landing .drow .dmeta{font-size:11.5px;color:var(--text-3);text-align:right;white-space:nowrap;line-height:1.4}.home-landing .drow .dmeta .stat{font-weight:600;color:var(--text);display:block}.home-landing .drow .arr{color:var(--text-4);font-size:16px;transition:.15s}.home-landing .drow:hover .arr{color:var(--text-2);transform:translate(3px)}.home-landing .drow.building{border-color:#9bd35a66;background:#9bd35a0d}.home-landing .drow.building .dspin{width:40px;height:40px;border-radius:11px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--green-soft)}.home-landing .drow.building .dspin:after{content:"";width:20px;height:20px;border-radius:50%;border:2.5px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.home-landing .drow.building .bstep{display:flex;align-items:center;gap:7px;margin-top:6px;font-size:11px;color:var(--text-3);font-variant-numeric:tabular-nums}.home-landing .drow.building .bflow{font-weight:600;font-variant-numeric:normal;padding:1px 7px;border-radius:6px;background:var(--green-soft);color:var(--green-300)}.home-landing .drow.building.attn .bflow{background:var(--amber-soft, rgba(224, 178, 74, .16));color:var(--amber-300)}.home-landing .drow .bbar{height:5px;background:var(--panel-3);border-radius:3px;margin-top:9px;overflow:hidden;max-width:360px}.home-landing .drow .bbar>div{height:100%;background:var(--green);border-radius:3px;transition:width .6s ease}.home-landing .drow .livedot{width:7px;height:7px;border-radius:50%;background:var(--green);display:inline-block;animation:home-pulse 1.4s ease-in-out infinite}.home-landing .drow.building.attn{border-color:#e0b24a66;background:#e0b24a0f}.home-landing .drow.building.attn .dspin{background:var(--amber-soft, rgba(224, 178, 74, .16))}.home-landing .drow.building.attn .dspin:after{border-color:var(--amber-300);border-top-color:transparent;animation:none}.home-landing .drow .livedot.warn{background:var(--amber-300)}.home-landing .drow.ready .dic.ic-ready{color:var(--blue-300)}.home-landing .cta-pill{display:inline-flex;align-items:center;white-space:nowrap;font-size:12.5px;font-weight:600;padding:8px 14px;border-radius:9px;background:var(--action-bg);color:var(--action-fg)}.home-landing .drow.ready:hover .cta-pill{filter:brightness(1.05)}.home-landing .drow.quiet{background:transparent}.home-landing .drow.quiet .dic{background:var(--panel-2);opacity:.85}.home-landing .drow.quiet .dname{color:var(--text-2)}.home-landing .drow .lines{display:inline-flex;gap:4px;margin-top:5px;justify-content:flex-end}.home-landing .drow .ln{width:16px;height:4px;border-radius:2px;background:var(--line-2)}.home-landing .drow .ln.done{background:var(--green)}.home-landing .bstatus-foot{display:flex;align-items:center;justify-content:flex-end;gap:13px;flex-wrap:wrap;padding:2px 4px 0}.home-landing .bstatus-reset{font-family:inherit;font-size:11.5px;font-weight:600;padding:6px 12px;border-radius:9px;border:.5px solid var(--amber-300);background:transparent;color:var(--amber-300);cursor:pointer;transition:.15s;white-space:nowrap}.home-landing .bstatus-reset:hover{background:#e0b24a1a}.home-landing .crumbs,.learn-screen .crumbs,.hosting-screen .crumbs{font-size:13px;color:var(--text-3);margin-bottom:20px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.home-landing .crumbs a,.learn-screen .crumbs a,.hosting-screen .crumbs a{color:var(--text-3);text-decoration:none;cursor:pointer;white-space:nowrap;background:none;border:none;font:inherit;padding:0}.home-landing .crumbs a:hover,.learn-screen .crumbs a:hover,.hosting-screen .crumbs a:hover{color:var(--text-2)}.home-landing .crumbs .sep,.learn-screen .crumbs .sep,.hosting-screen .crumbs .sep{color:var(--text-4)}.home-landing .crumbs b,.learn-screen .crumbs b,.hosting-screen .crumbs b{color:var(--text);white-space:nowrap}.home-landing .crumbs .back,.learn-screen .crumbs .back,.hosting-screen .crumbs .back{display:inline-flex;align-items:center;gap:5px;color:var(--text-2);cursor:pointer;font-weight:500;margin-right:6px;background:none;border:none;font:inherit;padding:0}.home-landing .crumbs .back:hover,.learn-screen .crumbs .back:hover,.hosting-screen .crumbs .back:hover{color:var(--text)}.learn-screen{padding:26px 40px 40px}.learn-screen .h{font-size:23px;font-weight:700;letter-spacing:-.01em}.learn-screen .hsub{font-size:14px;color:var(--text-3);line-height:1.6;max-width:680px;margin:8px 0 24px}.learn-screen .tlist{display:flex;flex-direction:column;gap:10px}.learn-screen .trow{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:13px;padding:15px 17px;background:var(--panel-2);cursor:pointer;transition:.15s;width:100%;text-align:left;color:var(--text);font-family:inherit}.learn-screen .trow:hover{border-color:var(--line-2);background:var(--panel-3);transform:translateY(-1px)}.learn-screen .trow .tic{width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:21px;flex-shrink:0;background:var(--panel-3);color:var(--text-2)}.learn-screen .trow.next .tic{color:var(--amber)}.learn-screen .trow .tbody{flex:1;min-width:0}.learn-screen .trow .tn{font-size:15.5px;font-weight:600;color:var(--text)}.learn-screen .trow .td{font-size:12.5px;color:var(--text-3);margin-top:2px}.learn-screen .trow .tt{font-size:11px;font-weight:600;color:var(--text-3);white-space:nowrap;border:.5px solid var(--line-2);border-radius:8px;padding:3px 9px}.learn-screen .trow.done .tt{color:var(--green);border-color:#9bd35a4d}.learn-screen .trow.next .tt{color:var(--amber);border-color:#ef9f2759;background:#ef9f2712}.learn-screen .trow .arrow{margin-left:auto;color:var(--text-4);font-size:18px;transition:.15s}.learn-screen .trow:hover .arrow{color:var(--text-2);transform:translate(3px)}.learn-screen .trow.soon .tn{color:var(--text-2)}.learn-screen .trow.soon .td{color:var(--text-4)}.learn-screen .trow-group{display:flex;flex-direction:column;gap:6px}.learn-screen .detected-services{display:flex;flex-direction:column;gap:6px;margin:0 4px 0 22px}.learn-screen .detected-service{display:flex;align-items:center;gap:10px;border:.5px solid var(--line-2);border-radius:10px;padding:9px 13px;background:var(--panel);font-size:12.5px}.learn-screen .detected-service .ds-tag{font-family:var(--mono);font-size:10.5px;font-weight:600;color:var(--blue);border:.5px solid rgba(110,168,254,.35);background:var(--blue-soft);border-radius:7px;padding:2px 7px;white-space:nowrap}.learn-screen .detected-service .ds-name{font-weight:600;color:var(--text)}.learn-screen .detected-service .ds-why{color:var(--text-3);font-family:var(--mono);font-size:11.5px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.learn-screen .detected-service .ds-key-set{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;font-weight:600;color:var(--green, #8bd450);border:.5px solid rgba(139,212,80,.35);border-radius:7px;padding:2px 7px;white-space:nowrap}.learn-screen .detected-service .ds-add-key{margin-left:auto;flex-shrink:0;font-family:inherit;font-size:11.5px;font-weight:600;color:#161616;background:var(--accent, #d7ff63);border:none;border-radius:8px;padding:3px 10px;cursor:pointer;transition:.15s}.learn-screen .detected-service .ds-add-key:hover{filter:brightness(1.05)}.learn-screen .detected-service .ds-dismiss{margin-left:auto;flex-shrink:0;font-family:inherit;font-size:11.5px;color:var(--text-3);background:transparent;border:.5px solid var(--line-2);border-radius:8px;padding:3px 10px;cursor:pointer;transition:.15s}.learn-screen .detected-service .ds-dismiss:hover{color:var(--text);border-color:var(--line);background:var(--panel-3)}.hosting-screen{padding:26px 40px 40px}.hosting-screen .htitle{display:flex;align-items:center;gap:15px;margin-bottom:24px}.hosting-screen .htitle>div{min-width:0}.hosting-screen .htitle .hic{width:54px;height:54px;border-radius:15px;background:linear-gradient(160deg,#1d1d1d,#141414);border:.5px solid var(--line);display:flex;align-items:center;justify-content:center;font-size:26px;flex-shrink:0;color:var(--amber)}.hosting-screen .htitle .h{font-size:25px;font-weight:700;letter-spacing:-.02em}.hosting-screen .htitle .hmeta{font-size:13px;color:var(--text-3);margin-top:3px;font-family:var(--mono)}.hosting-screen .lead{font-size:15px;color:var(--text-2);line-height:1.6;max-width:680px;margin-bottom:8px}.hosting-screen .lead b{color:var(--text);font-weight:600}.hosting-screen .lead.dim{font-size:14px;color:var(--text-3);margin-bottom:26px}.hosting-screen .seclabel{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin:0 2px 13px}.hosting-screen .journey{position:relative;border:.5px solid var(--line);border-radius:18px;background:linear-gradient(150deg,#161616,#0f0f0f);padding:30px 34px 26px;margin-bottom:26px;overflow:hidden}.hosting-screen .jrow{display:flex;align-items:flex-start;justify-content:center;position:relative;z-index:1}.hosting-screen .jcol{display:flex;flex-direction:column;align-items:center;gap:9px;width:170px;text-align:center}.hosting-screen .jtile{width:62px;height:62px;border-radius:16px;background:var(--panel-3);border:.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;font-size:30px}.hosting-screen .jtile.lime{background:#c7f04a1f;border-color:#c7f04a66;box-shadow:0 0 0 4px #c7f04a0f}.hosting-screen .jlbl{font-size:14px;font-weight:600;color:var(--text)}.hosting-screen .jsub{font-size:12px;color:var(--text-3);line-height:1.4}.hosting-screen .jconn{flex:1;max-width:96px;display:flex;align-items:center;justify-content:center;color:var(--text-4);font-size:18px;padding-top:22px;position:relative}.hosting-screen .jconn:before{content:"";position:absolute;top:31px;left:-6px;right:-6px;height:2px;background:repeating-linear-gradient(90deg,var(--line-2) 0 5px,transparent 5px 11px)}.hosting-screen .jconn span{position:relative;z-index:1;background:#121212;padding:0 6px}.hosting-screen .jpacket{position:absolute;top:25px;width:9px;height:9px;border-radius:50%;background:var(--lime);box-shadow:0 0 10px 2px #c7f04a99;z-index:2;left:0;animation:hs-jtravel 3.6s cubic-bezier(.6,0,.4,1) infinite}@keyframes hs-jtravel{0%{left:14%;opacity:0}12%{opacity:1}88%{opacity:1}to{left:86%;opacity:0}}.home-landing .crumbs,.home-landing .hello,.home-landing .project,.home-landing .seclabel,.home-landing .drow,.home-landing .exdoor{width:100%;max-width:2200px;margin-left:auto;margin-right:auto}@media(prefers-reduced-motion:reduce){.hosting-screen .jpacket{animation:none;left:50%;opacity:.7}.home-landing .drow.building .dspin:after,.hosting-screen .deploy-spin:after,.hosting-screen .dep-step.active .dot:after{animation:none}.home-landing .drow .bbar>div{transition:none}.home-landing .drow .livedot{animation:none}}.wired-provider{border:.5px solid rgba(199,240,74,.45);border-radius:12px;background:linear-gradient(150deg,#c7f04a12,#c7f04a03);padding:12px 15px;margin:0 0 16px;display:flex;flex-direction:column;gap:4px}.wired-provider-title{font-size:14px;color:var(--text-1)}.wired-provider-detail{font-size:13px;color:var(--text-2);line-height:1.5}.hosting-screen .hosting-detected{border:.5px solid rgba(199,240,74,.45);border-radius:14px;background:linear-gradient(150deg,#c7f04a12,#c7f04a03);padding:14px 16px;margin-bottom:18px;display:flex;flex-direction:column;gap:6px}.hosting-screen .hosting-detected-title{font-size:14px;font-weight:600;color:var(--text-1)}.hosting-screen .hosting-detected-detail{font-size:13px;color:var(--text-2);line-height:1.55}.hosting-screen .hosting-detected-detail code{font-family:var(--mono, monospace);font-size:12px;background:var(--panel-3, rgba(255, 255, 255, .05));padding:1px 5px;border-radius:5px}.hosting-screen .provcard{display:flex;gap:18px;border:.5px solid var(--line-2);border-radius:16px;background:var(--panel-2);padding:20px 22px;transition:.15s}.hosting-screen .provcard.best{border-color:#c7f04a73;background:linear-gradient(150deg,#c7f04a0d,#c7f04a03)}.hosting-screen .pv-logo{width:50px;height:50px;border-radius:13px;background:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:0 2px 10px #0006}.hosting-screen .provbody{flex:1;min-width:0}.hosting-screen .provtop{display:flex;align-items:center;gap:10px;margin-bottom:5px;flex-wrap:wrap}.hosting-screen .provname{font-size:18px;font-weight:700}.hosting-screen .bestfit{font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#0a0a0a;background:var(--lime);border-radius:6px;padding:3px 9px;white-space:nowrap;flex-shrink:0}.hosting-screen .provdesc{font-size:13.5px;color:var(--text-2);line-height:1.55;margin-bottom:14px;max-width:560px}.hosting-screen .reasons{display:flex;flex-direction:column;gap:9px;margin-bottom:15px}.hosting-screen .reason{display:flex;align-items:flex-start;gap:10px;font-size:13.5px;color:var(--text-2);line-height:1.45}.hosting-screen .reason b{color:var(--text);font-weight:600}.hosting-screen .reason svg{margin-top:2px;flex-shrink:0}.hosting-screen .chips{display:flex;gap:8px;flex-wrap:wrap}.hosting-screen .chip{font-size:11.5px;font-weight:500;color:var(--text-2);background:var(--panel-3);border:.5px solid var(--line);border-radius:8px;padding:5px 11px}.hosting-screen .alt-toggle{display:inline-flex;align-items:center;gap:7px;margin-top:15px;font-size:13px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .alt-toggle:hover{color:var(--text)}.hosting-screen .alt-toggle .chev{transition:transform .2s;font-size:11px}.hosting-screen .alts{display:flex;flex-direction:column;gap:10px;margin-top:14px;animation:home-fade .25s ease}.hosting-screen .altcard{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:13px;background:var(--panel-2);padding:14px 16px;transition:.15s}.hosting-screen .altcard:hover{border-color:var(--line-2);background:var(--panel-3)}.hosting-screen .altmark{width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-weight:800;font-size:18px;color:#fff;font-family:var(--mono)}.hosting-screen .altbody{flex:1;min-width:0}.hosting-screen .altname{font-size:14.5px;font-weight:600}.hosting-screen .altdesc{font-size:12.5px;color:var(--text-3);line-height:1.45;margin-top:2px}.hosting-screen .altpick{font-size:12.5px;font-weight:600;color:var(--text-2);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:8px 14px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .altpick:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .faq{margin-top:14px;border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);overflow:hidden}.hosting-screen .faqitem{border-bottom:.5px solid var(--line)}.hosting-screen .faqitem:last-child{border-bottom:none}.hosting-screen .faqq{width:100%;text-align:left;display:flex;align-items:center;gap:12px;padding:15px 18px;background:none;border:none;color:var(--text);font-size:14px;font-weight:600;cursor:pointer;font-family:inherit}.hosting-screen .faqq .chev{margin-left:auto;color:var(--text-4);transition:transform .2s;font-size:12px}.hosting-screen .faqq.open .chev{transform:rotate(180deg)}.hosting-screen .faqa{font-size:13.5px;color:var(--text-3);line-height:1.6;padding:0 18px 16px;max-width:640px}.setup-topic .faq{margin-top:22px;border:none;border-top:.5px solid var(--line);border-radius:0;background:transparent}.setup-topic .seclabel{margin-top:40px;color:var(--text-4)}.setup-topic .faqq{color:var(--text-2);font-weight:500;font-size:13.5px;padding:13px 4px}.setup-topic .faqa{padding:0 4px 14px}.hosting-screen .setup-ill{position:relative;border:.5px solid var(--line);border-radius:18px;background:linear-gradient(180deg,rgba(255,255,255,.02),transparent);padding:30px 28px;margin-top:2px;overflow:hidden}.hosting-screen .setup-ill .ill-cap{margin-top:18px;text-align:center;font-size:12.5px;color:var(--text-3)}.hosting-screen .ill-split{display:flex;align-items:stretch;gap:16px}.hosting-screen .isplit{flex:1;border:.5px solid var(--line);border-radius:14px;padding:16px 18px;background:#ffffff03}.hosting-screen .isplit.after{border-color:#c7f04a59;background:#c7f04a0d}.hosting-screen .isplit-tag{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin-bottom:12px}.hosting-screen .isplit.after .isplit-tag{color:#c7f04a}.hosting-screen .isplit-row{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--text-2);padding:6px 0}.hosting-screen .isplit-row .mk{width:18px;text-align:center;color:var(--text-4)}.hosting-screen .isplit.after .isplit-row .mk{color:#c7f04a}.hosting-screen .isplit-arrow{align-self:center;color:var(--text-4);font-size:18px}.hosting-screen .ill-stack{display:flex;flex-direction:column;gap:10px;max-width:540px;margin:0 auto}.hosting-screen .istack-row{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:12px;padding:12px 16px;background:#ffffff03}.hosting-screen .istack-row.lime{border-color:#c7f04a66;background:#c7f04a0f}.hosting-screen .istack-emoji{font-size:22px;width:28px;text-align:center}.hosting-screen .istack-lbl{font-weight:600;font-size:14px;color:var(--text)}.hosting-screen .istack-sub{font-size:12.5px;color:var(--text-3);margin-left:auto}.hosting-screen .ill-orbit{display:flex;align-items:center;justify-content:center;gap:34px;flex-wrap:wrap}.hosting-screen .iorbit-center{display:flex;flex-direction:column;align-items:center;gap:10px}.hosting-screen .iorbit-tile{width:76px;height:76px;border-radius:18px;display:flex;align-items:center;justify-content:center;font-size:34px;background:#c7f04a1f;border:.5px solid rgba(199,240,74,.4);box-shadow:0 0 0 5px #c7f04a0d}.hosting-screen .iorbit-lbl{font-size:14px;font-weight:600;color:var(--text)}.hosting-screen .iorbit-sats{display:flex;flex-direction:column;gap:10px}.hosting-screen .iorbit-sat{display:flex;align-items:center;gap:10px;border:.5px solid var(--line);border-radius:999px;padding:8px 16px 8px 12px;font-size:13px;color:var(--text-2);background:#ffffff03}.hosting-screen .ill-bars{display:flex;align-items:flex-end;justify-content:center;gap:18px;height:148px}.hosting-screen .ibar{width:46px;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:8px}.hosting-screen .ibar-fill{width:100%;border-radius:7px 7px 3px 3px;background:#ffffff14;min-height:8px}.hosting-screen .ibar.lime .ibar-fill{background:#c7f04a8c}.hosting-screen .ibar-lbl{font-size:11px;color:var(--text-3);text-align:center}.hosting-screen .ill-emblem{display:flex;flex-direction:column;align-items:center;gap:18px;text-align:center}.hosting-screen .iemblem-tile{width:88px;height:88px;border-radius:22px;display:flex;align-items:center;justify-content:center;font-size:42px;background:#c7f04a1f;border:.5px solid rgba(199,240,74,.4);box-shadow:0 0 0 6px #c7f04a0d}.hosting-screen .iemblem-chips{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}.hosting-screen .iemblem-chip{border:.5px solid var(--line);border-radius:999px;padding:7px 14px;font-size:12.5px;color:var(--text-2);background:#ffffff03}.hosting-screen .ill-channels{display:flex;flex-direction:column;gap:18px;max-width:560px;margin:0 auto}.hosting-screen .ichan{display:flex;align-items:center;gap:16px}.hosting-screen .ichan-lbl{width:92px;font-size:13px;font-weight:600;color:var(--text-2);text-align:right}.hosting-screen .ichan-track{flex:1;display:flex;align-items:center;gap:10px}.hosting-screen .ichan-dot{width:12px;height:12px;border-radius:50%;background:var(--line)}.hosting-screen .ichan.on .ichan-lbl{color:#c7f04a}.hosting-screen .ichan.on .ichan-dot{background:#c7f04a99}.hosting-screen .ichan-line{flex:1;height:.5px;background:var(--line)}.hosting-screen .ask{margin-top:26px}.hosting-screen .askrow{display:flex;gap:10px;align-items:stretch}.hosting-screen .askrow input{flex:1;font-family:inherit;font-size:14px;color:var(--text);background:var(--panel-2);border:.5px solid var(--line-2);border-radius:12px;padding:14px 16px;outline:none;transition:.15s}.hosting-screen .askrow input::placeholder{color:var(--text-4)}.hosting-screen .askrow input:focus{border-color:var(--blue)}.hosting-screen .askrow button{width:50px;border-radius:12px;background:var(--panel-3);border:.5px solid var(--line-2);color:var(--text-2);font-size:17px;cursor:pointer;transition:.15s}.hosting-screen .askrow button:hover{background:#252525;color:var(--text)}.hosting-screen .asknote{font-size:11.5px;color:var(--text-4);margin-top:9px;display:flex;align-items:center;gap:6px}.hosting-screen .askans{display:flex;gap:11px;margin-top:14px;border:.5px solid rgba(133,183,235,.25);background:#85b7eb0f;border-radius:13px;padding:14px 16px;animation:home-fade .25s ease}.hosting-screen .askav{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--lime);flex-shrink:0;width:26px;height:26px;border-radius:8px;background:#000;display:flex;align-items:center;justify-content:center}.hosting-screen .askans .at{font-size:13.5px;color:var(--text-2);line-height:1.6}.hosting-screen .setup-extlink{display:inline-flex;align-items:center;gap:8px;margin-top:10px;padding:9px 14px;border-radius:10px;font-size:13.5px;font-weight:600;text-decoration:none;color:var(--blue);background:var(--panel-2);border:.5px solid var(--line-2);transition:.15s}.hosting-screen .setup-extlink:hover{background:var(--panel-3);border-color:var(--blue)}.hosting-screen .setup-extlink-glyph{font-size:13px;opacity:.85}.hosting-screen .setup-note{margin-top:14px;padding:14px 16px;border:.5px solid var(--line-2);background:var(--panel-2);border-radius:13px;font-size:13.5px;line-height:1.6;color:var(--text-2)}.hosting-screen .setup-note p{margin:0}.hosting-screen .setup-note p+p{margin-top:10px}.hosting-screen .setup-note b{color:var(--text)}.hosting-screen .setup-note-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:6px}.hosting-screen .setup-note-links .setup-extlink{margin-top:6px}.hosting-screen .cta-wrap{margin-top:28px}.hosting-screen .cta{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:16px;font-weight:700;color:var(--action-fg);background:var(--action-bg);border:none;border-radius:14px;padding:18px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .cta:hover{background:#d4f76a;transform:translateY(-1px)}.hosting-screen .cta .ce{font-size:18px}.hosting-screen .cta-note{font-size:12.5px;color:var(--text-4);text-align:center;margin-top:13px;display:flex;align-items:center;justify-content:center;gap:6px}.hosting-screen .cta-done,.run-locally-screen .cta-done{display:flex;align-items:center;gap:12px;width:100%;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:14px;padding:16px 18px}.hosting-screen .cta-done-check,.run-locally-screen .cta-done-check{display:inline-flex;align-items:center;gap:10px;font-size:15px;font-weight:700;color:var(--green)}.hosting-screen .cta-done-check .ce,.run-locally-screen .cta-done-check .ce{font-size:18px}.hosting-screen .cta-done-actions,.run-locally-screen .cta-done-actions{display:flex;align-items:center;gap:8px;margin-left:auto}.hosting-screen .cta-done .lf-back,.run-locally-screen .cta-done .lf-back{font-size:13.5px;font-weight:600;color:#0a0a0a;background:var(--lime);border:none;border-radius:11px;padding:11px 18px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .cta-done .lf-back:hover,.run-locally-screen .cta-done .lf-back:hover{background:#d4f76a}.hosting-screen .cta-revert,.run-locally-screen .cta-revert,.hosting-screen .live-foot .lf-revert{font-size:13px;font-weight:600;color:var(--text-4);background:transparent;border:none;border-radius:11px;padding:11px 12px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .cta-revert:hover,.run-locally-screen .cta-revert:hover,.hosting-screen .live-foot .lf-revert:hover{color:var(--text-1);background:#7f7f7f1f}.hosting-screen .reason-foot{font-size:12.5px;line-height:1.5;color:var(--text-4);margin:12px 0 0;padding-top:11px;border-top:1px solid var(--border-1, rgba(255, 255, 255, .07))}.hosting-screen .flowbar{display:flex;align-items:center;gap:8px;margin-bottom:26px;font-size:12px;font-family:var(--mono)}.hosting-screen .flowbar .fstep{display:flex;align-items:center;gap:7px;color:var(--text-4);white-space:nowrap}.hosting-screen .flowbar .fstep .fn{width:20px;height:20px;border-radius:50%;border:1.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;font-size:10.5px;color:var(--text-4)}.hosting-screen .flowbar .fstep.done .fn{background:var(--green);border-color:var(--green);color:#0a0a0a}.hosting-screen .flowbar .fstep.active{color:var(--text)}.hosting-screen .flowbar .fstep.active .fn{border-color:var(--lime);color:var(--lime)}.hosting-screen .flowbar .fsep{flex:1;max-width:38px;height:1px;background:var(--line-2)}.hosting-screen .panel{border:.5px solid var(--line);border-radius:18px;background:var(--panel-2);padding:26px 28px}.hosting-screen .panel .ph{font-size:19px;font-weight:700;letter-spacing:-.01em;margin-bottom:6px;display:flex;align-items:center;gap:10px}.hosting-screen .panel .psub{font-size:14px;color:var(--text-3);line-height:1.55;margin-bottom:22px;max-width:600px}.hosting-screen .connect-box{border:.5px solid var(--line-2);border-radius:14px;background:var(--panel-3);padding:22px;margin-bottom:18px}.hosting-screen .connect-box .cbtitle{display:flex;align-items:center;gap:12px;margin-bottom:18px}.hosting-screen .connect-box .cbtitle .pv-logo{width:42px;height:42px}.hosting-screen .connect-box .cbt{font-size:15px;font-weight:600}.hosting-screen .connect-box .cbd{font-size:12.5px;color:var(--text-3);margin-top:2px}.hosting-screen .grant{display:flex;flex-direction:column;gap:11px;margin-bottom:20px}.hosting-screen .grantrow{display:flex;align-items:flex-start;gap:10px;font-size:13px;color:var(--text-2);line-height:1.4}.hosting-screen .grantrow svg{margin-top:2px;flex-shrink:0}.hosting-screen .grantrow b{color:var(--text);font-weight:600}.hosting-screen .auth-btn{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:14.5px;font-weight:700;color:#fff;background:#000;border:.5px solid var(--line-2);border-radius:12px;padding:14px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .auth-btn:hover{background:#111;border-color:var(--text-4)}.hosting-screen .auth-row{display:flex;gap:11px;margin-top:11px}.hosting-screen .auth-ghost{flex:1;font-size:13px;font-weight:600;color:var(--text-3);background:none;border:.5px solid var(--line-2);border-radius:11px;padding:12px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .auth-ghost:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .reassure{font-size:12.5px;color:var(--text-4);line-height:1.55;margin-top:18px;display:flex;align-items:flex-start;gap:7px}.hosting-screen .deploy-head{display:flex;align-items:center;gap:14px;margin-bottom:20px}.hosting-screen .deploy-spin{width:46px;height:46px;border-radius:13px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--green-soft)}.hosting-screen .deploy-spin:after{content:"";width:23px;height:23px;border-radius:50%;border:2.5px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.hosting-screen .deploy-t{font-size:17px;font-weight:700}.hosting-screen .deploy-d{font-size:13px;color:var(--text-3);margin-top:2px}.hosting-screen .dep-bar{height:6px;background:var(--panel-3);border-radius:4px;overflow:hidden;margin-bottom:22px}.hosting-screen .dep-bar>div{height:100%;background:var(--green);border-radius:4px;transition:width .5s ease}.hosting-screen .dep-steps{display:flex;flex-direction:column;gap:2px}.hosting-screen .dep-step{display:flex;align-items:flex-start;gap:13px;padding:9px 0;position:relative}.hosting-screen .dep-step .dot{width:21px;height:21px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;z-index:1;background:var(--panel-3);border:1.5px solid var(--line-2)}.hosting-screen .dep-step:not(:last-child):before{content:"";position:absolute;left:10px;top:26px;bottom:-7px;width:1px;background:var(--line-2)}.hosting-screen .dep-step.done .dot{background:var(--green);border-color:var(--green)}.hosting-screen .dep-step.done:not(:last-child):before{background:#9bd35a66}.hosting-screen .dep-step.active .dot{border:none;background:transparent}.hosting-screen .dep-step.active .dot:after{content:"";width:19px;height:19px;border-radius:50%;border:2px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.hosting-screen .dep-step .sl{font-size:14px;color:var(--text-4);line-height:1.4;padding-top:1px}.hosting-screen .dep-step.done .sl{color:var(--text-3)}.hosting-screen .dep-step.active .sl{color:var(--text);font-weight:600}.hosting-screen .live-hero{text-align:center;padding:6px 0 22px}.hosting-screen .live-hero .lh-em{font-size:42px}.hosting-screen .live-hero .lh-t{font-size:23px;font-weight:800;letter-spacing:-.02em;margin-top:10px}.hosting-screen .live-hero .lh-d{font-size:14px;color:var(--text-3);margin-top:7px}.hosting-screen .url-card{display:flex;align-items:center;gap:14px;border:.5px solid rgba(155,211,90,.35);background:#9bd35a0d;border-radius:14px;padding:16px 18px;margin-bottom:14px}.hosting-screen .url-card .ucglobe{font-size:22px}.hosting-screen .url-card .uc-l{font-size:11px;color:var(--text-4);text-transform:uppercase;letter-spacing:.07em;font-weight:700}.hosting-screen .url-card .uc-u{font-family:var(--mono);font-size:15px;color:var(--text);margin-top:3px;white-space:nowrap}.hosting-screen .url-card .uc-actions{margin-left:auto;display:flex;gap:9px;flex-shrink:0}.hosting-screen .btn-copy,.hosting-screen .btn-visit{font-size:13px;font-weight:600;border-radius:10px;padding:10px 15px;cursor:pointer;transition:.15s;white-space:nowrap;border:.5px solid var(--line-2);font-family:inherit}.hosting-screen .btn-copy{color:var(--text-2);background:var(--panel-3)}.hosting-screen .btn-copy:hover{color:var(--text)}.hosting-screen .btn-visit{color:#0a0a0a;background:var(--lime);border-color:var(--lime)}.hosting-screen .btn-visit:hover{background:#d4f76a}.hosting-screen .domain-row{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:13px;background:var(--panel-2);padding:15px 17px;margin-bottom:14px}.hosting-screen .domain-row .dre{font-size:19px}.hosting-screen .domain-row .drt{font-size:13.5px;font-weight:600}.hosting-screen .domain-row .drd{font-size:12px;color:var(--text-3);margin-top:1px}.hosting-screen .domain-row .drbtn{margin-left:auto;font-size:12.5px;font-weight:600;color:var(--blue);background:#85b7eb1a;border:.5px solid rgba(133,183,235,.25);border-radius:9px;padding:8px 14px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .domain-row .drbtn:hover{background:#85b7eb29;color:var(--text)}.hosting-screen .live-foot{display:flex;align-items:center;gap:12px;margin-top:20px}.hosting-screen .live-foot .done-pill{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--green);white-space:nowrap}.hosting-screen .live-foot .lf-back{margin-left:auto;font-size:13.5px;font-weight:600;color:#0a0a0a;background:var(--lime);border:none;border-radius:11px;padding:11px 18px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .live-foot .lf-back:hover{background:#d4f76a}.hosting-screen .conn-card{display:flex;align-items:center;gap:16px;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:16px;padding:16px 18px;margin-bottom:28px}.hosting-screen .conn-card .pv-logo{width:44px;height:44px}.hosting-screen .conn-body{flex:1;min-width:0}.hosting-screen .conn-top{display:flex;align-items:center;gap:11px}.hosting-screen .conn-name{font-size:16px;font-weight:700}.hosting-screen .conn-live{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:600;color:var(--green);font-family:var(--mono)}.hosting-screen .conn-live .lbdot{width:8px;height:8px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a2e}.hosting-screen .conn-acct{font-size:12.5px;color:var(--text-3);margin-top:3px}.hosting-screen .conn-acct b{color:var(--text-2);font-weight:600;font-family:var(--mono)}.hosting-screen .conn-disc{font-size:12.5px;font-weight:600;color:var(--text-3);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:9px 14px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .conn-disc:hover{color:#e98b8b;border-color:#e98b8b66}.hosting-screen .dep-card{border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);overflow:hidden}.hosting-screen .depc-row{display:flex;align-items:center;gap:13px;padding:16px 18px}.hosting-screen .depc-dot{width:9px;height:9px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a29;flex-shrink:0}.hosting-screen .depc-main{flex:1;min-width:0}.hosting-screen .depc-t{font-size:14px;font-weight:600}.hosting-screen .depc-d{font-size:12.5px;color:var(--text-3);margin-top:2px}.hosting-screen .depc-btn{font-size:12.5px;font-weight:600;color:var(--text-2);background:var(--panel-3);border:.5px solid var(--line-2);border-radius:9px;padding:9px 15px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .depc-btn:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .live-banner{display:flex;align-items:center;gap:14px;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:16px;padding:18px 20px;margin-bottom:24px}.hosting-screen .live-banner .lbdot{width:9px;height:9px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a2e;flex-shrink:0}.hosting-screen .live-banner .lbt{font-size:14.5px;font-weight:600}.hosting-screen .live-banner .lbu{font-family:var(--mono);font-size:12.5px;color:var(--green);margin-top:2px}.hosting-screen .live-banner .lbview{margin-left:auto;font-size:12.5px;font-weight:600;color:var(--green);background:#9bd35a1f;border:.5px solid rgba(155,211,90,.3);border-radius:9px;padding:8px 14px;cursor:pointer;text-decoration:none;font-family:inherit}.run-locally-screen .seclabel{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin:0 2px 11px}.run-locally-screen .rl-loading{color:var(--text-3);font-size:14px;padding:18px 2px}.run-locally-screen .setup-ai-assist{margin-bottom:24px}.run-locally-screen .rl-sec{margin-bottom:26px}.run-locally-screen .rl-prereqs,.run-locally-screen .rl-notes{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}.run-locally-screen .rl-prereq{display:flex;flex-direction:column;gap:3px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:12px 15px}.run-locally-screen .rl-prereq-label{font-size:13.5px;font-weight:600;color:var(--text)}.run-locally-screen .rl-prereq-detail{font-size:12.5px;color:var(--text-3);line-height:1.5}.run-locally-screen .rl-load-steps{margin:0;padding:14px 16px 14px 38px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);list-style:decimal outside;display:flex;flex-direction:column;gap:9px}.run-locally-screen .rl-load-step{font-size:13px;color:var(--text-2);line-height:1.55;padding-left:4px}.run-locally-screen .rl-load-step::marker{color:var(--text-4);font-weight:700}.run-locally-screen .rl-load-target{margin-top:10px;display:flex;flex-direction:column;gap:6px}.run-locally-screen .rl-load-target-label{font-size:12px;font-weight:600;color:var(--text-3)}.run-locally-screen .rl-cmd,.libraries-screen .rl-cmd,.lib-row .rl-cmd{display:flex;align-items:center;gap:10px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-3);padding:11px 12px 11px 15px}.run-locally-screen .rl-cmd-text,.libraries-screen .rl-cmd-text,.lib-row .rl-cmd-text{flex:1;font-family:var(--mono);font-size:13px;color:var(--lime);overflow-x:auto;white-space:pre}.run-locally-screen .rl-copy,.libraries-screen .rl-copy,.lib-row .rl-copy{flex-shrink:0;font-size:11.5px;font-weight:600;color:var(--text-2);background:var(--panel);border:.5px solid var(--line);border-radius:8px;padding:6px 12px;cursor:pointer;font-family:inherit;transition:.15s}.run-locally-screen .rl-copy:hover,.libraries-screen .rl-copy:hover,.lib-row .rl-copy:hover{color:var(--text);border-color:var(--line-2)}.run-locally-screen .rl-reachable{font-size:13.5px;color:var(--text-2);line-height:1.6}.run-locally-screen .rl-url{color:var(--blue);text-decoration:none;font-family:var(--mono);font-size:13px}.run-locally-screen .rl-url:hover{text-decoration:underline}.run-locally-screen .rl-note{font-size:12.5px;color:var(--text-3);line-height:1.55}.run-locally-screen .cta-wrap{margin-top:28px}.run-locally-screen .cta{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:15px;font-weight:700;color:var(--action-fg);background:var(--action-bg);border:none;border-radius:14px;padding:16px;cursor:pointer;transition:.15s;font-family:inherit}.run-locally-screen .cta:hover{background:#d4f76a;transform:translateY(-1px)}.learn-screen .setup-libraries-section{margin-top:26px}.learn-screen .setup-libraries-section .seclabel{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--text-2);margin-bottom:10px}.libraries-screen .lib-loading,.libraries-screen .lib-empty-body{font-size:13.5px;color:var(--text-2);line-height:1.6}.libraries-screen .lib-empty{border:.5px solid var(--line);border-radius:12px;background:var(--panel-3);padding:22px;margin-top:8px}.libraries-screen .lib-empty-title{font-size:15px;font-weight:600;color:var(--text);margin-bottom:6px}.libraries-screen .lib-searchbar{margin:4px 0 16px}.libraries-screen .lib-search{width:100%;box-sizing:border-box;font-size:13.5px;font-family:inherit;color:var(--text);background:var(--panel-3);border:.5px solid var(--line);border-radius:10px;padding:10px 14px}.libraries-screen .lib-search:focus{outline:none;border-color:var(--line-2)}.libraries-screen .lib-groups{display:flex;flex-direction:column;gap:12px}.lib-group{border:.5px solid var(--line);border-radius:12px;background:var(--panel-2);overflow:hidden}.lib-group-head{display:flex;align-items:center;gap:10px;width:100%;padding:13px 15px;background:transparent;border:none;cursor:pointer;font-family:inherit;text-align:left}.lib-group-head:hover{background:var(--panel-3)}.lib-group-icon{display:inline-flex;color:var(--text-2)}.lib-group-title{font-size:14px;font-weight:600;color:var(--text)}.lib-group-count{font-size:12px;color:var(--text-2)}.lib-group-path{flex:1;font-family:var(--mono);font-size:11.5px;color:var(--text-3, var(--text-2));text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lib-group-chevron{font-size:12px;color:var(--text-2)}.lib-rows{display:flex;flex-direction:column;border-top:.5px solid var(--line)}.lib-row{display:flex;flex-direction:column;gap:8px;padding:14px 16px}.lib-row+.lib-row{border-top:.5px solid var(--line)}.lib-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.lib-name{font-size:14px;font-weight:600;color:var(--text);font-family:var(--mono)}.lib-version{font-size:12px;font-family:var(--mono);color:var(--text-2)}.lib-kind{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:var(--panel-3);color:var(--text-2);border:.5px solid var(--line)}.lib-kind.dev{color:#c9a227}.lib-outdated{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:#d6606029;color:#d66060;border:.5px solid rgba(214,96,96,.4)}.lib-desc{font-size:13px;color:var(--text);line-height:1.55}.lib-desc.muted{color:var(--text-2);font-style:italic}.lib-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--text-2)}.lib-tag{padding:2px 8px;border-radius:6px;background:var(--panel-3);border:.5px solid var(--line)}.lib-docs{color:var(--lime);text-decoration:none}.lib-docs:hover{text-decoration:underline}.learn-screen .setup-addrow{margin-top:22px;padding:16px 18px;border:.5px dashed var(--line-2);border-radius:13px;background:var(--panel-2);display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.learn-screen .setup-addrow-copy{font-size:13px;color:var(--text-3);line-height:1.5;max-width:420px}.learn-screen .setup-addrow-btns{display:flex;gap:10px;flex-shrink:0}.learn-screen .setup-addbtn{font-family:inherit;font-size:13px;font-weight:600;color:var(--text);background:var(--panel-3);border:.5px solid var(--line-2);border-radius:9px;padding:9px 14px;cursor:pointer;transition:.15s;white-space:nowrap}.learn-screen .setup-addbtn:hover{border-color:var(--blue);transform:translateY(-1px)}.learn-screen .setup-addbtn-ask{color:var(--blue);background:var(--blue-soft);border-color:var(--blue-300)}.learn-screen .atf-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;z-index:40}.learn-screen .atf-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:41;width:min(440px,calc(100vw - 48px));background:var(--panel);border:.5px solid var(--line-2);border-radius:16px;padding:24px;box-shadow:0 18px 48px #0006}.learn-screen .atf-title{font-size:17px;font-weight:700;color:var(--text)}.learn-screen .atf-lead{font-size:13px;color:var(--text-3);line-height:1.55;margin:8px 0 18px}.learn-screen .atf-field{display:block;margin-bottom:14px}.learn-screen .atf-label{display:block;font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:6px}.learn-screen .atf-optional{font-weight:400;color:var(--text-4)}.learn-screen .atf-input{width:100%;box-sizing:border-box;font-family:inherit;font-size:14px;color:var(--text);background:var(--panel-2);border:.5px solid var(--line-2);border-radius:9px;padding:10px 12px;transition:.15s}.learn-screen .atf-input:focus{outline:none;border-color:var(--blue)}.learn-screen .atf-textarea{resize:vertical;min-height:44px;line-height:1.5}.learn-screen .atf-error{font-size:12.5px;color:var(--amber);margin:-4px 0 12px}.learn-screen .atf-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.learn-screen .atf-btn{font-family:inherit;font-size:13px;font-weight:600;border-radius:9px;padding:9px 16px;cursor:pointer;transition:.15s;border:.5px solid var(--line-2)}.learn-screen .atf-btn:disabled{opacity:.5;cursor:default}.learn-screen .atf-btn-ghost{color:var(--text-2);background:transparent}.learn-screen .atf-btn-ghost:hover:not(:disabled){background:var(--panel-3)}.learn-screen .atf-btn-primary{color:var(--action-fg);background:var(--action-bg);border-color:transparent}.learn-screen .atf-btn-primary:hover:not(:disabled){transform:translateY(-1px)}.hosting-screen .real-token-label{display:block;font-size:12px;font-weight:600;color:var(--text-2);margin:14px 0 6px}.hosting-screen .real-token-input{width:100%;box-sizing:border-box;padding:10px 12px;font-size:14px;font-family:inherit;color:var(--text-1);background:var(--panel-2);border:1px solid var(--border-1);border-radius:8px;margin-bottom:14px}.hosting-screen .real-token-input:focus{outline:none;border-color:var(--blue-300)}.hosting-screen .auth-btn:disabled{opacity:.5;cursor:not-allowed}.hosting-screen .real-error{background:color-mix(in srgb,var(--red, #e5484d) 12%,transparent);border:1px solid color-mix(in srgb,var(--red, #e5484d) 40%,transparent);border-radius:10px;padding:14px 16px;margin-bottom:16px}.hosting-screen .real-error-title{font-weight:600;color:var(--red, #e5484d);margin-bottom:4px}.hosting-screen .real-error-msg{font-size:13px;color:var(--text-2);word-break:break-word}.hosting-screen .dep-bar-indeterminate{width:40%;height:100%;background:var(--green);border-radius:4px;animation:real-provision-slide 1.1s ease-in-out infinite}@keyframes real-provision-slide{0%{transform:translate(-100%)}to{transform:translate(250%)}}.concept-term-wrap{position:relative;display:inline}.concept-term{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;text-decoration:underline dotted;text-underline-offset:2px;text-decoration-color:var(--accent, #6b8afd)}.concept-term:hover,.concept-term[aria-expanded=true]{color:var(--accent, #6b8afd)}.concept-popover{position:fixed;z-index:1000;display:block;width:300px;max-width:min(300px,80vw);padding:12px 14px;background:var(--surface, #1b1f2a);border:1px solid var(--border, #2c3242);border-radius:10px;box-shadow:0 8px 28px #00000059;text-align:left;white-space:normal;cursor:default}.concept-popover-term{display:block;font-weight:600;font-size:14px;color:var(--text-primary, #e8ebf2)}.concept-popover-cat{display:inline-block;margin:2px 0 6px;font-size:11px;letter-spacing:.02em;text-transform:uppercase;color:var(--text-tertiary, #8a92a6)}.concept-popover-body{display:block}.learn-screen .concepts-nudge{margin:0 0 18px;padding:12px 14px;font-size:13px;line-height:1.6;color:var(--text-secondary, #b6bdcc);background:var(--surface-muted, rgba(107, 138, 253, .08));border:1px solid var(--border, #2c3242);border-radius:10px}.learn-screen .concepts-nudge-link{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;padding:0;font:inherit;color:var(--accent, #6b8afd);cursor:pointer;text-decoration:underline}.setup-screen{--bg: var(--surface-page);--panel-2: var(--surface-card);--panel-3: var(--surface-raised);--inset: #0d0d0d;--line: var(--line-subtle);--line-2: var(--line-hair);--text: var(--text-strong);--text-2: var(--text-body);--text-3: var(--text-faint);--text-4: var(--text-subtle);--lime: var(--lime-300);--green: var(--green-300);--blue: var(--blue-300);--amber: var(--amber-300);--indigo: var(--indigo-300);--mono: "IBM Plex Mono", monospace;--sans: "IBM Plex Sans", sans-serif;--accent: var(--blue-300);--accent-soft: var(--blue-soft);background:var(--bg);font-family:var(--sans);color:var(--text);-webkit-font-smoothing:antialiased;padding:18px 28px 50px}.setup-screen.accent-blue{--accent: var(--blue-300);--accent-soft: var(--blue-soft)}.setup-screen.accent-amber{--accent: var(--amber-300);--accent-soft: var(--amber-soft)}.setup-screen.accent-green{--accent: var(--green-300);--accent-soft: var(--green-soft)}.setup-screen.accent-indigo{--accent: var(--indigo-300);--accent-soft: var(--indigo-soft)}.setup-screen *,.setup-screen *:before,.setup-screen *:after{box-sizing:border-box}.setup-screen .su-wrap{max-width:760px;margin:0 auto}.setup-screen .su-crumbs{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--text-3);max-width:760px;margin:0 auto 18px}.setup-screen .su-crumbs .back,.setup-screen .su-crumbs button{background:none;border:none;cursor:pointer;color:var(--text-3);font:inherit;padding:0}.setup-screen .su-crumbs button:hover{color:var(--text-2)}.setup-screen .su-crumbs .sep{color:var(--text-4)}.setup-screen .su-crumbs b{color:var(--text-2);font-weight:600}.setup-screen .su-shead{display:flex;align-items:flex-start;gap:15px;margin-bottom:20px}.setup-screen .su-badge{width:48px;height:48px;border-radius:13px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--accent-soft);color:var(--accent)}.setup-screen .su-title{font-size:22px;font-weight:700;letter-spacing:-.02em;display:flex;align-items:center;gap:11px}.setup-screen .su-chip{font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;border-radius:6px;padding:3px 8px;transform:translateY(-2px);display:inline-flex;align-items:center;gap:5px}.setup-screen .su-chip.notset{color:var(--text-3);background:var(--panel-3);border:.5px solid var(--line-2)}.setup-screen .su-chip.connected{color:var(--green);background:var(--green-soft);border:.5px solid color-mix(in srgb,var(--green) 30%,transparent)}.setup-screen .su-via{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--text-3);font-family:var(--mono);margin-top:4px}.setup-screen .su-via b{color:var(--accent);font-weight:600}.setup-screen .su-lead{font-size:13.5px;color:var(--text-3);line-height:1.5;margin-top:9px}.setup-screen .su-explain{border:.5px solid var(--line);border-radius:16px;background:var(--panel-2);padding:20px 22px;margin-bottom:18px}.setup-screen .su-eh{font-size:14.5px;font-weight:700;letter-spacing:-.01em;display:flex;align-items:center;gap:9px}.setup-screen .su-q{width:22px;height:22px;border-radius:7px;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;flex-shrink:0}.setup-screen .su-lede{font-size:13px;color:var(--text-2);line-height:1.55;margin-top:11px}.setup-screen .su-lede b{color:var(--text);font-weight:600}.setup-screen .su-erows{display:flex;flex-direction:column;gap:2px;margin-top:16px}.setup-screen .su-erow{display:flex;align-items:flex-start;gap:13px;padding:12px 0;border-top:.5px solid var(--line)}.setup-screen .su-en{width:30px;height:30px;border-radius:9px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--panel-3);color:var(--accent)}.setup-screen .su-et{flex:1}.setup-screen .su-et b{font-size:13.5px;font-weight:600}.setup-screen .su-et span{display:block;font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:2px}.setup-screen .su-et span em{color:var(--text-2);font-style:normal;font-weight:500}.setup-screen .su-why{margin-top:16px;border:.5px solid var(--line);border-radius:13px;background:var(--inset);padding:15px 16px}.setup-screen .su-wh{font-size:12px;font-weight:700;color:var(--text-2);display:flex;align-items:center;gap:8px;margin-bottom:12px}.setup-screen .su-wh svg{color:var(--accent)}.setup-screen .su-whyrow{display:flex;align-items:flex-start;gap:11px}.setup-screen .su-whyrow+.su-whyrow{margin-top:10px}.setup-screen .su-wc{width:18px;height:18px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}.setup-screen .su-whyrow p{font-size:12.5px;color:var(--text-2);line-height:1.5}.setup-screen .su-whyrow p b{color:var(--text);font-weight:600}.setup-screen .su-connect{border:.5px solid color-mix(in srgb,var(--connect, var(--lime)) 30%,transparent);border-radius:16px;background:linear-gradient(135deg,color-mix(in srgb,var(--connect, var(--lime)) 7%,transparent),color-mix(in srgb,var(--connect, var(--lime)) 1.5%,transparent));padding:20px 22px;margin-bottom:13px}.setup-screen .su-ct{font-size:14.5px;font-weight:700}.setup-screen .su-cd{font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:5px}.setup-screen .su-cbtn{display:inline-flex;align-items:center;gap:10px;background:var(--connect, var(--lime));color:var(--bg);font-family:var(--sans);font-size:13.5px;font-weight:700;border:none;border-radius:11px;padding:13px 20px;cursor:pointer;transition:.15s;margin-top:16px}.setup-screen .su-cbtn:hover:not(:disabled){filter:brightness(1.08);transform:translateY(-1px)}.setup-screen .su-cbtn:disabled{cursor:default;opacity:.85}.setup-screen .su-reassure{display:flex;flex-wrap:wrap;gap:8px 18px;margin-top:14px}.setup-screen .su-reassure span{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;color:var(--text-3)}.setup-screen .su-reassure span svg{color:var(--connect, var(--lime));flex-shrink:0}.setup-screen .su-alt-toggle{display:inline-flex;align-items:center;gap:7px;margin:0 2px 14px;font-family:var(--sans);font-size:12.5px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;transition:.15s}.setup-screen .su-alt-toggle:hover{color:var(--text-2)}.setup-screen .su-chev{transition:transform .2s;font-size:11px;line-height:1}.setup-screen .su-chev.open{transform:rotate(180deg)}.setup-screen .su-alts{display:flex;flex-direction:column;gap:9px;margin-bottom:22px}.setup-screen .su-altrow{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:12px;background:var(--panel-2);padding:12px 14px}.setup-screen .su-altmark{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-weight:800;font-size:16px;color:#fff;font-family:var(--mono)}.setup-screen .su-altbody{flex:1;min-width:0}.setup-screen .su-altname{font-size:13.5px;font-weight:600}.setup-screen .su-altdesc{font-size:12px;color:var(--text-3);line-height:1.45;margin-top:2px}.setup-screen .su-altfact{display:flex;align-items:center;flex-wrap:wrap;font-size:12px;font-weight:600;color:var(--text-2);margin-top:4px}.setup-screen .su-altpick{font-family:var(--sans);font-size:12px;font-weight:600;color:var(--text-2);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:8px 13px;cursor:pointer;white-space:nowrap;transition:.15s}.setup-screen .su-altpick:hover{color:var(--text);border-color:var(--text-3)}.setup-screen .su-altpick.picked{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 50%,transparent)}.setup-screen .su-uplabel{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--text-4);margin:0 2px 12px}.setup-screen .su-locked{display:flex;flex-direction:column;gap:9px}.setup-screen .su-lrow{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--panel-2) 50%,transparent);padding:13px 15px;opacity:.62}.setup-screen .su-ln{width:30px;height:30px;border-radius:9px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--panel-3);color:var(--text-4)}.setup-screen .su-lt b{font-size:13.5px;font-weight:600;color:var(--text-2)}.setup-screen .su-lt span{display:block;font-size:12px;color:var(--text-4);line-height:1.45;margin-top:2px}.setup-screen .su-lk{margin-left:auto;color:var(--text-4);flex-shrink:0;display:flex}.setup-screen .su-statusbar,.setup-screen .su-remember,.setup-screen .su-modebar{display:flex;align-items:center;gap:11px;margin:20px 0 24px;padding:11px 14px;border:.5px solid var(--line);border-radius:12px;background:var(--panel-2)}.setup-screen .su-statusbar{border-color:color-mix(in srgb,var(--green) 28%,transparent);background:linear-gradient(120deg,color-mix(in srgb,var(--green) 6%,transparent),transparent 70%)}.setup-screen .su-remember{background:linear-gradient(120deg,color-mix(in srgb,var(--green) 6%,transparent),transparent 70%)}.setup-screen .su-widget-ic{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--green-soft);color:var(--green)}.setup-screen .su-modebar .su-widget-ic{background:var(--amber-soft);color:var(--amber)}.setup-screen .su-widget-body{flex:1;min-width:0}.setup-screen .su-widget-body b{font-size:13px;font-weight:600}.setup-screen .su-widget-body span{display:block;font-size:11.5px;color:var(--text-3);margin-top:1px}.setup-screen .su-widget-body code{font-family:var(--mono);color:var(--green)}.setup-screen .su-rdot{width:8px;height:8px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 0 4px color-mix(in srgb,var(--green) 12%,transparent)}.setup-screen .su-ago{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--text-4);white-space:nowrap}.setup-screen .su-chg{font-size:12px;color:var(--text-3);cursor:pointer;background:none;border:.5px solid var(--line-2);border-radius:8px;padding:7px 12px;font-family:var(--sans);flex-shrink:0}.setup-screen .su-chg:hover{color:var(--text);border-color:var(--text-3)}.setup-screen .su-seg{display:inline-flex;background:var(--inset);border:.5px solid var(--line);border-radius:10px;padding:3px;gap:3px;flex-shrink:0}.setup-screen .su-seg button{font-family:var(--sans);font-size:12px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;padding:7px 13px;border-radius:7px;transition:.15s}.setup-screen .su-seg button.on{background:var(--panel-3);color:var(--text);box-shadow:inset 0 0 0 .5px var(--line-2)}.setup-screen .su-seg button.on.live{color:var(--green)}.setup-screen .su-seclabel{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-4);margin:0 2px 13px}.setup-screen .su-steps{position:relative;padding-left:6px}.setup-screen .su-step{position:relative;display:flex;gap:16px;padding-bottom:22px}.setup-screen .su-step:last-child{padding-bottom:0}.setup-screen .su-rail{position:relative;flex-shrink:0;display:flex;flex-direction:column;align-items:center}.setup-screen .su-node{width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-family:var(--mono);font-size:12px;font-weight:700;flex-shrink:0;z-index:1}.setup-screen .su-node.done{background:var(--lime);color:var(--bg)}.setup-screen .su-node.todo{background:var(--panel-3);color:var(--text-2);border:.5px solid var(--line-2)}.setup-screen .su-line{flex:1;width:1.5px;background:var(--line-2);margin:4px 0}.setup-screen .su-step:last-child .su-line{display:none}.setup-screen .su-scon{flex:1;min-width:0;padding-top:3px}.setup-screen .su-stitle{font-size:14.5px;font-weight:600;display:flex;align-items:center;gap:9px}.setup-screen .su-pill{font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;padding:2px 7px;border-radius:6px;color:var(--green);background:var(--green-soft)}.setup-screen .su-sdesc{font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:5px}.setup-screen .su-methods{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.setup-screen .su-mchip{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;font-weight:500;color:var(--text-2);background:var(--panel-2);border:.5px solid var(--line);border-radius:10px;padding:9px 12px;cursor:pointer;transition:.15s;font-family:var(--sans)}.setup-screen .su-mchip:hover{border-color:var(--line-2)}.setup-screen .su-mchip .su-ck{width:16px;height:16px;border-radius:5px;border:1.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;flex-shrink:0}.setup-screen .su-mchip .su-ck svg{opacity:0}.setup-screen .su-mchip.on{border-color:color-mix(in srgb,var(--accent) 50%,transparent);background:color-mix(in srgb,var(--accent) 8%,transparent);color:var(--text)}.setup-screen .su-mchip.on .su-ck{background:var(--accent);border-color:var(--accent);color:var(--bg)}.setup-screen .su-mchip.on .su-ck svg{opacity:1}.setup-screen .su-acct{display:flex;align-items:center;gap:11px;margin-top:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:11px 13px}.setup-screen .su-av{width:30px;height:30px;border-radius:8px;background:var(--accent);color:var(--bg);font-weight:700;font-size:13px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-family:var(--mono)}.setup-screen .su-ainfo{flex:1;min-width:0}.setup-screen .su-ainfo b{font-size:13px;font-weight:600}.setup-screen .su-ainfo span{display:block;font-size:11.5px;color:var(--text-3);font-family:var(--mono);margin-top:1px}.setup-screen .su-field{margin-top:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:13px 14px;font-size:13.5px;color:var(--text);line-height:1.55}.setup-screen .su-edit{float:right;font-size:12px;color:var(--blue);cursor:pointer;margin-left:12px}.setup-screen .su-field b{font-weight:600}.setup-screen .su-examples{display:flex;flex-wrap:wrap;gap:7px;margin-top:11px}.setup-screen .su-ex{font-size:11.5px;color:var(--text-3);background:var(--bg);border:.5px solid var(--line);border-radius:8px;padding:6px 10px;cursor:pointer;transition:.15s;font-family:var(--sans)}.setup-screen .su-ex:hover{border-color:var(--line-2);color:var(--text-2)}.setup-screen .su-ex.added{border-color:color-mix(in srgb,var(--blue) 50%,transparent);color:var(--blue)}.setup-screen .su-plus{color:var(--blue);margin-right:5px;font-weight:600}.setup-screen .su-builds{margin-top:12px;display:flex;flex-direction:column;gap:8px}.setup-screen .su-bitem{display:flex;align-items:flex-start;gap:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:12px 14px}.setup-screen .su-bx{width:22px;height:22px;border-radius:7px;background:var(--lime-soft);color:var(--lime);display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}.setup-screen .su-bmain{flex:1;min-width:0}.setup-screen .su-bmain b{font-size:13.5px;font-weight:600}.setup-screen .su-bmain span{display:block;font-size:12px;color:var(--text-3);line-height:1.45;margin-top:2px}.setup-screen .su-where{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--text-4);border:.5px solid var(--line);border-radius:6px;padding:3px 7px;white-space:nowrap;align-self:center}.setup-screen .su-learn{border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);padding:15px 16px;margin-bottom:24px}.setup-screen .su-lhd{display:flex;align-items:center;gap:9px;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--amber);margin-bottom:9px}.setup-screen .su-learn p{font-size:13px;color:var(--text-2);line-height:1.55}.setup-screen .su-learn p+p{margin-top:8px}.setup-screen .su-learn b{color:var(--text);font-weight:600}.setup-screen .su-note{display:flex;gap:11px;margin-top:16px;border:.5px solid color-mix(in srgb,var(--note-accent, var(--blue)) 28%,transparent);background:linear-gradient(120deg,color-mix(in srgb,var(--note-accent, var(--blue)) 6%,transparent),transparent 70%);border-radius:12px;padding:13px 15px}.setup-screen .su-note svg{color:var(--note-accent, var(--blue));flex-shrink:0;margin-top:1px}.setup-screen .su-note p{font-size:12.5px;color:var(--text-2);line-height:1.5}.setup-screen .su-note p b{color:var(--note-accent, var(--blue))}.setup-screen .su-foot{display:flex;align-items:center;gap:14px;margin-top:24px;padding-top:20px;border-top:.5px solid var(--line)}.setup-screen .su-cta{display:inline-flex;align-items:center;gap:9px;background:var(--lime);color:var(--bg);font-family:var(--sans);font-size:13.5px;font-weight:700;border:none;border-radius:11px;padding:13px 19px;cursor:pointer;transition:.15s;white-space:nowrap}.setup-screen .su-cta:hover:not(:disabled){filter:brightness(1.06);transform:translateY(-1px)}.setup-screen .su-cta:disabled{cursor:default}.setup-screen .su-ar{font-size:16px;margin-top:-1px}.setup-screen .su-fnote{font-size:12px;color:var(--text-3);line-height:1.45}.setup-screen .su-fnote b{color:var(--text-2)}@keyframes su-spin{to{transform:rotate(360deg)}}.setup-screen .su-spin{animation:su-spin .8s linear infinite}.concepts-glossary .concept-search{width:100%;box-sizing:border-box;margin:4px 0 16px;padding:10px 12px;font:inherit;font-size:14px;color:var(--text-primary, #e8ebf2);background:var(--surface, #1b1f2a);border:1px solid var(--border, #2c3242);border-radius:10px}.concepts-glossary .concept-search:focus{outline:none;border-color:var(--accent, #6b8afd)}.concepts-glossary .concept-row{display:block}.concepts-glossary .concept-row .trow{width:100%}.concepts-glossary .concept-row-body{padding:0 16px 14px;margin-top:-4px}.concepts-glossary .concept-empty{padding:24px 4px;color:var(--text-tertiary, #8a92a6);font-size:14px}.xsvc{display:flex;flex-direction:column;min-height:100%;background:transparent;color:var(--text-body, #aaaaaa);font-family:IBM Plex Sans,system-ui,sans-serif}.xsvc-scroll{flex:1;overflow-y:auto;padding:26px 10% 40px}.xsvc-crumbs{margin-bottom:14px}.xsvc-back{background:none;border:0;padding:0;cursor:pointer;font:inherit;font-size:12.5px;color:var(--text-faint, #6b6b6b)}.xsvc-back:hover{color:var(--text-body, #aaaaaa)}.xsvc-head{display:block}.xsvc-head h1{font-size:26px;font-weight:700;color:var(--text-strong, #f2f2f2);letter-spacing:-.02em;margin:0}.xsvc-sub{font-size:13.5px;color:var(--text-faint, #6b6b6b);margin:7px 0 0;max-width:54ch}.xsvc-headbtn{font:inherit;font-size:12.5px;font-weight:600;color:var(--text-body, #aaaaaa);background:var(--surface-raised, #1c1c1c);border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:9px;padding:9px 14px;cursor:pointer;white-space:nowrap}.xsvc-headbtn:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));color:var(--text-strong, #f2f2f2)}.xsvc-groups{margin-top:26px}.xsvc-group{margin-bottom:24px}.xsvc-group-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:11px}.xsvc-seclabel{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--text-subtle, #4a4a4a)}.xsvc-seccount{font-size:11.5px;color:var(--text-subtle, #4a4a4a);font-variant-numeric:tabular-nums}.xsvc-rows{display:flex;flex-direction:column;gap:9px}.xsvc-row{display:flex;align-items:center;gap:14px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:14px;padding:14px 16px;background:var(--surface-card, #161616);transition:.16s;cursor:pointer}.xsvc-row:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));background:var(--surface-raised, #1c1c1c);transform:translateY(-1px)}.xsvc-row.attn{border-color:#ef9f2766;background:linear-gradient(150deg,#ef9f270f,#ef9f2703)}.xsvc-tile{width:40px;height:40px;border-radius:11px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-family:IBM Plex Mono,ui-monospace,monospace;font-size:13px;font-weight:600}.xsvc-tile.t-lime{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-tile.t-blue{background:var(--blue-soft, rgba(133, 183, 235, .13));color:var(--blue-300, #85b7eb)}.xsvc-tile.t-green{background:var(--green-soft, rgba(155, 211, 90, .13));color:var(--green-300, #9bd35a)}.xsvc-tile.t-amber{background:var(--amber-soft, rgba(239, 159, 39, .13));color:var(--amber-300, #ef9f27)}.xsvc-tile.t-indigo{background:var(--indigo-soft, rgba(139, 133, 255, .13));color:var(--indigo-300, #8b85ff)}.xsvc-rmain{min-width:0;flex:1}.xsvc-rname{font-size:14.5px;font-weight:600;color:var(--text-strong, #f2f2f2);display:flex;align-items:center;gap:9px;flex-wrap:wrap}.xsvc-rdesc{font-size:12.5px;color:var(--text-faint, #6b6b6b);margin-top:3px}.xsvc-rright{display:flex;align-items:center;gap:16px;flex-shrink:0}.xsvc-rmeta{text-align:right;line-height:1.3}.xsvc-rmeta .big{font-size:13px;font-weight:600;color:var(--text-strong, #f2f2f2);font-variant-numeric:tabular-nums}.xsvc-rmeta .lil{font-size:11px;color:var(--text-faint, #6b6b6b);margin-top:2px}.xsvc-arr{color:var(--text-subtle, #4a4a4a);font-size:15px;transition:.16s}.xsvc-row:hover .xsvc-arr{color:var(--text-body, #aaaaaa);transform:translate(2px)}.xsvc-tag{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:10px;font-weight:500;padding:2.5px 7px;border-radius:6px;text-transform:uppercase}.xsvc-tag.set{background:var(--green-soft, rgba(155, 211, 90, .13));color:var(--green-300, #9bd35a)}.xsvc-tag.env{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a);text-transform:none}.xsvc-tag.miss{background:var(--amber-soft, rgba(239, 159, 39, .13));color:var(--amber-300, #ef9f27)}.xsvc-addkey{font:inherit;font-size:11.5px;font-weight:600;color:#0a0a0a;background:var(--amber-300, #ef9f27);border:0;border-radius:8px;padding:6px 11px;cursor:pointer}.xsvc-empty-wrap{margin-top:30px;display:flex;justify-content:center}.xsvc-empty-card{width:100%;max-width:700px;text-align:center;padding:42px 34px 28px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:20px;background:radial-gradient(120% 120% at 50% -10%,rgba(199,240,74,.05),transparent 60%),var(--surface-panel, #111111)}.xsvc-empty-mark{width:52px;height:52px;border-radius:14px;margin:0 auto 18px;display:flex;align-items:center;justify-content:center;background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-empty-card h2{font-size:20px;font-weight:700;color:var(--text-strong, #f2f2f2);margin:0 0 10px}.xsvc-empty-card p{font-size:13.5px;color:var(--text-body, #aaaaaa);margin:0 auto;max-width:50ch}.xsvc-chat-hero{margin-top:26px;text-align:left}.xsvc-lead{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--lime-300, #c7f04a);display:flex;align-items:center;gap:7px;margin-bottom:11px}.xsvc-composer{display:flex;align-items:center;gap:10px;width:100%;font:inherit;text-align:left;cursor:pointer;background:var(--surface-card, #161616);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:13px;padding:11px 12px 11px 15px}.xsvc-composer:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-composer .ph{flex:1;font-size:13.5px;color:var(--text-faint, #6b6b6b)}.xsvc-composer .send{width:32px;height:32px;border-radius:9px;background:var(--lime-300, #c7f04a);color:#0a0a0a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:13px}.xsvc-chip{font:inherit;font-size:12px;color:var(--text-body, #aaaaaa);background:var(--surface-raised, #1c1c1c);border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:999px;padding:7px 13px;cursor:pointer}.xsvc-chip:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));color:var(--text-strong, #f2f2f2)}.xsvc-chip .g{color:var(--lime-300, #c7f04a);font-family:IBM Plex Mono,ui-monospace,monospace;margin-right:5px}.xsvc-bottombar{flex-shrink:0;border-top:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));background:linear-gradient(180deg,rgba(199,240,74,.02),transparent),var(--surface-panel, #111111);padding:12px clamp(18px,6%,64px) 14px}.xsvc-bb-sugg{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:10px}.xsvc-bb-sugg .xsvc-chip{font-size:11.5px}.xsvc-bb-composer{display:flex;align-items:center;gap:11px;width:100%;font:inherit;text-align:left;cursor:pointer;background:var(--surface-card, #161616);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:12px;padding:10px 11px 10px 15px}.xsvc-bb-composer:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-bb-composer .ai{width:24px;height:24px;border-radius:7px;background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a);display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-bb-composer .ph{flex:1;font-size:13.5px;color:var(--text-faint, #6b6b6b)}.xsvc-bb-composer .send{width:30px;height:30px;border-radius:9px;background:var(--lime-300, #c7f04a);color:#0a0a0a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-connected{position:relative;display:flex;flex-direction:column;min-height:100%;height:100%}.xsvc-connected>.xsvc{flex:1}.xsvc-chatdock{position:absolute;left:0;right:0;bottom:0;z-index:20;background:var(--surface-page, #0a0a0a);border-top:.5px solid var(--line-hair, rgba(255, 255, 255, .12));padding:10px 10% 16px;box-shadow:0 -18px 40px #0000008c}.xsvc-chatdock-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;font-family:IBM Plex Sans,system-ui,sans-serif;font-size:12.5px;color:var(--text-faint, #6b6b6b)}.xsvc-chatdock-close{background:none;border:0;padding:4px 6px;cursor:pointer;font:inherit;color:var(--text-faint, #6b6b6b)}.xsvc-chatdock-close:hover{color:var(--text-body, #aaaaaa)}.xsvc-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:16px}.xsvc-sortlbl{font-size:12px;color:var(--text-faint, #6b6b6b)}.xsvc-seg{display:inline-flex;border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:9px;overflow:hidden}.xsvc-seg button{font:inherit;font-size:12.5px;padding:5px 14px;background:transparent;color:var(--text-faint, #6b6b6b);border:0;cursor:pointer}.xsvc-seg button:hover{color:var(--text-body, #aaaaaa)}.xsvc-seg button.on{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-tile svg{display:block}.xsvc-rowwrap{border-radius:14px}.xsvc-arr.down{color:var(--lime-300, #c7f04a)}.xsvc-detail{padding:12px 16px 14px 70px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-top:0;border-radius:0 0 14px 14px;background:var(--surface-card, #161616);display:flex;flex-direction:column;gap:8px}.xsvc-detrow{display:flex;align-items:center;gap:12px;font-size:12.5px}.xsvc-detlabel{min-width:92px;color:var(--text-faint, #6b6b6b)}.xsvc-detval{color:var(--text-body, #aaaaaa)}.xsvc-detval.mono,.xsvc-keyval .mono{font-family:IBM Plex Mono,ui-monospace,monospace;color:var(--lime-300, #c7f04a);font-size:12px;letter-spacing:.02em}.xsvc-keyval{display:inline-flex;align-items:center;gap:10px;font:inherit;background:var(--surface-page, #0a0a0a);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:8px;padding:5px 10px;cursor:pointer}.xsvc-keyval:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-keyval .eye{display:flex;color:var(--text-faint, #6b6b6b)}.xsvc-keyval:hover .eye{color:var(--lime-300, #c7f04a)}.xsvc-titlerow{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}.xsvc-count{font-size:13px;color:var(--text-faint, #6b6b6b);font-variant-numeric:tabular-nums}.xsvc-cinput{flex:1;min-width:0;font:inherit;font-size:13.5px;color:var(--text-strong, #f2f2f2);background:transparent;border:0;outline:none}.xsvc-cinput::placeholder{color:var(--text-faint, #6b6b6b)}.xsvc-composer .send,.xsvc-bb-composer .send{border:0;cursor:pointer}.xsvc-composer,.xsvc-bb-composer{cursor:text}.hosting-screen .sd-callout{display:flex;gap:12px;padding:13px 15px;border-radius:11px;background:var(--surface-card);border:1px solid var(--line-subtle);border-left-width:3px;margin:14px 0}.hosting-screen .sd-callout.cost{border-left-color:var(--amber-300)}.hosting-screen .sd-callout.wait{border-left-color:var(--blue-300)}.hosting-screen .sd-callout.size{border-left-color:var(--lime-400)}.hosting-screen .sd-callout-ic{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:7px;background:var(--surface-raised);font-size:14px;font-weight:700}.hosting-screen .sd-callout-t{font-size:14px;font-weight:600;margin-bottom:2px}.hosting-screen .sd-callout-b{font-size:13.5px;line-height:1.55;color:var(--text-body)}.hosting-screen .sd-store{display:flex;gap:13px;padding:15px;border-radius:12px;background:var(--surface-card);border:1px solid var(--line-subtle);margin-bottom:12px}.hosting-screen .sd-store-mark{flex:none;display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;font-size:20px;color:#fff}.hosting-screen .sd-store.ios .sd-store-mark{background:linear-gradient(140deg,#555,#111)}.hosting-screen .sd-store.android .sd-store-mark{background:linear-gradient(140deg,#3ddc84,#14a05a)}.hosting-screen .sd-store-top{display:flex;align-items:center;gap:10px;margin-bottom:4px}.hosting-screen .sd-store-name{font-size:15px;font-weight:600}.hosting-screen .sd-store-badge{font-size:11.5px;padding:2px 8px;border-radius:999px;background:var(--surface-raised);color:var(--text-body);border:1px solid var(--line-subtle)}.hosting-screen .sd-store-desc{font-size:13.5px;line-height:1.55;color:var(--text-body)}.hosting-screen .sd-store-enroll{display:inline-flex;align-items:center;margin-top:10px;padding:6px 12px;border-radius:8px;font-size:13px;font-weight:600;text-decoration:none;color:var(--accent-strong, #2563eb);background:var(--surface-raised);border:1px solid var(--line-subtle)}.hosting-screen .sd-store-enroll:hover{text-decoration:underline}.hosting-screen .sd-checks{display:flex;flex-direction:column;gap:9px;margin:6px 0}.hosting-screen .sd-check{display:flex;gap:9px;font-size:14px;line-height:1.5;color:var(--text-body)}.hosting-screen .sd-check svg{flex:none;margin-top:3px}.hosting-screen .sd-check b{color:var(--text-strong)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./markdown-C9tbsVHX.js";import{b as o}from"./react-nrLBr15I.js";import{u as se}from"./useServerIdentity-B7rI0u3O.js";function ce(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function le(t){if(!t)return{base:null,sep:"/"};const r=t.lastIndexOf("/"),a=t.lastIndexOf("\\"),n=Math.max(r,a);if(n<0)return{base:null,sep:"/"};const c=n===a?"\\":"/";return{base:t.slice(0,n),sep:c}}function B({suggestedNewProjectPath:t,creating:r=!1,createError:a=null,onCreate:n,onClose:c}){const[i,x]=o.useState(""),[l,f]=o.useState(""),j=o.useRef(!1),{base:y,sep:m}=le(t),p=y?`${y}${m}`:"",w=`${p}${ce(i)}`,g=j.current?l:w;o.useEffect(()=>{const b=S=>{S.key==="Escape"&&!r&&c()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r,c]);const h=b=>{j.current=!0,f(b)},N=()=>{const b=i.trim(),S=g.trim();b.length>0&&S.length>0&&!r&&n(S,b)},P=i.trim().length>0&&!r;return e.jsx("div",{role:"presentation",onClick:()=>{r||c()},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 px-6 backdrop-blur-sm",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create your first project",onClick:b=>b.stopPropagation(),className:"w-full max-w-md rounded-xl border border-[var(--border-default)] bg-[var(--bg-elevated,#141414)] p-6 text-[var(--text-primary)] shadow-2xl",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)]",children:"Create your first project"}),e.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:"Name your project and choose where it lives. CodeYam will scaffold it and walk you through the rest."}),e.jsxs("label",{className:"mt-5 block text-xs font-medium text-[var(--text-secondary)]",children:["Project name",e.jsx("input",{type:"text",autoFocus:!0,value:i,onChange:b=>x(b.target.value),onKeyDown:b=>{b.key==="Enter"&&N()},placeholder:"My First App","aria-label":"Project name",className:"mt-1 w-full rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-2 text-sm font-normal text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"})]}),e.jsxs("label",{className:"mt-4 block text-xs font-medium text-[var(--text-secondary)]",children:["Location",e.jsx("input",{type:"text",value:g,onChange:b=>h(b.target.value),onKeyDown:b=>{b.key==="Enter"&&N()},placeholder:p||"/path/to/new/project","aria-label":"Project location",className:"mt-1 w-full rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-2 font-mono text-sm font-normal text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"})]}),a&&e.jsx("div",{className:"mt-3 whitespace-pre-line text-xs text-[var(--accent-red)]",children:a}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:c,disabled:r,className:"rounded border border-[var(--border-default)] px-4 py-2 text-sm text-[var(--text-secondary)] transition hover:text-[var(--text-primary)] disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),e.jsx("button",{type:"button",onClick:N,disabled:!P,className:"rounded bg-[var(--accent-active)] px-4 py-2 text-sm font-semibold text-[var(--bg-deep)] transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:r?"Creating…":"Create Project"})]})]})})}const fe=Object.freeze(Object.defineProperty({__proto__:null,CreateProjectModal:B},Symbol.toStringTag,{value:"Module"}));function R({projects:t,onClone:r,cloningRepoUrl:a=null,cloneError:n=null,defaultOpen:c=!1}){const[i,x]=o.useState(c),l=i||a!==null||n!==null;return e.jsxs("div",{className:"mt-6",children:[e.jsxs("button",{type:"button",onClick:()=>x(f=>!f),"aria-expanded":l,className:"flex w-full items-center justify-between rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-3 text-left transition hover:border-[var(--accent-active)]",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Open Source Projects"}),e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:l?"▾":"▸"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 px-1 text-xs text-[var(--text-muted)]",children:"Clone one of codeyam's showcase apps and open it in the editor — nothing to configure."}),e.jsx("ul",{className:"mt-2 flex flex-col gap-3",children:t.map(f=>e.jsx(I,{project:f,busy:a===f.repoUrl,onClone:r},f.slug))}),n&&e.jsx("div",{className:"mt-3 whitespace-pre-line rounded-lg border border-[var(--accent-red)]/40 bg-[var(--bg-card)] px-4 py-3 font-mono text-xs text-[var(--accent-red)]",children:n})]})]})}function I({project:t,busy:r,onClone:a}){const{name:n,description:c,repoUrl:i,thumbnail:x}=t;return e.jsxs("li",{className:"flex items-center justify-between gap-4 rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx($,{src:x,name:n,size:"h-24 w-20"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-[var(--text-primary)]",children:n}),e.jsx("div",{className:"mt-1 text-xs text-[var(--text-muted)]",children:c})]})]}),e.jsx("button",{type:"button",disabled:r,onClick:()=>a(i),className:"shrink-0 rounded bg-[var(--accent-active)] px-3 py-1.5 text-sm font-medium text-[var(--bg-deep)] transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:r?"Cloning…":"Clone & Open"})]})}const he=Object.freeze(Object.defineProperty({__proto__:null,OpenSourceProjectRow:I,OpenSourceProjectsSection:R},Symbol.toStringTag,{value:"Module"})),ie=[{slug:"tabcommand",name:"TabCommand",description:"A Chrome extension dashboard to control your browser (React + Vite, Manifest V3).",repoUrl:"https://github.com/codeyam-ai/tabcommand",thumbnail:"/open-source/tabcommand.png",thumbnailSource:{repo:"tabcommand",scenario:"home-grouped",dimension:"desktop"}},{slug:"codeyam-counter",name:"CodeYam Counter",description:"A native SwiftUI iOS counter app with a shared AppCore SwiftPM library.",repoUrl:"https://github.com/codeyam-ai/codeyam-counter",thumbnail:"/open-source/codeyam-counter.png",thumbnailSource:{repo:"codeyam-counter",scenario:"counter-active-count",dimension:"iphone-16"}},{slug:"el-carot",name:"El Carot",description:"AI-powered tarot readings through a one-of-a-kind deck (Next.js + Prisma + Anthropic API).",repoUrl:"https://github.com/codeyam-ai/el-carot",thumbnail:"/open-source/el-carot.png",thumbnailSource:{repo:"el-carot",scenario:"landing-english",dimension:"mobile"}}];function U(t){const r=t.filter(n=>n.isCurrent),a=t.filter(n=>!n.isCurrent);return[...r,...a]}function z({projects:t,loading:r=!1,error:a=null,openError:n=null,busyPath:c=null,onOpen:i,onStop:x,onScan:l,scanning:f=!1,scanResult:j=null,scanError:y=null,onCreate:m,creating:p=!1,createError:w=null,suggestedNewProjectPath:g=null,bootstrapping:h=!1,onClone:N,cloningRepoUrl:P=null,cloneError:b=null}){const[S,_]=o.useState(!1),{version:k}=se(),F=!r&&!a&&t.length===0,E=!!m&&!(F&&m);return e.jsxs("div",{className:"flex min-h-screen flex-col items-center bg-[var(--bg-deep)] px-6 py-16 text-[var(--text-primary)]",children:[e.jsxs("div",{className:"w-full max-w-2xl",children:[e.jsx(J,{}),E&&m&&e.jsx(D,{onCreate:m,creating:p,createError:w,suggestedNewProjectPath:g}),l&&e.jsx(K,{onScan:l,scanning:f,scanResult:j,scanError:y}),h&&e.jsx(Y,{}),n&&e.jsx(X,{message:n}),r?e.jsx(G,{}):a?e.jsx(Q,{message:a}):t.length===0?e.jsx(Z,{onScan:l,scanning:f,onCreateFirst:m?()=>_(!0):void 0}):e.jsx("ul",{className:"flex flex-col gap-3",children:U(t).map(O=>e.jsx(H,{project:O,busy:c===O.path,onOpen:i,onStop:x},O.path))}),N&&e.jsx(R,{projects:ie,onClone:N,cloningRepoUrl:P,cloneError:b,defaultOpen:t.length===0}),k&&e.jsxs("div",{"data-testid":"launcher-version",className:"mt-8 text-center text-xs text-[var(--text-dim)]",children:["codeyam-editor v",k]})]}),S&&m&&e.jsx(B,{suggestedNewProjectPath:g,creating:p,createError:w,onCreate:m,onClose:()=>_(!1)})]})}function H({project:t,busy:r,onOpen:a,onStop:n}){const{name:c,path:i,exists:x,running:l,controlPort:f,tests:j,thumbnailUrl:y,isCurrent:m,protected:p}=t;return e.jsxs("li",{className:`flex items-center justify-between gap-4 rounded-lg border bg-[var(--bg-card)] px-4 py-3 ${m?"border-[var(--accent-active)]":"border-[var(--border-default)]"} ${x?"":"opacity-60"}`,children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx($,{src:x&&!p?y:null,name:c}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-[var(--text-primary)]",children:c}),m&&e.jsx(W,{}),l&&e.jsx(q,{controlPort:f})]}),e.jsx("div",{className:"truncate text-xs text-[var(--text-dim)]",title:i,children:i}),p?e.jsx("div",{className:"mt-1 text-xs text-[var(--text-dim)]",children:"OS-protected location — not scanned in the background"}):x?e.jsx(de,{tests:j}):e.jsx("div",{className:"mt-1 text-xs text-[var(--accent-orange)]",children:"Folder missing — moved or deleted"})]})]}),e.jsx(V,{path:i,exists:x,running:l,busy:r,isCurrent:m,onOpen:a,onStop:n})]})}function J(){return e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-semibold text-[var(--text-primary)]",children:"Your projects"}),e.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:"Pick a project to open in the editor, or stop one that's running."})]})}function D({onCreate:t,creating:r=!1,createError:a=null,suggestedNewProjectPath:n=null,defaultOpen:c=!1}){const[i,x]=o.useState(c),[l,f]=o.useState(""),[j,y]=o.useState(""),m=o.useRef(!1);o.useEffect(()=>{m.current||n&&l===""&&f(n)},[n,l]);const p=h=>{m.current=!0,f(h)};if(!(i||r||a!==null))return e.jsx("div",{className:"mb-3",children:e.jsx("button",{type:"button",onClick:()=>x(!0),className:"text-sm text-[var(--text-secondary)] underline-offset-2 transition hover:text-[var(--text-primary)] hover:underline",children:"+ New project…"})});const g=()=>{const h=l.trim();h.length>0&&!r&&t(h,j.trim())};return e.jsxs("div",{className:"mb-3 rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:l,onChange:h=>p(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()},placeholder:"/path/to/new/project","aria-label":"Folder for the new project",className:"min-w-0 flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"}),e.jsx("button",{type:"button",disabled:r||l.trim().length===0,onClick:g,className:"shrink-0 rounded bg-[var(--accent-active)] px-3 py-1.5 text-sm font-medium text-[var(--bg-deep)] transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:r?"Creating…":"Create"})]}),e.jsx("input",{type:"text",value:j,onChange:h=>y(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()},placeholder:"Project name (optional)","aria-label":"Project name (optional)",className:"mt-2 w-full rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"}),a&&e.jsx("div",{className:"mt-2 whitespace-pre-line text-xs text-[var(--accent-red)]",children:a})]})}function K({onScan:t,scanning:r=!1,scanResult:a=null,scanError:n=null}){const[c,i]=o.useState(!1),[x,l]=o.useState(""),[f,j]=o.useState(!0);if(!(c||r||a!==null||n!==null))return e.jsx("div",{className:"mb-6",children:e.jsx("button",{type:"button",onClick:()=>i(!0),className:"text-sm text-[var(--text-secondary)] underline-offset-2 transition hover:text-[var(--text-primary)] hover:underline",children:"+ Add projects from a folder…"})});const m=()=>{const p=x.trim();p.length>0&&!r&&t(p,f)};return e.jsxs("div",{className:"mb-6 rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&m()},placeholder:"/path/to/your/workspace","aria-label":"Folder to scan for projects",className:"min-w-0 flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-input)] px-3 py-1.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"}),e.jsx("button",{type:"button",disabled:r||x.trim().length===0,onClick:m,className:"shrink-0 rounded bg-[var(--accent-active)] px-3 py-1.5 text-sm font-medium text-[var(--bg-deep)] transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:r?"Scanning…":"Scan"})]}),e.jsxs("label",{className:"mt-2 flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:p=>j(p.target.checked)}),"Remember this folder and re-scan it next time"]}),n&&e.jsx("div",{className:"mt-2 text-xs text-[var(--accent-red)]",children:n}),a&&!n&&e.jsxs("div",{className:"mt-2 text-xs text-[var(--accent-green)]",children:["Found ",a.found," project",a.found===1?"":"s",", ",a.added," new"]}),(a==null?void 0:a.note)&&!n&&e.jsx("div",{className:"mt-1 text-xs text-[var(--text-dim)]",children:a.note})]})}function Y(){return e.jsx("div",{className:"mb-6 rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-3 text-sm text-[var(--text-muted)]",children:"Looking for your projects…"})}function V({path:t,exists:r,running:a,busy:n,isCurrent:c=!1,onOpen:i,onStop:x}){const l=n?"Opening…":c?"Open this project":a?"Reopen":"Open";return e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a&&r&&e.jsx("button",{type:"button",disabled:n,onClick:()=>x(t),className:"rounded border border-[var(--border-default)] px-3 py-1.5 text-sm text-[var(--text-secondary)] transition hover:border-[var(--accent-red)] hover:text-[var(--accent-red)] disabled:cursor-not-allowed disabled:opacity-50",children:n?"Stopping…":"Stop"}),e.jsx("button",{type:"button",disabled:!r||n,onClick:()=>i(t),className:"rounded bg-[var(--accent-active)] px-3 py-1.5 text-sm font-medium text-[var(--bg-deep)] transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:l})]})}function W(){return e.jsx("span",{className:"inline-flex items-center rounded-full bg-[var(--accent-active)]/15 px-2 py-0.5 text-xs font-medium text-[var(--accent-active)]",children:"Current"})}function $({src:t,name:r,size:a="h-12 w-16"}){const[n,c]=o.useState(!1);o.useEffect(()=>{c(!1)},[t]);const i=!!t&&!n;return e.jsx("div",{className:`flex ${a} shrink-0 items-center justify-center overflow-hidden rounded border border-[var(--border-subtle)] bg-[var(--bg-surface)]`,children:i?e.jsx("img",{src:t??void 0,alt:`${r} preview`,className:"max-h-full max-w-full object-contain",onError:()=>c(!0)}):e.jsx("div",{className:"flex h-full w-full items-center justify-center text-[10px] text-[var(--text-dim)]",children:"no preview"})})}function de({tests:t}){return!t||t.total===0?e.jsx("div",{className:"mt-1 text-xs text-[var(--text-dim)]",children:"No tests yet"}):e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"text-[var(--text-muted)]",children:[t.total," tests"]}),t.passed>0&&e.jsxs("span",{className:"text-[var(--accent-green)]",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-[var(--accent-red)]",children:[t.failed," failed"]})]})}function q({controlPort:t}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[var(--accent-green)]/15 px-2 py-0.5 text-xs text-[var(--accent-green)]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--accent-green)]"}),"running",t?` · :${t}`:""]})}function G(){return e.jsx("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-6 text-sm text-[var(--text-muted)]",children:"Loading projects…"})}function Q({message:t}){return e.jsxs("div",{className:"whitespace-pre-line rounded-lg border border-[var(--accent-red)]/40 bg-[var(--bg-card)] px-4 py-6 text-sm text-[var(--accent-red)]",children:["Couldn't load projects: ",t]})}function X({message:t}){return e.jsx("div",{className:"mb-3 whitespace-pre-line rounded-lg border border-[var(--accent-red)]/40 bg-[var(--bg-card)] px-4 py-3 font-mono text-xs text-[var(--accent-red)]",children:t})}function Z({onScan:t,scanning:r=!1,onCreateFirst:a}={}){return a?e.jsxs("div",{className:"flex flex-col items-center rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-6 py-16 text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-[var(--text-primary)]",children:"Create Your First Project"}),e.jsx("p",{className:"mt-2 max-w-sm text-sm text-[var(--text-muted)]",children:"CodeYam will walk you through creating your first project. You just need an idea to get started"}),e.jsx("button",{type:"button",onClick:a,className:"mt-6 rounded bg-[var(--accent-active)] px-5 py-2.5 text-sm font-semibold text-[var(--bg-deep)] transition hover:opacity-90",children:"Create Project"})]}):e.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border-default)] bg-[var(--bg-card)] px-4 py-10 text-center",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t?e.jsxs(e.Fragment,{children:["No projects yet."," ",r?"Scanning for projects…":"Add a folder above to scan for projects already on disk, or run"," ",!r&&e.jsx("code",{className:"rounded bg-[var(--bg-input)] px-1.5 py-0.5 text-xs text-[var(--text-secondary)]",children:"codeyam-editor init"}),!r&&" in a project folder."]}):e.jsxs(e.Fragment,{children:["No projects yet. Run"," ",e.jsx("code",{className:"rounded bg-[var(--bg-input)] px-1.5 py-0.5 text-xs text-[var(--text-secondary)]",children:"codeyam-editor init"})," ","in a project folder to get started."]})})})}const ve=Object.freeze(Object.defineProperty({__proto__:null,CurrentBadge:W,ProjectBootstrapBanner:Y,ProjectCreateForm:D,ProjectLauncher:z,ProjectLauncherEmpty:Z,ProjectLauncherError:Q,ProjectLauncherHeader:J,ProjectLauncherLoading:G,ProjectOpenError:X,ProjectRow:H,ProjectRowActions:V,ProjectScanForm:K,RunningBadge:q,Thumbnail:$,sortCurrentFirst:U},Symbol.toStringTag,{value:"Module"})),ue=3e3,L=305e3;async function A(t,r,a){const n=new AbortController,c=setTimeout(()=>n.abort(),a);try{return await fetch(t,{...r,signal:n.signal})}finally{clearTimeout(c)}}function M(t,r){return t instanceof DOMException&&t.name==="AbortError"?"Opening timed out — the project may not be responding.":t instanceof Error?t.message:r}function xe(){const[t,r]=o.useState(null),[a,n]=o.useState(null),[c,i]=o.useState(null),[x,l]=o.useState(null),[f,j]=o.useState(!1),[y,m]=o.useState(null),[p,w]=o.useState(null),[g,h]=o.useState(!1),[N,P]=o.useState(null),[b,S]=o.useState(!1),[_,k]=o.useState(null),[F,E]=o.useState(null),[O,ee]=o.useState(null),C=o.useCallback(async()=>{try{const d=await fetch("/api/projects");if(!d.ok)throw new Error(`HTTP ${d.status}`);const s=await d.json();r(Array.isArray(s.projects)?s.projects:[]),ee(typeof s.suggestedNewProjectPath=="string"?s.suggestedNewProjectPath:null),n(null)}catch(d){n(d instanceof Error?d.message:"Failed to load projects")}},[]),T=o.useCallback(async()=>{try{const d=await fetch("/api/projects/scan-status");if(!d.ok)return;const u=!!(await d.json()).running;S(v=>(v&&!u&&C(),u))}catch{}},[C]);o.useEffect(()=>{C(),T();const d=setInterval(()=>{document.visibilityState==="visible"&&(C(),T())},ue),s=()=>{document.visibilityState==="visible"&&(C(),T())};return document.addEventListener("visibilitychange",s),()=>{clearInterval(d),document.removeEventListener("visibilitychange",s)}},[C,T]);const te=o.useCallback(async(d,s)=>{j(!0),w(null),m(null);try{const u=await fetch("/api/projects/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:d,remember:s})}),v=await u.json().catch(()=>({}));if(!u.ok)throw new Error(typeof v.error=="string"?v.error:`HTTP ${u.status}`);r(Array.isArray(v.projects)?v.projects:[]),m({found:v.found??0,added:v.added??0,note:typeof v.note=="string"?v.note:void 0})}catch(u){w(u instanceof Error?u.message:"Scan failed")}finally{j(!1)}},[]),re=o.useCallback(async(d,s)=>{h(!0),P(null);try{const u=await A("/api/projects/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{path:d,name:s}:{path:d})},L),v=await u.json().catch(()=>({}));if(!u.ok)throw new Error(typeof v.error=="string"?v.error:`HTTP ${u.status}`);if(typeof v.url=="string"){window.location.href=v.url;return}throw new Error("create did not return a url")}catch(u){P(M(u,"Failed to create project")),h(!1)}},[]),ae=o.useCallback(async d=>{k(d),E(null);try{const s=await A("/api/projects/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:d})},L),u=await s.json().catch(()=>({}));if(!s.ok)throw new Error(typeof u.error=="string"?u.error:`HTTP ${s.status}`);if(typeof u.url=="string"){window.location.href=u.url;return}throw new Error("clone did not return a url")}catch(s){E(M(s,"Failed to clone project")),k(null)}},[]),ne=o.useCallback(async d=>{l(d),i(null);try{const s=await A("/api/projects/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d})},L),u=await s.json().catch(()=>({}));if(!s.ok)throw new Error(typeof u.error=="string"?u.error:`HTTP ${s.status}`);const{url:v}=u;if(typeof v=="string"){window.location.href=v;return}throw new Error("open did not return a url")}catch(s){i(M(s,"Failed to open project")),l(null)}},[]),oe=o.useCallback(async d=>{l(d);try{const s=await fetch("/api/projects/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:d})});if(!s.ok)throw new Error(`HTTP ${s.status}`);await C()}catch(s){n(s instanceof Error?s.message:"Failed to stop project")}finally{l(null)}},[C]);return e.jsx(z,{projects:t??[],loading:t===null&&a===null,error:a,openError:c,busyPath:x,onOpen:ne,onStop:oe,onScan:te,scanning:f,scanResult:y,scanError:p,onCreate:re,creating:g,createError:N,suggestedNewProjectPath:O,bootstrapping:b,onClone:ae,cloningRepoUrl:_,cloneError:F})}const je=Object.freeze(Object.defineProperty({__proto__:null,ProjectLauncherScreen:xe},Symbol.toStringTag,{value:"Module"}));export{B as C,I as O,xe as P,q as R,$ as T,je as _,R as a,X as b,Z as c,Q as d,G as e,J as f,W as g,Y as h,D as i,K as j,V as k,H as l,z as m,ve as n,he as o,fe as p};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./markdown-C9tbsVHX.js";import{b as l}from"./react-nrLBr15I.js";import{u as or}from"./useEvents-S3Qk1Y_d.js";import{r as ir,a as cr}from"./xterm--24IGk-x.js";import{l as Y,c as lr}from"./index-DCHqRrwO.js";import{u as dr}from"./useServerIdentity-B7rI0u3O.js";const ye=4e3;function Be(e){let t;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return t.length>ye?`${t.slice(0,ye)}
|
|
2
|
-
… (truncated, ${t.length-ye} more chars)`:t}function ur({slug:e,scenarioName:t,seedTabs:r,mockEntries:a,selectedMock:s,selectedSeedTab:o,selectedSeedRows:c}){const i=[],p=t??e;if(i.push(`# Edit Scenario Data: "${p}"`),i.push(""),i.push(`**Slug**: ${e}`),i.push(`**Scenario file**: .codeyam/scenarios/${e}.json`),i.push(""),i.push("## Scenario overview"),r.length>0){i.push("### Seed & Local tables");for(const f of r){const b=f.category?` (${f.category})`:"";i.push(`- **${f.label}**${b} — dataKey \`${f.dataKey}\``)}i.push("")}if(a.length>0){i.push("### HTTP mocks");const f=new Map;for(const b of a){const h=f.get(b.source)??[];h.push(b),f.set(b.source,h)}for(const[b,h]of f){i.push(`**${b}** (${h.length}):`);for(const d of h)i.push(`- \`${d.method} ${d.pathPattern}\``)}i.push("")}if(s){const f=`${s.method} ${s.pathPattern}`;i.push(`## Currently viewing: mock \`${f}\``),i.push(`- **Source**: ${s.source}`),s.status!==void 0&&i.push(`- **Status**: ${s.status}`);const b=s.headers??{},h=Object.entries(b);if(h.length>0){i.push("- **Headers**:");for(const[d,m]of h)i.push(` - \`${d}: ${m}\``)}s.body!==void 0&&s.body!==null?(i.push("- **Body**:"),i.push("```json"),i.push(Be(s.body)),i.push("```")):i.push("- **Body**: (empty)"),i.push("")}else if(o){if(i.push(`## Currently viewing: seed table **${o.label}**`),i.push(`- **dataKey**: \`${o.dataKey}\``),o.category&&i.push(`- **Category**: ${o.category}`),o.description&&i.push(`- **Description**: ${o.description}`),o.schemaFields&&o.schemaFields.length>0){i.push("- **Schema**:");for(const f of o.schemaFields){const b=f.isId?" (PK)":"";i.push(` - \`${f.name}\`: ${f.type}${b}`)}}c&&c.length>0?(i.push(`- **Rows** (${c.length}):`),i.push("```json"),i.push(Be(c)),i.push("```")):i.push("- **Rows**: (none yet)"),i.push("")}return i.push("## Your task"),i.push("The user is looking at the Scenario Data Panel and wants your help adjusting its data. Ask what change they'd like to make."),i.push(""),i.push("Typical edits:"),i.push('- Tweak an HTTP mock body, status, or headers → update `mocks.http["METHOD /path"]` in the scenario JSON'),i.push("- Add or remove seed rows → update the `seed` section"),i.push("- Adjust `localStorage` values → update the `localStorage` section"),i.push(""),i.push("To save changes:"),i.push("1. Write the updated scenario JSON to `.codeyam/tmp/scenario.json`"),i.push("2. Run: `codeyam-editor editor register @.codeyam/tmp/scenario.json`"),i.push("3. The editor will reload automatically and the panel will reflect the new data."),i.join(`
|
|
3
|
-
`)}const Ce=new Set;let ae=null;const fr=150;function Ca(e){return Ce.add(e),()=>{Ce.delete(e)}}function q(){ae&&clearTimeout(ae),ae=setTimeout(()=>{ae=null;for(const e of Ce)e()},fr)}const Ne=new Set;function Na(e){for(const t of Ne)t(e)}function pr(e){return Ne.add(e),()=>{Ne.delete(e)}}function hr({onSelect:e,onFocus:t}){l.useEffect(()=>pr(({routeKey:r,jsonPath:a})=>{e(r),t(a)}),[e,t])}const Me="claude";function ee(e){switch(e){case"codex":return"Codex";case"gemini":return"Gemini";case"opencode":return"OpenCode";default:return"Claude"}}const mr=3e3;function Qe(){const[e,t]=l.useState(null),[r,a]=l.useState(!0),[s,o]=l.useState(null),c=l.useRef(null),i=l.useCallback(async()=>{try{const p=await fetch("/api/config");if(!p.ok)throw new Error(`HTTP ${p.status}`);const f=await p.json(),b={projectTitle:f.projectTitle??null,projectDescription:f.projectDescription??null,provider:f.provider??Me,port:f.port??3e3,previewOrigin:f.previewOrigin??null,screenSizes:f.screenSizes??{},defaultScreenSize:f.defaultScreenSize??null,apps:f.apps??[],admin:f.admin??!1,mobileTerminalCommands:f.mobileTerminalCommands??[],launcherUrl:f.launcherUrl??null,projectCount:f.projectCount??0,setupBrowserEnabled:f.setupBrowserEnabled??!1,claudePermissionModeAuto:f.claudePermissionModeAuto??!0},h=JSON.stringify(b);h!==c.current&&(c.current=h,t(b)),o(null)}catch(p){o(p instanceof Error?p.message:"Failed to load config")}finally{a(!1)}},[]);return l.useEffect(()=>{i();const p=setInterval(()=>{i()},mr);return()=>clearInterval(p)},[i]),{config:e,apps:(e==null?void 0:e.apps)??[],loading:r,error:s,refetch:i}}async function de(e){try{const t=await e.json();if(t.error)return t.error}catch{}return`Request failed (${e.status})`}async function xr(e,t=null){const r=t!=null?`?since_ms=${encodeURIComponent(t)}`:"",s=await(await fetch(`/api/mock-panel/${encodeURIComponent(e)}${r}`)).json();if("error"in s)throw new Error(s.error);return s}async function Fe(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t.routeKey)}`,a=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t.status,body:t.body,headers:t.headers})});if(!a.ok)throw new Error(await de(a))}async function br(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t)}`,a=await fetch(r,{method:"DELETE"});if(!a.ok)throw new Error(await de(a))}async function gr(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t)}/passthrough`,a=await fetch(r,{method:"POST"});if(!a.ok)throw new Error(await de(a))}function U(e){return e.kind==="shared"?`shared:${e.slug}`:e.kind}async function yr(e){const t=await fetch("/api/mocks/save-scoped",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok||"success"in r&&r.success===!1)throw new Error("error"in r?r.error:`Save failed (${t.status})`);return r}async function vr(e,t,r){const a=new URLSearchParams({scenarioSlug:e,routeKey:t,scope:U(r)}),s=await fetch(`/api/mocks/save-scope-impact?${a.toString()}`);if(!s.ok)throw new Error(await de(s));return(await s.json()).impactedScenarios??[]}function jr(){const[e,t]=l.useState(null),[r,a]=l.useState(null),s=l.useRef(null),o=async()=>{try{const i=await fetch("/api/editor-dev-server");if(!i.ok)throw new Error(`Failed to fetch dev server status: ${i.statusText}`);const p=await i.json(),f=JSON.stringify(p);if(f===s.current){a(null);return}s.current=f,t(p),a(null)}catch(i){a(i instanceof Error?i.message:String(i))}};return l.useEffect(()=>{o();const i=setInterval(o,1e3);return()=>clearInterval(i)},[]),{status:e,error:r,restart:async()=>{try{const i=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})});if(!i.ok)throw new Error(`Failed to restart dev server: ${i.statusText}`);o()}catch(i){a(i instanceof Error?i.message:String(i))}}}}function _r(e){const[t,r]=l.useState([]),[a,s]=l.useState(null),[o,c]=l.useState(!1),[i,p]=l.useState(null),{events:f}=or(),{status:b}=jr(),h=(b==null?void 0:b.lastIframeLoadedAtMs)??null,d=l.useCallback(async()=>{if(!e){r([]),s(null);return}c(!0),p(null);try{const u=await xr(e,h);r(u.entries),s(u.defaultSlug)}catch(u){p(u instanceof Error?u.message:"Failed to load mocks")}finally{c(!1)}},[e,h]);l.useEffect(()=>{d()},[d]),l.useEffect(()=>{const u=f[f.length-1];!u||u.type!=="http_request"||d()},[f,d]);const m=l.useCallback(async u=>{e&&(await Fe(e,u),await d())},[e,d]),x=l.useCallback(async u=>{e&&(u.scope.kind==="scenario"?await Fe(e,{routeKey:u.routeKey,status:u.status,body:u.body,headers:u.headers}):await yr({scenarioSlug:e,routeKey:u.routeKey,scope:u.scope,status:u.status,body:u.body,headers:u.headers}),await d())},[e,d]),g=l.useCallback(async u=>{e&&(await br(e,u),await d())},[e,d]),y=l.useCallback(async u=>{e&&(await gr(e,u),await d())},[e,d]);return{entries:t,defaultSlug:a,loading:o,error:i,refresh:d,upsert:m,upsertScoped:x,remove:g,setPassthrough:y}}function wr(e){const t={};for(const[r,a]of Object.entries(e))if(typeof a=="string")try{const s=JSON.parse(a);Array.isArray(s)?t[r]=s:typeof s=="object"&&s!==null&&(t[r]=[s])}catch{}else Array.isArray(a)&&(t[r]=a);return t}function Sr(e,t){return e.length===0||t.length===0?!1:e.filter(a=>t.includes(a)).length>=Math.min(e.length,t.length)*.5}function kr(e){return e==null?"null":typeof e=="number"?Number.isInteger(e)?"int4":"float":typeof e=="boolean"?"bool":typeof e=="object"?Array.isArray(e)?"array":"json":"text"}function Cr(e,t){return e.length>0?Object.keys(e[0]):t?t.map(r=>r.name):[]}function Nr(e,t,r){const a=new Map((r||[]).map(o=>[o.name,o.type])),s={};for(const o of e)s[o]=a.get(o)||(t.length>0?kr(t[0][o]):"text");return s}function Er(e,t){var r;return((r=t==null?void 0:t.find(a=>a.isId))==null?void 0:r.name)||e.find(a=>a==="id")||null}function Tr(e,t){const{_metadata:r,...a}=t,s=a.localStorage&&typeof a.localStorage=="object"&&!Array.isArray(a.localStorage)?wr(a.localStorage):{},o={};if(a.seed&&typeof a.seed=="object"&&!Array.isArray(a.seed))for(const[d,m]of Object.entries(a.seed))Array.isArray(m)&&(o[d]=m);const c={},i=[],p=new Set,f=new Set,b=new Set;for(const d of e){const m=d.name.charAt(0).toLowerCase()+d.name.slice(1),x=d.fields.map(u=>u.name);let g=null,y=[];for(const u of[d.name,m,`${m}s`])if(u in a&&Array.isArray(a[u])){g=u,y=a[u],f.add(u);break}if(!g){for(const u of[d.name,m,`${m}s`])if(u in o){g=u,y=o[u],b.add(u),u in s&&p.add(u);break}}if(!g){for(const u of[d.name,m,`${m}s`])if(u in s){g=m,y=s[u],p.add(u);break}}if(!g){for(const[u,v]of Object.entries(s))if(!p.has(u)&&v.length>0&&Sr(x,Object.keys(v[0]))){g=m,y=v,p.add(u);break}}g||(g=m),c[g]=y,i.push({label:d.name,dataKey:g,category:d.category,description:d.description,schemaFields:d.fields.map(u=>({name:u.name,type:u.type,isId:u.isId??!1}))})}const h=new Set(["name","id","url","dimensions","componentName","scenarioType","pageFilePath","routeName","description","props","env"]);for(const[d,m]of Object.entries(a))d==="_metadata"||d==="localStorage"||d==="seed"||d==="type"||d==="mocks"||h.has(d)||f.has(d)||Or(m)&&(c[d]=m,i.push({label:d,dataKey:d}));for(const[d,m]of Object.entries(o))b.has(d)||(c[d]=m,i.push({label:d,dataKey:d}));for(const[d,m]of Object.entries(s))p.has(d)||(c[d]=m,i.push({label:d,dataKey:d}));return{data:c,tabs:i}}function Ke(e){return e==="null"?null:e==="true"?!0:e==="false"?!1:e===""?"":isNaN(Number(e))?e:Number(e)}function Or(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="object"&&e[0]!==null}function Mr(e){if(typeof e!="object"||e===null||!("props"in e))return null;const t=e.props;return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Ar(e){if(typeof e!="object"||e===null||!("browserState"in e))return null;const t=e.browserState;return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Pr(e,t){const r=new Set;for(const a of t){const s=e[a.dataKey];Array.isArray(s)&&s.length>0&&r.add(a.dataKey)}return r}function Rr(e){if(typeof e=="object"&&e!==null&&"shares"in e){const t=e.shares;if(Array.isArray(t))return t.filter(r=>typeof r=="string")}return[]}function Dr(e){const[t,r]=l.useState({data:null,tableTabs:[],scenarioOwnedDataKeys:new Set,shares:[],props:null,browserState:null,loading:!0,error:null});return l.useEffect(()=>{r(a=>({...a,loading:!0,error:null})),Promise.all([fetch("/api/data-structure").then(a=>a.json()).catch(()=>[]),fetch(`/api/scenarios/${encodeURIComponent(e)}`).then(a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()})]).then(([a,s])=>{const o=Tr(Array.isArray(a)?a:[],s);r({data:o.data,tableTabs:o.tabs,scenarioOwnedDataKeys:Pr(o.data,o.tabs),shares:Rr(s),props:Mr(s),browserState:Ar(s),loading:!1,error:null})}).catch(a=>r({data:null,tableTabs:[],scenarioOwnedDataKeys:new Set,shares:[],props:null,browserState:null,loading:!1,error:a instanceof Error?a.message:"Failed to load"}))},[e]),t}function Ae(e,t=""){return`/api/scenarios/${encodeURIComponent(e)}/draft${t}`}async function Ir(e){const t=await fetch(Ae(e,"/status"));if(!t.ok)return{isDirty:!1,diffSummary:null};const r=await t.json();return{isDirty:!!r.isDirty,diffSummary:r.diffSummary??null}}async function Lr(e){const t=await fetch(Ae(e,"/commit"),{method:"POST"});if(!t.ok)throw new Error(`Save failed (${t.status})`)}async function $r(e){const t=await fetch(Ae(e),{method:"DELETE"});if(!t.ok)throw new Error(`Cancel failed (${t.status})`)}function Br({slug:e,onPreviewReload:t}){const[r,a]=l.useState(!1),[s,o]=l.useState(null),[c,i]=l.useState(!1),[p,f]=l.useState(!1),[b,h]=l.useState(null),d=l.useRef(null),m=l.useCallback(async()=>{if(!e){a(!1),o(null);return}try{const v=await Ir(e);a(v.isDirty),o(v.diffSummary)}catch{}},[e]);l.useEffect(()=>{m()},[m]),l.useEffect(()=>{if(!r)return;const v=C=>{C.preventDefault(),C.returnValue=""};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[r]);const x=l.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{m()},100)},[m]),g=l.useCallback(async()=>{if(e){i(!0),h(null);try{await Lr(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Save failed")}finally{i(!1)}}},[e,t]),y=l.useCallback(async()=>{if(e){f(!0),h(null);try{await $r(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Cancel failed")}finally{f(!1)}}},[e,t]),u=l.useCallback(v=>r?window.confirm(v):!0,[r]);return{isDirty:r,saving:c,cancelling:p,error:b,diffSummary:s,save:g,cancel:y,markDirty:x,confirmIfDirty:u}}const Fr={scenario:"Scenario",shared:"Shared",default:"Defaults","catalog-only":"Observed only",passthrough:"Passthrough"},Kr={scenario:null,shared:null,default:null,"catalog-only":"Observed during live traffic but not mocked yet. Promote it to a scenario mock to capture and edit the response.",passthrough:null};function Ze(e){return Fr[e]??e}function zr(e){return Kr[e]??null}const Hr={scenario:"bg-emerald-500/15 text-emerald-300 border-emerald-500/40",shared:"bg-violet-500/15 text-violet-300 border-violet-500/40",default:"bg-[#D7FF63]/15 text-[#D7FF63] border-[#D7FF63]/40","catalog-only":"bg-slate-500/15 text-slate-300 border-slate-500/40",passthrough:"bg-zinc-500/15 text-zinc-300 border-zinc-500/40"};function Pe({source:e}){const t=zr(e);return n.jsx("span",{className:`px-1.5 py-0.5 rounded border ${Hr[e]}`,title:t??`source: ${e}`,children:Ze(e)})}const Ea=Object.freeze(Object.defineProperty({__proto__:null,MockSourceBadge:Pe},Symbol.toStringTag,{value:"Module"}));function et({label:e,scenarioCount:t,inheritedCount:r,expanded:a,onToggle:s}){const o=r===0;return n.jsxs("h3",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[var(--text-dim)]",children:[n.jsx("div",{className:"mb-0.5",children:e}),n.jsxs("div",{className:"flex items-center gap-1 normal-case tracking-normal font-normal",children:[n.jsxs("span",{children:[t," scenario-specific"]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsxs("button",{type:"button",onClick:s,disabled:o,"aria-expanded":a,className:`inline-flex items-center gap-0.5 ${o?"cursor-default text-[var(--text-dim)]":"cursor-pointer hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 text-[9px]",children:o?"":a?"▾":"▸"}),n.jsxs("span",{children:[r," inherited from default"]})]})]})]})}const Ta=Object.freeze(Object.defineProperty({__proto__:null,SidebarGroupOverrideHeader:et},Symbol.toStringTag,{value:"Module"}));function tt({children:e}){return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mx-3 my-1 border-t border-[var(--border-subtle)]"}),n.jsx("div",{className:"px-3 pb-1 text-[9px] uppercase tracking-wider text-[var(--text-dim)]",children:"Inherited from default"}),e]})}const Oa=Object.freeze(Object.defineProperty({__proto__:null,SidebarInheritedSection:tt},Symbol.toStringTag,{value:"Module"}));function rt({slug:e}){return n.jsx("span",{className:"px-1 py-0.5 rounded border text-[9px] font-mono bg-violet-500/10 text-violet-300 border-violet-500/30",title:`from shared-data set: ${e}`,children:e})}const Ma=Object.freeze(Object.defineProperty({__proto__:null,MockSharedSlugBadge:rt},Symbol.toStringTag,{value:"Module"})),Vr={GET:"text-emerald-400",POST:"text-[#D7FF63]",PUT:"text-amber-400",PATCH:"text-purple-400",DELETE:"text-red-400"};function nt({entry:e,routeKey:t,active:r,onSelect:a}){const s=Vr[e.method]??"text-[var(--text-muted)]";return n.jsxs("button",{onClick:a,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${r?"bg-[var(--accent-blue)]/10 border-[var(--accent-blue)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,title:t,children:[n.jsx("span",{className:`font-mono text-[9px] font-semibold ${s}`,children:e.method}),n.jsx("span",{className:"truncate flex-1 font-mono",children:e.pathPattern}),e.source==="shared"&&e.sharedSlug&&n.jsx(rt,{slug:e.sharedSlug})]})}const Aa=Object.freeze(Object.defineProperty({__proto__:null,SidebarMockEntryRow:nt},Symbol.toStringTag,{value:"Module"})),Yr=["scenario","shared","default","catalog-only","passthrough"];function X(e){return`${e.method} ${e.pathPattern}`}function at({seedTabs:e,mockEntries:t,selection:r,onSelect:a,overrides:s}){const o=new Map;for(const c of t){const i=o.get(c.source)??[];i.push(c),o.set(c.source,i)}return n.jsxs("nav",{className:"w-56 shrink-0 border-r border-[var(--border-subtle)] bg-[var(--bg-deep)] overflow-y-auto",children:[n.jsxs(oe,{label:"Browser Environment",count:4,emptyHint:"",children:[n.jsx(Z,{label:"Cookies",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="cookies",onSelect:()=>a({kind:"browser",tab:"cookies"})}),n.jsx(Z,{label:"Local Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="localStorage",onSelect:()=>a({kind:"browser",tab:"localStorage"})}),n.jsx(Z,{label:"Session Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="sessionStorage",onSelect:()=>a({kind:"browser",tab:"sessionStorage"})}),n.jsx(Z,{label:"Request Headers",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="headers",onSelect:()=>a({kind:"browser",tab:"headers"})})]}),n.jsx(oe,{label:"Seed & Local",count:e.length,emptyHint:"No seed or localStorage data",override:s?{scenarioCount:s.scenarioSeedCount,inheritedCount:s.inheritedSeedCount,renderInherited:()=>ze({tabs:s.inheritedSeedTabs,selection:r,onSelect:a})}:void 0,children:ze({tabs:e,selection:r,onSelect:a})}),n.jsx(oe,{label:"Mock APIs",count:t.length,emptyHint:"No HTTP mocks registered",override:s?{scenarioCount:s.scenarioMockCount,inheritedCount:s.inheritedMockCount,renderInherited:()=>He({entries:s.inheritedMockEntries,selection:r,onSelect:a})}:void 0,children:He({entries:t,grouped:o,selection:r,onSelect:a})})]})}function ze({tabs:e,selection:t,onSelect:r}){return e.map(a=>{const s=(t==null?void 0:t.kind)==="seed"&&t.dataKey===a.dataKey;return n.jsxs("button",{onClick:()=>r({kind:"seed",dataKey:a.dataKey}),className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${s?"bg-[var(--accent-active)]/10 border-[var(--accent-active)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{className:"truncate flex-1",children:a.label}),a.category&&n.jsx("span",{className:"text-[9px] uppercase tracking-wide text-[var(--text-dim)]",children:a.category==="mock-api"?"API":a.category})]},a.dataKey)})}function Z({label:e,active:t,onSelect:r}){return n.jsxs("button",{onClick:r,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${t?"bg-[var(--accent-active)]/10 border-[var(--accent-active)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{className:"truncate flex-1",children:e}),n.jsx("span",{className:"text-[9px] uppercase tracking-wide text-[var(--text-dim)]",children:"ENV"})]})}function He({entries:e,grouped:t,selection:r,onSelect:a}){const s=t??Wr(e);return Yr.flatMap(o=>{const c=s.get(o)??[];return c.length===0?[]:[n.jsxs("div",{className:"px-3 pt-2 pb-1 text-[9px] uppercase tracking-wider text-[var(--text-dim)] font-semibold flex items-center gap-1.5",children:[Ze(o),n.jsx(Pe,{source:o})]},`hdr-${o}`),...c.map(i=>{const p=X(i),f=(r==null?void 0:r.kind)==="mock"&&r.routeKey===p;return n.jsx(nt,{entry:i,routeKey:p,active:f,onSelect:()=>a({kind:"mock",routeKey:p})},p)})]})}function Wr(e){const t=new Map;for(const r of e){const a=t.get(r.source)??[];a.push(r),t.set(r.source,a)}return t}function oe({label:e,count:t,emptyHint:r,children:a,override:s}){const[o,c]=l.useState(!1);if(s){const{scenarioCount:i,inheritedCount:p,renderInherited:f}=s,b=i+(o?p:0);return n.jsxs("section",{className:"py-2",children:[n.jsx(et,{label:e,scenarioCount:i,inheritedCount:p,expanded:o,onToggle:()=>c(h=>!h)}),b===0?n.jsx("p",{className:"px-3 py-1 text-[10px] italic text-[var(--text-dim)]",children:r}):n.jsxs("div",{children:[a,o&&p>0&&n.jsx(tt,{children:f()})]})]})}return n.jsxs("section",{className:"py-2",children:[n.jsxs("h3",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[var(--text-dim)] flex items-center justify-between",children:[n.jsx("span",{children:e}),n.jsx("span",{children:t})]}),t===0?n.jsx("p",{className:"px-3 py-1 text-[10px] italic text-[var(--text-dim)]",children:r}):n.jsx("div",{children:a})]})}const Pa=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateButton:Z,ScenarioDataPanelSidebar:at,SidebarGroup:oe,routeKeyFor:X},Symbol.toStringTag,{value:"Module"}));function Ur({seedTabs:e,mockEntries:t,initialSection:r,selection:a,setSelection:s}){l.useEffect(()=>{if(a)return;const o=r==="mocks",c=r==="seed";if(o&&t.length>0){s({kind:"mock",routeKey:X(t[0])});return}if(c&&e.length>0){s({kind:"seed",dataKey:e[0].dataKey});return}e.length>0?s({kind:"seed",dataKey:e[0].dataKey}):t.length>0&&s({kind:"mock",routeKey:X(t[0])})},[r,t,e,a,s])}const Ee={state:"unknown",provider:Me,credsPresent:!0,cliInstalled:!0,scannedDirs:[],reason:null,expiresAt:null,probeInFlight:!1,probeAttempts:0,backendFieldAbsent:!1};function Xr(e){if(e==null)return{...Ee,backendFieldAbsent:!0};if(typeof e!="object")return Ee;const t=e,r=t.state==="authenticated"||t.state==="needs-login"||t.state==="unknown"?t.state:"unknown",a=t.provider==="claude"||t.provider==="codex"||t.provider==="gemini"||t.provider==="opencode"?t.provider:Me,s=typeof t.credsPresent=="boolean"?t.credsPresent:!0,o=typeof t.cliInstalled=="boolean"?t.cliInstalled:!0,c=Array.isArray(t.scannedDirs)?t.scannedDirs.filter(h=>typeof h=="string"):[],i=t.reason==="token-expired"||t.reason==="api-401"||t.reason==="no-credentials"||t.reason==="probe-timeout"||t.reason==="config-corrupt"||t.reason==="cli-not-found"?t.reason:null,p=typeof t.tokenExpiresAt=="string"?t.tokenExpiresAt:typeof t.expiresAt=="string"?t.expiresAt:null,f=typeof t.probeInFlight=="boolean"?t.probeInFlight:!1,b=typeof t.probeAttempts=="number"&&Number.isFinite(t.probeAttempts)&&t.probeAttempts>=0?t.probeAttempts:0;return{state:r,provider:a,credsPresent:s,cliInstalled:o,scannedDirs:c,reason:i,expiresAt:p,probeInFlight:f,probeAttempts:b,backendFieldAbsent:!1}}const Jr=1e3;function qr(){const[e,t]=l.useState(Ee),r=l.useRef(e.state);r.current=e.state;const a=l.useCallback(async()=>{try{const s=await fetch("/api/config");if(!s.ok)return;const o=await s.json();t(Xr(o.providerAuth))}catch{}},[]);return l.useEffect(()=>{a()},[a]),l.useEffect(()=>{if(e.state!=="unknown")return;const s=window.setInterval(()=>{r.current==="unknown"&&a()},Jr);return()=>window.clearInterval(s)},[e.state,a]),l.useEffect(()=>{const s=()=>{t(o=>({...o,state:"needs-login"})),a()};return window.addEventListener("agent-auth-required",s),()=>window.removeEventListener("agent-auth-required",s)},[a]),l.useEffect(()=>{const s=()=>{t(o=>({...o,state:"authenticated"})),a()};return window.addEventListener("agent-auth-resolved",s),()=>window.removeEventListener("agent-auth-resolved",s)},[a]),{state:e.state,provider:e.provider,credsPresent:e.credsPresent,cliInstalled:e.cliInstalled,scannedDirs:e.scannedDirs,reason:e.reason,expiresAt:e.expiresAt,probeInFlight:e.probeInFlight,probeAttempts:e.probeAttempts,backendFieldAbsent:e.backendFieldAbsent,refresh:a}}var Gr=ir(),Qr=cr();function Zr(e){const t=window.location.protocol==="https:"?"wss:":"ws:",r=new URL(`${t}//${window.location.host}/ws/terminal`);return e!=null&&e.provider&&r.searchParams.set("provider",e.provider),e!=null&&e.mode&&r.searchParams.set("mode",e.mode),e!=null&&e.sessionId&&r.searchParams.set("sessionId",e.sessionId),e!=null&&e.chatKey&&r.searchParams.set("chatKey",e.chatKey),e!=null&&e.launch&&r.searchParams.set("launch","1"),e!=null&&e.cols&&e.cols>0&&r.searchParams.set("cols",String(e.cols)),e!=null&&e.rows&&e.rows>0&&r.searchParams.set("rows",String(e.rows)),r.toString()}const en=20,tn=1;function rn(e,t){const r=t===tn?e:e/en;return Math.trunc(r)||Math.sign(r)}async function nn(e){try{if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(e),!0}catch{}return an(e)}function an(e){var s;if(typeof document>"u"||!document.body)return!1;const t=document.activeElement,r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="0",r.style.left="-9999px",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);let a=!1;try{r.focus(),r.select(),a=document.execCommand("copy")}catch{a=!1}finally{r.remove(),(s=t==null?void 0:t.focus)==null||s.call(t)}return a}function sn(){if(typeof navigator>"u")return!1;const e=navigator.platform??"";return e?/Mac|iPhone|iPad|iPod/i.test(e):/Mac|iPhone|iPad|iPod/i.test(navigator.userAgent??"")}function on(e,t,r={}){const a=r.isMac??sn(),s=r.onError,o=r.onCopy;let c=null;async function i(x){if(!x)return!1;let g=!1;try{g=await nn(x)}catch(y){return s==null||s(Ve("copy",y)),!1}if(g){try{e.clearSelection()}catch{}o==null||o()}else s==null||s(ln("copy"));return g}async function p(){return e.hasSelection()?i(e.getSelection()):!1}async function f(){try{const x=await navigator.clipboard.readText();x&&e.paste(x)}catch(x){s==null||s(Ve("paste",x))}}function b(x){return x.type!=="keydown"?!0:a?(x.metaKey&&!x.ctrlKey&&!x.altKey&&x.key.toLowerCase()==="c"||x.ctrlKey&&!x.metaKey&&!x.altKey&&!x.shiftKey&&x.key.toLowerCase()==="c")&&e.hasSelection()?(p(),!1):!0:(x.ctrlKey&&x.shiftKey&&!x.metaKey&&!x.altKey&&x.key.toLowerCase()==="c"||x.ctrlKey&&!x.shiftKey&&!x.metaKey&&!x.altKey&&x.key.toLowerCase()==="c")&&e.hasSelection()?(p(),!1):!0}e.attachCustomKeyEventHandler(b);function h(){if(!c)return;const{root:x,onDocumentClick:g,onKeyDown:y}=c;document.removeEventListener("mousedown",g,!0),document.removeEventListener("keydown",y,!0),x.remove(),c=null}function d(x,g,y){h();const u=document.createElement("div");u.setAttribute("data-terminal-clipboard-menu","true"),u.style.position="fixed",u.style.left=`${x}px`,u.style.top=`${g}px`,u.style.zIndex="1000",u.style.minWidth="180px",u.style.padding="4px 0",u.style.background="var(--bg-card)",u.style.border="1px solid var(--border-subtle)",u.style.borderRadius="6px",u.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.35)",u.style.fontSize="12px",u.style.color="var(--text-primary)",u.style.userSelect="none";const v=a?"⌘C":"Ctrl+Shift+C",C=a?"⌘V":"Ctrl+Shift+V",w=ve("Copy",v,!y,()=>{i(y),h()}),_=ve("Paste",C,!1,()=>{f(),h()}),P=ve("Select All","",!1,()=>{try{e.selectAll()}catch{}const j=e.hasSelection()?e.getSelection():"";i(j),h()});u.appendChild(w),u.appendChild(_),u.appendChild(P),document.body.appendChild(u),cn(u,x,g);const B=j=>{u.contains(j.target)||h()},T=j=>{j.key==="Escape"&&(j.preventDefault(),h())};document.addEventListener("mousedown",B,!0),document.addEventListener("keydown",T,!0),c={root:u,onDocumentClick:B,onKeyDown:T}}function m(x){x.preventDefault();const g=e.hasSelection()?e.getSelection():"";d(x.clientX,x.clientY,g)}return t.addEventListener("contextmenu",m),()=>{t.removeEventListener("contextmenu",m),h(),e.attachCustomKeyEventHandler(()=>!0)}}function ve(e,t,r,a){const s=document.createElement("button");s.type="button",s.disabled=r,s.style.display="flex",s.style.justifyContent="space-between",s.style.alignItems="center",s.style.gap="16px",s.style.width="100%",s.style.padding="6px 12px",s.style.border="none",s.style.background="transparent",s.style.textAlign="left",s.style.fontSize="12px",s.style.cursor=r?"default":"pointer",s.style.color=r?"var(--text-dim)":"var(--text-primary)";const o=document.createElement("span");if(o.textContent=e,s.appendChild(o),t){const c=document.createElement("span");c.textContent=t,c.style.color="var(--text-dim)",c.style.fontSize="11px",s.appendChild(c)}return r||(s.addEventListener("mouseenter",()=>{s.style.background="var(--border-subtle)"}),s.addEventListener("mouseleave",()=>{s.style.background="transparent"}),s.addEventListener("click",()=>a())),s}function cn(e,t,r){const a=typeof window<"u"?window.innerWidth:0,s=typeof window<"u"?window.innerHeight:0;if(!a||!s)return;const o=e.getBoundingClientRect(),c=4;let i=t,p=r;o.width&&t+o.width+c>a&&(i=Math.max(c,a-o.width-c)),o.height&&r+o.height+c>s&&(p=Math.max(c,s-o.height-c)),e.style.left=`${i}px`,e.style.top=`${p}px`}function Ve(e,t){const r=t instanceof Error?t.message:String(t);return`Clipboard ${e} failed: ${r}`}function ln(e){return`Clipboard ${e} blocked by the browser.`}function dn(e,t,r,a,s,o){const c=e.leftBorderCol+1;if(t===a)return s-r;if(a<t){let f=r-c;f+=1;for(let h=a+1;h<t;h++){const d=o(h);if(d===null)return null;f+=Math.max(1,d-c+1)}const b=o(a);return b===null?null:(f+=Math.max(0,b-s),-f)}const i=o(t);if(i===null)return null;let p=Math.max(0,i-r)+1;for(let f=t+1;f<a;f++){const b=o(f);if(b===null)return null;p+=Math.max(1,b-c+1)}return p+=s-c,p}const se=new Set(["│","┃","║","|"]);function un(e,t,r,a){const s=e.baseY,o=(m,x)=>{const g=e.getLine(s+m);if(!g)return null;const y=g.getCell(x);return y?y.getChars():null},c=m=>{let x=-1;for(let y=0;y<r;y++){const u=o(m,y);if(u!==null&&se.has(u)){x=y;break}}if(x===-1)return null;let g=-1;for(let y=r-1;y>x;y--){const u=o(m,y);if(u!==null&&se.has(u)){g=y;break}}return g===-1?null:{leftBorderCol:x,rightBorderCol:g}};let i=t,p=c(t);if(!p){const m=c(t-1);if(m)i=t-1,p=m;else{const x=c(t+1);x&&(i=t+1,p=x)}}if(!p)return null;const{leftBorderCol:f,rightBorderCol:b}=p;let h=i;for(let m=i-1;m>=0;m--){const x=o(m,f);if(x===null)break;if(!(x===""||x===" ")){if(!se.has(x))break;h=m}}let d=i;for(let m=i+1;m<a;m++){const x=o(m,f);if(x===null)break;if(!(x===""||x===" ")){if(!se.has(x))break;d=m}}return{topRow:h,bottomRow:d,leftBorderCol:f,rightBorderCol:b}}function fn(e,t,r,a){const s=e.getLine(e.baseY+t);if(!s)return null;for(let o=a;o>=r;o--){const c=s.getCell(o);if(!c)continue;const i=c.getChars();if(i!==""&&i!==" ")return o}return r-1}const pn=200;function hn(e){const{click:t,terminal:r,cellSurface:a,debug:s}=e,o=r.buffer.active,c=w=>{s==null||s({cursorY:o.cursorY,cursorX:o.cursorX,originalTargetCol:w.originalTargetCol??w.targetCol,snapped:w.snapped??!1,...w})};if(o.type==="alternate")return c({targetRow:-1,targetCol:-1,box:null,rejected:"alt-screen",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(o.viewportY!==o.baseY)return c({targetRow:-1,targetCol:-1,box:null,rejected:"scrollback",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const i=a.getBoundingClientRect();if(i.width===0||i.height===0)return c({targetRow:-1,targetCol:-1,box:null,rejected:"outside-grid",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const p=t.clientX-i.left,f=t.clientY-i.top;if(p<0||f<0||p>=i.width||f>=i.height)return c({targetRow:-1,targetCol:-1,box:null,rejected:"outside-grid",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const b=i.width/r.cols,h=i.height/r.rows,d=Math.floor(p/b),m=Math.floor(f/h),x=r.modes.applicationCursorKeysMode,g=x?"\x1BOC":"\x1B[C",y=x?"\x1BOD":"\x1B[D",u=un(o,o.cursorY,r.cols,r.rows);if(u){if(m<u.topRow||m>u.bottomRow)return c({targetRow:m,targetCol:d,box:u,rejected:"out-of-box",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(d<=u.leftBorderCol||d>=u.rightBorderCol)return c({targetRow:m,targetCol:d,box:u,rejected:"border",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const w=u.leftBorderCol+1,_=u.rightBorderCol-1,P=A=>fn(o,A,w,_),B=o.cursorY<u.topRow||o.cursorY>u.bottomRow,T=B?u.bottomRow:o.cursorY,j=B?_:o.cursorX,$=m!==T;let S=null;if($&&(S=P(m),S===null))return c({targetRow:m,targetCol:d,originalTargetCol:d,snapped:!1,box:u,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;let E=d,M=!1;if($&&S!==null){const A=Math.max(w,S);d>A&&(E=A,M=!0)}if(m===T&&E===j)return c({targetRow:m,targetCol:E,originalTargetCol:d,snapped:M,box:u,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const I=dn(u,T,j,m,E,P);if(I===null)return c({targetRow:m,targetCol:E,originalTargetCol:d,snapped:M,box:u,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(I===0)return c({targetRow:m,targetCol:E,originalTargetCol:d,snapped:M,box:u,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(Math.abs(I)>pn)return c({targetRow:m,targetCol:E,originalTargetCol:d,snapped:M,box:u,rejected:"emit-cap",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const L=I<0?y.repeat(-I):g.repeat(I);return c({targetRow:m,targetCol:E,originalTargetCol:d,snapped:M,box:u,rejected:null,emittedDirection:I<0?"left":"right",emittedByteCount:L.length,predictedCursorY:m,predictedCursorX:E}),L}if(m!==o.cursorY)return c({targetRow:m,targetCol:d,box:null,rejected:"out-of-box",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const v=d-o.cursorX;if(v===0)return c({targetRow:m,targetCol:d,box:null,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const C=v<0?y.repeat(-v):g.repeat(v);return c({targetRow:m,targetCol:d,box:null,rejected:null,emittedDirection:v<0?"left":"right",emittedByteCount:C.length,predictedCursorY:m,predictedCursorX:d}),C}const Ye=1;function mn(e,t){const{sendInput:r,pixelThreshold:a=3,timeThresholdMs:s=300,now:o=()=>Date.now(),onVerificationDisable:c}=t,i=e.element;if(!i)return()=>{};const p=i.querySelector(".xterm-screen")??i;let f=null,b=!1,h=null,d=null;const m=typeof e.onRender=="function"?e.onRender.bind(e):null;m&&(d=m(()=>{const y=h;if(!y)return;h=null;const u=e.buffer.active,v=Math.abs(u.cursorY-y.y),C=Math.abs(u.cursorX-y.x);if(v>Ye||C>Ye){b=!0;const w={predicted:y,actual:{y:u.cursorY,x:u.cursorX}};c?c(w):console.warn("[click-cursor] disabled — cursor diverged from prediction",w)}}));function x(y){if(y.button!==0||y.altKey||y.shiftKey||y.metaKey||y.ctrlKey){f=null;return}f={clientX:y.clientX,clientY:y.clientY,at:o()}}function g(y){var T;const u=f;if(f=null,!u)return;const v=y.clientX-u.clientX,C=y.clientY-u.clientY;if(Math.hypot(v,C)>a||o()-u.at>s)return;const w=typeof window<"u"&&((T=window.localStorage)==null?void 0:T.getItem("codeyam.terminalClickDebug"))==="1";if(w)try{const j=e.buffer.active,$=j.cursorY,S={};for(let E=-2;E<=2;E++){const M=$+E,I=j.getLine(j.baseY+M);if(!I)continue;const L=[];for(let A=0;A<e.cols;A++){const K=I.getCell(A);L.push(K?K.getChars():"")}S[`row${M}`]=L.join("|")}console.log("[click-cursor] buffer dump",{cursorY:$,cursorX:j.cursorX,viewportY:j.viewportY,baseY:j.baseY,rows:S})}catch{}let _=null;const P=j=>{_=j,w&&console.log("[click-cursor] result",j)},B=hn({click:{clientX:y.clientX,clientY:y.clientY},terminal:e,cellSurface:p,debug:P});if(B){if(_){const j=_,$=j.box!==null&&j.targetRow!==j.cursorY;if($&&b){w&&console.log("[click-cursor] suppressed by verification-disabled");return}$&&j.predictedCursorY!==null&&j.predictedCursorX!==null&&(h={y:j.predictedCursorY,x:j.predictedCursorX})}r(B)}}return p.addEventListener("mousedown",x),p.addEventListener("mouseup",g),()=>{p.removeEventListener("mousedown",x),p.removeEventListener("mouseup",g),d==null||d.dispose()}}function xn(){window.focus()}function bn(e,t){xn(),e==null||e.focus({preventScroll:!0}),t()}async function st(e=1500){try{return(await fetch("/api/health",{signal:AbortSignal.timeout(e)})).ok}catch{return!1}}function gn(e,t){let r=!1,a=null;async function s(){if(!r){if(await st(1500)){r||t();return}r||(a=setTimeout(s,e))}}return a=setTimeout(s,e),()=>{r=!0,a&&(clearTimeout(a),a=null)}}const yn="The editor server closed the terminal connection with no further detail.";function vn(e){if(e&&typeof e=="object"&&"message"in e){const t=e.message;if(typeof t=="string"&&t.length>0)return t}return yn}let ot=!1;function je(e){ot=e}function Ra(){return ot}function it(){return n.jsx("div",{"data-testid":"terminal-connecting-hint",className:"absolute top-2 right-3 text-xs font-mono text-[#aaa] pointer-events-none z-10 select-none",children:"Connecting…"})}const Da=Object.freeze(Object.defineProperty({__proto__:null,TerminalConnectingHint:it},Symbol.toStringTag,{value:"Module"}));function ct({attempt:e,maxAttempts:t,pulseKey:r}){return n.jsx("div",{"data-testid":"terminal-reconnecting-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/40",children:n.jsxs("div",{"data-testid":"terminal-reconnecting-banner-label",className:"px-4 py-2 rounded font-mono text-sm shadow terminal-disconnect-pulse bg-amber-500/90 text-black",children:["Reconnecting… (attempt ",e," of ",t,")"]},r)})}const Ia=Object.freeze(Object.defineProperty({__proto__:null,TerminalReconnectingBanner:ct},Symbol.toStringTag,{value:"Module"}));function lt({onRefresh:e}){return n.jsx("div",{"data-testid":"terminal-failed-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Connection lost. The page must be refreshed to continue."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-failed-banner-refresh",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Refresh page"})]})})}const La=Object.freeze(Object.defineProperty({__proto__:null,TerminalFailedBanner:lt},Symbol.toStringTag,{value:"Module"}));function dt({onReload:e}){return n.jsx("div",{"data-testid":"terminal-server-stopped-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Editor stopped — restart it from your terminal to continue."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-server-stopped-banner-reload",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Reload page"})]})})}const $a=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerStoppedBanner:dt},Symbol.toStringTag,{value:"Module"}));function ut({message:e,onRefresh:t}){return n.jsx("div",{"data-testid":"terminal-server-error-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("pre",{"data-testid":"terminal-server-error-banner-message",className:"whitespace-pre-wrap break-words flex-1 m-0 font-mono text-xs leading-snug",children:e}),n.jsx("button",{type:"button",onClick:t,"data-testid":"terminal-server-error-banner-refresh",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 self-start",children:"Refresh"})]})})}const Ba=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerErrorBanner:ut},Symbol.toStringTag,{value:"Module"}));function ft({onRefresh:e}){return n.jsx("div",{"data-testid":"terminal-edge-unreachable-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("span",{className:"flex-1 leading-snug",children:"The editor is reachable and this session is valid, but the live terminal connection (WebSocket) still can't be established — the WebSocket path itself isn't carrying the connection, which usually means the VM's tunnel/ingress. Retry to reconnect; if it persists, the VM's ingress needs attention."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-edge-unreachable-banner-retry",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 self-start",children:"Retry"})]})})}const Fa=Object.freeze(Object.defineProperty({__proto__:null,TerminalEdgeUnreachableBanner:ft},Symbol.toStringTag,{value:"Module"}));function pt({canRetry:e=!1,onRefresh:t}){return n.jsx("div",{"data-testid":"terminal-session-stale-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("span",{className:"flex-1 leading-snug",children:e?"The editor restarted and this tab's session couldn't be re-established automatically. Retry to pick up a fresh session; if it keeps failing, reload the page.":"The editor restarted, so this tab's session expired. Re-establishing it and reconnecting the terminal — no action needed."}),e&&n.jsx("button",{type:"button",onClick:t,"data-testid":"terminal-session-stale-banner-retry",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 self-start",children:"Retry"})]})})}const Ka=Object.freeze(Object.defineProperty({__proto__:null,TerminalSessionStaleBanner:pt},Symbol.toStringTag,{value:"Module"}));function ht({status:e,pulseKey:t,onRefresh:r}){return e.kind==="open"||e.kind==="ended"?null:e.kind==="connecting"?n.jsx(it,{}):e.kind==="reconnecting"?n.jsx(ct,{attempt:e.attempt,maxAttempts:e.maxAttempts,pulseKey:t}):e.kind==="server-stopped"?n.jsx(dt,{onReload:r}):e.kind==="server-error"?n.jsx(ut,{message:e.message,onRefresh:r}):e.kind==="edge-unreachable"?n.jsx(ft,{onRefresh:r}):e.kind==="session-stale"?n.jsx(pt,{canRetry:e.canRetry,onRefresh:r}):n.jsx(lt,{onRefresh:r})}const za=Object.freeze(Object.defineProperty({__proto__:null,TerminalDisconnectOverlay:ht},Symbol.toStringTag,{value:"Module"}));function mt({status:e,onRetry:t}){return e==="retrying"?n.jsx("div",{"data-testid":"mini-agent-launch-retrying",className:"absolute inset-x-0 top-2 z-10 flex justify-center pointer-events-none",children:n.jsx("span",{className:"font-mono text-xs italic text-[var(--text-dim)] bg-black/40 px-2 py-1 rounded",children:"Launch slow — retrying…"})}):e==="failed"?n.jsx("div",{role:"alert","data-testid":"mini-agent-launch-failed-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Couldn't launch the build agent — the shell prompt didn't respond in time."}),n.jsx("button",{type:"button",onClick:t,"data-testid":"mini-agent-launch-failed-retry",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Retry"})]})}):null}const Ha=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentLaunchOverlay:mt},Symbol.toStringTag,{value:"Module"})),jn=40;function _n(e){const t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t&&t.slice(0,jn).replace(/-+$/,"")||"session"}const ie=new Map;function Re(e,t){const r=ie.get(e);if(!r){let a;try{a=t()}catch(s){return Promise.reject(s)}return a instanceof Promise?We(e,a):Promise.resolve()}return We(e,r.then(()=>t()))}function We(e,t){const r=t.catch(()=>{});return ie.set(e,r),r.then(()=>{ie.get(e)===r&&ie.delete(e)}),t}let Q=0,G=[];function Va(){if(Q+=1,Q===1&&G.length>0){const e=G;G=[];for(const t of e)t()}}function Ya(){Q>0&&(Q-=1)}function wn(){return Q>0}function Sn(e){return Q>0?Promise.resolve(!0):new Promise(t=>{let r=!1;const a=()=>{r||(r=!0,t(!0))};G.push(a),setTimeout(()=>{r||(r=!0,G=G.filter(s=>s!==a),t(!1))},e)})}const ue="build",Ue="miniagent",Xe=3e3;function kn(e){return wn()?e():Sn(Xe).then(t=>{if(t)return e();console.warn(`[terminal] dropped programmatic injection: no terminal-send-input listener attached within ${Xe}ms`)})}function De(e){window.dispatchEvent(new CustomEvent("terminal-send-input",{detail:e}))}function Wa(e){Re(ue,()=>kn(()=>De(e)))}const ce=50;function Cn(e,t=De,r=ue){return Re(r,()=>new Promise(a=>{t(e),setTimeout(()=>{t("\r"),a()},ce)}))}const _e=3e3;function Nn(e){return e==="gemini"?"gemini":e==="opencode"?"opencode":"claude"}function xt(e,t){const r=Nn(e);return r==="claude"&&t?`${r} --permission-mode auto`:r}function En(e,t){return`'${e==="powershell"?t.replaceAll("'","''"):t.replaceAll("'","'\\''")}'`}function Tn(e,t,r=!0,a="posix"){const s=En(a,t);return e==="opencode"?`opencode${r?" --auto":""} --prompt ${s}\r`:`${xt(e,r)} ${s}\r`}async function On(e,t=De,r=ue){const a=_n(e);await Cn(`/rename ${a}`,t,r)}function Mn(e,t,r,a=ue){Y("dispatch-rename",{phase:"queued",caller:t,label:e,delayMs:_e}),setTimeout(()=>{Y("dispatch-rename",{phase:"fired",caller:t,label:e,delayMs:_e}),On(e,r,a)},_e)}const Ie=".codeyam/tmp/inline-prompt.md";function An(e){return e.split(`
|
|
4
|
-
`).map(t=>t.startsWith("'@")?` ${t}`:t).join(`
|
|
5
|
-
`)}function Pn(e){return`mkdir -p .codeyam/tmp && cat > ${Ie} << 'INLINE_PROMPT_EOF'
|
|
6
|
-
${e}
|
|
7
|
-
INLINE_PROMPT_EOF\r`}function Rn(e){return`New-Item -ItemType Directory -Force -Path .codeyam/tmp | Out-Null; @'
|
|
8
|
-
${An(e)}
|
|
9
|
-
'@ | Set-Content -LiteralPath ${Ie} -Encoding utf8\r`}function Dn(e,t,r=!0,a="posix"){const s=xt(e,r),o=a==="powershell"?Rn(t):Pn(t),c=`${s} "Read the file at '${Ie}' for your instructions."\r`;return[o,c]}function In({idleMs:e,ceilingMs:t}){return new Promise(r=>{let a=null,s=null,o=!1;function c(){o||(o=!0,a!==null&&clearTimeout(a),s!==null&&clearTimeout(s),window.removeEventListener("miniagent-output",p),r())}function i(){a!==null&&clearTimeout(a),a=setTimeout(c,e)}function p(){i()}window.addEventListener("miniagent-output",p),s=setTimeout(c,t),i()})}const Ln=350,$n=4e3,Bn=8e3,Fn=500,W={armed:"mini-agent-launch-armed",fired:"mini-agent-launch-fired",confirmed:"mini-agent-launch-confirmed",relaunch:"mini-agent-relaunch",failed:"mini-agent-launch-failed",reattached:"mini-agent-launch-reattached"};function Kn(e){const{provider:t,slashCommand:r,prompt:a,chatName:s,sendInput:o,permissionModeAuto:c=!0,shellDialect:i=null}=e,[p,f]=l.useState("idle"),b=l.useRef(o),h=l.useRef(r),d=l.useRef(a),m=l.useRef(s),x=l.useRef(t),g=l.useRef(c),y=l.useRef(i);l.useEffect(()=>{b.current=o},[o]),l.useEffect(()=>{g.current=c},[c]),l.useEffect(()=>{y.current=i},[i]),l.useEffect(()=>{h.current=r},[r]),l.useEffect(()=>{d.current=a},[a]),l.useEffect(()=>{m.current=s},[s]),l.useEffect(()=>{x.current=t},[t]);const u=l.useRef(0),v=l.useRef(!1),C=l.useRef(0),w=l.useCallback((S,E)=>{const M=h.current,I=d.current;Re(Ue,()=>{const L=y.current??"posix";if(M){const z=Tn(x.current,M,g.current,L),H=we(z);return S(H),new Promise(V=>{setTimeout(()=>{E()&&S("\r"),V()},ce)})}const[A,K]=Dn(x.current,I??"",g.current,L),F=we(A),J=we(K);return S(F),new Promise(z=>{setTimeout(()=>{if(!E())return z();S("\r"),setTimeout(()=>{if(!E())return z();S(J),setTimeout(()=>{E()&&S("\r"),z()},ce)},Fn)},ce)})})},[]),_=l.useCallback(()=>{const S=++u.current,E=Date.now();C.current=E,f("armed"),Y(W.armed,{provider:x.current,slashCommand:h.current,chatName:m.current,hasPrompt:typeof d.current=="string"});function M(){return u.current===S}function I(L){M()&&(f(L===1?"firing":"retrying"),Y(L===1?W.fired:W.relaunch,{provider:x.current,slashCommand:h.current,chatName:m.current,attempt:L,elapsedMs:Date.now()-E}),w(b.current,M),v.current||(v.current=!0,Mn(m.current,"mini-agent-chat",A=>b.current(A),Ue)),setTimeout(()=>{M()&&(L===1?I(2):(f("failed"),Y(W.failed,{provider:x.current,slashCommand:h.current,reason:"banner-timeout",elapsedMs:Date.now()-E})))},Bn))}In({idleMs:Ln,ceilingMs:$n}).then(()=>{M()&&I(1)})},[w]),P=l.useCallback(()=>{v.current=!1,_()},[_]),B=l.useCallback(()=>{_()},[_]),T=l.useCallback(()=>{u.current!==0&&(u.current++,f("confirmed"),Y(W.confirmed,{elapsedMs:Date.now()-C.current}))},[]),j=l.useCallback(()=>{u.current!==0&&(u.current++,f("failed"),Y(W.failed,{reason:"startup-failed",elapsedMs:Date.now()-C.current}))},[]),$=l.useCallback(()=>{u.current++,f("confirmed"),Y(W.reattached,{provider:x.current,chatName:m.current})},[]);return l.useEffect(()=>()=>{u.current++},[]),{status:p,arm:P,retry:B,onBannerReady:T,onStartupFailed:j,onReattached:$}}function we(e){return e.endsWith("\r")?e.slice(0,-1):e}const fe=l.createContext({registerSender:()=>{},setReady:()=>{},sendToAgent:()=>!1,agentReady:!1});function zn({children:e}){const t=l.useRef(null),[r,a]=l.useState(!1),s=l.useCallback(p=>{t.current=p},[]),o=l.useCallback(p=>{a(p)},[]),c=l.useCallback(p=>{const f=t.current;return f?f(p):!1},[]),i=l.useMemo(()=>({registerSender:s,setReady:o,sendToAgent:c,agentReady:r}),[s,o,c,r]);return n.jsx(fe.Provider,{value:i,children:e})}function Hn(){const{sendToAgent:e,agentReady:t}=l.useContext(fe);return{sendToAgent:e,agentReady:t}}function Vn(e,t){const{registerSender:r,setReady:a}=l.useContext(fe);l.useEffect(()=>(r(e),()=>r(null)),[r,e]),l.useEffect(()=>(a(t),()=>a(!1)),[a,t])}function bt(){const{registerSender:e,setReady:t}=l.useContext(fe);return{registerSender:e,setReady:t}}const Ua=Object.freeze(Object.defineProperty({__proto__:null,AgentInputProvider:zn,useAgentInput:Hn,useAgentInputChannel:bt,useRegisterAgentInput:Vn},Symbol.toStringTag,{value:"Module"})),gt=l.createContext({openPicker:()=>{}});function Yn({openPicker:e,children:t}){const r=l.useMemo(()=>({openPicker:e}),[e]);return n.jsx(gt.Provider,{value:r,children:t})}function yt(){return l.useContext(gt)}const Xa=Object.freeze(Object.defineProperty({__proto__:null,FilePickerProvider:Yn,useFilePicker:yt},Symbol.toStringTag,{value:"Module"}));function vt({className:e=""}){const{openPicker:t}=yt();return n.jsxs("button",{type:"button",onClick:t,title:"Attach a file","aria-label":"Attach a file","data-testid":"attach-file-button",className:`inline-flex items-center gap-1 text-xs font-medium cursor-pointer bg-transparent border-none text-[var(--text-dim)] hover:text-[var(--text-primary)] transition ${e}`,children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),"Attach file"]})}const Ja=Object.freeze(Object.defineProperty({__proto__:null,AttachFileButton:vt},Symbol.toStringTag,{value:"Module"})),Je=15;function jt({chatName:e,prompt:t,slashCommand:r,height:a=400,onClose:s}){const o=l.useRef(null),c=l.useRef(null),i=l.useRef(null);l.useRef(t);const{config:p}=Qe(),f=(p==null?void 0:p.provider)??"claude",[b,h]=l.useState({kind:"connecting"}),[d,m]=l.useState(0),x=l.useCallback(T=>{const j=c.current;(j==null?void 0:j.readyState)===WebSocket.OPEN&&j.send(JSON.stringify({type:"input",data:T}))},[]),{registerSender:g,setReady:y}=bt(),u=l.useCallback(T=>{var j;return((j=c.current)==null?void 0:j.readyState)===WebSocket.OPEN?(c.current.send(JSON.stringify({type:"input",data:T})),!0):!1},[]),v=b.kind==="open";l.useEffect(()=>(v&&g(u),()=>g(null)),[g,u,v]),l.useEffect(()=>(y(v),()=>y(!1)),[y,v]);const C=l.useCallback(()=>{var T;((T=c.current)==null?void 0:T.readyState)===WebSocket.OPEN&&(g(u),y(!0)),bn(o.current,()=>{var j;return(j=i.current)==null?void 0:j.focus()})},[g,y,u]),{shellDialect:w}=dr(),_=Kn({provider:f,slashCommand:r,prompt:t,chatName:e,sendInput:x,permissionModeAuto:(p==null?void 0:p.claudePermissionModeAuto)??!0,shellDialect:w}),P=l.useRef(_);l.useEffect(()=>{P.current=_});const B=l.useRef(e);return l.useEffect(()=>{B.current=e}),l.useEffect(()=>{const T=o.current;if(!T)return;const j=new Gr.Terminal({theme:{background:"#1a1a1a",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},fontSize:12,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",cursorBlink:!0,scrollback:5e3,allowProposedApi:!0}),$=new Qr.FitAddon;j.loadAddon($),j.open(T);const S=on(j,T,{onError:k=>console.warn("[MiniAgentChat]",k)}),E=mn(j,{sendInput:k=>{const N=c.current;(N==null?void 0:N.readyState)===WebSocket.OPEN&&N.send(JSON.stringify({type:"input",data:k}))}});requestAnimationFrame(()=>{try{$.fit()}catch{}}),i.current=j;const M={current:"inline"},I={current:null},L={current:!1},A={current:!1};let K=0,F=null;function J(){h({kind:"connecting"});const k=Zr({mode:M.current,sessionId:I.current??void 0,chatKey:e,cols:j.cols,rows:j.rows}),N=new WebSocket(k);N.binaryType="arraybuffer",c.current=N,N.onopen=()=>{K=0,h({kind:"open"}),je(!0),window.dispatchEvent(new CustomEvent("miniagent-ws-open")),N.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))},N.onmessage=R=>{if(R.data instanceof ArrayBuffer){j.write(new Uint8Array(R.data)),window.dispatchEvent(new CustomEvent("miniagent-output"));return}try{const D=JSON.parse(R.data);if(D.type==="error"){A.current=!0,h({kind:"server-error",message:vn(D)});return}if(D.type==="session-id"){if(D.sessionId&&(I.current=D.sessionId,M.current="resume"),D.reattached===!0){L.current=!0,P.current.onReattached();return}L.current||(L.current=!0,P.current.arm());return}if(D.type==="agent-idle"||D.type==="claude-idle"){window.dispatchEvent(new CustomEvent("miniagent-agent-idle",{detail:{chatName:B.current}}));return}if(D.type==="agent-active"||D.type==="claude-active"){window.dispatchEvent(new CustomEvent("miniagent-agent-active",{detail:{chatName:B.current}}));return}if(D.type==="agent-banner-ready"){P.current.onBannerReady();return}if(D.type==="agent-auth-required"){window.dispatchEvent(new CustomEvent("agent-auth-required"));return}if(D.type==="startup-failed"){P.current.onStartupFailed();return}}catch{j.write(R.data),window.dispatchEvent(new CustomEvent("miniagent-output"))}},N.onerror=()=>{},N.onclose=async()=>{if(je(!1),A.current){h(D=>D.kind==="server-error"?D:{kind:"ended"});return}const R=await st();if(!A.current){if(!R){h({kind:"server-stopped"}),F==null||F(),F=gn(2e3,()=>{A.current||window.location.reload()});return}if(K<Je){const D=K<4?1e3*Math.pow(2,K):1e4;K++,h({kind:"reconnecting",attempt:K,maxAttempts:Je}),setTimeout(()=>{A.current||J()},D)}else h({kind:"failed"})}}}try{$.fit()}catch{}J(),j.onData(k=>{const N=c.current;(N==null?void 0:N.readyState)===WebSocket.OPEN?N.send(JSON.stringify({type:"input",data:k})):m(R=>R+1)});const z=new ResizeObserver(()=>{try{$.fit();const k=c.current;(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))}catch{}});z.observe(T);function H(k){const N=i.current;if(!N)return;const R=k.target;if(R!=null&&R.closest(".xterm-viewport")||N.buffer.active.length<=N.rows)return;const ne=rn(k.deltaY,k.deltaMode);ne!==0&&(N.scrollLines(ne),k.preventDefault(),k.stopPropagation())}T.addEventListener("wheel",H,{passive:!1});function V(){var k;(k=i.current)==null||k.focus()}window.addEventListener("terminal-focus",V);function re(k){const N=k.detail,R=c.current;typeof N=="string"&&(R==null?void 0:R.readyState)===WebSocket.OPEN&&R.send(JSON.stringify({type:"input",data:N}))}return window.addEventListener("miniagent-send-input",re),()=>{var N;A.current=!0,je(!1),F==null||F(),F=null,window.removeEventListener("terminal-focus",V),window.removeEventListener("miniagent-send-input",re),T.removeEventListener("wheel",H),z.disconnect(),S(),E();const k=c.current;(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.close(),(N=i.current)==null||N.dispose()}},[f]),n.jsxs("div",{"data-codeyam-hydrated":"MiniAgentChat",className:"mt-2 border border-[var(--border-subtle)] rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--bg-card)]",children:[n.jsx("span",{className:"text-xs font-medium text-[var(--accent-active)]",children:ee(f)}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(vt,{}),s&&n.jsx("button",{onClick:s,className:"text-[var(--text-dim)] hover:text-[var(--text-primary)] text-xs bg-transparent border-none cursor-pointer",children:"Close"})]})]}),n.jsxs("div",{ref:o,className:"mini-agent-terminal",tabIndex:-1,onPointerDown:C,onClick:C,style:{height:a,background:"#1a1a1a",padding:"6px 10px",position:"relative",overflow:"hidden",outline:"none"},children:[n.jsx(ht,{status:b,pulseKey:d,onRefresh:()=>window.location.reload()}),n.jsx(mt,{status:_.status,onRetry:_.retry})]})]})}const qa=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentChat:jt},Symbol.toStringTag,{value:"Module"}));function _t(e){return e>=500?"transient":"rejected"}function wt({provider:e,onAuthenticated:t}){const[r,a]=l.useState(""),[s,o]=l.useState(!1),[c,i]=l.useState(null),[p,f]=l.useState(!1),b=ee(e),h=l.useCallback(async()=>{if(r.trim()){o(!0),i(null),f(!1);try{const d=await fetch("/api/auth/api-key",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e,key:r.trim()})});if(!d.ok){if(_t(d.status)==="transient"){f(!0),i(`The editor was briefly unreachable (HTTP ${d.status}). Your key wasn't rejected — try again.`);return}const m=await d.json().catch(()=>({}));i(m.error??`Could not save the key (HTTP ${d.status}).`);return}a(""),t()}catch{f(!0),i("Could not reach the editor to save the key. Try again.")}finally{o(!1)}}},[r,e,t]);return n.jsxs("div",{"data-testid":"api-key-flow",className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-[#8E8E8E]",children:["Paste your ",b," API key. It is stored locally in",n.jsx("code",{className:"mx-1 text-[#D7FF63]",children:".codeyam/editor.local.json"}),"and never committed."]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"password",value:r,onChange:d=>a(d.target.value),placeholder:`${b} API key`,className:"flex-1 min-w-0 px-2 py-1.5 rounded bg-black border border-[#3A3A3A] text-white text-sm"}),n.jsx("button",{onClick:()=>void h(),disabled:s||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:s?"Saving…":"Save"})]}),c?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-[#FF8B43]",children:c}),p?n.jsx("button",{"data-testid":"api-key-flow-retry",onClick:()=>void h(),disabled:s||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md border border-[#3A3A3A] text-white font-medium cursor-pointer disabled:opacity-50",children:s?"Saving…":"Retry"}):null]}):null]})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,ApiKeyFlow:wt,classifyApiKeySaveFailure:_t},Symbol.toStringTag,{value:"Module"})),Wn=500,Un=75e3;function St({onAuthenticated:e}){const[t,r]=l.useState({state:"starting"}),[a,s]=l.useState(""),[o,c]=l.useState(!1),[i,p]=l.useState(!1),[f,b]=l.useState(!1),[h,d]=l.useState(!1),m=l.useRef(!1),x=l.useRef(e);x.current=e;const g=l.useCallback(async()=>{try{const _=await fetch("/api/auth/status");if(!_.ok)return;const P=await _.json();r(P),P.state==="authenticated"&&!m.current&&(m.current=!0,x.current())}catch{}},[]),y=l.useCallback(async()=>{m.current=!1,b(!1),r({state:"starting"});try{await fetch("/api/auth/start",{method:"POST"})}catch{r({state:"failed",error:"Could not start the login process."})}},[]);l.useEffect(()=>{y()},[y]),l.useEffect(()=>{const _=window.setInterval(()=>void g(),Wn);return()=>window.clearInterval(_)},[g]),l.useEffect(()=>{if(t.state!=="starting"){b(!1);return}const _=window.setTimeout(()=>b(!0),Un);return()=>window.clearTimeout(_)},[t.state]);const u=l.useCallback(async()=>{if(a.trim()){c(!0);try{const _=await fetch("/api/auth/code",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:a.trim()})});if(_.ok)s("");else{const P=await _.json().catch(()=>({}));r({state:"failed",error:P.error??"Code not accepted — check the value and try again."})}}catch{r({state:"failed",error:"Could not submit the code."})}finally{c(!1)}}},[a]),v=l.useCallback(async()=>{try{await fetch("/api/auth/cancel",{method:"POST"})}catch{}y()},[y]),C=l.useCallback(async()=>{d(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),e()}catch{}finally{d(!1)}},[e]),w=l.useCallback(()=>{var _;t.url&&((_=navigator.clipboard)==null||_.writeText(t.url),p(!0),window.setTimeout(()=>p(!1),1500))},[t.url]);return f&&t.state==="starting"?n.jsxs("div",{"data-testid":"claude-oauth-timeout",className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-[#FF8B43]",children:["Login link preparation timed out — the backend may be wedged. Try again, recheck if you already authenticated elsewhere, or open a terminal and run ",n.jsx("code",{className:"text-white",children:"claude /login"})," ","directly."]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{onClick:()=>void v(),"data-testid":"claude-oauth-timeout-retry",className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Retry"}),n.jsx("button",{onClick:()=>void C(),"data-testid":"claude-oauth-timeout-recheck",disabled:h,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:h?"Rechecking…":"I already logged in — recheck"})]})]}):t.state==="failed"?n.jsxs("div",{"data-testid":"claude-oauth-failed",className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-[#FF8B43]",children:t.error??"Login failed."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{onClick:()=>void v(),className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Try again"}),n.jsx("button",{onClick:()=>void C(),"data-testid":"claude-oauth-failed-recheck",disabled:h,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:h?"Rechecking…":"I already logged in — recheck"})]})]}):t.state==="authenticated"?n.jsx("p",{"data-testid":"claude-oauth-authenticated",className:"text-sm text-[#D7FF63]",children:"Connected. Opening Build…"}):t.state==="url-ready"&&t.url?n.jsxs("div",{"data-testid":"claude-oauth-url-ready",className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-[#8E8E8E]",children:"Open this URL in your browser, approve access, then paste the code back here:"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 truncate px-2 py-1.5 rounded bg-black text-[#D7FF63] text-xs",children:t.url}),n.jsx("button",{onClick:w,className:"px-2 py-1.5 text-xs rounded-md border border-[#3A3A3A] text-white cursor-pointer",children:i?"Copied":"Copy"}),n.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"px-2 py-1.5 text-xs rounded-md border border-[#3A3A3A] text-white cursor-pointer",children:"Open"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:a,onChange:_=>s(_.target.value),placeholder:"Paste the code from the browser here",className:"flex-1 min-w-0 px-2 py-1.5 rounded bg-black border border-[#3A3A3A] text-white text-sm"}),n.jsx("button",{onClick:()=>void u(),disabled:o||!a.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:o?"Submitting…":"Submit"})]})]}):n.jsx("p",{"data-testid":"claude-oauth-starting",className:"text-sm text-[#8E8E8E]",children:"Preparing the login link…"})}const Qa=Object.freeze(Object.defineProperty({__proto__:null,ClaudeOAuthFlow:St},Symbol.toStringTag,{value:"Module"}));function kt({provider:e,onAuthenticated:t,onClose:r}){const a=ee(e);return n.jsx("div",{"data-testid":"provider-auth-modal",className:"fixed inset-0 z-[100] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:n.jsxs("div",{className:"w-[32rem] max-w-[90vw] rounded-lg border border-[#3A3A3A] bg-[#1E1E1E] p-6 space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("h2",{className:"text-base font-medium text-white",children:["Connect your ",a," account"]}),n.jsx("button",{onClick:r,"aria-label":"Close",className:"text-[#8E8E8E] hover:text-white cursor-pointer",children:"✕"})]}),e==="claude"?n.jsx(St,{onAuthenticated:t}):n.jsx(wt,{provider:e,onAuthenticated:t})]})})}const Za=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthModal:kt},Symbol.toStringTag,{value:"Module"}));function Xn(e){const t=new Date(e).getTime()-Date.now(),r=Math.abs(Math.round(t/36e5));if(r<1)return t<0?"just now":"very soon";if(r<48)return t<0?`${r} h ago`:`in ${r} h`;const a=Math.round(r/24);return t<0?`${a} d ago`:`in ${a} d`}function Ct({provider:e,credsPresent:t=!0,reason:r=null,expiresAt:a=null,sessionOngoing:s=!1,onAuthenticated:o,onAuthorized:c}){const[i,p]=l.useState(!1),[f,b]=l.useState(!1),h=ee(e),d=l.useCallback(()=>{p(!1),o(),c==null||c()},[o,c]),m=l.useCallback(async()=>{b(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),o()}catch{}finally{b(!1)}},[o]),x=e==="claude"&&!t,g=a?` (token expired ${Xn(a)})`:"",y=x?`${h} credentials file is missing`:r==="token-expired"?`Your ${h} token has expired`:r==="api-401"?`${h} authentication rejected (401)`:`Connect your ${h} account`,u=s?" Your Build session stays open — you can finish logging in here or directly in the Build terminal.":"",v=x?"The editor couldn't find ~/.claude/.credentials.json on this machine — likely deleted between editor restarts (operator-side action, a Reconfigure, or a stale image). Re-seed by clicking Authenticate to run OAuth, or — on a fleet VM — copy the file from a donor VM through the dashboard.":r==="token-expired"?`Your ${h} token has expired${g} — click Authenticate to refresh it. On a fleet VM the dashboard can copy a fresh token from a donor VM.${u}`:r==="api-401"?`The ${h} server rejected your credentials (401)${g}. This usually means the token was revoked or expired. Click Authenticate to re-connect.${u}`:s?"You can finish logging in here or directly in the Build terminal — your session stays open either way. On a cloud VM the dashboard usually does this for you; locally you connect once here.":`Authentication used to happen inside the Build terminal. Now it lives here, out of your way. Connect ${h} to unlock the Build tab. On a cloud VM the dashboard usually does this for you; locally you connect once here.`;return n.jsxs("div",{"data-testid":"provider-auth-gate","data-auth-variant":x?"creds-missing":"needs-login","data-auth-card":!0,className:"m-4 rounded-lg border border-[#D7FF63]/40 bg-[#1E1E1E] p-5 space-y-3",children:[n.jsx("h2",{className:"text-base font-medium text-white",children:y}),n.jsx("p",{className:"text-sm text-[#8E8E8E]",children:v}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("button",{onClick:()=>p(!0),className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Authenticate"}),n.jsx("button",{onClick:()=>void m(),"data-testid":"provider-auth-gate-recheck",disabled:f,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:f?"Rechecking…":"Already logged in? Recheck"})]}),i?n.jsx(kt,{provider:e,onAuthenticated:d,onClose:()=>p(!1)}):null]})}const es=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthenticateCta:Ct},Symbol.toStringTag,{value:"Module"}));let Se=!1;function Nt(e){const{state:t,provider:r,credsPresent:a,reason:s,expiresAt:o,refresh:c}=qr(),[i]=l.useState(()=>Se);return l.useEffect(()=>{t==="authenticated"?Se=!0:t==="needs-login"&&(Se=!1)},[t]),t==="needs-login"?n.jsx(Ct,{provider:r,credsPresent:a,reason:s,expiresAt:o,onAuthenticated:()=>void c(),onAuthorized:()=>{}}):t==="authenticated"||i?n.jsx(jt,{...e}):n.jsxs("div",{"data-testid":"gated-agent-chat-checking",className:"mt-2 flex items-center gap-3 rounded-lg border border-[var(--border-subtle)] px-3 py-4",children:[n.jsx("span",{"aria-hidden":"true",className:"h-4 w-4 rounded-full border-2 border-[var(--text-dim)] border-t-transparent animate-spin"}),n.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:"Checking your account…"})]})}const ts=Object.freeze(Object.defineProperty({__proto__:null,GatedAgentChat:Nt},Symbol.toStringTag,{value:"Module"}));function Et(){return n.jsx("div",{className:"flex h-full items-center justify-center p-6",children:n.jsxs("div",{className:"max-w-xs text-center space-y-2",children:[n.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No scenario data yet."}),n.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Seed data and HTTP mocks will appear here as the scenario captures them, or add them with the scenario editor."})]})})}const rs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEmptyState:Et},Symbol.toStringTag,{value:"Module"}));function Tt({variant:e,onClose:t}){return e!=="slideOver"?null:n.jsx("button",{onClick:t,className:"rounded border border-[var(--border-default)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"Close"})}const ns=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelCloseButton:Tt},Symbol.toStringTag,{value:"Module"}));function Ot({variant:e,providerLabel:t,chatOpen:r,onToggleChat:a}){const s=e==="inline",o=s?"flex items-center gap-1.5 px-3 py-1.5 rounded border text-xs font-medium cursor-pointer transition-colors":"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors",c=r?"border-[var(--accent-active)] bg-[var(--accent-active)]/15 text-[var(--accent-active)]":s?"border-[var(--accent-active)] bg-[var(--accent-active)] text-black hover:bg-[var(--accent-active)]/90":"border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40";return n.jsxs("button",{type:"button",onClick:a,className:`${o} ${c}`,title:`Open a chat with ${t} seeded with this scenario's context`,children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),"Edit with ",t]})}const as=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEditChatButton:Ot},Symbol.toStringTag,{value:"Module"})),Te=new Set,Oe=new Set;let Mt={isActive:!1,previewSlug:null};function Jn(){for(const e of Te)e()}function ss(e){return Te.add(e),()=>{Te.delete(e)}}function os(e){Mt=e;for(const t of Oe)t(e)}function qn(e){return Oe.add(e),()=>{Oe.delete(e)}}function qe(){return Mt}function Gn(){const[e,t]=l.useState(()=>qe());return l.useEffect(()=>(t(qe()),qn(t)),[]),e}function At({panelSlug:e,scenarioState:t}){const r=Gn(),{isActive:a,previewSlug:s}=t??r;return s!==e?null:n.jsxs("button",{type:"button","aria-pressed":a,onClick:()=>Jn(),title:a?"Exit inspect data source":"Inspect data source — click a value in the live preview to see its mock",className:a?"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors border-[var(--accent-active)] bg-[var(--accent-active)]/15 text-[var(--accent-active)]":"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40",children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a?"Inspecting…":"Inspect data"]})}const is=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelInspectButton:At},Symbol.toStringTag,{value:"Module"}));function Pt({variant:e,slug:t}){const r=()=>window.open(lr(t),"_blank");return e==="slideOver"?n.jsx("button",{type:"button",onClick:r,className:"p-1.5 rounded text-[var(--text-dim)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-card)] transition-colors cursor-pointer",title:"Open in new window",children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}):e==="inline"?n.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 px-2.5 py-1 rounded border border-[var(--border-default)] bg-transparent text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40 transition-colors cursor-pointer",title:"Open the full data editor in a new browser tab",children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Open in new tab"]}):null}const cs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelOpenInNewButton:Pt},Symbol.toStringTag,{value:"Module"}));function Rt(e){if(!e)return"Unsaved changes";const t=[];e.mocks.length>0&&t.push(`${e.mocks.length} mock${e.mocks.length===1?"":"s"}`);const r=e.seed.length;return r>0&&t.push(`${r} seed ${r===1?"table":"tables"}`),t.length>0?`Unsaved changes (${t.join(", ")})`:"Unsaved changes"}function Dt({diff:e,saving:t,cancelling:r,error:a,onSave:s,onCancel:o}){return n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border border-amber-500/40 bg-amber-500/10 px-2 py-1.5","data-testid":"scenario-draft-bar",children:[n.jsx("span",{className:"text-xs text-amber-300 font-medium",children:Rt(e)}),n.jsxs("div",{className:"flex items-center gap-2",children:[a&&n.jsx("span",{className:"text-xs text-red-400",children:a}),n.jsx("button",{type:"button",onClick:o,disabled:r||t,className:"px-2 py-0.5 text-xs rounded border border-[var(--border-default)] bg-[var(--bg-surface)] text-[var(--text-primary)] hover:bg-[var(--bg-input)] disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:r?"Discarding…":"Cancel"}),n.jsx("button",{type:"button",onClick:s,disabled:r||t,className:"px-3 py-0.5 text-xs rounded border border-[var(--accent-blue)] bg-[var(--accent-blue)]/20 text-[var(--accent-blue)] hover:bg-[var(--accent-blue)]/30 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:t?"Saving…":"Save"})]})]})}const ls=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDraftBar:Dt,summarizeDraftDiff:Rt},Symbol.toStringTag,{value:"Module"}));function It({title:e,slug:t,provider:r,chatOpen:a,onToggleChat:s,variant:o,onClose:c,draftDirty:i,draftDiff:p,draftSaving:f,draftCancelling:b,draftError:h,onSave:d,onCancel:m}){const x=ee(r),g=!!i&&!!d&&!!m;return n.jsxs("header",{className:"flex flex-col gap-2 border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("div",{className:"min-w-0",children:n.jsxs("h2",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:["Scenario data: ",e]})}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ot,{variant:o,providerLabel:x,chatOpen:a,onToggleChat:s}),n.jsx(At,{panelSlug:t}),n.jsx(Pt,{variant:o,slug:t}),c&&n.jsx(Tt,{variant:o,onClose:c})]})]}),g&&d&&m&&n.jsx(Dt,{diff:p??null,saving:f??!1,cancelling:b??!1,error:h??null,onSave:d,onCancel:m})]})}const ds=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelHeader:It},Symbol.toStringTag,{value:"Module"}));function Qn(e,t){const[r,a]=l.useState(e.status??200),[s,o]=l.useState(e.body??null),[c,i]=l.useState(()=>Object.entries(e.headers??{}).map(([h,d])=>({name:h,value:d})));l.useEffect(()=>{a(e.status??200),o(e.body??null),i(Object.entries(e.headers??{}).map(([h,d])=>({name:h,value:d})))},[t,e.status,e.body,e.headers]);const p=l.useMemo(()=>e.headers??{},[e.headers]),f=l.useMemo(()=>{if((e.status??200)!==r||JSON.stringify(e.body??null)!==JSON.stringify(s))return!0;const h={};for(const g of c)g.name.trim()&&(h[g.name.trim()]=g.value);const d=p,m=Object.keys(d),x=Object.keys(h);if(m.length!==x.length)return!0;for(const g of x)if(d[g]!==h[g])return!0;return!1},[r,s,c,e.status,e.body,p]);return{status:r,setStatus:a,body:s,setBody:o,headers:c,setHeaders:i,isDirty:f,buildPayload:()=>{const h={};for(const d of c)d.name.trim()&&(h[d.name.trim()]=d.value);return{status:r,body:s,headers:h}}}}const Zn=e=>navigator.clipboard.writeText(e);function ea(e={}){const{writer:t=Zn,resetMs:r=2e3}=e,[a,s]=l.useState(!1),o=l.useRef(null),c=l.useCallback(async i=>{await t(i),s(!0),o.current!==null&&clearTimeout(o.current),o.current=setTimeout(()=>{s(!1),o.current=null},r)},[t,r]);return{copied:a,copy:c}}function Lt({body:e,onBodyChange:t}){const{copied:r,copy:a}=ea();async function s(){try{const c=await navigator.clipboard.readText(),i=JSON.parse(c);t(i)}catch{}}function o(){a(JSON.stringify(e,null,2))}return n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>void s(),className:"text-[10px] px-2 py-0.5 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"Paste"}),n.jsx("button",{type:"button",onClick:o,className:"text-[10px] px-2 py-0.5 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:r?"Copied":"Copy"})]})}const us=Object.freeze(Object.defineProperty({__proto__:null,JsonBodyActions:Lt},Symbol.toStringTag,{value:"Module"}));function te(e){return JSON.stringify(e)}function $t(e,t){return e?e instanceof Set?e.has(t):e.includes(t):!1}function ta(e){const t=new Set;function r(a,s){if(a!==null&&typeof a=="object")if(t.add(te(s)),Array.isArray(a))a.forEach((o,c)=>r(o,[...s,c]));else for(const[o,c]of Object.entries(a))r(c,[...s,o])}return r(e,[]),t}function ra(e){return e===null?"text-slate-400 italic":typeof e=="string"?"text-emerald-300":typeof e=="number"?"text-amber-300":typeof e=="boolean"?"text-[#D7FF63]":"text-[var(--text-primary)]"}function na(e){return e===null?"null":typeof e=="string"?`"${e}"`:String(e)}function aa(e){return e===null?"null":typeof e=="string"?e:String(e)}function sa(e){const t=e.trim();if(t==="")return"";if(t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;try{return JSON.parse(t)}catch{return e}}function pe(e){return JSON.parse(JSON.stringify(e))}function oa(e,t,r){if(t.length===0)return r;const a=pe(e);let s=a;for(let o=0;o<t.length-1;o++)s=s[t[o]];return s[t[t.length-1]]=r,a}function Le(e,t){if(t.length===0)return e;const r=pe(e);let a=r;for(let o=0;o<t.length-1;o++)a=a[t[o]];const s=t[t.length-1];return Array.isArray(a)?a.splice(s,1):delete a[s],r}function ia(e,t){const r=pe(e);let a=r;for(const s of t)a=a[s];return Array.isArray(a)&&a.push(null),r}function ca(e,t,r){const a=pe(e);let s=a;for(const o of t)s=s[o];return s&&typeof s=="object"&&!Array.isArray(s)&&(s[r]=""),a}function la(e){if(typeof e!="string"||e.length===0||e!=="$"&&!e.startsWith("$.")&&!e.startsWith("$["))return null;const t=[];let r=e[0]==="$"?1:0;for(;r<e.length;){const a=e[r];if(a==="."){r+=1;const s=r;for(;r<e.length&&e[r]!=="."&&e[r]!=="[";)r+=1;const o=e.slice(s,r);if(o.length===0)return null;t.push(o)}else if(a==="["){const s=e.indexOf("]",r);if(s===-1)return null;const o=e.slice(r+1,s);if(o.length===0)return null;const c=Number(o);if(!Number.isInteger(c)||c<0)return null;t.push(c),r=s+1}else return null}return t}function da(e,t){l.useEffect(()=>{if(!e)return;const r=la(e);r&&t(a=>{const s=new Set(a);for(let o=0;o<r.length;o++)s.add(te(r.slice(0,o)));return s})},[e,t])}function he({collapsible:e,isOpen:t,onToggle:r,parentKey:a,readOnly:s,onRemove:o,children:c}){return n.jsxs("div",{className:"group/row flex items-center gap-1 min-h-[1.5em] hover:bg-[var(--bg-card)]/30 rounded px-1",children:[e?n.jsx("button",{type:"button",onClick:r,className:"w-4 h-4 flex items-center justify-center text-[var(--text-dim)] hover:text-[var(--text-primary)] bg-transparent border-none cursor-pointer p-0","aria-label":t?"Collapse":"Expand",children:n.jsx("span",{className:"text-[10px]",children:t?"▾":"▸"})}):n.jsx("span",{className:"w-4"}),a!==null&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-cyan-300",children:typeof a=="number"?`[${a}]`:a}),n.jsx("span",{className:"text-[var(--text-dim)]",children:":"})]}),n.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-1",children:c}),!s&&o&&n.jsx("button",{type:"button",onClick:o,className:"opacity-0 group-hover/row:opacity-100 text-[10px] text-[var(--text-dim)] hover:text-red-400 bg-transparent border-none cursor-pointer px-1",title:"Remove",children:"×"})]})}const fs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNodeLine:he},Symbol.toStringTag,{value:"Module"}));function Bt(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:c}=e,i=te(r),p=$t(s,i),f=t.length>0;return n.jsxs("div",{children:[n.jsxs(he,{collapsible:f,isOpen:p,onToggle:()=>o(i),parentKey:a,readOnly:c,onRemove:r.length>0?()=>e.onValueChange(Le(e.rootValue,r)):null,children:[n.jsx("span",{className:"text-[var(--text-dim)]",children:"["}),!p&&n.jsxs(n.Fragment,{children:[f&&n.jsxs("span",{className:"text-[var(--text-dim)] italic",children:[" ","…",t.length," item",t.length===1?"":"s"," "]}),n.jsx("span",{className:"text-[var(--text-dim)]",children:"]"})]})]}),p&&n.jsxs("div",{className:"ml-4 border-l border-[var(--border-subtle)] pl-2",children:[t.map((b,h)=>l.createElement(me,{...e,key:h,value:b,path:[...r,h],parentKey:h,isLast:h===t.length-1})),!c&&n.jsx("button",{type:"button",onClick:()=>e.onValueChange(ia(e.rootValue,r)),className:"text-[10px] text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer py-0.5",children:"+ Add item"})]}),p&&n.jsx("div",{className:"text-[var(--text-dim)]",children:"]"})]})}const ps=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeArrayNode:Bt},Symbol.toStringTag,{value:"Module"}));function Ft({onSave:e,onCancel:t}){const[r,a]=l.useState("");return n.jsxs("div",{className:"flex items-center gap-1 py-0.5",children:[n.jsx("span",{className:"text-[var(--text-dim)] text-[10px]",children:"+ key:"}),n.jsx("input",{autoFocus:!0,value:r,onChange:s=>a(s.target.value),onBlur:()=>e(r),onKeyDown:s=>{s.key==="Enter"?(s.preventDefault(),e(r)):s.key==="Escape"&&(s.preventDefault(),t())},placeholder:"keyName",className:"rounded border border-[var(--accent-active)]/50 bg-[var(--bg-surface)] px-1 py-0 text-xs font-mono text-[var(--text-primary)] min-w-[6rem]"})]})}const hs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeAddKeyInput:Ft},Symbol.toStringTag,{value:"Module"}));function Kt(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:c,addingKeyAtPath:i,onStartAddKey:p,onStopAddKey:f}=e,b=te(r),h=$t(s,b),d=Object.entries(t),m=d.length>0,x=i===b;return n.jsxs("div",{children:[n.jsxs(he,{collapsible:m,isOpen:h,onToggle:()=>o(b),parentKey:a,readOnly:c,onRemove:r.length>0?()=>e.onValueChange(Le(e.rootValue,r)):null,children:[n.jsx("span",{className:"text-[var(--text-dim)]",children:"{"}),!h&&n.jsxs(n.Fragment,{children:[m&&n.jsxs("span",{className:"text-[var(--text-dim)] italic",children:[" ","…",d.length," key",d.length===1?"":"s"," "]}),n.jsx("span",{className:"text-[var(--text-dim)]",children:"}"})]})]}),h&&n.jsxs("div",{className:"ml-4 border-l border-[var(--border-subtle)] pl-2",children:[d.map(([g,y],u)=>l.createElement(me,{...e,key:g,value:y,path:[...r,g],parentKey:g,isLast:u===d.length-1})),!c&&!x&&n.jsx("button",{type:"button",onClick:()=>p(b),className:"text-[10px] text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer py-0.5",children:"+ Add key"}),!c&&x&&n.jsx(Ft,{onSave:g=>{g.trim()&&e.onValueChange(ca(e.rootValue,r,g.trim())),f()},onCancel:f})]}),h&&n.jsx("div",{className:"text-[var(--text-dim)]",children:"}"})]})}const ms=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeObjectNode:Kt},Symbol.toStringTag,{value:"Module"}));function zt({initial:e,onSave:t,onCancel:r}){const[a,s]=l.useState(e);return n.jsx("input",{autoFocus:!0,value:a,onChange:o=>s(o.target.value),onBlur:()=>t(a),onKeyDown:o=>{o.key==="Enter"?(o.preventDefault(),t(a)):o.key==="Escape"&&(o.preventDefault(),r())},className:"flex-1 min-w-[4rem] rounded border border-[var(--accent-active)]/50 bg-[var(--bg-surface)] px-1 py-0 text-xs font-mono text-[var(--text-primary)]"})}const xs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveEditor:zt},Symbol.toStringTag,{value:"Module"}));function Ht(e){const{value:t,path:r,parentKey:a,readOnly:s,editingPath:o,onStartEdit:c,onStopEdit:i}=e,p=te(r),f=o===p;return n.jsx(he,{collapsible:!1,isOpen:!1,parentKey:a,readOnly:s,onToggle:()=>{},onRemove:r.length>0?()=>e.onValueChange(Le(e.rootValue,r)):null,children:f?n.jsx(zt,{initial:aa(t),onSave:b=>{const h=sa(b);e.onValueChange(oa(e.rootValue,r,h)),i()},onCancel:i}):n.jsx("button",{type:"button",onClick:s?void 0:()=>c(p),disabled:s,className:`${s?"":"hover:bg-[var(--bg-card)] cursor-pointer"} bg-transparent border-none px-1 py-0 rounded ${ra(t)} text-left font-mono`,title:s?void 0:"Click to edit",children:na(t)})})}const bs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveNode:Ht},Symbol.toStringTag,{value:"Module"}));function me(e){const{value:t}=e;return Array.isArray(t)?n.jsx(Bt,{...e,value:t}):t!==null&&typeof t=="object"?n.jsx(Kt,{...e,value:t}):n.jsx(Ht,{...e})}const gs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNode:me},Symbol.toStringTag,{value:"Module"}));function xe({value:e,onChange:t,readOnly:r=!1,focusJsonPath:a}){const[s,o]=l.useState(()=>ta(e)),[c,i]=l.useState(null),[p,f]=l.useState(null);da(a,o);function b(h){o(d=>{const m=new Set(d);return m.has(h)?m.delete(h):m.add(h),m})}return n.jsx("div",{className:"flex flex-col h-full min-h-0",children:n.jsx("div",{className:"flex-1 min-h-0 overflow-auto font-mono text-xs leading-relaxed text-[var(--text-primary)] bg-[var(--bg-input)] border border-[var(--border-default)] rounded p-3",children:n.jsx(me,{value:e,path:[],parentKey:null,isLast:!0,readOnly:r,expanded:s,editingPath:c,addingKeyAtPath:p,onToggle:b,onStartEdit:i,onStopEdit:()=>i(null),onStartAddKey:f,onStopAddKey:()=>f(null),onValueChange:t,rootValue:e})})})}const ys=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeEditor:xe},Symbol.toStringTag,{value:"Module"}));function Vt({headers:e,onChange:t}){function r(o,c){t(e.map((i,p)=>p===o?{...i,...c}:i))}function a(){t([...e,{name:"",value:""}])}function s(o){t(e.filter((c,i)=>i!==o))}return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Headers"}),n.jsx("button",{type:"button",onClick:a,className:"text-xs text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer",children:"+ Add"})]}),e.length===0&&n.jsx("p",{className:"text-xs text-[var(--text-dim)] italic",children:"No headers"}),e.map((o,c)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:o.name,onChange:i=>r(c,{name:i.target.value}),placeholder:"Name",className:"flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("input",{value:o.value,onChange:i=>r(c,{value:i.target.value}),placeholder:"Value",className:"flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("button",{type:"button",onClick:()=>s(c),className:"px-2 text-xs text-[var(--text-dim)] hover:text-red-400 bg-transparent border-none cursor-pointer",children:"×"})]},c))]})}const vs=Object.freeze(Object.defineProperty({__proto__:null,MockBodyHeadersEditor:Vt},Symbol.toStringTag,{value:"Module"})),ke=5;function ua(e,t){if(e==="loading")return"Computing impact…";if(e==null)return"";if(t.kind==="scenario")return"Affects only this scenario.";if(e.length===0)return"Affects no other scenarios.";const r=e.length===1?"scenario":"scenarios",a=e.slice(0,ke).join(", "),s=e.length>ke?`, +${e.length-ke} more`:"";return`Affects ${e.length} ${r}: ${a}${s}`}function fa(e){const t=[{label:"This scenario only",description:"Write to this scenario's mocks file. The row's source flips to scenario.",scope:{kind:"scenario"}}];return e.source==="shared"&&e.sharedSlug&&t.push({label:`Shared data set "${e.sharedSlug}"`,description:"Write to the shared set this row came from. Affects every scenario opted into it.",scope:{kind:"shared",slug:e.sharedSlug}}),(e.source==="default"||e.source==="shared")&&t.push({label:"Defaults",description:"Write to _default.json. Affects every scenario that falls through to defaults for this route.",scope:{kind:"default"}}),t}function pa(e,t){if(e.source==="default"){const r=t.findIndex(a=>a.scope.kind==="default");if(r>=0)return r}if(e.source==="shared"){const r=t.findIndex(a=>a.scope.kind==="shared"&&a.scope.slug===(e.sharedSlug??""));if(r>=0)return r}return 0}function ha(e,t,r){const[a,s]=l.useState({}),o=r.map(c=>U(c.scope)).join("|");return l.useEffect(()=>{let c=!1;return(async()=>{const p={};for(const f of r)p[U(f.scope)]="loading";s(p);for(const f of r)try{const b=await vr(e,t,f.scope);if(c)return;s(h=>({...h,[U(f.scope)]:b}))}catch{if(c)return;s(b=>({...b,[U(f.scope)]:[]}))}})(),()=>{c=!0}},[e,t,o]),a}function Yt({choice:e,selected:t,impactLabel:r,onSelect:a}){return n.jsxs("label",{className:`flex cursor-pointer flex-col rounded border p-3 text-xs transition-colors ${t?"border-violet-500 bg-violet-500/10":"border-[var(--border-subtle)] hover:bg-[var(--bg-elevated)]"}`,children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"radio",name:"save-scope",checked:t,onChange:a}),n.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:e.label})]}),n.jsx("span",{className:"mt-1 pl-6 text-[var(--text-muted)]",children:e.description}),n.jsx("span",{className:"mt-1 pl-6 text-[var(--text-dim)] italic",children:r})]})}const js=Object.freeze(Object.defineProperty({__proto__:null,SaveScopeChoiceRow:Yt},Symbol.toStringTag,{value:"Module"}));function Wt({entry:e,scenarioSlug:t,routeKey:r,onCancel:a,onConfirm:s}){const o=fa(e),[c,i]=l.useState(()=>pa(e,o)),p=ha(t,r,o),[f,b]=l.useState(!1),[h,d]=l.useState(null),m=async()=>{const x=o[c];if(x){b(!0),d(null);try{await s(x.scope)}catch(g){d(g instanceof Error?g.message:"Save failed")}finally{b(!1)}}};return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"save-scope-modal-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:n.jsxs("div",{className:"w-[28rem] max-w-[90vw] rounded-lg border border-[var(--border-default)] bg-[var(--bg-surface)] p-5 shadow-xl",children:[n.jsx("h2",{id:"save-scope-modal-title",className:"text-sm font-semibold text-[var(--text-primary)]",children:"Where should this save land?"}),n.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r}),n.jsx("div",{className:"mt-4 space-y-2",children:o.map((x,g)=>n.jsx(Yt,{choice:x,selected:c===g,impactLabel:ua(p[U(x.scope)],x.scope),onSelect:()=>i(g)},U(x.scope)))}),h&&n.jsx("p",{className:"mt-3 text-xs text-red-400",role:"alert",children:h}),n.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:f,className:"rounded border border-[var(--border-default)] px-3 py-1.5 text-xs text-[var(--text-primary)] hover:bg-[var(--bg-elevated)] disabled:opacity-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void m(),disabled:f,className:"rounded bg-violet-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-violet-400 disabled:opacity-50",children:f?"Saving…":"Save"})]})]})})}const _s=Object.freeze(Object.defineProperty({__proto__:null,SaveScopeModal:Wt},Symbol.toStringTag,{value:"Module"}));function Ut({entry:e,routeKey:t,scenarioSlug:r,onSave:a,focusJsonPath:s}){const o=Qn(e,t),[c,i]=l.useState(null),[p,f]=l.useState(!1),[b,h]=l.useState(!1);l.useEffect(()=>{i(null),h(!1)},[t]);const d=async x=>{f(!0),i(null);try{const g=o.buildPayload();await a({routeKey:t,...g,scope:x})}catch(g){throw i(g instanceof Error?g.message:"Save failed"),g}finally{f(!1)}},m=async()=>{if(o.isDirty){if(e.source==="scenario"){try{await d({kind:"scenario"})}catch{}return}h(!0)}};return n.jsxs("div",{className:"flex flex-col gap-3 h-full min-h-0",children:[c&&n.jsx("p",{className:"text-xs text-red-400",children:c}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Status"}),n.jsx("input",{type:"number",value:o.status,onChange:x=>o.setStatus(Number(x.target.value)),className:"w-20 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{type:"button",onClick:()=>void m(),disabled:!o.isDirty||p,className:"rounded bg-violet-500 px-3 py-1 text-xs font-medium text-white hover:bg-violet-400 disabled:opacity-50",children:p?"Saving…":o.isDirty?"Save changes":"Saved"})]}),n.jsx(Vt,{headers:o.headers,onChange:o.setHeaders}),n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[n.jsxs("div",{className:"flex items-center gap-2 pb-1",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Body"}),n.jsx(Lt,{body:o.body,onBodyChange:o.setBody})]}),n.jsx(xe,{value:o.body,onChange:o.setBody,focusJsonPath:s},t)]}),b&&n.jsx(Wt,{entry:e,scenarioSlug:r,routeKey:t,onCancel:()=>h(!1),onConfirm:async x=>{await d(x),h(!1)}})]})}const ws=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockEditable:Ut},Symbol.toStringTag,{value:"Module"}));function ma(e,t){if(e==null)return"never";const r=Math.max(0,Math.floor((t-e)/1e3));if(r<60)return`${r}s ago`;const a=Math.floor(r/60);return a<60?`${a}m ago`:`${Math.floor(a/60)}h ago`}const Ge={GET:"text-emerald-400 border-emerald-400/40",POST:"text-[#D7FF63] border-[#D7FF63]/40",PUT:"text-amber-400 border-amber-400/40",PATCH:"text-purple-400 border-purple-400/40",DELETE:"text-red-400 border-red-400/40"};function xa(e){return Ge[e]??Ge.GET}function Xt({entry:e,scenarioHasDefaultFallback:t,onSave:r,onRemove:a,onPassthrough:s}){const o=`${e.method} ${e.pathPattern}`,c=xa(e.method),i=e.status??e.lastObservedStatus,p=l.useMemo(()=>e.lastObservedMs?ma(e.lastObservedMs,Date.now()):null,[e.lastObservedMs]),f="px-3 py-1 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer text-xs";return n.jsxs("header",{className:"border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-3 space-y-2 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:`px-2 py-0.5 rounded border font-mono text-xs ${c}`,children:e.method}),n.jsx("span",{className:"font-mono text-sm text-[var(--text-primary)] break-all",children:e.pathPattern}),n.jsx(Pe,{source:e.source}),i!==void 0&&n.jsx("span",{className:"px-1.5 py-0.5 rounded border border-[var(--border-default)] text-[var(--text-muted)] font-mono text-xs",children:i}),e.observedCount>0&&n.jsxs("span",{className:"ml-auto text-xs text-[var(--text-dim)]",children:[e.observedCount,"× ",p?`· ${p}`:""]})]}),e.variants.length>1&&n.jsxs("div",{className:"text-[10px] text-[var(--text-dim)] font-mono",children:["variants: ",e.variants.filter(b=>b!==o).join(", ")]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.source==="scenario"&&t&&n.jsx("button",{onClick:()=>void a(o),className:f,title:"Remove this scenario mock and fall back to the default",children:"Revert to default"}),e.source==="scenario"&&n.jsx("button",{onClick:()=>void s(o),className:f,children:"Mark passthrough"}),e.source==="default"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>void r({routeKey:o,status:e.status??200,body:e.body,headers:e.headers??{},scope:{kind:"scenario"}}),className:"px-3 py-1 rounded border border-emerald-500/50 bg-emerald-500/10 text-emerald-300 hover:bg-emerald-500/20 cursor-pointer text-xs",title:"Copy default body into this scenario",children:"Promote to scenario"}),n.jsx("button",{onClick:()=>void s(o),className:f,children:"Mark passthrough"})]}),e.source==="passthrough"&&n.jsx("button",{onClick:()=>void a(o),className:f,children:"Undo passthrough"})]})]})}const Ss=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockHeader:Xt},Symbol.toStringTag,{value:"Module"}));function Jt({entry:e}){const t=Object.entries(e.headers??{}),r=e.body!==void 0&&e.body!==null;return!r&&t.length===0?n.jsx("p",{className:"text-xs italic text-[var(--text-dim)]",children:e.source==="catalog-only"?"No mock body yet — this endpoint has only been observed, not mocked. Promote it to a scenario to start editing.":e.source==="passthrough"?"This endpoint passes through to the upstream service.":"No body configured."}):n.jsxs("div",{className:"space-y-3 h-full min-h-0 flex flex-col",children:[t.length>0&&n.jsxs("section",{className:"space-y-1 flex-shrink-0",children:[n.jsx("h4",{className:"text-xs font-medium uppercase tracking-wide text-[var(--text-dim)]",children:"Headers"}),n.jsx("dl",{className:"text-xs font-mono space-y-0.5",children:t.map(([a,s])=>n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("dt",{className:"text-[var(--text-muted)]",children:[a,":"]}),n.jsx("dd",{className:"text-[var(--text-primary)] break-all",children:s})]},a))})]}),r&&n.jsxs("section",{className:"flex-1 min-h-0 flex flex-col",children:[n.jsx("h4",{className:"text-xs font-medium uppercase tracking-wide text-[var(--text-dim)] pb-1",children:"Body"}),n.jsx(xe,{value:e.body,onChange:()=>{},readOnly:!0},`${e.method} ${e.pathPattern}`)]})]})}const ks=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockReadOnly:Jt},Symbol.toStringTag,{value:"Module"}));function qt({entry:e,scenarioSlug:t,scenarioHasDefaultFallback:r,onSave:a,onRemove:s,onPassthrough:o,focusJsonPath:c}){const i=`${e.method} ${e.pathPattern}`,p=e.source==="scenario"||e.source==="default"||e.source==="shared";return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(Xt,{entry:e,scenarioHasDefaultFallback:r,onSave:a,onRemove:s,onPassthrough:o}),n.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-4",children:p?n.jsx(Ut,{entry:e,routeKey:i,scenarioSlug:t,onSave:a,focusJsonPath:c}):n.jsx(Jt,{entry:e})})]})}const Cs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMock:qt},Symbol.toStringTag,{value:"Module"}));function ba({slug:e,tab:t,initialRows:r,onCellEdited:a}){const[s,o]=l.useState(r),[c,i]=l.useState(null),[p,f]=l.useState(""),[b,h]=l.useState(""),d=l.useRef(null);l.useEffect(()=>{o(r),i(null)},[t.dataKey,r]);function m(v,C){const w=s[v];i({row:v,col:C});const _=w[C]===null?"":typeof w[C]=="object"?JSON.stringify(w[C]):String(w[C]);f(_),h(_)}function x(v){if(f(v),d.current&&clearTimeout(d.current),!c)return;const C=c;d.current=setTimeout(()=>{u(C.row,C.col,v)},600)}function g(){c&&(d.current&&clearTimeout(d.current),u(c.row,c.col,p),i(null))}function y(){if(d.current&&clearTimeout(d.current),!!c){if(p!==b){const v=[...s];v[c.row]={...v[c.row],[c.col]:Ke(b)},o(v),fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t.dataKey,rowIndex:c.row,column:c.col,value:b})}).then(()=>{q(),a&&a()}).catch(()=>{})}i(null)}}async function u(v,C,w){const _=[...s];_[v]={..._[v],[C]:Ke(w)},o(_);try{await fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t.dataKey,rowIndex:v,column:C,value:w})}),q(),a&&a()}catch{}}return{rows:s,editingCell:c,editValue:p,handleEditCell:m,handleEditValueChange:x,handleSave:g,handleCancelEdit:y}}function Gt({tab:e}){return!e.description&&!e.category?null:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-[var(--bg-deep)] border-b border-[var(--border-subtle)]",children:[e.category&&n.jsx("span",{className:`text-[9px] rounded px-1.5 py-0 border ${e.category==="datastore"?"text-[var(--accent-active)]/80 bg-[var(--accent-active)]/10 border-[var(--accent-active)]/30":e.category==="mock-api"?"text-[#D7FF63]/80 bg-[#D7FF63]/10 border-[#D7FF63]/30":"text-[var(--text-muted)] bg-[var(--bg-surface)]/30 border-[var(--text-dim)]/30"}`,children:e.category==="mock-api"?"API Mock":e.category}),e.description&&n.jsx("span",{className:"text-[10px] text-[var(--text-dim)]",children:e.description})]})}const Ns=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCategoryBadge:Gt},Symbol.toStringTag,{value:"Module"}));function Qt({editingCell:e,editValue:t,onEditValueChange:r,onSave:a,onCancel:s}){return n.jsxs("div",{className:"border-t border-[var(--border-default)] bg-[var(--bg-deep)] px-3 py-2",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:n.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["Editing"," ",n.jsx("strong",{className:"text-[var(--text-secondary)]",children:e.col})," ","in row ",e.row+1]})}),n.jsx("textarea",{value:t,onChange:o=>r(o.target.value),className:"w-full px-2 py-1.5 text-[11px] bg-[var(--bg-card)] text-[var(--text-primary)] border border-[var(--border-default)] rounded outline-none focus:border-[var(--accent-active)]/50 resize-y min-h-[60px] max-h-[200px] font-mono",autoFocus:!0,rows:t.length>100?4:2,onKeyDown:o=>{o.key==="Escape"&&s(),o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&a()}}),n.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[n.jsx("button",{onClick:a,className:"px-3 py-1 text-[10px] font-medium text-[var(--bg-deep)] bg-[var(--accent-active)] rounded cursor-pointer border-none hover:bg-[var(--accent-active)]/80 transition-colors",children:"Save"}),n.jsx("button",{onClick:s,className:"px-3 py-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text-primary)] bg-transparent border-none cursor-pointer",children:"Cancel"}),n.jsxs("span",{className:"text-[9px] text-[var(--text-dim)] ml-auto",children:["⌘","+Enter to save, Esc to cancel"]})]})]})}const Es=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCellEditor:Qt},Symbol.toStringTag,{value:"Module"}));function Zt({columns:e,colTypes:t,pkCol:r,rows:a,onEditCell:s}){return e.length===0?n.jsx("div",{className:"px-3 py-4 text-[10px] text-[var(--text-dim)] text-center",children:"No columns defined for this table"}):n.jsx("div",{className:"overflow-x-auto max-h-[300px] overflow-y-auto",children:n.jsxs("table",{className:"w-full text-[10px] border-collapse table-fixed",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-[var(--bg-deep)] sticky top-0 z-10",children:[n.jsx("th",{className:"text-right text-[var(--text-dim)] font-normal px-2 py-1.5 border-b border-[var(--border-default)] w-8",children:"#"}),e.map(o=>n.jsx(er,{name:o,type:t[o],isPk:o===r},o))]})}),n.jsx("tbody",{children:a.map((o,c)=>n.jsx(tr,{row:o,rowIndex:c,columns:e,pkCol:r,onEditCell:s},c))})]})})}function er({name:e,type:t,isPk:r}){return n.jsxs("th",{className:"text-left px-2 py-1.5 border-b border-[var(--border-default)] whitespace-nowrap overflow-hidden",children:[r&&n.jsx("span",{className:"inline-block text-[8px] font-bold text-[var(--bg-deep)] bg-[var(--accent-active)] rounded px-1 py-0 mr-1.5 align-middle",children:"PK"}),n.jsx("span",{className:"text-[var(--text-secondary)] font-medium",children:e}),n.jsx("span",{className:"text-[var(--text-dim)] font-normal ml-1",children:t})]})}function tr({row:e,rowIndex:t,columns:r,pkCol:a,onEditCell:s}){return n.jsxs("tr",{className:"border-b border-[var(--border-subtle)] hover:bg-[var(--bg-card)] group/row",children:[n.jsx("td",{className:"text-right text-[var(--text-dim)] px-2 py-1.5 w-8 select-none",children:t+1}),r.map(o=>n.jsx(rr,{value:e[o],isPk:o===a,onEdit:()=>s(t,o)},o))]})}function rr({value:e,isPk:t,onEdit:r}){return n.jsxs("td",{className:`px-2 py-1.5 overflow-hidden relative group/cell ${t?"text-[var(--accent-active)] font-medium":"text-[var(--text-secondary)]"}`,title:String(e??""),children:[n.jsx("span",{className:"truncate block whitespace-nowrap",children:e===null?n.jsx("span",{className:"text-[var(--text-dim)] italic",children:"null"}):typeof e=="object"?n.jsx("span",{className:"text-[var(--text-dim)]",children:JSON.stringify(e)}):typeof e=="number"?n.jsx("span",{className:"text-amber-400",children:String(e)}):String(e)}),n.jsx("button",{onClick:a=>{a.stopPropagation(),r()},className:"absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover/cell:opacity-100 text-[var(--text-dim)] hover:text-[var(--text-primary)] bg-[var(--bg-card)] border border-[var(--border-default)] rounded cursor-pointer p-0.5 transition-opacity",title:"Edit",children:n.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})]})}const Ts=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCell:rr,DataViewerColumnHeader:er,DataViewerRow:tr,DataViewerTable:Zt},Symbol.toStringTag,{value:"Module"}));function nr({slug:e,tab:t,initialRows:r,onCellEdited:a}){const{rows:s,editingCell:o,editValue:c,handleEditCell:i,handleEditValueChange:p,handleSave:f,handleCancelEdit:b}=ba({slug:e,tab:t,initialRows:r,onCellEdited:a}),h=Cr(s,t.schemaFields),d=Nr(h,s,t.schemaFields),m=Er(h,t.schemaFields);return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(Gt,{tab:t}),n.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:n.jsx(Zt,{columns:h,colTypes:d,pkCol:m,rows:s,onEditCell:i})}),o&&n.jsx(Qt,{editingCell:o,editValue:c,onEditValueChange:p,onSave:f,onCancel:b})]})}const Os=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainTable:nr},Symbol.toStringTag,{value:"Module"}));function ga({slug:e,browserState:t,tab:r,onCellEdited:a}){const s=l.useMemo(()=>{if(!t)return{};switch(r){case"cookies":return t.cookies??{};case"localStorage":return t.localStorage??{};case"sessionStorage":return t.sessionStorage??{};case"headers":return t.requestHeaders??{};default:return{}}},[t,r]),o=l.useCallback(async p=>{const f=r==="headers"?"browserState.requestHeaders":`browserState.${r}`;try{await fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:f,value:JSON.stringify(p)})}),q(),a&&a()}catch{}},[e,r,a]),c=l.useMemo(()=>{switch(r){case"cookies":return"Cookies";case"localStorage":return"Local Storage";case"sessionStorage":return"Session Storage";case"headers":return"Request Headers"}},[r]),i=l.useMemo(()=>{switch(r){case"cookies":return"Cookies injected via Set-Cookie headers on the scenario's initial response.";case"localStorage":return"localStorage items set before the app's JavaScript executes.";case"sessionStorage":return"sessionStorage items set before the app's JavaScript executes.";case"headers":return"Custom headers added to every outbound HTTP request from the iframe."}},[r]);return{value:s,handleChange:o,label:c,description:i}}function ar({slug:e,browserState:t,tab:r,onCellEdited:a}){const{value:s,handleChange:o,label:c,description:i}=ga({slug:e,browserState:t,tab:r,onCellEdited:a});return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-[var(--border-subtle)]",children:[n.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)]",children:c}),n.jsx("p",{className:"text-xs text-[var(--text-dim)] mt-1",children:i})]}),n.jsx("div",{className:"flex-1 min-h-0 p-4 overflow-auto",children:n.jsx(xe,{value:s,onChange:o})})]})}const Ms=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateTab:ar},Symbol.toStringTag,{value:"Module"}));function le({label:e,active:t,onClick:r}){return n.jsx("button",{type:"button",onClick:r,className:`px-2 py-0.5 rounded-full border text-[10px] font-mono transition-colors cursor-pointer ${t?"bg-violet-500/25 text-violet-100 border-violet-400/70":"bg-violet-500/10 text-violet-300 border-violet-500/40 hover:bg-violet-500/20"}`,"aria-pressed":t,children:e})}const As=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataBadge:le},Symbol.toStringTag,{value:"Module"}));function sr({shares:e,activeBadge:t,onSelect:r}){return n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-2","data-testid":"scenario-mock-data-strip",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-semibold",children:"Mock Data:"}),n.jsx(le,{label:"This Page",active:t.kind==="this-page",onClick:()=>r({kind:"this-page"})}),e.map(a=>n.jsx(le,{label:a,active:t.kind==="share"&&t.slug===a,onClick:()=>r({kind:"share",slug:a})},a)),n.jsx(le,{label:"Defaults",active:t.kind==="defaults",onClick:()=>r({kind:"defaults"})})]})}const Ps=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataStrip:sr},Symbol.toStringTag,{value:"Module"}));function ya({slug:e,scenarioName:t,initialSection:r,onClose:a,variant:s="slideOver"}){const{data:o,tableTabs:c,scenarioOwnedDataKeys:i,shares:p,browserState:f,loading:b,error:h}=Dr(e),{entries:d,loading:m,error:x,upsertScoped:g,remove:y,setPassthrough:u}=_r(e),{config:v}=Qe(),C=(v==null?void 0:v.provider)??"claude",w=Br({slug:e,onPreviewReload:q}),_=l.useCallback(()=>{w.markDirty(),q()},[w]),P=l.useCallback(async O=>{await g(O),_()},[g,_]),B=l.useCallback(async O=>{await y(O),_()},[y,_]),T=l.useCallback(async O=>{await u(O),_()},[u,_]),j=l.useCallback(()=>{w.markDirty(),q()},[w]),$=l.useCallback(()=>{a&&w.confirmIfDirty("Discard unsaved changes to this scenario?")&&a()},[a,w]),[S,E]=l.useState(null),[M,I]=l.useState(null),[L,A]=l.useState(!1),K=l.useCallback(O=>E({kind:"mock",routeKey:O}),[]);hr({onSelect:K,onFocus:I});const[F,J]=l.useState({kind:"this-page"}),z=b||m,H=l.useMemo(()=>s==="inline"?c.filter(O=>i.has(O.dataKey)):c,[s,c,i]),V=l.useMemo(()=>{if(s!=="inline")return d;switch(F.kind){case"this-page":return d.filter(O=>O.consumedThisPageLoad);case"defaults":return d.filter(O=>O.source==="default");case"share":return d.filter(O=>O.source==="shared"&&O.sharedSlug===F.slug)}},[s,d,F]);Ur({seedTabs:H,mockEntries:V,initialSection:r,selection:S,setSelection:E});const re=l.useMemo(()=>{const O=new Set;for(const $e of d)$e.source==="default"&&O.add(X($e));return O},[d]),k=(S==null?void 0:S.kind)==="seed"?H.find(O=>O.dataKey===S.dataKey)??null:null,N=(S==null?void 0:S.kind)==="mock"?V.find(O=>X(O)===S.routeKey)??null:null,R=k&&o?o[k.dataKey]??[]:[],D=l.useMemo(()=>ur({slug:e,scenarioName:t,seedTabs:H,mockEntries:V,selectedMock:N,selectedSeedTab:k,selectedSeedRows:R}),[e,t,H,V,N,k,R]),ne=t??e,be=H.length>0||V.length>0,ge=n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(It,{title:ne,slug:e,provider:C,chatOpen:L,onToggleChat:()=>A(O=>!O),variant:s,onClose:a?$:void 0,draftDirty:w.isDirty,draftDiff:w.diffSummary,draftSaving:w.saving,draftCancelling:w.cancelling,draftError:w.error,onSave:()=>void w.save(),onCancel:()=>void w.cancel()}),s==="inline"&&n.jsx(sr,{shares:p,activeBadge:F,onSelect:J}),L&&n.jsx("div",{className:"flex-shrink-0 border-b border-[var(--border-subtle)] bg-[var(--bg-deep)]",children:n.jsx(Nt,{chatName:`edit-data-${e}`,prompt:D,height:360,onClose:()=>A(!1)})}),n.jsxs("div",{className:"flex flex-1 min-h-0",children:[n.jsx(at,{seedTabs:H,mockEntries:V,selection:S,onSelect:E}),n.jsx("main",{className:"flex-1 min-w-0 min-h-0 bg-[var(--bg-deep)] flex flex-col",children:n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[h&&n.jsxs("p",{className:"p-4 text-xs text-red-400",children:["Seed error: ",h]}),x&&n.jsxs("p",{className:"p-4 text-xs text-red-400",children:["Mocks error: ",x]}),!z&&!be&&n.jsx(Et,{}),k&&n.jsx(nr,{slug:e,tab:k,initialRows:R,onCellEdited:j}),N&&n.jsx(qt,{entry:N,scenarioSlug:e,scenarioHasDefaultFallback:re.has(X(N)),onSave:P,onRemove:B,onPassthrough:T,focusJsonPath:M}),(S==null?void 0:S.kind)==="browser"&&n.jsx(ar,{slug:e,browserState:f,tab:S.tab,onCellEdited:j}),!k&&!N&&(S==null?void 0:S.kind)!=="browser"&&be&&!z&&n.jsx("p",{className:"p-4 text-xs text-[var(--text-dim)] italic",children:"Select a data source from the left to view it."}),z&&!be&&n.jsx("p",{className:"p-4 text-xs text-[var(--text-dim)]",children:"Loading scenario data…"})]})})]})]});return s==="fullPage"?n.jsx("div",{className:"fixed inset-0 bg-[var(--bg-deep)] text-[var(--text-primary)]",children:ge}):s==="inline"?n.jsx("div",{className:"rounded-md border border-[var(--border-subtle)] bg-[var(--bg-deep)] max-h-[min(640px,70vh)] min-h-0 flex flex-col overflow-hidden",children:ge}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/40",onClick:$,"aria-label":"Close scenario data panel"}),n.jsx("aside",{className:"fixed right-0 top-0 z-50 h-full w-full max-w-4xl border-l border-[var(--border-default)] bg-[var(--bg-deep)] shadow-2xl",children:ge})]})}const Rs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanel:ya},Symbol.toStringTag,{value:"Module"}));export{tt as $,zn as A,ar as B,Lt as C,tr as D,Dt as E,rt as F,nt as G,Wt as H,Yt as I,Ht as J,at as K,sr as L,Vt as M,le as N,Pt as O,Xt as P,qt as Q,At as R,ya as S,pt as T,It as U,Et as V,Ot as W,Tt as X,Zt as Y,Qt as Z,Gt as _,Pe as a,Es as a$,et as a0,dt as a1,lt as a2,ct as a3,it as a4,ht as a5,vt as a6,wt as a7,St as a8,kt as a9,Cs as aA,is as aB,ds as aC,rs as aD,as as aE,ns as aF,Rs as aG,_s as aH,js as aI,es as aJ,Za as aK,Ea as aL,Ma as aM,vs as aN,Ha as aO,qa as aP,bs as aQ,xs as aR,ms as aS,fs as aT,gs as aU,ys as aV,ps as aW,hs as aX,us as aY,ts as aZ,Ts as a_,Nt as aa,Ct as ab,Xa as ac,Ua as ad,Qa as ae,Ga as af,Ka as ag,$a as ah,Ba as ai,Ia as aj,La as ak,Fa as al,za as am,Da as an,Aa as ao,Oa as ap,Ta as aq,ls as ar,Pa as as,cs as at,Ps as au,As as av,Os as aw,ks as ax,Ss as ay,ws as az,nr as b,Ns as b0,Ms as b1,Ja as b2,Qe as b3,ee as b4,ea as b5,De as b6,On as b7,_e as b8,Cn as b9,qr as bA,Me as bB,Yn as bC,Wa as ba,Gr as bb,Qr as bc,on as bd,mn as be,Va as bf,bn as bg,Zr as bh,vn as bi,st as bj,gn as bk,xn as bl,Ya as bm,_t as bn,Sn as bo,Xe as bp,wn as bq,ce as br,nn as bs,jr as bt,Ca as bu,os as bv,ss as bw,Na as bx,Ra as by,Hn as bz,Ut as c,Jt as d,q as e,ma as f,Br as g,Dr as h,_r as i,ft as j,ut as k,oe as l,er as m,rr as n,Z as o,Ke as p,mt as q,jt as r,zt as s,Kt as t,Vn as u,he as v,me as w,xe as x,Bt as y,Ft as z};
|