@yuriai/web 0.2.27-beta.2 → 0.2.27-beta.3

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.
Files changed (94) hide show
  1. package/dist/assets/{AgentAvatar-BW4Zg8bo.js → AgentAvatar-kIN4sZMz.js} +1 -1
  2. package/dist/assets/{AssistantView-Cl0ZeXwr.js → AssistantView-C2KQZ6a4.js} +3 -3
  3. package/dist/assets/{DiagramView-D6wdXRzu.js → DiagramView-DK0iXm9b.js} +1 -1
  4. package/dist/assets/{FadeInOnReveal-gOsILpSk.js → FadeInOnReveal-BJA9Za3T.js} +1 -1
  5. package/dist/assets/{GuiPluginSurface-DOZAQKX0.js → GuiPluginSurface-Dz2CdSUA.js} +1 -1
  6. package/dist/assets/{GuiPluginWindow-tGvc4_0g.js → GuiPluginWindow-l4FYY6S-.js} +1 -1
  7. package/dist/assets/{Icon-DvUDsV1z.js → Icon-BP1sfnHn.js} +1 -1
  8. package/dist/assets/{ImageLoadingPlaceholder-9xYbKqtf.js → ImageLoadingPlaceholder-DCWssLJG.js} +1 -1
  9. package/dist/assets/{LoadingImage-CiOcKPfb.js → LoadingImage-C_Hryaqe.js} +1 -1
  10. package/dist/assets/{MarkdownRenderer-DZkP4UNr.js → MarkdownRenderer-Y6uQXIFH.js} +2 -2
  11. package/dist/assets/{MarkdownRendererImpl-BXzPUEEo.js → MarkdownRendererImpl-qKp1tQrP.js} +1 -1
  12. package/dist/assets/{MarkstreamRendererImpl-B-NWd069.js → MarkstreamRendererImpl-B_JTod0h.js} +1 -1
  13. package/dist/assets/{MobileDetailNavigation-5U28hfYf.js → MobileDetailNavigation-B3rUx5Ve.js} +1 -1
  14. package/dist/assets/{MobileResizableSheet-ZL-zPa3W.js → MobileResizableSheet-F1zSUD1S.js} +1 -1
  15. package/dist/assets/{MobileShareBridge-JSH_Y8Ps.js → MobileShareBridge-F70fkIfS.js} +1 -1
  16. package/dist/assets/{MobileTabPageHeader-Bj9MIS38.js → MobileTabPageHeader-0esgB2TO.js} +1 -1
  17. package/dist/assets/{MultiRunWindow-ZPz62Aqg.js → MultiRunWindow-D8m6R_4x.js} +1 -1
  18. package/dist/assets/{OnboardingScreen-BQNoy9o1.js → OnboardingScreen-BAsPVV_W.js} +1 -1
  19. package/dist/assets/{OverlayScrollbar-BwCFalSw.js → OverlayScrollbar-wiRM4AGj.js} +1 -1
  20. package/dist/assets/{SettingsView-B17qt8dh.js → SettingsView-izzjIckv.js} +15 -15
  21. package/dist/assets/{SettingsWindow-CIFNHb-F.js → SettingsWindow-CSuHDq_c.js} +1 -1
  22. package/dist/assets/{TerminalView-BZZ8LW4d.js → TerminalView-BtM5-BVx.js} +1 -1
  23. package/dist/assets/{ToolOutputDialog-BKuVpgEu.js → ToolOutputDialog-DJs9w1_J.js} +1 -1
  24. package/dist/assets/{YuriLogo-C1Ty-RTB.js → YuriLogo-aBS6wlYU.js} +1 -1
  25. package/dist/assets/{appThemeRegistry-DqGuzMaH.js → appThemeRegistry-BY5rY9-W.js} +1 -1
  26. package/dist/assets/{button-DuHjvKJJ.js → button-Dt6Ygbc7.js} +1 -1
  27. package/dist/assets/{capgoAdapter-B-tddboe.js → capgoAdapter-MQ1qpf60.js} +1 -1
  28. package/dist/assets/{collapsible-B8eL5nLo.js → collapsible-Dm7OHk7m.js} +1 -1
  29. package/dist/assets/{diagram-ChoQDKzy.js → diagram-DWZaG3_v.js} +1 -1
  30. package/dist/assets/{dialog-CVhqZux0.js → dialog-CjQeHVOc.js} +1 -1
  31. package/dist/assets/{dropdown-menu.styles-DGvlOX_5.js → dropdown-menu.styles-PdxueXzN.js} +1 -1
  32. package/dist/assets/{es-B8sAsuo5.js → es-BjI1GHJ5.js} +1 -1
  33. package/dist/assets/{fileMentionTouchSelection-Dd-iSIe2.js → fileMentionTouchSelection-D7QtVxjI.js} +1 -1
  34. package/dist/assets/{fr-BPpW8T-l.js → fr-Bs7ndHkb.js} +1 -1
  35. package/dist/assets/{gitApi-D43bAQh1.js → gitApi-BxQmH8Wg.js} +1 -1
  36. package/dist/assets/{input-E_oYiXZT.js → input-Dq4usRDa.js} +1 -1
  37. package/dist/assets/{insertionBoundaries-BQjiZAmZ.js → insertionBoundaries-CKQL85zy.js} +1 -1
  38. package/dist/assets/{ja-DEoFDi7P.js → ja-DkdV26EW.js} +1 -1
  39. package/dist/assets/{ko-B45xHN6I.js → ko-B0qoC5da.js} +1 -1
  40. package/dist/assets/{main-C6MDfyZy.js → main-CNwFqQQd.js} +2 -2
  41. package/dist/assets/{main-u5iQScJs.js → main-DPhcXanT.js} +4 -4
  42. package/dist/assets/{markdownHeightCache-heNXHdzb.js → markdownHeightCache-C1u0bWDL.js} +1 -1
  43. package/dist/assets/{mcpQueries-BqKVe4Su.js → mcpQueries-D2IxTr4k.js} +1 -1
  44. package/dist/assets/{miniChat-Dhfn71Re.js → miniChat-CF2vb25D.js} +2 -2
  45. package/dist/assets/{mobile-DSVdPfcG.js → mobile-C24qSj44.js} +2 -2
  46. package/dist/assets/{mobileBackNavigation-DHxFQ7SY.js → mobileBackNavigation-vpCg1S7j.js} +1 -1
  47. package/dist/assets/{multirun-CPOzaEQj.js → multirun-DT-dFXud.js} +1 -1
  48. package/dist/assets/{native-config-oauL2ekt.js → native-config-ncdoz9Wl.js} +1 -1
  49. package/dist/assets/{pl-Bm3Je_AX.js → pl-D27Y_GBs.js} +1 -1
  50. package/dist/assets/{projectMeta-YDMdD3AP.js → projectMeta-CG8NLahh.js} +1 -1
  51. package/dist/assets/{pt-BR-BiQwFHhL.js → pt-BR-DbocEu4b.js} +1 -1
  52. package/dist/assets/{readiness-BveVUOIb.js → readiness-DSJs_3v4.js} +1 -1
  53. package/dist/assets/{renderElectronMiniChatApp-NC8iRPyy.js → renderElectronMiniChatApp-ChZCxxH6.js} +2 -2
  54. package/dist/assets/{renderMobileApp-D5ai1i6y.js → renderMobileApp-CRv3Il6P.js} +4 -4
  55. package/dist/assets/{runtimeConfig-BpcgdIV9.js → runtimeConfig-CZrflo-r.js} +1 -1
  56. package/dist/assets/{runtimeEndpointReset-ByKa_0nu.js → runtimeEndpointReset-Cx3RE97b.js} +3 -3
  57. package/dist/assets/{scheduledTaskNavigation-CZfAnPD-.js → scheduledTaskNavigation-rhgnZaaj.js} +1 -1
  58. package/dist/assets/{sessionChangeSummary-D6NlE_5k.js → sessionChangeSummary-CVUA1AFw.js} +1 -1
  59. package/dist/assets/{sessionLookup-C70EoX-V.js → sessionLookup-C3_vQwLe.js} +1 -1
  60. package/dist/assets/{sortable-tabs-strip-aKussO2c.js → sortable-tabs-strip-C1QmKFdb.js} +1 -1
  61. package/dist/assets/{speechSettingsQueries-B6qf-mCh.js → speechSettingsQueries-BSQ-2JTv.js} +1 -1
  62. package/dist/assets/{store-BeD2keas.js → store-DvN2L3vf.js} +2 -2
  63. package/dist/assets/{textarea-DmKaqHSb.js → textarea-vtIQM2iP.js} +1 -1
  64. package/dist/assets/{tooltip-DUKu4nC6.js → tooltip-BpG2mxrT.js} +1 -1
  65. package/dist/assets/{types-DRTMRW4R.js → types-CNTgeeM1.js} +1 -1
  66. package/dist/assets/{uk-CYZXWdd7.js → uk-B_JwElWz.js} +1 -1
  67. package/dist/assets/{useAppFontEffects-BiQf6tgZ.js → useAppFontEffects-BguV1Hfa.js} +5 -5
  68. package/dist/assets/{useDesktopWindowControlsLayout-DJxNmCWb.js → useDesktopWindowControlsLayout-CwgkVw9f.js} +1 -1
  69. package/dist/assets/{useEffectiveDirectory-B8q00InF.js → useEffectiveDirectory-Ci6Z13kj.js} +1 -1
  70. package/dist/assets/{useMobileNavigationStore-Bn4SaalY.js → useMobileNavigationStore-TCj7ZnhV.js} +6 -6
  71. package/dist/assets/{useWorkerHighlightedLines-B6lWNk01.js → useWorkerHighlightedLines-HKhuYGSj.js} +1 -1
  72. package/dist/assets/{zh-CN-CMLBHipA.js → zh-CN-DhFFdHQu.js} +1 -1
  73. package/dist/assets/{zh-TW-CJlmnnhK.js → zh-TW-BvehppXO.js} +1 -1
  74. package/dist/index.html +5 -5
  75. package/dist/mini-chat.html +5 -5
  76. package/dist/mobile.html +5 -5
  77. package/package.json +1 -1
  78. package/server/lib/assistants/DOCUMENTATION.md +10 -0
  79. package/server/lib/assistants/contact-store.js +16 -0
  80. package/server/lib/assistants/contact-store.test.js +19 -0
  81. package/server/lib/assistants/routes.js +25 -3
  82. package/server/lib/assistants/service.js +7 -1
  83. package/server/lib/assistants/weixin/DOCUMENTATION.md +142 -0
  84. package/server/lib/assistants/weixin/api.js +113 -0
  85. package/server/lib/assistants/weixin/api.test.js +80 -0
  86. package/server/lib/assistants/weixin/routes.js +23 -0
  87. package/server/lib/assistants/weixin/routes.test.js +41 -0
  88. package/server/lib/assistants/weixin/runtime.js +357 -0
  89. package/server/lib/assistants/weixin/runtime.test.js +286 -0
  90. package/server/lib/assistants/weixin/store.js +103 -0
  91. package/server/lib/assistants/weixin/typing.js +88 -0
  92. package/server/lib/assistants/weixin/typing.test.js +185 -0
  93. package/server/lib/opencode/shutdown-runtime.js +1 -1
  94. package/server/lib/opencode/shutdown-runtime.test.js +12 -0
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-BKuVpgEu.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D4ja813o.js","assets/desktop-JwYqThiw.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-BQjbsJ43.js","assets/useUIStore-DI7va1HH.js","assets/vendor-zustand-B43HCgwC.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-D5d-V1vN.js","assets/vendor-tanstack-react-query-C4SG3JZB.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/runtime-file-resource-6np6lzoV.js","assets/queryRuntime-Dkpnq3Z1.js","assets/fileQueries-5a1jkme2.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-download-CcNIVp7u.js","assets/platform-DFJEtBlo.js","assets/vendor-pierre-diffs-Bj9Nqn6w.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-BcebBLwF.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-DuHjvKJJ.js","assets/store-BeD2keas.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CGF5jnIh.js","assets/vendor-framer-motion-C1twy-GF.js","assets/Icon-DvUDsV1z.js","assets/dialog-CVhqZux0.js","assets/dialog-CTYD3Sbr.css","assets/tap-LkQum5bB.js","assets/image-loading-Dq1g_wpm.js","assets/image-loading-D9Z_BASK.css","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-DqGuzMaH.js","assets/useMobileNavigationStore-Bn4SaalY.js","assets/gitApiHttp-DHrRqnYh.js","assets/vendor-opencode-client-UL_TecvQ.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-JyLTFv27.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-sonner-r2EJnfoo.js","assets/useAssistantUIStore-C9FPlYQz.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MarkdownRenderer-DZkP4UNr.js","assets/useEffectiveDirectory-B8q00InF.js","assets/markdownHeightCache-heNXHdzb.js","assets/dualLimitLru-D8Sphgua.js","assets/toolHelpers-iEHVHQ9p.js","assets/ImageLoadingPlaceholder-9xYbKqtf.js","assets/useWorkerHighlightedLines-B6lWNk01.js","assets/markdownTheme-hpURsgju.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-BeZn51tF.js","assets/mobileBackNavigation-DHxFQ7SY.js","assets/touch-gestures-K2_ZOkKW.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-DEZ1K7qW.js";import{a}from"./vendor-zustand-B43HCgwC.js";import{at as o,c as s,d as c,f as l,it as u,l as d,m as f,p,u as m}from"./vendor-base-ui-BQjbsJ43.js";import{n as h}from"./useUIStore-DI7va1HH.js";import{$ as g,B as _,J as v,K as y,U as b,X as x,q as S,st as C,z as w}from"./persistence-JyLTFv27.js";import{n as T}from"./vendor-react-D5d-V1vN.js";import{s as E}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{o as D}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as O,r as ee}from"./platform-DFJEtBlo.js";import{r as k}from"./vendor-sonner-r2EJnfoo.js";import{a as A,f as j,i as M,o as N,p as P,r as F}from"./vendor-reactuses-core-BcebBLwF.js";import{f as I,r as L,t as R}from"./button-DuHjvKJJ.js";import{i as z,n as B}from"./MobileShareBridge-JSH_Y8Ps.js";import{N as V,T as H,_ as U,a as W,f as te,g as G,h as ne,j as re,l as ie,n as ae,r as oe,s as K,t as se,u as ce,v as le,w as ue}from"./MobileDetailNavigation-5U28hfYf.js";import{En as q,Hr as de,Mo as fe,Ur as pe,Xn as me,Xt as J,lt as he,s as Y}from"./useMobileNavigationStore-Bn4SaalY.js";import{i as ge,n as _e,r as ve}from"./useAssistantUIStore-C9FPlYQz.js";import{t as ye}from"./AgentAvatar-BW4Zg8bo.js";import{d as be,o as X,t as xe}from"./vendor-framer-motion-C1twy-GF.js";import{n as Z}from"./Icon-DvUDsV1z.js";import{a as Se,i as Ce,n as we,o as Te,r as Ee,t as De}from"./dialog-CVhqZux0.js";import{r as Oe}from"./device-BjRYYXNT.js";import{c as ke,s as Ae}from"./image-loading-Dq1g_wpm.js";import{C as je,T as Me,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as ze,p as Be,r as Ve,s as He,u as Ue,v as We,w as Ge,x as Ke}from"./sessionChangeSummary-D6NlE_5k.js";import{a as qe,n as Je,r as Ye,t as Xe}from"./fileMentionTouchSelection-Dd-iSIe2.js";import{a as Ze,o as Qe,t as $e}from"./MarkdownRenderer-DZkP4UNr.js";import{n as et}from"./textarea-DmKaqHSb.js";import{t as tt}from"./ImageLoadingPlaceholder-9xYbKqtf.js";import{t as nt}from"./LoadingImage-CiOcKPfb.js";import{t as rt}from"./vendor-motion-BmLx2V78.js";import{a as it,c as at,l as ot,o as st,s as ct,t as lt}from"./scheduledTaskNavigation-CZfAnPD-.js";import{a as ut,o as dt,t as ft}from"./sessionLookup-C70EoX-V.js";import{i as pt,n as mt,r as ht}from"./assistant-attachment-cache-B9iHLlm2.js";var gt=T(),Q=t(o(),1),$=u();function _t({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=I(),[a,o]=Q.useState(!1),s=Q.useRef(!1),c=F(async()=>{if(!s.current){s.current=!0,o(!0);try{(await ie(e)).failed&&k.error(i(`assistants.unread.markAllFailed`))}catch{k.error(i(`assistants.unread.markAllFailed`))}finally{s.current=!1,o(!1)}}}),l=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!l?null:(0,$.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,$.jsx)(R,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,onClick:c,"aria-label":i(`assistants.unread.markAll`),title:i(`assistants.unread.markAll`),disabled:a||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":a,children:(0,$.jsx)(Z,{name:`check-double`,className:r?`size-5`:`size-4`})})})}var vt=a(e=>({workingByID:{},setWorking:(t,n)=>e(e=>({workingByID:{...e.workingByID,[t]:n}}))})),yt=({sending:e=!1,processing:t=!1,serverWorking:n=!1})=>e||t||n,bt=(e,t)=>{let n=(0,gt.c)(5),r=t!==void 0&&t,i;n[0]===e?i=n[1]:(i=t=>!!t.workingByID[e],n[0]=e,n[1]=i);let a=vt(i),o;return n[2]!==a||n[3]!==r?(o=yt({processing:a,serverWorking:r}),n[2]=a,n[3]=r,n[4]=o):o=n[4],o},xt=e=>{let t=(0,gt.c)(25),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c,hoverTarget:l,followPointer:u,blinkOnMount:d}=e,f=i===void 0?24:i,p=s===void 0||s,m=d===void 0||d,{t:h}=I(),g;t[0]!==n||t[1]!==o?(g=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=g):g=t[2];let _=vt(g),v=!!(o||_),y=`calc(${f}px * var(--dpt-n, 1))`,b;t[3]===c?b=t[4]:(b=L(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=b);let x;t[5]===y?x=t[6]:(x={width:y,minWidth:y,maxWidth:y,height:y,minHeight:y,maxHeight:y},t[5]=y,t[6]=x);let S=o===void 0?void 0:v?`working`:`idle`,C=r??n,w;t[7]!==m||t[8]!==u||t[9]!==l||t[10]!==a||t[11]!==n||t[12]!==f||t[13]!==S||t[14]!==C?(w=(0,$.jsx)(ye,{kind:`assistant`,motion:S,name:C,size:f,label:a,hoverTarget:l,followPointer:u,animationKey:n,blinkOnMount:m}),t[7]=m,t[8]=u,t[9]=l,t[10]=a,t[11]=n,t[12]=f,t[13]=S,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==h||t[18]!==o?(T=o&&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-background`,"data-assistant-working-dot":``,"aria-label":h(`assistants.contact.working`)}):null,t[16]=p,t[17]=h,t[18]=o,t[19]=T):T=t[19];let E;return t[20]!==T||t[21]!==b||t[22]!==x||t[23]!==w?(E=(0,$.jsxs)(`span`,{className:b,style:x,"data-assistant-working-avatar":``,children:[w,T]}),t[20]=T,t[21]=b,t[22]=x,t[23]=w,t[24]=E):E=t[24],E},St=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(H)&&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}},Ct=(e,t)=>{let n=(0,gt.c)(5),r;n[0]!==e||n[1]!==t?(r=ae(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:St},n[3]=r,n[4]=i),E(i)},wt=3e5,Tt=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function Et(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||!Tt(n,e)||e.getTime()-n.getTime()>wt)&&t.set(r.messageID,r.createdAt),n=e)}return t}function Dt(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`${Tt(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var Ot=Q.memo(e=>{let t=(0,gt.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=I(),s=bt(n,r),c=Ct(n,ke()),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=Dt(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 kt(e){let t=(0,gt.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(Ft),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`||(O()?!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,ce(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=F(d),p;t[5]===f?p=t[6]:(p=e=>{s.current=e.some(Pt),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],A(o,F(p),m),M(`visibilitychange`,f,Nt),M(`focus`,f,Mt),M(`resize`,f,jt);let h,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>o.current?.closest(`[data-assistant-contact-transcript]`),g={passive:!0},t[8]=h,t[9]=g):(h=t[8],g=t[9]),M(`scroll`,f,h,g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_={attributes:!0,attributeFilter:[`class`]},t[10]=_):_=t[10],j(f,At,_),N(f,15e3);let v;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(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]=v):v=t[11],v}function At(){return document.documentElement}function jt(){return window.visualViewport}function Mt(){return window}function Nt(){return document}function Pt(e){return e.isIntersecting&&e.intersectionRatio===1}function Ft(){return{transport:r(),generation:i()}}var It=()=>{},Lt=Q.memo(Me),Rt=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,zt=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=I(),c=ke(),l=E({...pe(c),select:Rt}),u=Q.useMemo(()=>he({sessions:l.data??[],currentSessionId:null,searchQuery:e,limit:e.trim()?10:3}),[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(Xe,[]);M(`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 _=F(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)(Je,{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)(R,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(Z,{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)(R,{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)(et,{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:L(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,Ye(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)(Z,{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`)})]})}),Bt=e=>{let t=(0,gt.c)(120),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({active:n,onChange:r,onVoiceSend:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{t:o}=I(),s=Q.useRef(null),c=n&&!!a.isMobile&&!!i,l;t[5]===c?l=t[6]:(l={available:c},t[5]=c,t[6]=l);let{enabled:u,hint:d,onHintChange:f}=Ge(l),p;t[7]!==d||t[8]!==a.placeholder||t[9]!==o?(p=d===null?a.placeholder:o(d===`recording`?`chat.dictation.releaseSend`:d===`cancelling`?`chat.dictation.releaseCancel`:d===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[7]=d,t[8]=a.placeholder,t[9]=o,t[10]=p):p=t[10];let m=p,h;t[11]===a.value?h=t[12]:(h=()=>({canonical:a.value,document:b(a.value,new Map)}),t[11]=a.value,t[12]=h);let[g,x]=Q.useState(h),T;t[13]!==g.canonical||t[14]!==g.document||t[15]!==a.value?(T=g.canonical===a.value?g.document:b(a.value,new Map),t[13]=g.canonical,t[14]=g.document,t[15]=a.value,t[16]=T):T=t[16];let E=T,[D,O]=Q.useState(0),[ee,k]=Q.useState(!0),[A,j]=Q.useState(!1),[M,N]=Q.useState(),P=Q.useRef(null),R=Q.useRef(null),z=Q.useRef(null),B=Q.useRef(null),V;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(V=Ne(),t[17]=V):V=t[17];let H=Q.useRef(V),U=Q.useId(),W;t[18]!==n||t[19]!==A||t[20]!==D||t[21]!==ee||t[22]!==E.text||t[23]!==a.disabled||t[24]!==a.pending?(W=n&&!a.pending&&!a.disabled&&!ee&&!A?qe({text:E.text,cursor:D}):null,t[18]=n,t[19]=A,t[20]=D,t[21]=ee,t[22]=E.text,t[23]=a.disabled,t[24]=a.pending,t[25]=W):W=t[25];let te=W,G=te?.kind===`mention`?te:null,ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>{B.current!==null&&(P.current?.focus({preventScroll:!0}),P.current?.setSelectionRange(B.current,B.current),B.current=null)},t[26]=ne):ne=t[26];let re;t[27]===E?re=t[28]:(re=[E],t[27]=E,t[28]=re),Q.useLayoutEffect(ne,re);let ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>k(!0),t[29]=ie):ie=t[29];let ae=F(ie),oe;t[30]!==A||t[31]!==D||t[32]!==E||t[33]!==r?(oe=(e,t,n)=>{let i=n===void 0||n,a=v(e);a.ok&&(i&&(H.current=Le(H.current,{before:He(E,[],{start:P.current?.selectionStart??D,end:P.current?.selectionEnd??D}),after:He(e,[],{start:t,end:t})})),A||(B.current=t),O(t),x({canonical:a.text,document:e}),r(a.text))},t[30]=A,t[31]=D,t[32]=E,t[33]=r,t[34]=oe):oe=t[34];let K=F(oe),se;t[35]!==K||t[36]!==E||t[37]!==G||t[38]!==o?(se=e=>{if(!G)return;let t=e.title||o(`chat.fileMentionAutocomplete.untitledSession`),n=_(E,G.tokenStart,G.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:C({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);k(!0),K(n.document,r)},t[35]=K,t[36]=E,t[37]=G,t[38]=o,t[39]=se):se=t[39];let ce=F(se),le;t[40]!==n||t[41]!==K||t[42]!==E||t[43]!==a.disabled||t[44]!==a.pending?(le=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=E.text?`${E.text} ${e}`:e,r=y(E,t,t.length,t.length);K(r.document,r.caret),k(!0)},t[40]=n,t[41]=K,t[42]=E,t[43]=a.disabled,t[44]=a.pending,t[45]=le):le=t[45];let ue=F(le),q;t[46]!==n||t[47]!==E.text||t[48]!==ue||t[49]!==r||t[50]!==i||t[51]!==a.disabled||t[52]!==a.pending?(q=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(E.text){ue(e);return}r(e),i?.(e)}},t[46]=n,t[47]=E.text,t[48]=ue,t[49]=r,t[50]=i,t[51]=a.disabled,t[52]=a.pending,t[53]=q):q=t[53];let de=F(q),fe;t[54]!==K||t[55]!==E?(fe=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!E.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=w(n.selectionStart,n.selectionEnd,E.references)??{start:n.selectionStart,end:n.selectionEnd},i=v({text:E.text.slice(r.start,r.end),references:E.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=y(E,E.text.slice(0,r.start)+E.text.slice(r.end),r.start,r.start);K(e.document,e.caret)}},t[54]=K,t[55]=E,t[56]=fe):fe=t[56];let pe=F(fe),me;t[57]!==E.references||t[58]!==E.text?(me=Be(E.text,E.references.map(Vt))?.map(Ht),t[57]=E.references,t[58]=E.text,t[59]=me):me=t[59];let J=me,he=u&&E.text.length===0?`true`:void 0,Y;t[60]!==u||t[61]!==ue||t[62]!==a.disabled||t[63]!==a.pending||t[64]!==de||t[65]!==f?(Y=u&&(0,$.jsx)(Lt,{containerRef:s,disabled:!!(a.pending||a.disabled),onInsert:ue,onSend:de,onRelease:It,onHintChange:f}),t[60]=u,t[61]=ue,t[62]=a.disabled,t[63]=a.pending,t[64]=de,t[65]=f,t[66]=Y):Y=t[66];let ge=E.text,_e=a.pending,ve;t[67]===a?ve=t[68]:(ve=()=>{a.pending||a.onSubmit()},t[67]=a,t[68]=ve);let ye=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,be;t[69]!==a.textLayoutClassName||t[70]!==ye?(be=L(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,ye,a.textLayoutClassName),t[69]=a.textLayoutClassName,t[70]=ye,t[71]=be):be=t[71];let X;t[72]!==K||t[73]!==E?(X=(e,t)=>{let n=y(E,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);K(n.document,n.caret),k(t?.nativeEvent?.inputType===`insertFromPaste`)},t[72]=K,t[73]=E,t[74]=X):X=t[74];let xe=G?U:void 0,Z=G?M:void 0,Se;t[75]===a.textareaProps?Se=t[76]:(Se=e=>{a.textareaProps?.onScroll?.(e),R.current&&(R.current.scrollTop=e.currentTarget.scrollTop,R.current.scrollLeft=e.currentTarget.scrollLeft)},t[75]=a.textareaProps,t[76]=Se);let Ce,we;t[77]!==pe||t[78]!==a.textareaProps?(Ce=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},we=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[77]=pe,t[78]=a.textareaProps,t[79]=Ce,t[80]=we):(Ce=t[79],we=t[80]);let Te;t[81]===a.textareaProps?Te=t[82]:(Te=e=>{O(e.currentTarget.selectionStart),a.textareaProps?.onSelect?.(e)},t[81]=a.textareaProps,t[82]=Te);let Ee,De;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=()=>{j(!0)},De=e=>{j(!1),O(e.currentTarget.selectionStart)},t[83]=Ee,t[84]=De):(Ee=t[83],De=t[84]);let Oe;t[85]!==K||t[86]!==A||t[87]!==E||t[88]!==G||t[89]!==a.textareaProps?(Oe=e=>{if(a.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||Ke(e))){if(A){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?Ue(H.current,E):Pe(H.current,E);t&&(e.preventDefault(),H.current=t.history,K(t.snapshot.document,t.snapshot.selection.end,!1),k(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=S(E,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),K(t.document,t.caret),k(!0);return}}G&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),z.current?.keyDown(e.key))}},t[85]=K,t[86]=A,t[87]=E,t[88]=G,t[89]=a.textareaProps,t[90]=Oe):Oe=t[90];let ke;t[91]!==a.textareaProps||t[92]!==xe||t[93]!==Z||t[94]!==Se||t[95]!==Ce||t[96]!==we||t[97]!==Te||t[98]!==Oe?(ke={...a.textareaProps,"aria-controls":xe,"aria-activedescendant":Z,"aria-autocomplete":`list`,onScroll:Se,onCopy:Ce,onCut:we,onSelect:Te,onCompositionStart:Ee,onCompositionEnd:De,onKeyDown:Oe},t[91]=a.textareaProps,t[92]=xe,t[93]=Z,t[94]=Se,t[95]=Ce,t[96]=we,t[97]=Te,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]!==ae||t[101]!==U||t[102]!==G||t[103]!==a.isMobile||t[104]!==ce?(Ae=G?(0,$.jsx)(zt,{ref:z,query:G.query,isMobile:a.isMobile??!1,listId:U,onHighlightChange:N,onSelect:ce,onClose:ae}):null,t[100]=ae,t[101]=U,t[102]=G,t[103]=a.isMobile,t[104]=ce,t[105]=Ae):Ae=t[105];let je;t[106]!==E.text||t[107]!==J||t[108]!==m||t[109]!==a||t[110]!==ve||t[111]!==be||t[112]!==X||t[113]!==ke||t[114]!==Ae?(je=(0,$.jsx)(We,{...a,value:ge,pending:_e,placeholder:m,disableInputWhilePending:!1,inputRef:P,onSubmit:ve,highlightedContent:J,highlightRef:R,textLayoutClassName:be,onChange:X,textareaProps:ke,children:Ae}),t[106]=E.text,t[107]=J,t[108]=m,t[109]=a,t[110]=ve,t[111]=be,t[112]=X,t[113]=ke,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==he||t[117]!==Y||t[118]!==je?(Me=(0,$.jsxs)(`div`,{ref:s,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":he,children:[Y,je]}),t[116]=he,t[117]=Y,t[118]=je,t[119]=Me):Me=t[119],Me};function Vt(e){return{start:e.start,end:e.end,priority:103,...x(e)}}function Ht(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(Fe,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var Ut=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function Wt({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=I(),i=ke(),{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=Ze(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&&ht(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=F(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await mt(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=F(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)(nt,{src:h,alt:w,contentFrame:!0,className:Ut,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)(tt,{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)(Z,{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)(R,{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 Gt(e){let t=(0,gt.c)(39),{part:n,onShowPopup:r}=e,{t:i}=I(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=Ae(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=F(d);if(Ze(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)(R,{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)(nt,{src:o,alt:u,contentFrame:!0,className:Ut,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)(Z,{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)(R,{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 Kt(e){let t=(0,gt.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=ke(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(Wt,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(Gt,{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 qt=Q.memo(e=>{let t=(0,gt.c)(32),{turn:n,retryDisabled:r,onRetry:i}=e,{t:a}=I(),o;t[0]===a?o=t[1]:(o=a(`assistants.contact.sendError.viewDetails`),t[0]=a,t[1]=o);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Z,{name:`exclamation-fill`,className:`size-[18px] text-[var(--status-error)]`,"data-assistant-contact-error-dot":``}),t[2]=u):u=t[2];let h;t[3]===o?h=t[4]:(h=(0,$.jsx)(p,{type:`button`,"aria-label":o,"data-assistant-contact-send-error":``,className:`absolute right-full top-1/2 mr-1.5 flex size-9 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-0 shadow-none outline-none focus-visible:opacity-70`,children:u}),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g={side:`flip`,align:`shift`,fallbackAxisSide:`end`},t[5]=g):g=t[5];let _;t[6]===a?_=t[7]:(_=a(`assistants.contact.sendError.title`),t[6]=a,t[7]=_);let v;t[8]===_?v=t[9]:(v=(0,$.jsx)(d,{className:`typography-ui-label font-medium`,children:_}),t[8]=_,t[9]=v);let y;t[10]!==a||t[11]!==n.error?(y=n.error||a(`assistants.contact.sendFailed`),t[10]=a,t[11]=n.error,t[12]=y):y=t[12];let b;t[13]===y?b=t[14]:(b=(0,$.jsx)(s,{role:`alert`,className:`mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap typography-meta leading-relaxed [overflow-wrap:anywhere]`,children:y}),t[13]=y,t[14]=b);let x;t[15]!==i||t[16]!==n.messageID?(x=()=>i(n.messageID),t[15]=i,t[16]=n.messageID,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Z,{name:`refresh`,className:`size-3`}),t[18]=S):S=t[18];let C;t[19]===a?C=t[20]:(C=a(`chat.history.retry`),t[19]=a,t[20]=C);let w;t[21]!==r||t[22]!==C||t[23]!==x?(w=(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(R,{type:`button`,size:`xs`,disabled:r,onClick:x,children:[S,C]})}),t[21]=r,t[22]=C,t[23]=x,t[24]=w):w=t[24];let T;t[25]!==w||t[26]!==v||t[27]!==b?(T=(0,$.jsx)(l,{children:(0,$.jsx)(c,{side:`left`,align:`center`,sideOffset:6,collisionPadding:12,collisionAvoidance:g,className:`z-50`,children:(0,$.jsxs)(m,{className:`yuri-mobile-overlay-surface w-72 max-w-[calc(100vw-2rem)] rounded-xl p-4 text-foreground outline-none`,"data-assistant-contact-send-error-popup":``,children:[v,b,w]})})}),t[25]=w,t[26]=v,t[27]=b,t[28]=T):T=t[28];let E;return t[29]!==T||t[30]!==h?(E=(0,$.jsxs)(f,{children:[h,T]}),t[29]=T,t[30]=h,t[31]=E):E=t[31],E});function Jt(e){let t=(0,gt.c)(7),{children:n,failedTurn:r,retryDisabled:i,onRetry:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==i?(o=r?.status===`failed`?(0,$.jsx)(qt,{turn:r,retryDisabled:i,onRetry:a}):null,t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`relative min-w-0 max-w-full`,"data-assistant-contact-user-part":``,children:[n,o]}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}var Yt=[],Xt=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
3
- `),Zt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),Qt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},$t=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},en=(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:[]}),tn=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>en(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,en(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,en(e,null,n+r.length,`admitted`)]:r},nn=(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:Xt(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=tn(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)},rn=(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},an=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),on=(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}]},sn=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:on(e,t.assistantID,t.turnID,t.admittedAt),cn=(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=sn(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=un(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=dn(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},ln=(e,t)=>on(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}}),un=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:on(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}:{}}),dn=(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},fn=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),pn=(e,t)=>e instanceof re?e.code===`no_provider`?t.noProvider:e.code===`admission_timeout`||e.code===`generate_timeout`?t.timedOut:e.message&&e.message!==e.code?e.message:`${t.sendFailed}\n\n${e.code} (HTTP ${e.status})`:V(e)?t.timedOut:e instanceof Error&&e.message.trim()?e.message:t.sendFailed,mn=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},hn=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:Zt(e.assistantID,r,n,e.createdAt)}},gn=e=>e.some(e=>e.status===`sending`),_n=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`);function vn(e){let t=(0,gt.c)(6),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Z,{name:`brain`,weight:`medium`,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[1]=n,t[2]=i);let a;return t[3]!==i||t[4]!==n?(a=(0,$.jsxs)(`p`,{"data-contact-card-model":``,className:`flex min-w-0 flex-1 items-center gap-1.5 text-[0.75em] leading-4 text-muted-foreground`,title:n,children:[r,i]}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}var yn=[`grid h-[148px] w-[19rem] min-w-0 max-w-full shrink-0 grid-rows-[40px_20px_20px_48px] content-start cursor-pointer rounded-[1.35rem] bg-[var(--surface-muted)]`,`px-4 py-2.5 text-left typography-ui-label transition-colors duration-150 motion-reduce:transition-none`,`hover:bg-interactive-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),bn=yn,xn=yn,Sn=`row-start-1 mb-2 flex h-8 min-w-0 items-center gap-2`,Cn=`row-start-2 min-w-0 self-start truncate font-medium leading-5 text-foreground`,wn=`row-start-4 flex h-12 min-w-0 flex-col justify-center`;function Tn(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var En=e=>{let t=(0,gt.c)(35),{card:n,assistant:r,active:i}=e,a=i===void 0||i,{t:o}=I(),s=je(),c;t[0]===s?c=t[1]:(c=s&&!ee(),t[0]=s,t[1]=c);let l=!!c,u=n.name,d=`${n.providerID}/${n.modelID}`,f;t[2]!==n.assistantID||t[3]!==l?(f=()=>{if(l){Y.getState().openAssistant(n.assistantID);return}_e(n.assistantID)},t[2]=n.assistantID,t[3]=l,t[4]=f):f=t[4];let p=F(f),m;t[5]===p?m=t[6]:(m=e=>{Tn(e,p)},t[5]=p,t[6]=m);let h=F(m),g;t[7]!==o||t[8]!==u?(g=o(`assistants.contact.card.assistant.aria`,{name:u}),t[7]=o,t[8]=u,t[9]=g):g=t[9];let _=r?.avatarSeed,v=a?!!(r?.working||r?.activeContactTurn):void 0,y;t[10]!==n.assistantID||t[11]!==_||t[12]!==v?(y=(0,$.jsx)(`span`,{className:`relative inline-block shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(xt,{name:n.assistantID,avatarSeed:_,size:32,working:v,showWorkingDot:!1,followPointer:!1})}),t[10]=n.assistantID,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]===o?b=t[15]:(b=o(`assistants.contact.card.assistant.label`),t[14]=o,t[15]=b);let x;t[16]===b?x=t[17]:(x=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,children:b}),t[16]=b,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[18]=S):S=t[18];let C;t[19]!==x||t[20]!==y?(C=(0,$.jsxs)(`div`,{className:Sn,children:[y,x,S]}),t[19]=x,t[20]=y,t[21]=C):C=t[21];let w;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(Cn,`row-span-2 self-center`),t[22]=w):w=t[22];let T;t[23]===u?T=t[24]:(T=(0,$.jsx)(`h3`,{className:w,title:u,children:u}),t[23]=u,t[24]=T);let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=L(wn,`justify-end pb-1`),t[25]=E):E=t[25];let D;t[26]===d?D=t[27]:(D=(0,$.jsx)(`div`,{className:E,children:(0,$.jsx)(`div`,{className:`flex h-4 min-w-0 items-center`,children:(0,$.jsx)(vn,{value:d})})}),t[26]=d,t[27]=D);let O;return t[28]!==h||t[29]!==p||t[30]!==C||t[31]!==T||t[32]!==D||t[33]!==g?(O=(0,$.jsxs)(`article`,{className:bn,role:`button`,tabIndex:0,"aria-label":g,"data-assistant-contact-card":`assistant`,onClick:p,onKeyDown:h,children:[C,T,D]}),t[28]=h,t[29]=p,t[30]=C,t[31]=T,t[32]=D,t[33]=g,t[34]=O):O=t[34],O},Dn=e=>!!(e&&typeof e==`object`&&!Array.isArray(e)),On=e=>typeof e==`string`&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e),kn=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6,An=e=>e.kind===`cron`?e.cron===void 0:e.kind===`once`?e.date===void 0:e.kind===`weekly`?e.times===void 0||e.weekdays===void 0:e.kind===`daily`&&e.times===void 0,jn=e=>{if(!Dn(e)||e.timezone!==void 0&&typeof e.timezone!=`string`)return!1;if(e.kind===`cron`)return typeof e.cron==`string`&&!!e.cron.trim();if(e.kind===`once`)return typeof e.date==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&On(e.time);let t=Array.isArray(e.times)&&e.times.length>0&&e.times.every(On);return e.kind===`daily`?t||On(e.time):e.kind===`weekly`&&(t||On(e.time))&&Array.isArray(e.weekdays)&&e.weekdays.length>0&&e.weekdays.every(kn)},Mn=(e,t)=>{if(!An(e)||!jn(t?.schedule))return e;let n=t.schedule;return{...e,kind:n.kind,time:n.time??n.times?.[0]??null,timezone:n.timezone??e.timezone,cron:n.cron??null,date:n.date??null,times:n.times??null,weekdays:n.weekdays??null}},Nn=(e,t)=>{let n=e.kind===`daily`||e.kind===`weekly`||e.kind===`once`||e.kind===`cron`?t(`sessions.scheduledTasks.editor.scheduleType.${e.kind}`):e.kind||``,r=[...new Set((e.times?.length?e.times:e.time?[e.time]:[]).filter(On))].sort(),i=r.join(`, `),a=n,o=r.length===1;if(e.kind===`cron`)i=e.cron?.trim()||n,a=e.cron?.trim()?n:``,o=!1;else if(e.kind===`once`)i=[e.date?.trim(),i].filter(Boolean).join(` `),o=!1;else if(e.kind===`weekly`&&e.weekdays?.length){let n=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`];a=[...new Set(e.weekdays.filter(kn))].sort((e,t)=>e-t).map(e=>t(`sessions.scheduledTasks.dialog.schedule.weekdayShort.${n[e]}`)).join(`, `)}return{value:i||t(`assistants.contact.card.schedule.timeUnavailable`),cadence:a,clock:o,timezone:e.timezone}},Pn=e=>{let t=(0,gt.c)(43),{card:n,task:r}=e,{t:i}=I(),a=n.name,o;t[0]!==n||t[1]!==i||t[2]!==r?(o=Nn(Mn(n,r),i),t[0]=n,t[1]=i,t[2]=r,t[3]=o):o=t[3];let s=o,c;t[4]===n.prompt?c=t[5]:(c=n.prompt?.trim(),t[4]=n.prompt,t[5]=c);let l=c,u;t[6]!==n.projectID||t[7]!==n.taskID?(u=()=>{lt(n.projectID,n.taskID)},t[6]=n.projectID,t[7]=n.taskID,t[8]=u):u=t[8];let d=F(u),f;t[9]===d?f=t[10]:(f=e=>{Tn(e,d)},t[9]=d,t[10]=f);let p=F(f),m;t[11]!==i||t[12]!==a?(m=i(`assistants.contact.card.schedule.aria`,{name:a}),t[11]=i,t[12]=a,t[13]=m):m=t[13];let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Z,{name:`calendar`,weight:`medium`,className:`size-4 shrink-0`}),t[14]=h):h=t[14];let g;t[15]===i?g=t[16]:(g=i(`assistants.contact.card.schedule.label`),t[15]=i,t[16]=g);let _;t[17]===g?_=t[18]:(_=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[h,(0,$.jsx)(`span`,{className:`truncate`,children:g})]}),t[17]=g,t[18]=_);let v;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[19]=v):v=t[19];let y;t[20]===_?y=t[21]:(y=(0,$.jsxs)(`div`,{className:Sn,children:[_,v]}),t[20]=_,t[21]=y);let b;t[22]===a?b=t[23]:(b=(0,$.jsx)(`h3`,{className:Cn,title:a,children:a}),t[22]=a,t[23]=b);let x;t[24]===l?x=t[25]:(x=l?(0,$.jsx)(`p`,{className:`row-start-3 mt-1 min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,title:l,children:l}):null,t[24]=l,t[25]=x);let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=L(wn,`justify-end`),t[26]=S):S=t[26];let C;t[27]===s.cadence?C=t[28]:(C=s.cadence?(0,$.jsx)(`span`,{"data-contact-schedule-cadence":``,className:`min-w-0 max-w-[36%] flex-[0_1_auto] truncate text-[0.75em] leading-4 text-muted-foreground`,title:s.cadence,children:s.cadence}):null,t[27]=s.cadence,t[28]=C);let w=`min-w-0 flex-[0_1_auto] truncate leading-[22px] text-foreground tabular-nums ${s.clock?`text-[1.25em] font-normal tracking-[-0.3px]`:`text-[0.85em]`}`,T;t[29]!==s.value||t[30]!==w?(T=(0,$.jsx)(`p`,{className:w,title:s.value,children:s.value}),t[29]=s.value,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,$.jsx)(`div`,{className:S,children:(0,$.jsxs)(`div`,{"data-contact-schedule-time":``,className:`flex min-w-0 flex-none items-baseline gap-1.5`,children:[C,T]})}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==p||t[36]!==d||t[37]!==y||t[38]!==b||t[39]!==x||t[40]!==E||t[41]!==m?(D=(0,$.jsxs)(`article`,{className:bn,role:`button`,tabIndex:0,"aria-label":m,"data-assistant-contact-card":`schedule`,onClick:d,onKeyDown:p,children:[y,b,x,E]}),t[35]=p,t[36]=d,t[37]=y,t[38]=b,t[39]=x,t[40]=E,t[41]=m,t[42]=D):D=t[42],D},Fn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`||t===`busy`||t===`retry`?t:e===`idle`?`complete`:t===`idle`?t:t||`busy`,In=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,Ln=e=>e===`busy`?`text-[var(--status-info)]`:e===`retry`||e===`question`?`text-[var(--status-warning)]`:e===`error`?`text-[var(--status-error)]`:e===`idle`||e===`complete`?`text-[var(--status-success)]`:`text-muted-foreground`,Rn=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,zn=e=>{let t=(0,gt.c)(56),{card:n}=e,{t:r}=I(),i=je(),a;t[0]===i?a=t[1]:(a=i&&!ee(),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=de(s),l=J(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=Fn(l?.type,n.status),f=In(d),p;t[4]!==n.directory||t[5]!==c?(p=typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory,t[4]=n.directory,t[5]=c,t[6]=p):p=t[6];let m=p,g;t[7]===m?g=t[8]:(g=Rn(m),t[7]=m,t[8]=g);let _=g,v=me(m).data?.current?.trim()||null,y;t[9]===c?y=t[10]:(y=Ve(c),t[9]=c,t[10]=y);let b=y,x=d===`complete`||d===`idle`?Re(c):null,S;t[11]!==n.directory||t[12]!==n.sessionID||t[13]!==o?(S=()=>{let e=ft(n.sessionID)?.directory||n.directory;q(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||h.getState().setActiveMainTab(`chat`)},t[11]=n.directory,t[12]=n.sessionID,t[13]=o,t[14]=S):S=t[14];let C=F(S),w;t[15]===C?w=t[16]:(w=e=>{Tn(e,C)},t[15]=C,t[16]=w);let T=F(w),E=xn,D=r(`assistants.contact.card.session.aria`,{title:u}),O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Z,{name:`chat-thread`,weight:`medium`,className:`size-4 shrink-0`}),t[17]=O):O=t[17];let k;t[18]===r?k=t[19]:(k=r(`assistants.contact.card.session.label`),t[18]=r,t[19]=k);let A;t[20]===k?A=t[21]:(A=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[O,(0,$.jsx)(`span`,{className:`truncate`,children:k})]}),t[20]=k,t[21]=A);let j=f?(0,$.jsxs)(`span`,{"data-assistant-session-status":``,className:L(`ml-auto inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[0.75em] leading-4`,Ln(d)),children:[(0,$.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}),r(f)]}):null,M;t[22]!==A||t[23]!==j?(M=(0,$.jsxs)(`div`,{className:Sn,children:[A,j]}),t[22]=A,t[23]=j,t[24]=M):M=t[24];let N;t[25]===u?N=t[26]:(N=(0,$.jsx)(`h3`,{className:Cn,title:u,children:u}),t[25]=u,t[26]=N);let P=L(`flex min-w-0 items-center gap-1.5 text-foreground`,v&&`max-w-[45%] shrink-0`),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Z,{name:`folder`,weight:`medium`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[27]=R):R=t[27];let z;t[28]===_?z=t[29]:(z=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:_}),t[28]=_,t[29]=z);let B;t[30]!==m||t[31]!==P||t[32]!==z?(B=(0,$.jsxs)(`p`,{className:P,title:m,children:[R,z]}),t[30]=m,t[31]=P,t[32]=z,t[33]=B):B=t[33];let V;t[34]===v?V=t[35]:(V=v?(0,$.jsxs)(`p`,{"data-contact-session-branch":``,className:`flex min-w-0 items-center gap-1 text-muted-foreground`,title:v,children:[(0,$.jsx)(Z,{name:`git-branch`,weight:`medium`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:v})]}):null,t[34]=v,t[35]=V);let H;t[36]!==B||t[37]!==V?(H=(0,$.jsxs)(`div`,{"data-contact-session-project":``,className:`flex h-4 min-w-0 flex-none items-center gap-2 text-[0.8em] leading-4`,children:[B,V]}),t[36]=B,t[37]=V,t[38]=H):H=t[38];let U=x?(0,$.jsxs)(`p`,{"data-contact-session-changes":``,className:`flex h-4 min-w-0 flex-none items-center gap-1.5 overflow-hidden whitespace-nowrap text-[0.8em] leading-4 text-muted-foreground tabular-nums`,children:[(0,$.jsx)(Z,{name:`code`,weight:`medium`,className:`size-3.5 shrink-0`}),x.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,x.additions]}),x.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,x.deletions]}),x.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:x.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:x.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:x.files})})]}):null,W;t[39]===b?W=t[40]:(W=b?(0,$.jsx)(vn,{value:b}):null,t[39]=b,t[40]=W);let te;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[41]=te):te=t[41];let G;t[42]===W?G=t[43]:(G=(0,$.jsxs)(`div`,{"data-contact-session-bottom":``,className:`mt-auto flex h-4 min-w-0 flex-none items-center gap-2`,children:[W,te]}),t[42]=W,t[43]=G);let ne;t[44]!==H||t[45]!==U||t[46]!==G?(ne=(0,$.jsxs)(`div`,{"data-contact-session-details":``,className:`row-start-3 row-end-5 flex min-w-0 flex-col gap-1.5 py-1`,children:[H,U,G]}),t[44]=H,t[45]=U,t[46]=G,t[47]=ne):ne=t[47];let re;return t[48]!==T||t[49]!==C||t[50]!==D||t[51]!==M||t[52]!==N||t[53]!==ne||t[54]!==E?(re=(0,$.jsxs)(`article`,{className:E,role:`button`,tabIndex:0,"aria-label":D,"data-assistant-contact-card":`session`,onClick:C,onKeyDown:T,children:[M,N,ne]}),t[48]=T,t[49]=C,t[50]=D,t[51]=M,t[52]=N,t[53]=ne,t[54]=E,t[55]=re):re=t[55],re},Bn=2,Vn=1500,Hn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),Un=e=>e.scrollHeight-e.scrollTop-e.clientHeight,Wn=e=>Un(e)<=Bn,Gn=(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},Kn=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,qn=({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 _=xe(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=F(()=>{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=F(()=>{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}),T=F(()=>{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}}),E=F(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),D=Q.useRef(null),O=F(e=>{let t=i.current;!g.current||!t||(D.current=e??null,l.current=!0,u.current=null,h.current=null,p.current=t.scrollTop)}),ee=F(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=Hn(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=D.current;return D.current=null,y.current=X(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}),k=F(e=>{h.current={direction:e,expiresAt:performance.now()+Vn}}),A=F(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),j=F(()=>{x(),l.current=!1,w()}),N=F(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=Hn(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&&j();return}let o=A();T(),t.scrollTop<=80&&o===`up`&&r?.(),n&&Wn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),I=F(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(ze(t,e.target))return;k(`up`),j(),t.scrollTop<=80&&r?.();return}Gn(t,e.target)||k(`down`)}}),L=F(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),R=F(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&&ze(t,e.target)||l<0&&Gn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}k(l>0?`up`:`down`),l>2&&(j(),t.scrollTop<=80&&r?.())}}),z=F(()=>{m.current=null}),B=F(e=>{if(Ie(e)){k(`up`),j(),(i.current?.scrollTop??1/0)<=80&&r?.();return}Kn(e)&&k(`down`)}),V=F(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&k(`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&&(ee(),T())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let H=Q.useMemo(()=>()=>void 0,[]),U=e&&a?a:H,W=Q.useMemo(()=>({passive:!0}),[]);M(`scroll`,N,U,W),M(`wheel`,I,U,W),M(`touchstart`,L,U,W),M(`touchmove`,R,U,W),M(`touchend`,z,U,W),M(`touchcancel`,z,U,W),M(`keydown`,B,U),M(`pointerdown`,V,U,W);let te=F(()=>{ee(),T()});return P(typeof ResizeObserver<`u`&&e?s:null,te),{scrollRef:S,contentRef:C,preparePrepend:E,followLatest:O}},Jn=.3,Yn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],Xn=[.23,1,.32,1],Zn=be(...Yn),Qn=be(...Xn),$n=.15,er=.1,tr=.08,nr=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),rr=e=>Number.parseFloat(e)||0,ir=(e,t,n)=>e+(t-e)*n,ar=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],or=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+rr(n.borderLeftWidth)+rr(n.paddingLeft),i=t.top+rr(n.borderTopWidth)+rr(n.paddingTop);return{left:r,top:i,width:t.right-rr(n.borderRightWidth)-rr(n.paddingRight)-r,height:t.bottom-rr(n.borderBottomWidth)-rr(n.paddingBottom)-i}},sr=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`}),cr=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=or(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=sr(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:nr(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:ar(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},lr=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},ur=(e,t,n,r)=>(e.style.opacity=String(t),X(e,{opacity:[t,n]},{duration:r,ease:`linear`})),dr=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=ar(i),o=nr(t.getBoundingClientRect()),s=or(t),c=e.compact?{...e.background,left:e.textBox.left-rr(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=lr({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=lr({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=lr({...sr(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=Zn(n),i=Qn(n),m=nr(t.getBoundingClientRect()),h=c,g=ir(h.left,m.left,i),_=ir(h.left+h.width,m.left+m.width,i),v=ir(h.top+h.height,m.top+m.height,r),y=ir(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)=>`${ir(rr(e.radii[n]),rr(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(X(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:$n,ease:`linear`}),ur(f,1,0,er),ur(p,0,1,tr),X(0,1,{duration:Jn,ease:`linear`,onUpdate:m,onComplete:_})),_},fr=64,pr=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)},mr=e=>Array.from(e?.files||[]),hr=async(e,t=g)=>{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}},gr=(e,t)=>{let n=[...e,...t];for(let e of n.slice(fr))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,fr)},_r=Qe(()=>D(()=>import(`./ToolOutputDialog-BKuVpgEu.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,71,72,73,74,75,76]))),vr=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),yr=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),br=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,xr=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=I(),o=ke(),s=h(e=>e.isMobile),c=ne(),l=le(),u=G(e.id,n),d=h(e=>e.isSettingsDialogOpen),f=n&&!d&&!u.hasMessageGap?ue(e,u.data):null,p=z(e.name).displayName||e.name,m=(e,t)=>{let n=e?l.data?.assistants.find(t=>t.id===e):void 0;return n?z(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[_,v]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(new Map),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),[T,E]=Q.useState([]);Q.useEffect(()=>{let e=new Set(y.map(e=>e.url));for(let t of x.current.values())for(let n of t.attachments)e.add(n.url);for(let t of w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[y,T]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[D,O]=Q.useState([]),[ee,k]=Q.useState(null),[A,j]=Q.useState({open:!1,title:``,content:``}),M=h(e=>e.setImagePreviewOpen),N=F(e=>{(e.image||e.mermaid||e.video)&&(j(e),M(!0))}),P=F(e=>{j(t=>({...t,open:e})),M(e)});Q.useEffect(()=>()=>{M(!1)},[M]),Q.useEffect(()=>{S.current.clear(),x.current.clear(),E([]),O([]),k(null)},[o]);let V=Q.useMemo(()=>mn(),[]),H=Q.useRef(new Set),W=Q.useRef(new Map),ie=vt(e=>e.setWorking),ae=u.data?.messages??Yt,K=Q.useMemo(()=>ae.some(e=>e.parts.some(e=>e.type===`card`&&e.cardType===`schedule`&&An(e))),[ae]),se=U(e.id,n&&K),ce=Q.useMemo(()=>{let e=new Map;for(let t of se.data?.tasks??[]){if(!t.task)continue;let n=e.get(t.projectID);n||(n=new Map,e.set(t.projectID,n)),n.set(t.taskID,t.task)}return e},[se.data]),q=Qt(T,e.id),de=$t(D,e.id),pe=nn(ae,q,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`&&vr(e.text)))}),me=pe.length-1;for(;me>=0&&yr(pe[me]);)--me;let J=pe.filter((e,t)=>!yr(e)||t>me),he=Et(J),Y=xe(),ge=`${o}:${e.id}`,_e=Q.useRef(null),ve=_e.current,ye=ve?.lastID?J.findIndex(e=>br(e)===ve.lastID):-1,be=n&&!Y&&ve?.scope===ge&&ve.ready&&(ve.lastID===null||ye>=0);Q.useLayoutEffect(()=>{let e=J.at(-1);_e.current={scope:ge,ready:n&&u.isSuccess,lastID:e?br(e):null}});let X=new Date().toDateString(),Se=i(`common.date.today`),Ce=Q.useMemo(()=>Dt(a,Se,new Date(X)),[a,Se,X]),we=gn(q),Te=_n(de),Ee=!!(e.working||e.activeContactTurn),De=l.data?.revision??null,Oe=de.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),Ae=new Map(de.map(e=>[e.turnID,e])),je=Q.useRef(!1),Me=F(async(e=!1)=>{if(!(!n||je.current||u.isFetchingPreviousPage||u.isFillingMessageGap)&&!(e&&u.previousPageError)&&!(!u.hasPreviousPage&&!u.hasMessageGap)){je.current=!0,Fe();try{u.hasMessageGap?await u.retryMessageGap():await u.fetchPreviousPage()}catch{}finally{je.current=!1}}}),{scrollRef:Ne,contentRef:Pe,preparePrepend:Fe,followLatest:Ie}=qn({active:n,assistantID:e.id,contentRevision:`${J[0]?.messageID}:${J.length}:${Oe}:${u.isFetchingPreviousPage}:${u.hasPreviousPage}:${u.isFillingMessageGap}`,onLoadEarlier:()=>{Me(!0)}}),Le=Q.useRef(null),Re=Q.useRef(null),ze=Q.useRef(null),Be=Q.useRef(null),Ve=Q.useRef(null),[He,Ue]=Q.useState(null),We=()=>{let e=Re.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?cr(e,t,!s):null};Q.useLayoutEffect(()=>{let e=ze.current;if(!e)return;ze.current=null;let t=Array.from(Le.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>Ue(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Ve.current?.(),Ve.current=dr(e.source,t,t,n)}),Q.useEffect(()=>()=>{ze.current=null,Ve.current?.(),Ve.current=null},[n,e.id,o]),Q.useEffect(()=>{k(null),x.current.clear(),S.current.clear(),H.current.clear(),W.current=new Map,E(t=>Qt(t,e.id)),O(t=>$t(t,e.id)),j({open:!1,title:``,content:``}),M(!1)},[e.id,M]),Q.useEffect(()=>{for(let e of ae){let t=x.current.get(e.messageID);if(t){for(let e of t.attachments)S.current.delete(`${t.assistantID}:${e.id}`);x.current.delete(e.messageID)}}E(e=>rn(e,ae))},[ae]),Q.useEffect(()=>{let t=new Set(q.filter(e=>e.status===`sending`).map(e=>e.messageID));O(n=>cn(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:Ee,snapshotRevision:De,admissionRevisionByTurnID:W.current,pendingSendTurnIDs:t,messages:ae,settledTurnIDs:H.current}))},[e.activeContactTurn,e.id,ae,q,Ee,De]),Q.useEffect(()=>{ie(e.id,we||Te||Ee)},[e.id,Te,we,Ee,ie]),Q.useEffect(()=>{let t=e.id;return()=>{ie(t,!1)}},[e.id,ie]);let Ge=F(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){H.current.delete(t.turnID),O(e=>on(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(H.current.has(t.turnID))return;O(e=>ln(e,t));return}t.type===`contact-turn-end`&&(H.current.add(t.turnID),O(e=>dn(un(e,t,{requireExisting:!0}),ae)))}});Q.useEffect(()=>{if(n)return fe(Ge)},[n,e.id]);let Ke=F(async e=>{if(we)return;let t=C.current,n=await hr(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&k(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>gr(e,n.attachments))}),qe=F(e=>{let t=pr(e.clipboardData);t.length!==0&&(e.preventDefault(),Ke(t))}),Je=F(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),Ye=F(e=>{let t=mr(e.dataTransfer);t.length!==0&&(e.preventDefault(),Ke(t))}),Xe=F(async(t,r)=>{let a=C.current,o=e.id,s=r?x.current.get(r):void 0;if(r&&(!s||s.assistantID!==o))return;let l=s?.text??t??_,u=s?.attachments??y,d=hn({gate:V,sending:gn(q),text:l,attachments:u,assistantID:o,createMessageID:()=>r||`yuri_contact_${g()}`});if(!d.ok)return;ie(o,!0),x.current.set(d.messageID,{assistantID:o,text:l,attachments:u});let f=u.length===0&&t===void 0&&!r&&n&&!Y?We():null;ze.current=f?{messageID:d.messageID,source:f}:null,Ue(f?{scope:ge,messageID:d.messageID}:null),Be.current=f?d.messageID:Be.current,r||(Ie(f?{duration:Jn,ease:Yn}:void 0),v(e=>e===l?``:e),b(e=>e.filter(e=>!u.includes(e)))),E(e=>e.some(e=>e.messageID===d.messageID)?e.map(e=>e.messageID===d.messageID?{...d.turn,createdAt:e.createdAt}:e):[...e,d.turn]),k(null);let m=()=>{u.forEach(e=>S.current.delete(`${o}:${e.id}`)),x.current.delete(d.messageID)};try{let t=[];for(let e of u){let n=`${o}:${e.id}`,r=S.current.get(n);if(!r){if(r=await pt(o,e.file,e.id,a.signal),a.signal.aborted)return;S.current.set(n,r)}t.push(r)}if(a.signal.aborted)return;let n=[...d.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===d.messageID?{...e,parts:n}:e));let r=await te(o,d.messageID,{parts:n});if(a.signal.aborted)return;m(),typeof r.revision==`number`&&W.current.set(d.messageID,r.revision),E(e=>an(e,d.messageID)),H.current.has(d.messageID)||O(e=>on(e,o,d.messageID)),c.data?.serverInstanceID&&B({serverInstanceID:c.data.serverInstanceID,assistantID:o,name:p,avatarSeed:e.avatarSeed??o}).catch(()=>void 0)}catch(e){if(a.signal.aborted)return;if(e instanceof re&&e.code===`admission_timeout`)try{let e=await oe(o,d.messageID);if(a.signal.aborted)return;if(e){m(),typeof e.revision==`number`&&W.current.set(d.messageID,e.revision),E(e=>an(e,d.messageID)),H.current.has(d.messageID)||O(e=>on(e,o,d.messageID));return}}catch{}let t=pn(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>fn(e,d.messageID,t))}finally{V.release()}}),Ze=F(e=>{Xe(void 0,e)}),Qe=u.isError&&J.length===0,et=u.isSuccess&&J.length===0,tt=new Map(q.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:Le,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Ne,className:L(`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:Pe,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)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:p,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!1}),(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)(Z,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:p}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void u.refetch(),children:i(`chat.history.retry`)})]}):et?(0,$.jsxs)(`div`,{ref:Pe,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)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:p,className:`opacity-90`,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!1}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:p})}),(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:Pe,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[u.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,u.hasPreviousPage||u.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":u.isFetchingPreviousPage||u.isFillingMessageGap,children:[u.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,u.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,disabled:u.isFetchingPreviousPage||u.isFillingMessageGap,onClick:()=>void Me(),children:i(u.isFetchingPreviousPage||u.isFillingMessageGap?`chat.history.loadingMore`:u.previousPageError||u.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,J.map((t,r)=>{let a=`${ge}:${br(t)}`,c=r>0?J[r-1]:null,u=he.get(t.messageID),d=u!==void 0,h=d?(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(u).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:Ce(u)})}):null,g=t.role===`user`,_=t.role===`peer`,v=t.role===`assistant`&&!d&&c?.role===`assistant`&&c.turnID===t.turnID,y=c?.turnID!==t.turnID,b=!g&&(_||!v),x=_?m(t.fromAssistantID,t.fromAssistantName):p,S=_&&t.fromAssistantID?l.data?.assistants.find(e=>e.id===t.fromAssistantID):e,C=tt.get(t.messageID),w=Ae.get(t.turnID),T=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`),E=(e,t)=>g?(0,$.jsx)(Jt,{failedTurn:n?C:void 0,retryDisabled:we,onRetry:Ze,children:e},t):e;return t.status===`error`||T?(0,$.jsxs)(Q.Fragment,{children:[h,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:L(`relative px-1`,!d&&`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||w?.error||i(`assistants.contact.sendFailed`)}),f?.messageID===t.messageID?(0,$.jsx)(kt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]},a):(0,$.jsxs)(Q.Fragment,{children:[h,(0,$.jsxs)(rt.div,{"data-message-id":t.messageID,initial:be&&r>ye&&t.messageID!==Be.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:Y?0:.18,ease:`easeOut`},className:L(`flex w-full`,g?`justify-end`:`justify-start`,d?`mt-0`:y?`mt-6 first:mt-0`:v?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":C?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!v?``:void 0,children:[g?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-9 shrink-0 justify-center pt-0.5`,children:b?(0,$.jsx)(xt,{name:S?.id||t.fromAssistantID||e.id,avatarSeed:S?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:32,label:x,working:n?!!(S?.working||S?.activeContactTurn):void 0,showWorkingDot:!1,followPointer:!1}):(0,$.jsx)(`span`,{className:`size-8`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:L(`relative flex min-w-0 flex-col gap-1.5`,g?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[_?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:x})}):null,t.parts.map((r,o)=>{if(r.type===`card`&&r.cardType===`session`)return(0,$.jsx)(zn,{card:r},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`assistant`)return(0,$.jsx)(En,{card:r,assistant:l.data?.assistants.find(e=>e.id===r.assistantID),active:n},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`schedule`)return(0,$.jsx)(Pn,{card:r,task:ce.get(r.projectID)?.get(r.taskID)},`${a}:card:${o}`);if(r.type===`file`)return E((0,$.jsx)(Kt,{assistantID:e.id,part:r,onShowPopup:N},`${a}:file:${o}`),`${a}:file:${o}`);if(r.type===`text`&&vr(r.text))return null;if(r.type===`text`&&(r.text.trim()||t.status===`streaming`)){let e=!g,n=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(r.text.trim());return E((0,$.jsx)(`div`,{"aria-label":_?i(`assistants.contact.peer.aria`,{name:x}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":n||void 0,className:L(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] typography-markdown leading-6`,s&&!n&&`touch-manipulation [-webkit-user-select:all] [user-select:all]`,n?`p-0`:`px-4 py-2.5`,e?null:`whitespace-pre-wrap`,n?`text-foreground`:g?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:_?`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)($e,{content:r.text,messageId:a,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:N,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):r.text},`${a}:text:${o}`),`${a}:text:${o}`)}return null}),C?.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,f?.messageID===t.messageID?(0,$.jsx)(kt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]})]},a)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-1 left-[2.875rem] flex h-10 items-center`,"data-assistant-contact-status-slot":``,children:!we&&He?.scope!==ge&&(Te||Ee)?(0,$.jsxs)(rt.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!Y&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:Y?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.875rem] top-0.5 flex w-9 justify-center`,"data-assistant-contact-processing-avatar":``,children:(0,$.jsx)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:32,label:p,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!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:Re,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[ee?(0,$.jsx)(`div`,{className:`chat-input-column mb-2`,children:(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:ee})}):null,(0,$.jsx)(`form`,{className:L(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),Xe()},onDragOver:Je,onDrop:Ye,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(Bt,{active:n,layout:`inline`,value:_,attachments:y,pending:we,isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:p}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>v(e),onVoiceSend:e=>{Xe(e)},onSubmit:()=>{Xe()},onAddFiles:e=>{Ke(e)},onRemoveAttachment:t=>{we||(S.current.delete(`${e.id}:${t}`),b(e=>e.filter(e=>e.id!==t)))},onPaste:qe,onDragOver:Je,onDrop:Ye,className:L(`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:p})}},`${o}:${e.id}`)})})]}),A.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(_r,{popup:A,onOpenChange:P,isMobile:s})}):null]})};async function Sr(e){await W(e);let t=ge.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await K();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&ge.getState().setDefaultShareAssistant(null)}function Cr({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=I(),[a,o]=Q.useState(!1),s=e?z(e.name).displayName||e.name:``,c=F(e=>{a&&!e||n(e)}),l=F(()=>{a||n(!1)}),u=F(async()=>{if(!(!e||a)){o(!0);try{await Sr(e),r?.(e.id),n(!1),k.success(i(`assistants.settings.toast.deleted`))}catch{k.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,$.jsx)(De,{open:t&&e!==null,onOpenChange:c,children:(0,$.jsxs)(we,{className:`max-w-md`,children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(Te,{children:i(`assistants.settings.delete`)}),(0,$.jsx)(Ee,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,$.jsxs)(Ce,{children:[(0,$.jsx)(R,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,$.jsx)(R,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var wr=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,Tr={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 Er(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?Tr[e.fallbackKind]:`assistants.contact.empty`)}var Dr=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`,Or=e({AssistantView:()=>jr}),kr=e=>{let t=(0,gt.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=I(),o=je(),s;t[0]===n?s=t[1]:(s=n?z(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}ve(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=F(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)(xt,{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)(Ot,{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)(se,{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},Ar=e=>{let t=(0,gt.c)(52),{avatarSeed:n,unreadCount:r,summary:i,assistantID:a,displayName:o,selected:s,editLabel:c,deleteLabel:l,onSelect:u,onEdit:d,onDelete:f,serverWorking:p}=e,m=bt(a,p!==void 0&&p),[h,g]=Q.useState(!1),_=Q.useRef(null),v;t[0]===u?v=t[1]:(v=()=>u(),t[0]=u,t[1]=v);let y=F(v),b;t[2]===d?b=t[3]:(b=()=>{g(!1),d()},t[2]=d,t[3]=b);let x=F(b),S;t[4]===f?S=t[5]:(S=()=>{g(!1),f()},t[4]=f,t[5]=S);let C=F(S),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),g(!0)},t[6]=w):w=t[6];let T=s?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,E;t[7]===T?E=t[8]:(E=L(`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),t[7]=T,t[8]=E);let D;t[9]!==y||t[10]!==s||t[11]!==E?(D=(0,$.jsx)(`button`,{ref:_,type:`button`,role:`option`,"aria-selected":s,onClick:y,onContextMenu:w,className:E}),t[9]=y,t[10]=s,t[11]=E,t[12]=D):D=t[12];let O;t[13]!==a||t[14]!==n||t[15]!==o||t[16]!==m?(O=(0,$.jsx)(xt,{name:a,avatarSeed:n,size:44,label:o,working:m,hoverTarget:_}),t[13]=a,t[14]=n,t[15]=o,t[16]=m,t[17]=O):O=t[17];let ee=s?`font-semibold`:`font-medium`,k;t[18]===ee?k=t[19]:(k=L(`block truncate typography-ui-label leading-5`,ee),t[18]=ee,t[19]=k);let A;t[20]!==o||t[21]!==k?(A=(0,$.jsx)(`span`,{className:k,children:o}),t[20]=o,t[21]=k,t[22]=A):A=t[22];let j;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=L(wr,`mt-1 text-[length:calc(var(--text-micro)*0.9)] leading-5`),t[23]=j):j=t[23];let M;t[24]===i?M=t[25]:(M=(0,$.jsx)(`span`,{className:j,children:i}),t[24]=i,t[25]=M);let N;t[26]!==A||t[27]!==M?(N=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[A,M]}),t[26]=A,t[27]=M,t[28]=N):N=t[28];let P;t[29]===r?P=t[30]:(P=(0,$.jsx)(ut,{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[29]=r,t[30]=P);let I;t[31]!==N||t[32]!==P||t[33]!==D||t[34]!==O?(I=(0,$.jsxs)(ot,{render:D,children:[O,N,P]}),t[31]=N,t[32]=P,t[33]=D,t[34]=O,t[35]=I):I=t[35];let R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Z,{name:`edit`,className:`size-4`}),t[36]=R):R=t[36];let z;t[37]!==c||t[38]!==x?(z=(0,$.jsxs)(ct,{onClick:x,children:[R,c]}),t[37]=c,t[38]=x,t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(at,{}),t[40]=B):B=t[40];let V;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Z,{name:`delete-bin`,className:`size-4`}),t[41]=V):V=t[41];let H;t[42]!==l||t[43]!==C?(H=(0,$.jsxs)(ct,{onClick:C,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[V,l]}),t[42]=l,t[43]=C,t[44]=H):H=t[44];let U;t[45]!==z||t[46]!==H?(U=(0,$.jsxs)(st,{className:`min-w-[10rem]`,children:[z,B,H]}),t[45]=z,t[46]=H,t[47]=U):U=t[47];let W;return t[48]!==h||t[49]!==I||t[50]!==U?(W=(0,$.jsxs)(it,{open:h,onOpenChange:g,children:[I,U]}),t[48]=h,t[49]=I,t[50]=U,t[51]=W):W=t[51],W},jr=e=>{let t=(0,gt.c)(117),{activeOverride:i,onMobileBack:a,onMobileOpenSettings:o}=e,{t:s}=I(),{isMobile:c}=Oe(),l=je(),u=Q.useSyncExternalStore(n,r,r),d=h(Mr),f=i??d,p=h(Nr),m=c||p,g=ne(),_=le(),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=dt(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=ge(S),w=ge(Pr),T=ge(Fr),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 D=E,O;t[9]!==w||t[10]!==C||t[11]!==v?(O=()=>{!C&&v?.assistants[0]&&w(v.assistants[0].id)},t[9]=w,t[10]=C,t[11]=v,t[12]=O):O=t[12];let ee=v?.assistants,k;t[13]!==w||t[14]!==C||t[15]!==ee?(k=[w,C,ee],t[13]=w,t[14]=C,t[15]=ee,t[16]=k):k=t[16],Q.useEffect(O,k);let A;t[17]!==D||t[18]!==w||t[19]!==C||t[20]!==v?.assistants||t[21]!==_.isSuccess?(A=()=>{_.isSuccess&&C&&!D&&w(v?.assistants[0]?.id??null)},t[17]=D,t[18]=w,t[19]=C,t[20]=v?.assistants,t[21]=_.isSuccess,t[22]=A):A=t[22];let j=v?.assistants,M;t[23]!==D||t[24]!==w||t[25]!==C||t[26]!==_.isSuccess||t[27]!==j?(M=[D,w,C,j,_.isSuccess],t[23]=D,t[24]=w,t[25]=C,t[26]=_.isSuccess,t[27]=j,t[28]=M):M=t[28],Q.useEffect(A,M);let N;t[29]!==l||t[30]!==T?(N=()=>{if(T(),l){l.openSettings();return}let e=h.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=T,t[31]=N):N=t[31];let P=F(N),B;t[32]===l?B=t[33]:(B=e=>{ve(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=B);let V=F(B),H;t[34]!==D||t[35]!==l?(H=()=>{D&&ve(D.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=D,t[35]=l,t[36]=H):H=t[36];let U=F(H),[W,te]=Q.useState(null),G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{te(e)},t[37]=G):G=t[37];let re=F(G),ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{e||te(null)},t[38]=ie):ie=t[38];let ae=F(ie),oe=F(Ir),K;t[39]!==a||t[40]!==oe?(K=()=>{if(a){a();return}oe()},t[39]=a,t[40]=oe,t[41]=K):K=t[41];let se=F(K),ce=Dr({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:!!D}),ue;t[42]!==D||t[43]!==se||t[44]!==m||t[45]!==o?(ue=(e,t,n,r)=>(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[m?(0,$.jsx)(kr,{assistant:D,onBack:se,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)(Z,{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]=D,t[43]=se,t[44]=m,t[45]=o,t[46]=ue):ue=t[46];let q=ue;if(ce===`loading`){let e;t[47]!==D||t[48]!==se||t[49]!==m||t[50]!==o?(e=m?(0,$.jsx)(kr,{assistant:D,onBack:se,onOpenSettings:o}):null,t[47]=D,t[48]=se,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)(Z,{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(ce===`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(ce===`onboarding`){let e;if(t[63]!==P||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]!==P||t[70]!==i?(a=(0,$.jsx)(R,{onClick:P,children:i}),t[69]=P,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=P,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!v||!D){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 de;t[75]===D.name?de=t[76]:(de=z(D.name),t[75]=D.name,t[76]=de);let fe=de,pe;t[77]!==_.isError||t[78]!==s?(pe=_.isError?s(`assistants.state.staleSnapshot`):null,t[77]=_.isError,t[78]=s,t[79]=pe):pe=t[79];let me=pe,J;t[80]!==x||t[81]!==m||t[82]!==P||t[83]!==V||t[84]!==re||t[85]!==w||t[86]!==C||t[87]!==v||t[88]!==s?(J=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-1 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)(_t,{snapshot:v,compact:!0,rowClassName:`flex min-w-0 flex-1 justify-end`}),(0,$.jsx)(R,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`size-8 min-h-0 min-w-0 !shadow-[0_0_0_0.5px_rgb(0_0_0/0.08),0_1px_2px_rgb(0_0_0/0.05)] dark:!shadow-[var(--yuri-mobile-glass-shadow)]`,"aria-label":s(`assistants.settings.create`),onClick:P,children:(0,$.jsx)(Z,{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-1`,children:x.map(e=>{let t=e.id===C,n=z(e.name);return(0,$.jsx)(Ar,{assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:Er(e.latestMessagePreview,s),displayName:n.displayName,selected:t,editLabel:s(`assistants.menu.edit`),deleteLabel:s(`assistants.settings.delete`),assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>w(e.id),onEdit:()=>V(e.id),onDelete:()=>re(e)},e.id)})})})]}),t[80]=x,t[81]=m,t[82]=P,t[83]=V,t[84]=re,t[85]=w,t[86]=C,t[87]=v,t[88]=s,t[89]=J):J=t[89];let he=W!==null,Y;t[90]!==W||t[91]!==ae||t[92]!==he?(Y=(0,$.jsx)(Cr,{assistant:W,open:he,onOpenChange:ae}),t[90]=W,t[91]=ae,t[92]=he,t[93]=Y):Y=t[93];let _e=!m&&`border-l border-[var(--surface-subtle)]`,ye;t[94]===_e?ye=t[95]:(ye=L(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-clip bg-background`,_e),t[94]=_e,t[95]=ye);let be;t[96]!==D||t[97]!==se||t[98]!==m||t[99]!==o||t[100]!==U||t[101]!==fe||t[102]!==s?(be=m?(0,$.jsx)(kr,{assistant:D,onBack:se,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)(xt,{name:D.id,avatarSeed:D.avatarSeed,size:40,label:fe.displayName||D.name,working:!!(D.working||D.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:fe.displayName}),(0,$.jsx)(Ot,{assistantID:D.id,serverWorking:!!(D.working||D.activeContactTurn),lastContactAt:D.latestMessagePreview?.createdAt})]}),(0,$.jsx)(R,{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)(Z,{name:`settings-3`,className:`size-4`})})]}),t[96]=D,t[97]=se,t[98]=m,t[99]=o,t[100]=U,t[101]=fe,t[102]=s,t[103]=be):be=t[103];let X;t[104]!==f||t[105]!==D||t[106]!==m||t[107]!==me?(X=(0,$.jsx)(xr,{assistant:D,warning:me,active:f,overlayHeader:m}),t[104]=f,t[105]=D,t[106]=m,t[107]=me,t[108]=X):X=t[108];let xe;t[109]!==ye||t[110]!==be||t[111]!==X?(xe=(0,$.jsxs)(`div`,{className:ye,children:[be,X]}),t[109]=ye,t[110]=be,t[111]=X,t[112]=xe):xe=t[112];let Se;return t[113]!==J||t[114]!==Y||t[115]!==xe?(Se=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-clip bg-background`,"data-presentation":`workspace`,children:[J,Y,xe]}),t[113]=J,t[114]=Y,t[115]=xe,t[116]=Se):Se=t[116],Se};function Mr(e){return e.activeMainTab===`assistant`}function Nr(e){return e.isMobile}function Pr(e){return e.selectAssistant}function Fr(e){return e.requestCreate}function Ir(){h.getState().setActiveMainTab(`chat`)}export{Cr as a,_t as c,Er as i,Or as n,xt as o,wr as r,bt as s,jr as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-DJs9w1_J.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D4ja813o.js","assets/desktop-JwYqThiw.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-BQjbsJ43.js","assets/useUIStore-DI7va1HH.js","assets/vendor-zustand-B43HCgwC.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-D5d-V1vN.js","assets/vendor-tanstack-react-query-C4SG3JZB.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/runtime-file-resource-6np6lzoV.js","assets/queryRuntime-Dkpnq3Z1.js","assets/fileQueries-5a1jkme2.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-download-CcNIVp7u.js","assets/platform-DFJEtBlo.js","assets/vendor-pierre-diffs-Bj9Nqn6w.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-BcebBLwF.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-Dt6Ygbc7.js","assets/store-DvN2L3vf.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CGF5jnIh.js","assets/vendor-framer-motion-C1twy-GF.js","assets/Icon-BP1sfnHn.js","assets/dialog-CjQeHVOc.js","assets/dialog-CTYD3Sbr.css","assets/tap-LkQum5bB.js","assets/image-loading-Dq1g_wpm.js","assets/image-loading-D9Z_BASK.css","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-BY5rY9-W.js","assets/useMobileNavigationStore-TCj7ZnhV.js","assets/gitApiHttp-DHrRqnYh.js","assets/vendor-opencode-client-UL_TecvQ.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-JyLTFv27.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-sonner-r2EJnfoo.js","assets/useAssistantUIStore-C9FPlYQz.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MarkdownRenderer-Y6uQXIFH.js","assets/useEffectiveDirectory-Ci6Z13kj.js","assets/markdownHeightCache-C1u0bWDL.js","assets/dualLimitLru-D8Sphgua.js","assets/toolHelpers-iEHVHQ9p.js","assets/ImageLoadingPlaceholder-DCWssLJG.js","assets/useWorkerHighlightedLines-HKhuYGSj.js","assets/markdownTheme-hpURsgju.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-BeZn51tF.js","assets/mobileBackNavigation-vpCg1S7j.js","assets/touch-gestures-K2_ZOkKW.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-DEZ1K7qW.js";import{a}from"./vendor-zustand-B43HCgwC.js";import{at as o,c as s,d as c,f as l,it as u,l as d,m as f,p,u as m}from"./vendor-base-ui-BQjbsJ43.js";import{n as h}from"./useUIStore-DI7va1HH.js";import{$ as g,B as _,J as v,K as y,U as b,X as x,q as S,st as C,z as w}from"./persistence-JyLTFv27.js";import{n as T}from"./vendor-react-D5d-V1vN.js";import{s as E}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{o as D}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as O,r as ee}from"./platform-DFJEtBlo.js";import{r as k}from"./vendor-sonner-r2EJnfoo.js";import{a as A,f as j,i as M,o as N,p as P,r as F}from"./vendor-reactuses-core-BcebBLwF.js";import{f as I,r as L,t as R}from"./button-Dt6Ygbc7.js";import{i as z,n as B}from"./MobileShareBridge-F70fkIfS.js";import{N as V,T as H,_ as U,a as W,f as te,g as G,h as ne,j as re,l as ie,n as ae,r as oe,s as K,t as se,u as ce,v as le,w as ue}from"./MobileDetailNavigation-B3rUx5Ve.js";import{En as q,Hr as de,Mo as fe,Ur as pe,Xn as me,Xt as J,lt as he,s as Y}from"./useMobileNavigationStore-TCj7ZnhV.js";import{i as ge,n as _e,r as ve}from"./useAssistantUIStore-C9FPlYQz.js";import{t as ye}from"./AgentAvatar-kIN4sZMz.js";import{d as be,o as X,t as xe}from"./vendor-framer-motion-C1twy-GF.js";import{n as Z}from"./Icon-BP1sfnHn.js";import{a as Se,i as Ce,n as we,o as Te,r as Ee,t as De}from"./dialog-CjQeHVOc.js";import{r as Oe}from"./device-BjRYYXNT.js";import{c as ke,s as Ae}from"./image-loading-Dq1g_wpm.js";import{C as je,T as Me,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as ze,p as Be,r as Ve,s as He,u as Ue,v as We,w as Ge,x as Ke}from"./sessionChangeSummary-CVUA1AFw.js";import{a as qe,n as Je,r as Ye,t as Xe}from"./fileMentionTouchSelection-D7QtVxjI.js";import{a as Ze,o as Qe,t as $e}from"./MarkdownRenderer-Y6uQXIFH.js";import{n as et}from"./textarea-vtIQM2iP.js";import{t as tt}from"./ImageLoadingPlaceholder-DCWssLJG.js";import{t as nt}from"./LoadingImage-C_Hryaqe.js";import{t as rt}from"./vendor-motion-BmLx2V78.js";import{a as it,c as at,l as ot,o as st,s as ct,t as lt}from"./scheduledTaskNavigation-rhgnZaaj.js";import{a as ut,o as dt,t as ft}from"./sessionLookup-C3_vQwLe.js";import{i as pt,n as mt,r as ht}from"./assistant-attachment-cache-B9iHLlm2.js";var gt=T(),Q=t(o(),1),$=u();function _t({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=I(),[a,o]=Q.useState(!1),s=Q.useRef(!1),c=F(async()=>{if(!s.current){s.current=!0,o(!0);try{(await ie(e)).failed&&k.error(i(`assistants.unread.markAllFailed`))}catch{k.error(i(`assistants.unread.markAllFailed`))}finally{s.current=!1,o(!1)}}}),l=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!l?null:(0,$.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,$.jsx)(R,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,onClick:c,"aria-label":i(`assistants.unread.markAll`),title:i(`assistants.unread.markAll`),disabled:a||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":a,children:(0,$.jsx)(Z,{name:`check-double`,className:r?`size-5`:`size-4`})})})}var vt=a(e=>({workingByID:{},setWorking:(t,n)=>e(e=>({workingByID:{...e.workingByID,[t]:n}}))})),yt=({sending:e=!1,processing:t=!1,serverWorking:n=!1})=>e||t||n,bt=(e,t)=>{let n=(0,gt.c)(5),r=t!==void 0&&t,i;n[0]===e?i=n[1]:(i=t=>!!t.workingByID[e],n[0]=e,n[1]=i);let a=vt(i),o;return n[2]!==a||n[3]!==r?(o=yt({processing:a,serverWorking:r}),n[2]=a,n[3]=r,n[4]=o):o=n[4],o},xt=e=>{let t=(0,gt.c)(25),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c,hoverTarget:l,followPointer:u,blinkOnMount:d}=e,f=i===void 0?24:i,p=s===void 0||s,m=d===void 0||d,{t:h}=I(),g;t[0]!==n||t[1]!==o?(g=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=g):g=t[2];let _=vt(g),v=!!(o||_),y=`calc(${f}px * var(--dpt-n, 1))`,b;t[3]===c?b=t[4]:(b=L(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=b);let x;t[5]===y?x=t[6]:(x={width:y,minWidth:y,maxWidth:y,height:y,minHeight:y,maxHeight:y},t[5]=y,t[6]=x);let S=o===void 0?void 0:v?`working`:`idle`,C=r??n,w;t[7]!==m||t[8]!==u||t[9]!==l||t[10]!==a||t[11]!==n||t[12]!==f||t[13]!==S||t[14]!==C?(w=(0,$.jsx)(ye,{kind:`assistant`,motion:S,name:C,size:f,label:a,hoverTarget:l,followPointer:u,animationKey:n,blinkOnMount:m}),t[7]=m,t[8]=u,t[9]=l,t[10]=a,t[11]=n,t[12]=f,t[13]=S,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==h||t[18]!==o?(T=o&&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-background`,"data-assistant-working-dot":``,"aria-label":h(`assistants.contact.working`)}):null,t[16]=p,t[17]=h,t[18]=o,t[19]=T):T=t[19];let E;return t[20]!==T||t[21]!==b||t[22]!==x||t[23]!==w?(E=(0,$.jsxs)(`span`,{className:b,style:x,"data-assistant-working-avatar":``,children:[w,T]}),t[20]=T,t[21]=b,t[22]=x,t[23]=w,t[24]=E):E=t[24],E},St=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(H)&&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}},Ct=(e,t)=>{let n=(0,gt.c)(5),r;n[0]!==e||n[1]!==t?(r=ae(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:St},n[3]=r,n[4]=i),E(i)},wt=3e5,Tt=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function Et(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||!Tt(n,e)||e.getTime()-n.getTime()>wt)&&t.set(r.messageID,r.createdAt),n=e)}return t}function Dt(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`${Tt(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var Ot=Q.memo(e=>{let t=(0,gt.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=I(),s=bt(n,r),c=Ct(n,ke()),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=Dt(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 kt(e){let t=(0,gt.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(Ft),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`||(O()?!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,ce(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=F(d),p;t[5]===f?p=t[6]:(p=e=>{s.current=e.some(Pt),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],A(o,F(p),m),M(`visibilitychange`,f,Nt),M(`focus`,f,Mt),M(`resize`,f,jt);let h,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>o.current?.closest(`[data-assistant-contact-transcript]`),g={passive:!0},t[8]=h,t[9]=g):(h=t[8],g=t[9]),M(`scroll`,f,h,g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_={attributes:!0,attributeFilter:[`class`]},t[10]=_):_=t[10],j(f,At,_),N(f,15e3);let v;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(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]=v):v=t[11],v}function At(){return document.documentElement}function jt(){return window.visualViewport}function Mt(){return window}function Nt(){return document}function Pt(e){return e.isIntersecting&&e.intersectionRatio===1}function Ft(){return{transport:r(),generation:i()}}var It=()=>{},Lt=Q.memo(Me),Rt=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,zt=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=I(),c=ke(),l=E({...pe(c),select:Rt}),u=Q.useMemo(()=>he({sessions:l.data??[],currentSessionId:null,searchQuery:e,limit:e.trim()?10:3}),[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(Xe,[]);M(`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 _=F(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)(Je,{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)(R,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(Z,{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)(R,{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)(et,{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:L(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,Ye(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)(Z,{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`)})]})}),Bt=e=>{let t=(0,gt.c)(120),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({active:n,onChange:r,onVoiceSend:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{t:o}=I(),s=Q.useRef(null),c=n&&!!a.isMobile&&!!i,l;t[5]===c?l=t[6]:(l={available:c},t[5]=c,t[6]=l);let{enabled:u,hint:d,onHintChange:f}=Ge(l),p;t[7]!==d||t[8]!==a.placeholder||t[9]!==o?(p=d===null?a.placeholder:o(d===`recording`?`chat.dictation.releaseSend`:d===`cancelling`?`chat.dictation.releaseCancel`:d===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[7]=d,t[8]=a.placeholder,t[9]=o,t[10]=p):p=t[10];let m=p,h;t[11]===a.value?h=t[12]:(h=()=>({canonical:a.value,document:b(a.value,new Map)}),t[11]=a.value,t[12]=h);let[g,x]=Q.useState(h),T;t[13]!==g.canonical||t[14]!==g.document||t[15]!==a.value?(T=g.canonical===a.value?g.document:b(a.value,new Map),t[13]=g.canonical,t[14]=g.document,t[15]=a.value,t[16]=T):T=t[16];let E=T,[D,O]=Q.useState(0),[ee,k]=Q.useState(!0),[A,j]=Q.useState(!1),[M,N]=Q.useState(),P=Q.useRef(null),R=Q.useRef(null),z=Q.useRef(null),B=Q.useRef(null),V;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(V=Ne(),t[17]=V):V=t[17];let H=Q.useRef(V),U=Q.useId(),W;t[18]!==n||t[19]!==A||t[20]!==D||t[21]!==ee||t[22]!==E.text||t[23]!==a.disabled||t[24]!==a.pending?(W=n&&!a.pending&&!a.disabled&&!ee&&!A?qe({text:E.text,cursor:D}):null,t[18]=n,t[19]=A,t[20]=D,t[21]=ee,t[22]=E.text,t[23]=a.disabled,t[24]=a.pending,t[25]=W):W=t[25];let te=W,G=te?.kind===`mention`?te:null,ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>{B.current!==null&&(P.current?.focus({preventScroll:!0}),P.current?.setSelectionRange(B.current,B.current),B.current=null)},t[26]=ne):ne=t[26];let re;t[27]===E?re=t[28]:(re=[E],t[27]=E,t[28]=re),Q.useLayoutEffect(ne,re);let ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>k(!0),t[29]=ie):ie=t[29];let ae=F(ie),oe;t[30]!==A||t[31]!==D||t[32]!==E||t[33]!==r?(oe=(e,t,n)=>{let i=n===void 0||n,a=v(e);a.ok&&(i&&(H.current=Le(H.current,{before:He(E,[],{start:P.current?.selectionStart??D,end:P.current?.selectionEnd??D}),after:He(e,[],{start:t,end:t})})),A||(B.current=t),O(t),x({canonical:a.text,document:e}),r(a.text))},t[30]=A,t[31]=D,t[32]=E,t[33]=r,t[34]=oe):oe=t[34];let K=F(oe),se;t[35]!==K||t[36]!==E||t[37]!==G||t[38]!==o?(se=e=>{if(!G)return;let t=e.title||o(`chat.fileMentionAutocomplete.untitledSession`),n=_(E,G.tokenStart,G.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:C({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);k(!0),K(n.document,r)},t[35]=K,t[36]=E,t[37]=G,t[38]=o,t[39]=se):se=t[39];let ce=F(se),le;t[40]!==n||t[41]!==K||t[42]!==E||t[43]!==a.disabled||t[44]!==a.pending?(le=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=E.text?`${E.text} ${e}`:e,r=y(E,t,t.length,t.length);K(r.document,r.caret),k(!0)},t[40]=n,t[41]=K,t[42]=E,t[43]=a.disabled,t[44]=a.pending,t[45]=le):le=t[45];let ue=F(le),q;t[46]!==n||t[47]!==E.text||t[48]!==ue||t[49]!==r||t[50]!==i||t[51]!==a.disabled||t[52]!==a.pending?(q=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(E.text){ue(e);return}r(e),i?.(e)}},t[46]=n,t[47]=E.text,t[48]=ue,t[49]=r,t[50]=i,t[51]=a.disabled,t[52]=a.pending,t[53]=q):q=t[53];let de=F(q),fe;t[54]!==K||t[55]!==E?(fe=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!E.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=w(n.selectionStart,n.selectionEnd,E.references)??{start:n.selectionStart,end:n.selectionEnd},i=v({text:E.text.slice(r.start,r.end),references:E.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=y(E,E.text.slice(0,r.start)+E.text.slice(r.end),r.start,r.start);K(e.document,e.caret)}},t[54]=K,t[55]=E,t[56]=fe):fe=t[56];let pe=F(fe),me;t[57]!==E.references||t[58]!==E.text?(me=Be(E.text,E.references.map(Vt))?.map(Ht),t[57]=E.references,t[58]=E.text,t[59]=me):me=t[59];let J=me,he=u&&E.text.length===0?`true`:void 0,Y;t[60]!==u||t[61]!==ue||t[62]!==a.disabled||t[63]!==a.pending||t[64]!==de||t[65]!==f?(Y=u&&(0,$.jsx)(Lt,{containerRef:s,disabled:!!(a.pending||a.disabled),onInsert:ue,onSend:de,onRelease:It,onHintChange:f}),t[60]=u,t[61]=ue,t[62]=a.disabled,t[63]=a.pending,t[64]=de,t[65]=f,t[66]=Y):Y=t[66];let ge=E.text,_e=a.pending,ve;t[67]===a?ve=t[68]:(ve=()=>{a.pending||a.onSubmit()},t[67]=a,t[68]=ve);let ye=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,be;t[69]!==a.textLayoutClassName||t[70]!==ye?(be=L(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,ye,a.textLayoutClassName),t[69]=a.textLayoutClassName,t[70]=ye,t[71]=be):be=t[71];let X;t[72]!==K||t[73]!==E?(X=(e,t)=>{let n=y(E,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);K(n.document,n.caret),k(t?.nativeEvent?.inputType===`insertFromPaste`)},t[72]=K,t[73]=E,t[74]=X):X=t[74];let xe=G?U:void 0,Z=G?M:void 0,Se;t[75]===a.textareaProps?Se=t[76]:(Se=e=>{a.textareaProps?.onScroll?.(e),R.current&&(R.current.scrollTop=e.currentTarget.scrollTop,R.current.scrollLeft=e.currentTarget.scrollLeft)},t[75]=a.textareaProps,t[76]=Se);let Ce,we;t[77]!==pe||t[78]!==a.textareaProps?(Ce=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},we=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[77]=pe,t[78]=a.textareaProps,t[79]=Ce,t[80]=we):(Ce=t[79],we=t[80]);let Te;t[81]===a.textareaProps?Te=t[82]:(Te=e=>{O(e.currentTarget.selectionStart),a.textareaProps?.onSelect?.(e)},t[81]=a.textareaProps,t[82]=Te);let Ee,De;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=()=>{j(!0)},De=e=>{j(!1),O(e.currentTarget.selectionStart)},t[83]=Ee,t[84]=De):(Ee=t[83],De=t[84]);let Oe;t[85]!==K||t[86]!==A||t[87]!==E||t[88]!==G||t[89]!==a.textareaProps?(Oe=e=>{if(a.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||Ke(e))){if(A){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?Ue(H.current,E):Pe(H.current,E);t&&(e.preventDefault(),H.current=t.history,K(t.snapshot.document,t.snapshot.selection.end,!1),k(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=S(E,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),K(t.document,t.caret),k(!0);return}}G&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),z.current?.keyDown(e.key))}},t[85]=K,t[86]=A,t[87]=E,t[88]=G,t[89]=a.textareaProps,t[90]=Oe):Oe=t[90];let ke;t[91]!==a.textareaProps||t[92]!==xe||t[93]!==Z||t[94]!==Se||t[95]!==Ce||t[96]!==we||t[97]!==Te||t[98]!==Oe?(ke={...a.textareaProps,"aria-controls":xe,"aria-activedescendant":Z,"aria-autocomplete":`list`,onScroll:Se,onCopy:Ce,onCut:we,onSelect:Te,onCompositionStart:Ee,onCompositionEnd:De,onKeyDown:Oe},t[91]=a.textareaProps,t[92]=xe,t[93]=Z,t[94]=Se,t[95]=Ce,t[96]=we,t[97]=Te,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]!==ae||t[101]!==U||t[102]!==G||t[103]!==a.isMobile||t[104]!==ce?(Ae=G?(0,$.jsx)(zt,{ref:z,query:G.query,isMobile:a.isMobile??!1,listId:U,onHighlightChange:N,onSelect:ce,onClose:ae}):null,t[100]=ae,t[101]=U,t[102]=G,t[103]=a.isMobile,t[104]=ce,t[105]=Ae):Ae=t[105];let je;t[106]!==E.text||t[107]!==J||t[108]!==m||t[109]!==a||t[110]!==ve||t[111]!==be||t[112]!==X||t[113]!==ke||t[114]!==Ae?(je=(0,$.jsx)(We,{...a,value:ge,pending:_e,placeholder:m,disableInputWhilePending:!1,inputRef:P,onSubmit:ve,highlightedContent:J,highlightRef:R,textLayoutClassName:be,onChange:X,textareaProps:ke,children:Ae}),t[106]=E.text,t[107]=J,t[108]=m,t[109]=a,t[110]=ve,t[111]=be,t[112]=X,t[113]=ke,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==he||t[117]!==Y||t[118]!==je?(Me=(0,$.jsxs)(`div`,{ref:s,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":he,children:[Y,je]}),t[116]=he,t[117]=Y,t[118]=je,t[119]=Me):Me=t[119],Me};function Vt(e){return{start:e.start,end:e.end,priority:103,...x(e)}}function Ht(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(Fe,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var Ut=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function Wt({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=I(),i=ke(),{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=Ze(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&&ht(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=F(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await mt(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=F(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)(nt,{src:h,alt:w,contentFrame:!0,className:Ut,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)(tt,{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)(Z,{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)(R,{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 Gt(e){let t=(0,gt.c)(39),{part:n,onShowPopup:r}=e,{t:i}=I(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=Ae(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=F(d);if(Ze(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)(R,{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)(nt,{src:o,alt:u,contentFrame:!0,className:Ut,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)(Z,{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)(R,{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 Kt(e){let t=(0,gt.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=ke(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(Wt,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(Gt,{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 qt=Q.memo(e=>{let t=(0,gt.c)(32),{turn:n,retryDisabled:r,onRetry:i}=e,{t:a}=I(),o;t[0]===a?o=t[1]:(o=a(`assistants.contact.sendError.viewDetails`),t[0]=a,t[1]=o);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Z,{name:`exclamation-fill`,className:`size-[18px] text-[var(--status-error)]`,"data-assistant-contact-error-dot":``}),t[2]=u):u=t[2];let h;t[3]===o?h=t[4]:(h=(0,$.jsx)(p,{type:`button`,"aria-label":o,"data-assistant-contact-send-error":``,className:`absolute right-full top-1/2 mr-1.5 flex size-9 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-0 shadow-none outline-none focus-visible:opacity-70`,children:u}),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g={side:`flip`,align:`shift`,fallbackAxisSide:`end`},t[5]=g):g=t[5];let _;t[6]===a?_=t[7]:(_=a(`assistants.contact.sendError.title`),t[6]=a,t[7]=_);let v;t[8]===_?v=t[9]:(v=(0,$.jsx)(d,{className:`typography-ui-label font-medium`,children:_}),t[8]=_,t[9]=v);let y;t[10]!==a||t[11]!==n.error?(y=n.error||a(`assistants.contact.sendFailed`),t[10]=a,t[11]=n.error,t[12]=y):y=t[12];let b;t[13]===y?b=t[14]:(b=(0,$.jsx)(s,{role:`alert`,className:`mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap typography-meta leading-relaxed [overflow-wrap:anywhere]`,children:y}),t[13]=y,t[14]=b);let x;t[15]!==i||t[16]!==n.messageID?(x=()=>i(n.messageID),t[15]=i,t[16]=n.messageID,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Z,{name:`refresh`,className:`size-3`}),t[18]=S):S=t[18];let C;t[19]===a?C=t[20]:(C=a(`chat.history.retry`),t[19]=a,t[20]=C);let w;t[21]!==r||t[22]!==C||t[23]!==x?(w=(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(R,{type:`button`,size:`xs`,disabled:r,onClick:x,children:[S,C]})}),t[21]=r,t[22]=C,t[23]=x,t[24]=w):w=t[24];let T;t[25]!==w||t[26]!==v||t[27]!==b?(T=(0,$.jsx)(l,{children:(0,$.jsx)(c,{side:`left`,align:`center`,sideOffset:6,collisionPadding:12,collisionAvoidance:g,className:`z-50`,children:(0,$.jsxs)(m,{className:`yuri-mobile-overlay-surface w-72 max-w-[calc(100vw-2rem)] rounded-xl p-4 text-foreground outline-none`,"data-assistant-contact-send-error-popup":``,children:[v,b,w]})})}),t[25]=w,t[26]=v,t[27]=b,t[28]=T):T=t[28];let E;return t[29]!==T||t[30]!==h?(E=(0,$.jsxs)(f,{children:[h,T]}),t[29]=T,t[30]=h,t[31]=E):E=t[31],E});function Jt(e){let t=(0,gt.c)(7),{children:n,failedTurn:r,retryDisabled:i,onRetry:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==i?(o=r?.status===`failed`?(0,$.jsx)(qt,{turn:r,retryDisabled:i,onRetry:a}):null,t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`relative min-w-0 max-w-full`,"data-assistant-contact-user-part":``,children:[n,o]}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}var Yt=[],Xt=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
3
+ `),Zt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),Qt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},$t=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},en=(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:[]}),tn=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>en(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,en(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,en(e,null,n+r.length,`admitted`)]:r},nn=(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:Xt(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=tn(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)},rn=(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},an=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),on=(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}]},sn=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:on(e,t.assistantID,t.turnID,t.admittedAt),cn=(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=sn(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=un(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=dn(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},ln=(e,t)=>on(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}}),un=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:on(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}:{}}),dn=(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},fn=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),pn=(e,t)=>e instanceof re?e.code===`no_provider`?t.noProvider:e.code===`admission_timeout`||e.code===`generate_timeout`?t.timedOut:e.message&&e.message!==e.code?e.message:`${t.sendFailed}\n\n${e.code} (HTTP ${e.status})`:V(e)?t.timedOut:e instanceof Error&&e.message.trim()?e.message:t.sendFailed,mn=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},hn=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:Zt(e.assistantID,r,n,e.createdAt)}},gn=e=>e.some(e=>e.status===`sending`),_n=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`);function vn(e){let t=(0,gt.c)(6),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Z,{name:`brain`,weight:`medium`,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[1]=n,t[2]=i);let a;return t[3]!==i||t[4]!==n?(a=(0,$.jsxs)(`p`,{"data-contact-card-model":``,className:`flex min-w-0 flex-1 items-center gap-1.5 text-[0.75em] leading-4 text-muted-foreground`,title:n,children:[r,i]}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}var yn=[`grid h-[148px] w-[19rem] min-w-0 max-w-full shrink-0 grid-rows-[40px_20px_20px_48px] content-start cursor-pointer rounded-[1.35rem] bg-[var(--surface-muted)]`,`px-4 py-2.5 text-left typography-ui-label transition-colors duration-150 motion-reduce:transition-none`,`hover:bg-interactive-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),bn=yn,xn=yn,Sn=`row-start-1 mb-2 flex h-8 min-w-0 items-center gap-2`,Cn=`row-start-2 min-w-0 self-start truncate font-medium leading-5 text-foreground`,wn=`row-start-4 flex h-12 min-w-0 flex-col justify-center`;function Tn(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var En=e=>{let t=(0,gt.c)(35),{card:n,assistant:r,active:i}=e,a=i===void 0||i,{t:o}=I(),s=je(),c;t[0]===s?c=t[1]:(c=s&&!ee(),t[0]=s,t[1]=c);let l=!!c,u=n.name,d=`${n.providerID}/${n.modelID}`,f;t[2]!==n.assistantID||t[3]!==l?(f=()=>{if(l){Y.getState().openAssistant(n.assistantID);return}_e(n.assistantID)},t[2]=n.assistantID,t[3]=l,t[4]=f):f=t[4];let p=F(f),m;t[5]===p?m=t[6]:(m=e=>{Tn(e,p)},t[5]=p,t[6]=m);let h=F(m),g;t[7]!==o||t[8]!==u?(g=o(`assistants.contact.card.assistant.aria`,{name:u}),t[7]=o,t[8]=u,t[9]=g):g=t[9];let _=r?.avatarSeed,v=a?!!(r?.working||r?.activeContactTurn):void 0,y;t[10]!==n.assistantID||t[11]!==_||t[12]!==v?(y=(0,$.jsx)(`span`,{className:`relative inline-block shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(xt,{name:n.assistantID,avatarSeed:_,size:32,working:v,showWorkingDot:!1,followPointer:!1})}),t[10]=n.assistantID,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]===o?b=t[15]:(b=o(`assistants.contact.card.assistant.label`),t[14]=o,t[15]=b);let x;t[16]===b?x=t[17]:(x=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,children:b}),t[16]=b,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[18]=S):S=t[18];let C;t[19]!==x||t[20]!==y?(C=(0,$.jsxs)(`div`,{className:Sn,children:[y,x,S]}),t[19]=x,t[20]=y,t[21]=C):C=t[21];let w;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=L(Cn,`row-span-2 self-center`),t[22]=w):w=t[22];let T;t[23]===u?T=t[24]:(T=(0,$.jsx)(`h3`,{className:w,title:u,children:u}),t[23]=u,t[24]=T);let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=L(wn,`justify-end pb-1`),t[25]=E):E=t[25];let D;t[26]===d?D=t[27]:(D=(0,$.jsx)(`div`,{className:E,children:(0,$.jsx)(`div`,{className:`flex h-4 min-w-0 items-center`,children:(0,$.jsx)(vn,{value:d})})}),t[26]=d,t[27]=D);let O;return t[28]!==h||t[29]!==p||t[30]!==C||t[31]!==T||t[32]!==D||t[33]!==g?(O=(0,$.jsxs)(`article`,{className:bn,role:`button`,tabIndex:0,"aria-label":g,"data-assistant-contact-card":`assistant`,onClick:p,onKeyDown:h,children:[C,T,D]}),t[28]=h,t[29]=p,t[30]=C,t[31]=T,t[32]=D,t[33]=g,t[34]=O):O=t[34],O},Dn=e=>!!(e&&typeof e==`object`&&!Array.isArray(e)),On=e=>typeof e==`string`&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e),kn=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6,An=e=>e.kind===`cron`?e.cron===void 0:e.kind===`once`?e.date===void 0:e.kind===`weekly`?e.times===void 0||e.weekdays===void 0:e.kind===`daily`&&e.times===void 0,jn=e=>{if(!Dn(e)||e.timezone!==void 0&&typeof e.timezone!=`string`)return!1;if(e.kind===`cron`)return typeof e.cron==`string`&&!!e.cron.trim();if(e.kind===`once`)return typeof e.date==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&On(e.time);let t=Array.isArray(e.times)&&e.times.length>0&&e.times.every(On);return e.kind===`daily`?t||On(e.time):e.kind===`weekly`&&(t||On(e.time))&&Array.isArray(e.weekdays)&&e.weekdays.length>0&&e.weekdays.every(kn)},Mn=(e,t)=>{if(!An(e)||!jn(t?.schedule))return e;let n=t.schedule;return{...e,kind:n.kind,time:n.time??n.times?.[0]??null,timezone:n.timezone??e.timezone,cron:n.cron??null,date:n.date??null,times:n.times??null,weekdays:n.weekdays??null}},Nn=(e,t)=>{let n=e.kind===`daily`||e.kind===`weekly`||e.kind===`once`||e.kind===`cron`?t(`sessions.scheduledTasks.editor.scheduleType.${e.kind}`):e.kind||``,r=[...new Set((e.times?.length?e.times:e.time?[e.time]:[]).filter(On))].sort(),i=r.join(`, `),a=n,o=r.length===1;if(e.kind===`cron`)i=e.cron?.trim()||n,a=e.cron?.trim()?n:``,o=!1;else if(e.kind===`once`)i=[e.date?.trim(),i].filter(Boolean).join(` `),o=!1;else if(e.kind===`weekly`&&e.weekdays?.length){let n=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`];a=[...new Set(e.weekdays.filter(kn))].sort((e,t)=>e-t).map(e=>t(`sessions.scheduledTasks.dialog.schedule.weekdayShort.${n[e]}`)).join(`, `)}return{value:i||t(`assistants.contact.card.schedule.timeUnavailable`),cadence:a,clock:o,timezone:e.timezone}},Pn=e=>{let t=(0,gt.c)(43),{card:n,task:r}=e,{t:i}=I(),a=n.name,o;t[0]!==n||t[1]!==i||t[2]!==r?(o=Nn(Mn(n,r),i),t[0]=n,t[1]=i,t[2]=r,t[3]=o):o=t[3];let s=o,c;t[4]===n.prompt?c=t[5]:(c=n.prompt?.trim(),t[4]=n.prompt,t[5]=c);let l=c,u;t[6]!==n.projectID||t[7]!==n.taskID?(u=()=>{lt(n.projectID,n.taskID)},t[6]=n.projectID,t[7]=n.taskID,t[8]=u):u=t[8];let d=F(u),f;t[9]===d?f=t[10]:(f=e=>{Tn(e,d)},t[9]=d,t[10]=f);let p=F(f),m;t[11]!==i||t[12]!==a?(m=i(`assistants.contact.card.schedule.aria`,{name:a}),t[11]=i,t[12]=a,t[13]=m):m=t[13];let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Z,{name:`calendar`,weight:`medium`,className:`size-4 shrink-0`}),t[14]=h):h=t[14];let g;t[15]===i?g=t[16]:(g=i(`assistants.contact.card.schedule.label`),t[15]=i,t[16]=g);let _;t[17]===g?_=t[18]:(_=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[h,(0,$.jsx)(`span`,{className:`truncate`,children:g})]}),t[17]=g,t[18]=_);let v;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[19]=v):v=t[19];let y;t[20]===_?y=t[21]:(y=(0,$.jsxs)(`div`,{className:Sn,children:[_,v]}),t[20]=_,t[21]=y);let b;t[22]===a?b=t[23]:(b=(0,$.jsx)(`h3`,{className:Cn,title:a,children:a}),t[22]=a,t[23]=b);let x;t[24]===l?x=t[25]:(x=l?(0,$.jsx)(`p`,{className:`row-start-3 mt-1 min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,title:l,children:l}):null,t[24]=l,t[25]=x);let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=L(wn,`justify-end`),t[26]=S):S=t[26];let C;t[27]===s.cadence?C=t[28]:(C=s.cadence?(0,$.jsx)(`span`,{"data-contact-schedule-cadence":``,className:`min-w-0 max-w-[36%] flex-[0_1_auto] truncate text-[0.75em] leading-4 text-muted-foreground`,title:s.cadence,children:s.cadence}):null,t[27]=s.cadence,t[28]=C);let w=`min-w-0 flex-[0_1_auto] truncate leading-[22px] text-foreground tabular-nums ${s.clock?`text-[1.25em] font-normal tracking-[-0.3px]`:`text-[0.85em]`}`,T;t[29]!==s.value||t[30]!==w?(T=(0,$.jsx)(`p`,{className:w,title:s.value,children:s.value}),t[29]=s.value,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==C||t[33]!==T?(E=(0,$.jsx)(`div`,{className:S,children:(0,$.jsxs)(`div`,{"data-contact-schedule-time":``,className:`flex min-w-0 flex-none items-baseline gap-1.5`,children:[C,T]})}),t[32]=C,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==p||t[36]!==d||t[37]!==y||t[38]!==b||t[39]!==x||t[40]!==E||t[41]!==m?(D=(0,$.jsxs)(`article`,{className:bn,role:`button`,tabIndex:0,"aria-label":m,"data-assistant-contact-card":`schedule`,onClick:d,onKeyDown:p,children:[y,b,x,E]}),t[35]=p,t[36]=d,t[37]=y,t[38]=b,t[39]=x,t[40]=E,t[41]=m,t[42]=D):D=t[42],D},Fn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`||t===`busy`||t===`retry`?t:e===`idle`?`complete`:t===`idle`?t:t||`busy`,In=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,Ln=e=>e===`busy`?`text-[var(--status-info)]`:e===`retry`||e===`question`?`text-[var(--status-warning)]`:e===`error`?`text-[var(--status-error)]`:e===`idle`||e===`complete`?`text-[var(--status-success)]`:`text-muted-foreground`,Rn=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,zn=e=>{let t=(0,gt.c)(56),{card:n}=e,{t:r}=I(),i=je(),a;t[0]===i?a=t[1]:(a=i&&!ee(),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=de(s),l=J(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=Fn(l?.type,n.status),f=In(d),p;t[4]!==n.directory||t[5]!==c?(p=typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory,t[4]=n.directory,t[5]=c,t[6]=p):p=t[6];let m=p,g;t[7]===m?g=t[8]:(g=Rn(m),t[7]=m,t[8]=g);let _=g,v=me(m).data?.current?.trim()||null,y;t[9]===c?y=t[10]:(y=Ve(c),t[9]=c,t[10]=y);let b=y,x=d===`complete`||d===`idle`?Re(c):null,S;t[11]!==n.directory||t[12]!==n.sessionID||t[13]!==o?(S=()=>{let e=ft(n.sessionID)?.directory||n.directory;q(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||h.getState().setActiveMainTab(`chat`)},t[11]=n.directory,t[12]=n.sessionID,t[13]=o,t[14]=S):S=t[14];let C=F(S),w;t[15]===C?w=t[16]:(w=e=>{Tn(e,C)},t[15]=C,t[16]=w);let T=F(w),E=xn,D=r(`assistants.contact.card.session.aria`,{title:u}),O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Z,{name:`chat-thread`,weight:`medium`,className:`size-4 shrink-0`}),t[17]=O):O=t[17];let k;t[18]===r?k=t[19]:(k=r(`assistants.contact.card.session.label`),t[18]=r,t[19]=k);let A;t[20]===k?A=t[21]:(A=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[O,(0,$.jsx)(`span`,{className:`truncate`,children:k})]}),t[20]=k,t[21]=A);let j=f?(0,$.jsxs)(`span`,{"data-assistant-session-status":``,className:L(`ml-auto inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[0.75em] leading-4`,Ln(d)),children:[(0,$.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}),r(f)]}):null,M;t[22]!==A||t[23]!==j?(M=(0,$.jsxs)(`div`,{className:Sn,children:[A,j]}),t[22]=A,t[23]=j,t[24]=M):M=t[24];let N;t[25]===u?N=t[26]:(N=(0,$.jsx)(`h3`,{className:Cn,title:u,children:u}),t[25]=u,t[26]=N);let P=L(`flex min-w-0 items-center gap-1.5 text-foreground`,v&&`max-w-[45%] shrink-0`),R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Z,{name:`folder`,weight:`medium`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[27]=R):R=t[27];let z;t[28]===_?z=t[29]:(z=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:_}),t[28]=_,t[29]=z);let B;t[30]!==m||t[31]!==P||t[32]!==z?(B=(0,$.jsxs)(`p`,{className:P,title:m,children:[R,z]}),t[30]=m,t[31]=P,t[32]=z,t[33]=B):B=t[33];let V;t[34]===v?V=t[35]:(V=v?(0,$.jsxs)(`p`,{"data-contact-session-branch":``,className:`flex min-w-0 items-center gap-1 text-muted-foreground`,title:v,children:[(0,$.jsx)(Z,{name:`git-branch`,weight:`medium`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:v})]}):null,t[34]=v,t[35]=V);let H;t[36]!==B||t[37]!==V?(H=(0,$.jsxs)(`div`,{"data-contact-session-project":``,className:`flex h-4 min-w-0 flex-none items-center gap-2 text-[0.8em] leading-4`,children:[B,V]}),t[36]=B,t[37]=V,t[38]=H):H=t[38];let U=x?(0,$.jsxs)(`p`,{"data-contact-session-changes":``,className:`flex h-4 min-w-0 flex-none items-center gap-1.5 overflow-hidden whitespace-nowrap text-[0.8em] leading-4 text-muted-foreground tabular-nums`,children:[(0,$.jsx)(Z,{name:`code`,weight:`medium`,className:`size-3.5 shrink-0`}),x.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,x.additions]}),x.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,x.deletions]}),x.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:x.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:x.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:x.files})})]}):null,W;t[39]===b?W=t[40]:(W=b?(0,$.jsx)(vn,{value:b}):null,t[39]=b,t[40]=W);let te;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(Z,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[41]=te):te=t[41];let G;t[42]===W?G=t[43]:(G=(0,$.jsxs)(`div`,{"data-contact-session-bottom":``,className:`mt-auto flex h-4 min-w-0 flex-none items-center gap-2`,children:[W,te]}),t[42]=W,t[43]=G);let ne;t[44]!==H||t[45]!==U||t[46]!==G?(ne=(0,$.jsxs)(`div`,{"data-contact-session-details":``,className:`row-start-3 row-end-5 flex min-w-0 flex-col gap-1.5 py-1`,children:[H,U,G]}),t[44]=H,t[45]=U,t[46]=G,t[47]=ne):ne=t[47];let re;return t[48]!==T||t[49]!==C||t[50]!==D||t[51]!==M||t[52]!==N||t[53]!==ne||t[54]!==E?(re=(0,$.jsxs)(`article`,{className:E,role:`button`,tabIndex:0,"aria-label":D,"data-assistant-contact-card":`session`,onClick:C,onKeyDown:T,children:[M,N,ne]}),t[48]=T,t[49]=C,t[50]=D,t[51]=M,t[52]=N,t[53]=ne,t[54]=E,t[55]=re):re=t[55],re},Bn=2,Vn=1500,Hn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),Un=e=>e.scrollHeight-e.scrollTop-e.clientHeight,Wn=e=>Un(e)<=Bn,Gn=(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},Kn=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,qn=({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 _=xe(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=F(()=>{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=F(()=>{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}),T=F(()=>{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}}),E=F(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),D=Q.useRef(null),O=F(e=>{let t=i.current;!g.current||!t||(D.current=e??null,l.current=!0,u.current=null,h.current=null,p.current=t.scrollTop)}),ee=F(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=Hn(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=D.current;return D.current=null,y.current=X(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}),k=F(e=>{h.current={direction:e,expiresAt:performance.now()+Vn}}),A=F(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),j=F(()=>{x(),l.current=!1,w()}),N=F(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=Hn(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&&j();return}let o=A();T(),t.scrollTop<=80&&o===`up`&&r?.(),n&&Wn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),I=F(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(ze(t,e.target))return;k(`up`),j(),t.scrollTop<=80&&r?.();return}Gn(t,e.target)||k(`down`)}}),L=F(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),R=F(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&&ze(t,e.target)||l<0&&Gn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}k(l>0?`up`:`down`),l>2&&(j(),t.scrollTop<=80&&r?.())}}),z=F(()=>{m.current=null}),B=F(e=>{if(Ie(e)){k(`up`),j(),(i.current?.scrollTop??1/0)<=80&&r?.();return}Kn(e)&&k(`down`)}),V=F(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&k(`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&&(ee(),T())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let H=Q.useMemo(()=>()=>void 0,[]),U=e&&a?a:H,W=Q.useMemo(()=>({passive:!0}),[]);M(`scroll`,N,U,W),M(`wheel`,I,U,W),M(`touchstart`,L,U,W),M(`touchmove`,R,U,W),M(`touchend`,z,U,W),M(`touchcancel`,z,U,W),M(`keydown`,B,U),M(`pointerdown`,V,U,W);let te=F(()=>{ee(),T()});return P(typeof ResizeObserver<`u`&&e?s:null,te),{scrollRef:S,contentRef:C,preparePrepend:E,followLatest:O}},Jn=.3,Yn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],Xn=[.23,1,.32,1],Zn=be(...Yn),Qn=be(...Xn),$n=.15,er=.1,tr=.08,nr=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),rr=e=>Number.parseFloat(e)||0,ir=(e,t,n)=>e+(t-e)*n,ar=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],or=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+rr(n.borderLeftWidth)+rr(n.paddingLeft),i=t.top+rr(n.borderTopWidth)+rr(n.paddingTop);return{left:r,top:i,width:t.right-rr(n.borderRightWidth)-rr(n.paddingRight)-r,height:t.bottom-rr(n.borderBottomWidth)-rr(n.paddingBottom)-i}},sr=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`}),cr=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=or(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=sr(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:nr(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:ar(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},lr=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},ur=(e,t,n,r)=>(e.style.opacity=String(t),X(e,{opacity:[t,n]},{duration:r,ease:`linear`})),dr=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=ar(i),o=nr(t.getBoundingClientRect()),s=or(t),c=e.compact?{...e.background,left:e.textBox.left-rr(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=lr({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=lr({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=lr({...sr(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=Zn(n),i=Qn(n),m=nr(t.getBoundingClientRect()),h=c,g=ir(h.left,m.left,i),_=ir(h.left+h.width,m.left+m.width,i),v=ir(h.top+h.height,m.top+m.height,r),y=ir(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)=>`${ir(rr(e.radii[n]),rr(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(X(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:$n,ease:`linear`}),ur(f,1,0,er),ur(p,0,1,tr),X(0,1,{duration:Jn,ease:`linear`,onUpdate:m,onComplete:_})),_},fr=64,pr=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)},mr=e=>Array.from(e?.files||[]),hr=async(e,t=g)=>{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}},gr=(e,t)=>{let n=[...e,...t];for(let e of n.slice(fr))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,fr)},_r=Qe(()=>D(()=>import(`./ToolOutputDialog-DJs9w1_J.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,71,72,73,74,75,76]))),vr=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),yr=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),br=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,xr=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=I(),o=ke(),s=h(e=>e.isMobile),c=ne(),l=le(),u=G(e.id,n),d=h(e=>e.isSettingsDialogOpen),f=n&&!d&&!u.hasMessageGap?ue(e,u.data):null,p=z(e.name).displayName||e.name,m=(e,t)=>{let n=e?l.data?.assistants.find(t=>t.id===e):void 0;return n?z(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[_,v]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(new Map),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),[T,E]=Q.useState([]);Q.useEffect(()=>{let e=new Set(y.map(e=>e.url));for(let t of x.current.values())for(let n of t.attachments)e.add(n.url);for(let t of w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[y,T]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[D,O]=Q.useState([]),[ee,k]=Q.useState(null),[A,j]=Q.useState({open:!1,title:``,content:``}),M=h(e=>e.setImagePreviewOpen),N=F(e=>{(e.image||e.mermaid||e.video)&&(j(e),M(!0))}),P=F(e=>{j(t=>({...t,open:e})),M(e)});Q.useEffect(()=>()=>{M(!1)},[M]),Q.useEffect(()=>{S.current.clear(),x.current.clear(),E([]),O([]),k(null)},[o]);let V=Q.useMemo(()=>mn(),[]),H=Q.useRef(new Set),W=Q.useRef(new Map),ie=vt(e=>e.setWorking),ae=u.data?.messages??Yt,K=Q.useMemo(()=>ae.some(e=>e.parts.some(e=>e.type===`card`&&e.cardType===`schedule`&&An(e))),[ae]),se=U(e.id,n&&K),ce=Q.useMemo(()=>{let e=new Map;for(let t of se.data?.tasks??[]){if(!t.task)continue;let n=e.get(t.projectID);n||(n=new Map,e.set(t.projectID,n)),n.set(t.taskID,t.task)}return e},[se.data]),q=Qt(T,e.id),de=$t(D,e.id),pe=nn(ae,q,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`&&vr(e.text)))}),me=pe.length-1;for(;me>=0&&yr(pe[me]);)--me;let J=pe.filter((e,t)=>!yr(e)||t>me),he=Et(J),Y=xe(),ge=`${o}:${e.id}`,_e=Q.useRef(null),ve=_e.current,ye=ve?.lastID?J.findIndex(e=>br(e)===ve.lastID):-1,be=n&&!Y&&ve?.scope===ge&&ve.ready&&(ve.lastID===null||ye>=0);Q.useLayoutEffect(()=>{let e=J.at(-1);_e.current={scope:ge,ready:n&&u.isSuccess,lastID:e?br(e):null}});let X=new Date().toDateString(),Se=i(`common.date.today`),Ce=Q.useMemo(()=>Dt(a,Se,new Date(X)),[a,Se,X]),we=gn(q),Te=_n(de),Ee=!!(e.working||e.activeContactTurn),De=l.data?.revision??null,Oe=de.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),Ae=new Map(de.map(e=>[e.turnID,e])),je=Q.useRef(!1),Me=F(async(e=!1)=>{if(!(!n||je.current||u.isFetchingPreviousPage||u.isFillingMessageGap)&&!(e&&u.previousPageError)&&!(!u.hasPreviousPage&&!u.hasMessageGap)){je.current=!0,Fe();try{u.hasMessageGap?await u.retryMessageGap():await u.fetchPreviousPage()}catch{}finally{je.current=!1}}}),{scrollRef:Ne,contentRef:Pe,preparePrepend:Fe,followLatest:Ie}=qn({active:n,assistantID:e.id,contentRevision:`${J[0]?.messageID}:${J.length}:${Oe}:${u.isFetchingPreviousPage}:${u.hasPreviousPage}:${u.isFillingMessageGap}`,onLoadEarlier:()=>{Me(!0)}}),Le=Q.useRef(null),Re=Q.useRef(null),ze=Q.useRef(null),Be=Q.useRef(null),Ve=Q.useRef(null),[He,Ue]=Q.useState(null),We=()=>{let e=Re.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?cr(e,t,!s):null};Q.useLayoutEffect(()=>{let e=ze.current;if(!e)return;ze.current=null;let t=Array.from(Le.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>Ue(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Ve.current?.(),Ve.current=dr(e.source,t,t,n)}),Q.useEffect(()=>()=>{ze.current=null,Ve.current?.(),Ve.current=null},[n,e.id,o]),Q.useEffect(()=>{k(null),x.current.clear(),S.current.clear(),H.current.clear(),W.current=new Map,E(t=>Qt(t,e.id)),O(t=>$t(t,e.id)),j({open:!1,title:``,content:``}),M(!1)},[e.id,M]),Q.useEffect(()=>{for(let e of ae){let t=x.current.get(e.messageID);if(t){for(let e of t.attachments)S.current.delete(`${t.assistantID}:${e.id}`);x.current.delete(e.messageID)}}E(e=>rn(e,ae))},[ae]),Q.useEffect(()=>{let t=new Set(q.filter(e=>e.status===`sending`).map(e=>e.messageID));O(n=>cn(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:Ee,snapshotRevision:De,admissionRevisionByTurnID:W.current,pendingSendTurnIDs:t,messages:ae,settledTurnIDs:H.current}))},[e.activeContactTurn,e.id,ae,q,Ee,De]),Q.useEffect(()=>{ie(e.id,we||Te||Ee)},[e.id,Te,we,Ee,ie]),Q.useEffect(()=>{let t=e.id;return()=>{ie(t,!1)}},[e.id,ie]);let Ge=F(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){H.current.delete(t.turnID),O(e=>on(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(H.current.has(t.turnID))return;O(e=>ln(e,t));return}t.type===`contact-turn-end`&&(H.current.add(t.turnID),O(e=>dn(un(e,t,{requireExisting:!0}),ae)))}});Q.useEffect(()=>{if(n)return fe(Ge)},[n,e.id]);let Ke=F(async e=>{if(we)return;let t=C.current,n=await hr(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&k(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>gr(e,n.attachments))}),qe=F(e=>{let t=pr(e.clipboardData);t.length!==0&&(e.preventDefault(),Ke(t))}),Je=F(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),Ye=F(e=>{let t=mr(e.dataTransfer);t.length!==0&&(e.preventDefault(),Ke(t))}),Xe=F(async(t,r)=>{let a=C.current,o=e.id,s=r?x.current.get(r):void 0;if(r&&(!s||s.assistantID!==o))return;let l=s?.text??t??_,u=s?.attachments??y,d=hn({gate:V,sending:gn(q),text:l,attachments:u,assistantID:o,createMessageID:()=>r||`yuri_contact_${g()}`});if(!d.ok)return;ie(o,!0),x.current.set(d.messageID,{assistantID:o,text:l,attachments:u});let f=u.length===0&&t===void 0&&!r&&n&&!Y?We():null;ze.current=f?{messageID:d.messageID,source:f}:null,Ue(f?{scope:ge,messageID:d.messageID}:null),Be.current=f?d.messageID:Be.current,r||(Ie(f?{duration:Jn,ease:Yn}:void 0),v(e=>e===l?``:e),b(e=>e.filter(e=>!u.includes(e)))),E(e=>e.some(e=>e.messageID===d.messageID)?e.map(e=>e.messageID===d.messageID?{...d.turn,createdAt:e.createdAt}:e):[...e,d.turn]),k(null);let m=()=>{u.forEach(e=>S.current.delete(`${o}:${e.id}`)),x.current.delete(d.messageID)};try{let t=[];for(let e of u){let n=`${o}:${e.id}`,r=S.current.get(n);if(!r){if(r=await pt(o,e.file,e.id,a.signal),a.signal.aborted)return;S.current.set(n,r)}t.push(r)}if(a.signal.aborted)return;let n=[...d.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===d.messageID?{...e,parts:n}:e));let r=await te(o,d.messageID,{parts:n});if(a.signal.aborted)return;m(),typeof r.revision==`number`&&W.current.set(d.messageID,r.revision),E(e=>an(e,d.messageID)),H.current.has(d.messageID)||O(e=>on(e,o,d.messageID)),c.data?.serverInstanceID&&B({serverInstanceID:c.data.serverInstanceID,assistantID:o,name:p,avatarSeed:e.avatarSeed??o}).catch(()=>void 0)}catch(e){if(a.signal.aborted)return;if(e instanceof re&&e.code===`admission_timeout`)try{let e=await oe(o,d.messageID);if(a.signal.aborted)return;if(e){m(),typeof e.revision==`number`&&W.current.set(d.messageID,e.revision),E(e=>an(e,d.messageID)),H.current.has(d.messageID)||O(e=>on(e,o,d.messageID));return}}catch{}let t=pn(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>fn(e,d.messageID,t))}finally{V.release()}}),Ze=F(e=>{Xe(void 0,e)}),Qe=u.isError&&J.length===0,et=u.isSuccess&&J.length===0,tt=new Map(q.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:Le,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Ne,className:L(`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:Pe,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)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:p,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!1}),(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)(Z,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:p}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void u.refetch(),children:i(`chat.history.retry`)})]}):et?(0,$.jsxs)(`div`,{ref:Pe,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)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:p,className:`opacity-90`,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!1}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:p})}),(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:Pe,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[u.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,u.hasPreviousPage||u.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":u.isFetchingPreviousPage||u.isFillingMessageGap,children:[u.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,u.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,disabled:u.isFetchingPreviousPage||u.isFillingMessageGap,onClick:()=>void Me(),children:i(u.isFetchingPreviousPage||u.isFillingMessageGap?`chat.history.loadingMore`:u.previousPageError||u.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,J.map((t,r)=>{let a=`${ge}:${br(t)}`,c=r>0?J[r-1]:null,u=he.get(t.messageID),d=u!==void 0,h=d?(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(u).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:Ce(u)})}):null,g=t.role===`user`,_=t.role===`peer`,v=t.role===`assistant`&&!d&&c?.role===`assistant`&&c.turnID===t.turnID,y=c?.turnID!==t.turnID,b=!g&&(_||!v),x=_?m(t.fromAssistantID,t.fromAssistantName):p,S=_&&t.fromAssistantID?l.data?.assistants.find(e=>e.id===t.fromAssistantID):e,C=tt.get(t.messageID),w=Ae.get(t.turnID),T=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`),E=(e,t)=>g?(0,$.jsx)(Jt,{failedTurn:n?C:void 0,retryDisabled:we,onRetry:Ze,children:e},t):e;return t.status===`error`||T?(0,$.jsxs)(Q.Fragment,{children:[h,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:L(`relative px-1`,!d&&`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||w?.error||i(`assistants.contact.sendFailed`)}),f?.messageID===t.messageID?(0,$.jsx)(kt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]},a):(0,$.jsxs)(Q.Fragment,{children:[h,(0,$.jsxs)(rt.div,{"data-message-id":t.messageID,initial:be&&r>ye&&t.messageID!==Be.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:Y?0:.18,ease:`easeOut`},className:L(`flex w-full`,g?`justify-end`:`justify-start`,d?`mt-0`:y?`mt-6 first:mt-0`:v?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":C?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!v?``:void 0,children:[g?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-9 shrink-0 justify-center pt-0.5`,children:b?(0,$.jsx)(xt,{name:S?.id||t.fromAssistantID||e.id,avatarSeed:S?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:32,label:x,working:n?!!(S?.working||S?.activeContactTurn):void 0,showWorkingDot:!1,followPointer:!1}):(0,$.jsx)(`span`,{className:`size-8`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:L(`relative flex min-w-0 flex-col gap-1.5`,g?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[_?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:x})}):null,t.parts.map((r,o)=>{if(r.type===`card`&&r.cardType===`session`)return(0,$.jsx)(zn,{card:r},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`assistant`)return(0,$.jsx)(En,{card:r,assistant:l.data?.assistants.find(e=>e.id===r.assistantID),active:n},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`schedule`)return(0,$.jsx)(Pn,{card:r,task:ce.get(r.projectID)?.get(r.taskID)},`${a}:card:${o}`);if(r.type===`file`)return E((0,$.jsx)(Kt,{assistantID:e.id,part:r,onShowPopup:N},`${a}:file:${o}`),`${a}:file:${o}`);if(r.type===`text`&&vr(r.text))return null;if(r.type===`text`&&(r.text.trim()||t.status===`streaming`)){let e=!g,n=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(r.text.trim());return E((0,$.jsx)(`div`,{"aria-label":_?i(`assistants.contact.peer.aria`,{name:x}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":n||void 0,className:L(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] typography-markdown leading-6`,s&&!n&&`touch-manipulation [-webkit-user-select:all] [user-select:all]`,n?`p-0`:`px-4 py-2.5`,e?null:`whitespace-pre-wrap`,n?`text-foreground`:g?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:_?`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)($e,{content:r.text,messageId:a,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:N,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):r.text},`${a}:text:${o}`),`${a}:text:${o}`)}return null}),C?.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,f?.messageID===t.messageID?(0,$.jsx)(kt,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]})]},a)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-1 left-[2.875rem] flex h-10 items-center`,"data-assistant-contact-status-slot":``,children:!we&&He?.scope!==ge&&(Te||Ee)?(0,$.jsxs)(rt.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!Y&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:Y?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.875rem] top-0.5 flex w-9 justify-center`,"data-assistant-contact-processing-avatar":``,children:(0,$.jsx)(xt,{name:e.id,avatarSeed:e.avatarSeed,size:32,label:p,working:n?Ee:void 0,showWorkingDot:!1,followPointer:!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:Re,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[ee?(0,$.jsx)(`div`,{className:`chat-input-column mb-2`,children:(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:ee})}):null,(0,$.jsx)(`form`,{className:L(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),Xe()},onDragOver:Je,onDrop:Ye,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(Bt,{active:n,layout:`inline`,value:_,attachments:y,pending:we,isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:p}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>v(e),onVoiceSend:e=>{Xe(e)},onSubmit:()=>{Xe()},onAddFiles:e=>{Ke(e)},onRemoveAttachment:t=>{we||(S.current.delete(`${e.id}:${t}`),b(e=>e.filter(e=>e.id!==t)))},onPaste:qe,onDragOver:Je,onDrop:Ye,className:L(`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:p})}},`${o}:${e.id}`)})})]}),A.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(_r,{popup:A,onOpenChange:P,isMobile:s})}):null]})};async function Sr(e){await W(e);let t=ge.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await K();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&ge.getState().setDefaultShareAssistant(null)}function Cr({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=I(),[a,o]=Q.useState(!1),s=e?z(e.name).displayName||e.name:``,c=F(e=>{a&&!e||n(e)}),l=F(()=>{a||n(!1)}),u=F(async()=>{if(!(!e||a)){o(!0);try{await Sr(e),r?.(e.id),n(!1),k.success(i(`assistants.settings.toast.deleted`))}catch{k.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,$.jsx)(De,{open:t&&e!==null,onOpenChange:c,children:(0,$.jsxs)(we,{className:`max-w-md`,children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(Te,{children:i(`assistants.settings.delete`)}),(0,$.jsx)(Ee,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,$.jsxs)(Ce,{children:[(0,$.jsx)(R,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,$.jsx)(R,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var wr=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,Tr={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 Er(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?Tr[e.fallbackKind]:`assistants.contact.empty`)}var Dr=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`,Or=e({AssistantView:()=>jr}),kr=e=>{let t=(0,gt.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=I(),o=je(),s;t[0]===n?s=t[1]:(s=n?z(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}ve(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=F(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)(xt,{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)(Ot,{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)(se,{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},Ar=e=>{let t=(0,gt.c)(52),{avatarSeed:n,unreadCount:r,summary:i,assistantID:a,displayName:o,selected:s,editLabel:c,deleteLabel:l,onSelect:u,onEdit:d,onDelete:f,serverWorking:p}=e,m=bt(a,p!==void 0&&p),[h,g]=Q.useState(!1),_=Q.useRef(null),v;t[0]===u?v=t[1]:(v=()=>u(),t[0]=u,t[1]=v);let y=F(v),b;t[2]===d?b=t[3]:(b=()=>{g(!1),d()},t[2]=d,t[3]=b);let x=F(b),S;t[4]===f?S=t[5]:(S=()=>{g(!1),f()},t[4]=f,t[5]=S);let C=F(S),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),g(!0)},t[6]=w):w=t[6];let T=s?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,E;t[7]===T?E=t[8]:(E=L(`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),t[7]=T,t[8]=E);let D;t[9]!==y||t[10]!==s||t[11]!==E?(D=(0,$.jsx)(`button`,{ref:_,type:`button`,role:`option`,"aria-selected":s,onClick:y,onContextMenu:w,className:E}),t[9]=y,t[10]=s,t[11]=E,t[12]=D):D=t[12];let O;t[13]!==a||t[14]!==n||t[15]!==o||t[16]!==m?(O=(0,$.jsx)(xt,{name:a,avatarSeed:n,size:44,label:o,working:m,hoverTarget:_}),t[13]=a,t[14]=n,t[15]=o,t[16]=m,t[17]=O):O=t[17];let ee=s?`font-semibold`:`font-medium`,k;t[18]===ee?k=t[19]:(k=L(`block truncate typography-ui-label leading-5`,ee),t[18]=ee,t[19]=k);let A;t[20]!==o||t[21]!==k?(A=(0,$.jsx)(`span`,{className:k,children:o}),t[20]=o,t[21]=k,t[22]=A):A=t[22];let j;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=L(wr,`mt-1 text-[length:calc(var(--text-micro)*0.9)] leading-5`),t[23]=j):j=t[23];let M;t[24]===i?M=t[25]:(M=(0,$.jsx)(`span`,{className:j,children:i}),t[24]=i,t[25]=M);let N;t[26]!==A||t[27]!==M?(N=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[A,M]}),t[26]=A,t[27]=M,t[28]=N):N=t[28];let P;t[29]===r?P=t[30]:(P=(0,$.jsx)(ut,{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[29]=r,t[30]=P);let I;t[31]!==N||t[32]!==P||t[33]!==D||t[34]!==O?(I=(0,$.jsxs)(ot,{render:D,children:[O,N,P]}),t[31]=N,t[32]=P,t[33]=D,t[34]=O,t[35]=I):I=t[35];let R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Z,{name:`edit`,className:`size-4`}),t[36]=R):R=t[36];let z;t[37]!==c||t[38]!==x?(z=(0,$.jsxs)(ct,{onClick:x,children:[R,c]}),t[37]=c,t[38]=x,t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(at,{}),t[40]=B):B=t[40];let V;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Z,{name:`delete-bin`,className:`size-4`}),t[41]=V):V=t[41];let H;t[42]!==l||t[43]!==C?(H=(0,$.jsxs)(ct,{onClick:C,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[V,l]}),t[42]=l,t[43]=C,t[44]=H):H=t[44];let U;t[45]!==z||t[46]!==H?(U=(0,$.jsxs)(st,{className:`min-w-[10rem]`,children:[z,B,H]}),t[45]=z,t[46]=H,t[47]=U):U=t[47];let W;return t[48]!==h||t[49]!==I||t[50]!==U?(W=(0,$.jsxs)(it,{open:h,onOpenChange:g,children:[I,U]}),t[48]=h,t[49]=I,t[50]=U,t[51]=W):W=t[51],W},jr=e=>{let t=(0,gt.c)(117),{activeOverride:i,onMobileBack:a,onMobileOpenSettings:o}=e,{t:s}=I(),{isMobile:c}=Oe(),l=je(),u=Q.useSyncExternalStore(n,r,r),d=h(Mr),f=i??d,p=h(Nr),m=c||p,g=ne(),_=le(),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=dt(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=ge(S),w=ge(Pr),T=ge(Fr),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 D=E,O;t[9]!==w||t[10]!==C||t[11]!==v?(O=()=>{!C&&v?.assistants[0]&&w(v.assistants[0].id)},t[9]=w,t[10]=C,t[11]=v,t[12]=O):O=t[12];let ee=v?.assistants,k;t[13]!==w||t[14]!==C||t[15]!==ee?(k=[w,C,ee],t[13]=w,t[14]=C,t[15]=ee,t[16]=k):k=t[16],Q.useEffect(O,k);let A;t[17]!==D||t[18]!==w||t[19]!==C||t[20]!==v?.assistants||t[21]!==_.isSuccess?(A=()=>{_.isSuccess&&C&&!D&&w(v?.assistants[0]?.id??null)},t[17]=D,t[18]=w,t[19]=C,t[20]=v?.assistants,t[21]=_.isSuccess,t[22]=A):A=t[22];let j=v?.assistants,M;t[23]!==D||t[24]!==w||t[25]!==C||t[26]!==_.isSuccess||t[27]!==j?(M=[D,w,C,j,_.isSuccess],t[23]=D,t[24]=w,t[25]=C,t[26]=_.isSuccess,t[27]=j,t[28]=M):M=t[28],Q.useEffect(A,M);let N;t[29]!==l||t[30]!==T?(N=()=>{if(T(),l){l.openSettings();return}let e=h.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=T,t[31]=N):N=t[31];let P=F(N),B;t[32]===l?B=t[33]:(B=e=>{ve(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=B);let V=F(B),H;t[34]!==D||t[35]!==l?(H=()=>{D&&ve(D.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=D,t[35]=l,t[36]=H):H=t[36];let U=F(H),[W,te]=Q.useState(null),G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{te(e)},t[37]=G):G=t[37];let re=F(G),ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{e||te(null)},t[38]=ie):ie=t[38];let ae=F(ie),oe=F(Ir),K;t[39]!==a||t[40]!==oe?(K=()=>{if(a){a();return}oe()},t[39]=a,t[40]=oe,t[41]=K):K=t[41];let se=F(K),ce=Dr({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:!!D}),ue;t[42]!==D||t[43]!==se||t[44]!==m||t[45]!==o?(ue=(e,t,n,r)=>(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[m?(0,$.jsx)(kr,{assistant:D,onBack:se,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)(Z,{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]=D,t[43]=se,t[44]=m,t[45]=o,t[46]=ue):ue=t[46];let q=ue;if(ce===`loading`){let e;t[47]!==D||t[48]!==se||t[49]!==m||t[50]!==o?(e=m?(0,$.jsx)(kr,{assistant:D,onBack:se,onOpenSettings:o}):null,t[47]=D,t[48]=se,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)(Z,{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(ce===`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(ce===`onboarding`){let e;if(t[63]!==P||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]!==P||t[70]!==i?(a=(0,$.jsx)(R,{onClick:P,children:i}),t[69]=P,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=P,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!v||!D){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 de;t[75]===D.name?de=t[76]:(de=z(D.name),t[75]=D.name,t[76]=de);let fe=de,pe;t[77]!==_.isError||t[78]!==s?(pe=_.isError?s(`assistants.state.staleSnapshot`):null,t[77]=_.isError,t[78]=s,t[79]=pe):pe=t[79];let me=pe,J;t[80]!==x||t[81]!==m||t[82]!==P||t[83]!==V||t[84]!==re||t[85]!==w||t[86]!==C||t[87]!==v||t[88]!==s?(J=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-1 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)(_t,{snapshot:v,compact:!0,rowClassName:`flex min-w-0 flex-1 justify-end`}),(0,$.jsx)(R,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`size-8 min-h-0 min-w-0 !shadow-[0_0_0_0.5px_rgb(0_0_0/0.08),0_1px_2px_rgb(0_0_0/0.05)] dark:!shadow-[var(--yuri-mobile-glass-shadow)]`,"aria-label":s(`assistants.settings.create`),onClick:P,children:(0,$.jsx)(Z,{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-1`,children:x.map(e=>{let t=e.id===C,n=z(e.name);return(0,$.jsx)(Ar,{assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:Er(e.latestMessagePreview,s),displayName:n.displayName,selected:t,editLabel:s(`assistants.menu.edit`),deleteLabel:s(`assistants.settings.delete`),assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>w(e.id),onEdit:()=>V(e.id),onDelete:()=>re(e)},e.id)})})})]}),t[80]=x,t[81]=m,t[82]=P,t[83]=V,t[84]=re,t[85]=w,t[86]=C,t[87]=v,t[88]=s,t[89]=J):J=t[89];let he=W!==null,Y;t[90]!==W||t[91]!==ae||t[92]!==he?(Y=(0,$.jsx)(Cr,{assistant:W,open:he,onOpenChange:ae}),t[90]=W,t[91]=ae,t[92]=he,t[93]=Y):Y=t[93];let _e=!m&&`border-l border-[var(--surface-subtle)]`,ye;t[94]===_e?ye=t[95]:(ye=L(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-clip bg-background`,_e),t[94]=_e,t[95]=ye);let be;t[96]!==D||t[97]!==se||t[98]!==m||t[99]!==o||t[100]!==U||t[101]!==fe||t[102]!==s?(be=m?(0,$.jsx)(kr,{assistant:D,onBack:se,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)(xt,{name:D.id,avatarSeed:D.avatarSeed,size:40,label:fe.displayName||D.name,working:!!(D.working||D.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:fe.displayName}),(0,$.jsx)(Ot,{assistantID:D.id,serverWorking:!!(D.working||D.activeContactTurn),lastContactAt:D.latestMessagePreview?.createdAt})]}),(0,$.jsx)(R,{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)(Z,{name:`settings-3`,className:`size-4`})})]}),t[96]=D,t[97]=se,t[98]=m,t[99]=o,t[100]=U,t[101]=fe,t[102]=s,t[103]=be):be=t[103];let X;t[104]!==f||t[105]!==D||t[106]!==m||t[107]!==me?(X=(0,$.jsx)(xr,{assistant:D,warning:me,active:f,overlayHeader:m}),t[104]=f,t[105]=D,t[106]=m,t[107]=me,t[108]=X):X=t[108];let xe;t[109]!==ye||t[110]!==be||t[111]!==X?(xe=(0,$.jsxs)(`div`,{className:ye,children:[be,X]}),t[109]=ye,t[110]=be,t[111]=X,t[112]=xe):xe=t[112];let Se;return t[113]!==J||t[114]!==Y||t[115]!==xe?(Se=(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-clip bg-background`,"data-presentation":`workspace`,children:[J,Y,xe]}),t[113]=J,t[114]=Y,t[115]=xe,t[116]=Se):Se=t[116],Se};function Mr(e){return e.activeMainTab===`assistant`}function Nr(e){return e.isMobile}function Pr(e){return e.selectAssistant}function Fr(e){return e.requestCreate}function Ir(){h.getState().setActiveMainTab(`chat`)}export{Cr as a,_t as c,Er as i,Or as n,xt as o,wr as r,bt as s,jr as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEZ1K7qW.js";import{at as n,it as r}from"./vendor-base-ui-BQjbsJ43.js";import{n as i}from"./useUIStore-DI7va1HH.js";import{l as a}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{a as o,i as s,t as c,u as l}from"./fileQueries-5a1jkme2.js";import{r as u}from"./vendor-sonner-r2EJnfoo.js";import{f as d}from"./button-DuHjvKJJ.js";import{n as f}from"./Icon-DvUDsV1z.js";import{n as p}from"./useEffectiveDirectory-B8q00InF.js";import{t as m}from"./diagram-ChoQDKzy.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
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEZ1K7qW.js";import{at as n,it as r}from"./vendor-base-ui-BQjbsJ43.js";import{n as i}from"./useUIStore-DI7va1HH.js";import{l as a}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{a as o,i as s,t as c,u as l}from"./fileQueries-5a1jkme2.js";import{r as u}from"./vendor-sonner-r2EJnfoo.js";import{f as d}from"./button-Dt6Ygbc7.js";import{n as f}from"./Icon-BP1sfnHn.js";import{n as p}from"./useEffectiveDirectory-Ci6Z13kj.js";import{t as m}from"./diagram-DWZaG3_v.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{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{n as r}from"./vendor-react-D5d-V1vN.js";import{r as i}from"./button-DuHjvKJJ.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
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{n as r}from"./vendor-react-D5d-V1vN.js";import{r as i}from"./button-Dt6Ygbc7.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{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{n as r}from"./vendor-react-D5d-V1vN.js";import{f as i,t as a}from"./button-DuHjvKJJ.js";import{Kr as o}from"./useMobileNavigationStore-Bn4SaalY.js";import{r as s}from"./device-BjRYYXNT.js";import{i as c}from"./react-CURmDhtB.js";import{n as l,r as u,t as d}from"./readiness-BveVUOIb.js";import{t as f}from"./GuiPluginWindow-tGvc4_0g.js";var p=r(),m=e(t(),1),h=n();function g(){let e=(0,p.c)(21),{host:t,snapshot:n,error:r}=c(),{t:g}=i(),{isMobile:v}=s(),[y]=m.useState(_),b;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Set,e[0]=b):b=e[0];let x;e[1]===t?x=e[2]:(x={host:t,errors:b},e[1]=t,e[2]=x);let S=m.useRef(x),C,w;e[3]!==t||e[4]!==n.plugins||e[5]!==g?(C=()=>{S.current.host!==t&&(S.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||g(`guiPlugins.failed`),r=JSON.stringify([t.id,n]);e.add(r),S.current.errors.has(r)||o.error(`${t.id}: ${n}`)}S.current.errors=e},w=[t,n.plugins,g],e[3]=t,e[4]=n.plugins,e[5]=g,e[6]=C,e[7]=w):(C=e[6],w=e[7]),m.useEffect(C,w);let T;if(e[8]!==y||e[9]!==r||e[10]!==t||e[11]!==v||e[12]!==n.activePanel||e[13]!==n.panels||e[14]!==n.plugins||e[15]!==g){let i;e[17]===n.activePanel?i=e[18]:(i=e=>e.key===n.activePanel&&!e.inline,e[17]=n.activePanel,e[18]=i);let o=n.panels.find(i),s;e[19]===t?s=e[20]:(s=()=>t?.hidePanel(),e[19]=t,e[20]=s),T=(0,h.jsx)(f,{id:`gui-plugin-panel`,open:!!(t&&o),title:o?.title??g(`guiPlugins.title`),onClose:s,actions:v&&o?(0,h.jsx)(u,{target:y}):null,children:t&&o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":g(`guiPlugins.panels`),children:n.panels.map(e=>(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.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,h.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":g(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:g(`guiPlugins.close`)})]},e.key))}),r?(0,h.jsx)(`div`,{role:`alert`,className:`text-[var(--status-error)]`,children:r}):null,(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,h.jsx)(l,{host:t,contributionKey:o.key,kind:`panel`,actions:v?y:void 0,revision:d(n.plugins,o.pluginId)})})]}):null}),e[8]=y,e[9]=r,e[10]=t,e[11]=v,e[12]=n.activePanel,e[13]=n.panels,e[14]=n.plugins,e[15]=g,e[16]=T}else T=e[16];return T}function _(){return document.createElement(`div`)}export{g as GuiPluginSurface};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{n as r}from"./vendor-react-D5d-V1vN.js";import{f as i,t as a}from"./button-Dt6Ygbc7.js";import{Kr as o}from"./useMobileNavigationStore-TCj7ZnhV.js";import{r as s}from"./device-BjRYYXNT.js";import{i as c}from"./react-CURmDhtB.js";import{n as l,r as u,t as d}from"./readiness-DSJs_3v4.js";import{t as f}from"./GuiPluginWindow-l4FYY6S-.js";var p=r(),m=e(t(),1),h=n();function g(){let e=(0,p.c)(21),{host:t,snapshot:n,error:r}=c(),{t:g}=i(),{isMobile:v}=s(),[y]=m.useState(_),b;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Set,e[0]=b):b=e[0];let x;e[1]===t?x=e[2]:(x={host:t,errors:b},e[1]=t,e[2]=x);let S=m.useRef(x),C,w;e[3]!==t||e[4]!==n.plugins||e[5]!==g?(C=()=>{S.current.host!==t&&(S.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||g(`guiPlugins.failed`),r=JSON.stringify([t.id,n]);e.add(r),S.current.errors.has(r)||o.error(`${t.id}: ${n}`)}S.current.errors=e},w=[t,n.plugins,g],e[3]=t,e[4]=n.plugins,e[5]=g,e[6]=C,e[7]=w):(C=e[6],w=e[7]),m.useEffect(C,w);let T;if(e[8]!==y||e[9]!==r||e[10]!==t||e[11]!==v||e[12]!==n.activePanel||e[13]!==n.panels||e[14]!==n.plugins||e[15]!==g){let i;e[17]===n.activePanel?i=e[18]:(i=e=>e.key===n.activePanel&&!e.inline,e[17]=n.activePanel,e[18]=i);let o=n.panels.find(i),s;e[19]===t?s=e[20]:(s=()=>t?.hidePanel(),e[19]=t,e[20]=s),T=(0,h.jsx)(f,{id:`gui-plugin-panel`,open:!!(t&&o),title:o?.title??g(`guiPlugins.title`),onClose:s,actions:v&&o?(0,h.jsx)(u,{target:y}):null,children:t&&o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":g(`guiPlugins.panels`),children:n.panels.map(e=>(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.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,h.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":g(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:g(`guiPlugins.close`)})]},e.key))}),r?(0,h.jsx)(`div`,{role:`alert`,className:`text-[var(--status-error)]`,children:r}):null,(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,h.jsx)(l,{host:t,contributionKey:o.key,kind:`panel`,actions:v?y:void 0,revision:d(n.plugins,o.pluginId)})})]}):null}),e[8]=y,e[9]=r,e[10]=t,e[11]=v,e[12]=n.activePanel,e[13]=n.panels,e[14]=n.plugins,e[15]=g,e[16]=T}else T=e[16];return T}function _(){return document.createElement(`div`)}export{g as GuiPluginSurface};
@@ -1 +1 @@
1
- import{it as e}from"./vendor-base-ui-BQjbsJ43.js";import{n as t}from"./vendor-react-D5d-V1vN.js";import{f as n}from"./button-DuHjvKJJ.js";import{a as r,n as i,o as a,t as o}from"./dialog-CVhqZux0.js";import{r as s}from"./device-BjRYYXNT.js";import{t as c}from"./MobileResizableSheet-ZL-zPa3W.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=s(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let r;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(r=(0,u.jsx)(c,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=r):r=t[14],r}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(r,{children:(0,u.jsx)(a,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(i,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(o,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};
1
+ import{it as e}from"./vendor-base-ui-BQjbsJ43.js";import{n as t}from"./vendor-react-D5d-V1vN.js";import{f as n}from"./button-Dt6Ygbc7.js";import{a as r,n as i,o as a,t as o}from"./dialog-CjQeHVOc.js";import{r as s}from"./device-BjRYYXNT.js";import{t as c}from"./MobileResizableSheet-F1zSUD1S.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=s(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let r;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(r=(0,u.jsx)(c,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=r):r=t[14],r}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(r,{children:(0,u.jsx)(a,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(i,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(o,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};