@yuriai/web 0.3.2-beta.2 → 0.3.2-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 (104) hide show
  1. package/dist/assets/{AgentAvatar-B9ucI2MO.js → AgentAvatar-DEFsZEmz.js} +1 -1
  2. package/dist/assets/AssistantConversationSurface-Dv5EUOyi.js +3 -0
  3. package/dist/assets/AssistantSessionCard-Bltga-i7.js +2 -0
  4. package/dist/assets/{AssistantUnreadBadge-RQ0DmUi6.js → AssistantUnreadBadge-CTXv15Hu.js} +1 -1
  5. package/dist/assets/{AssistantView-Bo5BZS0L.js → AssistantView-jFFTgQjt.js} +1 -1
  6. package/dist/assets/{DiagramView-B-78GB_f.js → DiagramView-BWmLp7hy.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-C-CtY8g9.js → FadeInOnReveal-CAUN0CLN.js} +1 -1
  8. package/dist/assets/{GuiPluginPage-B1YKmblD.js → GuiPluginPage-C-ba8EBi.js} +1 -1
  9. package/dist/assets/{GuiPluginSurface-hm7K6byY.js → GuiPluginSurface-BXD7VSy-.js} +1 -1
  10. package/dist/assets/{GuiPluginWindow-7DO5ZOvG.js → GuiPluginWindow-DrBQ8ig5.js} +1 -1
  11. package/dist/assets/{Icon-C6CNZZkk.js → Icon-CWw2bUr_.js} +1 -1
  12. package/dist/assets/{ImageLoadingPlaceholder-B6Zer2YL.js → ImageLoadingPlaceholder-BunwTGdg.js} +1 -1
  13. package/dist/assets/{LoadingImage-BPX-DCAP.js → LoadingImage-BwuyM06-.js} +1 -1
  14. package/dist/assets/{MarkdownRenderer-DrXbG9Y5.js → MarkdownRenderer-DBiJPyID.js} +2 -2
  15. package/dist/assets/{MarkdownRendererImpl-D9FUbv9O.js → MarkdownRendererImpl-DVYVKsuL.js} +2 -2
  16. package/dist/assets/{MarkstreamRendererImpl-BXEYnxur.js → MarkstreamRendererImpl-DZX9o9OO.js} +2 -2
  17. package/dist/assets/{MobileDetailNavigation-CpjB_jck.js → MobileDetailNavigation-CYqota_p.js} +1 -1
  18. package/dist/assets/{MobileResizableSheet-Cn4FFye8.js → MobileResizableSheet-Be4ev9vj.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-DuDpHmZD.js → MobileShareBridge-CbtO4v1w.js} +1 -1
  20. package/dist/assets/MobileSurface-BsNRnAku.js +2 -0
  21. package/dist/assets/{MultiRunWindow--3wAH_2i.js → MultiRunWindow-lwPMnpaH.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-Cr6g_uej.js → OnboardingScreen-CNLtVzgH.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-CHgqvqG3.js → OverlayScrollbar-dFYzZtN7.js} +1 -1
  24. package/dist/assets/{RemoteAssistantSessionCard-CE-B_FHL.js → RemoteAssistantSessionCard-BJYmBRJm.js} +1 -1
  25. package/dist/assets/{SettingsView-BoQRiuVv.js → SettingsView-CHApPouO.js} +13 -13
  26. package/dist/assets/{SettingsWindow-B1JkVKIr.js → SettingsWindow-lhGgHfD5.js} +1 -1
  27. package/dist/assets/{SetupTourDialog-B43dbK2I.js → SetupTourDialog-B46Tyvcn.js} +1 -1
  28. package/dist/assets/{TerminalView-DKS2KRh0.js → TerminalView-D8V8eOVt.js} +1 -1
  29. package/dist/assets/ToolOutputDialog-Cwlx7FjV.js +16 -0
  30. package/dist/assets/{VoiceSettings-C6jznmzY.js → VoiceSettings-CB9qkMjr.js} +2 -2
  31. package/dist/assets/{capgoAdapter-B3s9u7sG.js → capgoAdapter-DmQmlaD4.js} +1 -1
  32. package/dist/assets/{checkbox-Cossbslk.js → checkbox-BF6Ew27G.js} +1 -1
  33. package/dist/assets/{collapsible-Bt9trgB2.js → collapsible-D6SmW6dp.js} +1 -1
  34. package/dist/assets/{context-menu-DUzve8Id.js → context-menu-0FkJFPFb.js} +1 -1
  35. package/dist/assets/{diagram-CCwMM241.js → diagram-BBuHtBwt.js} +1 -1
  36. package/dist/assets/dialog-Ctkzc2Zz.js +1 -0
  37. package/dist/assets/dialog-DYOEW9DC.css +1 -0
  38. package/dist/assets/{fileMentionTouchSelection-BsMdH79T.js → fileMentionTouchSelection-Ctt4StcZ.js} +1 -1
  39. package/dist/assets/{gitApi-6bjyfJ0P.js → gitApi-DBBc9J6o.js} +1 -1
  40. package/dist/assets/{input-Dc9Few6S.js → input-dbArHWaP.js} +1 -1
  41. package/dist/assets/{insertionBoundaries-DImWCHHe.js → insertionBoundaries-BGTaMvws.js} +1 -1
  42. package/dist/assets/{main-ClvHuS1l.js → main-BF3h13M0.js} +2 -2
  43. package/dist/assets/{main-C27KIa4w.js → main-D-BEO915.js} +14 -14
  44. package/dist/assets/{markdownHeightCache-CgEzszwt.js → markdownHeightCache-B9zDETOW.js} +1 -1
  45. package/dist/assets/{mcpQueries-D-c3h-8F.js → mcpQueries-CVzK-E8k.js} +1 -1
  46. package/dist/assets/miniChat-DaSVRLIT.js +2 -0
  47. package/dist/assets/mobile-BxYzuzvw.js +2 -0
  48. package/dist/assets/{mobileBackNavigation-CX1dqatK.js → mobileBackNavigation-CKLNMUuZ.js} +1 -1
  49. package/dist/assets/mobileConnections-TY8B_vJJ.js +2 -0
  50. package/dist/assets/{multirun-BqGvXgzB.js → multirun-YEb0yxyy.js} +1 -1
  51. package/dist/assets/{native-config--i6wCD4P.js → native-config-iKs3QC84.js} +1 -1
  52. package/dist/assets/{navigation-DEIXKsz9.js → navigation-DwodsHzA.js} +1 -1
  53. package/dist/assets/openRemoteProjectSession-B7tp7K6E.js +1 -0
  54. package/dist/assets/projectMeta-b96xwStQ.js +1 -0
  55. package/dist/assets/{pwa-CUF8fchS.js → pwa-CXclRR5h.js} +1 -1
  56. package/dist/assets/{queue-abort-optimistic-DnJeXLxG.js → queue-abort-optimistic-CxSpYsNp.js} +1 -1
  57. package/dist/assets/{react-_vsw1y6L.js → react-BcKSvwr4.js} +1 -1
  58. package/dist/assets/{readiness-jkhl68VV.js → readiness-CjM_fPUz.js} +2 -2
  59. package/dist/assets/{reference-history-D9aLqiz1.js → reference-history-BhDcCRSh.js} +1 -1
  60. package/dist/assets/{remoteSessionReference-BODrh2wf.js → remoteSessionReference-CcAQSJBP.js} +1 -1
  61. package/dist/assets/{renderElectronMiniChatApp-Bj1TCHnZ.js → renderElectronMiniChatApp-D7LRyQ0q.js} +2 -2
  62. package/dist/assets/renderMobileApp-CoKCXfEA.js +29 -0
  63. package/dist/assets/{runtimeConfig-9qXX2ix1.js → runtimeConfig-XD_Q8p-7.js} +1 -1
  64. package/dist/assets/{runtimeEndpointReset-BUGfn7y0.css → runtimeEndpointReset-BIrMtGn5.css} +1 -1
  65. package/dist/assets/{runtimeEndpointReset-nUC5uMtu.js → runtimeEndpointReset-CLOWf55R.js} +9 -9
  66. package/dist/assets/{select-RfWO-Q8r.js → select-DpIon12c.js} +1 -1
  67. package/dist/assets/{sessionLookup-BnWJnI1i.js → sessionLookup-Bgl1T8Xy.js} +1 -1
  68. package/dist/assets/{sortable-tabs-strip-BQhg8ugs.js → sortable-tabs-strip-BNUSKRdi.js} +1 -1
  69. package/dist/assets/{speechSettingsQueries-B5nF726M.js → speechSettingsQueries-Qp_K7NEi.js} +1 -1
  70. package/dist/assets/src-DRyZ4dLj.css +2 -0
  71. package/dist/assets/{textarea-7J-b5mR2.js → textarea-Cl9UwJTL.js} +1 -1
  72. package/dist/assets/{tooltip-IVmealjG.js → tooltip-Pge3VQEi.js} +1 -1
  73. package/dist/assets/{types-fkNzcMt6.js → types-zQujo_Lh.js} +1 -1
  74. package/dist/assets/{useAppFontEffects-BGhC1aSo.js → useAppFontEffects-CA0RAFjg.js} +62 -62
  75. package/dist/assets/{useDesktopWindowControlsLayout-CqAP968J.js → useDesktopWindowControlsLayout-xvFTC44C.js} +1 -1
  76. package/dist/assets/{useEffectiveDirectory-D_gt64gp.js → useEffectiveDirectory-DUB24zcV.js} +1 -1
  77. package/dist/assets/useMobileNavigationStore-CU0KrVK0.js +13 -0
  78. package/dist/assets/{usePluginsStore-GVUi9ssB.js → usePluginsStore-Cdk11zAA.js} +1 -1
  79. package/dist/assets/{useProjectRuntimeAPIs-MBstcTXw.js → useProjectRuntimeAPIs-LShklsHL.js} +1 -1
  80. package/dist/assets/{useStreamingTextThrottle-B9fGpeQT.js → useStreamingTextThrottle-4QIDm_ui.js} +1 -1
  81. package/dist/index.html +6 -6
  82. package/dist/mini-chat.html +6 -6
  83. package/dist/mobile.html +2 -2
  84. package/package.json +1 -1
  85. package/server/lib/notifications/DOCUMENTATION.md +11 -1
  86. package/server/lib/notifications/session-unread-store.js +20 -6
  87. package/server/lib/notifications/session-unread.test.js +80 -0
  88. package/server/lib/scheduled-tasks/DOCUMENTATION.md +14 -5
  89. package/server/lib/scheduled-tasks/runtime.js +29 -25
  90. package/server/lib/scheduled-tasks/runtime.test.js +88 -1
  91. package/dist/assets/AssistantConversationSurface-Blm96EOU.js +0 -3
  92. package/dist/assets/AssistantSessionCard-DX38brAH.js +0 -2
  93. package/dist/assets/MobileSurface-D93ybkxD.js +0 -2
  94. package/dist/assets/ToolOutputDialog-CBk9ZNkY.js +0 -16
  95. package/dist/assets/dialog-CDfUL86v.js +0 -1
  96. package/dist/assets/dialog-CTYD3Sbr.css +0 -1
  97. package/dist/assets/miniChat-BV82mwxi.js +0 -2
  98. package/dist/assets/mobile-CiUCPZu-.js +0 -2
  99. package/dist/assets/mobileConnections-BdfBfyV4.js +0 -2
  100. package/dist/assets/openRemoteProjectSession-DkaBkopU.js +0 -1
  101. package/dist/assets/projectMeta-CX7xsn7U.js +0 -1
  102. package/dist/assets/renderMobileApp-ZBJF50-1.js +0 -29
  103. package/dist/assets/src-INJJ62RE.css +0 -2
  104. package/dist/assets/useMobileNavigationStore-Dlt-Ip-3.js +0 -13
@@ -1,16 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,t as r,v as i,w as a}from"./runtime-auth-mjIpsk3N.js";import{c as o,i as s}from"./runtime-switch-BMjl5Y5W.js";import{n as c}from"./runtime-fetch-DKZOpfzo.js";import{R as l,n as u}from"./platform-wF65ZFgV.js";import{t as d}from"./runtimeAPIRegistry-C2VogTny.js";import{it as f,ot as p,st as m}from"./vendor-base-ui-fom6orB6.js";import{n as h}from"./vendor-react-D5BntRmA.js";import{s as g}from"./vendor-tanstack-react-query-ChSd65dm.js";import{E as _,c as v,f as y,o as b,s as x}from"./runtime-file-resource-DnhWnndu.js";import{r as S}from"./vendor-reactuses-core-B8s-Rcd-.js";import{a as C,n as w}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{S as T,x as E}from"./useUIStore-CYex4rbF.js";import{n as D,t as O}from"./runtime-file-download-Dc459c9e.js";import{a as k,i as A}from"./vendor-pierre-diffs-HJfPTtu2.js";import{t as j}from"./i18n-OsFhnlRH.js";import{In as M,Rn as N}from"./useMobileNavigationStore-Dlt-Ip-3.js";import{n as P,t as F}from"./useThemeSystem-D2YBbLma.js";import{l as I,o as L,s as R,u as ee}from"./vendor-framer-motion-DiGWHm7K.js";import{n as z}from"./Icon-C6CNZZkk.js";import{n as B,t as V}from"./dialog-CDfUL86v.js";import{t as te}from"./tap-LkQum5bB.js";import{r as ne}from"./themes-BgDJcxRc.js";import{i as re,n as H}from"./MarkdownRenderer-DrXbG9Y5.js";import{t as ie}from"./MobileWindowStack-DGLdgoGr.js";import{i as ae,n as U}from"./mobileBackNavigation-CX1dqatK.js";import{a as oe,n as se,r as ce}from"./toolHelpers-iEHVHQ9p.js";import{n as le}from"./useEffectiveDirectory-D_gt64gp.js";import{a as W,c as ue,i as G,o as de}from"./image-loading-ZB1bYt51.js";import{t as fe}from"./ImageLoadingPlaceholder-B6Zer2YL.js";import{t as K}from"./vendor-tanstack-react-virtual-WY42p6U6.js";import{n as q}from"./markdownTheme-C2LJ3cJo.js";import{n as J,t as pe}from"./markdown-worker-oBGEB9Eg.js";var Y=t(m(),1),X=h(),Z=p(),me=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,Q=e=>e.status===`completed`||e.status===`cancelled`,$={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},he={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},ge={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},_e=1.2,ve=24,ye=`1 1`,be=e=>{let t=(0,X.c)(23),{status:n,className:r}=e,{t:i}=j(),a=$[n],o;t[0]!==i||t[1]!==a?(o=i(a),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s=he[n],c;t[3]!==r||t[4]!==s?(c=N(`size-[1em] shrink-0 transition-colors duration-300`,s,r),t[3]=r,t[4]=s,t[5]=c):c=t[5];let l=n===`pending`?_e:void 0,u=n===`pending`?ve:void 0,d=n===`pending`?ye:void 0,f;t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:l,pathLength:u,strokeDasharray:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=n===`in_progress`?(0,Z.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=p);let m;t[12]===n?m=t[13]:(m=n===`completed`?(0,Z.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=m);let h;t[14]===n?h=t[15]:(h=n===`cancelled`?(0,Z.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=h);let g;return t[16]!==m||t[17]!==h||t[18]!==o||t[19]!==c||t[20]!==f||t[21]!==p?(g=(0,Z.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":o,className:c,children:[f,p,m,h]}),t[16]=m,t[17]=h,t[18]=o,t[19]=c,t[20]=f,t[21]=p,t[22]=g):g=t[22],g},xe=3.2,Se=e=>{let t=Math.PI*2*e,n=8+xe*Math.sin(t),r=8-xe*Math.cos(t);return`M8 8 L8 4.8 A${xe} ${xe} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},Ce=e=>{let t=(0,X.c)(11),{done:n,total:r,spinning:i,className:a}=e,o=n===void 0?0:n,s=r===void 0?0:r,c=i!==void 0&&i,l=s>0?Math.min(1,o/s):0,u;t[0]===a?u=t[1]:(u=N(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=u);let d=c?`yuri-todo-spin`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={transformBox:`fill-box`,transformOrigin:`center`},t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,Z.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:_e,pathLength:ve,strokeDasharray:ye,className:d,style:f}),t[3]=d,t[4]=p);let m;t[5]===l?m=t[6]:(m=l>0?(0,Z.jsx)(`path`,{d:Se(l),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=l,t[6]=m);let h;return t[7]!==u||t[8]!==p||t[9]!==m?(h=(0,Z.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:u,children:[p,m]}),t[7]=u,t[8]=p,t[9]=m,t[10]=h):h=t[10],h},we=({done:e,total:t,className:n,animate:r=!0})=>{let i=Y.useRef(e),a=r&&i.current!==e;return Y.useEffect(()=>{i.current=e},[e]),(0,Z.jsxs)(`span`,{className:N(`shrink-0 tabular-nums`,n),children:[(0,Z.jsx)(`span`,{className:N(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},Te=e=>{let t=(0,X.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=N(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,Z.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Z.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},Ee=e=>{let t=(0,X.c)(27),{todos:n,isWorking:r,animate:i,className:a,rowClassName:o,listRef:s,id:c}=e,l=r!==void 0&&r,u=i!==void 0&&i,{t:d}=j(),f=n.findIndex(De),p;t[0]!==f||t[1]!==n?(p=f>=0?f:n.findIndex(Oe),t[0]=f,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]===n?h=t[4]:(h=n.some(ke),t[3]=n,t[4]=h);let g=h,_;t[5]===a?_=t[6]:(_=N(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,a),t[5]=a,t[6]=_);let v;if(t[7]!==m||t[8]!==u||t[9]!==g||t[10]!==l||t[11]!==o||t[12]!==d||t[13]!==n){let e;t[15]!==m||t[16]!==u||t[17]!==g||t[18]!==l||t[19]!==o||t[20]!==d?(e=(e,t)=>{let n=me(e.status),r=l&&!g&&t===m&&n===`pending`?`in_progress`:n;return(0,Z.jsxs)(`li`,{"data-status":r,"aria-current":t===m?`step`:void 0,className:N(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,o??`gap-[0.6em] px-[0.5em]`,u&&`yuri-todo-row-in`),children:[(0,Z.jsx)(`span`,{className:N(`flex h-[1.32em] w-[1.15em] items-center justify-center`,u&&`yuri-todo-icon-pop`),title:d($[r]),children:(0,Z.jsx)(be,{status:r})},r),(0,Z.jsx)(`span`,{dir:`auto`,title:e.content,className:N(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,ge[r]),children:(0,Z.jsx)(`span`,{className:N(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=m,t[16]=u,t[17]=g,t[18]=l,t[19]=o,t[20]=d,t[21]=e):e=t[21],v=n.map(e),t[7]=m,t[8]=u,t[9]=g,t[10]=l,t[11]=o,t[12]=d,t[13]=n,t[14]=v}else v=t[14];let y;return t[22]!==c||t[23]!==s||t[24]!==_||t[25]!==v?(y=(0,Z.jsx)(`ul`,{id:c,ref:s,className:_,children:v}),t[22]=c,t[23]=s,t[24]=_,t[25]=v,t[26]=y):y=t[26],y};function De(e){return e.status===`in_progress`}function Oe(e){return e.status===`pending`}function ke(e){return e.status===`in_progress`}var Ae=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),je=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,Me=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=je(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},Ne=e=>`<pre><code>${Ae(e)}</code></pre>`,Pe=e=>{let t=(0,X.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=P(),u=Y.useRef(null),d;t[0]===l?d=t[1]:(d=q(l),t[0]=l,t[1]=d);let f=d,p,m;t[2]!==n||t[3]!==o||t[4]!==c?(p=()=>{let e=u.current;e&&(e.innerHTML=Ne(n),Me(e,c,o))},m=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=p,t[6]=m):(p=t[5],m=t[6]),Y.useLayoutEffect(p,m);let h,g;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(h=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return pe(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,Me(e,c,o))}),()=>{t=!1,i.abort()}},g=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=h,t[12]=g):(h=t[11],g=t[12]),Y.useEffect(h,g);let _;t[13]===i?_=t[14]:(_=N(`typography-code`,i),t[13]=i,t[14]=_);let v=f,y;t[15]!==a||t[16]!==v?(y={...v,...a},t[15]=a,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==_||t[19]!==y?(b=(0,Z.jsx)(`div`,{ref:u,className:_,style:y}),t[18]=_,t[19]=y,t[20]=b):b=t[20],b},Fe=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Ie=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},Le=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,Re=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,ze=(e,t)=>!e||typeof e!=`object`?String(e):ce(e,t||``),Be=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},Ve=e=>{if(!e||typeof e!=`object`)return;let t=Be(e.patch)??Be(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=Be(e.patch)??Be(e.diff);if(t)return t}},He=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},Ue=(e,t,n)=>{let r=Fe(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&Le(r)&&(r=Re(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=Ve(n);if(e)return e}return r},We=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
2
- `).split(`
3
- `),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},Ge=(e,t)=>{try{let n=e.trim().split(`
4
- `).filter(Boolean);if(n.length===0)return null;let r=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,i=Math.floor(e.length/2),a=!n.endsWith(`/`);r.push({name:n.replace(/\/$/,``),depth:i,isFile:a})}}),(0,Z.jsx)(`div`,{className:N(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:T.tool.popup,children:r.map((e,t)=>(0,Z.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,Z.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,Z.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},Ke={backgroundColor:`var(--status-info)`,opacity:.6},qe=(e,t,n)=>{try{let r=e.trim().split(`
5
- `).filter(Boolean);if(r.length===0)return null;let i={};return r.forEach(e=>{let t=e.match(/^(.+?):(\d+):(.*)$/)||e.match(/^(.+?):(.*)$/);if(t){let[,e,n,r]=t,a=r===void 0?``:n,o=r===void 0?n:r;i[e]||(i[e]=[]),i[e].push({lineNum:a,content:o})}}),(0,Z.jsxs)(`div`,{className:N(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:T.tool.popup,children:[(0,Z.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,r.length,` match`,r.length===1?``:`es`]}),Object.entries(i).map(([e,n])=>(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:N(`font-medium text-muted-foreground`,t?`typography-micro`:`typography-code`),children:e}),(0,Z.jsx)(`div`,{className:`pl-4 space-y-1`,children:n.map((e,n)=>!e.lineNum&&!e.content?null:(0,Z.jsxs)(`div`,{className:N(`flex items-start gap-2 min-w-0`,t?`typography-micro`:`typography-code`),children:[(0,Z.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 mt-1.5`,style:Ke}),(0,Z.jsxs)(`div`,{className:`flex gap-2 min-w-0 flex-1`,children:[e.lineNum&&(0,Z.jsxs)(`span`,{className:`text-muted-foreground font-mono whitespace-nowrap`,children:[`Line `,e.lineNum,`:`]}),(0,Z.jsx)(`span`,{className:`text-foreground font-mono break-words flex-1`,children:e.content||`\xA0`})]})]},n))})]},e))]})}catch{return null}},Je={backgroundColor:`var(--status-info)`,opacity:.6},Ye=(e,t,n)=>{try{let r=e.trim().split(`
6
- `).filter(Boolean);if(r.length===0)return null;let i={};r.forEach(e=>{let t=e.lastIndexOf(`/`),n=t>0?e.substring(0,t):`/`,r=t>=0?e.substring(t+1):e;i[n]||(i[n]=[]),i[n].push(r)});let a=Object.keys(i).sort();return(0,Z.jsxs)(`div`,{className:N(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:T.tool.popup,children:[(0,Z.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,r.length,` file`,r.length===1?``:`s`]}),a.map(e=>(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsxs)(`div`,{className:N(`font-medium text-muted-foreground`,t?`typography-micro`:`typography-code`),children:[e,`/`]}),(0,Z.jsx)(`div`,{className:N(`pl-4 grid gap-1`,t?`grid-cols-1`:`grid-cols-2`),children:i[e].sort().map(e=>(0,Z.jsxs)(`div`,{className:N(`flex items-center gap-2 min-w-0`,t?`typography-micro`:`typography-code`),children:[(0,Z.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:Je}),(0,Z.jsx)(`span`,{className:`text-foreground font-mono truncate`,children:e})]},e))})]},e))]})}catch{return null}},Xe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),Ze=(e,t,n)=>{try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let r=t.filter(e=>!!e&&typeof e==`object`&&typeof e.content==`string`&&typeof e.status==`string`&&Xe.has(e.status));return r.length===0?null:(0,Z.jsx)(Ee,{todos:r,className:N(`px-1 py-1`,n?.listClassName)})}catch{return null}},Qe=(e,t)=>{try{return(0,Z.jsx)(`div`,{className:N(`typography-code max-w-none w-full min-w-0`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/20`),style:T.tool.popup,children:(0,Z.jsx)(H,{content:e,variant:`tool`})})}catch{return null}},$e=e=>{let t=e.split(`
7
- `),n=``,r=[],i=0;for(;i<t.length;){let e=t[i];if(e.startsWith(`Index:`)||e.startsWith(`===`)||e.startsWith(`---`)||e.startsWith(`+++`)){e.startsWith(`Index:`)&&(n=e.split(` `)[1].split(`/`).pop()||`file`),i++;continue}if(e.startsWith(`@@`)){let a=e.match(/@@ -(\d+),\d+ \+(\d+),\d+ @@/),o=a?parseInt(a[1]):0,s=a?parseInt(a[2]):0,c=[],l=o,u=s,d=i+1;for(;d<t.length&&!t[d].startsWith(`@@`)&&!t[d].startsWith(`Index:`);){let e=t[d];e.startsWith(`+`)?(c.push({type:`added`,lineNumber:u,content:e.substring(1)}),u++):e.startsWith(`-`)?(c.push({type:`removed`,lineNumber:l,content:e.substring(1)}),l++):e.startsWith(` `)&&(c.push({type:`context`,lineNumber:u,content:e.substring(1)}),l++,u++),d++}r.push({file:n,oldStart:o,newStart:s,lines:c}),i=d;continue}i++}return r},et=(e,t,n)=>se(t,e,n),tt=e=>{let t=(0,X.c)(12),{mode:n,onModeChange:r,className:i}=e,a;t[0]!==n||t[1]!==r?(a=e=>{e.stopPropagation(),r(n===`side-by-side`?`unified`:`side-by-side`)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===i?s=t[4]:(s=N(`h-5 w-5 p-0 opacity-60 hover:opacity-100`,i),t[3]=i,t[4]=s);let c=n===`side-by-side`?`Switch to unified view`:`Switch to side-by-side view`,l;t[5]===n?l=t[6]:(l=n===`side-by-side`?(0,Z.jsx)(z,{name:`align-justify`,className:`h-3 w-3`}):(0,Z.jsx)(z,{name:`layout-column`,className:`h-3 w-3`}),t[5]=n,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,Z.jsx)(M,{size:`sm`,variant:`ghost`,className:s,onClick:o,title:c,children:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u},nt=(e,t)=>{let n=(0,X.c)(4),[r,i]=Y.useState(null),a,o;return n[0]!==e||n[1]!==t?(a=()=>{let n=!0,r=new AbortController;return i(null),J(e,(t||`text`).toLowerCase(),{signal:r.signal,priority:`visible`}).then(e=>{n&&i(e)}),()=>{n=!1,r.abort()}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),Y.useEffect(a,o),r};function rt(e){let t=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)}function it(e,t){let n=(0,X.c)(4),r=t===void 0||t,i,a;n[0]!==r||n[1]!==e?(i=()=>{let t=e.current;if(!(!r||!t))return rt(t)},a=[e,r],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),Y.useEffect(i,a)}var at=80,ot=20,st=Y.memo(e=>{let t=(0,X.c)(26),{lines:n,language:r,maxHeight:i,showLineNumbers:a,lineStyles:o}=e,s=i===void 0?`60vh`:i,c=a===void 0||a,{currentTheme:l}=P(),u;t[0]===l?u=t[1]:(u=q(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(ut).join(`
8
- `),t[2]=n,t[3]=f);let p=nt(f,r);if(!(n.length>at)){let e=d,r;t[4]!==s||t[5]!==e?(r={...e,maxHeight:s,overflow:`auto`},t[4]=s,t[5]=e,t[6]=r):r=t[6];let i;if(t[7]!==p||t[8]!==o||t[9]!==n||t[10]!==c){let e;t[12]!==p||t[13]!==o||t[14]!==c?(e=(e,t)=>(0,Z.jsx)(lt,{line:e,html:p?.[t],showLineNumbers:c,style:o?.(e)},t),t[12]=p,t[13]=o,t[14]=c,t[15]=e):e=t[15],i=n.map(e),t[7]=p,t[8]=o,t[9]=n,t[10]=c,t[11]=i}else i=t[11];let a;return t[16]!==r||t[17]!==i?(a=(0,Z.jsx)(`div`,{className:`typography-code font-mono w-full min-w-0`,style:r,children:i}),t[16]=r,t[17]=i,t[18]=a):a=t[18],a}let m;return t[19]!==p||t[20]!==o||t[21]!==n||t[22]!==s||t[23]!==c||t[24]!==d?(m=(0,Z.jsx)(ct,{lines:n,highlighted:p,syntaxVars:d,maxHeight:s,showLineNumbers:c,lineStyles:o}),t[19]=p,t[20]=o,t[21]=n,t[22]=s,t[23]=c,t[24]=d,t[25]=m):m=t[25],m});st.displayName=`VirtualizedCodeBlock`;var ct=Y.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=Y.useRef(null),s=`min(${e.length*ot}px, ${r})`,c=K({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>ot,overscan:20}),l=c.getVirtualItems();return(0,Z.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,Z.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,Z.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:(0,Z.jsx)(lt,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});ct.displayName=`VirtualizedRows`;var lt=Y.memo(e=>{let t=(0,X.c)(12),{line:n,html:r,showLineNumbers:i,style:a}=e,o;t[0]!==n.isInfo||t[1]!==n.lineNumber||t[2]!==i?(o=i&&(0,Z.jsx)(`span`,{className:`w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5`,style:{color:`var(--tools-edit-line-number)`,borderColor:`var(--tools-border)`},children:!n.isInfo&&n.lineNumber!=null?n.lineNumber:``}),t[0]=n.isInfo,t[1]=n.lineNumber,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n.isInfo||t[6]!==n.text?(s=(0,Z.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,Z.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,Z.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,Z.jsx)(`div`,{className:`whitespace-pre`,dangerouslySetInnerHTML:{__html:r}})}),t[4]=r,t[5]=n.isInfo,t[6]=n.text,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`typography-code font-mono flex w-full min-w-0`,style:a,children:[o,s]}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c});lt.displayName=`VirtualizedCodeBlock.Row`;function ut(e){return e.text}var dt={maxDepth:50,maxNodes:1e5,initiallyExpandedDepth:2};function ft(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`object`:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`null`}function pt(e){if(e.length===0)return`root`;let t=`root`;for(let n of e)/^\d+$/.test(n)?t+=`[${n}]`:t+=`.${n}`;return t}var mt=0;function ht(e,t,n,r,i){if(mt>=i.maxNodes)return null;mt++;let a=ft(e),o=pt(n),s=a===`object`||a===`array`,c={id:o,key:t,value:e,type:a,depth:r,path:n,isExpandable:s};if(s&&r<i.maxDepth){let t=a===`array`?e.map((e,t)=>[String(t),e]):Object.entries(e);c.childCount=t.length,c.children=[];for(let[e,a]of t){let t=ht(a,e,[...n,e],r+1,i);t&&c.children.push(t)}}else s&&(c.childCount=a===`array`?e.length:Object.keys(e).length);return c}function gt(e,t){let n={...dt,...t};mt=0;try{let t=e.trim();return t?ht(JSON.parse(t),`root`,[],0,n):null}catch{return null}}function _t(e,t){if(!e)return[];let n=[];function r(e){let i=!t.has(e.id);if(n.push({node:e,isExpanded:i}),e.isExpandable&&i&&e.children)for(let t of e.children)r(t)}return r(e),n}function vt(e){if(!e)return[];let t=[];function n(e){if(e.isExpandable&&(t.push(e.id),e.children))for(let t of e.children)n(t)}return n(e),t}function yt(e,t){if(!e)return[];let n=[];function r(e){if(e.isExpandable&&e.depth>=t&&n.push(e.id),e.children)for(let t of e.children)r(t)}return r(e),n}var bt=[`var(--syntax-key)`,`color-mix(in oklch, var(--syntax-key) 85%, var(--syntax-string))`,`color-mix(in oklch, var(--syntax-key) 70%, var(--syntax-number))`,`color-mix(in oklch, var(--syntax-key) 55%, var(--syntax-function))`,`color-mix(in oklch, var(--syntax-key) 40%, var(--syntax-type))`,`color-mix(in oklch, var(--syntax-key) 30%, var(--syntax-keyword))`];function xt(e){return bt[e%bt.length]}function St(e){switch(e.type){case`string`:return`var(--syntax-string)`;case`number`:return`var(--syntax-number)`;case`boolean`:return`var(--syntax-keyword)`;case`null`:return`var(--syntax-comment)`;default:return`var(--surface-foreground)`}}function Ct(e){switch(e.type){case`string`:{let t=e.value;return t.length>60?`"${t.slice(0,57)}..."`:`"${t}"`}case`number`:case`boolean`:return String(e.value);case`null`:return`null`;case`object`:return`{${e.childCount??0} ${e.childCount===1?`item`:`items`}}`;case`array`:return`[${e.childCount??0}]`;default:return String(e.value)}}function wt(e){if(e.type===`object`){let t=e.children?.map(e=>e.key).slice(0,3)??[],n=(e.childCount??0)>3?`, ...`:``;return`{ ${t.map(e=>`"${e}": ...`).join(`, `)}${n} }`}if(e.type===`array`){let t=e.childCount??0;return t<=3?`[${e.children?.map(e=>Ct(e)).join(`, `)??``}]`:`[${t} items]`}return Ct(e)}var Tt=Y.memo(e=>{let t=(0,X.c)(29),{flatNode:n,onToggle:r,onCopyPath:i}=e,{node:a,isExpanded:o}=n,s=a.depth*20,c;t[0]!==a.id||t[1]!==r?(c=()=>{r(a.id)},t[0]=a.id,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]!==a.id||t[4]!==i?(u=e=>{i&&(e.preventDefault(),i(a.id))},t[3]=a.id,t[4]=i,t[5]=u):u=t[5];let d=u,f;t[6]===a.depth?f=t[7]:(f=xt(a.depth),t[6]=a.depth,t[7]=f);let p=f,m;t[8]===a?m=t[9]:(m=St(a),t[8]=a,t[9]=m);let h=m,g=a.isExpandable&&a.children&&a.children.length>0,_=`${s+8}px`,v;t[10]===_?v=t[11]:(v={paddingLeft:_},t[10]=_,t[11]=v);let y;t[12]!==l||t[13]!==g||t[14]!==o?(y=g?(0,Z.jsx)(`button`,{type:`button`,onClick:l,className:`mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-[var(--interactive-hover)] text-muted-foreground`,children:o?(0,Z.jsx)(z,{name:`arrow-down-s`,className:`h-3 w-3`}):(0,Z.jsx)(z,{name:`arrow-right-s`,className:`h-3 w-3`})}):(0,Z.jsx)(`span`,{className:`mr-1 w-4`}),t[12]=l,t[13]=g,t[14]=o,t[15]=y):y=t[15];let b;t[16]!==p||t[17]!==a.key?(b=a.key!==`root`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mr-1 font-semibold`,style:{color:p},children:/^\d+$/.test(a.key)?a.key:`"${a.key}"`}),(0,Z.jsx)(`span`,{className:`mr-1 text-[var(--surface-foreground)]`,children:`:`})]}),t[16]=p,t[17]=a.key,t[18]=b):b=t[18];let x;t[19]!==o||t[20]!==a||t[21]!==h?(x=a.isExpandable?o?(0,Z.jsx)(`span`,{className:`text-[var(--surface-foreground)]`,children:a.type===`object`?`{`:`[`}):(0,Z.jsx)(`span`,{style:{color:`var(--surface-mutedForeground)`},children:wt(a)}):(0,Z.jsx)(`span`,{style:{color:h},children:Ct(a)}),t[19]=o,t[20]=a,t[21]=h,t[22]=x):x=t[22];let S;return t[23]!==d||t[24]!==v||t[25]!==y||t[26]!==b||t[27]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center py-0.5 px-2 hover:bg-[var(--surface-hover)] rounded-sm cursor-default font-mono text-xs leading-5 whitespace-nowrap`,style:v,onContextMenu:d,children:[y,b,x]}),t[23]=d,t[24]=v,t[25]=y,t[26]=b,t[27]=x,t[28]=S):S=t[28],S});Tt.displayName=`JsonRow`;var Et=200,Dt=22,Ot=Y.forwardRef(function({data:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2,onCopyPath:i},a){let o=Y.useMemo(()=>{try{return JSON.stringify(e)}catch{return null}},[e]),s=Y.useMemo(()=>o?gt(o):null,[o]),[c,l]=Y.useState(()=>s?new Set(yt(s,r)):new Set),u=Y.useMemo(()=>_t(s,c),[s,c]),d=u.length>Et,f=Y.useRef(null),p=K({count:u.length,enabled:d,getScrollElement:()=>f.current,estimateSize:()=>Dt,overscan:20,getItemKey:e=>u[e]?.node.id??e}),m=Y.useCallback(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=Y.useCallback(()=>{l(new Set)},[]),g=Y.useCallback(()=>{s&&l(new Set(vt(s)))},[s]);return Y.useImperativeHandle(a,()=>({expandAll:h,collapseAll:g}),[h,g]),s?d?(0,Z.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:(0,Z.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(e=>{let t=u[e.index];return t?(0,Z.jsx)(`div`,{"data-index":e.index,ref:p.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,Z.jsx)(Tt,{flatNode:t,onToggle:m,onCopyPath:i})},t.node.id):null})})}):(0,Z.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:u.map(e=>(0,Z.jsx)(Tt,{flatNode:e,onToggle:m,onCopyPath:i},e.node.id))}):null}),kt=Y.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=j(),a=Y.useRef(null),[o,s]=Y.useState(null),c=Y.useMemo(()=>{try{let t=e.trim();if(!t)return s(i(`jsonTreeView.error.emptyJson`)),null;let n=JSON.parse(t);return s(null),n}catch(e){return s(e instanceof Error?e.message:i(`jsonTreeView.error.invalidJson`)),null}},[e,i]),l=Y.useCallback(()=>{a.current?.expandAll()},[]),u=Y.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,Z.jsx)(`div`,{className:t,children:(0,Z.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,Z.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,Z.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,Z.jsxs)(`div`,{className:t,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,Z.jsxs)(M,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(z,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,Z.jsxs)(M,{variant:`ghost`,size:`xs`,onClick:u,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(z,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,Z.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,Z.jsx)(Ot,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),At=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},jt=(e,t)=>new At(e,t),Mt=e=>e instanceof At,Nt=e=>e+1,Pt=(e,t)=>e===t,Ft=e=>{let t=e.indexOf(`,`);if(t<0)throw jt(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},It=e=>Promise.resolve().then(()=>Ft(e)),Lt=1,Rt=56,zt=(e,t,n)=>Math.min(n,Math.max(t,e)),Bt=({isMobile:e,pointerType:t,cancelled:n,moved:r,suppressTap:i,targetWasCanvas:a,start:o,end:s,startScale:c,hasMultipleImages:l})=>{if(n||i)return`none`;let u={x:s.x-o.x,y:s.y-o.y},d=Math.hypot(u.x,u.y),f=t!==`mouse`;if(e&&f&&c<=1.01&&Math.abs(u.x)>=Rt&&Math.abs(u.x)>Math.abs(u.y)*1.2)return l?u.x<0?`next`:`previous`:`none`;let p=!r&&d<=10;return e&&f&&p||!e&&t===`mouse`&&p&&a?`close`:`none`},Vt=(e,t)=>{if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{width:1,height:1};let n=Math.min(t.width/e.width,t.height/e.height);return{width:Math.max(1,e.width*n),height:Math.max(1,e.height*n)}},Ht=(e,t)=>{let n=t.minScale??Lt,r=t.maxScale??5,i=zt(e.scale,n,r),a=Math.max(0,(t.image.width*i-t.viewport.width)/2),o=Math.max(0,(t.image.height*i-t.viewport.height)/2);return{scale:i,x:zt(e.x,-a,a),y:zt(e.y,-o,o)}},Ut=(e,t,n,r,i)=>{let a=zt(t,i.minScale??Lt,i.maxScale??5),o=a/e.scale;return Ht({scale:a,x:n.x-r.x-(n.x-r.x-e.x)*o,y:n.y-r.y-(n.y-r.y-e.y)*o},i)},Wt=(e,t,n)=>Ht({...e,x:e.x+t.x,y:e.y+t.y},n),Gt=.25,Kt=32,qt=(e,t)=>({scale:1-Math.min(.45,e/t*.65),opacity:zt(1-e/(t*.55),.15,1)}),Jt=(e,t,n,r)=>n?t.y>Kt?`y`:r&&Math.abs(t.x)>Kt?`x`:null:Math.hypot(e.x,e.y)<=10?null:!r||e.y>0&&e.y>=Math.abs(e.x)*.6?`y`:Math.abs(e.x)>=Math.abs(e.y)?`x`:`y`,Yt=(e,t,n,r,i)=>{let a=Wt(e,t,n),o={x:e.x+t.x-a.x,y:e.y+t.y-a.y},s=e.scale>1.01;r??=Jt(t,o,s,i);let c=s?Kt:0,l=r===`x`&&i?Math.sign(o.x)*Math.max(0,Math.abs(o.x)-c):0,u=r===`y`?Math.max(0,o.y-c):0,d=qt(u,n.viewport.height);return{transform:a,axis:r,galleryX:zt(l,-n.viewport.width,n.viewport.width),dismissY:u,dismissX:u>0?t.x*Gt:0,dismissScale:d.scale,backdropOpacity:d.opacity}},Xt=e=>{let t=e[e.length-1];if(!t)return{x:0,y:0};let n=e.find(e=>t.time-e.time<=100)??t,r=t.time-n.time;return r>0?{x:(t.x-n.x)/r,y:(t.y-n.y)/r}:{x:0,y:0}},Zt=280,Qt=(e,t)=>te(e,t),$t=(e,t,n)=>{let r=Math.abs(e.galleryX);return r>=Math.min(96,n.width*.22)||r>18&&Math.abs(t.x)>.55&&t.x*e.galleryX>0?e.galleryX<0?`next`:`previous`:e.dismissY>=Math.min(140,n.height*.18)||e.dismissY>48&&t.y>.65?`close`:`none`},en=(e,t,n,r,i,a)=>{let o=zt(r,a.minScale??Lt,a.maxScale??5),s=o/e.scale;return Ht({scale:o,x:n.x-i.x-(t.x-i.x-e.x)*s,y:n.y-i.y-(t.y-i.y-e.y)*s},a)};function tn(e){let t=(0,X.c)(39),{url:n,directory:r,label:i,active:a,returnToSource:o,sourceElement:s,viewport:c,isMobile:l,position:u,onActiveImage:d}=e,{t:f}=j(),p=de(n,r,`preview`),m=p.source||s?.currentSrc||``,h=`${p.key}\n${m}`,g=Y.useRef(null),[_,v]=Y.useState(null),[y,b]=Y.useState(null),x;t[0]!==_||t[1]!==h||t[2]!==s?(x=_?.key===h?_.size:s?.naturalWidth&&s.naturalHeight?{width:s.naturalWidth,height:s.naturalHeight}:null,t[0]=_,t[1]=h,t[2]=s,t[3]=x):x=t[3];let S=x,C=!!S,w=!!(p.error||y===h),T=S??c,E=Math.max(1,c.width*(l?1:.8)),D=Math.max(1,c.height*(l?1:.95)),O;t[4]!==T||t[5]!==E||t[6]!==D?(O=Vt(T,{width:E,height:D}),t[4]=T,t[5]=E,t[6]=D,t[7]=O):O=t[7];let k=O,A,M;t[8]!==a||t[9]!==w||t[10]!==C||t[11]!==S||t[12]!==d||t[13]!==p.key||t[14]!==m?(A=()=>{a&&d({element:g.current,source:m,resourceKey:p.key,naturalSize:S,loaded:C,error:w})},M=[a,m,p.key,S,C,w,d],t[8]=a,t[9]=w,t[10]=C,t[11]=S,t[12]=d,t[13]=p.key,t[14]=m,t[15]=A,t[16]=M):(A=t[15],M=t[16]),Y.useLayoutEffect(A,M);let N=!a||void 0,P=`translate3d(${u*(c.width+16)}px, 0, 0)`,F;t[17]===P?F=t[18]:(F={transform:P},t[17]=P,t[18]=F);let I;t[19]!==a||t[20]!==w||t[21]!==C?(I=!C&&!w&&(0,Z.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,role:a?`status`:void 0,children:(0,Z.jsx)(fe,{className:`aspect-square w-64 max-w-[80vw] rounded-xl`})}),t[19]=a,t[20]=w,t[21]=C,t[22]=I):I=t[22];let L;t[23]!==a||t[24]!==h||t[25]!==w||t[26]!==i||t[27]!==C||t[28]!==o||t[29]!==k||t[30]!==m||t[31]!==f?(L=w?(0,Z.jsx)(`p`,{role:a?`status`:void 0,className:`px-6 text-center typography-ui-label`,children:f(`filesView.error.readFileFailed`)}):(0,Z.jsx)(`img`,{ref:g,"data-preview-transition-target":a?``:void 0,"data-preview-return":o,src:m||void 0,alt:a?i:``,className:`block max-w-none touch-none object-contain will-change-transform ${a?`pointer-events-auto`:``} ${C?`opacity-100`:`opacity-0`}`,style:{width:`${k.width}px`,height:`${k.height}px`},loading:`eager`,draggable:!1,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&v({key:h,size:{width:t.naturalWidth,height:t.naturalHeight}})},onError:()=>b(h)}),t[23]=a,t[24]=h,t[25]=w,t[26]=i,t[27]=C,t[28]=o,t[29]=k,t[30]=m,t[31]=f,t[32]=L):L=t[32];let R;return t[33]!==u||t[34]!==F||t[35]!==I||t[36]!==L||t[37]!==N?(R=(0,Z.jsxs)(`div`,{"data-image-viewer-slide":u,"aria-hidden":N,className:`pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden`,style:F,children:[I,L]}),t[33]=u,t[34]=F,t[35]=I,t[36]=L,t[37]=N,t[38]=R):R=t[38],R}var nn=500,rn=24,an=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??nn,i=t.maxDistance??rn,a=!0,o,s=()=>{a&&(a=!1,n.removeEventListener(`click`,c,!0),o!==void 0&&globalThis.clearTimeout(o))},c=t=>{let n=t;typeof n.clientX==`number`&&typeof n.clientY==`number`&&(Math.hypot(n.clientX-e.x,n.clientY-e.y)>i||(s(),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))};return n.addEventListener(`click`,c,!0),o=globalThis.setTimeout(s,r),s},on=(e,t,n={})=>{an(e,n),t()},sn=t(f(),1);function cn(e,t,n,r,i){let a=e instanceof HTMLImageElement?e:e.querySelector(`img`);if(!a||!t.complete||!t.naturalWidth||!t.animate)return;let o=t.getBoundingClientRect(),s=a.getBoundingClientRect();if(!o.width||!o.height||!s.width||!s.height)return;let c=getComputedStyle(a),l=t.naturalWidth/t.naturalHeight,u=c.objectFit===`cover`?Math.max(s.width,s.height*l):Math.min(s.width,s.height*l),d=u/l,f=c.objectPosition.split(` `);if(!f.every(e=>e.endsWith(`%`)))return;let p=(s.width-u)*parseFloat(f[0])/100,m=(s.height-d)*parseFloat(f[1]??f[0])/100,h=s.left,g=s.top,_=s.right,v=s.bottom,y=c.borderRadius;for(let e=a.parentElement;e;e=e.parentElement){let t=getComputedStyle(e),n=e.getBoundingClientRect();[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowX)&&(h=Math.max(h,n.left),_=Math.min(_,n.right)),[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowY)&&(g=Math.max(g,n.top),v=Math.min(v,n.bottom)),n.width===s.width&&n.height===s.height&&t.borderRadius!==`0px`&&(y=t.borderRadius)}if(_<=h||v<=g)return;let b=document.createElement(`div`);b.dataset.mediaCropAnimation=``,b.setAttribute(`aria-hidden`,`true`),Object.assign(b.style,{position:`fixed`,left:`0`,top:`0`,overflow:`hidden`,pointerEvents:`none`,zIndex:`51`,contain:`paint`});let x=document.createElement(`img`);x.src=t.currentSrc||t.src,x.alt=``,Object.assign(x.style,{display:`block`,width:`${o.width}px`,height:`${o.height}px`,maxWidth:`none`,transformOrigin:`0 0`}),b.append(x),document.body.append(b);let S={transform:`translate(${o.left}px, ${o.top}px)`,width:`${o.width}px`,height:`${o.height}px`,borderRadius:`0px`},C={transform:`translate(${h}px, ${g}px)`,width:`${_-h}px`,height:`${v-g}px`,borderRadius:y},w={transform:`translate(0px, 0px) scale(1)`},T={transform:`translate(${s.left+p-h}px, ${s.top+m-g}px) scale(${u/o.width})`},E={duration:280,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`},D=t.style.visibility;t.style.visibility=`hidden`;let O=[b.animate(r?[S,C]:[C,S],E),x.animate(r?[w,T]:[T,w],E),n.animate({opacity:r?[1,0]:[0,1]},E)],k=!1,A=(e=!1)=>{b.remove(),t.style.visibility=D,O.forEach((t,n)=>{(!e||n!==2)&&t.cancel()})};return Promise.all(O.map(e=>e.finished)).then(()=>{k||(A(r),i())},()=>{k||(A(),i())}),()=>{k=!0,A()}}function ln(e,t,n,r,i=()=>{}){let a=e?.getBoundingClientRect(),o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!o&&e?.isConnected&&t instanceof HTMLImageElement&&n&&a?.width&&a.height&&a.bottom>0&&a.top<window.innerHeight&&a.right>0&&a.left<window.innerWidth){let a=cn(e,t,n,r,i);if(a)return a}if(!document.startViewTransition||o||!e?.isConnected||!t||!n||!a?.width||!a.height||a.bottom<=0||a.top>=window.innerHeight||a.right<=0||a.left>=window.innerWidth){if(!n?.animate||o)return i(),()=>{};let e=n.animate({opacity:r?[1,0]:[0,1]},{duration:150,fill:`forwards`}),t=!1;return e.finished.then(()=>{t||i()},()=>{}),()=>{t=!0,e.cancel()}}let s=e.style.viewTransitionName,c=t.style.viewTransitionName,l=n.style.visibility,u=!1,d=`yuri-media-preview`;e.style.viewTransitionName=r?`none`:d,t.style.viewTransitionName=r?d:`none`,r||(n.style.visibility=`hidden`);let f=document.startViewTransition(()=>{u||(e.style.viewTransitionName=r?d:`none`,t.style.viewTransitionName=r?`none`:d,n.style.visibility=r?`hidden`:l)}),p=()=>{e.style.viewTransitionName=s,t.style.viewTransitionName=c,n.style.visibility=l};f.ready.catch(()=>{});let m=()=>{u||(p(),i())};return f.finished.then(m,m),()=>{u=!0,f.skipTransition(),p()}}function un(e){let t=(0,X.c)(12),{onClose:n,isMobile:r,size:i}=e,{t:a}=j(),o;t[0]!==r||t[1]!==i?(o=r?{top:`calc(var(--yuri-safe-area-top, 0px) + 0.5rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{top:i?`calc(50% - ${i.height/2}px + 0.5rem)`:`0.5rem`,right:i?`calc(50% - ${i.width/2}px + 0.5rem)`:`0.5rem`},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a(`dialog.common.actions.close`),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(z,{name:`close`,className:`size-5`}),t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==s?(l=(0,Z.jsx)(M,{variant:`mobileGlass`,size:`mobileIcon`,"aria-label":s,onClick:n,children:c}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,Z.jsx)(`div`,{className:`absolute right-3 z-20`,style:o,children:l}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function dn(e){let t=(0,X.c)(9),{children:n,isMobile:r}=e,i;t[0]===r?i=t[1]:(i=r?{bottom:`calc(var(--yuri-safe-area-bottom, 0px) + 0.75rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{bottom:`1rem`,left:`1rem`},t[0]=r,t[1]=i);let a=r?`mobile`:`desktop`,o=`pointer-events-auto flex items-center text-[var(--yuri-media-preview-foreground)] ${r?`gap-1.5`:`gap-2`}`,s;t[2]!==n||t[3]!==a||t[4]!==o?(s=(0,Z.jsx)(`div`,{"data-media-preview-toolbar":a,className:o,onPointerDown:pn,onDoubleClick:fn,children:n}),t[2]=n,t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute z-20`,style:i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function fn(e){return e.stopPropagation()}function pn(e){return e.stopPropagation()}function mn(e){let t=(0,X.c)(30),{open:n,title:r,kind:i,source:a,isMobile:o,onOpenChange:s,children:c}=e,l=Y.useRef(null),u=Y.useId(),d=Y.useRef(null),f=Y.useRef(!1),[p,m]=Y.useState(!1),h;t[0]!==s||t[1]!==a?(h=()=>{if(f.current)return;f.current=!0,l.current&&(l.current.dataset.mediaPreviewClosing=`true`),d.current?.();let e=l.current?.querySelector(`[data-preview-transition-target]`)??null;d.current=ln(e?.dataset.previewReturn===`false`?void 0:a,e,l.current,!0,()=>{m(!0),s(!1)})},t[0]=s,t[1]=a,t[2]=h):h=t[2];let g=S(h),_=`${i}-preview`,v=n&&!p&&o,y;t[3]!==g||t[4]!==_||t[5]!==v?(y={id:_,active:v,layer:`overlay`,onBack:g,surfaceRef:l},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6],U(y);let b,x;if(t[7]!==g||t[8]!==p||t[9]!==o||t[10]!==u||t[11]!==n||t[12]!==a?(b=()=>{if(!n){m(!1),f.current=!1;return}if(p)return;let e=l.current;e&&delete e.dataset.mediaPreviewClosing;let t=document.activeElement instanceof HTMLElement?document.activeElement:null,r=o?ie.add({id:u,onClose:g},document.body):void 0;return e?.querySelector(`button`)?.focus({preventScroll:!0}),d.current=ln(a,e?.querySelector(`[data-preview-transition-target]`)??null,e,!1),()=>{d.current?.(),d.current=null,f.current=!1,r?.(),t?.isConnected&&t.focus({preventScroll:!0})}},x=[p,n,a,o,u,g],t[7]=g,t[8]=p,t[9]=o,t[10]=u,t[11]=n,t[12]=a,t[13]=b,t[14]=x):(b=t[13],x=t[14]),Y.useLayoutEffect(b,x),!n||p||typeof document>`u`)return null;let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C={color:`var(--yuri-media-preview-foreground)`},t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{if(f.current){e.preventDefault(),e.stopPropagation();return}d.current?.(),d.current=null},t[16]=w):w=t[16];let T;t[17]===g?T=t[18]:(T=e=>{if(!e.currentTarget.contains(e.target)||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g()),e.key!==`Tab`))return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]`)),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},t[17]=g,t[18]=T);let E=o?`var(--yuri-media-preview-background)`:`color-mix(in srgb, var(--yuri-media-preview-background) ${i===`mermaid`?90:70}%, transparent)`,D;t[19]===E?D=t[20]:(D=(0,Z.jsx)(`div`,{"data-media-preview-backdrop":``,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{backgroundColor:E}}),t[19]=E,t[20]=D);let O;t[21]!==c||t[22]!==g?(O=c(g),t[21]=c,t[22]=g,t[23]=O):O=t[23];let k;return t[24]!==i||t[25]!==D||t[26]!==O||t[27]!==T||t[28]!==r?(k=(0,sn.createPortal)((0,Z.jsxs)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-label":r,"data-media-preview":i,"data-page-scroll-lock":`true`,tabIndex:-1,className:`fixed inset-0 z-[80] overflow-hidden select-none [-webkit-touch-callout:none]`,style:C,onClick:hn,onPointerDownCapture:w,onKeyDown:T,children:[D,O]}),document.body),t[24]=i,t[25]=D,t[26]=O,t[27]=T,t[28]=r,t[29]=k):k=t[29],k}function hn(e){e.stopPropagation()}var gn=1048576,_n=C(`YuriVideo`),vn=e=>{let t=/^bytes=(\d*)-(\d*)$/.exec(e||`bytes=0-1048575`);if(!t||!t[1]&&!t[2])throw Error(`Invalid media range`);if(!t[1]){let e=Number(t[2]);if(!Number.isSafeInteger(e)||e<=0)throw Error(`Invalid media range`);return`bytes=-${Math.min(e,gn)}`}let n=Number(t[1]),r=t[2]?Number(t[2]):n+gn-1;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r)||r<n)throw Error(`Invalid media range`);return`bytes=${n}-${Math.min(r,n+gn-1)}`},yn=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)};async function bn(e,t,r){if(!w.isNativePlatform()||w.getPlatform()!==`ios`||!w.isPluginAvailable(`YuriVideo`))return null;let i=s(),a=crypto.randomUUID(),l=new Map,u=!1,d=()=>{},f=()=>{},p=async()=>{if(!u){u=!0,d(),f(),r.removeEventListener(`abort`,m);for(let e of l.values())e.abort();l.clear(),await Promise.allSettled([g?.remove(),_n.release({assetId:a})])}},m=()=>{p()},h=async n=>{if(n.assetId!==a||u)return;if(n.cancelled){l.get(n.requestId)?.abort();return}if(l.has(n.requestId))return;let o=new AbortController;l.set(n.requestId,o);let d;try{if(i!==s()||r.aborted)throw Error(`Video runtime changed`);let a=n.method===`HEAD`?`bytes=0-0`:vn(n.range),l=new URLSearchParams(e.split(`?`)[1]??``);(t.query instanceof URLSearchParams?t.query:new URLSearchParams(t.query)).forEach((e,t)=>l.set(t,e));let f=l.get(`path`);d=e.split(`?`)[0]===`/api/fs/raw`&&f?await x({path:f,range:a,signal:o.signal,directory:new Headers(t.headers).get(`x-opencode-directory`)??l.get(`directory`)??void 0,allowOutsideWorkspace:l.get(`allowOutsideWorkspace`)===`true`,outsideFileGrant:l.get(`outsideFileGrant`)??void 0}):await c(e,{...t,headers:{Range:a},signal:o.signal});let p=d.headers.get(`content-range`)||``;if(d.status===416&&/^bytes \*\/\d+$/.test(p)){await _n.respond({requestId:n.requestId,status:416,contentRange:p,dataBase64:``});return}let m=/^bytes (\d+)-(\d+)\/(\d+)$/.exec(p);if(d.status!==206||!m)throw Error(`Host does not support video ranges`);let[h,g,_]=m.slice(1).map(Number),v=g-h+1;if(![h,g,_].every(Number.isSafeInteger)||v<=0||v>1048576||g>=_)throw Error(`Invalid video range response`);let y=d.body?.getReader();if(!y)throw Error(`Missing video response body`);let b=new Uint8Array(v),S=0;try{for(;;){let{done:e,value:t}=await y.read();if(e)break;if(S+t.length>v)throw Error(`Oversized video range`);b.set(t,S),S+=t.length}}finally{await y.cancel().catch(()=>{}),y.releaseLock()}if(S!==v)throw Error(`Truncated video range`);if(u||o.signal.aborted||i!==s())return;let C=d.headers.get(`content-type`)?.split(`;`)[0]||`application/octet-stream`;await _n.respond({requestId:n.requestId,status:n.method===`HEAD`?200:206,contentType:C,contentRange:n.method===`HEAD`?void 0:p,contentLength:n.method===`HEAD`?_:v,dataBase64:n.method===`HEAD`?``:yn(b)})}catch{!u&&!o.signal.aborted&&await _n.respond({requestId:n.requestId,status:502,dataBase64:``}).catch(()=>{})}finally{d?.body&&!d.body.locked&&await d.body.cancel().catch(()=>{}),l.delete(n.requestId)}},g=await _n.addListener(`request`,e=>{h(e)});r.addEventListener(`abort`,m,{once:!0}),d=o(m),f=n(m);try{r.throwIfAborted();let{url:e}=await _n.create({assetId:a});if(u||r.aborted)throw await _n.release({assetId:a}),new DOMException(`Aborted`,`AbortError`);return{url:e,release:p}}catch(e){throw await p(),e}}var xn=`image/png`,Sn=C(`YuriMedia`),Cn=e=>{let t=e.toLowerCase().split(`;`)[0]?.trim()||xn;if(t===`image/jpeg`||t===`image/jpg`)return`jpg`;if(t===`image/webp`)return`webp`;if(t===`image/gif`)return`gif`;if(t===`image/svg+xml`)return`svg`;if(t===`image/png`)return`png`;if(t===`video/quicktime`)return`mov`;let n=t.split(`/`)[1];return n&&/^[a-z0-9.+-]+$/i.test(n)?n:`png`},wn=(e,t)=>{let n=`${t.startsWith(`video/`)?`video`:`image`}.${Cn(t)}`,r=(((e||``).trim()||n).split(/[\\/]/).pop()||n).replace(/[^\w.\- ()[\]]+/g,`_`).replace(/^\.+/,``);return r?/\.[a-z0-9]{1,8}$/i.test(r)?r:`${r}.${Cn(t)}`:n},Tn=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Failed to encode image`))},r.onerror=()=>n(r.error??Error(`Failed to encode image`)),r.readAsDataURL(e)}),En=async e=>{let t=await Tn(e),n=t.indexOf(`,`);return n>=0?t.slice(n+1):t},Dn=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},On=async(e,t,n)=>{if(e.startsWith(`yuri-asset:`)){let r=await y(e,t,n);if(r)return r;if(u())throw Error(`Image display stream is no longer available`)}return b(e,t,n)},kn=async(e,t,n)=>v({path:e,signal:t},n),An=async(e,t,n)=>{let r=e.effectiveDirectory??``,i=null;e.prefetchedBlob&&e.prefetchedBlob.size>0&&(i=e.prefetchedBlob);let a=e.displayUrl?.trim();if(!i&&a&&(!/^https?:/i.test(a)||!G(W(e.sourceUrl,r))))try{i=await On(a,t,n)}catch{t?.throwIfAborted(),i=null,n?.(0)}if(!i){let a=e.sourceUrl.trim();if(!a)throw Error(`Image source is empty`);if(/^(?:data|blob):/i.test(a)||/^https?:/i.test(a)||/^\/api(?=\/|[?#]|$)/.test(a))i=await On(a,t,n);else{let e=W(a,r);i=G(e)?await kn(e.path,t,n):await On(e.source,t,n)}}if(!i||i.size<=0)throw Error(`Image is empty`);n?.(100);let o=(e.mimeType||(i.type&&/^(image|video)\//.test(i.type)?i.type:``)||(e.kind===`video`?`video/mp4`:``)||xn).split(`;`)[0].trim()||xn;return{blob:i,filename:wn(e.filename,o),mimeType:o}},jn=()=>!u()||w===void 0?!1:w.isPluginAvailable(`YuriMedia`),Mn=async(e,t,n)=>{let r=W(e.sourceUrl,e.effectiveDirectory??``);if(l()&&e.kind===`video`&&!jn()){let e=d()?.files;if(G(r)&&e?.downloadFile)return t?.throwIfAborted(),await e.downloadFile(r.path),`saved`;throw Error(`Video download is unavailable for this source in VS Code`)}if(G(r)&&!e.prefetchedBlob&&!/^(?:blob|data|yuri-asset):/i.test(e.displayUrl??``)&&!jn()&&!l())return await O({path:r.path,filename:e.filename,signal:t},n),`downloaded`;let{blob:i,filename:a,mimeType:o}=await An(e,t,n);if(t?.throwIfAborted(),jn()){let n=await En(i);if(t?.throwIfAborted(),e.kind===`video`){if((await Sn.saveFile({dataBase64:n,mimeType:o,filename:a}))?.cancelled)throw new DOMException(`Save cancelled`,`AbortError`);return`saved`}return await Sn.saveImage({dataBase64:n,mimeType:o,filename:a}),`saved`}if(l()){let e=d()?.vscode;if(e?.saveImage){let t=await Tn(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return Dn(i,a),`downloaded`};function Nn(e){let t=(0,X.c)(34),{target:n,isMobile:r}=e,{t:i}=j(),[a,o]=Y.useState(`idle`),[s,c]=Y.useState(0),l=Y.useRef(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>l.current?.abort(),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),Y.useEffect(u,d);let f;t[2]===n?f=t[3]:(f=async()=>{if(l.current)return;let e=new AbortController;l.current=e,o(`saving`),c(0);try{await Mn(n,e.signal,t=>{e.signal.aborted||c(t)}),e.signal.aborted||o(`saved`)}catch(t){let n=t;if(e.signal.aborted)return;l.current=null,o(n instanceof DOMException&&n.name===`AbortError`?`idle`:`error`)}},t[2]=n,t[3]=f);let p=S(f),m=a===`saving`,h=a===`saved`,g;t[4]!==h||t[5]!==m||t[6]!==i||t[7]!==n?(g=i(m?`chat.image.actions.saving`:h?`filesView.editor.saved`:n.kind===`video`?`filesView.editor.saveFile`:`chat.image.actions.saveImage`),t[4]=h,t[5]=m,t[6]=i,t[7]=n,t[8]=g):g=t[8];let _=g,v=r?`ghost`:`mobileGlass`,y=r?`icon`:`mobileIcon`,b=m||h,x;t[9]!==r||t[10]!==_||t[11]!==s||t[12]!==h||t[13]!==m?(x=m?(0,Z.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:r?`size-4`:`size-6`,role:`progressbar`,"aria-label":_,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s??void 0,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:[(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,Z.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,pathLength:`100`,strokeDasharray:`${s??0} 100`,transform:`rotate(-90 12 12)`})]}):h?(0,Z.jsx)(z,{name:`check`,weight:`medium`,className:r?`size-4`:`size-6`}):(0,Z.jsx)(z,{name:`download-2-fill`,className:r?`size-4`:`size-6`}),t[9]=r,t[10]=_,t[11]=s,t[12]=h,t[13]=m,t[14]=x):x=t[14];let C;t[15]!==_||t[16]!==p||t[17]!==m||t[18]!==a||t[19]!==v||t[20]!==y||t[21]!==b||t[22]!==x?(C=(0,Z.jsx)(M,{variant:v,size:y,"data-media-save":a,className:`rounded-full [corner-shape:round] disabled:opacity-100`,"aria-label":_,"aria-busy":m,disabled:b,onClick:p,children:x}),t[15]=_,t[16]=p,t[17]=m,t[18]=a,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=C):C=t[23];let w;t[24]!==_||t[25]!==a||t[26]!==i||t[27]!==n?(w=a===`error`?i(n.kind===`video`?`filesView.toast.saveFailed`:`chat.image.actions.saveFailed`):a===`idle`?``:_,t[24]=_,t[25]=a,t[26]=i,t[27]=n,t[28]=w):w=t[28];let T;t[29]===w?T=t[30]:(T=(0,Z.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:w}),t[29]=w,t[30]=T);let E;return t[31]!==T||t[32]!==C?(E=(0,Z.jsxs)(Z.Fragment,{children:[C,T]}),t[31]=T,t[32]=C,t[33]=E):E=t[33],E}function Pn({video:e,onClose:t,isMobile:n}){let{t:o}=j(),s=le()??``,c=e.directory??s,l=ue(),u=W(e.url,c),d=G(u)?u.path:``,f=/^\/api(?=\/|[?#]|$)/.test(e.url)?e.url:``,p=!!(d||f),m=`${l}\n${c}\n${e.url}`,[h,_]=Y.useState();Y.useEffect(()=>{if(!p)return;let e=new AbortController,t;return bn(f||`/api/fs/raw`,{query:d?{path:d}:void 0},e.signal).then(async n=>{if(e.signal.aborted){await n?.release();return}t=n?.release,_({key:m,url:n?.url,unsupported:!n})}).catch(()=>{e.signal.aborted||_({key:m,error:!0})}),()=>{e.abort(),t?.()}},[p,d,f,m]);let y=h?.key===m?h:void 0,[x,S]=Y.useState(0);Y.useEffect(()=>{if(!p||a())return;let e=r(),t=i(()=>S(e=>e+1));return()=>{t(),e()}},[p,l]);let C=g({queryKey:[`video-preview`,l,c,e.url,x],enabled:p&&y?.unsupported===!0,gcTime:0,staleTime:1/0,retry:!1,queryFn:async({signal:e})=>{if(!a()){let t=await D(f||`/api/fs/raw`,d?{path:d}:void 0);return e.throwIfAborted(),{url:t,blob:void 0}}return{blob:d?await v({path:d,signal:e}):await b(f,e),url:void 0}}}),[w,T]=Y.useState(null);Y.useEffect(()=>{if(!C.data?.blob)return;let e=URL.createObjectURL(C.data.blob);return T({blob:C.data.blob,url:e}),()=>URL.revokeObjectURL(e)},[C.data]);let E=p?y?.url||C.data?.url||(w?.blob===C.data?.blob?w?.url:``):u.source,[O,k]=Y.useState(),A=y?.error||C.isError||!!(E&&O===E);return(0,Z.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-4`,children:[(0,Z.jsx)(un,{onClose:t,isMobile:n}),!E&&!A&&(0,Z.jsx)(`p`,{role:`status`,children:o(`common.loading`)}),A&&(0,Z.jsx)(`p`,{role:`alert`,children:o(`filesView.error.readFileFailed`)}),E&&(0,Z.jsx)(`video`,{src:E,controls:!0,playsInline:!0,preload:`metadata`,"aria-label":e.filename,className:`max-h-[80dvh] w-full max-w-5xl object-contain`,onError:()=>k(E),controlsList:`nodownload`,onContextMenu:e=>e.preventDefault()},E),(0,Z.jsx)(dn,{isMobile:n,children:(0,Z.jsx)(Nn,{isMobile:n,target:{kind:`video`,sourceUrl:e.url,displayUrl:y?.url||C.data?.url?void 0:E,filename:e.filename,mimeType:e.mimeType,effectiveDirectory:c,prefetchedBlob:C.data?.blob}},m)})]})}var Fn=e({default:()=>Zn}),In=400,Ln=(e,t,n)=>{e&&e.style[t]!==n&&(e.style[t]=n)},Rn=(e,t)=>new At(e,t),zn=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,Z.jsx)(z,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,Z.jsx)(z,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,Z.jsx)(z,{name:`file-list-2`,className:t}):n===`edit`||n===`multiedit`||n===`apply_patch`||n===`str_replace`||n===`str_replace_based_edit_tool`?(0,Z.jsx)(z,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,Z.jsx)(z,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,Z.jsx)(z,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,Z.jsx)(z,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,Z.jsx)(z,{name:`search`,className:t}):n===`glob`?(0,Z.jsx)(z,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,Z.jsx)(z,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,Z.jsx)(z,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,Z.jsx)(Ce,{className:N(`text-current`,t)}):n.startsWith(`git`)?(0,Z.jsx)(z,{name:`git-branch`,className:t}):(0,Z.jsx)(z,{name:`tools`,className:t})},Bn={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},Vn={download:!1,copy:!1,showPanZoomControls:!0},Hn=`
9
- [data-diff-header],
10
- [data-diff] {
11
- [data-separator] {
12
- height: 24px !important;
13
- }
14
- }
15
- `,Un={hunkLineCount:50,lineHeight:24,diffHeaderHeight:44,hunkSeparatorHeight:24,spacing:0},Wn=()=>{let e=(0,X.c)(22),t=F(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=ne(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=ne(!0),e[1]=i):i=e[1];let a=i,o;e[2]===t?.availableThemes?o=e[3]:(o=()=>t?.availableThemes??[r,a],e[2]=t?.availableThemes,e[3]=o),t?.availableThemes;let s;e[4]===o?s=e[5]:(s=o(),e[4]=o,e[5]=s);let c=s,l=t?.lightThemeId??r.metadata.id,u=t?.darkThemeId??a.metadata.id,d;e[6]!==c||e[7]!==l?(d=c.find(e=>e.metadata.id===l)??r,e[6]=c,e[7]=l,e[8]=d):d=e[8];let f=d,p;e[9]!==c||e[10]!==u?(p=c.find(e=>e.metadata.id===u)??a,e[9]=c,e[10]=u,e[11]=p):p=e[11];let m=p,h,g;e[12]!==m||e[13]!==f?(h=()=>{ae(f),ae(m)},g=[m,f],e[12]=m,e[13]=f,e[14]=h,e[15]=g):(h=e[14],g=e[15]),Y.useEffect(h,g);let _=t?.currentTheme.metadata.variant??`light`,v;e[16]!==m.metadata.id||e[17]!==f.metadata.id?(v={light:f.metadata.id,dark:m.metadata.id},e[16]=m.metadata.id,e[17]=f.metadata.id,e[18]=v):v=e[18];let y=_===`dark`?`dark`:`light`,b;return e[19]!==v||e[20]!==y?(b={theme:v,themeType:y},e[19]=v,e[20]=y,e[21]=b):b=e[21],b},Gn=()=>({width:typeof window<`u`?window.innerWidth:0,height:typeof window<`u`?window.innerHeight:0}),Kn=e=>{let t=(0,X.c)(3),[n,r]=Y.useState(Gn),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e||typeof window>`u`)return;let t=()=>{r(Gn())};return t(),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t)}},a=[e],t[0]=e,t[1]=i,t[2]=a),Y.useEffect(i,a),n},qn=({popup:e,onOpenChange:t,isMobile:n})=>{let{t:r}=j(),i=F(),a=le()??``,o=e.image?.directory??a,s=Y.useMemo(()=>{let t=e.image;if(!t)return[];let n=Array.isArray(t.gallery)?t.gallery.filter(e=>!!e?.url):[];return n.length>0?n:[{url:t.url,mimeType:t.mimeType,filename:t.filename,size:t.size}]},[e.image]),[c,l]=Y.useState(()=>{let t=e.image?.index??s.findIndex(t=>t.url===e.image?.url);return t>=0&&t<s.length?t:0}),u=e.previewSource instanceof HTMLImageElement?e.previewSource:void 0,[d,f]=Y.useState(null),p=d?.naturalSize,m=e.open,h=Kn(e.open),g=Y.useRef(null),_=Y.useRef(null),v=Y.useRef(null),y=Y.useRef(null),b=Y.useRef(null),x=Y.useRef(null),C=Y.useRef(null),[w]=Y.useState(()=>({trackX:R(0),dismissX:R(0),dismissY:R(0)})),T=Y.useRef(null),E=Y.useRef(null),D=Y.useRef(null),O=Y.useRef(null),k=Y.useRef({scale:1,x:0,y:0}),A=Y.useRef({image:{width:1,height:1},viewport:{width:1,height:1},maxScale:5}),P=Y.useRef(new Map),B=Y.useRef(null),V=Y.useRef(null),te=Y.useRef(null),ne=Y.useRef(0);Y.useEffect(()=>{e.open&&(ne.current=typeof performance<`u`?performance.now():Date.now())},[e.open]);let re=S(()=>(typeof performance<`u`?performance.now():Date.now())-ne.current<In);Y.useEffect(()=>{if(!e.open||s.length===0)return;let t=typeof e.image?.index==`number`?e.image.index:-1;if(t>=0&&t<s.length){l(t);return}let n=e.image?.url?s.findIndex(t=>t.url===e.image?.url):-1;l(n>=0?n:0)},[s,e.image?.index,e.image?.url,e.open]);let H=s[c]??s[0]??e.image,ie=d?.source??``,ae=d?.resourceKey??``,U=s.length>1,oe=n&&U?Array.from(new Set([(c-1+s.length)%s.length,c,(c+1)%s.length])):[c],se=e=>{v.current=e.element,f(t=>t?.element===e.element&&t.source===e.source&&t.resourceKey===e.resourceKey&&t.loaded===e.loaded&&t.error===e.error&&t.naturalSize?.width===e.naturalSize?.width&&t.naturalSize?.height===e.naturalSize?.height?t:e)},ce=S(()=>{s.length<=1||l(e=>(e-1+s.length)%s.length)}),W=S(()=>{s.length<=1||l(e=>(e+1)%s.length)}),ue=Y.useMemo(()=>{let e={width:Math.max(1,h.width*(n?1:.8)),height:Math.max(1,h.height*(n?1:.95))};return p?Vt(p,e):e},[p,n,h.height,h.width]),G=Y.useMemo(()=>({image:ue,viewport:{width:Math.max(1,h.width),height:Math.max(1,h.height)},maxScale:5}),[ue,h.height,h.width]),de=S(()=>{let e=te.current;te.current=null,e&&(v.current&&(v.current.style.transition=e.animate?`transform 180ms cubic-bezier(0.22, 1, 0.36, 1)`:`none`,v.current.style.transform=`translate3d(${e.transform.x}px, ${e.transform.y}px, 0) scale(${e.transform.scale})`),O.current&&(O.current.textContent=`${Math.round(e.transform.scale*100)}%`),g.current&&(g.current.style.cursor=e.transform.scale>1?`grab`:`zoom-in`));let t=w.trackX.get(),n=w.dismissY.get(),r=qt(n,A.current.viewport.height),i=y.current;Ln(i,`transform`,`translate3d(${t}px, 0, 0)`),i&&s.length===2&&Ln(i.querySelector(`[data-image-viewer-slide]:not([data-image-viewer-slide="0"])`),`transform`,`translate3d(${(t>0?-1:1)*(h.width+16)}px, 0, 0)`),Ln(b.current,`transform`,`translate3d(${w.dismissX.get()}px, ${n}px, 0) scale(${r.scale})`),Ln(C.current,`opacity`,`${r.opacity}`),Ln(x.current,`opacity`,`${r.opacity}`)}),fe=S(()=>ee.render(de)),K=S(()=>{I(de),de()}),q=S((e,t=!1,n=null)=>{let r=Ht(e,A.current);k.current=r,te.current={transform:r,animate:t},w.trackX.jump(n?.galleryX??0),w.dismissX.jump(n?.dismissX??0),w.dismissY.jump(n?.dismissY??0),fe()}),J=S(()=>{let e=T.current;T.current=null,e?.animations.forEach(e=>e.stop())}),pe=S(()=>{D.current!==null&&clearTimeout(D.current),D.current=null}),X=S((e,t={x:0,y:0})=>{J(),K();let n=e===`next`?-(h.width+16):e===`previous`?h.width+16:0,r=()=>{e===`next`?W():e===`previous`?ce():(q(k.current),K())},i=[[w.trackX,n,t.x],[w.dismissX,0,t.x*Gt],[w.dismissY,0,t.y]].filter(([e,t])=>Math.abs(e.get()-t)>.5);if(i.length===0||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){r();return}let a=i.map(([t,n,r])=>{let i=r*(n-t.get())>0?r*1e3:0;return L(t,n,{type:`spring`,bounce:0,visualDuration:e===`none`?.32:.26,velocity:i,restDelta:1,restSpeed:60,onUpdate:fe})}),o={animations:a};T.current=o,Promise.all(a.map(e=>e.finished)).then(()=>{T.current===o&&(T.current=null,_.current?.closest(`[data-media-preview-closing]`)||r())},()=>{T.current===o&&(T.current=null,q(k.current),K())})}),me=S((e=!0)=>{J(),q({scale:1,x:0,y:0},e)}),Q=S(()=>({x:A.current.viewport.width/2,y:A.current.viewport.height/2})),$=S((e,t,n=!1)=>{J(),q(Ut(k.current,e,t,Q(),A.current),n)}),he=S(e=>{if(k.current.scale>1.01){me(!0);return}$(2,e,!0)}),ge=S(e=>{if(pe(),Qt(E.current,e)){E.current=null,he(e);return}E.current=e,!re()&&(D.current=setTimeout(()=>{D.current=null,E.current=null,on(e,()=>t(!1))},Zt))}),_e=S(e=>{if(!(n||e.defaultPrevented)){if(e.key===`+`||e.key===`=`){e.preventDefault(),$(k.current.scale*1.4,Q(),!0);return}if(e.key===`-`||e.key===`_`){e.preventDefault(),$(k.current.scale/1.4,Q(),!0);return}if(e.key===`0`){e.preventDefault(),me(!0);return}if(e.key===`ArrowLeft`&&U){e.preventDefault(),ce();return}e.key===`ArrowRight`&&U&&(e.preventDefault(),W())}});Y.useEffect(()=>{if(e.open)return window.addEventListener(`keydown`,_e),()=>{window.removeEventListener(`keydown`,_e)}},[e.open]),Y.useLayoutEffect(()=>{I(de),te.current=null,J(),pe(),E.current=null,w.trackX.jump(0),w.dismissX.jump(0),w.dismissY.jump(0),k.current={scale:1,x:0,y:0},P.current.clear(),B.current=null,V.current=null,y.current?.querySelectorAll(`img`).forEach(e=>{e.style.transition=`none`,e.style.transform=`translate3d(0, 0, 0) scale(1)`}),y.current&&(y.current.style.transform=`translate3d(0, 0, 0)`),b.current&&(b.current.style.transform=`none`),C.current=_.current?.closest(`[data-media-preview]`)?.querySelector(`[data-media-preview-backdrop]`)??null,C.current&&(C.current.style.opacity=`1`),x.current&&(x.current.style.opacity=`1`),O.current&&(O.current.textContent=`100%`)},[c,o,e.image?.url,w]),Y.useLayoutEffect(()=>{let e=A.current.viewport.width!==G.viewport.width||A.current.viewport.height!==G.viewport.height;A.current=G;let t=Ht(k.current,A.current);k.current=t,v.current&&(v.current.style.transition=`none`,v.current.style.transform=`translate3d(${t.x}px, ${t.y}px, 0) scale(${t.scale})`),e&&(J(),P.current.clear(),B.current=null,V.current=null,q(t),K())},[G,J,q,K]),Y.useEffect(()=>()=>{J(),pe(),I(de),te.current=null},[]);let ve=S(e=>{if(n)return;e.preventDefault();let t={x:e.clientX,y:e.clientY},r=Math.exp(-e.deltaY*.002);$(k.current.scale*r,t)});Y.useEffect(()=>{let e=g.current;if(!(!m||n||!e))return e.addEventListener(`wheel`,ve,{passive:!1}),()=>e.removeEventListener(`wheel`,ve)},[n,m]),Y.useEffect(()=>{let e=g.current;if(!(!m||!n||!e))return rt(e)},[n,m]);let ye=S(e=>{n||(e.preventDefault(),he({x:e.clientX,y:e.clientY}))}),be=S(e=>{e.preventDefault(),e.stopPropagation()}),xe=S(e=>{e.pointerType!==`mouse`&&e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t={x:e.clientX,y:e.clientY};P.current.set(e.pointerId,{point:t,pointerType:e.pointerType});let r=T.current!==null;if(J(),pe(),P.current.size===1){let i=t,a=null,o=w.trackX.get(),s=w.dismissY.get(),c=r&&n&&e.pointerType!==`mouse`&&k.current.scale<=1.01;c&&Math.abs(o)>.5?(a=`x`,i={x:t.x-o,y:t.y}):c&&s>.5?(a=`y`,i={x:t.x-w.dismissX.get()/Gt,y:t.y-s}):r&&(q(k.current),K()),B.current={pointerId:e.pointerId,pointerType:e.pointerType,start:i,transform:k.current,moved:a!==null,targetWasCanvas:e.target===e.currentTarget,suppressTap:!1,axis:a,samples:[{...t,time:e.timeStamp}]},g.current&&k.current.scale>1&&(g.current.style.cursor=`grabbing`);return}B.current&&(B.current.suppressTap=!0),q(k.current),K();let i=Array.from(P.current.values()).slice(0,2).map(e=>e.point),a=i[1].x-i[0].x,o=i[1].y-i[0].y;V.current={distance:Math.max(1,Math.hypot(a,o)),midpoint:{x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2},transform:k.current},B.current&&(B.current.suppressTap=!0)}),Se=S(e=>{if(!P.current.has(e.pointerId))return;e.preventDefault();let t={x:e.clientX,y:e.clientY};if(P.current.set(e.pointerId,{point:t,pointerType:e.pointerType}),P.current.size>=2&&V.current){let e=Array.from(P.current.values()).slice(0,2).map(e=>e.point),t=e[1].x-e[0].x,n=e[1].y-e[0].y,r={x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},i=V.current.transform.scale*Math.hypot(t,n)/V.current.distance;q(en(V.current.transform,V.current.midpoint,r,i,Q(),A.current));return}let r=B.current;if(!r||r.pointerId!==e.pointerId)return;let i={x:t.x-r.start.x,y:t.y-r.start.y};for(r.samples.push({...t,time:e.timeStamp});r.samples.length>2&&e.timeStamp-r.samples[0].time>100;)r.samples.shift();if(Math.hypot(i.x,i.y)>10&&(r.moved=!0),n&&r.pointerType!==`mouse`&&!r.suppressTap){let e=Yt(r.transform,i,A.current,r.axis,U);r.axis=e.axis,q(e.transform,!1,e)}else r.transform.scale>1.01&&q(Wt(r.transform,i,A.current))}),Ce=S((e,r)=>{let i=B.current,a=P.current.get(e.pointerId);if(!a)return;let o=a?{x:e.clientX,y:e.clientY}:void 0;P.current.delete(e.pointerId);let s;if(i?.pointerId===e.pointerId&&o){let t={x:o.x-i.start.x,y:o.y-i.start.y},a=i.moved||Math.hypot(t.x,t.y)>10;if(n&&i.pointerType!==`mouse`&&!i.suppressTap&&a){let n=Yt(i.transform,t,A.current,i.axis,U);q(n.transform,!1,n);let a=Xt([...i.samples,{...o,time:e.timeStamp}]),c=r?`none`:$t(n,a,A.current.viewport);c===`close`&&!re()?s=o:X(c===`close`?`none`:c,a)}else{let t=Bt({isMobile:n,pointerType:i.pointerType,cancelled:r,moved:a,suppressTap:i.suppressTap,targetWasCanvas:i.targetWasCanvas,start:i.start,end:o,startScale:i.transform.scale,hasMultipleImages:U});t===`next`&&W(),t===`previous`&&ce(),t===`close`&&n&&i.pointerType!==`mouse`?ge({...o,time:e.timeStamp}):t===`close`&&!re()&&(s=o)}}if(P.current.size===1){let[t,n]=Array.from(P.current.entries())[0];B.current={pointerId:t,pointerType:n.pointerType,start:n.point,transform:k.current,moved:!1,targetWasCanvas:!1,suppressTap:!0,axis:null,samples:[{...n.point,time:e.timeStamp}]},V.current=null}else P.current.size===0&&(B.current=null,V.current=null,g.current&&(g.current.style.cursor=k.current.scale>1?`grab`:`zoom-in`));e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),s&&(K(),n&&i?.pointerType!==`mouse`?on(s,()=>t(!1)):t(!1))}),we=S(e=>{e.preventDefault(),e.stopPropagation(),B.current&&(B.current.suppressTap=!0)});if(!m||!H||typeof document>`u`)return null;let Te=i?.currentTheme.metadata.variant===`dark`?`text-foreground hover:bg-foreground/15 hover:text-foreground`:`text-background hover:bg-background/15 hover:text-background`;return(0,Z.jsxs)(`div`,{ref:_,className:`absolute inset-0 overflow-hidden select-none`,tabIndex:-1,onClick:be,children:[(0,Z.jsx)(`div`,{ref:g,"data-image-viewer-canvas":``,className:`absolute inset-0 flex items-center justify-center overflow-hidden touch-none [overscroll-behavior:none]`,onDoubleClick:n?void 0:ye,onContextMenu:we,onPointerDown:xe,onPointerMove:Se,onPointerUp:e=>Ce(e,!1),onPointerCancel:e=>Ce(e,!0),onLostPointerCapture:e=>Ce(e,!0),children:(0,Z.jsx)(`div`,{ref:b,"data-image-viewer-dismiss":``,className:`pointer-events-none absolute inset-0 will-change-transform`,children:(0,Z.jsx)(`div`,{ref:y,"data-image-viewer-track":``,className:`pointer-events-none absolute inset-0 will-change-transform`,children:oe.map(t=>{let r=s[t];if(!r)return null;let i=t===c,a=i?0:s.length===2||t===(c+1)%s.length?1:-1;return(0,Z.jsx)(tn,{url:r.url,directory:o,label:r.filename||e.title,active:i,returnToSource:r.url===e.image?.url,sourceElement:r.url===e.image?.url?u:void 0,viewport:h,isMobile:n,position:a,onActiveImage:se},`${t}\n${r.url}`)})})})}),(0,Z.jsxs)(`div`,{ref:x,className:`pointer-events-none absolute inset-0 [&_button]:pointer-events-auto`,children:[(0,Z.jsx)(un,{onClose:()=>t(!1),isMobile:n,size:ue}),(0,Z.jsxs)(dn,{isMobile:n,children:[U&&(0,Z.jsxs)(`span`,{"data-media-gallery-counter":``,className:`min-w-10 px-1 text-center typography-micro tabular-nums opacity-80`,children:[c+1,` / `,s.length]}),U&&(0,Z.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-current opacity-15`,"aria-hidden":`true`}),(0,Z.jsx)(M,{variant:n?`ghost`:`mobileGlass`,size:n?`icon`:`mobileIcon`,className:N(`rounded-full`,n&&`size-8`,n&&Te),onClick:()=>$(k.current.scale/1.4,Q(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomOutAria`),title:r(`chat.toolOutputDialog.image.zoomOutAria`),children:(0,Z.jsx)(z,{name:`subtract`,weight:`medium`,className:n?`size-4`:`size-6`})}),(0,Z.jsxs)(M,{variant:n?`ghost`:`mobileGlass`,size:n?`sm`:`lg`,"data-media-zoom-reset":``,className:N(`rounded-full tabular-nums`,n?`min-w-12`:`min-w-20`,n&&Te),onClick:()=>me(!0),"aria-label":r(`chat.toolOutputDialog.image.resetZoomAria`),title:r(`chat.toolOutputDialog.image.resetZoomAria`),children:[(0,Z.jsx)(z,{name:`restart`,weight:`medium`,className:n?`size-3.5`:`size-5`}),(0,Z.jsx)(`span`,{ref:O,children:`100%`})]}),(0,Z.jsx)(M,{variant:n?`ghost`:`mobileGlass`,size:n?`icon`:`mobileIcon`,className:N(`rounded-full`,n&&`size-8`,n&&Te),onClick:()=>$(k.current.scale*1.4,Q(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomInAria`),title:r(`chat.toolOutputDialog.image.zoomInAria`),children:(0,Z.jsx)(z,{name:`add`,weight:`medium`,className:n?`size-4`:`size-6`})}),(0,Z.jsx)(Nn,{isMobile:n,target:{sourceUrl:H.url||ie,displayUrl:ie||void 0,filename:H.filename||e.image?.filename||e.title,mimeType:H.mimeType||e.image?.mimeType,effectiveDirectory:o}},ae)]})]})]})},Jn=Y.memo(e=>{let t=(0,X.c)(7),{popup:n,diffViewMode:r,pierreThemeConfig:i}=e,a=n.content||``,o=r===`unified`?`unified`:`split`,s;t[0]!==i.theme||t[1]!==i.themeType||t[2]!==o?(s={diffStyle:o,diffIndicators:`none`,hunkSeparators:`line-info-basic`,lineDiffType:`none`,disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:`wrap`,theme:i.theme,themeType:i.themeType,unsafeCSS:Hn},t[0]=i.theme,t[1]=i.themeType,t[2]=o,t[3]=s):s=t[3];let c;return t[4]!==a||t[5]!==s?(c=(0,Z.jsx)(`div`,{className:`typography-code`,children:(0,Z.jsx)(A,{patch:a,metrics:Un,options:s,className:`block w-full`})}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c});Jn.displayName=`DialogUnifiedDiff`;var Yn=Y.memo(e=>{let t=(0,X.c)(29),{popup:n,pierreThemeConfig:r}=e,i;t[0]===n.content?i=t[1]:(i=We(n.content),t[0]=n.content,t[1]=i);let a=i,o=n.metadata?.input,s;t[2]===o?s=t[3]:(s=typeof o==`object`&&o?o:{},t[2]=o,t[3]=s);let c=s,l=typeof c.offset==`number`?c.offset:0,u=typeof c.file_path==`string`?c.file_path:typeof c.filePath==`string`?c.filePath:typeof c.path==`string`?c.path:`read-output`,d;t[4]===a.lines?d=t[5]:(d=a.lines.map(Qn).join(`
16
- `),t[4]=a.lines,t[5]=d);let f=d,p;t[6]!==u||t[7]!==n.language?(p=n.language||oe(u)||`text`,t[6]=u,t[7]=n.language,t[8]=p):p=t[8];let m=p,h;t[9]===a.lines?h=t[10]:(h=a.lines.some($n),t[9]=a.lines,t[10]=h);let g=h,_;if(t[11]!==g||t[12]!==l||t[13]!==a.lines||t[14]!==a.type){_=[];let e=l;for(let t of a.lines){t.lineNumber!==null&&(e=t.lineNumber);let n=a.type===`file`&&!g&&t.lineNumber===null&&!t.isInfo,r=t.lineNumber??(n?e+1:null);typeof r==`number`&&(e=r),_.push({text:t.text,lineNumber:r,isInfo:t.isInfo})}t[11]=g,t[12]=l,t[13]=a.lines,t[14]=a.type,t[15]=_}else _=t[15];let v=_;if(a.type===`file`){let e=m||void 0,n;t[16]!==f||t[17]!==u||t[18]!==e?(n={name:u,contents:f,lang:e},t[16]=f,t[17]=u,t[18]=e,t[19]=n):n=t[19];let i;t[20]!==r.theme||t[21]!==r.themeType?(i={disableFileHeader:!0,overflow:`wrap`,theme:r.theme,themeType:r.themeType},t[20]=r.theme,t[21]=r.themeType,t[22]=i):i=t[22];let a;return t[23]!==n||t[24]!==i?(a=(0,Z.jsx)(k,{file:n,options:i,className:`block w-full`}),t[23]=n,t[24]=i,t[25]=a):a=t[25],a}let y;return t[26]!==v||t[27]!==m?(y=(0,Z.jsx)(st,{lines:v,language:m,maxHeight:`70vh`}),t[26]=v,t[27]=m,t[28]=y):y=t[28],y});Yn.displayName=`DialogReadContent`;var Xn=({popup:e,onOpenChange:t,isMobile:n})=>{let r=_(),i=r?.entry.location.hostId?r.entry:void 0,{t:a}=j(),o=F(),s=Y.useMemo(()=>o?.currentTheme.metadata.variant===`dark`?o.currentTheme:o?.availableThemes.find(e=>e.metadata.id===o.darkThemeId&&e.metadata.variant===`dark`)??ne(!0),[o?.currentTheme,o?.availableThemes,o?.darkThemeId]),[c,l]=Y.useState(e.mermaid?.source||``),[u,d]=Y.useState(e.mermaid?.source?`ready`:`idle`),[f,p]=Y.useState(``),m=Y.useRef(0),h=Y.useCallback(e=>{let t=e.trim();if(!t.toLowerCase().startsWith(`file://`))return null;let n=e=>{if(!e||/[\0\r\n]/.test(e))return!1;let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).includes(`..`)?!1:t.startsWith(`/`)?!0:/^[A-Za-z]:\//.test(t)},r=e=>e.replace(/%([0-9A-Fa-f]{2})/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isFinite(n)?String.fromCharCode(n):`%${t}`});if(typeof URL.canParse==`function`&&URL.canParse(t)){let e=r(new URL(t).pathname||``);return/^\/[A-Za-z]:\//.test(e)&&(e=e.slice(1)),n(e)?e:null}let i=t.replace(/^file:\/\//i,``),a=r(i);return n(a)?a:n(i)?i:null},[]),g=Y.useCallback(async()=>{let t=e.mermaid,n=Nt(m.current);if(m.current=n,!t?.url){d(`error`),p(a(`chat.toolOutputDialog.mermaid.missingSource`));return}if(t.source){l(t.source),d(`ready`),p(``);return}d(`loading`),p(``);let r;if(t.url.startsWith(`data:`))r=It(t.url);else if(t.url.toLowerCase().startsWith(`file://`)){let e=h(t.url);r=e?x({path:e,scope:i}).then(e=>e.ok?e.text():Promise.reject(Rn(`chat.toolOutputDialog.mermaid.readFileFailedWithStatus`,{status:e.status}))):Promise.reject(Rn(`chat.toolOutputDialog.mermaid.invalidLocalPath`))}else{let e=typeof URL.canParse==`function`&&URL.canParse(t.url,window.location.origin)?new URL(t.url,window.location.origin):null;r=!e||e.protocol!==`http:`&&e.protocol!==`https:`?Promise.reject(Rn(`chat.toolOutputDialog.mermaid.unsupportedUrlProtocol`)):fetch(e.toString()).then(e=>e.ok?e.text():Promise.reject(Rn(`chat.toolOutputDialog.mermaid.loadFailedWithStatus`,{status:e.status})))}await r.then(e=>{Pt(m.current,n)&&(l(e),d(`ready`))}).catch(e=>{Pt(m.current,n)&&(d(`error`),p(Mt(e)?a(e.key,e.params):a(`chat.toolOutputDialog.mermaid.loadFailed`)))})},[h,e.mermaid,a,i]);Y.useEffect(()=>{!e.open||!e.mermaid||g()},[g,e.mermaid,e.open]);let v=`\`\`\`mermaid\n${c}\n\`\`\``;return!e.open||typeof document>`u`?null:(0,Z.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.target===e.currentTarget&&t(!1)},children:(0,Z.jsxs)(`div`,{"data-mermaid-preview":`true`,"data-preview-transition-target":``,className:`relative flex min-h-0 flex-col overflow-hidden`,style:{width:n?`100%`:`80%`,height:n?`100%`:`95%`},onMouseDown:e=>e.stopPropagation(),children:[(0,Z.jsx)(un,{onClose:()=>t(!1),isMobile:n}),(0,Z.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsxs)(`div`,{className:`h-full overflow-hidden`,children:[u===`loading`&&(0,Z.jsxs)(`div`,{className:`h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta`,children:[(0,Z.jsx)(z,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(`span`,{children:a(`chat.toolOutputDialog.mermaid.loading`)})]}),u===`error`&&(0,Z.jsxs)(`div`,{className:`rounded-xl border p-3 space-y-3`,style:{backgroundColor:`var(--status-error-background)`,borderColor:`var(--status-error-border)`},children:[(0,Z.jsx)(`p`,{className:`typography-markdown`,style:{color:`var(--status-error)`},children:f||a(`chat.toolOutputDialog.mermaid.renderFailed`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{g()},className:`px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]`,style:{borderColor:`var(--interactive-border)`,color:`var(--surface-foreground)`},children:a(`chat.toolOutputDialog.mermaid.retry`)})]}),u===`ready`&&(0,Z.jsx)(`div`,{className:`h-full`,children:(0,Z.jsx)(H,{content:v,variant:`tool`,allowMermaidWheelEvents:!0,className:`markdown-mermaid-fullscreen h-full`,mermaidControls:Vn,mermaidTheme:s,enableFileReferences:!1})})]})})]})})},Zn=e=>{let t=(0,X.c)(52),{popup:n,onOpenChange:r,isMobile:i}=e,{t:a}=j(),[o,s]=Y.useState(`unified`),c=Wn(),l;t[0]===n.open?l=t[1]:(l=()=>{n.open&&s(`unified`)},t[0]=n.open,t[1]=l);let u;t[2]!==n.open||t[3]!==n.title?(u=[n.open,n.title],t[2]=n.open,t[3]=n.title,t[4]=u):u=t[4],Y.useEffect(l,u);let d=n.video??(n.image&&re(n.image.url,n.image.mimeType)?n.image:void 0);if(n.image||n.mermaid||d){let e=d?`video`:n.image?`image`:`mermaid`,a;t[5]!==i||t[6]!==n||t[7]!==d?(a=e=>(0,Z.jsx)(Z.Fragment,{children:d?(0,Z.jsx)(Pn,{video:d,onClose:e,isMobile:i}):n.image?(0,Z.jsx)(qn,{popup:n,onOpenChange:e,isMobile:i}):(0,Z.jsx)(Xn,{popup:n,onOpenChange:e,isMobile:i})}),t[5]=i,t[6]=n,t[7]=d,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==r||t[11]!==n.open||t[12]!==n.previewSource||t[13]!==n.title||t[14]!==e||t[15]!==a?(o=(0,Z.jsx)(mn,{open:n.open,title:n.title,kind:e,source:n.previewSource,isMobile:i,onOpenChange:r,children:a}),t[9]=i,t[10]=r,t[11]=n.open,t[12]=n.previewSource,t[13]=n.title,t[14]=e,t[15]=a,t[16]=o):o=t[16],o}let f=n.open,p=i?`w-[95vw] max-w-[95vw]`:`max-w-5xl`,m=i?`[&>button]:right-1`:`[&>button]:top-2.5 [&>button]:right-4`,h;t[17]!==p||t[18]!==m?(h=N(`overflow-hidden flex flex-col min-h-0 pt-3 pb-4 px-4 gap-1`,`[&>button]:top-1.5`,p,m),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`90vh`},t[20]=g):g=t[20];let _;t[21]===n.metadata?_=t[22]:(_=n.metadata?.tool?zn(n.metadata.tool):(0,Z.jsx)(z,{name:`tools`,className:`h-3.5 w-3.5 text-foreground flex-shrink-0`}),t[21]=n.metadata,t[22]=_);let v;t[23]===n.title?v=t[24]:(v=(0,Z.jsx)(`span`,{className:`break-words flex-1 leading-tight`,children:n.title}),t[23]=n.title,t[24]=v);let y;t[25]!==o||t[26]!==n.isDiff?(y=n.isDiff&&(0,Z.jsx)(tt,{mode:o,onModeChange:s,className:`mr-8 flex-shrink-0`}),t[25]=o,t[26]=n.isDiff,t[27]=y):y=t[27];let b;t[28]!==y||t[29]!==_||t[30]!==v?(b=(0,Z.jsx)(`div`,{className:`flex-shrink-0 pb-1`,children:(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 text-foreground typography-ui-header font-semibold`,children:[_,v,y]})}),t[28]=y,t[29]=_,t[30]=v,t[31]=b):b=t[31];let x;t[32]!==c||t[33]!==n.metadata?(x=n.metadata?.input&&typeof n.metadata.input==`object`&&Object.keys(n.metadata.input).length>0&&n.metadata?.tool!==`todowrite`&&n.metadata?.tool!==`todoread`&&n.metadata?.tool!==`apply_patch`?(()=>{let e=n.metadata,t=e.input,r=e=>{let n=t[e];return typeof n==`string`?n:typeof n==`number`?String(n):null};return(0,Z.jsxs)(`div`,{className:`border-b border-border/20 p-4 -mx-3`,children:[(0,Z.jsx)(`div`,{className:`typography-markdown font-medium text-muted-foreground mb-2 px-3`,children:e.tool===`bash`||e.tool===`shell`?`Command:`:e.tool===`task`||e.tool===`subagent`?`Task Details:`:`Input:`}),(e.tool===`bash`||e.tool===`shell`)&&r(`command`)?(0,Z.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Z.jsx)(Pe,{language:`bash`,code:r(`command`),style:E.getPopupStyles(),codeStyle:Bn.style,wrap:!0})}):(e.tool===`task`||e.tool===`subagent`)&&r(`prompt`)?(0,Z.jsxs)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:E.getPopupStyles(),children:[r(`description`)?`Task: ${r(`description`)}\n`:``,r(`subagent_type`)||r(`agent`)?`Agent Type: ${r(`subagent_type`)||r(`agent`)}\n`:``,`Instructions:\n${r(`prompt`)}`]}):e.tool===`write`&&r(`content`)?(0,Z.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Z.jsx)(k,{file:{name:r(`filePath`)||r(`file_path`)||`new-file`,contents:r(`content`),lang:oe(r(`filePath`)||r(`file_path`)||``)||void 0},options:{disableFileHeader:!0,overflow:`wrap`,theme:c.theme,themeType:c.themeType},className:`block w-full`})}):(0,Z.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:E.getPopupStyles(),children:ze(t,e.tool)})]})})():null,t[32]=c,t[33]=n.metadata,t[34]=x):x=t[34];let S;t[35]!==o||t[36]!==i||t[37]!==c||t[38]!==n||t[39]!==a?(S=n.isDiff?(0,Z.jsx)(Jn,{popup:n,diffViewMode:o,pierreThemeConfig:c}):n.content?(0,Z.jsx)(`div`,{className:`p-4`,children:(()=>{let e=n.metadata?.tool;return e===`todowrite`||e===`todoread`?Ze(n.content)||(0,Z.jsx)(Pe,{language:`json`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:Bn.style,wrap:!0}):e===`list`?Ge(n.content)||(0,Z.jsx)(`pre`,{className:`typography-markdown bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`grep`?qe(n.content,i)||(0,Z.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`glob`?Ye(n.content,i)||(0,Z.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`task`||e===`subagent`||e===`reasoning`?(0,Z.jsx)(`div`,{className:e===`reasoning`?`text-muted-foreground/70`:``,children:(0,Z.jsx)(H,{content:n.content,variant:`tool`})}):e===`web-search`||e===`websearch`||e===`search_web`?Qe(n.content)||(0,Z.jsx)(Pe,{language:`text`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:Bn.style,wrap:!0}):e===`read`?(0,Z.jsx)(Yn,{popup:n,pierreThemeConfig:c}):(n.content?He(n.content):{data:null,isJson:!1}).isJson?(0,Z.jsx)(kt,{jsonString:n.content,initiallyExpandedDepth:3,maxHeight:`70vh`}):(0,Z.jsx)(Pe,{language:n.language||`text`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:Bn.style,wrap:!0})})()}):(0,Z.jsxs)(`div`,{className:`p-8 text-muted-foreground typography-ui-header`,children:[(0,Z.jsx)(`div`,{className:`mb-2`,children:a(`chat.toolOutputDialog.commandCompleted`)}),(0,Z.jsx)(`div`,{className:`typography-meta`,children:a(`chat.toolOutputDialog.noOutputProduced`)})]}),t[35]=o,t[36]=i,t[37]=c,t[38]=n,t[39]=a,t[40]=S):S=t[40];let C;t[41]!==x||t[42]!==S?(C=(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-border/30 bg-muted/10 overflow-hidden`,children:(0,Z.jsxs)(`div`,{className:`tool-output-surface h-full max-h-[75vh] overflow-y-auto px-3 pr-4`,children:[x,S]})}),t[41]=x,t[42]=S,t[43]=C):C=t[43];let w;t[44]!==b||t[45]!==C||t[46]!==h?(w=(0,Z.jsxs)(B,{className:h,style:g,children:[b,C]}),t[44]=b,t[45]=C,t[46]=h,t[47]=w):w=t[47];let T;return t[48]!==r||t[49]!==n.open||t[50]!==w?(T=(0,Z.jsx)(V,{open:f,onOpenChange:r,children:w}),t[48]=r,t[49]=n.open,t[50]=w,t[51]=T):T=t[51],T};function Qn(e){return e.text}function $n(e){return e.lineNumber!==null}export{Ce as _,tt as a,Ue as c,Ze as d,He as f,Ee as g,we as h,nt as i,ze as l,Te as m,Fn as n,Ie as o,Pe as p,it as r,et as s,Zn as t,$e as u,Q as v};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,X as r,Z as i,et as a,nt as o,ot as s,rt as c,st as l,tt as u}from"./vendor-base-ui-fom6orB6.js";import{n as d}from"./vendor-react-D5BntRmA.js";import{t as f}from"./i18n-OsFhnlRH.js";import{Rn as p}from"./useMobileNavigationStore-Dlt-Ip-3.js";import{n as m}from"./Icon-C6CNZZkk.js";var h=e(l(),1),g=d(),_=s(),v=0;function y(e,t){return e&&h.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,g.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,_.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function x(e){let t=(0,g.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=y(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,_.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function S(e){let n=(0,g.c)(4),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let i;return n[2]===r?i=n[3]:(i=(0,_.jsx)(t,{...r}),n[2]=r,n[3]=i),i}var C=h.forwardRef((e,t)=>{let n=(0,g.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],h.useEffect(A,a);let o=t,s;n[4]===r?s=n[5]:(s=p(`app-region-no-drag fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,r),n[4]=r,n[5]=s);let l;return n[6]!==i||n[7]!==o||n[8]!==s?(l=(0,_.jsx)(c,{ref:o,"data-slot":`dialog-overlay`,className:s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let t=(0,g.c)(33),n,r,i,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],s=t[4],c=t[5],l=t[6],u=t[7]):({className:r,overlayClassName:s,containerClassName:i,children:n,showCloseButton:l,presentation:u,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u);let d=u===void 0?`default`:u,{t:h}=f(),v=l??d!==`picker`,y=d===`picker`&&`bg-transparent dark:bg-transparent`,b;t[8]!==s||t[9]!==y?(b=p(`rounded-none`,y,s),t[8]=s,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,_.jsx)(C,{className:b}),t[11]=b,t[12]=x);let w=i??(d===`picker`?`block p-0`:`items-center p-4`),T;t[13]===w?T=t[14]:(T=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,w),t[13]=w,t[14]=T);let E=d===`picker`&&`yuri-picker-dialog yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent yuri-composer-autocomplete-surface fixed left-1/2 top-[10vh] w-[min(42rem,calc(100vw-3rem))] max-w-none -translate-x-1/2 translate-y-0 gap-0 overflow-hidden rounded-3xl border-0 p-0`,D;t[15]!==r||t[16]!==E?(D=p(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,E,r),t[15]=r,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==v||t[19]!==h?(O=v&&(0,_.jsxs)(o,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:h(`dialog.common.actions.close`)})]}),t[18]=v,t[19]=h,t[20]=O):O=t[20];let k;t[21]!==n||t[22]!==d||t[23]!==c||t[24]!==D||t[25]!==O?(k=(0,_.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,"data-presentation":d,className:D,...c,children:[n,O]}),t[21]=n,t[22]=d,t[23]=c,t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==k||t[28]!==T?(A=(0,_.jsx)(`div`,{className:T,children:k}),t[27]=k,t[28]=T,t[29]=A):A=t[29];let j;return t[30]!==A||t[31]!==x?(j=(0,_.jsxs)(S,{children:[x,A]}),t[30]=A,t[31]=x,t[32]=j):j=t[32],j}function T(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=p(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,_.jsx)(i,{"data-slot":`dialog-title`,className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(u,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
@@ -1 +0,0 @@
1
- .yuri-picker-dialog{--yuri-picker-header-end-inset:1.5rem;max-height:min(42rem,80dvh)}.yuri-picker-dialog:has(>[data-slot=dialog-close]){--yuri-picker-header-end-inset:3rem}.yuri-picker-dialog .yuri-picker-header{padding:calc(1rem * var(--padding-scale,1)) var(--yuri-picker-header-end-inset) calc(.5rem * var(--padding-scale,1)) calc(1.5rem * var(--padding-scale,1));text-align:left;flex-shrink:0}.yuri-picker-dialog .yuri-picker-title{min-width:0;font-size:calc(13 * var(--dpt));font-weight:500;line-height:calc(20 * var(--dpt))}.yuri-picker-dialog .yuri-picker-search{margin:0 calc(1.5rem * var(--padding-scale,1)) calc(.5rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-search [data-slot=input]{height:calc(2.5rem * var(--padding-scale,1));box-shadow:none;font-size:calc(14 * var(--dpt));line-height:calc(20 * var(--dpt));background:0 0}.yuri-picker-dialog .yuri-picker-search:has(svg) [data-slot=input]{padding-left:calc(1.5rem * var(--padding-scale,1));padding-right:0}.yuri-picker-dialog .yuri-picker-search>svg,.yuri-picker-dialog .yuri-picker-search>.relative>svg{left:0}.yuri-picker-dialog .yuri-picker-search:focus-within{box-shadow:inset 0 -1px 0 var(--interactive-border)}.yuri-picker-dialog .yuri-picker-list{overscroll-behavior:contain;min-height:0;padding:calc(.25rem * var(--padding-scale,1)) calc(.5rem * var(--padding-scale,1)) calc(.75rem * var(--padding-scale,1));flex:1;overflow-y:auto}.yuri-picker-dialog .yuri-picker-row{min-width:0;min-height:calc(2.25rem * var(--padding-scale,1));padding:calc(.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));border:0;border-radius:.5rem}.yuri-picker-dialog .yuri-picker-row+.yuri-picker-row{margin-top:calc(.125rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-picker-label{font-size:calc(13 * var(--dpt));font-weight:400;line-height:calc(20 * var(--dpt))}.yuri-picker-dialog .yuri-picker-meta{font-size:calc(11 * var(--dpt));font-weight:400;line-height:calc(17 * var(--dpt))}.yuri-picker-dialog .yuri-picker-empty{padding:calc(2.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));font-size:calc(12 * var(--dpt));line-height:calc(20 * var(--dpt));border:0}.yuri-picker-dialog .yuri-picker-footer{padding:calc(.25rem * var(--padding-scale,1)) calc(1.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-section+.yuri-picker-section{margin-top:calc(.75rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-picker-section-title{padding:0 calc(1rem * var(--padding-scale,1)) calc(.25rem * var(--padding-scale,1));font-size:calc(11 * var(--dpt));font-weight:400;line-height:calc(17 * var(--dpt))}.yuri-picker-dialog .yuri-picker-form{margin:0 calc(1.5rem * var(--padding-scale,1)) calc(.75rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-rows>.yuri-picker-row{margin-block:0}.yuri-picker-dialog .yuri-picker-rows>.yuri-picker-row+.yuri-picker-row{margin-top:calc(.125rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-help-shortcut-row{align-items:center;gap:calc(1rem * var(--padding-scale,1));grid-template-columns:minmax(0,1fr) minmax(0,45%);display:grid}
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-Bj1TCHnZ.js","assets/rolldown-runtime-hePW80VL.js","assets/platform-wF65ZFgV.js","assets/runtime-auth-mjIpsk3N.js","assets/runtime-switch-BMjl5Y5W.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-fom6orB6.js","assets/gitApiHttp-BEMPJCIG.js","assets/runtime-fetch-DKZOpfzo.js","assets/reasoning-projection-client-BEhVknv9.js","assets/vendor-zustand-CNn3HHhT.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/client-CgAFd1ew.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-8bssUUT3.js","assets/runtime-file-resource-DnhWnndu.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/useUIStore-CYex4rbF.js","assets/useMobileHtmlPreviewStore-DUquFMmd.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-Y-KPX915.js","assets/i18n-OsFhnlRH.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-Dj5cSf8B.js","assets/tour-CMXP3Kif.js","assets/MobileDetailNavigation-CpjB_jck.js","assets/useMobileNavigationStore-Dlt-Ip-3.js","assets/useAssistantUIStore-CphyXHEY.js","assets/input-store-DRTu4uZc.js","assets/remoteProjectQueries-8giIAvzL.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-C6CNZZkk.js","assets/MobileShareBridge-DuDpHmZD.js","assets/mobileConnections-BdfBfyV4.js","assets/AgentAvatar-B9ucI2MO.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-D2YBbLma.js","assets/vendor-framer-motion-DiGWHm7K.js","assets/dialog-CDfUL86v.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/useAppFontEffects-BGhC1aSo.js","assets/desktopHosts-135cuRCE.js","assets/desktopRelayRestore-1aUztDPU.js","assets/vendor-pierre-diffs-HJfPTtu2.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/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/gitApi-6bjyfJ0P.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-Cossbslk.js","assets/input-Dc9Few6S.js","assets/tooltip-IVmealjG.js","assets/pwa-CUF8fchS.js","assets/MobileResizableSheet-Cn4FFye8.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-RfWO-Q8r.js","assets/device-C8ZHblkr.js","assets/textarea-7J-b5mR2.js","assets/OverlayScrollbar-CHgqvqG3.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-CX7xsn7U.js","assets/vendor-dnd-kit-core-DRyd7I0I.js","assets/vendor-dnd-kit-accessibility-Cf9EEJvm.js","assets/vendor-dnd-kit-sortable-C8S8cyRO.js","assets/vendor-tanstack-react-virtual-WY42p6U6.js","assets/YuriLogo-DNvrroBa.js","assets/react-_vsw1y6L.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Bi7sRiFW.js","assets/theme-validation-BGYdrOu7.js","assets/MarkdownRenderer-DrXbG9Y5.js","assets/useEffectiveDirectory-D_gt64gp.js","assets/markdownHeightCache-CgEzszwt.js","assets/reference-history-D9aLqiz1.js","assets/useDictation-Do12BpsS.js","assets/LoadingImage-BPX-DCAP.js","assets/ImageLoadingPlaceholder-B6Zer2YL.js","assets/image-loading-ZB1bYt51.js","assets/image-loading-DA9JEHD8.css","assets/reference-history-8C8nv-EP.css","assets/fileMentionTouchSelection-BsMdH79T.js","assets/insertionBoundaries-DImWCHHe.js","assets/mobileBackNavigation-CX1dqatK.js","assets/queue-abort-optimistic-DnJeXLxG.js","assets/toolHelpers-iEHVHQ9p.js","assets/FadeInOnReveal-C-CtY8g9.js","assets/ToolOutputDialog-CBk9ZNkY.js","assets/runtime-file-download-Dc459c9e.js","assets/tap-LkQum5bB.js","assets/markdownTheme-C2LJ3cJo.js","assets/markdown-worker-oBGEB9Eg.js","assets/sessionLookup-BnWJnI1i.js","assets/remote-input-store-DFBMyVS-.js","assets/vendor-cmdk-BKc6RGpL.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/vendor-motion-DtmZZeEm.js","assets/useProjectRuntimeAPIs-MBstcTXw.js","assets/terminalApi-eR_918UZ.js","assets/sortable-tabs-strip-BQhg8ugs.js","assets/speechSettingsQueries-B5nF726M.js","assets/vendor-marked-S3gCOYp1.js","assets/useStreamingTextThrottle-B9fGpeQT.js","assets/useFontPreferences-DFF-uEAD.js","assets/useAppFontEffects-K31q-1OV.css","assets/useDesktopWindowControlsLayout-CqAP968J.js","assets/openRemoteProjectSession-DkaBkopU.js","assets/AssistantConversationSurface-Blm96EOU.js","assets/assistant-attachment-cache-zu9sz4ex.js","assets/AssistantSessionCard-DX38brAH.js","assets/AssistantConversationSurface-B59k-lXE.css","assets/src-INJJ62RE.css"])))=>i.map(i=>d[i]);
2
- import"./modulepreload-polyfill-P2Xu9kJm.js";import{o as e}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{t}from"./runtimeConfig-9qXX2ix1.js";/* empty css */window.__YURI_RUNTIME_APIS__=t(),e(async()=>{let{renderElectronMiniChatApp:e}=await import(`./renderElectronMiniChatApp-Bj1TCHnZ.js`);return{renderElectronMiniChatApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139])).then(({renderElectronMiniChatApp:e})=>{e(window.__YURI_RUNTIME_APIS__??t())});
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/runtimeConfig-9qXX2ix1.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-mjIpsk3N.js","assets/runtime-switch-BMjl5Y5W.js","assets/runtime-fetch-DKZOpfzo.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-wF65ZFgV.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/desktopRelayRestore-1aUztDPU.js","assets/desktopHosts-135cuRCE.js","assets/gitApiHttp-BEMPJCIG.js","assets/vendor-zustand-CNn3HHhT.js","assets/vendor-base-ui-fom6orB6.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/client-CgAFd1ew.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-8bssUUT3.js","assets/runtime-file-resource-DnhWnndu.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/useUIStore-CYex4rbF.js","assets/useMobileHtmlPreviewStore-DUquFMmd.js","assets/uuid-D-SDZijH.js","assets/terminalApi-eR_918UZ.js","assets/runtime-file-download-Dc459c9e.js","assets/types-fkNzcMt6.js","assets/capgoAdapter-B3s9u7sG.js","assets/native-config--i6wCD4P.js","assets/bootstrap-eLlfzqAI.js","assets/runtime-ead7P81A.js","assets/renderMobileApp-ZBJF50-1.js","assets/vendor-pierre-diffs-HJfPTtu2.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-Y-KPX915.js","assets/i18n-OsFhnlRH.js","assets/store-Dj5cSf8B.js","assets/tour-CMXP3Kif.js","assets/mobileConnections-BdfBfyV4.js","assets/MobileDetailNavigation-CpjB_jck.js","assets/useMobileNavigationStore-Dlt-Ip-3.js","assets/useAssistantUIStore-CphyXHEY.js","assets/input-store-DRTu4uZc.js","assets/remoteProjectQueries-8giIAvzL.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-C6CNZZkk.js","assets/MobileShareBridge-DuDpHmZD.js","assets/AgentAvatar-B9ucI2MO.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-D2YBbLma.js","assets/vendor-framer-motion-DiGWHm7K.js","assets/dialog-CDfUL86v.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/useAppFontEffects-BGhC1aSo.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/gitApi-6bjyfJ0P.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-Cossbslk.js","assets/input-Dc9Few6S.js","assets/tooltip-IVmealjG.js","assets/pwa-CUF8fchS.js","assets/MobileResizableSheet-Cn4FFye8.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-RfWO-Q8r.js","assets/device-C8ZHblkr.js","assets/textarea-7J-b5mR2.js","assets/OverlayScrollbar-CHgqvqG3.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-CX7xsn7U.js","assets/vendor-dnd-kit-core-DRyd7I0I.js","assets/vendor-dnd-kit-accessibility-Cf9EEJvm.js","assets/vendor-dnd-kit-sortable-C8S8cyRO.js","assets/vendor-tanstack-react-virtual-WY42p6U6.js","assets/YuriLogo-DNvrroBa.js","assets/react-_vsw1y6L.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Bi7sRiFW.js","assets/theme-validation-BGYdrOu7.js","assets/MarkdownRenderer-DrXbG9Y5.js","assets/useEffectiveDirectory-D_gt64gp.js","assets/markdownHeightCache-CgEzszwt.js","assets/reference-history-D9aLqiz1.js","assets/useDictation-Do12BpsS.js","assets/LoadingImage-BPX-DCAP.js","assets/ImageLoadingPlaceholder-B6Zer2YL.js","assets/image-loading-ZB1bYt51.js","assets/image-loading-DA9JEHD8.css","assets/reference-history-8C8nv-EP.css","assets/fileMentionTouchSelection-BsMdH79T.js","assets/insertionBoundaries-DImWCHHe.js","assets/mobileBackNavigation-CX1dqatK.js","assets/queue-abort-optimistic-DnJeXLxG.js","assets/toolHelpers-iEHVHQ9p.js","assets/FadeInOnReveal-C-CtY8g9.js","assets/ToolOutputDialog-CBk9ZNkY.js","assets/tap-LkQum5bB.js","assets/markdownTheme-C2LJ3cJo.js","assets/markdown-worker-oBGEB9Eg.js","assets/sessionLookup-BnWJnI1i.js","assets/remote-input-store-DFBMyVS-.js","assets/vendor-cmdk-BKc6RGpL.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/vendor-motion-DtmZZeEm.js","assets/useProjectRuntimeAPIs-MBstcTXw.js","assets/sortable-tabs-strip-BQhg8ugs.js","assets/speechSettingsQueries-B5nF726M.js","assets/vendor-marked-S3gCOYp1.js","assets/useStreamingTextThrottle-B9fGpeQT.js","assets/useFontPreferences-DFF-uEAD.js","assets/useAppFontEffects-K31q-1OV.css","assets/MobileSurface-D93ybkxD.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-D-c3h-8F.js","assets/usePluginsStore-GVUi9ssB.js","assets/collapsible-Bt9trgB2.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/openRemoteProjectSession-DkaBkopU.js","assets/AssistantConversationSurface-Blm96EOU.js","assets/assistant-attachment-cache-zu9sz4ex.js","assets/AssistantSessionCard-DX38brAH.js","assets/AssistantConversationSurface-B59k-lXE.css","assets/runtimeEndpointReset-nUC5uMtu.js","assets/YuriWordmark-bJX68f2Y.js","assets/readiness-jkhl68VV.js","assets/relay-preview-frame-src-BPyz3nXA.js","assets/AssistantUnreadBadge-RQ0DmUi6.js","assets/context-menu-DUzve8Id.js","assets/native-errors-06if6eu-.js","assets/appearance-DFsI3pnP.js","assets/navigation-DEIXKsz9.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BUGfn7y0.css","assets/SettingsView-BoQRiuVv.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-C6jznmzY.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-7DO5ZOvG.js","assets/vendor-yaml-C9KlJAlj.js","assets/project-preview-BhNspxqe.js","assets/AssistantView-Bo5BZS0L.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-INJJ62RE.css"])))=>i.map(i=>d[i]);
2
- import"./modulepreload-polyfill-P2Xu9kJm.js";import{o as e}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */e(async()=>{let{createConfiguredWebAPIs:e}=await import(`./runtimeConfig-9qXX2ix1.js`).then(e=>e.r);return{createConfiguredWebAPIs:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40])).then(async({createConfiguredWebAPIs:t})=>{window.__YURI_RUNTIME_APIS__=t();let{renderMobileApp:n}=await e(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-ZBJF50-1.js`);return{renderMobileApp:e}},__vite__mapDeps([41,1,2,3,4,5,6,7,8,12,13,11,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,37,36,42,43,44,45,46,47,48,49,50,51,52,53,40,39,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,10,9,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,35,122,123,124,125,126,127,128,129,130,34,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,38,168,169,170,171,172,173,174,175,176,177]));n(window.__YURI_RUNTIME_APIS__)});
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/assistant-attachment-cache-zu9sz4ex.js","assets/runtime-auth-mjIpsk3N.js","assets/runtime-switch-BMjl5Y5W.js","assets/runtime-fetch-DKZOpfzo.js","assets/reasoning-projection-client-BEhVknv9.js","assets/runtime-file-resource-DnhWnndu.js","assets/platform-wF65ZFgV.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-fom6orB6.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useAssistantUIStore-CphyXHEY.js","assets/vendor-zustand-CNn3HHhT.js","assets/safeStorage-DTOhKN0V.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/useUIStore-CYex4rbF.js","assets/useMobileHtmlPreviewStore-DUquFMmd.js","assets/MobileShareBridge-DuDpHmZD.js","assets/client-CgAFd1ew.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-8bssUUT3.js","assets/i18n-OsFhnlRH.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-Dj5cSf8B.js","assets/tour-CMXP3Kif.js","assets/MobileDetailNavigation-CpjB_jck.js","assets/useMobileNavigationStore-Dlt-Ip-3.js","assets/gitApiHttp-BEMPJCIG.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-Y-KPX915.js","assets/input-store-DRTu4uZc.js","assets/remoteProjectQueries-8giIAvzL.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-C6CNZZkk.js","assets/AgentAvatar-B9ucI2MO.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-D2YBbLma.js","assets/vendor-framer-motion-DiGWHm7K.js","assets/dialog-CDfUL86v.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{E as n,b as r,w as i}from"./runtime-auth-mjIpsk3N.js";import{l as a,r as o,t as s}from"./runtime-switch-BMjl5Y5W.js";import{n as c}from"./runtime-fetch-DKZOpfzo.js";import{n as l,t as u}from"./platform-wF65ZFgV.js";import{st as d}from"./vendor-base-ui-fom6orB6.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{r as f}from"./vendor-reactuses-core-B8s-Rcd-.js";import{n as p,o as m,t as h}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as g}from"./useUIStore-CYex4rbF.js";import{t as _}from"./uuid-D-SDZijH.js";import{t as ee}from"./i18n-OsFhnlRH.js";var v=t(d(),1),y=e=>`yuri.${e}PushOnboardingAttempted`,b=e=>{if(typeof window>`u`)return!0;try{return window.localStorage.getItem(y(e))===`1`}catch{return!0}},x=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(y(e),`1`)}catch{}},S=()=>{b(`ios`)||(x(`ios`),m(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([0,1,2])).then(async({PushNotifications:e})=>{(await e.checkPermissions().catch(()=>null))?.receive!==`granted`&&await e.requestPermissions().catch(()=>null)}).catch(()=>void 0))},te=()=>{b(`android`)||x(`android`)},ne=()=>{if(typeof window>`u`)return;let e=u();if(e!==`ios`&&e!==`android`)return;let t=g.getState();if(t.nativeNotificationsEnabled||t.setNativeNotificationsEnabled(!0),e===`ios`){S();return}te()},C=e({autoConnectLastInstance:()=>Fe,connectMobileShareConnection:()=>Ie,connectionDisplayUrl:()=>N,deleteMobileConnection:()=>Me,getAutoConnectTargetLabel:()=>Pe,getConnectionLabel:()=>k,isActiveRuntimeConnection:()=>Ue,isSameConnectionUrl:()=>ue,loadMobileConnections:()=>X,mobileConnectionKey:()=>pe,normalizeConnectionUrl:()=>O,refreshActiveConnectionCandidates:()=>qe,relayConnectionRuntimeKey:()=>de,reprobeActiveConnection:()=>We,upsertMobileConnection:()=>Z,useMobileConnection:()=>Ye,validateActiveRuntimeSession:()=>Be,validateMobileConnectionSession:()=>Le}),w=`yuri.mobile.connections.v1`,re=`yuri.mobile.`,T=`yuri.mobile.deviceId`,ie=()=>{try{let e=window.localStorage.getItem(T);if(e&&e.trim())return e.trim();let t=_();return window.localStorage.setItem(T,t),t}catch{return _()}},ae=()=>`mobile:${ie()}`,oe=()=>{try{let e=p.getPlatform();return e===`ios`||e===`android`?e:void 0}catch{return}},E=12,se=8e3,ce=2500,le=3e3,D=2500,O=e=>{let t=e.trim();if(!t)return``;let n=/^https?:\/\//i.test(t)?t:`http://${t}`,r=new URL(n);return r.hash=``,r.search=``,r.pathname=r.pathname.replace(/\/+$/,``),r.toString().replace(/\/+$/,``)},k=e=>{try{return new URL(e).host}catch{return e}},A=e=>{try{return O(e)}catch{return e.trim().replace(/\/+$/g,``)}},ue=(e,t)=>A(e)===A(t),de=e=>`relay:${e.serverId}@${e.relayUrl.trim()}`,fe=e=>`relay://${e.serverId}`,j=e=>e.candidates.filter(e=>e.kind===`direct`),M=e=>{let t=e.candidates.find(e=>e.kind===`relay`);return t&&t.kind===`relay`?t.relay:null},N=e=>{let t=j(e)[0];if(t)return t.url;let n=M(e);return n?fe(n):``},P=e=>{let t=M(e);if(t)return de(t);let n=j(e)[0];return n?A(n.url):``},pe=P,me=(e,t)=>{let n=e.find(e=>e.kind===`relay`),r=n&&n.kind===`relay`?n.relay.serverId:null,i=n&&n.kind===`relay`?n.relay.relayUrl.trim():null,a=new Set(e.filter(e=>e.kind===`direct`).map(e=>A(e.url)));return t.some(e=>e.kind===`relay`?r!==null&&e.relay.serverId===r&&e.relay.relayUrl.trim()===i:a.has(A(e.url)))},he=(e,t)=>t.id&&e.id===t.id?!0:me(e.candidates,t.candidates),ge=e=>{let t=(()=>{try{return O(e)}catch{return``}})();return t?[{kind:`direct`,url:t}]:[]},_e=e=>{if(e.candidates&&e.candidates.length>0)return e.candidates;let t=[];return typeof e.url==`string`&&e.url.trim()&&!/^relay:\/\//i.test(e.url.trim())&&t.push(...ge(e.url)),e.relay&&t.push({kind:`relay`,relay:e.relay}),t},ve=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(typeof t.relayUrl!=`string`||!t.relayUrl.trim()||typeof t.serverId!=`string`||!t.serverId.trim())return null;let n=t.hostEncPubJwk;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n;return r.kty!==`EC`||r.crv!==`P-256`||typeof r.x!=`string`||!r.x||typeof r.y!=`string`||!r.y?null:{relayUrl:t.relayUrl,serverId:t.serverId,hostEncPubJwk:{kty:`EC`,crv:`P-256`,x:r.x,y:r.y}}},F=e=>{try{return JSON.stringify(e)}catch{return String(e)}},I=(e,t={})=>{F(t)},L=(e,t={})=>{F(t)},ye=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},be=e=>{if(typeof e!=`string`)return e??void 0;try{return JSON.parse(e)}catch{return e}},xe=async(e,t)=>{if(!l())return null;try{let{CapacitorHttp:n}=await m(async()=>{let{CapacitorHttp:e}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{CapacitorHttp:e}},__vite__mapDeps([2,1])),r=Object.fromEntries(new Headers(t?.headers).entries()),i=await n.request({url:e,method:t?.method||`GET`,headers:r,data:be(t?.body)});return{ok:i.status>=200&&i.status<300,status:i.status,source:`native-http`,json:async()=>ye(i.data)}}catch(t){return console.warn(`[mobile-connect]`,`native-http failed`,F({url:e,error:t instanceof Error?t.message:String(t)})),null}},Se=async(e,t)=>{let n=await fetch(e,t).catch(t=>(console.warn(`[mobile-connect]`,`browser-fetch failed`,F({url:e,error:t instanceof Error?t.message:String(t)})),null));return n?{ok:n.ok,status:n.status,source:`browser-fetch`,json:()=>n.json()}:null},R=async(e,t,n)=>{let r,i=new Promise(t=>{r=window.setTimeout(()=>{n?.(),t(null)},e)});try{return await Promise.race([t,i])}catch{return null}finally{r!==void 0&&window.clearTimeout(r)}},z=async(e,t,n)=>{let r=n?.totalTimeoutMs??se,i=Date.now(),a=await R(Math.min(ce,r),xe(e,t));if(a)return a;let o=new AbortController;return R(Math.max(500,r-(Date.now()-i)),Se(e,{...t,signal:o.signal}),()=>o.abort())},B=async e=>{if(!e)return null;let t=await e.json().catch(()=>null);if(!t||typeof t!=`object`)return null;let n=t;return{authenticated:typeof n.authenticated==`boolean`?n.authenticated:void 0,disabled:typeof n.disabled==`boolean`?n.disabled:void 0,scope:typeof n.scope==`string`?n.scope:void 0}},V=15e3,Ce=async(e,t,r,i=V,a)=>{let o=n({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk,...r?{grant:r}:{}}),s=e=>e===`ok`&&a?.keepTunnel?{outcome:e,tunnel:o}:(o.close(),{outcome:e});try{let e=t?{Authorization:`Bearer ${t}`}:void 0,n=await R(i,o.fetch(`/auth/session`,{headers:e}).catch(()=>null));if(I(`relay:session`,{ok:n?.ok===!0,status:n?.status??null,hasToken:!!t}),!n)return s(`unreachable`);if(n.status===401)return s(t?`auth-failed`:`needs-login`);if(n.status===403)return s(`auth-failed`);if(!n.ok&&n.status!==404)return s(`unreachable`);let r=await B(n);return r&&r.disabled!==!0&&r.authenticated===!1?s(t?`auth-failed`:`needs-login`):s(`ok`)}catch(e){throw o.close(),e}},we=(e,t,n,i,o)=>{let s=typeof window<`u`?window.location.origin:``,c={relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk,...n?{grant:n}:{}};o&&r(c,o),a({apiBaseUrl:s,clientToken:t,runtimeKey:i??de(e),relay:c})},Te=e=>{if(!e||typeof e!=`object`)return null;let t=e;if(t.kind===`direct`)return typeof t.url==`string`&&t.url.trim()?{kind:`direct`,url:t.url}:null;if(t.kind===`relay`){let e=ve(t.relay);return e?{kind:`relay`,relay:e}:null}return null},Ee=e=>{if(e.mode===`relay`){let t=ve(e.relay);return t?[{kind:`relay`,relay:t}]:[]}return typeof e.url==`string`?ge(e.url):[]},H=()=>{if(typeof window>`u`)return[];let e;try{e=JSON.parse(window.localStorage.getItem(w)||`[]`)}catch{return[]}if(!Array.isArray(e))return[];let t=l();return e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let n=e;if(typeof n.id!=`string`)return[];let r=Array.isArray(n.candidates)?n.candidates.map(Te).filter(e=>!!e):Ee(n);if(r.length===0)return[];let i=typeof n.clientToken==`string`&&n.clientToken.trim()?n.clientToken:void 0,a=typeof n.label==`string`&&n.label.trim()?n.label:k(N({candidates:r})),o={id:n.id,label:a,candidates:r,lastUsedAt:typeof n.lastUsedAt==`number`?n.lastUsedAt:0};return t?[{...o,hasToken:!!n.hasToken||!!i}]:[{...o,clientToken:i,hasToken:!!i}]}).sort((e,t)=>t.lastUsedAt-e.lastUsedAt)},U=e=>e.kind===`relay`?{kind:`relay`,relay:{relayUrl:e.relay.relayUrl,serverId:e.relay.serverId,hostEncPubJwk:e.relay.hostEncPubJwk}}:{kind:`direct`,url:e.url},W=e=>{if(typeof window>`u`)return;let t=l(),n=e.slice(0,E).map(e=>{let n={id:e.id,label:e.label,candidates:e.candidates.map(U),lastUsedAt:e.lastUsedAt};return t?{...n,hasToken:!!(e.hasToken||e.clientToken)}:{...n,clientToken:e.clientToken}});try{window.localStorage.setItem(w,JSON.stringify(n))}catch(e){throw console.warn(`[mobile-storage] failed to persist connection metadata`,e),e}},De=(e,t,n=!0)=>{let r=e.find(e=>he(e,t)),i=l(),a={id:t.id||r?.id||_(),label:t.label,candidates:t.candidates,lastUsedAt:n?Date.now():r?.lastUsedAt??0,...i?{hasToken:t.hasToken??(!!t.clientToken||r?.hasToken||!1)}:{clientToken:t.clientToken??r?.clientToken,hasToken:!!(t.clientToken??r?.clientToken)}};return[a,...e.filter(e=>e.id!==a.id&&!he(e,t))].sort((e,t)=>t.lastUsedAt-e.lastUsedAt).slice(0,E)},G=h,Oe=0,K=e=>`${re}token.${encodeURIComponent(e)}`,ke=async(e,t)=>{let n,r=new Promise(e=>{n=window.setTimeout(()=>e(t),le)});try{return await Promise.race([e.catch(()=>t),r])}finally{n!==void 0&&window.clearTimeout(n)}},q=async(e,t,n)=>l()?ke(t().catch(t=>(console.warn(`[mobile-storage] ${e} failed`,t),n)),n):n,J=async e=>{L(`secure:read-start`,{key:e});let t=await q(`secure:read`,async()=>(await G.internalGetItem({prefixedKey:K(e),sync:!1})).data,null),n=typeof t==`string`&&t.trim()?t:void 0;return L(`secure:read`,{key:e,hasToken:!!n}),n},Y=async(e,t)=>{L(`secure:write-start`,{key:e});let n=await q(`secure:write`,async()=>(await G.internalSetItem({prefixedKey:K(e),data:t,sync:!1,access:Oe}),!0),!1);return L(`secure:write`,{key:e,ok:n}),n},Ae=async e=>{await q(`secure:delete`,async()=>(await G.internalRemoveItem({prefixedKey:K(e),sync:!1}),!0),!1)},je=async()=>{if(typeof window>`u`||!l())return;let e;try{e=JSON.parse(window.localStorage.getItem(w)||`[]`)}catch{return}if(!Array.isArray(e))return;let t=e.filter(e=>!!e&&typeof e==`object`&&typeof e.url==`string`&&typeof e.clientToken==`string`&&!!e.clientToken.trim());if(t.length!==0){L(`secure:migrate-start`,{count:t.length});for(let{url:e,clientToken:n}of t)await Y(A(e),n);W(H()),L(`secure:migrate-done`,{count:t.length})}},X=async()=>(await je(),H()),Z=async e=>{let t=De(H(),e);if(W(t),l()&&e.clientToken){let n=t[0];n&&await Y(P(n),e.clientToken)}return t},Me=async e=>{let t=H(),n=t.find(t=>t.id===e)??null,r=t.filter(t=>t.id!==e);if(n){let e;if(l())try{e=await J(P(n))||void 0}catch{e=void 0}else typeof n.clientToken==`string`&&n.clientToken.trim()&&(e=n.clientToken.trim());if(e)try{let{clearAssistantAttachmentCacheForBearer:t}=await m(async()=>{let{clearAssistantAttachmentCacheForBearer:e}=await import(`./assistant-attachment-cache-zu9sz4ex.js`).then(e=>e.t);return{clearAssistantAttachmentCacheForBearer:e}},__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2,20,21]));await t(e,`forget-connection`)}catch{}}if(W(r),n&&l()&&await Ae(P(n)),n){let e=P(n);try{let{useAssistantUIStore:t}=await m(async()=>{let{useAssistantUIStore:e}=await import(`./useAssistantUIStore-CphyXHEY.js`).then(e=>e.a);return{useAssistantUIStore:e}},__vite__mapDeps([22,1,5,4,23,12,24,25,21,26,7,9,10,11,27,2]));t.getState().removeCatalogPartition(e);let{publishNativeAssistantCatalog:n}=await m(async()=>{let{publishNativeAssistantCatalog:e}=await import(`./MobileShareBridge-DuDpHmZD.js`).then(e=>e.n);return{publishNativeAssistantCatalog:e}},__vite__mapDeps([28,1,5,4,6,7,9,10,11,12,25,21,29,23,30,31,24,32,8,13,14,15,16,17,18,19,2,20,33,34,35,36,37,38,39,40,26,27,41,42,22,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]));await n().catch(()=>void 0)}catch{console.warn(`[mobile-storage] connection catalog cleanup failed`)}}return r},Ne=1500,Q=async(e,t,n)=>{let r=n?.fast?{totalTimeoutMs:D}:void 0,i=M({candidates:e})?.serverId??null,a=e.find(e=>e.kind===`relay`)??null,o=e.filter(e=>e.kind===`direct`),s=async()=>{for(let e of o){let n=O(e.url)||e.url,a=t?{Authorization:`Bearer ${t}`}:void 0,o=await z(`${n}/health`,{method:`GET`},r);if(!o?.ok)continue;if(i){let e=await o.json().catch(()=>null),t=e&&typeof e==`object`?e.serverId:null;if(typeof t==`string`&&t&&t!==i){I(`probe:server-id-mismatch`,{url:n});continue}}let s=await z(`${n}/auth/session`,{method:`GET`,credentials:`include`,headers:a},r);if(s?.status===401)return{status:`needs-login`};if(!s||!s.ok&&s.status!==404)continue;let c=await B(s);if(c&&c.disabled!==!0&&c.authenticated===!1)return{status:`needs-login`};let u=c?.disabled===!0;return!t&&l()&&!u&&c?.scope!==`client`?{status:`needs-login`}:{status:`ok`,transport:{kind:`direct`,url:n}}}return{status:`unreachable`}},c=async()=>{if(!a)return{status:`unreachable`};let{outcome:e,tunnel:r}=await Ce(a.relay,t,void 0,n?.fast?D:void 0,{keepTunnel:!0});return e===`ok`?{status:`ok`,transport:{kind:`relay`,relay:a.relay,tunnel:r}}:e===`needs-login`||e===`auth-failed`?{status:`needs-login`}:{status:`unreachable`}};return a?o.length===0?c():new Promise(e=>{let t=!1,n=!1,r,i=null,a=null,o=e=>{e?.status===`ok`&&e.transport.kind===`relay`&&e.transport.tunnel?.close()},l=n=>{t||(t=!0,e(n))},u=()=>{n||t||(r!==void 0&&(window.clearTimeout(r),r=void 0),c().then(e=>{if(a=e,t||n){o(e);return}if(e.status===`ok`||e.status===`needs-login`){l(e);return}i&&l(i)}))};s().then(e=>{if(i=e,!t){if(e.status===`ok`||e.status===`needs-login`){n=!0,r!==void 0&&window.clearTimeout(r),o(a),l(e);return}if(a){l(a);return}u()}}),r=window.setTimeout(u,Ne)}):s()},$=(e,t,n)=>{e.kind===`relay`?we(e.relay,t,n?.grant,n?.runtimeKey,e.tunnel):a({apiBaseUrl:e.url,clientToken:t,runtimeKey:n?.runtimeKey}),Je()},Pe=()=>{let e=H()[0];return e?.label?.trim()?e.label:null},Fe=async()=>{await je();let e=H()[0];if(!e)return!1;let t;if(l()){if(!e.hasToken||(t=await J(P(e)),!t))return!1}else if(t=e.clientToken,!t)return!1;let n=await Q(e.candidates,t);return n.status===`ok`&&(await Z({id:e.id,label:e.label,candidates:e.candidates}),$(n.transport,t,{runtimeKey:P(e)}),!0)},Ie=async(e,t)=>{let n=(await X()).find(t=>P(t)===e);if(!n)return`missing`;let r=l()?n.hasToken?await J(e):void 0:n.clientToken;if(!r)return`auth-required`;let i=t?.transportPreference===`relay`?n.candidates.filter(e=>e.kind===`relay`):n.candidates;if(i.length===0)return`offline`;let a=await Q(i,r,{fast:!0});return a.status===`needs-login`?`auth-required`:a.status===`ok`?($(a.transport,r,{runtimeKey:e}),`connected`):`offline`},Le=async(e,t)=>{let n=``;try{n=O(e.url)}catch{return!1}if(!n)return!1;let r=e.clientToken?.trim()||void 0,i=r?{Authorization:`Bearer ${r}`}:void 0,a=t?.fast?{totalTimeoutMs:D}:void 0;if(!(await z(`${n}/health`,{method:`GET`,headers:i},a))?.ok)return!1;let o=await z(`${n}/auth/session`,{method:`GET`,credentials:`include`,headers:i},a);if(!o||!o.ok&&o.status!==404)return!1;let s=await B(o);return!(s&&s.disabled!==!0&&s.authenticated===!1)},Re=e=>[...e].sort((e,t)=>{let n=(e.priority??100)-(t.priority??100);if(n!==0)return n;let r=e=>e.type===`relay`?2:+!e.url.startsWith(`https://`);return r(e)-r(t)}).flatMap(e=>{if(e.type===`relay`){let t=ve({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return t?[{kind:`relay`,relay:t}]:[]}return ge(e.url)}),ze=async e=>{let t=M({candidates:e})?.serverId??null;for(let r of e){if(r.kind===`relay`){let e=n(r.relay),t=await R(V,e.fetch(`/health`).catch(()=>null));if(I(`establish:relay:health`,{ok:t?.ok===!0,status:t?.status??null}),t)return{kind:`relay`,relay:r.relay,tunnel:e};e.close();continue}let e=O(r.url)||r.url,i=await z(`${e}/health`,{method:`GET`});if(I(`establish:direct:health`,{ok:i?.ok===!0,status:i?.status??null}),i?.ok){if(t){let n=await i.json().catch(()=>null),r=n&&typeof n==`object`?n.serverId:null;if(typeof r==`string`&&r&&r!==t){I(`establish:server-id-mismatch`,{url:e});continue}}return{kind:`direct`,url:e}}}return null},Be=async(e,t)=>{if(!i())return Le(e,t);let n=await R(t?.fast?D:V,c(`/auth/session`).then(e=>e).catch(()=>null));if(!n)return!0;if(n.status===401)return!1;if(!n.ok&&n.status!==404)return!0;let r=await B(n);return!(r&&r.disabled!==!0&&r.authenticated===!1)},Ve=e=>e.kind===`relay`?i():!i()&&ue(e.url,s()),He=()=>{let e=o();return e?H().find(t=>P(t)===e)??null:null},Ue=e=>{let t=o();return!!t&&P(e)===t},We=async()=>{let e=He();if(!e)return`no-connection`;let t;if(t=l()?e.hasToken?await J(P(e)):void 0:e.clientToken,!t)return`unreachable`;let n=e.candidates.findIndex(e=>Ve(e.kind===`relay`?{kind:`relay`,relay:e.relay}:{kind:`direct`,url:e.url})),r=await Q(n>=0?e.candidates.slice(0,n):e.candidates,t,{fast:!0});if(r.status===`ok`)return await Z({id:e.id,label:e.label,candidates:e.candidates}),$(r.transport,t,{runtimeKey:P(e)}),`switched`;if(r.status===`needs-login`)return`unreachable`;if(n>=0&&await Be({url:s(),clientToken:t},{fast:!0}))return Je(),`unchanged`;let i=await Q(n>=0?e.candidates.slice(n+1):[],t,{fast:!0});return i.status===`ok`?(await Z({id:e.id,label:e.label,candidates:e.candidates}),$(i.transport,t,{runtimeKey:P(e)}),`switched`):`unreachable`},Ge=5e3,Ke=!1,qe=async()=>{if(Ke)return`skipped`;let e=He();if(!e)return I(`candidates:refresh-skip`,{reason:`no-active-connection`}),`skipped`;let t=M(e);if(!t)return I(`candidates:refresh-skip`,{reason:`no-relay-candidate`}),`skipped`;Ke=!0;try{let n=await R(V,c(`/api/client-auth/connection/candidates`).then(e=>e).catch(()=>null));if(!n?.ok)return I(`candidates:refresh-skip`,{reason:`fetch-failed`,status:n?.status??null}),`skipped`;let r=await n.json().catch(()=>null);if(!r||r.serverId!==t.serverId)return I(`candidates:refresh-skip`,{reason:`server-id-mismatch`}),`skipped`;let i=Array.isArray(r.candidates)?r.candidates:[],a=[];for(let e of i){if(!e||typeof e!=`object`)continue;let t=e;if(t.type===`lan`&&typeof t.url==`string`)try{let e=O(t.url);e&&!a.includes(e)&&a.push(e)}catch{}}if(a.length===0)return I(`candidates:refresh-skip`,{reason:`no-lan-reported`}),`skipped`;let o=j(e).filter(e=>e.url.startsWith(`https://`)),s=[...a.map(e=>({kind:`direct`,url:e})),...o,{kind:`relay`,relay:t}];return JSON.stringify(e.candidates.map(U))===JSON.stringify(s.map(U))?`unchanged`:(I(`candidates:refreshed`,{lanCount:a.length}),await Z({id:e.id,label:e.label,candidates:s}),`updated`)}finally{Ke=!1}},Je=()=>{typeof window>`u`||window.setTimeout(()=>{(async()=>{let e=await qe().catch(()=>`skipped`);I(`candidates:refresh-result`,{result:e}),e===`updated`&&i()&&await We().catch(()=>null)})()},Ge)},Ye=e=>{let{t}=ee(),[n,r]=v.useState(()=>H()),[i,a]=v.useState(null),[o,s]=v.useState(null),[c,u]=v.useState(null),d=v.useRef(n),p=v.useRef(0),m=v.useRef(null),h=v.useRef(new Set),g=f(()=>{ne(),e(),h.current.forEach(e=>e())}),y=f(e=>(h.current.add(e),()=>h.current.delete(e))),b=f(e=>{p.current+=1,d.current=e,r(e)}),x=f(e=>{m.current=e,a(e)}),S=f(e=>{m.current===e&&(m.current=null,a(null))}),te=f(()=>s(t(`mobile.connect.history.updateFailed`)));v.useEffect(()=>{let e=!1,t=p.current;return X().then(n=>{!e&&p.current===t&&b(n)}).catch(()=>{e||te()}),()=>{e=!0}},[b,te]);let C=f((e,t=!0)=>{let n=De(d.current,e,t);return W(n),b(n),n}),w=f(async e=>{if(!m.current){s(null),x(`connect`);try{let n=_e(e);if(n.length===0){s(t(`mobile.connect.error.urlRequired`));return}let r=e.id?d.current.find(t=>t.id===e.id):d.current.find(e=>me(e.candidates,n)),i=e.label?.trim()||r?.label||k(N({candidates:n})),a=e.relayGrant,o=e.clientToken?.trim()||void 0,c=!!o;o||(l()?r?.hasToken&&(o=await J(P(r))):o=r?.clientToken),I(`connect:start`,{candidates:n.map(e=>e.kind),hasToken:!!o});let f=await Q(n,o);if(I(`connect:probe`,{status:f.status}),f.status===`unreachable`){s(t(`mobile.connect.error.unreachable`));return}if(f.status===`needs-login`){C({id:r?.id,label:i,candidates:n},!1),u({id:r?.id??_(),label:i,candidates:n,...o?{reason:`pairing`}:{},relay:M({candidates:n})??void 0,relayGrant:a});return}let p=P({candidates:n});o&&c&&l()&&await Y(p,o),C({id:r?.id,label:i,candidates:n,clientToken:o}),u(null),$(f.transport,o??null,{runtimeKey:p,grant:a}),g()}catch(e){console.warn(`[mobile-connect] connect threw`,e),s(t(`mobile.connect.error.invalidUrl`))}finally{S(`connect`)}}}),re=f(async e=>{if(m.current)return;s(null),x(`pairing`);let n=Re(e.candidates),r=null,i=!1;try{if(r=await ze(n),!r){s(t(`mobile.connect.error.unreachable`));return}let a={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({pairingId:e.pairingId,secret:e.secret,clientLabel:`Yuri Mobile`,clientKind:`mobile`,deviceName:`Yuri Mobile`,devicePlatform:oe(),dedupeKey:ae()})},o=r.kind===`relay`?await R(V,r.tunnel.fetch(`/api/client-auth/pairing/redeem`,a).catch(()=>null)):await z(`${r.url}/api/client-auth/pairing/redeem`,a);if(!o?.ok){s(t(`mobile.connect.error.authRequired`));return}let c=await o.json().catch(()=>null),d=typeof c?.clientToken==`string`?c.clientToken.trim():``;if(!d){s(t(`mobile.connect.error.authRequired`));return}let f=typeof c?.server?.label==`string`?c.server.label:``,p=e.label||f||k(N({candidates:n})),m=P({candidates:n});if(l()&&!await Y(m,d)){s(t(`mobile.connect.error.authRequired`));return}C({label:p,candidates:n,clientToken:d}),u(null),$(r.kind===`relay`?{kind:`relay`,relay:r.relay,tunnel:r.tunnel}:{kind:`direct`,url:r.url},d,{runtimeKey:m}),i=r.kind===`relay`,g()}catch(e){console.warn(`[mobile-connect] pairing threw`,e),s(t(`mobile.connect.error.authRequired`))}finally{!i&&r?.kind===`relay`&&r.tunnel.close(),S(`pairing`)}}),T=f(async e=>{if(!c||c.reason===`pairing`||!e.trim()||m.current)return;s(null),x(`password`);let{id:n,label:r,candidates:i}=c,a=null,o=!1;try{if(a=await ze(i),!a){s(t(`mobile.connect.error.unreachable`));return}let c={method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({password:e,trustDevice:!0,issueClientToken:!0,clientLabel:`Yuri Mobile`,clientKind:`mobile`,devicePlatform:oe(),dedupeKey:ae()})};I(`password:start`,{transport:a.kind});let d=a.kind===`relay`?await R(V,a.tunnel.fetch(`/auth/session`,c).catch(()=>null)):await z(`${a.url}/auth/session`,c);if(I(`password:done`,{ok:d?.ok===!0,status:d?.status??null}),!d?.ok){s(t(`mobile.connect.error.passwordFailed`));return}let f=await d.json().catch(()=>null),p=typeof f?.clientToken==`string`?f.clientToken.trim():``;if(I(`password:token`,{issued:!!p}),!p){if(a.kind===`direct`&&!l()){C({id:n,label:r,candidates:i}),u(null),$({kind:`direct`,url:a.url},null,{runtimeKey:P({candidates:i})}),g();return}s(t(`mobile.connect.error.authRequired`));return}l()&&await Y(P({candidates:i}),p),C({id:n,label:r,candidates:i,clientToken:p}),u(null),$(a.kind===`relay`?{kind:`relay`,relay:a.relay,tunnel:a.tunnel}:{kind:`direct`,url:a.url},p,{runtimeKey:P({candidates:i})}),o=a.kind===`relay`,g()}catch(e){console.warn(`[mobile-connect] password threw`,e),s(t(`mobile.connect.error.passwordFailed`))}finally{!o&&a?.kind===`relay`&&a.tunnel.close(),S(`password`)}}),ie=f(()=>{u(null),s(null)}),E=f(async e=>{if(m.current)return null;x(`metadata`);try{s(null);let n=_e(e),r=e.id?d.current.find(t=>t.id===e.id)??null:null;if(r){let e=n.filter(e=>e.kind===`direct`),t=j(r).filter(t=>t.url.startsWith(`https://`)&&!e.some(e=>ue(e.url,t.url))),i=M(r);n=[...e,...t,...i?[{kind:`relay`,relay:i}]:[]]}if(n.length===0)return s(t(`mobile.connect.error.urlRequired`)),null;let i=e.clientToken?.trim()||void 0,a=e.label?.trim()||k(N({candidates:n}));if(l()){let e=P({candidates:n});if(i)await Y(e,i);else if(r?.hasToken){let t=P(r);if(t&&e&&t!==e){let n=await J(t);n&&await Y(e,n)}}}return C({id:e.id,label:a,candidates:n,clientToken:i},!1).find(e=>me(e.candidates,n))??null}catch{return s(t(`mobile.connect.history.updateFailed`)),null}finally{S(`metadata`)}}),se=f(async(e,n)=>{if(m.current||!n.trim())return null;let r=d.current.find(t=>t.id===e);if(!r)return null;x(`metadata`),s(null);try{let t={...r,label:n.trim()},i=d.current.map(n=>n.id===e?t:n);return W(i),b(i),t}catch{return s(t(`mobile.connect.history.updateFailed`)),null}finally{S(`metadata`)}}),ce=f(async e=>{if(m.current)return null;x(`metadata`),s(null);try{let t=d.current.find(t=>t.id===e)??null,n=await Me(e);return b(n),t}catch{return s(t(`mobile.connect.history.updateFailed`)),null}finally{S(`metadata`)}});return{connections:n,isBusy:i!==null,isPasswordBusy:i===`password`,error:o,pendingConnection:c,connect:w,redeemPairingConnection:re,submitPassword:T,cancelPassword:ie,saveConnection:E,renameConnection:se,removeConnection:ce,subscribeConnected:y,setError:s}};export{Ue as a,C as c,Pe as i,We as l,Ie as n,X as o,N as r,pe as s,Fe as t,Ye as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./useUIStore-CYex4rbF.js";import{Va as t,Wa as n,s as r}from"./useMobileNavigationStore-Dlt-Ip-3.js";import{i,n as a}from"./remoteProjectQueries-8giIAvzL.js";function o(i,a,o,s=i.path,c=!1,l){a.assertCurrent(),t.getState().setActiveProjectIdOnly(i.id),n.getState().openRemoteSession(i,{hubId:a.hubId,hostId:i.hostId,directory:s,...i.instanceId?{instanceId:i.instanceId}:{}},o,l),e.getState().setActiveMainTab(`chat`),c&&r.getState().openRemoteProject()}async function s(e,n=!1){let r=await a(),s=r.projects.find(t=>t.id===e.id&&t.hostId===e.hostId&&t.path===e.path);if(!s)throw Error(`Remote project is not registered in the current Hub`);let c=i(r);c.assertCurrent(),t.getState().upsertRemoteProject(s,r.hubId),o(s,c,null,s.path,n)}export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,t as r}from"./runtime-switch-BMjl5Y5W.js";import{n as i}from"./runtime-fetch-DKZOpfzo.js";import{a,i as o}from"./vendor-zustand-CNn3HHhT.js";import{ot as s,st as c}from"./vendor-base-ui-fom6orB6.js";import{W as l}from"./gitApiHttp-BEMPJCIG.js";import{n as u}from"./vendor-react-D5BntRmA.js";import{r as d}from"./useUIStore-CYex4rbF.js";import{n as f,t as p}from"./i18n-OsFhnlRH.js";import{Gr as m,In as h,Jr as g,Kr as _,Mr as v,Rn as y,Si as b,Ui as ee,Ur as x,Xi as S,Yr as C,la as te,p as w,qr as ne,x as T}from"./useMobileNavigationStore-Dlt-Ip-3.js";import{n as E}from"./Icon-C6CNZZkk.js";import{d as D,i as re,l as ie,m as ae}from"./gitApi-6bjyfJ0P.js";import{t as oe}from"./input-Dc9Few6S.js";import{n as se,t as ce}from"./tooltip-IVmealjG.js";import{d as le,l as ue}from"./select-RfWO-Q8r.js";import{_ as de,l as fe,o as pe,s as me,t as he,v as ge,y as _e}from"./vendor-dnd-kit-core-DRyd7I0I.js";import{n as ve,o as ye,s as be,t as xe}from"./vendor-dnd-kit-sortable-C8S8cyRO.js";import{n as Se}from"./textarea-7J-b5mR2.js";import{t as Ce}from"./vendor-tanstack-react-virtual-WY42p6U6.js";var O=e(c(),1),k=u(),we={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},A=null,j={},M=(e,t)=>{A!==t&&(A=t,j.compact=void 0,j.compactTokensShort=void 0,j.usd=void 0);let n=j[e];if(n)return n;let r=new Intl.NumberFormat(t,we[e]);return j[e]=r,r},N=(e,t=f())=>M(`compact`,t).format(e),Te=(e,t=f())=>M(`compactTokensShort`,t).format(e),P=(e,t=f())=>M(`usd`,t).format(e),Ee=(e,t=f())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),De=(e,t=f())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),Oe=(e,t=f())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),ke=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},Ae=(e,t,n)=>{let r=ke(t.limit,`context`),i=ke(t.limit,`output`),a=r??n?.limit?.context,o=i??n?.limit?.output;return a===void 0&&o===void 0?n:{...n??{id:typeof t.id==`string`?t.id:``,providerId:e,name:typeof t.name==`string`?t.name:void 0},limit:{...n?.limit,...a===void 0?{}:{context:a},...o===void 0?{}:{output:o}}}};function F(e){let t=e.toLowerCase().trim();return{lower:t,compact:t.replace(/[^a-z0-9]/g,``),tokens:t.split(/[^a-z0-9]+/).filter(Boolean)}}function je(e,t){let n=F(t);if(!n.lower)return!0;let r=F(e);return r.lower.includes(n.lower)||n.compact.length>=2&&r.compact.includes(n.compact)?!0:n.tokens.length!==0&&n.tokens.every(e=>r.tokens.some(t=>t.startsWith(e)||t.includes(e)))}var Me=a()(o(e=>({collapsedSections:{},toggleSection:t=>e(e=>{let n={...e.collapsedSections};return n[t]?delete n[t]:n[t]=!0,{collapsedSections:n}})}),{name:`model-picker-collapsed-sections`,version:1})),I=s(),Ne={image:{icon:`file-image`,labelKey:`modalityImage`},video:{icon:`file-video`,labelKey:`modalityVideo`},audio:{icon:`file-music`,labelKey:`modalityAudio`}},Pe=e=>e.trim().toLowerCase(),L=e=>{let t=(0,k.c)(5),{iconName:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,I.jsx)(E,{name:n,className:`size-3.5`}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,I.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,role:`img`,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Fe=(e,t)=>{let n=[];e?.tool_call&&t.capabilityToolCalling&&n.push({key:`tool_call`,icon:`tools`,label:t.capabilityToolCalling}),e?.reasoning&&t.capabilityReasoning&&n.push({key:`reasoning`,icon:`brain-ai-3`,label:t.capabilityReasoning});let r=[...e?.modalities?.input??[],...e?.modalities?.output??[]],i=Array.from(new Set(r.map(Pe).filter(Boolean)));for(let e of i){let r=Ne[e];if(!r)continue;let i=t[r.labelKey];i&&n.push({key:`modality-${e}`,icon:r.icon,label:i})}return n},Ie=e=>te(e,void 0,{maxLength:40}),Le=e=>{if(typeof e!=`number`||Number.isNaN(e))return``;if(e===0)return`0`;let t=N(e);return t.endsWith(`.0`)?t.slice(0,-2):t},Re=e=>typeof e!=`number`||!Number.isFinite(e)?`—`:P(e),R=(e,t)=>t?!0:e?!!(e.tool_call||e.reasoning||e.cost?.input!==void 0||e.cost?.output!==void 0||(e.modalities?.input?.length??0)>0||(e.modalities?.output?.length??0)>0):!1,ze=e=>{let t=(0,k.c)(21),{metadata:n,providerName:r,providerID:i,modelID:a,active:o,anchor:s,labels:c,children:l}=e,{t:u}=p(),[d,f]=O.useState(!1),m=`${i}/${a}`,g,_;t[0]===o?(g=t[1],_=t[2]):(g=()=>{if(!o){f(!1);return}let e=window.setTimeout(()=>f(!0),450);return()=>window.clearTimeout(e)},_=[o],t[0]=o,t[1]=g,t[2]=_),O.useEffect(g,_);let v;t[3]!==o||t[4]!==d||t[5]!==n||t[6]!==r?(v=o&&d&&R(n,r),t[3]=o,t[4]=d,t[5]=n,t[6]=r,t[7]=v):v=t[7];let y=v,x,S;if(t[8]!==s||t[9]!==l||t[10]!==c||t[11]!==n||t[12]!==m||t[13]!==r||t[14]!==y||t[15]!==u){let e=y?Fe(n,c):[],i=n?.cost?.input!==void 0||n?.cost?.output!==void 0;x=l,S=y?(0,I.jsx)(ce,{open:!0,onOpenChange:B,children:(0,I.jsx)(se,{anchor:s,side:`right`,sideOffset:8,className:`min-w-52 max-w-xs text-left transition-none data-[starting-style]:opacity-100 data-[starting-style]:scale-100 data-[ending-style]:opacity-100 data-[ending-style]:scale-100`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 text-left text-xs`,children:[r&&c.provider?(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,I.jsx)(`span`,{className:`typography-meta font-medium`,children:c.provider}),(0,I.jsx)(`span`,{className:`typography-meta text-foreground`,children:r})]}):null,e.length>0?(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,I.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:c.capabilities}),(0,I.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:e.map(V)})]}):null,i?(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-muted-foreground`,children:[c.costPerMillion?(0,I.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:c.costPerMillion}):null,(0,I.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 min-w-0`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[c.costInput?(0,I.jsx)(`span`,{className:`typography-meta shrink-0`,children:c.costInput}):null,(0,I.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:Re(n?.cost?.input)})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[c.costOutput?(0,I.jsx)(`span`,{className:`typography-meta shrink-0`,children:c.costOutput}):null,(0,I.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:Re(n?.cost?.output)})]})]})]}):null,(0,I.jsx)(h,{variant:`ghost`,size:`xs`,className:`h-auto min-h-0 w-full min-w-0 justify-end gap-0 rounded-none p-0 text-right cursor-copy font-normal text-muted-foreground hover:bg-transparent active:bg-transparent`,"aria-label":u(`onboarding.common.copyToClipboard`),title:m,onClick:async e=>{e.stopPropagation();try{(await ee(m)).ok?b.success(u(`contextSidebar.actions.copied`)):b.error(u(`filesView.toast.copyFailed`))}catch{b.error(u(`filesView.toast.copyFailed`))}},children:(0,I.jsx)(`span`,{className:`block w-full min-w-0 truncate text-right text-[10px] leading-tight`,children:m})})]})})}):null,t[8]=s,t[9]=l,t[10]=c,t[11]=n,t[12]=m,t[13]=r,t[14]=y,t[15]=u,t[16]=x,t[17]=S}else x=t[16],S=t[17];let C;return t[18]!==x||t[19]!==S?(C=(0,I.jsxs)(I.Fragment,{children:[x,S]}),t[18]=x,t[19]=S,t[20]=C):C=t[20],C},Be=()=>{let e=0,t=new Set,n=new Map,r=e=>{let t=n.get(e);if(t)for(let e of t)e()};return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),subscribeIndex:(e,t)=>{let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),()=>{r.delete(t),r.size===0&&n.delete(e)}},set:n=>{if(e===n)return;let i=e;e=n,r(i),r(n);for(let e of t)e()}}},Ve=O.memo(e=>{let t=(0,k.c)(12),{store:n,index:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=()=>n.getSnapshot()===r,t[0]=r,t[1]=n,t[2]=a):a=t[2];let[o,s]=O.useState(a),c,l;t[3]!==r||t[4]!==n?(c=()=>{let e=()=>s(n.getSnapshot()===r);return e(),n.subscribeIndex(r,e)},l=[r,n],t[3]=r,t[4]=n,t[5]=c,t[6]=l):(c=t[5],l=t[6]),O.useEffect(c,l);let u;t[7]!==i||t[8]!==o?(u=i(o),t[7]=i,t[8]=o,t[9]=u):u=t[9];let d;return t[10]===u?d=t[11]:(d=(0,I.jsx)(I.Fragment,{children:u}),t[10]=u,t[11]=d),d}),He=e=>{let t=(0,k.c)(11),{store:n,flatModelList:r,footerContent:i,fallback:a}=e,o;t[0]===n?o=t[1]:(o=()=>n.getSnapshot(),t[0]=n,t[1]=o);let[s,c]=O.useState(o),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>n.subscribe(()=>c(n.getSnapshot())),u=[n],t[2]=n,t[3]=l,t[4]=u),O.useEffect(l,u);let d=r[s],f;t[5]!==d||t[6]!==a||t[7]!==i?(f=typeof i==`function`?i(d):i??a,t[5]=d,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;return t[9]===f?p=t[10]:(p=(0,I.jsx)(I.Fragment,{children:f}),t[9]=f,t[10]=p),p},Ue=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:p}=ye(o),m;t[3]===d?m=t[4]:(m=_e.Transform.toString(d),t[3]=d,t[4]=m);let h;t[5]!==m||t[6]!==f?(h={transform:m,transition:f},t[5]=m,t[6]=f,t[7]=h):h=t[7];let g=p&&`opacity-60`,_;t[8]===g?_=t[9]:(_=y(g),t[8]=g,t[9]=_);let v;t[10]!==s||t[11]!==i||t[12]!==p||t[13]!==c||t[14]!==u?(v=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:p}),t[10]=s,t[11]=i,t[12]=p,t[13]=c,t[14]=u,t[15]=v):v=t[15];let b;return t[16]!==l||t[17]!==h||t[18]!==_||t[19]!==v?(b=(0,I.jsx)(`div`,{ref:l,style:h,className:_,children:v}),t[16]=l,t[17]=h,t[18]=_,t[19]=v,t[20]=b):b=t[20],b},We=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:p}=ye(o),m;t[3]===d?m=t[4]:(m=_e.Translate.toString(d),t[3]=d,t[4]=m);let h;t[5]!==m||t[6]!==f?(h={transform:m,transition:f},t[5]=m,t[6]=f,t[7]=h):h=t[7];let g=p&&`opacity-60`,_;t[8]===g?_=t[9]:(_=y(g),t[8]=g,t[9]=_);let v;t[10]!==s||t[11]!==i||t[12]!==p||t[13]!==c||t[14]!==u?(v=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:p}),t[10]=s,t[11]=i,t[12]=p,t[13]=c,t[14]=u,t[15]=v):v=t[15];let b;return t[16]!==l||t[17]!==h||t[18]!==_||t[19]!==v?(b=(0,I.jsx)(`div`,{ref:l,style:h,className:_,children:v}),t[16]=l,t[17]=h,t[18]=_,t[19]=v,t[20]=b):b=t[20],b},Ge=32,Ke=(e,t)=>{if(!t)return;if(!e){t.scrollIntoView({block:`nearest`});return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top+e.scrollTop,a=i+r.height,o=e.scrollTop,s=o+e.clientHeight,c=i<o+Ge?i-Ge:a>s?a-e.clientHeight:o,l=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.max(0,Math.min(c,l))},z=({providers:e,favoriteModels:t,recentModels:n,getMetadata:r,searchQuery:i,onSearchQueryChange:a,onSelect:o,labels:s,selectedModel:c,hiddenModels:l=[],allowedProviderIds:u,allowedModelIdsByProvider:d,includeNotSelected:f=!1,onSelectNone:p,selectionCount:m,disabled:h=!1,maxHeightClassName:g=`max-h-[min(400px,calc(100dvh-12rem))] flex-1`,maxHeightStyle:_,sectionHeaderClassName:v,rowClassName:b,stickyHeaders:ee=!0,autoFocus:x=!0,onEscape:S,isFavorite:C,onToggleFavorite:te,renderRowEnd:w,onActiveKeyDown:ne,onActiveEntryChange:T,onVariantKey:D,onReorderFavorite:re,reorderFavoriteAriaLabel:ie,reorderFavoriteTitle:ae,providerOrder:se,onReorderProvider:ce,reorderProviderTitle:_e,footerContent:ye,renderVersion:k,tooltipsEnabled:we=!0,virtualize:A=!1})=>{let j=O.useRef(null);j.current||=Be();let M=j.current,N=O.useRef([]),Te=O.useRef(null),P=O.useRef(!1),Ee=O.useRef(null),De=Me(e=>e.collapsedSections),Oe=Me(e=>e.toggleSection),ke=O.useMemo(()=>new Set(Object.keys(De).filter(e=>De[e])),[De]),F=i.trim().length>0,[Ne,Pe]=O.useState(()=>new Set),L=F?Ne:ke,Fe=ge(de(me,{activationConstraint:{distance:8}})),Re=ge(de(pe,{activationConstraint:{distance:8}})),R=O.useMemo(()=>!u||u.length===0?null:new Set(u),[u]),Ge=O.useMemo(()=>d?new Map(Object.entries(d).map(([e,t])=>[e,new Set(t)])):null,[d]),z=O.useCallback((e,t)=>!Ge||Ge.get(e)?.has(t)===!0,[Ge]),B=O.useMemo(()=>new Map(e.map(e=>[e.id,e])),[e]),V=O.useCallback((e,t)=>l.some(n=>n.providerID===e&&n.modelID===t),[l]),H=O.useCallback((e,t)=>{let n=i.trim();return!n||je(`${t} ${e}`,n)},[i]),U=O.useMemo(()=>t.filter(({model:e,providerID:t,modelID:n})=>{if(R&&!R.has(t)||!z(t,n)||V(t,n))return!1;let r=B.get(t)?.name||t;return H(Ie(e),r)}),[R,t,z,V,H,B]),W=O.useMemo(()=>n.filter(({model:e,providerID:t,modelID:n})=>{if(R&&!R.has(t)||!z(t,n)||V(t,n))return!1;let r=B.get(t)?.name||t;return H(Ie(e),r)}),[R,z,V,H,B,n]),qe=O.useMemo(()=>{if(!se||se.length===0)return e;let t=new Map(se.map((e,t)=>[e,t])),n=e.filter(e=>t.has(e.id)).sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)),r=e.filter(e=>!t.has(e.id));return[...n,...r]},[se,e]),G=O.useMemo(()=>qe.filter(e=>!R||R.has(e.id)).map(e=>{let t=(Array.isArray(e.models)?e.models:[]).filter(t=>{let n=typeof t.id==`string`?t.id:``;return!n||V(e.id,n)||!z(e.id,n)?!1:H(Ie(t),e.name||e.id)});return{...e,models:t}}).filter(e=>e.models.length>0),[R,z,V,H,qe]),{flatModelList:K,modelRowIndices:Je}=O.useMemo(()=>{let e=[],t=new Map,n=(n,r)=>{t.set(`${r}:${n.providerID}:${n.modelID}`,e.length),e.push(n)};return L.has(`favorites`)||U.forEach(e=>n(e,`fav`)),L.has(`recent`)||W.forEach(e=>n(e,`recent`)),G.forEach(e=>{L.has(`provider:${e.id}`)||e.models.forEach(t=>n({model:t,providerID:e.id,modelID:t.id},`provider`))}),{flatModelList:e,modelRowIndices:t}},[L,U,G,W]),[q,Ye]=O.useState(16);O.useLayoutEffect(()=>{A&&Ye(Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16)},[A]);let J=O.useMemo(()=>{if(!A)return[];let e=[],t=0,n=(n,r,i,a)=>{if(e.push({key:n,height:(1.5+(a?.625:0))*q,modelIndex:-1}),!L.has(n))for(let a of r)e.push({key:`${n}:${a.providerID}:${a.modelID}`,height:i*q,modelIndex:t++})};return U.length&&n(`favorites`,U,2.5,!1),W.length&&n(`recent`,W,2.5,U.length>0),G.forEach((e,t)=>n(`provider:${e.id}`,e.models.map(t=>({model:t,providerID:e.id,modelID:t.id})),2,t>0||U.length>0||W.length>0)),e},[L,U,G,W,q,A]),Xe=O.useMemo(()=>({estimateSize:e=>J[e].height,getItemKey:e=>J[e].key}),[J]),Ze=Ce({enabled:A,count:J.length,getScrollElement:()=>Te.current,...Xe,paddingStart:.375*q,paddingEnd:.375*q,overscan:6,initialRect:{width:400,height:400}}).getVirtualItems(),Qe=new Set(Ze.map(e=>J[e.index].modelIndex)),Y=K.length>0,X=!!re&&i.trim().length===0&&U.length>1,$e=!!ce&&i.trim().length===0&&!R&&G.length>1,et=O.useMemo(()=>new Map(U.map(e=>[`${e.providerID}:${e.modelID}`,e])),[U]);O.useEffect(()=>{M.set(0)},[i,M]),O.useEffect(()=>{F||Pe(e=>e.size===0?e:new Set)},[F]);let tt=O.useCallback(e=>{M.set(e),T?.(K[e])},[K,T,M]),nt=O.useCallback(e=>{let t=K.length;if(t===0)return;P.current=!0,Ee.current=null;let n=(M.getSnapshot()+e+t)%t;M.set(n),T?.(K[n]),requestAnimationFrame(()=>Ke(Te.current,N.current[n]))},[K,T,M]);O.useEffect(()=>{T?.(K[M.getSnapshot()])},[K,T,M]);let rt=O.useCallback(e=>{if(!e.defaultPrevented){if(e.stopPropagation(),e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=K[M.getSnapshot()];if(t&&D?.(e,t))return}if(ne?.(e,K[M.getSnapshot()]),!e.defaultPrevented){if(e.key===`ArrowDown`){e.preventDefault(),nt(1);return}if(e.key===`ArrowUp`){e.preventDefault(),nt(-1);return}if(e.key===`Enter`){e.preventDefault();let t=K[M.getSnapshot()];t&&!h&&o(t);return}e.key===`Escape`&&(e.preventDefault(),S?.())}}},[h,K,nt,ne,S,o,D,M]),it=y(`model-picker-section-header typography-micro font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 px-2 py-1.5`,ee&&`sticky top-0 z-10 [background:linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))]`,v),at=(e,t,n,i)=>{let a=Je.get(`${t}:${e.providerID}:${e.modelID}`);if(a===void 0)return null;if(A&&!i?.isDragging&&!(Ze.length?Qe.has(a):a<12))return(0,I.jsx)(`div`,{ref:e=>{N.current[a]=e},className:`model-picker-row-placeholder`,"data-model-section":t,"aria-hidden":`true`},`${t}-${e.providerID}-${e.modelID}`);let l=Ae(e.providerID,e.model,r?.(e.providerID,e.modelID)),u=B.get(e.providerID)?.name||e.providerID,d=Le(l?.limit?.context),f=m?.(e)??0,p=c?.providerID===e.providerID&&c.modelID===e.modelID,g=C?.(e)??!1,_=e=>{let t={x:e.clientX,y:e.clientY},n=Ee.current,r=!n||n.x!==t.x||n.y!==t.y;Ee.current=t,!(P.current&&!n)&&(P.current&&!r||(P.current&&r&&(P.current=!1),tt(a)))};return(0,I.jsx)(Ve,{store:M,index:a,renderVersion:k,children:r=>{let c=(0,I.jsxs)(`div`,{ref:e=>{N.current[a]=e},role:`option`,"data-model-section":t,"aria-selected":p,"aria-setsize":A?K.length:void 0,"aria-posinset":A?a+1:void 0,"aria-disabled":h||void 0,tabIndex:-1,onClick:()=>{h||o(e)},onKeyDown:t=>{h||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e))},onMouseEnter:_,onMouseMove:_,className:y(`model-picker-row w-full text-left px-2 py-1.5 rounded-md typography-meta flex items-center gap-2 cursor-pointer`,!h&&(r?`bg-interactive-selection`:`hover:bg-interactive-hover/50`),h&&`cursor-not-allowed opacity-60`,b),children:[(0,I.jsxs)(`div`,{className:`model-picker-row-main flex items-center gap-1.5 flex-1 min-w-0`,children:[i?(0,I.jsx)(`button`,{type:`button`,ref:i.setActivatorNodeRef,...i.attributes,...i.listeners,disabled:h,onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`model-favorite-drag-handle flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground hover:text-foreground disabled:pointer-events-none`,"aria-label":ie,title:ae,children:(0,I.jsx)(E,{name:`draggable`,className:`size-3.5`})}):null,n?(0,I.jsx)(le,{modelId:e.modelID,providerId:e.providerID,className:`h-3.5 w-3.5 flex-shrink-0`}):null,(0,I.jsxs)(`span`,{className:`model-picker-row-labels contents`,children:[(0,I.jsx)(`span`,{className:`model-picker-row-name font-medium truncate`,children:Ie(e.model)}),(0,I.jsxs)(`span`,{className:`model-picker-row-meta contents`,children:[t===`provider`?null:(0,I.jsx)(`span`,{className:`model-picker-row-provider hidden truncate`,children:u}),d?(0,I.jsx)(`span`,{className:`model-picker-row-context typography-micro text-muted-foreground flex-shrink-0`,children:d}):null]})]})]}),f>0?(0,I.jsxs)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:[`x`,f]}):null,w?.(e,{isHighlighted:r,isSelected:p}),(0,I.jsx)(`span`,{className:y(`model-picker-row-selection size-4 shrink-0`,!p&&`hidden`),children:p?(0,I.jsx)(E,{name:`check`,className:`h-4 w-4 text-primary`}):null}),te?(0,I.jsx)(`button`,{type:`button`,disabled:h,onClick:t=>{t.preventDefault(),t.stopPropagation(),te(e)},className:y(`model-favorite-button flex h-4 w-4 items-center justify-center hover:text-primary/80 flex-shrink-0 disabled:pointer-events-none`,g?`text-primary`:`text-muted-foreground`),"aria-label":g?s.unfavorite:s.favorite,title:g?s.unfavorite:s.favorite,children:(0,I.jsx)(E,{name:g?`star-fill`:`star`,className:`h-3.5 w-3.5`})}):null]});return(0,I.jsx)(ze,{metadata:l,providerName:u,providerID:e.providerID,modelID:e.modelID,active:we&&r,anchor:()=>N.current[a],labels:s,children:c})}},`${t}-${e.providerID}-${e.modelID}`)},ot=e=>{if(!re)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=et.get(String(t.id)),i=et.get(String(n.id));!r||!i||re(r,i)},st=e=>{if(!ce)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=qe.map(e=>e.id),i=r.indexOf(String(t.id)),a=r.indexOf(String(n.id));i!==-1&&a!==-1&&ce(ve(r,i,a))},Z=e=>L.has(e),ct=e=>{if(!F){Oe(e);return}Pe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},lt=(e,t,n,r)=>{let i=Z(e),a=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ct(e))};return r?(0,I.jsxs)(`div`,{ref:r.setActivatorNodeRef,...r.attributes,...r.listeners,role:`button`,tabIndex:0,"aria-expanded":!i,title:_e,className:y(it,`w-full text-left cursor-grab select-none active:cursor-grabbing`),onClick:()=>ct(e),onKeyDown:a,children:[(0,I.jsx)(E,{name:`draggable`,className:`size-3.5 flex-shrink-0 text-muted-foreground/70`}),t,(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,I.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,I.jsx)(E,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]}):(0,I.jsxs)(`button`,{type:`button`,className:y(it,`w-full text-left cursor-pointer`),onClick:()=>ct(e),"aria-expanded":!i,children:[t,(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,I.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,I.jsx)(E,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]})},ut=(e,t,n)=>(0,I.jsxs)(I.Fragment,{children:[t>0?(0,I.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,lt(`provider:${e.id}`,(0,I.jsx)(ue,{providerId:e.id,className:`h-4 w-4 flex-shrink-0`}),e.name||e.id,n),Z(`provider:${e.id}`)?null:e.models.map(t=>at({model:t,providerID:e.id,modelID:t.id},`provider`,!0))]});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`model-picker-search-area p-1.5 pb-1`,children:(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(E,{name:`search`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,I.jsx)(oe,{type:`text`,placeholder:s.searchPlaceholder,value:i,onChange:e=>a(e.target.value),onKeyDown:rt,className:`model-picker-search h-8 pl-8 typography-meta`,autoFocus:x})]})}),(0,I.jsx)(Se,{ref:Te,outerClassName:g,className:`overlay-scrollbar-target--no-gutter`,style:_,children:(0,I.jsxs)(`div`,{className:`model-picker-list px-1`,children:[f?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 typography-meta text-muted-foreground hover:bg-interactive-hover/50`,onClick:p,children:[(0,I.jsx)(E,{name:`close`,className:`h-3.5 w-3.5`}),(0,I.jsx)(`span`,{children:s.notSelected}),c?null:(0,I.jsx)(E,{name:`check`,className:`h-4 w-4 text-primary ml-auto`})]}),(0,I.jsx)(`div`,{className:`h-px bg-border/40 my-1`})]}):null,Y?null:(0,I.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:s.noResults}),U.length>0?(0,I.jsxs)(`div`,{className:`model-picker-section`,children:[lt(`favorites`,(0,I.jsx)(E,{name:`star-fill`,className:`h-4 w-4 text-primary`}),s.favorites),!Z(`favorites`)&&(X?(0,I.jsx)(he,{sensors:Fe,collisionDetection:fe,onDragEnd:ot,children:(0,I.jsx)(xe,{items:U.map(e=>`${e.providerID}:${e.modelID}`),strategy:be,children:U.map(e=>(0,I.jsx)(Ue,{id:`${e.providerID}:${e.modelID}`,disabled:h,children:t=>at(e,`fav`,!0,t)},`fav-sortable-${e.providerID}-${e.modelID}`))})}):U.map(e=>at(e,`fav`,!0)))]}):null,W.length>0?(0,I.jsxs)(`div`,{className:`model-picker-section`,children:[U.length>0?(0,I.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,lt(`recent`,(0,I.jsx)(E,{name:`time`,className:`h-4 w-4`}),s.recent),Z(`recent`)?null:W.map(e=>at(e,`recent`,!0))]}):null,(U.length>0||W.length>0)&&G.length>0?(0,I.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,$e?(0,I.jsx)(he,{sensors:Re,collisionDetection:fe,onDragEnd:st,children:(0,I.jsx)(xe,{items:G.map(e=>e.id),strategy:be,children:G.map((e,t)=>(0,I.jsx)(We,{id:e.id,disabled:h,children:n=>ut(e,t,n)},e.id))})}):G.map((e,t)=>(0,I.jsx)(`div`,{children:ut(e,t)},e.id))]})}),(0,I.jsx)(`div`,{className:`model-picker-footer px-3 pt-1 pb-1.5 border-t border-border/40 typography-micro text-muted-foreground`,children:(0,I.jsx)(He,{store:M,flatModelList:K,footerContent:ye,fallback:s.keyboardHint})})]})};function B(){}function V(e){let{key:t,icon:n,label:r}=e;return(0,I.jsx)(L,{iconName:n,label:r},t)}function H(e,t,n,r,i){let a=e.find(e=>e.id===n);if(!a)return null;let o=(Array.isArray(a.models)?a.models:[]).find(e=>e.id===r);return!o||t.some(e=>e.providerID===n&&e.modelID===r)?null:i===void 0?{provider:a,model:o,providerID:n,modelID:r}:{provider:a,model:o,providerID:n,modelID:r,variant:i}}var U=e=>{let t=(0,k.c)(30),n=S(W),r=d(qe),i=d(G),a=d(K),o=e?.currentProviderID??null,s=e?.currentModelID??null,c;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==a||t[5]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return H(n,a,t,r,i)},t[4]=a,t[5]=n,t[6]=e):e=t[6],c=r.map(e).filter(Je),t[0]=r,t[1]=a,t[2]=n,t[3]=c}else c=t[3];let l=c,u;if(t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==a||t[11]!==n||t[12]!==i){bb0:{let e;t[14]!==a||t[15]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return H(n,a,t,r,i)},t[14]=a,t[15]=n,t[16]=e):e=t[16];let c;t[17]===r?c=t[18]:(c=e=>{let{providerID:t,modelID:n}=e;return!r.some(e=>e.providerID===t&&e.modelID===n)},t[17]=r,t[18]=c);let l=i.map(e).filter(q).filter(c);if(!o||!s){u=l;break bb0}if(r.some(e=>e.providerID===o&&e.modelID===s)){u=l;break bb0}let d;t[19]!==s||t[20]!==o?(d=e=>e.providerID===o&&e.modelID===s,t[19]=s,t[20]=o,t[21]=d):d=t[21];let f=l.findIndex(d);if(f===0){u=l;break bb0}if(f>0){let e=l.slice(),[t]=e.splice(f,1);e.unshift(t),u=e;break bb0}let p;t[22]!==s||t[23]!==o||t[24]!==a||t[25]!==n?(p=H(n,a,o,s),t[22]=s,t[23]=o,t[24]=a,t[25]=n,t[26]=p):p=t[26];let m=p;if(!m){u=l;break bb0}u=[m,...l]}t[7]=s,t[8]=o,t[9]=r,t[10]=a,t[11]=n,t[12]=i,t[13]=u}else u=t[13];let f=u,p;return t[27]!==l||t[28]!==f?(p={favoriteModelsList:l,recentModelsList:f},t[27]=l,t[28]=f,t[29]=p):p=t[29],p};function W(e){return e.providers}function qe(e){return e.favoriteModels}function G(e){return e.recentModels}function K(e){return e.hiddenModels}function Je(e){return e!==null}function q(e){return e!==null}var Ye=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function J(e){let t=Ye(e),n=await ie(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var Xe=6e4,Ze=500,Qe=1048576,Y=new Map,X=new Map,$e=0,et=(e,t)=>e.length+t.length,tt=(e,t)=>{Y.delete(e),Y.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of Y)n+=et(e,t.root);for(;Y.size>Ze||n>Qe&&Y.size>1;){let e=Y.entries().next().value;if(!e)break;n-=et(e[0],e[1].root),Y.delete(e[0])}};function nt(e){if($e+=1,typeof e==`string`&&e){let t=Ye(e);Y.delete(t),X.delete(t);return}Y.clear(),X.clear()}var rt=async e=>ae(e).catch(()=>e),it=async e=>{let t=Y.get(e);if(t&&Date.now()-t.resolvedAt<Xe)return Y.delete(e),Y.set(e,t),t.root;t&&Y.delete(e);let n=X.get(e);if(n)return n;let r=$e,i=rt(e).then(t=>($e===r&&tt(e,t),t)).catch(()=>e).finally(()=>{X.get(e)===i&&X.delete(e)});return X.set(e,i),i};async function at(e,t){let n=Ye(e);if(!n)return`HEAD`;try{let e=await it(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await ie(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var ot=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},st=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:ot(e),worktreeSource:`existing`}),Z=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},ct=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),lt=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),ut=(e,t)=>{let n=Z(e);n&&w.setState(e=>{let r=!1,i=e=>Z(e.path)!==n&&Z(e.worktreeRoot??e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},dt=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,ft=e=>{let t=Z(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},pt=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(x(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},mt=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=ct(e.worktreeName??e.preferredName??``),i=lt(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=lt(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=pt({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},ht=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},gt=new Map,Q=new Map,_t=new Map,vt=new Map,yt=new Map,bt=new WeakMap,xt=3e4,St=``,Ct=()=>{let e=`${n()}\u0000${t()}`;return e!==St&&(St=e,gt.clear(),Q.clear(),_t.clear(),vt.clear(),yt.clear()),e},wt=e=>`${Ct()}\u0000${Z(e)}`,Tt=(e,t=wt(e))=>_t.get(t)??0,Et=e=>{let t=wt(e),n=vt.get(t)??Z(e),r=wt(n);yt.set(r,(yt.get(r)??0)+1);let i=new Set([t,r]);for(let[e,t]of vt)e.startsWith(`${Ct()}\u0000`)&&t===n&&i.add(e);for(let e of i)_t.set(e,(_t.get(e)??0)+1),gt.delete(e);l(n),Z(e)!==n&&l(e)},Dt=async(e,t,n)=>{let r=Z(await ae(e)),i=Z(e),a=`${t}\u0000${r}`,o=n&&bt.get(n);n&&!o&&(o=new Map,bt.set(n,o)),n&&!o?.has(a)&&t===Ct()&&Et(r);let s=yt.get(a)??0,c=o?.get(a);(!c||c.generation!==s)&&(n&&c&&l(r),c={generation:s,value:D.worktree.list(r)},o?.set(a,c));let u=await c.value;t===Ct()&&vt.set(`${t}\u0000${e}`,r);let d=u.filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let t=Z(e.path),n=(e.branch||``).replace(/^refs\/heads\//,``).trim(),i=(e.name||``).trim(),a=st(e,t);return{source:`sdk`,name:i||ft(t),path:t,projectDirectory:r,branch:n,label:n||i||ft(t),worktreeRoot:a.worktreeRoot,worktreeStatus:a.worktreeStatus,headState:a.headState,worktreeSource:a.worktreeSource}});return v(i,d).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},Ot=async(e,t,n,r)=>{for(;;){let i=Tt(e,t),a=await Dt(e,n,r);if(n!==Ct())return a;if(i===Tt(e,t))return gt.set(t,{value:a,at:Date.now()}),a}};async function kt(e,t){let n=Z(e.path),r=Ct(),i=`${r}\u0000${n}`,a=gt.get(i);if(a&&Date.now()-a.at<xt)return a.value;let o=Q.get(i);if(o)return o;let s=Ot(n,i,r,t).finally(()=>{Q.get(i)===s&&Q.delete(i)});return Q.set(i,s),s}var At=(e,t)=>{let n=_(e.worktreeRoot??e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},jt=e=>{let t=new Set([...e].map(Z));if(t.size===0)return;let n=w.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(Z(i.path))&&r.delete(e);for(let[e,n]of T.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?Z(n.worktreeRoot):``,i=typeof n.cwd==`string`&&n.cwd.trim()?Z(n.cwd):``;(r&&t.has(r)||i&&t.has(i))&&T.getState().clearAttachment(e)}r.size!==n.size&&w.setState({worktreeMetadata:r})};async function Mt(e,t={}){let n=Z(e.path),r=wt(n);_t.set(r,Tt(n)+1),gt.delete(r),Q.delete(r);let i=await kt({...e,path:n},t.refreshBatch??{}),a=vt.get(r);if(t.isCurrent&&!t.isCurrent())return{worktrees:i,addedDirectories:[],removedDirectories:[],repositoryDirectory:a};let o=i,s=[],c=[];return w.setState(e=>{let t=e.availableWorktreesByProject,r=v(n,t.get(n)??[]),a=new Map(r.map(e=>[Z(e.path),e])),l=i.map(e=>At(e,a.get(Z(e.path)))),u=new Set(l.map(e=>Z(e.path)));if(s=l.filter(e=>!a.has(Z(e.path))).map(e=>e.path),c=r.filter(e=>!u.has(Z(e.path))).map(e=>e.path),o=l,r.length===l.length&&r.every((e,t)=>{let n=l[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus})&&r.every((e,r)=>e===t.get(n)?.[r])&&r.length===(t.get(n)?.length??0))return{};let d=new Map(t);return d.set(n,l),{availableWorktreesByProject:d,availableWorktrees:[...d.values()].flat()}}),jt(c),{worktrees:o,addedDirectories:s,removedDirectories:c,repositoryDirectory:a}}async function Nt(e,t){let n=Z(e.path),r=Z(await ae(n));vt.set(wt(n),r);let i=n===Z(r)?[]:await D.worktree.list(r),a=mt(t,n),o=await D.worktree.create(n,a),s=typeof o?.name==`string`?o.name:``,c=typeof o?.branch==`string`?o.branch:``,l=typeof o?.path==`string`?o.path:``;if(!s||!l)throw Error(`Worktree create missing name/path`);let u={source:`sdk`,name:s,path:Z(l),projectDirectory:r,branch:c,label:c||s,worktreeRoot:Z(l),worktreeStatus:dt(o?.bootstrapStatus),headState:c?`branch`:`unborn`,worktreeSource:`created-for-session`},d=v(n,[...i.filter(e=>!!e.path).map(e=>({path:e.path,worktreeRoot:e.path,projectDirectory:r,branch:e.branch??``,label:e.branch??``})),u]).find(e=>e.worktreeRoot===u.worktreeRoot)??u,f=d.worktreeRoot??d.path;o?.bootstrapStatus?g(f,o.bootstrapStatus):ne(f),C(f,{onFailed:()=>ut(f,`invalid`),onReady:()=>ut(f,`ready`)}),Et(n),nt();let p=n;return w.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(p)??[];return t.set(p,[...n.filter(e=>Z(e.path)!==d.path),d]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),d}async function Pt(e,t){let n=e.path,r=mt(t,n);return D.worktree.validate(n,r)}async function Ft(e,t,n){let r=Z(e.path),i=!!n?.deleteRemoteBranch,a=n?.deleteLocalBranch===!0,o=n?.remoteName;if(!(await D.worktree.remove(r,{directory:t.worktreeRoot??t.path,deleteLocalBranch:a}))?.success)throw Error(`Worktree removal failed`);m(t.worktreeRoot??t.path),Et(Z(e.path)),nt();let s=Z(t.worktreeRoot??t.path),c=w.getState().availableWorktreesByProject,l=new Map(c),u=new Set([s,Z(t.path)]);for(let[e,t]of c){let n=t.filter(e=>Z(e.worktreeRoot??e.path)!==s||(u.add(Z(e.path)),!1));n.length!==t.length&&(l.set(e,n),Et(e))}jt(u),w.setState({availableWorktreesByProject:l,availableWorktrees:w.getState().availableWorktrees.filter(e=>Z(e.worktreeRoot??e.path)!==s)});let d=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&d&&await re(r,{branch:d,remote:o}).catch(()=>void 0)}var It=200,$=new Map,Lt=[{key:`code`,Icon:`code-box`,label:`Code`},{key:`terminal`,Icon:`terminal-box`,label:`Terminal`},{key:`rocket`,Icon:`rocket`,label:`Rocket`},{key:`flask`,Icon:`flask`,label:`Lab`},{key:`gamepad`,Icon:`gamepad`,label:`Game`},{key:`briefcase`,Icon:`briefcase`,label:`Work`},{key:`home`,Icon:`home`,label:`Home`},{key:`globe`,Icon:`global`,label:`Web`},{key:`leaf`,Icon:`leaf`,label:`Nature`},{key:`shield`,Icon:`shield`,label:`Security`},{key:`palette`,Icon:`palette`,label:`Design`},{key:`server`,Icon:`server`,label:`Server`},{key:`phone`,Icon:`smartphone`,label:`Mobile`},{key:`database`,Icon:`database-2`,label:`Data`},{key:`lightbulb`,Icon:`lightbulb`,label:`Idea`},{key:`music`,Icon:`music`,label:`Music`},{key:`camera`,Icon:`camera`,label:`Media`},{key:`book`,Icon:`book-open`,label:`Docs`},{key:`heart`,Icon:`heart`,label:`Favorite`}],Rt=Object.fromEntries(Lt.map(e=>[e.key,e.Icon])),zt=[{key:`keyword`,label:`Purple`,cssVar:`var(--syntax-keyword)`},{key:`string`,label:`Green`,cssVar:`var(--syntax-string)`},{key:`number`,label:`Pink`,cssVar:`var(--syntax-number)`},{key:`type`,label:`Gold`,cssVar:`var(--syntax-type)`},{key:`constant`,label:`Cyan`,cssVar:`var(--syntax-constant)`},{key:`comment`,label:`Muted`,cssVar:`var(--syntax-comment)`},{key:`error`,label:`Red`,cssVar:`var(--status-error)`},{key:`primary`,label:`Blue`,cssVar:`var(--primary)`},{key:`success`,label:`Green`,cssVar:`var(--status-success)`}],Bt=Object.fromEntries(zt.map(e=>[e.key,e.cssVar])),Vt=(e,t)=>{if(typeof e!=`number`||e<=0)return null;let n=new URLSearchParams({v:String(e)});return typeof t?.iconColor==`string`&&t.iconColor.trim()&&n.set(`iconColor`,t.iconColor.trim()),(t?.themeVariant===`light`||t?.themeVariant===`dark`)&&n.set(`theme`,t.themeVariant),n},Ht=(e,t)=>e?[r()||`same-origin`,e,t.toString()].join(`|`):null,Ut=(e,t,n)=>{let r=Vt(t,n);if(!r)return null;let i=Ht(e,r);return i?{cacheKey:i,projectId:e,query:r}:null},Wt=()=>{for(;$.size>It;){let e=$.keys().next().value;if(typeof e!=`string`)return;let t=$.get(e);t?.url&&typeof URL<`u`&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(t.url),$.delete(e)}},Gt=e=>{let t=$.get(e.cacheKey);if(t?.url)return Promise.resolve(t.url);if(t?.promise)return t.promise;let n=i(`/api/projects/${encodeURIComponent(e.projectId)}/icon`,{method:`GET`,headers:{Accept:`image/*`},query:e.query}).then(async t=>{if(!t.ok||typeof URL>`u`||typeof URL.createObjectURL!=`function`)return null;let n=await t.blob(),r=URL.createObjectURL(n);return $.set(e.cacheKey,{url:r}),Wt(),r}).catch(()=>null).finally(()=>{let t=$.get(e.cacheKey);t?.promise===n&&!t.url&&$.delete(e.cacheKey)});return $.set(e.cacheKey,{promise:n}),n},Kt=(e,t)=>{let n=(0,k.c)(10),r=e.id,i=e.iconImage?.updatedAt,a=t?.themeVariant,o=t?.iconColor,s;n[0]!==o||n[1]!==r||n[2]!==a||n[3]!==i?(s=Ut(r,i,{themeVariant:a,iconColor:o}),n[0]=o,n[1]=r,n[2]=a,n[3]=i,n[4]=s):s=n[4];let c=s,l;n[5]===c?l=n[6]:(l=()=>c?$.get(c.cacheKey)?.url??null:null,n[5]=c,n[6]=l);let[u,d]=O.useState(l),f,p;return n[7]===c?(f=n[8],p=n[9]):(f=()=>{if(!c){d(null);return}let e=$.get(c.cacheKey)?.url;if(e){d(e);return}let t=!1;return d(null),Gt(c).then(e=>{t||d(e)}),()=>{t=!0}},p=[c],n[7]=c,n[8]=f,n[9]=p),O.useEffect(f,p),u},qt=e=>{let t=(0,k.c)(21),{project:n,options:r,className:i,alt:a,draggable:o,fallback:s,onError:c}=e,l=a===void 0?``:a,u=o!==void 0&&o,d=s===void 0?null:s,f=Kt(n,r),[p,m]=O.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1)},t[0]=h):h=t[0];let g=n.iconImage?.updatedAt,_;if(t[1]!==n.id||t[2]!==f||t[3]!==g?(_=[f,n.id,g],t[1]=n.id,t[2]=f,t[3]=g,t[4]=_):_=t[4],O.useEffect(h,_),!f||p){let e;return t[5]===d?e=t[6]:(e=O.createElement(O.Fragment,null,d),t[5]=d,t[6]=e),e}let v;if(t[7]!==l||t[8]!==i||t[9]!==u||t[10]!==c||t[11]!==f){let e;t[13]===c?e=t[14]:(e=e=>{m(!0),c?.(e)},t[13]=c,t[14]=e);let n;t[15]!==l||t[16]!==i||t[17]!==u||t[18]!==f||t[19]!==e?(n={src:f,alt:l,className:i,draggable:u,onError:e},t[15]=l,t[16]=i,t[17]=u,t[18]=f,t[19]=e,t[20]=n):n=t[20],v=O.createElement(`img`,n),t[7]=l,t[8]=i,t[9]=u,t[10]=c,t[11]=f,t[12]=v}else v=t[12];return v};export{P as C,Oe as S,Ae as _,qt as a,Ee as b,kt as c,ht as d,at as f,je as g,z as h,Rt as i,Ft as l,U as m,Bt as n,Nt as o,J as p,Lt as r,Mt as s,zt as t,Pt as u,N as v,De as x,Te as y};