@gbasin/agentboard-linux-arm64 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -303,4 +303,4 @@ ${s.join(`
|
|
|
303
303
|
active:scale-95 transition-all duration-75
|
|
304
304
|
select-none touch-manipulation
|
|
305
305
|
${r?iW[t.status]:rW[t.status]}
|
|
306
|
-
`,onClick:()=>{aW(),u(t.id)},title:lt?t.name:void 0,children:i},t.id)})})]}),(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[(0,W.jsx)(`div`,{ref:we,className:`absolute inset-0`,style:{backgroundColor:S.background}}),Me&&e&&(0,W.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,W.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,W.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,W.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Fe&&e&&(0,W.jsxs)(`div`,{className:`absolute ${j&&!N?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:left-auto md:right-4 md:translate-x-0`,children:[(0,W.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,W.jsxs)(`button`,{type:`button`,onClick:Ie,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,W.jsx)(de,{width:14,height:14}),`Copy`]}),(0,W.jsx)(`button`,{type:`button`,onClick:Re,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,W.jsx)(Ue,{width:14,height:14})})]}),!e&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ve&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,W.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,W.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:be}),(0,W.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),xe&&(0,W.jsx)(`span`,{className:`text-muted`,children:xe}),(0,W.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Se]})]}),n.lastResumeError&&(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,W.jsx)(ae,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,W.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>h(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>_(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,W.jsx)(nE,{session:n})]})}),ke&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:bottom-8`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,W.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,W.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):j&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,W.jsx)(zU,{...ot}),e&&(0,W.jsx)($U,{onSendKey:nt,onPasteText:rt,onPasteImage:it,disabled:a!==`connected`||ve||!Pe,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!fe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:at,isKeyboardVisible:ct,onEnterTextMode:st}),(A||k)&&(0,W.jsx)(eW,{isOpen:z,onClose:()=>B(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:h,onHibernate:g,onMoveToHistory:_,onNewSession:f,loading:y,error:b}),F&&e&&(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,W.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,W.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,W.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{onClick:()=>I(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,W.jsx)(`button`,{ref:ce,onClick:He,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function sW({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=H(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,W.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,W.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,W.jsx)(`p`,{className:`text-danger`,children:s}),(0,W.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,W.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,W.jsx)(xe,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,W.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,W.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function cW(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function lW(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?cW(o):null}function uW(e){return e?e===`claude-rp`?`claude`:e:null}function dW(e){let t=e.trim();if(!t)return``;let n=cW(t);return lW(n)??n}function fW(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`}function pW(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=fW(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function mW(e){let t=dW(e);if(t)return pW(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var hW={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null},gW={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[]};function _W(e){let t=uW(e);return t?hW[t]:null}function vW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yW(e){return RegExp(`(^|\\s)${vW(e)}(?=\\s|$)`,`g`)}function bW(e,t){return(t?[uW(t)].filter(e=>e!==null):Object.keys(gW)).some(t=>gW[t].some(t=>yW(t).test(e)))}function xW(e,t){let n=pW(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function SW(e,t){let n=_W(t);if(!n)return e;let r=e.trim();if(!r||bW(r,t))return r;let i=xW(r,n);if(i)return i;let a=dW(r);if(a&&a!==r){let e=xW(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function CW(e,t){let n=uW(t);if(!n||bW(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function wW(e,t){let n=uW(t);if(!n)return e;let r=e;for(let e of gW[n])r=r.replace(yW(e),` `);return r.replace(/\s+/g,` `).trim()}function TW({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=H(e=>e.yoloMode),D=H(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=l&&c.length>0,M=e=>{if(!E)return e;let t=mW(e);return t&&!CW(e,t)?SW(e,t):e};if((0,x.useEffect)(()=>{if(!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let t=f?.trim();if(t){let e=i.find(e=>te(e)===t);e?(v(e.id),b(te(e))):(v(null),b(t))}else{let e=i.find(e=>e.id===a);e?(v(a),b(M(te(e)))):i.length>0?(v(i[0].id),b(M(te(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S]),!e)return null;let N=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(M(te(t))))},P=()=>{v(null),b(``)},F=_===null,I=w!==``,L=mW(y),ee=_W(L)!==null,R=L?bW(y,L):!1,z=L&&!R?CW(y,L):null,B=!ee||z!==null,V=L?L===`pi`?`Pi has no permission prompts — nothing to enable`:z??`Append ${_W(L)}`:`Enter a supported agent command (claude, codex, grok, devin)`,ne=e=>{D(e),L&&b(e?SW(y,L):wW(y,L))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,I?w:void 0),t()},U=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ie=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],ae=p.trim()||`~`;return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,W.jsxs)(`form`,{ref:O,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,W.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[j&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ie.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:U.map((e,t)=>{let n=e.isCustom?F:_===e.id;return(0,W.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,tabIndex:n?0:-1,onClick:()=>{e.isCustom?P():N(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%U.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+U.length)%U.length;else return;let r=U[n];r.isCustom?P():N(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[(0,W.jsx)(nh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,W.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,W.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${B?`text-muted opacity-60`:`text-secondary`}`,title:V,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:R,disabled:B,onChange:e=>ne(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:I?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!I&&(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,W.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,W.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!I&&(0,W.jsx)(sW,{initialPath:ae,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function EW({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var DW={};function OW(e,t){let n=x.useRef(DW);return n.current===DW&&(n.current=e(t)),n}var kW=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],AW=kW&&kW!==x.useLayoutEffect?kW:e=>e();function jW(e){let t=OW(MW).current;return t.next=e,AW(t.effect),t.trampoline}function MW(){let e={next:void 0,callback:NW,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function NW(){}function PW(e,t,n,r){let i=OW(IW).current;return LW(i,e,t,n,r)&&zW(i,[e,t,n,r]),i.callback}function FW(e){let t=OW(IW).current;return RW(t,e)&&zW(t,e),t.callback}function IW(){return{callback:null,cleanup:null,refs:[]}}function LW(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function RW(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function zW(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var BW=typeof document<`u`?x.useLayoutEffect:()=>{},VW={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},HW={...VW,position:`fixed`,top:0,left:0},UW={...VW,position:`absolute`};function WW(){}Object.freeze([]);var GW=Object.freeze({});function KW(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var qW=18;function JW(e){return qW>=e}function YW(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(JW(19)?n?.ref:t.ref)??null}function XW(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function ZW(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function QW(e,t){return typeof e==`function`?e(t):e}function $W(e,t){return typeof e==`function`?e(t):e}var eG={};function tG(e,t,n,r,i){let a={...sG(e,eG)};return t&&(a=rG(a,t)),n&&(a=rG(a,n)),r&&(a=rG(a,r)),i&&(a=rG(a,i)),a}function nG(e){if(e.length===0)return eG;if(e.length===1)return sG(e[0],eG);let t={...sG(e[0],eG)};for(let n=1;n<e.length;n+=1)t=rG(t,e[n]);return t}function rG(e,t){return oG(t)?t(e):iG(e,t)}function iG(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=XW(e.style,r);break;case`className`:e[n]=uG(e.className,r);break;default:aG(n,r)?e[n]=cG(e[n],r):e[n]=r}}return e}function aG(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function oG(e){return typeof e==`function`}function sG(e,t){return oG(e)?e(t):e??eG}function cG(e,t){return t?e?n=>{if(dG(n)){let r=n;lG(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function lG(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function uG(e,t){return t?e?t+` `+e:t:e}function dG(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function fG(e,t,n={}){let r=t.render,i=pG(t,n);return n.enabled===!1?null:hG(e,r,i,n.state??GW)}function pG(e,t={}){let{className:n,style:r,render:i}=e,{state:a=GW,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?QW(n,a):void 0,d=l?$W(r,a):void 0,f=l?ZW(a,c):GW,p=l?XW(f,Array.isArray(s)?nG(s):s)??GW:GW;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=FW([p.ref,YW(i),...o]):p.ref=PW(p.ref,YW(i),o):PW(null,null)),l?(u!==void 0&&(p.className=uG(p.className,u)),d!==void 0&&(p.style=XW(p.style,d)),p):GW}var mG=Symbol.for(`react.lazy`);function hG(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=tG(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===mG&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return gG(e,n);throw Error(KW(8))}function gG(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var _G={...x},vG=0;function yG(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(vG+=1,r(`${t}-${vG}`))},[n,t]),i}var bG=_G.useId;function xG(e,t){if(bG!==void 0){let n=bG();return e??(t?`${t}-${n}`:n)}return yG(e,t)}function SG(e){return xG(e,`base-ui`)}function CG(){return typeof window<`u`}function wG(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function TG(e){return CG()?e instanceof Element||e instanceof wG(e).Element:!1}function EG(e){return CG()?e instanceof HTMLElement||e instanceof wG(e).HTMLElement:!1}function DG(e){return!CG()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof wG(e).ShadowRoot}var OG=x.createContext(void 0);function kG(e=!1){let t=x.useContext(OG);if(t===void 0&&!e)throw Error(KW(16));return t}function AG(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function jG(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=kG(!0)!==void 0,s=jW(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=AG({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;MG(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return BW(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return tG({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(lG(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(lG(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:jW(e=>{a.current=e,l()})}}function MG(e){return EG(e)&&e.tagName===`BUTTON`}var NG=x.createContext(void 0);function PG(){let e=x.useContext(NG);if(e===void 0)throw Error(KW(63));return e}var FG=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),IG={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},LG={valid(e){return e===null?null:e?{[FG.valid]:``}:{[FG.invalid]:``}}},RG=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),zG={...LG,checked(e){return e?{[RG.checked]:``}:{[RG.unchecked]:``}}};function BG(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var VG=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:WW,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function HG(){return x.useContext(VG)}var UG=x.createContext({invalid:void 0,name:void 0,validityData:{state:IG,errors:[],error:``,value:``,initialValue:null},setValidityData:WW,disabled:void 0,touched:!1,setTouched:WW,dirty:!1,setDirty:WW,filled:!1,setFilled:WW,focused:!1,setFocused:WW,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=GW)=>e,getInputValidationProps:(e=GW)=>e,inputRef:{current:null},commit:async()=>{}}});function WG(e=!0){let t=x.useContext(UG);if(t.setValidityData===WW&&!e)throw Error(KW(28));return t}function GG(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=HG(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=WG(),f=jW(e.getValue);BW(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),BW(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:BG(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?U.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),BW(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var KG=x.createContext({controlId:void 0,registerControlId:WW,labelId:void 0,setLabelId:WW,messageIds:[],setMessageIds:WW,getDescriptionProps:e=>e});function qG(){return x.useContext(KG)}function JG(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=qG(),o=SG(t),s=n?i:void 0,c=OW(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=jW(()=>{!l.current||a===WW||(l.current=!1,a(c.current,void 0))});return BW(()=>{if(a===WW)return;let e;if(n){let n=r?.current;e=TG(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var YG=`none`;function XG(e,t,n,r){let i=!1,a=!1,o=r??GW;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function ZG(e,t){let n=x.useRef(e),r=jW(t);BW(()=>{n.current!==e&&r(n.current)},[e,r]),BW(()=>{n.current=e},[e])}var QG=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=HG(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=WG(),{labelId:A}=qG(),j=D||f,M=O??s,N=jW(l),P=x.useRef(null),F=PW(P,o,k.inputRef),I=x.useRef(null),L=SG(),ee=JG({id:a,implicit:!1,controlRef:I}),R=c?void 0:ee,[z,B]=EW({controlled:n,default:!!i,name:`Switch`,state:`checked`});GG({id:L,commit:k.commit,value:z,controlRef:I,name:M,getValue:()=>z}),BW(()=>{P.current&&C(P.current.checked)},[P,C]),ZG(z,()=>{_(M),b(z!==S.initialValue),C(z),T()?k.commit(z):k.commit(z,!0)});let{getButtonProps:te,buttonRef:V}=jG({disabled:j,native:c}),ne={id:c?ee:L,role:`switch`,"aria-checked":z,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},H=x.useMemo(()=>tG({checked:z,disabled:j,id:R,name:M,required:d,style:M?UW:HW,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=XG(YG,e.nativeEvent);N?.(t,n),!n.isCanceled&&B(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?GW:{value:h}),[z,j,F,R,M,N,d,B,k,h]),re=x.useMemo(()=>({...v,checked:z,disabled:j,readOnly:u,required:d}),[v,z,j,u,d]),U=fG(`span`,e,{state:re,ref:[t,I,V],props:[ne,k.getValidationProps,g,te],stateAttributesMapping:zG});return(0,W.jsxs)(NG.Provider,{value:re,children:[U,!z&&M&&m!==void 0&&(0,W.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,W.jsx)(`input`,{...H})]})}),$G=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=WG(),o=PG();return fG(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:zG,props:i})});function eK(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=eK(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function tK(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=eK(e))&&(r&&(r+=` `),r+=t);return r}var nK=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},rK=(e,t)=>({classGroupId:e,validator:t}),iK=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),aK=`-`,oK=[],sK=`arbitrary..`,cK=e=>{let t=dK(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return uK(e);let n=e.split(aK);return lK(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?nK(i,t):t:i||oK}return n[e]||oK}}},lK=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=lK(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(aK):e.slice(t).join(aK),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},uK=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?sK+r:void 0})(),dK=e=>{let{theme:t,classGroups:n}=e;return fK(n,t)},fK=(e,t)=>{let n=iK();for(let r in e){let i=e[r];pK(i,n,r,t)}return n},pK=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];mK(i,t,n,r)}},mK=(e,t,n,r)=>{if(typeof e==`string`){hK(e,t,n);return}if(typeof e==`function`){gK(e,t,n,r);return}_K(e,t,n,r)},hK=(e,t,n)=>{let r=e===``?t:vK(t,e);r.classGroupId=n},gK=(e,t,n,r)=>{if(yK(e)){pK(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(rK(n,e))},_K=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];pK(o,vK(t,a),n,r)}},vK=(e,t)=>{let n=e,r=t.split(aK),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=iK(),n.nextPart.set(t,i)),n=i}return n},yK=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,bK=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},xK=`!`,SK=`:`,CK=[],wK=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),TK=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===SK){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(xK)?(c=s.slice(0,-1),l=!0):s.startsWith(xK)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return wK(t,l,c,u)};if(t){let e=t+SK,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):wK(CK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},EK=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},DK=e=>({cache:bK(e.cacheSize),parseClassName:TK(e),sortModifiers:EK(e),...cK(e)}),OK=/\s+/,kK=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(OK),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+xK:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},AK=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=jK(n))&&(i&&(i+=` `),i+=r);return i},jK=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=jK(e[r]))&&(n&&(n+=` `),n+=t);return n},MK=(e,...t)=>{let n,r,i,a,o=o=>(n=DK(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=kK(e,n);return i(e,a),a};return a=o,(...e)=>a(AK(...e))},NK=[],PK=e=>{let t=t=>t[e]||NK;return t.isThemeGetter=!0,t},FK=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,IK=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LK=/^\d+\/\d+$/,RK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,UK=e=>LK.test(e),WK=e=>!!e&&!Number.isNaN(Number(e)),GK=e=>!!e&&Number.isInteger(Number(e)),KK=e=>e.endsWith(`%`)&&WK(e.slice(0,-1)),qK=e=>RK.test(e),JK=()=>!0,YK=e=>zK.test(e)&&!BK.test(e),XK=()=>!1,ZK=e=>VK.test(e),QK=e=>HK.test(e),$K=e=>!Q(e)&&!$(e),eq=e=>fq(e,gq,XK),Q=e=>FK.test(e),tq=e=>fq(e,_q,YK),nq=e=>fq(e,vq,WK),rq=e=>fq(e,mq,XK),iq=e=>fq(e,hq,QK),aq=e=>fq(e,bq,ZK),$=e=>IK.test(e),oq=e=>pq(e,_q),sq=e=>pq(e,yq),cq=e=>pq(e,mq),lq=e=>pq(e,gq),uq=e=>pq(e,hq),dq=e=>pq(e,bq,!0),fq=(e,t,n)=>{let r=FK.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pq=(e,t,n=!1)=>{let r=IK.exec(e);return r?r[1]?t(r[1]):n:!1},mq=e=>e===`position`||e===`percentage`,hq=e=>e===`image`||e===`url`,gq=e=>e===`length`||e===`size`||e===`bg-size`,_q=e=>e===`length`,vq=e=>e===`number`,yq=e=>e===`family-name`,bq=e=>e===`shadow`,xq=MK(()=>{let e=PK(`color`),t=PK(`font`),n=PK(`text`),r=PK(`font-weight`),i=PK(`tracking`),a=PK(`leading`),o=PK(`breakpoint`),s=PK(`container`),c=PK(`spacing`),l=PK(`radius`),u=PK(`shadow`),d=PK(`inset-shadow`),f=PK(`text-shadow`),p=PK(`drop-shadow`),m=PK(`blur`),h=PK(`perspective`),g=PK(`aspect`),_=PK(`ease`),v=PK(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[UK,`full`,`auto`,...w()],E=()=>[GK,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,GK,$,Q]},GK,$,Q],O=()=>[GK,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[UK,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),cq,rq,{position:[$,Q]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,lq,eq,{size:[$,Q]}],ee=()=>[KK,oq,tq],R=()=>[``,`none`,`full`,l,$,Q],z=()=>[``,WK,oq,tq],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[WK,KK,cq,rq],ne=()=>[``,`none`,m,$,Q],H=()=>[`none`,WK,$,Q],re=()=>[`none`,WK,$,Q],U=()=>[WK,$,Q],ie=()=>[UK,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[qK],breakpoint:[qK],color:[JK],container:[qK],"drop-shadow":[qK],ease:[`in`,`out`,`in-out`],font:[$K],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[qK],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[qK],shadow:[qK],spacing:[`px`,WK],text:[qK],"text-shadow":[qK],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,UK,Q,$,g]}],container:[`container`],columns:[{columns:[WK,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[GK,`auto`,$,Q]}],basis:[{basis:[UK,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[WK,UK,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,WK,$,Q]}],shrink:[{shrink:[``,WK,$,Q]}],order:[{order:[GK,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,oq,tq]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,$,nq]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,KK,Q]}],"font-family":[{font:[sq,Q,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[WK,`none`,$,nq]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[WK,`from-font`,`auto`,$,tq]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[WK,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},GK,$,Q],radial:[``,$,Q],conic:[GK,$,Q]},uq,iq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[WK,$,Q]}],"outline-w":[{outline:[``,WK,oq,tq]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,dq,aq]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,dq,aq]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[WK,tq]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,dq,aq]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[WK,$,Q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[WK]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[WK]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ne()}],brightness:[{brightness:[WK,$,Q]}],contrast:[{contrast:[WK,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,dq,aq]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,WK,$,Q]}],"hue-rotate":[{"hue-rotate":[WK,$,Q]}],invert:[{invert:[``,WK,$,Q]}],saturate:[{saturate:[WK,$,Q]}],sepia:[{sepia:[``,WK,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[WK,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[WK,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,WK,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[WK,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,WK,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[WK,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[WK,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,WK,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[WK,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[WK,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[WK,oq,tq,nq]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Sq(...e){return xq(tK(e))}function Cq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,W.jsx)(QG,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:Sq(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,W.jsx)($G,{className:Sq(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var wq=null,Tq=!1,Eq={},Dq=500;function Oq(){if(typeof window>`u`)return null;if(wq?.state===`closed`&&(wq=null),!wq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;wq=new e}return wq}function kq(){wq&&=(wq.close().catch(()=>{}),null),Oq()}function Aq(){return Tq}function jq(){wq&&(kq(),Tq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&jq()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&jq()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&jq(),e=t},5e3)}async function Mq(){let e=Oq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Tq=!1}async function Nq(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function Pq(e){let t=Oq();if(!t||(await Nq(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function Fq(){let e=Date.now();if(!(e-(Eq.permission||0)<Dq)){Eq.permission=e;try{await Pq({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function Iq(){let e=Date.now();if(!(e-(Eq.idle||0)<Dq)){Eq.idle=e;try{await Pq({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function Lq({isOpen:e,onClose:t}){let n=H(e=>e.defaultProjectDir),r=H(e=>e.setDefaultProjectDir),i=H(e=>e.commandPresets),a=H(e=>e.setCommandPresets),o=H(e=>e.defaultPresetId),s=H(e=>e.setDefaultPresetId),c=H(e=>e.sessionSortMode),l=H(e=>e.setSessionSortMode),u=H(e=>e.sessionSortDirection),d=H(e=>e.setSessionSortDirection),f=H(e=>e.useWebGL),p=H(e=>e.setUseWebGL),m=H(e=>e.fontSize),h=H(e=>e.setFontSize),g=H(e=>e.lineHeight),_=H(e=>e.setLineHeight),v=H(e=>e.letterSpacing),y=H(e=>e.setLetterSpacing),b=H(e=>e.fontOption),S=H(e=>e.setFontOption),C=H(e=>e.customFontFamily),w=H(e=>e.setCustomFontFamily),T=H(e=>e.shortcutModifier),E=H(e=>e.setShortcutModifier),D=H(e=>e.showProjectName),O=H(e=>e.setShowProjectName),k=H(e=>e.showLastUserMessage),A=H(e=>e.setShowLastUserMessage),j=H(e=>e.showSessionIdPrefix),M=H(e=>e.setShowSessionIdPrefix),N=tU(e=>e.theme),F=tU(e=>e.setTheme),I=H(e=>e.soundOnPermission),ee=H(e=>e.setSoundOnPermission),R=H(e=>e.soundOnIdle),z=H(e=>e.setSoundOnIdle),[B,te]=(0,x.useState)(n),[V,ne]=(0,x.useState)(i),[re,U]=(0,x.useState)(o),[ie,ae]=(0,x.useState)(c),[oe,se]=(0,x.useState)(u),[ce,le]=(0,x.useState)(f),[ue,de]=(0,x.useState)(m),[fe,pe]=(0,x.useState)(g),[me,he]=(0,x.useState)(v),[ge,_e]=(0,x.useState)(b),[ve,ye]=(0,x.useState)(C),[be,xe]=(0,x.useState)(T),[Se,Ce]=(0,x.useState)(D),[we,Te]=(0,x.useState)(k),[Ee,De]=(0,x.useState)(j),[Oe,ke]=(0,x.useState)(N),[Ae,je]=(0,x.useState)(I),[Me,Ne]=(0,x.useState)(R),[Pe,Fe]=(0,x.useState)(!0),[Ie,Le]=(0,x.useState)(!1),[Re,ze]=(0,x.useState)(!0),[Be,Ve]=(0,x.useState)(!0),[He,Ue]=(0,x.useState)(!1),[We,Ge]=(0,x.useState)(!1),[Ke,Je]=(0,x.useState)(24),[Xe,Ze]=(0,x.useState)(!1),[Qe,$e]=(0,x.useState)(!1),[et,tt]=(0,x.useState)(``),[nt,rt]=(0,x.useState)(``),[it,at]=(0,x.useState)(``),ot=(0,x.useRef)(null),st=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let t=++st.current;if(ot.current&&=(clearTimeout(ot.current),null),e){if(te(n),ne(i),U(o),ae(c),se(u),le(f),de(m),pe(g),he(v),_e(b),ye(C),xe(T),Ce(D),Te(k),De(j),ke(N),je(I),Ne(R),$e(!1),tt(``),rt(``),at(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Fe(e.enabled)).catch(()=>{}),Ve(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{st.current===t&&ze(e.enabled)}).catch(()=>{}).finally(()=>{st.current===t&&Ve(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Je(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>Ue(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else typeof document<`u`&&(ot.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{ot.current&&=(clearTimeout(ot.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,R,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let ct=e=>{e.preventDefault();let n=B.trim(),i=ce!==f;r(n||`~/Documents/GitHub`),a(V),s(re),l(ie),d(oe),p(ce),h(ue),_(fe),y(me),S(ge),w(ve),E(be),O(Se),A(we),M(Ee),F(Oe),ee(Ae),z(Me),t({webglChanged:i})},lt=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},ut=e=>{let t=V.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=V.filter(t=>t.id!==e);ne(n),e===re&&U(n[0]?.id||`claude`)},dt=()=>{if(!et.trim()||!nt.trim()||V.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:et.trim(),command:nt.trim(),isBuiltIn:!1,agentType:it||void 0};ne([...V,e]),$e(!1),tt(``),rt(``),at(``)},ft=V.length<50,pt=e=>{Le(!0),Fe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Fe(!e)).finally(()=>Le(!1))},mt=e=>{Ge(!0),Ue(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ue(!e)).finally(()=>Ge(!1))},ht=e=>{Ve(!0),ze(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>ze(!e)).finally(()=>Ve(!1))},gt=e=>{let t=Ke;Ze(!0),Je(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Je(t)).finally(()=>Ze(!1))};return(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,W.jsxs)(`form`,{onSubmit:ct,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,W.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,W.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,W.jsx)(`input`,{value:B,onChange:e=>te(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,W.jsx)(`select`,{value:re,onChange:e=>U(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:V.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,W.jsx)(`div`,{className:`space-y-3`,children:V.map(e=>(0,W.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`input`,{value:e.label,onChange:t=>lt(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>ut(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,W.jsx)(`input`,{value:e.command,onChange:t=>lt(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,W.jsxs)(`select`,{value:e.agentType||``,onChange:t=>lt(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok`})]})]})]},e.id))}),Qe?(0,W.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,W.jsx)(`input`,{value:et,onChange:e=>tt(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,W.jsx)(`input`,{value:nt,onChange:e=>rt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`select`,{value:it,onChange:e=>at(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok Icon`})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:dt,disabled:!et.trim()||!nt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!0),disabled:!ft,className:`btn text-xs mt-3 w-full`,children:ft?`+ Add Preset`:`Max 50 presets`})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`desc`?`btn-primary`:``}`,onClick:()=>se(`desc`),children:`Newest First`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`asc`?`btn-primary`:``}`,onClick:()=>se(`asc`),children:`Oldest First`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,W.jsx)(Cq,{checked:Se,onCheckedChange:Ce})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,W.jsx)(Cq,{checked:we,onCheckedChange:Te})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,W.jsx)(Cq,{checked:Ee,onCheckedChange:De})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,W.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`number`,min:1,max:168,value:Ke,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&>(t)},disabled:Xe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,W.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Fq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Cq,{checked:Ae,onCheckedChange:e=>{je(e),e&&Mq()}})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Iq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Cq,{checked:Me,onCheckedChange:e=>{Ne(e),e&&Mq()}})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,W.jsx)(Cq,{checked:ce,onCheckedChange:le})]}),ce!==f&&(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,W.jsx)(Cq,{checked:Pe,onCheckedChange:pt,disabled:Ie})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,W.jsx)(Cq,{checked:Re,onCheckedChange:ht,disabled:Be,ariaLabel:`Enable terminal colors`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,W.jsx)(Cq,{checked:He,onCheckedChange:mt,disabled:We})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.max(6,ue-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,W.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:ue}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.min(24,ue+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:fe,onChange:e=>pe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:fe.toFixed(1)})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:me,onChange:e=>he(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[me,`px`]})]})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,W.jsx)(`select`,{value:ge,onChange:e=>_e(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),ge===`custom`&&(0,W.jsx)(`input`,{value:ve,onChange:e=>ye(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,W.jsx)(Cq,{checked:Oe===`dark`,onCheckedChange:e=>ke(e?`dark`:`light`)})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,W.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,W.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${be===e?`btn-primary`:``}`,onClick:()=>xe(e),children:e===`auto`?`Auto`:Ye(e)},e))}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:be===`auto`?`Shortcuts: ${Ye(qe(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Ye(be)}+[1-9/N/X/[/]]`})]})]})}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var Rq=[];function zq(e){x.useEffect(e,Rq)}var Bq=x.createContext(void 0);function Vq(){let e=x.useContext(Bq);if(!e)throw Error(KW(73));return e}var Hq=Symbol(`NOT_FOUND`);function Uq(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Wq(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Gq(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Kq=e=>Array.isArray(e)?e:[e];function qq(e){let t=Array.isArray(e[0])?e[0]:e;return Gq(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Jq(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Yq(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Hq},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Xq(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Hq}function i(t,i){r(t)===Hq&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var Zq=(e,t)=>e===t;function Qq(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function $q(e,t){let{equalityCheck:n=Zq,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Qq(n),o=0,s=r<=1?Yq(a):Xq(r,a);function c(){let t=s.get(arguments);if(t===Hq){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var eJ=class{constructor(e){this.value=e}deref(){return this.value}},tJ=typeof WeakRef<`u`?WeakRef:eJ,nJ=0,rJ=1;function iJ(){return{s:nJ,v:void 0,o:null,p:null}}function aJ(e,t={}){let n=iJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=iJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=iJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===rJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new tJ(c):c}return s.s=rJ,s.v=c,c}return o.clearCache=()=>{n=iJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function oJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Uq(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=aJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Kq(c),p=Kq(u),m=qq(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Jq(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var sJ=oJ(aJ),cJ=Object.assign((e,t=sJ)=>{Wq(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>cJ}),lJ=oJ({memoize:$q,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),uJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(KW(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},dJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(KW(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(KW(2))}u=lJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},fJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),pJ=s(((e,t)=>{t.exports=fJ()})),mJ=s((e=>{var t=p(),n=pJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),hJ=s(((e,t)=>{t.exports=mJ()})),gJ=[],_J=void 0;function vJ(){return _J}function yJ(e){gJ.push(e)}var bJ=pJ(),xJ=hJ(),SJ=JW(19)?TJ:EJ;function CJ(e,t,n,r,i){return SJ(e,t,n,r,i)}function wJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,bJ.useSyncExternalStore)(e.subscribe,a,a)}yJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,bJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function TJ(e,t,n,r,i){let a=vJ();if(!a)return wJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function EJ(e,t,n,r,i){return(0,xJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var DJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return CJ(this,e,t,n,r)}},OJ=class extends DJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),BW(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;BW(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;BW(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;BW(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),CJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=jW(t??WW);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},kJ=null;globalThis.requestAnimationFrame;var AJ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},jJ=class e{static create(){return new e}static request(e){return AJ.request(e)}static cancel(e){return AJ.cancel(e)}currentId=kJ;request(e){this.cancel(),this.currentId=AJ.request(()=>{this.currentId=kJ,e()})}cancel=()=>{this.currentId!==kJ&&(AJ.cancel(this.currentId),this.currentId=kJ)};disposeEffect=()=>this.cancel};function MJ(){let e=OW(jJ.create).current;return zq(e.disposeEffect),e}var NJ=0,PJ=class e{static create(){return new e}currentId=NJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=NJ,t()},e)}isStarted(){return this.currentId!==NJ}clear=()=>{this.currentId!==NJ&&(clearTimeout(this.currentId),this.currentId=NJ)};disposeEffect=()=>this.clear};function FJ(){let e=OW(PJ.create).current;return zq(e.disposeEffect),e}var IJ=0;function LJ(e){return IJ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${IJ}`}function RJ(e){return e?.ownerDocument||document}function zJ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var BJ=typeof navigator<`u`,VJ=KJ(),HJ=JJ(),UJ=qJ();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),VJ.platform===`MacIntel`&&VJ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(VJ.platform),BJ&&/firefox/i.test(UJ);var WJ=BJ&&/apple/i.test(navigator.vendor);BJ&&/Edg/i.test(UJ),BJ&&/android/i.test(HJ)||/android/i.test(UJ),BJ&&HJ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var GJ=UJ.includes(`jsdom/`);function KJ(){if(!BJ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function qJ(){if(!BJ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function JJ(){if(!BJ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function YJ(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function XJ(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&DG(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ZJ(e){return`composedPath`in e?e.composedPath()[0]:e.target}function QJ(e){if(!e||GJ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var $J=dJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),eY={toasts:uJ(e=>e.toasts),isEmpty:uJ(e=>e.toasts.length===0),toast:uJ($J,(e,t)=>e.get(t)?.value),toastIndex:uJ($J,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:uJ($J,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:uJ($J,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:uJ(e=>e.hovering),focused:uJ(e=>e.focused),expanded:uJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:uJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:uJ(e=>e.prevFocusElement)},tY=class extends OJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},eY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=eY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||LJ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),eY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=eY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),eY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{eY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=zJ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=zJ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=zJ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=PJ.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=ZJ(e);XJ(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!eY.expandedOrOutOfFocus(this.state),a=i?PJ.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=YJ(RJ(this.state.viewport));if(!this.state.viewport||!XJ(this.state.viewport,t)||!QJ(t))return;let n=eY.toasts(this.state),r=eY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},nY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=OW(()=>new tY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return zq(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,W.jsx)(Bq.Provider,{value:a,children:t})},rY=x.forwardRef(function(e,t){let[n,r]=x.useState();BW(()=>{WJ&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,W.jsx)(`span`,{...e,ref:t,style:HW,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),iY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),aY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=Vq(),s=FJ(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(YJ(RJ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=wG(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=wG(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=ZJ(n),i=YJ(RJ(e));(!XJ(e,r)||!QJ(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=RJ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||QJ(RJ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||XJ(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=fG(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[iY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(rY,{onFocus:_}),i,!u&&m&&(0,W.jsx)(rY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(rY,{onFocus:_}),E,!f&&D.length>0&&(0,W.jsx)(`div`,{style:HW,children:D.map(e=>(0,W.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,W.jsx)(`div`,{children:e.title}),(0,W.jsx)(`div`,{children:e.description})]},e.id))})]})});function oY(e){return JW(19)?e:e?`true`:void 0}var sY=x.createContext(void 0);function cY(){let e=x.useContext(sY);if(!e)throw Error(KW(66));return e}var lY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),uY={[lY.startingStyle]:``},dY={[lY.endingStyle]:``},fY={transitionStatus(e){return e===`starting`?uY:e===`ending`?dY:null}};function pY(e){return e==null?e:`current`in e?e.current:e}function mY(e,t=!1,n=!0){let r=MJ();return jW((i,a=null)=>{r.cancel();function o(){U.flushSync(i)}let s=pY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=lY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function hY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=jW(i),o=mY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var gY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),_Y={...fY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},vY=40,yY=10,bY=.5,xY=1;function SY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function CY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var wY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=Vq(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),ee=u.useState(`toastIndex`,n.id),R=u.useState(`toastVisibleIndex`,n.id),z=u.useState(`toastOffsetY`,n.id),B=u.useState(`focused`),te=u.useState(`expanded`);hY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let V=jW((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?U.flushSync(a):a()});BW(V,[V]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**bY:-(Math.abs(e)**bY):(!c.includes(`right`)&&e>0&&(n=e**bY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**bY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**bY:-(Math.abs(t)**bY):(!c.includes(`down`)&&t>0&&(r=t**bY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**bY))),{x:n,y:r}}function H(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=ZJ(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=CY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function re(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=xY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=SY(u,a,o),f(u));else{let e=N.current,t=SY(e,l,s);t>vY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=yY&&(F.current=!0)}let d=ne(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>vY&&(t=!0,a=`right`);break;case`left`:r<-vY&&(t=!0,a=`left`);break;case`down`:i>vY&&(t=!0,a=`down`);break;case`up`:i<-vY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!A.current||!XJ(A.current,YJ(RJ(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){XJ(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[gY.swipeMovementX]:`0px`,[gY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[gY.swipeMovementX]:`${e}px`,[gY.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!B?!0:void 0,onPointerDown:l?H:void 0,onPointerMove:l?re:void 0,onPointerUp:l?ie:void 0,onKeyDown:ae,inert:oY(n.limited),style:{...oe(),[gY.index]:n.transitionStatus===`ending`?ee:R,[gY.offsetY]:`${z}px`,[gY.height]:n.height?`${n.height}px`:void 0}},le=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:V,index:ee,visibleIndex:R,expanded:te}),[n,w,E,p,d,V,ee,R,te]),ue={transitionStatus:n.transitionStatus,expanded:te,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=fG(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:_Y,props:[ce,o]});return(0,W.jsx)(sY.Provider,{value:le,children:de})}),TY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=cY(),l=a??s.description,u=!!l,d=xG(i);BW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=fG(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),EY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=cY(),l=a??s.title,u=!!l,d=xG(i);BW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=fG(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),DY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=Vq(),{toast:c}=cY(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=jG({disabled:i,native:a}),m={type:c.type};return fG(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function OY(){let e=x.useContext(Bq);if(!e)throw Error(KW(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function kY(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||LJ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var AY=5e3,jY=kY();function MY({toast:e}){return(0,W.jsxs)(wY,{toast:e,className:Sq(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(EY,{className:Sq(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,W.jsx)(TY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,W.jsx)(DY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function NY(){let{toasts:e}=OY();return(0,W.jsx)(W.Fragment,{children:e.map(e=>(0,W.jsx)(MY,{toast:e},e.id))})}function PY(){return(0,W.jsxs)(nY,{timeout:AY,toastManager:jY,children:[(0,W.jsx)(NY,{}),(0,W.jsx)(aY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var FY=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],IY=3e3,LY=8e3,RY=15e3,zY=5e3,BY=2e4,VY=1e4,HY=1500,UY=5e3,WY=750,GY=4,KY=5e3,qY=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(pE(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,pE(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{pE(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?FY[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){pE(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){pE(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}pE(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;pE(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?LY:IY;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(pE(`ws_connect_timeout`,{wsState:FY[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){pE(`ws_onopen_stale`,this.wsSnap(),`info`);return}pE(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),pE(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(UY)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(pE(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){pE(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}pE(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>RY&&(pE(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},zY))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return pE(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(pE(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){pE(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(pE(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},HY)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){pE(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){pE(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){pE(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,pE(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},WY)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,pE(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},VY)))};e!==void 0&&e<BY?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,BY)},e):this.heartbeatTimer=window.setInterval(t,BY)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){pE(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=GY){pE(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets(),this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},KY);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);pE(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){pE(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function JY(){let e=qm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{qY.connect(),qY.startLifecycleListeners();let t=qY.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),qY.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{qY.send(e)},[]),subscribe:(0,x.useMemo)(()=>qY.subscribe.bind(qY),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>qY.getConnectionEpoch(),[])}}var YY=100;function XY({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>YY?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function ZY(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function QY(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{XY({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),ZY(document)}},[])}function $Y(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function eX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=qm(e=>e.sessions),_=qm(e=>e.agentSessions),v=qm(e=>e.agentSessionsEpoch),y=qm(e=>e.selectedSessionId),b=qm(e=>e.selectedHibernatingSessionId),S=qm(e=>e.setSessions),C=qm(e=>e.setAgentSessions),w=qm(e=>e.setActiveAgentSessions),T=qm(e=>e.setHostStatuses),E=qm(e=>e.updateSession),D=qm(e=>e.setSelectedSessionId),O=qm(e=>e.setSelectedHibernatingSessionId),k=qm(e=>e.hasLoaded),A=qm(e=>e.connectionStatus),j=qm(e=>e.connectionError),M=qm(e=>e.clearExitingSession),N=qm(e=>e.markSessionExiting),P=qm(e=>e.setRemoteAllowControl),F=qm(e=>e.setRemoteAllowAttach),I=qm(e=>e.setHostLabel),L=qm(e=>e.setPreferWindowName),ee=qm(e=>e.hostStatuses),R=qm(e=>e.remoteAllowControl),z=qm(e=>e.hostLabel),B=tU(e=>e.theme),te=re(),V=H(e=>e.defaultProjectDir),ne=H(e=>e.commandPresets),ie=H(e=>e.defaultPresetId),ae=H(e=>e.lastProjectPath),oe=H(e=>e.setLastProjectPath),se=H(e=>e.addRecentPath),ce=H(e=>e.shortcutModifier),le=H(e=>e.sidebarWidth),ue=H(e=>e.setSidebarWidth),de=H(e=>e.projectFilters),fe=H(e=>e.hostFilters),pe=H(e=>e.soundOnPermission),me=H(e=>e.soundOnIdle),he=qm(e=>e.connectionEpoch),{sendMessage:ge,subscribe:_e,getConnectionEpoch:ve}=JY();QY(),(0,x.useEffect)(()=>{if(typeof document>`u`||!pe&&!me)return;let e=!1,t=()=>{e&&!Aq()||(e=!0,Mq())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[pe,me]);let ye=(0,x.useRef)(!1),be=(0,x.useCallback)(e=>{e.preventDefault(),ye.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ye.current)return;let t=e.clientX;ue(Math.max(180,Math.min(400,t)))},t=()=>{ye.current&&(ye.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[ue]),(0,x.useEffect)(()=>{let e=_e(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=qm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=H.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&Fq(),e.status===`working`&&i.status===`waiting`&&r&&Iq())}if(Ie.current.size>0){let e=ve();for(let[t,n]of Ie.current)n.epoch!==e&&Ie.current.delete(t)}let i=Ie.current.size>0?e.sessions.filter(e=>!Ie.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=qm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Me.current=s),S(i);let c=Ne.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=qm.getState(),{projectFilters:d,hostFilters:f}=H.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Ne.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&fE(e.clientLogLevel)),e.type===`session-update`){let t=qm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=H.getState();t!==`permission`&&n===`permission`&&e&&Fq(),t===`working`&&n===`waiting`&&r&&Iq()}}if(e.type===`session-created`){let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),se(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=H.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){EH(e.sessionId);let t=qm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=qm.getState(),a=Me.current;i&&!n.some(e=>e.sessionId===i)&&(Ne.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Me.current=null,O(a)):a&&(Me.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=qm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=qm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isPinned:e.session.isPinned,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Ie.current.get(e.sessionId);if(t){let n=qm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Ie.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,se,M,ge,D,O,h,S,C,w,T,P,F,I,L,_e,E]);let xe=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),Se=_.hibernating??[],Ce=_.history??[],we=(0,x.useMemo)(()=>$Y(Se,de,fe),[Se,de,fe]),Te=(0,x.useMemo)(()=>we.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[we,m,b]);(0,x.useEffect)(()=>{xe?.projectPath&&!xe.remote&&oe(xe.projectPath)},[xe?.projectPath,xe?.remote,oe]);let Ee=H(e=>e.sessionSortMode),De=H(e=>e.sessionSortDirection),Oe=H(e=>e.manualSessionOrder),ke=(0,x.useMemo)(()=>Mm(g,{mode:Ee,direction:De,manualOrder:Oe}),[g,Ee,De,Oe]),Ae=(0,x.useMemo)(()=>{let e=ke;return de.length>0&&(e=e.filter(e=>de.includes(e.projectPath))),fe.length>0&&(e=e.filter(e=>fe.includes(e.host??``))),e},[ke,de,fe]),je=(0,x.useRef)(b),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(null),Pe=(0,x.useRef)(he),Fe=(0,x.useCallback)(()=>Ae.length>0?(D(Ae[0].id),!0):we.length>0?(O(we[0].sessionId),!0):!1,[Ae,we,D,O]);(0,x.useEffect)(()=>{let e=je.current;e&&b===null&&!Se.some(t=>t.sessionId===e)?Ne.current=e:b!==null&&(Ne.current=null),je.current=b},[Se,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Pe.current!==he&&(Pe.current=he,Me.current=null,Ne.current=null,h(null))},[he]),(0,x.useEffect)(()=>{k&&(b||y&&(Ae.some(e=>e.id===y)||Fe()||D(null)))},[k,y,b,Fe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==he||we.some(e=>e.sessionId===b))return;let e=Ae.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Fe()||O(null)},[we,Ae,v,m,b,Fe,D,O,he]),(0,x.useEffect)(()=>{let e=Ne.current;if(!e)return;if(b!==null){Ne.current=null;return}let t=Ae.find(t=>t.agentSessionId?.trim()===e);if(t){Ne.current=null,D(t.id);return}if(y!==null){Ne.current=null;return}Fe()&&(Ne.current=null)},[Ae,y,b,Fe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(Ae.length>0||we.length>0)&&Fe()},[we.length,Ae.length,k,Fe,y,b]);let Ie=(0,x.useRef)(new Map),Le=(0,x.useCallback)((e,t=`unknown`)=>{EH(e);let{sessions:n,selectedSessionId:r}=qm.getState(),i=n.find(t=>t.id===e);i&&Ie.current.set(e,{session:i,wasSelected:r===e,epoch:ve()}),(0,U.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),ge({type:`session-kill`,sessionId:e,source:t})},[N,S,ge]);(0,x.useEffect)(()=>{let n=qe(ce),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Xe(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=Ae;if(t.length===0){let t=we;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Ae.length>0){let t=Ae[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=we[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&te&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Le(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,Ae,we,Le,ce,te]);let Re=()=>te?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,ze=()=>l(!0),Be=(e,t,n,r)=>{ge({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||oe(e)},Ve=e=>{ge({type:`session-wake`,sessionId:e})},He=(0,x.useCallback)(e=>{ge({type:`session-hibernate`,sessionId:e})},[ge]),Ue=(e,t)=>{ge({type:`session-rename`,sessionId:e,newName:t})},We=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&ge({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,ge]),Ge=(0,x.useCallback)(e=>{ge({type:`session-move-to-history`,sessionId:e})},[ge]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,B)},[B]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ke=(0,x.useMemo)(()=>z?ee.filter(e=>e.host!==z):ee,[ee,z]);return(0,W.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:le},children:[(0,W.jsx)($e,{connectionStatus:A,onNewSession:Re,onOpenSettings:ze,tailscaleIp:f?.tailscaleIp??null}),(0,W.jsx)(sE,{sessions:g,hibernatingSessions:Se,historySessions:Ce,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:Ue,onResume:Ve,onHibernate:He,onKill:Le,onDuplicate:We,onMoveToHistory:Ge,onNewSession:Re,loading:!k,error:j||u})]}),(0,W.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:be}),(0,W.jsx)(oW,{session:xe,sessions:Ae,hibernatingSession:Te,hibernatingSessions:Se,connectionStatus:A,connectionEpoch:he,sendMessage:ge,subscribe:_e,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Re,onKillSession:Le,onRenameSession:Ue,onOpenSettings:ze,onResumeSession:Ve,onHibernateSession:He,onMoveToHistory:Ge,historySessions:Ce,loading:!k,error:j||u}),(0,W.jsx)(TW,{isOpen:e,onClose:()=>t(!1),onCreate:Be,defaultProjectDir:V,commandPresets:ne,defaultPresetId:ie,lastProjectPath:ae,activeProjectPath:xe&&!xe.remote?xe.projectPath:void 0,remoteHosts:Ke,remoteAllowControl:R,initialHost:n,initialPath:i,initialCommand:o}),(0,W.jsx)(Lq,{isOpen:c,onClose:()=>l(!1)}),(0,W.jsx)(PY,{})]})}var tX=`modulepreload`,nX=function(e){return`/`+e},rX={},iX=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=nX(t,n),t in rX)return;rX[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:tX,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},aX=`true`,oX=`false`,sX=aX===`true`,cX=oX===`true`;function lX(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,sX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await iX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!cX)if(sX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}We()&&document.documentElement.classList.add(`ios`),Ge()&&document.documentElement.classList.add(`ios-pwa`),lX({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var uX=document.getElementById(`root`);if(!uX)throw Error(`Root element not found`);(0,E.createRoot)(uX).render((0,W.jsx)(x.StrictMode,{children:(0,W.jsx)(eX,{})}));
|
|
306
|
+
`,onClick:()=>{aW(),u(t.id)},title:lt?t.name:void 0,children:i},t.id)})})]}),(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[(0,W.jsx)(`div`,{ref:we,className:`absolute inset-0`,style:{backgroundColor:S.background}}),Me&&e&&(0,W.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,W.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,W.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,W.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Fe&&e&&(0,W.jsxs)(`div`,{className:`absolute ${j&&!N?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:left-auto md:right-4 md:translate-x-0`,children:[(0,W.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,W.jsxs)(`button`,{type:`button`,onClick:Ie,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,W.jsx)(de,{width:14,height:14}),`Copy`]}),(0,W.jsx)(`button`,{type:`button`,onClick:Re,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,W.jsx)(Ue,{width:14,height:14})})]}),!e&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ve&&(0,W.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,W.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,W.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:be}),(0,W.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),xe&&(0,W.jsx)(`span`,{className:`text-muted`,children:xe}),(0,W.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Se]})]}),n.lastResumeError&&(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,W.jsx)(ae,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,W.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>h(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>_(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,W.jsx)(nE,{session:n})]})}),ke&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:bottom-8`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,W.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,W.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):j&&e&&!N?(0,W.jsxs)(`button`,{type:`button`,onClick:ze,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,W.jsx)(zU,{...ot}),e&&(0,W.jsx)($U,{onSendKey:nt,onPasteText:rt,onPasteImage:it,disabled:a!==`connected`||ve||!Pe,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!fe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:at,isKeyboardVisible:ct,onEnterTextMode:st}),(A||k)&&(0,W.jsx)(eW,{isOpen:z,onClose:()=>B(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:h,onHibernate:g,onMoveToHistory:_,onNewSession:f,loading:y,error:b}),F&&e&&(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,W.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,W.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,W.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{onClick:()=>I(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,W.jsx)(`button`,{ref:ce,onClick:He,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function sW({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=H(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,W.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,W.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,W.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,W.jsx)(`p`,{className:`text-danger`,children:s}),(0,W.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,W.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,W.jsx)(xe,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,W.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,W.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,W.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function cW(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function lW(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?cW(o):null}function uW(e){return e?e===`claude-rp`?`claude`:e:null}function dW(e){let t=e.trim();if(!t)return``;let n=cW(t);return lW(n)??n}function fW(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`}function pW(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=fW(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function mW(e){let t=dW(e);if(t)return pW(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var hW={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null},gW={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[]};function _W(e){let t=uW(e);return t?hW[t]:null}function vW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yW(e){return RegExp(`(^|\\s)${vW(e)}(?=\\s|$)`,`g`)}function bW(e,t){return(t?[uW(t)].filter(e=>e!==null):Object.keys(gW)).some(t=>gW[t].some(t=>yW(t).test(e)))}function xW(e,t){let n=pW(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function SW(e,t){let n=_W(t);if(!n)return e;let r=e.trim();if(!r||bW(r,t))return r;let i=xW(r,n);if(i)return i;let a=dW(r);if(a&&a!==r){let e=xW(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function CW(e,t){let n=uW(t);if(!n||bW(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function wW(e,t){let n=uW(t);if(!n)return e;let r=e;for(let e of gW[n])r=r.replace(yW(e),` `);return r.replace(/\s+/g,` `).trim()}function TW({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=H(e=>e.yoloMode),D=H(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=l&&c.length>0,M=e=>{if(!E)return e;let t=mW(e);return t&&!CW(e,t)?SW(e,t):e},N=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(M(te(t))))},P=()=>{v(null),b(``)};if((0,x.useEffect)(()=>{if(!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let t=f?.trim();if(t){let e=i.find(e=>te(e)===t);e?(v(e.id),b(te(e))):(v(null),b(t))}else{let e=i.find(e=>e.id===a);e?(v(a),b(M(te(e)))):i.length>0?(v(i[0].id),b(M(te(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?P():N(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let F=_===null,I=w!==``,L=mW(y),ee=_W(L)!==null,R=L?bW(y,L):!1,z=L&&!R?CW(y,L):null,B=!ee||z!==null,V=L?L===`pi`?`Pi has no permission prompts — nothing to enable`:z??`Append ${_W(L)}`:`Enter a supported agent command (claude, codex, grok, devin)`,ne=e=>{D(e),L&&b(e?SW(y,L):wW(y,L))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,I?w:void 0),t()},U=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ie=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],ae=p.trim()||`~`;return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,W.jsxs)(`form`,{ref:O,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,W.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[j&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ie.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,W.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:U.map((e,t)=>{let n=e.isCustom?F:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,W.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?P():N(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%U.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+U.length)%U.length;else return;let r=U[n];r.isCustom?P():N(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,W.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,W.jsx)(nh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,W.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,W.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${B?`text-muted opacity-60`:`text-secondary`}`,title:V,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:R,disabled:B,onChange:e=>ne(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:I?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!I&&(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,W.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,W.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!I&&(0,W.jsx)(sW,{initialPath:ae,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function EW({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var DW={};function OW(e,t){let n=x.useRef(DW);return n.current===DW&&(n.current=e(t)),n}var kW=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],AW=kW&&kW!==x.useLayoutEffect?kW:e=>e();function jW(e){let t=OW(MW).current;return t.next=e,AW(t.effect),t.trampoline}function MW(){let e={next:void 0,callback:NW,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function NW(){}function PW(e,t,n,r){let i=OW(IW).current;return LW(i,e,t,n,r)&&zW(i,[e,t,n,r]),i.callback}function FW(e){let t=OW(IW).current;return RW(t,e)&&zW(t,e),t.callback}function IW(){return{callback:null,cleanup:null,refs:[]}}function LW(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function RW(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function zW(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var BW=typeof document<`u`?x.useLayoutEffect:()=>{},VW={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},HW={...VW,position:`fixed`,top:0,left:0},UW={...VW,position:`absolute`};function WW(){}Object.freeze([]);var GW=Object.freeze({});function KW(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var qW=18;function JW(e){return qW>=e}function YW(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(JW(19)?n?.ref:t.ref)??null}function XW(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function ZW(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function QW(e,t){return typeof e==`function`?e(t):e}function $W(e,t){return typeof e==`function`?e(t):e}var eG={};function tG(e,t,n,r,i){let a={...sG(e,eG)};return t&&(a=rG(a,t)),n&&(a=rG(a,n)),r&&(a=rG(a,r)),i&&(a=rG(a,i)),a}function nG(e){if(e.length===0)return eG;if(e.length===1)return sG(e[0],eG);let t={...sG(e[0],eG)};for(let n=1;n<e.length;n+=1)t=rG(t,e[n]);return t}function rG(e,t){return oG(t)?t(e):iG(e,t)}function iG(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=XW(e.style,r);break;case`className`:e[n]=uG(e.className,r);break;default:aG(n,r)?e[n]=cG(e[n],r):e[n]=r}}return e}function aG(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function oG(e){return typeof e==`function`}function sG(e,t){return oG(e)?e(t):e??eG}function cG(e,t){return t?e?n=>{if(dG(n)){let r=n;lG(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function lG(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function uG(e,t){return t?e?t+` `+e:t:e}function dG(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function fG(e,t,n={}){let r=t.render,i=pG(t,n);return n.enabled===!1?null:hG(e,r,i,n.state??GW)}function pG(e,t={}){let{className:n,style:r,render:i}=e,{state:a=GW,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?QW(n,a):void 0,d=l?$W(r,a):void 0,f=l?ZW(a,c):GW,p=l?XW(f,Array.isArray(s)?nG(s):s)??GW:GW;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=FW([p.ref,YW(i),...o]):p.ref=PW(p.ref,YW(i),o):PW(null,null)),l?(u!==void 0&&(p.className=uG(p.className,u)),d!==void 0&&(p.style=XW(p.style,d)),p):GW}var mG=Symbol.for(`react.lazy`);function hG(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=tG(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===mG&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return gG(e,n);throw Error(KW(8))}function gG(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var _G={...x},vG=0;function yG(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(vG+=1,r(`${t}-${vG}`))},[n,t]),i}var bG=_G.useId;function xG(e,t){if(bG!==void 0){let n=bG();return e??(t?`${t}-${n}`:n)}return yG(e,t)}function SG(e){return xG(e,`base-ui`)}function CG(){return typeof window<`u`}function wG(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function TG(e){return CG()?e instanceof Element||e instanceof wG(e).Element:!1}function EG(e){return CG()?e instanceof HTMLElement||e instanceof wG(e).HTMLElement:!1}function DG(e){return!CG()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof wG(e).ShadowRoot}var OG=x.createContext(void 0);function kG(e=!1){let t=x.useContext(OG);if(t===void 0&&!e)throw Error(KW(16));return t}function AG(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function jG(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=kG(!0)!==void 0,s=jW(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=AG({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;MG(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return BW(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return tG({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(lG(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(lG(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:jW(e=>{a.current=e,l()})}}function MG(e){return EG(e)&&e.tagName===`BUTTON`}var NG=x.createContext(void 0);function PG(){let e=x.useContext(NG);if(e===void 0)throw Error(KW(63));return e}var FG=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),IG={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},LG={valid(e){return e===null?null:e?{[FG.valid]:``}:{[FG.invalid]:``}}},RG=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),zG={...LG,checked(e){return e?{[RG.checked]:``}:{[RG.unchecked]:``}}};function BG(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var VG=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:WW,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function HG(){return x.useContext(VG)}var UG=x.createContext({invalid:void 0,name:void 0,validityData:{state:IG,errors:[],error:``,value:``,initialValue:null},setValidityData:WW,disabled:void 0,touched:!1,setTouched:WW,dirty:!1,setDirty:WW,filled:!1,setFilled:WW,focused:!1,setFocused:WW,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=GW)=>e,getInputValidationProps:(e=GW)=>e,inputRef:{current:null},commit:async()=>{}}});function WG(e=!0){let t=x.useContext(UG);if(t.setValidityData===WW&&!e)throw Error(KW(28));return t}function GG(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=HG(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=WG(),f=jW(e.getValue);BW(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),BW(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:BG(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?U.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),BW(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var KG=x.createContext({controlId:void 0,registerControlId:WW,labelId:void 0,setLabelId:WW,messageIds:[],setMessageIds:WW,getDescriptionProps:e=>e});function qG(){return x.useContext(KG)}function JG(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=qG(),o=SG(t),s=n?i:void 0,c=OW(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=jW(()=>{!l.current||a===WW||(l.current=!1,a(c.current,void 0))});return BW(()=>{if(a===WW)return;let e;if(n){let n=r?.current;e=TG(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var YG=`none`;function XG(e,t,n,r){let i=!1,a=!1,o=r??GW;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function ZG(e,t){let n=x.useRef(e),r=jW(t);BW(()=>{n.current!==e&&r(n.current)},[e,r]),BW(()=>{n.current=e},[e])}var QG=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=HG(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=WG(),{labelId:A}=qG(),j=D||f,M=O??s,N=jW(l),P=x.useRef(null),F=PW(P,o,k.inputRef),I=x.useRef(null),L=SG(),ee=JG({id:a,implicit:!1,controlRef:I}),R=c?void 0:ee,[z,B]=EW({controlled:n,default:!!i,name:`Switch`,state:`checked`});GG({id:L,commit:k.commit,value:z,controlRef:I,name:M,getValue:()=>z}),BW(()=>{P.current&&C(P.current.checked)},[P,C]),ZG(z,()=>{_(M),b(z!==S.initialValue),C(z),T()?k.commit(z):k.commit(z,!0)});let{getButtonProps:te,buttonRef:V}=jG({disabled:j,native:c}),ne={id:c?ee:L,role:`switch`,"aria-checked":z,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},H=x.useMemo(()=>tG({checked:z,disabled:j,id:R,name:M,required:d,style:M?UW:HW,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=XG(YG,e.nativeEvent);N?.(t,n),!n.isCanceled&&B(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?GW:{value:h}),[z,j,F,R,M,N,d,B,k,h]),re=x.useMemo(()=>({...v,checked:z,disabled:j,readOnly:u,required:d}),[v,z,j,u,d]),U=fG(`span`,e,{state:re,ref:[t,I,V],props:[ne,k.getValidationProps,g,te],stateAttributesMapping:zG});return(0,W.jsxs)(NG.Provider,{value:re,children:[U,!z&&M&&m!==void 0&&(0,W.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,W.jsx)(`input`,{...H})]})}),$G=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=WG(),o=PG();return fG(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:zG,props:i})});function eK(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=eK(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function tK(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=eK(e))&&(r&&(r+=` `),r+=t);return r}var nK=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},rK=(e,t)=>({classGroupId:e,validator:t}),iK=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),aK=`-`,oK=[],sK=`arbitrary..`,cK=e=>{let t=dK(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return uK(e);let n=e.split(aK);return lK(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?nK(i,t):t:i||oK}return n[e]||oK}}},lK=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=lK(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(aK):e.slice(t).join(aK),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},uK=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?sK+r:void 0})(),dK=e=>{let{theme:t,classGroups:n}=e;return fK(n,t)},fK=(e,t)=>{let n=iK();for(let r in e){let i=e[r];pK(i,n,r,t)}return n},pK=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];mK(i,t,n,r)}},mK=(e,t,n,r)=>{if(typeof e==`string`){hK(e,t,n);return}if(typeof e==`function`){gK(e,t,n,r);return}_K(e,t,n,r)},hK=(e,t,n)=>{let r=e===``?t:vK(t,e);r.classGroupId=n},gK=(e,t,n,r)=>{if(yK(e)){pK(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(rK(n,e))},_K=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];pK(o,vK(t,a),n,r)}},vK=(e,t)=>{let n=e,r=t.split(aK),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=iK(),n.nextPart.set(t,i)),n=i}return n},yK=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,bK=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},xK=`!`,SK=`:`,CK=[],wK=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),TK=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===SK){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(xK)?(c=s.slice(0,-1),l=!0):s.startsWith(xK)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return wK(t,l,c,u)};if(t){let e=t+SK,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):wK(CK,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},EK=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},DK=e=>({cache:bK(e.cacheSize),parseClassName:TK(e),sortModifiers:EK(e),...cK(e)}),OK=/\s+/,kK=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(OK),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+xK:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},AK=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=jK(n))&&(i&&(i+=` `),i+=r);return i},jK=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=jK(e[r]))&&(n&&(n+=` `),n+=t);return n},MK=(e,...t)=>{let n,r,i,a,o=o=>(n=DK(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=kK(e,n);return i(e,a),a};return a=o,(...e)=>a(AK(...e))},NK=[],PK=e=>{let t=t=>t[e]||NK;return t.isThemeGetter=!0,t},FK=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,IK=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LK=/^\d+\/\d+$/,RK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,UK=e=>LK.test(e),WK=e=>!!e&&!Number.isNaN(Number(e)),GK=e=>!!e&&Number.isInteger(Number(e)),KK=e=>e.endsWith(`%`)&&WK(e.slice(0,-1)),qK=e=>RK.test(e),JK=()=>!0,YK=e=>zK.test(e)&&!BK.test(e),XK=()=>!1,ZK=e=>VK.test(e),QK=e=>HK.test(e),$K=e=>!Q(e)&&!$(e),eq=e=>fq(e,gq,XK),Q=e=>FK.test(e),tq=e=>fq(e,_q,YK),nq=e=>fq(e,vq,WK),rq=e=>fq(e,mq,XK),iq=e=>fq(e,hq,QK),aq=e=>fq(e,bq,ZK),$=e=>IK.test(e),oq=e=>pq(e,_q),sq=e=>pq(e,yq),cq=e=>pq(e,mq),lq=e=>pq(e,gq),uq=e=>pq(e,hq),dq=e=>pq(e,bq,!0),fq=(e,t,n)=>{let r=FK.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pq=(e,t,n=!1)=>{let r=IK.exec(e);return r?r[1]?t(r[1]):n:!1},mq=e=>e===`position`||e===`percentage`,hq=e=>e===`image`||e===`url`,gq=e=>e===`length`||e===`size`||e===`bg-size`,_q=e=>e===`length`,vq=e=>e===`number`,yq=e=>e===`family-name`,bq=e=>e===`shadow`,xq=MK(()=>{let e=PK(`color`),t=PK(`font`),n=PK(`text`),r=PK(`font-weight`),i=PK(`tracking`),a=PK(`leading`),o=PK(`breakpoint`),s=PK(`container`),c=PK(`spacing`),l=PK(`radius`),u=PK(`shadow`),d=PK(`inset-shadow`),f=PK(`text-shadow`),p=PK(`drop-shadow`),m=PK(`blur`),h=PK(`perspective`),g=PK(`aspect`),_=PK(`ease`),v=PK(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[UK,`full`,`auto`,...w()],E=()=>[GK,`none`,`subgrid`,$,Q],D=()=>[`auto`,{span:[`full`,GK,$,Q]},GK,$,Q],O=()=>[GK,`auto`,$,Q],k=()=>[`auto`,`min`,`max`,`fr`,$,Q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[UK,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,$,Q],F=()=>[...b(),cq,rq,{position:[$,Q]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,lq,eq,{size:[$,Q]}],ee=()=>[KK,oq,tq],R=()=>[``,`none`,`full`,l,$,Q],z=()=>[``,WK,oq,tq],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[WK,KK,cq,rq],ne=()=>[``,`none`,m,$,Q],H=()=>[`none`,WK,$,Q],re=()=>[`none`,WK,$,Q],U=()=>[WK,$,Q],ie=()=>[UK,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[qK],breakpoint:[qK],color:[JK],container:[qK],"drop-shadow":[qK],ease:[`in`,`out`,`in-out`],font:[$K],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[qK],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[qK],shadow:[qK],spacing:[`px`,WK],text:[qK],"text-shadow":[qK],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,UK,Q,$,g]}],container:[`container`],columns:[{columns:[WK,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[GK,`auto`,$,Q]}],basis:[{basis:[UK,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[WK,UK,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,WK,$,Q]}],shrink:[{shrink:[``,WK,$,Q]}],order:[{order:[GK,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,oq,tq]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,$,nq]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,KK,Q]}],"font-family":[{font:[sq,Q,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[WK,`none`,$,nq]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[WK,`from-font`,`auto`,$,tq]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[WK,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},GK,$,Q],radial:[``,$,Q],conic:[GK,$,Q]},uq,iq]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[WK,$,Q]}],"outline-w":[{outline:[``,WK,oq,tq]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,dq,aq]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,dq,aq]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[WK,tq]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,dq,aq]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[WK,$,Q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[WK]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[WK]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:ne()}],brightness:[{brightness:[WK,$,Q]}],contrast:[{contrast:[WK,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,dq,aq]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,WK,$,Q]}],"hue-rotate":[{"hue-rotate":[WK,$,Q]}],invert:[{invert:[``,WK,$,Q]}],saturate:[{saturate:[WK,$,Q]}],sepia:[{sepia:[``,WK,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[WK,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[WK,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,WK,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[WK,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,WK,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[WK,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[WK,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,WK,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[WK,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[WK,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[WK,oq,tq,nq]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Sq(...e){return xq(tK(e))}function Cq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,W.jsx)(QG,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:Sq(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,W.jsx)($G,{className:Sq(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var wq=null,Tq=!1,Eq={},Dq=500;function Oq(){if(typeof window>`u`)return null;if(wq?.state===`closed`&&(wq=null),!wq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;wq=new e}return wq}function kq(){wq&&=(wq.close().catch(()=>{}),null),Oq()}function Aq(){return Tq}function jq(){wq&&(kq(),Tq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&jq()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&jq()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&jq(),e=t},5e3)}async function Mq(){let e=Oq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Tq=!1}async function Nq(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function Pq(e){let t=Oq();if(!t||(await Nq(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function Fq(){let e=Date.now();if(!(e-(Eq.permission||0)<Dq)){Eq.permission=e;try{await Pq({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function Iq(){let e=Date.now();if(!(e-(Eq.idle||0)<Dq)){Eq.idle=e;try{await Pq({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function Lq({isOpen:e,onClose:t}){let n=H(e=>e.defaultProjectDir),r=H(e=>e.setDefaultProjectDir),i=H(e=>e.commandPresets),a=H(e=>e.setCommandPresets),o=H(e=>e.defaultPresetId),s=H(e=>e.setDefaultPresetId),c=H(e=>e.sessionSortMode),l=H(e=>e.setSessionSortMode),u=H(e=>e.sessionSortDirection),d=H(e=>e.setSessionSortDirection),f=H(e=>e.useWebGL),p=H(e=>e.setUseWebGL),m=H(e=>e.fontSize),h=H(e=>e.setFontSize),g=H(e=>e.lineHeight),_=H(e=>e.setLineHeight),v=H(e=>e.letterSpacing),y=H(e=>e.setLetterSpacing),b=H(e=>e.fontOption),S=H(e=>e.setFontOption),C=H(e=>e.customFontFamily),w=H(e=>e.setCustomFontFamily),T=H(e=>e.shortcutModifier),E=H(e=>e.setShortcutModifier),D=H(e=>e.showProjectName),O=H(e=>e.setShowProjectName),k=H(e=>e.showLastUserMessage),A=H(e=>e.setShowLastUserMessage),j=H(e=>e.showSessionIdPrefix),M=H(e=>e.setShowSessionIdPrefix),N=tU(e=>e.theme),F=tU(e=>e.setTheme),I=H(e=>e.soundOnPermission),ee=H(e=>e.setSoundOnPermission),R=H(e=>e.soundOnIdle),z=H(e=>e.setSoundOnIdle),[B,te]=(0,x.useState)(n),[V,ne]=(0,x.useState)(i),[re,U]=(0,x.useState)(o),[ie,ae]=(0,x.useState)(c),[oe,se]=(0,x.useState)(u),[ce,le]=(0,x.useState)(f),[ue,de]=(0,x.useState)(m),[fe,pe]=(0,x.useState)(g),[me,he]=(0,x.useState)(v),[ge,_e]=(0,x.useState)(b),[ve,ye]=(0,x.useState)(C),[be,xe]=(0,x.useState)(T),[Se,Ce]=(0,x.useState)(D),[we,Te]=(0,x.useState)(k),[Ee,De]=(0,x.useState)(j),[Oe,ke]=(0,x.useState)(N),[Ae,je]=(0,x.useState)(I),[Me,Ne]=(0,x.useState)(R),[Pe,Fe]=(0,x.useState)(!0),[Ie,Le]=(0,x.useState)(!1),[Re,ze]=(0,x.useState)(!0),[Be,Ve]=(0,x.useState)(!0),[He,Ue]=(0,x.useState)(!1),[We,Ge]=(0,x.useState)(!1),[Ke,Je]=(0,x.useState)(24),[Xe,Ze]=(0,x.useState)(!1),[Qe,$e]=(0,x.useState)(!1),[et,tt]=(0,x.useState)(``),[nt,rt]=(0,x.useState)(``),[it,at]=(0,x.useState)(``),ot=(0,x.useRef)(null),st=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let t=++st.current;if(ot.current&&=(clearTimeout(ot.current),null),e){if(te(n),ne(i),U(o),ae(c),se(u),le(f),de(m),pe(g),he(v),_e(b),ye(C),xe(T),Ce(D),Te(k),De(j),ke(N),je(I),Ne(R),$e(!1),tt(``),rt(``),at(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Fe(e.enabled)).catch(()=>{}),Ve(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{st.current===t&&ze(e.enabled)}).catch(()=>{}).finally(()=>{st.current===t&&Ve(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Je(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>Ue(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else typeof document<`u`&&(ot.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{ot.current&&=(clearTimeout(ot.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,R,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let ct=e=>{e.preventDefault();let n=B.trim(),i=ce!==f;r(n||`~/Documents/GitHub`),a(V),s(re),l(ie),d(oe),p(ce),h(ue),_(fe),y(me),S(ge),w(ve),E(be),O(Se),A(we),M(Ee),F(Oe),ee(Ae),z(Me),t({webglChanged:i})},lt=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},ut=e=>{let t=V.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=V.filter(t=>t.id!==e);ne(n),e===re&&U(n[0]?.id||`claude`)},dt=()=>{if(!et.trim()||!nt.trim()||V.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:et.trim(),command:nt.trim(),isBuiltIn:!1,agentType:it||void 0};ne([...V,e]),$e(!1),tt(``),rt(``),at(``)},ft=V.length<50,pt=e=>{Le(!0),Fe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Fe(!e)).finally(()=>Le(!1))},mt=e=>{Ge(!0),Ue(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ue(!e)).finally(()=>Ge(!1))},ht=e=>{Ve(!0),ze(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>ze(!e)).finally(()=>Ve(!1))},gt=e=>{let t=Ke;Ze(!0),Je(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Je(t)).finally(()=>Ze(!1))};return(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,W.jsxs)(`form`,{onSubmit:ct,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,W.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,W.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,W.jsx)(`input`,{value:B,onChange:e=>te(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,W.jsx)(`select`,{value:re,onChange:e=>U(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:V.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,W.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,W.jsx)(`div`,{className:`space-y-3`,children:V.map(e=>(0,W.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`input`,{value:e.label,onChange:t=>lt(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>ut(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,W.jsx)(`input`,{value:e.command,onChange:t=>lt(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,W.jsxs)(`select`,{value:e.agentType||``,onChange:t=>lt(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok`})]})]})]},e.id))}),Qe?(0,W.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,W.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,W.jsx)(`input`,{value:et,onChange:e=>tt(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,W.jsx)(`input`,{value:nt,onChange:e=>rt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(`select`,{value:it,onChange:e=>at(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,W.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,W.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,W.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,W.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,W.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,W.jsx)(`option`,{value:`grok`,children:`Grok Icon`})]}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,onClick:dt,disabled:!et.trim()||!nt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>$e(!0),disabled:!ft,className:`btn text-xs mt-3 w-full`,children:ft?`+ Add Preset`:`Max 50 presets`})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`desc`?`btn-primary`:``}`,onClick:()=>se(`desc`),children:`Newest First`}),(0,W.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`asc`?`btn-primary`:``}`,onClick:()=>se(`asc`),children:`Oldest First`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,W.jsx)(Cq,{checked:Se,onCheckedChange:Ce})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,W.jsx)(Cq,{checked:we,onCheckedChange:Te})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,W.jsx)(Cq,{checked:Ee,onCheckedChange:De})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,W.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`number`,min:1,max:168,value:Ke,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&>(t)},disabled:Xe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,W.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,W.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Fq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Cq,{checked:Ae,onCheckedChange:e=>{je(e),e&&Mq()}})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void Iq(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,W.jsx)(Cq,{checked:Me,onCheckedChange:e=>{Ne(e),e&&Mq()}})]})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,W.jsx)(Cq,{checked:ce,onCheckedChange:le})]}),ce!==f&&(0,W.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,W.jsx)(Cq,{checked:Pe,onCheckedChange:pt,disabled:Ie})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,W.jsx)(Cq,{checked:Re,onCheckedChange:ht,disabled:Be,ariaLabel:`Enable terminal colors`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,W.jsx)(Cq,{checked:He,onCheckedChange:mt,disabled:We})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.max(6,ue-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,W.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:ue}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>de(Math.min(24,ue+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,W.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:fe,onChange:e=>pe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:fe.toFixed(1)})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:me,onChange:e=>he(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,W.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[me,`px`]})]})]}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,W.jsx)(`select`,{value:ge,onChange:e=>_e(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),ge===`custom`&&(0,W.jsx)(`input`,{value:ve,onChange:e=>ye(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,W.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,W.jsx)(Cq,{checked:Oe===`dark`,onCheckedChange:e=>ke(e?`dark`:`light`)})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,W.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,W.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,W.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${be===e?`btn-primary`:``}`,onClick:()=>xe(e),children:e===`auto`?`Auto`:Ye(e)},e))}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:be===`auto`?`Shortcuts: ${Ye(qe(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Ye(be)}+[1-9/N/X/[/]]`})]})]})}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var Rq=[];function zq(e){x.useEffect(e,Rq)}var Bq=x.createContext(void 0);function Vq(){let e=x.useContext(Bq);if(!e)throw Error(KW(73));return e}var Hq=Symbol(`NOT_FOUND`);function Uq(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Wq(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Gq(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Kq=e=>Array.isArray(e)?e:[e];function qq(e){let t=Array.isArray(e[0])?e[0]:e;return Gq(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Jq(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Yq(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Hq},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Xq(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Hq}function i(t,i){r(t)===Hq&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var Zq=(e,t)=>e===t;function Qq(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function $q(e,t){let{equalityCheck:n=Zq,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Qq(n),o=0,s=r<=1?Yq(a):Xq(r,a);function c(){let t=s.get(arguments);if(t===Hq){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var eJ=class{constructor(e){this.value=e}deref(){return this.value}},tJ=typeof WeakRef<`u`?WeakRef:eJ,nJ=0,rJ=1;function iJ(){return{s:nJ,v:void 0,o:null,p:null}}function aJ(e,t={}){let n=iJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=iJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=iJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===rJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new tJ(c):c}return s.s=rJ,s.v=c,c}return o.clearCache=()=>{n=iJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function oJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Uq(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=aJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Kq(c),p=Kq(u),m=qq(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Jq(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var sJ=oJ(aJ),cJ=Object.assign((e,t=sJ)=>{Wq(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>cJ}),lJ=oJ({memoize:$q,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),uJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(KW(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},dJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(KW(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(KW(2))}u=lJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},fJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),pJ=s(((e,t)=>{t.exports=fJ()})),mJ=s((e=>{var t=p(),n=pJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),hJ=s(((e,t)=>{t.exports=mJ()})),gJ=[],_J=void 0;function vJ(){return _J}function yJ(e){gJ.push(e)}var bJ=pJ(),xJ=hJ(),SJ=JW(19)?TJ:EJ;function CJ(e,t,n,r,i){return SJ(e,t,n,r,i)}function wJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,bJ.useSyncExternalStore)(e.subscribe,a,a)}yJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,bJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function TJ(e,t,n,r,i){let a=vJ();if(!a)return wJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function EJ(e,t,n,r,i){return(0,xJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var DJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return CJ(this,e,t,n,r)}},OJ=class extends DJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),BW(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;BW(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;BW(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;BW(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),CJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=jW(t??WW);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},kJ=null;globalThis.requestAnimationFrame;var AJ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},jJ=class e{static create(){return new e}static request(e){return AJ.request(e)}static cancel(e){return AJ.cancel(e)}currentId=kJ;request(e){this.cancel(),this.currentId=AJ.request(()=>{this.currentId=kJ,e()})}cancel=()=>{this.currentId!==kJ&&(AJ.cancel(this.currentId),this.currentId=kJ)};disposeEffect=()=>this.cancel};function MJ(){let e=OW(jJ.create).current;return zq(e.disposeEffect),e}var NJ=0,PJ=class e{static create(){return new e}currentId=NJ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=NJ,t()},e)}isStarted(){return this.currentId!==NJ}clear=()=>{this.currentId!==NJ&&(clearTimeout(this.currentId),this.currentId=NJ)};disposeEffect=()=>this.clear};function FJ(){let e=OW(PJ.create).current;return zq(e.disposeEffect),e}var IJ=0;function LJ(e){return IJ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${IJ}`}function RJ(e){return e?.ownerDocument||document}function zJ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var BJ=typeof navigator<`u`,VJ=KJ(),HJ=JJ(),UJ=qJ();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),VJ.platform===`MacIntel`&&VJ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(VJ.platform),BJ&&/firefox/i.test(UJ);var WJ=BJ&&/apple/i.test(navigator.vendor);BJ&&/Edg/i.test(UJ),BJ&&/android/i.test(HJ)||/android/i.test(UJ),BJ&&HJ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var GJ=UJ.includes(`jsdom/`);function KJ(){if(!BJ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function qJ(){if(!BJ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function JJ(){if(!BJ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function YJ(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function XJ(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&DG(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ZJ(e){return`composedPath`in e?e.composedPath()[0]:e.target}function QJ(e){if(!e||GJ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var $J=dJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),eY={toasts:uJ(e=>e.toasts),isEmpty:uJ(e=>e.toasts.length===0),toast:uJ($J,(e,t)=>e.get(t)?.value),toastIndex:uJ($J,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:uJ($J,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:uJ($J,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:uJ(e=>e.hovering),focused:uJ(e=>e.focused),expanded:uJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:uJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:uJ(e=>e.prevFocusElement)},tY=class extends OJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},eY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=eY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||LJ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),eY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=eY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),eY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{eY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=zJ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=zJ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=zJ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=PJ.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=ZJ(e);XJ(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!eY.expandedOrOutOfFocus(this.state),a=i?PJ.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=YJ(RJ(this.state.viewport));if(!this.state.viewport||!XJ(this.state.viewport,t)||!QJ(t))return;let n=eY.toasts(this.state),r=eY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},nY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=OW(()=>new tY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return zq(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,W.jsx)(Bq.Provider,{value:a,children:t})},rY=x.forwardRef(function(e,t){let[n,r]=x.useState();BW(()=>{WJ&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,W.jsx)(`span`,{...e,ref:t,style:HW,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),iY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),aY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=Vq(),s=FJ(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(YJ(RJ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=wG(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=wG(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=ZJ(n),i=YJ(RJ(e));(!XJ(e,r)||!QJ(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=RJ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||QJ(RJ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||XJ(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=fG(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[iY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(rY,{onFocus:_}),i,!u&&m&&(0,W.jsx)(rY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,W.jsxs)(x.Fragment,{children:[!u&&m&&(0,W.jsx)(rY,{onFocus:_}),E,!f&&D.length>0&&(0,W.jsx)(`div`,{style:HW,children:D.map(e=>(0,W.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,W.jsx)(`div`,{children:e.title}),(0,W.jsx)(`div`,{children:e.description})]},e.id))})]})});function oY(e){return JW(19)?e:e?`true`:void 0}var sY=x.createContext(void 0);function cY(){let e=x.useContext(sY);if(!e)throw Error(KW(66));return e}var lY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),uY={[lY.startingStyle]:``},dY={[lY.endingStyle]:``},fY={transitionStatus(e){return e===`starting`?uY:e===`ending`?dY:null}};function pY(e){return e==null?e:`current`in e?e.current:e}function mY(e,t=!1,n=!0){let r=MJ();return jW((i,a=null)=>{r.cancel();function o(){U.flushSync(i)}let s=pY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=lY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function hY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=jW(i),o=mY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var gY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),_Y={...fY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},vY=40,yY=10,bY=.5,xY=1;function SY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function CY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var wY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=Vq(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),ee=u.useState(`toastIndex`,n.id),R=u.useState(`toastVisibleIndex`,n.id),z=u.useState(`toastOffsetY`,n.id),B=u.useState(`focused`),te=u.useState(`expanded`);hY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let V=jW((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?U.flushSync(a):a()});BW(V,[V]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**bY:-(Math.abs(e)**bY):(!c.includes(`right`)&&e>0&&(n=e**bY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**bY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**bY:-(Math.abs(t)**bY):(!c.includes(`down`)&&t>0&&(r=t**bY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**bY))),{x:n,y:r}}function H(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=ZJ(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=CY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function re(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=xY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=SY(u,a,o),f(u));else{let e=N.current,t=SY(e,l,s);t>vY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=yY&&(F.current=!0)}let d=ne(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>vY&&(t=!0,a=`right`);break;case`left`:r<-vY&&(t=!0,a=`left`);break;case`down`:i>vY&&(t=!0,a=`down`);break;case`up`:i<-vY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!A.current||!XJ(A.current,YJ(RJ(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){XJ(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[gY.swipeMovementX]:`0px`,[gY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[gY.swipeMovementX]:`${e}px`,[gY.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":se&&!B?!0:void 0,onPointerDown:l?H:void 0,onPointerMove:l?re:void 0,onPointerUp:l?ie:void 0,onKeyDown:ae,inert:oY(n.limited),style:{...oe(),[gY.index]:n.transitionStatus===`ending`?ee:R,[gY.offsetY]:`${z}px`,[gY.height]:n.height?`${n.height}px`:void 0}},le=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:V,index:ee,visibleIndex:R,expanded:te}),[n,w,E,p,d,V,ee,R,te]),ue={transitionStatus:n.transitionStatus,expanded:te,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=fG(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:_Y,props:[ce,o]});return(0,W.jsx)(sY.Provider,{value:le,children:de})}),TY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=cY(),l=a??s.description,u=!!l,d=xG(i);BW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=fG(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),EY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=cY(),l=a??s.title,u=!!l,d=xG(i);BW(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=fG(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),DY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=Vq(),{toast:c}=cY(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=jG({disabled:i,native:a}),m={type:c.type};return fG(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function OY(){let e=x.useContext(Bq);if(!e)throw Error(KW(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function kY(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||LJ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var AY=5e3,jY=kY();function MY({toast:e}){return(0,W.jsxs)(wY,{toast:e,className:Sq(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(EY,{className:Sq(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,W.jsx)(TY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,W.jsx)(DY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,W.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function NY(){let{toasts:e}=OY();return(0,W.jsx)(W.Fragment,{children:e.map(e=>(0,W.jsx)(MY,{toast:e},e.id))})}function PY(){return(0,W.jsxs)(nY,{timeout:AY,toastManager:jY,children:[(0,W.jsx)(NY,{}),(0,W.jsx)(aY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var FY=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],IY=3e3,LY=8e3,RY=15e3,zY=5e3,BY=2e4,VY=1e4,HY=1500,UY=5e3,WY=750,GY=4,KY=5e3,qY=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(pE(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,pE(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{pE(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?FY[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){pE(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){pE(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}pE(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;pE(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?LY:IY;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(pE(`ws_connect_timeout`,{wsState:FY[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){pE(`ws_onopen_stale`,this.wsSnap(),`info`);return}pE(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),pE(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(UY)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(pE(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){pE(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}pE(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>RY&&(pE(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},zY))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return pE(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(pE(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){pE(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(pE(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},HY)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){pE(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){pE(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){pE(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,pE(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},WY)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,pE(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},VY)))};e!==void 0&&e<BY?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,BY)},e):this.heartbeatTimer=window.setInterval(t,BY)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){pE(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=GY){pE(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets(),this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},KY);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);pE(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){pE(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function JY(){let e=qm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{qY.connect(),qY.startLifecycleListeners();let t=qY.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),qY.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{qY.send(e)},[]),subscribe:(0,x.useMemo)(()=>qY.subscribe.bind(qY),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>qY.getConnectionEpoch(),[])}}var YY=100;function XY({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>YY?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function ZY(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function QY(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{XY({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),ZY(document)}},[])}function $Y(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function eX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=qm(e=>e.sessions),_=qm(e=>e.agentSessions),v=qm(e=>e.agentSessionsEpoch),y=qm(e=>e.selectedSessionId),b=qm(e=>e.selectedHibernatingSessionId),S=qm(e=>e.setSessions),C=qm(e=>e.setAgentSessions),w=qm(e=>e.setActiveAgentSessions),T=qm(e=>e.setHostStatuses),E=qm(e=>e.updateSession),D=qm(e=>e.setSelectedSessionId),O=qm(e=>e.setSelectedHibernatingSessionId),k=qm(e=>e.hasLoaded),A=qm(e=>e.connectionStatus),j=qm(e=>e.connectionError),M=qm(e=>e.clearExitingSession),N=qm(e=>e.markSessionExiting),P=qm(e=>e.setRemoteAllowControl),F=qm(e=>e.setRemoteAllowAttach),I=qm(e=>e.setHostLabel),L=qm(e=>e.setPreferWindowName),ee=qm(e=>e.hostStatuses),R=qm(e=>e.remoteAllowControl),z=qm(e=>e.hostLabel),B=tU(e=>e.theme),te=re(),V=H(e=>e.defaultProjectDir),ne=H(e=>e.commandPresets),ie=H(e=>e.defaultPresetId),ae=H(e=>e.lastProjectPath),oe=H(e=>e.setLastProjectPath),se=H(e=>e.addRecentPath),ce=H(e=>e.shortcutModifier),le=H(e=>e.sidebarWidth),ue=H(e=>e.setSidebarWidth),de=H(e=>e.projectFilters),fe=H(e=>e.hostFilters),pe=H(e=>e.soundOnPermission),me=H(e=>e.soundOnIdle),he=qm(e=>e.connectionEpoch),{sendMessage:ge,subscribe:_e,getConnectionEpoch:ve}=JY();QY(),(0,x.useEffect)(()=>{if(typeof document>`u`||!pe&&!me)return;let e=!1,t=()=>{e&&!Aq()||(e=!0,Mq())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[pe,me]);let ye=(0,x.useRef)(!1),be=(0,x.useCallback)(e=>{e.preventDefault(),ye.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ye.current)return;let t=e.clientX;ue(Math.max(180,Math.min(400,t)))},t=()=>{ye.current&&(ye.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[ue]),(0,x.useEffect)(()=>{let e=_e(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=qm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=H.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&Fq(),e.status===`working`&&i.status===`waiting`&&r&&Iq())}if(Ie.current.size>0){let e=ve();for(let[t,n]of Ie.current)n.epoch!==e&&Ie.current.delete(t)}let i=Ie.current.size>0?e.sessions.filter(e=>!Ie.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=qm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(Me.current=s),S(i);let c=Ne.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=qm.getState(),{projectFilters:d,hostFilters:f}=H.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Ne.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&fE(e.clientLogLevel)),e.type===`session-update`){let t=qm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=H.getState();t!==`permission`&&n===`permission`&&e&&Fq(),t===`working`&&n===`waiting`&&r&&Iq()}}if(e.type===`session-created`){let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),se(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=H.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){EH(e.sessionId);let t=qm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=qm.getState(),a=Me.current;i&&!n.some(e=>e.sessionId===i)&&(Ne.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(Me.current=null,O(a)):a&&(Me.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=qm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=qm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isPinned:e.session.isPinned,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=qm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Ie.current.get(e.sessionId);if(t){let n=qm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Ie.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,se,M,ge,D,O,h,S,C,w,T,P,F,I,L,_e,E]);let xe=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),Se=_.hibernating??[],Ce=_.history??[],we=(0,x.useMemo)(()=>$Y(Se,de,fe),[Se,de,fe]),Te=(0,x.useMemo)(()=>we.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[we,m,b]);(0,x.useEffect)(()=>{xe?.projectPath&&!xe.remote&&oe(xe.projectPath)},[xe?.projectPath,xe?.remote,oe]);let Ee=H(e=>e.sessionSortMode),De=H(e=>e.sessionSortDirection),Oe=H(e=>e.manualSessionOrder),ke=(0,x.useMemo)(()=>Mm(g,{mode:Ee,direction:De,manualOrder:Oe}),[g,Ee,De,Oe]),Ae=(0,x.useMemo)(()=>{let e=ke;return de.length>0&&(e=e.filter(e=>de.includes(e.projectPath))),fe.length>0&&(e=e.filter(e=>fe.includes(e.host??``))),e},[ke,de,fe]),je=(0,x.useRef)(b),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(null),Pe=(0,x.useRef)(he),Fe=(0,x.useCallback)(()=>Ae.length>0?(D(Ae[0].id),!0):we.length>0?(O(we[0].sessionId),!0):!1,[Ae,we,D,O]);(0,x.useEffect)(()=>{let e=je.current;e&&b===null&&!Se.some(t=>t.sessionId===e)?Ne.current=e:b!==null&&(Ne.current=null),je.current=b},[Se,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Pe.current!==he&&(Pe.current=he,Me.current=null,Ne.current=null,h(null))},[he]),(0,x.useEffect)(()=>{k&&(b||y&&(Ae.some(e=>e.id===y)||Fe()||D(null)))},[k,y,b,Fe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==he||we.some(e=>e.sessionId===b))return;let e=Ae.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Fe()||O(null)},[we,Ae,v,m,b,Fe,D,O,he]),(0,x.useEffect)(()=>{let e=Ne.current;if(!e)return;if(b!==null){Ne.current=null;return}let t=Ae.find(t=>t.agentSessionId?.trim()===e);if(t){Ne.current=null,D(t.id);return}if(y!==null){Ne.current=null;return}Fe()&&(Ne.current=null)},[Ae,y,b,Fe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(Ae.length>0||we.length>0)&&Fe()},[we.length,Ae.length,k,Fe,y,b]);let Ie=(0,x.useRef)(new Map),Le=(0,x.useCallback)((e,t=`unknown`)=>{EH(e);let{sessions:n,selectedSessionId:r}=qm.getState(),i=n.find(t=>t.id===e);i&&Ie.current.set(e,{session:i,wasSelected:r===e,epoch:ve()}),(0,U.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),ge({type:`session-kill`,sessionId:e,source:t})},[N,S,ge]);(0,x.useEffect)(()=>{let n=qe(ce),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Xe(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=Ae;if(t.length===0){let t=we;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(Ae.length>0){let t=Ae[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=we[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&te&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Le(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,Ae,we,Le,ce,te]);let Re=()=>te?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,ze=()=>l(!0),Be=(e,t,n,r)=>{ge({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||oe(e)},Ve=e=>{ge({type:`session-wake`,sessionId:e})},He=(0,x.useCallback)(e=>{ge({type:`session-hibernate`,sessionId:e})},[ge]),Ue=(e,t)=>{ge({type:`session-rename`,sessionId:e,newName:t})},We=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&ge({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,ge]),Ge=(0,x.useCallback)(e=>{ge({type:`session-move-to-history`,sessionId:e})},[ge]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,B)},[B]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ke=(0,x.useMemo)(()=>z?ee.filter(e=>e.host!==z):ee,[ee,z]);return(0,W.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:le},children:[(0,W.jsx)($e,{connectionStatus:A,onNewSession:Re,onOpenSettings:ze,tailscaleIp:f?.tailscaleIp??null}),(0,W.jsx)(sE,{sessions:g,hibernatingSessions:Se,historySessions:Ce,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:Ue,onResume:Ve,onHibernate:He,onKill:Le,onDuplicate:We,onMoveToHistory:Ge,onNewSession:Re,loading:!k,error:j||u})]}),(0,W.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:be}),(0,W.jsx)(oW,{session:xe,sessions:Ae,hibernatingSession:Te,hibernatingSessions:Se,connectionStatus:A,connectionEpoch:he,sendMessage:ge,subscribe:_e,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Re,onKillSession:Le,onRenameSession:Ue,onOpenSettings:ze,onResumeSession:Ve,onHibernateSession:He,onMoveToHistory:Ge,historySessions:Ce,loading:!k,error:j||u}),(0,W.jsx)(TW,{isOpen:e,onClose:()=>t(!1),onCreate:Be,defaultProjectDir:V,commandPresets:ne,defaultPresetId:ie,lastProjectPath:ae,activeProjectPath:xe&&!xe.remote?xe.projectPath:void 0,remoteHosts:Ke,remoteAllowControl:R,initialHost:n,initialPath:i,initialCommand:o}),(0,W.jsx)(Lq,{isOpen:c,onClose:()=>l(!1)}),(0,W.jsx)(PY,{})]})}var tX=`modulepreload`,nX=function(e){return`/`+e},rX={},iX=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=nX(t,n),t in rX)return;rX[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:tX,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},aX=`true`,oX=`false`,sX=aX===`true`,cX=oX===`true`;function lX(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,sX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await iX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!cX)if(sX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}We()&&document.documentElement.classList.add(`ios`),Ge()&&document.documentElement.classList.add(`ios-pwa`),lX({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var uX=document.getElementById(`root`);if(!uX)throw Error(`Root element not found`);(0,E.createRoot)(uX).render((0,W.jsx)(x.StrictMode,{children:(0,W.jsx)(eX,{})}));
|
package/dist/client/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<title>Agentboard</title>
|
|
9
9
|
<link rel="apple-touch-icon" href="/icons/pwa-192x192.png" />
|
|
10
10
|
<meta name="theme-color" content="#0f172a" />
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-C92OD_iZ.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-D9NZjKbA.css">
|
|
13
13
|
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
14
14
|
<body>
|
package/dist/client/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,n={};const i=(i,o)=>(i=new URL(i+".js",o).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(o,s)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(n[r])return;let t={};const f=e=>i(e,r),d={module:{uri:r},exports:t,require:f};n[r]=Promise.all(o.map(e=>d[e]||f(e))).then(e=>(s(...e),t))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let e,n={};const i=(i,o)=>(i=new URL(i+".js",o).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(o,s)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(n[r])return;let t={};const f=e=>i(e,r),d={module:{uri:r},exports:t,require:f};n[r]=Promise.all(o.map(e=>d[e]||f(e))).then(e=>(s(...e),t))}}define(["./workbox-8c29f6e4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"805393244116b9e6002994a407ab59e0"},{url:"favicon.svg",revision:"12048a608dedfc53518ddc59c07e41b6"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"fonts/jetbrains-mono-vietnamese-wght-normal.woff2",revision:"ddf99e6e35c6ee9f00a41d2567b0e77f"},{url:"fonts/jetbrains-mono-latin-wght-normal.woff2",revision:"b058178d7f309414f8f856b99fd80d9b"},{url:"fonts/jetbrains-mono-latin-ext-wght-normal.woff2",revision:"e36841ed93d5bfe6b1d487d18ad7e90b"},{url:"fonts/jetbrains-mono-greek-wght-normal.woff2",revision:"51671ed9eb64e29390d4791ab0023c8e"},{url:"fonts/jetbrains-mono-cyrillic-wght-normal.woff2",revision:"615bf869ebeb5998734d81fc8958116c"},{url:"fonts/jetbrains-mono-cyrillic-ext-wght-normal.woff2",revision:"742dd0628e0118d32dccf0437900670b"},{url:"assets/workbox-window.prod.es5-Bq4GJJid.js",revision:null},{url:"assets/index-D9NZjKbA.css",revision:null},{url:"assets/index-C92OD_iZ.js",revision:null},{url:"icons/pwa-192x192.png",revision:"affb57c15619ee7223d1adea372ad514"},{url:"icons/pwa-512x512.png",revision:"eb82042b3e4ed505f3efe1b79622d998"},{url:"manifest.webmanifest",revision:"b6d4b3666a548fa0f0c6919d31ec2eee"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/api(?:\/|$)/,/^\/ws(?:\/|$)/]}))});
|