import{j as a,E as rn,o as pr,S as gr,s as an,H as on,t as _,R as ln,y as yr}from"./vendor-codemirror-DuTs_c1R.js";import{b as xr,g as br,a as y,R as et,u as Tt,N as wr,O as kr,c as rs,d as Nr,e as Xe,B as vr}from"./vendor-react-XjCOqm20.js";import{r as jr,a as Sr}from"./vendor-xterm--24IGk-x.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=t(r);fetch(r.href,i)}})();var pt={},Cs;function Cr(){if(Cs)return pt;Cs=1;var s=xr();return pt.createRoot=s.createRoot,pt.hydrateRoot=s.hydrateRoot,pt}var Tr=Cr();const Ar=br(Tr);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Or=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cn=(...s)=>s.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var Er={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _r=y.forwardRef(({color:s="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:r="",children:i,iconNode:o,...l},c)=>y.createElement("svg",{ref:c,...Er,width:e,height:e,stroke:s,strokeWidth:n?Number(t)*24/Number(e):t,className:cn("lucide",r),...l},[...o.map(([d,p])=>y.createElement(d,p)),...Array.isArray(i)?i:[i]]));/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M=(s,e)=>{const t=y.forwardRef(({className:n,...r},i)=>y.createElement(_r,{ref:i,iconNode:e,className:cn(`lucide-${Or(s)}`,n),...r}));return t.displayName=`${s}`,t};/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lr=M("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dn=M("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const un=M("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Te=M("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ir=M("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ae=M("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mr=M("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $r=M("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pr=M("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rr=M("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Br=M("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const At=M("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dr=M("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fr=M("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kr=M("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qr=M("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ur=M("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zr=M("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vr=M("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wr=M("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ts=M("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gr=M("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hr=M("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jr=M("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yr=M("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lt=M("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const is=M("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fn=M("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qr=M("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hn=M("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const As=M("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xr=M("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zr=M("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ei=M("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mn=M("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ti=M("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const si=M("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Be=M("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pn=M("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gn=M("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ni=M("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yn=M("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const De=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function xn(s){var e,t,n="";if(typeof s=="string"||typeof s=="number")n+=s;else if(typeof s=="object")if(Array.isArray(s)){var r=s.length;for(e=0;e<r;e++)s[e]&&(t=xn(s[e]))&&(n&&(n+=" "),n+=t)}else for(t in s)s[t]&&(n&&(n+=" "),n+=t);return n}function $(){for(var s,e,t=0,n="",r=arguments.length;t<r;t++)(s=arguments[t])&&(e=xn(s))&&(n&&(n+=" "),n+=e);return n}const Os=s=>{let e;const t=new Set,n=(d,p)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const u=e;e=p??(typeof f!="object"||f===null)?f:Object.assign({},e,f),t.forEach(h=>h(e,u))}},r=()=>e,l={setState:n,getState:r,getInitialState:()=>c,subscribe:d=>(t.add(d),()=>t.delete(d))},c=e=s(n,r,l);return l},ri=(s=>s?Os(s):Os),ii=s=>s;function ai(s,e=ii){const t=et.useSyncExternalStore(s.subscribe,et.useCallback(()=>e(s.getState()),[s,e]),et.useCallback(()=>e(s.getInitialState()),[s,e]));return et.useDebugValue(t),t}const Es=s=>{const e=ri(s),t=n=>ai(e,n);return Object.assign(t,e),t},Ee=(s=>s?Es(s):Es),bn="";async function F(s,e){const t=await fetch(`${bn}${s}`,{headers:{"Content-Type":"application/json"},...e});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.detail||`HTTP ${t.status}`)}return t.json()}const oi=()=>F("/api/workspace"),_s=s=>F("/api/workspace/run-root",{method:"POST",body:JSON.stringify({path:s})}),li=()=>F("/api/workspace/shell",{method:"POST"}),ci=()=>F("/api/templates"),di=s=>F(`/api/templates/content?value=${encodeURIComponent(s)}`),ui=s=>F("/api/generator/create",{method:"POST",body:JSON.stringify(s)}),fi=s=>F("/api/generator/preview",{method:"POST",body:JSON.stringify(s)}),hi=(s=!0,e=6)=>F(`/api/dashboard?refresh=${s}&recent_limit=${e}`),mi=(s={})=>{const e=new URLSearchParams;return s.query&&e.set("query",s.query),s.status&&s.status!=="All"&&e.set("status",s.status),s.offset!=null&&e.set("offset",String(s.offset)),s.limit!=null&&e.set("limit",String(s.limit)),s.refresh!=null&&e.set("refresh",String(s.refresh)),F(`/api/tasks?${e}`)},pi=(s,e=!0)=>F(`/api/tasks/${encodeURIComponent(s)}?refresh=${e}`),gi=(s,e,t)=>F("/api/tasks/batch/run",{method:"POST",body:JSON.stringify({task_names:s,execution_mode:e,max_workers:t})}),Ls=s=>F("/api/tasks/batch/delete",{method:"POST",body:JSON.stringify({task_names:s})});async function yi(s){const e=await fetch(`${bn}/api/tasks/export/csv`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({task_names:s})});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.detail||`HTTP ${e.status}`)}return e.blob()}const wn=(s,e)=>F(`/api/tasks/${encodeURIComponent(s)}/run`,{method:"POST",body:JSON.stringify({execution_mode:e})}),kn=s=>F(`/api/tasks/${encodeURIComponent(s)}/cancel`,{method:"POST"}),xi=(s,e)=>F(`/api/tasks/${encodeURIComponent(s)}/pin`,{method:"POST",body:JSON.stringify({pinned:e})}),bi=(s,e)=>F(`/api/tasks/${encodeURIComponent(s)}/notes`,{method:"PATCH",body:JSON.stringify({notes:e})}),wi=(s,e)=>F(`/api/tasks/${encodeURIComponent(s)}/env`,{method:"PATCH",body:JSON.stringify({env:e})}),ki=(s,e)=>F(`/api/tasks/${encodeURIComponent(s)}/rename`,{method:"POST",body:JSON.stringify({new_name:e})}),Is=(s,e,t,n=12e3)=>{const r=new URLSearchParams;return e&&r.set("log_file_name",e),r.set("tail_bytes",String(n)),F(`/api/tasks/${encodeURIComponent(s)}/logs?${r}`)};function Ni(s){const e=location.protocol==="https:"?"wss:":"ws:";return new WebSocket(`${e}//${location.host}/api/tasks/${encodeURIComponent(s)}/logs/stream`)}const vi=()=>F("/api/system/metrics"),ji=()=>F("/api/launcher/scripts"),Si=s=>F(`/api/launcher/configs?script=${encodeURIComponent(s)}`),Ci=(s,e)=>F("/api/launcher/open",{method:"POST",body:JSON.stringify({script_path:s,config_path:e})}),Ms=()=>F("/api/launcher/pick-script",{method:"POST"}),Ti=()=>F("/api/launcher/pick-shell-root",{method:"POST"});let Le=0;const Nn="pyruns_theme",$s="pyruns_manager_cols",Ps="pyruns_generator_cols",Rs="pyruns_pinned_params";function Ai(){return typeof window>"u"?"light":window.localStorage.getItem(Nn)==="dark"?"dark":"light"}function vn(s,e){if(typeof window>"u")return e;const t=window.localStorage.getItem(s);if(!t)return e;const n=Number.parseInt(t,10);return Number.isFinite(n)?n:e}function Oi(s){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(s);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function as(s){typeof document>"u"||(document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(s))}const jn=Ai();as(jn);const os=Ee((s,e)=>({theme:jn,toggle(){const t=e().theme==="dark"?"light":"dark";typeof window<"u"&&window.localStorage.setItem(Nn,t),as(t),s({theme:t})}})),pe=Ee((s,e)=>({workspace:null,lastScriptWorkspace:null,loading:!1,async fetch(){s({loading:!0});try{const t=await oi();s(n=>({workspace:t,lastScriptWorkspace:(t==null?void 0:t.workspace_kind)==="script"?t:n.lastScriptWorkspace}))}finally{s({loading:!1})}},setWorkspace(t){s(n=>({workspace:t,lastScriptWorkspace:(t==null?void 0:t.workspace_kind)==="script"?t:n.lastScriptWorkspace}))},async setRunRoot(t){const n=await _s(t);s(r=>({workspace:n,lastScriptWorkspace:(n==null?void 0:n.workspace_kind)==="script"?n:r.lastScriptWorkspace}))},async openShellWorkspace(){const t=await li();s(n=>({workspace:t,lastScriptWorkspace:n.lastScriptWorkspace}))},async exitShellWorkspace(){const t=e().lastScriptWorkspace;if(!(t!=null&&t.run_root))return null;const n=await _s(t.run_root);return s({workspace:n,lastScriptWorkspace:n}),n}})),Yt=Ee((s,e)=>({tasks:[],total:0,offset:0,limit:50,hasMore:!1,query:"",statusFilter:"All",selectedIds:new Set,loading:!1,columns:vn($s,5),setQuery(t){s({query:t,offset:0})},setStatusFilter(t){s({statusFilter:t,offset:0})},setOffset(t){s({offset:t})},setColumns(t){typeof window<"u"&&window.localStorage.setItem($s,String(t)),s({columns:t})},async fetchTasks(){const{query:t,statusFilter:n,offset:r,limit:i}=e();s({loading:!0});try{const o=await mi({query:t,status:n,offset:r,limit:i});s({tasks:o.items,total:o.total,hasMore:o.has_more})}finally{s({loading:!1})}},toggleSelect(t){const n=new Set(e().selectedIds);n.has(t)?n.delete(t):n.add(t),s({selectedIds:n})},selectAll(){s({selectedIds:new Set(e().tasks.map(t=>t.name))})},clearSelection(){s({selectedIds:new Set})},setSelectedIds(t){s({selectedIds:t})}})),Ei=Ee(s=>({data:null,loading:!1,async fetch(){s({loading:!0});try{const e=await hi();s({data:e})}finally{s({loading:!1})}}})),_i=Ee((s,e)=>({templates:[],selectedTemplate:"",templateContent:null,viewMode:"form",yamlText:"",shellText:"",namePrefix:"task",appendTimestamp:!0,columns:vn(Ps,5),pinnedParams:Oi(Rs),loading:!1,async fetchTemplates(){const t=await ci();s({templates:t.items})},async loadTemplate(t){if(!t){s({selectedTemplate:"",templateContent:null,yamlText:""});return}s({loading:!0,selectedTemplate:t});try{const n=await di(t);s({templateContent:n,yamlText:n.content,shellText:n.mode_hint==="shell"?n.content:e().shellText,viewMode:n.mode_hint==="shell"?"shell":e().viewMode==="shell"?"yaml":e().viewMode})}finally{s({loading:!1})}},clearTemplate(){s({selectedTemplate:"",templateContent:null})},setViewMode(t){s({viewMode:t})},setYamlText(t){s({yamlText:t})},setShellText(t){s({shellText:t})},setNamePrefix(t){s({namePrefix:t})},setAppendTimestamp(t){s({appendTimestamp:t})},setColumns(t){typeof window<"u"&&window.localStorage.setItem(Ps,String(t)),s({columns:t})},togglePin(t){const n=[...e().pinnedParams],r=n.indexOf(t);r>=0?n.splice(r,1):n.push(t),typeof window<"u"&&window.localStorage.setItem(Rs,JSON.stringify(n)),s({pinnedParams:n})}})),qe=Ee((s,e)=>({selectedTaskName:null,logContent:"",logOffset:0,availableLogs:[],selectedLog:"",loading:!1,exportIds:new Set,async selectTask(t){const n=++Le;s({selectedTaskName:t,logContent:"",logOffset:0,availableLogs:[],selectedLog:"",loading:!0});try{const r=await Is(t,void 0,void 0,5e4);if(n!==Le||e().selectedTaskName!==t)return;s({logContent:r.content,logOffset:r.offset,availableLogs:r.available_logs,selectedLog:r.selected_log})}finally{n===Le&&s({loading:!1})}},async selectLogFile(t){const{selectedTaskName:n}=e();if(!n)return;const r=++Le;s({selectedLog:t,logContent:"",logOffset:0,loading:!0});try{const i=await Is(n,t,void 0,5e4);if(r!==Le||e().selectedTaskName!==n||e().selectedLog!==t)return;s({logContent:i.content,logOffset:i.offset,availableLogs:i.available_logs,selectedLog:i.selected_log})}finally{r===Le&&s({loading:!1})}},appendLog(t){s(n=>({logContent:n.logContent+t}))},clearLog(){s({logContent:"",logOffset:0})},toggleExport(t){const n=new Set(e().exportIds);n.has(t)?n.delete(t):n.add(t),s({exportIds:n})},selectAllExport(t){s({exportIds:new Set(t)})},clearExport(){s({exportIds:new Set})}})),Bt=Ee((s,e)=>({scripts:[],configs:[],selectedScript:"",selectedConfig:"",step:0,loading:!1,async fetchScripts(){s({loading:!0});try{const t=await ji();s({scripts:t.items,step:0})}finally{s({loading:!1})}},async selectScript(t){s({selectedScript:t,loading:!0});try{const n=await Si(t);s({configs:n.items,step:1})}finally{s({loading:!1})}},selectConfig(t){s({selectedConfig:t,step:2})},async openWorkspace(){const{selectedScript:t,selectedConfig:n}=e();s({loading:!0});try{const r=await Ci(t,n||void 0);pe.getState().setWorkspace(r)}finally{s({loading:!1})}},reset(){s({scripts:[],configs:[],selectedScript:"",selectedConfig:"",step:0})}})),Li=[{to:"/",icon:zr,label:"Home",end:!0},{to:"/generator",icon:yn,label:"Generator"},{to:"/manager",icon:Wr,label:"Manager"},{to:"/monitor",icon:Be,label:"Monitor"}];function Ii(){var T;const s=pe(b=>b.workspace),e=pe(b=>b.setWorkspace),t=pe(b=>b.openShellWorkspace),n=pe(b=>b.exitShellWorkspace),{theme:r,toggle:i}=os(),o=Tt(),[l,c]=y.useState(!1),[d,p]=y.useState(!1),f=((T=s==null?void 0:s.script_path)==null?void 0:T.split(/[\\/]/).pop())||"",u=(s==null?void 0:s.workspace_kind)==="shell",h=u?"_shell_":f||"Choose .py file",x=()=>{qe.setState({selectedTaskName:null,logContent:"",logOffset:0,availableLogs:[],selectedLog:""})},m=async()=>{c(!0);try{const b=u?await Ti():await Ms();e(b),o("/")}catch{}finally{c(!1)}},g=async()=>{c(!0);try{const b=await Ms();e(b),o("/")}catch{}finally{c(!1)}},N=async()=>{p(!0);try{if(u){if(!await n()){await g();return}}else await t();o("/generator")}finally{p(!1)}};return a.jsxs("aside",{className:"flex h-screen w-sidebar min-w-[180px] max-w-[260px] flex-none flex-col border-r border-border-subtle bg-surface-raised",children:[a.jsxs("div",{className:"flex h-12 items-center gap-2 border-b border-border-subtle px-4",children:[a.jsx(fn,{className:"h-4 w-4 text-accent"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-sm font-semibold tracking-tight text-txt-primary",children:"Pyruns"}),a.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-txt-tertiary",children:u?"shell workspace":"script workspace"})]})]}),a.jsx("nav",{className:"flex flex-1 flex-col gap-1 overflow-y-auto px-2 py-3",children:Li.map(({to:b,icon:j,label:v,end:O})=>a.jsxs(wr,{to:b,end:O,onClick:b==="/monitor"?x:void 0,className:({isActive:A})=>$("flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors",A?"border border-border-subtle bg-surface-overlay text-txt-primary":"border border-transparent text-txt-secondary hover:bg-surface-overlay hover:text-txt-primary"),children:[a.jsx(j,{className:"h-4 w-4 flex-none"}),a.jsx("span",{children:v})]},b))}),a.jsxs("div",{className:"border-t border-border-subtle p-3",children:[a.jsxs("button",{type:"button",onClick:m,disabled:l,className:"w-full rounded-xl border border-border-subtle bg-surface-overlay/60 px-3 py-3.5 text-left transition-colors hover:border-border hover:bg-surface-overlay disabled:opacity-60",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-txt-tertiary",children:[a.jsx(At,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:u?"Shell Folder":"Script File"}),a.jsx("div",{className:"flex-1 border-t border-border-subtle/80"}),l?a.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Mr,{className:"h-3.5 w-3.5"})]}),a.jsx("div",{className:"mt-3 truncate rounded-lg border border-border-subtle bg-surface-raised px-3 py-2 font-mono text-sm font-medium text-txt-primary",title:h,children:h}),a.jsx("div",{className:"mt-3 text-[10px] uppercase tracking-[0.18em] text-txt-tertiary",children:"Workspace"}),a.jsx("div",{className:"mt-1 truncate text-2xs text-txt-secondary",title:(s==null?void 0:s.run_root)||"Choose a Python script or choose a shell workspace folder",children:(s==null?void 0:s.run_root)||"Choose a Python script or choose a shell workspace folder"})]}),a.jsxs("button",{type:"button",onClick:()=>void N(),disabled:d,className:$("mt-2 flex w-full items-center justify-center gap-2 rounded-lg border px-3 py-2 text-sm font-medium transition-colors disabled:opacity-60",u?"border-accent/25 bg-accent/10 text-accent":"border-border-subtle bg-surface-raised text-txt-secondary hover:bg-surface-overlay hover:text-txt-primary"),title:u?"Exit shell mode":"Open the shared shell workspace",children:[d?a.jsx(Ts,{className:"h-4 w-4 animate-spin"}):a.jsx(Be,{className:"h-4 w-4"}),a.jsx("span",{children:u?"Exit Shell Mode":"Open Shell Mode"})]}),a.jsxs("button",{type:"button",onClick:i,className:"mt-2 flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-txt-secondary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:[r==="dark"?a.jsx(si,{className:"h-4 w-4"}):a.jsx(Hr,{className:"h-4 w-4"}),a.jsx("span",{children:r==="dark"?"Light Mode":"Dark Mode"})]})]})]})}function Mi(){return a.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-surface-base",children:[a.jsx(Ii,{}),a.jsx("main",{className:"flex-1 min-w-0 overflow-hidden",children:a.jsx(kr,{})})]})}function ls(s,e,t=!0,n=!0){const r=y.useRef(s);r.current=s,y.useEffect(()=>{if(!t)return;const i=()=>{typeof document<"u"&&document.visibilityState==="hidden"||r.current()};n&&i();const o=setInterval(i,e);return()=>clearInterval(o)},[e,t,n])}const Bs={pending:{bg:"bg-gray-500/10",text:"text-gray-400",dot:"bg-gray-400",border:"border-gray-500/20"},queued:{bg:"bg-blue-500/10",text:"text-blue-400",dot:"bg-blue-400",border:"border-blue-500/20"},running:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"bg-amber-400",border:"border-amber-500/20"},completed:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"bg-emerald-400",border:"border-emerald-500/20"},failed:{bg:"bg-rose-500/10",text:"text-rose-400",dot:"bg-rose-400",border:"border-rose-500/20"}},$i={pending:"Pending",queued:"Queued",running:"Running",completed:"Completed",failed:"Failed"},Pi=["pending","queued","running","completed","failed"],Ri={str:"border-sky-500/25 bg-sky-500/10 text-sky-700 dark:text-sky-300",int:"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",float:"border-teal-500/25 bg-teal-500/10 text-teal-700 dark:text-teal-300",bool:"border-fuchsia-500/25 bg-fuchsia-500/10 text-fuchsia-700 dark:text-fuchsia-300",list:"border-violet-500/25 bg-violet-500/10 text-violet-700 dark:text-violet-300",null:"border-slate-500/25 bg-slate-500/10 text-slate-700 dark:text-slate-300"};function Ot({status:s,size:e="sm"}){const t=Bs[s]||Bs.pending;return a.jsxs("span",{className:$("inline-flex items-center gap-1.5 rounded-full border font-medium capitalize",t.bg,t.text,t.border,e==="sm"?"px-2.5 py-1 text-2xs":"px-3 py-1.5 text-xs"),children:[a.jsx("span",{className:$("w-1.5 h-1.5 rounded-full",t.dot)}),s]})}const Bi=[{key:"total",label:"Total Tasks",icon:Ur,color:"text-txt-secondary"},{key:"running",label:"Running",icon:Lr,color:"text-amber-400"},{key:"completed",label:"Completed",icon:$r,color:"text-emerald-400"},{key:"failed",label:"Failed",icon:Pr,color:"text-rose-400"}];function Di(){var T,b,j;const{data:s,loading:e,fetch:t}=Ei(),n=pe(v=>v.workspace),r=Tt(),[i,o]=y.useState(null),[l,c]=y.useState(null),d=Number(((T=n==null?void 0:n.settings)==null?void 0:T.header_refresh_interval)??3),p=Number.isFinite(d)?Math.max(1,d):3,f=y.useCallback(()=>{t(),vi().then(o).catch(()=>{})},[t]),u=y.useCallback(v=>{qe.getState().selectTask(v.name),r("/monitor")},[r]);ls(f,p*1e3,!0,!0);const h=s==null?void 0:s.summary,x=(i==null?void 0:i.gpus.find(v=>qt(v)===l))??null,m=(i==null?void 0:i.gpus.length)??0,g=(i==null?void 0:i.gpus.reduce((v,O)=>v+O.processes.length,0))??0,N=m?((i==null?void 0:i.gpus.reduce((v,O)=>v+O.util,0))??0)/m:0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"h-full overflow-y-auto p-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h1",{className:"text-lg font-semibold text-txt-primary",children:"Dashboard"}),a.jsx("p",{className:"mt-1 text-xs text-txt-tertiary",children:n!=null&&n.script_name?`Workspace: ${n.script_name}`:"Welcome to Pyruns"})]}),a.jsx("div",{className:"mb-6 grid grid-cols-2 gap-3 lg:grid-cols-4",children:Bi.map(({key:v,label:O,icon:A,color:C})=>a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-surface-raised p-4",children:[a.jsx("div",{className:$("rounded-md bg-surface-overlay p-2",C),children:a.jsx(A,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xl font-semibold tabular-nums text-txt-primary",children:e?"--":(h==null?void 0:h[v])??0}),a.jsx("div",{className:"text-2xs text-txt-tertiary",children:O})]})]},v))}),a.jsxs("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,2.2fr)_minmax(18rem,1fr)]",children:[a.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-raised",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border-subtle px-4 py-3",children:[a.jsx("h2",{className:"text-sm font-medium text-txt-primary",children:"Recent Tasks"}),a.jsxs("button",{type:"button",onClick:()=>r("/manager"),className:"flex items-center gap-1 text-2xs text-txt-tertiary transition-colors hover:text-accent",children:["View all ",a.jsx(dn,{className:"h-3 w-3"})]})]}),a.jsx("div",{className:"divide-y divide-border-subtle",children:(b=s==null?void 0:s.recent_tasks)!=null&&b.length?s.recent_tasks.map(v=>a.jsx(Fi,{task:v,onClick:()=>u(v)},v.name)):a.jsx("div",{className:"px-4 py-8 text-center text-xs text-txt-tertiary",children:"No tasks yet"})})]}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-raised p-4",children:[a.jsx("h2",{className:"mb-3 text-sm font-medium text-txt-primary",children:"Workspace"}),a.jsxs("div",{className:"space-y-2 text-xs",children:[a.jsx(Kt,{label:"Script",value:(n==null?void 0:n.script_name)||"--"}),a.jsx(Kt,{label:"Templates",value:String((s==null?void 0:s.template_count)??0)}),a.jsx(Kt,{label:"Path",value:(n==null?void 0:n.run_root)||"--",mono:!0})]}),a.jsxs("button",{type:"button",onClick:()=>r("/generator"),className:"mt-4 flex w-full items-center justify-center gap-2 rounded-md bg-accent/10 px-3 py-2 text-xs font-medium text-accent transition-colors hover:bg-accent/20",children:[a.jsx(yn,{className:"h-3.5 w-3.5"})," Generate Tasks"]})]}),a.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-raised p-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-medium text-txt-primary",children:"System"}),a.jsxs("p",{className:"mt-1 text-2xs text-txt-tertiary",children:["Auto-refreshes every ",p,"s."]})]}),m>0&&a.jsxs("div",{className:"rounded-full border border-sky-500/15 bg-sky-500/8 px-2.5 py-1 text-2xs text-sky-300",children:[m," GPU",m>1?"s":""," online"]})]}),i?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mt-3 space-y-2.5",children:[a.jsx(Ds,{label:"CPU",value:i.cpu_percent,icon:Rr}),a.jsx(Ds,{label:"RAM",value:i.mem_percent,icon:Gr})]}),a.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:grid-cols-3 xl:grid-cols-1",children:[a.jsx(Ft,{label:"GPU Util Avg",value:`${N.toFixed(0)}%`,tone:"sky"}),a.jsx(Ft,{label:"GPU Processes",value:String(g),tone:g?"emerald":"slate"}),a.jsx(Ft,{label:"Refresh",value:`${p}s`,tone:"slate"})]})]}):a.jsx("div",{className:"mt-3 rounded-lg border border-dashed border-border-subtle bg-surface-overlay/50 px-3 py-4 text-2xs text-txt-tertiary",children:"Loading system metrics..."})]})]})]}),a.jsxs("div",{className:"mt-4 rounded-lg border border-border-subtle bg-surface-raised",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border-subtle px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-medium text-txt-primary",children:"GPU Fleet"}),a.jsx("p",{className:"mt-1 text-2xs text-txt-tertiary",children:"Click any GPU card to inspect active processes and VRAM usage."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-2xs",children:[a.jsxs(Ks,{children:[m," GPU",m===1?"":"s"]}),a.jsxs(Ks,{children:[g," active proc",g===1?"":"s"]})]})]}),a.jsx("div",{className:"p-4",children:(j=i==null?void 0:i.gpus)!=null&&j.length?a.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-3",children:i.gpus.map(v=>a.jsx(Ki,{gpu:v,onClick:()=>c(qt(v))},qt(v)))}):a.jsx("div",{className:"rounded-lg border border-dashed border-border-subtle bg-surface-overlay/50 px-3 py-8 text-center text-2xs text-txt-tertiary",children:"No NVIDIA GPU metrics detected."})})]})]}),a.jsx(qi,{gpu:x,onClose:()=>c(null)})]})}function Fi({task:s,onClick:e}){return a.jsxs("button",{type:"button",onClick:e,className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-surface-overlay",children:[a.jsx(Ot,{status:s.status}),a.jsx("span",{className:"flex-1 truncate text-sm text-txt-primary",children:s.name}),a.jsx("span",{className:"flex-none font-mono text-2xs text-txt-tertiary",children:s.created_at})]})}function Ds({label:s,value:e,icon:t}){const n=Math.min(100,Math.max(0,e)),r=n>90?"bg-rose-500":n>70?"bg-amber-500":"bg-emerald-500";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(t,{className:"h-3.5 w-3.5 flex-none text-txt-tertiary"}),a.jsx("span",{className:"w-8 flex-none text-2xs text-txt-secondary",children:s}),a.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-overlay",children:a.jsx("div",{className:$("h-full rounded-full transition-all duration-500",r),style:{width:`${n}%`}})}),a.jsxs("span",{className:"w-10 text-right text-2xs tabular-nums text-txt-secondary",children:[n.toFixed(0),"%"]})]})}function Ki({gpu:s,onClick:e}){const t=s.mem_total>0?s.mem_used/s.mem_total*100:0,n=s.processes.length;return a.jsxs("button",{type:"button",onClick:e,className:"w-full rounded-lg border border-sky-500/15 bg-[linear-gradient(135deg,rgba(14,165,233,0.12),rgba(30,41,59,0.18))] px-3 py-3 text-left transition-colors hover:border-sky-400/30 hover:bg-[linear-gradient(135deg,rgba(14,165,233,0.18),rgba(30,41,59,0.28))]",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"text-xs font-semibold text-txt-primary",children:["GPU ",s.index]}),a.jsx("div",{className:"truncate text-2xs text-sky-100/80",children:s.name})]}),a.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-sky-400/20 bg-sky-500/10 px-2 py-1 text-2xs text-sky-200",children:[a.jsxs("span",{className:"font-medium tabular-nums",children:[s.util.toFixed(0),"%"]}),a.jsx("span",{children:"util"})]})]}),a.jsxs("div",{className:"mt-3 space-y-2",children:[a.jsx(Fs,{label:"Compute",value:s.util,tone:"util"}),a.jsx(Fs,{label:"VRAM",value:t,tone:"memory"})]}),a.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-2xs text-txt-secondary",children:[a.jsxs("span",{className:"tabular-nums",children:[nt(s.mem_used)," / ",nt(s.mem_total)]}),a.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[n," proc",n===1?"":"s",a.jsx(Ae,{className:"h-3 w-3"})]})]})]})}function Fs({label:s,value:e,tone:t}){const n=Math.min(100,Math.max(0,e)),r=t==="memory"?n>92?"bg-rose-400":n>75?"bg-amber-400":"bg-cyan-400":n>92?"bg-rose-400":n>75?"bg-amber-400":"bg-emerald-400";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-12 flex-none text-2xs text-txt-secondary",children:s}),a.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-overlay/80",children:a.jsx("div",{className:$("h-full rounded-full transition-all duration-500",r),style:{width:`${n}%`}})}),a.jsxs("span",{className:"w-10 text-right text-2xs tabular-nums text-txt-secondary",children:[n.toFixed(0),"%"]})]})}function qi({gpu:s,onClose:e}){if(!s)return null;const t=s.mem_total>0?s.mem_used/s.mem_total*100:0;return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:e,children:a.jsxs("div",{className:"w-full max-w-2xl rounded-2xl border border-border-subtle bg-surface-raised shadow-[0_24px_80px_-48px_rgba(15,23,42,0.95)]",onClick:n=>n.stopPropagation(),children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-border-subtle px-5 py-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-xs uppercase tracking-[0.18em] text-txt-tertiary",children:"GPU Detail"}),a.jsxs("div",{className:"mt-1 truncate text-base font-semibold text-txt-primary",children:["GPU ",s.index," | ",s.name]}),a.jsx("div",{className:"mt-1 truncate font-mono text-2xs text-txt-tertiary",children:s.uuid})]}),a.jsx("button",{type:"button",onClick:e,className:"rounded-lg p-1 text-txt-tertiary transition-colors hover:bg-surface-hover hover:text-txt-primary",children:a.jsx(De,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 border-b border-border-subtle px-5 py-4 sm:grid-cols-3",children:[a.jsx(Dt,{label:"Compute",value:`${s.util.toFixed(0)}%`,tone:"emerald"}),a.jsx(Dt,{label:"VRAM",value:`${nt(s.mem_used)} / ${nt(s.mem_total)}`,tone:"sky"}),a.jsx(Dt,{label:"Processes",value:String(s.processes.length),tone:t>85?"amber":"slate"})]}),a.jsx("div",{className:"max-h-[420px] overflow-y-auto px-5 py-4",children:s.processes.length===0?a.jsx("div",{className:"rounded-xl border border-dashed border-border-subtle bg-surface-overlay/60 px-4 py-8 text-center text-sm text-txt-tertiary",children:"No active compute processes reported by NVIDIA for this GPU."}):a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border-subtle",children:[a.jsxs("div",{className:"grid grid-cols-[96px_minmax(0,1fr)_140px] gap-3 border-b border-border-subtle bg-surface-overlay/70 px-4 py-2 text-2xs uppercase tracking-[0.18em] text-txt-tertiary",children:[a.jsx("span",{children:"PID"}),a.jsx("span",{children:"Process"}),a.jsx("span",{className:"text-right",children:"VRAM"})]}),s.processes.map(n=>a.jsxs("div",{className:"grid grid-cols-[96px_minmax(0,1fr)_140px] gap-3 border-b border-border-subtle/80 px-4 py-3 text-sm last:border-b-0",children:[a.jsx("span",{className:"font-mono text-txt-secondary",children:n.pid>=0?n.pid:"--"}),a.jsx("span",{className:"truncate text-txt-primary",title:n.name,children:n.name}),a.jsx("span",{className:"text-right font-mono text-txt-secondary",children:nt(n.memory_mb)})]},`${n.pid}-${n.name}`))]})})]})})}function Dt({label:s,value:e,tone:t}){const n={emerald:"border-emerald-500/20 bg-emerald-500/10 text-emerald-300",sky:"border-sky-500/20 bg-sky-500/10 text-sky-300",amber:"border-amber-500/20 bg-amber-500/10 text-amber-300",slate:"border-border-subtle bg-surface-overlay text-txt-secondary"}[t];return a.jsxs("div",{className:$("rounded-xl border px-3 py-3",n),children:[a.jsx("div",{className:"text-2xs uppercase tracking-[0.18em] text-txt-tertiary",children:s}),a.jsx("div",{className:"mt-1 truncate text-sm font-semibold",children:e})]})}function Ft({label:s,value:e,tone:t}){const n={emerald:"border-emerald-500/15 bg-emerald-500/10 text-emerald-300",sky:"border-sky-500/15 bg-sky-500/10 text-sky-300",slate:"border-border-subtle bg-surface-overlay text-txt-secondary"}[t];return a.jsxs("div",{className:$("rounded-lg border px-3 py-2.5",n),children:[a.jsx("div",{className:"text-2xs uppercase tracking-[0.18em] text-txt-tertiary",children:s}),a.jsx("div",{className:"mt-1 text-sm font-semibold",children:e})]})}function Ks({children:s}){return a.jsx("span",{className:"rounded-full border border-border-subtle bg-surface-overlay px-2.5 py-1 text-txt-secondary",children:s})}function Kt({label:s,value:e,mono:t}){return a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"w-16 flex-none text-txt-tertiary",children:s}),a.jsx("span",{className:$("truncate text-txt-secondary",t&&"font-mono text-2xs"),title:e,children:e})]})}function qt(s){return s.uuid||`${s.id}`}function nt(s){return!Number.isFinite(s)||s<=0?"0 MB":s>=1024?`${(s/1024).toFixed(s>=10240?0:1)} GB`:`${s.toFixed(s>=100?0:1)} MB`}const cs=Symbol.for("yaml.alias"),Qt=Symbol.for("yaml.document"),ke=Symbol.for("yaml.map"),Sn=Symbol.for("yaml.pair"),de=Symbol.for("yaml.scalar"),Ve=Symbol.for("yaml.seq"),ie=Symbol.for("yaml.node.type"),_e=s=>!!s&&typeof s=="object"&&s[ie]===cs,ct=s=>!!s&&typeof s=="object"&&s[ie]===Qt,dt=s=>!!s&&typeof s=="object"&&s[ie]===ke,z=s=>!!s&&typeof s=="object"&&s[ie]===Sn,D=s=>!!s&&typeof s=="object"&&s[ie]===de,ut=s=>!!s&&typeof s=="object"&&s[ie]===Ve;function q(s){if(s&&typeof s=="object")switch(s[ie]){case ke:case Ve:return!0}return!1}function U(s){if(s&&typeof s=="object")switch(s[ie]){case cs:case ke:case de:case Ve:return!0}return!1}const Cn=s=>(D(s)||q(s))&&!!s.anchor,je=Symbol("break visit"),Ui=Symbol("skip children"),rt=Symbol("remove node");function We(s,e){const t=zi(e);ct(s)?$e(null,s.contents,t,Object.freeze([s]))===rt&&(s.contents=null):$e(null,s,t,Object.freeze([]))}We.BREAK=je;We.SKIP=Ui;We.REMOVE=rt;function $e(s,e,t,n){const r=Vi(s,e,t,n);if(U(r)||z(r))return Wi(s,n,r),$e(s,r,t,n);if(typeof r!="symbol"){if(q(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){const o=$e(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===je)return je;o===rt&&(e.items.splice(i,1),i-=1)}}}else if(z(e)){n=Object.freeze(n.concat(e));const i=$e("key",e.key,t,n);if(i===je)return je;i===rt&&(e.key=null);const o=$e("value",e.value,t,n);if(o===je)return je;o===rt&&(e.value=null)}}return r}function zi(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Vi(s,e,t,n){var r,i,o,l,c;if(typeof t=="function")return t(s,e,n);if(dt(e))return(r=t.Map)==null?void 0:r.call(t,s,e,n);if(ut(e))return(i=t.Seq)==null?void 0:i.call(t,s,e,n);if(z(e))return(o=t.Pair)==null?void 0:o.call(t,s,e,n);if(D(e))return(l=t.Scalar)==null?void 0:l.call(t,s,e,n);if(_e(e))return(c=t.Alias)==null?void 0:c.call(t,s,e,n)}function Wi(s,e,t){const n=e[e.length-1];if(q(n))n.items[s]=t;else if(z(n))s==="key"?n.key=t:n.value=t;else if(ct(n))n.contents=t;else{const r=_e(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const Gi={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Hi=s=>s.replace(/[!,[\]{}]/g,e=>Gi[e]);class X{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},X.defaultYaml,e),this.tags=Object.assign({},X.defaultTags,t)}clone(){const e=new X(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new X(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:X.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},X.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:X.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},X.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[i,o]=n;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);const i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Hi(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let r;if(e&&n.length>0&&U(e.contents)){const i={};We(e.contents,(o,l)=>{U(l)&&l.tag&&(i[l.tag]=!0)}),r=Object.keys(i)}else r=[];for(const[i,o]of n)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(l=>l.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
`)}}X.defaultYaml={explicit:!1,version:"1.2"};X.defaultTags={"!!":"tag:yaml.org,2002:"};function Tn(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function An(s){const e=new Set;return We(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function On(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function Ji(s,e){const t=[],n=new Map;let r=null;return{onAnchor:i=>{t.push(i),r??(r=An(s));const o=On(e,r);return r.add(o),o},setAnchors:()=>{for(const i of t){const o=n.get(i);if(typeof o=="object"&&o.anchor&&(D(o.node)||q(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=i,l}}},sourceObjects:n}}function Pe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,i=n.length;r<i;++r){const o=n[r],l=Pe(s,n,String(r),o);l===void 0?delete n[r]:l!==o&&(n[r]=l)}else if(n instanceof Map)for(const r of Array.from(n.keys())){const i=n.get(r),o=Pe(s,n,r,i);o===void 0?n.delete(r):o!==i&&n.set(r,o)}else if(n instanceof Set)for(const r of Array.from(n)){const i=Pe(s,n,r,r);i===void 0?n.delete(r):i!==r&&(n.delete(r),n.add(i))}else for(const[r,i]of Object.entries(n)){const o=Pe(s,n,r,i);o===void 0?delete n[r]:o!==i&&(n[r]=o)}return s.call(e,t,n)}function re(s,e,t){if(Array.isArray(s))return s.map((n,r)=>re(n,String(r),t));if(s&&typeof s.toJSON=="function"){if(!t||!Cn(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=i=>{n.res=i,delete t.onCreate};const r=s.toJSON(e,t);return t.onCreate&&t.onCreate(r),r}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}class ds{constructor(e){Object.defineProperty(this,ie,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!ct(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=re(this,"",o);if(typeof r=="function")for(const{count:c,res:d}of o.anchors.values())r(d,c);return typeof i=="function"?Pe(i,{"":l},"",l):l}}class us extends ds{constructor(e){super(cs),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t!=null&&t.aliasResolveCache?n=t.aliasResolveCache:(n=[],We(e,{Node:(i,o)=>{(_e(o)||Cn(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let r;for(const i of n){if(i===this)break;i.anchor===this.source&&(r=i)}return r}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=n.get(o);if(l||(re(o,null,t),l=n.get(o)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Nt(r,o,n)),l.count*l.aliasCount>i)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(e,t,n){const r=`*${this.source}`;if(e){if(Tn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${r} `}return r}}function Nt(s,e,t){if(_e(e)){const n=e.resolve(s),r=t&&n&&t.get(n);return r?r.count*r.aliasCount:0}else if(q(e)){let n=0;for(const r of e.items){const i=Nt(s,r,t);i>n&&(n=i)}return n}else if(z(e)){const n=Nt(s,e.key,t),r=Nt(s,e.value,t);return Math.max(n,r)}return 1}const En=s=>!s||typeof s!="function"&&typeof s!="object";class I extends ds{constructor(e){super(de),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:re(this.value,e,t)}toString(){return String(this.value)}}I.BLOCK_FOLDED="BLOCK_FOLDED";I.BLOCK_LITERAL="BLOCK_LITERAL";I.PLAIN="PLAIN";I.QUOTE_DOUBLE="QUOTE_DOUBLE";I.QUOTE_SINGLE="QUOTE_SINGLE";const Yi="tag:yaml.org,2002:";function Qi(s,e,t){if(e){const n=t.filter(i=>i.tag===e),r=n.find(i=>!i.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(n=>{var r;return((r=n.identify)==null?void 0:r.call(n,s))&&!n.format})}function at(s,e,t){var f,u,h;if(ct(s)&&(s=s.contents),U(s))return s;if(z(s)){const x=(u=(f=t.schema[ke]).createNode)==null?void 0:u.call(f,t.schema,null,t);return x.items.push(s),x}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:r,onTagObj:i,schema:o,sourceObjects:l}=t;let c;if(n&&s&&typeof s=="object"){if(c=l.get(s),c)return c.anchor??(c.anchor=r(s)),new us(c.anchor);c={anchor:null,node:null},l.set(s,c)}e!=null&&e.startsWith("!!")&&(e=Yi+e.slice(2));let d=Qi(s,e,o.tags);if(!d){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const x=new I(s);return c&&(c.node=x),x}d=s instanceof Map?o[ke]:Symbol.iterator in Object(s)?o[Ve]:o[ke]}i&&(i(d),delete t.onTagObj);const p=d!=null&&d.createNode?d.createNode(t.schema,s,t):typeof((h=d==null?void 0:d.nodeClass)==null?void 0:h.from)=="function"?d.nodeClass.from(t.schema,s,t):new I(s);return e?p.tag=e:d.default||(p.tag=d.tag),c&&(c.node=p),p}function St(s,e,t){let n=t;for(let r=e.length-1;r>=0;--r){const i=e[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const o=[];o[i]=n,n=o}else n=new Map([[i,n]])}return at(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const tt=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class _n extends ds{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>U(n)||z(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(tt(e))this.add(t);else{const[n,...r]=e,i=this.get(n,!0);if(q(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,St(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const r=this.get(t,!0);if(q(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&D(i)?i.value:i:q(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!z(t))return!1;const n=t.value;return n==null||e&&D(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const r=this.get(t,!0);return q(r)?r.hasIn(n):!1}setIn(e,t){const[n,...r]=e;if(r.length===0)this.set(n,t);else{const i=this.get(n,!0);if(q(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,St(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}const Xi=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function ge(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const Se=(s,e,t)=>s.endsWith(`
`)?ge(t,e):t.includes(`
`)?`
`+ge(t,e):(s.endsWith(" ")?"":" ")+t,Ln="flow",Xt="block",vt="quoted";function Et(s,e,t="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:l}={}){if(!r||r<0)return s;r<i&&(i=0);const c=Math.max(1+i,1+r-e.length);if(s.length<=c)return s;const d=[],p={};let f=r-e.length;typeof n=="number"&&(n>r-Math.max(2,i)?d.push(0):f=r-n);let u,h,x=!1,m=-1,g=-1,N=-1;t===Xt&&(m=qs(s,m,e.length),m!==-1&&(f=m+c));for(let b;b=s[m+=1];){if(t===vt&&b==="\\"){switch(g=m,s[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}N=m}if(b===`
`)t===Xt&&(m=qs(s,m,e.length)),f=m+e.length+c,u=void 0;else{if(b===" "&&h&&h!==" "&&h!==`
`&&h!=="	"){const j=s[m+1];j&&j!==" "&&j!==`
`&&j!=="	"&&(u=m)}if(m>=f)if(u)d.push(u),f=u+c,u=void 0;else if(t===vt){for(;h===" "||h==="	";)h=b,b=s[m+=1],x=!0;const j=m>N+1?m-2:g-1;if(p[j])return s;d.push(j),p[j]=!0,f=j+c,u=void 0}else x=!0}h=b}if(x&&l&&l(),d.length===0)return s;o&&o();let T=s.slice(0,d[0]);for(let b=0;b<d.length;++b){const j=d[b],v=d[b+1]||s.length;j===0?T=`
${e}${s.slice(0,v)}`:(t===vt&&p[j]&&(T+=`${s[j]}\\`),T+=`
${e}${s.slice(j+1,v)}`)}return T}function qs(s,e,t){let n=e,r=e+1,i=s[r];for(;i===" "||i==="	";)if(e<r+t)i=s[++e];else{do i=s[++e];while(i&&i!==`
`);n=e,r=e+1,i=s[r]}return n}const _t=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Lt=s=>/^(%|---|\.\.\.)/m.test(s);function Zi(s,e,t){if(!e||e<0)return!1;const n=e-t,r=s.length;if(r<=n)return!1;for(let i=0,o=0;i<r;++i)if(s[i]===`
`){if(i-o>n)return!0;if(o=i+1,r-o<=n)return!1}return!0}function it(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Lt(s)?"  ":"");let o="",l=0;for(let c=0,d=t[c];d;d=t[++c])if(d===" "&&t[c+1]==="\\"&&t[c+2]==="n"&&(o+=t.slice(l,c)+"\\ ",c+=1,l=c,d="\\"),d==="\\")switch(t[c+1]){case"u":{o+=t.slice(l,c);const p=t.substr(c+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=t.substr(c,6)}c+=5,l=c+1}break;case"n":if(n||t[c+2]==='"'||t.length<r)c+=1;else{for(o+=t.slice(l,c)+`

`;t[c+2]==="\\"&&t[c+3]==="n"&&t[c+4]!=='"';)o+=`
`,c+=2;o+=i,t[c+2]===" "&&(o+="\\"),c+=1,l=c+1}break;default:c+=1}return o=l?o+t.slice(l):t,n?o:Et(o,i,vt,_t(e,!1))}function Zt(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
`)||/[ \t]\n|\n[ \t]/.test(s))return it(s,e);const t=e.indent||(Lt(s)?"  ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
${t}`)+"'";return e.implicitKey?n:Et(n,t,Ln,_t(e,!1))}function Re(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=it;else{const r=s.includes('"'),i=s.includes("'");r&&!i?n=Zt:i&&!r?n=it:n=t?Zt:it}return n(s,e)}let es;try{es=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{es=/\n+(?!\n|$)/g}function jt({comment:s,type:e,value:t},n,r,i){const{blockQuote:o,commentString:l,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(t))return Re(t,n);const d=n.indent||(n.forceBlockIndent||Lt(t)?"  ":""),p=o==="literal"?!0:o==="folded"||e===I.BLOCK_FOLDED?!1:e===I.BLOCK_LITERAL?!0:!Zi(t,c,d.length);if(!t)return p?`|
`:`>
`;let f,u;for(u=t.length;u>0;--u){const v=t[u-1];if(v!==`
`&&v!=="	"&&v!==" ")break}let h=t.substring(u);const x=h.indexOf(`
`);x===-1?f="-":t===h||x!==h.length-1?(f="+",i&&i()):f="",h&&(t=t.slice(0,-h.length),h[h.length-1]===`
`&&(h=h.slice(0,-1)),h=h.replace(es,`$&${d}`));let m=!1,g,N=-1;for(g=0;g<t.length;++g){const v=t[g];if(v===" ")m=!0;else if(v===`
`)N=g;else break}let T=t.substring(0,N<g?N+1:g);T&&(t=t.substring(T.length),T=T.replace(/\n+/g,`$&${d}`));let j=(m?d?"2":"1":"")+f;if(s&&(j+=" "+l(s.replace(/ ?[\r\n]+/g," ")),r&&r()),!p){const v=t.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`);let O=!1;const A=_t(n,!0);o!=="folded"&&e!==I.BLOCK_FOLDED&&(A.onOverflow=()=>{O=!0});const C=Et(`${T}${v}${h}`,d,Xt,A);if(!O)return`>${j}
${d}${C}`}return t=t.replace(/\n+/g,`$&${d}`),`|${j}
${d}${T}${t}${h}`}function ea(s,e,t,n){const{type:r,value:i}=s,{actualString:o,implicitKey:l,indent:c,indentStep:d,inFlow:p}=e;if(l&&i.includes(`
`)||p&&/[[\]{},]/.test(i))return Re(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return l||p||!i.includes(`
`)?Re(i,e):jt(s,e,t,n);if(!l&&!p&&r!==I.PLAIN&&i.includes(`
`))return jt(s,e,t,n);if(Lt(i)){if(c==="")return e.forceBlockIndent=!0,jt(s,e,t,n);if(l&&c===d)return Re(i,e)}const f=i.replace(/\n+/g,`$&
${c}`);if(o){const u=m=>{var g;return m.default&&m.tag!=="tag:yaml.org,2002:str"&&((g=m.test)==null?void 0:g.test(f))},{compat:h,tags:x}=e.doc.schema;if(x.some(u)||h!=null&&h.some(u))return Re(i,e)}return l?f:Et(f,c,Ln,_t(e,!1))}function fs(s,e,t,n){const{implicitKey:r,inFlow:i}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==I.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=I.QUOTE_DOUBLE);const c=p=>{switch(p){case I.BLOCK_FOLDED:case I.BLOCK_LITERAL:return r||i?Re(o.value,e):jt(o,e,t,n);case I.QUOTE_DOUBLE:return it(o.value,e);case I.QUOTE_SINGLE:return Zt(o.value,e);case I.PLAIN:return ea(o,e,t,n);default:return null}};let d=c(l);if(d===null){const{defaultKeyType:p,defaultStringType:f}=e.options,u=r&&p||f;if(d=c(u),d===null)throw new Error(`Unsupported default string type ${u}`)}return d}function In(s,e){const t=Object.assign({blockQuote:!0,commentString:Xi,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):"  ",inFlow:n,options:t}}function ta(s,e){var r;if(e.tag){const i=s.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let t,n;if(D(e)){n=e.value;let i=s.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,n)});if(i.length>1){const o=i.filter(l=>l.test);o.length>0&&(i=o)}t=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=((r=n==null?void 0:n.constructor)==null?void 0:r.name)??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function sa(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const r=[],i=(D(s)||q(s))&&s.anchor;i&&Tn(i)&&(t.add(i),r.push(`&${i}`));const o=s.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function Ue(s,e,t,n){var c;if(z(s))return s.toString(e,t,n);if(_e(s)){if(e.doc.directives)return s.toString(e);if((c=e.resolvedAliases)!=null&&c.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r;const i=U(s)?s:e.doc.createNode(s,{onTagObj:d=>r=d});r??(r=ta(e.doc.schema.tags,i));const o=sa(i,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof r.stringify=="function"?r.stringify(i,e,t,n):D(i)?fs(i,e,t,n):i.toString(e,t,n);return o?D(i)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
${e.indent}${l}`:l}function na({key:s,value:e},t,n,r){const{allNullValues:i,doc:o,indent:l,indentStep:c,options:{commentString:d,indentSeq:p,simpleKeys:f}}=t;let u=U(s)&&s.comment||null;if(f){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(q(s)||!U(s)&&typeof s=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let h=!f&&(!s||u&&e==null&&!t.inFlow||q(s)||(D(s)?s.type===I.BLOCK_FOLDED||s.type===I.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!h&&(f||!i),indent:l+c});let x=!1,m=!1,g=Ue(s,t,()=>x=!0,()=>m=!0);if(!h&&!t.inFlow&&g.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(t.inFlow){if(i||e==null)return x&&n&&n(),g===""?"?":h?`? ${g}`:g}else if(i&&!f||e==null&&h)return g=`? ${g}`,u&&!x?g+=Se(g,t.indent,d(u)):m&&r&&r(),g;x&&(u=null),h?(u&&(g+=Se(g,t.indent,d(u))),g=`? ${g}
${l}:`):(g=`${g}:`,u&&(g+=Se(g,t.indent,d(u))));let N,T,b;U(e)?(N=!!e.spaceBefore,T=e.commentBefore,b=e.comment):(N=!1,T=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!h&&!u&&D(e)&&(t.indentAtStart=g.length+1),m=!1,!p&&c.length>=2&&!t.inFlow&&!h&&ut(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let j=!1;const v=Ue(e,t,()=>j=!0,()=>m=!0);let O=" ";if(u||N||T){if(O=N?`
`:"",T){const A=d(T);O+=`
${ge(A,t.indent)}`}v===""&&!t.inFlow?O===`
`&&b&&(O=`

`):O+=`
${t.indent}`}else if(!h&&q(e)){const A=v[0],C=v.indexOf(`
`),E=C!==-1,R=t.inFlow??e.flow??e.items.length===0;if(E||!R){let V=!1;if(E&&(A==="&"||A==="!")){let W=v.indexOf(" ");A==="&"&&W!==-1&&W<C&&v[W+1]==="!"&&(W=v.indexOf(" ",W+1)),(W===-1||C<W)&&(V=!0)}V||(O=`
${t.indent}`)}}else(v===""||v[0]===`
`)&&(O="");return g+=O+v,t.inFlow?j&&n&&n():b&&!j?g+=Se(g,t.indent,d(b)):m&&r&&r(),g}function Mn(s,e){(s==="debug"||s==="warn")&&console.warn(e)}const gt="<<",ye={identify:s=>s===gt||typeof s=="symbol"&&s.description===gt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I(Symbol(gt)),{addToJSMap:$n}),stringify:()=>gt},ra=(s,e)=>(ye.identify(e)||D(e)&&(!e.type||e.type===I.PLAIN)&&ye.identify(e.value))&&(s==null?void 0:s.doc.schema.tags.some(t=>t.tag===ye.tag&&t.default));function $n(s,e,t){if(t=s&&_e(t)?t.resolve(s.doc):t,ut(t))for(const n of t.items)Ut(s,e,n);else if(Array.isArray(t))for(const n of t)Ut(s,e,n);else Ut(s,e,t)}function Ut(s,e,t){const n=s&&_e(t)?t.resolve(s.doc):t;if(!dt(n))throw new Error("Merge sources must be maps or map aliases");const r=n.toJSON(null,s,Map);for(const[i,o]of r)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Pn(s,e,{key:t,value:n}){if(U(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(ra(s,t))$n(s,e,n);else{const r=re(t,"",s);if(e instanceof Map)e.set(r,re(n,r,s));else if(e instanceof Set)e.add(r);else{const i=ia(t,r,s),o=re(n,i,s);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function ia(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(U(s)&&(t!=null&&t.doc)){const n=In(t.doc,{});n.anchors=new Set;for(const i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;const r=s.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),Mn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return r}return JSON.stringify(e)}function hs(s,e,t){const n=at(s,void 0,t),r=at(e,void 0,t);return new Z(n,r)}class Z{constructor(e,t=null){Object.defineProperty(this,ie,{value:Sn}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return U(t)&&(t=t.clone(e)),U(n)&&(n=n.clone(e)),new Z(t,n)}toJSON(e,t){const n=t!=null&&t.mapAsMap?new Map:{};return Pn(t,n,this)}toString(e,t,n){return e!=null&&e.doc?na(this,e,t,n):JSON.stringify(this)}}function Rn(s,e,t){return(e.inFlow??s.flow?oa:aa)(s,e,t)}function aa({comment:s,items:e},t,{blockItemPrefix:n,flowChars:r,itemIndent:i,onChompKeep:o,onComment:l}){const{indent:c,options:{commentString:d}}=t,p=Object.assign({},t,{indent:i,type:null});let f=!1;const u=[];for(let x=0;x<e.length;++x){const m=e[x];let g=null;if(U(m))!f&&m.spaceBefore&&u.push(""),Ct(t,u,m.commentBefore,f),m.comment&&(g=m.comment);else if(z(m)){const T=U(m.key)?m.key:null;T&&(!f&&T.spaceBefore&&u.push(""),Ct(t,u,T.commentBefore,f))}f=!1;let N=Ue(m,p,()=>g=null,()=>f=!0);g&&(N+=Se(N,i,d(g))),f&&g&&(f=!1),u.push(n+N)}let h;if(u.length===0)h=r.start+r.end;else{h=u[0];for(let x=1;x<u.length;++x){const m=u[x];h+=m?`
${c}${m}`:`
`}}return s?(h+=`
`+ge(d(s),c),l&&l()):f&&o&&o(),h}function oa({items:s},e,{flowChars:t,itemIndent:n}){const{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:l}}=e;n+=i;const c=Object.assign({},e,{indent:n,inFlow:!0,type:null});let d=!1,p=0;const f=[];for(let x=0;x<s.length;++x){const m=s[x];let g=null;if(U(m))m.spaceBefore&&f.push(""),Ct(e,f,m.commentBefore,!1),m.comment&&(g=m.comment);else if(z(m)){const T=U(m.key)?m.key:null;T&&(T.spaceBefore&&f.push(""),Ct(e,f,T.commentBefore,!1),T.comment&&(d=!0));const b=U(m.value)?m.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(d=!0)):m.value==null&&(T!=null&&T.comment)&&(g=T.comment)}g&&(d=!0);let N=Ue(m,c,()=>g=null);x<s.length-1&&(N+=","),g&&(N+=Se(N,n,l(g))),!d&&(f.length>p||N.includes(`
`))&&(d=!0),f.push(N),p=f.length}const{start:u,end:h}=t;if(f.length===0)return u+h;if(!d){const x=f.reduce((m,g)=>m+g.length+2,2);d=e.options.lineWidth>0&&x>e.options.lineWidth}if(d){let x=u;for(const m of f)x+=m?`
${i}${r}${m}`:`
`;return`${x}
${r}${h}`}else return`${u}${o}${f.join(" ")}${o}${h}`}function Ct({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){const i=ge(e(n),s);t.push(i.trimStart())}}function Ce(s,e){const t=D(e)?e.value:e;for(const n of s)if(z(n)&&(n.key===e||n.key===t||D(n.key)&&n.key.value===t))return n}class ne extends _n{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ke,e),this.items=[]}static from(e,t,n){const{keepUndefined:r,replacer:i}=n,o=new this(e),l=(c,d)=>{if(typeof i=="function")d=i.call(t,c,d);else if(Array.isArray(i)&&!i.includes(c))return;(d!==void 0||r)&&o.items.push(hs(c,d,n))};if(t instanceof Map)for(const[c,d]of t)l(c,d);else if(t&&typeof t=="object")for(const c of Object.keys(t))l(c,t[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){var o;let n;z(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Z(e,e==null?void 0:e.value):n=new Z(e.key,e.value);const r=Ce(this.items,n.key),i=(o=this.schema)==null?void 0:o.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);D(r.value)&&En(n.value)?r.value.value=n.value:r.value=n.value}else if(i){const l=this.items.findIndex(c=>i(n,c)<0);l===-1?this.items.push(n):this.items.splice(l,0,n)}else this.items.push(n)}delete(e){const t=Ce(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const n=Ce(this.items,e),r=n==null?void 0:n.value;return(!t&&D(r)?r.value:r)??void 0}has(e){return!!Ce(this.items,e)}set(e,t){this.add(new Z(e,t),!0)}toJSON(e,t,n){const r=n?new n:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(r);for(const i of this.items)Pn(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(const r of this.items)if(!z(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Rn(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const Ge={collection:"map",default:!0,nodeClass:ne,tag:"tag:yaml.org,2002:map",resolve(s,e){return dt(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>ne.from(s,e,t)};class Oe extends _n{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ve,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=yt(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=yt(e);if(typeof n!="number")return;const r=this.items[n];return!t&&D(r)?r.value:r}has(e){const t=yt(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=yt(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const r=this.items[n];D(r)&&En(t)?r.value=t:this.items[n]=t}toJSON(e,t){const n=[];t!=null&&t.onCreate&&t.onCreate(n);let r=0;for(const i of this.items)n.push(re(i,String(r++),t));return n}toString(e,t,n){return e?Rn(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+"  ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){const{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof r=="function"){const c=t instanceof Set?l:String(o++);l=r.call(t,c,l)}i.items.push(at(l,void 0,n))}}return i}}function yt(s){let e=D(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const He={collection:"seq",default:!0,nodeClass:Oe,tag:"tag:yaml.org,2002:seq",resolve(s,e){return ut(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>Oe.from(s,e,t)},It={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),fs(s,e,t,n)}},Mt={identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new I(null),stringify:({source:s},e)=>typeof s=="string"&&Mt.test.test(s)?s:e.options.nullStr},ms={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new I(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&ms.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function le({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let l=e-(i.length-o-1);for(;l-- >0;)i+="0"}return i}const Bn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:le},Dn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():le(s)}},Fn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new I(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:le},$t=s=>typeof s=="bigint"||Number.isInteger(s),ps=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Kn(s,e,t){const{value:n}=s;return $t(n)&&n>=0?t+n.toString(e):le(s)}const qn={identify:s=>$t(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>ps(s,2,8,t),stringify:s=>Kn(s,8,"0o")},Un={identify:$t,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>ps(s,0,10,t),stringify:le},zn={identify:s=>$t(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>ps(s,2,16,t),stringify:s=>Kn(s,16,"0x")},la=[Ge,He,It,Mt,ms,qn,Un,zn,Bn,Dn,Fn];function Us(s){return typeof s=="bigint"||Number.isInteger(s)}const xt=({value:s})=>JSON.stringify(s),ca=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:xt},{identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:xt},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:xt},{identify:Us,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Us(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:xt}],da={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},ua=[Ge,He].concat(ca,da),gs={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,r,i){if(!t)return"";const o=t;let l;if(typeof btoa=="function"){let c="";for(let d=0;d<o.length;++d)c+=String.fromCharCode(o[d]);l=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=I.BLOCK_LITERAL),e!==I.QUOTE_DOUBLE){const c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),d=Math.ceil(l.length/c),p=new Array(d);for(let f=0,u=0;f<d;++f,u+=c)p[f]=l.substr(u,c);l=p.join(e===I.BLOCK_LITERAL?`
`:" ")}return fs({comment:s,type:e,value:l},n,r,i)}};function Vn(s,e){if(ut(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!z(n)){if(dt(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const r=n.items[0]||new Z(new I(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
${r.key.commentBefore}`:n.commentBefore),n.comment){const i=r.value??r.key;i.comment=i.comment?`${n.comment}
${i.comment}`:n.comment}n=r}s.items[t]=z(n)?n:new Z(n)}}else e("Expected a sequence for this tag");return s}function Wn(s,e,t){const{replacer:n}=t,r=new Oe(s);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let l,c;if(Array.isArray(o))if(o.length===2)l=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const d=Object.keys(o);if(d.length===1)l=d[0],c=o[l];else throw new TypeError(`Expected tuple with one key, not ${d.length} keys`)}else l=o;r.items.push(hs(l,c,t))}return r}const ys={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Vn,createNode:Wn};class Fe extends Oe{constructor(){super(),this.add=ne.prototype.add.bind(this),this.delete=ne.prototype.delete.bind(this),this.get=ne.prototype.get.bind(this),this.has=ne.prototype.has.bind(this),this.set=ne.prototype.set.bind(this),this.tag=Fe.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t!=null&&t.onCreate&&t.onCreate(n);for(const r of this.items){let i,o;if(z(r)?(i=re(r.key,"",t),o=re(r.value,i,t)):i=re(r,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){const r=Wn(e,t,n),i=new this;return i.items=r.items,i}}Fe.tag="tag:yaml.org,2002:omap";const xs={collection:"seq",identify:s=>s instanceof Map,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=Vn(s,e),n=[];for(const{key:r}of t.items)D(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new Fe,t)},createNode:(s,e,t)=>Fe.from(s,e,t)};function Gn({value:s,source:e},t){return e&&(s?Hn:Jn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const Hn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new I(!0),stringify:Gn},Jn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new I(!1),stringify:Gn},fa={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:le},ha={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():le(s)}},ma={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new I(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:le},ft=s=>typeof s=="bigint"||Number.isInteger(s);function Pt(s,e,t,{intAsBigInt:n}){const r=s[0];if((r==="-"||r==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return r==="-"?BigInt(-1)*o:o}const i=parseInt(s,t);return r==="-"?-1*i:i}function bs(s,e,t){const{value:n}=s;if(ft(n)){const r=n.toString(e);return n<0?"-"+t+r.substr(1):t+r}return le(s)}const pa={identify:ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Pt(s,2,2,t),stringify:s=>bs(s,2,"0b")},ga={identify:ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Pt(s,1,8,t),stringify:s=>bs(s,8,"0")},ya={identify:ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Pt(s,0,10,t),stringify:le},xa={identify:ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Pt(s,2,16,t),stringify:s=>bs(s,16,"0x")};class Ke extends ne{constructor(e){super(e),this.tag=Ke.tag}add(e){let t;z(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Z(e.key,null):t=new Z(e,null),Ce(this.items,t.key)||this.items.push(t)}get(e,t){const n=Ce(this.items,e);return!t&&z(n)?D(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=Ce(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Z(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){const{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof r=="function"&&(o=r.call(t,o,o)),i.items.push(hs(o,null,n));return i}}Ke.tag="tag:yaml.org,2002:set";const ws={collection:"map",identify:s=>s instanceof Set,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>Ke.from(s,e,t),resolve(s,e){if(dt(s)){if(s.hasAllNullValues(!0))return Object.assign(new Ke,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function ks(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,r=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,l)=>o*r(60)+r(l),r(0));return t==="-"?r(-1)*i:i}function Yn(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return le(s);let n="";e<0&&(n="-",e*=t(-1));const r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const Qn={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>ks(s,t),stringify:Yn},Xn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>ks(s,!1),stringify:Yn},Rt={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){const e=s.match(Rt.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,r,i,o,l]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0;let d=Date.UTC(t,n-1,r,i||0,o||0,l||0,c);const p=e[8];if(p&&p!=="Z"){let f=ks(p,!1);Math.abs(f)<30&&(f*=60),d-=6e4*f}return new Date(d)},stringify:({value:s})=>(s==null?void 0:s.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},zs=[Ge,He,It,Mt,Hn,Jn,pa,ga,ya,xa,fa,ha,ma,gs,ye,xs,ys,ws,Qn,Xn,Rt],Vs=new Map([["core",la],["failsafe",[Ge,He,It]],["json",ua],["yaml11",zs],["yaml-1.1",zs]]),Ws={binary:gs,bool:ms,float:Fn,floatExp:Dn,floatNaN:Bn,floatTime:Xn,int:Un,intHex:zn,intOct:qn,intTime:Qn,map:Ge,merge:ye,null:Mt,omap:xs,pairs:ys,seq:He,set:ws,timestamp:Rt},ba={"tag:yaml.org,2002:binary":gs,"tag:yaml.org,2002:merge":ye,"tag:yaml.org,2002:omap":xs,"tag:yaml.org,2002:pairs":ys,"tag:yaml.org,2002:set":ws,"tag:yaml.org,2002:timestamp":Rt};function zt(s,e,t){const n=Vs.get(e);if(n&&!s)return t&&!n.includes(ye)?n.concat(ye):n.slice();let r=n;if(!r)if(Array.isArray(s))r=[];else{const i=Array.from(Vs.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(const i of s)r=r.concat(i);else typeof s=="function"&&(r=s(r.slice()));return t&&(r=r.concat(ye)),r.reduce((i,o)=>{const l=typeof o=="string"?Ws[o]:o;if(!l){const c=JSON.stringify(o),d=Object.keys(Ws).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${d}`)}return i.includes(l)||i.push(l),i},[])}const wa=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Ns{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?zt(e,"compat"):e?zt(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?ba:{},this.tags=zt(t,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,ke,{value:Ge}),Object.defineProperty(this,de,{value:It}),Object.defineProperty(this,Ve,{value:He}),this.sortMapEntries=typeof o=="function"?o:o===!0?wa:null}clone(){const e=Object.create(Ns.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function ka(s,e){var c;const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const d=s.directives.toString(s);d?(t.push(d),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const r=In(s,e),{commentString:i}=r.options;if(s.commentBefore){t.length!==1&&t.unshift("");const d=i(s.commentBefore);t.unshift(ge(d,""))}let o=!1,l=null;if(s.contents){if(U(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const f=i(s.contents.commentBefore);t.push(ge(f,""))}r.forceBlockIndent=!!s.comment,l=s.contents.comment}const d=l?void 0:()=>o=!0;let p=Ue(s.contents,r,()=>l=null,d);l&&(p+=Se(p,"",i(l))),(p[0]==="|"||p[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${p}`:t.push(p)}else t.push(Ue(s.contents,r));if((c=s.directives)!=null&&c.docEnd)if(s.comment){const d=i(s.comment);d.includes(`
`)?(t.push("..."),t.push(ge(d,""))):t.push(`... ${d}`)}else t.push("...");else{let d=s.comment;d&&o&&(d=d.replace(/^\n+/,"")),d&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(ge(i(d),"")))}return t.join(`
`)+`
`}class ht{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ie,{value:Qt});let r=null;typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;n!=null&&n._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new X({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){const e=Object.create(ht.prototype,{[ie]:{value:Qt}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=U(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ie(this.contents)&&this.contents.add(e)}addIn(e,t){Ie(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=An(this);e.anchor=!t||n.has(t)?On(t||"a",n):t}return new us(e.anchor)}createNode(e,t,n){let r;if(typeof t=="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){const g=T=>typeof T=="number"||T instanceof String||T instanceof Number,N=t.filter(g).map(String);N.length>0&&(t=t.concat(N)),r=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:l,keepUndefined:c,onTagObj:d,tag:p}=n??{},{onAnchor:f,setAnchors:u,sourceObjects:h}=Ji(this,o||"a"),x={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:d,replacer:r,schema:this.schema,sourceObjects:h},m=at(e,p,x);return l&&q(m)&&(m.flow=!0),u(),m}createPair(e,t,n={}){const r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new Z(r,i)}delete(e){return Ie(this.contents)?this.contents.delete(e):!1}deleteIn(e){return tt(e)?this.contents==null?!1:(this.contents=null,!0):Ie(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return q(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return tt(e)?!t&&D(this.contents)?this.contents.value:this.contents:q(this.contents)?this.contents.getIn(e,t):void 0}has(e){return q(this.contents)?this.contents.has(e):!1}hasIn(e){return tt(e)?this.contents!==void 0:q(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=St(this.schema,[e],t):Ie(this.contents)&&this.contents.set(e,t)}setIn(e,t){tt(e)?this.contents=t:this.contents==null?this.contents=St(this.schema,Array.from(e),t):Ie(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new X({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new X({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ns(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=re(this.contents,t??"",l);if(typeof i=="function")for(const{count:d,res:p}of l.anchors.values())i(p,d);return typeof o=="function"?Pe(o,{"":c},"",c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return ka(this,e)}}function Ie(s){if(q(s))return!0;throw new Error("Expected a YAML collection as document contents")}class Zn extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}}class st extends Zn{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class Na extends Zn{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const Gs=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));const{line:n,col:r}=t.linePos[0];t.message+=` at line ${n}, column ${r}`;let i=r-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){const l=Math.min(i-39,o.length-79);o="…"+o.substring(l),i-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,i))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`…
`),o=l+o}if(/[^ ]/.test(o)){let l=1;const c=t.linePos[1];(c==null?void 0:c.line)===n&&c.col>r&&(l=Math.max(1,Math.min(c.col-r,80-i)));const d=" ".repeat(i)+"^".repeat(l);t.message+=`:

${o}
${d}
`}};function ze(s,{flow:e,indicator:t,next:n,offset:r,onError:i,parentIndent:o,startOnNewline:l}){let c=!1,d=l,p=l,f="",u="",h=!1,x=!1,m=null,g=null,N=null,T=null,b=null,j=null,v=null;for(const C of s)switch(x&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&i(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),x=!1),m&&(d&&C.type!=="comment"&&C.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),C.type){case"space":!e&&(t!=="doc-start"||(n==null?void 0:n.type)!=="flow-collection")&&C.source.includes("	")&&(m=C),p=!0;break;case"comment":{p||i(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const E=C.source.substring(1)||" ";f?f+=u+E:f=E,u="",d=!1;break}case"newline":d?f?f+=C.source:(!j||t!=="seq-item-ind")&&(c=!0):u+=C.source,d=!0,h=!0,(g||N)&&(T=C),p=!0;break;case"anchor":g&&i(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&i(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=C,v??(v=C.offset),d=!1,p=!1,x=!0;break;case"tag":{N&&i(C,"MULTIPLE_TAGS","A node can have at most one tag"),N=C,v??(v=C.offset),d=!1,p=!1,x=!0;break}case t:(g||N)&&i(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),j&&i(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${e??"collection"}`),j=C,d=t==="seq-item-ind"||t==="explicit-key-ind",p=!1;break;case"comma":if(e){b&&i(C,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=C,d=!1,p=!1;break}default:i(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),d=!1,p=!1}const O=s[s.length-1],A=O?O.offset+O.source.length:r;return x&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(d&&m.indent<=o||(n==null?void 0:n.type)==="block-map"||(n==null?void 0:n.type)==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:j,spaceBefore:c,comment:f,hasNewline:h,anchor:g,tag:N,newlineAfterProp:T,end:A,start:v??A}}function ot(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
`))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(ot(e.key)||ot(e.value))return!0}return!1;default:return!0}}function ts(s,e,t){if((e==null?void 0:e.type)==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&ot(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function er(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const r=typeof n=="function"?n:(i,o)=>i===o||D(i)&&D(o)&&i.value===o.value;return e.some(i=>r(i.key,t))}const Hs="All mapping items must start at the same column";function va({composeNode:s,composeEmptyNode:e},t,n,r,i){var p;const o=(i==null?void 0:i.nodeClass)??ne,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let c=n.offset,d=null;for(const f of n.items){const{start:u,key:h,sep:x,value:m}=f,g=ze(u,{indicator:"explicit-key-ind",next:h??(x==null?void 0:x[0]),offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0}),N=!g.found;if(N){if(h&&(h.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==n.indent&&r(c,"BAD_INDENT",Hs)),!g.anchor&&!g.tag&&!x){d=g.end,g.comment&&(l.comment?l.comment+=`
`+g.comment:l.comment=g.comment);continue}(g.newlineAfterProp||ot(h))&&r(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((p=g.found)==null?void 0:p.indent)!==n.indent&&r(c,"BAD_INDENT",Hs);t.atKey=!0;const T=g.end,b=h?s(t,h,g,r):e(t,T,u,null,g,r);t.schema.compat&&ts(n.indent,h,r),t.atKey=!1,er(t,l.items,b)&&r(T,"DUPLICATE_KEY","Map keys must be unique");const j=ze(x??[],{indicator:"map-value-ind",next:m,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!h||h.type==="block-scalar"});if(c=j.end,j.found){N&&((m==null?void 0:m.type)==="block-map"&&!j.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&g.start<j.found.offset-1024&&r(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const v=m?s(t,m,j,r):e(t,c,x,null,j,r);t.schema.compat&&ts(n.indent,m,r),c=v.range[2];const O=new Z(b,v);t.options.keepSourceTokens&&(O.srcToken=f),l.items.push(O)}else{N&&r(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),j.comment&&(b.comment?b.comment+=`
`+j.comment:b.comment=j.comment);const v=new Z(b);t.options.keepSourceTokens&&(v.srcToken=f),l.items.push(v)}}return d&&d<c&&r(d,"IMPOSSIBLE","Map comment with trailing content"),l.range=[n.offset,c,d??c],l}function ja({composeNode:s,composeEmptyNode:e},t,n,r,i){const o=(i==null?void 0:i.nodeClass)??Oe,l=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let c=n.offset,d=null;for(const{start:p,value:f}of n.items){const u=ze(p,{indicator:"seq-item-ind",next:f,offset:c,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)(f==null?void 0:f.type)==="block-seq"?r(u.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{d=u.end,u.comment&&(l.comment=u.comment);continue}const h=f?s(t,f,u,r):e(t,u.end,p,null,u,r);t.schema.compat&&ts(n.indent,f,r),c=h.range[2],l.items.push(h)}return l.range=[n.offset,c,d??c],l}function mt(s,e,t,n){let r="";if(s){let i=!1,o="";for(const l of s){const{source:c,type:d}=l;switch(d){case"space":i=!0;break;case"comment":{t&&!i&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const p=c.substring(1)||" ";r?r+=o+p:r=p,o="";break}case"newline":r&&(o+=c),i=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}e+=c.length}}return{comment:r,offset:e}}const Vt="Block collections are not allowed within flow collections",Wt=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Sa({composeNode:s,composeEmptyNode:e},t,n,r,i){var g;const o=n.start.source==="{",l=o?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(o?ne:Oe),d=new c(t.schema);d.flow=!0;const p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=n.offset+n.start.source.length;for(let N=0;N<n.items.length;++N){const T=n.items[N],{start:b,key:j,sep:v,value:O}=T,A=ze(b,{flow:l,indicator:"explicit-key-ind",next:j??(v==null?void 0:v[0]),offset:f,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!v&&!O){N===0&&A.comma?r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):N<n.items.length-1&&r(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),A.comment&&(d.comment?d.comment+=`
`+A.comment:d.comment=A.comment),f=A.end;continue}!o&&t.options.strict&&ot(j)&&r(j,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0)A.comma&&r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(A.comma||r(A.start,"MISSING_CHAR",`Missing , between ${l} items`),A.comment){let C="";e:for(const E of b)switch(E.type){case"comma":case"space":break;case"comment":C=E.source.substring(1);break e;default:break e}if(C){let E=d.items[d.items.length-1];z(E)&&(E=E.value??E.key),E.comment?E.comment+=`
`+C:E.comment=C,A.comment=A.comment.substring(C.length+1)}}if(!o&&!v&&!A.found){const C=O?s(t,O,A,r):e(t,A.end,v,null,A,r);d.items.push(C),f=C.range[2],Wt(O)&&r(C.range,"BLOCK_IN_FLOW",Vt)}else{t.atKey=!0;const C=A.end,E=j?s(t,j,A,r):e(t,C,b,null,A,r);Wt(j)&&r(E.range,"BLOCK_IN_FLOW",Vt),t.atKey=!1;const R=ze(v??[],{flow:l,indicator:"map-value-ind",next:O,offset:E.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(R.found){if(!o&&!A.found&&t.options.strict){if(v)for(const B of v){if(B===R.found)break;if(B.type==="newline"){r(B,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<R.found.offset-1024&&r(R.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else O&&("source"in O&&((g=O.source)==null?void 0:g[0])===":"?r(O,"MISSING_CHAR",`Missing space after : in ${l}`):r(R.start,"MISSING_CHAR",`Missing , or : between ${l} items`));const V=O?s(t,O,R,r):R.found?e(t,R.end,v,null,R,r):null;V?Wt(O)&&r(V.range,"BLOCK_IN_FLOW",Vt):R.comment&&(E.comment?E.comment+=`
`+R.comment:E.comment=R.comment);const W=new Z(E,V);if(t.options.keepSourceTokens&&(W.srcToken=T),o){const B=d;er(t,B.items,E)&&r(C,"DUPLICATE_KEY","Map keys must be unique"),B.items.push(W)}else{const B=new ne(t.schema);B.flow=!0,B.items.push(W);const Y=(V??E).range;B.range=[E.range[0],Y[1],Y[2]],d.items.push(B)}f=V?V.range[2]:R.end}}const u=o?"}":"]",[h,...x]=n.end;let m=f;if((h==null?void 0:h.source)===u)m=h.offset+h.source.length;else{const N=l[0].toUpperCase()+l.substring(1),T=p?`${N} must end with a ${u}`:`${N} in block collection must be sufficiently indented and end with a ${u}`;r(f,p?"MISSING_CHAR":"BAD_INDENT",T),h&&h.source.length!==1&&x.unshift(h)}if(x.length>0){const N=mt(x,m,t.options.strict,r);N.comment&&(d.comment?d.comment+=`
`+N.comment:d.comment=N.comment),d.range=[n.offset,m,N.offset]}else d.range=[n.offset,m,m];return d}function Gt(s,e,t,n,r,i){const o=t.type==="block-map"?va(s,e,t,n,i):t.type==="block-seq"?ja(s,e,t,n,i):Sa(s,e,t,n,i),l=o.constructor;return r==="!"||r===l.tagName?(o.tag=l.tagName,o):(r&&(o.tag=r),o)}function Ca(s,e,t,n,r){var u;const i=n.tag,o=i?e.directives.tagName(i.source,h=>r(i,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){const{anchor:h,newlineAfterProp:x}=n,m=h&&i?h.offset>i.offset?h:i:h??i;m&&(!x||x.offset<m.offset)&&r(m,"MISSING_CHAR","Missing newline after block sequence props")}const l=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===ne.tagName&&l==="map"||o===Oe.tagName&&l==="seq")return Gt(s,e,t,r,o);let c=e.schema.tags.find(h=>h.tag===o&&h.collection===l);if(!c){const h=e.schema.knownTags[o];if((h==null?void 0:h.collection)===l)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return h?r(i,"BAD_COLLECTION_TYPE",`${h.tag} used for ${l} collection, but expects ${h.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Gt(s,e,t,r,o)}const d=Gt(s,e,t,r,o,c),p=((u=c.resolve)==null?void 0:u.call(c,d,h=>r(i,"TAG_RESOLVE_FAILED",h),e.options))??d,f=U(p)?p:new I(p);return f.range=d.range,f.tag=o,c!=null&&c.format&&(f.format=c.format),f}function Ta(s,e,t){const n=e.offset,r=Aa(e,s.options.strict,t);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};const i=r.mode===">"?I.BLOCK_FOLDED:I.BLOCK_LITERAL,o=e.source?Oa(e.source):[];let l=o.length;for(let m=o.length-1;m>=0;--m){const g=o[m][1];if(g===""||g==="\r")l=m;else break}if(l===0){const m=r.chomp==="+"&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):"";let g=n+r.length;return e.source&&(g+=e.source.length),{value:m,type:i,comment:r.comment,range:[n,g,g]}}let c=e.indent+r.indent,d=e.offset+r.length,p=0;for(let m=0;m<l;++m){const[g,N]=o[m];if(N===""||N==="\r")r.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&t(d+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=g.length),p=m,c===0&&!s.atRoot&&t(d,"BAD_INDENT","Block scalar values in collections must be indented");break}d+=g.length+N.length+1}for(let m=o.length-1;m>=l;--m)o[m][0].length>c&&(l=m+1);let f="",u="",h=!1;for(let m=0;m<p;++m)f+=o[m][0].slice(c)+`
`;for(let m=p;m<l;++m){let[g,N]=o[m];d+=g.length+N.length+1;const T=N[N.length-1]==="\r";if(T&&(N=N.slice(0,-1)),N&&g.length<c){const j=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;t(d-N.length-(T?2:1),"BAD_INDENT",j),g=""}i===I.BLOCK_LITERAL?(f+=u+g.slice(c)+N,u=`
`):g.length>c||N[0]==="	"?(u===" "?u=`
`:!h&&u===`
`&&(u=`

`),f+=u+g.slice(c)+N,u=`
`,h=!0):N===""?u===`
`?f+=`
`:u=`
`:(f+=u+N,u=" ",h=!1)}switch(r.chomp){case"-":break;case"+":for(let m=l;m<o.length;++m)f+=`
`+o[m][0].slice(c);f[f.length-1]!==`
`&&(f+=`
`);break;default:f+=`
`}const x=n+r.length+e.source.length;return{value:f,type:i,comment:r.comment,range:[n,x,x]}}function Aa({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=e[0],i=r[0];let o=0,l="",c=-1;for(let u=1;u<r.length;++u){const h=r[u];if(!l&&(h==="-"||h==="+"))l=h;else{const x=Number(h);!o&&x?o=x:c===-1&&(c=s+u)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let d=!1,p="",f=r.length;for(let u=1;u<e.length;++u){const h=e[u];switch(h.type){case"space":d=!0;case"newline":f+=h.source.length;break;case"comment":t&&!d&&n(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=h.source.length,p=h.source.substring(1);break;case"error":n(h,"UNEXPECTED_TOKEN",h.message),f+=h.source.length;break;default:{const x=`Unexpected token in block scalar header: ${h.type}`;n(h,"UNEXPECTED_TOKEN",x);const m=h.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:i,indent:o,chomp:l,comment:p,length:f}}function Oa(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),i=[n!=null&&n[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}function Ea(s,e,t){const{offset:n,type:r,source:i,end:o}=s;let l,c;const d=(u,h,x)=>t(n+u,h,x);switch(r){case"scalar":l=I.PLAIN,c=_a(i,d);break;case"single-quoted-scalar":l=I.QUOTE_SINGLE,c=La(i,d);break;case"double-quoted-scalar":l=I.QUOTE_DOUBLE,c=Ia(i,d);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+i.length,n+i.length]}}const p=n+i.length,f=mt(o,p,e,t);return{value:c,type:l,comment:f.comment,range:[n,p,f.offset]}}function _a(s,e){let t="";switch(s[0]){case"	":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),tr(s)}function La(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),tr(s.slice(1,-1)).replace(/''/g,"'")}function tr(s){let e,t;try{e=new RegExp(`(.*?)(?<![ 	])[ 	]*\r?
`,"sy"),t=new RegExp(`[ 	]*(.*?)(?:(?<![ 	])[ 	]*)?\r?
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let r=n[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?i===`
`?r+=i:i=`
`:(r+=i+n[1],i=" "),o=t.lastIndex;const l=/[ \t]*(.*)/sy;return l.lastIndex=o,n=l.exec(s),r+i+((n==null?void 0:n[1])??"")}function Ia(s,e){let t="";for(let n=1;n<s.length-1;++n){const r=s[n];if(!(r==="\r"&&s[n+1]===`
`))if(r===`
`){const{fold:i,offset:o}=Ma(s,n);t+=i,n=o}else if(r==="\\"){let i=s[++n];const o=$a[i];if(o)t+=o;else if(i===`
`)for(i=s[n+1];i===" "||i==="	";)i=s[++n+1];else if(i==="\r"&&s[n+1]===`
`)for(i=s[++n+1];i===" "||i==="	";)i=s[++n+1];else if(i==="x"||i==="u"||i==="U"){const l={x:2,u:4,U:8}[i];t+=Pa(s,n+1,l,e),n+=l}else{const l=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(r===" "||r==="	"){const i=n;let o=s[n+1];for(;o===" "||o==="	";)o=s[++n+1];o!==`
`&&!(o==="\r"&&s[n+2]===`
`)&&(t+=n>i?s.slice(i,n+1):r)}else t+=r}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Ma(s,e){let t="",n=s[e+1];for(;(n===" "||n==="	"||n===`
`||n==="\r")&&!(n==="\r"&&s[e+2]!==`
`);)n===`
`&&(t+=`
`),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const $a={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:"	",v:"\v",N:"",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","	":"	"};function Pa(s,e,t,n){const r=s.substr(e,t),o=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(o)){const l=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}return String.fromCodePoint(o)}function sr(s,e,t,n){const{value:r,type:i,comment:o,range:l}=e.type==="block-scalar"?Ta(s,e,n):Ea(e,s.options.strict,n),c=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null;let d;s.options.stringKeys&&s.atKey?d=s.schema[de]:c?d=Ra(s.schema,r,c,t,n):e.type==="scalar"?d=Ba(s,r,e,n):d=s.schema[de];let p;try{const f=d.resolve(r,u=>n(t??e,"TAG_RESOLVE_FAILED",u),s.options);p=D(f)?f:new I(f)}catch(f){const u=f instanceof Error?f.message:String(f);n(t??e,"TAG_RESOLVE_FAILED",u),p=new I(r)}return p.range=l,p.source=r,i&&(p.type=i),c&&(p.tag=c),d.format&&(p.format=d.format),o&&(p.comment=o),p}function Ra(s,e,t,n,r){var l;if(t==="!")return s[de];const i=[];for(const c of s.tags)if(!c.collection&&c.tag===t)if(c.default&&c.test)i.push(c);else return c;for(const c of i)if((l=c.test)!=null&&l.test(e))return c;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[de])}function Ba({atKey:s,directives:e,schema:t},n,r,i){const o=t.tags.find(l=>{var c;return(l.default===!0||s&&l.default==="key")&&((c=l.test)==null?void 0:c.test(n))})||t[de];if(t.compat){const l=t.compat.find(c=>{var d;return c.default&&((d=c.test)==null?void 0:d.test(n))})??t[de];if(o.tag!==l.tag){const c=e.tagString(o.tag),d=e.tagString(l.tag),p=`Value may be parsed as either ${c} or ${d}`;i(r,"TAG_RESOLVE_FAILED",p,!0)}}return o}function Da(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":s-=r.source.length;continue}for(r=e[++n];(r==null?void 0:r.type)==="space";)s+=r.source.length,r=e[++n];break}}return s}const Fa={composeNode:nr,composeEmptyNode:vs};function nr(s,e,t,n){const r=s.atKey,{spaceBefore:i,comment:o,anchor:l,tag:c}=t;let d,p=!0;switch(e.type){case"alias":d=Ka(s,e,n),(l||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":d=sr(s,e,c,n),l&&(d.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":d=Ca(Fa,s,e,t,n),l&&(d.anchor=l.source.substring(1));break;default:{const f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),d=vs(s,e.offset,void 0,null,t,n),p=!1}}return l&&d.anchor===""&&n(l,"BAD_ALIAS","Anchor cannot be an empty string"),r&&s.options.stringKeys&&(!D(d)||typeof d.value!="string"||d.tag&&d.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(d.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?d.comment=o:d.commentBefore=o),s.options.keepSourceTokens&&p&&(d.srcToken=e),d}function vs(s,e,t,n,{spaceBefore:r,comment:i,anchor:o,tag:l,end:c},d){const p={type:"scalar",offset:Da(e,t,n),indent:-1,source:""},f=sr(s,p,l,d);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&d(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function Ka({options:s},{offset:e,source:t,end:n},r){const i=new us(t.substring(1));i.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,l=mt(n,o,s.strict,r);return i.range=[e,o,l.offset],l.comment&&(i.comment=l.comment),i}function qa(s,e,{offset:t,start:n,value:r,end:i},o){const l=Object.assign({_directives:e},s),c=new ht(void 0,l),d={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},p=ze(n,{indicator:"doc-start",next:r??(i==null?void 0:i[0]),offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?nr(d,r,p,o):vs(d,p.end,n,null,p,o);const f=c.contents.range[2],u=mt(i,f,!1,o);return u.comment&&(c.comment=u.comment),c.range=[t,f,u.offset],c}function Ze(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Js(s){var r;let e="",t=!1,n=!1;for(let i=0;i<s.length;++i){const o=s[i];switch(o[0]){case"#":e+=(e===""?"":n?`

`:`
`)+(o.substring(1)||" "),t=!0,n=!1;break;case"%":((r=s[i+1])==null?void 0:r[0])!=="#"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Ua{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{const o=Ze(t);i?this.warnings.push(new Na(o,n,r)):this.errors.push(new st(o,n,r))},this.directives=new X({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:r}=Js(this.prelude);if(n){const i=e.contents;if(t)e.comment=e.comment?`${e.comment}
${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(q(i)&&!i.flow&&i.items.length>0){let o=i.items[0];z(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${n}
${l}`:n}else{const o=i.commentBefore;i.commentBefore=o?`${n}
${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Js(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const r of e)yield*this.next(r);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,r)=>{const i=Ze(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=qa(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new st(Ze(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new st(Ze(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=mt(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new st(Ze(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),r=new ht(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}}const rr="\uFEFF",ir="",ar="",ss="";function za(s){switch(s){case rr:return"byte-order-mark";case ir:return"doc-mode";case ar:return"flow-error-end";case ss:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case"	":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function oe(s){switch(s){case void 0:case" ":case`
`:case"\r":case"	":return!0;default:return!1}}const Ys=new Set("0123456789ABCDEFabcdef"),Va=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),bt=new Set(",[]{}"),Wa=new Set(` ,[]{}
\r	`),Ht=s=>!s||Wa.has(s);class Ga{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t==="	";)t=this.buffer[++e];return!t||t==="#"||t===`
`?!0:t==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){const r=this.buffer[n+e+1];if(r===`
`||!r&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){const n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&oe(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===rr&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){const i=e[n-1];if(i===" "||i==="	"){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){const i=e[t-1];if(i===" "||i==="	")t-=1;else break}const r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield ir,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if((t==="---"||t==="...")&&oe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!oe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&oe(t)){const n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ht),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&oe(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield ar,yield*this.parseLineStart();let i=0;for(;r[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ht),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||oe(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let r=n.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){const i=this.continueScalar(r+1);if(i===-1)break;r=n.indexOf(`
`,i)}r!==-1&&(t=r-(n[r-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>oe(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
`:e=i,t=0;break;case"\r":{const o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n==="	"){for(;n==="	"||n===" "||n==="\r"||n===`
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);const l=i;for(;o===" ";)o=this.buffer[--i];if(o===`
`&&i>=this.pos&&i+1+t>l)e=i;else break}while(!0);return yield ss,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){const i=this.buffer[n+1];if(oe(i)||e&&bt.has(i))break;t=n}else if(oe(r)){let i=this.buffer[n+1];if(r==="\r"&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i==="#"||e&&bt.has(i))break;if(r===`
`){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&bt.has(r))break;t=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield ss,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Ht))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(oe(t)||e&&bt.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!oe(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Va.has(t))t=this.buffer[++e];else if(t==="%"&&Ys.has(this.buffer[e+1])&&Ys.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n==="	");const r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Ha{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}}function we(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Qs(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function or(s){switch(s==null?void 0:s.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function wt(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Me(s){var t;if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=s[++e])==null?void 0:t.type)==="space";);return s.splice(e,s.length)}function Xs(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!we(e.start,"explicit-key-ind")&&!we(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,or(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class Ja{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ga,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=za(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(e==null?void 0:e.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Xs(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{const r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&Qs(r.start)===-1&&(t.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Qs(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=wt(this.peek(2)),n=Me(t);let r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var n;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const r="end"in t.value?t.value.end:void 0,i=Array.isArray(r)?r[r.length-1]:void 0;(i==null?void 0:i.type)==="comment"?r==null||r.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2],i=(n=r==null?void 0:r.value)==null?void 0:n.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,i=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(i&&t.sep&&!t.value){const l=[];for(let c=0;c<t.sep.length;++c){const d=t.sep[c];switch(d.type){case"newline":l.push(c);break;case"space":break;case"comment":d.indent>e.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(o=t.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(we(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(or(t.key)&&!we(t.sep,"newline")){const l=Me(t.start),c=t.key,d=t.sep;d.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:c,sep:d}]})}else o.length>0?t.sep=t.sep.concat(o,this.sourceToken):t.sep.push(this.sourceToken);else if(we(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const l=Me(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):we(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);i||t.value?(e.items.push({start:o,key:l,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(l):(Object.assign(t,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(e);if(l){if(l.type==="block-seq"){if(!t.explicitKey&&t.sep&&!we(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var n;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const r="end"in t.value?t.value.end:void 0,i=Array.isArray(r)?r[r.length-1]:void 0;(i==null?void 0:i.type)==="comment"?r==null||r.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const r=e.items[e.items.length-2],i=(n=r==null?void 0:r.value)==null?void 0:n.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||we(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while((n==null?void 0:n.type)==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const r=wt(n),i=Me(r);Xs(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=wt(e),n=Me(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=wt(e),n=Me(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ya(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ha||null,prettyErrors:e}}function Qa(s,e={}){const{lineCounter:t,prettyErrors:n}=Ya(e),r=new Ja(t==null?void 0:t.addNewLine),i=new Ua(e);let o=null;for(const l of i.compose(r.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new st(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Gs(s,t)),o.warnings.forEach(Gs(s,t))),o}function Xa(s,e,t){let n;const r=Qa(s,t);if(!r)return null;if(r.warnings.forEach(i=>Mn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},t))}function lr(s,e,t){let n=null;if(Array.isArray(e)&&(n=e),s===void 0){const{keepUndefined:r}={};if(!r)return}return ct(s)&&!n?s.toString(t):new ht(s,n,t).toString(t)}function js({title:s="No items",description:e}){return a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-3 text-zinc-500",children:[a.jsx(qr,{className:"w-10 h-10 text-zinc-600"}),a.jsx("p",{className:"text-sm font-medium",children:s}),e&&a.jsx("p",{className:"text-xs text-zinc-600",children:e})]})}function ns({open:s,title:e,description:t,confirmLabel:n="Confirm",confirmVariant:r="primary",onConfirm:i,onCancel:o,children:l}){const c=y.useRef(null);return y.useEffect(()=>{var d,p;s?(d=c.current)==null||d.showModal():(p=c.current)==null||p.close()},[s]),s?a.jsx("dialog",{ref:c,className:"fixed inset-0 z-50 m-auto w-full max-w-md rounded-2xl border border-border-subtle bg-surface-raised p-0 shadow-[0_24px_80px_-48px_rgba(15,23,42,0.95)] backdrop:bg-black/50",onClose:o,children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-txt-primary",children:e}),a.jsx("button",{type:"button",onClick:o,className:"rounded-lg p-1 text-txt-tertiary transition-colors hover:bg-surface-hover hover:text-txt-primary",children:a.jsx(De,{className:"w-4 h-4"})})]}),t&&a.jsx("p",{className:"mb-4 text-xs text-txt-secondary leading-relaxed",children:t}),l,a.jsxs("div",{className:"flex justify-end gap-2 mt-5",children:[a.jsx("button",{type:"button",onClick:o,className:"rounded-md px-3.5 py-2 text-xs text-txt-secondary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:"Cancel"}),a.jsx("button",{type:"button",onClick:i,className:`rounded-md px-3.5 py-2 text-xs font-medium transition-colors ${r==="danger"?"border border-rose-500/20 text-rose-400 hover:bg-rose-500/10":"border border-border-subtle text-txt-primary hover:bg-surface-overlay"}`,children:n})]})]})}):null}const Za={primary:"border border-accent bg-accent text-white shadow-sm shadow-accent/20 hover:bg-accent-hover",success:"border border-emerald-700/80 bg-emerald-600 text-white shadow-sm shadow-emerald-950/30 hover:bg-emerald-500",danger:"border border-rose-800/80 bg-rose-600 text-white shadow-sm shadow-rose-950/30 hover:bg-rose-500",ghost:"border border-border-subtle bg-transparent text-txt-secondary hover:bg-surface-overlay hover:text-txt-primary",accentTint:"border border-accent/25 bg-accent/8 text-accent hover:bg-accent/12"},eo={sm:"gap-1.5 rounded-md px-3 py-1.5 text-xs",md:"gap-2 rounded-lg px-3.5 py-2 text-sm"};function se({icon:s,variant:e="ghost",size:t="sm",children:n,className:r,...i}){return a.jsxs("button",{type:"button",className:$("inline-flex items-center justify-center font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",Za[e],eo[t],r),...i,children:[s,a.jsx("span",{children:n})]})}function ce({title:s,subtitle:e,icon:t,accent:n=!1,className:r,bodyClassName:i,children:o}){return a.jsxs("section",{className:$("overflow-hidden rounded-md border",n?"border-accent/20 bg-accent/5":"border-border-subtle bg-surface-raised/40",r),children:[a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border-subtle px-2.5 py-1.5",children:[t,a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:$("text-xs font-medium",n?"text-accent":"text-txt-primary"),children:s}),e&&a.jsx("div",{className:"text-2xs text-txt-tertiary",children:e})]})]}),a.jsx("div",{className:$("p-2",i),children:o})]})}const to=yr(),so=rn.theme({"&":{color:"#1f2937",backgroundColor:"transparent"},".cm-content":{caretColor:"#2563eb"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"#2563eb"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"rgba(37, 99, 235, 0.18)"},".cm-activeLine":{backgroundColor:"rgba(15, 23, 42, 0.04)"},".cm-gutters":{color:"#94a3b8",backgroundColor:"rgba(248, 250, 252, 0.92)",borderRight:"1px solid rgba(203, 213, 225, 0.7)"},".cm-activeLineGutter":{backgroundColor:"rgba(226, 232, 240, 0.65)",color:"#64748b"}}),no=[pr,rn.theme({"&":{backgroundColor:"transparent"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"rgba(38, 79, 120, 0.55)"},".cm-activeLine":{backgroundColor:"rgba(255, 255, 255, 0.04)"},".cm-gutters":{backgroundColor:"rgba(15, 23, 42, 0.78)",borderRight:"1px solid rgba(51, 65, 85, 0.95)"},".cm-activeLineGutter":{backgroundColor:"rgba(30, 41, 59, 0.82)"}})],ro=gr.define({startState:()=>({inString:null}),token(s,e){if(s.sol()&&(e.inString=null),s.eatSpace())return null;if(s.peek()==="#")return s.skipToEnd(),"comment";if(e.inString){let n=!1;for(;!s.eol();){const r=s.next();if(n){n=!1;continue}if(r==="\\"){n=!0;continue}if(r===e.inString){e.inString=null;break}}return"string"}const t=s.peek();return t==='"'||t==="'"?(e.inString=t,s.next(),"string"):s.match(/^\$\{[^}]+\}/)||s.match(/^\$[A-Za-z_][\w]*/)?"variableName":s.match(/^--?[A-Za-z][\w-]*/)?"attributeName":s.match(/^(?:&&|\|\||<<|>>|[|&;<>])/)?"operator":s.match(/^(?:\d+\.\d+|\d+)/)?"number":s.match(/^(?:if|then|elif|else|fi|for|while|until|do|done|case|esac|function|in)\b/)?"keyword":s.match(/^(?:echo|cd|export|set|unset|pwd|test|source|cat|python|conda|pip|git|ls|cp|mv|rm|mkdir|touch|exit)\b/)?"builtin":s.match(/^[A-Za-z_][\w-]*(?==)/)?"definition":(s.next(),null)}}),io=an(on.define([{tag:[_.keyword,_.controlKeyword],color:"#0000ff"},{tag:[_.name,_.variableName],color:"#001080"},{tag:[_.propertyName,_.attributeName,_.definition(_.variableName)],color:"#795e26"},{tag:[_.number,_.integer,_.float],color:"#098658"},{tag:[_.bool,_.null],color:"#0000ff"},{tag:[_.string,_.special(_.string)],color:"#a31515"},{tag:[_.comment,_.lineComment],color:"#008000",fontStyle:"italic"},{tag:[_.operator,_.separator],color:"#111827"},{tag:[_.brace,_.squareBracket,_.paren],color:"#111827"}]),{fallback:!1}),ao=an(on.define([{tag:[_.keyword,_.controlKeyword],color:"#569cd6"},{tag:[_.name,_.variableName],color:"#9cdcfe"},{tag:[_.propertyName,_.attributeName,_.definition(_.variableName)],color:"#dcdcaa"},{tag:[_.number,_.integer,_.float],color:"#b5cea8"},{tag:[_.bool,_.null],color:"#569cd6"},{tag:[_.string,_.special(_.string)],color:"#ce9178"},{tag:[_.comment,_.lineComment],color:"#6a9955",fontStyle:"italic"},{tag:[_.operator,_.separator],color:"#d4d4d4"},{tag:[_.brace,_.squareBracket,_.paren],color:"#d4d4d4"}]),{fallback:!1});function Zs(s,e){const t=e==="dark"?no:[so],n=e==="dark"?ao:io,r=s==="yaml"?to:ro;return[...t,r,n]}function en(s){return s.includes("|")||/-?\d+\s*:\s*-?\d+(?:\s*:\s*-?\d+)?/.test(s)}function oo(s){return(s.task_kind||"config")!=="config"||!s.name?"":`tasks/${s.name}/${s.config_file||"config.yaml"}`}function lo(s){const e=s.trim();return/^-?\d+\s*:\s*-?\d+(?:\s*:\s*-?\d+)?$/.test(e)?"range":e.includes("|")?e.startsWith("(")&&e.endsWith(")")?"zip":"product":"batch"}function cr(s){return s==null?"null":typeof s=="boolean"?"bool":typeof s=="number"?Number.isInteger(s)?"int":"float":Array.isArray(s)?"list":"str"}function dr(s,e=""){if(!s)return{};const t={};for(const[n,r]of Object.entries(s)){if(n.startsWith("_meta"))continue;const i=e?`${e}.${n}`:n;if(typeof r=="object"&&r!==null&&!Array.isArray(r)){Object.assign(t,dr(r,i));continue}t[i]=cr(r)}return t}function co(){const s=pe(w=>w.workspace),e=os(w=>w.theme),{templates:t,selectedTemplate:n,templateContent:r,viewMode:i,yamlText:o,shellText:l,namePrefix:c,appendTimestamp:d,columns:p,pinnedParams:f,loading:u,fetchTemplates:h,loadTemplate:x,clearTemplate:m,setViewMode:g,setYamlText:N,setShellText:T,setNamePrefix:b,setAppendTimestamp:j,setColumns:v,togglePin:O}=_i(),[A,C]=y.useState(!1),[E,R]=y.useState(null),[V,W]=y.useState(!1),[B,Y]=y.useState(""),[ue,fe]=y.useState(""),K=(s==null?void 0:s.workspace_kind)==="shell",H=s==null?void 0:s.shell_runtime,L=K?"shell":i==="shell"?"form":i,J=e==="dark"?"dark":"light",xe=y.useMemo(()=>Zs("yaml",J),[J]),Je=y.useMemo(()=>Zs("shell",J),[J]);y.useEffect(()=>{if(K){m(),i!=="shell"&&g("shell");return}i==="shell"&&g("form")},[m,K,T,g,l,i]),y.useEffect(()=>{!(s!=null&&s.run_root)||K||h()},[h,K,s==null?void 0:s.run_root]),y.useEffect(()=>{if(K)return;if(t.length===0){n&&m();return}t.some(P=>P.value===n)||x(t[0].value)},[m,K,x,n,t]);const Q=y.useMemo(()=>{if(L!=="form")return null;try{return Xa(o)||{}}catch{return null}},[L,o]),ae=y.useMemo(()=>{if(!Q)return[];const w=[],P=(G,ve="")=>{for(const[me,te]of Object.entries(G)){const Qe=ve?`${ve}.${me}`:me;if(typeof te=="string"&&(te.includes("|")||/^\s*-?\d+\s*:\s*-?\d+(?:\s*:\s*-?\d+)?\s*$/.test(te.trim()))){w.push({key:Qe,value:te,kind:lo(te)});continue}typeof te=="object"&&te!==null&&!Array.isArray(te)&&P(te,Qe)}};return P(Q),w},[Q]),ee=y.useMemo(()=>ae.map(w=>w.key),[ae]),Ne=y.useMemo(()=>dr((r==null?void 0:r.parsed_config)||Q),[Q,r==null?void 0:r.parsed_config]),he=L==="form"&&en(o),be=L==="yaml"&&en(o),Ye=E!=null&&E.count?`Batch syntax detected. ${E.count} tasks will be created after confirmation.`:"Batch syntax detected. A preview opens before creating multiple tasks.",S=y.useCallback(async()=>{W(!0),Y(""),fe("");try{const w=await ui({name_prefix:c||"task",mode:L,yaml_text:L==="shell"?"":o,shell_text:L==="shell"?l:"",template_value:K?void 0:n,append_timestamp:d});C(!1),R(null);let P="";const G=!K&&w.items.length>0?oo(w.items[0]):"";if(G)try{await h(),await x(G),P=w.items[0].name}catch{P=""}fe(P?`Created ${w.count} ${w.task_kind==="shell"?"shell task":"task"}${w.count>1?"s":""}. Selected ${P}.`:`Created ${w.count} ${w.task_kind==="shell"?"shell task":"task"}${w.count>1?"s":""}`),window.setTimeout(()=>fe(""),4e3)}catch(w){Y(w.message)}finally{W(!1)}},[d,L,h,K,x,c,n,l,o]),k=y.useCallback(async()=>{if(Y(""),fe(""),L==="form"&&he&&!A){try{const w=await fi({mode:L,yaml_text:o,template_value:n});R(w),C(!0)}catch(w){Y(w.message)}return}await S()},[S,L,he,A,n,o]);return a.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border-subtle bg-surface-raised px-3 py-2",children:[K?a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-accent/20 bg-accent/8 px-3 py-1.5 text-xs font-medium text-accent",children:[a.jsx(Be,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:"Shell Workspace"})]}):a.jsxs("div",{className:"relative",children:[a.jsx("select",{value:n,onChange:w=>void x(w.target.value),title:"Select template",className:"max-w-[320px] appearance-none rounded-md border border-border-subtle bg-surface-overlay px-3 py-1.5 pr-7 text-xs text-txt-primary outline-none transition-colors focus:border-border",children:t.map(w=>a.jsx("option",{value:w.value,children:w.label},w.value))}),a.jsx(Te,{className:"pointer-events-none absolute right-2 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]}),L==="form"&&a.jsxs("div",{className:"relative",children:[a.jsx("select",{value:p,onChange:w=>v(Number(w.target.value)),title:"Columns per row",className:"appearance-none rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 pr-6 text-xs text-txt-primary outline-none transition-colors focus:border-border",children:[2,3,4,5,6,7,8].map(w=>a.jsxs("option",{value:w,children:[w," col",w>1?"s":""]},w))}),a.jsx(Te,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]}),!K&&(r==null?void 0:r.read_only)&&a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/10 px-2 py-1 text-2xs text-amber-400",children:[a.jsx(gn,{className:"h-3 w-3"}),a.jsx("span",{children:"Read-only"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex items-center rounded-lg border border-border-subtle bg-surface-overlay p-0.5",children:(K?["shell"]:["form","yaml"]).map(w=>a.jsxs("button",{type:"button",onClick:()=>g(w),className:$("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",L===w?"bg-surface-raised text-txt-primary":"text-txt-secondary hover:text-txt-primary"),children:[w==="form"&&a.jsx(Vr,{className:"h-3 w-3"}),w==="yaml"&&a.jsx(At,{className:"h-3 w-3"}),w==="shell"&&a.jsx(Be,{className:"h-3 w-3"}),a.jsx("span",{children:w.charAt(0).toUpperCase()+w.slice(1)})]},w))})]}),a.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a.jsx("div",{className:"min-w-0 flex flex-1 flex-col overflow-hidden",style:{flexBasis:"78%"},children:!K&&u?a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("div",{className:"animate-pulse text-xs text-txt-tertiary",children:"Loading template..."})}):L==="form"?a.jsx(uo,{config:Q,columns:p,declaredTypeMap:Ne,pinnedParams:f,batchParams:ee,onTogglePin:O,onChange:w=>N(lr(w))}):L==="yaml"?a.jsx(fo,{value:o,onChange:N,theme:J,extensions:xe}):a.jsx(ho,{value:l,onChange:T,theme:J,extensions:Je})}),a.jsxs("aside",{className:"flex w-[286px] flex-col gap-2.5 overflow-y-auto border-l border-border-subtle bg-surface-raised p-2.5",style:{minWidth:268,maxWidth:296},children:[a.jsxs(ce,{title:"Naming",bodyClassName:"space-y-2.5 p-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-2xs uppercase tracking-[0.16em] text-txt-tertiary",children:"Task Prefix"}),a.jsx("input",{value:c,onChange:w=>b(w.target.value),placeholder:"task",className:"mt-1.5 w-full rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 text-sm font-medium text-txt-primary outline-none transition-colors focus:border-border"})]}),a.jsxs("label",{className:"inline-flex items-center gap-2 text-xs text-txt-secondary",children:[a.jsx("input",{type:"checkbox",checked:d,onChange:w=>j(w.target.checked),className:"h-3.5 w-3.5 rounded border-border accent-accent"}),a.jsx("span",{children:"Append timestamp"})]})]}),L==="form"&&ee.length>0&&a.jsxs(ce,{title:"Pinned Batch Inputs",icon:a.jsx(lt,{className:"h-3.5 w-3.5 text-accent"}),accent:!0,bodyClassName:"space-y-1.5 p-2",children:[a.jsxs("div",{className:"text-2xs text-accent",children:[ee.length," batch-sensitive field",ee.length>1?"s":""]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:ee.map(w=>a.jsx("span",{className:"rounded-md border border-accent/20 bg-accent/8 px-1.5 py-0.5 font-mono text-2xs text-accent",title:w,children:w},w))})]}),L==="form"&&a.jsxs(ce,{title:"Batch Syntax",bodyClassName:"space-y-1.5 p-2",children:[a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:[a.jsx("span",{className:"text-txt-primary",children:"Product"}),": `lr: 0.001 | 0.01 | 0.1`"]}),a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:[a.jsx("span",{className:"text-txt-primary",children:"Zip"}),": `seed: (1 | 2 | 3)`"]}),a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:[a.jsx("span",{className:"text-txt-primary",children:"Range"}),": `epoch: 10:100:1`"]})]}),L==="yaml"&&a.jsxs(ce,{title:"YAML Mode",bodyClassName:"space-y-1.5 p-2",children:[a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:["YAML mode creates exactly one ",a.jsx("code",{className:"text-txt-primary",children:"config.yaml"})," task."]}),a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:["Batch syntax is disabled here. Switch back to ",a.jsx("span",{className:"text-txt-primary",children:"Form"})," for batch expansion and parameter pinning."]}),be&&a.jsx("div",{className:"rounded-md border border-amber-500/20 bg-amber-500/10 px-2.5 py-2 text-2xs text-amber-400",children:"Batch syntax was detected in YAML mode, but YAML mode only creates one task. Use Form mode if you want batch generation."})]}),L==="shell"&&a.jsxs(ce,{title:"Shell Mode",icon:a.jsx(Be,{className:"h-3.5 w-3.5 text-accent"}),accent:!0,bodyClassName:"space-y-1.5 p-2",children:[a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:["Shell mode creates one ",a.jsx("code",{className:"text-txt-primary",children:"config.sh"})," task at a time."]}),a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:["The script runs inside ",a.jsx("code",{className:"text-txt-primary",children:"_shell_"})," by following the terminal that launched ",a.jsx("code",{className:"text-txt-primary",children:"pyr"}),"."]}),a.jsx("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:(H==null?void 0:H.mode)==="custom"?a.jsxs(a.Fragment,{children:["Custom shell active: ",a.jsx("code",{className:"text-txt-primary",children:H.executable||"unset"})]}):a.jsxs(a.Fragment,{children:["Current shell: ",a.jsx("code",{className:"text-txt-primary",children:(H==null?void 0:H.display_name)||"Follow current terminal"})]})}),a.jsxs("div",{className:"text-2xs leading-relaxed text-txt-secondary",children:["To override the default, set ",a.jsx("code",{className:"text-txt-primary",children:"shell_mode: custom"})," and ",a.jsx("code",{className:"text-txt-primary",children:"shell_executable"})," in ",a.jsx("code",{className:"text-txt-primary",children:"_pyruns_settings.yaml"}),"."]})]}),(B||ue)&&a.jsxs(ce,{title:"Status",bodyClassName:"space-y-1.5 p-2",children:[B&&a.jsx("div",{className:"rounded-md border border-rose-500/20 bg-rose-500/10 px-3 py-2 text-xs text-rose-400",title:B,children:B}),ue&&a.jsx("div",{className:"rounded-md border border-emerald-500/20 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-400",children:ue})]}),a.jsxs("div",{className:"sticky bottom-0 mt-auto border-t border-border-subtle bg-surface-raised pt-3",children:[a.jsx(se,{icon:a.jsx(ei,{className:"h-4 w-4"}),variant:"primary",size:"md",className:"w-full",onClick:k,disabled:V,children:V?"Creating...":L==="shell"?"Create Shell Task":he?"Preview Batch Tasks":"Generate Tasks"}),a.jsx("div",{className:"mt-2 text-center text-2xs text-txt-tertiary",children:L==="form"&&he?Ye:L==="yaml"&&be?"YAML mode does not expand batch syntax. Switch back to Form mode.":L==="shell"?"Creates one config.sh task immediately.":"Creates one task immediately."})]})]})]}),a.jsxs(ns,{open:A,title:"Batch Preview",description:E?`${E.count} task(s) will be created`:"",confirmLabel:"Generate All",onConfirm:S,onCancel:()=>C(!1),children:[ae.length>0&&a.jsxs("div",{className:"space-y-2 rounded-lg border border-border-subtle bg-surface-overlay/70 p-3",children:[a.jsx("div",{className:"text-xs font-medium text-txt-primary",children:"Batch triggers"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:ae.map(w=>a.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-md border border-border-subtle bg-surface-raised px-2 py-1 text-2xs",title:w.value,children:[a.jsx("span",{className:"font-mono text-txt-primary",children:w.key}),a.jsx("span",{className:"rounded-full border border-border-subtle bg-surface-overlay px-1.5 py-0.5 uppercase tracking-[0.12em] text-[10px] text-txt-secondary",children:w.kind})]},w.key))})]}),(E==null?void 0:E.items)&&a.jsxs("div",{className:"mt-2 max-h-60 space-y-1 overflow-y-auto",children:[E.items.map(w=>a.jsxs("div",{className:"rounded-md border border-border-subtle bg-surface-overlay px-2 py-1 text-2xs font-mono text-txt-secondary",children:["#",w.index,": ",w.preview]},w.index)),E.count>E.items.length&&a.jsxs("div",{className:"px-2 text-2xs text-txt-tertiary",children:["...and ",E.count-E.items.length," more"]})]})]})]})}function uo({config:s,columns:e,declaredTypeMap:t,pinnedParams:n,batchParams:r,onTogglePin:i,onChange:o}){const[l,c]=y.useState(s||{});if(y.useEffect(()=>{s&&c(s)},[s]),!s||Object.keys(s).length===0)return a.jsx(js,{title:"No parameters",description:"Load a template to edit parameters"});const d=Object.keys(l).filter(f=>!f.startsWith("_meta")),p=(f,u)=>{const h={...l,[f]:u};c(h),o(h)};return a.jsx("div",{className:"h-full overflow-y-auto p-3",children:a.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`},children:d.map(f=>{const u=l[f];return typeof u=="object"&&u!==null&&!Array.isArray(u)?a.jsx("div",{className:"col-span-full",children:a.jsx(ur,{name:f,data:u,columns:e,declaredTypeMap:t,pinnedParams:n,batchParams:r,prefix:f,onTogglePin:i,onChange:h=>p(f,h)})},f):a.jsx(fr,{name:f,value:u,declaredType:t[f],pinned:n.includes(f),batchActive:r.includes(f),onChange:h=>p(f,h),onTogglePin:()=>i(f)},f)})})})}function ur({name:s,data:e,columns:t,declaredTypeMap:n,pinnedParams:r,batchParams:i,prefix:o,onTogglePin:l,onChange:c}){const[d,p]=y.useState(!0),f=(u,h)=>{c({...e,[u]:h})};return a.jsxs("div",{className:"overflow-hidden rounded-md border border-border-subtle bg-surface-raised",children:[a.jsxs("button",{type:"button",onClick:()=>p(!d),className:"flex w-full items-center gap-1.5 border-b border-border-subtle px-2.5 py-1.5 text-left transition-colors hover:bg-surface-overlay",children:[d?a.jsx(Te,{className:"h-3.5 w-3.5 text-txt-tertiary"}):a.jsx(Ae,{className:"h-3.5 w-3.5 text-txt-tertiary"}),a.jsx("span",{className:"truncate text-sm font-semibold text-txt-primary",title:s,children:s}),a.jsx("span",{className:"rounded-full border border-border-subtle px-1.5 py-0.5 text-2xs font-medium text-txt-secondary",children:Object.keys(e).length})]}),d&&a.jsx("div",{className:"p-2",children:a.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`},children:Object.entries(e).filter(([u])=>!u.startsWith("_meta")).map(([u,h])=>{const x=`${o}.${u}`;return typeof h=="object"&&h!==null&&!Array.isArray(h)?a.jsx("div",{className:"col-span-full",children:a.jsx(ur,{name:u,data:h,columns:t,declaredTypeMap:n,pinnedParams:r,batchParams:i,prefix:x,onTogglePin:l,onChange:m=>f(u,m)})},u):a.jsx(fr,{name:u,value:h,declaredType:n[x],pinned:r.includes(x),batchActive:i.includes(x),onChange:m=>f(u,m),onTogglePin:()=>l(x)},u)})})})]})}function fr({name:s,value:e,declaredType:t,pinned:n,batchActive:r,onChange:i,onTogglePin:o}){const l=t||cr(e),[c,d]=y.useState(tn(e));y.useEffect(()=>{d(tn(e))},[e]);const p=c.includes("|")||/^\s*-?\d+\s*:\s*-?\d+(?:\s*:\s*-?\d+)?\s*$/.test(c.trim()),f=()=>{const u=c.trim();if(l==="bool"&&!p){if(u==="true"||u==="True"||u==="1"){i(!0);return}if(u==="false"||u==="False"||u==="0"){i(!1);return}}if((l==="int"||l==="float")&&!p&&u!==""&&!Number.isNaN(Number(u))){i(l==="int"?Math.round(Number(u)):Number(u));return}if(l==="list"&&!p)try{const h=JSON.parse(c);if(Array.isArray(h)){i(h);return}}catch{}if(l==="null"&&!p&&u===""){i(null);return}i(c)};return a.jsxs("div",{className:$("flex items-center gap-1.5 rounded-md border px-1.5 py-1 transition-colors",n?"border-accent/20 bg-accent/5":"border-border-subtle bg-surface-raised hover:border-border",(p||r)&&"border-amber-500/20 bg-amber-500/5"),children:[a.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o()},title:n?"Unpin":"Pin",className:$("flex-none rounded-md p-0.5 transition-colors",n?"text-accent":"text-txt-tertiary hover:text-accent"),children:a.jsx(lt,{className:"h-3 w-3"})}),a.jsx("span",{className:"max-w-[34%] flex-none truncate text-xs font-semibold text-txt-primary",title:s,children:s}),a.jsx("span",{className:$("flex-none rounded-full border px-1.5 py-0.5 text-[10px] font-mono",Ri[l]),children:l}),l==="bool"&&!p?a.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>i(!e),title:`Toggle ${s}`,className:$("relative h-4.5 w-9 rounded-full transition-colors",e?"bg-accent":"bg-zinc-600"),children:a.jsx("span",{className:$("absolute top-0.5 h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"left-[18px]":"left-0.5")})}),a.jsx("span",{className:"text-xs font-mono text-txt-secondary",title:String(e),children:String(e)})]}):a.jsx("input",{type:"text",value:c,onChange:u=>d(u.target.value),onBlur:f,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),f())},spellCheck:!1,title:c,className:$("ml-auto min-w-0 flex-1 rounded-md border bg-transparent px-1.5 py-1 text-xs font-mono text-txt-primary outline-none transition-colors focus:border-border",p||r?"border-amber-500/20":"border-border-subtle")})]})}function fo({value:s,onChange:e,theme:t,extensions:n}){return a.jsx("div",{className:"h-full p-3",children:a.jsx("div",{className:"generator-code-editor",children:a.jsx(ln,{value:s,height:"100%",theme:t,extensions:n,onChange:r=>e(r)})})})}function ho({value:s,onChange:e,theme:t,extensions:n}){return a.jsx("div",{className:"h-full p-3",children:a.jsx("div",{className:"generator-code-editor",children:a.jsx(ln,{value:s,height:"100%",theme:t,extensions:n,onChange:r=>e(r)})})})}function tn(s){if(Array.isArray(s))try{return JSON.stringify(s)}catch{return String(s)}return String(s??"")}function mo(s,e=300){const[t,n]=y.useState(s);return y.useEffect(()=>{const r=setTimeout(()=>n(s),e);return()=>clearTimeout(r)},[s,e]),t}function hr({value:s,onChange:e,placeholder:t="Search...",debounceMs:n=300}){const[r,i]=y.useState(s),o=mo(r,n),l=y.useRef(null);return y.useEffect(()=>{e(o)},[o]),y.useEffect(()=>{i(s)},[s]),y.useEffect(()=>{const c=l.current;if(!c)return;c.style.height="0px";const d=Math.min(Math.max(c.scrollHeight,34),120);c.style.height=`${d}px`},[r]),a.jsxs("div",{className:"relative flex items-start",children:[a.jsx(Xr,{className:"pointer-events-none absolute left-2.5 top-2.5 h-3.5 w-3.5 text-txt-tertiary"}),a.jsx("textarea",{ref:l,rows:1,value:r,onChange:c=>i(c.target.value),placeholder:t,className:"min-h-[34px] w-full resize-none overflow-y-auto rounded-md border border-border-subtle bg-surface-overlay py-2 pl-8 pr-8 text-xs leading-5 text-txt-primary placeholder:text-txt-tertiary outline-none transition-colors focus:border-border focus:bg-surface-raised"}),r&&a.jsx("button",{type:"button",onClick:()=>{i(""),e("")},className:"absolute right-1.5 top-1.5 rounded-md p-1 text-txt-tertiary hover:bg-surface-hover hover:text-txt-primary",children:a.jsx(De,{className:"w-3 h-3"})})]})}function Ss({selected:s,className:e}){return a.jsx("span",{className:$("flex h-4.5 w-4.5 items-center justify-center rounded border transition-colors",s?"border-accent bg-accent text-white":"border-border-strong bg-surface-overlay text-transparent",e),children:a.jsx(un,{className:"h-3 w-3"})})}function po({total:s,offset:e,limit:t,onOffsetChange:n}){if(s<=t)return null;const r=Math.floor(e/t)+1,i=Math.ceil(s/t);return a.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-400",children:[a.jsx("button",{disabled:e===0,onClick:()=>n(Math.max(0,e-t)),className:$("p-1 rounded hover:bg-surface-overlay transition-colors",e===0&&"opacity-30 cursor-not-allowed"),children:a.jsx(Ir,{className:"w-3.5 h-3.5"})}),a.jsxs("span",{className:"tabular-nums",children:[r," / ",i]}),a.jsx("button",{disabled:e+t>=s,onClick:()=>n(e+t),className:$("p-1 rounded hover:bg-surface-overlay transition-colors",e+t>=s&&"opacity-30 cursor-not-allowed"),children:a.jsx(Ae,{className:"w-3.5 h-3.5"})}),a.jsxs("span",{className:"text-zinc-600 ml-1",children:[s," total"]})]})}const go={neutral:"border-border-subtle bg-surface-overlay text-txt-secondary",amber:"border-amber-500/20 bg-amber-500/10 text-amber-400",emerald:"border-emerald-500/20 bg-emerald-500/10 text-emerald-400",rose:"border-rose-500/20 bg-rose-500/10 text-rose-400",accent:"border-accent/20 bg-accent/8 text-accent"};function kt({label:s,value:e,tone:t="neutral"}){return a.jsxs("div",{className:$("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-2xs",go[t]),children:[a.jsx("span",{className:"uppercase tracking-[0.16em]",children:s}),a.jsx("span",{className:$("font-medium tabular-nums",t==="neutral"&&"text-txt-primary"),children:e})]})}function mr({task:s,onClose:e,onRefresh:t}){const[n,r]=y.useState("info"),[i,o]=y.useState(s.notes||""),[l,c]=y.useState(Object.entries(s.env||{}).map(([b,j])=>[b,String(j)])),[d,p]=y.useState(!1),[f,u]=y.useState(!1),[h,x]=y.useState(s.name);y.useEffect(()=>{r("info"),o(s.notes||""),c(Object.entries(s.env||{}).map(([b,j])=>[b,String(j)])),x(s.name),u(!1)},[s]);const m=y.useCallback(async()=>{p(!0);try{await bi(s.name,i),t()}finally{p(!1)}},[s.name,i,t]),g=y.useCallback(async()=>{p(!0);const b=Object.fromEntries(l.filter(([j])=>j.trim()));try{await wi(s.name,b),t()}finally{p(!1)}},[s.name,l,t]),N=y.useCallback(async()=>{if(!h.trim()||h===s.name){u(!1);return}p(!0);try{await ki(s.name,h.trim()),t(),e()}catch{x(s.name)}finally{p(!1),u(!1)}},[s.name,h,t,e]),T=[{key:"info",label:"Info",icon:Fr},{key:"config",label:s.task_kind==="shell"?"Script":"Config",icon:Zr},{key:"notes",label:"Notes",icon:ti},{key:"env",label:"Env",icon:ni}];return a.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",onClick:e,children:[a.jsx("div",{className:"absolute inset-0 bg-black/30"}),a.jsxs("div",{className:"animate-slide-in relative flex h-full w-[44%] min-w-[360px] max-w-[1120px] flex-col border-l border-border-subtle bg-surface-raised",onClick:b=>b.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center gap-2 border-b border-border-subtle px-4 py-3",children:[a.jsx(Ot,{status:s.status}),a.jsx("div",{className:"min-w-0 flex-1",children:f?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{autoFocus:!0,value:h,onChange:b=>x(b.target.value),onKeyDown:b=>{b.key==="Enter"&&N(),b.key==="Escape"&&(u(!1),x(s.name))},title:"New task name",className:"w-full rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 text-sm text-txt-primary outline-none focus:border-border"}),a.jsx("button",{type:"button",onClick:()=>void N(),title:"Save name",className:"rounded-md p-1.5 text-txt-secondary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:a.jsx(un,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>{u(!1),x(s.name)},title:"Cancel",className:"rounded-md p-1.5 text-txt-tertiary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:a.jsx(De,{className:"h-3.5 w-3.5"})})]}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"truncate text-sm font-medium text-txt-primary",children:s.name}),a.jsx("button",{type:"button",onClick:()=>u(!0),title:"Rename task",className:"rounded-md p-1 text-txt-tertiary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:a.jsx(Yr,{className:"h-3 w-3"})})]})}),a.jsx("button",{type:"button",onClick:e,className:"rounded-md p-1.5 text-txt-tertiary transition-colors hover:bg-surface-overlay hover:text-txt-primary",title:"Close",children:a.jsx(De,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex gap-1 border-b border-border-subtle px-3 py-2",children:T.map(({key:b,label:j,icon:v})=>a.jsxs("button",{type:"button",onClick:()=>r(b),className:$("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",n===b?"bg-surface-overlay text-txt-primary":"text-txt-secondary hover:bg-surface-overlay hover:text-txt-primary"),children:[a.jsx(v,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:j})]},b))}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[n==="info"&&a.jsx(yo,{task:s}),n==="config"&&a.jsx(xo,{task:s}),n==="notes"&&a.jsxs("div",{className:"flex h-full flex-col gap-3",children:[a.jsx("textarea",{value:i,onChange:b=>o(b.target.value),placeholder:"Add notes...",className:"min-h-[220px] flex-1 resize-none rounded-lg border border-border-subtle bg-surface-overlay p-3 text-xs font-mono text-txt-primary outline-none transition-colors focus:border-border"}),a.jsx("button",{type:"button",onClick:()=>void m(),disabled:d,className:"self-end rounded-md border border-border-subtle px-3 py-2 text-xs font-medium text-txt-primary transition-colors hover:bg-surface-overlay disabled:opacity-50",children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsx(As,{className:"h-3.5 w-3.5"}),"Save Notes"]})})]}),n==="env"&&a.jsxs("div",{className:"flex flex-col gap-3",children:[l.map(([b,j],v)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{value:b,onChange:O=>{const A=[...l];A[v]=[O.target.value,j],c(A)},placeholder:"KEY",className:"w-2/5 rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 text-xs font-mono text-txt-primary outline-none transition-colors focus:border-border"}),a.jsx("input",{value:j,onChange:O=>{const A=[...l];A[v]=[b,O.target.value],c(A)},placeholder:"value",className:"flex-1 rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 text-xs font-mono text-txt-primary outline-none transition-colors focus:border-border"}),a.jsx("button",{type:"button",onClick:()=>c(l.filter((O,A)=>A!==v)),className:"rounded-md p-1 text-txt-tertiary transition-colors hover:bg-surface-overlay hover:text-rose-400",title:"Remove",children:a.jsx(De,{className:"h-3.5 w-3.5"})})]},`${b}-${v}`)),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>c([...l,["",""]]),className:"text-xs text-txt-secondary transition-colors hover:text-txt-primary",children:"+ Add variable"}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{type:"button",onClick:()=>void g(),disabled:d,className:"rounded-md border border-border-subtle px-3 py-2 text-xs font-medium text-txt-primary transition-colors hover:bg-surface-overlay disabled:opacity-50",children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsx(As,{className:"h-3.5 w-3.5"}),"Save"]})})]})]})]})]})]})}function yo({task:s}){var t,n,r;const e=[["Status",s.status],["Created",s.created_at],["Task Kind",s.task_kind],["Config File",s.config_file],["Run Index",String(s.run_index||1)],["Directory",s.dir]];return(t=s.start_times)!=null&&t.length&&e.push(["Last Start",s.start_times[s.start_times.length-1]]),(n=s.finish_times)!=null&&n.length&&e.push(["Last Finish",s.finish_times[s.finish_times.length-1]]),(r=s.pids)!=null&&r.length&&e.push(["PIDs",s.pids.join(", ")]),s._load_error&&e.push(["Load Error",s._load_error]),a.jsx("div",{className:"space-y-2",children:e.map(([i,o])=>a.jsxs("div",{className:"grid grid-cols-[88px_minmax(0,1fr)] gap-3 border-b border-border-subtle py-2",children:[a.jsx("span",{className:"text-xs text-txt-tertiary",children:i}),a.jsx("span",{className:"break-all font-mono text-xs text-txt-primary",children:o})]},i))})}function xo({task:s}){var n;const e=Object.fromEntries(Object.entries(s.config||{}).filter(([r])=>!r.startsWith("_meta"))),t=(n=s.config_text)!=null&&n.trim()?s.config_text:Object.keys(e).length>0?lr(e):"(empty)";return a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"text-2xs uppercase tracking-[0.16em] text-txt-tertiary",children:s.config_file}),a.jsx("pre",{className:"overflow-auto whitespace-pre-wrap rounded-lg border border-border-subtle bg-surface-overlay p-4 font-mono text-xs leading-relaxed text-txt-primary",children:t})]})}const bo=["All",...Pi];function wo(){const{tasks:s,total:e,offset:t,limit:n,query:r,statusFilter:i,selectedIds:o,columns:l,setQuery:c,setStatusFilter:d,setOffset:p,setColumns:f,fetchTasks:u,toggleSelect:h,selectAll:x,clearSelection:m}=Yt(),[g,N]=y.useState("thread"),[T,b]=y.useState("2"),[j,v]=y.useState(!1),[O,A]=y.useState(null),[C,E]=y.useState(null),[R,V]=y.useState(!1),W=Tt(),[B,Y]=rs(),ue=B.get("task"),fe=s.some(S=>S.status==="running"||S.status==="queued");ls(u,fe?3e3:1e4,!0,!1),y.useEffect(()=>{u()},[r,i,t,u]),y.useEffect(()=>{if(!ue)return;let S=!1;return pi(ue).then(k=>{S||E(k)}).catch(()=>{if(!S){const k=new URLSearchParams(B);k.delete("task"),Y(k,{replace:!0})}}),()=>{S=!0}},[ue,B,Y]);const K=s.length>0&&s.every(S=>o.has(S.name)),H=y.useMemo(()=>s.filter(S=>S.pinned),[s]),L=y.useMemo(()=>s.filter(S=>!S.pinned),[s]),J=y.useMemo(()=>({total:e,active:s.filter(S=>S.status==="running"||S.status==="queued").length,completed:s.filter(S=>S.status==="completed").length,failed:s.filter(S=>S.status==="failed").length}),[s,e]),xe=y.useCallback(S=>{const k=S.trim();if(!k)return 1;const w=Number.parseInt(k,10);return Number.isFinite(w)?Math.min(32,Math.max(1,w)):1},[]),Je=y.useCallback(async()=>{const S=[...o];if(!S.length)return;const k=xe(T);b(String(k)),await gi(S,g,k),m(),V(!1),await u()},[o,g,T,xe,m,u]),Q=y.useCallback(async()=>{const S=[...o];S.length&&(await Ls(S),m(),v(!1),V(!1),await u())},[o,m,u]),ae=y.useCallback(async()=>{O&&(await Ls([O.name]),(C==null?void 0:C.name)===O.name&&E(null),A(null),await u())},[O,C,u]),ee=y.useCallback(async(S,k)=>{k==="run"||k==="rerun"?await wn(S.name,g):await kn(S.name),await u()},[g,u]),Ne=y.useCallback(async S=>{await xi(S.name,!S.pinned),await u()},[u]),he=()=>{V(!1),m()},be=S=>{if(R){h(S.name);return}E(S)},Ye=y.useCallback(()=>{if(E(null),!B.get("task"))return;const S=new URLSearchParams(B);S.delete("task"),Y(S,{replace:!0})},[B,Y]);return a.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border-subtle bg-surface-raised px-3 py-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx("select",{value:i,onChange:S=>d(S.target.value),title:"Filter by status",className:"appearance-none rounded-md border border-border-subtle bg-surface-overlay px-3 py-1.5 pr-7 text-xs text-txt-primary outline-none transition-colors focus:border-border",children:bo.map(S=>a.jsx("option",{value:S,children:S==="All"?"All Status":$i[S]},S))}),a.jsx(Te,{className:"pointer-events-none absolute right-2 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]}),a.jsx("div",{className:"w-64 max-w-full",children:a.jsx(hr,{value:r,onChange:c,placeholder:"Search tasks..."})}),a.jsxs("div",{className:"relative",children:[a.jsx("select",{value:l,onChange:S=>f(Number(S.target.value)),title:"Cards per row",className:"appearance-none rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 pr-6 text-xs text-txt-primary outline-none transition-colors focus:border-border",children:[1,2,3,4,5,6,7,8].map(S=>a.jsxs("option",{value:S,children:[S," col",S>1?"s":""]},S))}),a.jsx(Te,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]}),a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx(kt,{label:"Total",value:J.total}),a.jsx(kt,{label:"Active",value:J.active,tone:"amber"}),a.jsx(kt,{label:"Done",value:J.completed,tone:"emerald"}),a.jsx(kt,{label:"Failed",value:J.failed,tone:"rose"})]}),R?a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(se,{icon:a.jsx(Ss,{selected:K}),variant:"accentTint",onClick:()=>K?m():x(),children:K?"Deselect All":"Select All"}),a.jsxs("label",{className:"flex items-center gap-1.5 text-2xs text-txt-secondary",children:["Workers",a.jsx("input",{type:"number",min:1,max:32,value:T,onChange:S=>b(S.target.value),onBlur:()=>b(S=>String(xe(S))),title:"Max workers",className:"w-12 rounded-md border border-border-subtle bg-surface-overlay px-1.5 py-1 text-xs tabular-nums text-txt-primary outline-none transition-colors focus:border-border"})]}),a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:g,onChange:S=>N(S.target.value),title:"Execution mode",className:"appearance-none rounded-md border border-border-subtle bg-surface-overlay px-2.5 py-1.5 pr-6 text-xs text-txt-primary outline-none transition-colors focus:border-border",children:[a.jsx("option",{value:"thread",children:"Thread"}),a.jsx("option",{value:"process",children:"Process"})]}),a.jsx(Te,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]}),a.jsxs(se,{icon:a.jsx(is,{className:"h-3.5 w-3.5"}),variant:"success",onClick:Je,disabled:o.size===0,children:["Run (",o.size,")"]}),a.jsx(se,{icon:a.jsx(pn,{className:"h-3.5 w-3.5"}),variant:"danger",onClick:()=>o.size>0&&v(!0),disabled:o.size===0,children:"Delete"}),a.jsx(se,{variant:"ghost",onClick:he,children:"Cancel"})]}):a.jsx(se,{icon:a.jsx(Jr,{className:"h-4 w-4"}),variant:"primary",size:"md",onClick:()=>V(!0),children:"Select"})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:s.length===0?a.jsx(js,{title:"No tasks found",description:r?"Try a different search":"Generate some tasks to get started"}):a.jsxs("div",{className:"space-y-3",children:[H.length>0&&a.jsx(ce,{title:"Pinned",subtitle:`${H.length} pinned task${H.length>1?"s":""}`,icon:a.jsx(lt,{className:"h-3.5 w-3.5 text-accent"}),accent:!0,bodyClassName:"p-2",children:a.jsx(sn,{tasks:H,columns:l,selectedIds:o,selectMode:R,onCardClick:be,onTaskAction:ee,onPin:Ne,onDelete:A,onMonitor:S=>{qe.getState().selectTask(S.name),W("/monitor")}})}),a.jsx(ce,{title:"Tasks",subtitle:`${L.length} task${L.length>1?"s":""}`,icon:a.jsx(hn,{className:"h-3.5 w-3.5 text-txt-tertiary"}),bodyClassName:"p-2",children:a.jsx(sn,{tasks:L,columns:l,selectedIds:o,selectMode:R,onCardClick:be,onTaskAction:ee,onPin:Ne,onDelete:A,onMonitor:S=>{qe.getState().selectTask(S.name),W("/monitor")}})})]})}),a.jsxs("div",{className:"flex items-center justify-between border-t border-border-subtle bg-surface-raised px-3 py-1.5",children:[a.jsxs("span",{className:"text-2xs text-txt-tertiary",children:[R&&o.size>0?`${o.size} selected | `:"",e," task",e!==1?"s":""]}),a.jsx(po,{total:e,offset:t,limit:n,onOffsetChange:p})]}),a.jsx(ns,{open:j,title:"Delete Tasks",description:`Move ${o.size} task(s) to trash?`,confirmLabel:"Delete",confirmVariant:"danger",onConfirm:Q,onCancel:()=>v(!1)}),a.jsx(ns,{open:!!O,title:"Delete Task",description:O?`Move '${O.name}' to trash?`:"",confirmLabel:"Delete",confirmVariant:"danger",onConfirm:ae,onCancel:()=>A(null)}),C&&a.jsx(mr,{task:C,onClose:Ye,onRefresh:u})]})}function sn({tasks:s,columns:e,selectedIds:t,selectMode:n,onCardClick:r,onTaskAction:i,onPin:o,onDelete:l,onMonitor:c}){return s.length===0?a.jsx("div",{className:"px-2 py-5 text-center text-2xs text-txt-tertiary",children:"No tasks in this section"}):a.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`},children:s.map(d=>a.jsx(ko,{task:d,selected:t.has(d.name),selectMode:n,onClick:()=>r(d),onAction:p=>void i(d,p),onPin:()=>void o(d),onDelete:()=>l(d),onMonitor:()=>c(d)},d.name))})}function ko({task:s,selected:e,selectMode:t,onClick:n,onAction:r,onPin:i,onDelete:o,onMonitor:l}){const c=No(s),d=s.dir.split(/[\\/]/).pop()||s.dir,p=s.task_kind==="shell"?"shell":"config",f=s._load_error||s.preview_text||"No preview available.";return a.jsxs("div",{className:$("group relative cursor-pointer rounded-md border bg-surface-raised px-3 py-2.5 transition-colors",e?"border-accent bg-accent/8 ring-1 ring-accent/20":"border-border-subtle hover:border-border",s.pinned&&!e&&"border-accent/20"),onClick:n,children:[t?a.jsx("div",{className:"absolute right-2.5 top-2.5",children:a.jsx(Ss,{selected:e})}):a.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),i()},title:s.pinned?"Unpin":"Pin",className:$("absolute right-2.5 top-2.5 rounded-md p-1 transition-colors hover:bg-surface-overlay",s.pinned?"text-accent":"text-txt-tertiary hover:text-accent"),children:a.jsx(lt,{className:"h-3.5 w-3.5"})}),a.jsxs("div",{className:"flex items-center gap-2 pr-7",children:[a.jsx(Ot,{status:s.status}),a.jsx("span",{className:"text-2xs uppercase tracking-[0.16em] text-txt-tertiary",children:p})]}),a.jsx("div",{className:"mt-1.5 pr-7 text-sm font-medium text-txt-primary",title:s.name,children:s.name}),a.jsx("div",{className:"mt-1 min-h-[30px] text-2xs leading-5 text-txt-secondary",title:f,children:a.jsx("div",{className:$("truncate-2",s._load_error&&"text-rose-400"),children:f})}),a.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-txt-tertiary",children:[a.jsx("span",{title:s.created_at,children:s.created_at}),a.jsxs("span",{title:`Run #${Math.max(s.run_index||1,1)}`,children:["Run #",Math.max(s.run_index||1,1)]}),a.jsx("span",{className:"truncate",title:d,children:d})]}),s._load_error&&a.jsxs("div",{className:"mt-2 inline-flex max-w-full items-center gap-1 rounded-full border border-rose-500/20 bg-rose-500/10 px-2 py-1 text-2xs text-rose-400",title:s._load_error,children:[a.jsx(gn,{className:"h-3 w-3"}),a.jsx("span",{className:"truncate",children:"Task load error"})]}),!t&&a.jsxs("div",{className:"mt-2.5 flex items-center justify-end gap-1 border-t border-border-subtle pt-1.5",children:[c&&a.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),r(c.action)},title:c.label,className:$("rounded-md p-1.5 transition-colors",c.className),children:a.jsx(c.icon,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),l()},title:"View logs",className:"rounded-md p-1.5 text-txt-tertiary transition-colors hover:bg-surface-overlay hover:text-txt-primary",children:a.jsx(Be,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o()},title:"Delete task",className:"rounded-md p-1.5 text-rose-400 transition-colors hover:bg-rose-500/10 hover:text-rose-300",children:a.jsx(pn,{className:"h-3.5 w-3.5"})})]})]})}function No(s){if(s._load_error)return null;switch(s.status){case"pending":case"failed":return{action:"run",icon:is,label:"Run",className:"text-emerald-400 hover:bg-emerald-500/10"};case"running":case"queued":return{action:"cancel",icon:mn,label:"Stop",className:"text-rose-400 hover:bg-rose-500/10"};case"completed":return{action:"rerun",icon:Qr,label:"Rerun",className:"text-blue-400 hover:bg-blue-500/10"};default:return null}}var vo=jr(),jo=Sr();function So({taskName:s,onChunk:e,enabled:t=!0}){const n=y.useRef(null),r=y.useRef(e);r.current=e;const i=y.useCallback(()=>{n.current&&(n.current.close(),n.current=null)},[]);return y.useEffect(()=>{if(!s||!t){i();return}const o=Ni(s);return n.current=o,o.onmessage=l=>{if(n.current===o)try{const c=JSON.parse(l.data);c.type==="chunk"&&c.content&&r.current(c)}catch{}},o.onerror=()=>o.close(),()=>{o.onmessage=null,o.onerror=null,n.current===o&&(n.current=null),o.close()}},[s,t,i]),{disconnect:i}}function Co(){var S;const{tasks:s,fetchTasks:e}=Yt(),t=pe(k=>k.workspace),{selectedTaskName:n,logContent:r,availableLogs:i,selectedLog:o,loading:l,exportIds:c,selectTask:d,selectLogFile:p,appendLog:f,toggleExport:u,selectAllExport:h,clearExport:x}=qe(),[m,g]=y.useState(""),[N,T]=y.useState(!1),[b,j]=y.useState(null),v=y.useRef(null),O=y.useRef(null),A=y.useRef(null),C=y.useRef(null),E=y.useRef(null),R=y.useRef(n),V=y.useRef(o),W=y.useRef(""),B=s.some(k=>k.status==="running"||k.status==="queued"),Y=Number(((S=t==null?void 0:t.settings)==null?void 0:S.monitor_sidebar_width_pct)??14),ue=Number.isFinite(Y)?Y:14,fe=!!n;ls(e,B?3e3:1e4,!0,!1),y.useEffect(()=>{e()},[e]),y.useEffect(()=>{const k=new vo.Terminal({cursorBlink:!1,disableStdin:!0,scrollback:1e5,fontSize:13,fontFamily:"'JetBrains Mono', 'Cascadia Code', Consolas, monospace",allowProposedApi:!0,theme:{background:"#0A0A0B",foreground:"#E4E4E7",cursor:"#E4E4E7",selectionBackground:"#5E6AD240",selectionForeground:"#FFFFFF",black:"#27272A",red:"#F43F5E",green:"#10B981",yellow:"#F59E0B",blue:"#3B82F6",magenta:"#A855F7",cyan:"#06B6D4",white:"#E4E4E7",brightBlack:"#52525B",brightRed:"#FB7185",brightGreen:"#34D399",brightYellow:"#FBBF24",brightBlue:"#60A5FA",brightMagenta:"#C084FC",brightCyan:"#22D3EE",brightWhite:"#FAFAFA"}});k.attachCustomKeyEventHandler(P=>{var me;if(!((P.ctrlKey||P.metaKey)&&!P.altKey&&P.key.toLowerCase()==="c"))return!0;const ve=k.getSelection();return ve?(P.preventDefault(),typeof navigator<"u"&&((me=navigator.clipboard)!=null&&me.writeText)&&navigator.clipboard.writeText(ve).catch(()=>{}),!1):!0});const w=new jo.FitAddon;return k.loadAddon(w),O.current=k,A.current=w,()=>{var P;(P=C.current)==null||P.disconnect(),k.dispose(),O.current=null,A.current=null}},[]),y.useEffect(()=>{var te,Qe;if(!fe){(te=C.current)==null||te.disconnect();return}const k=O.current,w=A.current,P=v.current;if(!k||!w||!P)return;k.element?k.element.parentElement!==P&&P.appendChild(k.element):k.open(P);const G=()=>{try{w.fit()}catch{}},ve=requestAnimationFrame(G);(Qe=C.current)==null||Qe.disconnect();const me=new ResizeObserver(G);return me.observe(P),C.current=me,()=>{cancelAnimationFrame(ve),me.disconnect()}},[fe]);const K=`${n??""}::${o||""}`,H=!l&&i.length===0&&!o;y.useEffect(()=>{const k=O.current;if(!k)return;if(!n){k.clear(),k.reset(),E.current=null;return}const w=E.current;if(!w||w.key!==K){k.clear(),k.reset(),r?k.write(r):H&&k.write(`\x1B[2m  < NO LOG >\x1B[0m\r
`),E.current={key:K,content:r};return}if(r!==w.content){if(r.startsWith(w.content)){const G=r.slice(w.content.length);G&&k.write(G)}else k.clear(),k.reset(),r?k.write(r):H&&k.write(`\x1B[2m  < NO LOG >\x1B[0m\r
`);E.current={key:K,content:r}}},[K,n,r,H]),y.useEffect(()=>{s.length===0||!n||s.some(w=>w.name===n)||qe.setState({selectedTaskName:null,logContent:"",logOffset:0,availableLogs:[],selectedLog:""})},[s,n]),y.useEffect(()=>{if(!b)return;const k=s.find(w=>w.name===b.name);if(!k){j(null);return}k!==b&&j(k)},[b,s]);const L=s.find(k=>k.name===n),J=L?`run${Math.max(L.run_index||1,1)}.log`:"",xe=(L==null?void 0:L.status)==="running"&&(!o||o===J);R.current=n,V.current=o,W.current=J;const Je=y.useCallback(k=>{const w=R.current;if(!w||k.task_name!==w)return;const P=V.current;P&&P!==W.current||f(k.content)},[f]);So({taskName:n,onChunk:Je,enabled:xe});const Q=m?s.filter(k=>Ao(k,m)):s,ae=Q.filter(k=>k.pinned),ee=Q.filter(k=>!k.pinned),Ne=Q.length>0&&Q.every(k=>c.has(k.name)),he=k=>{if(N){u(k.name);return}d(k.name)},be=y.useCallback(async k=>{if(!n||!L)return;const w=n;k==="run"?await wn(w):await kn(w),await e(),Yt.getState().tasks.some(G=>G.name===w)&&await d(w)},[n,L,e,d]),Ye=y.useCallback(async()=>{const k=[...c];if(!k.length)return;const w=await yi(k),P=URL.createObjectURL(w),G=document.createElement("a");G.href=P,G.download=`pyruns_export_${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.csv`,G.click(),URL.revokeObjectURL(P)},[c]);return a.jsxs("div",{className:"flex h-full overflow-hidden",children:[a.jsxs("aside",{className:"flex flex-col overflow-hidden border-r border-border-subtle bg-surface-raised",style:{width:`${ue}%`},children:[a.jsxs("div",{className:"border-b border-border-subtle px-2.5 py-2",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-2xs uppercase tracking-[0.18em] text-txt-tertiary",children:"Monitor"}),a.jsxs("div",{className:"text-sm font-medium text-txt-primary",children:[Q.length," task views"]})]}),a.jsx("span",{className:"rounded-full border border-border-subtle bg-surface-overlay px-2 py-1 text-2xs text-txt-secondary",children:B?"Live polling":"Idle polling"})]}),a.jsx(hr,{value:m,onChange:g,placeholder:"Filter tasks...",debounceMs:150})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[ae.length>0&&a.jsx(ce,{title:"Pinned",subtitle:`${ae.length} pinned`,icon:a.jsx(lt,{className:"h-3.5 w-3.5 text-accent"}),accent:!0,className:"mb-3",bodyClassName:"space-y-1 p-1",children:ae.map(k=>a.jsx(nn,{task:k,active:!N&&k.name===n,exportMode:N,exportSelected:c.has(k.name),onClick:()=>he(k)},k.name))}),a.jsx(ce,{title:"Tasks",subtitle:`${ee.length} task${ee.length>1?"s":""}`,icon:a.jsx(hn,{className:"h-3.5 w-3.5 text-txt-tertiary"}),bodyClassName:"space-y-1 p-1",children:ee.length===0&&ae.length===0?a.jsx("div",{className:"px-2 py-5 text-center text-2xs text-txt-tertiary",children:"No tasks"}):ee.map(k=>a.jsx(nn,{task:k,active:!N&&k.name===n,exportMode:N,exportSelected:c.has(k.name),onClick:()=>he(k)},k.name))})]}),a.jsx("div",{className:"border-t border-border-subtle px-2.5 py-2",children:N?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between px-0.5 text-2xs",children:[a.jsx("button",{type:"button",onClick:()=>Ne?x():h(Q.map(k=>k.name)),className:"text-accent transition-colors hover:text-accent-hover",children:Ne?"Deselect All":"Select All"}),a.jsxs("span",{className:"text-txt-tertiary",children:[c.size," selected"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(se,{icon:a.jsx(Br,{className:"h-3.5 w-3.5"}),variant:"primary",className:"flex-1",onClick:Ye,disabled:c.size===0,children:"Export"}),a.jsx(se,{variant:"ghost",onClick:()=>{T(!1),x()},children:"Cancel"})]})]}):a.jsx(se,{icon:a.jsx(Dr,{className:"h-3.5 w-3.5"}),variant:"primary",className:"w-full",onClick:()=>T(!0),children:"Export"})})]}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",style:{background:"#0A0A0B"},children:[a.jsx("div",{className:"flex items-center gap-2.5 border-b border-border-subtle bg-surface-raised px-3 py-2",children:L?a.jsxs(a.Fragment,{children:[a.jsx(Ot,{status:L.status}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate text-sm font-medium text-txt-primary",title:L.name,children:L.name}),a.jsx("div",{className:"truncate text-2xs text-txt-tertiary",title:o||J||"latest log",children:o||J||"latest log"})]}),xe&&a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-emerald-500/20 bg-emerald-500/10 px-2 py-1 text-2xs text-emerald-400",children:[a.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400"}),"Live"]}),(L.status==="pending"||L.status==="failed"||L.status==="completed")&&a.jsx(se,{icon:a.jsx(is,{className:"h-3.5 w-3.5"}),variant:"success",onClick:()=>void be("run"),children:"Run"}),(L.status==="running"||L.status==="queued")&&a.jsx(se,{icon:a.jsx(mn,{className:"h-3.5 w-3.5"}),variant:"danger",onClick:()=>void be("cancel"),children:"Stop"}),a.jsx(se,{variant:"accentTint",onClick:()=>j(L),children:"View Details"}),i.length>1&&a.jsxs("div",{className:"relative",children:[a.jsx("select",{value:o,onChange:k=>void p(k.target.value),title:"Select log file",className:"appearance-none rounded-md border border-border-subtle bg-surface-overlay px-2 py-1.5 pr-6 text-2xs text-txt-primary outline-none transition-colors focus:border-border",children:i.map(k=>a.jsx("option",{value:k,children:k},k))}),a.jsx(Te,{className:"pointer-events-none absolute right-1.5 top-1/2 h-3 w-3 -translate-y-1/2 text-txt-tertiary"})]})]}):a.jsx("span",{className:"text-xs text-txt-tertiary",children:"Select a task to view logs"})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:n?a.jsx("div",{ref:v,className:"monitor-terminal-shell h-full w-full"}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx(js,{title:"No task selected",description:"Select a task from the sidebar to inspect logs"})})})]}),b&&a.jsx(mr,{task:b,onClose:()=>j(null),onRefresh:()=>{e()}})]})}function nn({task:s,active:e,exportMode:t,exportSelected:n,onClick:r}){return a.jsxs("button",{type:"button",onClick:r,className:$("flex w-full items-center gap-1.5 rounded-md border px-2 py-1 text-left transition-colors",t&&n&&"border-accent/25 bg-accent/10",!t&&e?"border-accent/25 bg-accent/10":"border-transparent hover:border-border-subtle hover:bg-surface-overlay"),title:s.name,children:[t&&a.jsx(Ss,{selected:n}),a.jsx(To,{status:s.status}),a.jsx("span",{className:$("flex-1 truncate text-xs",e&&!t?"font-medium text-txt-primary":"text-txt-secondary"),children:s.name}),s.status==="running"&&a.jsx("span",{className:"h-1.5 w-1.5 flex-none animate-pulse rounded-full bg-amber-400"})]})}function To({status:s}){const e={pending:"bg-gray-500",queued:"bg-blue-500",running:"bg-amber-500",completed:"bg-emerald-500",failed:"bg-rose-500"};return a.jsx("span",{className:$("h-2 w-2 flex-none rounded-full",e[s])})}function Ao(s,e){const t=[s.name,s.notes,s.preview_text,s.search_text,s.config_text].filter(Boolean).join(`
`).toLowerCase(),n=e.split(/\r?\n/).map(r=>r.trim().toLowerCase()).filter(Boolean);return n.length===0?!0:n.every(r=>t.includes(r))}function Oo({onClose:s}){const{scripts:e,configs:t,selectedScript:n,selectedConfig:r,step:i,loading:o,fetchScripts:l,selectScript:c,selectConfig:d,openWorkspace:p,reset:f}=Bt(),u=Tt(),[h]=rs();y.useEffect(()=>{l();const g=h.get("script");g&&c(g)},[]);const x=y.useCallback(async()=>{await p(),s(),u("/")},[s,u]),m=y.useCallback(async()=>{d(""),await Bt.getState().openWorkspace(),s(),u("/")},[s,u]);return a.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/70 backdrop-blur-sm",children:a.jsxs("div",{className:"bg-surface-raised border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 border-b border-border-subtle",children:[a.jsx(fn,{className:"w-5 h-5 text-accent"}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-zinc-100",children:"Launch Workspace"}),a.jsx("p",{className:"text-2xs text-zinc-500 mt-0.5",children:"Select a script and configuration to get started"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border-subtle",children:[a.jsx(Jt,{num:1,label:"Script",active:i===0,done:i>0}),a.jsx(Ae,{className:"w-3 h-3 text-zinc-600"}),a.jsx(Jt,{num:2,label:"Config",active:i===1,done:i>1}),a.jsx(Ae,{className:"w-3 h-3 text-zinc-600"}),a.jsx(Jt,{num:3,label:"Open",active:i===2,done:!1})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx("div",{className:"text-xs text-zinc-500 animate-pulse",children:"Loading..."})}),!o&&i===0&&a.jsx("div",{className:"space-y-1",children:e.length===0?a.jsx("div",{className:"text-center py-12 text-xs text-zinc-600",children:"No Python scripts found in the current directory."}):e.map(g=>a.jsx(Eo,{script:g,onClick:()=>c(g.script_path)},g.script_path||g.workspace_path))}),!o&&i===1&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"text-2xs text-zinc-500 mb-3",children:["Select a config for ",a.jsx("span",{className:"text-zinc-300 font-medium",children:n.split("/").pop()})]}),t.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx("p",{className:"text-xs text-zinc-600 mb-3",children:"No config files found"}),a.jsx("button",{onClick:m,className:"text-xs text-accent hover:text-accent-hover transition-colors",children:"Continue without config →"})]}):a.jsxs(a.Fragment,{children:[t.map(g=>a.jsx(_o,{config:g,onClick:()=>d(g.path)},g.path)),a.jsx("button",{onClick:m,className:"w-full text-left px-3 py-2 text-2xs text-zinc-600 hover:text-zinc-400 transition-colors",children:"Skip — use workspace default"})]})]}),!o&&i===2&&a.jsxs("div",{className:"flex flex-col items-center py-8 gap-4",children:[a.jsx("div",{className:"p-3 rounded-full bg-accent/10",children:a.jsx(Kr,{className:"w-6 h-6 text-accent"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-zinc-200 font-medium",children:"Ready to launch"}),a.jsx("p",{className:"text-2xs text-zinc-500 mt-1 font-mono",children:n.split("/").pop()}),r&&a.jsx("p",{className:"text-2xs text-zinc-600 mt-0.5 font-mono",children:r.split("/").pop()})]}),a.jsxs("button",{onClick:x,disabled:o,className:"flex items-center gap-2 px-6 py-2.5 rounded-md bg-accent text-white text-sm font-medium hover:bg-accent-hover transition-colors disabled:opacity-50",children:["Open Workspace ",a.jsx(dn,{className:"w-4 h-4"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border-subtle",children:[i>0?a.jsx("button",{onClick:()=>Bt.setState({step:i-1}),className:"text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:"← Back"}):a.jsx("div",{}),a.jsx("button",{onClick:s,className:"text-xs text-zinc-600 hover:text-zinc-400 transition-colors",children:"Cancel"})]})]})})}function Jt({num:s,label:e,active:t,done:n}){return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:$("w-5 h-5 rounded-full flex items-center justify-center text-2xs font-medium",t?"bg-accent text-white":n?"bg-accent/20 text-accent":"bg-surface-overlay text-zinc-600"),children:n?"✓":s}),a.jsx("span",{className:$("text-xs",t?"text-zinc-200":"text-zinc-500"),children:e})]})}function Eo({script:s,onClick:e}){return a.jsxs("button",{onClick:e,className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-surface-overlay transition-colors text-left group",children:[a.jsx(At,{className:"w-4 h-4 text-zinc-500 group-hover:text-accent transition-colors flex-none"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-zinc-200 truncate",children:s.label}),a.jsx("div",{className:"text-2xs text-zinc-600 font-mono truncate",children:s.script_path})]}),s.source==="workspace"||s.source==="workspace+file"?a.jsx("span",{className:"text-2xs text-accent/60 flex-none",children:"workspace"}):null,a.jsx(Ae,{className:"w-3.5 h-3.5 text-zinc-600 group-hover:text-zinc-400 flex-none"})]})}function _o({config:s,onClick:e}){return a.jsxs("button",{onClick:e,className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-surface-overlay transition-colors text-left group",children:[a.jsx(At,{className:"w-4 h-4 text-zinc-500 group-hover:text-accent transition-colors flex-none"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm text-zinc-200",children:s.label})}),s.kind==="workspace_default"&&a.jsx("span",{className:"text-2xs text-zinc-600 flex-none",children:"default"}),a.jsx(Ae,{className:"w-3.5 h-3.5 text-zinc-600 group-hover:text-zinc-400 flex-none"})]})}function Lo(){const[s,e]=rs(),[t,n]=y.useState(!1),r=pe(l=>l.fetch),i=os(l=>l.theme);y.useEffect(()=>{as(i)},[i]),y.useEffect(()=>{r()},[]),y.useEffect(()=>{s.get("launcher")==="1"&&n(!0)},[s]);const o=()=>{n(!1),s.delete("launcher"),s.delete("script"),s.delete("config"),e(s,{replace:!0})};return a.jsxs(a.Fragment,{children:[a.jsx(Nr,{children:a.jsxs(Xe,{element:a.jsx(Mi,{}),children:[a.jsx(Xe,{index:!0,element:a.jsx(Di,{})}),a.jsx(Xe,{path:"generator",element:a.jsx(co,{})}),a.jsx(Xe,{path:"manager",element:a.jsx(wo,{})}),a.jsx(Xe,{path:"monitor",element:a.jsx(Co,{})})]})}),t&&a.jsx(Oo,{onClose:o})]})}Ar.createRoot(document.getElementById("root")).render(a.jsx(et.StrictMode,{children:a.jsx(vr,{children:a.jsx(Lo,{})})}));
