@yuriai/web 0.2.35 → 0.2.36-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-DLzcNrQ0.js → AgentAvatar-D4JLZ7IL.js} +1 -1
- package/dist/assets/{AssistantContactStatus-9chQCNlQ.js → AssistantContactStatus-CqANenYS.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-DzZgExBt.js → AssistantUnreadBadge-j-O3lnH_.js} +1 -1
- package/dist/assets/{AssistantView-D6y9ECO7.js → AssistantView-DXibp8Nh.js} +1 -1
- package/dist/assets/{DiagramView-BO0AIQl-.js → DiagramView-BRW8DdSg.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BRrU2ivL.js → FadeInOnReveal-CY1UuS2D.js} +1 -1
- package/dist/assets/{GuiPluginSurface-0_eilin-.js → GuiPluginSurface-BOWSgNtP.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BykPaQeY.js → GuiPluginWindow-DlnxZgDZ.js} +1 -1
- package/dist/assets/{Icon-OJf0qBKf.js → Icon-D7VxRqha.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-DlQbo9CM.js → ImageLoadingPlaceholder-ClzN4oGS.js} +1 -1
- package/dist/assets/{LoadingImage-sZ5omN5L.js → LoadingImage-QfRXuKTy.js} +1 -1
- package/dist/assets/MarkdownRenderer-DjSn61IL.js +2 -0
- package/dist/assets/MarkdownRendererImpl-DIvSv3Rv.js +10 -0
- package/dist/assets/MarkstreamRendererImpl-AJvljij3.js +3 -0
- package/dist/assets/{MobileDetailNavigation-D107--jY.js → MobileDetailNavigation-CaO-fGvE.js} +1 -1
- package/dist/assets/{MobileResizableSheet-DuAi_epR.js → MobileResizableSheet-CNn25qxG.js} +1 -1
- package/dist/assets/{MobileShareBridge-Duya4-qV.js → MobileShareBridge-D8oRgnuW.js} +2 -2
- package/dist/assets/MobileTabPageHeader-CkuLCAUz.js +2 -0
- package/dist/assets/{MultiRunWindow-CKFLVBjQ.js → MultiRunWindow-PFfaS1N3.js} +1 -1
- package/dist/assets/{OnboardingScreen-CqsI0632.js → OnboardingScreen-BmAImZZZ.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CZD1yU06.js → OverlayScrollbar-dxKlRNuH.js} +1 -1
- package/dist/assets/{SettingsView-By8wQ0io.js → SettingsView-Ci7GRXnm.js} +12 -12
- package/dist/assets/{SettingsWindow-BkYvnI4i.js → SettingsWindow-DjqjH8zU.js} +1 -1
- package/dist/assets/{SetupTourDialog-ER0fy_HE.js → SetupTourDialog-yJq3b29w.js} +1 -1
- package/dist/assets/{TerminalView-Bxwe5vPx.js → TerminalView-DsqOYj1E.js} +3 -3
- package/dist/assets/{ToolOutputDialog-wLULKJRN.js → ToolOutputDialog-CxlFIAQ4.js} +1 -1
- package/dist/assets/{VoiceSettings-BYFnku1a.js → VoiceSettings-BEtahqoU.js} +2 -2
- package/dist/assets/{YuriLogo-CMUoGUHc.js → YuriLogo-DADSHd1H.js} +1 -1
- package/dist/assets/{YuriWordmark-DHYo0FlR.js → YuriWordmark-CGDlDvEH.js} +1 -1
- package/dist/assets/{appThemeRegistry-z9y3dowq.js → appThemeRegistry-Bz6WZldU.js} +1 -1
- package/dist/assets/bootstrap-Bi91NjXG.js +3 -0
- package/dist/assets/{button-C-gRcs_2.js → button-B7w-b2yV.js} +1 -1
- package/dist/assets/{capgoAdapter-CmkP4lqS.js → capgoAdapter-BpF4euDL.js} +1 -1
- package/dist/assets/{checkbox-BrJBzET8.js → checkbox-DTPgJBK_.js} +1 -1
- package/dist/assets/{collapsible-B7esGYLd.js → collapsible-DZ4ykYM2.js} +1 -1
- package/dist/assets/{context-menu-DWn1nSZC.js → context-menu-BXHMb3Q-.js} +1 -1
- package/dist/assets/{diagram-Bnra5_6g.js → diagram-CldUPV-Z.js} +1 -1
- package/dist/assets/{dialog-3UseH0hM.js → dialog-gc3n4NXh.js} +1 -1
- package/dist/assets/{es-J7a_sZ1u.js → es-DDcXvUON.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-ByaQJcTS.js → fileMentionTouchSelection-CJtFYKAV.js} +1 -1
- package/dist/assets/{fileReferenceActions-COS3jfbf.js → fileReferenceActions-DrAZHld4.js} +1 -1
- package/dist/assets/{fr-BYxUMKWp.js → fr-pUULu88g.js} +2 -2
- package/dist/assets/{gitApi-Dw-LR3UG.js → gitApi-CJS823P8.js} +1 -1
- package/dist/assets/{gitApiHttp-MWsHNHuo.js → gitApiHttp-CKrsk1tw.js} +2 -2
- package/dist/assets/{input-CmLlZdeD.js → input-B7yPcQsA.js} +1 -1
- package/dist/assets/insertionBoundaries-D9Vc7ZK5.js +1 -0
- package/dist/assets/{ja-DCdBiJmD.js → ja-C7MjLXCG.js} +1 -1
- package/dist/assets/{ko-D-Nb_RJY.js → ko-U4JK9TxK.js} +1 -1
- package/dist/assets/{main-Dp8KQSBT.js → main-DD5kDabV.js} +2 -2
- package/dist/assets/{main-CRiKyn7G.js → main-Da12pxuy.js} +14 -14
- package/dist/assets/{markdownHeightCache-xNkQdlqi.js → markdownHeightCache-CLiBBW4n.js} +1 -1
- package/dist/assets/{mcpQueries-BZSAqZuN.js → mcpQueries-JrS0Bvb3.js} +1 -1
- package/dist/assets/{miniChat-BCW0br3M.js → miniChat-lRi18Hvu.js} +2 -2
- package/dist/assets/mobile-8eKyWn8a.js +2 -0
- package/dist/assets/{mobileBackNavigation-Bgo8TriP.js → mobileBackNavigation-BMaLnPn4.js} +1 -1
- package/dist/assets/multirun-Cui2oFM-.js +3 -0
- package/dist/assets/{native-config-ZqHOJ6fS.js → native-config-C8AlS30O.js} +1 -1
- package/dist/assets/{pl-AmU4w3aM.js → pl-Cy7NC-CJ.js} +1 -1
- package/dist/assets/projectMeta-A8jJRQk7.js +1 -0
- package/dist/assets/{pt-BR-BI4ft-Fj.js → pt-BR-qCU-EBEs.js} +1 -1
- package/dist/assets/pwa-CbR9DKyA.js +2 -0
- package/dist/assets/queue-abort-optimistic-B_crtkQx.js +1 -0
- package/dist/assets/{readiness-BYqlQeMk.js → readiness-BpeOajK9.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BJtTYEcH.js → renderElectronMiniChatApp-DqJy20-t.js} +2 -2
- package/dist/assets/{renderMobileApp-DYwORO8C.js → renderMobileApp-C9OxYnMu.js} +7 -7
- package/dist/assets/{runtimeConfig-DL4uXM0C.js → runtimeConfig-7LsY--_g.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-C6j5YkJj.js → runtimeEndpointReset-NZMW9r3D.js} +7 -7
- package/dist/assets/{scheduledTaskNavigation-Cq5yavoC.js → scheduledTaskNavigation-7dD6PWMD.js} +1 -1
- package/dist/assets/{select-J8r9SxHt.js → select-WCptRb7Z.js} +1 -1
- package/dist/assets/sessionLookup-CxjYSDU2.js +1 -0
- package/dist/assets/{sortable-tabs-strip-CiP6RIQa.js → sortable-tabs-strip-DFKCoZZF.js} +1 -1
- package/dist/assets/{speechSettingsQueries-CufXiLkn.js → speechSettingsQueries-4gKyXBgi.js} +1 -1
- package/dist/assets/src-B_i0g2Ca.css +2 -0
- package/dist/assets/{store-OjrIiXCx.js → store-CVmc1U19.js} +3 -3
- package/dist/assets/{terminalApi-BMWW_0wH.js → terminalApi-Bo6KWljy.js} +1 -1
- package/dist/assets/{textarea-BHgcxJdC.js → textarea-CMVUhwQ2.js} +1 -1
- package/dist/assets/{tooltip-Degmpxnd.js → tooltip-L2xweVkb.js} +1 -1
- package/dist/assets/types-djs5o8aQ.js +2 -0
- package/dist/assets/{uk-CbdByxxj.js → uk-D5ulQPhM.js} +1 -1
- package/dist/assets/{useAppFontEffects-J3RrHTRd.js → useAppFontEffects-mxyvl0gj.js} +58 -54
- package/dist/assets/{useAssistantUIStore-D25VqrpK.js → useAssistantUIStore-cHle1U5H.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-D22mutiT.js → useDesktopWindowControlsLayout-ZHw0VsJh.js} +1 -1
- package/dist/assets/{useDictation-DFVJpRbm.js → useDictation-DO12CgDE.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-D1ga92jj.js → useEffectiveDirectory-B6ny9aem.js} +1 -1
- package/dist/assets/{useFontPreferences-CEK8G_Ps.js → useFontPreferences-D-AOjd9H.js} +1 -1
- package/dist/assets/useMobileNavigationStore-DRBFwjAg.js +17 -0
- package/dist/assets/{usePluginsStore-GuZu61OT.js → usePluginsStore-Bav6NFUH.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-VhgGU_te.js → useStreamingTextThrottle-DLR8xP-j.js} +1 -1
- package/dist/assets/useUIStore-B61bCFEM.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-DNj4Aa0S.js → useWorkerHighlightedLines-DdYDj9PN.js} +1 -1
- package/dist/assets/{vendor-marked-WVekxjAN.js → vendor-marked-S3gCOYp1.js} +1 -1
- package/dist/assets/{zh-CN-ufEVDbXp.js → zh-CN-C3SRM0mS.js} +1 -1
- package/dist/assets/{zh-TW-DTBlZ4YC.js → zh-TW-CZD-9AC2.js} +1 -1
- package/dist/index.html +10 -10
- package/dist/mini-chat.html +10 -10
- package/dist/mobile.html +10 -10
- package/package.json +1 -1
- package/dist/assets/MarkdownRenderer-64YkD1Ct.js +0 -2
- package/dist/assets/MarkdownRendererImpl-iosoqnCI.js +0 -10
- package/dist/assets/MarkstreamRendererImpl-BIxWqmEF.js +0 -3
- package/dist/assets/MobileTabPageHeader-CqhuzKJa.js +0 -2
- package/dist/assets/bootstrap-C8paoQ0j.js +0 -3
- package/dist/assets/insertionBoundaries-9KJWoqup.js +0 -1
- package/dist/assets/mobile-usXz8wZd.js +0 -2
- package/dist/assets/multirun-CflOv3TT.js +0 -3
- package/dist/assets/projectMeta-KP9BgEIm.js +0 -1
- package/dist/assets/pwa-BbBJQBpm.js +0 -2
- package/dist/assets/queue-abort-optimistic-BaOXtqLx.js +0 -1
- package/dist/assets/sessionLookup-LrqUcxJk.js +0 -1
- package/dist/assets/src-DHfmlFCj.css +0 -2
- package/dist/assets/types-DWyP764A.js +0 -2
- package/dist/assets/useMobileNavigationStore-BOlo2VUm.js +0 -17
- package/dist/assets/useUIStore-BerIUSLP.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n,t as r}from"./runtime-switch-DEZ1K7qW.js";import{n as i}from"./runtime-fetch-D0YWp3FJ.js";import{S as a,x as o}from"./desktop-BAmoc_34.js";import{t as s}from"./runtimeAPIRegistry-C2VogTny.js";import{a as c,i as l,r as u}from"./vendor-zustand-vDaAPGfl.js";import{st as d}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{S as f,a as p,h as m,m as h,o as ee,r as g,w as te,x as ne}from"./useUIStore-BerIUSLP.js";import{n as re}from"./vendor-react-DlzBev0S.js";import{a as ie}from"./queryRuntime-2dx7jbt9.js";import{t as ae}from"./pathNormalization-ewtPqJWn.js";import{r as oe}from"./runtime-ead7P81A.js";var se=`yuri.inst.`,ce=e=>{try{return btoa(unescape(encodeURIComponent(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}catch{return encodeURIComponent(e)}},le=e=>{let t=(e??n()).trim();return t.length>0?t:`default`},ue=()=>{if(typeof window>`u`)return``;let e=window.__YURI_LOCAL_ORIGIN__;return typeof e==`string`?e.trim().replace(/\/+$/,``):``},_=(e,t=n())=>`${se}${ce(le(t))}.${e}`,de=(e=n())=>le(e).startsWith(`relay:`),fe=(e=n())=>{let t=le(e);if(t==="default"||t===`local`)return!0;if(de(t)||!t.startsWith(`url:`))return!1;let r=ue();if(!r)return!1;try{return new URL(t.slice(4)).origin===new URL(r).origin}catch{return!1}},pe=(e=n())=>!de(e),me=(e,t=r())=>{let n=t.trim().replace(/\/+$/,``);return n?`${e}:${encodeURIComponent(n)}`:null},he=(e,t)=>{let r=t?.storage??(typeof localStorage<`u`?localStorage:{getItem:()=>null}),i=t?.runtimeKey??n(),a=r.getItem(_(e,i));if(a!==null)return a;if(pe(i)){let t=me(e),n=t?r.getItem(t):null;if(n!==null)return n}return fe(i)?r.getItem(e):null},v=(e,t,r)=>{let i=r?.storage??(typeof localStorage<`u`?localStorage:{setItem:()=>void 0}),a=r?.runtimeKey??n();i.setItem(_(e,a),t)},ge=e=>({getItem:t=>he(t,{storage:e}),setItem:(t,n)=>{v(t,n,{storage:e})},removeItem:t=>{y(t,{storage:e})}}),y=(e,t)=>{let r=t?.storage??(typeof localStorage<`u`?localStorage:{removeItem:()=>void 0}),i=t?.runtimeKey??n();r.removeItem(_(e,i))},_e=e=>{let t;try{t=te()}catch{return}let r=t=>t===null?null:JSON.parse(t,e?.reviver),i=e=>t.getItem(e);return{getItem:e=>{let t=n(),a=_(e,t),o=i(a);if(o instanceof Promise)return o.then(n=>{if(n!==null)return r(n);if(!fe(t))return null;let a=i(e);return a instanceof Promise?a.then(r):r(a)});if(o!==null)return r(o);if(!fe(t))return null;let s=i(e);return s instanceof Promise?s.then(r):r(s)},setItem:(r,i)=>{let a=_(r,n());t.setItem(a,JSON.stringify(i,e?.replacer))},removeItem:e=>{let r=_(e,n());t.removeItem(r)}}},ve=(e=ye)=>{let t=new Map,n=0;return{countUnicodeCodePoints:r=>{let i=t.get(r);if(i!==void 0)return t.delete(r),t.set(r,i),i;let a=e(r);if(r.length>4e5)return a;for(;n+r.length>4e5&&t.size>0;){let e=t.keys().next().value;n-=e.length,t.delete(e)}return t.set(r,a),n+=r.length,a}}},ye=e=>{let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(n+=1)}t+=1}return t},be=ve(),xe=e=>be.countUnicodeCodePoints(e),b=(e,t)=>{if(!e)throw Error(`${t} must be non-empty`);return e},Se=({transportIdentity:e},t)=>({transportIdentity:b(e,`transportIdentity`),owner:{kind:`session`,ownerID:b(t,`sessionID`)}}),Ce=({transportIdentity:e},t)=>({transportIdentity:b(e,`transportIdentity`),owner:{kind:`draft`,ownerID:b(t,`draftID`)}}),we=e=>{let t=typeof e.projectId==`string`?e.projectId.trim():``;if(t)return`new-session:project:${t}`;let n=typeof e.directory==`string`?e.directory.trim():``;return n?`new-session:directory:${n}`:`new-session:default`},Te=({transportIdentity:e},t)=>({transportIdentity:b(e,`transportIdentity`),owner:{kind:`surface`,ownerID:b(t,`surfaceID`)}}),Ee=8192,De=e=>{if(typeof e!=`string`||e.length===0||e.length>Ee)return!1;try{let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`file:`}catch{return!1}},Oe=e=>JSON.stringify([e.transportIdentity,e.owner.kind,e.owner.ownerID]),ke=e=>JSON.stringify([e.transportIdentity,e.owner.kind,e.owner.ownerID,e.attachmentOccurrenceRefID]),Ae=e=>JSON.stringify([`root`,e]),je=(e,t)=>JSON.stringify([`part`,e,t]),Me={mentionCount:1e3,valueLength:8192,pathLength:8192,labelLength:512},x={referenceCount:1e3,idLength:512,displayLength:514,sessionIDLength:128,skillNameLength:511,commandNameLength:511,commandReferenceLength:8192,pastePayloadLength:1e5,totalPastePayloadLength:2e5},S=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},C=(e,t)=>Object.keys(e).every(e=>t.includes(e)),w=e=>typeof e==`string`&&e.length>0,Ne=e=>typeof e==`string`,T=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,E=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,Pe=(e,t)=>{if(t<=0||t>=e.length)return!0;let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return!(n>=55296&&n<=56319&&r>=56320&&r<=57343)},Fe=(e,t)=>{if(!Array.isArray(t)||t.length>Me.mentionCount)return;let n=[],r=new Set,i=0;for(let a of t){if(!S(a)||!C(a,[`kind`,`value`,`path`,`label`,`range`])||a.kind!==`file`&&a.kind!==`directory`&&a.kind!==`agent`||!E(a.value,Me.valueLength)||!E(a.path,Me.pathLength)||!E(a.label,Me.labelLength)||!S(a.range)||!C(a.range,[`start`,`end`])||!T(a.range.start)||!T(a.range.end)||a.range.end<=a.range.start||a.range.end>e.length||a.range.start<i||!Pe(e,a.range.start)||!Pe(e,a.range.end)||e.slice(a.range.start,a.range.end)!==`@${a.value}`)return;let t=JSON.stringify([a.kind,a.value,a.path,a.label,a.range.start,a.range.end]);if(r.has(t))return;r.add(t),i=a.range.end,n.push({kind:a.kind,value:a.value,path:a.path,label:a.label,range:{start:a.range.start,end:a.range.end}})}return n},Ie=e=>E(e,x.sessionIDLength)&&/^[A-Za-z0-9_-]+$/.test(e),Le=/^[^\s/\\[\]\r\n]+$/u,Re=()=>/\[skill:([^\s/\\\]\r\n]+)\]/gu,ze=e=>E(e,x.skillNameLength)&&Le.test(e),Be=e=>E(e,x.commandNameLength)&&/^[\p{L}\p{N}._/-]+$/u.test(e),Ve=e=>E(e,x.commandReferenceLength)&&!/[\]\r\n]/u.test(e),He=e=>{if(!(!S(e)||!E(e.id,x.idLength)||!E(e.display,x.displayLength)||!T(e.start)||!T(e.end)||e.end<=e.start)){if(e.kind===`session`&&C(e,[`id`,`kind`,`start`,`end`,`display`,`sessionId`])&&Ie(e.sessionId))return{id:e.id,kind:`session`,start:e.start,end:e.end,display:e.display,sessionId:e.sessionId};if(e.kind===`paste`&&C(e,[`id`,`kind`,`start`,`end`,`display`,`text`,`characterCount`,`index`])&&typeof e.text==`string`&&e.text.length<=x.pastePayloadLength&&T(e.characterCount)&&e.characterCount===xe(e.text)&&T(e.index)&&e.index>=1)return{id:e.id,kind:`paste`,start:e.start,end:e.end,display:e.display,text:e.text,characterCount:e.characterCount,index:e.index};if(e.kind===`skill`&&C(e,[`id`,`kind`,`start`,`end`,`display`,`skillName`])&&ze(e.skillName)&&(e.display===`/${e.skillName}`||e.display===`/ ${e.skillName}`||e.display===`@${e.skillName}`||e.display===`@ ${e.skillName}`))return{id:e.id,kind:`skill`,start:e.start,end:e.end,display:e.display,skillName:e.skillName};if(e.kind===`command`&&C(e,[`id`,`kind`,`start`,`end`,`display`,`commandName`,`reference`])&&Be(e.commandName)&&Ve(e.reference)&&(e.display===`/${e.commandName}`||e.display===`/ ${e.commandName}`))return{id:e.id,kind:`command`,start:e.start,end:e.end,display:e.display,commandName:e.commandName,reference:e.reference}}},Ue=(e,t)=>{if(!Array.isArray(t)||t.length>x.referenceCount)return;let n=t.map(He);if(!n.every(Boolean))return;let r=n,i=new Set,a=0,o=0;for(let t of r)if(i.has(t.id)||t.start<a||t.end>e.length||e.slice(t.start,t.end)!==t.display||(i.add(t.id),a=t.end,t.kind===`paste`&&(o+=t.text.length,o>x.totalPastePayloadLength)))return;return{text:e,references:r}},We=(e,t)=>{if(e===null||[`string`,`number`,`boolean`,`undefined`].includes(typeof e))return!0;if(typeof e!=`object`||e instanceof Blob||typeof File<`u`&&e instanceof File||!Array.isArray(e)&&!S(e)||t.has(e))return!1;t.add(e);let n=Object.values(e).every(e=>We(e,t));return t.delete(e),n},Ge=e=>{if(!(!S(e)||!C(e,[`kind`,`ownerID`])||!w(e.ownerID))&&(e.kind===`session`||e.kind===`draft`||e.kind===`surface`))return{kind:e.kind,ownerID:e.ownerID}},Ke=e=>{if(!S(e)||!C(e,[`transportIdentity`,`owner`])||!w(e.transportIdentity))return;let t=Ge(e.owner);return t?{transportIdentity:e.transportIdentity,owner:t}:void 0},qe=e=>{if(!(!S(e)||!w(e.kind))){if(e.kind===`blob`&&C(e,[`kind`,`blobID`])&&w(e.blobID))return{kind:`blob`,blobID:e.blobID};if(!(e.kind!==`url`||!C(e,[`kind`,`url`])||!De(e.url)))return{kind:`url`,url:e.url}}},Je=(e,t,n)=>{try{let r=JSON.parse(e);return Array.isArray(r)?n===void 0?r.length===2&&r[0]===`root`&&r[1]===t:r.length===3&&r[0]===`part`&&r[1]===n&&r[2]===t:!1}catch{return!1}},Ye=(e,t)=>{if(!S(e)||!C(e,[`attachmentID`,`attachmentRefID`,`filename`,`mimeType`,`size`,`locator`,`source`,`serverPath`,`vscodePath`,`vscodeSource`])||!w(e.attachmentID)||!w(e.attachmentRefID)||!Je(e.attachmentRefID,e.attachmentID,t)||!w(e.filename)||!Ne(e.mimeType)||!T(e.size)||e.source!==`local`&&e.source!==`vscode`&&e.source!==`server`||e.serverPath!==void 0&&!w(e.serverPath)||e.vscodePath!==void 0&&!w(e.vscodePath)||e.vscodeSource!==void 0&&e.vscodeSource!==`file`&&e.vscodeSource!==`selection`||e.source===`server`&&!w(e.serverPath)||e.source===`vscode`&&(!w(e.vscodePath)||e.vscodeSource!==`file`&&e.vscodeSource!==`selection`))return;let n=qe(e.locator);if(n)return{attachmentID:e.attachmentID,attachmentRefID:e.attachmentRefID,filename:e.filename,mimeType:e.mimeType,size:e.size,locator:n,source:e.source,...e.serverPath===void 0?{}:{serverPath:e.serverPath},...e.vscodePath===void 0?{}:{vscodePath:e.vscodePath},...e.vscodeSource===void 0?{}:{vscodeSource:e.vscodeSource}}},Xe=e=>{if(!We(e,new Set)||!S(e)||!C(e,[`version`,`key`,`revision`,`text`,`attachments`,`syntheticParts`,`mentions`,`composerReferences`])||e.version!==1||!T(e.revision)||e.revision<1||typeof e.text!=`string`||!Array.isArray(e.attachments)||!Array.isArray(e.syntheticParts)||!Array.isArray(e.mentions))return;let t=e.text,n=Ke(e.key),r=e.attachments.map(e=>Ye(e)),i=e.syntheticParts.map(e=>{if(!S(e)||!C(e,[`partID`,`text`,`attachments`,`synthetic`])||!w(e.partID)||typeof e.text!=`string`||!Array.isArray(e.attachments)||e.synthetic!==void 0&&typeof e.synthetic!=`boolean`)return;let t=e.partID,n=e.text,r=e.attachments.map(e=>Ye(e,t));return r.every(Boolean)?{partID:t,text:n,attachments:r,...e.synthetic===void 0?{}:{synthetic:e.synthetic}}:void 0}),a=Fe(t,e.mentions),o=e.composerReferences===void 0?{text:t,references:[]}:Ue(t,e.composerReferences);if(!n||!r.every(Boolean)||!i.every(Boolean)||!a||!o)return;let s=r,c=i,l=new Set;for(let e of[...s,...c.flatMap(e=>e.attachments)]){if(l.has(e.attachmentRefID))return;l.add(e.attachmentRefID)}if(new Set(c.map(e=>e.partID)).size===c.length)return{version:1,key:n,revision:e.revision,text:t,attachments:s,syntheticParts:c,mentions:a,...e.composerReferences===void 0?{}:{composerReferences:o.references}}},Ze=e=>Xe(e),D=` `,Qe=`0.2em`,$e=`size-[1em]`,et=e=>e.startsWith(D)?e.slice(D.length):e,tt=e=>e.replaceAll(`/${D}`,`/`).replaceAll(`@${D}`,`@`).replaceAll(`[${D}`,`[`),nt=e=>{let t=e.match(/^\s*/)?.[0].length??0,n=e.slice(t);if(!n.startsWith(`/`))return null;let r=1;n.startsWith(D,r)&&(r+=D.length);let i=n.slice(r);if(!i)return null;let a=i.search(/\s/u),o=a===-1?i:i.slice(0,a);return o?{commandName:o,argumentsText:a===-1?``:i.slice(a).trim()}:null},rt=e=>O({trigger:`[`,icon:`file-image`,label:e,suffix:`]`}),it=({trigger:e,label:t,suffix:n=``})=>`${e}${t}${n}`,O=e=>`${e.trigger}${D}${e.label}${e.suffix??``}`,at=e=>it(e),ot=(e,t)=>e===at(t)||e===O(t),k=(e,t)=>{let n=t===O(e);return{trigger:n?`${e.trigger}${D}`:e.trigger,icon:e.icon,align:e.align??`end`,label:e.label,suffix:e.suffix,slot:n?`reserved`:`compact`}},st=(e,t,n=``)=>{let r=e.startsWith(t)?e.slice(t.length):e,i=r.startsWith(D)?r.slice(D.length):r;return n&&i.endsWith(n)?i.slice(0,-n.length):i},ct=(e,t)=>e===t||!!e&&!!t&&e.trigger===t.trigger&&e.icon===t.icon&&e.align===t.align&&e.label===t.label&&e.suffix===t.suffix&&e.slot===t.slot,lt=0n,ut=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,dt=14;function ft(e){let t=``;for(let n=0;n<e;n++)t+=ut[Math.floor(Math.random()*62)];return t}var pt=/^[0-9a-f]{12}$/,mt=/^[0-9A-Za-z]{14}$/,ht=(1n<<48n)-1n,gt=(e,t)=>{if(typeof t!=`string`||!t.startsWith(`${e}_`))return;let n=t.slice(e.length+1),r=n.slice(0,12);if(!(!pt.test(r)||!mt.test(n.slice(12))))return BigInt(`0x${r}`)},_t=(e,t)=>{let n=BigInt(Date.now())*4096n&ht,r=gt(e,t)??0n,i=[n,lt,r].reduce((e,t)=>e>t?e:t);if(i>=ht)throw Error(`Ascending ID space exhausted`);let a=i+1n;lt=a;let o=new Uint8Array(6);for(let e=0;e<6;e++)o[e]=Number(a>>BigInt(40-8*e)&BigInt(255));let s=``;for(let e=0;e<o.length;e++)s+=o[e].toString(16).padStart(2,`0`);return`${e}_${s}${ft(dt)}`},vt=e=>_t(e),yt=e=>{let t=e.replace(/\\/g,`/`).replace(/\/+$/g,``).trim();if(!t)return``;let n=new TextEncoder().encode(t),r=``;for(let e of n)r+=String.fromCharCode(e);return`path_${typeof btoa==`function`?btoa(r).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``):t.replace(/[^A-Za-z0-9._-]+/g,`_`)}`},bt=()=>globalThis.crypto===void 0?null:{randomUUID:typeof globalThis.crypto.randomUUID==`function`?()=>globalThis.crypto.randomUUID():void 0,getRandomValues:typeof globalThis.crypto.getRandomValues==`function`?e=>globalThis.crypto.getRandomValues(e):void 0},xt=(e=bt())=>{try{let t=e?.randomUUID?.();if(t)return t}catch{}let t=new Uint8Array(16),n=!1;try{e?.getRandomValues&&(e.getRandomValues(t),n=!0)}catch{}if(!n)for(let e=0;e<t.length;e+=1)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=Array.from(t,e=>e.toString(16).padStart(2,`0`));return`${r.slice(0,4).join(``)}-${r.slice(4,6).join(``)}-${r.slice(6,8).join(``)}-${r.slice(8,10).join(``)}-${r.slice(10).join(``)}`},A={...x,sessionIdLength:x.sessionIDLength,visibleTextLength:1e5,canonicalOutputLength:2e5},St=e=>typeof e==`string`&&Ie(e),Ct=e=>e.replaceAll(`\\`,`/`).split(`/`).at(-1)?.replace(/\.md$/,``)??``,wt=e=>({trigger:`@`,icon:`chat-thread`,label:e}),Tt=(e,t)=>({trigger:`/`,icon:t,label:e}),j=(e,t)=>({trigger:t,icon:`book-open`,label:e}),Et=(e,t)=>[`/`,`@`].some(n=>ot(e,j(t,n))),Dt=(e,t)=>ot(e,j(t,`@`))?j(t,`@`):j(t,`/`),Ot={session:{kind:`session`,validatePayload:e=>St(e.sessionId),contributeCanonical:e=>({text:`@session:${e.sessionId}`,semantic:{type:`session`,sessionId:e.sessionId}}),contributeDirectSend:e=>({text:at(wt(st(e.display,`@`))),semantic:{type:`session`,sessionId:e.sessionId}}),decorate:e=>({style:`mentionSession`,visual:k(wt(st(e.display,`@`)),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:/@session:([A-Za-z0-9_-]+)/g,resolveDisplay:(e,t)=>{let n=e.index===0?``:t.text[e.index-1],r=t.text[e.index+e[0].length]??``;return(n===``||/[\s([{]/.test(n))&&(r===``||/[\s)\]},.!?;:]/.test(r))?O(wt(t.sessionTitles.get(e[1])||e[1])):null},materialize:(e,t,n)=>({id:`session:${e[1]}:${e.index}`,kind:`session`,sessionId:e[1],display:t,start:n,end:n+t.length})}},paste:{kind:`paste`,validatePayload:e=>typeof e.text==`string`&&e.text.length<=A.pastePayloadLength&&typeof e.characterCount==`number`&&Number.isSafeInteger(e.characterCount)&&e.characterCount===xe(e.text)&&typeof e.index==`number`&&Number.isSafeInteger(e.index)&&e.index>=1,contributeCanonical:e=>({text:e.text}),contributeDirectSend:e=>({text:e.text}),decorate:()=>({style:`mentionPaste`}),payloadBudget:e=>({category:`opaque-text`,length:e.text.length})},skill:{kind:`skill`,validatePayload:e=>ze(e.skillName)&&typeof e.display==`string`&&Et(e.display,e.skillName),contributeCanonical:e=>({text:`[skill:${e.skillName}]`}),contributeDirectSend:e=>({text:`[skill:${e.skillName}]`}),decorate:e=>({style:`mentionCommand`,skillName:e.skillName,visual:k(Dt(e.display,e.skillName),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:Re(),resolveDisplay:e=>O(j(e[1],`@`)),materialize:(e,t,n)=>({id:`skill:${n}`,kind:`skill`,skillName:e[1],display:t,start:n,end:n+t.length})}},command:{kind:`command`,validatePayload:e=>Be(e.commandName)&&Ve(e.reference)&&typeof e.display==`string`&&ot(e.display,Tt(e.commandName,`command`)),contributeCanonical:e=>({text:`[command:${e.reference}]`}),contributeDirectSend:e=>({text:`[command:${e.reference}]`}),decorate:e=>({style:`mentionCommand`,visual:k(Tt(e.commandName,`command`),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:/\[command:([^\]\r\n]+)\]/g,resolveDisplay:e=>{let t=Ct(e[1]);return Ve(e[1])&&Be(t)?O(Tt(t,`command`)):null},materialize:(e,t,n)=>({id:`command:${n}`,kind:`command`,commandName:Ct(e[1]),reference:e[1],display:t,start:n,end:n+t.length})}}},M=e=>Ot[e],kt=(e,t)=>M(e).validatePayload(t),At=e=>M(e.kind).contributeCanonical(e),jt=e=>M(e.kind).contributeDirectSend(e),Mt=e=>M(e.kind).decorate(e),N=e=>M(e.kind).payloadBudget(e),Nt=e=>M(e.kind).describeResourceIdentity?.(e),Pt=Object.keys(Ot),Ft=e=>typeof e==`string`&&Pt.includes(e),It=()=>Pt.flatMap(e=>{let t=M(e).canonical;return t?[t]:[]}),Lt=e=>{if(e.type===`attachment`)return`attachment:${e.attachmentRefID}`},Rt=e=>{let t=new Map;for(let n of e.references){let e=Nt(n);e&&t.set(Lt(e),e)}return[...t.values()]},zt=(e,t)=>{let n=new Map(e.map(e=>[Lt(e),e])),r=new Map(t.map(e=>[Lt(e),e]));return{previous:[...n.values()],next:[...r.values()],added:[...r].flatMap(([e,t])=>n.has(e)?[]:[t]),removed:[...n].flatMap(([e,t])=>r.has(e)?[]:[t])}},Bt=(e,t)=>zt(Rt(e),Rt(t)),Vt=(e,t=`queue-canonical`)=>{if(e.references.length>A.referenceCount)return{ok:!1,reason:`reference-budget-exceeded`};let n=[...e.references].sort((e,t)=>e.start-t.start),r=0,i=0;for(let t of n){if(t.start<r||t.start<0||t.end<=t.start||t.end>e.text.length||e.text.slice(t.start,t.end)!==t.display)return{ok:!1,reason:`invalid-references`};r=t.end;let n=N(t);i+=n?.category===`opaque-text`?n.length:0}if(i>A.totalPastePayloadLength)return{ok:!1,reason:`reference-payload-budget-exceeded`};let a=[],o=[],s=0;for(let r of n){s<r.start&&a.push({provenance:`authored`,text:e.text.slice(s,r.start),start:s,end:r.start});let n=t===`direct-send-display`?jt(r):At(r);n.semantic?(a.push({provenance:`generated-reference`,text:n.text,start:r.start,end:r.end,referenceId:r.id,semantic:n.semantic}),o.push(n.semantic)):a.push({provenance:`reference-payload`,text:n.text,start:r.start,end:r.end,referenceId:r.id}),s=r.end}s<e.text.length&&a.push({provenance:`authored`,text:e.text.slice(s),start:s,end:e.text.length});let c=a.map(e=>e.text).join(``);return c.length>A.canonicalOutputLength?{ok:!1,reason:`canonical-output-too-large`}:{ok:!0,plan:{chunks:a,semantics:o},text:c}},P=(e,t)=>Math.max(0,Math.min(e,t)),Ht=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,Ut=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return!Ht(t.id,A.displayLength)||!Ht(t.display,A.displayLength)||!Number.isSafeInteger(t.start)||!Number.isSafeInteger(t.end)||typeof t.kind!=`string`?!1:Ft(t.kind)&&kt(t.kind,t)},F=(e,t)=>{let n=[],r=0,i=[],a=Math.min(t.length,A.referenceCount);for(let e=0;e<a;e+=1){let a=t[e];if(!Ut(a)){typeof a==`object`&&a&&typeof a.id==`string`&&n.push(a.id),r+=1;continue}i.push({reference:a,index:e})}i.sort((e,t)=>e.reference.start-t.reference.start||e.index-t.index);let o=[],s=new Set,c=0,l=0,u=!1;for(let{reference:t}of i){if(s.has(t.id)||t.start<c||t.start<0||t.end<=t.start||t.end>e.length||e.slice(t.start,t.end)!==t.display){n.push(t.id),r+=1;continue}s.add(t.id),c=t.end;let i=N(t);if(l+=i?.category===`opaque-text`?i.length:0,l>x.totalPastePayloadLength){n.push(t.id),r+=1,s.delete(t.id),c=o.at(-1)?.end??0,u=!0,l-=i?.category===`opaque-text`?i.length:0;continue}o.push(t)}return r+=t.length-a,{document:{text:e,references:o},rejectedIds:n,rejectedCount:r,budgetExceeded:t.length>A.referenceCount,payloadBudgetExceeded:u}},I=e=>{let t=[...e.references].sort((e,t)=>e.start-t.start||e.end-t.end),n=[],r=new Set,i=0,a=0;for(let o of t){if(!Ht(o.id,A.idLength)||!Ht(o.display,A.displayLength)||!Ft(o.kind)||!Number.isSafeInteger(o.start)||!Number.isSafeInteger(o.end)||r.has(o.id)||o.start<i||o.start<0||o.end<=o.start||o.end>e.text.length||e.text.slice(o.start,o.end)!==o.display)continue;let t=N(o),s=t?.category===`opaque-text`?t.length:0;a+s>x.totalPastePayloadLength||(r.add(o.id),i=o.end,a+=s,n.push(o))}return{text:e.text,references:n}},Wt=(e,t)=>{if(t.length>x.pastePayloadLength)return!1;let n=F(e.text,e.references);return n.budgetExceeded||n.payloadBudgetExceeded?!1:n.document.references.reduce((e,t)=>{let n=N(t);return e+(n?.category===`opaque-text`?n.length:0)},0)+t.length<=x.totalPastePayloadLength},Gt=(e,t,n)=>{let r=e.filter(e=>t===n?t>e.start&&t<e.end:e.start<n&&e.end>t);return r.length===0?{start:t,end:n}:{start:Math.min(t,...r.map(e=>e.start)),end:Math.max(n,...r.map(e=>e.end))}};function Kt(e,t,n,r,i={}){let a=I(e);if(!kt(r.kind,r))return{document:a,caret:P(n,a.text.length),edit:{oldStart:t,oldEnd:n,newEnd:n}};let o=P(t,a.text.length),s=Math.max(o,P(n,a.text.length)),c=Gt(a.references,o,s),l=a.text.slice(0,c.start),u=a.text.slice(c.end),d=!!i.padDocumentEdges&&i.padLeadingDocumentEdge!==!1,f=!!i.padDocumentEdges,p=i.inlineBoundaries&&(l.length>0||d)&&!/\s$/.test(l)?` `:``,m=i.inlineBoundaries&&(u.length>0||f)&&!/^\s/.test(u)?` `:``,h=`${l}${p}${r.display}${m}${u}`,ee={...r,start:c.start+p.length,end:c.start+p.length+r.display.length},g=p.length+r.display.length+m.length-(c.end-c.start);return{document:I({text:h,references:[...a.references.filter(e=>e.end<=c.start||e.start>=c.end).map(e=>e.start>=c.end?{...e,start:e.start+g,end:e.end+g}:e),ee]}),caret:ee.end,edit:{oldStart:c.start,oldEnd:c.end,newEnd:c.start+p.length+r.display.length+m.length}}}var qt=(e,t)=>e<=t.oldStart?e:e>=t.oldEnd?e+t.newEnd-t.oldEnd:t.newEnd,Jt=(e,t,n=t.length,r=n)=>{let i=I(e),a=0,o=Math.min(i.text.length,t.length);for(;a<o&&i.text[a]===t[a];)a+=1;let s=0;for(;s<i.text.length-a&&s<t.length-a&&i.text[i.text.length-s-1]===t[t.length-s-1];)s+=1;let c={oldStart:a,oldEnd:i.text.length-s,newEnd:t.length-s},l=Gt(i.references,c.oldStart,c.oldEnd),u=l.start!==c.oldStart||l.end!==c.oldEnd,d=i.references.filter(e=>e.start<l.end&&e.end>l.start),f=t.slice(c.oldStart,c.newEnd),p=`${i.text.slice(0,l.start)}${f}${i.text.slice(l.end)}`,m={oldStart:l.start,oldEnd:l.end,newEnd:l.start+f.length},h=m.newEnd-m.oldEnd,ee=i.references.filter(e=>e.end<=l.start||e.start>=l.end).map(e=>e.start>=l.end?{...e,start:e.start+h,end:e.end+h}:e),g=(e,n)=>{let r=P(e,t.length),i=c.newEnd+l.end-c.oldEnd;return P(r<=l.start?r:r<c.oldStart||r===c.oldStart&&n===`start`?l.start:r<c.newEnd||r===c.newEnd&&n===`start`?l.start+r-c.oldStart:r<=i?m.newEnd:m.newEnd+r-i,p.length)},te=g(n,`start`),ne=Math.max(te,g(r,`end`)),re=I({text:p,references:ee});return{document:re,edit:m,requiresTextCorrection:u,selectionStart:te,selectionEnd:ne,caret:ne,mapCaret:e=>P(qt(e,m),re.text.length),removedReferences:d}},Yt=(e,t,n)=>{let r=Gt(n,e,t);return r.start===e&&r.end===t?null:r},Xt=(e,t,n)=>{let r=n,i=n;if(t===`Backspace`){for(;r>0&&/\s/.test(e[r-1]);)--r;for(;r>0&&!/\s/.test(e[r-1]);)--r}else{for(;i<e.length&&/\s/.test(e[i]);)i+=1;for(;i<e.length&&!/\s/.test(e[i]);)i+=1}return{start:r,end:i}},Zt=(e,t)=>{let n=I(e),r=P(t.selectionStart,n.text.length),i=Math.max(r,P(t.selectionEnd,n.text.length)),a=r===i?t.altKey?Xt(n.text,t.key,r):t.key===`Backspace`?{start:Math.max(0,r-1),end:r}:{start:r,end:Math.min(n.text.length,r+1)}:{start:r,end:i},o=Yt(a.start,a.end,n.references);if(!o)return null;let s=n.references.filter(e=>e.start<o.end&&e.end>o.start);return{document:I({text:`${n.text.slice(0,o.start)}${n.text.slice(o.end)}`,references:n.references.filter(e=>!s.includes(e)).map(e=>e.start>=o.end?{...e,start:e.start-(o.end-o.start),end:e.end-(o.end-o.start)}:e)}),caret:o.start,edit:{oldStart:o.start,oldEnd:o.end,newEnd:o.start},removedIds:s.map(e=>e.id),removedReferences:s}},Qt=(e,t)=>{let n=t,r=t;for(;n>0&&/\s/.test(e[n-1]);)--n;for(;r<e.length&&/\s/.test(e[r]);)r+=1;let i=n>0&&r<e.length?` `:``;return{text:`${e.slice(0,n)}${i}${e.slice(r)}`,caret:n+i.length}},$t=(e,t=`queue-canonical`)=>{let n=F(e.text,e.references);if(n.budgetExceeded)return{ok:!1,reason:`reference-budget-exceeded`};if(n.payloadBudgetExceeded)return{ok:!1,reason:`reference-payload-budget-exceeded`};if(n.rejectedCount>0)return{ok:!1,reason:`invalid-references`};let r=Vt(n.document,t);return r.ok?{ok:!0,text:r.text,chunks:r.plan.chunks,semantics:r.plan.semantics}:r},en=(e,t)=>e.match.index-t.match.index||e.adapterOrder-t.adapterOrder||e.matchOrder-t.matchOrder,tn=e=>{if(e.length>A.canonicalOutputLength||e.length>A.visibleTextLength)return null;let t=[],n=0;for(let[r,i]of It().entries()){i.matcher.lastIndex=0;let a,o=0;for(;(a=i.matcher.exec(e))!==null;){if(n+=1,n>A.referenceCount)return null;let e={codec:i,match:a,adapterOrder:r,matchOrder:o};o+=1;let s=t.findIndex(t=>en(e,t)<0);s===-1?t.push(e):t.splice(s,0,e)}}return t},nn=(e,t)=>{let n=F(e.text,e.references).document,r=tn(n.text);if(r===null)return n;let i={text:n.text,sessionTitles:t},a=[],o=``,s=0,c=0,l=new Set(n.references.map(e=>e.id)),u=[];for(let e of r){let{match:t,codec:r}=e,a=t.index,o=a+t[0].length;if(a<c||n.references.some(e=>e.start<o&&e.end>a))continue;let s=r.resolveDisplay(t,i);if(s===null||s.length>A.displayLength)continue;let d=r.materialize(t,s,a),f=d.id;for(;l.has(f);)f=`materialized:${f}`;l.add(f),u.push({start:a,end:o,display:s,reference:{...d,id:f}}),c=o}s=0;let d=0;for(let e of u){o+=`${n.text.slice(s,e.start)}${e.display}`;let t=e.start+d;a.push({...e.reference,start:t,end:t+e.display.length}),d+=e.display.length-(e.end-e.start),s=e.end}if(o+=n.text.slice(s),o.length>A.visibleTextLength)return n;let f=n.references.map(e=>{let t=u.filter(t=>t.end<=e.start).reduce((e,t)=>e+t.display.length-(t.end-t.start),0);return{...e,start:e.start+t,end:e.end+t}});return F(o,[...f,...a]).document},rn=(e,t)=>nn({text:e,references:[]},t),an=(e,t)=>rn(e,t),on=(e,t,n=`
|
|
2
|
-
|
|
3
|
-
`)=>{let r=F(e.text,e.references).document,i=F(t.text,t.references).document;if(r.text===i.text&&JSON.stringify(r.references)===JSON.stringify(i.references))return i;let a=new Set(r.references.map(e=>e.id)),o=e=>{let t=e;for(;a.has(t);)t=`recovered:${t}`;return a.add(t),t},s=r.text.length+n.length;return F(`${r.text}${n}${i.text}`,[...r.references,...i.references.map(e=>({...e,id:o(e.id),start:e.start+s,end:e.end+s}))]).document},sn=e=>({state:`unbound-legacy`,sessionID:e}),L=e=>e.state===`bound`?`bound:${JSON.stringify([e.transportIdentity,ae(e.directory),e.sessionID,e.deliveryTarget??{kind:`primary`}])}`:`unbound-legacy:${JSON.stringify([e.sessionID])}`,cn=(e,t)=>e.queuedMessages[L(t)]??ln,ln=[],un=3e4,dn=`queue`,fn=e=>e===`steer`||e===`queue`,pn=(e,t)=>e===`immediate`?`steer`:fn(e)?e:t===!1?`steer`:`queue`,mn=[],hn=(e,t)=>e.pendingAdmissions[L(t)]??mn,gn=e=>`${e}-${xt()}`,_n=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===Object.prototype,R=(e,t,n=[])=>{if(!_n(e)||!Object.keys(e).every(e=>e===`text`||e===`references`))return;let r=e;if(typeof r.text!=`string`)return;let i=Ue(r.text,r.references),a=i&&$t(i,`queue-canonical`);if(!a||!a.ok||a.text!==t)return;let o=new Set(n.map(e=>e.id));return Rt(i).every(e=>o.has(e.attachmentRefID))?i:void 0},z=(e,t)=>{if(e===void 0)return[];if(!t)return;let n=Fe(t.text,e);if(n)return n.some(e=>t.references.some(t=>e.range.start<t.end&&t.start<e.range.end))?void 0:n},vn=(e,t)=>{let n=_n(e)&&typeof e.content==`string`?e:t,r=R(n.composerDocument,n.content,Array.isArray(n.attachments)?n.attachments:[]),i=z(n.composerMentions,r);return{content:n.content,...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{},...Array.isArray(n.attachments)?{attachments:n.attachments}:{},..._n(n.sendConfig)?{sendConfig:n.sendConfig}:{}}},yn=e=>vn(void 0,e),B=(e,t)=>e.queueItemID===t.queueItemID&&e.operationID===t.operationID&&(!t.messageID||e.messageID===t.messageID),V=e=>e.status===`sending`||e.status===`reconciling`,bn=ne(),xn=()=>bn?.flush()??!0,Sn=`quiescing`,Cn=new Set,wn=new Set,Tn=e=>{if(Sn!==e){Sn=e;for(let e of wn)e()}},En=e=>{if(!(!e||Cn.has(e))){Cn.add(e);for(let e of wn)e()}},Dn=e=>e.state===`bound`&&Cn.has(e.transportIdentity),H=e=>Sn===`open`&&(!e||!Dn(e)),On=(e,t=Date.now())=>({reconciliationStartedAt:e.reconciliationStartedAt??t,reconciliationDeadlineAt:e.reconciliationDeadlineAt??(e.reconciliationStartedAt??t)+un,reconciliationChecks:Math.max(0,Math.floor(e.reconciliationChecks??0))}),kn=(e,t,n)=>{let r=t.queueItemID??(t.id||gn(`queued`)),i=!t.owner&&(t.status===`sending`||t.status===`reconciling`),a=i?`unresolved`:t.status===`sending`?`reconciling`:t.status===`retrying`||t.status===`reconciling`||t.status===`unresolved`||t.status===`failed`?t.status:`queued`,o=typeof t.messageID==`string`&&t.messageID.startsWith(`msg_`)?t.messageID:vt(`msg`),s=R(t.composerDocument,t.content,t.attachments),c=z(t.composerMentions,s);return{...t,...s?{composerDocument:s}:{composerDocument:void 0},...s&&c?.length?{composerMentions:c}:{composerMentions:void 0},id:r,queueItemID:r,operationID:t.operationID??gn(`operation`),messageID:o,owner:n,status:a,attemptCount:Math.max(0,Math.floor(t.attemptCount??0)),...t.status===`sending`||t.status===`reconciling`?On(t):{},...i||a===`reconciling`&&t.status===`sending`?{failure:{kind:`ambiguous-dispatch`,recovery:vn(t.failure?.recovery,t)}}:{}}},An=e=>{let t=e??{},n={};for(let[e,r]of Object.entries(t.queuedMessages??{})){if(!Array.isArray(r))continue;let t;if(e.startsWith(`bound:`)||e.startsWith(`unbound-legacy:`)){let n=r[0],i=e.startsWith(`unbound-legacy:`)?(()=>{try{let t=JSON.parse(e.slice(15));return Array.isArray(t)&&typeof t[0]==`string`?t[0]:e}catch{return e}})():e;t=n?.owner?.state===`bound`?n.owner:sn(n?.owner?.sessionID??i)}else t=sn(e);for(let e of r){let r=e.owner?.state===`bound`?e.owner:t,i=L(r);(n[i]??=[]).push(kn(r.sessionID,e,r))}}return{queuedMessages:n,followUpBehavior:pn(t.followUpBehavior,t.queueModeEnabled??null)}},U=(e,t,n,r)=>{if(Dn(t))return;let i=L(t);e(e=>{let t=e.queuedMessages[i],a=t?.findIndex(e=>L(e.owner)===i&&B(e,n))??-1;if(a<0||!t)return e;let o=r(t[a]);if(o===t[a])return e;let s=t.slice();return s[a]=o,{queuedMessages:{...e.queuedMessages,[i]:s}}})},jn=c()(u(l((e,t)=>({queuedMessages:{},followUpBehavior:dn,pendingAdmissions:{},addToQueue:(t,n)=>{if(!H(t))return{ok:!1,reason:`invalid-composer-document`};let r=R(n.composerDocument,n.content,n.attachments);if(n.composerDocument!==void 0&&!r)return{ok:!1,reason:`invalid-composer-document`};let i=z(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return{ok:!1,reason:`invalid-composer-mentions`};n={...n,...r?{composerDocument:r}:{},...i?.length?{composerMentions:i}:{}};let a={...n,id:gn(`queued`),queueItemID:``,operationID:gn(`operation`),messageID:vt(`msg`),createdAt:Date.now(),owner:t,status:`queued`,attemptCount:0};a.queueItemID=a.id;let o=L(t);return e(e=>({queuedMessages:{...e.queuedMessages,[o]:[...e.queuedMessages[o]??[],a]}})),{ok:!0,item:a}},removeFromQueue:(n,r,i)=>{if(!H(n)||!i)return!1;let a=L(n),o=t().queuedMessages[a];if(!o||o.length===0)return!0;let s=o.find(e=>(e.queueItemID===r||e.id===r)&&L(e.owner)===a);if(s&&s.operationID!==i)return!1;let c=o.find(e=>(e.queueItemID===r||e.id===r)&&e.operationID===i&&L(e.owner)===a);return!c||!V(c)&&(e(e=>{let t=e.queuedMessages[a];if(!t)return e;let n=t.filter(e=>e!==c);if(n.length===t.length)return e;if(n.length)return{queuedMessages:{...e.queuedMessages,[a]:n}};let{[a]:r,...i}=e.queuedMessages;return{queuedMessages:i}}),!cn(t(),n).some(e=>e===c||(e.queueItemID===r||e.id===r)&&e.operationID===i))},reorderQueue:(t,n,r,i)=>{if(!H(t)||!i)return;let a=L(t);e(e=>{let t=e.queuedMessages[a],o=t?.findIndex(e=>(e.id===n||e.queueItemID===n)&&e.operationID===i&&L(e.owner)===a)??-1,s=t?.findIndex(e=>(e.id===r||e.queueItemID===r)&&L(e.owner)===a)??-1;if(!t||o<0||s<0||o===s||V(t[o])||V(t[s]))return e;let c=t.slice(),[l]=c.splice(o,1);return c.splice(s,0,l),{queuedMessages:{...e.queuedMessages,[a]:c}}})},popToInput:(e,n,r)=>{if(!H(e)||!r)return null;let i=cn(t(),e).find(t=>(t.id===n||t.queueItemID===n)&&t.operationID===r&&L(t.owner)===L(e));return!i||V(i)||!t().removeFromQueue(e,i.queueItemID,i.operationID)?null:i},clearQueue:n=>{if(!H(n))return!1;let r=L(n),i=t().queuedMessages[r],a=(t().pendingAdmissions[r]??[]).length>0;return(!i||i.length===0)&&!a||!i?.some(V)&&(e(e=>{if(e.queuedMessages[r]?.some(V))return e;let t={...e.queuedMessages},n={...e.pendingAdmissions};return delete t[r],delete n[r],{queuedMessages:t,pendingAdmissions:n}}),(t().queuedMessages[r]??[]).length===0)},clearAllQueues:()=>{H()&&e(e=>{let t={},n=!1;for(let[r,i]of Object.entries(e.queuedMessages)){if(i[0]&&Dn(i[0].owner)){t[r]=i;continue}let e=i.filter(V);e.length&&(t[r]=e),e.length!==i.length&&(n=!0)}let r=Object.keys(e.pendingAdmissions).length>0;return n||r?{queuedMessages:t,pendingAdmissions:{}}:e})},setFollowUpBehavior:t=>{H()&&(e({followUpBehavior:t}),$({followUpBehavior:t}))},getQueueForScope:e=>cn(t(),e),getPendingAdmissionsForScope:e=>hn(t(),e),stageAdmission:(t,n)=>{if(!H(t)||!n.requestID||!n.queueItemID||!n.operationID||!n.messageID||typeof n.content!=`string`)return;let r=R(n.composerDocument,n.content);if(n.composerDocument!==void 0&&!r)return;let i=z(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return;let a=L(t),o={kind:`pending-admission`,requestID:n.requestID,queueItemID:n.queueItemID,operationID:n.operationID,messageID:n.messageID,content:n.content,createdAt:n.createdAt,phase:`admitting`,attachmentCount:Math.max(0,Math.floor(n.attachmentCount??0)),...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{}};e(e=>{let t=[...(e.pendingAdmissions[a]??[]).filter(e=>e.requestID!==o.requestID&&e.queueItemID!==o.queueItemID),o];return{pendingAdmissions:{...e.pendingAdmissions,[a]:t}}})},unstageAdmission:(t,n)=>{if(!n)return;let r=L(t);e(e=>{let t=e.pendingAdmissions[r];if(!t?.length)return e;let i=t.filter(e=>e.requestID!==n);if(i.length===t.length)return e;if(i.length)return{pendingAdmissions:{...e.pendingAdmissions,[r]:i}};let{[r]:a,...o}=e.pendingAdmissions;return{pendingAdmissions:o}})},confirmAdmission:(n,r)=>{if(!H(n)||!r.requestID||!r.sendConfig?.providerID||!r.sendConfig?.modelID)return{ok:!1,reason:`invalid-composer-document`};let i=L(n),a=(t().pendingAdmissions[i]??[]).find(e=>e.requestID===r.requestID);if(!a)return{ok:!1,reason:`invalid-composer-document`};let o=R(a.composerDocument,a.content,r.attachments);if(a.composerDocument!==void 0&&!o)return{ok:!1,reason:`invalid-composer-document`};let s=z(a.composerMentions,o);if(a.composerMentions!==void 0&&!s)return{ok:!1,reason:`invalid-composer-mentions`};let c={id:a.queueItemID,queueItemID:a.queueItemID,operationID:a.operationID,messageID:a.messageID,content:a.content,createdAt:a.createdAt,owner:n,status:`queued`,attemptCount:0,sendConfig:r.sendConfig,...o?{composerDocument:o}:{},...o&&s?.length?{composerMentions:s}:{},...r.attachments?.length?{attachments:r.attachments}:{}};return e(e=>{let t=(e.pendingAdmissions[i]??[]).filter(e=>e.requestID!==r.requestID);return{pendingAdmissions:t.length?{...e.pendingAdmissions,[i]:t}:(()=>{let{[i]:t,...n}=e.pendingAdmissions;return n})(),queuedMessages:{...e.queuedMessages,[i]:[...e.queuedMessages[i]??[],c]}}}),{ok:!0,item:c}},bindLegacyQueue:(t,n)=>{if(!H(t)||!H(n)||t.state!==`unbound-legacy`||n.state!==`bound`||t.sessionID!==n.sessionID)return[];let r=L(t),i=L(n),a=[];return e(e=>{let t=e.queuedMessages[r];if(!t||(a=t.filter(e=>!V(e)),a.length===0))return e;let o=t.filter(V),s={...e.queuedMessages,[i]:[...a.map(e=>({...e,owner:n})),...e.queuedMessages[i]??[]]};return o.length?s[r]=o:delete s[r],{queuedMessages:s}}),a.map(e=>({...e,owner:n}))},markQueueItemSendAttempt:(t,n)=>{H(t)&&U(e,t,n,e=>e.status===`queued`||e.status===`retrying`&&(e.nextAttemptAt??0)<=Date.now()?{...e,status:`sending`,attemptCount:e.attemptCount+1,nextAttemptAt:void 0,failure:void 0}:e)},markQueueItemPreDispatchRetry:(t,n,r,i)=>U(e,t,n,e=>e.status===`sending`?{...e,status:`retrying`,nextAttemptAt:r,failure:{kind:`pre-dispatch`,recovery:i?.recovery??yn(e)}}:e),markQueueItemReconciling:(t,n,r)=>U(e,t,n,e=>e.status===`sending`?{...e,status:`reconciling`,nextAttemptAt:void 0,...On(e),reconciliationNextCheckAt:void 0,failure:{kind:`ambiguous-dispatch`,recovery:r?.recovery??yn(e)}}:e),recordQueueItemReconciliationCheck:(t,n)=>U(e,t,n,e=>e.status===`reconciling`&&B(e,n)?{...e,reconciliationChecks:(e.reconciliationChecks??0)+1,reconciliationNextCheckAt:Date.now()+2e3}:e),resolveQueueItemReconciliation:(t,n)=>U(e,t,n,e=>e.status===`reconciling`&&B(e,n)?{...e,status:`unresolved`,nextAttemptAt:void 0}:e),markQueueItemDefinitiveFailure:(t,n,r)=>U(e,t,n,e=>e.status===`sending`?{...e,status:`failed`,nextAttemptAt:void 0,failure:{kind:`definitive`,recovery:r?.recovery??yn(e)}}:e),resetQueueItemForDispatch:(t,n)=>{H(t)&&U(e,t,n,e=>e.status!==`failed`&&e.status!==`unresolved`&&e.status!==`retrying`?e:{...e,status:`queued`,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0})},beginQueueItemDispatch:(t,n,r,i,a=Date.now())=>{if(!H(t)||!r.startsWith(`msg_`))return null;let o=L(t),s=null;return e(e=>{let t=e.queuedMessages[o],c=i?t?.findIndex(e=>L(e.owner)===o&&B(e,n))??-1:0,l=c>=0?t?.[c]:void 0,u=l?.status===`queued`||l?.status===`retrying`&&(i||(l.nextAttemptAt??0)<=a)||i&&(l?.status===`failed`||l?.status===`unresolved`);if(!l||L(l.owner)!==o||!B(l,n)||!u||t?.some(V))return e;s={...l,messageID:r,status:`sending`,attemptCount:l.attemptCount+1,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0};let d=t.slice();return d.splice(c,1),d.unshift(s),{queuedMessages:{...e.queuedMessages,[o]:d}}}),s},confirmQueueItem:(t,n)=>{if(Dn(t))return;let r=L(t);e(e=>{let t=e.queuedMessages[r],i=t?.find(e=>{let t=!n.operationID||e.operationID===n.operationID,r=!n.messageID||e.messageID===n.messageID,i=!n.queueItemID||e.queueItemID===n.queueItemID;return t&&r&&i});if(!i||!n.operationID&&!n.messageID)return e;let a=t.filter(e=>e!==i);if(a.length)return{queuedMessages:{...e.queuedMessages,[r]:a}};let{[r]:o,...s}=e.queuedMessages;return{queuedMessages:s}})}}),{name:`message-queue-store`,version:4,storage:bn,partialize:e=>({queuedMessages:e.queuedMessages,followUpBehavior:e.followUpBehavior}),migrate:An,merge:(e,t)=>({...t,...An(e),pendingAdmissions:t.pendingAdmissions})}),{name:`message-queue-store`})),Mn=(e,t)=>{let n=jn.getState().queuedMessages,r=[],i=[];for(let[a,o]of Object.entries(n)){let n=o[0]?.owner;if(!n||n.state!==`unbound-legacy`)continue;let s=t(n.sessionID);if(!s){i.push(n.sessionID);continue}r.push({sourceKey:a,target:{state:`bound`,transportIdentity:e,directory:s,sessionID:n.sessionID},items:o})}return!e||i.length?{ok:!1,unresolvedSessionIDs:i}:r.length?(jn.setState(e=>{let t={...e.queuedMessages};for(let e of r){let n=L(e.target);t[n]=[...e.items.map(t=>({...t,owner:e.target})),...t[n]??[]],delete t[e.sourceKey]}return{queuedMessages:t}}),{ok:!0,moved:r.reduce((e,t)=>e+t.items.length,0)}):{ok:!0,moved:0}},Nn=re(),Pn=e(d(),1),Fn=`directoryTreeShowHidden`,In=`directory-show-hidden-change`,Ln=()=>{if(typeof window>`u`)return!0;try{let e=f().getItem(Fn);return e===null||e===`true`}catch{return!0}},Rn=()=>{typeof window>`u`||window.dispatchEvent(new Event(In))},zn=(e,t={})=>{if(!(typeof window>`u`)){try{f().setItem(Fn,e?`true`:`false`),Rn()}catch{}t.persist!==!1&&$({directoryShowHidden:e})}},Bn=()=>{let e=(0,Nn.c)(2),[t,n]=Pn.useState(Ln),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(Ln())};return window.addEventListener(`storage`,e),window.addEventListener(In,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(In,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Pn.useEffect(r,i),t},Vn=`filesViewShowGitignored`,Hn=`files-view-show-gitignored-change`,Un=()=>{if(typeof window>`u`)return!1;try{return f().getItem(Vn)===`true`}catch{return!1}},Wn=()=>{typeof window>`u`||window.dispatchEvent(new Event(Hn))},Gn=(e,t={})=>{if(!(typeof window>`u`)){try{f().setItem(Vn,e?`true`:`false`),Wn()}catch{}t.persist!==!1&&$({filesViewShowGitignored:e})}},Kn=()=>{let e=(0,Nn.c)(2),[t,n]=Pn.useState(Un),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(Un())};return window.addEventListener(`storage`,e),window.addEventListener(Hn,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(Hn,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Pn.useEffect(r,i),t},qn=e=>{if(!e||typeof e!=`object`)return null;let t={};return typeof e.showReasoningTraces==`boolean`&&(t.showReasoningTraces=e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&(t.collapsibleThinkingBlocks=e.collapsibleThinkingBlocks),Object.keys(t).length>0?t:null},Jn=e=>{if(!e||typeof e!=`object`)return null;let t=e;return{showReasoningTraces:t.showReasoningTraces,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks}},Yn=e=>{let t=g.getState();typeof e.showReasoningTraces==`boolean`&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks)},Xn=async()=>{if(typeof window>`u`)return null;let e=localStorage.getItem(`appearance-preferences`);if(!e)return null;try{return qn(Jn(JSON.parse(e)))}catch(e){return console.warn(`Failed to parse stored appearance preferences:`,e),null}},Zn=[{name:`explore`,icon:`compass-3`,labelKey:`chat.draftPresets.explore.label`,command:`/explore`},{name:`catch-up`,icon:`history`,labelKey:`chat.draftPresets.catchup.label`,command:`/catch-up`},{name:`weigh`,icon:`scales-3`,labelKey:`chat.draftPresets.weigh.label`,command:`/weigh`},{name:`craft-goal`,icon:`target`,labelKey:`chat.draftPresets.craftGoal.label`,command:`/craft-goal`},{name:`debug`,icon:`bug`,labelKey:`chat.draftPresets.debug.label`,command:`/debug`},{name:`review`,icon:`search-eye`,labelKey:`chat.draftPresets.review.label`,command:`/workspace-review`}],Qn=new Map(Zn.map(e=>[e.name,e])),$n=e=>Qn.get(e),er=[{type:`command`,name:`explore`},{type:`command`,name:`catch-up`},{type:`command`,name:`weigh`},{type:`command`,name:`debug`},{type:`command`,name:`review`}],tr=`terminal-box`,nr=`book-open`,rr=e=>`${e.type}:${e.name}`,ir=(e,t)=>e.type===t.type&&e.name===t.name,ar=e=>{let t=e.replace(/^\//,``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e},or=e=>{if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.type===`command`||e.type===`skill`?e.type:null,a=typeof e.name==`string`?e.name.trim():``;if(!i||!a)continue;let o=`${i}:${a}`;n.has(o)||(n.add(o),t.push({type:i,name:a}))}return t},sr=`yuri.rt.`,cr=e=>{try{return btoa(unescape(encodeURIComponent(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}catch{return encodeURIComponent(e)}},W=(e,n=t())=>`${sr}${cr(n.trim().length>0?n.trim():`default`)}.${e}`,lr=(e,n,r=t())=>e?e===W(n,r):!1,ur=()=>{if(typeof window>`u`)return!0;if(a())return o();let e=window.__YURI_API_BASE_URL__,t=window.__YURI_LOCAL_ORIGIN__;if(typeof e==`string`&&e.trim()&&typeof t==`string`&&t.trim())try{return new URL(e).origin===new URL(t).origin}catch{return!1}try{if(o())return!0}catch{}if(typeof e==`string`&&e.trim())try{let t=new URL(e).hostname;if(t!==`localhost`&&t!==`127.0.0.1`&&t!==`::1`)return!1}catch{return!1}return!0},dr=(e,n)=>{let r=n?.storage??(typeof localStorage<`u`?localStorage:{getItem:()=>null}),i=n?.transport??t(),a=r.getItem(W(e,i));return a===null?ur()?r.getItem(e):null:a},G=(e,n,r)=>{let i=r?.storage??(typeof localStorage<`u`?localStorage:{setItem:()=>void 0}),a=r?.transport??t();i.setItem(W(e,a),n)},fr=e=>{let n;try{n=te()}catch{return}let r=t=>t===null?null:JSON.parse(t,e?.reviver),i=e=>n.getItem(e);return{getItem:e=>{let n=W(e,t()),a=i(n);if(a instanceof Promise)return a.then(t=>{if(t!==null)return r(t);if(!ur())return null;let n=i(e);return n instanceof Promise?n.then(r):r(n)});if(a!==null)return r(a);if(!ur())return null;let o=i(e);return o instanceof Promise?o.then(r):r(o)},setItem:(r,i)=>{let a=W(r,t());n.setItem(a,JSON.stringify(i,e?.replacer))},removeItem:e=>{let r=W(e,t());n.removeItem(r)}}},pr=512,mr=4096,hr=64,gr=2e5,_r=[`concise`,`detailed`,`mentor`,`pushback`,`noFiller`,`matchEnergy`,`warmPeer`,`custom`],vr=[`defaultModel`,`defaultVariant`,`defaultAgent`,`autoCreateWorktree`,`gitmojiEnabled`,`defaultFileViewerPreview`,`zenModel`,`messageStreamTransport`,`sttProvider`,`sttServerUrl`,`sttModel`,`sttLocalModel`,`sttLanguage`,`responseStyleEnabled`,`responseStylePreset`,`responseStyleCustomInstructions`],yr=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype,K=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),br=(e,t)=>{if(typeof e!=`string`)return;let n=e.trim();return n.length<=t?n:void 0},xr=e=>{let t=br(e,mr);if(t!==void 0)try{let e=new URL(t);return(e.protocol===`http:`||e.protocol===`https:`)&&!e.username&&!e.password?t:void 0}catch{return}},Sr=(e,t)=>typeof e==`string`&&t.includes(e)?e:void 0,Cr=e=>typeof e==`boolean`?e:void 0,wr=(e,t)=>{let n=e[t];switch(t){case`autoCreateWorktree`:case`gitmojiEnabled`:case`defaultFileViewerPreview`:case`responseStyleEnabled`:return Cr(n);case`messageStreamTransport`:return Sr(n,[`auto`,`ws`,`sse`]);case`sttProvider`:return Sr(n,[`local`,`openai-compatible`,`volcengine`]);case`sttServerUrl`:return xr(n);case`sttLanguage`:return br(n,hr);case`responseStyleCustomInstructions`:return br(n,gr);case`responseStylePreset`:return Sr(n,_r);default:return br(n,pr)}},Tr=e=>{if(!yr(e))throw Error(`Invalid settings bootstrap response`);if(!K(e,`schemaVersion`)||e.schemaVersion!==1)throw Error(`Unsupported settings bootstrap schema version`);let t={schemaVersion:1};for(let n of vr){if(!K(e,n))continue;let r=wr(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Er=e=>{if(!yr(e))throw Error(`Invalid settings bootstrap patch`);for(let t of Object.keys(e))if(!vr.includes(t))throw Error(`Invalid settings bootstrap patch`);let t=Tr({schemaVersion:1,...e}),n={};for(let r of vr)if(K(e,r)){if(!K(t,r))throw Error(`Invalid settings bootstrap patch`);Object.assign(n,{[r]:t[r]})}return n},Dr=e=>{if(!yr(e))return{};let t={};for(let n of vr){if(!K(e,n))continue;let r=wr(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Or=async(e,t)=>{let n=new AbortController,r,i=new Promise((e,t)=>{r=t}),a=e=>{r(e),n.abort(e)},o=()=>a(e.reason??new DOMException(`Request aborted`,`AbortError`)),s=setTimeout(()=>a(new DOMException(`Configuration request timed out`,`TimeoutError`)),3e4);e.addEventListener(`abort`,o,{once:!0});try{return e.aborted?(o(),await i):await Promise.race([t(n.signal),i])}finally{clearTimeout(s),e.removeEventListener(`abort`,o)}},kr=class extends Error{status;constructor(e){super(`Settings bootstrap request failed (${e})`),this.status=e,this.name=`SettingsBootstrapRequestError`}},Ar=(e=t())=>[e,`settings`,`bootstrap`],jr=(e=t())=>({queryKey:Ar(e),queryFn:({signal:e})=>Or(e,async e=>{let t=await i(`/api/config/settings/bootstrap`,{method:`GET`,headers:{Accept:`application/json`},signal:e});if(!t.ok)throw new kr(t.status);return Tr(await t.json())}),retry:(e,t)=>!(t instanceof kr&&(t.status===404||t.status===501))&&e<1,staleTime:1/0,gcTime:1/0}),Mr=(e=t())=>ie.fetchQuery(jr(e)),Nr=(e=t())=>ie.getQueryData(Ar(e)),Pr=(e,n=t())=>{let r=Er(e),i=Ar(n),a=Tr({schemaVersion:1,...ie.getQueryData(i),...r});return ie.setQueryData(i,a),a},Fr=e=>{if(!(typeof window>`u`)&&!(typeof window.__YURI_HOME__==`string`&&window.__YURI_HOME__.length>0))try{window.__YURI_HOME__=e}catch{}},Ir=e=>{if(!(typeof window>`u`)){if(e.themeId&&G(`selectedThemeId`,e.themeId),e.themeVariant&&G(`selectedThemeVariant`,e.themeVariant),e.lightThemeId&&G(`lightThemeId`,e.lightThemeId),e.darkThemeId&&G(`darkThemeId`,e.darkThemeId),typeof e.useSystemTheme==`boolean`&&(G(`useSystemTheme`,String(e.useSystemTheme)),G(`themeMode`,e.useSystemTheme?`system`:e.themeVariant===`dark`||e.themeVariant===`light`?e.themeVariant:`system`)),e.lastDirectory&&v(`lastDirectory`,e.lastDirectory),e.homeDirectory&&(v(`homeDirectory`,e.homeDirectory),Fr(e.homeDirectory)),Array.isArray(e.projects)&&e.projects.length>0?v(`projects`,JSON.stringify(e.projects)):y(`projects`),e.activeProjectId?v(`activeProjectId`,e.activeProjectId):y(`activeProjectId`),Array.isArray(e.pinnedDirectories)&&e.pinnedDirectories.length>0?v(`pinnedDirectories`,JSON.stringify(e.pinnedDirectories)):y(`pinnedDirectories`),Array.isArray(e.projects)&&e.projects.length>0){let t=e.projects.filter(e=>e.sidebarCollapsed===!0).map(e=>e.id).filter(e=>typeof e==`string`&&e.length>0);t.length>0?v(`yuri.sessions.projectCollapse`,JSON.stringify(t)):y(`yuri.sessions.projectCollapse`)}if(typeof e.gitmojiEnabled==`boolean`?localStorage.setItem(`gitmojiEnabled`,String(e.gitmojiEnabled)):localStorage.removeItem(`gitmojiEnabled`),typeof e.directoryShowHidden==`boolean`&&localStorage.setItem(`directoryTreeShowHidden`,e.directoryShowHidden?`true`:`false`),typeof e.filesViewShowGitignored==`boolean`&&localStorage.setItem(`filesViewShowGitignored`,e.filesViewShowGitignored?`true`:`false`),typeof e.openInAppId==`string`&&e.openInAppId.length>0&&localStorage.setItem(`openInAppId`,e.openInAppId),typeof e.pwaAppName==`string`){let t=e.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);t.length>0?localStorage.setItem(`yuri.pwaName`,t):localStorage.removeItem(`yuri.pwaName`)}if(typeof e.mobileKeyboardMode==`string`&&ee(e.mobileKeyboardMode),typeof e.openCodeUpdateToastDismissedVersion==`string`){let t=e.openCodeUpdateToastDismissedVersion.trim();t?localStorage.setItem(`opencode-update-toast-dismissed-version`,t):localStorage.removeItem(`opencode-update-toast-dismissed-version`)}}},Lr=e=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`yuri:settings-synced`,{detail:e}))},Rr=e=>{if(!Array.isArray(e))return;let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.id==`string`?e.id.trim():``,a=typeof e.label==`string`?e.label.trim():``,o=typeof e.source==`string`?e.source.trim():``,s=typeof e.subpath==`string`?e.subpath.trim():``,c=typeof e.gitIdentityId==`string`?e.gitIdentityId.trim():``;!i||!a||!o||n.has(i)||(n.add(i),t.push({id:i,label:a,source:o,...s?{subpath:s}:{},...c?{gitIdentityId:c}:{}}))}return t},zr=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){let e=typeof n==`string`?n.trim():``,i=typeof r==`string`?r.trim():``;!e||!i||(t[e]=i)}return t},Br=(e,t)=>{let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)},Vr=(e,t)=>e.length===t.length&&e.every((e,n)=>e.providerID===t[n]?.providerID&&e.modelID===t[n]?.modelID&&e.variant===t[n]?.variant),Hr=(e,t)=>{if(t.length===0)return t;let n=new Map;for(let t of e)typeof t.variant==`string`&&t.variant.length>0&&n.set(`${t.providerID}/${t.modelID}`,t.variant);return t.map(e=>{if(typeof e.variant==`string`&&e.variant.length>0)return e;let t=n.get(`${e.providerID}/${e.modelID}`);return t?{providerID:e.providerID,modelID:e.modelID,variant:t}:e})},Ur=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Wr=e=>{if(Array.isArray(e))return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))},Gr=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!n||!Array.isArray(r))continue;let e=Wr(r);e&&e.length>0&&(t[n]=e.slice(0,5))}return Object.keys(t).length>0?t:void 0},Kr=(e,t)=>{let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Array.isArray(t[n])&&Ur(e[n],t[n]))},qr=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,Jr=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t&&qr.test(t)?t.toLowerCase():null},Yr=e=>{if(!Array.isArray(e))return;let t=[],n=new Set,r=new Set;for(let i of e){if(!i||typeof i!=`object`)continue;let e=i,a=typeof e.path==`string`?e.path.trim():``;if(!a)continue;let o=a===`/`?a:a.replace(/\\/g,`/`).replace(/\/+$/,``);if(!o)continue;let s=yt(o);if(!s||n.has(s)||r.has(o))continue;n.add(s),r.add(o);let c={id:s,path:o};if(typeof e.label==`string`&&e.label.trim().length>0&&(c.label=e.label.trim()),typeof e.icon==`string`&&e.icon.trim().length>0&&(c.icon=e.icon.trim()),e.iconImage===null)c.iconImage=null;else if(e.iconImage&&typeof e.iconImage==`object`){let t=e.iconImage,n=typeof t.mime==`string`?t.mime.trim():``,r=typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt)?Math.max(0,Math.round(t.updatedAt)):0,i=t.source===`custom`||t.source===`auto`?t.source:null;n&&r>0&&i&&(c.iconImage={mime:n,updatedAt:r,source:i})}if(typeof e.color==`string`&&e.color.trim().length>0&&(c.color=e.color.trim()),e.iconBackground===null)c.iconBackground=null;else{let t=Jr(e.iconBackground);t&&(c.iconBackground=t)}typeof e.addedAt==`number`&&Number.isFinite(e.addedAt)&&e.addedAt>=0&&(c.addedAt=e.addedAt),typeof e.lastOpenedAt==`number`&&Number.isFinite(e.lastOpenedAt)&&e.lastOpenedAt>=0&&(c.lastOpenedAt=e.lastOpenedAt),typeof e.sidebarCollapsed==`boolean`&&(c.sidebarCollapsed=e.sidebarCollapsed),t.push(c)}return t.length>0?t:void 0},Xr=(e,t,n)=>{if(!Array.isArray(e))return;let r=[],i=new Set,a=n?.preserveVariant===!0;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,o=typeof e.providerID==`string`?e.providerID.trim():``,s=typeof e.modelID==`string`?e.modelID.trim():``;if(!o||!s)continue;let c=`${o}/${s}`;if(!i.has(c)&&(i.add(c),a&&typeof e.variant==`string`&&e.variant.trim().length>0?r.push({providerID:o,modelID:s,variant:e.variant.trim()}):r.push({providerID:o,modelID:s}),r.length>=t))break}return r},Zr=()=>{let e=g.persist;if(e&&typeof e==`object`)return e},Qr=()=>s()?.settings??null,$r=(e,t,n)=>{let r={...Dr(t),...Dr(e)};if(Object.keys(r).length!==0)try{Pr(r,n)}catch(e){console.warn(`Failed to patch settings bootstrap cache:`,e)}},ei=e=>{let t=g.getState(),n=typeof window<`u`?window.__zustand_config_store__?.getState?.()??null:null,r=jn.getState();if(typeof e.showReasoningTraces==`boolean`&&e.showReasoningTraces!==t.showReasoningTraces&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.sessionTitleRefreshEnabled==`boolean`&&e.sessionTitleRefreshEnabled!==t.sessionTitleRefreshEnabled&&t.setSessionTitleRefreshEnabled(e.sessionTitleRefreshEnabled),typeof e.sessionGoalEnabled==`boolean`&&e.sessionGoalEnabled!==t.sessionGoalEnabled&&t.setSessionGoalEnabled(e.sessionGoalEnabled),typeof e.collapsibleThinkingBlocks==`boolean`&&e.collapsibleThinkingBlocks!==t.collapsibleThinkingBlocks&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks),typeof e.autoDeleteEnabled==`boolean`&&e.autoDeleteEnabled!==t.autoDeleteEnabled&&t.setAutoDeleteEnabled(e.autoDeleteEnabled),typeof e.autoDeleteAfterDays==`number`&&Number.isFinite(e.autoDeleteAfterDays)){let n=Math.max(1,Math.min(365,e.autoDeleteAfterDays));n!==t.autoDeleteAfterDays&&t.setAutoDeleteAfterDays(n)}(e.sessionRetentionAction===`archive`||e.sessionRetentionAction===`delete`)&&e.sessionRetentionAction!==t.sessionRetentionAction&&t.setSessionRetentionAction(e.sessionRetentionAction);let i=null;if(fn(e.followUpBehavior)?i=e.followUpBehavior:typeof e.queueModeEnabled==`boolean`&&(i=pn(void 0,e.queueModeEnabled)),i&&i!==r.followUpBehavior&&r.setFollowUpBehavior(i),typeof e.showDeletionDialog==`boolean`&&e.showDeletionDialog!==t.showDeletionDialog&&t.setShowDeletionDialog(e.showDeletionDialog),typeof e.nativeNotificationsEnabled==`boolean`&&e.nativeNotificationsEnabled!==t.nativeNotificationsEnabled&&t.setNativeNotificationsEnabled(e.nativeNotificationsEnabled),typeof e.notificationMode==`string`&&(e.notificationMode===`always`||e.notificationMode===`hidden-only`)&&e.notificationMode!==t.notificationMode&&t.setNotificationMode(e.notificationMode),typeof e.notifyOnSubtasks==`boolean`&&e.notifyOnSubtasks!==t.notifyOnSubtasks&&t.setNotifyOnSubtasks(e.notifyOnSubtasks),typeof e.notifyOnCompletion==`boolean`&&e.notifyOnCompletion!==t.notifyOnCompletion&&t.setNotifyOnCompletion(e.notifyOnCompletion),typeof e.notifyOnError==`boolean`&&e.notifyOnError!==t.notifyOnError&&t.setNotifyOnError(e.notifyOnError),typeof e.notifyOnQuestion==`boolean`&&e.notifyOnQuestion!==t.notifyOnQuestion&&t.setNotifyOnQuestion(e.notifyOnQuestion),typeof e.notifyOnPermission==`boolean`&&e.notifyOnPermission!==t.notifyOnPermission&&t.setNotifyOnPermission(e.notifyOnPermission),typeof e.notifyOnScheduledTasks==`boolean`&&e.notifyOnScheduledTasks!==t.notifyOnScheduledTasks&&t.setNotifyOnScheduledTasks(e.notifyOnScheduledTasks),typeof e.notifyOnAssistants==`boolean`&&e.notifyOnAssistants!==t.notifyOnAssistants&&t.setNotifyOnAssistants(e.notifyOnAssistants),typeof e.notifyOnGoals==`boolean`&&e.notifyOnGoals!==t.notifyOnGoals&&t.setNotifyOnGoals(e.notifyOnGoals),e.notificationTemplates&&typeof e.notificationTemplates==`object`&&t.setNotificationTemplates(e.notificationTemplates),typeof e.summarizeLastMessage==`boolean`&&e.summarizeLastMessage!==t.summarizeLastMessage&&t.setSummarizeLastMessage(e.summarizeLastMessage),typeof e.summaryThreshold==`number`&&Number.isFinite(e.summaryThreshold)&&t.setSummaryThreshold(e.summaryThreshold),typeof e.summaryLength==`number`&&Number.isFinite(e.summaryLength)&&t.setSummaryLength(e.summaryLength),typeof e.maxLastMessageLength==`number`&&Number.isFinite(e.maxLastMessageLength)&&t.setMaxLastMessageLength(e.maxLastMessageLength),typeof e.inputSpellcheckEnabled==`boolean`&&e.inputSpellcheckEnabled!==t.inputSpellcheckEnabled&&t.setInputSpellcheckEnabled(e.inputSpellcheckEnabled),typeof e.showOpenCodeUpdateNotifications==`boolean`&&e.showOpenCodeUpdateNotifications!==t.showOpenCodeUpdateNotifications&&t.setShowOpenCodeUpdateNotifications(e.showOpenCodeUpdateNotifications),typeof e.showToolFileIcons==`boolean`&&e.showToolFileIcons!==t.showToolFileIcons&&t.setShowToolFileIcons(e.showToolFileIcons),typeof e.showTurnChangedFiles==`boolean`&&e.showTurnChangedFiles!==t.showTurnChangedFiles&&t.setShowTurnChangedFiles(e.showTurnChangedFiles),typeof e.showExpandedBashTools==`boolean`&&e.showExpandedBashTools!==t.showExpandedBashTools&&t.setShowExpandedBashTools(e.showExpandedBashTools),typeof e.showSubagentTaskDetails==`boolean`&&e.showSubagentTaskDetails!==t.showSubagentTaskDetails&&t.setShowSubagentTaskDetails(e.showSubagentTaskDetails),typeof e.timeFormatPreference==`string`&&(e.timeFormatPreference===`auto`||e.timeFormatPreference===`12h`||e.timeFormatPreference===`24h`)&&e.timeFormatPreference!==t.timeFormatPreference&&t.setTimeFormatPreference(e.timeFormatPreference),typeof e.weekStartPreference==`string`&&(e.weekStartPreference===`auto`||e.weekStartPreference===`sunday`||e.weekStartPreference===`monday`)&&e.weekStartPreference!==t.weekStartPreference&&t.setWeekStartPreference(e.weekStartPreference),typeof e.desktopWindowControlsPosition==`string`&&(e.desktopWindowControlsPosition===`auto`||e.desktopWindowControlsPosition===`left`||e.desktopWindowControlsPosition===`right`)&&e.desktopWindowControlsPosition!==t.desktopWindowControlsPosition&&t.setDesktopWindowControlsPosition(e.desktopWindowControlsPosition),typeof e.chatRenderMode==`string`&&(e.chatRenderMode===`sorted`||e.chatRenderMode===`live`)&&e.chatRenderMode!==t.chatRenderMode&&t.setChatRenderMode(e.chatRenderMode),typeof e.activityRenderMode==`string`&&(e.activityRenderMode===`collapsed`||e.activityRenderMode===`summary`)&&e.activityRenderMode!==t.activityRenderMode&&t.setActivityRenderMode(e.activityRenderMode),typeof e.collapsibleUserMessages==`boolean`&&e.collapsibleUserMessages!==t.collapsibleUserMessages&&t.setCollapsibleUserMessages(e.collapsibleUserMessages),typeof e.messageStreamTransport==`string`&&(e.messageStreamTransport===`auto`||e.messageStreamTransport===`ws`||e.messageStreamTransport===`sse`)&&n&&e.messageStreamTransport!==n.settingsMessageStreamTransport&&n.setSettingsMessageStreamTransport(e.messageStreamTransport),typeof e.promptNavigatorEnabled==`boolean`&&e.promptNavigatorEnabled!==t.promptNavigatorEnabled&&t.setPromptNavigatorEnabled(e.promptNavigatorEnabled),typeof e.showSplitAssistantMessageActions==`boolean`&&e.showSplitAssistantMessageActions!==t.showSplitAssistantMessageActions&&t.setShowSplitAssistantMessageActions(e.showSplitAssistantMessageActions),typeof e.showAssistantTps==`boolean`&&e.showAssistantTps!==t.showAssistantTps&&t.setShowAssistantTps(e.showAssistantTps),typeof e.reportUsage==`boolean`&&e.reportUsage!==t.reportUsage&&t.setReportUsage(e.reportUsage),typeof e.fontSize==`number`&&Number.isFinite(e.fontSize)&&e.fontSize!==t.fontSize&&t.setFontSize(e.fontSize),Array.isArray(e.draftStarters)){let n=or(e.draftStarters);JSON.stringify(t.globalDraftStarters)!==JSON.stringify(n)&&t.setGlobalDraftStarters(n)}if(typeof e.terminalFontSize==`number`&&Number.isFinite(e.terminalFontSize)&&e.terminalFontSize!==t.terminalFontSize&&t.setTerminalFontSize(e.terminalFontSize),typeof e.editorFontSize==`number`&&Number.isFinite(e.editorFontSize)&&e.editorFontSize!==t.editorFontSize&&t.setEditorFontSize(e.editorFontSize),m(e.uiFont)&&e.uiFont!==t.uiFont&&t.setUiFont(e.uiFont),h(e.monoFont)&&e.monoFont!==t.monoFont&&t.setMonoFont(e.monoFont),typeof e.padding==`number`&&Number.isFinite(e.padding)&&e.padding!==t.padding&&t.setPadding(e.padding),typeof e.cornerRadius==`number`&&Number.isFinite(e.cornerRadius)&&e.cornerRadius!==t.cornerRadius&&t.setCornerRadius(e.cornerRadius),typeof e.inputBarOffset==`number`&&Number.isFinite(e.inputBarOffset)&&e.inputBarOffset!==t.inputBarOffset&&t.setInputBarOffset(e.inputBarOffset),e.shortcutOverrides&&!Br(e.shortcutOverrides,t.shortcutOverrides)&&g.setState({shortcutOverrides:e.shortcutOverrides}),typeof e.mobileKeyboardMode==`string`){let n=p(e.mobileKeyboardMode,t.mobileKeyboardMode);n!==t.mobileKeyboardMode&&t.setMobileKeyboardMode(n)}if(Array.isArray(e.favoriteModels)){let n=t.favoriteModels,r=Hr(n,e.favoriteModels);Vr(n,r)||g.setState({favoriteModels:r})}if(Array.isArray(e.hiddenModels)){let n=t.hiddenModels,r=e.hiddenModels;Vr(n,r)||g.setState({hiddenModels:r})}if(Array.isArray(e.collapsedModelProviders)){let n=t.collapsedModelProviders,r=e.collapsedModelProviders;Ur(n,r)||g.setState({collapsedModelProviders:r})}if(Array.isArray(e.recentModels)){let n=t.recentModels,r=Hr(n,e.recentModels);Vr(n,r)||g.setState({recentModels:r})}if(Array.isArray(e.recentAgents)){let n=t.recentAgents,r=e.recentAgents;Ur(n,r)||g.setState({recentAgents:r})}if(e.recentEfforts&&typeof e.recentEfforts==`object`){let n=t.recentEfforts,r=e.recentEfforts;Kr(n,r)||g.setState({recentEfforts:r})}typeof e.diffLayoutPreference==`string`&&(e.diffLayoutPreference===`dynamic`||e.diffLayoutPreference===`inline`||e.diffLayoutPreference===`side-by-side`)&&e.diffLayoutPreference!==t.diffLayoutPreference&&t.setDiffLayoutPreference(e.diffLayoutPreference),typeof e.gitChangesViewMode==`string`&&(e.gitChangesViewMode===`flat`||e.gitChangesViewMode===`tree`)&&e.gitChangesViewMode!==t.gitChangesViewMode&&t.setGitChangesViewMode(e.gitChangesViewMode),typeof e.directoryShowHidden==`boolean`&&zn(e.directoryShowHidden,{persist:!1}),typeof e.filesViewShowGitignored==`boolean`&&Gn(e.filesViewShowGitignored,{persist:!1})},ti=e=>{if(!e||typeof e!=`object`)return null;let t=e,n={};if(typeof t.themeId==`string`&&t.themeId.length>0&&(n.themeId=t.themeId),(t.useSystemTheme===!0||t.useSystemTheme===!1)&&(n.useSystemTheme=t.useSystemTheme),typeof t.themeVariant==`string`&&(t.themeVariant===`light`||t.themeVariant===`dark`)&&(n.themeVariant=t.themeVariant),typeof t.lightThemeId==`string`&&t.lightThemeId.length>0&&(n.lightThemeId=t.lightThemeId),typeof t.darkThemeId==`string`&&t.darkThemeId.length>0&&(n.darkThemeId=t.darkThemeId),typeof t.lastDirectory==`string`&&t.lastDirectory.length>0&&(n.lastDirectory=t.lastDirectory),typeof t.homeDirectory==`string`&&t.homeDirectory.length>0&&(n.homeDirectory=t.homeDirectory),typeof t.opencodeBinary==`string`){let e=t.opencodeBinary.trim();n.opencodeBinary=e.length>0?e:void 0}typeof t.desktopLanAccessEnabled==`boolean`&&(n.desktopLanAccessEnabled=t.desktopLanAccessEnabled),typeof t.desktopKeepAwakeEnabled==`boolean`&&(n.desktopKeepAwakeEnabled=t.desktopKeepAwakeEnabled),typeof t.desktopMinimizeToTrayEnabled==`boolean`&&(n.desktopMinimizeToTrayEnabled=t.desktopMinimizeToTrayEnabled);let r=Yr(t.projects);if([`manual`,`a-z`,`z-a`,`date-added`,`recent`].includes(t.projectSortOrder)&&(n.projectSortOrder=t.projectSortOrder),r&&(n.projects=r),typeof t.activeProjectId==`string`&&t.activeProjectId.length>0&&(n.activeProjectId=t.activeProjectId),Array.isArray(t.securityScopedBookmarks)&&(n.securityScopedBookmarks=t.securityScopedBookmarks.filter(e=>typeof e==`string`&&e.length>0)),Array.isArray(t.pinnedDirectories)&&(n.pinnedDirectories=Array.from(new Set(t.pinnedDirectories.filter(e=>typeof e==`string`&&e.length>0)))),Array.isArray(t.draftStarters)&&(n.draftStarters=or(t.draftStarters)),typeof t.draftStartersCraftGoalAdded==`boolean`&&(n.draftStartersCraftGoalAdded=t.draftStartersCraftGoalAdded),typeof t.showReasoningTraces==`boolean`&&(n.showReasoningTraces=t.showReasoningTraces),typeof t.sessionTitleRefreshEnabled==`boolean`&&(n.sessionTitleRefreshEnabled=t.sessionTitleRefreshEnabled),typeof t.sessionGoalEnabled==`boolean`&&(n.sessionGoalEnabled=t.sessionGoalEnabled),typeof t.collapsibleThinkingBlocks==`boolean`&&(n.collapsibleThinkingBlocks=t.collapsibleThinkingBlocks),typeof t.autoDeleteEnabled==`boolean`&&(n.autoDeleteEnabled=t.autoDeleteEnabled),typeof t.autoDeleteAfterDays==`number`&&Number.isFinite(t.autoDeleteAfterDays)&&(n.autoDeleteAfterDays=t.autoDeleteAfterDays),(t.sessionRetentionAction===`archive`||t.sessionRetentionAction===`delete`)&&(n.sessionRetentionAction=t.sessionRetentionAction),typeof t.defaultModel==`string`&&t.defaultModel.length>0&&(n.defaultModel=t.defaultModel),typeof t.defaultVariant==`string`&&t.defaultVariant.length>0&&(n.defaultVariant=t.defaultVariant),typeof t.defaultAgent==`string`&&t.defaultAgent.length>0&&(n.defaultAgent=t.defaultAgent),typeof t.smallModelUseDefault==`boolean`&&(n.smallModelUseDefault=t.smallModelUseDefault),typeof t.smallModelOverride==`string`&&t.smallModelOverride.length>0&&(n.smallModelOverride=t.smallModelOverride),(t.summaryModelMode===`provider`||t.summaryModelMode===`custom`)&&(n.summaryModelMode=t.summaryModelMode),typeof t.summaryProviderID==`string`&&t.summaryProviderID.length>0&&(n.summaryProviderID=t.summaryProviderID),typeof t.summaryModelID==`string`&&t.summaryModelID.length>0&&(n.summaryModelID=t.summaryModelID),typeof t.summaryCustomModelID==`string`&&t.summaryCustomModelID.length>0&&(n.summaryCustomModelID=t.summaryCustomModelID),typeof t.summaryCustomBaseURL==`string`&&(n.summaryCustomBaseURL=t.summaryCustomBaseURL),typeof t.hasSummaryCustomAPIToken==`boolean`&&(n.hasSummaryCustomAPIToken=t.hasSummaryCustomAPIToken),typeof t.summaryCommitPrompt==`string`&&(n.summaryCommitPrompt=t.summaryCommitPrompt),typeof t.summarySessionTitlePrompt==`string`&&(n.summarySessionTitlePrompt=t.summarySessionTitlePrompt),typeof t.autoCreateWorktree==`boolean`&&(n.autoCreateWorktree=t.autoCreateWorktree),typeof t.gitmojiEnabled==`boolean`&&(n.gitmojiEnabled=t.gitmojiEnabled),fn(t.followUpBehavior)?n.followUpBehavior=t.followUpBehavior:typeof t.queueModeEnabled==`boolean`&&(n.followUpBehavior=pn(void 0,t.queueModeEnabled)),typeof t.showDeletionDialog==`boolean`&&(n.showDeletionDialog=t.showDeletionDialog),typeof t.nativeNotificationsEnabled==`boolean`&&(n.nativeNotificationsEnabled=t.nativeNotificationsEnabled),typeof t.notificationMode==`string`&&(t.notificationMode===`always`||t.notificationMode===`hidden-only`)&&(n.notificationMode=t.notificationMode),typeof t.notifyOnSubtasks==`boolean`&&(n.notifyOnSubtasks=t.notifyOnSubtasks),typeof t.notifyOnCompletion==`boolean`&&(n.notifyOnCompletion=t.notifyOnCompletion),typeof t.notifyOnError==`boolean`&&(n.notifyOnError=t.notifyOnError),typeof t.notifyOnQuestion==`boolean`&&(n.notifyOnQuestion=t.notifyOnQuestion),typeof t.notifyOnPermission==`boolean`&&(n.notifyOnPermission=t.notifyOnPermission),typeof t.notifyOnScheduledTasks==`boolean`&&(n.notifyOnScheduledTasks=t.notifyOnScheduledTasks),typeof t.notifyOnAssistants==`boolean`&&(n.notifyOnAssistants=t.notifyOnAssistants),typeof t.notifyOnGoals==`boolean`&&(n.notifyOnGoals=t.notifyOnGoals),t.notificationTemplates&&typeof t.notificationTemplates==`object`){let e=t.notificationTemplates,r=t=>{let n=e[t];if(!n||typeof n!=`object`)return;let r=n;return{title:typeof r.title==`string`?r.title:``,message:typeof r.message==`string`?r.message:``}},i=r(`completion`),a=r(`error`),o=r(`question`),s=r(`subtask`);(i||a||o||s)&&(n.notificationTemplates={completion:i??{title:`Task Complete`,message:`Your task has finished.`},error:a??{title:`Error Occurred`,message:`An error occurred while processing your task.`},question:o??{title:`Input Needed`,message:`Please provide input to continue.`},subtask:s??{title:`Subtask Complete`,message:`A subtask has finished.`}})}if(typeof t.summarizeLastMessage==`boolean`&&(n.summarizeLastMessage=t.summarizeLastMessage),typeof t.summaryThreshold==`number`&&Number.isFinite(t.summaryThreshold)&&(n.summaryThreshold=Math.max(0,Math.round(t.summaryThreshold))),typeof t.summaryLength==`number`&&Number.isFinite(t.summaryLength)&&(n.summaryLength=Math.max(10,Math.round(t.summaryLength))),typeof t.maxLastMessageLength==`number`&&Number.isFinite(t.maxLastMessageLength)&&(n.maxLastMessageLength=Math.max(10,Math.round(t.maxLastMessageLength))),typeof t.usageAutoRefresh==`boolean`&&(n.usageAutoRefresh=t.usageAutoRefresh),typeof t.usageRefreshIntervalMs==`number`&&Number.isFinite(t.usageRefreshIntervalMs)&&(n.usageRefreshIntervalMs=t.usageRefreshIntervalMs),(t.usageDisplayMode===`usage`||t.usageDisplayMode===`remaining`)&&(n.usageDisplayMode=t.usageDisplayMode),typeof t.usageShowPredValues==`boolean`&&(n.usageShowPredValues=t.usageShowPredValues),Array.isArray(t.usageDropdownProviders)&&(n.usageDropdownProviders=t.usageDropdownProviders.filter(e=>typeof e==`string`&&e.length>0)),typeof t.magpieUsageUrl==`string`&&(n.magpieUsageUrl=t.magpieUsageUrl),Array.isArray(t.magpieHiddenProviders)&&(n.magpieHiddenProviders=t.magpieHiddenProviders.filter(e=>typeof e==`string`&&e.startsWith(`magpie:`))),t.usageSelectedModels&&typeof t.usageSelectedModels==`object`){let e={};for(let[n,r]of Object.entries(t.usageSelectedModels))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageSelectedModels=e)}if(t.usageCollapsedFamilies&&typeof t.usageCollapsedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageCollapsedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageCollapsedFamilies=e)}if(t.usageExpandedFamilies&&typeof t.usageExpandedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageExpandedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageExpandedFamilies=e)}if(t.usageModelGroups&&typeof t.usageModelGroups==`object`){let e={};for(let[n,r]of Object.entries(t.usageModelGroups))if(r&&typeof r==`object`){let t=r,i={};Array.isArray(t.customGroups)&&(i.customGroups=t.customGroups.filter(e=>e&&typeof e==`object`).map(e=>({id:String(e.id??``),label:String(e.label??``),models:Array.isArray(e.models)?e.models.filter(e=>typeof e==`string`):[],order:typeof e.order==`number`?e.order:0}))),t.modelAssignments&&typeof t.modelAssignments==`object`&&(i.modelAssignments=Object.fromEntries(Object.entries(t.modelAssignments).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),t.renamedGroups&&typeof t.renamedGroups==`object`&&(i.renamedGroups=Object.fromEntries(Object.entries(t.renamedGroups).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),Object.keys(i).length>0&&(e[n]=i)}Object.keys(e).length>0&&(n.usageModelGroups=e)}typeof t.inputSpellcheckEnabled==`boolean`&&(n.inputSpellcheckEnabled=t.inputSpellcheckEnabled),typeof t.showOpenCodeUpdateNotifications==`boolean`&&(n.showOpenCodeUpdateNotifications=t.showOpenCodeUpdateNotifications),typeof t.openCodeUpdateToastDismissedVersion==`string`&&(n.openCodeUpdateToastDismissedVersion=t.openCodeUpdateToastDismissedVersion.trim().slice(0,128)),typeof t.showToolFileIcons==`boolean`&&(n.showToolFileIcons=t.showToolFileIcons),typeof t.showTurnChangedFiles==`boolean`&&(n.showTurnChangedFiles=t.showTurnChangedFiles),typeof t.showExpandedBashTools==`boolean`&&(n.showExpandedBashTools=t.showExpandedBashTools),typeof t.showSubagentTaskDetails==`boolean`&&(n.showSubagentTaskDetails=t.showSubagentTaskDetails),typeof t.timeFormatPreference==`string`&&(t.timeFormatPreference===`auto`||t.timeFormatPreference===`12h`||t.timeFormatPreference===`24h`)&&(n.timeFormatPreference=t.timeFormatPreference),typeof t.weekStartPreference==`string`&&(t.weekStartPreference===`auto`||t.weekStartPreference===`sunday`||t.weekStartPreference===`monday`)&&(n.weekStartPreference=t.weekStartPreference),typeof t.desktopWindowControlsPosition==`string`&&(t.desktopWindowControlsPosition===`auto`||t.desktopWindowControlsPosition===`left`||t.desktopWindowControlsPosition===`right`)&&(n.desktopWindowControlsPosition=t.desktopWindowControlsPosition),typeof t.chatRenderMode==`string`&&(t.chatRenderMode===`sorted`||t.chatRenderMode===`live`)&&(n.chatRenderMode=t.chatRenderMode),typeof t.messageStreamTransport==`string`&&(t.messageStreamTransport===`auto`||t.messageStreamTransport===`ws`||t.messageStreamTransport===`sse`)&&(n.messageStreamTransport=t.messageStreamTransport),typeof t.activityRenderMode==`string`&&(t.activityRenderMode===`collapsed`||t.activityRenderMode===`summary`)&&(n.activityRenderMode=t.activityRenderMode),typeof t.collapsibleUserMessages==`boolean`&&(n.collapsibleUserMessages=t.collapsibleUserMessages),typeof t.showSplitAssistantMessageActions==`boolean`&&(n.showSplitAssistantMessageActions=t.showSplitAssistantMessageActions),typeof t.showAssistantTps==`boolean`&&(n.showAssistantTps=t.showAssistantTps),typeof t.fontSize==`number`&&Number.isFinite(t.fontSize)&&(n.fontSize=t.fontSize),typeof t.terminalFontSize==`number`&&Number.isFinite(t.terminalFontSize)&&(n.terminalFontSize=t.terminalFontSize),typeof t.editorFontSize==`number`&&Number.isFinite(t.editorFontSize)&&(n.editorFontSize=t.editorFontSize),m(t.uiFont)&&(n.uiFont=t.uiFont),h(t.monoFont)&&(n.monoFont=t.monoFont),typeof t.padding==`number`&&Number.isFinite(t.padding)&&(n.padding=t.padding),typeof t.cornerRadius==`number`&&Number.isFinite(t.cornerRadius)&&(n.cornerRadius=t.cornerRadius),typeof t.inputBarOffset==`number`&&Number.isFinite(t.inputBarOffset)&&(n.inputBarOffset=t.inputBarOffset);let i=zr(t.shortcutOverrides);i&&(n.shortcutOverrides=i),typeof t.mobileKeyboardMode==`string`&&(t.mobileKeyboardMode===`native`||t.mobileKeyboardMode===`resize-content`)&&(n.mobileKeyboardMode=t.mobileKeyboardMode);let a=Xr(t.favoriteModels,64,{preserveVariant:!0});a&&(n.favoriteModels=a);let o=Xr(t.hiddenModels,1024);o&&(n.hiddenModels=o);let s=Wr(t.collapsedModelProviders);s&&(n.collapsedModelProviders=s);let c=Xr(t.recentModels,16,{preserveVariant:!0});c&&(n.recentModels=c);let l=Wr(t.recentAgents);l&&(n.recentAgents=l);let u=Gr(t.recentEfforts);if(u&&(n.recentEfforts=u),typeof t.diffLayoutPreference==`string`&&(t.diffLayoutPreference===`dynamic`||t.diffLayoutPreference===`inline`||t.diffLayoutPreference===`side-by-side`)&&(n.diffLayoutPreference=t.diffLayoutPreference),typeof t.gitChangesViewMode==`string`&&(t.gitChangesViewMode===`flat`||t.gitChangesViewMode===`tree`)&&(n.gitChangesViewMode=t.gitChangesViewMode),typeof t.directoryShowHidden==`boolean`&&(n.directoryShowHidden=t.directoryShowHidden),typeof t.filesViewShowGitignored==`boolean`&&(n.filesViewShowGitignored=t.filesViewShowGitignored),typeof t.openInAppId==`string`&&t.openInAppId.length>0&&(n.openInAppId=t.openInAppId),typeof t.pwaAppName==`string`){let e=t.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);n.pwaAppName=e.length>0?e:``}let d=Rr(t.skillCatalogs);return d&&(n.skillCatalogs=d),typeof t.reportUsage==`boolean`&&(n.reportUsage=t.reportUsage),typeof t.globalBehaviorPrompt==`string`&&(n.globalBehaviorPrompt=t.globalBehaviorPrompt),typeof t.responseStyleEnabled==`boolean`&&(n.responseStyleEnabled=t.responseStyleEnabled),typeof t.responseStylePreset==`string`&&(t.responseStylePreset===`concise`||t.responseStylePreset===`detailed`||t.responseStylePreset===`mentor`||t.responseStylePreset===`pushback`||t.responseStylePreset===`noFiller`||t.responseStylePreset===`matchEnergy`||t.responseStylePreset===`warmPeer`||t.responseStylePreset===`custom`)&&(n.responseStylePreset=t.responseStylePreset),typeof t.responseStyleCustomInstructions==`string`&&(n.responseStyleCustomInstructions=t.responseStyleCustomInstructions),typeof t.dictationEnabled==`boolean`&&(n.dictationEnabled=t.dictationEnabled),t.sttProvider===`local`||t.sttProvider===`openai-compatible`||t.sttProvider===`volcengine`?n.sttProvider=t.sttProvider:t.sttProvider===`server`?n.sttProvider=`openai-compatible`:(t.sttProvider===`browser`||t.sttProvider===`wasm`)&&(n.sttProvider=`local`),typeof t.sttServerUrl==`string`&&(n.sttServerUrl=t.sttServerUrl.trim()),typeof t.sttModel==`string`&&(n.sttModel=t.sttModel.trim()),typeof t.sttLocalModel==`string`&&(n.sttLocalModel=t.sttLocalModel.trim()),typeof t.sttLanguage==`string`&&(n.sttLanguage=t.sttLanguage.trim()),n},q=new Map,ni=new Map,ri=2e3,ii=async e=>{let n=q.get(e);if(n&&Date.now()-n.at<ri)return n.value;let r=ni.get(e);if(r)return r;let a=(async()=>{if(t()!==e)return null;let n=Qr();if(n)try{let t=ti((await n.load()).settings);return q.set(e,{value:t,at:Date.now()}),t}catch(e){console.warn(`Failed to load shared settings from runtime settings API:`,e)}if(t()!==e)return null;try{let t=await i(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return null;let n=ti(await t.json().catch(()=>null));return q.set(e,{value:n,at:Date.now()}),n}catch(e){return console.warn(`Failed to load shared settings from server:`,e),null}})();ni.set(e,a);try{return await a}finally{ni.get(e)===a&&ni.delete(e)}},ai=(e=t())=>{q.delete(e)},oi=async()=>{if(typeof window>`u`)return;let e=t(),n=Zr(),r=()=>!n?.hasHydrated||n.hasHydrated()||!n.onFinishHydration?Promise.resolve():new Promise(e=>{let t=!1,r=()=>{t||(t=!0,e())},i=n.onFinishHydration(()=>{i?.(),r()});n.hasHydrated?.()&&r()}),i=async n=>{if(await r(),t()===e){try{Ir(n)}catch(e){console.warn(`persistToLocalStorage failed:`,e)}try{ei(n)}catch(e){console.warn(`applyDesktopUiPreferences failed:`,e)}Lr(n)}};try{let n=await ii(e);n&&t()===e&&await i(n)}catch(e){console.warn(`Failed to synchronise settings:`,e)}},J=null,Y=null,X=null,Z=[],si=200,Q=new Map,ci=async e=>{for(;Q.get(e)?.size;)await Promise.all([...Q.get(e)])},li=async()=>{let e=J,n=Y,r=Z;if(J=null,Y=null,X=null,Z=[],!e||!n||Object.keys(e).length===0){r.forEach(e=>e());return}if(t()!==n){r.forEach(e=>e());return}let a=()=>t()===n,o=Qr();if(o){try{let t=await o.save(e);$r(t,e,n),t&&a()&&(Ir(t),ei(t),Lr(t),q.set(n,{value:ti(t),at:Date.now()})),r.forEach(e=>e());return}catch(e){console.warn(`Failed to update settings via runtime settings API:`,e)}if(!a()){r.forEach(e=>e());return}}try{let t=await i(`/api/config/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(e)});if(!t.ok){console.warn(`Failed to update shared settings via API:`,t.status,t.statusText);return}let r=await t.json().catch(()=>null);$r(r,e,n),r&&a()&&(Ir(r),ei(r),Lr(r),q.set(n,{value:ti(r),at:Date.now()}))}catch(e){console.warn(`Failed to update shared settings via API:`,e)}finally{r.forEach(e=>e())}},$=async e=>{if(typeof window>`u`)return;let n=t();if(Y&&Y!==n){X&&=(clearTimeout(X),null),J=null,Y=null;let e=Z;Z=[],e.forEach(e=>e())}let r={...J??{}},i=q.get(n)?.value;for(let[t,n]of Object.entries(e)){let e=i?.[t];Object.is(n,e)||n!==void 0&&e!==void 0&&JSON.stringify(n)===JSON.stringify(e)?delete r[t]:r[t]=n}if(J=r,Y=n,Object.keys(r).length===0&&!X){J=null,Y=null;return}X&&clearTimeout(X);let a=new Promise(e=>{Z.push(e)}),o=Q.get(n)??new Set;Q.set(n,o),o.add(a),X=setTimeout(()=>void li(),si);try{await a}finally{o.delete(a),o.size===0&&Q.get(n)===o&&Q.delete(n)}},ui=async()=>{if(typeof window>`u`)return;let e=Zr();try{let t=await Xn();if(!t)return;let n=()=>Yn(t);if(e?.hasHydrated?.()){n();return}if(n(),e?.onFinishHydration){let t=e.onFinishHydration(()=>{t?.(),n()})}}catch(e){console.warn(`Failed to load appearance preferences:`,e)}},di={startingApi:`Starting OpenCode API…`,initializing:`Initializing…`,connecting:`Connecting…`,connectingRemote:`Connecting to remote instance…`,connected:`Connected!`,connectionError:`Connection error`,disconnected:`Disconnected`,reconnecting:`Reconnecting…`,initialDataLoadFailed:`OpenCode connected, but initial data load failed.`,cliNotFound:`OpenCode CLI not found. Please install it first.`,providersReady:`✓ Providers`,providersLoading:`… Providers`,agentsReady:`✓ Agents`,agentsLoading:`… Agents`,startingDevServer:e=>`Starting webview dev server (${e})...`,waitingDevServer:(e,t)=>`Waiting for webview dev server (${e})... attempt ${t}`,loadingData:(e,t)=>`Loading data (${e}, ${t})…`},fi={startingApi:`Démarrage de l’API OpenCode…`,initializing:`Initialisation…`,connecting:`Connexion…`,connectingRemote:`Connexion à l’instance distante…`,connected:`Connecté !`,connectionError:`Erreur de connexion`,disconnected:`Déconnecté`,reconnecting:`Reconnexion…`,initialDataLoadFailed:`OpenCode est connecté, mais le chargement initial des données a échoué.`,cliNotFound:`L’interface en ligne de commande OpenCode est introuvable. Veuillez l’installer d’abord.`,providersReady:`✓ Fournisseurs`,providersLoading:`… Fournisseurs`,agentsReady:`✓ Agents`,agentsLoading:`… Agents`,startingDevServer:e=>`Démarrage du serveur de développement de la webview (${e})...`,waitingDevServer:(e,t)=>`En attente du serveur de développement de la webview (${e})... tentative ${t}`,loadingData:(e,t)=>`Chargement des données (${e}, ${t})…`},pi={startingApi:`正在启动 OpenCode API…`,initializing:`正在初始化…`,connecting:`正在连接…`,connectingRemote:`正在连接远程实例…`,connected:`已连接!`,connectionError:`连接错误`,disconnected:`已断开连接`,reconnecting:`正在重新连接…`,initialDataLoadFailed:`OpenCode 已连接,但初始数据加载失败。`,cliNotFound:`未找到 OpenCode CLI。请先安装它。`,providersReady:`✓ 提供商`,providersLoading:`… 提供商`,agentsReady:`✓ Agent`,agentsLoading:`… Agent`,startingDevServer:e=>`正在启动 webview 开发服务器 (${e})...`,waitingDevServer:(e,t)=>`正在等待 webview 开发服务器 (${e})... 第 ${t} 次尝试`,loadingData:(e,t)=>`正在加载数据 (${e}, ${t})…`},mi={startingApi:`正在啟動 OpenCode API…`,initializing:`正在初始化…`,connecting:`正在連線…`,connectingRemote:`正在連線至遠端執行個體…`,connected:`已連線!`,connectionError:`連線錯誤`,disconnected:`已中斷連線`,reconnecting:`正在重新連線…`,initialDataLoadFailed:`OpenCode 已連線,但初始資料載入失敗。`,cliNotFound:`找不到 OpenCode CLI。請先安裝。`,providersReady:`✓ 提供者`,providersLoading:`… 提供者`,agentsReady:`✓ 代理`,agentsLoading:`… 代理`,startingDevServer:e=>`正在啟動 webview 開發伺服器 (${e})...`,waitingDevServer:(e,t)=>`正在等待 webview 開發伺服器 (${e})... 第 ${t} 次嘗試`,loadingData:(e,t)=>`正在載入資料 (${e}, ${t})…`},hi={startingApi:`Запуск OpenCode API…`,initializing:`Ініціалізація…`,connecting:`Підключення…`,connectingRemote:`Підключення до віддаленого екземпляра…`,connected:`Підключено!`,connectionError:`Помилка підключення`,disconnected:`Відключено`,reconnecting:`Повторне підключення…`,initialDataLoadFailed:`OpenCode підключено, але початкове завантаження даних не вдалося.`,cliNotFound:`OpenCode CLI не знайдено. Спершу встановіть його.`,providersReady:`✓ Провайдери`,providersLoading:`… Провайдери`,agentsReady:`✓ Агенти`,agentsLoading:`… Агенти`,startingDevServer:e=>`Запуск dev-сервера webview (${e})...`,waitingDevServer:(e,t)=>`Очікування dev-сервера webview (${e})... спроба ${t}`,loadingData:(e,t)=>`Завантаження даних (${e}, ${t})…`},gi={startingApi:`Iniciando la API de OpenCode…`,initializing:`Inicializando…`,connecting:`Conectando…`,connectingRemote:`Conectando con la instancia remota…`,connected:`¡Conectado!`,connectionError:`Error de conexión`,disconnected:`Desconectado`,reconnecting:`Reconectando…`,initialDataLoadFailed:`OpenCode se conectó, pero falló la carga inicial de datos.`,cliNotFound:`No se encontró OpenCode CLI. Instálalo primero.`,providersReady:`✓ Proveedores`,providersLoading:`… Proveedores`,agentsReady:`✓ Agentes`,agentsLoading:`… Agentes`,startingDevServer:e=>`Iniciando el servidor de desarrollo de webview (${e})...`,waitingDevServer:(e,t)=>`Esperando el servidor de desarrollo de webview (${e})... intento ${t}`,loadingData:(e,t)=>`Cargando datos (${e}, ${t})…`},_i={startingApi:`Iniciando a API do OpenCode…`,initializing:`Inicializando…`,connecting:`Conectando…`,connectingRemote:`Conectando à instância remota…`,connected:`Conectado!`,connectionError:`Erro de conexão`,disconnected:`Desconectado`,reconnecting:`Reconectando…`,initialDataLoadFailed:`OpenCode conectado, mas o carregamento inicial dos dados falhou.`,cliNotFound:`OpenCode CLI não encontrado. Instale-o primeiro.`,providersReady:`✓ Provedores`,providersLoading:`… Provedores`,agentsReady:`✓ Agentes`,agentsLoading:`… Agentes`,startingDevServer:e=>`Iniciando o servidor de desenvolvimento da webview (${e})...`,waitingDevServer:(e,t)=>`Aguardando o servidor de desenvolvimento da webview (${e})... tentativa ${t}`,loadingData:(e,t)=>`Carregando dados (${e}, ${t})…`},vi={startingApi:`OpenCode API 시작 중…`,initializing:`초기화 중…`,connecting:`연결 중…`,connectingRemote:`원격 인스턴스에 연결 중…`,connected:`연결됨!`,connectionError:`연결 오류`,disconnected:`연결 끊김`,reconnecting:`다시 연결 중…`,initialDataLoadFailed:`OpenCode에 연결되었지만 초기 데이터 로드에 실패했습니다.`,cliNotFound:`OpenCode CLI를 찾을 수 없습니다. 먼저 설치하세요.`,providersReady:`✓ 공급자`,providersLoading:`… 공급자`,agentsReady:`✓ 에이전트`,agentsLoading:`… 에이전트`,startingDevServer:e=>`webview 개발 서버 시작 중 (${e})...`,waitingDevServer:(e,t)=>`webview 개발 서버 대기 중 (${e})... ${t}번째 시도`,loadingData:(e,t)=>`데이터 로드 중 (${e}, ${t})…`},yi={startingApi:`Uruchamianie API OpenCode…`,initializing:`Inicjalizacja…`,connecting:`Łączenie…`,connectingRemote:`Łączenie ze zdalną instancją…`,connected:`Połączono!`,connectionError:`Błąd połączenia`,disconnected:`Rozłączono`,reconnecting:`Ponowne łączenie…`,initialDataLoadFailed:`OpenCode połączony, ale początkowe ładowanie danych nie powiodło się.`,cliNotFound:`Nie znaleziono OpenCode CLI. Najpierw go zainstaluj.`,providersReady:`✓ Dostawcy`,providersLoading:`… Dostawcy`,agentsReady:`✓ Agenci`,agentsLoading:`… Agenci`,startingDevServer:e=>`Uruchamianie serwera deweloperskiego webview (${e})...`,waitingDevServer:(e,t)=>`Oczekiwanie na serwer deweloperski webview (${e})... próba ${t}`,loadingData:(e,t)=>`Ładowanie danych (${e}, ${t})…`},bi={startingApi:`OpenCode API を起動中…`,initializing:`初期化中…`,connecting:`接続中…`,connectingRemote:`リモートインスタンスに接続中…`,connected:`接続完了!`,connectionError:`接続エラー`,disconnected:`切断されました`,reconnecting:`再接続中…`,initialDataLoadFailed:`OpenCode に接続しましたが、初期データの読み込みに失敗しました。`,cliNotFound:`OpenCode CLI が見つかりません。先にインストールしてください。`,providersReady:`✓ プロバイダ`,providersLoading:`… プロバイダ`,agentsReady:`✓ エージェント`,agentsLoading:`… エージェント`,startingDevServer:e=>`Webview 開発サーバーを起動中 (${e})...`,waitingDevServer:(e,t)=>`Webview 開発サーバーを待機中 (${e})... 試行 ${t}`,loadingData:(e,t)=>`データを読み込み中 (${e}, ${t})…`},xi=e=>Si[e],Si={en:di,fr:fi,"zh-CN":pi,"zh-TW":mi,uk:hi,es:gi,"pt-BR":_i,ko:vi,pl:yi,ja:bi},Ci=()=>oe();export{Rt as $,Bn as A,Se as At,Wt as B,$n as C,je as Ct,rr as D,Ue as Dt,or as E,Ce as Et,En as F,pe as Ft,an as G,Kt as H,Mn as I,he as It,Jt as J,on as K,L,y as Lt,hn as M,_e as Mt,cn as N,ge as Nt,Gn as O,Fe as Ot,sn as P,_ as Pt,Mt as Q,Tn as R,v as Rt,nr as S,Ae as St,ir as T,ze as Tt,nn as U,Yt as V,rn as W,$t as X,Zt as Y,F as Z,W as _,Ze as _t,oi as a,Qe as at,tr as b,Re as bt,Mr as c,rt as ct,Or as d,k as dt,Bt as et,Dr as f,nt as ft,dr as g,x as gt,ur as h,tt as ht,ai as i,_t as it,xn as j,Te as jt,Kn as k,Xe as kt,Pr as l,O as lt,lr as m,et as mt,Ci as n,yt as nt,$ as o,$e as ot,fr as p,ct as pt,Qt as q,ui as r,vt as rt,ci as s,D as st,xi as t,xt as tt,Nr as u,at as ut,G as v,we as vt,ar as w,De as wt,er as x,Oe as xt,Zn as y,ke as yt,jn as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-DEZ1K7qW.js";import{T as r}from"./desktop-BAmoc_34.js";import{a as i,i as a,r as o}from"./vendor-zustand-vDaAPGfl.js";import{ot as s,st as c}from"./vendor-base-ui-CzHs0bHY.js";import{bt as l,kt as u}from"./gitApiHttp-MWsHNHuo.js";import{r as d,x as f}from"./useUIStore-BerIUSLP.js";import{A as p,k as m}from"./bootstrap-C8paoQ0j.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{i as g}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as ee,r as _,u as te}from"./button-C-gRcs_2.js";import{$r as v,Kr as y,Qn as b,St as x,V as S,Wi as ne,Zn as C,_a as re,ea as ie,ft as ae,ki as oe,p as w,va as T,w as E,x as D}from"./useMobileNavigationStore-BOlo2VUm.js";import{a as se,g as O,o as ce,p as le,s as ue}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as k}from"./AgentAvatar-DLzcNrQ0.js";import{n as A}from"./Icon-OJf0qBKf.js";import{g as j,v as M}from"./gitApi-Dw-LR3UG.js";import{c as de,d as fe,l as pe,n as me,r as he,t as ge}from"./fileMentionTouchSelection-ByaQJcTS.js";import{n as _e}from"./textarea-BHgcxJdC.js";import{f as ve,o as N}from"./projectMeta-KP9BgEIm.js";var ye=(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=O([...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)},be=(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&&e.agentName===r.agentName}),P=(e,t)=>e.highlightedIndex===t.highlightedIndex&&be(e.rows,t.rows),F=(e,t)=>be(e,t)?e:t.slice(),xe=(e,t,n)=>{e&&(t.current&&P(t.current,n)||(t.current=n,e(n)))},Se=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},I=e(c(),1),L=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},R=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,z=(e,t)=>{let n=L(t),r=L(e);if(!n||!r)return!1;let i=R(n),a=R(r);return a===i||a.startsWith(`${i}/`)},Ce=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=L(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=>L(e)).filter(e=>z(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>L(e)).filter(e=>z(e,t)))):[],s=typeof i.selectedPath==`string`?L(i.selectedPath):null,c=s&&z(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},B=(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},V=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},we=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=L((t||``).trim()),a=L((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(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:B({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=e=>R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=R(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:B({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=L((t||``).trim()),a=n?L(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:B({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=L((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=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(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:B({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=L((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>L((e||``).trim())).filter(e=>e&&z(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=V(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:f(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Ce(t)}},partialize:e=>({byRoot:Ce(e.byRoot)})}),{name:`files-view-tabs-store`})),H=h(),Te=(e,t)=>{let n=(0,H.c)(4),r=t===void 0?200:t,[i,a]=I.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]),I.useEffect(o,s),i},Ee=()=>{let e=(0,H.c)(17),t=w(De),n=x(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=E(r),a=w(Oe),o=w(ke),s=T(Ae),c=T(je),u=l(Me);if(t){let r;e[2]===i?r=e[3]:(r=D(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 u??void 0};function De(e){return e.currentSessionId}function Oe(e){return e.worktreeMetadata}function ke(e){return e.newSessionDraft}function Ae(e){return e.activeProjectId}function je(e){return e.projects}function Me(e){return e.currentDirectory}var U=s(),W=`bg-transparent font-[inherit] text-[var(--primary-base)]`,G=(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,U.jsx)(`mark`,{className:W,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},K=I.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),f=Ee()??``,h=w(e=>e.currentSessionId),b=v(e=>e.activeSessions),x=S({enabled:!!i}),C=T(e=>e.activeProjectId),re=T(e=>e.projects),ae=I.useMemo(()=>re.find(e=>e.id===C)?.path??null,[C,re]),E=I.useMemo(()=>{let e=ae||f;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[ae,f]),D=we(e=>E?e.byRoot[E]:void 0),O=oe(e=>e.agents),j=u(e=>e.searchFiles),M=Te(e,180),fe=p(),pe=m(),[ve,N]=I.useState([]),[ye,be]=I.useState(!1),[P,F]=I.useState(0),L=I.useRef(0),R=I.useRef({query:e,directory:f,ids:[]}),[z,Ce]=I.useState(360),[B,V]=I.useState({}),[H,De]=I.useState({}),Oe=I.useRef([]),ke=I.useRef([]),Ae=I.useRef([]),je=I.useRef(null),Me=I.useRef(null),W=I.useRef(null);W.current||=ge();let K=d(e=>e.isMobile),q=(e??``).trim(),J=ie({directory:f||null}),Ne=I.useMemo(()=>r?J.data??[]:[],[r,J.data]),Pe=I.useMemo(()=>{if(!E||!D)return[];let e=[D.selectedPath,...D.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(`${E}/`)?e.slice(E.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return ue(n,q,{limit:6})},[q,E,D]),Fe=I.useMemo(()=>n?ne(O).filter(e=>e.mode!==`primary`):[],[O,n]),Y=I.useMemo(()=>i?se({sessions:y(b,x),currentSessionId:h,searchQuery:q}):[],[b,h,x,q,i]),Ie=Pe,Le=ve,X=I.useMemo(()=>de({skills:Ne,agents:Fe,sessions:Y,recentFiles:Ie,pathHits:Le,searchQuery:q,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Ne,Fe,Y,Ie,Le,q,l]);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!je.current||je.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),I.useEffect(()=>{if(!f){N([]);return}let e=(M??``).trim(),t=le(e);if(!t){N([]);return}let n=!1;be(!0);let r={includeHidden:fe,respectGitignore:!pe};return Promise.all([j(f,t,80,{...r,type:`file`}),j(f,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Pe.map(e=>e.path));N(ce({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||N([])}).finally(()=>{n||be(!1)}),()=>{n=!0}},[f,M,Pe,j,fe,pe]),I.useLayoutEffect(()=>{let t=R.current,n=t.ids[L.current],r=t.query===e&&t.directory===f?Math.max(0,X.findIndex(e=>e.id===n)):0;R.current={query:e,directory:f,ids:X.map(e=>e.id)},L.current=r,F(r)},[X,e,f]),I.useEffect(()=>{V({}),De({})},[X]),I.useEffect(()=>{Oe.current[P]?.scrollIntoView({block:`nearest`})},[P]),I.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ke.current.forEach((n,r)=>{if(!n)return;let i=Ae.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}}),V(e),De(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[X]),I.useEffect(()=>{let e=ke.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Ce(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let Re=g(e=>{t(e)}),ze=g(e=>{n?.(e)}),Be=g(e=>{i?.(e)}),Ve=g(e=>{r?.(e)}),He=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&W.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&W.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(W.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>W.current?.pointerCancel(),onClick:()=>{W.current?.click(t)},onMouseMove:()=>{L.current=e,F(e)}}),Ue=e=>{let t=X.length;if(t===0)return;let n=(e%t+t)%t,r=X[n];if(r.agentName!==void 0){ze(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Ne.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Ve(e);return}if(r.id.startsWith(`session:`)){let e=Y.find(e=>r.id===`session:${e.id}`);e&&Be(e);return}let i=r.id.startsWith(`recent:`)?Ie.find(e=>r.id===`recent:${e.path}`):Le.find(e=>r.id===`file:${e.path}`);i&&Re(i)};I.useEffect(()=>{xe(s,Me,{rows:X,highlightedIndex:P})},[s,P,X]);let We=I.useRef(s);return We.current=s,I.useEffect(()=>()=>{Se(We.current,Me)},[]),I.useImperativeHandle(c,()=>({acceptIndex:e=>{Ue(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=X.length;if(t!==0){if(e===`ArrowDown`){L.current=(L.current+1)%t,F(L.current);return}if(e===`ArrowUp`){L.current=(L.current-1+t)%t,F(L.current);return}(e===`Enter`||e===`Tab`)&&Ue(L.current)}}})),(0,U.jsxs)(me,{ref:je,isMobile:K,className:`max-w-[640px] max-h-64`,style:o,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,U.jsxs)(`div`,{className:`py-1`,children:[X.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?te(e.title,{maxLength:60}):e.title,i=P===t,a=B[t]??!1,o=H[t]??2.6;return(0,U.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Oe.current[t]=e},className:_(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,he(K,i),!K&&i&&`text-interactive-selection-foreground`),...He(t,()=>Ue(t)),children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,U.jsx)(A,{name:e.iconName,className:`size-3.5 text-current`}):(0,U.jsx)(k,{name:e.agentName,size:20})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{ref:e=>{ke.current[t]=e},className:_(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${z}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,U.jsx)(`span`,{ref:e=>{Ae.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,U.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:G(e.title,q)}):(0,U.jsx)(`span`,{className:`block truncate`,children:G(r,q)})]}),e.trailingLabel?(0,U.jsx)(`span`,{className:_(`max-w-[40%] shrink-0 truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,U.jsx)(`div`,{className:_(`truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:G(e.subtitle,q)}):null]})]},e.id)}),ye&&Le.length===0?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ye&&X.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),q=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),J=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&q.has(n))},Ne=(e,t)=>!e||t({name:e}),Pe=` `,Fe=(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]===Pe&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Y=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ie=_(Y,`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)]`),Le=_(Y,`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)]`),X=_(Y,`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)]`),Re=_(Y,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ze=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Be=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},Ve=I.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),f=d(e=>e.isMobile),p=w(e=>e.currentSessionId),m=w(e=>!!e.newSessionDraft?.open),h=w(I.useCallback(e=>p?e.getDirectoryForSession(p):void 0,[p])),g=ae(p??``,h??void 0),te=I.useMemo(()=>s??{sessionID:p??null,hasMessages:g.length>0,hasNewDraft:m},[s,p,g.length,m]),{hasSession:v,canStartSessionCommand:y}=I.useMemo(()=>Be(te),[te]),b=te.hasMessages,[x,S]=I.useState([]),[ne,C]=I.useState(!1),ie=re({directory:i}),oe=I.useMemo(()=>ie.data??[],[ie.data]),T=ie.isFetching,[E,D]=I.useState(0),se=I.useRef(0),O=I.useRef(!1),ce=I.useRef([]),le=I.useRef(null),ue=I.useRef(!1),k=I.useRef(null),j=I.useRef(!1),M=I.useRef(null);I.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]),I.useEffect(()=>{(async()=>{C(T);try{let t=oe.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:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...t],i=!b,a=ye(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>ze(e,a)?e:a)}catch{let t=!b,n=ye([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>ze(e,n)?e:n)}finally{C(!1)}})()},[e,b,v,y,oe,T,u,o]),I.useEffect(()=>{D(0)},[x]),I.useEffect(()=>{se.current=E},[E]),I.useEffect(()=>{ce.current[E]?.scrollIntoView({block:`nearest`})},[E]),I.useEffect(()=>{xe(c,M,{rows:pe(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:E})},[x,c,E,u]);let de=I.useRef(c);de.current=c,I.useEffect(()=>()=>{Se(de.current,M)},[]),I.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,J(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){O.current=!0,D(e=>(e+1)%r);return}if(e===`ArrowUp`){O.current=!0,D(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(se.current%r+r)%r,i=x[n];i&&t(i,J(i,e===`Enter`))}}}}),[x,n,t]);let ge=e=>{let t=fe(e);switch(e.name){case`new`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,U.jsxs)(me,{ref:le,isMobile:f,className:`max-w-[450px] max-h-64`,style:a,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:ne?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,U.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,U.jsxs)(`div`,{ref:e=>{ce.current[r]=e},className:_(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,f?`items-center`:`items-start`,he(f,r===E),!f&&r===E&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(k.current={x:e.clientX,y:e.clientY},j.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!k.current)return;let t=e.clientX-k.current.x,n=e.clientY-k.current.y;Math.hypot(t,n)>6&&(j.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=j.current;k.current=null,j.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),ue.current=!0,t(n,J(n,f)))},onPointerCancel:()=>{k.current=null,j.current=!1},onClick:()=>{if(ue.current){ue.current=!1;return}t(n,J(n,f))},onMouseMove:()=>{O.current=!1,D(r)},children:[(0,U.jsx)(`div`,{className:_(!f&&`mt-0.5`),children:ge(n)}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,G(n.name,e)]}),n.isSkill?(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,U.jsx)(`span`,{className:Re,children:`Yuri`}):i?(0,U.jsx)(`span`,{className:Re,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,U.jsx)(`span`,{className:n.scope===`project`?X:Le,children:n.scope}):null,n.agent&&(0,U.jsx)(`span`,{className:Re,children:n.agent})]}),n.description&&!f&&(0,U.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:G(n.description,e)})]})]},n.id)}),x.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!f&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Ve.displayName=`CommandAutocomplete`;var He=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,Ue=1e4,We=6e4,Ge=5e3,Ke=3e4,qe=6e4,Je=25,Ye=40,Xe=2,Ze=15e3,Qe=500,$e=30,et=20971520,tt=new Map,nt=new Map,rt=new Map,it=new Map,at=new Map,ot=new Map,st=new WeakMap,ct=e=>{let t=st.get(e);return t||(t=new Set(e.files.map(e=>e.path)),st.set(e,t)),t},lt=(e,t)=>`${t}:${e}`,ut=e=>nt.get(e)??0,dt=e=>{let t=ut(e)+1;return nt.set(e,t),t},ft=e=>{let t=(rt.get(e)??0)+1;return rt.set(e,t),t},pt=e=>{let t=tt.get(e);if(t)return t;let n=new Set;return tt.set(e,n),n},Z=()=>({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}),mt=(e,t=$e,n=et)=>{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},ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,gt=e=>{let t=e?.trim()??``;return t===`?`?``:t},_t=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),gt(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&>(t.index)!==gt(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),gt(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},vt=e=>!e||e.trim().length===0,yt=e=>(e||``).trim()===`U`,bt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},xt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},St=e=>vt(e.index)&&vt(e.working_dir),Q=i()(o((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&dt(r),n&&dt(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Z()),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=lt(n,a),s=it.get(o)??(a===`light`?it.get(lt(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||=Z(),!a){let r=new Map(t().directories),i=r.get(n)??Z();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)>We,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),d=t().directories.get(n)??Z(),f=ot.get(n),p=f?.received===u&&f.stored===d.status?null:_t(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&dt(n);let m={...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:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),ot.set(n,{received:u,stored:m})}else{ot.set(n,{received:u,stored:d.status});let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();it.set(o,c);try{return await c}finally{it.get(o)===c&&it.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`?bt(e):xt(e);t!==e&&(l=!0),St(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=ft(r);{let n=new Map(t().directories),i=n.get(r)??Z();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await b(r,i,void 0,o):await C(r,i,void 0,o);if(s!==rt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Z();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(He(i)||console.error(`Failed to fetch git branches:`,i),s!==rt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Z();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)??Z();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)??Z();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)??Z();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();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)??Z();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=Z();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>Ue||!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)??Z(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=mt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{dt(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,Je);await t().prefetchDiffs(e,n,i,{maxFiles:Je})},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=Ye}=a,c=Math.min(Math.max(1,s),$e),l=ct(o.status),u=o.status.diffStats,d=pt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Qe||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=ut(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,ee=[],_=()=>{let e=g;return g+=1,e<m.length?m[e]:null},te=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Ze}ms`)),Ze)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},v=async()=>{for(;;){if(h!==ut(n))return;let e=_();if(!e)return;try{ee.push(await te(e))}catch{}finally{d.delete(e)}}},y=Math.min(Xe,m.length);if(await Promise.allSettled(Array.from({length:y},()=>v())),m.forEach(e=>d.delete(e)),h!==ut(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let S=new Map(x.diffCache),ne=Date.now();ee.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:ne})});let C=mt(S);b.set(n,{...x,diffCache:C}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Z();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<Ge||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=at.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)>=Ge)&&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>=Ke)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=Ue)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=qe)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return at.set(e,i),i.finally(()=>{at.get(e)===i&&at.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Ct=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),Q(n)},wt=e=>{let r=(0,H.c)(3),i=I.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],Q(a)},Tt=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),Q(n)},Et=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),Q(n)},Dt=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),Q(n)},Ot=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=I.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),Q(i)},kt=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),Q(n)},At=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),Q(n)},jt=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),Q(n)},Mt=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)}},$=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),Nt=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),Pt=async e=>{let t=await ve(e);try{let n=Mt((await j(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await M(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Ft=async(e,t)=>{let n=await Pt(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},It=async(e,t,n)=>{let r=Nt(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Ft(e,r):i&&$(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:$(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},Lt=async(e,t,n)=>{let r=await It(e.path,t,n);return N(e,r)},Rt=`yuri:lastWorktreeSourceBranch`,zt=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Bt=({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},Vt=(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?` `:``}`},Ht=(e,t,n)=>{let r=Vt(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Ut=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Ht(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}},Wt=(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]},Gt=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Ne as C,we as D,Te as E,F as O,Fe as S,Ee as T,Ot as _,Rt as a,Et as b,Lt as c,Dt as d,wt as f,Tt as g,kt as h,Ht as i,Pt as l,At as m,Wt as n,Bt as o,jt as p,Ut as r,zt as s,Gt as t,It as u,Ct as v,K as w,Ve as x,Q as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-DYwORO8C.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D0YWp3FJ.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-base-ui-CzHs0bHY.js","assets/gitApiHttp-MWsHNHuo.js","assets/desktop-BAmoc_34.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BerIUSLP.js","assets/bootstrap-C8paoQ0j.js","assets/vendor-react-DlzBev0S.js","assets/queryRuntime-2dx7jbt9.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/runtime-file-resource-BP4P52ry.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-sEg2IOLZ.js","assets/capgoAdapter-CmkP4lqS.js","assets/types-DWyP764A.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-C-gRcs_2.js","assets/store-OjrIiXCx.js","assets/tour-DDI0Zg7l.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-Duya4-qV.js","assets/MobileDetailNavigation-D107--jY.js","assets/useMobileNavigationStore-BOlo2VUm.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/Icon-OJf0qBKf.js","assets/AgentAvatar-DLzcNrQ0.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-3UseH0hM.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-Dw-LR3UG.js","assets/useAppFontEffects-J3RrHTRd.js","assets/desktopHosts-BLU1tGSX.js","assets/desktopRelayRestore-2BIIs8mZ.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-BrJBzET8.js","assets/input-CmLlZdeD.js","assets/tooltip-Degmpxnd.js","assets/pwa-BbBJQBpm.js","assets/MobileResizableSheet-DuAi_epR.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-J8r9SxHt.js","assets/device-w1ioiqv3.js","assets/textarea-BHgcxJdC.js","assets/OverlayScrollbar-CZD1yU06.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-KP9BgEIm.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/YuriLogo-CMUoGUHc.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Cq5yavoC.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-LrqUcxJk.js","assets/useDictation-DFVJpRbm.js","assets/LoadingImage-sZ5omN5L.js","assets/ImageLoadingPlaceholder-DlQbo9CM.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-ByaQJcTS.js","assets/insertionBoundaries-9KJWoqup.js","assets/appThemeRegistry-z9y3dowq.js","assets/queue-abort-optimistic-BaOXtqLx.js","assets/MarkdownRenderer-64YkD1Ct.js","assets/useEffectiveDirectory-D1ga92jj.js","assets/markdownHeightCache-xNkQdlqi.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-BRrU2ivL.js","assets/useWorkerHighlightedLines-DNj4Aa0S.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CiP6RIQa.js","assets/speechSettingsQueries-CufXiLkn.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-VhgGU_te.js","assets/useFontPreferences-CEK8G_Ps.js","assets/terminalApi-BMWW_0wH.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-CqhuzKJa.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-BZSAqZuN.js","assets/usePluginsStore-GuZu61OT.js","assets/collapsible-B7esGYLd.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/projectActions-BX0cjZoq.js","assets/AssistantContactStatus-9chQCNlQ.js","assets/assistant-attachment-cache-oatc8F4t.js","assets/runtimeEndpointReset-C6j5YkJj.js","assets/YuriWordmark-DHYo0FlR.js","assets/mobileBackNavigation-Bgo8TriP.js","assets/AssistantUnreadBadge-DzZgExBt.js","assets/context-menu-DWn1nSZC.js","assets/readiness-BYqlQeMk.js","assets/native-errors-06if6eu-.js","assets/appearance--vFosLNi.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BP4JwHFJ.css","assets/SettingsView-By8wQ0io.js","assets/native-config-ZqHOJ6fS.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-BYFnku1a.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-BykPaQeY.js","assets/vendor-yaml-C9KlJAlj.js","assets/AssistantView-D6y9ECO7.js","assets/touch-gestures-CErgaXZ7.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-DHfmlFCj.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./runtimeConfig-DL4uXM0C.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */window.__YURI_RUNTIME_APIS__=e(),t(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-DYwORO8C.js`);return{renderMobileApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164])).then(({renderMobileApp:t})=>{t(window.__YURI_RUNTIME_APIS__??e())});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t}from"./desktop-BAmoc_34.js";import{a as n,r}from"./vendor-zustand-vDaAPGfl.js";import{ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{At as o,In as s,Vn as c,bt as l}from"./gitApiHttp-MWsHNHuo.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{r as u}from"./useUIStore-BerIUSLP.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{u as f}from"./fileQueries-C2Rs6TPz.js";import{i as p}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as m,i as h,r as g,t as _,y as v}from"./button-C-gRcs_2.js";import{$r as y,Bi as b,Cr as x,Hi as S,Nr as C,br as w,f as T,ki as ee,p as E,ri as D,va as O,yr as k}from"./useMobileNavigationStore-BOlo2VUm.js";import{n as A}from"./Icon-OJf0qBKf.js";import{n as te}from"./gitApi-Dw-LR3UG.js";import{t as j}from"./checkbox-BrJBzET8.js";import{t as ne}from"./input-CmLlZdeD.js";import{i as re,n as M,t as ie}from"./tooltip-Degmpxnd.js";import{a as ae}from"./device-w1ioiqv3.js";import{a as oe,b as se,c as N,f as P,h as F,l as I,o as L,p as R,r as z,w as ce,x as B,y as le}from"./insertionBoundaries-9KJWoqup.js";import{a as V,c as ue,d as H,i as U,n as de,o as W,r as G,s as fe,t as pe}from"./select-J8r9SxHt.js";import{r as K,t as me}from"./textarea-BHgcxJdC.js";import{a as q,f as J,h as he,i as Y,m as ge,n as _e}from"./projectMeta-KP9BgEIm.js";import{n as ve,r as ye,t as be}from"./collapsible-B7esGYLd.js";var X=e(a(),1),xe=d(),Se=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Ce=/^g[1-9]\d*$/,Z=(e,t,n,r,i)=>{if(!Se.test(e)||t!==void 0&&!Ce.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}},we=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 Z(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Ce.test(e)?Z(n,e,r,i,void 0):Z(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?Z(n,void 0,i,a,o):Z(n,r,i,a,o)},Te=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(`/`)},Q=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Ee=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),De=(e,t)=>`${Ee(e)}-${Ee(t)}`.substring(0,60),Oe=(e,t)=>`${e}/${t}`,ke=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Ae=(e,t)=>{let n=ke(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};c(e.id,n),E.getState().markSessionAsYuriCreated(e.id),y.getState().upsertSession(i);try{s().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},je=()=>{let e=O.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=l.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Me=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:s}=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 c=je();if(!c)return e({error:`Select a project`,isLoading:!1}),null;let l=c.path,u=await te(l)&&t.isolateRuns!==!1,d=Ee(n),f=u?await J(l):void 0,p=u?await I(l):null,m=[],h=s?.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 s=new Map;for(let g of n.models){let n=`${g.providerID}:${g.modelID}`,_=a.get(n)||1,v=(s.get(n)||0)+1;s.set(n,v);let y=De(g.providerID,g.modelID),b=r.length>1?`g${e+1}`:void 0,x=_>1?Oe(d,`${y}/${v}`):Oe(d,y),S=b?`${b}/${x}`:x,T=Te({groupSlug:d,runGroup:b,providerID:g.providerID,modelID:g.modelID,index:_>1?v:void 0});try{if(!u){let e=await o.withDirectory(l,()=>o.createSession({title:T}));Ae(e,l),m.push({sessionId:e.id,worktreePath:l,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i});continue}let e=await N(c,{preferredName:S,mode:`new`,branchName:S,worktreeName:S,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:h,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await w(c)&&await C(e.path);let r=await o.withDirectory(e.path,()=>o.createSession({title:T}));Ae(r,e.path),E.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=s?.filter(e=>e.trim().length>0)??[];g.length>0&&x(c,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 y=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{await Promise.allSettled(m.map(async e=>{try{await T({sessionId:e.sessionId,directory:e.worktreePath,content:e.prompt,providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:i,files:y})}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(),Ne=`h-7`,Pe=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Fe=e=>{let t=(0,xe.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=g(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Ne),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(H,{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)(A,{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},Ie=e=>{let t=(0,xe.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:c,maxModels:l,addButtonClassName:d,dropdownSide:f,dropdownClassName:p,containerClassName:h,triggerIcon:v}=e,y=c===void 0||c,b=f===void 0?`top`:f,{t:x}=m(),C=ee(Le),w=ee(Re),T=u(ze),E=u(Be),{favoriteModelsList:D,recentModelsList:O}=ge(),k=u(Ve),te=u(He),[j,ne]=X.useState(!1),[re,M]=X.useState(``),[ie,ae]=X.useState(null),oe=X.useRef(null),se=X.useRef(null),N=l===1,P=l===void 0||n.length<l||N,F;if(t[0]!==n){F=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;F.set(t,(F.get(t)||0)+1)}t[0]=n,t[1]=F}else F=t[1];let I=F,L;t[2]===n?L=t[3]:(L=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=L);let R=L,z,ce;t[4]!==b||t[5]!==j?(z=()=>{if(!j||!se.current)return;let e=se.current.getBoundingClientRect();if(b===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ae(Math.max(160,Math.min(320,t)));return}let t=se.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;ae(Math.max(150,Math.min(300,r)))},ce=[b,j],t[4]=b,t[5]=j,t[6]=z,t[7]=ce):(z=t[6],ce=t[7]),X.useEffect(z,ce);let B,le;t[8]!==P||t[9]!==j?(B=()=>{!P&&j&&(ne(!1),M(``))},le=[P,j],t[8]=P,t[9]=j,t[10]=B,t[11]=le):(B=t[10],le=t[11]),X.useEffect(B,le);let V,H;t[12]===j?(V=t[13],H=t[14]):(V=()=>{if(!j)return;let e=e=>{oe.current&&!oe.current.contains(e.target)&&(ne(!1),M(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},H=[j],t[12]=j,t[13]=V,t[14]=H),X.useEffect(V,H);let W;t[15]!==N||t[16]!==r||t[17]!==a||t[18]!==n.length?(W=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:S(e.model,e.modelID)||e.modelID,instanceId:Pe()};N&&n.length>0&&a?a(0,t):r(t),N&&(ne(!1),M(``))},t[15]=N,t[16]=r,t[17]=a,t[18]=n.length,t[19]=W):W=t[19];let G=W,K;t[20]===x?K=t[21]:(K=x(`multirun.modelMultiSelect.search.placeholder`),t[20]=x,t[21]=K);let me;t[22]===x?me=t[23]:(me=x(`multirun.modelMultiSelect.search.noResults`),t[22]=x,t[23]=me);let q;t[24]===x?q=t[25]:(q=x(`multirun.modelMultiSelect.sections.favorites`),t[24]=x,t[25]=q);let J;t[26]===x?J=t[27]:(J=x(`multirun.modelMultiSelect.sections.recent`),t[26]=x,t[27]=J);let Y;t[28]===x?Y=t[29]:(Y=x(`multirun.modelMultiSelect.keyboard.hint`),t[28]=x,t[29]=Y);let _e;t[30]===x?_e=t[31]:(_e=x(`settings.agents.modelSelector.actions.favorite`),t[30]=x,t[31]=_e);let ve;t[32]===x?ve=t[33]:(ve=x(`settings.agents.modelSelector.actions.unfavorite`),t[32]=x,t[33]=ve);let ye;t[34]===x?ye=t[35]:(ye=x(`chat.modelControls.provider`),t[34]=x,t[35]=ye);let be;t[36]===x?be=t[37]:(be=x(`chat.modelControls.capabilities`),t[36]=x,t[37]=be);let Se;t[38]===x?Se=t[39]:(Se=x(`chat.modelControls.capability.toolCalling`),t[38]=x,t[39]=Se);let Ce;t[40]===x?Ce=t[41]:(Ce=x(`chat.modelControls.capability.reasoning`),t[40]=x,t[41]=Ce);let Z;t[42]===x?Z=t[43]:(Z=x(`chat.modelControls.modality.image`),t[42]=x,t[43]=Z);let we;t[44]===x?we=t[45]:(we=x(`chat.modelControls.modality.video`),t[44]=x,t[45]=we);let Te;t[46]===x?Te=t[47]:(Te=x(`chat.modelControls.modality.audio`),t[46]=x,t[47]=Te);let Q;t[48]===x?Q=t[49]:(Q=x(`chat.modelControls.costPerMillion`),t[48]=x,t[49]=Q);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]!==K||t[55]!==me||t[56]!==q||t[57]!==J||t[58]!==Y||t[59]!==_e||t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==Se||t[64]!==Ce||t[65]!==Z||t[66]!==we||t[67]!==Te||t[68]!==Q||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:K,noResults:me,favorites:q,recent:J,keyboardHint:Y,favorite:_e,unfavorite:ve,provider:ye,capabilities:be,capabilityToolCalling:Se,capabilityReasoning:Ce,modalityImage:Z,modalityVideo:we,modalityAudio:Te,costPerMillion:Q,costInput:Ee,costOutput:De},t[54]=K,t[55]=me,t[56]=q,t[57]=J,t[58]=Y,t[59]=_e,t[60]=ve,t[61]=ye,t[62]=be,t[63]=Se,t[64]=Ce,t[65]=Z,t[66]=we,t[67]=Te,t[68]=Q,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===h?Ae=t[73]:(Ae=g(`relative`,h),t[72]=h,t[73]=Ae);let je;t[74]===d?je=t[75]:(je=g(Ne,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),t[74]=d,t[75]=je);let Me=!P,Ie;t[76]===j?Ie=t[77]:(Ie=()=>{ne(!j)},t[76]=j,t[77]=Ie);let We;t[78]===v?We=t[79]:(We=v??(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=v,t[79]=We);let Ge;t[80]!==s||t[81]!==x?(Ge=s??x(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=x,t[82]=Ge):Ge=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ie||t[86]!==We||t[87]!==Ge?(Ke=(0,$.jsxs)(_,{ref:se,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ie,children:[We,Ge]}),t[83]=je,t[84]=Me,t[85]=Ie,t[86]=We,t[87]=Ge,t[88]=Ke):Ke=t[88];let qe;t[89]!==ie||t[90]!==P||t[91]!==p||t[92]!==b||t[93]!==D||t[94]!==w||t[95]!==G||t[96]!==k||t[97]!==E||t[98]!==j||t[99]!==ke||t[100]!==I||t[101]!==te||t[102]!==C||t[103]!==O||t[104]!==re||t[105]!==T?(qe=j?(0,$.jsx)(`div`,{className:g(`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`,p),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(he,{providers:C,providerOrder:te,favoriteModels:D,recentModels:O,getMetadata:w,hiddenModels:k,searchQuery:re,onSearchQueryChange:M,onSelect:G,labels:ke,selectionCount:e=>I.get(`${e.providerID}:${e.modelID}`)||0,disabled:!P,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:ie?`${ie}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:j,isFavorite:e=>E(e.providerID,e.modelID),onToggleFavorite:e=>T(e.providerID,e.modelID),onEscape:()=>{ne(!1),M(``)}})}):null,t[89]=ie,t[90]=P,t[91]=p,t[92]=b,t[93]=D,t[94]=w,t[95]=G,t[96]=k,t[97]=E,t[98]=j,t[99]=ke,t[100]=I,t[101]=te,t[102]=C,t[103]=O,t[104]=re,t[105]=T,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:oe,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==R||t[112]!==I||t[113]!==i||t[114]!==a||t[115]!==C||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=I.get(n)||1,o=R(e),s=C.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)(Fe,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(pe,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(fe,{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)(A,{name:`brain-ai-3`,className:g(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(ue,{placeholder:x(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?x(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(de,{fitContent:!0,children:[(0,$.jsx)(U,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:x(`multirun.modelMultiSelect.variant.default`)}),c.map(Ue)]})]})]},e.instanceId)})}),t[111]=R,t[112]=I,t[113]=i,t[114]=a,t[115]=C,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 Le(e){return e.providers}function Re(e){return e.getModelMetadata}function ze(e){return e.toggleFavoriteModel}function Be(e){return e.isFavoriteModel}function Ve(e){return e.hiddenModels}function He(e){return e.providerOrder}function Ue(e){return(0,$.jsx)(U,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function We(e){let t=(0,xe.c)(30),{git:n}=f(),r=P(e),i=se(e),a=F(e),o=R(e),s=le(Ye),c=le(Je),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 p=r?.all,m;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==p?(m=[e,n,i,p,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=p,t[18]=m):m=t[18],X.useEffect(d,m);let h=a||i===!0&&o,g;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],g=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(qe).sort(),t[20]=r.all,t[21]=e),g=e}let _=g,v;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],v=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Ke).map(Ge).sort(),t[23]=r.all,t[24]=e),v=e}let y=v,b;bb2:{if(!e){b=null;break bb2}if(i!==null){b=i;break bb2}if(h){b=null;break bb2}b=r?.all?!0:null}let x=b,S;return t[25]!==x||t[26]!==h||t[27]!==_||t[28]!==y?(S={localBranches:_,remoteBranches:y,isLoading:h,isGitRepository:x},t[25]=x,t[26]=h,t[27]=_,t[28]=y,t[29]=S):S=t[29],S}function Ge(e){return e.replace(/^remotes\//,``)}function Ke(e){return e.startsWith(`remotes/`)}function qe(e){return!e.startsWith(`remotes/`)}function Je(e){return e.fetchStatus}function Ye(e){return e.fetchBranches}var Xe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=m(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=We(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 J(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(oe),{sourceBranch:o,shouldClearSavedSourceBranch:s}=L({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(oe),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pe,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(fe,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(ue,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(de,{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)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(U,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(W,{}),c.length>0&&(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(U,{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`)})]})},Ze=e=>{let t=(0,xe.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=m(),l=ee(Qe),u=ee($e),d=ee(et),f;t[0]===l?f=t[1]:(f=l(),t[0]=l,t[1]=f);let p=f,h;t[2]===p?h=t[3]:(h=p.filter(tt),t[2]=p,t[3]=h);let _=h,v,y;t[4]!==p.length||t[5]!==u?(v=()=>{p.length===0&&u()},y=[p.length,u],t[4]=p.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=g(`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)(ue,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(fe,{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)(G,{children:_.map(nt)}),t[25]=_,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(de,{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)(pe,{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 Qe(e){return e.getVisibleAgents}function $e(e){return e.loadAgents}function et(e){return e.currentAgentName}function tt(e){return b(e.mode)}function nt(e){return(0,$.jsx)(U,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var rt=10485760,it=5,at=e=>{let t=(0,xe.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(re,{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)(A,{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)(ie,{children:[r,(0,$.jsx)(M,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ot=e=>{let t=(0,xe.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},st=e=>{let t=h(e.path),n=e.icon?Y[e.icon]:null,r=e.color?_e[e.color]:void 0,i=(0,$.jsx)(A,{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)(q,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ct=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=m(),[o,s]=X.useState(``),[c,u]=X.useState(()=>[{id:Pe(),prompt:``,models:[]}]),[d,f]=X.useState(``),[h,y]=X.useState([]),[b,x]=X.useState(!1),[S,C]=X.useState([]),[w,T]=X.useState(!1),[ee,te]=X.useState(!1),[oe,se]=X.useState(!0),N=X.useRef(null),P=l(e=>e.currentDirectory??null),F=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},[]),I=O(e=>e.activeProjectId),L=O(e=>e.setActiveProjectIdOnly),R=O(e=>e.projects),[z,ce]=X.useState(()=>I??null);X.useEffect(()=>{if(I){ce(I);return}!z&&R.length>0&&ce(R[0].id)},[I,R,z]);let B=X.useMemo(()=>z?R.find(e=>e.id===z)??null:null,[R,z]),le=B?.path??P,V=p(e=>{ce(e),e!==I&&L(e)}),H=X.useMemo(()=>{if(B?.path)return{id:B.id,path:B.path};let e=P??F;return e?{id:`path:${e}`,path:e}:null},[B,P,F]),[W]=X.useState(()=>typeof window<`u`&&t()),G=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),me=ae(),q=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__YURI_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},[]),J=X.useMemo(()=>W&&G||me?`pl-[5.5rem]`:`pl-3`,[W,G,me]),he=X.useMemo(()=>!W||!G||q===null?``:q>=26?`h-12`:q<=15?`h-14`:``,[W,G,q]),Y=p(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&W&&await v()}),ge=p(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),_e=!!r;X.useEffect(()=>{if(_e)return window.addEventListener(`keydown`,ge,!0),()=>window.removeEventListener(`keydown`,ge,!0)},[_e]);let[xe,Se]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=We(le),we=X.useRef(!1),Te=Z===!0,Q=Te&&oe;X.useEffect(()=>{if(Z===!1){we.current=!0,se(!1);return}Z===!0&&we.current&&(we.current=!1,se(!0))},[Z]);let Ee=Me(e=>e.createMultiRun),De=Me(e=>e.error),Oe=Me(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(!H)return;let e=!1;return te(!0),(async()=>{try{let t=await k(H);e||C(t)}catch{}finally{e||te(!1)}})(),()=>{e=!0}},[H]);let ke=p((e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=p(e=>{u(t=>t.filter(t=>t.id!==e))}),je=p(()=>{u(e=>[...e,{id:Pe(),prompt:``,models:[]}])}),Ne=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>rt){D.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)});y(t=>[...t,{id:Pe(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),D.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&D.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),N.current&&(N.current.value=``)},Fe=e=>{y(t=>t.filter(t=>t.id!==e))},Ie=X.useMemo(()=>c.reduce((e,t)=>e+t.models.length,0),[c]),Le=async e=>{e.preventDefault();let t=c.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Ie<1)){x(!0),Oe();try{z&&z!==I&&L(z);let e=h.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=S.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:Q?xe:void 0,isolateRuns:Q,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&E.getState().setCurrentSession(s.firstSessionId),n?.())}finally{x(!1)}}},Re=!!(o.trim()&&c.some(e=>e.prompt.trim()&&e.models.length>=1)&&Ie>=1&&le&&!Ce&&(Z===!1||!Q||xe)),ze=S.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:Y,className:g(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,J,he),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)(ie,{children:[(0,$.jsx)(re,{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)(A,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(K,{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)(ot,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),R.length>0?(0,$.jsxs)(pe,{value:z??void 0,onValueChange:V,children:[(0,$.jsx)(fe,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:B?(0,$.jsx)(ue,{children:st(B)}):(0,$.jsx)(ue,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(de,{fitContent:!0,children:R.map(e=>(0,$.jsx)(U,{value:e.id,className:`max-w-[24rem]`,children:st(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)(ot,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(at,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(ne,{id:`group-name`,value:o,onChange:e=>s(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)(ot,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Xe,{directory:le,value:xe,onChange:Se,disabled:!Q,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)(j,{checked:oe,onChange:se,disabled:!Te,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)(ot,{htmlFor:`multirun-agent`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)(Ze,{value:d,onChange:f,id:`multirun-agent`})]})]}),(0,$.jsxs)(be,{open:w,onOpenChange:T,children:[(0,$.jsxs)(ye,{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)(A,{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)(A,{name:`arrow-down-s`,className:g(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,w&&`rotate-180`)})]}),(0,$.jsx)(ve,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:ee?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[S.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(ne,{value:e,onChange:e=>{let n=[...S];n[t]=e.target.value,C(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(S.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)(A,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C([...S,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(A,{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)(ot,{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:N,type:`file`,multiple:!0,className:`hidden`,onChange:Ne,accept:`*/*`}),(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>N.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)(A,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(M,{children:a(`multirun.launcher.attachments.tooltip`)})]}),h.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)(A,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(A,{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:()=>Fe(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(A,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),c.map((e,t)=>(0,$.jsx)(lt,{group:e,groupIndex:t,canRemove:c.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)(A,{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:[!Q&&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)(A,{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)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(_,{type:`submit`,size:`sm`,disabled:!Re||b,children:b?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Ie})})})]})})]})},lt=e=>{let t=(0,xe.c)(94),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=m(),[c,l]=X.useState(!1),[u,d]=X.useState(``),[f,h]=X.useState(!1),[g,_]=X.useState(``),v=X.useRef(null),y=X.useRef(null),b=X.useRef(null),x;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(x=e=>{n.models.length>=it||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=x):x=t[3];let S=p(x),C;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(C=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]=C):C=t[7];let w=p(C),T;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(T=(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]=T):T=t[11];let ee=p(T),E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(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);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);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
3
|
-
`)?(d(t),l(!0)):l(!1);return}l(!1)},t[12]=E):E=t[12];let D=p(E),O;t[13]!==n.id||t[14]!==a?(O=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=O):O=t[15];let k=p(O),te;t[16]!==n.prompt||t[17]!==k||t[18]!==D?(te=e=>{let t=n.prompt,r=v.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=z(t,i===-1?r:i,r,`@${a}`);k(o.text),l(!1),d(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),D(o.text,o.caret)})},t[16]=n.prompt,t[17]=k,t[18]=D,t[19]=te):te=t[19];let j=p(te),ne;t[20]!==n.prompt||t[21]!==k||t[22]!==D?(ne=e=>{let t=n.prompt,r=v.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=z(t,i===-1?r:i,r,`@${e}`);k(a.text),l(!1),d(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),D(a.text,a.caret)})},t[20]=n.prompt,t[21]=k,t[22]=D,t[23]=ne):ne=t[23];let re=p(ne),M;t[24]!==k||t[25]!==D?(M=e=>{let t=`/${e.name} `;k(t),h(!1),_(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),D(t,t.length)})},t[24]=k,t[25]=D,t[26]=M):M=t[26];let ie=p(M),ae;t[27]!==f||t[28]!==c?(ae=e=>{if(f&&b.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),b.current.handleKeyDown(e.key);return}c&&y.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),y.current.handleKeyDown(e.key))},t[27]=f,t[28]=c,t[29]=ae):ae=t[29];let oe=p(ae),se=r+1,N;t[30]!==s||t[31]!==se?(N=s(`multirun.launcher.groups.groupLabel`,{index:se}),t[30]=s,t[31]=se,t[32]=N):N=t[32];let P;t[33]===N?P=t[34]:(P=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:N}),t[33]=N,t[34]=P);let F;t[35]!==i||t[36]!==n.id||t[37]!==o||t[38]!==s?(F=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)(A,{name:`close`,className:`h-3.5 w-3.5`})}),t[35]=i,t[36]=n.id,t[37]=o,t[38]=s,t[39]=F):F=t[39];let I;t[40]!==P||t[41]!==F?(I=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;t[43]===s?L=t[44]:(L=s(`multirun.launcher.groups.prompt.label`),t[43]=s,t[44]=L);let R;t[45]===L?R=t[46]:(R=(0,$.jsx)(ot,{required:!0,children:L}),t[45]=L,t[46]=R);let le=n.prompt,V;t[47]!==k||t[48]!==D?(V=e=>{let t=e.target.value;k(t);let n=e.target.selectionStart??t.length;D(t,n)},t[47]=k,t[48]=D,t[49]=V):V=t[49];let ue;t[50]===s?ue=t[51]:(ue=s(`multirun.launcher.groups.prompt.placeholder`),t[50]=s,t[51]=ue);let H;t[52]!==n.prompt||t[53]!==oe||t[54]!==V||t[55]!==ue?(H=(0,$.jsx)(me,{ref:v,value:le,onChange:V,onKeyDown:oe,placeholder:ue,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[52]=n.prompt,t[53]=oe,t[54]=V,t[55]=ue,t[56]=H):H=t[56];let U;t[57]!==g||t[58]!==ie||t[59]!==f?(U=f?(0,$.jsx)(B,{ref:b,searchQuery:g,onCommandSelect:ie,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[57]=g,t[58]=ie,t[59]=f,t[60]=U):U=t[60];let de;t[61]!==re||t[62]!==j||t[63]!==u||t[64]!==c?(de=c?(0,$.jsx)(ce,{ref:y,searchQuery:u,onFileSelect:j,onAgentSelect:re,onSkillSelect:e=>re(e.name),onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[61]=re,t[62]=j,t[63]=u,t[64]=c,t[65]=de):de=t[65];let W;t[66]!==H||t[67]!==U||t[68]!==de?(W=(0,$.jsxs)(`div`,{className:`relative`,children:[H,U,de]}),t[66]=H,t[67]=U,t[68]=de,t[69]=W):W=t[69];let G;t[70]!==R||t[71]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[R,W]}),t[70]=R,t[71]=W,t[72]=G):G=t[72];let fe;t[73]===s?fe=t[74]:(fe=s(`multirun.launcher.models.info`,{max:it}),t[73]=s,t[74]=fe);let pe;t[75]===fe?pe=t[76]:(pe=(0,$.jsx)(at,{children:fe}),t[75]=fe,t[76]=pe);let K;t[77]===s?K=t[78]:(K=s(`multirun.launcher.models.label`),t[77]=s,t[78]=K);let q;t[79]!==pe||t[80]!==K?(q=(0,$.jsx)(ot,{required:!0,info:pe,children:K}),t[79]=pe,t[80]=K,t[81]=q):q=t[81];let J;t[82]!==n.models||t[83]!==S||t[84]!==w||t[85]!==ee?(J=(0,$.jsx)(Ie,{selectedModels:n.models,onAdd:S,onRemove:w,onUpdate:ee,minModels:1,maxModels:it}),t[82]=n.models,t[83]=S,t[84]=w,t[85]=ee,t[86]=J):J=t[86];let he;t[87]!==q||t[88]!==J?(he=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[q,J]}),t[87]=q,t[88]=J,t[89]=he):he=t[89];let Y;return t[90]!==I||t[91]!==G||t[92]!==he?(Y=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[I,G,he]}),t[90]=I,t[91]=G,t[92]=he,t[93]=Y):Y=t[93],Y};export{Q as a,Pe as i,Ze as n,we as o,Ie as r,ct as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./runtime-switch-DEZ1K7qW.js";import{n as r}from"./runtime-fetch-D0YWp3FJ.js";import{a as i,i as a}from"./vendor-zustand-vDaAPGfl.js";import{ot as o,st as s}from"./vendor-base-ui-CzHs0bHY.js";import{r as c}from"./useUIStore-BerIUSLP.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{d as u,f as d,p as f,r as p,t as m}from"./button-C-gRcs_2.js";import{Ar as h,Dr as g,Hi as _,Or as v,Tr as y,jr as b,ki as ee,kr as te,p as x,ri as S,w as ne}from"./useMobileNavigationStore-BOlo2VUm.js";import{n as C}from"./Icon-OJf0qBKf.js";import{k as re,l as ie,v as w,x as T}from"./gitApi-Dw-LR3UG.js";import{t as ae}from"./input-CmLlZdeD.js";import{i as oe,n as se,t as ce}from"./tooltip-Degmpxnd.js";import{d as le,l as ue}from"./select-J8r9SxHt.js";import{_ as de,l as fe,o as pe,s as me,t as he,v as ge,y as E}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{n as _e,o as D,s as ve,t as ye}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";import{n as be}from"./textarea-BHgcxJdC.js";var O=e(s(),1),k=l(),xe=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},Se=(e,t,n)=>{let r=xe(t.limit,`context`),i=xe(t.limit,`output`),a=r??n?.limit?.context,o=i??n?.limit?.output;return a===void 0&&o===void 0?n:{...n??{id:typeof t.id==`string`?t.id:``,providerId:e,name:typeof t.name==`string`?t.name:void 0},limit:{...n?.limit,...a===void 0?{}:{context:a},...o===void 0?{}:{output:o}}}};function Ce(e){let t=e.toLowerCase().trim();return{lower:t,compact:t.replace(/[^a-z0-9]/g,``),tokens:t.split(/[^a-z0-9]+/).filter(Boolean)}}function we(e,t){let n=Ce(t);if(!n.lower)return!0;let r=Ce(e);return r.lower.includes(n.lower)||n.compact.length>=2&&r.compact.includes(n.compact)?!0:n.tokens.length!==0&&n.tokens.every(e=>r.tokens.some(t=>t.startsWith(e)||t.includes(e)))}var Te=i()(a(e=>({collapsedSections:{},toggleSection:t=>e(e=>{let n={...e.collapsedSections};return n[t]?delete n[t]:n[t]=!0,{collapsedSections:n}})}),{name:`model-picker-collapsed-sections`,version:1})),A=o(),Ee={image:{icon:`file-image`,labelKey:`modalityImage`},video:{icon:`file-video`,labelKey:`modalityVideo`},audio:{icon:`file-music`,labelKey:`modalityAudio`}},De=e=>e.trim().toLowerCase(),j=e=>{let t=(0,k.c)(5),{iconName:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,A.jsx)(C,{name:n,className:`size-3.5`}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,A.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,role:`img`,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Oe=(e,t)=>{let n=[];e?.tool_call&&t.capabilityToolCalling&&n.push({key:`tool_call`,icon:`tools`,label:t.capabilityToolCalling}),e?.reasoning&&t.capabilityReasoning&&n.push({key:`reasoning`,icon:`brain-ai-3`,label:t.capabilityReasoning});let r=[...e?.modalities?.input??[],...e?.modalities?.output??[]],i=Array.from(new Set(r.map(De).filter(Boolean)));for(let e of i){let r=Ee[e];if(!r)continue;let i=t[r.labelKey];i&&n.push({key:`modality-${e}`,icon:r.icon,label:i})}return n},ke=e=>new Intl.NumberFormat(f(),{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0}).format(e),M=e=>new Intl.NumberFormat(f(),{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}).format(e),N=e=>_(e,void 0,{maxLength:40}),Ae=e=>{if(typeof e!=`number`||Number.isNaN(e))return``;if(e===0)return`0`;let t=ke(e);return t.endsWith(`.0`)?t.slice(0,-2):t},P=e=>typeof e!=`number`||!Number.isFinite(e)?`—`:M(e),F=(e,t)=>t?!0:e?!!(e.tool_call||e.reasoning||e.cost?.input!==void 0||e.cost?.output!==void 0||(e.modalities?.input?.length??0)>0||(e.modalities?.output?.length??0)>0):!1,je=e=>{let t=(0,k.c)(14),{metadata:n,providerName:r,providerID:i,modelID:a,active:o,labels:s,children:c}=e,{t:l}=d(),[f,p]=O.useState(!1),h=`${i}/${a}`,g,_;if(t[0]===o?(g=t[1],_=t[2]):(g=()=>{if(!o){p(!1);return}let e=window.setTimeout(()=>p(!0),450);return()=>window.clearTimeout(e)},_=[o],t[0]=o,t[1]=g,t[2]=_),O.useEffect(g,_),!F(n,r))return c;let v;if(t[3]!==o||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==n||t[8]!==h||t[9]!==r||t[10]!==l){let e=Oe(n,s),i=n?.cost?.input!==void 0||n?.cost?.output!==void 0,a;t[12]===c?a=t[13]:(a=(0,A.jsx)(oe,{asChild:!0,children:c}),t[12]=c,t[13]=a),v=(0,A.jsxs)(ce,{delayDuration:0,open:o&&f,onOpenChange:I,children:[a,o&&f?(0,A.jsx)(se,{side:`right`,sideOffset:8,className:`min-w-52 max-w-xs text-left transition-none data-[starting-style]:opacity-100 data-[starting-style]:scale-100 data-[ending-style]:opacity-100 data-[ending-style]:scale-100`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 text-left text-xs`,children:[r&&s.provider?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium`,children:s.provider}),(0,A.jsx)(`span`,{className:`typography-meta text-foreground`,children:r})]}):null,e.length>0?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.capabilities}),(0,A.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:e.map(Be)})]}):null,i?(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-muted-foreground`,children:[s.costPerMillion?(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.costPerMillion}):null,(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costInput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costInput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.input)})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costOutput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costOutput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.output)})]})]})]}):null,(0,A.jsx)(m,{variant:`ghost`,size:`xs`,className:`h-auto min-h-0 w-full min-w-0 justify-end gap-0 rounded-none p-0 text-right cursor-copy font-normal text-muted-foreground hover:bg-transparent active:bg-transparent`,"aria-label":l(`onboarding.common.copyToClipboard`),title:h,onClick:async e=>{e.stopPropagation();try{(await u(h)).ok?S.success(l(`contextSidebar.actions.copied`)):S.error(l(`filesView.toast.copyFailed`))}catch{S.error(l(`filesView.toast.copyFailed`))}},children:(0,A.jsx)(`span`,{className:`block w-full min-w-0 truncate text-right text-[10px] leading-tight`,children:h})})]})}):null]}),t[3]=o,t[4]=c,t[5]=f,t[6]=s,t[7]=n,t[8]=h,t[9]=r,t[10]=l,t[11]=v}else v=t[11];return v},Me=()=>{let e=0,t=new Set,n=new Map,r=e=>{let t=n.get(e);if(t)for(let e of t)e()};return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),subscribeIndex:(e,t)=>{let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),()=>{r.delete(t),r.size===0&&n.delete(e)}},set:n=>{if(e===n)return;let i=e;e=n,r(i),r(n);for(let e of t)e()}}},Ne=O.memo(e=>{let t=(0,k.c)(12),{store:n,index:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=()=>n.getSnapshot()===r,t[0]=r,t[1]=n,t[2]=a):a=t[2];let[o,s]=O.useState(a),c,l;t[3]!==r||t[4]!==n?(c=()=>{let e=()=>s(n.getSnapshot()===r);return e(),n.subscribeIndex(r,e)},l=[r,n],t[3]=r,t[4]=n,t[5]=c,t[6]=l):(c=t[5],l=t[6]),O.useEffect(c,l);let u;t[7]!==i||t[8]!==o?(u=i(o),t[7]=i,t[8]=o,t[9]=u):u=t[9];let d;return t[10]===u?d=t[11]:(d=(0,A.jsx)(A.Fragment,{children:u}),t[10]=u,t[11]=d),d}),Pe=e=>{let t=(0,k.c)(11),{store:n,flatModelList:r,footerContent:i,fallback:a}=e,o;t[0]===n?o=t[1]:(o=()=>n.getSnapshot(),t[0]=n,t[1]=o);let[s,c]=O.useState(o),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>n.subscribe(()=>c(n.getSnapshot())),u=[n],t[2]=n,t[3]=l,t[4]=u),O.useEffect(l,u);let d=r[s],f;t[5]!==d||t[6]!==a||t[7]!==i?(f=typeof i==`function`?i(d):i??a,t[5]=d,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;return t[9]===f?p=t[10]:(p=(0,A.jsx)(A.Fragment,{children:f}),t[9]=f,t[10]=p),p},Fe=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Transform.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Ie=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Translate.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Le=32,Re=(e,t)=>{if(!t)return;if(!e){t.scrollIntoView({block:`nearest`});return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top+e.scrollTop,a=i+r.height,o=e.scrollTop,s=o+e.clientHeight,c=i<o+Le?i-Le:a>s?a-e.clientHeight:o,l=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.max(0,Math.min(c,l))},ze=({providers:e,favoriteModels:t,recentModels:n,getMetadata:r,searchQuery:i,onSearchQueryChange:a,onSelect:o,labels:s,selectedModel:c,hiddenModels:l=[],allowedProviderIds:u,allowedModelIdsByProvider:d,includeNotSelected:f=!1,onSelectNone:m,selectionCount:h,disabled:g=!1,maxHeightClassName:_=`max-h-[min(400px,calc(100dvh-12rem))] flex-1`,maxHeightStyle:v,sectionHeaderClassName:y,rowClassName:b,stickyHeaders:ee=!0,autoFocus:te=!0,onEscape:x,isFavorite:S,onToggleFavorite:ne,renderRowEnd:re,onActiveKeyDown:ie,onActiveEntryChange:w,onVariantKey:T,onReorderFavorite:oe,reorderFavoriteAriaLabel:se,reorderFavoriteTitle:ce,providerOrder:E,onReorderProvider:D,reorderProviderTitle:k,footerContent:xe,renderVersion:Ce,tooltipsEnabled:Ee=!0})=>{let De=O.useRef(null);De.current||=Me();let j=De.current,Oe=O.useRef([]),ke=O.useRef(null),M=O.useRef(!1),P=O.useRef(null),F=Te(e=>e.collapsedSections),Le=Te(e=>e.toggleSection),ze=O.useMemo(()=>new Set(Object.keys(F).filter(e=>F[e])),[F]),I=i.trim().length>0,[Be,L]=O.useState(()=>new Set),R=I?Be:ze,Ve=ge(de(me,{activationConstraint:{distance:8}})),He=ge(de(pe,{activationConstraint:{distance:8}})),z=O.useMemo(()=>!u||u.length===0?null:new Set(u),[u]),Ue=O.useMemo(()=>d?new Map(Object.entries(d).map(([e,t])=>[e,new Set(t)])):null,[d]),B=O.useCallback((e,t)=>!Ue||Ue.get(e)?.has(t)===!0,[Ue]),V=O.useMemo(()=>new Map(e.map(e=>[e.id,e])),[e]),H=O.useCallback((e,t)=>l.some(n=>n.providerID===e&&n.modelID===t),[l]),U=O.useCallback((e,t)=>{let n=i.trim();return!n||we(`${t} ${e}`,n)},[i]),W=O.useMemo(()=>t.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,t,B,H,U,V]),G=O.useMemo(()=>n.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,B,H,U,V,n]),We=O.useMemo(()=>{if(!E||E.length===0)return e;let t=new Map(E.map((e,t)=>[e,t])),n=e.filter(e=>t.has(e.id)).sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)),r=e.filter(e=>!t.has(e.id));return[...n,...r]},[E,e]),K=O.useMemo(()=>We.filter(e=>!z||z.has(e.id)).map(e=>{let t=(Array.isArray(e.models)?e.models:[]).filter(t=>{let n=typeof t.id==`string`?t.id:``;return!n||H(e.id,n)||!B(e.id,n)?!1:U(N(t),e.name||e.id)});return{...e,models:t}}).filter(e=>e.models.length>0),[z,B,H,U,We]),q=O.useMemo(()=>{let e=[];return R.has(`favorites`)||W.forEach(t=>e.push(t)),R.has(`recent`)||G.forEach(t=>e.push(t)),K.forEach(t=>{R.has(`provider:${t.id}`)||t.models.forEach(n=>e.push({model:n,providerID:t.id,modelID:n.id}))}),e},[R,W,K,G]),Ge=q.length>0,Ke=!!oe&&i.trim().length===0&&W.length>1,qe=!!D&&i.trim().length===0&&!z&&K.length>1,Je=O.useMemo(()=>new Map(W.map(e=>[`${e.providerID}:${e.modelID}`,e])),[W]);O.useEffect(()=>{j.set(0)},[i,j]),O.useEffect(()=>{I||L(e=>e.size===0?e:new Set)},[I]);let Ye=O.useCallback(e=>{j.set(e),w?.(q[e])},[q,w,j]),J=O.useCallback(e=>{let t=q.length;if(t===0)return;M.current=!0,P.current=null;let n=(j.getSnapshot()+e+t)%t;j.set(n),w?.(q[n]),requestAnimationFrame(()=>Re(ke.current,Oe.current[n]))},[q,w,j]);O.useEffect(()=>{w?.(q[j.getSnapshot()])},[q,w,j]);let Xe=O.useCallback(e=>{if(!e.defaultPrevented){if(e.stopPropagation(),e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=q[j.getSnapshot()];if(t&&T?.(e,t))return}if(ie?.(e,q[j.getSnapshot()]),!e.defaultPrevented){if(e.key===`ArrowDown`){e.preventDefault(),J(1);return}if(e.key===`ArrowUp`){e.preventDefault(),J(-1);return}if(e.key===`Enter`){e.preventDefault();let t=q[j.getSnapshot()];t&&!g&&o(t);return}e.key===`Escape`&&(e.preventDefault(),x?.())}}},[g,q,J,ie,x,o,T,j]),Ze=p(`model-picker-section-header typography-micro font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 px-2 py-1.5`,ee&&`sticky top-0 z-10 [background:linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))]`,y),Y=0,X=(e,t,n,i,a)=>{let l=Se(e.providerID,e.model,r?.(e.providerID,e.modelID)),u=V.get(e.providerID)?.name||e.providerID,d=Ae(l?.limit?.context),f=h?.(e)??0,m=c?.providerID===e.providerID&&c.modelID===e.modelID,_=S?.(e)??!1,v=e=>{let t={x:e.clientX,y:e.clientY},n=P.current,r=!n||n.x!==t.x||n.y!==t.y;P.current=t,!(M.current&&!n)&&(M.current&&!r||(M.current&&r&&(M.current=!1),Ye(i)))};return(0,A.jsx)(Ne,{store:j,index:i,renderVersion:Ce,children:t=>{let r=(0,A.jsxs)(`div`,{ref:e=>{Oe.current[i]=e},role:`option`,"aria-selected":m,"aria-disabled":g||void 0,tabIndex:-1,onClick:()=>{g||o(e)},onKeyDown:t=>{g||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e))},onMouseEnter:v,onMouseMove:v,className:p(`w-full text-left px-2 py-1.5 rounded-md typography-meta flex items-center gap-2 cursor-pointer`,!g&&(t?`bg-interactive-selection`:`hover:bg-interactive-hover/50`),g&&`cursor-not-allowed opacity-60`,b),children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-1 min-w-0`,children:[a?(0,A.jsx)(`button`,{type:`button`,ref:a.setActivatorNodeRef,...a.attributes,...a.listeners,disabled:g,onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`model-favorite-drag-handle flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground hover:text-foreground disabled:pointer-events-none`,"aria-label":se,title:ce,children:(0,A.jsx)(C,{name:`draggable`,className:`size-3.5`})}):null,n?(0,A.jsx)(le,{modelId:e.modelID,providerId:e.providerID,className:`h-3.5 w-3.5 flex-shrink-0`}):null,(0,A.jsx)(`span`,{className:`font-medium truncate`,children:N(e.model)}),d?(0,A.jsx)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:d}):null]}),f>0?(0,A.jsxs)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:[`x`,f]}):null,re?.(e,{isHighlighted:t,isSelected:m}),m?(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary flex-shrink-0`}):null,ne?(0,A.jsx)(`button`,{type:`button`,disabled:g,onClick:t=>{t.preventDefault(),t.stopPropagation(),ne(e)},className:p(`model-favorite-button flex h-4 w-4 items-center justify-center hover:text-primary/80 flex-shrink-0 disabled:pointer-events-none`,_?`text-primary`:`text-muted-foreground`),"aria-label":_?s.unfavorite:s.favorite,title:_?s.unfavorite:s.favorite,children:(0,A.jsx)(C,{name:_?`star-fill`:`star`,className:`h-3.5 w-3.5`})}):null]});return(0,A.jsx)(je,{metadata:l,providerName:u,providerID:e.providerID,modelID:e.modelID,active:Ee&&t,labels:s,children:r})}},`${t}-${e.providerID}-${e.modelID}`)},Qe=e=>{if(!oe)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Je.get(String(t.id)),i=Je.get(String(n.id));!r||!i||oe(r,i)},$e=e=>{if(!D)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=We.map(e=>e.id),i=r.indexOf(String(t.id)),a=r.indexOf(String(n.id));i!==-1&&a!==-1&&D(_e(r,i,a))},Z=e=>R.has(e),et=e=>{if(!I){Le(e);return}L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Q=(e,t,n,r)=>{let i=Z(e),a=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),et(e))};return r?(0,A.jsxs)(`div`,{ref:r.setActivatorNodeRef,...r.attributes,...r.listeners,role:`button`,tabIndex:0,"aria-expanded":!i,title:k,className:p(Ze,`w-full text-left cursor-grab select-none active:cursor-grabbing`),onClick:()=>et(e),onKeyDown:a,children:[(0,A.jsx)(C,{name:`draggable`,className:`size-3.5 flex-shrink-0 text-muted-foreground/70`}),t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]}):(0,A.jsxs)(`button`,{type:`button`,className:p(Ze,`w-full text-left cursor-pointer`),onClick:()=>et(e),"aria-expanded":!i,children:[t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]})},tt=(e,t,n)=>(0,A.jsxs)(A.Fragment,{children:[t>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`provider:${e.id}`,(0,A.jsx)(ue,{providerId:e.id,className:`h-4 w-4 flex-shrink-0`}),e.name||e.id,n),Z(`provider:${e.id}`)?null:e.models.map(t=>X({model:t,providerID:e.id,modelID:t.id},`provider`,!0,Y++))]});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`p-1.5 pb-1`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(C,{name:`search`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,A.jsx)(ae,{type:`text`,placeholder:s.searchPlaceholder,value:i,onChange:e=>a(e.target.value),onKeyDown:Xe,className:`model-picker-search h-8 pl-8 typography-meta`,autoFocus:te})]})}),(0,A.jsx)(be,{ref:ke,outerClassName:_,className:`overlay-scrollbar-target--no-gutter`,style:v,children:(0,A.jsxs)(`div`,{className:`px-1`,children:[f?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 typography-meta text-muted-foreground hover:bg-interactive-hover/50`,onClick:m,children:[(0,A.jsx)(C,{name:`close`,className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:s.notSelected}),c?null:(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary ml-auto`})]}),(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`})]}):null,Ge?null:(0,A.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:s.noResults}),W.length>0?(0,A.jsxs)(`div`,{children:[Q(`favorites`,(0,A.jsx)(C,{name:`star-fill`,className:`h-4 w-4 text-primary`}),s.favorites),!Z(`favorites`)&&(Ke?(0,A.jsx)(he,{sensors:Ve,collisionDetection:fe,onDragEnd:Qe,children:(0,A.jsx)(ye,{items:W.map(e=>`${e.providerID}:${e.modelID}`),strategy:ve,children:W.map(e=>{let t=Y++;return(0,A.jsx)(Fe,{id:`${e.providerID}:${e.modelID}`,disabled:g,children:n=>X(e,`fav`,!0,t,n)},`fav-sortable-${e.providerID}-${e.modelID}`)})})}):W.map(e=>X(e,`fav`,!0,Y++)))]}):null,G.length>0?(0,A.jsxs)(`div`,{children:[W.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`recent`,(0,A.jsx)(C,{name:`time`,className:`h-4 w-4`}),s.recent),Z(`recent`)?null:G.map(e=>X(e,`recent`,!0,Y++))]}):null,(W.length>0||G.length>0)&&K.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,qe?(0,A.jsx)(he,{sensors:He,collisionDetection:fe,onDragEnd:$e,children:(0,A.jsx)(ye,{items:K.map(e=>e.id),strategy:ve,children:K.map((e,t)=>(0,A.jsx)(Ie,{id:e.id,disabled:g,children:n=>tt(e,t,n)},e.id))})}):K.map((e,t)=>(0,A.jsx)(`div`,{children:tt(e,t)},e.id))]})}),(0,A.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t border-border/40 typography-micro text-muted-foreground`,children:(0,A.jsx)(Pe,{store:j,flatModelList:q,footerContent:xe,fallback:s.keyboardHint})})]})};function I(){}function Be(e){let{key:t,icon:n,label:r}=e;return(0,A.jsx)(j,{iconName:n,label:r},t)}function L(e,t,n,r,i){let a=e.find(e=>e.id===n);if(!a)return null;let o=(Array.isArray(a.models)?a.models:[]).find(e=>e.id===r);return!o||t.some(e=>e.providerID===n&&e.modelID===r)?null:i===void 0?{provider:a,model:o,providerID:n,modelID:r}:{provider:a,model:o,providerID:n,modelID:r,variant:i}}var R=e=>{let t=(0,k.c)(30),n=ee(Ve),r=c(He),i=c(z),a=c(Ue),o=e?.currentProviderID??null,s=e?.currentModelID??null,l;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==a||t[5]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[4]=a,t[5]=n,t[6]=e):e=t[6],l=r.map(e).filter(B),t[0]=r,t[1]=a,t[2]=n,t[3]=l}else l=t[3];let u=l,d;if(t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==a||t[11]!==n||t[12]!==i){bb0:{let e;t[14]!==a||t[15]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[14]=a,t[15]=n,t[16]=e):e=t[16];let c;t[17]===r?c=t[18]:(c=e=>{let{providerID:t,modelID:n}=e;return!r.some(e=>e.providerID===t&&e.modelID===n)},t[17]=r,t[18]=c);let l=i.map(e).filter(V).filter(c);if(!o||!s){d=l;break bb0}if(r.some(e=>e.providerID===o&&e.modelID===s)){d=l;break bb0}let u;t[19]!==s||t[20]!==o?(u=e=>e.providerID===o&&e.modelID===s,t[19]=s,t[20]=o,t[21]=u):u=t[21];let f=l.findIndex(u);if(f===0){d=l;break bb0}if(f>0){let e=l.slice(),[t]=e.splice(f,1);e.unshift(t),d=e;break bb0}let p;t[22]!==s||t[23]!==o||t[24]!==a||t[25]!==n?(p=L(n,a,o,s),t[22]=s,t[23]=o,t[24]=a,t[25]=n,t[26]=p):p=t[26];let m=p;if(!m){d=l;break bb0}d=[m,...l]}t[7]=s,t[8]=o,t[9]=r,t[10]=a,t[11]=n,t[12]=i,t[13]=d}else d=t[13];let f=d,p;return t[27]!==u||t[28]!==f?(p={favoriteModelsList:u,recentModelsList:f},t[27]=u,t[28]=f,t[29]=p):p=t[29],p};function Ve(e){return e.providers}function He(e){return e.favoriteModels}function z(e){return e.recentModels}function Ue(e){return e.hiddenModels}function B(e){return e!==null}function V(e){return e!==null}var H=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function U(e){let t=H(e),n=await w(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var W=6e4,G=500,We=1048576,K=new Map,q=new Map,Ge=0,Ke=(e,t)=>e.length+t.length,qe=(e,t)=>{K.delete(e),K.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of K)n+=Ke(e,t.root);for(;K.size>G||n>We&&K.size>1;){let e=K.entries().next().value;if(!e)break;n-=Ke(e[0],e[1].root),K.delete(e[0])}};function Je(e){if(Ge+=1,typeof e==`string`&&e){let t=H(e);K.delete(t),q.delete(t);return}K.clear(),q.clear()}var Ye=async e=>re(e).catch(()=>e),J=async e=>{let t=K.get(e);if(t&&Date.now()-t.resolvedAt<W)return K.delete(e),K.set(e,t),t.root;t&&K.delete(e);let n=q.get(e);if(n)return n;let r=Ge,i=Ye(e).then(t=>(Ge===r&&qe(e,t),t)).catch(()=>e).finally(()=>{q.get(e)===i&&q.delete(e)});return q.set(e,i),i};async function Xe(e,t){let n=H(e);if(!n)return`HEAD`;try{let e=await J(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await w(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var Ze=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},Y=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:Ze(e),worktreeSource:`existing`}),X=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Qe=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),$e=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),Z=(e,t)=>{let n=X(e);n&&x.setState(e=>{let r=!1,i=e=>X(e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},et=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,Q=e=>{let t=X(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},tt=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(y(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},nt=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=Qe(e.worktreeName??e.preferredName??``),i=$e(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=$e(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=tt({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},rt=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},it=new Map,at=new Map,ot=new Map,st=3e4,ct=e=>`${t()}\u0000${X(e)}`,lt=(e,t=ct(e))=>ot.get(t)??0,ut=e=>{let t=ct(e);ot.set(t,lt(e)+1),it.delete(t)},dt=async e=>{let t=await J(e).catch(()=>e),n=X(e);return(await T.worktree.list(e)).filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let n=X(e.path),r=(e.branch||``).replace(/^refs\/heads\//,``).trim(),i=(e.name||``).trim(),a=Y(e,n);return{source:`sdk`,name:i||Q(n),path:n,projectDirectory:t,branch:r,label:r||i||Q(n),worktreeRoot:a.worktreeRoot,worktreeStatus:a.worktreeStatus,headState:a.headState,worktreeSource:a.worktreeSource}}).filter(e=>X(e.path)!==n).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},ft=async(e,n,r)=>{for(;;){let i=lt(e,n),a=await dt(e);if(i===lt(e,n))return r===t()&&it.set(n,{value:a,at:Date.now()}),a}};async function pt(e){let n=X(e.path),r=t(),i=`${r}\u0000${n}`,a=it.get(i);if(a&&Date.now()-a.at<st)return a.value;let o=at.get(i);if(o)return o;let s=ft(n,i,r).finally(()=>{at.get(i)===s&&at.delete(i)});return at.set(i,s),s}var mt=(e,t)=>{let n=v(e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},ht=e=>{let t=new Set([...e].map(X));if(t.size===0)return;let n=x.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(X(i.path))&&r.delete(e);for(let[e,n]of ne.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?X(n.worktreeRoot):``,i=typeof n.cwd==`string`&&n.cwd.trim()?X(n.cwd):``;(r&&t.has(r)||i&&t.has(i))&&ne.getState().clearAttachment(e)}r.size!==n.size&&x.setState({worktreeMetadata:r})};async function gt(e,t={}){let n=X(e.path);ut(n);let r=await pt({...e,path:n});if(t.isCurrent&&!t.isCurrent())return{worktrees:r,addedDirectories:[],removedDirectories:[]};let i=r,a=[],o=[];return x.setState(e=>{let t=e.availableWorktreesByProject,s=t.get(n)??[],c=new Map(s.map(e=>[X(e.path),e])),l=r.map(e=>mt(e,c.get(X(e.path)))),u=new Set(l.map(e=>X(e.path)));if(a=l.filter(e=>!c.has(X(e.path))).map(e=>e.path),o=s.filter(e=>!u.has(X(e.path))).map(e=>e.path),i=l,s.length===l.length&&s.every((e,t)=>{let n=l[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus}))return{};let d=new Map(t);return d.set(n,l),{availableWorktreesByProject:d,availableWorktrees:[...d.values()].flat()}}),ht(o),{worktrees:i,addedDirectories:a,removedDirectories:o}}async function _t(e,t){let n=X(e.path),r=await J(n).catch(()=>n),i=nt(t,n),a=await T.worktree.create(n,i),o=typeof a?.name==`string`?a.name:``,s=typeof a?.branch==`string`?a.branch:``,c=typeof a?.path==`string`?a.path:``;if(!o||!c)throw Error(`Worktree create missing name/path`);let l={source:`sdk`,name:o,path:X(c),projectDirectory:r,branch:s,label:s||o,worktreeRoot:X(c),worktreeStatus:et(a?.bootstrapStatus),headState:s?`branch`:`unborn`,worktreeSource:`created-for-session`};a?.bootstrapStatus?h(l.path,a.bootstrapStatus):te(l.path),b(l.path,{onFailed:()=>Z(l.path,`invalid`),onReady:()=>Z(l.path,`ready`)}),ut(n),Je();let u=n;return x.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(u)??[];return t.set(u,[...n.filter(e=>X(e.path)!==l.path),l]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),l}async function vt(e,t){let n=e.path,r=nt(t,n);return T.worktree.validate(n,r)}async function yt(e,t,n){let r=X(e.path),i=!!n?.deleteRemoteBranch,a=n?.deleteLocalBranch===!0,o=n?.remoteName;if(!(await T.worktree.remove(r,{directory:t.path,deleteLocalBranch:a}))?.success)throw Error(`Worktree removal failed`);g(t.path),ut(X(e.path)),Je();let s=X(t.path),c=r,l=x.getState().availableWorktreesByProject,u=new Map(l),d=u.get(c)??[];u.set(c,d.filter(e=>X(e.path)!==s)),ht([s]),x.setState({availableWorktreesByProject:u,availableWorktrees:x.getState().availableWorktrees.filter(e=>X(e.path)!==s)});let f=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&f&&await ie(r,{branch:f,remote:o}).catch(()=>void 0)}var bt=200,$=new Map,xt=[{key:`code`,Icon:`code-box`,label:`Code`},{key:`terminal`,Icon:`terminal-box`,label:`Terminal`},{key:`rocket`,Icon:`rocket`,label:`Rocket`},{key:`flask`,Icon:`flask`,label:`Lab`},{key:`gamepad`,Icon:`gamepad`,label:`Game`},{key:`briefcase`,Icon:`briefcase`,label:`Work`},{key:`home`,Icon:`home`,label:`Home`},{key:`globe`,Icon:`global`,label:`Web`},{key:`leaf`,Icon:`leaf`,label:`Nature`},{key:`shield`,Icon:`shield`,label:`Security`},{key:`palette`,Icon:`palette`,label:`Design`},{key:`server`,Icon:`server`,label:`Server`},{key:`phone`,Icon:`smartphone`,label:`Mobile`},{key:`database`,Icon:`database-2`,label:`Data`},{key:`lightbulb`,Icon:`lightbulb`,label:`Idea`},{key:`music`,Icon:`music`,label:`Music`},{key:`camera`,Icon:`camera`,label:`Media`},{key:`book`,Icon:`book-open`,label:`Docs`},{key:`heart`,Icon:`heart`,label:`Favorite`}],St=Object.fromEntries(xt.map(e=>[e.key,e.Icon])),Ct=[{key:`keyword`,label:`Purple`,cssVar:`var(--syntax-keyword)`},{key:`string`,label:`Green`,cssVar:`var(--syntax-string)`},{key:`number`,label:`Pink`,cssVar:`var(--syntax-number)`},{key:`type`,label:`Gold`,cssVar:`var(--syntax-type)`},{key:`constant`,label:`Cyan`,cssVar:`var(--syntax-constant)`},{key:`comment`,label:`Muted`,cssVar:`var(--syntax-comment)`},{key:`error`,label:`Red`,cssVar:`var(--status-error)`},{key:`primary`,label:`Blue`,cssVar:`var(--primary)`},{key:`success`,label:`Green`,cssVar:`var(--status-success)`}],wt=Object.fromEntries(Ct.map(e=>[e.key,e.cssVar])),Tt=(e,t)=>{if(typeof e!=`number`||e<=0)return null;let n=new URLSearchParams({v:String(e)});return typeof t?.iconColor==`string`&&t.iconColor.trim()&&n.set(`iconColor`,t.iconColor.trim()),(t?.themeVariant===`light`||t?.themeVariant===`dark`)&&n.set(`theme`,t.themeVariant),n},Et=(e,t)=>e?[n()||`same-origin`,e,t.toString()].join(`|`):null,Dt=(e,t,n)=>{let r=Tt(t,n);if(!r)return null;let i=Et(e,r);return i?{cacheKey:i,projectId:e,query:r}:null},Ot=()=>{for(;$.size>bt;){let e=$.keys().next().value;if(typeof e!=`string`)return;let t=$.get(e);t?.url&&typeof URL<`u`&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(t.url),$.delete(e)}},kt=e=>{let t=$.get(e.cacheKey);if(t?.url)return Promise.resolve(t.url);if(t?.promise)return t.promise;let n=r(`/api/projects/${encodeURIComponent(e.projectId)}/icon`,{method:`GET`,headers:{Accept:`image/*`},query:e.query}).then(async t=>{if(!t.ok||typeof URL>`u`||typeof URL.createObjectURL!=`function`)return null;let n=await t.blob(),r=URL.createObjectURL(n);return $.set(e.cacheKey,{url:r}),Ot(),r}).catch(()=>null).finally(()=>{let t=$.get(e.cacheKey);t?.promise===n&&!t.url&&$.delete(e.cacheKey)});return $.set(e.cacheKey,{promise:n}),n},At=(e,t)=>{let n=(0,k.c)(10),r=e.id,i=e.iconImage?.updatedAt,a=t?.themeVariant,o=t?.iconColor,s;n[0]!==o||n[1]!==r||n[2]!==a||n[3]!==i?(s=Dt(r,i,{themeVariant:a,iconColor:o}),n[0]=o,n[1]=r,n[2]=a,n[3]=i,n[4]=s):s=n[4];let c=s,l;n[5]===c?l=n[6]:(l=()=>c?$.get(c.cacheKey)?.url??null:null,n[5]=c,n[6]=l);let[u,d]=O.useState(l),f,p;return n[7]===c?(f=n[8],p=n[9]):(f=()=>{if(!c){d(null);return}let e=$.get(c.cacheKey)?.url;if(e){d(e);return}let t=!1;return d(null),kt(c).then(e=>{t||d(e)}),()=>{t=!0}},p=[c],n[7]=c,n[8]=f,n[9]=p),O.useEffect(f,p),u},jt=e=>{let t=(0,k.c)(21),{project:n,options:r,className:i,alt:a,draggable:o,fallback:s,onError:c}=e,l=a===void 0?``:a,u=o!==void 0&&o,d=s===void 0?null:s,f=At(n,r),[p,m]=O.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1)},t[0]=h):h=t[0];let g=n.iconImage?.updatedAt,_;if(t[1]!==n.id||t[2]!==f||t[3]!==g?(_=[f,n.id,g],t[1]=n.id,t[2]=f,t[3]=g,t[4]=_):_=t[4],O.useEffect(h,_),!f||p){let e;return t[5]===d?e=t[6]:(e=O.createElement(O.Fragment,null,d),t[5]=d,t[6]=e),e}let v;if(t[7]!==l||t[8]!==i||t[9]!==u||t[10]!==c||t[11]!==f){let e;t[13]===c?e=t[14]:(e=e=>{m(!0),c?.(e)},t[13]=c,t[14]=e);let n;t[15]!==l||t[16]!==i||t[17]!==u||t[18]!==f||t[19]!==e?(n={src:f,alt:l,className:i,draggable:u,onError:e},t[15]=l,t[16]=i,t[17]=u,t[18]=f,t[19]=e,t[20]=n):n=t[20],v=O.createElement(`img`,n),t[7]=l,t[8]=i,t[9]=u,t[10]=c,t[11]=f,t[12]=v}else v=t[12];return v};export{Se as _,jt as a,pt as c,rt as d,Xe as f,we as g,ze as h,St as i,yt as l,R as m,wt as n,_t as o,U as p,xt as r,gt as s,Ct as t,vt as u};
|