@openchambery/web 2.0.0-beta.11 → 2.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AssistantView-DZ0JKlUo.js +3 -0
- package/dist/assets/{DiagramView-ByYLIfWo.js → DiagramView--pU6ohnA.js} +1 -1
- package/dist/assets/{MarkdownRenderer-CPU6kSHd.js → MarkdownRenderer-38oU4xtI.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-2hw5cdqQ.js → MarkdownRendererImpl-BmaQCjcI.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-DXZQkLTa.js → MarkstreamRendererImpl-DsK1uz-k.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-C9BzieQY.js → MobileDetailNavigation-6fKfAuI8.js} +1 -1
- package/dist/assets/{MobileShareBridge-2_iOfzqO.js → MobileShareBridge-C71kg-60.js} +1 -1
- package/dist/assets/MobileSurface-BFUgve3c.js +2 -0
- package/dist/assets/{MultiRunWindow-QA6pMrJ9.js → MultiRunWindow-CLn3DKGh.js} +1 -1
- package/dist/assets/SettingsView-BgkJZ9di.js +25 -0
- package/dist/assets/{SettingsWindow-CetgiJMX.js → SettingsWindow-BEeczSGh.js} +1 -1
- package/dist/assets/{TerminalView-BuXuo7gm.js → TerminalView-C4IN1OjP.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DNSSOaCt.js → ToolOutputDialog-CqaiiT1U.js} +1 -1
- package/dist/assets/{appThemeRegistry-Cb7qFBsc.js → appThemeRegistry-iIISIT3M.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-BCAKb-NS.js → fileMentionTouchSelection-CRd9V2j3.js} +1 -1
- package/dist/assets/{gitApi-3VBj3fbR.js → gitApi-Defy-gVu.js} +4 -4
- package/dist/assets/insertionBoundaries-Dn1Al9mx.js +1 -0
- package/dist/assets/{main-COEILjRF.js → main-BF8yvTbG.js} +12 -12
- package/dist/assets/{main-DsUewWPt.js → main-DFJ23aoT.js} +2 -2
- package/dist/assets/{mcpQueries-B05QR67V.js → mcpQueries-Cgf6MdLa.js} +1 -1
- package/dist/assets/{miniChat-D7IPMm-k.js → miniChat-Bpvko0j9.js} +2 -2
- package/dist/assets/{mobile-BnCoDxnv.js → mobile-3sunRAXX.js} +2 -2
- package/dist/assets/multirun-CRhkfJum.js +4 -0
- package/dist/assets/{projectMeta-C5gcAd5f.js → projectMeta-BXR_V6FR.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-DsAaWCss.js → renderElectronMiniChatApp-BT8rVrtX.js} +2 -2
- package/dist/assets/renderMobileApp-DoE5q0Ob.js +28 -0
- package/dist/assets/{runtimeConfig-CzPK1uMj.js → runtimeConfig-B88-ZivS.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DKjVJCdt.js → runtimeEndpointReset-DMiw-qyY.js} +6 -6
- package/dist/assets/{sessionChangeSummary-CktSWasa.js → sessionChangeSummary-BuOczB_t.js} +1 -1
- package/dist/assets/{sessionLookup-CDA1aAcI.js → sessionLookup-CYbs1Lsc.js} +1 -1
- package/dist/assets/{useAppFontEffects-2zzPMQF2.js → useAppFontEffects-CXh2NTBX.js} +53 -53
- package/dist/assets/{useDesktopWindowControlsLayout-B-2YooUd.js → useDesktopWindowControlsLayout-BPqsR_Z4.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-K3U4eL5F.js → useEffectiveDirectory-DvYPK8Aw.js} +1 -1
- package/dist/assets/useMobileNavigationStore-CBw22aun.js +414 -0
- package/dist/assets/useSessionAutoCleanup-BuAJaaCz.js +2 -0
- package/dist/assets/{useWorkerHighlightedLines-CsoMQNik.js → useWorkerHighlightedLines-BKdTJ37z.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/dist/assets/AssistantView-C4GkABnI.js +0 -3
- package/dist/assets/MobileSurface-DNVA7K_1.js +0 -2
- package/dist/assets/SettingsView-dWuu0VIb.js +0 -25
- package/dist/assets/insertionBoundaries-BMuCcvPy.js +0 -1
- package/dist/assets/multirun-BDmFjX9N.js +0 -4
- package/dist/assets/renderMobileApp-DOaoohlp.js +0 -28
- package/dist/assets/useMobileNavigationStore-B0zSdCwP.js +0 -414
- package/dist/assets/useSessionAutoCleanup-BCXHAcbX.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{c as t,i as n}from"./runtime-switch-LvWDU-SL.js";import{A as r,O as i,d as a,f as o,nn as s,wn as c}from"./persistence-DznVIKwz.js";import{a as l,i as u,r as d}from"./vendor-zustand-B4dlGEM2.js";import{nt as f,rt as p}from"./vendor-base-ui-CnHfUmDN.js";import{B as m,Ct as h,M as g,Mt as _}from"./platform-DSTtx-DI.js";import{b as v,n as ee,x as y}from"./useUIStore-syVmbuDA.js";import{n as b}from"./vendor-react-DLPElpoQ.js";import{s as x}from"./vendor-tanstack-react-query-D7pys_c9.js";import{n as S}from"./vendor-reactuses-core-Dq5ocTF8.js";import{f as te,r as C,u as ne}from"./button-Doq9FI1I.js";import{Ht as re,Pn as ie,S as w,Ua as ae,_n as T,ao as E,d as D,dt as oe,ft as se,io as ce,lt as O,ma as le,mr as k,mt as A,sn as ue,ut as j,xr as de,y as fe}from"./useMobileNavigationStore-B0zSdCwP.js";import{n as M}from"./Icon-Dz2kO9RN.js";import{g as N,v as P}from"./gitApi-3VBj3fbR.js";import{f as pe,k as me,o as F}from"./projectMeta-C5gcAd5f.js";import{n as he}from"./textarea--CYehp07.js";import{n as ge,r as _e,t as ve}from"./fileMentionTouchSelection-BCAKb-NS.js";var I=e=>{switch(e.name){case`new`:return`add`;case`init`:return`file`;case`undo`:return`arrow-go-back`;case`redo`:return`arrow-go-forward`;case`timeline`:return`time`;case`compact`:return`scissors`;case`reload`:return`refresh`;case`goal`:return`target`;case`review`:return`search-eye`;case`test`:case`build`:case`run`:return`terminal-box`;default:return e.isBuiltIn?`flashlight`:`command`}},ye=()=>`book-open`,be=e=>{if(e.isDirectory)return`folder-3-fill`;switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`json`:return`code`;case`md`:case`mdx`:return`file`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return`file-image`;default:return`file-pdf`}},xe=()=>`ai-agent`,Se=()=>`chat-thread`,Ce=(e,t)=>e.map(e=>{let n=e.isSkill?t.skill:e.isOpenChamber?`OpenChamber`:e.isBuiltIn?t.system:e.scope||e.agent||t.command;return{id:e.id,title:`/${e.name}`,subtitle:e.description,badge:n,iconName:I(e)}}),we=({skills:e=[],agents:t,sessions:n,recentFiles:r,pathHits:i,untitledSession:a,sessionBadge:o,skillBadge:s})=>{let c=[];for(let t of e)c.push({id:`skill:${t.name}-${t.scope}`,title:`@${t.name}`,subtitle:t.description,badge:s??t.scope,iconName:ye()});for(let e of t)c.push({id:`agent:${e.name}`,title:`@${e.name}`,subtitle:e.description,iconName:xe()});for(let e of n)c.push({id:`session:${e.id}`,title:e.title||a,badge:o,iconName:Se()});for(let e of r)c.push({id:`recent:${e.path}`,title:e.relativePath||e.name,iconName:be(e)});for(let e of i)c.push({id:`file:${e.path}`,title:e.relativePath||e.name,iconName:be(e)});return c},Te=(e,t)=>{let n=t.trim();if(!n.length)return[...e].sort((e,t)=>e.scope===`project`&&t.scope!==`project`?-1:e.scope!==`project`&&t.scope===`project`?1:e.name.localeCompare(t.name));let r=ie([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.scope===`project`&&t.item.scope!==`project`?-1:e.item.scope!==`project`&&t.item.scope===`project`?1:e.item.name.localeCompare(t.item.name):e.score-t.score),r.map(e=>e.item)},Ee=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=ie([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},De=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName}),Oe=(e,t)=>e.highlightedIndex===t.highlightedIndex&&De(e.rows,t.rows),ke=(e,t)=>De(e,t)?e:t.slice(),Ae=(e,t,n)=>{e&&(t.current&&Oe(t.current,n)||(t.current=n,e(n)))},je=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},L=e(p(),1),R=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},z=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,B=(e,t)=>{let n=R(t),r=R(e);if(!n||!r)return!1;let i=z(n),a=z(r);return a===i||a.startsWith(`${i}/`)},Me=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=R(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>R(e)).filter(e=>B(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>R(e)).filter(e=>B(e,t)))):[],s=typeof i.selectedPath==`string`?R(i.selectedPath):null,c=s&&B(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},V=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},Ne=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Pe=l()(d(u((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=R((t||``).trim()),a=R((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=Ne(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:V({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=e=>z(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=z(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=z(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:V({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=R((t||``).trim()),a=n?R(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=Ne(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:V({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=R((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=Ne(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=Ne(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=R((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>R((e||``).trim())).filter(e=>e&&B(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=Ne(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:v(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Me(t)}},partialize:e=>({byRoot:Me(e.byRoot)})}),{name:`files-view-tabs-store`})),H=b(),Fe=(e,t)=>{let n=(0,H.c)(4),r=t===void 0?200:t,[i,a]=L.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),L.useEffect(o,s),i},Ie=()=>{let e=(0,H.c)(17),t=D(U),n=T(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=w(r),a=D(W),o=D(Le),s=E(G),c=E(Re),l=h(K);if(t){let r;e[2]===i?r=e[3]:(r=fe(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return l??void 0};function U(e){return e.currentSessionId}function W(e){return e.worktreeMetadata}function Le(e){return e.newSessionDraft}function G(e){return e.activeProjectId}function Re(e){return e.projects}function K(e){return e.currentDirectory}var q=f(),J=`bg-transparent font-[inherit] text-[var(--primary-base)]`,Y=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,q.jsx)(`mark`,{className:J,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},X=L.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:a,onSessionSelect:o,onClose:s,style:c,onRowsChange:l},u)=>{let{t:d}=te(),f=Ie()??``,p=D(e=>e.currentSessionId),m=de(e=>e.activeSessions),h=re({enabled:!!o}),g=E(e=>e.activeProjectId),v=E(e=>e.projects),y=L.useMemo(()=>v.find(e=>e.id===g)?.path??null,[g,v]),b=L.useMemo(()=>{let e=y||f;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[y,f]),x=Pe(e=>b?e.byRoot[b]:void 0),ie=le(e=>e.getVisibleAgents),w=_(e=>e.searchFiles),T=Fe(e,180),ce=r(),ue=i(),[fe,N]=L.useState([]),[P,pe]=L.useState([]),[me,F]=L.useState(!1),[I,xe]=L.useState(0),Se=L.useRef(0),[Ce,Ee]=L.useState(360),[De,Oe]=L.useState({}),[ke,R]=L.useState({}),z=L.useRef([]),B=L.useRef([]),Me=L.useRef([]),V=L.useRef(null),Ne=L.useRef(null),H=L.useRef(null);H.current||=ve();let U=ee(e=>e.isMobile),W=(e??``).trim(),Le=ae({directory:f||null}),G=L.useMemo(()=>a?Te(Le.data??[],W):[],[W,a,Le.data]),Re=L.useMemo(()=>{if(!b||!x)return[];let e=[x.selectedPath,...x.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${b}/`)?e.slice(b.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return se(n,W,{limit:6})},[W,b,x]),K=L.useMemo(()=>W.length>0?P:P.slice(0,2),[P,W.length]),J=L.useMemo(()=>o?O({sessions:k(m,h),currentSessionId:p,searchQuery:W}):[],[m,p,h,W,o]),X=Re,Z=fe;L.useEffect(()=>{let e=e=>{let t=e.target;!t||!V.current||V.current.contains(t)||s()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[s]),L.useEffect(()=>{if(!f){N([]);return}let e=(T??``).trim(),t=A(e);if(!t){N([]);return}let n=!1;F(!0);let r={includeHidden:ce,respectGitignore:!ue};return Promise.all([w(f,t,80,{...r,type:`file`}),w(f,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Re.map(e=>e.path));N(j({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||N([])}).finally(()=>{n||F(!1)}),()=>{n=!0}},[f,T,Re,w,ce,ue]),L.useEffect(()=>{let t=ie().filter(e=>e.mode&&e.mode!==`primary`).map(e=>({name:e.name,description:e.description,mode:e.mode}));pe(oe(t,e??``))},[ie,e]),L.useEffect(()=>{xe(0),Oe({}),R({})},[Z,X.length,K.length,J.length,G.length]),L.useEffect(()=>{Se.current=I},[I]),L.useEffect(()=>{z.current[I]?.scrollIntoView({block:`nearest`})},[I]),L.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};B.current.forEach((n,r)=>{if(!n)return;let i=Me.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),Oe(e),R(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Z,X]),L.useEffect(()=>{let e=B.current[I];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Ee(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[I]);let ze=S(e=>{t(e)}),Be=S(e=>{n?.(e)}),Ve=S(e=>{o?.(e)}),He=S(e=>{a?.(e)}),Ue=G.length,We=Ue,Ge=We+K.length,Ke=Ge+J.length,qe=Ke+X.length,Je=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>xe(e)}),Ye=e=>{let t=Ue+K.length+J.length+X.length+Z.length;if(t===0)return;let n=(e%t+t)%t;if(n<Ue){let e=G[n];e&&He(e);return}if(n<Ge){let e=K[n-We];e&&Be(e.name);return}if(n<Ke){let e=J[n-Ge];e&&Ve(e);return}let r=n-Ke,i=r<X.length?X[r]:Z[r-X.length];i&&ze(i)};L.useEffect(()=>{Ae(l,Ne,{rows:we({skills:G,agents:K,sessions:J,recentFiles:X,pathHits:Z,untitledSession:d(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:d(`chat.fileMentionAutocomplete.sessionType`),skillBadge:d(`chat.commandAutocomplete.badge.skill`)}),highlightedIndex:I})},[l,I,d,K,Z,X,J,G]);let Xe=L.useRef(l);Xe.current=l,L.useEffect(()=>()=>{je(Xe.current,Ne)},[]),L.useImperativeHandle(u,()=>({acceptIndex:e=>{Ye(e)},handleKeyDown:e=>{if(e===`Escape`){s();return}let t=Ue+K.length+J.length+X.length+Z.length;if(t!==0){if(e===`ArrowDown`){xe(e=>(e+1)%t);return}if(e===`ArrowUp`){xe(e=>(e-1+t)%t);return}(e===`Enter`||e===`Tab`)&&Ye(Se.current)}}}),[Ue,Z,X,K,J,G,s,ze,Be,Ve,He]);let Ze=e=>(0,q.jsx)(M,{name:be(e),className:`h-3.5 w-3.5 text-current`});return(0,q.jsxs)(ge,{ref:V,isMobile:U,className:`max-w-[640px] max-h-64`,style:c,children:[(0,q.jsx)(he,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,q.jsxs)(`div`,{className:`pb-2`,children:[G.length>0&&(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.skills`)}),G.map((e,t)=>{let n=I===t;return(0,q.jsx)(`div`,{ref:e=>{z.current[t]=e},className:C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,_e(U,n),!U&&n&&`text-interactive-selection-foreground`),...Je(t,()=>He(e)),children:(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(M,{name:ye(),className:`h-3.5 w-3.5 translate-y-px flex-shrink-0 text-current`}),(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`@`,Y(e.name,W)]}),U?null:(0,q.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:e.scope})]}),e.description&&!U?(0,q.jsx)(`div`,{className:`pl-5.5 typography-meta text-muted-foreground truncate`,children:Y(e.description,W)}):null]})},`skill-${e.name}-${e.scope}`)}),K.length>0&&(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.agents`)}),K.map((e,t)=>{let n=We+t,r=I===n;return(0,q.jsx)(`div`,{ref:e=>{z.current[n]=e},className:C(`flex items-start gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,_e(U,r),!U&&r&&`text-interactive-selection-foreground`),...Je(n,()=>Be(e.name)),children:(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`truncate`,children:[`@`,Y(e.name,W)]}),e.description&&!U?(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:Y(e.description,W)}):null]})},`agent-${e.name}`)}),K.length===2&&W.length===0&&P.length>2&&(0,q.jsx)(`div`,{className:`px-3 py-1 typography-meta text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.searchMoreAgents`)}),J.length>0&&(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.sessions`)}),J.map((e,t)=>{let n=Ge+t,r=I===n;return(0,q.jsxs)(`div`,{ref:e=>{z.current[n]=e},className:C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,_e(U,r),!U&&r&&`text-interactive-selection-foreground`),...Je(n,()=>Ve(e)),children:[(0,q.jsx)(M,{name:`chat-thread`,className:`h-4 w-4 flex-shrink-0 text-[var(--primary-base)]`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title||d(`chat.fileMentionAutocomplete.untitledSession`),children:Y(e.title||d(`chat.fileMentionAutocomplete.untitledSession`),W)}),U?null:(0,q.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.sessionType`)})]},`session-${e.id}`)}),X.length>0&&(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.recentFiles`)}),X.map((e,t)=>{let n=Ke+t,r=e.relativePath||e.name,i=ne(r,{maxLength:60}),a=I===n,o=De[n]??!1,s=ke[n]??2.6;return(0,q.jsxs)(`div`,{ref:e=>{z.current[n]=e},className:C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,_e(U,a),!U&&a&&`text-interactive-selection-foreground`),...Je(n,()=>ze(e)),children:[Ze(e),(0,q.jsxs)(`span`,{ref:e=>{B.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${Ce}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,q.jsx)(`span`,{ref:e=>{Me.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,q.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Y(r,W)}):(0,q.jsx)(`span`,{className:`block truncate`,children:Y(i,W)})]})]},`recent-${e.path}`)}),Z.length>0&&(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.groups.files`)}),Z.map((e,t)=>{let n=qe+t,r=e.relativePath||e.name,i=ne(r,{maxLength:60}),a=I===n,o=De[n]??!1,s=ke[n]??2.6;return(0,q.jsxs)(`div`,{ref:e=>{z.current[n]=e},className:C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,_e(U,a),!U&&a&&`text-interactive-selection-foreground`),...Je(n,()=>ze(e)),children:[Ze(e),(0,q.jsxs)(`span`,{ref:e=>{B.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${Ce}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,q.jsx)(`span`,{ref:e=>{Me.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,q.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Y(r,W)}):(0,q.jsx)(`span`,{className:`block truncate`,children:Y(i,W)})]})]},e.path)}),me&&Z.length===0?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,q.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!me&&Z.length===0&&X.length===0&&K.length===0&&J.length===0&&G.length===0&&(0,q.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:d(`chat.fileMentionAutocomplete.empty`)})]})}),!U&&(0,q.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:d(`chat.autocomplete.keyboardHint`)})]})}),Z=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`goal`,`btw`]),ze=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&Z.has(n))},Be=(e,t)=>!e||t({name:e}),Ve=` `,He=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===Ve&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Ue=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,We=C(Ue,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Ge=C(Ue,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),Ke=C(Ue,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),qe=C(Ue,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),Je=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Ye=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!s()}},Xe=L.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:r,style:i,commandPolicy:a,commandContext:o,onRowsChange:c},l)=>{let{t:u}=te(),d=ee(e=>e.isMobile),f=D(e=>e.currentSessionId),p=D(e=>!!e.newSessionDraft?.open),m=D(L.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),h=ue(f??``,m??void 0),g=L.useMemo(()=>o??{sessionID:f??null,hasMessages:h.length>0,hasNewDraft:p},[o,f,h.length,p]),{hasSession:_,canStartSessionCommand:v,canUseReviewHandoffFlow:y}=L.useMemo(()=>Ye(g,d),[g,d]),b=g.hasMessages,[x,S]=L.useState([]),[ne,re]=L.useState(!1),ie=ce({directory:r}),w=L.useMemo(()=>ie.data??[],[ie.data]),ae=ie.isFetching,[T,E]=L.useState(0),oe=L.useRef(0),se=L.useRef(!1),O=L.useRef([]),le=L.useRef(null),k=L.useRef(!1),A=L.useRef(null),j=L.useRef(!1),de=L.useRef(null);L.useEffect(()=>{let e=e=>{let t=e.target;!t||!le.current||le.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),L.useEffect(()=>{(async()=>{re(ae);try{let t=w.flatMap((e,t)=>e.source===`skill`?[]:[{id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,scope:e.scope,reference:e.reference}]),n=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:btw`,name:`btw`,source:`openchamber`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...s()?[{id:`openchamber:reload`,name:`reload`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...y?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[],...t],r=!b,i=Ee(n.filter(e=>(r||e.name!==`init`)&&(a?.(e)??!0)),e);S(e=>Je(e,i)?e:i)}catch{let t=!b,n=Ee([{id:`openchamber:new`,name:`new`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:btw`,name:`btw`,source:`openchamber`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...s()?[{id:`openchamber:reload`,name:`reload`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...y?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(a?.(e)??!0)),e);S(e=>Je(e,n)?e:n)}finally{re(!1)}})()},[e,b,_,v,y,w,ae,u,a]),L.useEffect(()=>{E(0)},[x]),L.useEffect(()=>{oe.current=T},[T]),L.useEffect(()=>{O.current[T]?.scrollIntoView({block:`nearest`})},[T]),L.useEffect(()=>{Ae(c,de,{rows:Ce(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[x,c,T,u]);let fe=L.useRef(c);fe.current=c,L.useEffect(()=>()=>{je(fe.current,de)},[]),L.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,ze(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){se.current=!0,E(e=>(e+1)%r);return}if(e===`ArrowUp`){se.current=!0,E(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(oe.current%r+r)%r,i=x[n];i&&t(i,ze(i,e===`Enter`))}}}}),[x,n,t]);let N=e=>{let t=I(e);switch(e.name){case`new`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,q.jsx)(M,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,q.jsxs)(ge,{ref:le,isMobile:d,className:`max-w-[450px] max-h-64`,style:i,children:[(0,q.jsx)(he,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:ne?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,q.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,q.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isOpenChamber;return(0,q.jsxs)(`div`,{ref:e=>{O.current[r]=e},className:C(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,_e(d,r===T),!d&&r===T&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(A.current={x:e.clientX,y:e.clientY},j.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!A.current)return;let t=e.clientX-A.current.x,n=e.clientY-A.current.y;Math.hypot(t,n)>6&&(j.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=j.current;A.current=null,j.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),k.current=!0,t(n,ze(n,d)))},onPointerCancel:()=>{A.current=null,j.current=!1},onClick:()=>{if(k.current){k.current=!1;return}t(n,ze(n,d))},onMouseMove:()=>{se.current=!1,E(r)},children:[(0,q.jsx)(`div`,{className:C(!d&&`mt-0.5`),children:N(n)}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,Y(n.name,e)]}),n.isSkill?(0,q.jsx)(`span`,{className:We,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,q.jsx)(`span`,{className:We,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,q.jsx)(`span`,{className:qe,children:`OpenChamber`}):i?(0,q.jsx)(`span`,{className:qe,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,q.jsx)(`span`,{className:n.scope===`project`?Ke:Ge,children:n.scope}):null,n.agent&&(0,q.jsx)(`span`,{className:qe,children:n.agent})]}),n.description&&!d&&(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Y(n.description,e)})]})]},n.id)}),x.length===0&&(0,q.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,q.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Xe.displayName=`CommandAutocomplete`;function Ze(e){return(e.description||e.content).replace(/\s+/g,` `).trim().slice(0,120)}var Qe=L.forwardRef((e,t)=>{let n=(0,H.c)(63),{searchQuery:r,onSnippetSelect:i,onClose:a,style:o}=e,{t:s}=te(),c=L.useRef(null),l=ee($e),[u,d]=L.useState(0),f=L.useRef(0),p;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],n[0]=p):p=n[0];let[m,h]=L.useState(p),g;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],n[1]=g):g=n[1];let _=L.useRef(g),v=me(et),y=me(tt),b=me(nt),x=me(rt),S=ee(it),ne=ee(at),re,w;n[2]===y?(re=n[3],w=n[4]):(re=()=>{y()},w=[y],n[2]=y,n[3]=re,n[4]=w),L.useEffect(re,w);let ae,T;n[5]!==r||n[6]!==v?(ae=()=>{let e=r.trim();if(!e.length){let e=[...v].sort(ot);h(e),d(+!!e.length);return}let t=ie(v,e,st);t.sort(ct);let n=t.map(lt);h(n),d(+!!n.length)},T=[r,v],n[5]=r,n[6]=v,n[7]=ae,n[8]=T):(ae=n[7],T=n[8]),L.useEffect(ae,T);let E,D;n[9]===u?(E=n[10],D=n[11]):(E=()=>{f.current=u,_.current[u]?.scrollIntoView({block:`nearest`})},D=[u],n[9]=u,n[10]=E,n[11]=D),L.useEffect(E,D);let oe,se;n[12]===a?(oe=n[13],se=n[14]):(se=()=>{let e=e=>{let t=e.target;t&&c.current&&!c.current.contains(t)&&a()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},oe=[a],n[12]=a,n[13]=oe,n[14]=se),L.useEffect(se,oe);let ce;n[15]!==i||n[16]!==r?(ce=e=>{let t=r.trim(),n=e.aliases.includes(t)?t:e.name;i(e,n)},n[15]=i,n[16]=r,n[17]=ce):ce=n[17];let O=ce,le;n[18]!==a||n[19]!==x||n[20]!==S||n[21]!==ne||n[22]!==b||n[23]!==v?(le=()=>{let e=new Set(v.map(ut)),t=`new-snippet`,n=1;for(;e.has(t);)t=`new-snippet-${n++}`;b({name:t,scope:`global`}),x(t),ne(`snippets`),S(!0),a()},n[18]=a,n[19]=x,n[20]=S,n[21]=ne,n[22]=b,n[23]=v,n[24]=le):le=n[24];let k=le,A,ue;n[25]!==O||n[26]!==m||n[27]!==a||n[28]!==k?(A=()=>({handleKeyDown:e=>{if(e===`Escape`){a();return}let t=m.length+1;if(e===`ArrowDown`){d(e=>(e+1)%t);return}if(e===`ArrowUp`){d(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){if(f.current===0){k();return}let e=m[f.current-1];e&&O(e)}}}),ue=[O,m,a,k],n[25]=O,n[26]=m,n[27]=a,n[28]=k,n[29]=A,n[30]=ue):(A=n[29],ue=n[30]),L.useImperativeHandle(t,A,ue);let j;n[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{_.current[0]=e},n[31]=j):j=n[31];let de;n[32]!==l||n[33]!==u?(de=C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,_e(l,u===0)),n[32]=l,n[33]=u,n[34]=de):de=n[34];let fe,N;n[35]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>d(0),N=(0,q.jsx)(M,{name:`add`,className:`h-3.5 w-3.5 text-muted-foreground`}),n[35]=fe,n[36]=N):(fe=n[35],N=n[36]);let P;n[37]===s?P=n[38]:(P=s(`chat.snippetAutocomplete.action.addNew`),n[37]=s,n[38]=P);let pe;n[39]===P?pe=n[40]:(pe=(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:P}),n[39]=P,n[40]=pe);let F;n[41]!==k||n[42]!==de||n[43]!==pe?(F=(0,q.jsxs)(`div`,{ref:j,className:de,onClick:k,onMouseMove:fe,children:[N,pe]}),n[41]=k,n[42]=de,n[43]=pe,n[44]=F):F=n[44];let ve;n[45]!==O||n[46]!==m||n[47]!==l||n[48]!==r||n[49]!==u||n[50]!==s?(ve=m.length?m.map((e,t)=>(0,q.jsx)(`div`,{ref:e=>{_.current[t+1]=e},className:C(`flex gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,l?`items-center`:`items-start`,_e(l,t+1===u)),onClick:()=>O(e),onMouseMove:()=>d(t+1),children:(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`truncate`,children:[`#`,Y(e.name,r)]}),(0,q.jsx)(`span`,{className:`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0 bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`,children:s(`snippets.source.${e.source}`)})]}),!l&&(0,q.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Y(Ze(e),r)})]})},`${e.source}:${e.filePath}`)):(0,q.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:s(`chat.snippetAutocomplete.empty`)}),n[45]=O,n[46]=m,n[47]=l,n[48]=r,n[49]=u,n[50]=s,n[51]=ve):ve=n[51];let I;n[52]!==F||n[53]!==ve?(I=(0,q.jsxs)(he,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:[F,ve]}),n[52]=F,n[53]=ve,n[54]=I):I=n[54];let ye;n[55]!==l||n[56]!==s?(ye=!l&&(0,q.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:s(`chat.snippetAutocomplete.footer`)}),n[55]=l,n[56]=s,n[57]=ye):ye=n[57];let be;return n[58]!==l||n[59]!==o||n[60]!==I||n[61]!==ye?(be=(0,q.jsxs)(ge,{ref:c,isMobile:l,className:`max-w-[450px] max-h-60`,style:o,children:[I,ye]}),n[58]=l,n[59]=o,n[60]=I,n[61]=ye,n[62]=be):be=n[62],be});Qe.displayName=`SnippetAutocomplete`;function $e(e){return e.isMobile}function et(e){return e.snippets}function tt(e){return e.loadSnippets}function nt(e){return e.setSnippetDraft}function rt(e){return e.setSelectedSnippet}function it(e){return e.setSettingsDialogOpen}function at(e){return e.setSettingsPage}function ot(e,t){return e.source===`project`&&t.source!==`project`?-1:e.source!==`project`&&t.source===`project`?1:e.name.localeCompare(t.name)}function st(e){return[e.name,...e.aliases]}function ct(e,t){return e.score===t.score?e.item.source===`project`&&t.item.source!==`project`?-1:e.item.source!==`project`&&t.item.source===`project`?1:e.item.name.localeCompare(t.item.name):e.score-t.score}function lt(e){return e.item}function ut(e){return e.name}var dt=2,ft=e=>!!e&&typeof e==`object`&&!Array.isArray(e),pt=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},mt=e=>ft(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&ft(e.branches),ht=(e,t)=>JSON.stringify([e,t]),gt=e=>`version`in e&&e.version===dt&&ft(e.entries),_t=e=>{if(!e)return null;try{let t=JSON.parse(e);return ft(t)?t.version===dt&&ft(t.entries)?{version:dt,entries:t.entries}:t:null}catch{return null}},vt=(e,t)=>{try{e.setItem(`oc.gitBranchCache`,JSON.stringify(t))}catch{}},yt=(e,t,n)=>{let r=pt(e);if(!r||!t)return null;let i;try{i=n.getItem(`oc.gitBranchCache`)}catch{return null}let a=_t(i);if(!a)return null;if(gt(a))return mt(a.entries[ht(t,r)])?a.entries[ht(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=pt(e);r&&mt(n)&&(o[ht(t,r)]=n)}return vt(n,{version:dt,entries:o}),o[ht(t,r)]??null},bt=(e,t,n,r)=>{let i=pt(e);if(!i||!t||!mt(n))return;let a=null;try{a=r.getItem(`oc.gitBranchCache`)}catch{return}let o=_t(a);vt(r,{version:dt,entries:{...o&>(o)?o.entries:{},[ht(t,i)]:n}})},xt=3e4,St=pt,Ct=(e,t=n())=>o.git.branches(St(e),t),wt=(e,t=n())=>o.git.remotes(St(e),t),Tt=async(e,t,n)=>{n.throwIfAborted();let r=c()?.git,i=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):r?await r.getGitBranches(e,{signal:n}):await g(e,{signal:n});return n.throwIfAborted(),i},Et=async(e,t,n)=>{n.throwIfAborted();let r=c()?.git,i=t?.getRemotes?await t.getRemotes(e,{signal:n}):r?await r.getRemotes(e,{signal:n}):await m(e,{signal:n});return n.throwIfAborted(),i},Dt=(e,t,r=n(),i=y())=>{let a=St(e),o=t;return{queryKey:Ct(a,r),queryFn:async({signal:e})=>{if(!a)throw Error(`Git branches require a directory`);let t=await Tt(a,o,e);return bt(a,r,t,i),t},staleTime:xt,gcTime:1/0,initialData:()=>yt(a,r,i)??void 0,initialDataUpdatedAt:0}},Ot=(e,t,r=n())=>{let i=St(e),a=t;return{queryKey:wt(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return Et(i,a,e)},staleTime:xt,gcTime:1/0}},kt=(e,r,i)=>{let a=(0,H.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=St(e),u=x,l=Dt(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},At=(e,r,i)=>{let a=(0,H.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=St(e),u=x,l=Ot(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},jt=(e,t,r=a,i=n())=>r.fetchQuery(Dt(e,t,i)),Mt=(e,t,r=a,i=n())=>r.fetchQuery({...Dt(e,t,i),staleTime:0}),Nt=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,Pt=1e4,Ft=6e4,It=5e3,Lt=3e4,Rt=6e4,zt=25,Bt=40,Vt=2,Ht=15e3,Ut=500,Wt=30,Gt=20971520,Kt=new Map,qt=new Map,Jt=new Map,Yt=new Map,Xt=new Map,Zt=(e,t)=>`${t}:${e}`,Qt=e=>qt.get(e)??0,$t=e=>{let t=Qt(e)+1;return qt.set(e,t),t},en=e=>{let t=(Jt.get(e)??0)+1;return Jt.set(e,t),t},tn=e=>{let t=Kt.get(e);if(t)return t;let n=new Set;return Kt.set(e,n),n},Q=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),nn=(e,t=Wt,n=Gt)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},rn=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!(!n&&!i)&&(!n||!i||n.insertions!==i.insertions||n.deletions!==i.deletions))return!0}return!1},an=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,on=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[];if(n.length!==r.length||e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&an(e.upstreamComparison,t.upstreamComparison))return!0;let i=new Set(n.map(e=>`${e.path}:${e.index}:${e.working_dir}`));for(let e of r)if(!i.has(`${e.path}:${e.index}:${e.working_dir}`))return!0;return!!(t.diffStats!==void 0&&rn(e.diffStats,t.diffStats))},sn=(e,t)=>{let n=new Set;if(!t)return n;let r=e?.files??[],i=t.files??[],a=new Map(r.map(e=>[e.path,e])),o=new Map(i.map(e=>[e.path,e])),s=new Set([...a.keys(),...o.keys()]);for(let e of s){let t=a.get(e),r=o.get(e);if(!t||!r){n.add(e);continue}if(t.index!==r.index||t.working_dir!==r.working_dir){n.add(e);continue}}if(t.diffStats!==void 0){let r=e?.diffStats??{},i=t.diffStats??{},a=new Set([...Object.keys(r),...Object.keys(i)]);for(let e of a){let t=r[e],a=i[e];if(!t||!a){n.add(e);continue}(t.insertions!==a.insertions||t.deletions!==a.deletions)&&n.add(e)}}return n},cn=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[],i=e=>{let t=e?.trim()??``;return t===`?`?``:t},a=new Map(n.map(e=>[e.path,i(e.index)])),o=new Map(r.map(e=>[e.path,i(e.index)])),s=new Set([...a.keys(),...o.keys()]);for(let e of s)if((a.get(e)??``)!==(o.get(e)??``))return!0;return!1},ln=e=>!e||e.trim().length===0,un=e=>(e||``).trim()===`U`,dn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(un(t)||un(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},fn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(un(t)||un(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},pn=e=>ln(e.index)&&ln(e.working_dir),$=l()(d((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&$t(r),n&&$t(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Q()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=Zt(n,a),s=Yt.get(o)??(a===`light`?Yt.get(Zt(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Q(),!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>Ft,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0);if(on(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Q(),s=sn(i.status,u),l=cn(i.status,u),d=new Set((i.status?.files??[]).map(e=>e.path)),f=new Set((u.files??[]).map(e=>e.path)),p=new Map(i.diffCache);for(let e of d)f.has(e)||p.delete(e);for(let e of s)p.delete(e);let m=s.size>0;m&&$t(n);let h={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:h,diffCache:p,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:m?Date.now():i.lastStatusChange}),e({directories:r})}else{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();Yt.set(o,c);try{return await c}finally{Yt.get(o)===c&&Yt.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?dn(e):fn(e);t!==e&&(l=!0),pn(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=en(r);{let n=new Map(t().directories),i=n.get(r)??Q();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await Mt(r,i,void 0,o):await jt(r,i,void 0,o);if(s!==Jt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Q();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(Nt(i)||console.error(`Failed to fetch git branches:`,i),s!==Jt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Q();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Q();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>Pt||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Q(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=nn(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{$t(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,zt);await t().prefetchDiffs(e,n,i,{maxFiles:zt})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=Bt}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=tn(n),d=[],f=new Set;for(let e of i){if(!e||f.has(e)||(f.add(e),!c.has(e))||o.diffCache.has(e)||u.has(e))continue;let t=l?.[e];t&&t.insertions+t.deletions>Ut||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=Qt(n);if(typeof document<`u`&&document.hidden)return;p.forEach(e=>u.add(e));let h=0,g=[],_=()=>{let e=h;return h+=1,e<p.length?p[e]:null},v=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Ht}ms`)),Ht)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},ee=async()=>{for(;;){if(m!==Qt(n))return;let e=_();if(!e)return;try{g.push(await v(e))}catch{}finally{u.delete(e)}}},y=Math.min(Vt,p.length);if(await Promise.allSettled(Array.from({length:y},()=>ee())),p.forEach(e=>u.delete(e)),m!==Qt(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let S=new Map(x.diffCache),te=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:te})});let C=nn(S);b.set(n,{...x,diffCache:C}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<It||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Xt.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=It)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=Lt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=Pt)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=Rt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Xt.set(e,i),i.finally(()=>{Xt.get(e)===i&&Xt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),mn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),$(n)},hn=e=>{let r=(0,H.c)(3),i=L.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],$(a)},gn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),$(n)},_n=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),$(n)},vn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),$(n)},yn=e=>{let t=(0,H.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=L.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),$(i)},bn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),$(n)},xn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),$(n)},Sn=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),$(n)},Cn=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},wn=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),Tn=e=>e.branchName?wn(e.branchName):e.mode===`existing`?wn(e.existingBranch||e.preferredName||``):wn(e.preferredName||``),En=async e=>{let t=await pe(e);try{let n=Cn((await N(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Cn((await P(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Dn=async(e,t)=>{let n=await En(e),r=wn(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},On=async(e,t,n)=>{let r=Tn(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Dn(e,r):i&&wn(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:wn(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},kn=async(e,t,n)=>{let r=await On(e.path,t,n);return F(e,r)},An=`oc:lastWorktreeSourceBranch`,jn=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Mn=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},Nn=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},Pn=(e,t,n)=>{let r=Nn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Fn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Pn(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},In=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))||e.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},Ln=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Fe as A,At as C,Be as D,He as E,ke as M,X as O,kt as S,Xe as T,yn as _,An as a,_n as b,kn as c,vn as d,hn as f,gn as g,bn as h,Pn as i,Pe as j,Ie as k,En as l,xn as m,In as n,Mn as o,Sn as p,Fn as r,jn as s,Ln as t,On as u,mn as v,Qe as w,Mt as x,$ as y};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t}from"./persistence-DznVIKwz.js";import{a as n,r}from"./vendor-zustand-B4dlGEM2.js";import{nt as i,rt as a}from"./vendor-base-ui-CnHfUmDN.js";import{Bn as o,Ct as s,Kn as c,Nt as l}from"./platform-DSTtx-DI.js";import{n as u}from"./useUIStore-syVmbuDA.js";import{n as d}from"./vendor-react-DLPElpoQ.js";import{n as f}from"./vendor-reactuses-core-Dq5ocTF8.js";import{f as p,i as m,r as h,t as g,y as _}from"./button-Doq9FI1I.js";import{Gn as v,Kn as y,Tr as b,Yn as x,ao as S,ar as C,d as w,ja as T,ka as E,ma as ee,u as D,xr as O}from"./useMobileNavigationStore-B0zSdCwP.js";import{n as k}from"./Icon-Dz2kO9RN.js";import{n as te}from"./gitApi-3VBj3fbR.js";import{D as ne,O as re,S as A,_ as ie,a as j,b as ae,f as M,g as oe,h as se,i as N,j as ce,k as le,m as ue,n as P,v as F,x as de,y as I}from"./projectMeta-C5gcAd5f.js";import{t as L}from"./input-DZZuQ1IL.js";import{i as R,n as z,t as B}from"./tooltip-CGLzBwEK.js";import{o as fe}from"./OverlayScrollbar-DCWyGseO.js";import{n as V}from"./useRuntimeAPIs-DSLXJybW.js";import{r as pe,t as me}from"./textarea--CYehp07.js";import{O as he,T as ge,a as H,b as U,c as _e,f as W,h as G,l as K,o as q,p as J,r as ve,w as ye,y as Y}from"./insertionBoundaries-BMuCcvPy.js";import{n as be,r as xe,t as Se}from"./collapsible-CYUeu3_N.js";var X=e(a(),1),Ce=d(),Z=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Q=/^g[1-9]\d*$/,we=(e,t,n,r,i)=>{if(!Z.test(e)||t!==void 0&&!Q.test(t)||!n?.trim()||!r?.trim()||n!==n.trim()||r!==r.trim())return null;if(i===void 0)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!1};if(i===`fusion`)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!0};if(!/^\d+$/.test(i))return null;let a=Number.parseInt(i,10);return!Number.isSafeInteger(a)||a<=0?null:{groupSlug:e,runGroup:t,providerID:n,modelID:r,index:a,fusion:!1}},Te=e=>{if(!e)return null;let t=e.split(`/`);if(t.length<3||t.length>5)return null;let[n]=t;if(t.length===3)return we(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Q.test(e)?we(n,e,r,i,void 0):we(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?we(n,void 0,i,a,o):we(n,r,i,a,o)},Ee=e=>{let t=[e.groupSlug];return e.runGroup&&t.push(e.runGroup),t.push(e.providerID,e.modelID),e.index!==void 0&&t.push(String(e.index)),t.join(`/`)},De=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Oe=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),ke=(e,t)=>`${Oe(e)}-${Oe(t)}`.substring(0,60),Ae=(e,t)=>`${e}/${t}`,je=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Me=(e,t)=>{let n=je(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};c(e.id,n),w.getState().markSessionAsOpenChamberCreated(e.id),O.getState().upsertSession(i);try{o().ensureChild(n,{bootstrap:!1}).setState(t=>{let n=t.session.findIndex(t=>t.id===e.id);if(n>=0&&t.session[n]===i)return t;let r=n>=0?t.session.map((e,t)=>t===n?i:e):[...t.session,i].sort((e,t)=>e.id.localeCompare(t.id));return{session:r,sessionTotal:Math.max(t.sessionTotal,r.length),limit:Math.max(t.limit,r.length)}})}catch{}return i},Ne=()=>{let e=S.getState(),t=e.activeProjectId;if(!t)return null;let n=e.projects.find(e=>e.id===t);if(n?.path)return{id:n.id,path:n.path};let r=s.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Pe=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:o}=t;if(!n)return e({error:`Group name is required`}),null;if(!r||r.length===0)return e({error:`At least one run group is required`}),null;for(let t=0;t<r.length;t++){if(!r[t].prompt.trim())return e({error:`Group ${t+1}: prompt is required`}),null;if(r[t].models.length<1)return e({error:`Group ${t+1}: select at least 1 model`}),null;if(r[t].models.length>5)return e({error:`Group ${t+1}: maximum 5 models allowed`}),null}e({isLoading:!0,error:null});try{let s=Ne();if(!s)return e({error:`Select a project`,isLoading:!1}),null;let c=s.path,u=await te(c)&&t.isolateRuns!==!1,d=Oe(n),f=u?await M(c):void 0,p=u?await K(c):null,m=[],h=o?.filter(e=>e.trim().length>0)??[];for(let e=0;e<r.length;e++){let n=r[e],i=n.prompt,a=new Map;for(let e of n.models){let t=`${e.providerID}:${e.modelID}`;a.set(t,(a.get(t)||0)+1)}let o=new Map;for(let g of n.models){let n=`${g.providerID}:${g.modelID}`,_=a.get(n)||1,v=(o.get(n)||0)+1;o.set(n,v);let b=ke(g.providerID,g.modelID),x=r.length>1?`g${e+1}`:void 0,S=_>1?Ae(d,`${b}/${v}`):Ae(d,b),T=x?`${x}/${S}`:S,E=Ee({groupSlug:d,runGroup:x,providerID:g.providerID,modelID:g.modelID,index:_>1?v:void 0});try{if(!u){let e=await l.withDirectory(c,()=>l.createSession({title:E}));Me(e,c),m.push({sessionId:e.id,worktreePath:c,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i});continue}let e=await _e(s,{preferredName:T,mode:`new`,branchName:T,worktreeName:T,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:h,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await y(s)&&await C(e.path);let r=await l.withDirectory(e.path,()=>l.createSession({title:E}));Me(r,e.path),w.getState().setWorktreeMetadata(r.id,n),m.push({sessionId:r.id,worktreePath:e.path,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let g=o?.filter(e=>e.trim().length>0)??[];g.length>0&&x(s,g).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let _=m.map(e=>e.sessionId),v=m[0]?.sessionId??null;if(_.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let b=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{let e=le.getState().expandText;await Promise.allSettled(m.map(async t=>{try{let n=await e(t.prompt).catch(()=>t.prompt);await D({sessionId:t.sessionId,directory:t.worktreePath,content:n,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:i,files:b})}catch(e){console.warn(`[MultiRun] Failed to start run:`,e)}}))}catch(e){console.warn(`[MultiRun] Failed to start runs:`,e)}})(),e({isLoading:!1}),{groupSlug:d,sessionIds:_,firstSessionId:v}}catch(t){return e({error:t instanceof Error?t.message:`Failed to create Multi-Run`,isLoading:!1}),null}},clearError:()=>{e({error:null})}}),{name:`multirun-store`})),$=i(),Fe=`h-7`,Ie=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Le=e=>{let t=(0,Ce.c)(13),{model:n,instanceIndex:r,totalSameModel:i,onRemove:a}=e,o=n.displayName||`${n.providerID}/${n.modelID}`,s=i>1?`${o} (${r})`:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=h(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Fe),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(re,{modelId:n.modelID,providerId:n.providerID,className:`h-3.5 w-3.5`}),t[1]=n.modelID,t[2]=n.providerID,t[3]=l):l=t[3];let u;t[4]===s?u=t[5]:(u=(0,$.jsx)(`span`,{className:`typography-meta font-medium truncate max-w-[140px]`,children:s}),t[4]=s,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(k,{name:`close`,className:`h-3.5 w-3.5`}),t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`text-muted-foreground hover:text-foreground ml-0.5`,children:d}),t[7]=a,t[8]=f);let p;return t[9]!==l||t[10]!==u||t[11]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[9]=l,t[10]=u,t[11]=f,t[12]=p):p=t[12],p},Re=e=>{let t=(0,Ce.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:c,maxModels:l,addButtonClassName:d,dropdownSide:f,dropdownClassName:m,containerClassName:_,triggerIcon:v}=e,y=c===void 0||c,b=f===void 0?`top`:f,{t:x}=p(),S=ee(ze),C=ee(Be),w=u(Ve),E=u(He),{favoriteModelsList:D,recentModelsList:O}=ne(),te=u(Ue),re=u(We),[j,M]=X.useState(!1),[oe,N]=X.useState(``),[ce,le]=X.useState(null),P=X.useRef(null),F=X.useRef(null),I=l===1,L=l===void 0||n.length<l||I,R;if(t[0]!==n){R=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;R.set(t,(R.get(t)||0)+1)}t[0]=n,t[1]=R}else R=t[1];let z=R,B;t[2]===n?B=t[3]:(B=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=B);let fe=B,V,pe;t[4]!==b||t[5]!==j?(V=()=>{if(!j||!F.current)return;let e=F.current.getBoundingClientRect();if(b===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;le(Math.max(160,Math.min(320,t)));return}let t=F.current.parentElement;for(;t&&!(t.getAttribute(`role`)===`dialog`||t.hasAttribute(`data-scroll-shadow`));){let e=getComputedStyle(t);if(e.overflow===`auto`||e.overflow===`hidden`||e.overflowY===`auto`||e.overflowY===`hidden`)break;t=t.parentElement}let n=t?t.getBoundingClientRect().top:0,r=e.top-n-16;le(Math.max(150,Math.min(300,r)))},pe=[b,j],t[4]=b,t[5]=j,t[6]=V,t[7]=pe):(V=t[6],pe=t[7]),X.useEffect(V,pe);let me,he;t[8]!==L||t[9]!==j?(me=()=>{!L&&j&&(M(!1),N(``))},he=[L,j],t[8]=L,t[9]=j,t[10]=me,t[11]=he):(me=t[10],he=t[11]),X.useEffect(me,he);let ge,H;t[12]===j?(ge=t[13],H=t[14]):(ge=()=>{if(!j)return;let e=e=>{P.current&&!P.current.contains(e.target)&&(M(!1),N(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},H=[j],t[12]=j,t[13]=ge,t[14]=H),X.useEffect(ge,H);let U;t[15]!==I||t[16]!==r||t[17]!==a||t[18]!==n.length?(U=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:T(e.model,e.modelID)||e.modelID,instanceId:Ie()};I&&n.length>0&&a?a(0,t):r(t),I&&(M(!1),N(``))},t[15]=I,t[16]=r,t[17]=a,t[18]=n.length,t[19]=U):U=t[19];let _e=U,W;t[20]===x?W=t[21]:(W=x(`multirun.modelMultiSelect.search.placeholder`),t[20]=x,t[21]=W);let G;t[22]===x?G=t[23]:(G=x(`multirun.modelMultiSelect.search.noResults`),t[22]=x,t[23]=G);let K;t[24]===x?K=t[25]:(K=x(`multirun.modelMultiSelect.sections.favorites`),t[24]=x,t[25]=K);let q;t[26]===x?q=t[27]:(q=x(`multirun.modelMultiSelect.sections.recent`),t[26]=x,t[27]=q);let J;t[28]===x?J=t[29]:(J=x(`multirun.modelMultiSelect.keyboard.hint`),t[28]=x,t[29]=J);let ve;t[30]===x?ve=t[31]:(ve=x(`settings.agents.modelSelector.actions.favorite`),t[30]=x,t[31]=ve);let ye;t[32]===x?ye=t[33]:(ye=x(`settings.agents.modelSelector.actions.unfavorite`),t[32]=x,t[33]=ye);let Y;t[34]===x?Y=t[35]:(Y=x(`chat.modelControls.provider`),t[34]=x,t[35]=Y);let be;t[36]===x?be=t[37]:(be=x(`chat.modelControls.capabilities`),t[36]=x,t[37]=be);let xe;t[38]===x?xe=t[39]:(xe=x(`chat.modelControls.capability.toolCalling`),t[38]=x,t[39]=xe);let Se;t[40]===x?Se=t[41]:(Se=x(`chat.modelControls.capability.reasoning`),t[40]=x,t[41]=Se);let Z;t[42]===x?Z=t[43]:(Z=x(`chat.modelControls.modality.image`),t[42]=x,t[43]=Z);let Q;t[44]===x?Q=t[45]:(Q=x(`chat.modelControls.modality.video`),t[44]=x,t[45]=Q);let we;t[46]===x?we=t[47]:(we=x(`chat.modelControls.modality.audio`),t[46]=x,t[47]=we);let Te;t[48]===x?Te=t[49]:(Te=x(`chat.modelControls.costPerMillion`),t[48]=x,t[49]=Te);let Ee;t[50]===x?Ee=t[51]:(Ee=x(`chat.modelControls.costInput`),t[50]=x,t[51]=Ee);let De;t[52]===x?De=t[53]:(De=x(`chat.modelControls.costOutput`),t[52]=x,t[53]=De);let Oe;t[54]!==W||t[55]!==G||t[56]!==K||t[57]!==q||t[58]!==J||t[59]!==ve||t[60]!==ye||t[61]!==Y||t[62]!==be||t[63]!==xe||t[64]!==Se||t[65]!==Z||t[66]!==Q||t[67]!==we||t[68]!==Te||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:W,noResults:G,favorites:K,recent:q,keyboardHint:J,favorite:ve,unfavorite:ye,provider:Y,capabilities:be,capabilityToolCalling:xe,capabilityReasoning:Se,modalityImage:Z,modalityVideo:Q,modalityAudio:we,costPerMillion:Te,costInput:Ee,costOutput:De},t[54]=W,t[55]=G,t[56]=K,t[57]=q,t[58]=J,t[59]=ve,t[60]=ye,t[61]=Y,t[62]=be,t[63]=xe,t[64]=Se,t[65]=Z,t[66]=Q,t[67]=we,t[68]=Te,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===_?Ae=t[73]:(Ae=h(`relative`,_),t[72]=_,t[73]=Ae);let je;t[74]===d?je=t[75]:(je=h(Fe,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),t[74]=d,t[75]=je);let Me=!L,Ne;t[76]===j?Ne=t[77]:(Ne=()=>{M(!j)},t[76]=j,t[77]=Ne);let Pe;t[78]===v?Pe=t[79]:(Pe=v??(0,$.jsx)(k,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=v,t[79]=Pe);let Re;t[80]!==s||t[81]!==x?(Re=s??x(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=x,t[82]=Re):Re=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ne||t[86]!==Pe||t[87]!==Re?(Ke=(0,$.jsxs)(g,{ref:F,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ne,children:[Pe,Re]}),t[83]=je,t[84]=Me,t[85]=Ne,t[86]=Pe,t[87]=Re,t[88]=Ke):Ke=t[88];let qe;t[89]!==ce||t[90]!==L||t[91]!==m||t[92]!==b||t[93]!==D||t[94]!==C||t[95]!==_e||t[96]!==te||t[97]!==E||t[98]!==j||t[99]!==ke||t[100]!==z||t[101]!==re||t[102]!==S||t[103]!==O||t[104]!==oe||t[105]!==w?(qe=j?(0,$.jsx)(`div`,{className:h(`absolute left-0 z-50 w-[min(420px,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex flex-col overflow-hidden rounded-xl border border-border/50 shadow-lg`,b===`top`?`bottom-full mb-1`:`top-full mt-1`,m),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(A,{providers:S,providerOrder:re,favoriteModels:D,recentModels:O,getMetadata:C,hiddenModels:te,searchQuery:oe,onSearchQueryChange:N,onSelect:_e,labels:ke,selectionCount:e=>z.get(`${e.providerID}:${e.modelID}`)||0,disabled:!L,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:ce?`${ce}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:j,isFavorite:e=>E(e.providerID,e.modelID),onToggleFavorite:e=>w(e.providerID,e.modelID),onEscape:()=>{M(!1),N(``)}})}):null,t[89]=ce,t[90]=L,t[91]=m,t[92]=b,t[93]=D,t[94]=C,t[95]=_e,t[96]=te,t[97]=E,t[98]=j,t[99]=ke,t[100]=z,t[101]=re,t[102]=S,t[103]=O,t[104]=oe,t[105]=w,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:P,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==fe||t[112]!==z||t[113]!==i||t[114]!==a||t[115]!==S||t[116]!==n||t[117]!==y||t[118]!==x?(Ye=y&&n.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:n.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=z.get(n)||1,o=fe(e),s=S.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID),c=s?.variants?Object.keys(s.variants):[],l=c.length>0,u=e.variant??`__default__`;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Le,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(ue,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(ae,{size:`chip`,className:`px-2 gap-1.5 rounded-md !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 typography-meta font-medium text-foreground`,children:[(0,$.jsx)(k,{name:`brain-ai-3`,className:h(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(de,{placeholder:x(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?x(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(se,{fitContent:!0,children:[(0,$.jsx)(ie,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:x(`multirun.modelMultiSelect.variant.default`)}),c.map(Ge)]})]})]},e.instanceId)})}),t[111]=fe,t[112]=z,t[113]=i,t[114]=a,t[115]=S,t[116]=n,t[117]=y,t[118]=x,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Je||t[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),t[120]=Je,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==l||t[124]!==o||t[125]!==n.length||t[126]!==x?(Ze=o!==void 0&&n.length<o&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:l===void 0?x(`multirun.modelMultiSelect.validation.minOnly`,{min:o}):x(`multirun.modelMultiSelect.validation.minToMax`,{min:o,max:l})}),t[123]=l,t[124]=o,t[125]=n.length,t[126]=x,t[127]=Ze):Ze=t[127];let Qe;return t[128]!==Xe||t[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),t[128]=Xe,t[129]=Ze,t[130]=Qe):Qe=t[130],Qe};function ze(e){return e.providers}function Be(e){return e.getModelMetadata}function Ve(e){return e.toggleFavoriteModel}function He(e){return e.isFavoriteModel}function Ue(e){return e.hiddenModels}function We(e){return e.providerOrder}function Ge(e){return(0,$.jsx)(ie,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function Ke(e){let t=(0,Ce.c)(30),{git:n}=V(),r=W(e),i=U(e),a=G(e),o=J(e),s=Y(Ze),c=Y(Xe),l,u;t[0]!==e||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==a?(l=()=>{!e||!n||i!==null||a||c(e,n,{silent:!0})},u=[e,n,c,i,a],t[0]=e,t[1]=c,t[2]=n,t[3]=i,t[4]=a,t[5]=l,t[6]=u):(l=t[5],u=t[6]),X.useEffect(l,u);let d;t[7]!==r?.all||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==i?(d=()=>{!e||!n||i===!0&&(r?.all||s(e,n))},t[7]=r?.all,t[8]=e,t[9]=s,t[10]=n,t[11]=i,t[12]=d):d=t[12];let f=r?.all,p;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==f?(p=[e,n,i,f,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=f,t[18]=p):p=t[18],X.useEffect(d,p);let m=a||i===!0&&o,h;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],h=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(Ye).sort(),t[20]=r.all,t[21]=e),h=e}let g=h,_;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],_=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Je).map(qe).sort(),t[23]=r.all,t[24]=e),_=e}let v=_,y;bb2:{if(!e){y=null;break bb2}if(i!==null){y=i;break bb2}if(m){y=null;break bb2}y=r?.all?!0:null}let b=y,x;return t[25]!==b||t[26]!==m||t[27]!==g||t[28]!==v?(x={localBranches:g,remoteBranches:v,isLoading:m,isGitRepository:b},t[25]=b,t[26]=m,t[27]=g,t[28]=v,t[29]=x):x=t[29],x}function qe(e){return e.replace(/^remotes\//,``)}function Je(e){return e.startsWith(`remotes/`)}function Ye(e){return!e.startsWith(`remotes/`)}function Xe(e){return e.fetchStatus}function Ze(e){return e.fetchBranches}var Qe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=p(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=Ke(e),d=X.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return X.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await M(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(H),{sourceBranch:o,shouldClearSavedSourceBranch:s}=q({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(H),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(ue,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(ae,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(de,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(se,{className:`max-h-[280px] max-w-[320px]`,children:l?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.loadingBranches`)}):s.length===0&&c.length===0?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.noBranchesFound`)}):(0,$.jsxs)($.Fragment,{children:[s.length>0&&(0,$.jsxs)(oe,{children:[(0,$.jsx)(F,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(ie,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(I,{}),c.length>0&&(0,$.jsxs)(oe,{children:[(0,$.jsx)(F,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(ie,{value:`remotes/${e}`,className:`whitespace-normal break-all`,children:e},`remotes/${e}`))]})]})})]}),u===!1&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground/70 mt-2`,children:o(`multiRun.branchSelector.status.notInGitRepository`)})]})},$e=e=>{let t=(0,Ce.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=p(),l=ee(et),u=ee(tt),d=ee(nt),f;t[0]===l?f=t[1]:(f=l(),t[0]=l,t[1]=f);let m=f,g;t[2]===m?g=t[3]:(g=m.filter(rt),t[2]=m,t[3]=g);let _=g,v,y;t[4]!==m.length||t[5]!==u?(v=()=>{m.length===0&&u()},y=[m.length,u],t[4]=m.length,t[5]=u,t[6]=v,t[7]=y):(v=t[6],y=t[7]),X.useEffect(v,y);let b,x;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==_||t[12]!==n?(b=()=>{if(a)return;let e=n.trim();if(e.length>0&&_.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&_.some(e=>e.name===t)){r(t);return}let i=_[0]?.name;i&&r(i)},x=[d,a,r,_,n],t[8]=d,t[9]=a,t[10]=r,t[11]=_,t[12]=n,t[13]=b,t[14]=x):(b=t[13],x=t[14]),X.useEffect(b,x);let S=n.trim().length>0?n:void 0,C;t[15]===i?C=t[16]:(C=h(`max-w-full typography-meta text-foreground !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 data-[popup-open]:!bg-[var(--interactive-active)]/70`,i),t[15]=i,t[16]=C);let w;t[17]===c?w=t[18]:(w=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=w);let T;t[19]===w?T=t[20]:(T=(0,$.jsx)(de,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(ae,{id:o,size:`lg`,className:C,children:T}),t[21]=o,t[22]=C,t[23]=T,t[24]=E):E=t[24];let D;t[25]===_?D=t[26]:(D=_.length>0&&(0,$.jsx)(oe,{children:_.map(it)}),t[25]=_,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(se,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let k;return t[30]!==a||t[31]!==r||t[32]!==S||t[33]!==E||t[34]!==O?(k=(0,$.jsxs)(ue,{value:S,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=S,t[33]=E,t[34]=O,t[35]=k):k=t[35],k};function et(e){return e.getVisibleAgents}function tt(e){return e.loadAgents}function nt(e){return e.currentAgentName}function rt(e){return E(e.mode)}function it(e){return(0,$.jsx)(ie,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var at=10485760,ot=5,st=e=>{let t=(0,Ce.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground transition-colors`,children:(0,$.jsx)(k,{name:`information`,className:`h-3.5 w-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(B,{children:[r,(0,$.jsx)(z,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ct=e=>{let t=(0,Ce.c)(9),{htmlFor:n,required:r,children:i,info:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,$.jsx)(`span`,{className:`text-destructive ml-0.5`,children:`*`}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==o?(s=(0,$.jsxs)(`label`,{htmlFor:n,className:`typography-meta font-medium text-foreground`,children:[i,o]}),t[2]=i,t[3]=n,t[4]=o,t[5]=s):s=t[5];let c=a&&a,l;return t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l},lt=e=>{let t=m(e.path),n=e.icon?N[e.icon]:null,r=e.color?P[e.color]:void 0,i=(0,$.jsx)(k,{name:n??`folder`,className:`h-3.5 w-3.5`,style:r?{color:r}:void 0});return(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,$.jsx)(j,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ut=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=p(),[o,c]=X.useState(``),[l,u]=X.useState(()=>[{id:Ie(),prompt:``,models:[]}]),[d,m]=X.useState(``),[y,x]=X.useState([]),[C,T]=X.useState(!1),[E,ee]=X.useState([]),[D,O]=X.useState(!1),[te,ne]=X.useState(!1),[re,A]=X.useState(!0),j=X.useRef(null),M=s(e=>e.currentDirectory??null),oe=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),N=S(e=>e.activeProjectId),le=S(e=>e.setActiveProjectIdOnly),P=S(e=>e.projects),[F,I]=X.useState(()=>N??null);X.useEffect(()=>{if(N){I(N);return}!F&&P.length>0&&I(P[0].id)},[N,P,F]);let V=X.useMemo(()=>F?P.find(e=>e.id===F)??null:null,[P,F]),me=V?.path??M,he=f(e=>{I(e),e!==N&&le(e)}),ge=X.useMemo(()=>{if(V?.path)return{id:V.id,path:V.path};let e=M??oe;return e?{id:`path:${e}`,path:e}:null},[V,M,oe]),[H]=X.useState(()=>typeof window<`u`&&t()),U=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),_e=fe(),W=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__OPENCHAMBER_MACOS_MAJOR__;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;if(typeof navigator>`u`)return null;let t=(navigator.userAgent||``).match(/Mac OS X (\d+)[._](\d+)/);if(!t)return null;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isNaN(n)?null:n===10?r:n},[]),G=X.useMemo(()=>H&&U||_e?`pl-[5.5rem]`:`pl-3`,[H,U,_e]),K=X.useMemo(()=>!H||!U||W===null?``:W>=26?`h-12`:W<=15?`h-14`:``,[H,U,W]),q=f(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&H&&await _()}),J=f(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),ve=!!r;X.useEffect(()=>{if(ve)return window.addEventListener(`keydown`,J,!0),()=>window.removeEventListener(`keydown`,J,!0)},[ve]);let[ye,Y]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=Ke(me),Q=X.useRef(!1),we=Z===!0,Te=we&&re;X.useEffect(()=>{if(Z===!1){Q.current=!0,A(!1);return}Z===!0&&Q.current&&(Q.current=!1,A(!0))},[Z]);let Ee=Pe(e=>e.createMultiRun),De=Pe(e=>e.error),Oe=Pe(e=>e.clearError);X.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&u(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),X.useEffect(()=>{if(!ge)return;let e=!1;return ne(!0),(async()=>{try{let t=await v(ge);e||ee(t)}catch{}finally{e||ne(!1)}})(),()=>{e=!0}},[ge]);let ke=f((e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=f(e=>{u(t=>t.filter(t=>t.id!==e))}),je=f(()=>{u(e=>[...e,{id:Ie(),prompt:``,models:[]}])}),Me=async e=>{let t=e.target.files;if(!t)return;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r.size>at){b.error(a(`multirun.launcher.toast.fileTooLarge`,{fileName:r.name}));continue}try{let e=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});x(t=>[...t,{id:Ie(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),b.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&b.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),j.current&&(j.current.value=``)},Ne=e=>{x(t=>t.filter(t=>t.id!==e))},Fe=X.useMemo(()=>l.reduce((e,t)=>e+t.models.length,0),[l]),Le=async e=>{e.preventDefault();let t=l.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Fe<1)){T(!0),Oe();try{F&&F!==N&&le(F);let e=y.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=E.filter(e=>e.trim().length>0),i=t.map(e=>({prompt:e.prompt.trim(),models:e.models.map(e=>({providerID:e.providerID,modelID:e.modelID,displayName:e.displayName,variant:e.variant}))})),a={name:o.trim(),groups:i,agent:d||void 0,worktreeBaseBranch:Te?ye:void 0,isolateRuns:Te,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&w.getState().setCurrentSession(s.firstSessionId),n?.())}finally{T(!1)}}},Re=!!(o.trim()&&l.some(e=>e.prompt.trim()&&e.models.length>=1)&&Fe>=1&&me&&!Ce&&(Z===!1||!Te||ye)),ze=E.filter(e=>e.trim()).length;return(0,$.jsxs)(`form`,{onSubmit:Le,className:`flex flex-col h-full bg-background`,children:[i?null:(0,$.jsxs)(`header`,{onMouseDown:q,className:h(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,G,K),style:{borderColor:`var(--interactive-border)`},children:[(0,$.jsx)(`h1`,{className:`typography-ui-label font-medium`,children:a(`multirun.launcher.title`)}),r&&(0,$.jsx)(`div`,{className:`absolute right-0 flex items-center pr-3`,children:(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:r,"aria-label":a(`multirun.launcher.actions.closeEsc`),className:`inline-flex h-9 w-9 items-center justify-center p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary app-region-no-drag`,children:(0,$.jsx)(k,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(z,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(pe,{className:`flex-1 min-h-0 overflow-auto`,size:64,hideTopShadow:!0,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),P.length>0?(0,$.jsxs)(ue,{value:F??void 0,onValueChange:he,children:[(0,$.jsx)(ae,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:V?(0,$.jsx)(de,{children:lt(V)}):(0,$.jsx)(de,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(se,{fitContent:!0,children:P.map(e=>(0,$.jsx)(ie,{value:e.id,className:`max-w-[24rem]`,children:lt(e)},e.id))})]}):(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground py-2`,children:a(`multirun.launcher.project.empty`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(st,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(L,{id:`group-name`,value:o,onChange:e=>c(e.target.value),placeholder:a(`multirun.launcher.groupName.placeholder`),className:`typography-meta w-full`,required:!0})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Qe,{directory:me,value:ye,onChange:Y,disabled:!Te,id:`multirun-worktree-base-branch`}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex w-fit items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(ce,{checked:re,onChange:A,disabled:!we,ariaLabel:a(`multirun.launcher.isolateRuns.label`)}),(0,$.jsx)(`span`,{children:a(`multirun.launcher.isolateRuns.label`)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-agent`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)($e,{value:d,onChange:m,id:`multirun-agent`})]})]}),(0,$.jsxs)(Se,{open:D,onOpenChange:O,children:[(0,$.jsxs)(xe,{className:`w-full flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-lg hover:bg-[var(--interactive-hover)]/50 transition-colors group`,children:[(0,$.jsx)(k,{name:`terminal`,className:`h-3.5 w-3.5 text-muted-foreground/70`}),(0,$.jsx)(`span`,{className:`typography-meta font-medium text-muted-foreground group-hover:text-foreground transition-colors`,children:a(`multirun.launcher.setupCommands.label`)}),ze>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center h-4 min-w-4 px-1 rounded-full typography-micro font-medium`,style:{backgroundColor:`var(--primary-base)`,color:`var(--primary-foreground)`,fontSize:`0.625rem`,lineHeight:1},children:ze}),(0,$.jsx)(k,{name:`arrow-down-s`,className:h(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,D&&`rotate-180`)})]}),(0,$.jsx)(be,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:te?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[E.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(L,{value:e,onChange:e=>{let n=[...E];n[t]=e.target.value,ee(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(E.filter((e,n)=>n!==t)),className:`flex-shrink-0 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":a(`multirun.launcher.setupCommands.removeCommandAria`),children:(0,$.jsx)(k,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ee([...E,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(k,{name:`add`,className:`h-3 w-3`}),a(`multirun.launcher.setupCommands.addCommand`)]})]})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(ct,{htmlFor:`prompt`,required:!0,children:a(`multirun.launcher.attachments.label`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:j,type:`file`,multiple:!0,className:`hidden`,onChange:Me,accept:`*/*`}),(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j.current?.click(),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md typography-micro text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(k,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(z,{children:a(`multirun.launcher.attachments.tooltip`)})]}),y.map(e=>(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md typography-micro border`,style:{backgroundColor:`var(--surface-elevated)`,borderColor:`var(--interactive-border)`},children:[e.mimeType.startsWith(`image/`)?(0,$.jsx)(k,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(k,{name:`file`,className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate max-w-[100px]`,title:e.filename,children:e.filename}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ne(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(k,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),l.map((e,t)=>(0,$.jsx)(dt,{group:e,groupIndex:t,canRemove:l.length>1,onUpdate:ke,onRemove:Ae},e.id)),(0,$.jsxs)(`button`,{type:`button`,onClick:je,className:`flex items-center gap-1.5 py-2 px-3 -mx-3 rounded-lg typography-meta font-medium text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(k,{name:`add`,className:`h-3.5 w-3.5`}),a(`multirun.launcher.groups.addGroup`)]}),De&&(0,$.jsx)(`div`,{className:`px-3 py-2 rounded-lg typography-meta`,style:{backgroundColor:`var(--status-error-background)`,color:`var(--status-error)`,borderWidth:1,borderColor:`var(--status-error-border)`},children:De})]})})}),(0,$.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl flex items-center justify-end gap-2`,children:[!Te&&Z!==null?(0,$.jsxs)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(k,{name:`information`,className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a(`multirun.launcher.project.gitRequired`)})]}):null,(0,$.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(g,{type:`submit`,size:`sm`,disabled:!Re||C,children:C?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Fe})})})]})})]})},dt=e=>{let t=(0,Ce.c)(104),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=p(),[c,l]=X.useState(!1),[u,d]=X.useState(``),[m,h]=X.useState(!1),[g,_]=X.useState(``),[v,y]=X.useState(!1),[b,x]=X.useState(``),S=X.useRef(null),C=X.useRef(null),w=X.useRef(null),T=X.useRef(null),E;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(E=e=>{n.models.length>=ot||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=E):E=t[3];let ee=f(E),D;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(D=e=>{a(n.id,{models:n.models.filter((t,n)=>n!==e)})},t[4]=n.id,t[5]=n.models,t[6]=a,t[7]=D):D=t[7];let O=f(D),te;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(te=(e,t)=>{a(n.id,{models:n.models.map((n,r)=>r===e?t:n)})},t[8]=n.id,t[9]=n.models,t[10]=a,t[11]=te):te=t[11];let ne=f(te),re;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(re=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
|
|
2
|
-
`),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){_(e.substring(1,i)),h(!0),l(!1),y(!1);return}}h(!1);let n=e.substring(0,t),r=n.lastIndexOf(`#`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);if((!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
3
|
-
`)){x(t),y(!0),l(!1);return}}y(!1);let i=n.lastIndexOf(`@`);if(i!==-1){let e=i>0?n[i-1]:null,t=n.substring(i+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
4
|
-
`)?(d(t),l(!0)):l(!1);return}l(!1)},t[12]=re):re=t[12];let A=f(re),ie;t[13]!==n.id||t[14]!==a?(ie=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=ie):ie=t[15];let j=f(ie),ae;t[16]!==n.prompt||t[17]!==j||t[18]!==A?(ae=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,o=ve(t,i===-1?r:i,r,`@${a}`);j(o.text),l(!1),d(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),A(o.text,o.caret)})},t[16]=n.prompt,t[17]=j,t[18]=A,t[19]=ae):ae=t[19];let M=f(ae),oe;t[20]!==n.prompt||t[21]!==j||t[22]!==A?(oe=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=ve(t,i===-1?r:i,r,`@${e}`);j(a.text),l(!1),d(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),A(a.text,a.caret)})},t[20]=n.prompt,t[21]=j,t[22]=A,t[23]=oe):oe=t[23];let se=f(oe),N;t[24]!==j||t[25]!==A?(N=e=>{let t=`/${e.name} `;j(t),h(!1),_(``),y(!1),requestAnimationFrame(()=>{let e=S.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),A(t,t.length)})},t[24]=j,t[25]=A,t[26]=N):N=t[26];let ce=f(N),le;t[27]!==n.prompt||t[28]!==j||t[29]!==A?(le=(e,t)=>{let r=n.prompt,i=S.current?.selectionStart??r.length,a=r.substring(0,i).lastIndexOf(`#`),o=a===-1?i:a,s=`${r.substring(0,o)}#${t} ${r.substring(i)}`,c=o+t.length+2;j(s),y(!1),x(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=c,e.selectionEnd=c,e.focus()),A(s,c)})},t[27]=n.prompt,t[28]=j,t[29]=A,t[30]=le):le=t[30];let ue=f(le),P;t[31]!==m||t[32]!==c||t[33]!==v?(P=e=>{if(m&&w.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),w.current.handleKeyDown(e.key);return}c&&C.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),C.current.handleKeyDown(e.key)),v&&T.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),T.current.handleKeyDown(e.key))},t[31]=m,t[32]=c,t[33]=v,t[34]=P):P=t[34];let F=f(P),de=r+1,I;t[35]!==s||t[36]!==de?(I=s(`multirun.launcher.groups.groupLabel`,{index:de}),t[35]=s,t[36]=de,t[37]=I):I=t[37];let L;t[38]===I?L=t[39]:(L=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:I}),t[38]=I,t[39]=L);let R;t[40]!==i||t[41]!==n.id||t[42]!==o||t[43]!==s?(R=i&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(n.id),className:`inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10`,"aria-label":s(`multirun.launcher.groups.removeGroup`),children:(0,$.jsx)(k,{name:`close`,className:`h-3.5 w-3.5`})}),t[40]=i,t[41]=n.id,t[42]=o,t[43]=s,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]===s?B=t[49]:(B=s(`multirun.launcher.groups.prompt.label`),t[48]=s,t[49]=B);let fe;t[50]===B?fe=t[51]:(fe=(0,$.jsx)(ct,{required:!0,children:B}),t[50]=B,t[51]=fe);let V=n.prompt,pe;t[52]!==j||t[53]!==A?(pe=e=>{let t=e.target.value;j(t);let n=e.target.selectionStart??t.length;A(t,n)},t[52]=j,t[53]=A,t[54]=pe):pe=t[54];let H;t[55]===s?H=t[56]:(H=s(`multirun.launcher.groups.prompt.placeholder`),t[55]=s,t[56]=H);let U;t[57]!==n.prompt||t[58]!==F||t[59]!==pe||t[60]!==H?(U=(0,$.jsx)(me,{ref:S,value:V,onChange:pe,onKeyDown:F,placeholder:H,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[57]=n.prompt,t[58]=F,t[59]=pe,t[60]=H,t[61]=U):U=t[61];let _e;t[62]!==g||t[63]!==ce||t[64]!==m?(_e=m?(0,$.jsx)(ge,{ref:w,searchQuery:g,onCommandSelect:ce,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[62]=g,t[63]=ce,t[64]=m,t[65]=_e):_e=t[65];let W;t[66]!==se||t[67]!==M||t[68]!==u||t[69]!==c?(W=c?(0,$.jsx)(he,{ref:C,searchQuery:u,onFileSelect:M,onAgentSelect:se,onSkillSelect:e=>se(e.name),onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[66]=se,t[67]=M,t[68]=u,t[69]=c,t[70]=W):W=t[70];let G;t[71]!==ue||t[72]!==v||t[73]!==b?(G=v?(0,$.jsx)(ye,{ref:T,searchQuery:b,onSnippetSelect:ue,onClose:()=>y(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[71]=ue,t[72]=v,t[73]=b,t[74]=G):G=t[74];let K;t[75]!==U||t[76]!==_e||t[77]!==W||t[78]!==G?(K=(0,$.jsxs)(`div`,{className:`relative`,children:[U,_e,W,G]}),t[75]=U,t[76]=_e,t[77]=W,t[78]=G,t[79]=K):K=t[79];let q;t[80]!==fe||t[81]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[fe,K]}),t[80]=fe,t[81]=K,t[82]=q):q=t[82];let J;t[83]===s?J=t[84]:(J=s(`multirun.launcher.models.info`,{max:ot}),t[83]=s,t[84]=J);let Y;t[85]===J?Y=t[86]:(Y=(0,$.jsx)(st,{children:J}),t[85]=J,t[86]=Y);let be;t[87]===s?be=t[88]:(be=s(`multirun.launcher.models.label`),t[87]=s,t[88]=be);let xe;t[89]!==Y||t[90]!==be?(xe=(0,$.jsx)(ct,{required:!0,info:Y,children:be}),t[89]=Y,t[90]=be,t[91]=xe):xe=t[91];let Se;t[92]!==n.models||t[93]!==ee||t[94]!==O||t[95]!==ne?(Se=(0,$.jsx)(Re,{selectedModels:n.models,onAdd:ee,onRemove:O,onUpdate:ne,minModels:1,maxModels:ot}),t[92]=n.models,t[93]=ee,t[94]=O,t[95]=ne,t[96]=Se):Se=t[96];let Z;t[97]!==xe||t[98]!==Se?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[xe,Se]}),t[97]=xe,t[98]=Se,t[99]=Z):Z=t[99];let Q;return t[100]!==z||t[101]!==q||t[102]!==Z?(Q=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[z,q,Z]}),t[100]=z,t[101]=q,t[102]=Z,t[103]=Q):Q=t[103],Q};export{De as a,Ie as i,$e as n,Te as o,Re as r,ut as t};
|