@yuriai/web 0.2.0-beta.3 → 0.2.0-beta.5
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-k7s0gPMz.js → AgentAvatar-DtMkzQZ_.js} +1 -1
- package/dist/assets/{AssistantView-CLKNSmK0.js → AssistantView-6O3NFtqC.js} +3 -3
- package/dist/assets/DiagramView-Hher-h6H.js +1 -0
- package/dist/assets/{FadeInOnReveal-DuelAGXz.js → FadeInOnReveal-TjU_WL37.js} +1 -1
- package/dist/assets/{GuiPluginSurface-736HcjIN.js → GuiPluginSurface-DXeqcfY3.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BHbqKl7P.js → GuiPluginWindow-BZJ8izaH.js} +1 -1
- package/dist/assets/{Icon-BX4GW-k_.js → Icon-giRdbrNf.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-OnlbaJBG.js → ImageLoadingPlaceholder-iyU1QhoP.js} +1 -1
- package/dist/assets/{LoadingImage-DDEN3tpH.js → LoadingImage-C7a7GyLc.js} +1 -1
- package/dist/assets/MarkdownRenderer-D3_fpssn.js +2 -0
- package/dist/assets/MarkdownRendererImpl-DVoAsYmS.js +10 -0
- package/dist/assets/MarkstreamRendererImpl-CV6jjTpf.js +3 -0
- package/dist/assets/{MobileDetailNavigation-BEB3hlJ1.js → MobileDetailNavigation-DuSr0tTA.js} +1 -1
- package/dist/assets/{MobileResizableSheet-THVjYOSA.js → MobileResizableSheet-inQgquPH.js} +1 -1
- package/dist/assets/MobileShareBridge-CgATSPbV.js +4 -0
- package/dist/assets/MobileTabPageHeader-uJ8dKmgd.js +2 -0
- package/dist/assets/{MultiRunWindow-Bi3aly9b.js → MultiRunWindow-DZ1j0Dkd.js} +1 -1
- package/dist/assets/OnboardingScreen-B4FMt-Wd.js +1 -0
- package/dist/assets/{OverlayScrollbar-C-Od80p5.js → OverlayScrollbar-DJDdcmwv.js} +1 -1
- package/dist/assets/SettingsView-sGrAs9ve.js +26 -0
- package/dist/assets/{SettingsWindow-B24JgZnf.js → SettingsWindow-CS2FMIfT.js} +1 -1
- package/dist/assets/TerminalView-CVPedDHn.js +8 -0
- package/dist/assets/{ToolOutputDialog-gcD1fSaB.js → ToolOutputDialog-iRAV-k1u.js} +1 -1
- package/dist/assets/{YuriLogo-DvKVga_x.js → YuriLogo-BqA0pCyD.js} +1 -1
- package/dist/assets/{appThemeRegistry-ktbSDOFk.js → appThemeRegistry-Bhv6nS-u.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-BIxi1vPM.js → assistant-attachment-cache-tZmmQ6I2.js} +1 -1
- package/dist/assets/button-D6gHjV_f.js +1 -0
- package/dist/assets/{capgoAdapter-3Uy_m4Za.js → capgoAdapter-0ZtbMR6Z.js} +1 -1
- package/dist/assets/{collapsible-BT03pxhm.js → collapsible-CnA0u5S9.js} +1 -1
- package/dist/assets/desktop-DpAcrF1h.js +1 -0
- package/dist/assets/desktopHosts-CjH4TGh8.js +1 -0
- package/dist/assets/desktopRelayRestore-BLJo3sm7.js +1 -0
- package/dist/assets/device-D6RHIV_h.js +2 -0
- package/dist/assets/{diagram-1AdssMXJ.js → diagram-DwYOPB42.js} +1 -1
- package/dist/assets/{dialog-DLc0nKV7.js → dialog-D6iTQ8x_.js} +1 -1
- package/dist/assets/{dropdown-menu.styles-B-E_v3QZ.js → dropdown-menu.styles-BRW8BT1V.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-bVnePHdS.js → fileMentionTouchSelection-wDv5vIb4.js} +2 -2
- package/dist/assets/{path-utils-QNmCUIdP.js → fileQueries-QvEzQ4wT.js} +1 -1
- package/dist/assets/fileReferenceActions-DuYvTiGf.js +1 -0
- package/dist/assets/{fileReferenceParser-D6pFtXag.js → fileReferenceParser-1HHDBUum.js} +1 -1
- package/dist/assets/{gitApi-DccSJMYl.js → gitApi-CVxUMiqs.js} +1 -1
- package/dist/assets/host-srMXY66T.js +1 -0
- package/dist/assets/{image-loading-ClwkpTt4.js → image-loading-2rgFmXBb.js} +1 -1
- package/dist/assets/{input-BhopRvzu.js → input-BJ-BM-aV.js} +1 -1
- package/dist/assets/insertionBoundaries-Ctgm0pX6.js +1 -0
- package/dist/assets/main-BH5wC5YF.js +2 -0
- package/dist/assets/main-C52hcXbF.js +169 -0
- package/dist/assets/{markdownHeightCache-Ci4Phpkv.js → markdownHeightCache-BWX84Di3.js} +1 -1
- package/dist/assets/{mcpQueries-CFR_danB.js → mcpQueries-DyCIeQmm.js} +1 -1
- package/dist/assets/miniChat-DoZ6DORs.js +2 -0
- package/dist/assets/mobile-yjjnJFod.js +2 -0
- package/dist/assets/{mobileBackNavigation-i40NmwxE.js → mobileBackNavigation-gnihJDQb.js} +1 -1
- package/dist/assets/multirun-C11LDNc0.js +3 -0
- package/dist/assets/{native-config-BU8ochmh.js → native-config-BupiMhBe.js} +1 -1
- package/dist/assets/path-utils-jGozTg9d.js +1 -0
- package/dist/assets/persistence-D-W3L37Z.js +3 -0
- package/dist/assets/platform-BxfprX15.js +7 -0
- package/dist/assets/{projectMeta-Ddp_NxcI.js → projectMeta-CgbRkhl1.js} +1 -1
- package/dist/assets/{readiness-CydU25xC.js → readiness-D6Yhaj2W.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-TX-wG67x.js +2 -0
- package/dist/assets/renderMobileApp-B-GAh_XB.js +28 -0
- package/dist/assets/{runtime-file-download-CwMwe_O9.js → runtime-file-download-BHIiwnLA.js} +1 -1
- package/dist/assets/runtime-file-resource-4US6DwDy.js +2 -0
- package/dist/assets/runtimeConfig-BZbfvch8.js +2 -0
- package/dist/assets/runtimeEndpointReset-BJz7-nQ-.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-CE4sIXxf.js → scheduledTaskNavigation-8rJFjQWy.js} +1 -1
- package/dist/assets/sessionChangeSummary-zFviJimG.js +1 -0
- package/dist/assets/{sessionLookup-Mz6LvD5p.js → sessionLookup-DKJNcuN_.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-dKp0SH4C.js → sortable-tabs-strip-kyGjL8Ym.js} +1 -1
- package/dist/assets/speechSettingsQueries-1kzEZaDk.js +4 -0
- package/dist/assets/{terminalApi-Bs5skvIp.js → terminalApi-CbdyLKQc.js} +1 -1
- package/dist/assets/{textarea-CaGuTnhs.js → textarea-COmti5oi.js} +1 -1
- package/dist/assets/{tooltip-Bxj4llmx.js → tooltip-DoKFlr59.js} +1 -1
- package/dist/assets/{types-DoaGaihV.js → types-DYDLQOKT.js} +1 -1
- package/dist/assets/{useAppFontEffects-sz1UI2pZ.js → useAppFontEffects-BFMuXOWZ.js} +29 -29
- package/dist/assets/useDesktopWindowControlsLayout-BRmymxlE.js +1 -0
- package/dist/assets/{useEffectiveDirectory-Ct1Akmfw.js → useEffectiveDirectory-B_KnXAgL.js} +1 -1
- package/dist/assets/{useFontPreferences-n13Q1-rH.js → useFontPreferences-B7zZSuJJ.js} +1 -1
- package/dist/assets/useMobileNavigationStore-DT5mNqWh.js +417 -0
- package/dist/assets/{useWorkerHighlightedLines-B3R3cGBi.js → useWorkerHighlightedLines-CUUmS5X0.js} +1 -1
- package/dist/index.html +17 -15
- package/dist/mini-chat.html +17 -15
- package/dist/mobile.html +17 -15
- package/package.json +1 -1
- package/server/lib/fs/DOCUMENTATION.md +1 -0
- package/server/lib/fs/binary-file.d.ts +3 -0
- package/server/lib/fs/binary-file.js +21 -0
- package/server/lib/fs/routes.js +1 -21
- package/server/lib/fs/routes.test.js +43 -0
- package/dist/assets/DiagramView-C_urOuXu.js +0 -1
- package/dist/assets/MarkdownRenderer-CRYQRJ6O.js +0 -2
- package/dist/assets/MarkdownRendererImpl-DJcRI0hT.js +0 -10
- package/dist/assets/MarkstreamRendererImpl-BffzWk4G.js +0 -3
- package/dist/assets/MobileShareBridge-9gdwpoAb.js +0 -4
- package/dist/assets/MobileTabPageHeader-Dh5mqOcK.js +0 -2
- package/dist/assets/OnboardingScreen-BHomvleJ.js +0 -1
- package/dist/assets/SettingsView-CIPoAFnD.js +0 -26
- package/dist/assets/TerminalView-BWutwGtP.js +0 -8
- package/dist/assets/button-4sNruiRJ.js +0 -1
- package/dist/assets/desktopHosts-DNc_ga0E.js +0 -1
- package/dist/assets/desktopRelayRestore-BWl7Zy8M.js +0 -1
- package/dist/assets/device-B-trKdcC.js +0 -2
- package/dist/assets/fileReferenceActions-Ca5wtvOa.js +0 -1
- package/dist/assets/host-u2MH0QSP.js +0 -1
- package/dist/assets/insertionBoundaries-BZgMtXXz.js +0 -1
- package/dist/assets/main-DSa1W5SA.js +0 -2
- package/dist/assets/main-HBpfFsY-.js +0 -169
- package/dist/assets/miniChat-DcG2PyMu.js +0 -2
- package/dist/assets/mobile-DGUDmzLl.js +0 -2
- package/dist/assets/multirun-D-E3RJbf.js +0 -3
- package/dist/assets/persistence-CcGnI3Ek.js +0 -3
- package/dist/assets/platform-CxNhofMC.js +0 -7
- package/dist/assets/renderElectronMiniChatApp-C11y4O8g.js +0 -2
- package/dist/assets/renderMobileApp-BeJqGLid.js +0 -28
- package/dist/assets/runtime-file-resource-yx0xpKe-.js +0 -2
- package/dist/assets/runtimeConfig-xiF5snk3.js +0 -2
- package/dist/assets/runtimeEndpointReset-CWOI8alW.js +0 -149
- package/dist/assets/sessionChangeSummary-DA1ZMfkC.js +0 -1
- package/dist/assets/speechSettingsQueries-CYiiOuya.js +0 -4
- package/dist/assets/useDesktopWindowControlsLayout-D_0gn_5u.js +0 -1
- package/dist/assets/useMobileNavigationStore-BdTMlKQU.js +0 -417
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{r as i}from"./button-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{r as i}from"./button-D6gHjV_f.js";import{t as a}from"./agentColors-DWSbQXy2.js";import{n as o,t as s}from"./vendor-dicebear-core-CV95S5Pg.js";import{n as c,t as l}from"./vendor-dicebear-styles-7lEG-JsF.js";import{t as u}from"./dualLimitLru-D8Sphgua.js";import{t as d}from"./useThemeSystem-8jhE4Zyk.js";var f=e(t(),1),p=r(),m={background:`#c1f2c4`},h={assistant:new o(c),agent:new o(l)},g=new u({maxEntries:128,maxBytes:1048576});function _(e,t,n=!1,r){let i=e===`agent`?t?.trim().toLowerCase()||`default`:t||`default`,a=e===`agent`?(r??m).background.replace(`#`,``):`00000000`,o=JSON.stringify([e,i,a,e===`assistant`&&n]),c=g.get(o);if(c!==void 0)return c;let l;return l=e===`agent`?new s(h.agent,{seed:i,size:128,idRandomization:!1,borderRadius:0,backgroundColor:[a]}).toDataUri():new s(h.assistant,{seed:i,size:128,scale:1.2,backgroundColor:[`00000000`],idRandomization:!1,animationVariant:n?`fastest`:`none`}).toDataUri(),g.set(o,l,(o.length+l.length)*2),l}var v=(e,t)=>({background:t(e)||m.background}),y=e=>{let t=(0,p.c)(5),n;t[0]===e?n=t[1]:(n=a(e),t[0]=e,t[1]=n);let r=n.var,i=d()?.currentTheme.colors,o;if(t[2]!==r||t[3]!==i){let e=i?{"--status-success":i.status.success,"--status-info":i.status.info,"--status-warning":i.status.warning,"--syntax-keyword":i.syntax.base.keyword,"--syntax-type":i.syntax.base.type,"--syntax-function":i.syntax.base.function,"--syntax-number":i.syntax.base.number,"--syntax-variable":i.syntax.base.variable}:{};o=v(r,t=>e[t]??``),t[2]=r,t[3]=i,t[4]=o}else o=t[4];return o},b=n(),x=f.memo(e=>{let t=(0,p.c)(33),{name:n,kind:r,animated:o,emoji:s,size:c,shape:l,className:u,label:d}=e,f=r===void 0?`agent`:r,m=o!==void 0&&o,h=c===void 0?16:c,g=l===void 0?`rounded`:l,v=a(n),x=y(n),S;bb0:{if(s){S=void 0;break bb0}if(f!==`agent`){let e;t[0]!==m||t[1]!==f||t[2]!==n?(e=_(f,n,m),t[0]=m,t[1]=f,t[2]=n,t[3]=e):e=t[3],S=e;break bb0}let e;t[4]!==m||t[5]!==f||t[6]!==n||t[7]!==x?(e=_(f,n,m,x),t[4]=m,t[5]=f,t[6]=n,t[7]=x,t[8]=e):e=t[8],S=e}let C=S,w=i(`inline-flex aspect-square shrink-0 overflow-clip`,g===`square`?`rounded-none`:g===`circle`?`rounded-full`:`rounded-sm`,s&&`items-center justify-center select-none`,v.class,u),T=`calc(${h}px * var(--dpt-n, 1))`,E=`calc(${h}px * var(--dpt-n, 1))`,D=`calc(${h}px * var(--dpt-n, 1))`,O=`calc(${h}px * var(--dpt-n, 1))`,k=`calc(${h}px * var(--dpt-n, 1))`,A=`calc(${h}px * var(--dpt-n, 1))`,j=`var(${v.var})`,M;t[9]===s?M=t[10]:(M=s?{display:`inline-flex`,alignItems:`center`,justifyContent:`center`}:null,t[9]=s,t[10]=M);let N;t[11]!==O||t[12]!==k||t[13]!==A||t[14]!==j||t[15]!==M||t[16]!==T||t[17]!==E||t[18]!==D?(N={width:T,minWidth:E,maxWidth:D,height:O,minHeight:k,maxHeight:A,color:j,...M},t[11]=O,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=T,t[17]=E,t[18]=D,t[19]=N):N=t[19];let P=d?`img`:void 0,F=!d||void 0,I;t[20]!==C||t[21]!==s||t[22]!==h?(I=s?(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-full w-full items-center justify-center leading-none`,style:{fontSize:`calc(${h*.75}px * var(--dpt-n, 1))`,lineHeight:1,transform:`translateY(0.06em)`},children:s}):(0,b.jsx)(`img`,{src:C,alt:``,draggable:!1,className:`block h-full w-full max-h-full max-w-full object-contain`,"aria-hidden":`true`}),t[20]=C,t[21]=s,t[22]=h,t[23]=I):I=t[23];let L;return t[24]!==f||t[25]!==d||t[26]!==g||t[27]!==N||t[28]!==P||t[29]!==F||t[30]!==I||t[31]!==w?(L=(0,b.jsx)(`span`,{className:w,style:N,"data-agent-avatar":``,"data-avatar-kind":f,"data-agent-avatar-shape":g,role:P,"aria-label":d,"aria-hidden":F,children:I}),t[24]=f,t[25]=d,t[26]=g,t[27]=N,t[28]=P,t[29]=F,t[30]=I,t[31]=w,t[32]=L):L=t[32],L});export{v as i,y as n,_ as r,x as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{c as n,i as r,n as i}from"./runtime-switch-CAZiOV2G.js";import{$ as a,B as o,J as s,K as c,U as l,X as u,q as d,st as f,z as p}from"./persistence-CcGnI3Ek.js";import{it as m,rt as h}from"./vendor-base-ui-CdzJ6My_.js";import{n as g,r as _}from"./platform-CxNhofMC.js";import{n as v}from"./useUIStore-NMQx_cnG.js";import{n as y}from"./vendor-react-BP2cRVqX.js";import{s as b}from"./vendor-tanstack-react-query-CdqCAt40.js";import{o as x}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as S}from"./vendor-sonner-ZS8XIOVl.js";import{a as C,d as w,f as T,i as E,n as D,r as O}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as k,r as A,t as j}from"./button-4sNruiRJ.js";import{a as M,n as N}from"./MobileShareBridge-9gdwpoAb.js";import{E as P,M as F,P as I,T as L,_ as R,c as z,d as B,g as V,i as ee,n as te,o as H,p as U,r as W,t as ne,u as re,y as G}from"./MobileDetailNavigation-BEB3hlJ1.js";import{Fr as ie,Pr as ae,Sn as oe,ct as se,o as ce,qt as K,wo as le}from"./useMobileNavigationStore-BdTMlKQU.js";import{i as ue,n as de,r as fe}from"./useAssistantUIStore-D7JZlg_Q.js";import{t as q}from"./AgentAvatar-k7s0gPMz.js";import{n as J}from"./Icon-BX4GW-k_.js";import{a as Y,i as pe,n as me,o as he,r as ge,t as X}from"./dialog-DLc0nKV7.js";import{r as _e}from"./device-B-trKdcC.js";import{c as ve,s as ye}from"./image-loading-ClwkpTt4.js";import{E as be,S as xe,T as Se,a as Z,c as Ce,d as we,f as Te,i as Ee,l as De,m as Oe,n as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,w as Fe,y as Ie}from"./sessionChangeSummary-DA1ZMfkC.js";import{c as Le,o as Re,t as ze}from"./vendor-framer-motion-DsGBcZHB.js";import{a as Be,n as Ve,r as He,t as Ue}from"./fileMentionTouchSelection-bVnePHdS.js";import{a as We,o as Ge,t as Ke}from"./MarkdownRenderer-CRYQRJ6O.js";import{n as qe}from"./textarea-CaGuTnhs.js";import{t as Je}from"./ImageLoadingPlaceholder-OnlbaJBG.js";import{t as Ye}from"./LoadingImage-DDEN3tpH.js";import{t as Xe}from"./vendor-motion-CIQx6DBb.js";import{a as Ze,c as Qe,l as $e,o as et,s as tt,t as nt}from"./scheduledTaskNavigation-CE4sIXxf.js";import{a as rt,c as it,i as at,s as ot,t as st}from"./sessionLookup-Mz6LvD5p.js";import{i as ct,n as lt,r as ut}from"./assistant-attachment-cache-BIxi1vPM.js";var dt=y(),Q=t(m(),1),$=h();function ft({snapshot:e,rowClassName:t,compact:n=!1}){let{t:r}=k(),[i,a]=Q.useState(!1),o=Q.useRef(!1),s=D(async()=>{if(!o.current){o.current=!0,a(!0);try{(await re(e)).failed&&S.error(r(`assistants.unread.markAllFailed`))}catch{S.error(r(`assistants.unread.markAllFailed`))}finally{o.current=!1,a(!1)}}}),c=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!c?null:(0,$.jsx)(`div`,{className:t,style:n&&!c?{visibility:`hidden`}:void 0,children:(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`xs`,onClick:s,className:n?`h-auto bg-transparent px-1 py-1 text-[11px] font-normal text-muted-foreground hover:bg-transparent whitespace-nowrap`:`max-w-full whitespace-normal text-right`,disabled:i||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":i,children:r(`assistants.unread.markAll`)})})}var pt=e=>{let t=(0,dt.c)(21),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c}=e,l=i===void 0?24:i,u=s===void 0||s,{t:d}=k(),f;t[0]!==n||t[1]!==o?(f=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=f):f=t[2];let p=at(f),m=!!(o||p),h=`calc(${l}px * var(--dpt-n, 1))`,g;t[3]===c?g=t[4]:(g=A(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=g);let _;t[5]===h?_=t[6]:(_={width:h,minWidth:h,maxWidth:h,height:h,minHeight:h,maxHeight:h},t[5]=h,t[6]=_);let v=r??n,y;t[7]!==m||t[8]!==a||t[9]!==l||t[10]!==v?(y=(0,$.jsx)(q,{kind:`assistant`,animated:m,name:v,size:l,label:a,shape:`rounded`,className:`rounded-[0.5rem]`}),t[7]=m,t[8]=a,t[9]=l,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==d||t[14]!==o?(b=o&&u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-background`,"data-assistant-working-dot":``,"aria-label":d(`assistants.contact.working`)}):null,t[12]=u,t[13]=d,t[14]=o,t[15]=b):b=t[15];let x;return t[16]!==g||t[17]!==_||t[18]!==y||t[19]!==b?(x=(0,$.jsxs)(`span`,{className:g,style:_,"data-assistant-working-avatar":``,children:[y,b]}),t[16]=g,t[17]=_,t[18]=y,t[19]=b,t[20]=x):x=t[20],x},mt=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(P)&&Number.isFinite(new Date(n.createdAt).getTime()))return{timestamp:n.createdAt,empty:!1}}return{timestamp:void 0,empty:e.generation>=0&&e.olderComplete&&!e.hasMessageGap}},ht=(e,t)=>{let n=(0,dt.c)(5),r;n[0]!==e||n[1]!==t?(r=W(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;return n[3]===r?i=n[4]:(i={...r,enabled:!1,select:mt},n[3]=r,n[4]=i),b(i)},gt=3e5,_t=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function vt(e){let t=new Map,n=null;for(let r of e){if(!(r.status===`error`||r.status===`failed`||r.parts.some(e=>e.type!==`text`||e.text.trim()&&!e.text.trim().startsWith(`yuri.settle.`)&&!e.text.trim().startsWith(`oc.settle.`))))continue;let e=new Date(r.createdAt);Number.isFinite(e.getTime())&&((!n||!_t(n,e)||e.getTime()-n.getTime()>gt)&&t.set(r.messageID,r.createdAt),n=e)}return t}function yt(e,t,n){let r=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),i=new Intl.DateTimeFormat(e,{month:`long`,day:`numeric`}),a=new Intl.DateTimeFormat(e,{year:`numeric`,month:`long`,day:`numeric`});return e=>{let o=new Date(e);return`${_t(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var bt=Q.memo(e=>{let t=(0,dt.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=k(),s=rt(n,r),c=ht(n,ve()),l;t[0]!==c||t[1]!==i?(l=i!==void 0&&Number.isFinite(new Date(i).getTime())?i:c.data?.timestamp,t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=new Date().toDateString(),t[3]=d):d=t[3];let f=d,p;t[4]===a?p=t[5]:(p=a(`common.date.today`),t[4]=a,t[5]=p);let m=p,h;bb0:{if(u===void 0){h=null;break bb0}let e;t[6]!==o||t[7]!==u||t[8]!==m?(e=yt(o,m,new Date(f))(u),t[6]=o,t[7]=u,t[8]=m,t[9]=e):e=t[9],h=e}let g=h,_;t[10]!==c||t[11]!==g||t[12]!==a||t[13]!==s?(_=s?a(`assistants.conversation.typing`):g?a(`assistants.conversation.lastContact`,{time:g}):c.data?.empty?a(`assistants.conversation.neverContacted`):c.isError?a(`assistants.contact.loadFailed`):a(`common.loading`),t[10]=c,t[11]=g,t[12]=a,t[13]=s,t[14]=_):_=t[14];let v=_,y;return t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`mt-1 block truncate typography-micro font-normal leading-4 text-muted-foreground/70`,"aria-live":`polite`,title:v,children:v}),t[15]=v,t[16]=y),y});function xt(e){let t=(0,dt.c)(12),{assistantID:n,position:a}=e,o=Q.useRef(null),s=Q.useRef(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={busy:!1,done:!1,retryAt:0},t[0]=c):c=t[0];let l=Q.useRef(c),[u]=Q.useState(Dt),d;t[1]!==n||t[2]!==a||t[3]!==u?(d=()=>{let e=o.current;if(!e||!s.current||l.current.busy||l.current.done||Date.now()<l.current.retryAt||u.transport!==r()||u.generation!==i()||document.visibilityState!==`visible`||(g()?!document.documentElement.classList.contains(`yuri-native-app-active`):!document.hasFocus())||e.parentElement?.closest(`[inert], [aria-hidden="true"]`))return;let t=e.closest(`[data-assistant-contact-transcript]`);if(!t||t.scrollHeight-t.scrollTop-t.clientHeight>2)return;let c=e.getBoundingClientRect(),d=t.getBoundingClientRect(),f=window.visualViewport,p=f?.offsetTop??0,m=p+(f?.height??window.innerHeight);c.height<=0||c.width<=0||c.bottom>Math.min(d.bottom,m)||c.top<Math.max(d.top,p)||c.right<=Math.max(d.left,0)||c.left>=Math.min(d.right,window.innerWidth)||(l.current.busy=!0,B(n,a).then(()=>{l.current.done=!0}).catch(()=>{l.current.retryAt=Date.now()+15e3}).finally(()=>{l.current.busy=!1}))},t[1]=n,t[2]=a,t[3]=u,t[4]=d):d=t[4];let f=D(d),p;t[5]===f?p=t[6]:(p=e=>{s.current=e.some(Et),f()},t[5]=f,t[6]=p);let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m={threshold:1},t[7]=m):m=t[7],E(o,D(p),m),O(`visibilitychange`,f,Tt),O(`focus`,f,wt),O(`resize`,f,Ct);let h,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>o.current?.closest(`[data-assistant-contact-transcript]`),_={passive:!0},t[8]=h,t[9]=_):(h=t[8],_=t[9]),O(`scroll`,f,h,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={attributes:!0,attributeFilter:[`class`]},t[10]=v):v=t[10],w(f,St,v),C(f,15e3);let y;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`span`,{ref:o,"aria-hidden":`true`,className:`absolute bottom-0 left-0 block h-px w-px`,"data-assistant-read-marker":``}),t[11]=y):y=t[11],y}function St(){return document.documentElement}function Ct(){return window.visualViewport}function wt(){return window}function Tt(){return document}function Et(e){return e.isIntersecting&&e.intersectionRatio===1}function Dt(){return{transport:r(),generation:i()}}var Ot=()=>{},kt=Q.memo(be),At=e=>e?.directories.flatMap(({directory:e,sessions:t})=>e?t.filter(e=>!e.time.archived).map(t=>({...t,directory:e||t.location?.directory||t.directory||``})).filter(e=>e.directory.length>0):[])??null,jt=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=k(),c=ve(),l=b({...ie(c),select:At}),u=Q.useMemo(()=>se({sessions:l.data??[],currentSessionId:null,searchQuery:e}),[l.data,e]),[d,f]=Q.useState({query:e,index:0}),p=Math.min(d.query===e?d.index:0,Math.max(0,u.length-1)),m=Q.useRef(null),h=Q.useRef([]),g=Q.useMemo(Ue,[]);O(`pointerdown`,e=>{e.target instanceof Node&&!m.current?.contains(e.target)&&a()},void 0,{capture:!0}),Q.useLayoutEffect(()=>{h.current[p]?.scrollIntoView?.({block:`nearest`})},[p]),Q.useLayoutEffect(()=>{r(u.length?`${n}-${p}`:void 0)},[p,n,u.length,r]);let _=D(t=>{if(t===`Escape`){a();return}u.length&&(t===`ArrowDown`&&f({query:e,index:(p+1)%u.length}),t===`ArrowUp`&&f({query:e,index:(p-1+u.length)%u.length}),(t===`Enter`||t===`Tab`)&&i(u[p]))});return Q.useImperativeHandle(o,()=>({keyDown:_}),[_]),(0,$.jsxs)(Ve,{ref:m,isMobile:t,className:`max-w-[640px] max-h-64`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-3 py-1`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`assistants.contact.sessionMention.scope`)}),(0,$.jsx)(j,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(J,{name:`close`,className:`size-4`})})]}),l.isPending?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(`common.loading`)}):null,l.isError?(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 typography-meta text-[var(--status-error)]`,children:[s(`assistants.contact.sessionMention.loadFailed`),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void l.refetch(),children:s(`chat.history.retry`)})]}):null,l.isSuccess&&!u.length?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(l.data===null?`common.unavailable`:`sessions.sidebar.empty.noMatches.title`)}):null,(0,$.jsx)(qe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,$.jsx)(`div`,{id:n,role:`listbox`,"aria-label":s(`chat.fileMentionAutocomplete.groups.sessions`),className:`p-1.5`,children:u.map((r,a)=>(0,$.jsxs)(`div`,{id:`${n}-${a}`,role:`option`,"aria-selected":a===p,ref:e=>{h.current[a]=e},className:A(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,He(t,a===p)),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>f({query:e,index:a}),onPointerDown:e=>{e.pointerType===`touch`&&g.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&g.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&g.pointerUp(()=>i(r))&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>g.pointerCancel(),onClick:()=>g.click(()=>i(r)),children:[(0,$.jsx)(J,{name:`chat-thread`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium leading-5`,title:r.title,children:r.title||s(`chat.fileMentionAutocomplete.untitledSession`)}),(0,$.jsx)(`div`,{className:`truncate text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,title:r.directory,children:r.directory})]})]},`${r.directory}:${r.id}`))})}),t?null:(0,$.jsx)(`div`,{className:`mx-1.5 shrink-0 border-t px-1.5 py-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`chat.autocomplete.keyboardHint`)})]})}),Mt=e=>{let t=(0,dt.c)(122),n,r,i,a,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],u=t[5]):({active:n,working:u,onChange:r,onVoiceSend:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=u);let m=u!==void 0&&u,{t:h}=k(),g=Q.useRef(null),_=n&&!!a.isMobile&&!!i,v;t[6]===_?v=t[7]:(v={available:_},t[6]=_,t[7]=v);let{enabled:y,hint:b,onHintChange:x}=Se(v),S;t[8]!==b||t[9]!==a.placeholder||t[10]!==h?(S=b===null?a.placeholder:h(b===`recording`?`chat.dictation.releaseSend`:b===`cancelling`?`chat.dictation.releaseCancel`:b===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[8]=b,t[9]=a.placeholder,t[10]=h,t[11]=S):S=t[11];let C=S,w;t[12]===a.value?w=t[13]:(w=()=>({canonical:a.value,document:l(a.value,new Map)}),t[12]=a.value,t[13]=w);let[T,E]=Q.useState(w),O;t[14]!==T.canonical||t[15]!==T.document||t[16]!==a.value?(O=T.canonical===a.value?T.document:l(a.value,new Map),t[14]=T.canonical,t[15]=T.document,t[16]=a.value,t[17]=O):O=t[17];let j=O,[M,N]=Q.useState(0),[P,F]=Q.useState(!0),[I,L]=Q.useState(!1),[R,z]=Q.useState(),B=Q.useRef(null),V=Q.useRef(null),ee=Q.useRef(null),te=Q.useRef(null),H;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(H=De(),t[18]=H):H=t[18];let U=Q.useRef(H),W=Q.useId(),ne;t[19]!==n||t[20]!==I||t[21]!==M||t[22]!==P||t[23]!==j.text||t[24]!==a.disabled||t[25]!==a.pending?(ne=n&&!a.pending&&!a.disabled&&!P&&!I?Be({text:j.text,cursor:M}):null,t[19]=n,t[20]=I,t[21]=M,t[22]=P,t[23]=j.text,t[24]=a.disabled,t[25]=a.pending,t[26]=ne):ne=t[26];let re=ne,G=re?.kind===`mention`?re:null,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>{te.current!==null&&(B.current?.focus({preventScroll:!0}),B.current?.setSelectionRange(te.current,te.current),te.current=null)},t[27]=ie):ie=t[27];let ae;t[28]===j?ae=t[29]:(ae=[j],t[28]=j,t[29]=ae),Q.useLayoutEffect(ie,ae);let oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>F(!0),t[30]=oe):oe=t[30];let se=D(oe),ce;t[31]!==I||t[32]!==M||t[33]!==j||t[34]!==r?(ce=(e,t,n)=>{let i=n===void 0||n,a=s(e);a.ok&&(i&&(U.current=Pe(U.current,{before:Ce(j,[],{start:B.current?.selectionStart??M,end:B.current?.selectionEnd??M}),after:Ce(e,[],{start:t,end:t})})),I||(te.current=t),N(t),E({canonical:a.text,document:e}),r(a.text))},t[31]=I,t[32]=M,t[33]=j,t[34]=r,t[35]=ce):ce=t[35];let K=D(ce),le;t[36]!==K||t[37]!==j||t[38]!==G||t[39]!==h?(le=e=>{if(!G)return;let t=e.title||h(`chat.fileMentionAutocomplete.untitledSession`),n=o(j,G.tokenStart,G.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:f({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);F(!0),K(n.document,r)},t[36]=K,t[37]=j,t[38]=G,t[39]=h,t[40]=le):le=t[40];let ue=D(le),de;t[41]!==n||t[42]!==K||t[43]!==j||t[44]!==a.disabled||t[45]!==a.pending?(de=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=j.text?`${j.text} ${e}`:e,r=c(j,t,t.length,t.length);K(r.document,r.caret),F(!0)},t[41]=n,t[42]=K,t[43]=j,t[44]=a.disabled,t[45]=a.pending,t[46]=de):de=t[46];let fe=D(de),q;t[47]!==n||t[48]!==j.text||t[49]!==fe||t[50]!==r||t[51]!==i||t[52]!==a.disabled||t[53]!==a.pending?(q=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(j.text){fe(e);return}r(e),i?.(e)}},t[47]=n,t[48]=j.text,t[49]=fe,t[50]=r,t[51]=i,t[52]=a.disabled,t[53]=a.pending,t[54]=q):q=t[54];let J=D(q),Y;t[55]!==K||t[56]!==j?(Y=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!j.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=p(n.selectionStart,n.selectionEnd,j.references)??{start:n.selectionStart,end:n.selectionEnd},i=s({text:j.text.slice(r.start,r.end),references:j.references.filter(e=>e.start>=r.start&&e.end<=r.end).map(e=>({...e,start:e.start-r.start,end:e.end-r.start}))});if(i.ok&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,i.text),t)){let e=c(j,j.text.slice(0,r.start)+j.text.slice(r.end),r.start,r.start);K(e.document,e.caret)}},t[55]=K,t[56]=j,t[57]=Y):Y=t[57];let pe=D(Y),me;t[58]!==j.references||t[59]!==j.text?(me=Oe(j.text,j.references.map(Nt))?.map(Pt),t[58]=j.references,t[59]=j.text,t[60]=me):me=t[60];let he=me,ge=y&&j.text.length===0?`true`:void 0,X;t[61]!==y||t[62]!==fe||t[63]!==a.disabled||t[64]!==a.pending||t[65]!==J||t[66]!==x?(X=y&&(0,$.jsx)(kt,{containerRef:g,disabled:!!(a.pending||a.disabled),onInsert:fe,onSend:J,onRelease:Ot,onHintChange:x}),t[61]=y,t[62]=fe,t[63]=a.disabled,t[64]=a.pending,t[65]=J,t[66]=x,t[67]=X):X=t[67];let _e=j.text,ve=a.pending||m,ye;t[68]===a?ye=t[69]:(ye=()=>{a.pending||a.onSubmit()},t[68]=a,t[69]=ye);let be=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,Z;t[70]!==a.textLayoutClassName||t[71]!==be?(Z=A(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,be,a.textLayoutClassName),t[70]=a.textLayoutClassName,t[71]=be,t[72]=Z):Z=t[72];let Ee;t[73]!==K||t[74]!==j?(Ee=(e,t)=>{let n=c(j,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);K(n.document,n.caret),F(t?.nativeEvent?.inputType===`insertFromPaste`)},t[73]=K,t[74]=j,t[75]=Ee):Ee=t[75];let ke=G?W:void 0,Ae=G?R:void 0,je;t[76]===a.textareaProps?je=t[77]:(je=e=>{a.textareaProps?.onScroll?.(e),V.current&&(V.current.scrollTop=e.currentTarget.scrollTop,V.current.scrollLeft=e.currentTarget.scrollLeft)},t[76]=a.textareaProps,t[77]=je);let Me,Ne;t[78]!==pe||t[79]!==a.textareaProps?(Me=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},Ne=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[78]=pe,t[79]=a.textareaProps,t[80]=Me,t[81]=Ne):(Me=t[80],Ne=t[81]);let Fe;t[82]===a.textareaProps?Fe=t[83]:(Fe=e=>{N(e.currentTarget.selectionStart),a.textareaProps?.onSelect?.(e)},t[82]=a.textareaProps,t[83]=Fe);let Le,Re;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>{L(!0)},Re=e=>{L(!1),N(e.currentTarget.selectionStart)},t[84]=Le,t[85]=Re):(Le=t[84],Re=t[85]);let ze;t[86]!==K||t[87]!==I||t[88]!==j||t[89]!==G||t[90]!==a.textareaProps?(ze=e=>{if(a.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||xe(e))){if(I){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?we(U.current,j):Te(U.current,j);t&&(e.preventDefault(),U.current=t.history,K(t.snapshot.document,t.snapshot.selection.end,!1),F(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=d(j,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),K(t.document,t.caret),F(!0);return}}G&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),ee.current?.keyDown(e.key))}},t[86]=K,t[87]=I,t[88]=j,t[89]=G,t[90]=a.textareaProps,t[91]=ze):ze=t[91];let Ve;t[92]!==a.textareaProps||t[93]!==ke||t[94]!==Ae||t[95]!==je||t[96]!==Me||t[97]!==Ne||t[98]!==Fe||t[99]!==ze?(Ve={...a.textareaProps,"aria-controls":ke,"aria-activedescendant":Ae,"aria-autocomplete":`list`,onScroll:je,onCopy:Me,onCut:Ne,onSelect:Fe,onCompositionStart:Le,onCompositionEnd:Re,onKeyDown:ze},t[92]=a.textareaProps,t[93]=ke,t[94]=Ae,t[95]=je,t[96]=Me,t[97]=Ne,t[98]=Fe,t[99]=ze,t[100]=Ve):Ve=t[100];let He;t[101]!==se||t[102]!==W||t[103]!==G||t[104]!==a.isMobile||t[105]!==ue?(He=G?(0,$.jsx)(jt,{ref:ee,query:G.query,isMobile:a.isMobile??!1,listId:W,onHighlightChange:z,onSelect:ue,onClose:se}):null,t[101]=se,t[102]=W,t[103]=G,t[104]=a.isMobile,t[105]=ue,t[106]=He):He=t[106];let Ue;t[107]!==j.text||t[108]!==he||t[109]!==C||t[110]!==a||t[111]!==ve||t[112]!==ye||t[113]!==Z||t[114]!==Ee||t[115]!==Ve||t[116]!==He?(Ue=(0,$.jsx)(Ie,{...a,value:_e,pending:ve,placeholder:C,disableInputWhilePending:!1,inputRef:B,onSubmit:ye,highlightedContent:he,highlightRef:V,textLayoutClassName:Z,onChange:Ee,textareaProps:Ve,children:He}),t[107]=j.text,t[108]=he,t[109]=C,t[110]=a,t[111]=ve,t[112]=ye,t[113]=Z,t[114]=Ee,t[115]=Ve,t[116]=He,t[117]=Ue):Ue=t[117];let We;return t[118]!==ge||t[119]!==X||t[120]!==Ue?(We=(0,$.jsxs)(`div`,{ref:g,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":ge,children:[X,Ue]}),t[118]=ge,t[119]=X,t[120]=Ue,t[121]=We):We=t[121],We};function Nt(e){return{start:e.start,end:e.end,priority:103,...u(e)}}function Pt(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(Ae,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var Ft=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function It({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=k(),i=ve(),{attachmentID:a,sha256:o,size:s,mime:c,filename:l}=t,u=Q.useMemo(()=>({type:`file`,attachmentID:a,sha256:o,size:s,mime:c,filename:l}),[a,o,s,c,l]),d=c.startsWith(`image/`),f=We(l??``,c),[p,m]=Q.useState(0),[h,g]=Q.useState(``),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x=Q.useRef(null),S=Q.useRef([]);Q.useEffect(()=>{g(``),v(!1);let t=new AbortController,n;return d&&ut(e,u,{signal:t.signal}).then(e=>{if(t.signal.aborted){e.release();return}n=e.release,g(e.url)}).catch(()=>{t.signal.aborted||v(!0)}),()=>{t.abort(),n?.()}},[e,u,i,d,p]),Q.useEffect(()=>()=>{x.current?.abort(),S.current.forEach(e=>URL.revokeObjectURL(e)),S.current=[]},[e,u,i]);let C=D(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await lt(e,u,{signal:i.signal});if(i.signal.aborted)return;S.current.forEach(e=>URL.revokeObjectURL(e));let o=URL.createObjectURL(a);if(S.current=[o],t&&n){n({open:!0,title:l||r(`assistants.contact.attachment.file`),content:``,video:{url:o,mimeType:c,filename:l}});return}let s=document.createElement(`a`);s.href=o,s.download=l||r(`assistants.contact.attachment.file`),document.body.appendChild(s),s.click(),s.remove()}catch{i.signal.aborted||v(!0)}finally{x.current===i&&(x.current=null),i.signal.aborted||b(!1)}}),w=l||r(d?`assistants.contact.attachment.image`:`assistants.contact.attachment.file`),T=D(e=>{!n||!h||n({open:!0,title:w,content:``,metadata:{tool:`image-preview`,filename:w,mime:c},previewSource:e.currentTarget,image:{url:h,mimeType:c,filename:w,size:s,gallery:[{url:h,mimeType:c,filename:w,size:s}],index:0}})});return d&&h&&!_?(0,$.jsx)(Ye,{src:h,alt:w,contentFrame:!0,className:Ft,onError:()=>v(!0),onClick:T,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T(e))},role:`button`,tabIndex:0,"data-assistant-contact-image":``}):d&&!_?(0,$.jsx)(Je,{className:`h-[var(--yuri-content-image-height)] w-[min(20rem,100%)] rounded-[1.35rem]`}):(0,$.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5 ring-1 ring-inset ring-[var(--surface-subtle)]`,"data-assistant-contact-file":``,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(J,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:w})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:r(`assistants.contact.attachment.loadFailed`)}):null,d&&!_||y?(0,$.jsx)(`span`,{role:`status`,className:`typography-micro text-muted-foreground`,children:r(`common.loading`)}):(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:d?()=>m(e=>e+1):()=>void C(f&&!!n),children:r(_?`chat.history.retry`:f&&n?`contextPanel.mode.preview`:`assistants.contact.attachment.download`)})]})}function Lt(e){let t=(0,dt.c)(39),{part:n,onShowPopup:r}=e,{t:i}=k(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=ye(a,``),[s,c]=Q.useState(!1),l;t[0]!==n.filename||t[1]!==i?(l=n.filename||i(`assistants.contact.attachment.image`),t[0]=n.filename,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]!==u||t[4]!==r||t[5]!==o?(d=e=>{!r||!o||r({open:!0,title:u,content:``,metadata:{tool:`image-preview`,filename:u},previewSource:e.currentTarget,image:{url:o,filename:u,gallery:[{url:o,filename:u}],index:0}})},t[3]=u,t[4]=r,t[5]=o,t[6]=d):d=t[6];let f=D(d);if(We(a,n.mime)&&a&&r){let e;t[7]!==r||t[8]!==n.filename||t[9]!==n.mime||t[10]!==a||t[11]!==i?(e=()=>r({open:!0,title:n.filename||i(`assistants.contact.attachment.file`),content:``,video:{url:a,filename:n.filename,mimeType:n.mime}}),t[7]=r,t[8]=n.filename,t[9]=n.mime,t[10]=a,t[11]=i,t[12]=e):e=t[12];let o;t[13]!==n.filename||t[14]!==i?(o=n.filename||i(`contextPanel.mode.preview`),t[13]=n.filename,t[14]=i,t[15]=o):o=t[15];let s;return t[16]!==e||t[17]!==o?(s=(0,$.jsx)(j,{variant:`secondary`,size:`sm`,onClick:e,children:o}),t[16]=e,t[17]=o,t[18]=s):s=t[18],s}if(n.mime.startsWith(`image/`)&&o&&!s){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>c(!0),t[19]=e):e=t[19];let n;t[20]===f?n=t[21]:(n=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},t[20]=f,t[21]=n);let r;return t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==n?(r=(0,$.jsx)(Ye,{src:o,alt:u,contentFrame:!0,className:Ft,onError:e,onClick:f,onKeyDown:n,role:`button`,tabIndex:0,"data-assistant-contact-image":``}),t[22]=u,t[23]=f,t[24]=o,t[25]=n,t[26]=r):r=t[26],r}let p;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(J,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),t[27]=p):p=t[27];let m;t[28]!==n.filename||t[29]!==i?(m=n.filename||i(`assistants.contact.attachment.file`),t[28]=n.filename,t[29]=i,t[30]=m):m=t[30];let h;t[31]===m?h=t[32]:(h=(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:m}),t[31]=m,t[32]=h);let g;t[33]!==s||t[34]!==i?(g=s?(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>c(!1),children:i(`chat.history.retry`)}):null,t[33]=s,t[34]=i,t[35]=g):g=t[35];let _;return t[36]!==h||t[37]!==g?(_=(0,$.jsxs)(`div`,{className:`flex max-w-full items-center gap-2.5 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5`,"data-assistant-contact-file":``,children:[p,h,g]}),t[36]=h,t[37]=g,t[38]=_):_=t[38],_}function Rt(e){let t=(0,dt.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=ve(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(It,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(Lt,{part:r,onShowPopup:i},`${a}:${r.url}`),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o):o=t[4],o}var zt=[],Bt=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
|
|
3
|
-
`),Vt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),Ht=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Ut=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Wt=(e,t,n,r)=>({messageID:t?`${e.turnID}:preview:${t.bubbleIndex}`:`${e.turnID}:preview:${r}`,assistantID:e.assistantID,role:`assistant`,turnID:e.turnID,bubbleIndex:t?.bubbleIndex??0,createdAt:t?.occurredAt??e.occurredAt,ordinal:n,status:r,fromAssistantID:null,fromAssistantName:null,parts:t?[{type:`text`,text:t.text}]:[],text:t?.text??``,cards:[]}),Gt=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>Wt(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,Wt(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,Wt(e,null,n+r.length,`admitted`)]:r},Kt=(e,t,n,r=[])=>{let i=new Set(e.map(e=>e.messageID)),a=t.flatMap((t,r)=>t.assistantID!==n||i.has(t.messageID)?[]:[{messageID:t.messageID,assistantID:n,role:`user`,turnID:t.messageID,bubbleIndex:0,createdAt:t.createdAt,ordinal:e.length+r,status:t.status,fromAssistantID:null,fromAssistantName:null,parts:[...t.parts],text:Bt(t.parts),cards:[]}]),o=a.length===0?e:[...e,...a],s=r.filter(e=>e.assistantID===n);if(s.length===0)return o;let c=new Map,l=new Map;o.forEach((e,t)=>{if(c.set(e.turnID,t),e.role!==`assistant`||e.messageID.includes(`:preview:`))return;let n=l.get(e.turnID)??new Set;n.add(e.bubbleIndex),l.set(e.turnID,n)});let u=new Map,d=[];for(let e of s){let t=Gt(e,l.get(e.turnID)??new Set,o.length+d.length);if(t.length===0)continue;let n=c.get(e.turnID);if(n===void 0){if(e.status===`failed`&&o.some(t=>t.turnID!==e.turnID))continue;d.push(...t);continue}let r=u.get(n)??[];r.push(...t),u.set(n,r)}return u.size===0&&d.length===0?o:o.flatMap((e,t)=>[e,...u.get(t)??[]]).concat(d)},qt=(e,t)=>{let n=new Set(t.map(e=>e.messageID)),r=e.filter(e=>!n.has(e.messageID));return r.length===e.length?e:r},Jt=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),Yt=(e,t,n,r=Date.now())=>{let i=e.filter(e=>e.assistantID!==t||e.status!==`failed`||e.turnID===n);return i.some(e=>e.assistantID===t&&e.turnID===n)?i.length===e.length?e:i:[...i,{assistantID:t,turnID:n,status:`admitted`,bubbles:[],occurredAt:r}]},Xt=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:Yt(e,t.assistantID,t.turnID,t.admittedAt),Zt=(e,t)=>{let n=t.assistantID,r=t.pendingSendTurnIDs??new Set,i=t.settledTurnIDs??new Set,a=typeof t.snapshotRevision==`number`&&Number.isFinite(t.snapshotRevision)?t.snapshotRevision:null,o=t.admissionRevisionByTurnID instanceof Map?t.admissionRevisionByTurnID:new Map(Object.entries(t.admissionRevisionByTurnID??{}).map(([e,t])=>[e,Number(t)])),s=t.occurredAt??Date.now(),c=t.activeContactTurn&&t.activeContactTurn.turnID?t.activeContactTurn:null,l=!!(t.serverWorking||c),u=Xt(e,c?{assistantID:n,turnID:c.turnID,admittedAt:c.admittedAt}:null,i),d=Array.isArray(t.messages)?t.messages:[];for(let e of d)e.role===`assistant`&&e.status===`error`&&(r.has(e.turnID)||i.has(e.turnID)||(u=$t(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=en(u,d),l){let t=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID)||c&&e.turnID===c.turnID)return!0;let t=o.get(e.turnID);return typeof t==`number`&&a!=null&&a<t?!0:typeof t==`number`&&a!=null&&a>=t&&e.turnID!==c?.turnID?!1:!c||e.turnID===c.turnID});return t.length===e.length&&t.every((t,n)=>t===e[n])?e:t}if(a==null)return u.length===e.length&&u.every((t,n)=>t===e[n])?e:u;let f=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID))return!0;if(i.has(e.turnID))return!1;let t=o.get(e.turnID);return typeof t==`number`&&a<t});return f.length===e.length&&f.every((t,n)=>t===e[n])?e:f.length===u.length?u:f},Qt=(e,t)=>Yt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>{if(e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`failed`||e.status===`complete`)return e;let n=e.bubbles.find(e=>e.bubbleIndex===t.bubbleIndex);if(n?.done)return e;let r=n?{...n,text:`${n.text}${t.delta}`,done:t.done,occurredAt:t.occurredAt}:{bubbleIndex:t.bubbleIndex,text:t.delta,done:t.done,occurredAt:t.occurredAt},i=n?e.bubbles.map(e=>e.bubbleIndex===t.bubbleIndex?r:e):[...e.bubbles,r].sort((e,t)=>e.bubbleIndex-t.bubbleIndex);return{...e,status:`streaming`,bubbles:i}}),$t=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:Yt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`complete`||e.status===`failed`?e:{...e,status:t.status===`error`?`failed`:`complete`,...t.error?{error:t.error}:{}}),en=(e,t)=>{let n=new Set(t.map(e=>e.turnID).filter(Boolean)),r=t.length>0?t[t.length-1]?.turnID??null:null,i=[...e].reverse().find(e=>e.status===`admitted`||e.status===`streaming`)?.turnID??r,a=new Set(t.flatMap(e=>e.role===`assistant`?[e.turnID]:[])),o=e.filter(e=>e.status===`admitted`||e.status===`streaming`||!(e.status===`complete`&&a.has(e.turnID)||!n.has(e.turnID)||e.status===`failed`&&(i&&i!==e.turnID||r&&r!==e.turnID)));return o.length===e.length?e:o},tn=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),nn=(e,t)=>{if(e instanceof F){if(e.code===`no_provider`)return t.noProvider;if(e.code===`admission_timeout`||e.code===`generate_timeout`)return t.timedOut;if(e.message&&e.message!==e.code)return e.message}return I(e)?t.timedOut:t.sendFailed},rn=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},an=e=>{let t=e.text.trim();if(e.sending||!t&&e.attachments.length===0||!e.gate.tryAcquire())return{ok:!1};let n=[...t?[{type:`text`,text:t}]:[],...e.attachments.map(e=>({type:`file`,mime:e.mime,url:e.url,filename:e.name}))],r=e.createMessageID();return{ok:!0,messageID:r,parts:n,turn:Vt(e.assistantID,r,n,e.createdAt)}},on=e=>e.some(e=>e.status===`sending`),sn=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`),cn=[`cursor-pointer rounded-[1.35rem] bg-[var(--surface-elevated)] ring-1 ring-inset ring-[var(--surface-subtle)]`,`px-3.5 py-3 text-left transition-[background-color,box-shadow,transform] duration-200 ease-out motion-reduce:transition-none`,`hover:-translate-y-px hover:bg-interactive-hover/45 hover:shadow-sm active:translate-y-0 motion-reduce:hover:translate-y-0`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),ln=`${cn} w-fit min-w-0 max-w-[min(100%,15rem)]`,un=`${cn} w-fit min-w-0 max-w-[min(100%,20rem)]`;function dn(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var fn=e=>{let t=(0,dt.c)(23),{card:n}=e,{t:r}=k(),i=Fe(),a;t[0]===i?a=t[1]:(a=i&&!_(),t[0]=i,t[1]=a);let o=!!a,s=n.name,c=`${n.providerID}/${n.modelID}`,l;t[2]!==n.assistantID||t[3]!==o?(l=()=>{if(o){ce.getState().openAssistant(n.assistantID);return}de(n.assistantID)},t[2]=n.assistantID,t[3]=o,t[4]=l):l=t[4];let u=D(l),d;t[5]===u?d=t[6]:(d=e=>{dn(e,u)},t[5]=u,t[6]=d);let f=D(d),p;t[7]!==r||t[8]!==s?(p=r(`assistants.contact.card.assistant.aria`,{name:s}),t[7]=r,t[8]=s,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`robot-2`,className:`size-5`})})}),t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]===c?g=t[14]:(g=(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:c}),t[13]=c,t[14]=g);let v;t[15]!==h||t[16]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[h,g]})]}),t[15]=h,t[16]=g,t[17]=v):v=t[17];let y;return t[18]!==f||t[19]!==u||t[20]!==p||t[21]!==v?(y=(0,$.jsx)(`article`,{className:ln,role:`button`,tabIndex:0,"aria-label":p,"data-assistant-contact-card":`assistant`,onClick:u,onKeyDown:f,children:v}),t[18]=f,t[19]=u,t[20]=p,t[21]=v,t[22]=y):y=t[22],y},pn=e=>{let t=(0,dt.c)(30),{card:n}=e,{t:r}=k(),i=n.name,a;t[0]!==n.kind||t[1]!==r?(a=n.kind===`daily`||n.kind===`weekly`||n.kind===`once`||n.kind===`cron`?r(`sessions.scheduledTasks.editor.scheduleType.${n.kind}`):n.kind,t[0]=n.kind,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==n.time||t[4]!==o?(s=[o,n.time].filter(Boolean),t[3]=n.time,t[4]=o,t[5]=s):s=t[5];let c=s.join(` · `),l;t[6]!==n.prompt||t[7]!==c?(l=c.trim()||(typeof n.prompt==`string`?n.prompt.trim():``),t[6]=n.prompt,t[7]=c,t[8]=l):l=t[8];let u=l,d;t[9]!==n.projectID||t[10]!==n.taskID?(d=()=>{nt(n.projectID,n.taskID)},t[9]=n.projectID,t[10]=n.taskID,t[11]=d):d=t[11];let f=D(d),p;t[12]===f?p=t[13]:(p=e=>{dn(e,f)},t[12]=f,t[13]=p);let m=D(p),h;t[14]!==r||t[15]!==i?(h=r(`assistants.contact.card.schedule.aria`,{name:i}),t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`calendar`,className:`size-5`})})}),t[17]=g):g=t[17];let _;t[18]===i?_=t[19]:(_=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:i}),t[18]=i,t[19]=_);let v;t[20]===u?v=t[21]:(v=u?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:u}):null,t[20]=u,t[21]=v);let y;t[22]!==_||t[23]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[_,v]})]}),t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;return t[25]!==m||t[26]!==f||t[27]!==y||t[28]!==h?(b=(0,$.jsx)(`article`,{className:ln,role:`button`,tabIndex:0,"aria-label":h,"data-assistant-contact-card":`schedule`,onClick:f,onKeyDown:m,children:y}),t[25]=m,t[26]=f,t[27]=y,t[28]=h,t[29]=b):b=t[29],b},mn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`?t:e===`idle`?`complete`:t===`busy`||t===`retry`||t===`idle`?t:t||`busy`,hn=e=>e===`cancelled`?`assistants.contact.card.session.status.cancelled`:e===`busy`?`assistants.contact.card.session.status.busy`:e===`retry`?`assistants.contact.card.session.status.retry`:e===`idle`?`assistants.contact.card.session.status.idle`:e===`complete`?`assistants.contact.card.session.status.complete`:e===`error`?`assistants.contact.card.session.status.error`:e===`question`?`assistants.contact.card.session.status.question`:null,gn=e=>e===`busy`?`bg-[var(--status-info)]/10 text-[var(--status-info)]`:e===`retry`||e===`question`?`bg-[var(--status-warning)]/10 text-[var(--status-warning)]`:e===`error`?`bg-[var(--status-error)]/10 text-[var(--status-error)]`:e===`idle`||e===`complete`?`bg-[var(--status-success)]/10 text-[var(--status-success)]`:`bg-[var(--surface-muted)] text-muted-foreground`,_n=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,vn=e=>{let t=(0,dt.c)(35),{card:n}=e,{t:r}=k(),i=Fe(),a;t[0]===i?a=t[1]:(a=i&&!_(),t[0]=i,t[1]=a);let o=!!a,s;t[2]===n.sessionID?s=t[3]:(s=e=>e.activeSessions.find(e=>e.id===n.sessionID)??e.archivedSessions.find(e=>e.id===n.sessionID)??null,t[2]=n.sessionID,t[3]=s);let c=ae(s),l=K(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=mn(l?.type,n.status),f=hn(d),p=d===`busy`||d===`retry`,m=_n(typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory),h=ke(c)||n.branch,g=Ee(c),y=je(c),b=Ne(y),x=[m,g,h].filter(yn),S;t[4]!==n.directory||t[5]!==n.sessionID||t[6]!==o?(S=()=>{let e=st(n.sessionID)?.directory||n.directory;oe(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||v.getState().setActiveMainTab(`chat`)},t[4]=n.directory,t[5]=n.sessionID,t[6]=o,t[7]=S):S=t[7];let C=D(S),w;t[8]===C?w=t[9]:(w=e=>{dn(e,C)},t[8]=C,t[9]=w);let T=D(w),E=un,O=r(`assistants.contact.card.session.aria`,{title:u}),j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`chat-3`,className:`size-5`})}),t[10]=j):j=t[10];let M;t[11]===p?M=t[12]:(M=p?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-[var(--surface-elevated)]`,"data-assistant-working-dot":``,"aria-hidden":!0}):null,t[11]=p,t[12]=M);let N;t[13]===M?N=t[14]:(N=(0,$.jsxs)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:[j,M]}),t[13]=M,t[14]=N);let P;t[15]===u?P=t[16]:(P=(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:u}),t[15]=u,t[16]=P);let F=f?(0,$.jsx)(`span`,{className:A(`shrink-0 rounded-full px-1.5 py-0.5 typography-micro leading-none`,gn(d)),children:r(f)}):null,I;t[17]!==P||t[18]!==F?(I=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[P,F]}),t[17]=P,t[18]=F,t[19]=I):I=t[19];let L;t[20]===x?L=t[21]:(L=x.length>0?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:x.join(` · `)}):null,t[20]=x,t[21]=L);let R=b||y?.files!==void 0&&y.files>0?(0,$.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-1.5 typography-micro tabular-nums`,children:[y?.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,y.additions]}),y?.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,y.deletions]}),y?.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:y.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:y.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:y.files})})]}):null,z;t[22]!==I||t[23]!==L||t[24]!==R?(z=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[I,L,R]}),t[22]=I,t[23]=L,t[24]=R,t[25]=z):z=t[25];let B;t[26]!==N||t[27]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[N,z]}),t[26]=N,t[27]=z,t[28]=B):B=t[28];let V;return t[29]!==T||t[30]!==C||t[31]!==B||t[32]!==E||t[33]!==O?(V=(0,$.jsx)(`article`,{className:E,role:`button`,tabIndex:0,"aria-label":O,"data-assistant-contact-card":`session`,onClick:C,onKeyDown:T,children:B}),t[29]=T,t[30]=C,t[31]=B,t[32]=E,t[33]=O,t[34]=V):V=t[34],V};function yn(e){return!!(e&&e.trim())}var bn=2,xn=1500,Sn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),Cn=e=>e.scrollHeight-e.scrollTop-e.clientHeight,wn=e=>Cn(e)<=bn,Tn=(e,t)=>{let n=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;n&&n!==e;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0;n=n.parentElement}return!1},En=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,Dn=({active:e,assistantID:t,contentRevision:n,onLoadEarlier:r})=>{let i=Q.useRef(null),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(!0),u=Q.useRef(null),d=Q.useRef(null),f=Q.useRef(null),p=Q.useRef(0),m=Q.useRef(null),h=Q.useRef(null),g=Q.useRef(e);g.current=e;let _=ze(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=D(()=>{y.current?.stop(),y.current=null,b.current=null}),S=Q.useMemo(()=>e=>{i.current=e,o(t=>t===e?t:e)},[]),C=Q.useMemo(()=>e=>{c(t=>t===e?t:e)},[]),w=D(()=>{let e=i.current;if(!e||!g.current||l.current)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.getBoundingClientRect().bottom>t);u.current=n?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t,scrollTop:e.scrollTop}:null}),E=D(()=>{let e=i.current,t=u.current;if(!e||!g.current||l.current)return;if(!t){w();return}let n=e.scrollTop-t.scrollTop;if(Math.abs(n)>.5&&m.current){p.current=e.scrollTop,w();return}let r=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.dataset.messageId===t.id);if(!r){w();return}let a=r.getBoundingClientRect().top-e.getBoundingClientRect().top-(t.offset-n);Math.abs(a)>.5&&(e.scrollTop+=a),p.current=e.scrollTop,u.current={id:t.id,offset:r.getBoundingClientRect().top-e.getBoundingClientRect().top,scrollTop:e.scrollTop}}),k=D(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),A=Q.useRef(null),j=D(e=>{let t=i.current;!g.current||!t||(A.current=e??null,l.current=!0,u.current=null,h.current=null,p.current=t.scrollTop)}),M=D(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=Sn(e),n=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(t.scrollTop<n-.5)return x(),l.current=!1,p.current=t.scrollTop,w(),!1;let r=!v.current;if(r&&e.querySelector(`[data-message-id]`)&&(v.current=!0),wn(t))return x(),p.current=t.scrollTop,!1;let a=Math.max(0,t.scrollHeight-t.clientHeight);if(!r&&!_){if(b.current===a)return!1;x(),b.current=a;let t=A.current;return A.current=null,y.current=Re(e.scrollTop,a,{duration:t?.duration??.22,ease:t?[...t.ease]:`easeOut`,onUpdate:t=>{if(!g.current||!l.current||i.current!==e)return;let n=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop<Math.min(p.current,n)-.5){l.current=!1,x(),p.current=e.scrollTop,w();return}e.scrollTop=Math.min(Math.max(e.scrollTop,t),n),p.current=e.scrollTop},onComplete:()=>{y.current=null,b.current=null}}),!0}return x(),e.scrollTop=a,p.current=e.scrollTop,!0}),N=D(e=>{h.current={direction:e,expiresAt:performance.now()+xn}}),P=D(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),F=D(()=>{x(),l.current=!1,w()}),I=D(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=Sn(e),n=t.scrollTop>p.current,a=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(p.current=t.scrollTop,l.current){t.scrollTop<a-.5&&F();return}let o=P();E(),t.scrollTop<=80&&o===`up`&&r?.(),n&&wn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),L=D(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(Me(t,e.target))return;N(`up`),F(),t.scrollTop<=80&&r?.();return}Tn(t,e.target)||N(`down`)}}),R=D(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),z=D(e=>{let t=i.current,n=e.touches.item(0);if(!t||!n){m.current=null;return}let a=m.current;if(!a)return;let o=n.clientY-a.y,s=o*a.deltaY<0,c=(s?0:a.deltaX)+n.clientX-a.x,l=(s?0:a.deltaY)+o;if(m.current={x:n.clientX,y:n.clientY,deltaX:c,deltaY:l},!(Math.abs(c)>=Math.abs(l))){if(l>0&&Me(t,e.target)||l<0&&Tn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}N(l>0?`up`:`down`),l>2&&(F(),t.scrollTop<=80&&r?.())}}),B=D(()=>{m.current=null}),V=D(e=>{if(Z(e)){N(`up`),F(),(i.current?.scrollTop??1/0)<=80&&r?.();return}En(e)&&N(`down`)}),ee=D(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&N(`scrollbar`)});Q.useLayoutEffect(()=>{let n=e?t:null,r=i.current;(d.current!==n||f.current!==r)&&(x(),v.current=!1,d.current=n,f.current=r,l.current=!0,u.current=null,h.current=null,m.current=null,p.current=r?.scrollTop??0),e&&(M(),E())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let te=Q.useMemo(()=>()=>void 0,[]),H=e&&a?a:te,U=Q.useMemo(()=>({passive:!0}),[]);O(`scroll`,I,H,U),O(`wheel`,L,H,U),O(`touchstart`,R,H,U),O(`touchmove`,z,H,U),O(`touchend`,B,H,U),O(`touchcancel`,B,H,U),O(`keydown`,V,H),O(`pointerdown`,ee,H,U);let W=D(()=>{M(),E()});return T(typeof ResizeObserver<`u`&&e?s:null,W),{scrollRef:S,contentRef:C,preparePrepend:k,followLatest:j}},On=.3,kn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],An=[.23,1,.32,1],jn=Le(...kn),Mn=Le(...An),Nn=.15,Pn=.1,Fn=.08,In=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),Ln=e=>Number.parseFloat(e)||0,Rn=(e,t,n)=>e+(t-e)*n,zn=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],Bn=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+Ln(n.borderLeftWidth)+Ln(n.paddingLeft),i=t.top+Ln(n.borderTopWidth)+Ln(n.paddingTop);return{left:r,top:i,width:t.right-Ln(n.borderRightWidth)-Ln(n.paddingRight)-r,height:t.bottom-Ln(n.borderBottomWidth)-Ln(n.paddingBottom)-i}},Vn=e=>({color:e.color,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,fontFeatureSettings:e.fontFeatureSettings,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`}),Hn=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=Bn(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=Vn(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:In(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:zn(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},Un=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},Wn=(e,t,n,r)=>(e.style.opacity=String(t),Re(e,{opacity:[t,n]},{duration:r,ease:`linear`})),Gn=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=zn(i),o=In(t.getBoundingClientRect()),s=Bn(t),c=e.compact?{...e.background,left:e.textBox.left-Ln(i.paddingLeft),width:Math.min(e.background.width,Math.max(120,o.width+32))}:e.background,l={left:c.left,top:c.top+c.height-o.height},u={x:e.textBox.left-l.left-(s.left-o.left),y:e.textBox.top-l.top-(s.top-o.top)},d=Un({position:`fixed`,left:`0px`,top:`0px`,overflow:`hidden`,zIndex:`60`,willChange:`transform, width, height`});d.setAttribute(`aria-hidden`,`true`),d.setAttribute(`data-assistant-contact-send-flight`,``),d.style.backgroundColor=e.backgroundColor;let f=Un({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=Un({...Vn(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=jn(n),i=Mn(n),m=In(t.getBoundingClientRect()),h=c,g=Rn(h.left,m.left,i),_=Rn(h.left+h.width,m.left+m.width,i),v=Rn(h.top+h.height,m.top+m.height,r),y=Rn(h.height,m.height,r),b=v-y;d.style.transform=`translate3d(${g}px, ${b}px, 0)`,d.style.width=`${_-g}px`,d.style.height=`${y}px`,d.style.borderRadius=a.map((t,n)=>`${Rn(Ln(e.radii[n]),Ln(t),r)}px`).join(` `);let x=m.left+(l.left-o.left)*(1-i),S=m.top+(l.top-o.top)*(1-r),C=`translate3d(${x+(s.left-o.left)+u.x*(1-r)-g}px, ${S+(s.top-o.top)+u.y*(1-r)-b}px, 0)`;f.style.transform=C,p.style.transform=C},h=!1,g=[],_=()=>{h||(h=!0,g.forEach(e=>e.stop()),d.remove(),n.style.visibility=``,r?.())};return n.style.visibility=`hidden`,m(0),document.body.appendChild(d),g.push(Re(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:Nn,ease:`linear`}),Wn(f,1,0,Pn),Wn(p,0,1,Fn),Re(0,1,{duration:On,ease:`linear`,onUpdate:m,onComplete:_})),_},Kn=64,qn=e=>{if(!e)return[];let t=Array.from(e.files||[]);return t.length>0?t:Array.from(e.items||[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e instanceof File)},Jn=e=>Array.from(e?.files||[]),Yn=async(e,t=a)=>{let n=[],r=0;for(let i of Array.from(e||[])){if(!i||i.size<=0)continue;if(i.size>26214400){r+=1;continue}let e=URL.createObjectURL(i);n.push({id:t(),url:e,name:i.name.trim()||`attachment`,mime:i.type.trim()||`application/octet-stream`,file:i})}return{attachments:n,skippedTooLarge:r}},Xn=(e,t)=>{let n=[...e,...t];for(let e of n.slice(Kn))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,Kn)},Zn=Ge(()=>x(()=>import(`./ToolOutputDialog-gcD1fSaB.js`),__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]))),Qn=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),$n=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),er=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,tr=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:o}=k(),s=ve(),c=v(e=>e.isMobile),l=V(),u=G(),d=R(e.id,n),f=v(e=>e.isSettingsDialogOpen),p=n&&!f&&!d.hasMessageGap?L(e,d.data):null,m=M(e.name).displayName||e.name,h=(e,t)=>{let n=e?u.data?.assistants.find(t=>t.id===e):void 0;return n?M(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[g,_]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(null),S=Q.useRef(new Map),C=Q.useRef(new AbortController);Q.useEffect(()=>{let e=new AbortController;return C.current=e,()=>e.abort()},[e.id,s]);let w=Q.useRef(new Set);Q.useEffect(()=>{let e=new Set(y.map(e=>e.url));for(let t of w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[y]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[T,E]=Q.useState([]),[O,P]=Q.useState([]),[I,z]=Q.useState(null),[B,H]=Q.useState({open:!1,title:``,content:``}),W=v(e=>e.setImagePreviewOpen),ne=D(e=>{(e.image||e.mermaid||e.video)&&(H(e),W(!0))}),re=D(e=>{H(t=>({...t,open:e})),W(e)});Q.useEffect(()=>()=>{W(!1)},[W]);let ie=Q.useRef(!1);Q.useEffect(()=>{S.current.clear(),x.current=null,E([]),P([]),z(null)},[s]);let ae=Q.useMemo(()=>rn(),[]),oe=Q.useRef(new Set),se=Q.useRef(new Map),ce=at(e=>e.setWorking),K=d.data?.messages??zt,ue=Ht(T,e.id),de=Ut(O,e.id),fe=Kt(K,ue,e.id,de).filter(e=>{if(e.status===`admitted`&&e.messageID.endsWith(`:preview:admitted`))return!1;let t=Array.isArray(e.parts)?e.parts:[];return t.length===0||t.some(e=>!(e.type===`text`&&Qn(e.text)))}),q=fe.length-1;for(;q>=0&&$n(fe[q]);)--q;let Y=fe.filter((e,t)=>!$n(e)||t>q),pe=vt(Y),me=ze(),he=`${s}:${e.id}`,ge=Q.useRef(null),X=ge.current,_e=X?.lastID?Y.findIndex(e=>er(e)===X.lastID):-1,ye=n&&!me&&X?.scope===he&&X.ready&&(X.lastID===null||_e>=0);Q.useLayoutEffect(()=>{let e=Y.at(-1);ge.current={scope:he,ready:n&&d.isSuccess,lastID:e?er(e):null}});let be=new Date().toDateString(),xe=i(`common.date.today`),Se=Q.useMemo(()=>yt(o,xe,new Date(be)),[o,xe,be]),Z=on(ue),Ce=sn(de),we=!!(e.working||e.activeContactTurn),Te=u.data?.revision??null,Ee=de.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),De=new Map(de.map(e=>[e.turnID,e])),Oe=Q.useRef(!1),ke=D(async(e=!1)=>{if(!(!n||Oe.current||d.isFetchingPreviousPage||d.isFillingMessageGap)&&!(e&&d.previousPageError)&&!(!d.hasPreviousPage&&!d.hasMessageGap)){Oe.current=!0,Me();try{d.hasMessageGap?await d.retryMessageGap():await d.fetchPreviousPage()}catch{}finally{Oe.current=!1}}}),{scrollRef:Ae,contentRef:je,preparePrepend:Me,followLatest:Ne}=Dn({active:n,assistantID:e.id,contentRevision:`${Y[0]?.messageID}:${Y.length}:${Ee}:${d.isFetchingPreviousPage}:${d.hasPreviousPage}:${d.isFillingMessageGap}`,onLoadEarlier:()=>{ke(!0)}}),Pe=Q.useRef(null),Fe=Q.useRef(null),Ie=Q.useRef(null),Le=Q.useRef(null),Re=Q.useRef(null),[Be,Ve]=Q.useState(null),He=()=>{let e=Fe.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?Hn(e,t,!c):null};Q.useLayoutEffect(()=>{let e=Ie.current;if(!e)return;Ie.current=null;let t=Array.from(Pe.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>Ve(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Re.current?.(),Re.current=Gn(e.source,t,t,n)}),Q.useEffect(()=>()=>{Ie.current=null,Re.current?.(),Re.current=null},[n,e.id,s]),Q.useEffect(()=>{z(null),oe.current.clear(),se.current=new Map,E(t=>Ht(t,e.id)),P(t=>Ut(t,e.id)),H({open:!1,title:``,content:``}),W(!1)},[e.id,W]),Q.useEffect(()=>{E(e=>qt(e,K))},[K]),Q.useEffect(()=>{let t=new Set(ue.filter(e=>e.status===`sending`).map(e=>e.messageID));P(n=>Zt(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:we,snapshotRevision:Te,admissionRevisionByTurnID:se.current,pendingSendTurnIDs:t,messages:K,settledTurnIDs:oe.current}))},[e.activeContactTurn,e.id,K,ue,we,Te]),Q.useEffect(()=>{ce(e.id,Z||Ce||we)},[e.id,Ce,Z,we,ce]),Q.useEffect(()=>{let t=e.id;return()=>{ce(t,!1)}},[e.id,ce]);let Ue=D(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){oe.current.delete(t.turnID),P(e=>Yt(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(oe.current.has(t.turnID))return;P(e=>Qt(e,t));return}t.type===`contact-turn-end`&&(oe.current.add(t.turnID),P(e=>en($t(e,t,{requireExisting:!0}),K)))}});Q.useEffect(()=>{if(n)return le(Ue)},[n,e.id]);let We=D(async e=>{if(Z)return;let t=C.current,n=await Yn(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&z(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>Xn(e,n.attachments))}),Ge=D(e=>{let t=qn(e.clipboardData);t.length!==0&&(e.preventDefault(),We(t))}),qe=D(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),Je=D(e=>{let t=Jn(e.dataTransfer);t.length!==0&&(e.preventDefault(),We(t))}),Ye=D(async t=>{let r=C.current,o=t??g,s=y,c=e.id,u=x.current,d=u?.assistantID===c&&u.text===o&&u.attachments===s?u.messageID:null,f=an({gate:ae,sending:on(ue),text:o,attachments:s,assistantID:c,createMessageID:()=>d||`yuri_contact_${a()}`});if(!f.ok)return;ce(c,!0),x.current={assistantID:c,text:o,attachments:s,messageID:f.messageID};let p=s.length===0,h=p&&t===void 0&&!d&&n&&!me?He():null;Ie.current=h?{messageID:f.messageID,source:h}:null,Ve(h?{scope:he,messageID:f.messageID}:null),Le.current=h?f.messageID:Le.current,Ne(h?{duration:On,ease:kn}:void 0),p&&_(e=>e===o?``:e),E(e=>[...e.filter(e=>e.messageID!==f.messageID),f.turn]),z(null);let v=()=>{_(e=>e===o?``:e),b(e=>e.filter(e=>!s.includes(e))),s.forEach(e=>S.current.delete(`${c}:${e.id}`)),x.current=null};try{let t=[];for(let e of s){let n=`${c}:${e.id}`,i=S.current.get(n);if(!i){if(i=await ct(c,e.file,e.id,r.signal),r.signal.aborted)return;S.current.set(n,i)}t.push(i)}if(r.signal.aborted)return;let n=[...f.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===f.messageID?{...e,parts:n}:e));let i=await U(c,f.messageID,{parts:n});if(r.signal.aborted)return;v(),typeof i.revision==`number`&&se.current.set(f.messageID,i.revision),E(e=>Jt(e,f.messageID)),oe.current.has(f.messageID)||P(e=>Yt(e,c,f.messageID)),l.data?.serverInstanceID&&N({serverInstanceID:l.data.serverInstanceID,assistantID:c,name:m,avatarSeed:e.avatarSeed??c}).catch(()=>void 0)}catch(e){if(r.signal.aborted)return;if(e instanceof F&&e.code===`admission_timeout`)try{let e=await ee(c,f.messageID);if(r.signal.aborted)return;if(e){v(),typeof e.revision==`number`&&se.current.set(f.messageID,e.revision),E(e=>Jt(e,f.messageID)),oe.current.has(f.messageID)||P(e=>Yt(e,c,f.messageID));return}}catch{}let t=nn(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>tn(e,f.messageID,t)),p&&_(e=>e===``?o:e),z(t)}finally{ae.release()}}),Ze=D(async()=>{if(ie.current)return;ie.current=!0;let t=C.current;z(null);try{await te(e.id,e)}catch(e){t.signal.aborted||z(e instanceof Error?e.message:i(`settings.mcp.page.toast.unexpectedError`))}finally{ie.current=!1}}),Qe=d.isError&&Y.length===0,$e=d.isSuccess&&Y.length===0,et=new Map(ue.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:Pe,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Ae,className:A(`min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 sm:px-8`,c&&`pb-11`,r?`pt-[calc(max(0.625rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height)+1.25rem)]`:`pt-5 sm:pt-7`),style:{overflowAnchor:`none`,overscrollBehavior:`contain`,overscrollBehaviorY:`contain`},"data-assistant-contact-transcript":``,children:[t?(0,$.jsx)(`p`,{className:`mb-3 typography-micro text-[var(--status-warning)]`,children:t}):null,Qe?(0,$.jsxs)(`div`,{ref:je,className:`mx-auto flex h-full min-h-56 max-w-xs flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-error":``,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:m}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -right-1 -bottom-1 flex size-5 items-center justify-center rounded-full bg-[var(--surface-elevated)] text-[var(--status-error)] ring-2 ring-background`,children:(0,$.jsx)(J,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:m}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void d.refetch(),children:i(`chat.history.retry`)})]}):$e?(0,$.jsxs)(`div`,{ref:je,className:`mx-auto flex h-full min-h-56 max-w-sm flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-empty":``,children:[(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:m,className:`opacity-90`}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:m})}),(0,$.jsx)(`p`,{className:`mt-2 max-w-xs typography-ui leading-6 text-muted-foreground/80`,children:i(`assistants.contact.empty`)})]}):(0,$.jsxs)(`div`,{ref:je,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[d.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,d.hasPreviousPage||d.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":d.isFetchingPreviousPage||d.isFillingMessageGap,children:[d.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,d.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,disabled:d.isFetchingPreviousPage||d.isFillingMessageGap,onClick:()=>void ke(),children:i(d.isFetchingPreviousPage||d.isFillingMessageGap?`chat.history.loadingMore`:d.previousPageError||d.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,Y.map((t,n)=>{let r=`${he}:${er(t)}`,a=n>0?Y[n-1]:null,o=pe.get(t.messageID),c=o!==void 0,l=c?(0,$.jsx)(`div`,{className:`flex w-full justify-center px-4 pt-7 pb-4 first:pt-1`,"data-assistant-contact-time":``,children:(0,$.jsx)(`time`,{dateTime:new Date(o).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:Se(o)})}):null,d=t.role===`user`,f=t.role===`peer`,g=t.role===`assistant`&&!c&&a?.role===`assistant`&&a.turnID===t.turnID,_=a?.turnID!==t.turnID,v=!d&&(f||!g),y=f?h(t.fromAssistantID,t.fromAssistantName):m,b=f&&t.fromAssistantID?u.data?.assistants.find(e=>e.id===t.fromAssistantID):e,x=et.get(t.messageID),S=De.get(t.turnID),C=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`);return t.status===`error`||C?(0,$.jsxs)(Q.Fragment,{children:[l,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:A(`relative px-1`,!c&&`mt-3`),children:[(0,$.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap text-center text-[11px] font-normal leading-4 text-muted-foreground [overflow-wrap:anywhere]`,children:t.text||S?.error||i(`assistants.contact.sendFailed`)}),p?.messageID===t.messageID?(0,$.jsx)(xt,{assistantID:e.id,position:p},`${s}:${e.id}:${p.generation}:${p.ordinal}`):null]})]},r):(0,$.jsxs)(Q.Fragment,{children:[l,(0,$.jsxs)(Xe.div,{"data-message-id":t.messageID,initial:ye&&n>_e&&t.messageID!==Le.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:me?0:.18,ease:`easeOut`},className:A(`flex w-full`,d?`justify-end`:`justify-start`,c?`mt-0`:_?`mt-6 first:mt-0`:g?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":x?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!g?``:void 0,children:[d?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-8 shrink-0 justify-center pt-0.5`,children:v?(0,$.jsx)(pt,{name:b?.id||t.fromAssistantID||e.id,avatarSeed:b?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:28,label:y,working:t.status===`streaming`||void 0,showWorkingDot:!1}):(0,$.jsx)(`span`,{className:`size-7`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:A(`relative flex min-w-0 flex-col gap-1.5`,d?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[f?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:y})}):null,t.parts.map((n,a)=>{if(n.type===`card`&&n.cardType===`session`)return(0,$.jsx)(vn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`assistant`)return(0,$.jsx)(fn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`schedule`)return(0,$.jsx)(pn,{card:n},`${r}:card:${a}`);if(n.type===`file`)return(0,$.jsx)(Rt,{assistantID:e.id,part:n,onShowPopup:ne},`${r}:file:${a}`);if(n.type===`text`&&Qn(n.text))return null;if(n.type===`text`&&(n.text.trim()||t.status===`streaming`)){let e=!d,o=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(n.text.trim());return(0,$.jsx)(`div`,{"aria-label":f?i(`assistants.contact.peer.aria`,{name:y}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":o||void 0,className:A(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] typography-markdown leading-6`,o?`p-0`:`px-4 py-2.5`,e?null:`whitespace-pre-wrap`,o?`text-foreground`:d?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:f?`rounded-[1.25rem] border border-dashed border-border/50 bg-[var(--surface-muted)]/70 text-foreground`:`bg-[var(--surface-muted)] text-foreground`),children:e?(0,$.jsx)(Ke,{content:n.text,messageId:r,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:ne,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):n.text},`${r}:text:${a}`)}return null}),x?.status===`sending`?(0,$.jsx)(`p`,{className:`absolute right-1 top-full mt-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.sending`)}):null,x?.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 typography-micro text-[var(--status-error)]`,children:x.error||i(`assistants.contact.sendFailed`)}):null,p?.messageID===t.messageID?(0,$.jsx)(xt,{assistantID:e.id,position:p},`${s}:${e.id}:${p.generation}:${p.ordinal}`):null]})]})]},r)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-1 left-[2.625rem] flex h-10 items-center`,"data-assistant-contact-status-slot":``,children:!Z&&Be?.scope!==he&&(Ce||we)?(0,$.jsxs)(Xe.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!me&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:me?0:.18,ease:`easeOut`},className:`relative inline-flex h-9 origin-bottom-left items-center gap-1 rounded-[1.35rem] bg-[var(--surface-muted)] px-4 text-muted-foreground/70`,"data-assistant-contact-processing":``,children:[(0,$.jsx)(`div`,{className:`absolute -left-[2.625rem] top-0.5 flex w-8 justify-center`,"data-assistant-contact-processing-avatar":``,children:(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:28,label:m,working:!0,showWorkingDot:!1})}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.45s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.22s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-duration:1.4s] motion-reduce:animate-none`})]}):null})]})]}),(0,$.jsxs)(`footer`,{ref:Fe,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[I?(0,$.jsxs)(`div`,{className:`chat-input-column mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:I}),x.current?(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,disabled:Z,onClick:()=>void Ye(),children:i(`chat.history.retry`)}):null]}):null,(0,$.jsx)(`form`,{className:A(`relative w-full pt-1.5 pb-4`,c&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),Ye()},onDragOver:qe,onDrop:Je,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(Mt,{active:n,layout:`inline`,value:g,attachments:y,pending:Z,working:Ce||we,onStop:Ce||we?()=>{Ze()}:void 0,stopLabel:i(`chat.chatInput.actions.stopGeneratingAria`),isMobile:c,placeholder:i(`assistants.contact.placeholder`,{name:m}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>_(e),onVoiceSend:e=>{Ye(e)},onSubmit:()=>{Ye()},onAddFiles:e=>{We(e)},onRemoveAttachment:t=>{Z||(S.current.delete(`${e.id}:${t}`),x.current=null,b(e=>e.filter(e=>e.id!==t)))},onPaste:Ge,onDragOver:qe,onDrop:Je,className:A(`relative z-10`,c&&`yuri-mobile-composer-surface`),style:{borderRadius:`1.5rem`},"data-assistant-contact-composer-surface":``,textareaProps:{"aria-label":i(`assistants.contact.placeholder`,{name:m})}},`${s}:${e.id}`)})})]}),B.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Zn,{popup:B,onOpenChange:re,isMobile:c})}):null]})};async function nr(e){await H(e);let t=ue.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await z();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&ue.getState().setDefaultShareAssistant(null)}function rr({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=k(),[a,o]=Q.useState(!1),s=e?M(e.name).displayName||e.name:``,c=D(e=>{a&&!e||n(e)}),l=D(()=>{a||n(!1)}),u=D(async()=>{if(!(!e||a)){o(!0);try{await nr(e),r?.(e.id),n(!1),S.success(i(`assistants.settings.toast.deleted`))}catch{S.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,$.jsx)(X,{open:t&&e!==null,onOpenChange:c,children:(0,$.jsxs)(me,{className:`max-w-md`,children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(he,{children:i(`assistants.settings.delete`)}),(0,$.jsx)(ge,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,$.jsxs)(pe,{children:[(0,$.jsx)(j,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,$.jsx)(j,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var ir=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,ar={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function or(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?ar[e.fallbackKind]:`assistants.contact.empty`)}var sr=e=>e.capabilityPending?`loading`:e.capabilityError||e.supported!==!0||e.capabilityEnabled!==!0?`unavailable`:e.snapshotPending?`loading`:e.snapshotEnabled===!0?e.assistantCount===0?`onboarding`:e.hasAssistant?`ready`:e.snapshotSettled?`unavailable`:`loading`:`unavailable`,cr=e({AssistantView:()=>dr}),lr=e=>{let t=(0,dt.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=k(),o=Fe(),s;t[0]===n?s=t[1]:(s=n?M(n.name):null,t[0]=n,t[1]=s);let c=s,l=n&&c?c.displayName||n.name:``,u;t[2]!==n||t[3]!==o||t[4]!==i?(u=()=>{if(n){if(i){i(n.id);return}fe(n.id,o?{openMobileSettings:o.openSettings}:void 0)}},t[2]=n,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=D(u),f;t[6]!==n||t[7]!==l||t[8]!==a?(f=n?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(pt,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,$.jsx)(bt,{assistantID:n.id,serverWorking:!!(n.working||n.activeContactTurn),lastContactAt:n.latestMessagePreview?.createdAt})]})]}):l||a(`assistants.title`),t[6]=n,t[7]=l,t[8]=a,t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=a(`assistants.actions.backToChat`),t[10]=a,t[11]=p);let m;t[12]!==n||t[13]!==d||t[14]!==a?(m=n?[{icon:`settings-3`,ariaLabel:a(`assistants.conversation.openSettings`),onClick:d}]:[],t[12]=n,t[13]=d,t[14]=a,t[15]=m):m=t[15];let h;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsx)(ne,{title:f,backAriaLabel:p,onBack:r,actions:m,overlay:!0}),t[16]=r,t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h},ur=e=>{let t=(0,dt.c)(53),{avatarSeed:n,unreadCount:r,summary:i,assistantID:a,displayName:o,selected:s,enabled:c,editLabel:l,deleteLabel:u,onSelect:d,onEdit:f,onDelete:p,serverWorking:m}=e,h=rt(a,m!==void 0&&m),[g,_]=Q.useState(!1),v;t[0]===d?v=t[1]:(v=()=>d(),t[0]=d,t[1]=v);let y=D(v),b;t[2]===f?b=t[3]:(b=()=>{_(!1),f()},t[2]=f,t[3]=b);let x=D(b),S;t[4]===p?S=t[5]:(S=()=>{_(!1),p()},t[4]=p,t[5]=S);let C=D(S),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),_(!0)},t[6]=w):w=t[6];let T=s?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,E=!c&&`opacity-65`,O;t[7]!==T||t[8]!==E?(O=A(`flex w-full min-h-11 items-center gap-3 rounded-xl border px-3 py-3 text-left outline-none transition-[background-color,border-color,opacity] duration-150 ease-out active:bg-interactive-active focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,T,E),t[7]=T,t[8]=E,t[9]=O):O=t[9];let k;t[10]!==y||t[11]!==s||t[12]!==O?(k=(0,$.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":s,onClick:y,onContextMenu:w,className:O}),t[10]=y,t[11]=s,t[12]=O,t[13]=k):k=t[13];let j;t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==h?(j=(0,$.jsx)(pt,{name:a,avatarSeed:n,size:44,label:o,working:h}),t[14]=a,t[15]=n,t[16]=o,t[17]=h,t[18]=j):j=t[18];let M=s?`font-semibold`:`font-medium`,N;t[19]===M?N=t[20]:(N=A(`block truncate typography-ui-label leading-5`,M),t[19]=M,t[20]=N);let P;t[21]!==o||t[22]!==N?(P=(0,$.jsx)(`span`,{className:N,children:o}),t[21]=o,t[22]=N,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=A(ir,`mt-1 leading-5`),t[24]=F):F=t[24];let I;t[25]===i?I=t[26]:(I=(0,$.jsx)(`span`,{className:F,children:i}),t[25]=i,t[26]=I);let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]===r?R=t[31]:(R=(0,$.jsx)(ot,{count:r,className:`h-3.5 min-w-3.5 bg-[oklch(from_var(--primary-base)_calc(l_*_0.78)_c_h)] px-1 text-[10px] text-[var(--color-white)] shadow-none`}),t[30]=r,t[31]=R);let z;t[32]!==j||t[33]!==L||t[34]!==R||t[35]!==k?(z=(0,$.jsxs)($e,{render:k,children:[j,L,R]}),t[32]=j,t[33]=L,t[34]=R,t[35]=k,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(J,{name:`edit`,className:`size-4`}),t[37]=B):B=t[37];let V;t[38]!==l||t[39]!==x?(V=(0,$.jsxs)(tt,{onClick:x,children:[B,l]}),t[38]=l,t[39]=x,t[40]=V):V=t[40];let ee;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Qe,{}),t[41]=ee):ee=t[41];let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(J,{name:`delete-bin`,className:`size-4`}),t[42]=te):te=t[42];let H;t[43]!==u||t[44]!==C?(H=(0,$.jsxs)(tt,{onClick:C,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[te,u]}),t[43]=u,t[44]=C,t[45]=H):H=t[45];let U;t[46]!==V||t[47]!==H?(U=(0,$.jsxs)(et,{className:`min-w-[10rem]`,children:[V,ee,H]}),t[46]=V,t[47]=H,t[48]=U):U=t[48];let W;return t[49]!==g||t[50]!==z||t[51]!==U?(W=(0,$.jsxs)(Ze,{open:g,onOpenChange:_,children:[z,U]}),t[49]=g,t[50]=z,t[51]=U,t[52]=W):W=t[52],W},dr=e=>{let t=(0,dt.c)(118),{activeOverride:i,onMobileBack:a,onMobileOpenSettings:o}=e,{t:s}=k(),{isMobile:c}=_e(),l=Fe(),u=Q.useSyncExternalStore(n,r,r),d=v(fr),f=i??d,p=v(pr),m=c||p,h=V(),g=G(),_=g.data;_?.assistants;let y;t[0]===_?.assistants?y=t[1]:(y=_?.assistants??[],t[0]=_?.assistants,t[1]=y);let b;t[2]===y?b=t[3]:(b=it(y),t[2]=y,t[3]=b);let x=b,S;t[4]===u?S=t[5]:(S=e=>e.assistantByTransport[u]??null,t[4]=u,t[5]=S);let C=ue(S),w=ue(mr),T=ue(hr),E;t[6]!==C||t[7]!==_?.assistants?(E=_?.assistants.find(e=>e.id===C)??null,t[6]=C,t[7]=_?.assistants,t[8]=E):E=t[8];let O=E,N;t[9]!==w||t[10]!==C||t[11]!==_?(N=()=>{!C&&_?.assistants[0]&&w(_.assistants[0].id)},t[9]=w,t[10]=C,t[11]=_,t[12]=N):N=t[12];let P=_?.assistants,F;t[13]!==w||t[14]!==C||t[15]!==P?(F=[w,C,P],t[13]=w,t[14]=C,t[15]=P,t[16]=F):F=t[16],Q.useEffect(N,F);let I;t[17]!==O||t[18]!==w||t[19]!==C||t[20]!==_?.assistants||t[21]!==g.isSuccess?(I=()=>{g.isSuccess&&C&&!O&&w(_?.assistants[0]?.id??null)},t[17]=O,t[18]=w,t[19]=C,t[20]=_?.assistants,t[21]=g.isSuccess,t[22]=I):I=t[22];let L=_?.assistants,R;t[23]!==O||t[24]!==w||t[25]!==C||t[26]!==g.isSuccess||t[27]!==L?(R=[O,w,C,L,g.isSuccess],t[23]=O,t[24]=w,t[25]=C,t[26]=g.isSuccess,t[27]=L,t[28]=R):R=t[28],Q.useEffect(I,R);let z;t[29]!==l||t[30]!==T?(z=()=>{if(T(),l){l.openSettings();return}let e=v.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=T,t[31]=z):z=t[31];let B=D(z),ee;t[32]===l?ee=t[33]:(ee=e=>{fe(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=ee);let te=D(ee),H;t[34]!==O||t[35]!==l?(H=()=>{O&&fe(O.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=O,t[35]=l,t[36]=H):H=t[36];let U=D(H),[W,ne]=Q.useState(null),re;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{ne(e)},t[37]=re):re=t[37];let ie=D(re),ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{e||ne(null)},t[38]=ae):ae=t[38];let oe=D(ae),se=D(gr),ce;t[39]!==a||t[40]!==se?(ce=()=>{if(a){a();return}se()},t[39]=a,t[40]=se,t[41]=ce):ce=t[41];let K=D(ce),le=sr({capabilityPending:h.isPending,snapshotPending:g.isPending,capabilityError:h.isError,supported:h.data?.supported,capabilityEnabled:h.data?.enabled,snapshotEnabled:_?.enabled,snapshotSettled:g.isSuccess,assistantCount:_?.assistants.length??0,hasAssistant:!!O}),de;t[42]!==O||t[43]!==K||t[44]!==m||t[45]!==o?(de=(e,t,n,r)=>(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[m?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):null,(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,children:[(0,$.jsx)(J,{name:e,className:`size-6 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,$.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,$.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=O,t[43]=K,t[44]=m,t[45]=o,t[46]=de):de=t[46];let q=de;if(le===`loading`){let e;t[47]!==O||t[48]!==K||t[49]!==m||t[50]!==o?(e=m?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):null,t[47]=O,t[48]=K,t[49]=m,t[50]=o,t[51]=e):e=t[51];let n;t[52]===s?n=t[53]:(n=s(`common.loading`),t[52]=s,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(J,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`}),t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,"aria-busy":`true`,"aria-label":n,"data-assistant-workspace-loading":``,children:r}),t[55]=n,t[56]=i);let a;return t[57]!==e||t[58]!==i?(a=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[e,i]}),t[57]=e,t[58]=i,t[59]=a):a=t[59],a}if(le===`unavailable`){let e;return t[60]!==q||t[61]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[60]=q,t[61]=s,t[62]=e):e=t[62],e}if(le===`onboarding`){let e;if(t[63]!==B||t[64]!==q||t[65]!==s){let n=s(`assistants.onboarding.title`),r=s(`assistants.onboarding.description`),i;t[67]===s?i=t[68]:(i=s(`assistants.onboarding.action`),t[67]=s,t[68]=i);let a;t[69]!==B||t[70]!==i?(a=(0,$.jsx)(j,{onClick:B,children:i}),t[69]=B,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=B,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!_||!O){let e;return t[72]!==q||t[73]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[72]=q,t[73]=s,t[74]=e):e=t[74],e}let Y;t[75]===O.name?Y=t[76]:(Y=M(O.name),t[75]=O.name,t[76]=Y);let pe=Y,me;t[77]!==O.enabled||t[78]!==g.isError||t[79]!==s?(me=O.enabled?g.isError?s(`assistants.state.staleSnapshot`):null:s(`assistants.state.assistantDisabled`),t[77]=O.enabled,t[78]=g.isError,t[79]=s,t[80]=me):me=t[80];let he=me,ge;t[81]!==x||t[82]!==m||t[83]!==B||t[84]!==te||t[85]!==ie||t[86]!==w||t[87]!==C||t[88]!==_||t[89]!==s?(ge=m?null:(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-3 pt-4 sm:px-5`,children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,$.jsx)(ft,{snapshot:_,compact:!0,rowClassName:`min-w-0 flex-1`}),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`assistants.settings.create`),onClick:B,children:(0,$.jsx)(J,{name:`add`,className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 sm:px-4`,role:`listbox`,"aria-label":s(`assistants.listAria`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-1 pt-3`,children:x.map(e=>{let t=e.id===C,n=M(e.name);return(0,$.jsx)(ur,{assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:or(e.latestMessagePreview,s),displayName:n.displayName,selected:t,enabled:e.enabled,editLabel:s(`assistants.menu.edit`),deleteLabel:s(`assistants.settings.delete`),assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>w(e.id),onEdit:()=>te(e.id),onDelete:()=>ie(e)},e.id)})})})]}),t[81]=x,t[82]=m,t[83]=B,t[84]=te,t[85]=ie,t[86]=w,t[87]=C,t[88]=_,t[89]=s,t[90]=ge):ge=t[90];let X=W!==null,ve;t[91]!==W||t[92]!==oe||t[93]!==X?(ve=(0,$.jsx)(rr,{assistant:W,open:X,onOpenChange:oe}),t[91]=W,t[92]=oe,t[93]=X,t[94]=ve):ve=t[94];let ye=!m&&`border-l border-[var(--surface-subtle)]`,be;t[95]===ye?be=t[96]:(be=A(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,ye),t[95]=ye,t[96]=be);let xe;t[97]!==O||t[98]!==K||t[99]!==m||t[100]!==o||t[101]!==U||t[102]!==pe||t[103]!==s?(xe=m?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):(0,$.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3.5 border-b border-[var(--surface-subtle)]/70 px-5 sm:px-7`,children:[(0,$.jsx)(pt,{name:O.id,avatarSeed:O.avatarSeed,size:40,label:pe.displayName||O.name,working:!!(O.working||O.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:pe.displayName}),(0,$.jsx)(bt,{assistantID:O.id,serverWorking:!!(O.working||O.activeContactTurn),lastContactAt:O.latestMessagePreview?.createdAt})]}),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 rounded-full text-muted-foreground/65 transition-colors hover:text-foreground`,onClick:U,"aria-label":s(`assistants.conversation.openSettings`),children:(0,$.jsx)(J,{name:`settings-3`,className:`size-4`})})]}),t[97]=O,t[98]=K,t[99]=m,t[100]=o,t[101]=U,t[102]=pe,t[103]=s,t[104]=xe):xe=t[104];let Se;t[105]!==f||t[106]!==O||t[107]!==m||t[108]!==he?(Se=(0,$.jsx)(tr,{assistant:O,warning:he,active:f,overlayHeader:m}),t[105]=f,t[106]=O,t[107]=m,t[108]=he,t[109]=Se):Se=t[109];let Z;t[110]!==be||t[111]!==xe||t[112]!==Se?(Z=(0,$.jsxs)(`div`,{className:be,children:[xe,Se]}),t[110]=be,t[111]=xe,t[112]=Se,t[113]=Z):Z=t[113];let Ce;return t[114]!==ge||t[115]!==ve||t[116]!==Z?(Ce=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-hidden bg-background`,"data-presentation":`workspace`,children:[ge,ve,Z]}),t[114]=ge,t[115]=ve,t[116]=Z,t[117]=Ce):Ce=t[117],Ce};function fr(e){return e.activeMainTab===`assistant`}function pr(e){return e.isMobile}function mr(e){return e.selectAssistant}function hr(e){return e.requestCreate}function gr(){v.getState().setActiveMainTab(`chat`)}export{rr as a,or as i,cr as n,pt as o,ir as r,ft as s,dr as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-iRAV-k1u.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-ef9W7A43.js","assets/runtime-switch-CAZiOV2G.js","assets/runtime-fetch-BAN5Gnnp.js","assets/desktop-DpAcrF1h.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-CdzJ6My_.js","assets/platform-BxfprX15.js","assets/vendor-zustand-o69pgTEK.js","assets/vendor-opencode-client-BcpAhe9I.js","assets/vendor-effect-DXlObQuU.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-NMQx_cnG.js","assets/persistence-D-W3L37Z.js","assets/vendor-react-BP2cRVqX.js","assets/queryRuntime-BuRnpVtK.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-4US6DwDy.js","assets/fileQueries-QvEzQ4wT.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-download-BHIiwnLA.js","assets/vendor-pierre-diffs-DPBtNDJ5.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-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-D6gHjV_f.js","assets/store-Dy_l1m3m.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-8jhE4Zyk.js","assets/Icon-giRdbrNf.js","assets/dialog-D6iTQ8x_.js","assets/image-loading-2rgFmXBb.js","assets/image-loading-D9Z_BASK.css","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-Bhv6nS-u.js","assets/useMobileNavigationStore-DT5mNqWh.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-D7JZlg_Q.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MarkdownRenderer-D3_fpssn.js","assets/useEffectiveDirectory-B_KnXAgL.js","assets/markdownHeightCache-BWX84Di3.js","assets/dualLimitLru-D8Sphgua.js","assets/toolHelpers-DL452NVK.js","assets/ImageLoadingPlaceholder-iyU1QhoP.js","assets/useWorkerHighlightedLines-CUUmS5X0.js","assets/tooltip-DoKFlr59.js","assets/vendor-tanstack-react-virtual-B_EO--9t.js","assets/markdownTheme-DHoKvD6O.js","assets/markdown-worker-oBGEB9Eg.js","assets/mobileBackNavigation-gnihJDQb.js","assets/ToolOutputDialog-CbGuK5bP.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{c as n,i as r,n as i}from"./runtime-switch-CAZiOV2G.js";import{it as a,rt as o}from"./vendor-base-ui-CdzJ6My_.js";import{n as s,r as c}from"./platform-BxfprX15.js";import{n as l}from"./useUIStore-NMQx_cnG.js";import{$ as u,B as d,J as f,K as p,U as m,X as h,q as g,st as _,z as v}from"./persistence-D-W3L37Z.js";import{n as y}from"./vendor-react-BP2cRVqX.js";import{s as b}from"./vendor-tanstack-react-query-CdqCAt40.js";import{o as x}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as S}from"./vendor-sonner-ZS8XIOVl.js";import{a as C,d as w,f as T,i as E,n as D,r as O}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as k,r as A,t as j}from"./button-D6gHjV_f.js";import{a as M,n as N}from"./MobileShareBridge-CgATSPbV.js";import{E as P,M as F,P as I,T as L,_ as R,c as z,d as B,g as V,i as ee,n as te,o as H,p as U,r as W,t as ne,u as re,y as G}from"./MobileDetailNavigation-DuSr0tTA.js";import{Fr as ie,Pr as ae,Sn as oe,ct as se,o as ce,qt as K,wo as le}from"./useMobileNavigationStore-DT5mNqWh.js";import{i as ue,n as de,r as fe}from"./useAssistantUIStore-D7JZlg_Q.js";import{t as q}from"./AgentAvatar-DtMkzQZ_.js";import{n as J}from"./Icon-giRdbrNf.js";import{a as Y,i as pe,n as me,o as he,r as ge,t as X}from"./dialog-D6iTQ8x_.js";import{r as _e}from"./device-D6RHIV_h.js";import{c as ve,s as ye}from"./image-loading-2rgFmXBb.js";import{E as be,S as xe,T as Se,a as Z,c as Ce,d as we,f as Te,i as Ee,l as De,m as Oe,n as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,w as Fe,y as Ie}from"./sessionChangeSummary-zFviJimG.js";import{c as Le,o as Re,t as ze}from"./vendor-framer-motion-DsGBcZHB.js";import{a as Be,n as Ve,r as He,t as Ue}from"./fileMentionTouchSelection-wDv5vIb4.js";import{a as We,o as Ge,t as Ke}from"./MarkdownRenderer-D3_fpssn.js";import{n as qe}from"./textarea-COmti5oi.js";import{t as Je}from"./ImageLoadingPlaceholder-iyU1QhoP.js";import{t as Ye}from"./LoadingImage-C7a7GyLc.js";import{t as Xe}from"./vendor-motion-CIQx6DBb.js";import{a as Ze,c as Qe,l as $e,o as et,s as tt,t as nt}from"./scheduledTaskNavigation-8rJFjQWy.js";import{a as rt,c as it,i as at,s as ot,t as st}from"./sessionLookup-DKJNcuN_.js";import{i as ct,n as lt,r as ut}from"./assistant-attachment-cache-tZmmQ6I2.js";var dt=y(),Q=t(a(),1),$=o();function ft({snapshot:e,rowClassName:t,compact:n=!1}){let{t:r}=k(),[i,a]=Q.useState(!1),o=Q.useRef(!1),s=D(async()=>{if(!o.current){o.current=!0,a(!0);try{(await re(e)).failed&&S.error(r(`assistants.unread.markAllFailed`))}catch{S.error(r(`assistants.unread.markAllFailed`))}finally{o.current=!1,a(!1)}}}),c=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!c?null:(0,$.jsx)(`div`,{className:t,style:n&&!c?{visibility:`hidden`}:void 0,children:(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`xs`,onClick:s,className:n?`h-auto bg-transparent px-1 py-1 text-[11px] font-normal text-muted-foreground hover:bg-transparent whitespace-nowrap`:`max-w-full whitespace-normal text-right`,disabled:i||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":i,children:r(`assistants.unread.markAll`)})})}var pt=e=>{let t=(0,dt.c)(21),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c}=e,l=i===void 0?24:i,u=s===void 0||s,{t:d}=k(),f;t[0]!==n||t[1]!==o?(f=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=f):f=t[2];let p=at(f),m=!!(o||p),h=`calc(${l}px * var(--dpt-n, 1))`,g;t[3]===c?g=t[4]:(g=A(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=g);let _;t[5]===h?_=t[6]:(_={width:h,minWidth:h,maxWidth:h,height:h,minHeight:h,maxHeight:h},t[5]=h,t[6]=_);let v=r??n,y;t[7]!==m||t[8]!==a||t[9]!==l||t[10]!==v?(y=(0,$.jsx)(q,{kind:`assistant`,animated:m,name:v,size:l,label:a,shape:`rounded`,className:`rounded-[0.5rem]`}),t[7]=m,t[8]=a,t[9]=l,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==d||t[14]!==o?(b=o&&u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-background`,"data-assistant-working-dot":``,"aria-label":d(`assistants.contact.working`)}):null,t[12]=u,t[13]=d,t[14]=o,t[15]=b):b=t[15];let x;return t[16]!==g||t[17]!==_||t[18]!==y||t[19]!==b?(x=(0,$.jsxs)(`span`,{className:g,style:_,"data-assistant-working-avatar":``,children:[y,b]}),t[16]=g,t[17]=_,t[18]=y,t[19]=b,t[20]=x):x=t[20],x},mt=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(P)&&Number.isFinite(new Date(n.createdAt).getTime()))return{timestamp:n.createdAt,empty:!1}}return{timestamp:void 0,empty:e.generation>=0&&e.olderComplete&&!e.hasMessageGap}},ht=(e,t)=>{let n=(0,dt.c)(5),r;n[0]!==e||n[1]!==t?(r=W(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;return n[3]===r?i=n[4]:(i={...r,enabled:!1,select:mt},n[3]=r,n[4]=i),b(i)},gt=3e5,_t=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function vt(e){let t=new Map,n=null;for(let r of e){if(!(r.status===`error`||r.status===`failed`||r.parts.some(e=>e.type!==`text`||e.text.trim()&&!e.text.trim().startsWith(`yuri.settle.`)&&!e.text.trim().startsWith(`oc.settle.`))))continue;let e=new Date(r.createdAt);Number.isFinite(e.getTime())&&((!n||!_t(n,e)||e.getTime()-n.getTime()>gt)&&t.set(r.messageID,r.createdAt),n=e)}return t}function yt(e,t,n){let r=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),i=new Intl.DateTimeFormat(e,{month:`long`,day:`numeric`}),a=new Intl.DateTimeFormat(e,{year:`numeric`,month:`long`,day:`numeric`});return e=>{let o=new Date(e);return`${_t(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var bt=Q.memo(e=>{let t=(0,dt.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=k(),s=rt(n,r),c=ht(n,ve()),l;t[0]!==c||t[1]!==i?(l=i!==void 0&&Number.isFinite(new Date(i).getTime())?i:c.data?.timestamp,t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=new Date().toDateString(),t[3]=d):d=t[3];let f=d,p;t[4]===a?p=t[5]:(p=a(`common.date.today`),t[4]=a,t[5]=p);let m=p,h;bb0:{if(u===void 0){h=null;break bb0}let e;t[6]!==o||t[7]!==u||t[8]!==m?(e=yt(o,m,new Date(f))(u),t[6]=o,t[7]=u,t[8]=m,t[9]=e):e=t[9],h=e}let g=h,_;t[10]!==c||t[11]!==g||t[12]!==a||t[13]!==s?(_=s?a(`assistants.conversation.typing`):g?a(`assistants.conversation.lastContact`,{time:g}):c.data?.empty?a(`assistants.conversation.neverContacted`):c.isError?a(`assistants.contact.loadFailed`):a(`common.loading`),t[10]=c,t[11]=g,t[12]=a,t[13]=s,t[14]=_):_=t[14];let v=_,y;return t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`mt-1 block truncate typography-micro font-normal leading-4 text-muted-foreground/70`,"aria-live":`polite`,title:v,children:v}),t[15]=v,t[16]=y),y});function xt(e){let t=(0,dt.c)(12),{assistantID:n,position:a}=e,o=Q.useRef(null),c=Q.useRef(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={busy:!1,done:!1,retryAt:0},t[0]=l):l=t[0];let u=Q.useRef(l),[d]=Q.useState(Dt),f;t[1]!==n||t[2]!==a||t[3]!==d?(f=()=>{let e=o.current;if(!e||!c.current||u.current.busy||u.current.done||Date.now()<u.current.retryAt||d.transport!==r()||d.generation!==i()||document.visibilityState!==`visible`||(s()?!document.documentElement.classList.contains(`yuri-native-app-active`):!document.hasFocus())||e.parentElement?.closest(`[inert], [aria-hidden="true"]`))return;let t=e.closest(`[data-assistant-contact-transcript]`);if(!t||t.scrollHeight-t.scrollTop-t.clientHeight>2)return;let l=e.getBoundingClientRect(),f=t.getBoundingClientRect(),p=window.visualViewport,m=p?.offsetTop??0,h=m+(p?.height??window.innerHeight);l.height<=0||l.width<=0||l.bottom>Math.min(f.bottom,h)||l.top<Math.max(f.top,m)||l.right<=Math.max(f.left,0)||l.left>=Math.min(f.right,window.innerWidth)||(u.current.busy=!0,B(n,a).then(()=>{u.current.done=!0}).catch(()=>{u.current.retryAt=Date.now()+15e3}).finally(()=>{u.current.busy=!1}))},t[1]=n,t[2]=a,t[3]=d,t[4]=f):f=t[4];let p=D(f),m;t[5]===p?m=t[6]:(m=e=>{c.current=e.some(Et),p()},t[5]=p,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h={threshold:1},t[7]=h):h=t[7],E(o,D(m),h),O(`visibilitychange`,p,Tt),O(`focus`,p,wt),O(`resize`,p,Ct);let g,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>o.current?.closest(`[data-assistant-contact-transcript]`),_={passive:!0},t[8]=g,t[9]=_):(g=t[8],_=t[9]),O(`scroll`,p,g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={attributes:!0,attributeFilter:[`class`]},t[10]=v):v=t[10],w(p,St,v),C(p,15e3);let y;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`span`,{ref:o,"aria-hidden":`true`,className:`absolute bottom-0 left-0 block h-px w-px`,"data-assistant-read-marker":``}),t[11]=y):y=t[11],y}function St(){return document.documentElement}function Ct(){return window.visualViewport}function wt(){return window}function Tt(){return document}function Et(e){return e.isIntersecting&&e.intersectionRatio===1}function Dt(){return{transport:r(),generation:i()}}var Ot=()=>{},kt=Q.memo(be),At=e=>e?.directories.flatMap(({directory:e,sessions:t})=>e?t.filter(e=>!e.time.archived).map(t=>({...t,directory:e||t.location?.directory||t.directory||``})).filter(e=>e.directory.length>0):[])??null,jt=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=k(),c=ve(),l=b({...ie(c),select:At}),u=Q.useMemo(()=>se({sessions:l.data??[],currentSessionId:null,searchQuery:e}),[l.data,e]),[d,f]=Q.useState({query:e,index:0}),p=Math.min(d.query===e?d.index:0,Math.max(0,u.length-1)),m=Q.useRef(null),h=Q.useRef([]),g=Q.useMemo(Ue,[]);O(`pointerdown`,e=>{e.target instanceof Node&&!m.current?.contains(e.target)&&a()},void 0,{capture:!0}),Q.useLayoutEffect(()=>{h.current[p]?.scrollIntoView?.({block:`nearest`})},[p]),Q.useLayoutEffect(()=>{r(u.length?`${n}-${p}`:void 0)},[p,n,u.length,r]);let _=D(t=>{if(t===`Escape`){a();return}u.length&&(t===`ArrowDown`&&f({query:e,index:(p+1)%u.length}),t===`ArrowUp`&&f({query:e,index:(p-1+u.length)%u.length}),(t===`Enter`||t===`Tab`)&&i(u[p]))});return Q.useImperativeHandle(o,()=>({keyDown:_}),[_]),(0,$.jsxs)(Ve,{ref:m,isMobile:t,className:`max-w-[640px] max-h-64`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-3 py-1`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`assistants.contact.sessionMention.scope`)}),(0,$.jsx)(j,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(J,{name:`close`,className:`size-4`})})]}),l.isPending?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(`common.loading`)}):null,l.isError?(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 typography-meta text-[var(--status-error)]`,children:[s(`assistants.contact.sessionMention.loadFailed`),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void l.refetch(),children:s(`chat.history.retry`)})]}):null,l.isSuccess&&!u.length?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(l.data===null?`common.unavailable`:`sessions.sidebar.empty.noMatches.title`)}):null,(0,$.jsx)(qe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,$.jsx)(`div`,{id:n,role:`listbox`,"aria-label":s(`chat.fileMentionAutocomplete.groups.sessions`),className:`p-1.5`,children:u.map((r,a)=>(0,$.jsxs)(`div`,{id:`${n}-${a}`,role:`option`,"aria-selected":a===p,ref:e=>{h.current[a]=e},className:A(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,He(t,a===p)),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>f({query:e,index:a}),onPointerDown:e=>{e.pointerType===`touch`&&g.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&g.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&g.pointerUp(()=>i(r))&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>g.pointerCancel(),onClick:()=>g.click(()=>i(r)),children:[(0,$.jsx)(J,{name:`chat-thread`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium leading-5`,title:r.title,children:r.title||s(`chat.fileMentionAutocomplete.untitledSession`)}),(0,$.jsx)(`div`,{className:`truncate text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,title:r.directory,children:r.directory})]})]},`${r.directory}:${r.id}`))})}),t?null:(0,$.jsx)(`div`,{className:`mx-1.5 shrink-0 border-t px-1.5 py-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`chat.autocomplete.keyboardHint`)})]})}),Mt=e=>{let t=(0,dt.c)(122),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({active:n,working:o,onChange:r,onVoiceSend:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=o!==void 0&&o,{t:c}=k(),l=Q.useRef(null),u=n&&!!a.isMobile&&!!i,h;t[6]===u?h=t[7]:(h={available:u},t[6]=u,t[7]=h);let{enabled:y,hint:b,onHintChange:x}=Se(h),S;t[8]!==b||t[9]!==a.placeholder||t[10]!==c?(S=b===null?a.placeholder:c(b===`recording`?`chat.dictation.releaseSend`:b===`cancelling`?`chat.dictation.releaseCancel`:b===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[8]=b,t[9]=a.placeholder,t[10]=c,t[11]=S):S=t[11];let C=S,w;t[12]===a.value?w=t[13]:(w=()=>({canonical:a.value,document:m(a.value,new Map)}),t[12]=a.value,t[13]=w);let[T,E]=Q.useState(w),O;t[14]!==T.canonical||t[15]!==T.document||t[16]!==a.value?(O=T.canonical===a.value?T.document:m(a.value,new Map),t[14]=T.canonical,t[15]=T.document,t[16]=a.value,t[17]=O):O=t[17];let j=O,[M,N]=Q.useState(0),[P,F]=Q.useState(!0),[I,L]=Q.useState(!1),[R,z]=Q.useState(),B=Q.useRef(null),V=Q.useRef(null),ee=Q.useRef(null),te=Q.useRef(null),H;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(H=De(),t[18]=H):H=t[18];let U=Q.useRef(H),W=Q.useId(),ne;t[19]!==n||t[20]!==I||t[21]!==M||t[22]!==P||t[23]!==j.text||t[24]!==a.disabled||t[25]!==a.pending?(ne=n&&!a.pending&&!a.disabled&&!P&&!I?Be({text:j.text,cursor:M}):null,t[19]=n,t[20]=I,t[21]=M,t[22]=P,t[23]=j.text,t[24]=a.disabled,t[25]=a.pending,t[26]=ne):ne=t[26];let re=ne,G=re?.kind===`mention`?re:null,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>{te.current!==null&&(B.current?.focus({preventScroll:!0}),B.current?.setSelectionRange(te.current,te.current),te.current=null)},t[27]=ie):ie=t[27];let ae;t[28]===j?ae=t[29]:(ae=[j],t[28]=j,t[29]=ae),Q.useLayoutEffect(ie,ae);let oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>F(!0),t[30]=oe):oe=t[30];let se=D(oe),ce;t[31]!==I||t[32]!==M||t[33]!==j||t[34]!==r?(ce=(e,t,n)=>{let i=n===void 0||n,a=f(e);a.ok&&(i&&(U.current=Pe(U.current,{before:Ce(j,[],{start:B.current?.selectionStart??M,end:B.current?.selectionEnd??M}),after:Ce(e,[],{start:t,end:t})})),I||(te.current=t),N(t),E({canonical:a.text,document:e}),r(a.text))},t[31]=I,t[32]=M,t[33]=j,t[34]=r,t[35]=ce):ce=t[35];let K=D(ce),le;t[36]!==K||t[37]!==j||t[38]!==G||t[39]!==c?(le=e=>{if(!G)return;let t=e.title||c(`chat.fileMentionAutocomplete.untitledSession`),n=d(j,G.tokenStart,G.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:_({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);F(!0),K(n.document,r)},t[36]=K,t[37]=j,t[38]=G,t[39]=c,t[40]=le):le=t[40];let ue=D(le),de;t[41]!==n||t[42]!==K||t[43]!==j||t[44]!==a.disabled||t[45]!==a.pending?(de=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=j.text?`${j.text} ${e}`:e,r=p(j,t,t.length,t.length);K(r.document,r.caret),F(!0)},t[41]=n,t[42]=K,t[43]=j,t[44]=a.disabled,t[45]=a.pending,t[46]=de):de=t[46];let fe=D(de),q;t[47]!==n||t[48]!==j.text||t[49]!==fe||t[50]!==r||t[51]!==i||t[52]!==a.disabled||t[53]!==a.pending?(q=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(j.text){fe(e);return}r(e),i?.(e)}},t[47]=n,t[48]=j.text,t[49]=fe,t[50]=r,t[51]=i,t[52]=a.disabled,t[53]=a.pending,t[54]=q):q=t[54];let J=D(q),Y;t[55]!==K||t[56]!==j?(Y=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!j.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=v(n.selectionStart,n.selectionEnd,j.references)??{start:n.selectionStart,end:n.selectionEnd},i=f({text:j.text.slice(r.start,r.end),references:j.references.filter(e=>e.start>=r.start&&e.end<=r.end).map(e=>({...e,start:e.start-r.start,end:e.end-r.start}))});if(i.ok&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,i.text),t)){let e=p(j,j.text.slice(0,r.start)+j.text.slice(r.end),r.start,r.start);K(e.document,e.caret)}},t[55]=K,t[56]=j,t[57]=Y):Y=t[57];let pe=D(Y),me;t[58]!==j.references||t[59]!==j.text?(me=Oe(j.text,j.references.map(Nt))?.map(Pt),t[58]=j.references,t[59]=j.text,t[60]=me):me=t[60];let he=me,ge=y&&j.text.length===0?`true`:void 0,X;t[61]!==y||t[62]!==fe||t[63]!==a.disabled||t[64]!==a.pending||t[65]!==J||t[66]!==x?(X=y&&(0,$.jsx)(kt,{containerRef:l,disabled:!!(a.pending||a.disabled),onInsert:fe,onSend:J,onRelease:Ot,onHintChange:x}),t[61]=y,t[62]=fe,t[63]=a.disabled,t[64]=a.pending,t[65]=J,t[66]=x,t[67]=X):X=t[67];let _e=j.text,ve=a.pending||s,ye;t[68]===a?ye=t[69]:(ye=()=>{a.pending||a.onSubmit()},t[68]=a,t[69]=ye);let be=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,Z;t[70]!==a.textLayoutClassName||t[71]!==be?(Z=A(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,be,a.textLayoutClassName),t[70]=a.textLayoutClassName,t[71]=be,t[72]=Z):Z=t[72];let Ee;t[73]!==K||t[74]!==j?(Ee=(e,t)=>{let n=p(j,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);K(n.document,n.caret),F(t?.nativeEvent?.inputType===`insertFromPaste`)},t[73]=K,t[74]=j,t[75]=Ee):Ee=t[75];let ke=G?W:void 0,Ae=G?R:void 0,je;t[76]===a.textareaProps?je=t[77]:(je=e=>{a.textareaProps?.onScroll?.(e),V.current&&(V.current.scrollTop=e.currentTarget.scrollTop,V.current.scrollLeft=e.currentTarget.scrollLeft)},t[76]=a.textareaProps,t[77]=je);let Me,Ne;t[78]!==pe||t[79]!==a.textareaProps?(Me=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},Ne=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[78]=pe,t[79]=a.textareaProps,t[80]=Me,t[81]=Ne):(Me=t[80],Ne=t[81]);let Fe;t[82]===a.textareaProps?Fe=t[83]:(Fe=e=>{N(e.currentTarget.selectionStart),a.textareaProps?.onSelect?.(e)},t[82]=a.textareaProps,t[83]=Fe);let Le,Re;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>{L(!0)},Re=e=>{L(!1),N(e.currentTarget.selectionStart)},t[84]=Le,t[85]=Re):(Le=t[84],Re=t[85]);let ze;t[86]!==K||t[87]!==I||t[88]!==j||t[89]!==G||t[90]!==a.textareaProps?(ze=e=>{if(a.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||xe(e))){if(I){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?we(U.current,j):Te(U.current,j);t&&(e.preventDefault(),U.current=t.history,K(t.snapshot.document,t.snapshot.selection.end,!1),F(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=g(j,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),K(t.document,t.caret),F(!0);return}}G&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),ee.current?.keyDown(e.key))}},t[86]=K,t[87]=I,t[88]=j,t[89]=G,t[90]=a.textareaProps,t[91]=ze):ze=t[91];let Ve;t[92]!==a.textareaProps||t[93]!==ke||t[94]!==Ae||t[95]!==je||t[96]!==Me||t[97]!==Ne||t[98]!==Fe||t[99]!==ze?(Ve={...a.textareaProps,"aria-controls":ke,"aria-activedescendant":Ae,"aria-autocomplete":`list`,onScroll:je,onCopy:Me,onCut:Ne,onSelect:Fe,onCompositionStart:Le,onCompositionEnd:Re,onKeyDown:ze},t[92]=a.textareaProps,t[93]=ke,t[94]=Ae,t[95]=je,t[96]=Me,t[97]=Ne,t[98]=Fe,t[99]=ze,t[100]=Ve):Ve=t[100];let He;t[101]!==se||t[102]!==W||t[103]!==G||t[104]!==a.isMobile||t[105]!==ue?(He=G?(0,$.jsx)(jt,{ref:ee,query:G.query,isMobile:a.isMobile??!1,listId:W,onHighlightChange:z,onSelect:ue,onClose:se}):null,t[101]=se,t[102]=W,t[103]=G,t[104]=a.isMobile,t[105]=ue,t[106]=He):He=t[106];let Ue;t[107]!==j.text||t[108]!==he||t[109]!==C||t[110]!==a||t[111]!==ve||t[112]!==ye||t[113]!==Z||t[114]!==Ee||t[115]!==Ve||t[116]!==He?(Ue=(0,$.jsx)(Ie,{...a,value:_e,pending:ve,placeholder:C,disableInputWhilePending:!1,inputRef:B,onSubmit:ye,highlightedContent:he,highlightRef:V,textLayoutClassName:Z,onChange:Ee,textareaProps:Ve,children:He}),t[107]=j.text,t[108]=he,t[109]=C,t[110]=a,t[111]=ve,t[112]=ye,t[113]=Z,t[114]=Ee,t[115]=Ve,t[116]=He,t[117]=Ue):Ue=t[117];let We;return t[118]!==ge||t[119]!==X||t[120]!==Ue?(We=(0,$.jsxs)(`div`,{ref:l,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":ge,children:[X,Ue]}),t[118]=ge,t[119]=X,t[120]=Ue,t[121]=We):We=t[121],We};function Nt(e){return{start:e.start,end:e.end,priority:103,...h(e)}}function Pt(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(Ae,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var Ft=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function It({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=k(),i=ve(),{attachmentID:a,sha256:o,size:s,mime:c,filename:l}=t,u=Q.useMemo(()=>({type:`file`,attachmentID:a,sha256:o,size:s,mime:c,filename:l}),[a,o,s,c,l]),d=c.startsWith(`image/`),f=We(l??``,c),[p,m]=Q.useState(0),[h,g]=Q.useState(``),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x=Q.useRef(null),S=Q.useRef([]);Q.useEffect(()=>{g(``),v(!1);let t=new AbortController,n;return d&&ut(e,u,{signal:t.signal}).then(e=>{if(t.signal.aborted){e.release();return}n=e.release,g(e.url)}).catch(()=>{t.signal.aborted||v(!0)}),()=>{t.abort(),n?.()}},[e,u,i,d,p]),Q.useEffect(()=>()=>{x.current?.abort(),S.current.forEach(e=>URL.revokeObjectURL(e)),S.current=[]},[e,u,i]);let C=D(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await lt(e,u,{signal:i.signal});if(i.signal.aborted)return;S.current.forEach(e=>URL.revokeObjectURL(e));let o=URL.createObjectURL(a);if(S.current=[o],t&&n){n({open:!0,title:l||r(`assistants.contact.attachment.file`),content:``,video:{url:o,mimeType:c,filename:l}});return}let s=document.createElement(`a`);s.href=o,s.download=l||r(`assistants.contact.attachment.file`),document.body.appendChild(s),s.click(),s.remove()}catch{i.signal.aborted||v(!0)}finally{x.current===i&&(x.current=null),i.signal.aborted||b(!1)}}),w=l||r(d?`assistants.contact.attachment.image`:`assistants.contact.attachment.file`),T=D(e=>{!n||!h||n({open:!0,title:w,content:``,metadata:{tool:`image-preview`,filename:w,mime:c},previewSource:e.currentTarget,image:{url:h,mimeType:c,filename:w,size:s,gallery:[{url:h,mimeType:c,filename:w,size:s}],index:0}})});return d&&h&&!_?(0,$.jsx)(Ye,{src:h,alt:w,contentFrame:!0,className:Ft,onError:()=>v(!0),onClick:T,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T(e))},role:`button`,tabIndex:0,"data-assistant-contact-image":``}):d&&!_?(0,$.jsx)(Je,{className:`h-[var(--yuri-content-image-height)] w-[min(20rem,100%)] rounded-[1.35rem]`}):(0,$.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5 ring-1 ring-inset ring-[var(--surface-subtle)]`,"data-assistant-contact-file":``,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(J,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:w})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:r(`assistants.contact.attachment.loadFailed`)}):null,d&&!_||y?(0,$.jsx)(`span`,{role:`status`,className:`typography-micro text-muted-foreground`,children:r(`common.loading`)}):(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:d?()=>m(e=>e+1):()=>void C(f&&!!n),children:r(_?`chat.history.retry`:f&&n?`contextPanel.mode.preview`:`assistants.contact.attachment.download`)})]})}function Lt(e){let t=(0,dt.c)(39),{part:n,onShowPopup:r}=e,{t:i}=k(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=ye(a,``),[s,c]=Q.useState(!1),l;t[0]!==n.filename||t[1]!==i?(l=n.filename||i(`assistants.contact.attachment.image`),t[0]=n.filename,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]!==u||t[4]!==r||t[5]!==o?(d=e=>{!r||!o||r({open:!0,title:u,content:``,metadata:{tool:`image-preview`,filename:u},previewSource:e.currentTarget,image:{url:o,filename:u,gallery:[{url:o,filename:u}],index:0}})},t[3]=u,t[4]=r,t[5]=o,t[6]=d):d=t[6];let f=D(d);if(We(a,n.mime)&&a&&r){let e;t[7]!==r||t[8]!==n.filename||t[9]!==n.mime||t[10]!==a||t[11]!==i?(e=()=>r({open:!0,title:n.filename||i(`assistants.contact.attachment.file`),content:``,video:{url:a,filename:n.filename,mimeType:n.mime}}),t[7]=r,t[8]=n.filename,t[9]=n.mime,t[10]=a,t[11]=i,t[12]=e):e=t[12];let o;t[13]!==n.filename||t[14]!==i?(o=n.filename||i(`contextPanel.mode.preview`),t[13]=n.filename,t[14]=i,t[15]=o):o=t[15];let s;return t[16]!==e||t[17]!==o?(s=(0,$.jsx)(j,{variant:`secondary`,size:`sm`,onClick:e,children:o}),t[16]=e,t[17]=o,t[18]=s):s=t[18],s}if(n.mime.startsWith(`image/`)&&o&&!s){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>c(!0),t[19]=e):e=t[19];let n;t[20]===f?n=t[21]:(n=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},t[20]=f,t[21]=n);let r;return t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==n?(r=(0,$.jsx)(Ye,{src:o,alt:u,contentFrame:!0,className:Ft,onError:e,onClick:f,onKeyDown:n,role:`button`,tabIndex:0,"data-assistant-contact-image":``}),t[22]=u,t[23]=f,t[24]=o,t[25]=n,t[26]=r):r=t[26],r}let p;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(J,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),t[27]=p):p=t[27];let m;t[28]!==n.filename||t[29]!==i?(m=n.filename||i(`assistants.contact.attachment.file`),t[28]=n.filename,t[29]=i,t[30]=m):m=t[30];let h;t[31]===m?h=t[32]:(h=(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:m}),t[31]=m,t[32]=h);let g;t[33]!==s||t[34]!==i?(g=s?(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>c(!1),children:i(`chat.history.retry`)}):null,t[33]=s,t[34]=i,t[35]=g):g=t[35];let _;return t[36]!==h||t[37]!==g?(_=(0,$.jsxs)(`div`,{className:`flex max-w-full items-center gap-2.5 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5`,"data-assistant-contact-file":``,children:[p,h,g]}),t[36]=h,t[37]=g,t[38]=_):_=t[38],_}function Rt(e){let t=(0,dt.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=ve(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(It,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(Lt,{part:r,onShowPopup:i},`${a}:${r.url}`),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o):o=t[4],o}var zt=[],Bt=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
|
|
3
|
+
`),Vt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),Ht=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Ut=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},Wt=(e,t,n,r)=>({messageID:t?`${e.turnID}:preview:${t.bubbleIndex}`:`${e.turnID}:preview:${r}`,assistantID:e.assistantID,role:`assistant`,turnID:e.turnID,bubbleIndex:t?.bubbleIndex??0,createdAt:t?.occurredAt??e.occurredAt,ordinal:n,status:r,fromAssistantID:null,fromAssistantName:null,parts:t?[{type:`text`,text:t.text}]:[],text:t?.text??``,cards:[]}),Gt=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>Wt(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,Wt(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,Wt(e,null,n+r.length,`admitted`)]:r},Kt=(e,t,n,r=[])=>{let i=new Set(e.map(e=>e.messageID)),a=t.flatMap((t,r)=>t.assistantID!==n||i.has(t.messageID)?[]:[{messageID:t.messageID,assistantID:n,role:`user`,turnID:t.messageID,bubbleIndex:0,createdAt:t.createdAt,ordinal:e.length+r,status:t.status,fromAssistantID:null,fromAssistantName:null,parts:[...t.parts],text:Bt(t.parts),cards:[]}]),o=a.length===0?e:[...e,...a],s=r.filter(e=>e.assistantID===n);if(s.length===0)return o;let c=new Map,l=new Map;o.forEach((e,t)=>{if(c.set(e.turnID,t),e.role!==`assistant`||e.messageID.includes(`:preview:`))return;let n=l.get(e.turnID)??new Set;n.add(e.bubbleIndex),l.set(e.turnID,n)});let u=new Map,d=[];for(let e of s){let t=Gt(e,l.get(e.turnID)??new Set,o.length+d.length);if(t.length===0)continue;let n=c.get(e.turnID);if(n===void 0){if(e.status===`failed`&&o.some(t=>t.turnID!==e.turnID))continue;d.push(...t);continue}let r=u.get(n)??[];r.push(...t),u.set(n,r)}return u.size===0&&d.length===0?o:o.flatMap((e,t)=>[e,...u.get(t)??[]]).concat(d)},qt=(e,t)=>{let n=new Set(t.map(e=>e.messageID)),r=e.filter(e=>!n.has(e.messageID));return r.length===e.length?e:r},Jt=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),Yt=(e,t,n,r=Date.now())=>{let i=e.filter(e=>e.assistantID!==t||e.status!==`failed`||e.turnID===n);return i.some(e=>e.assistantID===t&&e.turnID===n)?i.length===e.length?e:i:[...i,{assistantID:t,turnID:n,status:`admitted`,bubbles:[],occurredAt:r}]},Xt=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:Yt(e,t.assistantID,t.turnID,t.admittedAt),Zt=(e,t)=>{let n=t.assistantID,r=t.pendingSendTurnIDs??new Set,i=t.settledTurnIDs??new Set,a=typeof t.snapshotRevision==`number`&&Number.isFinite(t.snapshotRevision)?t.snapshotRevision:null,o=t.admissionRevisionByTurnID instanceof Map?t.admissionRevisionByTurnID:new Map(Object.entries(t.admissionRevisionByTurnID??{}).map(([e,t])=>[e,Number(t)])),s=t.occurredAt??Date.now(),c=t.activeContactTurn&&t.activeContactTurn.turnID?t.activeContactTurn:null,l=!!(t.serverWorking||c),u=Xt(e,c?{assistantID:n,turnID:c.turnID,admittedAt:c.admittedAt}:null,i),d=Array.isArray(t.messages)?t.messages:[];for(let e of d)e.role===`assistant`&&e.status===`error`&&(r.has(e.turnID)||i.has(e.turnID)||(u=$t(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=en(u,d),l){let t=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID)||c&&e.turnID===c.turnID)return!0;let t=o.get(e.turnID);return typeof t==`number`&&a!=null&&a<t?!0:typeof t==`number`&&a!=null&&a>=t&&e.turnID!==c?.turnID?!1:!c||e.turnID===c.turnID});return t.length===e.length&&t.every((t,n)=>t===e[n])?e:t}if(a==null)return u.length===e.length&&u.every((t,n)=>t===e[n])?e:u;let f=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID))return!0;if(i.has(e.turnID))return!1;let t=o.get(e.turnID);return typeof t==`number`&&a<t});return f.length===e.length&&f.every((t,n)=>t===e[n])?e:f.length===u.length?u:f},Qt=(e,t)=>Yt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>{if(e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`failed`||e.status===`complete`)return e;let n=e.bubbles.find(e=>e.bubbleIndex===t.bubbleIndex);if(n?.done)return e;let r=n?{...n,text:`${n.text}${t.delta}`,done:t.done,occurredAt:t.occurredAt}:{bubbleIndex:t.bubbleIndex,text:t.delta,done:t.done,occurredAt:t.occurredAt},i=n?e.bubbles.map(e=>e.bubbleIndex===t.bubbleIndex?r:e):[...e.bubbles,r].sort((e,t)=>e.bubbleIndex-t.bubbleIndex);return{...e,status:`streaming`,bubbles:i}}),$t=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:Yt(e,t.assistantID,t.turnID,t.occurredAt).map(e=>e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`complete`||e.status===`failed`?e:{...e,status:t.status===`error`?`failed`:`complete`,...t.error?{error:t.error}:{}}),en=(e,t)=>{let n=new Set(t.map(e=>e.turnID).filter(Boolean)),r=t.length>0?t[t.length-1]?.turnID??null:null,i=[...e].reverse().find(e=>e.status===`admitted`||e.status===`streaming`)?.turnID??r,a=new Set(t.flatMap(e=>e.role===`assistant`?[e.turnID]:[])),o=e.filter(e=>e.status===`admitted`||e.status===`streaming`||!(e.status===`complete`&&a.has(e.turnID)||!n.has(e.turnID)||e.status===`failed`&&(i&&i!==e.turnID||r&&r!==e.turnID)));return o.length===e.length?e:o},tn=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),nn=(e,t)=>{if(e instanceof F){if(e.code===`no_provider`)return t.noProvider;if(e.code===`admission_timeout`||e.code===`generate_timeout`)return t.timedOut;if(e.message&&e.message!==e.code)return e.message}return I(e)?t.timedOut:t.sendFailed},rn=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},an=e=>{let t=e.text.trim();if(e.sending||!t&&e.attachments.length===0||!e.gate.tryAcquire())return{ok:!1};let n=[...t?[{type:`text`,text:t}]:[],...e.attachments.map(e=>({type:`file`,mime:e.mime,url:e.url,filename:e.name}))],r=e.createMessageID();return{ok:!0,messageID:r,parts:n,turn:Vt(e.assistantID,r,n,e.createdAt)}},on=e=>e.some(e=>e.status===`sending`),sn=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`),cn=[`cursor-pointer rounded-[1.35rem] bg-[var(--surface-elevated)] ring-1 ring-inset ring-[var(--surface-subtle)]`,`px-3.5 py-3 text-left transition-[background-color,box-shadow,transform] duration-200 ease-out motion-reduce:transition-none`,`hover:-translate-y-px hover:bg-interactive-hover/45 hover:shadow-sm active:translate-y-0 motion-reduce:hover:translate-y-0`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),ln=`${cn} w-fit min-w-0 max-w-[min(100%,15rem)]`,un=`${cn} w-fit min-w-0 max-w-[min(100%,20rem)]`;function dn(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var fn=e=>{let t=(0,dt.c)(23),{card:n}=e,{t:r}=k(),i=Fe(),a;t[0]===i?a=t[1]:(a=i&&!c(),t[0]=i,t[1]=a);let o=!!a,s=n.name,l=`${n.providerID}/${n.modelID}`,u;t[2]!==n.assistantID||t[3]!==o?(u=()=>{if(o){ce.getState().openAssistant(n.assistantID);return}de(n.assistantID)},t[2]=n.assistantID,t[3]=o,t[4]=u):u=t[4];let d=D(u),f;t[5]===d?f=t[6]:(f=e=>{dn(e,d)},t[5]=d,t[6]=f);let p=D(f),m;t[7]!==r||t[8]!==s?(m=r(`assistants.contact.card.assistant.aria`,{name:s}),t[7]=r,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`robot-2`,className:`size-5`})})}),t[10]=h):h=t[10];let g;t[11]===s?g=t[12]:(g=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:s}),t[11]=s,t[12]=g);let _;t[13]===l?_=t[14]:(_=(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:l}),t[13]=l,t[14]=_);let v;t[15]!==g||t[16]!==_?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[g,_]})]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;return t[18]!==p||t[19]!==d||t[20]!==m||t[21]!==v?(y=(0,$.jsx)(`article`,{className:ln,role:`button`,tabIndex:0,"aria-label":m,"data-assistant-contact-card":`assistant`,onClick:d,onKeyDown:p,children:v}),t[18]=p,t[19]=d,t[20]=m,t[21]=v,t[22]=y):y=t[22],y},pn=e=>{let t=(0,dt.c)(30),{card:n}=e,{t:r}=k(),i=n.name,a;t[0]!==n.kind||t[1]!==r?(a=n.kind===`daily`||n.kind===`weekly`||n.kind===`once`||n.kind===`cron`?r(`sessions.scheduledTasks.editor.scheduleType.${n.kind}`):n.kind,t[0]=n.kind,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==n.time||t[4]!==o?(s=[o,n.time].filter(Boolean),t[3]=n.time,t[4]=o,t[5]=s):s=t[5];let c=s.join(` · `),l;t[6]!==n.prompt||t[7]!==c?(l=c.trim()||(typeof n.prompt==`string`?n.prompt.trim():``),t[6]=n.prompt,t[7]=c,t[8]=l):l=t[8];let u=l,d;t[9]!==n.projectID||t[10]!==n.taskID?(d=()=>{nt(n.projectID,n.taskID)},t[9]=n.projectID,t[10]=n.taskID,t[11]=d):d=t[11];let f=D(d),p;t[12]===f?p=t[13]:(p=e=>{dn(e,f)},t[12]=f,t[13]=p);let m=D(p),h;t[14]!==r||t[15]!==i?(h=r(`assistants.contact.card.schedule.aria`,{name:i}),t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`calendar`,className:`size-5`})})}),t[17]=g):g=t[17];let _;t[18]===i?_=t[19]:(_=(0,$.jsx)(`h3`,{className:`min-w-0 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:i}),t[18]=i,t[19]=_);let v;t[20]===u?v=t[21]:(v=u?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:u}):null,t[20]=u,t[21]=v);let y;t[22]!==_||t[23]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[_,v]})]}),t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;return t[25]!==m||t[26]!==f||t[27]!==y||t[28]!==h?(b=(0,$.jsx)(`article`,{className:ln,role:`button`,tabIndex:0,"aria-label":h,"data-assistant-contact-card":`schedule`,onClick:f,onKeyDown:m,children:y}),t[25]=m,t[26]=f,t[27]=y,t[28]=h,t[29]=b):b=t[29],b},mn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`?t:e===`idle`?`complete`:t===`busy`||t===`retry`||t===`idle`?t:t||`busy`,hn=e=>e===`cancelled`?`assistants.contact.card.session.status.cancelled`:e===`busy`?`assistants.contact.card.session.status.busy`:e===`retry`?`assistants.contact.card.session.status.retry`:e===`idle`?`assistants.contact.card.session.status.idle`:e===`complete`?`assistants.contact.card.session.status.complete`:e===`error`?`assistants.contact.card.session.status.error`:e===`question`?`assistants.contact.card.session.status.question`:null,gn=e=>e===`busy`?`bg-[var(--status-info)]/10 text-[var(--status-info)]`:e===`retry`||e===`question`?`bg-[var(--status-warning)]/10 text-[var(--status-warning)]`:e===`error`?`bg-[var(--status-error)]/10 text-[var(--status-error)]`:e===`idle`||e===`complete`?`bg-[var(--status-success)]/10 text-[var(--status-success)]`:`bg-[var(--surface-muted)] text-muted-foreground`,_n=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,vn=e=>{let t=(0,dt.c)(35),{card:n}=e,{t:r}=k(),i=Fe(),a;t[0]===i?a=t[1]:(a=i&&!c(),t[0]=i,t[1]=a);let o=!!a,s;t[2]===n.sessionID?s=t[3]:(s=e=>e.activeSessions.find(e=>e.id===n.sessionID)??e.archivedSessions.find(e=>e.id===n.sessionID)??null,t[2]=n.sessionID,t[3]=s);let u=ae(s),d=K(n.sessionID),f=(typeof u?.title==`string`&&u.title.trim()?u.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),p=mn(d?.type,n.status),m=hn(p),h=p===`busy`||p===`retry`,g=_n(typeof u?.directory==`string`&&u.directory.trim()?u.directory.trim():n.directory),_=ke(u)||n.branch,v=Ee(u),y=je(u),b=Ne(y),x=[g,v,_].filter(yn),S;t[4]!==n.directory||t[5]!==n.sessionID||t[6]!==o?(S=()=>{let e=st(n.sessionID)?.directory||n.directory;oe(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||l.getState().setActiveMainTab(`chat`)},t[4]=n.directory,t[5]=n.sessionID,t[6]=o,t[7]=S):S=t[7];let C=D(S),w;t[8]===C?w=t[9]:(w=e=>{dn(e,C)},t[8]=C,t[9]=w);let T=D(w),E=un,O=r(`assistants.contact.card.session.aria`,{title:f}),j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-xl bg-[var(--surface-muted)] text-foreground`,children:(0,$.jsx)(J,{name:`chat-3`,className:`size-5`})}),t[10]=j):j=t[10];let M;t[11]===h?M=t[12]:(M=h?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-[var(--surface-elevated)]`,"data-assistant-working-dot":``,"aria-hidden":!0}):null,t[11]=h,t[12]=M);let N;t[13]===M?N=t[14]:(N=(0,$.jsxs)(`span`,{className:`relative inline-block size-10 shrink-0 leading-none`,"aria-hidden":!0,children:[j,M]}),t[13]=M,t[14]=N);let P;t[15]===f?P=t[16]:(P=(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 line-clamp-2 break-words typography-ui-label font-medium leading-5 text-foreground`,children:f}),t[15]=f,t[16]=P);let F=m?(0,$.jsx)(`span`,{className:A(`shrink-0 rounded-full px-1.5 py-0.5 typography-micro leading-none`,gn(p)),children:r(m)}):null,I;t[17]!==P||t[18]!==F?(I=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[P,F]}),t[17]=P,t[18]=F,t[19]=I):I=t[19];let L;t[20]===x?L=t[21]:(L=x.length>0?(0,$.jsx)(`p`,{className:`truncate typography-micro font-normal leading-4 text-muted-foreground`,children:x.join(` · `)}):null,t[20]=x,t[21]=L);let R=b||y?.files!==void 0&&y.files>0?(0,$.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-1.5 typography-micro tabular-nums`,children:[y?.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,y.additions]}),y?.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,y.deletions]}),y?.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:y.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:y.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:y.files})})]}):null,z;t[22]!==I||t[23]!==L||t[24]!==R?(z=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[I,L,R]}),t[22]=I,t[23]=L,t[24]=R,t[25]=z):z=t[25];let B;t[26]!==N||t[27]!==z?(B=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[N,z]}),t[26]=N,t[27]=z,t[28]=B):B=t[28];let V;return t[29]!==T||t[30]!==C||t[31]!==B||t[32]!==E||t[33]!==O?(V=(0,$.jsx)(`article`,{className:E,role:`button`,tabIndex:0,"aria-label":O,"data-assistant-contact-card":`session`,onClick:C,onKeyDown:T,children:B}),t[29]=T,t[30]=C,t[31]=B,t[32]=E,t[33]=O,t[34]=V):V=t[34],V};function yn(e){return!!(e&&e.trim())}var bn=2,xn=1500,Sn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),Cn=e=>e.scrollHeight-e.scrollTop-e.clientHeight,wn=e=>Cn(e)<=bn,Tn=(e,t)=>{let n=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;n&&n!==e;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0;n=n.parentElement}return!1},En=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,Dn=({active:e,assistantID:t,contentRevision:n,onLoadEarlier:r})=>{let i=Q.useRef(null),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(!0),u=Q.useRef(null),d=Q.useRef(null),f=Q.useRef(null),p=Q.useRef(0),m=Q.useRef(null),h=Q.useRef(null),g=Q.useRef(e);g.current=e;let _=ze(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=D(()=>{y.current?.stop(),y.current=null,b.current=null}),S=Q.useMemo(()=>e=>{i.current=e,o(t=>t===e?t:e)},[]),C=Q.useMemo(()=>e=>{c(t=>t===e?t:e)},[]),w=D(()=>{let e=i.current;if(!e||!g.current||l.current)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.getBoundingClientRect().bottom>t);u.current=n?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t,scrollTop:e.scrollTop}:null}),E=D(()=>{let e=i.current,t=u.current;if(!e||!g.current||l.current)return;if(!t){w();return}let n=e.scrollTop-t.scrollTop;if(Math.abs(n)>.5&&m.current){p.current=e.scrollTop,w();return}let r=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.dataset.messageId===t.id);if(!r){w();return}let a=r.getBoundingClientRect().top-e.getBoundingClientRect().top-(t.offset-n);Math.abs(a)>.5&&(e.scrollTop+=a),p.current=e.scrollTop,u.current={id:t.id,offset:r.getBoundingClientRect().top-e.getBoundingClientRect().top,scrollTop:e.scrollTop}}),k=D(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),A=Q.useRef(null),j=D(e=>{let t=i.current;!g.current||!t||(A.current=e??null,l.current=!0,u.current=null,h.current=null,p.current=t.scrollTop)}),M=D(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=Sn(e),n=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(t.scrollTop<n-.5)return x(),l.current=!1,p.current=t.scrollTop,w(),!1;let r=!v.current;if(r&&e.querySelector(`[data-message-id]`)&&(v.current=!0),wn(t))return x(),p.current=t.scrollTop,!1;let a=Math.max(0,t.scrollHeight-t.clientHeight);if(!r&&!_){if(b.current===a)return!1;x(),b.current=a;let t=A.current;return A.current=null,y.current=Re(e.scrollTop,a,{duration:t?.duration??.22,ease:t?[...t.ease]:`easeOut`,onUpdate:t=>{if(!g.current||!l.current||i.current!==e)return;let n=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop<Math.min(p.current,n)-.5){l.current=!1,x(),p.current=e.scrollTop,w();return}e.scrollTop=Math.min(Math.max(e.scrollTop,t),n),p.current=e.scrollTop},onComplete:()=>{y.current=null,b.current=null}}),!0}return x(),e.scrollTop=a,p.current=e.scrollTop,!0}),N=D(e=>{h.current={direction:e,expiresAt:performance.now()+xn}}),P=D(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),F=D(()=>{x(),l.current=!1,w()}),I=D(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=Sn(e),n=t.scrollTop>p.current,a=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(p.current=t.scrollTop,l.current){t.scrollTop<a-.5&&F();return}let o=P();E(),t.scrollTop<=80&&o===`up`&&r?.(),n&&wn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),L=D(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(Me(t,e.target))return;N(`up`),F(),t.scrollTop<=80&&r?.();return}Tn(t,e.target)||N(`down`)}}),R=D(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),z=D(e=>{let t=i.current,n=e.touches.item(0);if(!t||!n){m.current=null;return}let a=m.current;if(!a)return;let o=n.clientY-a.y,s=o*a.deltaY<0,c=(s?0:a.deltaX)+n.clientX-a.x,l=(s?0:a.deltaY)+o;if(m.current={x:n.clientX,y:n.clientY,deltaX:c,deltaY:l},!(Math.abs(c)>=Math.abs(l))){if(l>0&&Me(t,e.target)||l<0&&Tn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}N(l>0?`up`:`down`),l>2&&(F(),t.scrollTop<=80&&r?.())}}),B=D(()=>{m.current=null}),V=D(e=>{if(Z(e)){N(`up`),F(),(i.current?.scrollTop??1/0)<=80&&r?.();return}En(e)&&N(`down`)}),ee=D(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&N(`scrollbar`)});Q.useLayoutEffect(()=>{let n=e?t:null,r=i.current;(d.current!==n||f.current!==r)&&(x(),v.current=!1,d.current=n,f.current=r,l.current=!0,u.current=null,h.current=null,m.current=null,p.current=r?.scrollTop??0),e&&(M(),E())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let te=Q.useMemo(()=>()=>void 0,[]),H=e&&a?a:te,U=Q.useMemo(()=>({passive:!0}),[]);O(`scroll`,I,H,U),O(`wheel`,L,H,U),O(`touchstart`,R,H,U),O(`touchmove`,z,H,U),O(`touchend`,B,H,U),O(`touchcancel`,B,H,U),O(`keydown`,V,H),O(`pointerdown`,ee,H,U);let W=D(()=>{M(),E()});return T(typeof ResizeObserver<`u`&&e?s:null,W),{scrollRef:S,contentRef:C,preparePrepend:k,followLatest:j}},On=.3,kn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],An=[.23,1,.32,1],jn=Le(...kn),Mn=Le(...An),Nn=.15,Pn=.1,Fn=.08,In=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),Ln=e=>Number.parseFloat(e)||0,Rn=(e,t,n)=>e+(t-e)*n,zn=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],Bn=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+Ln(n.borderLeftWidth)+Ln(n.paddingLeft),i=t.top+Ln(n.borderTopWidth)+Ln(n.paddingTop);return{left:r,top:i,width:t.right-Ln(n.borderRightWidth)-Ln(n.paddingRight)-r,height:t.bottom-Ln(n.borderBottomWidth)-Ln(n.paddingBottom)-i}},Vn=e=>({color:e.color,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,fontFeatureSettings:e.fontFeatureSettings,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`}),Hn=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=Bn(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=Vn(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:In(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:zn(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},Un=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},Wn=(e,t,n,r)=>(e.style.opacity=String(t),Re(e,{opacity:[t,n]},{duration:r,ease:`linear`})),Gn=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=zn(i),o=In(t.getBoundingClientRect()),s=Bn(t),c=e.compact?{...e.background,left:e.textBox.left-Ln(i.paddingLeft),width:Math.min(e.background.width,Math.max(120,o.width+32))}:e.background,l={left:c.left,top:c.top+c.height-o.height},u={x:e.textBox.left-l.left-(s.left-o.left),y:e.textBox.top-l.top-(s.top-o.top)},d=Un({position:`fixed`,left:`0px`,top:`0px`,overflow:`hidden`,zIndex:`60`,willChange:`transform, width, height`});d.setAttribute(`aria-hidden`,`true`),d.setAttribute(`data-assistant-contact-send-flight`,``),d.style.backgroundColor=e.backgroundColor;let f=Un({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=Un({...Vn(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=jn(n),i=Mn(n),m=In(t.getBoundingClientRect()),h=c,g=Rn(h.left,m.left,i),_=Rn(h.left+h.width,m.left+m.width,i),v=Rn(h.top+h.height,m.top+m.height,r),y=Rn(h.height,m.height,r),b=v-y;d.style.transform=`translate3d(${g}px, ${b}px, 0)`,d.style.width=`${_-g}px`,d.style.height=`${y}px`,d.style.borderRadius=a.map((t,n)=>`${Rn(Ln(e.radii[n]),Ln(t),r)}px`).join(` `);let x=m.left+(l.left-o.left)*(1-i),S=m.top+(l.top-o.top)*(1-r),C=`translate3d(${x+(s.left-o.left)+u.x*(1-r)-g}px, ${S+(s.top-o.top)+u.y*(1-r)-b}px, 0)`;f.style.transform=C,p.style.transform=C},h=!1,g=[],_=()=>{h||(h=!0,g.forEach(e=>e.stop()),d.remove(),n.style.visibility=``,r?.())};return n.style.visibility=`hidden`,m(0),document.body.appendChild(d),g.push(Re(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:Nn,ease:`linear`}),Wn(f,1,0,Pn),Wn(p,0,1,Fn),Re(0,1,{duration:On,ease:`linear`,onUpdate:m,onComplete:_})),_},Kn=64,qn=e=>{if(!e)return[];let t=Array.from(e.files||[]);return t.length>0?t:Array.from(e.items||[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e instanceof File)},Jn=e=>Array.from(e?.files||[]),Yn=async(e,t=u)=>{let n=[],r=0;for(let i of Array.from(e||[])){if(!i||i.size<=0)continue;if(i.size>26214400){r+=1;continue}let e=URL.createObjectURL(i);n.push({id:t(),url:e,name:i.name.trim()||`attachment`,mime:i.type.trim()||`application/octet-stream`,file:i})}return{attachments:n,skippedTooLarge:r}},Xn=(e,t)=>{let n=[...e,...t];for(let e of n.slice(Kn))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,Kn)},Zn=Ge(()=>x(()=>import(`./ToolOutputDialog-iRAV-k1u.js`),__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]))),Qn=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),$n=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),er=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,tr=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=k(),o=ve(),s=l(e=>e.isMobile),c=V(),d=G(),f=R(e.id,n),p=l(e=>e.isSettingsDialogOpen),m=n&&!p&&!f.hasMessageGap?L(e,f.data):null,h=M(e.name).displayName||e.name,g=(e,t)=>{let n=e?d.data?.assistants.find(t=>t.id===e):void 0;return n?M(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[_,v]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(null),S=Q.useRef(new Map),C=Q.useRef(new AbortController);Q.useEffect(()=>{let e=new AbortController;return C.current=e,()=>e.abort()},[e.id,o]);let w=Q.useRef(new Set);Q.useEffect(()=>{let e=new Set(y.map(e=>e.url));for(let t of w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[y]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[T,E]=Q.useState([]),[O,P]=Q.useState([]),[I,z]=Q.useState(null),[B,H]=Q.useState({open:!1,title:``,content:``}),W=l(e=>e.setImagePreviewOpen),ne=D(e=>{(e.image||e.mermaid||e.video)&&(H(e),W(!0))}),re=D(e=>{H(t=>({...t,open:e})),W(e)});Q.useEffect(()=>()=>{W(!1)},[W]);let ie=Q.useRef(!1);Q.useEffect(()=>{S.current.clear(),x.current=null,E([]),P([]),z(null)},[o]);let ae=Q.useMemo(()=>rn(),[]),oe=Q.useRef(new Set),se=Q.useRef(new Map),ce=at(e=>e.setWorking),K=f.data?.messages??zt,ue=Ht(T,e.id),de=Ut(O,e.id),fe=Kt(K,ue,e.id,de).filter(e=>{if(e.status===`admitted`&&e.messageID.endsWith(`:preview:admitted`))return!1;let t=Array.isArray(e.parts)?e.parts:[];return t.length===0||t.some(e=>!(e.type===`text`&&Qn(e.text)))}),q=fe.length-1;for(;q>=0&&$n(fe[q]);)--q;let Y=fe.filter((e,t)=>!$n(e)||t>q),pe=vt(Y),me=ze(),he=`${o}:${e.id}`,ge=Q.useRef(null),X=ge.current,_e=X?.lastID?Y.findIndex(e=>er(e)===X.lastID):-1,ye=n&&!me&&X?.scope===he&&X.ready&&(X.lastID===null||_e>=0);Q.useLayoutEffect(()=>{let e=Y.at(-1);ge.current={scope:he,ready:n&&f.isSuccess,lastID:e?er(e):null}});let be=new Date().toDateString(),xe=i(`common.date.today`),Se=Q.useMemo(()=>yt(a,xe,new Date(be)),[a,xe,be]),Z=on(ue),Ce=sn(de),we=!!(e.working||e.activeContactTurn),Te=d.data?.revision??null,Ee=de.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),De=new Map(de.map(e=>[e.turnID,e])),Oe=Q.useRef(!1),ke=D(async(e=!1)=>{if(!(!n||Oe.current||f.isFetchingPreviousPage||f.isFillingMessageGap)&&!(e&&f.previousPageError)&&!(!f.hasPreviousPage&&!f.hasMessageGap)){Oe.current=!0,Me();try{f.hasMessageGap?await f.retryMessageGap():await f.fetchPreviousPage()}catch{}finally{Oe.current=!1}}}),{scrollRef:Ae,contentRef:je,preparePrepend:Me,followLatest:Ne}=Dn({active:n,assistantID:e.id,contentRevision:`${Y[0]?.messageID}:${Y.length}:${Ee}:${f.isFetchingPreviousPage}:${f.hasPreviousPage}:${f.isFillingMessageGap}`,onLoadEarlier:()=>{ke(!0)}}),Pe=Q.useRef(null),Fe=Q.useRef(null),Ie=Q.useRef(null),Le=Q.useRef(null),Re=Q.useRef(null),[Be,Ve]=Q.useState(null),He=()=>{let e=Fe.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?Hn(e,t,!s):null};Q.useLayoutEffect(()=>{let e=Ie.current;if(!e)return;Ie.current=null;let t=Array.from(Pe.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>Ve(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Re.current?.(),Re.current=Gn(e.source,t,t,n)}),Q.useEffect(()=>()=>{Ie.current=null,Re.current?.(),Re.current=null},[n,e.id,o]),Q.useEffect(()=>{z(null),oe.current.clear(),se.current=new Map,E(t=>Ht(t,e.id)),P(t=>Ut(t,e.id)),H({open:!1,title:``,content:``}),W(!1)},[e.id,W]),Q.useEffect(()=>{E(e=>qt(e,K))},[K]),Q.useEffect(()=>{let t=new Set(ue.filter(e=>e.status===`sending`).map(e=>e.messageID));P(n=>Zt(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:we,snapshotRevision:Te,admissionRevisionByTurnID:se.current,pendingSendTurnIDs:t,messages:K,settledTurnIDs:oe.current}))},[e.activeContactTurn,e.id,K,ue,we,Te]),Q.useEffect(()=>{ce(e.id,Z||Ce||we)},[e.id,Ce,Z,we,ce]),Q.useEffect(()=>{let t=e.id;return()=>{ce(t,!1)}},[e.id,ce]);let Ue=D(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){oe.current.delete(t.turnID),P(e=>Yt(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(oe.current.has(t.turnID))return;P(e=>Qt(e,t));return}t.type===`contact-turn-end`&&(oe.current.add(t.turnID),P(e=>en($t(e,t,{requireExisting:!0}),K)))}});Q.useEffect(()=>{if(n)return le(Ue)},[n,e.id]);let We=D(async e=>{if(Z)return;let t=C.current,n=await Yn(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&z(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>Xn(e,n.attachments))}),Ge=D(e=>{let t=qn(e.clipboardData);t.length!==0&&(e.preventDefault(),We(t))}),qe=D(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),Je=D(e=>{let t=Jn(e.dataTransfer);t.length!==0&&(e.preventDefault(),We(t))}),Ye=D(async t=>{let r=C.current,a=t??_,o=y,s=e.id,l=x.current,d=l?.assistantID===s&&l.text===a&&l.attachments===o?l.messageID:null,f=an({gate:ae,sending:on(ue),text:a,attachments:o,assistantID:s,createMessageID:()=>d||`yuri_contact_${u()}`});if(!f.ok)return;ce(s,!0),x.current={assistantID:s,text:a,attachments:o,messageID:f.messageID};let p=o.length===0,m=p&&t===void 0&&!d&&n&&!me?He():null;Ie.current=m?{messageID:f.messageID,source:m}:null,Ve(m?{scope:he,messageID:f.messageID}:null),Le.current=m?f.messageID:Le.current,Ne(m?{duration:On,ease:kn}:void 0),p&&v(e=>e===a?``:e),E(e=>[...e.filter(e=>e.messageID!==f.messageID),f.turn]),z(null);let g=()=>{v(e=>e===a?``:e),b(e=>e.filter(e=>!o.includes(e))),o.forEach(e=>S.current.delete(`${s}:${e.id}`)),x.current=null};try{let t=[];for(let e of o){let n=`${s}:${e.id}`,i=S.current.get(n);if(!i){if(i=await ct(s,e.file,e.id,r.signal),r.signal.aborted)return;S.current.set(n,i)}t.push(i)}if(r.signal.aborted)return;let n=[...f.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===f.messageID?{...e,parts:n}:e));let i=await U(s,f.messageID,{parts:n});if(r.signal.aborted)return;g(),typeof i.revision==`number`&&se.current.set(f.messageID,i.revision),E(e=>Jt(e,f.messageID)),oe.current.has(f.messageID)||P(e=>Yt(e,s,f.messageID)),c.data?.serverInstanceID&&N({serverInstanceID:c.data.serverInstanceID,assistantID:s,name:h,avatarSeed:e.avatarSeed??s}).catch(()=>void 0)}catch(e){if(r.signal.aborted)return;if(e instanceof F&&e.code===`admission_timeout`)try{let e=await ee(s,f.messageID);if(r.signal.aborted)return;if(e){g(),typeof e.revision==`number`&&se.current.set(f.messageID,e.revision),E(e=>Jt(e,f.messageID)),oe.current.has(f.messageID)||P(e=>Yt(e,s,f.messageID));return}}catch{}let t=nn(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>tn(e,f.messageID,t)),p&&v(e=>e===``?a:e),z(t)}finally{ae.release()}}),Ze=D(async()=>{if(ie.current)return;ie.current=!0;let t=C.current;z(null);try{await te(e.id,e)}catch(e){t.signal.aborted||z(e instanceof Error?e.message:i(`settings.mcp.page.toast.unexpectedError`))}finally{ie.current=!1}}),Qe=f.isError&&Y.length===0,$e=f.isSuccess&&Y.length===0,et=new Map(ue.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:Pe,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Ae,className:A(`min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 sm:px-8`,s&&`pb-11`,r?`pt-[calc(max(0.625rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height)+1.25rem)]`:`pt-5 sm:pt-7`),style:{overflowAnchor:`none`,overscrollBehavior:`contain`,overscrollBehaviorY:`contain`},"data-assistant-contact-transcript":``,children:[t?(0,$.jsx)(`p`,{className:`mb-3 typography-micro text-[var(--status-warning)]`,children:t}):null,Qe?(0,$.jsxs)(`div`,{ref:je,className:`mx-auto flex h-full min-h-56 max-w-xs flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-error":``,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:h}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -right-1 -bottom-1 flex size-5 items-center justify-center rounded-full bg-[var(--surface-elevated)] text-[var(--status-error)] ring-2 ring-background`,children:(0,$.jsx)(J,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:h}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void f.refetch(),children:i(`chat.history.retry`)})]}):$e?(0,$.jsxs)(`div`,{ref:je,className:`mx-auto flex h-full min-h-56 max-w-sm flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-empty":``,children:[(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:h,className:`opacity-90`}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:h})}),(0,$.jsx)(`p`,{className:`mt-2 max-w-xs typography-ui leading-6 text-muted-foreground/80`,children:i(`assistants.contact.empty`)})]}):(0,$.jsxs)(`div`,{ref:je,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[f.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,f.hasPreviousPage||f.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":f.isFetchingPreviousPage||f.isFillingMessageGap,children:[f.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,f.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,disabled:f.isFetchingPreviousPage||f.isFillingMessageGap,onClick:()=>void ke(),children:i(f.isFetchingPreviousPage||f.isFillingMessageGap?`chat.history.loadingMore`:f.previousPageError||f.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,Y.map((t,n)=>{let r=`${he}:${er(t)}`,a=n>0?Y[n-1]:null,s=pe.get(t.messageID),c=s!==void 0,l=c?(0,$.jsx)(`div`,{className:`flex w-full justify-center px-4 pt-7 pb-4 first:pt-1`,"data-assistant-contact-time":``,children:(0,$.jsx)(`time`,{dateTime:new Date(s).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:Se(s)})}):null,u=t.role===`user`,f=t.role===`peer`,p=t.role===`assistant`&&!c&&a?.role===`assistant`&&a.turnID===t.turnID,_=a?.turnID!==t.turnID,v=!u&&(f||!p),y=f?g(t.fromAssistantID,t.fromAssistantName):h,b=f&&t.fromAssistantID?d.data?.assistants.find(e=>e.id===t.fromAssistantID):e,x=et.get(t.messageID),S=De.get(t.turnID),C=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`);return t.status===`error`||C?(0,$.jsxs)(Q.Fragment,{children:[l,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:A(`relative px-1`,!c&&`mt-3`),children:[(0,$.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap text-center text-[11px] font-normal leading-4 text-muted-foreground [overflow-wrap:anywhere]`,children:t.text||S?.error||i(`assistants.contact.sendFailed`)}),m?.messageID===t.messageID?(0,$.jsx)(xt,{assistantID:e.id,position:m},`${o}:${e.id}:${m.generation}:${m.ordinal}`):null]})]},r):(0,$.jsxs)(Q.Fragment,{children:[l,(0,$.jsxs)(Xe.div,{"data-message-id":t.messageID,initial:ye&&n>_e&&t.messageID!==Le.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:me?0:.18,ease:`easeOut`},className:A(`flex w-full`,u?`justify-end`:`justify-start`,c?`mt-0`:_?`mt-6 first:mt-0`:p?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":x?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!p?``:void 0,children:[u?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-8 shrink-0 justify-center pt-0.5`,children:v?(0,$.jsx)(pt,{name:b?.id||t.fromAssistantID||e.id,avatarSeed:b?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:28,label:y,working:t.status===`streaming`||void 0,showWorkingDot:!1}):(0,$.jsx)(`span`,{className:`size-7`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:A(`relative flex min-w-0 flex-col gap-1.5`,u?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[f?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:y})}):null,t.parts.map((n,a)=>{if(n.type===`card`&&n.cardType===`session`)return(0,$.jsx)(vn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`assistant`)return(0,$.jsx)(fn,{card:n},`${r}:card:${a}`);if(n.type===`card`&&n.cardType===`schedule`)return(0,$.jsx)(pn,{card:n},`${r}:card:${a}`);if(n.type===`file`)return(0,$.jsx)(Rt,{assistantID:e.id,part:n,onShowPopup:ne},`${r}:file:${a}`);if(n.type===`text`&&Qn(n.text))return null;if(n.type===`text`&&(n.text.trim()||t.status===`streaming`)){let e=!u,o=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(n.text.trim());return(0,$.jsx)(`div`,{"aria-label":f?i(`assistants.contact.peer.aria`,{name:y}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":o||void 0,className:A(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] typography-markdown leading-6`,o?`p-0`:`px-4 py-2.5`,e?null:`whitespace-pre-wrap`,o?`text-foreground`:u?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:f?`rounded-[1.25rem] border border-dashed border-border/50 bg-[var(--surface-muted)]/70 text-foreground`:`bg-[var(--surface-muted)] text-foreground`),children:e?(0,$.jsx)(Ke,{content:n.text,messageId:r,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:ne,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):n.text},`${r}:text:${a}`)}return null}),x?.status===`sending`?(0,$.jsx)(`p`,{className:`absolute right-1 top-full mt-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.sending`)}):null,x?.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 typography-micro text-[var(--status-error)]`,children:x.error||i(`assistants.contact.sendFailed`)}):null,m?.messageID===t.messageID?(0,$.jsx)(xt,{assistantID:e.id,position:m},`${o}:${e.id}:${m.generation}:${m.ordinal}`):null]})]})]},r)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-1 left-[2.625rem] flex h-10 items-center`,"data-assistant-contact-status-slot":``,children:!Z&&Be?.scope!==he&&(Ce||we)?(0,$.jsxs)(Xe.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!me&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:me?0:.18,ease:`easeOut`},className:`relative inline-flex h-9 origin-bottom-left items-center gap-1 rounded-[1.35rem] bg-[var(--surface-muted)] px-4 text-muted-foreground/70`,"data-assistant-contact-processing":``,children:[(0,$.jsx)(`div`,{className:`absolute -left-[2.625rem] top-0.5 flex w-8 justify-center`,"data-assistant-contact-processing-avatar":``,children:(0,$.jsx)(pt,{name:e.id,avatarSeed:e.avatarSeed,size:28,label:h,working:!0,showWorkingDot:!1})}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.45s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.22s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-duration:1.4s] motion-reduce:animate-none`})]}):null})]})]}),(0,$.jsxs)(`footer`,{ref:Fe,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[I?(0,$.jsxs)(`div`,{className:`chat-input-column mb-2 flex items-center gap-2`,children:[(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:I}),x.current?(0,$.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,disabled:Z,onClick:()=>void Ye(),children:i(`chat.history.retry`)}):null]}):null,(0,$.jsx)(`form`,{className:A(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),Ye()},onDragOver:qe,onDrop:Je,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(Mt,{active:n,layout:`inline`,value:_,attachments:y,pending:Z,working:Ce||we,onStop:Ce||we?()=>{Ze()}:void 0,stopLabel:i(`chat.chatInput.actions.stopGeneratingAria`),isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:h}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>v(e),onVoiceSend:e=>{Ye(e)},onSubmit:()=>{Ye()},onAddFiles:e=>{We(e)},onRemoveAttachment:t=>{Z||(S.current.delete(`${e.id}:${t}`),x.current=null,b(e=>e.filter(e=>e.id!==t)))},onPaste:Ge,onDragOver:qe,onDrop:Je,className:A(`relative z-10`,s&&`yuri-mobile-composer-surface`),style:{borderRadius:`1.5rem`},"data-assistant-contact-composer-surface":``,textareaProps:{"aria-label":i(`assistants.contact.placeholder`,{name:h})}},`${o}:${e.id}`)})})]}),B.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Zn,{popup:B,onOpenChange:re,isMobile:s})}):null]})};async function nr(e){await H(e);let t=ue.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await z();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&ue.getState().setDefaultShareAssistant(null)}function rr({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=k(),[a,o]=Q.useState(!1),s=e?M(e.name).displayName||e.name:``,c=D(e=>{a&&!e||n(e)}),l=D(()=>{a||n(!1)}),u=D(async()=>{if(!(!e||a)){o(!0);try{await nr(e),r?.(e.id),n(!1),S.success(i(`assistants.settings.toast.deleted`))}catch{S.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,$.jsx)(X,{open:t&&e!==null,onOpenChange:c,children:(0,$.jsxs)(me,{className:`max-w-md`,children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(he,{children:i(`assistants.settings.delete`)}),(0,$.jsx)(ge,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,$.jsxs)(pe,{children:[(0,$.jsx)(j,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,$.jsx)(j,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var ir=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,ar={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function or(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?ar[e.fallbackKind]:`assistants.contact.empty`)}var sr=e=>e.capabilityPending?`loading`:e.capabilityError||e.supported!==!0||e.capabilityEnabled!==!0?`unavailable`:e.snapshotPending?`loading`:e.snapshotEnabled===!0?e.assistantCount===0?`onboarding`:e.hasAssistant?`ready`:e.snapshotSettled?`unavailable`:`loading`:`unavailable`,cr=e({AssistantView:()=>dr}),lr=e=>{let t=(0,dt.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=k(),o=Fe(),s;t[0]===n?s=t[1]:(s=n?M(n.name):null,t[0]=n,t[1]=s);let c=s,l=n&&c?c.displayName||n.name:``,u;t[2]!==n||t[3]!==o||t[4]!==i?(u=()=>{if(n){if(i){i(n.id);return}fe(n.id,o?{openMobileSettings:o.openSettings}:void 0)}},t[2]=n,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=D(u),f;t[6]!==n||t[7]!==l||t[8]!==a?(f=n?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(pt,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,$.jsx)(bt,{assistantID:n.id,serverWorking:!!(n.working||n.activeContactTurn),lastContactAt:n.latestMessagePreview?.createdAt})]})]}):l||a(`assistants.title`),t[6]=n,t[7]=l,t[8]=a,t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=a(`assistants.actions.backToChat`),t[10]=a,t[11]=p);let m;t[12]!==n||t[13]!==d||t[14]!==a?(m=n?[{icon:`settings-3`,ariaLabel:a(`assistants.conversation.openSettings`),onClick:d}]:[],t[12]=n,t[13]=d,t[14]=a,t[15]=m):m=t[15];let h;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsx)(ne,{title:f,backAriaLabel:p,onBack:r,actions:m,overlay:!0}),t[16]=r,t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h},ur=e=>{let t=(0,dt.c)(53),{avatarSeed:n,unreadCount:r,summary:i,assistantID:a,displayName:o,selected:s,enabled:c,editLabel:l,deleteLabel:u,onSelect:d,onEdit:f,onDelete:p,serverWorking:m}=e,h=rt(a,m!==void 0&&m),[g,_]=Q.useState(!1),v;t[0]===d?v=t[1]:(v=()=>d(),t[0]=d,t[1]=v);let y=D(v),b;t[2]===f?b=t[3]:(b=()=>{_(!1),f()},t[2]=f,t[3]=b);let x=D(b),S;t[4]===p?S=t[5]:(S=()=>{_(!1),p()},t[4]=p,t[5]=S);let C=D(S),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),_(!0)},t[6]=w):w=t[6];let T=s?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,E=!c&&`opacity-65`,O;t[7]!==T||t[8]!==E?(O=A(`flex w-full min-h-11 items-center gap-3 rounded-xl border px-3 py-3 text-left outline-none transition-[background-color,border-color,opacity] duration-150 ease-out active:bg-interactive-active focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,T,E),t[7]=T,t[8]=E,t[9]=O):O=t[9];let k;t[10]!==y||t[11]!==s||t[12]!==O?(k=(0,$.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":s,onClick:y,onContextMenu:w,className:O}),t[10]=y,t[11]=s,t[12]=O,t[13]=k):k=t[13];let j;t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==h?(j=(0,$.jsx)(pt,{name:a,avatarSeed:n,size:44,label:o,working:h}),t[14]=a,t[15]=n,t[16]=o,t[17]=h,t[18]=j):j=t[18];let M=s?`font-semibold`:`font-medium`,N;t[19]===M?N=t[20]:(N=A(`block truncate typography-ui-label leading-5`,M),t[19]=M,t[20]=N);let P;t[21]!==o||t[22]!==N?(P=(0,$.jsx)(`span`,{className:N,children:o}),t[21]=o,t[22]=N,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=A(ir,`mt-1 leading-5`),t[24]=F):F=t[24];let I;t[25]===i?I=t[26]:(I=(0,$.jsx)(`span`,{className:F,children:i}),t[25]=i,t[26]=I);let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]===r?R=t[31]:(R=(0,$.jsx)(ot,{count:r,className:`h-3.5 min-w-3.5 bg-[oklch(from_var(--primary-base)_calc(l_*_0.78)_c_h)] px-1 text-[10px] text-[var(--color-white)] shadow-none`}),t[30]=r,t[31]=R);let z;t[32]!==j||t[33]!==L||t[34]!==R||t[35]!==k?(z=(0,$.jsxs)($e,{render:k,children:[j,L,R]}),t[32]=j,t[33]=L,t[34]=R,t[35]=k,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(J,{name:`edit`,className:`size-4`}),t[37]=B):B=t[37];let V;t[38]!==l||t[39]!==x?(V=(0,$.jsxs)(tt,{onClick:x,children:[B,l]}),t[38]=l,t[39]=x,t[40]=V):V=t[40];let ee;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Qe,{}),t[41]=ee):ee=t[41];let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(J,{name:`delete-bin`,className:`size-4`}),t[42]=te):te=t[42];let H;t[43]!==u||t[44]!==C?(H=(0,$.jsxs)(tt,{onClick:C,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[te,u]}),t[43]=u,t[44]=C,t[45]=H):H=t[45];let U;t[46]!==V||t[47]!==H?(U=(0,$.jsxs)(et,{className:`min-w-[10rem]`,children:[V,ee,H]}),t[46]=V,t[47]=H,t[48]=U):U=t[48];let W;return t[49]!==g||t[50]!==z||t[51]!==U?(W=(0,$.jsxs)(Ze,{open:g,onOpenChange:_,children:[z,U]}),t[49]=g,t[50]=z,t[51]=U,t[52]=W):W=t[52],W},dr=e=>{let t=(0,dt.c)(118),{activeOverride:i,onMobileBack:a,onMobileOpenSettings:o}=e,{t:s}=k(),{isMobile:c}=_e(),u=Fe(),d=Q.useSyncExternalStore(n,r,r),f=l(fr),p=i??f,m=l(pr),h=c||m,g=V(),_=G(),v=_.data;v?.assistants;let y;t[0]===v?.assistants?y=t[1]:(y=v?.assistants??[],t[0]=v?.assistants,t[1]=y);let b;t[2]===y?b=t[3]:(b=it(y),t[2]=y,t[3]=b);let x=b,S;t[4]===d?S=t[5]:(S=e=>e.assistantByTransport[d]??null,t[4]=d,t[5]=S);let C=ue(S),w=ue(mr),T=ue(hr),E;t[6]!==C||t[7]!==v?.assistants?(E=v?.assistants.find(e=>e.id===C)??null,t[6]=C,t[7]=v?.assistants,t[8]=E):E=t[8];let O=E,N;t[9]!==w||t[10]!==C||t[11]!==v?(N=()=>{!C&&v?.assistants[0]&&w(v.assistants[0].id)},t[9]=w,t[10]=C,t[11]=v,t[12]=N):N=t[12];let P=v?.assistants,F;t[13]!==w||t[14]!==C||t[15]!==P?(F=[w,C,P],t[13]=w,t[14]=C,t[15]=P,t[16]=F):F=t[16],Q.useEffect(N,F);let I;t[17]!==O||t[18]!==w||t[19]!==C||t[20]!==v?.assistants||t[21]!==_.isSuccess?(I=()=>{_.isSuccess&&C&&!O&&w(v?.assistants[0]?.id??null)},t[17]=O,t[18]=w,t[19]=C,t[20]=v?.assistants,t[21]=_.isSuccess,t[22]=I):I=t[22];let L=v?.assistants,R;t[23]!==O||t[24]!==w||t[25]!==C||t[26]!==_.isSuccess||t[27]!==L?(R=[O,w,C,L,_.isSuccess],t[23]=O,t[24]=w,t[25]=C,t[26]=_.isSuccess,t[27]=L,t[28]=R):R=t[28],Q.useEffect(I,R);let z;t[29]!==u||t[30]!==T?(z=()=>{if(T(),u){u.openSettings();return}let e=l.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=u,t[30]=T,t[31]=z):z=t[31];let B=D(z),ee;t[32]===u?ee=t[33]:(ee=e=>{fe(e,u?{openMobileSettings:u.openSettings}:void 0)},t[32]=u,t[33]=ee);let te=D(ee),H;t[34]!==O||t[35]!==u?(H=()=>{O&&fe(O.id,u?{openMobileSettings:u.openSettings}:void 0)},t[34]=O,t[35]=u,t[36]=H):H=t[36];let U=D(H),[W,ne]=Q.useState(null),re;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{ne(e)},t[37]=re):re=t[37];let ie=D(re),ae;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{e||ne(null)},t[38]=ae):ae=t[38];let oe=D(ae),se=D(gr),ce;t[39]!==a||t[40]!==se?(ce=()=>{if(a){a();return}se()},t[39]=a,t[40]=se,t[41]=ce):ce=t[41];let K=D(ce),le=sr({capabilityPending:g.isPending,snapshotPending:_.isPending,capabilityError:g.isError,supported:g.data?.supported,capabilityEnabled:g.data?.enabled,snapshotEnabled:v?.enabled,snapshotSettled:_.isSuccess,assistantCount:v?.assistants.length??0,hasAssistant:!!O}),de;t[42]!==O||t[43]!==K||t[44]!==h||t[45]!==o?(de=(e,t,n,r)=>(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[h?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):null,(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,children:[(0,$.jsx)(J,{name:e,className:`size-6 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,$.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,$.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=O,t[43]=K,t[44]=h,t[45]=o,t[46]=de):de=t[46];let q=de;if(le===`loading`){let e;t[47]!==O||t[48]!==K||t[49]!==h||t[50]!==o?(e=h?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):null,t[47]=O,t[48]=K,t[49]=h,t[50]=o,t[51]=e):e=t[51];let n;t[52]===s?n=t[53]:(n=s(`common.loading`),t[52]=s,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(J,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`}),t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,"aria-busy":`true`,"aria-label":n,"data-assistant-workspace-loading":``,children:r}),t[55]=n,t[56]=i);let a;return t[57]!==e||t[58]!==i?(a=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[e,i]}),t[57]=e,t[58]=i,t[59]=a):a=t[59],a}if(le===`unavailable`){let e;return t[60]!==q||t[61]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[60]=q,t[61]=s,t[62]=e):e=t[62],e}if(le===`onboarding`){let e;if(t[63]!==B||t[64]!==q||t[65]!==s){let n=s(`assistants.onboarding.title`),r=s(`assistants.onboarding.description`),i;t[67]===s?i=t[68]:(i=s(`assistants.onboarding.action`),t[67]=s,t[68]=i);let a;t[69]!==B||t[70]!==i?(a=(0,$.jsx)(j,{onClick:B,children:i}),t[69]=B,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=B,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!v||!O){let e;return t[72]!==q||t[73]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[72]=q,t[73]=s,t[74]=e):e=t[74],e}let Y;t[75]===O.name?Y=t[76]:(Y=M(O.name),t[75]=O.name,t[76]=Y);let pe=Y,me;t[77]!==O.enabled||t[78]!==_.isError||t[79]!==s?(me=O.enabled?_.isError?s(`assistants.state.staleSnapshot`):null:s(`assistants.state.assistantDisabled`),t[77]=O.enabled,t[78]=_.isError,t[79]=s,t[80]=me):me=t[80];let he=me,ge;t[81]!==x||t[82]!==h||t[83]!==B||t[84]!==te||t[85]!==ie||t[86]!==w||t[87]!==C||t[88]!==v||t[89]!==s?(ge=h?null:(0,$.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-3 pt-4 sm:px-5`,children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,$.jsx)(ft,{snapshot:v,compact:!0,rowClassName:`min-w-0 flex-1`}),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`assistants.settings.create`),onClick:B,children:(0,$.jsx)(J,{name:`add`,className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 sm:px-4`,role:`listbox`,"aria-label":s(`assistants.listAria`),children:(0,$.jsx)(`div`,{className:`flex flex-col gap-1 pt-3`,children:x.map(e=>{let t=e.id===C,n=M(e.name);return(0,$.jsx)(ur,{assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:or(e.latestMessagePreview,s),displayName:n.displayName,selected:t,enabled:e.enabled,editLabel:s(`assistants.menu.edit`),deleteLabel:s(`assistants.settings.delete`),assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>w(e.id),onEdit:()=>te(e.id),onDelete:()=>ie(e)},e.id)})})})]}),t[81]=x,t[82]=h,t[83]=B,t[84]=te,t[85]=ie,t[86]=w,t[87]=C,t[88]=v,t[89]=s,t[90]=ge):ge=t[90];let X=W!==null,ve;t[91]!==W||t[92]!==oe||t[93]!==X?(ve=(0,$.jsx)(rr,{assistant:W,open:X,onOpenChange:oe}),t[91]=W,t[92]=oe,t[93]=X,t[94]=ve):ve=t[94];let ye=!h&&`border-l border-[var(--surface-subtle)]`,be;t[95]===ye?be=t[96]:(be=A(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,ye),t[95]=ye,t[96]=be);let xe;t[97]!==O||t[98]!==K||t[99]!==h||t[100]!==o||t[101]!==U||t[102]!==pe||t[103]!==s?(xe=h?(0,$.jsx)(lr,{assistant:O,onBack:K,onOpenSettings:o}):(0,$.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3.5 border-b border-[var(--surface-subtle)]/70 px-5 sm:px-7`,children:[(0,$.jsx)(pt,{name:O.id,avatarSeed:O.avatarSeed,size:40,label:pe.displayName||O.name,working:!!(O.working||O.activeContactTurn),showWorkingDot:!1}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:pe.displayName}),(0,$.jsx)(bt,{assistantID:O.id,serverWorking:!!(O.working||O.activeContactTurn),lastContactAt:O.latestMessagePreview?.createdAt})]}),(0,$.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 rounded-full text-muted-foreground/65 transition-colors hover:text-foreground`,onClick:U,"aria-label":s(`assistants.conversation.openSettings`),children:(0,$.jsx)(J,{name:`settings-3`,className:`size-4`})})]}),t[97]=O,t[98]=K,t[99]=h,t[100]=o,t[101]=U,t[102]=pe,t[103]=s,t[104]=xe):xe=t[104];let Se;t[105]!==p||t[106]!==O||t[107]!==h||t[108]!==he?(Se=(0,$.jsx)(tr,{assistant:O,warning:he,active:p,overlayHeader:h}),t[105]=p,t[106]=O,t[107]=h,t[108]=he,t[109]=Se):Se=t[109];let Z;t[110]!==be||t[111]!==xe||t[112]!==Se?(Z=(0,$.jsxs)(`div`,{className:be,children:[xe,Se]}),t[110]=be,t[111]=xe,t[112]=Se,t[113]=Z):Z=t[113];let Ce;return t[114]!==ge||t[115]!==ve||t[116]!==Z?(Ce=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-hidden bg-background`,"data-presentation":`workspace`,children:[ge,ve,Z]}),t[114]=ge,t[115]=ve,t[116]=Z,t[117]=Ce):Ce=t[117],Ce};function fr(e){return e.activeMainTab===`assistant`}function pr(e){return e.isMobile}function mr(e){return e.selectAssistant}function hr(e){return e.requestCreate}function gr(){l.getState().setActiveMainTab(`chat`)}export{rr as a,or as i,cr as n,pt as o,ir as r,ft as s,dr as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-CAZiOV2G.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import{n as i}from"./useUIStore-NMQx_cnG.js";import{l as a}from"./vendor-tanstack-react-query-CdqCAt40.js";import{a as o,i as s,t as c,u as l}from"./fileQueries-QvEzQ4wT.js";import{r as u}from"./vendor-sonner-ZS8XIOVl.js";import{f as d}from"./button-D6gHjV_f.js";import{n as f}from"./Icon-giRdbrNf.js";import{n as p}from"./useEffectiveDirectory-B_KnXAgL.js";import{t as m}from"./diagram-DwYOPB42.js";var h=e(n(),1),g=r();function _(){let{t:e}=d(),{files:n}=l(),r=a(),_=p()??null,v=t(),[y,b]=h.useState(null),[x,S]=h.useState(``),C=h.useRef(null),w=h.useRef(!1),T=h.useRef(null),E=h.useRef(0),D=h.useRef(Promise.resolve()),O=i(e=>e.pendingDiagramFile),k=o({scopeDirectory:_,path:y},{enabled:!!y});if(y&&(T.current?.path!==y||T.current.transport!==v||T.current.scopeDirectory!==_)){let e=E.current+1;E.current=e,T.current={path:y,generation:e,transport:v,scopeDirectory:_}}h.useEffect(()=>(w.current=!0,()=>{w.current=!1,E.current+=1}),[]),h.useEffect(()=>{if(!O)return;let e=i.getState().consumePendingDiagramFile();if(e){let t=E.current+1;E.current=t,T.current={path:e,generation:t,transport:v,scopeDirectory:_},b(e)}},[_,O,v]),h.useEffect(()=>{let e=T.current;if(!(!e||e.path!==y||e.transport!==v||e.scopeDirectory!==_)){if(k.data!==void 0){S(k.data);return}k.isError&&S(``)}},[_,y,k.data,k.isError,v]);let A=h.useCallback(async()=>{let t=C.current?.getXml(),i=T.current,a=n?.writeFile;if(!y||!a||!t||t===x||i?.path!==y)return;let{path:o,generation:l,scopeDirectory:d,transport:f}=i,p=D.current.then(async()=>{try{if(!(await a(o,t))?.success)throw Error(e(`filesView.toast.writeFileFailed`));let n={scopeDirectory:d,path:o};await r.cancelQueries({queryKey:c(n,f),exact:!0}),s(r,n,f,t);let i=T.current;w.current&&i?.path===o&&i.generation===l&&i.transport===f&&i.scopeDirectory===d&&S(t)}catch(t){u.error(t instanceof Error?t.message:e(`filesView.toast.saveFailed`))}});D.current=p.catch(()=>void 0),await p},[y,n,r,e,x]),j=y?y.split(`/`).pop()||y:``;return y?k.isPending?(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(f,{name:`loader-4`,className:`size-4 animate-spin`})}):(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/30 px-3 py-1.5`,children:[(0,g.jsx)(f,{name:`file`,className:`size-4 shrink-0 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`typography-ui text-muted-foreground truncate flex-1`,children:j}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,title:e(`filesView.diagram.saveDiagram`),children:(0,g.jsx)(f,{name:`save-3`,className:`size-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>i.getState().setActiveMainTab(`chat`),className:`size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,title:e(`filesView.diagram.closeDiagramView`),children:(0,g.jsx)(f,{name:`close`,className:`size-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,g.jsx)(m,{ref:C,xml:x,className:`h-full`})})]}):(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(`div`,{className:`typography-ui text-muted-foreground`,children:e(`filesView.editor.pickFileFromTree`)})})}export{_ as DiagramView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{r as i}from"./button-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{r as i}from"./button-D6gHjV_f.js";var a=`#yuri-skill:`,o=`#yuri-agent:`,s=e=>`https://opencode.ai/docs/agents/#${encodeURIComponent(e)}`,c=e=>`${a}${encodeURIComponent(e)}`,l=e=>`${o}${encodeURIComponent(e)}`,u=e=>{let t=[a,`#openchamber-skill:`].find(t=>e?.startsWith(t));if(!t||!e)return null;try{return decodeURIComponent(e.slice(t.length))}catch{return null}},d=e=>{let t=[o,`#openchamber-agent:`].find(t=>e?.startsWith(t));if(!t||!e)return null;try{return decodeURIComponent(e.slice(t.length))}catch{return null}},f=[`user-blocking`,`visible`,`background`],p=e=>{let t={"user-blocking":{head:null,tail:null},visible:{head:null,tail:null},background:{head:null,tail:null}},n=Math.max(1,Math.floor(e.maxTasksPerFrame)),r=Math.max(1,e.frameBudgetMs),i=null,a=!1,o=0,s=e=>{let n=t[e.priority];e.previous=n.tail,n.tail?n.tail.next=e:n.head=e,n.tail=e},c=e=>{let n=t[e.priority];e.previous?e.previous.next=e.next:n.head=e.next,e.next?e.next.previous=e.previous:n.tail=e.previous,e.next=null,e.previous=null},l=()=>{for(let e of f){let n=t[e].head;if(n)return c(n),n.consumed=!0,--o,n}return null},u=()=>{i===null&&o!==0&&(i=e.requestFrame(d))},d=()=>{i=null;let t=e.now(),a=0;for(;o>0&&a<n;){let n=l();if(!n||(n.run(),a+=1,e.now()-t>=r))break}u()},p=()=>{i!==null||a||o===0||(a=!0,i=e.requestFrame(()=>{i=null,a=!1,u()}))};return{enqueue(t,n){let r={cancelled:!1,consumed:!1,next:null,previous:null,priority:n?.priority??`background`,run:t};return s(r),o+=1,!a&&i===null&&p(),()=>{r.cancelled||r.consumed||(r.cancelled=!0,c(r),--o,o===0&&(i!==null&&(e.cancelFrame(i),i=null),a=!1))}},clear(){for(let e of f){let n=t[e],r=n.head;for(;r;){let e=r.next;r.cancelled=!0,r.next=null,r.previous=null,r=e}n.head=null,n.tail=null}o=0,i!==null&&(e.cancelFrame(i),i=null),a=!1}}},m=null,h=()=>typeof window>`u`?null:m||(m=p({requestFrame:e=>window.requestAnimationFrame(e),cancelFrame:e=>window.cancelAnimationFrame(e),now:()=>performance.now(),maxTasksPerFrame:2,frameBudgetMs:6}),m),g=(e,t)=>{let n=h();return n?n.enqueue(e,t):(e(),()=>{})},_={textThrottleMs:20,markdownPaceMs:64},v={textThrottleMs:100,markdownPaceMs:128},y=e=>e===`android`?v:_,b=r(),x=e(t(),1),S=n(),C=x.createContext(!1),w=e=>{let t=(0,b.c)(3),{disabled:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,S.jsx)(C.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i},T=e=>{let t=(0,b.c)(8),{children:n,className:r}=e,[a,o]=x.useState(!1),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=null,t=()=>o(!0);return typeof window<`u`&&typeof window.requestAnimationFrame==`function`?e=window.requestAnimationFrame(t):t(),()=>{e!==null&&typeof window<`u`&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(e)}},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),x.useEffect(s,c);let l=a?`opacity-100 translate-y-0`:`opacity-0 translate-y-2`,u;t[2]!==r||t[3]!==l?(u=i(`w-full transition-all duration-300 ease-out`,l,r),t[2]=r,t[3]=l,t[4]=u):u=t[4];let d;return t[5]!==n||t[6]!==u?(d=(0,S.jsx)(`div`,{className:u,children:n}),t[5]=n,t[6]=u,t[7]=d):d=t[7],d},E=e=>{let t=(0,b.c)(5),{children:n,className:r,skipAnimation:i,forceAnimation:a,ignoreContextDisabled:o,respectReducedMotion:s}=e,c=a!==void 0&&a,l=o!==void 0&&o,u=s!==void 0&&s,d=x.useContext(C),f=u&&typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!c||i||!l&&d||f){let e;return t[0]===n?e=t[1]:(e=(0,S.jsx)(S.Fragment,{children:n}),t[0]=n,t[1]=e),e}let p;return t[2]!==n||t[3]!==r?(p=(0,S.jsx)(T,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=p):p=t[4],p};export{l as a,d as c,g as i,u as l,E as n,s as o,y as r,c as s,w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{f as i,t as a}from"./button-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{f as i,t as a}from"./button-D6gHjV_f.js";import{Rr as o}from"./useMobileNavigationStore-DT5mNqWh.js";import{i as s}from"./react-BYRXYlGz.js";import{n as c,t as l}from"./readiness-D6Yhaj2W.js";import{t as u}from"./GuiPluginWindow-BZJ8izaH.js";var d=r(),f=e(t(),1),p=n();function m(){let e=(0,d.c)(19),{host:t,snapshot:n,error:r}=s(),{t:m}=i(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=new Set,e[0]=h):h=e[0];let g;e[1]===t?g=e[2]:(g={host:t,errors:h},e[1]=t,e[2]=g);let _=f.useRef(g),v,y;e[3]!==t||e[4]!==n.plugins||e[5]!==m?(v=()=>{_.current.host!==t&&(_.current={host:t,errors:new Set});let e=new Set;for(let t of n.plugins){if(t.status!==`failed`)continue;let n=t.error||m(`guiPlugins.failed`),r=JSON.stringify([t.id,n]);e.add(r),_.current.errors.has(r)||o.error(`${t.id}: ${n}`)}_.current.errors=e},y=[t,n.plugins,m],e[3]=t,e[4]=n.plugins,e[5]=m,e[6]=v,e[7]=y):(v=e[6],y=e[7]),f.useEffect(v,y);let b;if(e[8]!==r||e[9]!==t||e[10]!==n.activePanel||e[11]!==n.panels||e[12]!==n.plugins||e[13]!==m){let i;e[15]===n.activePanel?i=e[16]:(i=e=>e.key===n.activePanel&&!e.inline,e[15]=n.activePanel,e[16]=i);let o=n.panels.find(i),s;e[17]===t?s=e[18]:(s=()=>t?.hidePanel(),e[17]=t,e[18]=s),b=(0,p.jsx)(u,{id:`gui-plugin-panel`,open:!!(t&&o),title:o?.title??m(`guiPlugins.title`),onClose:s,children:t&&o?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":m(`guiPlugins.panels`),children:n.panels.map(e=>(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,p.jsx)(a,{variant:`chip`,size:`sm`,"aria-pressed":e.key===o.key,onClick:()=>t.selectPanel(e.key),className:`max-w-64 truncate`,children:e.title}),(0,p.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":m(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:m(`guiPlugins.close`)})]},e.key))}),r?(0,p.jsx)(`div`,{role:`alert`,className:`text-[var(--status-error)]`,children:r}):null,(0,p.jsx)(c,{host:t,contributionKey:o.key,kind:`panel`,revision:l(n.plugins,o.pluginId)})]}):null}),e[8]=r,e[9]=t,e[10]=n.activePanel,e[11]=n.panels,e[12]=n.plugins,e[13]=m,e[14]=b}else b=e[14];return b}export{m as GuiPluginSurface};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rt as e}from"./vendor-base-ui-CdzJ6My_.js";import{n as t}from"./vendor-react-BP2cRVqX.js";import{f as n}from"./button-
|
|
1
|
+
import{rt as e}from"./vendor-base-ui-CdzJ6My_.js";import{n as t}from"./vendor-react-BP2cRVqX.js";import{f as n}from"./button-D6gHjV_f.js";import{a as r,n as i,o as a,t as o}from"./dialog-D6iTQ8x_.js";import{r as s}from"./device-D6RHIV_h.js";import{t as c}from"./MobileResizableSheet-inQgquPH.js";var l=t(),u=e();function d(e){let t=(0,l.c)(23),{id:d,open:f,title:p,onClose:m,children:h}=e,{isMobile:g}=s(),{t:_}=n(),v;t[0]===m?v=t[1]:(v=e=>{e||m()},t[0]=m,t[1]=v);let y=v;if(g){let e;t[2]===_?e=t[3]:(e=_(`guiPlugins.close`),t[2]=_,t[3]=e);let n;t[4]===_?n=t[5]:(n=_(`guiPlugins.resize`),t[4]=_,t[5]=n);let r;return t[6]!==h||t[7]!==d||t[8]!==y||t[9]!==f||t[10]!==e||t[11]!==n||t[12]!==p?(r=(0,u.jsx)(c,{id:d,open:f,onOpenChange:y,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,initiallyExpanded:!0,children:h}),t[6]=h,t[7]=d,t[8]=y,t[9]=f,t[10]=e,t[11]=n,t[12]=p,t[13]=r):r=t[13],r}let b;t[14]===p?b=t[15]:(b=(0,u.jsx)(r,{children:(0,u.jsx)(a,{children:p})}),t[14]=p,t[15]=b);let x;t[16]!==h||t[17]!==b?(x=(0,u.jsxs)(i,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[b,h]}),t[16]=h,t[17]=b,t[18]=x):x=t[18];let S;return t[19]!==y||t[20]!==f||t[21]!==x?(S=(0,u.jsx)(o,{open:f,onOpenChange:y,children:x}),t[19]=y,t[20]=f,t[21]=x,t[22]=S):S=t[22],S}export{d as t};
|