@yuriai/web 0.2.38 → 0.2.39-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AgentAvatar-qwoC8op7.js +1 -0
- package/dist/assets/AssistantConversationSurface-BmOHENhF.css +1 -0
- package/dist/assets/AssistantConversationSurface-CyJGN78Z.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-DDw7a4MF.js → AssistantUnreadBadge-Hnqqug3k.js} +1 -1
- package/dist/assets/AssistantView-CFadOGiW.js +1 -0
- package/dist/assets/{DiagramView-CrjS-7Qg.js → DiagramView-D1g_U1Ve.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BWkJi5dK.js → FadeInOnReveal-DLWVDmNr.js} +1 -1
- package/dist/assets/{GuiPluginPage-Ct7QUMjH.js → GuiPluginPage-DGrpzWyU.js} +1 -1
- package/dist/assets/{GuiPluginSurface-C1a1HAzL.js → GuiPluginSurface-CU2-fLdm.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CGnY_Jp_.js → GuiPluginWindow-Cear_hK6.js} +1 -1
- package/dist/assets/{Icon-Co7WGN1G.js → Icon-D6eeecf3.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-KEVw1Pg-.js → ImageLoadingPlaceholder-BJguSRQf.js} +1 -1
- package/dist/assets/{LoadingImage-PH45V6oj.js → LoadingImage-C0ebLsVf.js} +1 -1
- package/dist/assets/MarkdownRenderer-Bibq6sQR.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-v1YoJHFp.js → MarkdownRendererImpl-CRMSm9zP.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-UwcR7nzW.js → MarkstreamRendererImpl-Cz3f0w5O.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-B8t6gz_S.js → MobileDetailNavigation-BfTbzw3E.js} +1 -1
- package/dist/assets/{MobileResizableSheet-Dd1w8a-6.js → MobileResizableSheet-CSHVXdcc.js} +1 -1
- package/dist/assets/{MobileShareBridge-DCE_Ahre.js → MobileShareBridge-CrnmSDpN.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-BYRAlNQp.js → MobileTabPageHeader-CwAiYIiK.js} +1 -1
- package/dist/assets/{MultiRunWindow-CxjpWlHn.js → MultiRunWindow-A7FOh3y9.js} +1 -1
- package/dist/assets/{OnboardingScreen-4LgzNqG4.js → OnboardingScreen-C4aWPE5g.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BQua3Ko6.js → OverlayScrollbar-BDmFJvuO.js} +1 -1
- package/dist/assets/{SettingsView-DxqpYiwv.js → SettingsView-YvxmCurl.js} +1 -1
- package/dist/assets/{SettingsWindow-DmhZHg_E.js → SettingsWindow-C6sp5FCT.js} +1 -1
- package/dist/assets/{SetupTourDialog-CzNscVSi.js → SetupTourDialog-DAbtAImS.js} +1 -1
- package/dist/assets/{TerminalView-BAqu9LRw.js → TerminalView-bFqYE6E8.js} +1 -1
- package/dist/assets/{ToolOutputDialog-C5b57FEy.js → ToolOutputDialog-BfKFoRx6.js} +1 -1
- package/dist/assets/{VoiceSettings-D4aaoz88.js → VoiceSettings-BFJoynNT.js} +1 -1
- package/dist/assets/{appThemeRegistry-DDaIHQum.js → appThemeRegistry-DzF1KyRO.js} +1 -1
- package/dist/assets/{capgoAdapter-CXcqPnFa.js → capgoAdapter-DomoN2dQ.js} +1 -1
- package/dist/assets/{checkbox-o8x1LJC4.js → checkbox-ClSxDwlM.js} +1 -1
- package/dist/assets/{collapsible-ZLW5y35Q.js → collapsible-Dhf2eN1l.js} +1 -1
- package/dist/assets/{context-menu-Bv2RsqQe.js → context-menu-DQz7Hocu.js} +1 -1
- package/dist/assets/{diagram-hqhzT9yo.js → diagram-BaIvxWpH.js} +1 -1
- package/dist/assets/{dialog-C7D331XW.js → dialog-B1Rrafoy.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-C3_guqVF.js → fileMentionTouchSelection-CUUCXrKA.js} +1 -1
- package/dist/assets/{gitApi-BOyQ2o3N.js → gitApi-L3nS1oNJ.js} +1 -1
- package/dist/assets/{input-os0CMgxY.js → input-el2PLKbt.js} +1 -1
- package/dist/assets/{insertionBoundaries-CGcJ-kUX.js → insertionBoundaries-DyPQrOsg.js} +1 -1
- package/dist/assets/{main-DmQr5rK8.js → main-5mNQIc25.js} +5 -5
- package/dist/assets/{main-x_36xEI7.js → main-BPnfMzuY.js} +2 -2
- package/dist/assets/{markdownHeightCache-BWCMEzOk.js → markdownHeightCache-DUGTouXi.js} +1 -1
- package/dist/assets/{mcpQueries-C3EdKlJU.js → mcpQueries-B2gQBmMk.js} +1 -1
- package/dist/assets/{miniChat-Dz4oT5h0.js → miniChat-DkaYsaSY.js} +2 -2
- package/dist/assets/{mobile-C2wjDVrA.js → mobile-B-ZWpOj6.js} +2 -2
- package/dist/assets/{mobile-html-network-DuXwrtnU.js → mobile-html-network-dTGXQKw0.js} +2 -2
- package/dist/assets/{mobileBackNavigation-C456iV52.js → mobileBackNavigation-CXTWT9pL.js} +1 -1
- package/dist/assets/{mobileConnections-DrUWc7kd.js → mobileConnections-NoXReTUi.js} +2 -2
- package/dist/assets/{multirun-CdraBH9O.js → multirun-DizITQa8.js} +1 -1
- package/dist/assets/{native-config-3LSj_OuN.js → native-config--mmoJe_H.js} +1 -1
- package/dist/assets/{projectMeta-CyhJE6CA.js → projectMeta-BzvXAJMC.js} +1 -1
- package/dist/assets/{pwa-BzFEQ5Js.js → pwa-BZGtwuiQ.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-CMMw3KSM.js → queue-abort-optimistic-BZ-uX9Xl.js} +1 -1
- package/dist/assets/{react-BJAlol6I.js → react-CnKEwma7.js} +1 -1
- package/dist/assets/{readiness-DmMVD6xM.js → readiness-NhPYDe48.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-CGDnFkRT.js +2 -0
- package/dist/assets/renderMobileApp-DgTlrPpr.js +29 -0
- package/dist/assets/{runtimeConfig-CAAd0cno.js → runtimeConfig-CBsnA3T3.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DKk9B2jX.js → runtimeEndpointReset-Co74Bqfs.js} +3 -3
- package/dist/assets/{select-ClX56nrO.js → select-Bn8U3CWh.js} +1 -1
- package/dist/assets/sessionLookup-14_73BfN.js +1 -0
- package/dist/assets/{sortable-tabs-strip-BQbGMaz-.js → sortable-tabs-strip-DdP1ALtI.js} +1 -1
- package/dist/assets/{speechSettingsQueries-85xpCH5y.js → speechSettingsQueries-D4ZaI_pC.js} +1 -1
- package/dist/assets/src-D-W1MV14.css +2 -0
- package/dist/assets/telegram-pattern-Y95HsYL8.svg +4649 -0
- package/dist/assets/{textarea-DpsaIedI.js → textarea-CI1VKA2e.js} +1 -1
- package/dist/assets/{tooltip-pELJ38kd.js → tooltip-Bjzgrs1l.js} +1 -1
- package/dist/assets/types-ChrzXO9y.js +2 -0
- package/dist/assets/{useAppFontEffects-CMJ-srCU.js → useAppFontEffects-DtgrP7dP.js} +13 -13
- package/dist/assets/{useDesktopWindowControlsLayout-DBBGRsuU.js → useDesktopWindowControlsLayout-H91TGqj1.js} +1 -1
- package/dist/assets/{useEffectiveDirectory--tyiZ84r.js → useEffectiveDirectory-C_NYC9Sb.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-Dr61mYqA.js → useMobileNavigationStore-BoZDstLm.js} +4 -4
- package/dist/assets/{usePluginsStore-P6_c6c0m.js → usePluginsStore-B3hliD_2.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-D3YtOLbE.js → useStreamingTextThrottle-BA4aJ24a.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-CO7SlSqM.js → useWorkerHighlightedLines-CEl8asH9.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/dist/assets/AgentAvatar-B2GEBJBG.js +0 -1
- package/dist/assets/AssistantContactStatus-CGFpgAuL.js +0 -3
- package/dist/assets/AssistantView-DpYyl49H.js +0 -1
- package/dist/assets/MarkdownRenderer-CZpY_qyH.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-CVNOL7vy.js +0 -2
- package/dist/assets/renderMobileApp-rVz5UaT-.js +0 -29
- package/dist/assets/sessionLookup-DC2xZn-T.js +0 -1
- package/dist/assets/src-ByI2s7WK.css +0 -2
- package/dist/assets/types-D-KYekEQ.js +0 -2
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/ToolOutputDialog-C5b57FEy.js","assets/runtime-auth-mjIpsk3N.js","assets/runtime-switch-BMjl5Y5W.js","assets/runtime-fetch-DKZOpfzo.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-DMsFWy1a.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-BF882_0b.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useMobileHtmlPreviewStore-C03uVLfX.js","assets/vendor-react-DlzBev0S.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/runtime-file-resource-CL7EVzOG.js","assets/fileQueries-D9l0crnM.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/runtime-file-download-DMY1k1af.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-reactuses-core-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/i18n-BU14awhU.js","assets/bootstrap-BhC95qVC.js","assets/runtime-ead7P81A.js","assets/store-BNNIbb4k.js","assets/tour-DDI0Zg7l.js","assets/useMobileNavigationStore-Dr61mYqA.js","assets/gitApiHttp-B1mApXwC.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/vendor-pathe-vBmvQE8f.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-sonner-BEHGipm5.js","assets/useAssistantUIStore-Du8puXWz.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/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/Icon-Co7WGN1G.js","assets/dialog-C7D331XW.js","assets/dialog-CTYD3Sbr.css","assets/tap-LkQum5bB.js","assets/themes-BgDJcxRc.js","assets/MarkdownRenderer-CZpY_qyH.js","assets/useEffectiveDirectory--tyiZ84r.js","assets/markdownHeightCache-BWCMEzOk.js","assets/dualLimitLru-D8Sphgua.js","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-DDaIHQum.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/toolHelpers-iEHVHQ9p.js","assets/image-loading-DEXNCcCm.js","assets/image-loading-D9Z_BASK.css","assets/ImageLoadingPlaceholder-KEVw1Pg-.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/useWorkerHighlightedLines-CO7SlSqM.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/mobileBackNavigation-C456iV52.js","assets/touch-gestures-CErgaXZ7.js","assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/vendor-capacitor-status-bar-D9bcMr9Q.js","assets/vendor-capacitor-keyboard-BRVcFyc9.js","assets/gitApi-BOyQ2o3N.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,_ as n,p as r,r as i,t as a,v as o,w as s}from"./runtime-auth-mjIpsk3N.js";import{c,f as l,i as u,l as d,n as f,r as p,s as m,t as h}from"./runtime-switch-BMjl5Y5W.js";import{n as g}from"./runtime-fetch-DKZOpfzo.js";import{n as _,r as v,t as y}from"./platform-DMsFWy1a.js";import{n as b,t as x}from"./runtimeAPIRegistry-C2VogTny.js";import{a as S,i as C}from"./vendor-zustand-vDaAPGfl.js";import{at as w,ot as T,st as E}from"./vendor-base-ui-CzHs0bHY.js";import{At as D,Gi as O,Mt as k,Wi as A,bt as j,kn as M,po as N,yt as P}from"./gitApiHttp-B1mApXwC.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{T as F,r as I}from"./useUIStore-BF882_0b.js";import{n as L,t as R}from"./vendor-react-DlzBev0S.js";import{s as z}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as B,c as V,o as H,s as ee,u as te}from"./fileQueries-D9l0crnM.js";import{r as ne,s as U}from"./runtime-file-resource-CL7EVzOG.js";import{o as re}from"./path-utils-jGozTg9d.js";import{a as ie,n as W,o as ae}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{a as oe,o as G,s as se,t as ce}from"./useMobileHtmlPreviewStore-C03uVLfX.js";import{n as le}from"./pathNormalization-ewtPqJWn.js";import{t as ue}from"./capgoAdapter-CXcqPnFa.js";/* empty css */import{a as de}from"./vendor-pierre-diffs-BFiZ3IhI.js";import{r as fe}from"./vendor-sonner-BEHGipm5.js";import{i as K,l as pe,p as me,r as q}from"./vendor-reactuses-core-CuTmqEMK.js";import{r as he,t as ge}from"./i18n-BU14awhU.js";import{i as _e,n as ve}from"./store-BNNIbb4k.js";import{a as ye,i as be,l as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./mobileConnections-DrUWc7kd.js";import{S as De,b as Oe,h as ke,t as Ae,v as je,y as Me}from"./MobileDetailNavigation-B8t6gz_S.js";import{A as Ne,An as Pe,Ea as Fe,Fi as Ie,H as Le,J as Re,Jn as J,Kn as Y,Li as ze,Mn as Be,Pt as Ve,Qr as He,R as Ue,Tr as We,Ui as Ge,_r as Ke,ai as qe,at as Je,ci as Ye,cn as Xe,cr as Ze,di as Qe,dr as $e,ei as et,et as tt,fi as nt,ft as rt,hi as it,ji as at,li as ot,ln as st,lt as ct,mi as lt,o as ut,oi as dt,p as ft,pi as pt,pt as mt,q as ht,qr as gt,ri as _t,rn as vt,s as yt,st as bt,t as xt,tt as St,ui as Ct,ut as wt,wr as Tt,xr as Et,yr as Dt,z as Ot}from"./useMobileNavigationStore-Dr61mYqA.js";import{i as kt,n as At,r as jt}from"./useAssistantUIStore-Du8puXWz.js";import{a as Mt,o as Nt,t as Pt}from"./MobileShareBridge-DCE_Ahre.js";import{n as Ft}from"./useThemeSystem-CNzUUkFn.js";import{n as X}from"./Icon-Co7WGN1G.js";import{a as It,i as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-C7D331XW.js";import{F as Ht,I as Ut,M as Wt,N as Gt,p as Kt}from"./gitApi-BOyQ2o3N.js";import{At as qt,Bt as Jt,Ct as Yt,Dt as Xt,Et as Zt,G as Qt,I as $t,K as en,Mt as tn,Nt as nn,Ot as rn,Pt as an,Q as on,S as sn,T as cn,Tt as ln,U as un,W as dn,X as fn,Z as pn,dt as mn,et as hn,i as gn,jt as _n,k as vn,kt as yn,q as bn,r as xn,t as Sn,tt as Cn,ut as wn,wt as Tn,x as En,xt as Dn}from"./useAppFontEffects-CMJ-srCU.js";import{t as On}from"./input-os0CMgxY.js";import{t as kn}from"./tap-LkQum5bB.js";import{r as An}from"./tooltip-pELJ38kd.js";import{A as jn,D as Mn,E as Nn,G as Pn,K as Fn,M as In,O as Ln,S as Rn,U as zn,W as Bn,Z as Vn}from"./pwa-BzFEQ5Js.js";import{t as Hn}from"./YuriLogo-DcoYyXzq.js";import{a as Un,o as Wn}from"./react-BJAlol6I.js";import{i as Gn,o as Kn,t as qn}from"./device-DNG0cNwQ.js";import{r as Jn}from"./themes-BgDJcxRc.js";import{o as Yn}from"./scheduledTaskNavigation-PH-etFzZ.js";import{a as Xn,n as Zn,o as Qn}from"./MarkdownRenderer-CZpY_qyH.js";import{C as $n,a as er,c as tr,d as nr,i as rr,l as ir,n as ar,o as or,r as sr,s as cr,t as lr,u as ur}from"./MobileResizableSheet-Dd1w8a-6.js";import{E as dr,T as fr,a as pr,i as mr}from"./sessionLookup-DC2xZn-T.js";import{E as hr,b as gr,h as _r,v as vr,y as yr}from"./insertionBoundaries-CGcJ-kUX.js";import{l as br,u as xr}from"./select-ClX56nrO.js";import{E as Sr,M as Cr,a as wr,h as Tr,j as Er,o as Dr,p as Or,t as kr}from"./appThemeRegistry-DDaIHQum.js";import{r as Ar}from"./queue-abort-optimistic-CMMw3KSM.js";import{a as jr,c as Mr,i as Nr,s as Pr}from"./toolHelpers-iEHVHQ9p.js";import{n as Fr}from"./useEffectiveDirectory--tyiZ84r.js";import{o as Ir}from"./image-loading-DEXNCcCm.js";import{t as Lr}from"./ImageLoadingPlaceholder-KEVw1Pg-.js";import{t as Rr}from"./LoadingImage-PH45V6oj.js";import{n as zr,r as Br}from"./textarea-DpsaIedI.js";import{a as Vr,f as Hr,i as Ur,n as Wr,s as Gr}from"./projectMeta-CyhJE6CA.js";import{G as Kr,J as qr,V as Jr,X as Yr,d as Xr,f as Zr,i as Qr,m as $r,s as ei,t as ti}from"./MobileTabPageHeader-BYRAlNQp.js";import{a as ni,i as ri}from"./AssistantContactStatus-CGFpgAuL.js";import{t as ii}from"./useFontPreferences-CAdw6cBK.js";import{B as ai,C as oi,Ct as si,D as ci,Dt as li,E as ui,Et as di,F as fi,G as pi,H as mi,I as hi,J as gi,K as _i,L as vi,M as yi,N as bi,Ot as xi,P as Si,R as Ci,S as wi,St as Ti,T as Ei,U as Di,V as Oi,W as ki,Y as Ai,_ as ji,a as Mi,at as Ni,b as Pi,c as Fi,ct as Ii,d as Li,f as Ri,g as zi,gt as Bi,h as Vi,ht as Hi,i as Ui,it as Wi,j as Gi,jt as Ki,k as qi,lt as Ji,n as Yi,nt as Xi,o as Zi,ot as Qi,p as $i,q as ea,r as ta,s as na,st as ra,t as ia,tt as aa,u as oa,ut as sa,v as ca,vt as la,w as ua,wt as da,x as fa,y as pa,yt as ma,z as ha}from"./runtimeEndpointReset-DKk9B2jX.js";import{t as ga}from"./YuriWordmark-Dlsq3scd.js";import{c as _a,l as va}from"./mcpQueries-C3EdKlJU.js";import{f as ya}from"./usePluginsStore-P6_c6c0m.js";import{a as ba,c as xa,i as Sa,l as Ca,o as wa,r as Ta,s as Ea,t as Da,u as Oa}from"./SettingsView-DxqpYiwv.js";import{n as ka,r as Aa,t as ja}from"./mobileBackNavigation-C456iV52.js";import{i as Ma}from"./readiness-DmMVD6xM.js";import{n as Na,r as Pa,t as Fa}from"./AssistantUnreadBadge-DDw7a4MF.js";import{a as Ia,c as La,i as Ra,o as za,r as Ba,s as Va,t as Ha}from"./AssistantView-DpYyl49H.js";import{n as Ua}from"./touch-gestures-CErgaXZ7.js";var Z=e(E(),1),Wa=R(),Ga=null,Ka=!1,qa=new Promise(e=>{Ga=e});function Ja(){Ka||(Ka=!0,Ga?.())}var Ya=6,Xa=e=>e.parentID??null,Za=e=>{let t=e.replace(/\/+$/,``);return t.slice(t.lastIndexOf(`/`)+1)||t},Qa=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),$a=(e,t)=>{if(!e)return``;let n=null,r=-1;for(let i of t){let t=Qa(i.path);(e===t||e.startsWith(`${t}/`))&&t.length>r&&(n=i,r=t.length)}return Za(n?n.path:e)},eo=()=>{let e=dt.getState().activeSessions,t=Ke.getState().index.session.unseenCount,n=Fe.getState().projects,r=0,i=[];for(let a of e){let e=Xa(a)!==null,o=(t[a.id]??0)>0&&!e;o&&(r+=1),e||i.push({id:a.id,title:a.title??``,updated:a.time?.updated??a.time?.created??0,unread:o,project:$a(_t(a),n)})}i.sort((e,t)=>t.updated-e.updated);let a=i.slice(0,Ya).map(({id:e,title:t,unread:n,project:r})=>({id:e,title:t,unread:n,project:r}));return{attentionCount:r,recentSessions:a}},to=`__YURI_WIDGET_SNAPSHOT__`,no=()=>{typeof window>`u`||(window[to]=()=>{try{return JSON.stringify(eo())}catch{return null}})},Q=L(),ro=ie(`YuriScreenAwake`),io=Promise.resolve(),ao=0;function oo(e){let t=io.then(()=>ro.setEnabled({enabled:e}));return io=t.catch(()=>void 0),t}async function so(){if(W.isNativePlatform()&&W.isPluginAvailable(`YuriScreenAwake`)){ao+=1;try{await oo(!0)}catch(e){throw--ao,e}let e=!1;return async()=>{e||(e=!0,--ao,ao===0&&await oo(!1))}}if(!navigator.wakeLock)throw Error(`Screen wake lock unavailable`);let e=await navigator.wakeLock.request(`screen`);return async()=>{e.released||await e.release()}}var $=T();function co({sessionId:e,directory:t,active:n,children:r}){let{t:i}=ge(),a=ct(e,t),o=wt(e,t),[s,l]=pe(`yuri.auto-read`,!1),u=s===!0,[d,f]=(0,Z.useState)(0),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(document.visibilityState===`visible`),y=on({enabled:p}),b=(0,Z.useRef)({enabled:!1,generation:0,floor:0,seen:new Set,observed:new Set,pending:[],playing:!1}),x=(0,Z.useRef)(!1),S=n&&!!e&&o,C=q(()=>{let e=b.current;e.enabled=!1,e.generation+=1,e.pending=[],e.playing=!1,e.seen.clear(),e.observed.clear(),x.current=!1,y.stop(),g(null),m(!1)}),w=q(()=>{let e=b.current;if(!e.enabled||e.playing||!n||document.visibilityState!==`visible`)return;let t=e.pending.shift();if(!t)return;e.playing=!0,g(t);let r=e.generation;y.play(t.text,t=>{if(r===e.generation){if(e.playing=!1,g(null),t){C(),fe.error(i(`mobile.menu.autoReadFailed`));return}w()}},{target:t.target})}),T=q(t=>{let n=b.current;!n.enabled||!S||t.sessionId!==e||!t.text.trim()||t.created<n.floor&&!n.observed.has(t.messageId)||n.seen.has(t.messageId)||(n.seen.add(t.messageId),n.pending.push(t),w())}),E=q((t,n)=>{b.current.enabled&&S&&t===e&&b.current.observed.add(n)}),D=q(()=>{if(u){l(!1),C();return}S&&(l(!0),y.unlock().catch(()=>{fe.error(i(`mobile.menu.autoReadFailed`))}))}),O=q(()=>{let e=b.current;e.floor=Math.max(0,...a.map(e=>e.time.created)),e.seen=new Set(a.filter(e=>e.time.completed!=null||e.role!==`assistant`).map(e=>e.id)),e.enabled=!0,m(!0)});(0,Z.useEffect)(()=>(C(),u&&S&&O(),C),[e,t,u,S,d,O,C]),(0,Z.useEffect)(()=>c(()=>{C(),f(e=>e+1)}),[C]);let k=q(()=>{l(!1),C()});K(`pointerdown`,()=>{if(!b.current.enabled||x.current)return;x.current=!0;let e=b.current.generation;y.unlock().catch(()=>{e===b.current.generation&&(x.current=!1)})},document),K(`visibilitychange`,()=>{v(document.visibilityState===`visible`),document.visibilityState===`visible`?w():(b.current.generation+=1,b.current.playing=!1,b.current.pending=[],y.stop(),g(null))},document),(0,Z.useEffect)(()=>{if(!p||!n||!_)return;let e=!1,t;return so().then(n=>{e?n().catch(()=>void 0):t=n}).catch(()=>{e||fe.warning(i(`mobile.menu.autoReadAwakeFailed`))}),()=>{e=!0,t?.().catch(()=>void 0)}},[p,n,_,e,t,d,i]);let A=(0,Z.useMemo)(()=>({enabled:u,available:S,toggle:D,rendered:T,streaming:E}),[u,S,D,T,E]),j=(0,Z.useMemo)(()=>p&&n&&_&&y.isPlaying&&h?.sessionId===e?{sessionId:e,messageId:h.messageId,stop:k}:null,[p,n,_,y.isPlaying,h,e,k]);return(0,$.jsx)(fn.Provider,{value:A,children:(0,$.jsx)(pn.Provider,{value:j,children:r})})}function lo(e){let t=(0,Q.c)(3),{children:n}=e,r=(0,Z.useContext)(fn);if(!r)return null;let i;return t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}var uo={getPlatform:()=>W.getPlatform(),isPluginAvailable:e=>W.isPluginAvailable(e),openInSystemBrowser:e=>se.open(e),openExternal:G},fo=async(e,t=uo)=>{if(t.getPlatform()===`android`){if(!t.isPluginAvailable(`YuriExternalBrowser`))return!1;try{return await t.openInSystemBrowser({url:e}),!0}catch{return!1}}return t.openExternal(e)},po=`mobile-app-update-available`,mo=`mobile-app-update-toast-dismissed-version`,ho=()=>{let e=(0,Q.c)(9),{t}=ge(),n=Kr(go),r=Kr(_o),i=Kr(vo),a=Kr(yo),o=Kr(bo),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,e[0]=s):s=e[0];let c=Z.useRef(s),l,u;return e[1]!==n||e[2]!==a||e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==i?(l=()=>{if(y()!==`android`||r!==`mobile`||!n||!i||!a||o){Ct.dismiss(po);return}F().getItem(mo)!==i&&(c.current.has(i)||(c.current.add(i),Ct.info(t(`mobileUpdate.toast.available.title`),{id:po,description:t(`mobileUpdate.toast.available.description`,{version:i}),duration:1/0,icon:(0,$.jsx)(X,{name:`download`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.toast.actions.download`),onClick:()=>{fo(a)}},cancel:{label:t(`mobileUpdate.toast.actions.dismiss`),onClick:()=>{F().setItem(mo,i),Ct.dismiss(po)}}})))},u=[n,a,o,r,t,i],e[1]=n,e[2]=a,e[3]=o,e[4]=r,e[5]=t,e[6]=i,e[7]=l,e[8]=u):(l=e[7],u=e[8]),Z.useEffect(l,u),null};function go(e){return e.available}function _o(e){return e.runtimeType}function vo(e){return e.info?.version}function yo(e){return e.info?.downloadUrl}function bo(e){return e.info?.inAppApply===!0}var xo=e=>!(!e.enabled||e.runtimeType!==`mobile`||!e.available||!e.inAppApply||!e.version||e.seenVersions.has(e.version)||e.dismissedVersion!==null&&e.dismissedVersion===e.version),So=e=>e.enabled&&!e.alreadyChecked,Co=`mobile-ota-update-available`,wo=`mobile-ota-update-toast-dismissed-version`,To=()=>{let e=(0,Q.c)(24),{t}=ge(),[n,r]=Z.useState(!1),i=Z.useRef(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,e[0]=a):a=e[0];let o=Z.useRef(a),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=_(),e[1]=s):s=e[1];let c=s,l=Kr(Eo),u=Kr(Do),d=Kr(Oo),f=Kr(ko),p=Kr(Ao),m=Kr(jo),h=Kr(Mo),g=Kr(No),v=Kr(Po),y=d?.version,b=d?.inAppApply===!0,x,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{So({enabled:c,alreadyChecked:i.current})&&(i.current=!0,Kr.getState().checkForUpdates().catch(Fo))},S=[c],e[2]=x,e[3]=S):(x=e[2],S=e[3]),Z.useEffect(x,S);let C;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{r(!0)},e[4]=C):C=e[4];let w=q(C),T=q(Io),E,D;if(e[5]!==l||e[6]!==T||e[7]!==b||e[8]!==w||e[9]!==u||e[10]!==t||e[11]!==y?(E=()=>{if(!xo({enabled:c,runtimeType:u,available:l,inAppApply:b,version:y??``,dismissedVersion:F().getItem(wo),seenVersions:o.current})||!y){(!l||!b||u!==`mobile`)&&Ct.dismiss(Co);return}o.current.add(y),Ct.info(t(`mobileUpdate.ota.toast.available.title`),{id:Co,description:t(`mobileUpdate.ota.toast.available.description`,{version:y}),duration:1/0,icon:(0,$.jsx)(X,{name:`refresh`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.ota.toast.actions.update`),onClick:w},cancel:{label:t(`mobileUpdate.ota.toast.actions.dismiss`),onClick:()=>{T(y)}}})},D=[l,b,c,w,T,u,t,y],e[5]=l,e[6]=T,e[7]=b,e[8]=w,e[9]=u,e[10]=t,e[11]=y,e[12]=E,e[13]=D):(E=e[12],D=e[13]),Z.useEffect(E,D),!c)return null;let O;return e[14]!==n||e[15]!==g||e[16]!==p||e[17]!==f||e[18]!==h||e[19]!==d||e[20]!==m||e[21]!==v||e[22]!==u?(O=(0,$.jsx)(Jr,{open:n,onOpenChange:r,info:d,downloading:f,downloaded:p,progress:m,error:h,onDownload:g,onRestart:v,runtimeType:u}),e[14]=n,e[15]=g,e[16]=p,e[17]=f,e[18]=h,e[19]=d,e[20]=m,e[21]=v,e[22]=u,e[23]=O):O=e[23],O};function Eo(e){return e.available}function Do(e){return e.runtimeType}function Oo(e){return e.info}function ko(e){return e.downloading}function Ao(e){return e.downloaded}function jo(e){return e.progress}function Mo(e){return e.error}function No(e){return e.downloadUpdate}function Po(e){return e.restartToUpdate}function Fo(){}function Io(e){F().setItem(wo,e),Ct.dismiss(Co)}var Lo=ie(`BarcodeScanner`),Ro=`yuri-barcode-scanner-active`,zo=()=>es()?Lo:null,Bo=()=>window.Capacitor?.getPlatform?.()===`android`,Vo=e=>typeof e==`object`&&e&&`message`in e?String(e.message??``):String(e??``),Ho=e=>/^\s*scan canceled\.?\s*$/i.test(Vo(e)),Uo=e=>/denied access to camera/i.test(Vo(e)),Wo=e=>!Ho(e)&&!Uo(e),Go=e=>{let t=Vo(e);return/module/i.test(t)&&/not\s*available|unavailable/i.test(t)},Ko=e=>{e.installGoogleBarcodeScannerModule?.().catch(()=>void 0)},qo=e=>{let t=e.trim();if(!t)return null;if(/^yuri:\/\//i.test(t)){let e=Ca(t);return e?{pairing:e}:null}return/^https?:\/\//i.test(t)?{url:t}:null},Jo=e=>{let t=qo(e);return t?`pairing`in t?{status:`pairing`,...t}:{status:`ok`,...t}:{status:`invalid`}},Yo=e=>{typeof document>`u`||document.documentElement.classList.toggle(Ro,e)},Xo=e=>{try{e()}catch{}},Zo=e=>{if(typeof document>`u`)return()=>void 0;let t=document.body,n=document.createElement(`button`);n.type=`button`,n.className=`yuri-barcode-scanner-chrome`,n.setAttribute(`aria-label`,`Cancel`),n.textContent=`×`,n.addEventListener(`click`,e),t.appendChild(n);let r=!1;return()=>{r||(r=!0,n.removeEventListener(`click`,e),n.parentNode===t&&t.removeChild(n))}},Qo=async e=>{if(!e.startScan||!e.stopScan||!e.addListener)return{status:`unsupported`};let t,n,r,i=!1,a=()=>void 0,o=new Promise(e=>{a=e}),s=e=>{i||(i=!0,a(e))};Yo(!0);let c=Zo(()=>s({status:`cancelled`}));try{let{App:e}=await ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),t=await e.addListener(`backButton`,()=>s({status:`cancelled`}));r=()=>void t.remove()}catch{r=void 0}try{return(await Promise.allSettled([Promise.resolve(e.addListener(`barcodesScanned`,({barcodes:e})=>{let t=e?.[0],n=(t?.rawValue??t?.displayValue??``).trim();n&&s(Jo(n))})).then(e=>{t=e}),Promise.resolve(e.addListener(`scanError`,()=>s({status:`failed`}))).then(e=>{n=e})])).some(({status:e})=>e===`rejected`)?s({status:`failed`}):i||e.startScan({formats:[`QR_CODE`]}).catch(e=>{Uo(e)?s({status:`permission-denied`}):s({status:`failed`})}),await o}finally{Yo(!1),Xo(c),Xo(()=>r?.()),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(n?.remove()),e.stopScan()])}},$o=e=>e.isNativePlatform&&e.isPluginAvailable,es=()=>$o({isNativePlatform:W.isNativePlatform(),isPluginAvailable:W.isPluginAvailable(`BarcodeScanner`)}),ts=async()=>{let e=zo();if(!e)return{status:`unsupported`};try{if(e.requestPermissions){let t=(await e.requestPermissions())?.camera;if(t&&t!==`granted`&&t!==`limited`)return{status:`permission-denied`}}if(e.scan)try{let t=(await e.scan({formats:[`QR_CODE`]}))?.barcodes?.[0],n=(t?.rawValue??t?.displayValue??``).trim();return n?Jo(n):{status:`cancelled`}}catch(t){return Ho(t)?{status:`cancelled`}:Uo(t)?{status:`permission-denied`}:Bo()&&Wo(t)&&e.startScan?(Go(t)&&Ko(e),Qo(e)):{status:`failed`}}return Bo()&&e.startScan?Qo(e):{status:`unsupported`}}catch{return{status:`failed`}}},ns={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},rs=({disabled:e=!1,isBusy:t=!1,tabIndex:n,inputClassName:r,buttonVariant:i=`outline`,buttonClassName:a=`h-12 w-full`,value:o,onValueChange:s,showPasteButton:c=!1,error:l,onRedeem:u,onInvalid:d})=>{let{t:f}=ge(),[p,m]=Z.useState(``),[h,g]=Z.useState(null),[_,v]=Z.useState(!1),y=o??p,b=Z.useId(),x=e=>{g(null),m(e),s?.(e)},S=q(async()=>{if(!(e||t||_)){v(!0);try{let e=await navigator.clipboard.readText();x(e);let t=qo(e);e.trim()&&(!t||!(`pairing`in t))&&d()}catch{g(f(`mobile.connect.link.pasteFallback`))}finally{v(!1)}}}),C=q(n=>{if(n.preventDefault(),e||t||_)return;let r=qo(y);if(!r||!(`pairing`in r)){d();return}u(r.pairing)});return(0,$.jsxs)(`form`,{className:`flex w-full flex-col gap-3`,onSubmit:C,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(On,{...ns,value:y,onChange:e=>x(e.target.value),placeholder:f(`mobile.connect.link.placeholder`),"aria-label":f(`mobile.connect.link.label`),inputMode:`url`,autoCapitalize:`none`,tabIndex:n,disabled:e||t||_,"aria-invalid":!!l,"aria-describedby":l||h?b:void 0,className:r}),c?(0,$.jsx)(Y,{variant:`outline`,size:`icon`,onClick:()=>void S(),disabled:e||t||_,"aria-label":f(`mobile.connect.link.paste`),children:(0,$.jsx)(X,{name:`clipboard`,className:`size-5`})}):null]}),l||h?(0,$.jsx)(`p`,{id:b,role:`alert`,className:`typography-small text-[var(--status-error)]`,children:l||h}):null,(0,$.jsx)(Y,{type:`submit`,variant:i,size:`lg`,className:a,disabled:e||t||_||!y.trim(),children:f(t?`mobile.connect.connecting`:`mobile.connect.connectButton`)})]})};function is({connection:e}){let{t}=ge(),{connections:n,isBusy:r,error:i,pendingConnection:a}=e,o=Z.useMemo(()=>es(),[]),[s,c]=Z.useState(null),[l,u]=Z.useState(!1),[d,f]=Z.useState(null),[p,m]=Z.useState(!1),[h,g]=Z.useState(null),[v,y]=Z.useState(null),[b,x]=Z.useState(``),[S,C]=Z.useState(``),[w,T]=Z.useState(``),E=n[0],D=n.find(e=>e.id===v),O=r||p,k=s!==null||a!==null,A=t=>{e.setError(null),c(t)},j=()=>{e.setError(null),c(null),u(!0)},M=q(()=>{O||(a?(e.cancelPassword(),C(``)):A(null))}),N=q(async t=>{O||(g(t.id),C(``),await e.connect({id:t.id,candidates:t.candidates,label:t.label}))}),P=q(async()=>{if(!O){g(null),m(!0),e.setError(null);try{let n=await ts();n.status===`ok`?await e.connect({url:n.url,label:n.label,clientToken:n.clientToken}):n.status===`pairing`?await e.redeemPairingConnection(n.pairing):n.status===`permission-denied`?e.setError(t(`mobile.connect.scan.permissionDenied`)):n.status===`invalid`?e.setError(t(`mobile.connect.scan.invalid`)):n.status===`unsupported`?e.setError(t(`mobile.connect.scan.unsupported`)):n.status===`failed`&&e.setError(t(`mobile.connect.scan.failed`))}catch{e.setError(t(`mobile.connect.scan.failed`))}finally{m(!1)}}}),F=q(()=>d?(f(null),!0):k?(M(),!0):l?(u(!1),!0):!1);Z.useEffect(()=>{if(!_())return;let e=!1,t;return ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:n})=>{let r=await n.addListener(`backButton`,()=>{F()||n.minimizeApp().catch(()=>void 0)});e?r.remove():t=()=>{r.remove()}}).catch(()=>void 0),()=>{e=!0,t?.()}},[F]);let I=e=>h===e.id&&r&&!a&&s!==`rename`&&s!==`remove`?t(`mobile.connect.connecting`):e.id===E?.id&&e.lastUsedAt>0?t(`mobile.connect.history.lastUsed`):t(`mobile.instances.status.saved`),L=e=>(0,$.jsxs)(Y,{size:`lg`,variant:e?`default`:`ghost`,className:e?`yuri-welcome-primary w-full`:`w-full`,disabled:O,onClick:()=>void P(),children:[(0,$.jsx)(X,{name:p?`loader-4`:`scan-2`,className:p?`size-5 animate-spin motion-reduce:animate-none`:`size-5`}),t(`mobile.connect.scanQr`)]}),R=t(a?a.reason===`pairing`?`mobile.connect.pairing.expired`:`mobile.connect.password.label`:s===`rename`?`mobile.connect.history.rename`:s===`remove`?`mobile.connect.history.remove`:`mobile.connect.welcome.moreOptions`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`main`,{className:`yuri-keyboard-fill-screen yuri-mobile-welcome`,inert:k||l,"aria-hidden":k||l||void 0,"data-welcome-paused":k||l||p?`true`:void 0,children:[(0,$.jsx)(`header`,{className:`yuri-welcome-brand`,children:(0,$.jsx)(ga,{className:`block`,width:88})}),(0,$.jsxs)(`div`,{className:`yuri-welcome-content`,children:[(0,$.jsxs)(`div`,{className:`yuri-welcome-intro`,children:[(0,$.jsxs)(`div`,{className:`yuri-welcome-art`,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{className:`yuri-image-loading yuri-welcome-dots`}),(0,$.jsx)(`div`,{className:`yuri-welcome-logo`,children:(0,$.jsx)(Hn,{width:144,height:144,className:`size-full`})})]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-copy`,children:[(0,$.jsx)(`h1`,{children:t(E?`mobile.connect.history.welcomeBack`:`mobile.connect.welcome.heading`)}),(0,$.jsx)(`p`,{children:t(`mobile.connect.welcome.pairingHint`)})]})]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-actions flex w-full flex-col gap-3`,children:[E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Y,{variant:`outline`,className:`yuri-welcome-device`,disabled:O,onClick:j,children:[(0,$.jsx)(X,{name:`computer`,className:`size-7`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label`,children:E.label}),(0,$.jsx)(`span`,{className:`block typography-small font-normal text-muted-foreground`,children:I(E)})]}),(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-5 text-muted-foreground`})]}),(0,$.jsx)(Y,{size:`lg`,className:`yuri-welcome-primary w-full`,disabled:O,onClick:()=>void N(E),children:r&&h===E.id?t(`mobile.connect.connecting`):i&&h===E.id?t(`desktopHostSwitcher.actions.retry`):t(`mobile.connect.history.continue`)})]}):null,o?L(!E):E?null:(0,$.jsx)(Y,{size:`lg`,className:`yuri-welcome-primary w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)}),i&&!k&&!l?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(Y,{variant:`ghost`,size:`lg`,disabled:O,className:`mx-auto text-muted-foreground`,onClick:()=>A(`more`),children:t(`mobile.connect.welcome.moreOptions`)})]})]})]}),(0,$.jsxs)(sr,{id:`welcome-history`,open:l,onOpenChange:u,presentation:`page`,edge:`right`,dismissGesture:!0,ariaLabel:t(`mobile.connect.history.title`),children:[(0,$.jsx)(Ae,{title:t(`mobile.connect.history.title`),backAriaLabel:t(`header.actions.backAria`),onBack:()=>u(!1)}),(0,$.jsxs)(zr,{outerClassName:`flex-1`,className:`px-6 py-6`,disableHorizontal:!0,children:[(0,$.jsx)(`h1`,{className:`typography-h1 mb-3`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(`p`,{className:`mb-6 typography-ui-label font-normal text-muted-foreground`,children:t(n.length?`mobile.connect.history.description`:`mobile.connect.saved.empty`)}),n.map(e=>(0,$.jsx)(`div`,{className:`border-b border-border/60 py-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(Y,{variant:`ghost`,className:`yuri-welcome-history-row min-w-0 flex-1`,disabled:O,onClick:()=>void N(e),children:[(0,$.jsx)(X,{name:r&&h===e.id&&!k?`loader-4`:`computer`,className:r&&h===e.id&&!k?`size-7 animate-spin motion-reduce:animate-none`:`size-7`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label`,children:e.label}),(0,$.jsx)(`span`,{className:`block typography-small font-normal text-muted-foreground`,children:I(e)})]})]}),i&&h===e.id&&!k&&!r?(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`desktopHostSwitcher.actions.retry`),onClick:()=>void N(e),children:(0,$.jsx)(X,{name:`error-warning-fill`,className:`size-5 text-[var(--status-error)]`})}):null,(0,$.jsxs)(Bn,{open:d===e.id,onOpenChange:t=>f(t?e.id:null),children:[(0,$.jsx)(Vn,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.connect.history.actions`,{name:e.label}),children:(0,$.jsx)(X,{name:`more`,className:`size-5`})})}),(0,$.jsxs)(Pn,{align:`end`,children:[(0,$.jsxs)(Fn,{onSelect:()=>{y(e.id),x(e.label),A(`rename`)},children:[(0,$.jsx)(X,{name:`edit`,className:`size-4`}),t(`mobile.connect.history.rename`)]}),(0,$.jsxs)(Fn,{onSelect:()=>{y(e.id),A(`remove`)},className:`text-[var(--status-error)]`,children:[(0,$.jsx)(X,{name:`delete-bin`,className:`size-4 text-inherit`}),t(`mobile.connect.history.remove`)]})]})]})]})},e.id)),i&&!h&&!k?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-history-footer`,children:[(0,$.jsx)(Hn,{width:36,height:36,className:`mx-auto mb-5 opacity-40`}),o?L(!1):null,(0,$.jsx)(Y,{variant:`ghost`,size:`lg`,className:`w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)})]})]}),(0,$.jsx)(lr,{id:`welcome-options`,open:k,onOpenChange:e=>{e||M()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:R}),ariaLabel:R,closeAriaLabel:t(`mobile.surface.closeAria`),resizeAriaLabel:t(`mobile.connect.options.resize`),children:(0,$.jsx)(zr,{className:`px-5 py-5`,disableHorizontal:!0,fillContainer:!1,children:a?.reason===`pairing`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(X,{name:`computer`,className:`size-6 shrink-0 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate typography-ui-label`,children:a.label}),n.some(e=>e.id===a.id)?(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.instances.deleteAria`,{label:a.label}),onClick:()=>{y(a.id),e.cancelPassword(),A(`remove`)},children:(0,$.jsx)(X,{name:`delete-bin`,className:`size-5`})}):null]}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.pairing.reconnectHint`)}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,o?L(!0):null,(0,$.jsx)(Y,{variant:o?`ghost`:`default`,size:`lg`,disabled:O,onClick:()=>{e.cancelPassword(),A(`more`)},children:t(`mobile.connect.link.useLink`)})]}):a?(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{t.preventDefault(),r||e.submitPassword(S)},children:[(0,$.jsx)(`p`,{className:`truncate typography-ui-label`,children:a.label}),(0,$.jsx)(On,{type:`password`,autoComplete:`current-password`,value:S,onChange:e=>C(e.target.value),"aria-label":t(`mobile.connect.password.label`),placeholder:t(`mobile.connect.password.placeholder`),disabled:r}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(Y,{type:`submit`,size:`lg`,className:`yuri-welcome-primary w-full`,disabled:r||!S.trim(),children:t(r?`mobile.connect.connecting`:`mobile.connect.unlockButton`)}),(0,$.jsx)(Y,{variant:`ghost`,disabled:r,onClick:M,children:t(`mobile.connect.cancelPassword`)})]}):s===`rename`&&D?(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{t.preventDefault(),e.renameConnection(D.id,b).then(e=>{e&&c(null)})},children:[(0,$.jsx)(On,{value:b,onChange:e=>x(e.target.value),disabled:r,"aria-label":t(`mobile.instances.label.label`),autoComplete:`off`,maxLength:120}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(Y,{type:`submit`,size:`lg`,disabled:r||!b.trim(),children:t(`mobile.instances.saveEdit`)})]}):s===`remove`&&D?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`p`,{className:`typography-ui-label font-normal`,children:t(`mobile.connect.history.removeHint`,{name:D.label})}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(Y,{variant:`destructive`,size:`lg`,disabled:r,onClick:()=>{e.removeConnection(D.id).then(e=>{e&&(c(null),g(null))})},children:t(`mobile.connect.history.remove`)}),(0,$.jsx)(Y,{variant:`ghost`,disabled:r,onClick:M,children:t(`mobile.instances.cancelEdit`)})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`typography-ui-header mb-2`,children:t(`mobile.connect.link.useLink`)}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.link.help`)})]}),(0,$.jsx)(rs,{value:w,onValueChange:t=>{T(t),e.setError(null)},showPasteButton:!0,inputClassName:`min-w-0 flex-1 text-[16px]`,buttonClassName:`yuri-welcome-primary w-full`,buttonVariant:`default`,disabled:O,isBusy:r,error:i,onInvalid:()=>e.setError(t(`mobile.connect.link.invalid`)),onRedeem:t=>{g(null),e.redeemPairingConnection(t)}}),(0,$.jsxs)(Y,{variant:`outline`,className:`yuri-welcome-history-row`,disabled:O,onClick:j,children:[(0,$.jsx)(X,{name:`history`,className:`size-6`}),(0,$.jsx)(`span`,{className:`flex-1 text-left`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-5`})]}),(0,$.jsx)(`p`,{className:`typography-small leading-relaxed text-muted-foreground`,children:t(`mobile.connect.welcome.scanHint`)})]})})})]})}function as(e){let t=(0,Q.c)(17),{children:n}=e,r=I(cs),i=I(ss),a=Z.useRef(null),o=Z.useRef(null),s;t[0]===i?s=t[1]:(s=()=>i(!1),t[0]=i,t[1]=s);let c;t[2]!==r||t[3]!==s?(c={id:`mobile-global-search`,active:r,onBack:s,surfaceRef:a,underlayRef:o},t[2]=r,t[3]=s,t[4]=c):c=t[4],ka(c);let l,u;t[5]===r?(l=t[6],u=t[7]):(l=()=>{if(!r)return;let e=document.activeElement,t=en(`global-search-page`);return()=>{t(),e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},u=[r],t[5]=r,t[6]=l,t[7]=u),Z.useLayoutEffect(l,u);let d=r||void 0,f=r||void 0,p;t[8]!==n||t[9]!==d||t[10]!==f?(p=(0,$.jsx)(`div`,{ref:o,inert:d,"aria-hidden":f,className:`h-full min-h-0 w-full`,children:n}),t[8]=n,t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r?(0,$.jsx)(`div`,{ref:a,"data-mobile-search-page":`true`,className:`absolute inset-0 z-50 flex min-h-0 flex-col overflow-hidden bg-background`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(ma,{presentation:`page`,onBack:os})}):null,t[12]=r,t[13]=m);let h;return t[14]!==p||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`relative isolate flex h-[100dvh] min-h-0 w-full flex-col overflow-hidden bg-background`,"data-page-scroll-lock":`true`,children:[p,m]}),t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function os(){ja.requestAnimatedBack(`root`)}function ss(e){return e.setCommandPaletteOpen}function cs(e){return e.isCommandPaletteOpen}async function ls(e,t,n){let i=f(),a=()=>{if(n.aborted||i!==f())throw new DOMException(`Preview ended`,`AbortError`)};a();let o=new URL(e);if(![`http:`,`https:`].includes(o.protocol)||o.username||o.password)throw Error(`invalid_url`);if(!oe(e))return{src:o.href};if(!t)throw Error(`unsupported_host`);let s=await g(`/api/preview/targets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o.href}),signal:n});if(!s.ok)throw Error(`preview_unavailable`);let c=await s.json();if(a(),typeof c.proxyBasePath!=`string`||!/^\/api\/preview\/proxy\/[a-f0-9]{16,64}$/i.test(c.proxyBasePath)||!Bi(`${c.proxyBasePath}${o.pathname}`)||typeof c.previewToken!=`string`||!c.previewToken||typeof c.expiresAt!=`number`||!Number.isFinite(c.expiresAt)||c.expiresAt<=Date.now())throw Error(`invalid_preview`);await r(),a();let u=new URLSearchParams(o.search);u.delete(`yuri_client_token`),u.delete(`yuri_url_token`),u.set(`yuri_preview_token`,c.previewToken);let d=`${c.proxyBasePath}${o.pathname}?${u}${o.hash}`,p=new URL(l().authenticatedAsset(d),`http://runtime.invalid`);return{src:`${t}${p.pathname}${p.search}${p.hash}`,expiresAt:c.expiresAt}}function us({url:e,hostOrigin:t}){let{t:n}=ge(),r=Z.useRef(null),[i,s]=Z.useReducer(e=>e+1,0),[c,l]=Z.useState();Z.useEffect(()=>{let n=new AbortController,r,s=0,c=async()=>{let a=++s;clearTimeout(r);try{let o=await ls(e,t,n.signal);if(n.signal.aborted||a!==s)return;l({url:e,hostOrigin:t,attempt:i,src:o.src}),o.expiresAt&&(r=setTimeout(()=>{c()},Math.max(1e3,o.expiresAt-Date.now()-1e4)))}catch{!n.signal.aborted&&a===s&&l({url:e,hostOrigin:t,attempt:i,error:!0})}},u=oe(e),d=u?a():void 0,f=u?o(()=>{c()}):void 0;return c(),()=>{n.abort(),clearTimeout(r),f?.(),d?.()}},[e,t,i]);let u=c?.url===e&&c.hostOrigin===t&&c.attempt===i?c:void 0;return K(`message`,t=>{if(!u?.src||!oe(e)||t.source!==r.current?.contentWindow||t.origin!==new URL(u.src).origin)return;let n=t.data;n?.source===`yuri-preview-bridge`&&n.version===1&&n.type===`navigate-preview`&&typeof n.url==`string`&&ce.getState().open(n.url)}),u?.error?(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,$.jsx)(Ma,{message:n(`contextPanel.preview.proxyError`)}),(0,$.jsx)(Y,{size:`sm`,onClick:s,children:n(`contextPanel.preview.actions.retry`)})]}):u?.src?(0,$.jsx)(`iframe`,{ref:r,src:u.src,title:n(`contextPanel.preview.iframeTitle`),onError:()=>l({url:e,hostOrigin:t,attempt:i,error:!0}),className:`h-full w-full border-0`,sandbox:`allow-scripts allow-same-origin allow-forms`}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:n(`contextPanel.preview.loading`)})}function ds(){let e=(0,Q.c)(16),{t}=ge(),n=ce(ps),r=Z.useSyncExternalStore(c,f,f),i=n?.generation===r?n:null,a=!!i,o;e[0]===t?o=e[1]:(o=t(`contextPanel.preview.iframeTitle`),e[0]=t,e[1]=o);let s;e[2]===t?s=e[3]:(s=t(`guiPlugins.close`),e[2]=t,e[3]=s);let l;e[4]===t?l=e[5]:(l=t(`guiPlugins.resize`),e[4]=t,e[5]=l);let u=i?.url??``,d;e[6]!==i||e[7]!==r?(d=i?(0,$.jsx)(la,{children:e=>(0,$.jsx)(us,{url:i.url,hostOrigin:e?.hostOrigin})},r):null,e[6]=i,e[7]=r,e[8]=d):d=e[8];let p;return e[9]!==a||e[10]!==o||e[11]!==s||e[12]!==l||e[13]!==u||e[14]!==d?(p=(0,$.jsx)(lr,{id:`mobile-html-preview`,open:a,ariaLabel:o,closeAriaLabel:s,resizeAriaLabel:l,initiallyExpanded:!0,title:u,onOpenChange:fs,children:d}),e[9]=a,e[10]=o,e[11]=s,e[12]=l,e[13]=u,e[14]=d,e[15]=p):p=e[15],p}function fs(e){e||ce.getState().close()}function ps(e){return e.target}var ms=`/assets/android-direct-share-1a0lp154.jpg`,hs=`/assets/ios-share-sheet-B3Dlufnc.jpg`,gs=`/assets/select-assistant-C89IRspC.jpg`,_s=`yuri:assistant-share-welcome:v1`,vs=[{image:hs,titleKey:`assistants.shareWelcome.example.chat.title`,descriptionKey:`assistants.shareWelcome.example.chat.description`},{image:ms,titleKey:`assistants.shareWelcome.example.article.title`,descriptionKey:`assistants.shareWelcome.example.article.description`},{image:gs,titleKey:`assistants.shareWelcome.example.note.title`,descriptionKey:`assistants.shareWelcome.example.note.description`}],ys=e=>{let t=(0,Q.c)(40),{enabled:n,open:r,onOpenChange:i}=e,a=n!==void 0&&n,{t:o}=ge(),[s,c]=pe(_s,!1),l=r!==void 0,u=l?r:a&&s!==!0,d;t[0]!==l||t[1]!==i||t[2]!==c?(d=()=>{l||c(!0),i?.(!1)},t[0]=l,t[1]=i,t[2]=c,t[3]=d):d=t[3];let f=q(d),p;t[4]!==f||t[5]!==i?(p=e=>{e?i?.(!0):f()},t[4]=f,t[5]=i,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-interactive-selection text-interactive-selection-foreground sm:size-12`,children:(0,$.jsx)(X,{name:`share-2`,className:`size-5`})}),t[7]=m):m=t[7];let h;t[8]===o?h=t[9]:(h=o(`assistants.shareWelcome.title`),t[8]=o,t[9]=h);let g;t[10]===h?g=t[11]:(g=(0,$.jsx)(zt,{className:`typography-ui-header text-left sm:text-3xl`,children:h}),t[10]=h,t[11]=g);let _;t[12]===o?_=t[13]:(_=o(`assistants.shareWelcome.description`),t[12]=o,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,$.jsx)(Bt,{className:`typography-ui text-left leading-6 sm:max-w-3xl sm:text-base sm:leading-7`,children:_}),t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==v?(y=(0,$.jsxs)(It,{className:`flex-row items-start gap-3 px-5 pb-5 pt-6 text-left sm:gap-4 sm:px-8 sm:pb-6 sm:pt-8`,children:[m,(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5 sm:space-y-2`,children:[g,v]})]}),t[16]=g,t[17]=v,t[18]=y):y=t[18];let b;t[19]===o?b=t[20]:(b=o(`assistants.shareWelcome.examplesAria`),t[19]=o,t[20]=b);let x;t[21]===o?x=t[22]:(x=vs.map((e,t)=>(0,$.jsxs)(`article`,{className:`w-[min(78vw,19rem)] shrink-0 snap-center overflow-hidden rounded-xl border border-border bg-background lg:w-auto lg:min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative overflow-hidden border-b border-border bg-muted`,children:[(0,$.jsx)(`img`,{src:e.image,alt:``,className:`h-72 w-full object-cover object-bottom lg:h-[min(38vh,23rem)]`}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-3 top-3 flex size-7 items-center justify-center rounded-full bg-[var(--surface-elevated)] typography-meta font-semibold text-foreground shadow-sm`,children:t+1})]}),(0,$.jsxs)(`div`,{className:`space-y-1 px-4 py-3.5 lg:min-h-25`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:o(e.titleKey)}),(0,$.jsx)(`p`,{className:`typography-meta leading-5 text-muted-foreground`,children:o(e.descriptionKey)})]})]},e.titleKey)),t[21]=o,t[22]=x);let S;t[23]!==b||t[24]!==x?(S=(0,$.jsx)(`div`,{className:`overflow-hidden px-5 pb-5 sm:px-8 sm:pb-7`,children:(0,$.jsx)(`div`,{className:`flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden lg:grid lg:grid-cols-3 lg:overflow-visible lg:pb-0`,"aria-label":b,children:x})}),t[23]=b,t[24]=x,t[25]=S):S=t[25];let C;t[26]===o?C=t[27]:(C=o(`assistants.shareWelcome.action`),t[26]=o,t[27]=C);let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-4`}),t[28]=w):w=t[28];let T;t[29]!==f||t[30]!==C?(T=(0,$.jsx)(Lt,{className:`border-t border-border px-5 py-4 sm:px-8 sm:py-5`,children:(0,$.jsxs)(Y,{size:`lg`,className:`w-full lg:mx-auto lg:w-72`,onClick:f,children:[C,w]})}),t[29]=f,t[30]=C,t[31]=T):T=t[31];let E;t[32]!==S||t[33]!==T||t[34]!==y?(E=(0,$.jsxs)(Rt,{showCloseButton:!1,className:`w-[min(100%,31rem)] max-w-none gap-0 overflow-hidden rounded-2xl border-border bg-[var(--surface-elevated)] p-0 sm:w-[min(calc(100%-3rem),44rem)] lg:w-[min(calc(100%-4rem),74rem)]`,containerClassName:`fixed inset-0 z-50 flex items-end justify-center px-0 pt-8 sm:items-center sm:p-6`,children:[y,S,T]}),t[32]=S,t[33]=T,t[34]=y,t[35]=E):E=t[35];let D;return t[36]!==u||t[37]!==E||t[38]!==p?(D=(0,$.jsx)(Vt,{open:u,onOpenChange:p,children:E}),t[36]=u,t[37]=E,t[38]=p,t[39]=D):D=t[39],D},bs=e=>{let t=(0,Q.c)(20),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({children:n,className:r,contentClassName:i,style:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=J(`yuri-mobile-header relative z-30 shrink-0 border-b border-border/30 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`,r),t[6]=r,t[7]=s);let c;t[8]===o?c=t[9]:(c={paddingTop:`var(--yuri-safe-area-top, 0px)`,...o},t[8]=o,t[9]=c);let l;t[10]===i?l=t[11]:(l=J(`flex h-[var(--yuri-header-height,56px)] w-full items-center gap-1 px-2`,i),t[10]=i,t[11]=l);let u;t[12]!==n||t[13]!==l?(u=(0,$.jsx)(`div`,{className:l,children:n}),t[12]=n,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==a||t[16]!==s||t[17]!==c||t[18]!==u?(d=(0,$.jsx)(`header`,{className:s,style:c,...a,children:u}),t[15]=a,t[16]=s,t[17]=c,t[18]=u,t[19]=d):d=t[19],d},xs=ie(`YuriNativeHeader`),Ss=`header.yuri-mobile-detail-navigation, header.yuri-mobile-header`,Cs=`yuri-native-header-source`,ws=`yuri-native-header-ready`,Ts=new Set([ws,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`]),Es=`--yuri-native-viewport-top`,Ds=`.fixed, [role="dialog"]`,Os=new Set([`style`,`data-yuri-header-collapse-phase`,`data-yuri-header-collapse-rest`]),ks=()=>parseFloat(document.documentElement.style.getPropertyValue(`--yuri-native-viewport-top`))||0,As=`[data-avatar-motion]`,js=new Set([`class`,`style`,`inert`,`aria-hidden`,`hidden`]),Ms=e=>{if(e.getClientRects().length===0||e.offsetHeight<=0||e.closest(`[inert],[aria-hidden="true"]`))return!1;let t=e.parentElement;if(!t||(typeof t.checkVisibility==`function`?!t.checkVisibility({visibilityProperty:!0,contentVisibilityAuto:!0,opacityProperty:!0}):getComputedStyle(t).visibility===`hidden`))return!1;let n=e.getBoundingClientRect().top-ks();return e.dataset.yuriCollapsibleHeader===`true`||Math.abs(n)<=1},Ns=(e,t)=>{let n=[...document.querySelectorAll(Ss)].filter(Ms);if(t&&e&&n.includes(e))return e;for(let e of n){let t=e.getBoundingClientRect(),n=document.elementFromPoint(t.left+t.width/2,t.bottom-4);if(n&&e.contains(n))return e}return n.at(-1)??null},Ps=()=>{let e=[];for(let t of document.styleSheets)try{for(let n of t.cssRules)e.push(n.cssText)}catch{}return e.join(`
|
|
3
|
-
`)},Fs=()=>{let e=0;for(let t of document.styleSheets)try{e+=t.cssRules.length}catch{}return`${document.styleSheets.length}:${e}`},Is=xs,Ls=()=>new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e(1)))});function Rs(){let e=document.documentElement,t=window,n=!1,r=0,i=0,a=null,o=``,s=``,c=``,l=``,u=!1,d=!1,f=[],p=()=>{if(!a)return;let e=parseFloat(a.style.getPropertyValue(`--yuri-mobile-header-collapse`))||0,n=a.dataset.yuriHeaderCollapsePhase??`rest`,r=a.dataset.yuriHeaderCollapseRest??`expanded`,i=`${e}|${n}|${r}`;i!==l&&(l=i,t.YuriHeaderCollapse?t.YuriHeaderCollapse.set(e,n,r):t.webkit?.messageHandlers?.yuriHeaderCollapse?.postMessage({progress:e,phase:n,rest:r}))},m=()=>{e.classList.remove(ws),u&&(u=!1,o=``,xs.update({seq:++r,visible:!1}).catch(()=>void 0))},h=()=>{if(i=0,n)return;let t=Ns(a,d);if(t!==a){if(a?.classList.remove(Cs),m(),a=t,l=``,!t)return;t.classList.add(Cs),p()}if(!t)return;let f=window.devicePixelRatio||1,h=t.offsetHeight,g=parseFloat(getComputedStyle(t,`::after`).height)||0,_=Math.ceil(h*f),v=t.querySelector(Ds)===null?Math.ceil(Math.max(h,g)*f):_,y=(h+2*(parseFloat(getComputedStyle(e).fontSize)||16))*f,b=t.cloneNode(!0);b.classList.remove(Cs),b.style.removeProperty(vn),delete b.dataset.yuriHeaderCollapsePhase,delete b.dataset.yuriHeaderCollapseRest;for(let e of b.querySelectorAll(Ds))e.style.display=`none`;let x=b.outerHTML,S=[...e.classList].filter(e=>!Ts.has(e)).join(` `),C=(e.getAttribute(`style`)??``).replace(RegExp(`${Es}\\s*:[^;]*;?`,`g`),``),w=document.body.className,T=`${x}|${S}|${C}|${w}|${v}|${y}`,E=Fs(),D=document.getElementById(`yuri-icon-sprite-v2`)?.outerHTML??``;if(T===o&&E===s&&D===c)return;o=T;let O={seq:++r,visible:!0,height:v,hitBottom:_,collapseDistance:y,html:x,rootClass:S,rootStyle:C,bodyClass:w};E!==s&&(s=E,O.css=Ps()),D!==c&&(c=D,O.sprite=D),u=!0,xs.update(O).catch(()=>void 0)},g=()=>{!i&&!n&&(i=requestAnimationFrame(h))};f.push(xs.addListener(`shown`,t=>{d&&t.seq===r&&a&&e.classList.add(ws)})),f.push(xs.addListener(`tap`,e=>{if(!a||!d)return;let t=a;try{for(let n of JSON.parse(e.path))t=t?.children[n]??null}catch{return}let n=t?.closest(`button, a, [role="button"]`);if(!n||!a.contains(n))return;let r={bubbles:!0,cancelable:!0,pointerType:`touch`,isPrimary:!0};n.dispatchEvent(new PointerEvent(`pointerdown`,r)),n.dispatchEvent(new PointerEvent(`pointerup`,r)),n.click()}));let _=new MutationObserver(e=>{if(!a||!a.isConnected){g();return}let t=!1;for(let n of e){if(n.target===a&&n.type===`attributes`&&Os.has(n.attributeName??``)){p();continue}let e=n.target instanceof Element?n.target:n.target.parentElement;if(!(e?.closest(As)&&a.contains(e))){if(a.contains(n.target)||n.type===`attributes`&&n.target.contains(a))t=!0;else if(n.type===`attributes`&&js.has(n.attributeName??``)&&n.target instanceof Element&&n.target.querySelector(Ss))t=!0;else if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(e.matches(Ss)||e.querySelector(Ss))&&(t=!0)}}t&&g()});_.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let v=new MutationObserver(g);v.observe(e,{attributes:!0,attributeFilter:[`class`,`style`]});let y=new MutationObserver(g);y.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener(`resize`,g),g(),t.__yuriImeOffset=t=>(window.dispatchEvent(new Event(`yuri:keyboard-native-layout`)),e.style.setProperty(Es,`${Math.max(0,t)}px`),Ls());let b=window;return b.__yuriNativeHeader=t=>(d=t,e.classList.toggle(ws,t&&a!==null),Ls()),()=>{n=!0,delete b.__yuriNativeHeader,i&&cancelAnimationFrame(i),_.disconnect(),v.disconnect(),y.disconnect(),window.removeEventListener(`resize`,g),delete t.__yuriImeOffset,e.classList.remove(ws),a?.classList.remove(Cs),a=null;for(let e of f)e.then(e=>e.remove()).catch(()=>void 0);xs.update({seq:++r,visible:!1}).catch(()=>void 0)}}var zs=`.yuri-mobile-composer`,Bs=`[data-btw-composer]`;function Vs(e,t){if(!e)return!1;let n=t;return!n||typeof n.closest!=`function`||!n.closest(Bs)}function Hs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.closest==`function`&&!!t.closest(zs)}function Us(e){return Hs(e??null)}var Ws=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Gs=e=>{let t=e.index?.trim();return!!(t&&t!==`?`)},Ks=e=>{let t=e.working_dir?.trim(),n=e.index?.trim();return!!(t||n===`?`)},qs=(e,t)=>t?`${e}\u0000staged`:e,Js=({onClose:e,initialDiffPath:t,initialDiffStaged:n=!1,initialDiffTargetLine:r=null,hideDiffHeader:i=!1})=>{let{t:a}=ge(),{git:o}=te(),s=Ws(Fr()??null),c=vr(s||null),l=gr(s||null),u=_r(s||null),d=yr(e=>e.setActiveDirectory),f=yr(e=>e.ensureAll),p=yr(e=>e.fetchStatus),m=yr(e=>e.fetchBranches),h=yr(e=>e.prefetchDiffs),g=yr(e=>e.getDiff),_=yr(e=>e.setDiff),[v,y]=Z.useState(()=>t?{type:`diff`,path:t,staged:n,targetLine:r}:{type:`list`}),b=Z.useRef(null);Z.useEffect(()=>{t&&y(e=>e.type===`diff`&&e.path===t&&e.staged===n&&e.targetLine===r?e:{type:`diff`,path:t,staged:n,targetLine:r})},[t,n,r]);let[x,S]=Z.useState(null),[C,w]=Z.useState(null),[T,E]=Z.useState(``),[D,O]=Z.useState(new Set),[k,A]=Z.useState(!1),[j,M]=Z.useState(!1),[N,P]=Z.useState([]),[F,I]=Z.useState([]),[L,R]=Z.useState([]),[z,B]=Z.useState(null),[V,H]=Z.useState({key:null,loading:!1,error:null,resolved:!1}),[ee,ne]=Z.useState(0),U=Z.useRef({key:null,generation:0}),[re,ie]=Z.useState(!1),W=fa(c)&&!re,ae=Z.useMemo(()=>{let e=c?.files??[];if(W)return[];let t=new Map;for(let n of e)t.set(n.path,n);return Array.from(t.values()).sort((e,t)=>e.path.localeCompare(t.path))},[c?.files,W]),oe=Z.useMemo(()=>ae.filter(Gs),[ae]),G=Z.useMemo(()=>ae.filter(Ks),[ae]),{deferredStagedCount:se,deferredUnstagedCount:ce}=Z.useMemo(()=>{if(!W||!c)return{deferredStagedCount:0,deferredUnstagedCount:0};let e=0,t=0;for(let n of c.files??[])Gs(n)&&(e+=1),Ks(n)&&(t+=1);return{deferredStagedCount:e,deferredUnstagedCount:t}},[W,c]),le=Z.useMemo(()=>{if(L.length>0)return L;let e=c?.tracking?.includes(`/`)?c.tracking.split(`/`)[0]:null;return e||z?[{name:e||`origin`,fetchUrl:z??``,pushUrl:z??``}]:[]},[z,L,c?.tracking]),ue=Z.useMemo(()=>e=>!s||v.type!==`diff`?null:e.directories.get(s)?.diffCache.get(qs(v.path,v.staged))??null,[s,v]),de=yr(ue),fe=Z.useMemo(()=>v.type===`diff`?ae.find(e=>e.path===v.path)??null:null,[ae,v]),K=v.type===`diff`&&s?`${s}\u0000${qs(v.path,v.staged)}`:null,pe=V.key===K,me=!!(K&&!de&&(!pe||V.loading)),he=pe?V.error:null,_e=!!(fe||pe&&V.resolved),ve=q(async(e,t=!0)=>{try{await Promise.all([p(e,o),m(e,o)])}catch(e){t&&Ct.error(e instanceof Error?e.message:a(`gitView.toast.refreshRepositoryFailed`))}}),ye=q(async(e,t,n)=>{let r=()=>U.current.key===t&&U.current.generation===n;try{let[t,n]=await Promise.all([o.getRemotes(e).catch(()=>[]),o.getRemoteUrl?o.getRemoteUrl(e).catch(()=>null):Promise.resolve(null)]);if(!r())return;R(t),B(n)}catch{if(!r())return;R([]),B(null)}}),be=q(e=>{if(e!==s)return{requestGeneration:null,promise:Promise.resolve()};let t=U.current.generation+1;return U.current={key:e,generation:t},{requestGeneration:t,promise:ye(e,e,t)}});Z.useEffect(()=>{s&&(d(s),f(s,o))},[s,f,o,d]),Z.useEffect(()=>{if(!s){U.current={key:null,generation:U.current.generation+1},R([]),B(null);return}let{requestGeneration:e,promise:t}=be(s);return()=>{e!==null&&U.current.key===s&&U.current.generation===e&&(U.current={key:s,generation:e+1})}},[s,o,be]),Z.useEffect(()=>{if(!s||ae.length===0)return;let e=Array.from(new Set([...oe.map(e=>e.path),...F,...ae.slice(0,20).map(e=>e.path)])).filter(Boolean);if(e.length===0)return;let t=window.setTimeout(()=>{h(s,o,e,{maxFiles:40})},120);return()=>window.clearTimeout(t)},[ae,s,o,h,oe,F]),Z.useEffect(()=>{if(v.type!==`diff`){H({key:null,loading:!1,error:null,resolved:!1});return}let e=qs(v.path,v.staged);if(!s||!K){H({key:null,loading:!1,error:null,resolved:!1});return}if(g(s,e)){H(e=>({key:K,loading:!1,error:null,resolved:e.key===K&&e.resolved||!!fe}));return}let t=!1;return H({key:K,loading:!0,error:null,resolved:!1}),o.getGitFileDiff(s,{path:v.path,staged:v.staged||void 0}).then(n=>{t||(_(s,e,{original:n.original??``,modified:n.modified??``,isBinary:n.isBinary}),H(e=>e.key===K?{...e,loading:!1,error:null,resolved:!0}:e))}).catch(e=>{t||H(t=>t.key===K?{...t,loading:!1,error:e instanceof Error?e.message:String(e),resolved:!1}:t)}),()=>{t=!0}},[K,s,ee,g,o,v,fe,_]);let xe=async(e,t)=>{if(!s)return;let n=s;S(e);try{let r=e=>{let t=`${e.name}/`,n=c?.tracking?.startsWith(t)?c.tracking.slice(t.length):void 0;return{remote:e.name,branch:n,rebase:!0}};if(e===`fetch`){if(!t)throw Error(a(`mobile.changes.noRemote`));await o.gitFetch(n,{remote:t.name}),Ct.success(a(`gitView.toast.fetchedFromRemote`,{name:t.name}))}else if(e===`sync`){if(!t)throw Error(a(`mobile.changes.noRemote`));await o.gitFetch(n,{remote:t.name});let e=await o.getGitStatus(n);if((e.behind??0)>0){if((e.files?.length??0)>0){Ct.error(a(`gitView.toast.commitOrStashBeforeSync`));return}await o.gitPull(n,r(t))}((await o.getGitStatus(n)).ahead??0)>0&&await o.gitPush(n),Ct.success(a(`gitView.toast.alreadyUpToDate`))}await ve(n,!1),await be(n).promise}catch(e){Ct.error(e instanceof Error?e.message:a(`gitView.toast.syncActionFailed`,{action:a(`gitView.sync.syncChanges`)}))}finally{S(null)}},Se=q(async(e,t)=>{if(!s||e.length===0)return;let n=s;try{t===`stage`?e.length>1?await Gt(n,e):await Wt(n,e[0]):e.length>1?await Ut(n,e):await Ht(n,e[0]),await ve(n,!1)}catch(e){Ct.error(e instanceof Error?e.message:a(t===`stage`?`gitView.toast.stageFileFailed`:`gitView.toast.unstageFileFailed`))}}),Ce=q((e,t=!1)=>{y({type:`diff`,path:e,staged:t,targetLine:null})}),we=q(()=>v.type===`diff`&&(y({type:`list`}),!0));ka({id:`mobile-changes-diff`,active:v.type===`diff`&&!i,layer:`overlay`,onBack:we,surfaceRef:b});let Te=q(async e=>{if(!s)return;let t=s;O(t=>new Set(t).add(e));try{await o.revertGitFile(t,e),Ct.success(a(`gitView.toast.revertedFile`,{path:e})),await ve(t,!1)}catch(e){Ct.error(e instanceof Error?e.message:a(`gitView.toast.revertFailed`))}finally{O(t=>{let n=new Set(t);return n.delete(e),n})}}),Ee=q(async e=>{if(!s||e.length===0||k)return;let t=s,n=Array.from(new Set(e));A(!0),O(new Set(n));try{await Promise.all(n.map(e=>o.revertGitFile(t,e))),await ve(t,!1),Ct.success(n.length===1?a(`gitView.toast.revertedFilesSingle`,{count:n.length}):a(`gitView.toast.revertedFilesPlural`,{count:n.length}))}catch(e){Ct.error(e instanceof Error?e.message:a(`gitView.toast.revertFailed`))}finally{O(new Set),A(!1)}}),De=q(e=>{let t=e.map(e=>e.trim()).filter(Boolean);if(t.length===0){P([]);return}E(e=>`${e.trim()}${e.trim()?`
|
|
4
|
-
|
|
5
|
-
`:``}${t.join(`
|
|
6
|
-
`)}`.trim()),P([])}),Oe=q(async()=>{if(!s)return;let e=s,t=oe.map(e=>e.path).sort();if(t.length===0){Ct.error(a(`gitView.toast.selectFileToDescribe`));return}M(!0);try{let{message:n}=await Kt(e,t);E(n.subject?.trim()??``),P(Array.isArray(n.highlights)?n.highlights:[])}catch(e){Ct.error(e instanceof Error?e.message:a(`gitView.toast.generateCommitMessageFailed`))}finally{M(!1)}}),ke=async(e={})=>{if(!s)return;let t=s;if(!T.trim()){Ct.error(a(`gitView.toast.enterCommitMessage`));return}let n=oe.map(e=>e.path).sort();if(n.length===0){Ct.error(a(`gitView.toast.selectFileToCommit`));return}w(e.pushAfter?`commitAndPush`:`commit`);try{if(await o.createGitCommit(t,T.trim(),{files:n}),Ct.success(a(`gitView.toast.commitCreated`)),E(``),P([]),e.pushAfter){let e=c?.tracking?.split(`/`)[0],n=le.find(t=>t.name===e)??le[0];if(!n)throw Error(a(`mobile.changes.noRemote`));S(`sync`);let r=`${n.name}/`,i=c?.tracking?.startsWith(r)?c.tracking.slice(r.length):void 0;await o.gitFetch(t,{remote:n.name}),((await o.getGitStatus(t)).behind??0)>0&&await o.gitPull(t,{remote:n.name,branch:i,rebase:!0}),((await o.getGitStatus(t)).ahead??0)>0&&await o.gitPush(t),await ve(t,!1),await be(t).promise}else await ve(t,!1)}catch(e){Ct.error(e instanceof Error?e.message:a(`gitView.toast.createCommitFailed`))}finally{w(null),e.pushAfter&&S(null)}},Ae=Z.useMemo(()=>{let e=[];return oe.length>0&&e.push({id:`staged`,title:a(`gitView.changes.stagedTitle`),entries:oe,actionSymbol:`-`,actionAllLabel:a(`gitView.changes.unstageAllAria`),getActionLabel:e=>a(`gitView.changes.unstageFileAria`,{path:e}),onActionFile:e=>void Se([e],`unstage`),onActionAll:e=>void Se(e,`unstage`),onViewDiff:e=>Ce(e,!0),onRevertFile:Te,showRevertActions:!1,accent:!0}),G.length>0&&e.push({id:`unstaged`,title:a(`gitView.changes.title`),entries:G,actionSymbol:`+`,actionAllLabel:a(`gitView.changes.stageAllAria`),getActionLabel:e=>a(`gitView.changes.stageFileAria`,{path:e}),onActionFile:e=>void Se([e],`stage`),onActionAll:e=>void Se(e,`stage`),onViewDiff:e=>Ce(e,!1),onRevertFile:Te}),e},[Te,Ce,Se,oe,a,G]),je=t=>(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background text-foreground`,children:[i?null:(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,children:[e?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":a(`mobile.surface.closeAria`),onClick:e,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 px-1`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label text-foreground`,children:a(`mobile.nav.changes`)}),(0,$.jsx)(`p`,{className:`truncate typography-micro text-muted-foreground`,children:c?.current||s||``})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:t})]});return s?u&&l===null?je((0,$.jsx)(Ys,{loading:!0,message:a(`gitView.loading.checkingRepository`)})):l===!1?je((0,$.jsx)(Ys,{icon:!0,message:a(`gitView.empty.notGitRepository`),description:a(`gitView.empty.notGitRepositoryDescription`)})):v.type===`diff`?(0,$.jsx)(`div`,{ref:b,className:`h-full min-h-0`,children:(0,$.jsx)(Xs,{path:v.path,directory:s,diff:de,fileExists:_e,error:he,loading:me,targetLine:v.targetLine,onBack:we,onRetry:()=>ne(e=>e+1),hideHeader:i})}):(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background text-foreground`,children:[(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,children:[e?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":a(`mobile.surface.closeAria`),onClick:e,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 px-1`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label text-foreground`,children:a(`mobile.nav.changes`)}),(0,$.jsx)(`p`,{className:`truncate typography-micro text-muted-foreground`,children:c?.current||s})]}),(0,$.jsx)(ci,{syncAction:x,remotes:le,onSync:e=>void xe(`sync`,e),disabled:C!==null||u,aheadCount:c?.ahead??0,behindCount:c?.behind??0,trackingRemoteName:c?.tracking?.split(`/`)[0],hasUncommittedChanges:(c?.files?.length??0)>0})]}),W?(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(wi,{stagedCount:se,unstagedCount:ce,onLoad:()=>ie(!0)})}):ae.length>0?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden px-4 pt-4`,children:(0,$.jsx)(oi,{groups:Ae,diffStats:c?.diffStats,revertingPaths:D,onRevertAll:Ee,isRevertingAll:k,headerBackgroundClassName:`bg-transparent`,onVisiblePathsChange:I})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-border/50 px-4 pb-4 pt-3`,children:(0,$.jsx)(Pi,{stagedCount:oe.length,commitMessage:T,onCommitMessageChange:E,generatedHighlights:N,onInsertHighlights:De,onGenerateMessage:Oe,isGeneratingMessage:j,onCommit:()=>void ke({pushAfter:!1}),onCommitAndPush:()=>void ke({pushAfter:!0}),commitAction:C,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Ys,{icon:!0,message:a(`gitView.empty.cleanTitle`),description:a(`mobile.changes.cleanDescription`)})})]}):je((0,$.jsx)(Ys,{message:a(`gitView.empty.selectSessionOrDirectory`)}))},Ys=e=>{let t=(0,Q.c)(13),{message:n,description:r,loading:i,icon:a}=e,o=i!==void 0&&i,s=a!==void 0&&a,c;t[0]===o?c=t[1]:(c=o?(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin text-muted-foreground`}):null,t[0]=o,t[1]=c);let l;t[2]===s?l=t[3]:(l=s?(0,$.jsx)(X,{name:`git-branch`,className:`size-6 text-muted-foreground`}):null,t[2]=s,t[3]=l);let u;t[4]===n?u=t[5]:(u=(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:n}),t[4]=n,t[5]=u);let d;t[6]===r?d=t[7]:(d=r?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:r}):null,t[6]=r,t[7]=d);let f;return t[8]!==c||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-2`,children:[c,l,u,d]})}),t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f},Xs=e=>{let t=(0,Q.c)(26),{path:n,directory:r,diff:i,fileExists:a,error:o,loading:s,targetLine:c,onBack:l,onRetry:u,hideHeader:d}=e,f=d!==void 0&&d,{t:p}=ge(),m=dr(),h;t[0]===n?h=t[1]:(h=jr(n)||`text`,t[0]=n,t[1]=h);let g=h,_;t[2]!==r||t[3]!==m||t[4]!==n||t[5]!==p?(_=m?(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,title:p(`diffView.actions.openFilePreview`),"aria-label":p(`diffView.actions.openFilePreview`),onClick:()=>m.openFile({path:re(r,n)}),children:(0,$.jsx)(X,{name:`eye`,className:`size-4`})}):null,t[2]=r,t[3]=m,t[4]=n,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]!==f||t[8]!==l||t[9]!==n||t[10]!==v||t[11]!==p?(y=f?(0,$.jsx)(ar,{children:v}):(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/50 px-3 text-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":p(`header.actions.backAria`),onClick:l,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1 px-2`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-header text-foreground`,children:n})}),v]}),t[7]=f,t[8]=l,t[9]=n,t[10]=v,t[11]=p,t[12]=y):y=t[12];let b;t[13]!==i||t[14]!==o||t[15]!==a||t[16]!==g||t[17]!==s||t[18]!==u||t[19]!==n||t[20]!==p||t[21]!==c?(b=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o?(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3`,children:[(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:p(`mobile.changes.diffDetail.loadFailed`)}),(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),(0,$.jsx)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:u,children:p(`diffView.actions.retry`)})]})}):s?(0,$.jsx)(Ys,{loading:!0,message:p(`diffView.state.loadingDiff`)}):a?i?i.isBinary?(0,$.jsx)(Ys,{icon:!0,message:p(`diffView.binary.unavailable`)}):Mr(n)?(0,$.jsx)(Ys,{icon:!0,message:p(`mobile.changes.diffDetail.imageUnavailable`)}):(0,$.jsx)(Br,{className:`h-full overflow-y-auto overflow-x-hidden p-3 pwa-overlay-scroll`,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:(0,$.jsx)(sa,{original:i.original,modified:i.modified,language:g,fileName:n,renderSideBySide:!1,wrapLines:!0,focusLine:c,layout:`inline`})}):(0,$.jsx)(Ys,{loading:!0,message:p(`diffView.state.loadingDiff`)}):(0,$.jsx)(Ys,{icon:!0,message:p(`mobile.changes.diffDetail.missingTitle`),description:p(`mobile.changes.diffDetail.missingDescription`)})}),t[13]=i,t[14]=o,t[15]=a,t[16]=g,t[17]=s,t[18]=u,t[19]=n,t[20]=p,t[21]=c,t[22]=b):b=t[22];let x;return t[23]!==y||t[24]!==b?(x=(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background text-foreground`,children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25],x},Zs=e(w(),1),Qs=`data-yuri-motion-id`,$s=`data-yuri-sheet-overscroll`,ec=`html, body { overscroll-behavior-y: none; }`,tc=[`input`,`textarea`,`select`,`[contenteditable]:not([contenteditable="false"])`,`[data-mobile-sheet-no-dismiss]`].join(`, `),nc=e=>e.closest(`[data-yuri-motion-id]`)?.getAttribute(`data-yuri-motion-id`)??null,rc=e=>{try{let t=e.contentDocument;return t?t.scrollingElement??t.documentElement:null}catch{return null}},ic=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)&&e<=1&&t>0,ac=(e,t,n)=>e?!0:ic(t,n),oc=(e,t)=>{let n=e.defaultView;return!n||t==null?!1:t instanceof n.Element},sc=(e,t)=>{let n=e.defaultView;return!n||t==null?!1:t instanceof n.HTMLElement},cc=(e,t)=>{let n=e.defaultView;return!n||t==null?!1:t instanceof n.HTMLStyleElement},lc=(e,t)=>{if(typeof e.item==`function`){let n=e.item(t);if(n)return n}return e[t]??null},uc=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=lc(e,n);if(r?.identifier===t)return r}return null},dc=(e,t)=>{try{let n=e.defaultView?.getComputedStyle(t);if(!n)return!1;let r=n.overflowY;return(r===`auto`||r===`scroll`||r===`overlay`)&&t.scrollHeight>t.clientHeight+1}catch{return!1}},fc=(e,t)=>{let n=[],r=new Set,i=t=>{!t||r.has(t)||dc(e,t)&&(r.add(t),n.push(t))},a=oc(e,t)?t:null;for(;a&&(sc(e,a)&&i(a),a!==e.documentElement&&a!==e.body);)a=a.parentElement;let o=e.scrollingElement??e.documentElement;return sc(e,o)&&i(o),n},pc=(e,t)=>{let n=fc(e,t);if(n.length===0){let t=(e.scrollingElement??e.documentElement)?.scrollTop??1/0;return Number.isFinite(t)&&t<=1}return n.every(e=>e.scrollTop<=1)},mc=e=>{let t=e.closest(`[${Qs}]`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect().height;if(Number.isFinite(e)&&e>0)return e}return window.innerHeight||1},hc=e=>{let t=null,n=()=>{t?.(),t=null;let n=(()=>{try{return e.contentDocument}catch{return null}})();if(!n)return;let r=nc(e);if(!r)return;let i=null;if(!cc(n,n.querySelector(`style[${$s}]`))){let e=n.createElement(`style`);e.setAttribute($s,`true`),e.textContent=ec,(n.head??n.documentElement).appendChild(e),i=e}let a=null,o=()=>{a?.active&&a.controller.finish(`cancel`),a=null},s=t=>{if(o(),t.touches.length!==1||(oc(n,t.target)?t.target:null)?.closest(tc)||!pc(n,t.target))return;let r=lc(t.touches,0);if(!r)return;let i=mc(e);a={touchId:r.identifier,startX:r.screenX,startY:r.screenY,lastY:r.screenY,lastTime:t.timeStamp,lastVelocityTime:t.timeStamp,velocity:0,motionDistance:i,commitDistance:rr(i,.1,40,64),active:!1,controller:null}},c=t=>{if(!a)return;if(t.touches.length!==1){o();return}let i=uc(t.touches,a.touchId);if(!i){o();return}let s=i.screenY-a.startY,c=i.screenX-a.startX,l=t.timeStamp-a.lastTime;if(a.velocity=cr(a.velocity,i.screenY-a.lastY,l,t.timeStamp-a.lastVelocityTime,1),i.screenY!==a.lastY&&l>0&&(a.lastVelocityTime=t.timeStamp),a.lastY=i.screenY,a.lastTime=t.timeStamp,!a.active){if(!pc(n,t.target)){a=null;return}if(!ac(!1,rc(e)?.scrollTop??0,s)){a=null;return}if(!tr(`bottom`,c,s,8,1))return;let i=nr(r);if(!i?.begin(`dismiss`)){a=null;return}a={...a,active:!0,controller:i}}let u=a;if(!u.active)return;t.preventDefault();let d=er(`bottom`,c,s);u.controller.update(or(d,u.motionDistance))},l=e=>{if(!a)return;let t=a,n=uc(e.changedTouches,t.touchId);if(a=null,!t.active)return;if(!n){t.controller.finish(`cancel`);return}let r=e.timeStamp-t.lastTime;t.velocity=cr(t.velocity,n.screenY-t.lastY,r,e.timeStamp-t.lastVelocityTime,1),n.screenY!==t.lastY&&r>0&&(t.lastVelocityTime=e.timeStamp),t.lastY=n.screenY,t.lastTime=e.timeStamp;let i=n.screenY-t.startY,o=n.screenX-t.startX,s=er(`bottom`,o,i),c=ir(s,t.velocity,t.commitDistance,.65,12);t.controller.finish(c?`commit`:`cancel`),e.preventDefault()},u=()=>o();n.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),n.addEventListener(`touchmove`,c,{capture:!0,passive:!1}),n.addEventListener(`touchend`,l,{capture:!0,passive:!1}),n.addEventListener(`touchcancel`,u,{capture:!0,passive:!0}),t=()=>{o(),n.removeEventListener(`touchstart`,s,!0),n.removeEventListener(`touchmove`,c,!0),n.removeEventListener(`touchend`,l,!0),n.removeEventListener(`touchcancel`,u,!0);try{i?.remove()}catch{}i=null}};return e.addEventListener(`load`,n),n(),()=>{e.removeEventListener(`load`,n),t?.()}},gc=Xn(()=>ae(()=>import(`./ToolOutputDialog-C5b57FEy.js`),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,2,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]))),_c=25e4,vc=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),yc=e=>{let t=vc(e);return!t||t===`/`?t||`/`:t.split(`/`).filter(Boolean).at(-1)??t},bc=e=>{let t=vc(e);if(!t||t===`/`)return null;let n=t.lastIndexOf(`/`);return n<=0?t.startsWith(`/`)?`/`:null:t.slice(0,n)},xc=(e,t)=>{let n=vc(e),r=vc(t);return!r||n===r?yc(n):n.startsWith(`${r}/`)?n.slice(r.length+1):n},Sc=e=>{if(typeof e!=`number`||!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=e/1024;for(let e of t){if(n<1024||e===t[t.length-1])return`${n.toFixed(n>=10?0:1)} ${e}`;n/=1024}return``},Cc=e=>/\.(md|mdx|markdown)$/i.test(e),wc=e=>{let t=e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`);return`/api/fs/serve${t.startsWith(`/`)?t:`/${t}`}`},Tc=e=>ne(wc(e)).url,Ec=e=>{let t=(0,Q.c)(156),{onClose:n,initialFilePath:r,directFilePreview:i,hideFileHeader:a}=e,o=r===void 0?null:r,s=i!==void 0&&i,c=a!==void 0&&a,{t:l}=ge(),{files:u}=te(),d=Fr()??null,f;t[0]===d?f=t[1]:(f=vc(d),t[0]=d,t[1]=f);let p=f,m;t[2]!==o||t[3]!==p?(m=()=>{let e=vc(o);return e?{type:`file`,path:e,returnDirectory:bc(e)??p}:{type:`browser`,directory:p}},t[2]=o,t[3]=p,t[4]=m):m=t[4];let[h,g]=Z.useState(m),_=Z.useRef(null),[v,y]=Z.useState(``),b=I(Fc),x=I(Ic),S,C;t[5]===p?(S=t[6],C=t[7]):(S=()=>{p&&g(e=>e.type===`file`?e.returnDirectory?e:{...e,returnDirectory:bc(e.path)??p}:e.type===`browser`&&e.directory?e:{type:`browser`,directory:p})},C=[p],t[5]=p,t[6]=S,t[7]=C),Z.useEffect(S,C);let w,T;t[8]!==b||t[9]!==p||t[10]!==x?(T=()=>{if(!b||!p)return;let e=vc(b);if(!e){x(null);return}y(``),g({type:`file`,path:e,returnDirectory:bc(e)??p}),x(null)},w=[b,p,x],t[8]=b,t[9]=p,t[10]=x,t[11]=w,t[12]=T):(w=t[11],T=t[12]),Z.useEffect(T,w);let E=h.type===`browser`?h.directory:h.returnDirectory,D=h.type===`browser`?h.directory:``,O=h.type===`file`?h.path:``,[k,A]=Z.useState(`preview`),j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{A(`preview`)},t[13]=j):j=t[13];let M;t[14]===O?M=t[15]:(M=[O],t[14]=O,t[15]=M),Z.useEffect(j,M);let N=hr(v,250),P;t[16]===v?P=t[17]:(P=v.trim(),t[16]=v,t[17]=P);let F=P,L;t[18]===N?L=t[19]:(L=N.trim(),t[18]=N,t[19]=L);let R=L,z;t[20]!==D||t[21]!==p?(z={scopeDirectory:p,directory:D},t[20]=D,t[21]=p,t[22]=z):z=t[22];let ne=!!D,U;t[23]===ne?U=t[24]:(U={enabled:ne,refetchOnMount:`always`},t[23]=ne,t[24]=U);let re=H(z,U),ie;t[25]!==D||t[26]!==R?(ie={directory:D,query:R,maxResults:40},t[25]=D,t[26]=R,t[27]=ie):ie=t[27];let W=!!(D&&R),ae;t[28]===W?ae=t[29]:(ae={enabled:W},t[28]=W,t[29]=ae);let oe=ee(ie,ae),G;t[30]===O?G=t[31]:(G=O&&(!Mr(O)||O.toLowerCase().endsWith(`.svg`)),t[30]=O,t[31]=G);let se=!!G,ce;t[32]!==O||t[33]!==p?(ce={scopeDirectory:p,path:O},t[32]=O,t[33]=p,t[34]=ce):ce=t[34];let le;t[35]===se?le=t[36]:(le={enabled:se},t[35]=se,t[36]=le);let ue=V(ce,le),de=se&&ue.data?.isBinary===!0,fe;t[37]!==O||t[38]!==ue.data||t[39]!==ue.error||t[40]!==ue.isFetchedAfterMount||t[41]!==u||t[42]!==k||t[43]!==de?(fe=O&&u.readFile&&ue.data&&ue.isFetchedAfterMount&&!ue.error&&!de&&(!Pr(O)||k===`source`)&&(!Mr(O)||O.toLowerCase().endsWith(`.svg`)),t[37]=O,t[38]=ue.data,t[39]=ue.error,t[40]=ue.isFetchedAfterMount,t[41]=u,t[42]=k,t[43]=de,t[44]=fe):fe=t[44];let K=!!fe,pe;t[45]!==O||t[46]!==p?(pe={scopeDirectory:p,path:O},t[45]=O,t[46]=p,t[47]=pe):pe=t[47];let me;t[48]===K?me=t[49]:(me={enabled:K},t[48]=K,t[49]=me);let he=B(pe,me),_e=re.data?.entries.slice().sort(Lc)??[],ve;t[50]!==re.error||t[51]!==l?(ve=re.error?re.error instanceof Error?re.error.message:l(`mobile.files.error.listFailed`):null,t[50]=re.error,t[51]=l,t[52]=ve):ve=t[52];let ye=ve,be=re.isFetching,xe;t[53]===oe.data?xe=t[54]:(xe=oe.data??[],t[53]=oe.data,t[54]=xe);let Se=xe,Ce=!!(F&&R&&v===N&&oe.isFetching),we;t[55]!==he.data||t[56]!==l?(we=he.data&&he.data.length>_c?`${he.data.slice(0,_c)}\n\n${l(`mobile.files.file.truncated`)}`:he.data??``,t[55]=he.data,t[56]=l,t[57]=we):we=t[57];let Te=we,Ee=ue.error??he.error,De;t[58]!==u||t[59]!==de||t[60]!==se||t[61]!==Ee||t[62]!==l?(De=se&&(!u.statFile||!de&&!u.readFile)?l(`mobile.files.error.readUnavailable`):Ee?Ee instanceof Error?Ee.message:l(`filesView.error.readFileFailed`):null,t[58]=u,t[59]=de,t[60]=se,t[61]=Ee,t[62]=l,t[63]=De):De=t[63];let Oe=De,ke=!Oe&&(se&&(!ue.data||!ue.isFetchedAfterMount)||K&&he.isFetching&&he.data===void 0),Ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>{y(``),g({type:`browser`,directory:e})},t[64]=Ae):Ae=t[64];let je=Ae,Me;t[65]!==E||t[66]!==p?(Me=e=>{g({type:`file`,path:e,returnDirectory:E||p})},t[65]=E,t[66]=p,t[67]=Me):Me=t[67];let Ne=Me,Pe;t[68]!==s||t[69]!==n||t[70]!==h.returnDirectory||t[71]!==h.type?(Pe=()=>h.type===`file`?s?(n?.(),!0):(g({type:`browser`,directory:h.returnDirectory}),!0):!1,t[68]=s,t[69]=n,t[70]=h.returnDirectory,t[71]=h.type,t[72]=Pe):Pe=t[72];let Fe=q(Pe),Ie=h.type===`file`,Le;t[73]!==Fe||t[74]!==Ie?(Le={id:`mobile-files-detail`,active:Ie,layer:`overlay`,onBack:Fe,surfaceRef:_},t[73]=Fe,t[74]=Ie,t[75]=Le):Le=t[75],ka(Le);let Re;t[76]===l?Re=t[77]:(Re=async e=>{(await at(e)).ok||Ct.error(l(`mobile.files.toast.copyFailed`))},t[76]=l,t[77]=Re);let Y=Re,ze;t[78]!==Te||t[79]!==l?(ze=async()=>{(await at(Te)).ok?Ct.success(l(`mobile.files.toast.contentCopied`)):Ct.error(l(`mobile.files.toast.copyFailed`))},t[78]=Te,t[79]=l,t[80]=ze):ze=t[80];let Be=ze;if(!p){let e;t[81]===l?e=t[82]:(e=l(`mobile.files.empty.noDirectory`),t[81]=l,t[82]=e);let n;return t[83]===e?n=t[84]:(n=(0,$.jsx)(Pc,{message:e}),t[83]=e,t[84]=n),n}if(h.type===`file`){let e;t[85]!==Y||t[86]!==h.path?(e=()=>void Y(h.path),t[85]=Y,t[86]=h.path,t[87]=e):e=t[87];let n;t[88]===Be?n=t[89]:(n=()=>void Be(),t[88]=Be,t[89]=n);let r;return t[90]!==Fe||t[91]!==Te||t[92]!==Oe||t[93]!==c||t[94]!==k||t[95]!==de||t[96]!==ke||t[97]!==h.path||t[98]!==e||t[99]!==n?(r=(0,$.jsx)(`div`,{ref:_,className:`flex h-full min-h-0 flex-col`,children:(0,$.jsx)(Ac,{path:h.path,content:Te,error:Oe,isLoading:ke,isBinary:de,hideHeader:c,htmlViewMode:k,onHtmlViewModeChange:A,onBack:Fe,onCopyPath:e,onCopyContent:n})}),t[90]=Fe,t[91]=Te,t[92]=Oe,t[93]=c,t[94]=k,t[95]=de,t[96]=ke,t[97]=h.path,t[98]=e,t[99]=n,t[100]=r):r=t[100],r}let Ve;t[101]!==p||t[102]!==h.directory||t[103]!==l?(Ve=h.directory===p?l(`mobile.files.rootDirectory`):yc(h.directory),t[101]=p,t[102]=h.directory,t[103]=l,t[104]=Ve):Ve=t[104];let He=Ve,Ue;t[105]!==v||t[106]!==Se?(Ue=v.trim()?Se:[],t[105]=v,t[106]=Se,t[107]=Ue):Ue=t[107];let We=Ue,Ge,Ke,qe,Je;if(t[108]!==n||t[109]!==v||t[110]!==p||t[111]!==h.directory||t[112]!==l){let e=bc(h.directory),r=h.directory!==p&&e!==null&&(e===p||e.startsWith(`${p}/`)),i=r&&!v.trim(),a=r?e:null;Je=`flex h-full flex-col overflow-hidden bg-background text-foreground`,Ge=`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,t[117]!==n||t[118]!==l?(Ke=n?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":l(`mobile.surface.closeAria`),onClick:n,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,t[117]=n,t[118]=l,t[119]=Ke):Ke=t[119],qe=i&&a?(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":l(`mobile.files.backToParentAria`,{name:yc(a)}),onClick:()=>je(a),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}):null,t[108]=n,t[109]=v,t[110]=p,t[111]=h.directory,t[112]=l,t[113]=Ge,t[114]=Ke,t[115]=qe,t[116]=Je}else Ge=t[113],Ke=t[114],qe=t[115],Je=t[116];let Ye;t[120]===He?Ye=t[121]:(Ye=(0,$.jsx)(`div`,{className:`min-w-0 flex-1 px-1`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label text-foreground`,children:He})}),t[120]=He,t[121]=Ye);let Xe;t[122]===l?Xe=t[123]:(Xe=l(`mobile.files.refreshAria`),t[122]=l,t[123]=Xe);let Ze;t[124]===re?Ze=t[125]:(Ze=()=>void re.refetch(),t[124]=re,t[125]=Ze);let Qe;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Qe={touchAction:`manipulation`},t[126]=Qe):Qe=t[126];let $e=be&&`animate-spin`,et;t[127]===$e?et=t[128]:(et=J(`size-5`,$e),t[127]=$e,t[128]=et);let tt;t[129]===et?tt=t[130]:(tt=(0,$.jsx)(X,{name:`refresh`,className:et}),t[129]=et,t[130]=tt);let nt;t[131]!==Xe||t[132]!==Ze||t[133]!==tt?(nt=(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":Xe,onClick:Ze,style:Qe,children:tt}),t[131]=Xe,t[132]=Ze,t[133]=tt,t[134]=nt):nt=t[134];let rt;t[135]!==Ge||t[136]!==Ke||t[137]!==qe||t[138]!==Ye||t[139]!==nt?(rt=(0,$.jsxs)(`header`,{className:Ge,children:[Ke,qe,Ye,nt]}),t[135]=Ge,t[136]=Ke,t[137]=qe,t[138]=Ye,t[139]=nt,t[140]=rt):rt=t[140];let it;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,$.jsx)(X,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),t[141]=it):it=t[141];let ot;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>y(e.target.value),t[142]=ot):ot=t[142];let st;t[143]===l?st=t[144]:(st=l(`mobile.files.search.placeholder`),t[143]=l,t[144]=st);let ct;t[145]!==v||t[146]!==st?(ct=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,"data-mobile-sheet-no-dismiss":``,children:(0,$.jsxs)(`div`,{className:`relative`,children:[it,(0,$.jsx)(On,{type:`text`,inputMode:`search`,value:v,onChange:ot,placeholder:st,className:`h-11 pl-9`})]})}),t[145]=v,t[146]=st,t[147]=ct):ct=t[147];let lt=Br,ut=ye?(0,$.jsx)(Pc,{message:ye}):v.trim()?(0,$.jsx)(Oc,{results:We,isSearching:Ce,onOpenFile:Ne}):(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:[_e.length===0&&!be?(0,$.jsx)(`div`,{className:`px-4 py-8 text-center typography-body text-muted-foreground`,children:l(`mobile.files.empty.directory`)}):null,_e.map(e=>(0,$.jsx)(Dc,{name:e.name,path:e.path,directory:e.isDirectory,meta:e.isDirectory?void 0:Sc(e.size),onClick:()=>e.isDirectory?je(e.path):Ne(e.path)},e.path))]}),dt;t[148]!==lt||t[149]!==ut?(dt=(0,$.jsx)(lt,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto px-4 pb-3`,children:ut}),t[148]=lt,t[149]=ut,t[150]=dt):dt=t[150];let ft;return t[151]!==Je||t[152]!==rt||t[153]!==ct||t[154]!==dt?(ft=(0,$.jsxs)(`div`,{className:Je,children:[rt,ct,dt]}),t[151]=Je,t[152]=rt,t[153]=ct,t[154]=dt,t[155]=ft):ft=t[155],ft},Dc=e=>{let t=(0,Q.c)(16),{name:n,path:r,directory:i,meta:a,onClick:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={touchAction:`manipulation`},t[0]=s):s=t[0];let c;t[1]!==i||t[2]!==r?(c=i?(0,$.jsx)(X,{name:`folder-3-fill`,className:`size-5 shrink-0 text-muted-foreground`}):(0,$.jsx)(Dn,{filePath:r,className:`size-5 shrink-0`}),t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:n}),t[4]=n,t[5]=l);let u;t[6]===a?u=t[7]:(u=a?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:a}):null,t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=i?(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-4 shrink-0 text-muted-foreground/60`}):null,t[8]=i,t[9]=d);let f;return t[10]!==o||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-14 w-full items-center gap-3 border-b border-border/30 px-3 py-2.5 text-left transition-colors last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,onClick:o,style:s,children:[c,l,u,d]}),t[10]=o,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f},Oc=e=>{let t=(0,Q.c)(10),{results:n,isSearching:r,onOpenFile:i}=e,{t:a}=ge(),o=vc(Fr()??null);if(r){let e;t[0]===a?e=t[1]:(e=a(`common.loading`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(Pc,{loading:!0,message:e}),t[2]=e,t[3]=n),n}if(n.length===0){let e;t[4]===a?e=t[5]:(e=a(`mobile.files.search.empty`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,$.jsx)(Pc,{message:e}),t[6]=e,t[7]=n),n}let s=n.map(e=>(0,$.jsx)(Dc,{name:yc(e.path),path:e.path,directory:!1,meta:xc(e.path,o),onClick:()=>i(e.path)},e.path)),c;return t[8]===s?c=t[9]:(c=(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:s}),t[8]=s,t[9]=c),c},kc=e=>{let t=(0,Q.c)(26),{path:n,canUseText:r,htmlViewMode:i,htmlFullscreen:a,onToggleHtmlViewMode:o,onEnterHtmlFullscreen:s,onCopyPath:c,onCopyContent:l}=e,{t:u}=ge(),d;t[0]===n?d=t[1]:(d=Pr(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==r||t[3]!==f||t[4]!==a||t[5]!==i||t[6]!==s||t[7]!==o||t[8]!==u?(p=f&&r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u(i===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,$.jsx)(X,{name:i===`preview`?`file-code`:`eye`,className:`size-4`})}),a?null:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:s,"aria-label":u(`mobile.files.html.fullscreenAria`),children:(0,$.jsx)(X,{name:`fullscreen`,className:`size-4`})})]}):null,t[2]=r,t[3]=f,t[4]=a,t[5]=i,t[6]=s,t[7]=o,t[8]=u,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==f||t[12]!==l||t[13]!==n||t[14]!==u?(m=r&&!Mr(n)&&!f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:l,"aria-label":u(`mobile.files.copyContentAria`),children:(0,$.jsx)(X,{name:`file-copy`,className:`size-4`})}):null,t[10]=r,t[11]=f,t[12]=l,t[13]=n,t[14]=u,t[15]=m):m=t[15];let h;t[16]!==r||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==u?(h=!r||Mr(n)||f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:c,"aria-label":u(`mobile.files.copyPathAria`),children:(0,$.jsx)(X,{name:`clipboard`,className:`size-4`})}):null,t[16]=r,t[17]=f,t[18]=c,t[19]=n,t[20]=u,t[21]=h):h=t[21];let g;return t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,$.jsxs)($.Fragment,{children:[p,m,h]}),t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g},Ac=e=>{let t=(0,Q.c)(90),{path:n,content:r,error:i,isLoading:a,isBinary:o,hideHeader:s,htmlViewMode:c,onHtmlViewModeChange:l,onBack:u,onCopyPath:d,onCopyContent:f}=e,p=s!==void 0&&s,{t:m}=ge(),h=Z.useRef(null),g=Fr(),_=Mr(n)&&!n.toLowerCase().endsWith(`.svg`)?n:``,v;t[0]===n?v=t[1]:(v=bc(n)??``,t[0]=n,t[1]=v);let y=Ir(_,v,`preview`),[b,x]=Z.useState(``),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S={open:!1,title:``,content:``},t[2]=S):S=t[2];let[C,w]=Z.useState(S),T=y.source,E;t[3]===n?E=t[4]:(E=yc(n),t[3]=n,t[4]=E);let D=E,O;t[5]!==r||t[6]!==n?(O=Mr(n)?`data:${Nr(n)};utf8,${encodeURIComponent(r)}`:``,t[5]=r,t[6]=n,t[7]=O):O=t[7];let k=O,A;t[8]!==r||t[9]!==k||t[10]!==T||t[11]!==n?(A=T||(Mr(n)&&r?k:``),t[8]=r,t[9]=k,t[10]=T,t[11]=n,t[12]=A):A=t[12];let j=A,M;t[13]!==i||t[14]!==b||t[15]!==y.error||t[16]!==j||t[17]!==m?(M=i??y.error??(j&&b===j?m(`filesView.error.readFileFailed`):null),t[13]=i,t[14]=b,t[15]=y.error,t[16]=j,t[17]=m,t[18]=M):M=t[18];let N=M,P;t[19]===j?P=t[20]:(P=()=>x(j),t[19]=j,t[20]=P);let F=q(P),I;t[21]!==D||t[22]!==_||t[23]!==n||t[24]!==j?(I=e=>{let t=_||j;t&&w({open:!0,title:D,content:``,previewSource:e.currentTarget.querySelector(`img`)??void 0,metadata:{tool:`image-preview`,filename:D,mime:Nr(n)},image:{url:t,mimeType:Nr(n),filename:D}})},t[21]=D,t[22]=_,t[23]=n,t[24]=j,t[25]=I):I=t[25];let L=q(I),R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{w(t=>t.open===e?t:{...t,open:e})},t[26]=R):R=t[26];let z=q(R),B;t[27]===n?B=t[28]:(B=Pr(n),t[27]=n,t[28]=B);let V=B,[H,ee]=Z.useState(!1),te=Z.useRef(null),ne;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>{ee(!1)},t[29]=ne):ne=t[29];let U;t[30]===n?U=t[31]:(U=[n],t[30]=n,t[31]=U),Z.useEffect(ne,U);let re;t[32]!==c||t[33]!==l?(re=()=>{l(c===`preview`?`source`:`preview`)},t[32]=c,t[33]=l,t[34]=re):re=t[34];let ie=q(re),W;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{ee(!0)},t[35]=W):W=t[35];let ae=q(W),oe;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>(ee(!1),!0),t[36]=oe):oe=t[36];let G=q(oe),se=V&&H,ce;t[37]!==G||t[38]!==se?(ce={id:`mobile-html-fullscreen`,active:se,layer:`overlay`,onBack:G,surfaceRef:te},t[37]=G,t[38]=se,t[39]=ce):ce=t[39],ka(ce);let le=!o&&!a&&!i,ue;t[40]!==ae||t[41]!==H||t[42]!==c||t[43]!==f||t[44]!==d||t[45]!==n||t[46]!==le||t[47]!==ie?(ue=(0,$.jsx)(kc,{path:n,canUseText:le,htmlViewMode:c,htmlFullscreen:H,onToggleHtmlViewMode:ie,onEnterHtmlFullscreen:ae,onCopyPath:d,onCopyContent:f}),t[40]=ae,t[41]=H,t[42]=c,t[43]=f,t[44]=d,t[45]=n,t[46]=le,t[47]=ie,t[48]=ue):ue=t[48];let de=ue,fe;t[49]!==r||t[50]!==i||t[51]!==c||t[52]!==a||t[53]!==n||t[54]!==m?(fe=c===`source`?a?(0,$.jsx)(Pc,{loading:!0,message:m(`filesView.state.loading`)}):i?(0,$.jsx)(Ma,{message:i}):(0,$.jsx)(Nc,{path:n,content:r}):(0,$.jsx)(jc,{path:n}),t[49]=r,t[50]=i,t[51]=c,t[52]=a,t[53]=n,t[54]=m,t[55]=fe):fe=t[55];let K=fe,pe;t[56]!==G||t[57]!==V||t[58]!==K||t[59]!==H||t[60]!==c||t[61]!==D||t[62]!==m||t[63]!==ie?(pe=V?(0,$.jsxs)(`div`,{ref:te,"data-mobile-html-preview":c===`preview`&&!H?`true`:void 0,"data-mobile-html-fullscreen":c===`preview`&&H?`true`:void 0,className:H?`fixed inset-0 z-[80] flex flex-col bg-background text-foreground`:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[H?(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-border/50 px-3 pb-2 pt-[max(0.5rem,env(safe-area-inset-top))]`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:G,"aria-label":m(`mobile.files.html.exitFullscreenAria`),className:`shrink-0 text-muted-foreground`,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-header text-foreground`,children:D}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:ie,"aria-label":m(c===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,$.jsx)(X,{name:c===`preview`?`file-code`:`eye`,className:`size-4`})})]}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,children:K})]}):null,t[56]=G,t[57]=V,t[58]=K,t[59]=H,t[60]=c,t[61]=D,t[62]=m,t[63]=ie,t[64]=pe):pe=t[64];let me=pe,he=g??void 0,_e;t[65]!==r||t[66]!==i||t[67]!==de||t[68]!==F||t[69]!==z||t[70]!==p||t[71]!==V||t[72]!==H||t[73]!==me||t[74]!==N||t[75]!==D||t[76]!==C||t[77]!==y.loading||t[78]!==o||t[79]!==a||t[80]!==u||t[81]!==L||t[82]!==n||t[83]!==j||t[84]!==m?(_e=e=>{let{preview:t,controls:s}=e;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,"data-mobile-edge-to-edge-preview":`true`,children:[p?(0,$.jsxs)(ar,{children:[s,de]}):(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/50 px-3 text-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":m(`header.actions.backAria`),onClick:u,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-header text-foreground`,children:D})}),s,de]}),(0,$.jsx)(`div`,{ref:h,className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:t??(o&&!a&&!i?(0,$.jsx)(ca,{path:n},n):V&&!a&&!i?H&&typeof document<`u`?(0,Zs.createPortal)(me,document.body):me:a||y.loading?Mr(n)?(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:(0,$.jsx)(Lr,{className:`aspect-square w-64 max-w-full rounded-lg`})}):(0,$.jsx)(Pc,{loading:!0,message:m(`filesView.state.loading`)}):N?(0,$.jsx)(Ma,{message:N}):Mr(n)&&j?(0,$.jsx)(Br,{className:`h-full overflow-auto p-4`,children:(0,$.jsx)(`button`,{type:`button`,className:`mx-auto block w-full cursor-zoom-in rounded-lg border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [&>.yuri-image-frame]:w-full`,onClick:L,"aria-label":D,children:(0,$.jsx)(Rr,{src:j,alt:D,className:`h-auto w-full rounded-lg object-contain`,draggable:!1,onError:F})})}):(0,$.jsx)(Nc,{path:n,content:r}))}),(0,$.jsx)($t,{containerRef:h}),C.open?(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(gc,{popup:C,onOpenChange:z,isMobile:!0})}):null]})},t[65]=r,t[66]=i,t[67]=de,t[68]=F,t[69]=z,t[70]=p,t[71]=V,t[72]=H,t[73]=me,t[74]=N,t[75]=D,t[76]=C,t[77]=y.loading,t[78]=o,t[79]=a,t[80]=u,t[81]=L,t[82]=n,t[83]=j,t[84]=m,t[85]=_e):_e=t[85];let ve;return t[86]!==n||t[87]!==he||t[88]!==_e?(ve=(0,$.jsx)(pa,{path:n,base:he,children:_e}),t[86]=n,t[87]=he,t[88]=_e,t[89]=ve):ve=t[89],ve},jc=e=>{let t=(0,Q.c)(2),{path:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(la,{children:()=>(0,$.jsx)(Mc,{path:n})}),t[0]=n,t[1]=r),r},Mc=e=>{let t=(0,Q.c)(29),{path:n}=e,{t:i}=ge(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=s(),t[0]=c):c=t[0];let l=c,u=Z.useRef(null),[d,f]=Z.useState(``),[p,m]=Z.useState(0),[g,_]=Z.useState(null),[v,y]=Z.useState(``),b,x;t[1]!==n||t[2]!==i?(b=()=>{let e=!1;if(f(``),_(null),y(``),l)return U({path:n}).then(async e=>{if(!e.ok)throw Error(i(`filesView.error.readFileFailed`));return e.text()}).then(t=>{e||(y(t),f(n))}).catch(t=>{e||(_(t instanceof Error?t.message:i(`filesView.error.readFileFailed`)),f(n))}),()=>{e=!0};let t=h(),s=a(t);r(t).then(t=>{e||!t||(f(n),_(null))}).catch(t=>{e||(_(t instanceof Error?t.message:i(`filesView.error.readFileFailed`)),f(n))});let c=o(()=>{e||(f(n),m(Rc),_(null))});return()=>{e=!0,s(),c()}},x=[n,l,i],t[1]=n,t[2]=i,t[3]=b,t[4]=x):(b=t[3],x=t[4]),Z.useEffect(b,x);let S;t[5]!==n||t[6]!==d?(S=()=>{if(d!==n)return;let e=u.current;if(e)return hc(e)},t[5]=n,t[6]=d,t[7]=S):S=t[7];let C;if(t[8]!==p||t[9]!==n||t[10]!==d||t[11]!==v?(C=[p,n,d,v],t[8]=p,t[9]=n,t[10]=d,t[11]=v,t[12]=C):C=t[12],Z.useEffect(S,C),g){let e;return t[13]===g?e=t[14]:(e=(0,$.jsx)(Ma,{message:g}),t[13]=g,t[14]=e),e}if(d!==n){let e;t[15]===i?e=t[16]:(e=i(`filesView.state.loading`),t[15]=i,t[16]=e);let n;return t[17]===e?n=t[18]:(n=(0,$.jsx)(Pc,{loading:!0,message:e}),t[17]=e,t[18]=n),n}let w;t[19]===n?w=t[20]:(w=l?void 0:Tc(n),t[19]=n,t[20]=w);let T=l?v:void 0,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E={backgroundColor:`var(--surface-background)`},t[21]=E):E=t[21];let D;t[22]===i?D=t[23]:(D=i(`filesView.editor.htmlPreviewTitle`),t[22]=i,t[23]=D);let O;return t[24]!==p||t[25]!==w||t[26]!==T||t[27]!==D?(O=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:(0,$.jsx)(`iframe`,{ref:u,src:w,srcDoc:T,className:`h-full min-h-0 w-full flex-1 border-none bg-background`,style:E,sandbox:`allow-scripts allow-same-origin allow-forms`,title:D},p)}),t[24]=p,t[25]=w,t[26]=T,t[27]=D,t[28]=O):O=t[28],O},Nc=e=>{let t=(0,Q.c)(30),{path:n,content:r}=e,{currentTheme:i,availableThemes:a,lightThemeId:o,darkThemeId:s}=Ft(),c;t[0]!==a||t[1]!==o?(c=a.find(e=>e.metadata.id===o)??Jn(!1),t[0]=a,t[1]=o,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==s?(u=a.find(e=>e.metadata.id===s)??Jn(!0),t[3]=a,t[4]=s,t[5]=u):u=t[5];let d=u,f,p;t[6]!==d||t[7]!==l?(f=()=>{kr(l),kr(d)},p=[d,l],t[6]=d,t[7]=l,t[8]=f,t[9]=p):(f=t[8],p=t[9]),Z.useEffect(f,p);let m;t[10]!==d.metadata.id||t[11]!==l.metadata.id?(m={light:l.metadata.id,dark:d.metadata.id},t[10]=d.metadata.id,t[11]=l.metadata.id,t[12]=m):m=t[12];let h=m;if(Cc(n)){let e;return t[13]===r?e=t[14]:(e=(0,$.jsx)(Br,{className:`h-full overflow-y-auto px-4 py-4`,children:(0,$.jsx)(Zn,{content:r,enableFileReferences:!1})}),t[13]=r,t[14]=e),e}let g;t[15]===n?g=t[16]:(g=yc(n),t[15]=n,t[16]=g);let _;t[17]===n?_=t[18]:(_=jr(n)||void 0,t[17]=n,t[18]=_);let v;t[19]!==r||t[20]!==g||t[21]!==_?(v={name:g,contents:r,lang:_},t[19]=r,t[20]=g,t[21]=_,t[22]=v):v=t[22];let y=i.metadata.variant===`dark`?`dark`:`light`,b;t[23]!==h||t[24]!==y?(b={disableFileHeader:!0,overflow:`wrap`,theme:h,themeType:y,unsafeCSS:Ji},t[23]=h,t[24]=y,t[25]=b):b=t[25];let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x={minHeight:`100%`},t[26]=x):x=t[26];let S;return t[27]!==b||t[28]!==v?(S=(0,$.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,$.jsx)(Br,{className:`min-h-0 flex-1 overflow-auto bg-[var(--syntax-base-background)]`,children:(0,$.jsx)(de,{file:v,options:b,className:`block min-h-full w-full`,style:x})})}),t[27]=b,t[28]=v,t[29]=S):S=t[29],S},Pc=e=>{let t=(0,Q.c)(7),{message:n,loading:r}=e,i=r!==void 0&&r,a;t[0]===i?a=t[1]:(a=i?(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin text-muted-foreground`}):(0,$.jsx)(X,{name:`folder-open-fill`,className:`size-6 text-muted-foreground`}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:n}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-2`,children:[a,o]})}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s};function Fc(e){return e.pendingFileFocusPath}function Ic(e){return e.setPendingFileFocusPath}function Lc(e,t){return e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1}function Rc(e){return e+1}var zc=S(e=>({expandedParents:{},toggleParent:t=>e(e=>{let n={...e.expandedParents};return n[t]?delete n[t]:n[t]=!0,{expandedParents:n}})})),Bc=S()(C(e=>({projectExpanded:{},worktreeExpanded:{},setProjectExpanded:(t,n)=>e(e=>({projectExpanded:{...e.projectExpanded,[t]:n}})),setWorktreeExpanded:(t,n)=>e(e=>({worktreeExpanded:{...e.worktreeExpanded,[t]:n}}))}),{name:`mobile-session-tree`,storage:N()}));typeof window<`u`&&c(e=>{m(e)&&Bc.persist.rehydrate()});var Vc=36,Hc=18,Uc=e=>e.parentID??null,Wc=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Gc=e=>{let t=e;return Wc(t.directory??t.project?.worktree??null)},Kc=e=>{let t=Wc(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},qc=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},Jc=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),Yc=e=>{if(e<=0)return``;let t=Date.now()-e;if(t<6e4)return`now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<7?`${i}d`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(new Date(e))},Xc=(e,t)=>{let n=Wc(e),r=Wc(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))},Zc=(e,t)=>e.worktrees.find(e=>Wc(e.path)===t)??null,Qc=(e,t)=>t===e.path||!!Zc(e,t),$c=(e,t)=>{let n=Wc(t);return n?e.find(e=>Qc(e,n))??null:null},el=(e,t,n)=>!n||`${e.title??``} ${e.id} ${Gc(e)} ${t}`.toLowerCase().includes(n),tl=e=>{let t=(0,Q.c)(14),{project:n,size:r}=e,i=r===void 0?`md`:r,a=i===`sm`?`size-6 rounded-md`:`size-8 rounded-lg`,o=i===`sm`?`size-3.5`:`size-4`,s=n.icon?Ur[n.icon]:null,c=n.color?Wr[n.color]:void 0,l=s??`folder-open`,u;t[0]===c?u=t[1]:(u=c?{color:c}:void 0,t[0]=c,t[1]=u);let d;t[2]!==o||t[3]!==l||t[4]!==u?(d=(0,$.jsx)(X,{name:l,className:o,style:u}),t[2]=o,t[3]=l,t[4]=u,t[5]=d):d=t[5];let f=d,p;t[6]===a?p=t[7]:(p=J(`flex shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,a),t[6]=a,t[7]=p);let m;t[8]!==f||t[9]!==n?(m=n.iconImage?(0,$.jsx)(Vr,{project:n,className:`size-full object-contain`,fallback:f}):f,t[8]=f,t[9]=n,t[10]=m):m=t[10];let h;return t[11]!==p||t[12]!==m?(h=(0,$.jsx)(`span`,{className:p,children:m}),t[11]=p,t[12]=m,t[13]=h):h=t[13],h},nl=e=>{let t=(0,Q.c)(5),{expanded:n}=e,r=n?`rotate-0`:`-rotate-90`,i;t[0]===r?i=t[1]:(i=J(`flex size-5 shrink-0 items-center justify-center text-muted-foreground/70 transition-transform duration-150`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(X,{name:`arrow-down-s`,className:`size-4`}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:i,children:a}),t[3]=i,t[4]=o),o},rl=e=>{let t=(0,Q.c)(2),{ariaLabel:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-primary`,"aria-label":n}),t[0]=n,t[1]=r),r},il=e=>{let t=(0,Q.c)(12),{onClick:n,className:r}=e,{t:i}=ge(),a;t[0]===i?a=t[1]:(a=i(`sessions.sidebar.project.actions.newWorktree`),t[0]=i,t[1]=a);let o=a,s;t[2]===r?s=t[3]:(s=J(`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,r),t[2]=r,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.stopPropagation(),n()},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={touchAction:`manipulation`},u=(0,$.jsx)(X,{name:`node-tree`,className:`size-4`}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;return t[8]!==o||t[9]!==s||t[10]!==c?(d=(0,$.jsx)(`button`,{type:`button`,className:s,"aria-label":o,title:o,onClick:c,style:l,children:u}),t[8]=o,t[9]=s,t[10]=c,t[11]=d):d=t[11],d},al=e=>{let t=(0,Q.c)(10),{icon:n,label:r,onClick:i,destructive:a}=e,o=a!==void 0&&a?`destructive`:`ghost`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={touchAction:`manipulation`},t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,$.jsx)(X,{name:n,className:`size-5 shrink-0 text-inherit`}),t[1]=n,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,$.jsx)(`span`,{className:`truncate`,children:r}),t[3]=r,t[4]=l);let u;return t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(Y,{type:`button`,variant:o,size:`default`,className:`min-h-12 w-full justify-start gap-3 rounded-xl px-3 typography-ui-label`,onClick:i,style:s,children:[c,l]}),t[5]=i,t[6]=o,t[7]=c,t[8]=l,t[9]=u):u=t[9],u},ol=e=>{let t=(0,Q.c)(107),{session:n,active:r,indent:i,contextLabel:a,confirmingArchive:o,hasChildren:s,expanded:c,onToggleChildren:l,onSelect:u,onRequestArchive:d,onConfirmArchive:f,onStop:p,stopAriaLabel:m,longPressHandlers:h,highlightQuery:g}=e,_=o!==void 0&&o,v=s!==void 0&&s,y=c!==void 0&&c,{t:b}=ge(),x;t[0]===n?x=t[1]:(x=Yc(qc(n)),t[0]=n,t[1]=x);let S=x,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B;if(t[2]!==r||t[3]!==_||t[4]!==y||t[5]!==v||t[6]!==g||t[7]!==i||t[8]!==h.onContextMenu||t[9]!==h.onPointerCancel||t[10]!==h.onPointerDown||t[11]!==h.onPointerMove||t[12]!==h.onPointerUp||t[13]!==h.pressed||t[14]!==u||t[15]!==l||t[16]!==n.title||t[17]!==b){B=n.title?.trim()||b(`mobile.sessions.untitled`);let e=r&&!_&&`bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]`,a=_&&`bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]`;t[36]!==e||t[37]!==a?(N=J(`relative flex items-center gap-1 transition-colors`,e,a),t[36]=e,t[37]=a,t[38]=N):N=t[38],t[39]!==y||t[40]!==v||t[41]!==i||t[42]!==l||t[43]!==b?(P=v&&l?(0,$.jsx)(`button`,{type:`button`,className:`absolute z-10 flex w-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,style:{left:Math.max(i-32,2),top:0,bottom:0,touchAction:`manipulation`},"aria-label":b(y?`sessions.sidebar.session.subsessions.collapse`:`sessions.sidebar.session.subsessions.expand`),onClick:e=>{e.stopPropagation(),l()},children:(0,$.jsx)(X,{name:`arrow-down-s`,className:J(`size-[18px] transition-transform duration-150`,y?`rotate-0`:`-rotate-90`)})}):null,t[39]=y,t[40]=v,t[41]=i,t[42]=l,t[43]=b,t[44]=P):P=t[44],C=`button`;let o=_&&`opacity-50`,s=h.pressed&&`bg-interactive-active scale-[0.99]`;t[45]!==o||t[46]!==s?(w=J(`flex min-h-12 min-w-0 flex-1 items-center gap-2.5 py-2 pr-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,o,s),t[45]=o,t[46]=s,t[47]=w):w=t[47],t[48]===i?T=t[49]:(T={paddingLeft:i,touchAction:`manipulation`},t[48]=i,t[49]=T),E=u,D=h.onPointerDown,O=h.onPointerMove,k=h.onPointerUp,A=h.onPointerCancel,j=h.onContextMenu,M=_,z=`flex min-w-0 flex-1 flex-col`,L=`flex items-center gap-2.5`;let c=r?`bg-primary`:`bg-muted-foreground/30`,d;t[50]===c?d=t[51]:(d=J(`size-1.5 shrink-0 rounded-full`,c),t[50]=c,t[51]=d),t[52]===d?R=t[53]:(R=(0,$.jsx)(`span`,{className:d,"aria-hidden":!0}),t[52]=d,t[53]=R);let f=r?`text-primary`:`text-foreground`;t[54]===f?F=t[55]:(F=J(`block min-w-0 flex-1 truncate typography-ui-label`,f),t[54]=f,t[55]=F),I=g?Rn(B,g):B,t[2]=r,t[3]=_,t[4]=y,t[5]=v,t[6]=g,t[7]=i,t[8]=h.onContextMenu,t[9]=h.onPointerCancel,t[10]=h.onPointerDown,t[11]=h.onPointerMove,t[12]=h.onPointerUp,t[13]=h.pressed,t[14]=u,t[15]=l,t[16]=n.title,t[17]=b,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P,t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z,t[35]=B}else C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26],M=t[27],N=t[28],P=t[29],F=t[30],I=t[31],L=t[32],R=t[33],z=t[34],B=t[35];let V;t[56]!==F||t[57]!==I?(V=(0,$.jsx)(`span`,{className:F,children:I}),t[56]=F,t[57]=I,t[58]=V):V=t[58];let H;t[59]===S?H=t[60]:(H=S?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:S}):null,t[59]=S,t[60]=H);let ee;t[61]!==V||t[62]!==H||t[63]!==L||t[64]!==R?(ee=(0,$.jsxs)(`span`,{className:L,children:[R,V,H]}),t[61]=V,t[62]=H,t[63]=L,t[64]=R,t[65]=ee):ee=t[65];let te;t[66]!==a||t[67]!==g?(te=a?(0,$.jsx)(`span`,{className:`block truncate typography-micro text-muted-foreground pl-4`,children:g?Rn(a,g):a}):null,t[66]=a,t[67]=g,t[68]=te):te=t[68];let ne;t[69]!==ee||t[70]!==te||t[71]!==z?(ne=(0,$.jsxs)(`span`,{className:z,children:[ee,te]}),t[69]=ee,t[70]=te,t[71]=z,t[72]=ne):ne=t[72];let U;t[73]!==C||t[74]!==w||t[75]!==T||t[76]!==E||t[77]!==D||t[78]!==O||t[79]!==k||t[80]!==A||t[81]!==j||t[82]!==M||t[83]!==ne?(U=(0,$.jsx)(`button`,{type:C,className:w,style:T,onClick:E,onPointerDown:D,onPointerMove:O,onPointerUp:k,onPointerCancel:A,onContextMenu:j,disabled:M,children:ne}),t[73]=C,t[74]=w,t[75]=T,t[76]=E,t[77]=D,t[78]=O,t[79]=k,t[80]=A,t[81]=j,t[82]=M,t[83]=ne,t[84]=U):U=t[84];let re;t[85]!==p||t[86]!==m?(re=p?(0,$.jsx)(`button`,{type:`button`,className:`mr-0.5 flex size-9 shrink-0 items-center justify-center rounded-xl text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":m,onClick:e=>{e.stopPropagation(),p()},style:{touchAction:`manipulation`},children:(0,$.jsx)(Ai,{})}):null,t[85]=p,t[86]=m,t[87]=re):re=t[87];let ie;t[88]===b?ie=t[89]:(ie=b(`sessions.sidebar.session.menu.label`),t[88]=b,t[89]=ie);let W;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(X,{name:`more-2`,className:`size-4`}),t[90]=W):W=t[90];let ae;t[91]!==h.onOpenActions||t[92]!==ie?(ae=(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,"data-session-drag-ignore":!0,"aria-label":ie,onClick:h.onOpenActions,children:W}),t[91]=h.onOpenActions,t[92]=ie,t[93]=ae):ae=t[93];let oe;t[94]!==_||t[95]!==f||t[96]!==d||t[97]!==b||t[98]!==B?(oe=d?(0,$.jsxs)($.Fragment,{children:[_?(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 shrink-0 items-center gap-1.5 rounded-xl bg-destructive px-3 text-destructive-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive`,"aria-label":b(`mobile.sessions.archiveSessionAria`,{title:B}),onClick:f,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`archive`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-ui-label`,children:b(`sessions.sidebar.bulkActions.archive`)})]}):null,(0,$.jsx)(`button`,{type:`button`,className:`mr-1.5 flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground/70 transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":b(_?`mobile.sessions.cancelArchiveAria`:`mobile.sessions.archiveSessionAria`,{title:B}),onClick:d,style:{touchAction:`manipulation`},children:_?(0,$.jsx)(X,{name:`close`,className:`size-4`}):(0,$.jsx)(X,{name:`archive`,className:`size-4`})})]}):null,t[94]=_,t[95]=f,t[96]=d,t[97]=b,t[98]=B,t[99]=oe):oe=t[99];let G;return t[100]!==N||t[101]!==P||t[102]!==U||t[103]!==re||t[104]!==ae||t[105]!==oe?(G=(0,$.jsxs)(`div`,{className:N,children:[P,U,re,ae,oe]}),t[100]=N,t[101]=P,t[102]=U,t[103]=re,t[104]=ae,t[105]=oe,t[106]=G):G=t[106],G},sl=e=>{let t=(0,Q.c)(15),{indent:n,showMore:r,showFewer:i,loadingMore:a,onShowMore:o,onShowFewer:s}=e,c=a!==void 0&&a,{t:l}=ge();if(!r&&!i)return null;let u;t[0]===n?u=t[1]:(u={paddingLeft:n,touchAction:`manipulation`},t[0]=n,t[1]=u);let d;t[2]!==s||t[3]!==i||t[4]!==l?(d=i?(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,onClick:s,children:[(0,$.jsx)(X,{name:`arrow-up-s`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-micro`,children:l(`sessions.sidebar.group.showFewer`)})]}):null,t[2]=s,t[3]=i,t[4]=l,t[5]=d):d=t[5];let f;t[6]!==c||t[7]!==o||t[8]!==r||t[9]!==l?(f=r?(0,$.jsxs)(`button`,{type:`button`,className:J(`inline-flex items-center gap-1.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-60`,c&&`animate-pulse`),onClick:o,disabled:c,children:[(0,$.jsx)(X,{name:`arrow-down-s`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-micro`,children:l(`sessions.sidebar.group.showMore`)})]}):null,t[6]=c,t[7]=o,t[8]=r,t[9]=l,t[10]=f):f=t[10];let p;return t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex min-h-10 w-full items-center gap-3 py-1.5 pr-3 text-muted-foreground`,style:u,children:[d,f]}),t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14],p},cl=({open:e,onOpenChange:t,variant:n=`sheet`})=>{let{t:r}=ge(),{git:i}=te(),a=vt(),o=Ue(),s=dt(e=>e.activeSessions),c=dt(e=>e.activePaginationByDirectory),l=Fe(e=>e.projects),u=Fe(e=>e.activeProjectId),d=j(e=>e.currentDirectory),f=ft(e=>e.currentSessionId),p=ft(e=>e.availableWorktreesByProject),m=ft(e=>e.setCurrentSession),h=ft(e=>e.archiveSession),g=ft(e=>e.archiveSessions),_=ft(e=>e.updateSessionTitle),v=ft(e=>e.requestSessionSmartTitle),y=ft(e=>e.shareSession),b=ft(e=>e.unshareSession),x=ft(e=>e.openNewSessionDraft),S=Fe(e=>e.setActiveProject),C=Fe(e=>e.setActiveProjectIdOnly),w=Fe(e=>e.removeProject),T=Ye();ji();let E=gt(e=>e.sessionOrderByScope),D=gt(e=>e.sessionOrderActivityByScope),O=ot(),k=Bc(e=>e.projectExpanded),A=Bc(e=>e.worktreeExpanded),M=Bc(e=>e.setProjectExpanded),N=Bc(e=>e.setWorktreeExpanded),P=Et(e=>e.orderByProject),F=zc(e=>e.expandedParents),I=zc(e=>e.toggleParent),[L,R]=Z.useState(``),[z,B]=Z.useState(null),[V,H]=Z.useState(null),[ee,ne]=Z.useState(0),[U,re]=Z.useState(!1),[ie,W]=Z.useState(!1),[ae,oe]=Z.useState(null),[G,se]=Z.useState(null),ce=G?.kind===`session`?G.session:null,{unread:le,onToggleRead:ue}=hi(ce,ce?Gc(ce):void 0),[de,fe]=Z.useState(null),[K,pe]=Z.useState(null),[me,he]=Z.useState(null),[_e,ve]=Z.useState(``),[ye,be]=Z.useState(!1),[xe,Se]=Z.useState(null),Ce=Z.useRef(null);Ce.current||=_i({onPressedKeyChange:pe});let[we,Te]=Z.useState(new Set),[Ee,De]=Z.useState(new Map),[Oe,ke]=Z.useState(new Map),Ae=ra(),je=Qi(),Me=q(e=>{Ar(e),Ve(e)}),Ne=q(e=>{Promise.all(e.map(e=>(Ar(e),Ve(e))))});Z.useEffect(()=>{if(!e){R(``),ke(new Map),B(null),H(null),se(null),he(null),Se(null),Ce.current?.reset();return}},[e]),Z.useEffect(()=>()=>{Ce.current?.reset()},[]),Z.useEffect(()=>{if(!e)return;if(l.length===0){ft.setState(e=>{let t=Di(e.availableWorktreesByProject,new Set,[]);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:[]}}),Te(e=>e.size===0?e:new Set),De(e=>e.size===0?e:new Map);return}let t=!1;return(async()=>{let e=await Promise.all(l.map(async e=>{let n=Wc(e.path);if(!n)return null;let r;try{r=await i.checkIsGitRepository(n)}catch{return{id:e.id,path:n,gitStatus:`failed`}}if(!r)return{id:e.id,path:n,gitStatus:`success`,isGitRepo:r,worktreeStatus:`success`,worktrees:[]};let[a,o]=await Promise.allSettled([Gr({id:e.id,path:n},{isCurrent:()=>!t}),Hr(n)]);return{id:e.id,path:n,gitStatus:`success`,isGitRepo:r,worktreeStatus:a.status===`fulfilled`?`success`:`failed`,worktrees:a.status===`fulfilled`?a.value.worktrees:void 0,rootBranchStatus:o.status===`fulfilled`?`success`:`failed`,rootBranch:o.status===`fulfilled`?o.value:void 0}}));if(t)return;let n=new Set(l.map(e=>Wc(e.path)).filter(Boolean)),r=e.flatMap(e=>e?.worktreeStatus?[{path:e.path,status:e.worktreeStatus,worktrees:e.worktrees}]:[]);ft.setState(e=>{let t=Di(e.availableWorktreesByProject,n,r);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:Array.from(t.values()).flat()}}),Te(t=>{let r=new Set([...t].filter(e=>n.has(e)));for(let t of e)t?.gitStatus===`success`&&(t.isGitRepo?r.add(t.path):r.delete(t.path));return Jc(r,t)?t:r}),De(t=>{let n=new Set(l.map(e=>e.id)),r=new Map([...t].filter(([e])=>n.has(e)));for(let t of e){if(!t||t.gitStatus!==`success`)continue;if(!t.isGitRepo){r.delete(t.id);continue}if(t.rootBranchStatus!==`success`)continue;let e=t.rootBranch?.trim();e&&e!==`HEAD`?r.set(t.id,e):r.delete(t.id)}return r.size===t.size&&[...r].every(([e,n])=>t.get(e)===n)?t:r})})(),()=>{t=!0}},[i,e,l,ee]);let Pe=Z.useMemo(()=>l.map(e=>({id:e.id,label:Kc(e.path),path:Wc(e.path),icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:we.has(Wc(e.path)),worktrees:Dt(P[e.id],p.get(Wc(e.path))??[])})),[we,l,P,p]),Le=Z.useMemo(()=>{let e=new Map(o.map(e=>[e.id,e])),t=s.map(t=>{let n=e.get(t.id);return n?et(n,t):t}),n=new Set(t.map(e=>e.id));for(let e of o)n.has(e.id)||t.push(e);return t},[s,o]),Re=L.trim().toLowerCase(),ze=Z.useMemo(()=>{let e=Pe.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===u})),t=(e,t,n)=>{let r=Wc(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||Kc(r),path:r,worktree:n,sessions:[]},e.buckets.push(a)),a};for(let n of e){t(n,n.project.path,null);for(let e of n.project.worktrees)t(n,e.path,e)}for(let n of Le){let r=Gc(n);if(!r)continue;let i=Wc(r),a=e.find(e=>Qc(e.project,i));if(!a)continue;let o=Zc(a.project,i);(o?t(a,o.path,o):t(a,a.project.path,null)).sessions.push(n)}for(let t of e)for(let e of t.buckets){let n=Wc(e.path),r=Wi(e.sessions.map(e=>({session:e})),E[n],D[n],T);e.sessions.sort((e,t)=>r({session:e},{session:t}));for(let n of e.sessions)Uc(n)||(t.totalSessions+=1)}return e},[u,Pe,Le,E,D,T]),Be=Wc(d),We=e=>e.isActive?Be===e.project.path?e.project.path:e.project.worktrees.find(e=>Xc(Be,e.path))?.path??e.project.path:null,Ge=e=>k[e.project.id]??!0,Ke=(e,t)=>A[`${e.project.id}::${t.key}`]??!1,Je=e=>{ke(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},Xe=()=>{se(null),Ce.current?.reset()},Ze=e=>({onOpenActions:()=>se(e),pressed:K===e.key||G?.key===e.key,onPointerDown:t=>{e.kind!==`session`&&(t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0||Ce.current?.start({pointerId:t.pointerId,key:e.key,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>se(e)}))},onPointerMove:e=>{Ce.current?.move(e.pointerId,e.clientX,e.clientY)},onPointerUp:e=>{Ce.current?.end(e.pointerId)},onPointerCancel:e=>{Ce.current?.cancel(e.pointerId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.kind!==`session`&&Ce.current?.openFromContextMenu(e.key,()=>se(e))}}),Qe=(e,t)=>{Ce.current?.consumeClick(e)||t()},$e=(e,t,n,r)=>{let i=Oi(),a=mi();if(ke(t=>{let r=new Map(t),o=Math.max(i,t.get(e)??i,n);return r.set(e,o+a),r}),Math.max(i,n)+a<r)return;let o=Wc(t);if(!o)return;let s=dt.getState().activePaginationByDirectory.get(o);s?.hasMore&&!s.loadingMore&&He(o)},tt=(e,t,n)=>{let i=`${e.project.id}::${t.key}`,a=Oi(),o=new Set(t.sessions.map(e=>e.id)),s=new Map;for(let e of t.sessions){let t=Uc(e);if(t&&o.has(t)){let n=s.get(t)??[];n.push(e),s.set(t,n)}}let l=t.sessions.filter(e=>!Uc(e)),u=Oe.get(i)??a,d=aa(l,u,je),p=l.length-d.length,m=c.get(Wc(t.path)),h=m?.hasMore===!0,g=m?.loadingMore===!0,_=l.length>a&&u>a,v=(e,t)=>{let n=s.get(e.id)??[],i=n.length>0,a=!!F[e.id],o=Ae.has(e.id),c=i&&!a?n.filter(e=>Ae.has(e.id)).map(e=>e.id):[],l=c.length>0,u=o?[e.id,...c]:c,d=e.title?.trim()||r(`mobile.sessions.untitled`),p=`session:${e.id}`;return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(ol,{session:e,active:f===e.id,indent:t,hasChildren:i,expanded:a,onToggleChildren:i?()=>I(e.id):void 0,confirmingArchive:V===e.id,onSelect:()=>Qe(p,()=>it(e)),onRequestArchive:()=>st(e.id),onConfirmArchive:()=>void ct(e),onStop:o||l?()=>Ne(u):void 0,stopAriaLabel:r(l?`mobile.sessions.stopSubsessionsAria`:`mobile.sessions.stopSessionAria`,{title:d}),longPressHandlers:Ze({key:p,kind:`session`,session:e})}),i&&a?n.map(e=>v(e,t+Hc)):null]},e.id)};return(0,$.jsxs)(`div`,{children:[l.length===0&&!h&&!g?(0,$.jsx)(`div`,{className:`py-1.5 pr-3 typography-ui-label font-normal text-muted-foreground/80`,style:{paddingLeft:n},children:r(`sessions.sidebar.group.empty.noSessionsInWorkspace`)}):null,(0,$.jsx)(Vi,{scopeKey:V?null:Wc(t.path),sessionIds:d.map(e=>e.id),folderIdBySessionId:new Map(d.map(e=>[e.id,gt.getState().getSessionFolderId(Wc(t.path),e.id)])),onSessionDroppedOnFolder:()=>{},onSessionsReordered:(e,n)=>{gt.getState().reorderSessions(Wc(t.path),d.map(e=>e.id),e,n,Xi(t.sessions)).catch(()=>Ct.error(r(`sessions.order.saveFailed`)))},children:d.map(e=>V?v(e,n):(0,$.jsx)($i,{sessionId:e.id,sessionDirectory:t.path,sessionTitle:e.title??``,children:v(e,n)},e.id))}),(0,$.jsx)(sl,{indent:n,showMore:p>0||h,showFewer:_,loadingMore:g,onShowMore:()=>$e(i,t.path,u,l.length),onShowFewer:()=>Je(i)})]})},nt=(e,t)=>{M(e,!t)},rt=(e,t,n)=>{N(`${e}::${t}`,!n)},it=e=>{$n();let n=Gc(e)||null,r=$c(Pe,n??``);r&&C(r.id),m(e.id,n),t(!1)},st=e=>{H(t=>t===e?null:e)},ct=async e=>{H(null),await h(e.id)?gi({sessionIds:[e.id],message:r(`sessions.sidebar.session.archive.success`),undoLabel:r(`sessions.sidebar.undo`),settingsLabel:r(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:r(`sessions.sidebar.session.archive.undoFailed`)}):Ct.error(r(`sessions.sidebar.session.archive.error`))},lt=()=>{x(),t(!1)},ut=e=>{oe(e),C(e),W(!0)},pt=e=>{let t=new Map;for(let e of Le){let n=Uc(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n},mt=async e=>{let t=pt(e.id),{archivedIds:n,failedIds:i}=await g(t);n.length>0&&gi({sessionIds:n,message:n.length===1?r(`sessions.sidebar.session.archive.success`):r(`sessions.sidebar.bulkActions.archivedPlural`,{count:n.length}),undoLabel:r(`sessions.sidebar.undo`),settingsLabel:r(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:n.length===1?r(`sessions.sidebar.session.archive.undoFailed`):r(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:n.length})}),i.length>0&&Ct.error(i.length===1?r(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):r(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))},ht=e=>{let t=pt(e.id);ea({sessionIds:t,message:t.length===1?r(`sessions.sidebar.session.delete.success`):r(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:r(`sessions.sidebar.undo`),commitFailedMessage:r(`sessions.sidebar.session.delete.error`)})},_t=async e=>{try{if(!(await y(e.id))?.share?.url){Ct.error(r(`sessions.sidebar.session.share.error`));return}Ct.success(r(`sessions.sidebar.session.share.successTitle`),{description:r(`sessions.sidebar.session.share.successDescription`)})}catch{Ct.error(r(`sessions.sidebar.session.share.error`))}},yt=async e=>{if((await at(e)).ok){Ct.success(r(`sessions.sidebar.session.menu.copied`));return}Ct.error(r(`sessions.sidebar.session.share.copyUrlError`))},bt=async e=>{try{if(await b(e)){Ct.success(r(`sessions.sidebar.session.unshare.success`));return}Ct.error(r(`sessions.sidebar.session.unshare.error`))}catch{Ct.error(r(`sessions.sidebar.session.unshare.error`))}},xt=async()=>{if(!me)return;let e=_e.trim();if(e)try{await _(me.id,e),he(null),ve(``)}catch{Ct.error(r(`sessions.sidebar.session.menu.rename`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}},St=async()=>{if(!me||ye)return;let e=me.id;he(null),ve(``),be(!0);try{await v(e)}catch{Ct.error(r(`sessions.sidebar.session.rename.smartTitle`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{be(!1)}},wt=(e,n)=>{C(e.id),x({selectedProjectId:e.id,directoryOverride:n,preserveDirectoryOverride:!0}),t(!1)},Tt=e=>{(async()=>{try{await Gr({id:e.id,path:e.path})}catch(e){console.warn(`[MobileSessions] Worktree refresh before session sync failed:`,e)}let t=ft.getState().availableWorktreesByProject.get(e.path)??e.worktrees,n=[e.path,...t.map(e=>e.path)];await qe(n,Le)})()},Ot=e=>{let t=Gc(e),n=$c(Pe,t);if(!n)return Kc(t)||t;let r=Zc(n,Wc(t));return r?.branch?`${n.label} · ${r.branch}`:n.label},kt=e=>{S(e.id),t(!1)},At=Z.useMemo(()=>Re?ze.filter(e=>`${e.project.label} ${e.project.path}`.toLowerCase().includes(Re)?!0:e.buckets.some(t=>t.sessions.some(t=>el(t,e.project.label,Re)))):ze,[Re,ze]),jt=Z.useMemo(()=>Re?Le.filter(e=>{let t=Gc(e);return el(e,$c(Pe,t)?.label??``,Re)}).sort((e,t)=>Ie(t)-Ie(e)):[],[Re,Pe,Le]),Mt=Z.useMemo(()=>Re?Pe.filter(e=>`${e.label} ${e.path}`.toLowerCase().includes(Re)).map(e=>({...e,sessionCount:Le.filter(t=>!Uc(t)&&Qc(e,Wc(Gc(t)))).length})):[],[Re,Pe,Le]),Nt=Re&&jt.length===0&&Mt.length===0,Pt=Pe.length>0?(0,$.jsxs)(Y,{type:`button`,variant:`default`,size:`sm`,"aria-label":r(`mobile.sessions.newChat`),onClick:lt,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`add`,className:`size-4`}),r(`mobile.sessions.newChat`)]}):null,Ft=Pe.find(e=>e.id===u)??null,It=Ft?.isGitRepo?(0,$.jsx)(Y,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.project.actions.newWorktree`),title:r(`sessions.sidebar.project.actions.newWorktree`),onClick:()=>ut(Ft.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`node-tree`,className:`size-4`})}):null,Lt=(0,$.jsx)(Y,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.header.actions.addProject`),title:r(`sessions.sidebar.header.actions.addProject`),onClick:()=>re(!0),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`folder-add`,className:`size-4`})}),Rt=Pt||Lt?(0,$.jsxs)($.Fragment,{children:[Pt,It,Lt]}):null,zt=G?.kind===`project`?G.project.label:G?.kind===`worktree`?G.worktree.branch||G.worktree.label||G.worktree.path:G?.kind===`session`?G.session.title?.trim()||r(`mobile.sessions.untitled`):``,Bt=Z.useMemo(()=>{if(!G)return[];if(G.kind===`project`){let e=G.project;return vi({gitRepository:e.isGitRepo,onNewSession:()=>{Xe(),wt(e,e.path)},onNewWorktree:()=>{Xe(),ut(e.id)},onSyncSessions:()=>{Xe(),Tt(e)},onEditProject:()=>{Xe(),B(e.id)},onCloseProject:()=>{Xe(),fe(e)}})}if(G.kind===`worktree`){let{project:e,worktree:t}=G;return ha({onNewSession:()=>{Xe(),wt(e,t.path)},onDeleteWorktree:()=>{Xe(),Se({project:e,worktree:t})}})}let e=G.session,t=!!e.share?.url;return Ci({pinned:T.has(e.id),shared:t,unread:le,onToggleRead:ue?()=>{Xe(),ue()}:void 0,onRename:()=>{Xe(),ve(e.title?.trim()||r(`mobile.sessions.untitled`)),he(e)},onTogglePin:()=>{Xe(),O(e.id)},onShare:!a||t?void 0:()=>{Xe(),_t(e)},onCopyLink:a&&t?()=>{let t=e.share?.url;Xe(),t&&yt(t)}:void 0,onUnshare:a&&t?()=>{Xe(),bt(e.id)}:void 0,onArchive:()=>{Xe(),mt(e)},onDelete:()=>{Xe(),ht(e)}})},[G,le,Xe,mt,yt,ht,ut,_t,bt,ue,T,wt,Tt,r,O]),Vt=Bt.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:Bt.map(e=>{let t=(0,$.jsx)(al,{icon:e.icon,label:ai(e,r),destructive:e.destructive,onClick:e.onClick},e.id);return e.separated?(0,$.jsx)(`div`,{className:G?.kind===`project`?`border-t border-[var(--yuri-popup-divider)]`:`mt-3 border-t border-[var(--surface-subtle)] pt-3`,children:t},e.id):t})}):null,Ht=(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(X,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(On,{value:L,onChange:e=>R(e.target.value),placeholder:r(`mobile.sessions.search.placeholder`),className:J(`h-11 pl-9`,L&&`pr-10`)}),L?(0,$.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":r(`mobile.sessions.clearSearchAria`),onClick:()=>R(``),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-4`})}):null]})}),(0,$.jsx)(Br,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto pb-4`,children:Pe.length===0?(0,$.jsx)(ll,{title:r(`mobile.sessions.empty.noProjectsTitle`),description:r(`mobile.sessions.empty.noProjectsDescription`),action:(0,$.jsxs)(Y,{type:`button`,size:`lg`,onClick:()=>re(!0),children:[(0,$.jsx)(X,{name:`folder-add`,className:`size-4`}),r(`sessions.sidebar.header.actions.addProject`)]})}):Nt?(0,$.jsx)(ll,{title:r(`mobile.sessions.empty.searchTitle`),description:r(`mobile.sessions.empty.searchDescription`)}):Re?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 px-3 pt-2`,children:[jt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.sessions`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:jt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:jt.map((e,t)=>{let n=Ae.has(e.id),i=e.title?.trim()||r(`mobile.sessions.untitled`);return(0,$.jsx)(`div`,{className:J(t>0&&`border-t border-border/30`),children:(0,$.jsx)(ol,{session:e,active:f===e.id,indent:12,contextLabel:Ot(e),highlightQuery:Re,onSelect:()=>Qe(`session:${e.id}`,()=>it(e)),longPressHandlers:Ze({key:`session:${e.id}`,kind:`session`,session:e}),onStop:n?()=>Me(e.id):void 0,stopAriaLabel:r(`mobile.sessions.stopSessionAria`,{title:i})})},e.id)})})]}):null,Mt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.projects`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:Mt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Mt.map((e,t)=>{let n=`project:${e.id}`,r=Ze({key:n,kind:`project`,project:e});return(0,$.jsxs)(`div`,{className:J(`flex items-center`,t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-14 min-w-0 flex-1 items-center gap-3 px-3 py-2 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,r.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>Qe(n,()=>kt(e)),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onContextMenu:r.onContextMenu,style:{touchAction:`manipulation`},children:[(0,$.jsx)(tl,{project:e}),(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:Rn(e.label,Re)}),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.sessionCount})]}),e.isGitRepo?(0,$.jsx)(il,{className:`mr-2`,onClick:()=>ut(e.id)}):null]},e.id)})})]}):null]}):(0,$.jsx)(`div`,{className:`flex flex-col`,children:At.map((e,t)=>{let n=Ge(e),i=`project:${e.project.id}`,a=Ze({key:i,kind:`project`,project:e.project}),o=Re?e.buckets.filter(t=>t.sessions.some(t=>el(t,e.project.label,Re))):e.buckets,s=We(e);return(0,$.jsxs)(`section`,{className:J(t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`div`,{className:`flex min-h-14 w-full items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-14 min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,a.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>Qe(i,()=>nt(e.project.id,n)),onPointerDown:a.onPointerDown,onPointerMove:a.onPointerMove,onPointerUp:a.onPointerUp,onPointerCancel:a.onPointerCancel,onContextMenu:a.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:e.project.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(tl,{project:e.project}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label font-semibold text-foreground`,children:e.project.label}),Ee.get(e.project.id)?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 typography-micro text-muted-foreground`,children:[(0,$.jsx)(X,{name:`git-branch`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ee.get(e.project.id)})]}):null]}),e.isActive?(0,$.jsx)(rl,{ariaLabel:r(`mobile.sessions.activeProjectAria`)}):null,(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.totalSessions})]}),(()=>{let t=n?[]:[...new Set(e.buckets.flatMap(e=>e.sessions.filter(e=>Ae.has(e.id)).map(e=>e.id)))];return t.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] mr-1`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:e.project.label}),onClick:e=>{e.stopPropagation(),Ne(t)},style:{touchAction:`manipulation`},children:(0,$.jsx)(Ai,{})}):null})(),e.project.isGitRepo?(0,$.jsx)(il,{className:`mr-2`,onClick:()=>ut(e.project.id)}):null]}),n?(0,$.jsx)(`div`,{className:`pb-2`,children:(()=>{let t=o.find(e=>e.worktree===null),n=o.filter(e=>e.worktree!==null);return(0,$.jsxs)($.Fragment,{children:[t&&(t.sessions.length>0||n.length===0)?tt(e,t,Vc):null,n.map(t=>{let n=Ke(e,t),i=s===t.path,a=`worktree:${e.project.id}:${t.key}`,o=Ze({key:a,kind:`worktree`,project:e.project,worktree:t.worktree});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-11 w-full items-center gap-2 py-1.5 pl-4 pr-3 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,o.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>Qe(a,()=>rt(e.project.id,t.key,n)),onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,onContextMenu:o.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:t.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(nl,{expanded:n}),(0,$.jsx)(X,{name:`node-tree`,className:J(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{className:J(`block min-w-0 flex-1 truncate typography-ui-label font-semibold`,i?`text-foreground`:`text-foreground/90`),children:t.label}),i?(0,$.jsx)(rl,{ariaLabel:r(`mobile.sessions.activeWorktreeAria`)}):null,(()=>{let e=n?[]:t.sessions.filter(e=>Ae.has(e.id)).map(e=>e.id);return e.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:t.label}),onClick:t=>{t.stopPropagation(),Ne(e)},style:{touchAction:`manipulation`},children:(0,$.jsx)(Ai,{})}):null})(),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:t.sessions.length})]}),n?tt(e,t,Vc):null]},t.key)})]})})()}):null]},e.project.id)})})}),(0,$.jsx)(ui,{open:U,onOpenChange:re,forceMobile:!0}),(0,$.jsx)(Cn,{open:ie,projectId:ae,onOpenChange:e=>{W(e),e||oe(null)},onWorktreeCreated:(e,n)=>{n?.sessionId?m(n.sessionId,e):x({selectedProjectId:ae,directoryOverride:e,preserveDirectoryOverride:!0}),t(!1)}}),(0,$.jsx)(zn,{open:!!G,title:zt,onClose:Xe,contentMaxHeightClassName:`max-h-[min(68dvh,560px)]`,children:Vt}),(0,$.jsx)(zn,{open:!!de,title:r(`sessions.sidebar.project.actions.closeProject`),onClose:()=>fe(null),closeAriaLabel:r(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>fe(null),children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!de)return;let e=de;fe(null),w(e.id),Ct.success(r(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:r(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:r(`mobile.projects.closeConfirmMessage`,{title:de?.label??``})})}),(0,$.jsx)(zn,{open:!!me,title:r(`sessions.sidebar.session.menu.rename`),onClose:()=>{ye||(he(null),ve(``))},footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:ye,onClick:()=>{he(null),ve(``)},children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:!_e.trim()||ye,onClick:()=>void xt(),children:r(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),xt()},children:[(0,$.jsx)(On,{value:_e,onChange:e=>ve(e.target.value),autoFocus:!0,className:`h-12`,disabled:ye}),(0,$.jsxs)(Y,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:ye,onClick:()=>void St(),children:[ye?(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(X,{name:`ai-generate-2`,className:`size-4`}),r(`sessions.sidebar.session.rename.smartTitle`)]})]})}),xe?(0,$.jsx)(pi,{open:!0,project:{id:xe.project.id,path:xe.project.path},worktree:xe.worktree,onClose:()=>Se(null),onDeleted:()=>ne(e=>e+1)}):null,(0,$.jsx)(ki,{open:z!==null,project:Pe.find(e=>e.id===z)??null,onClose:()=>B(null),onWorktreesChanged:()=>ne(e=>e+1)})]});return n===`sidebar`?e?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsx)(`div`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center justify-end gap-2 px-4`,children:Rt?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:Rt}):null}),Ht]}):null:(0,$.jsx)(lr,{id:`mobile-sessions-sheet`,open:e,onOpenChange:t,trailing:Rt,ariaLabel:r(`mobile.sessions.sheet.title`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:Ht})},ll=e=>{let t=(0,Q.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`p`,{className:`typography-ui-label text-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,$.jsx)(`div`,{className:`pt-2`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-6 text-center`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c},ul=`/assets/assistant-guide-hero-wide-DiFIThB0.jpg`;function dl(e){let t=(0,Q.c)(19),{swipe:n,actions:r}=e,{offset:i,dragging:a,actionRailRef:o,closeActions:s}=n,c=i!==0,l=a?`transition-none`:`transition-transform duration-150 ease-out`,u=!c&&`invisible pointer-events-none`,d;t[0]!==l||t[1]!==u?(d=J(`yuri-mobile-session-actions absolute inset-y-0 right-0 z-0 flex items-stretch`,l,u),t[0]=l,t[1]=u,t[2]=d):d=t[2];let f=`translate3d(calc(var(--yuri-mobile-session-actions-width) + ${i}px), 0, 0)`,p=c?`transform`:void 0,m;t[3]!==f||t[4]!==p?(m={transform:f,willChange:p},t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=!c,g;if(t[6]!==r||t[7]!==s||t[8]!==c){let e;t[10]!==s||t[11]!==c?(e=e=>(0,$.jsxs)(Y,{type:`button`,variant:e.destructive?`destructive`:`secondary`,className:J(`yuri-mobile-session-action h-full flex-col rounded-none border-0 px-1`,!e.destructive&&`bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-active`),"aria-label":e.label,tabIndex:c?0:-1,onClick:()=>{s(),e.onClick()},children:[(0,$.jsx)(X,{name:e.icon,className:`size-[18px]`}),(0,$.jsx)(`span`,{className:`yuri-mobile-session-action-label font-medium`,children:e.label})]},e.label),t[10]=s,t[11]=c,t[12]=e):e=t[12],g=r.map(e),t[6]=r,t[7]=s,t[8]=c,t[9]=g}else g=t[9];let _;return t[13]!==o||t[14]!==d||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,$.jsx)(`div`,{ref:o,"data-session-drag-ignore":!0,className:d,style:m,"aria-hidden":h,children:g}),t[13]=o,t[14]=d,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18],_}var fl=10,pl=`yuri:mobile-session-row-revealed`,ml=e=>{window.dispatchEvent(new CustomEvent(pl,{detail:e}))};function hl(e,t,n){let r=(0,Q.c)(32),i=n!==void 0&&n,[a,o]=Z.useState(0),[s,c]=Z.useState(!1),l=Z.useRef(null),u=Z.useRef(!1),d=Z.useRef(null),f,p;r[0]===i?(f=r[1],p=r[2]):(f=()=>{i&&(l.current=null,u.current=!0,o(0),c(!1))},p=[i],r[0]=i,r[1]=f,r[2]=p),Z.useEffect(f,p);let m;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o(0)},r[3]=m):m=r[3];let h;r[4]===e?h=r[5]:(h=[e],r[4]=e,r[5]=h),Z.useEffect(m,h);let g;r[6]===e?g=r[7]:(g=t=>{t.detail!==e&&o(0)},r[6]=e,r[7]=g),K(pl,g);let _;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>o(0),r[8]=_):_=r[8];let v=q(_),y;r[9]!==i||r[10]!==a?(y=e=>{if(i||e.button!==0||e.pointerType!==`touch`&&e.pointerType!==`pen`)return;let t=d.current?.offsetWidth??0;t<=0||(l.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startOffset:a,actionWidth:t,intent:`pending`},u.current=!1)},r[9]=i,r[10]=a,r[11]=y):y=r[11];let b=q(y),x;r[12]!==i||r[13]!==e?(x=t=>{if(i)return;let n=l.current;if(!n||n.pointerId!==t.pointerId)return;let r=t.clientX-n.startX,a=t.clientY-n.startY;if(n.intent===`pending`){let i=Math.abs(r),o=Math.abs(a);if(o>fl&&o>i){n.intent=`vertical`,l.current=null;return}if(i>fl&&i>o){n.intent=`horizontal`,c(!0),u.current=!0;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}ml(e)}}n.intent===`horizontal`&&(t.preventDefault(),o(Math.max(-n.actionWidth,Math.min(0,n.startOffset+r))))},r[12]=i,r[13]=e,r[14]=x):x=r[14];let S=q(x),C;r[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{let t=l.current;!t||t.pointerId!==e.pointerId||(l.current=null,t.intent===`horizontal`&&(c(!1),o(e=>e<-(t.actionWidth*.35)?-t.actionWidth:0)))},r[15]=C):C=r[15];let w=q(C),T;r[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{let e=l.current;l.current=null,c(!1),o(e?.startOffset??0)},r[16]=T):T=r[16];let E=q(T),D;r[17]!==v||r[18]!==e||r[19]!==a||r[20]!==t?(D=()=>{if(u.current){u.current=!1;return}if(a!==0){v();return}ml(e),t()},r[17]=v,r[18]=e,r[19]=a,r[20]=t,r[21]=D):D=r[21];let O=q(D),k=q(gl),A;return r[22]!==v||r[23]!==s||r[24]!==w||r[25]!==k||r[26]!==E||r[27]!==b||r[28]!==S||r[29]!==O||r[30]!==a?(A={offset:a,dragging:s,actionRailRef:d,closeActions:v,handleSelect:O,handlePointerDown:b,handlePointerMove:S,finishGesture:w,handlePointerCancel:E,handleContextMenu:k},r[22]=v,r[23]=s,r[24]=w,r[25]=k,r[26]=E,r[27]=b,r[28]=S,r[29]=O,r[30]=a,r[31]=A):A=r[31],A}function gl(e){e.preventDefault(),e.stopPropagation()}var _l=[{image:hs,titleKey:`assistants.guide.share.ios.title`,descriptionKey:`assistants.guide.share.ios.description`},{image:ms,titleKey:`assistants.guide.share.android.title`,descriptionKey:`assistants.guide.share.android.description`},{image:gs,titleKey:`assistants.guide.share.pick.title`,descriptionKey:`assistants.guide.share.pick.description`}];function vl(){let e=(0,Q.c)(8),{t}=ge(),n;e[0]===t?n=e[1]:(n=t(`common.loading`),e[0]=t,e[1]=n);let r,i,a,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`h-10 w-10 animate-pulse rounded-xl bg-[var(--surface-muted)] motion-reduce:animate-none`}),i=(0,$.jsx)(`div`,{className:`mt-2 h-4 w-2/3 animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),a=(0,$.jsx)(`div`,{className:`h-3.5 w-full animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),o=(0,$.jsx)(`div`,{className:`h-3.5 w-4/5 animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),e[2]=r,e[3]=i,e[4]=a,e[5]=o):(r=e[2],i=e[3],a=e[4],o=e[5]);let s;return e[6]===n?s=e[7]:(s=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-5`,"aria-busy":`true`,"aria-label":n,children:[r,i,a,o]}),e[6]=n,e[7]=s),s}function yl(e){let t=(0,Q.c)(35),{onEnable:n}=e,{t:r}=ge(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-hero`,"aria-hidden":`true`,children:(0,$.jsx)(`img`,{src:ul,alt:``})}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=r(`assistants.guide.disabledTitle`),t[1]=r,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,$.jsx)(`h2`,{className:`yuri-mobile-assistant-guide-title`,children:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=r(`assistants.guide.disabledDescription`),t[5]=r,t[6]=s);let c;t[7]===s?c=t[8]:(c=(0,$.jsx)(`p`,{className:`yuri-mobile-assistant-guide-description`,children:s}),t[7]=s,t[8]=c);let l;t[9]===r?l=t[10]:(l=r(`assistants.guide.enableAction`),t[9]=r,t[10]=l);let u;t[11]!==n||t[12]!==l?(u=(0,$.jsx)(Y,{type:`button`,size:`lg`,onClick:n,children:l}),t[11]=n,t[12]=l,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==u?(d=(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-guide-body`,children:[o,c,u]}),t[14]=o,t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;t[18]===r?f=t[19]:(f=r(`assistants.guide.shareTitle`),t[18]=r,t[19]=f);let p;t[20]===f?p=t[21]:(p=(0,$.jsx)(`h3`,{className:`yuri-mobile-assistant-guide-share-title`,children:f}),t[20]=f,t[21]=p);let m;t[22]===r?m=t[23]:(m=r(`assistants.guide.shareAria`),t[22]=r,t[23]=m);let h;t[24]===r?h=t[25]:(h=_l.map(e=>(0,$.jsxs)(`article`,{className:`yuri-mobile-assistant-guide-step`,children:[(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-step-image`,children:(0,$.jsx)(`img`,{src:e.image,alt:``})}),(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-guide-step-copy`,children:[(0,$.jsx)(`h4`,{children:r(e.titleKey)}),(0,$.jsx)(`p`,{children:r(e.descriptionKey)})]})]},e.titleKey)),t[24]=r,t[25]=h);let g;t[26]!==m||t[27]!==h?(g=(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-steps`,"aria-label":m,children:h}),t[26]=m,t[27]=h,t[28]=g):g=t[28];let _;t[29]!==p||t[30]!==g?(_=(0,$.jsxs)(`section`,{className:`yuri-mobile-assistant-guide-share`,children:[p,g]}),t[29]=p,t[30]=g,t[31]=_):_=t[31];let v;return t[32]!==_||t[33]!==d?(v=(0,$.jsxs)(`article`,{className:`yuri-mobile-assistant-guide`,children:[i,d,_]}),t[32]=_,t[33]=d,t[34]=v):v=t[34],v}function bl(e){let t=(0,Q.c)(51),{assistant:n,avatarSeed:r,unreadCount:i,assistantID:a,displayName:o,summary:s,editLabel:c,deleteLabel:l,onOpen:u,onEdit:d,onDelete:f,serverWorking:p}=e,m=ni(a,p!==void 0&&p),h=hl(`assistant:${a}`,u),g=Z.useRef(null),_;t[0]!==c||t[1]!==d?(_={label:c,icon:`edit`,onClick:d},t[0]=c,t[1]=d,t[2]=_):_=t[2];let v;t[3]!==l||t[4]!==f?(v={label:l,icon:`delete-bin`,destructive:!0,onClick:f},t[3]=l,t[4]=f,t[5]=v):v=t[5];let y;t[6]!==_||t[7]!==v?(y=[_,v],t[6]=_,t[7]=v,t[8]=y):y=t[8];let b;t[9]!==h||t[10]!==y?(b=(0,$.jsx)(dl,{swipe:h,actions:y}),t[9]=h,t[10]=y,t[11]=b):b=t[11];let x=h.dragging?`transition-none`:`transition-transform duration-150 ease-out`,S;t[12]===x?S=t[13]:(S=J(`yuri-mobile-assistant-card relative z-10 motion-reduce:transition-none`,x),t[12]=x,t[13]=S);let C=h.handleSelect,w=h.handlePointerDown,T=h.handlePointerMove,E=h.finishGesture,D=h.handlePointerCancel,O=`translate3d(${h.offset}px, 0, 0)`,k=h.offset===0?void 0:`transform`,A;t[14]!==O||t[15]!==k?(A={touchAction:`pan-y`,transform:O,willChange:k},t[14]=O,t[15]=k,t[16]=A):A=t[16];let j;t[17]!==a||t[18]!==r||t[19]!==o||t[20]!==m?(j=(0,$.jsx)(`span`,{className:`yuri-mobile-assistant-avatar`,children:(0,$.jsx)(ri,{name:a,avatarSeed:r,size:44,label:o,working:m,hoverTarget:g})}),t[17]=a,t[18]=r,t[19]=o,t[20]=m,t[21]=j):j=t[21];let M;t[22]===o?M=t[23]:(M=(0,$.jsx)(`span`,{className:`yuri-mobile-entity-title yuri-mobile-assistant-name block min-w-0 truncate font-semibold text-foreground`,children:o}),t[22]=o,t[23]=M);let N;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=J(`yuri-mobile-assistant-summary`,Ba),t[24]=N):N=t[24];let P;t[25]===s?P=t[26]:(P=(0,$.jsx)(`span`,{className:N,children:s}),t[25]=s,t[26]=P);let F;t[27]!==M||t[28]!==P?(F=(0,$.jsxs)(`span`,{className:`yuri-mobile-assistant-card-content min-w-0 flex-1`,children:[M,P]}),t[27]=M,t[28]=P,t[29]=F):F=t[29];let I;t[30]===i?I=t[31]:(I=(0,$.jsx)(Na,{count:i}),t[30]=i,t[31]=I);let L;t[32]!==h.finishGesture||t[33]!==h.handlePointerCancel||t[34]!==h.handlePointerDown||t[35]!==h.handlePointerMove||t[36]!==h.handleSelect||t[37]!==A||t[38]!==j||t[39]!==F||t[40]!==I||t[41]!==S?(L=(0,$.jsxs)(`button`,{ref:g,type:`button`,role:`option`,"aria-selected":`false`,"data-mobile-press-feedback":`soft`,className:S,onClick:C,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:D,style:A,children:[j,F,I]}),t[32]=h.finishGesture,t[33]=h.handlePointerCancel,t[34]=h.handlePointerDown,t[35]=h.handlePointerMove,t[36]=h.handleSelect,t[37]=A,t[38]=j,t[39]=F,t[40]=I,t[41]=S,t[42]=L):L=t[42];let R;t[43]!==n||t[44]!==f||t[45]!==d||t[46]!==L?(R=(0,$.jsx)(La,{assistant:n,onEdit:d,onDelete:f,trigger:L}),t[43]=n,t[44]=f,t[45]=d,t[46]=L,t[47]=R):R=t[47];let z;return t[48]!==R||t[49]!==b?(z=(0,$.jsxs)(Sa,{className:`yuri-mobile-assistant-card-shell relative isolate overflow-clip`,children:[b,R]}),t[48]=R,t[49]=b,t[50]=z):z=t[50],z}function xl(e){let t=(0,Q.c)(126),{onEnable:n,onOpenAssistant:r,className:i}=e,{t:a}=ge(),o=dr(),s=ke(),c=je();c.data?.assistants;let l;t[0]===c.data?.assistants?l=t[1]:(l=c.data?.assistants??[],t[0]=c.data?.assistants,t[1]=l);let u;t[2]===l?u=t[3]:(u=Pa(l),t[2]=l,t[3]=u);let d=u,f=kt(Sl),[p,m]=Z.useState(null),h;t[4]===n?h=t[5]:(h=()=>n(),t[4]=n,t[5]=h);let g=q(h),_;t[6]!==o||t[7]!==f?(_=()=>{f(),o?.openSettings(`assistants`)},t[6]=o,t[7]=f,t[8]=_):_=t[8];let v=q(_),y;t[9]===r?y=t[10]:(y=e=>r(e),t[9]=r,t[10]=y);let b=q(y),x;t[11]===o?x=t[12]:(x=e=>{jt(e,o?{openMobileSettings:o.openSettings}:void 0)},t[11]=o,t[12]=x);let S=q(x),C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{m(e)},t[13]=C):C=t[13];let w=q(C),T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||m(null)},t[14]=T):T=t[14];let E=q(T),D;t[15]===a?D=t[16]:(D=a(`assistants.title`),t[15]=a,t[16]=D);let O=D,k;t[17]===a?k=t[18]:(k=a(`assistants.menu.edit`),t[17]=a,t[18]=k);let A=k,j;t[19]===a?j=t[20]:(j=a(`assistants.settings.delete`),t[19]=a,t[20]=j);let M=j;if(s.isPending||s.data?.supported&&s.data.enabled&&c.isPending){let e;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Sa,{className:`yuri-mobile-assistant-loading`,children:(0,$.jsx)(vl,{})}),t[21]=e):e=t[21];let n;return t[22]!==i||t[23]!==O?(n=(0,$.jsx)(wa,{title:O,className:i,surface:!1,children:e}),t[22]=i,t[23]=O,t[24]=n):n=t[24],n}if(s.data?.supported&&s.data.enabled&&c.data?.enabled&&c.data.assistants.length>0){let e;t[25]===c.data?e=t[26]:(e=(0,$.jsx)(za,{snapshot:c.data,compact:!0,mobile:!0}),t[25]=c.data,t[26]=e);let n;t[27]===a?n=t[28]:(n=a(`assistants.settings.create`),t[27]=a,t[28]=n);let r;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(X,{name:`add`,className:`size-5`}),t[29]=r):r=t[29];let o;t[30]!==v||t[31]!==n?(o=(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`yuri-mobile-inverse-action`,"aria-label":n,onClick:v,children:r}),t[30]=v,t[31]=n,t[32]=o):o=t[32];let s;t[33]!==e||t[34]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,o]}),t[33]=e,t[34]=o,t[35]=s):s=t[35];let l;t[36]===a?l=t[37]:(l=a(`assistants.listAria`),t[36]=a,t[37]=l);let u;t[38]!==d.pinned||t[39]!==S||t[40]!==b||t[41]!==w?(u=(0,$.jsx)(Va,{contacts:d.pinned,onSelect:b,onEdit:S,onDelete:w}),t[38]=d.pinned,t[39]=S,t[40]=b,t[41]=w,t[42]=u):u=t[42];let f;if(t[43]!==d.unpinned||t[44]!==M||t[45]!==A||t[46]!==S||t[47]!==b||t[48]!==w||t[49]!==a){let e;t[51]!==M||t[52]!==A||t[53]!==S||t[54]!==b||t[55]!==w||t[56]!==a?(e=e=>{let t=Mt(e.name).displayName||e.name,n=Ra(e.latestMessagePreview,a);return(0,$.jsx)(bl,{assistant:e,assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,displayName:t,summary:n,editLabel:A,deleteLabel:M,assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onOpen:()=>b(e.id),onEdit:()=>S(e.id),onDelete:()=>w(e)},e.id)},t[51]=M,t[52]=A,t[53]=S,t[54]=b,t[55]=w,t[56]=a,t[57]=e):e=t[57],f=d.unpinned.map(e),t[43]=d.unpinned,t[44]=M,t[45]=A,t[46]=S,t[47]=b,t[48]=w,t[49]=a,t[50]=f}else f=t[50];let m;t[58]!==l||t[59]!==u||t[60]!==f?(m=(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-catalog`,role:`listbox`,"aria-label":l,children:[u,f]}),t[58]=l,t[59]=u,t[60]=f,t[61]=m):m=t[61];let h=p!==null,g;t[62]!==p||t[63]!==E||t[64]!==h?(g=(0,$.jsx)(Ia,{assistant:p,open:h,onOpenChange:E}),t[62]=p,t[63]=E,t[64]=h,t[65]=g):g=t[65];let _;return t[66]!==i||t[67]!==O||t[68]!==s||t[69]!==m||t[70]!==g?(_=(0,$.jsxs)(wa,{title:O,className:i,surface:!1,scrollsWithPage:!0,trailing:s,children:[m,g]}),t[66]=i,t[67]=O,t[68]=s,t[69]=m,t[70]=g,t[71]=_):_=t[71],_}if(s.data?.supported&&s.data.enabled&&c.data?.enabled&&c.data.assistants.length===0){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`yuri-mobile-assistant-onboarding-icon`,children:(0,$.jsx)(X,{name:`ai-agent`,className:`size-5`})}),t[72]=e):e=t[72];let n;t[73]===a?n=t[74]:(n=a(`assistants.onboarding.title`),t[73]=a,t[74]=n);let r;t[75]===n?r=t[76]:(r=(0,$.jsx)(`h2`,{children:n}),t[75]=n,t[76]=r);let o;t[77]===a?o=t[78]:(o=a(`assistants.onboarding.description`),t[77]=a,t[78]=o);let s;t[79]===o?s=t[80]:(s=(0,$.jsx)(`p`,{children:o}),t[79]=o,t[80]=s);let c;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(X,{name:`add`,className:`size-[18px]`}),t[81]=c):c=t[81];let l;t[82]===a?l=t[83]:(l=a(`assistants.onboarding.action`),t[82]=a,t[83]=l);let u;t[84]!==v||t[85]!==l?(u=(0,$.jsxs)(Y,{type:`button`,size:`lg`,className:`mt-6 w-full`,onClick:v,children:[c,l]}),t[84]=v,t[85]=l,t[86]=u):u=t[86];let d;t[87]!==r||t[88]!==s||t[89]!==u?(d=(0,$.jsxs)(Sa,{className:`yuri-mobile-assistant-onboarding`,children:[e,r,s,u]}),t[87]=r,t[88]=s,t[89]=u,t[90]=d):d=t[90];let f;return t[91]!==i||t[92]!==O||t[93]!==d?(f=(0,$.jsx)(wa,{title:O,className:i,surface:!1,surfaceClassName:`yuri-mobile-assistant-state`,children:d}),t[91]=i,t[92]=O,t[93]=d,t[94]=f):f=t[94],f}let N=s.isSuccess&&s.data.supported===!1,P=s.isError||s.data?.supported===!0&&s.data.enabled&&c.isError,F=s.data?.supported===!0&&(s.data.enabled===!1||c.data?.enabled===!1),I;t[95]!==a||t[96]!==P||t[97]!==N?(I=a(P?`assistants.state.unavailable`:N?`assistants.state.unsupportedTitle`:`assistants.state.instanceDisabled`),t[95]=a,t[96]=P,t[97]=N,t[98]=I):I=t[98];let L=I;if(F&&!P){let e;t[99]===g?e=t[100]:(e=(0,$.jsx)(yl,{onEnable:g}),t[99]=g,t[100]=e);let n;return t[101]!==i||t[102]!==O||t[103]!==e?(n=(0,$.jsx)(wa,{title:O,className:i,surface:!1,surfaceClassName:`yuri-mobile-assistant-guide-host`,children:e}),t[101]=i,t[102]=O,t[103]=e,t[104]=n):n=t[104],n}let R;t[105]===O?R=t[106]:(R=(0,$.jsx)(`span`,{className:`yuri-mobile-page-section-label`,children:O}),t[105]=O,t[106]=R);let z=N?`cloud-off`:`sparkling`,B;t[107]===z?B=t[108]:(B=(0,$.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-interactive-selection text-interactive-selection-foreground`,children:(0,$.jsx)(X,{name:z,weight:`medium`,className:`size-5`})}),t[107]=z,t[108]=B);let V;t[109]===L?V=t[110]:(V=(0,$.jsx)(`h2`,{className:`mt-5 max-w-xs text-lg font-semibold leading-snug tracking-[-0.02em] text-foreground`,children:L}),t[109]=L,t[110]=V);let H;t[111]!==a||t[112]!==P||t[113]!==N?(H=P?null:(0,$.jsx)(`p`,{className:`mt-2 max-w-sm typography-small leading-relaxed text-muted-foreground`,children:a(N?`assistants.state.unsupportedDescription`:`assistants.state.instanceDisabledDescription`)}),t[111]=a,t[112]=P,t[113]=N,t[114]=H):H=t[114];let ee;t[115]!==B||t[116]!==V||t[117]!==H?(ee=(0,$.jsxs)(`section`,{className:`w-full max-w-md py-2`,children:[B,V,H]}),t[115]=B,t[116]=V,t[117]=H,t[118]=ee):ee=t[118];let te;t[119]!==R||t[120]!==ee?(te=(0,$.jsx)(ba,{label:R,cardClassName:`yuri-mobile-assistant-state-card`,children:ee}),t[119]=R,t[120]=ee,t[121]=te):te=t[121];let ne;return t[122]!==i||t[123]!==O||t[124]!==te?(ne=(0,$.jsx)(wa,{title:O,className:i,surface:!1,surfaceClassName:`yuri-mobile-assistant-state`,children:te}),t[122]=i,t[123]=O,t[124]=te,t[125]=ne):ne=t[125],ne}function Sl(e){return e.requestCreate}function Cl(e){let t=(0,Q.c)(16),{assistantID:n,onBack:r}=e,{t:i}=ge(),[a,o]=(0,Z.useState)(null),s;t[0]===i?s=t[1]:(s=i(`assistants.title`),t[0]=i,t[1]=s);let c;t[2]===i?c=t[3]:(c=i(`settings.view.actions.back`),t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`div`,{ref:o}),t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==s||t[7]!==c?(u=(0,$.jsx)(Ae,{title:s,backAriaLabel:c,onBack:r,trailing:l}),t[5]=r,t[6]=s,t[7]=c,t[8]=u):u=t[8];let d;t[9]!==n||t[10]!==r||t[11]!==a?(d=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden px-[var(--yuri-mobile-page-inline-inset)] pb-[var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px))]`,children:(0,$.jsx)(Sa,{className:`yuri-mobile-settings-detail-card h-full`,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Ea,{assistantID:n,onItemDeleted:r,onSaved:r,saveActionContainer:a},n)})})}),t[9]=n,t[10]=r,t[11]=a,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,$.jsxs)(`div`,{"data-settings-view":`true`,"data-mobile-settings-stage":`page-content`,className:`yuri-settings-workspace yuri-settings-workspace-mobile flex h-full min-h-0 flex-col overflow-hidden bg-background`,children:[u,d]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function wl(e){let t=(0,Q.c)(13),{route:n}=e,{t:r}=ge(),i;t[0]===r?i=t[1]:(i=r(`chat.btw.title`),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r(`header.actions.backAria`),t[2]=r,t[3]=a);let o;t[4]!==i||t[5]!==a?(o=(0,$.jsx)(Ae,{title:i,backAriaLabel:a,onBack:Tl}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]!==n.directory||t[8]!==n.sessionId?(s=(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(un,{scope:{sessionId:n.sessionId,directory:n.directory},foot:`page`})}),t[7]=n.directory,t[8]=n.sessionId,t[9]=s):s=t[9];let c;return t[10]!==o||t[11]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Tl(){ja.requestAnimatedBack(`root`)}var El=[{id:`projects`,icon:`folder-open`,labelKey:`mobile.tabs.projects`},{id:`assistant`,icon:`sparkling`,labelKey:`mobile.tabs.assistant`},{id:`scheduled`,icon:`calendar-schedule`,labelKey:`mobile.tabs.scheduled`},{id:`settings`,icon:`settings-3`,labelKey:`mobile.tabs.settings`}];function Dl(e){let t=(0,Q.c)(22),{activeTab:n,onTabChange:r,className:i,tabMarks:a}=e,{t:o}=ge(),s=Me(),c;t[0]===o?c=t[1]:(c=o(`mobile.tabs.activity.loading`),t[0]=o,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=e=>{r(e.currentTarget.dataset.tab)},t[2]=r,t[3]=u);let d=q(u),f;t[4]!==n||t[5]!==r?(f=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=El.findIndex(e=>e.id===n),i=El[e.key===`Home`?0:e.key===`End`?El.length-1:(t+(e.key===`ArrowRight`?1:-1)+El.length)%El.length];r(i.id),document.getElementById(`mobile-tab-${i.id}`)?.focus()},t[4]=n,t[5]=r,t[6]=f):f=t[6];let p=q(f),m;t[7]===o?m=t[8]:(m=o(`mobile.nav.aria`),t[7]=o,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h={role:`tablist`},t[9]=h):h=t[9];let g;t[10]!==n||t[11]!==s||t[12]!==d||t[13]!==p||t[14]!==l||t[15]!==o||t[16]!==a?(g=El.map(e=>{let t=e.id===n,r=o(e.labelKey),i=e.id===`assistant`&&s>0,c=!i&&a?.[e.id]===`loading`,u=i?`mobile-tab-assistant-unread`:c?`mobile-tab-${e.id}-activity`:void 0;return(0,$.jsxs)(Y,{id:`mobile-tab-${e.id}`,"data-tab":e.id,type:`button`,role:`tab`,variant:`ghost`,size:`sm`,"aria-controls":`mobile-tabpanel-${e.id}`,"aria-label":r,"aria-describedby":u,"aria-selected":t,tabIndex:t?0:-1,title:r,onClick:d,onKeyDown:p,className:J(`yuri-mobile-tab-button min-w-0 flex-1 flex-col overflow-visible`,`font-medium leading-none tracking-tight text-muted-foreground`,`transition-[background-color,color,box-shadow,transform] duration-100`,`hover:bg-transparent hover:text-foreground`,`active:bg-interactive-active`,`motion-reduce:transition-none`,t&&[`bg-interactive-selection/55 text-primary`,`hover:bg-interactive-selection/55 hover:text-primary`,`font-semibold`]),children:[(0,$.jsxs)(`span`,{className:`relative inline-flex size-[23px] shrink-0 items-center justify-center overflow-visible`,children:[e.id===`assistant`?(0,$.jsx)(Ri,{size:23,className:`size-[23px] shrink-0 items-center justify-center [&[data-assistant-navigation-avatar]]:scale-105`}):(0,$.jsx)(X,{name:e.icon,weight:`medium`,className:`size-[23px] shrink-0`}),u?(0,$.jsx)(`span`,{id:u,role:c?`status`:void 0,"aria-label":c?l:void 0,"data-mobile-tab-activity":c?`loading`:void 0,className:`pointer-events-none absolute left-full -top-1 ml-0.5 inline-flex z-10`,children:i?(0,$.jsx)(Fa,{className:`h-[18px] min-w-[18px] px-1 text-[11px] font-bold tracking-normal ring-2 ring-background`}):(0,$.jsx)(`span`,{className:`inline-flex size-[18px] items-center justify-center rounded-full bg-foreground text-background ring-2 ring-background`,children:(0,$.jsx)(X,{name:`loader-4`,className:`size-3 animate-spin`})})}):null]}),(0,$.jsx)(`span`,{className:`yuri-mobile-tab-label block max-w-full overflow-hidden text-ellipsis whitespace-nowrap`,children:r})]},e.id)}),t[10]=n,t[11]=s,t[12]=d,t[13]=p,t[14]=l,t[15]=o,t[16]=a,t[17]=g):g=t[17];let _;return t[18]!==i||t[19]!==m||t[20]!==g?(_=(0,$.jsx)(Ta,{as:`nav`,"aria-label":m,variant:`navigation`,surfaceProps:h,className:i,children:g}),t[18]=i,t[19]=m,t[20]=g,t[21]=_):_=t[21],_}function Ol(e){return e.unreadCount>0?`unread`:e.working?`loading`:null}var kl=`yuri-native-ios-tab-bar`,Al=`YuriTabBar`,jl=[`projects`,`assistant`,`scheduled`,`settings`],Ml=ie(Al),Nl=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.nativeUiEnabled!==!1;function Pl(){return typeof window>`u`?!1:Nl({isCapacitor:_(),platform:y(),pluginAvailable:W.isPluginAvailable(Al),nativeUiEnabled:Er()})}var Fl=e=>e.classList.contains(`dark`)?`dark`:`light`,Il=()=>Sr(`--primary`),Ll=e=>typeof e==`string`&&jl.includes(e),Rl=e=>typeof e==`string`&&Ll(e)?e:null,zl=(e,t)=>e.selectedTab===t.selectedTab&&e.appearance===t.appearance&&e.ariaLabel===t.ariaLabel&&e.accentColor===t.accentColor&&e.tabs.length===t.tabs.length&&e.tabs.every((e,n)=>e.id===t.tabs[n]?.id&&e.label===t.tabs[n]?.label&&e.badge===t.tabs[n]?.badge&&e.activity===!0==(t.tabs[n]?.activity===!0)&&(e.activity===!0?e.activityLabel??null:null)===(t.tabs[n]?.activity===!0?t.tabs[n]?.activityLabel??null:null)),Bl=(e,t)=>{e.classList.toggle(kl,t)},Vl=(e,t)=>e&&!t,Hl=e=>e.visible?e.overlayHidden?{action:`present`}:e.lastState&&zl(e.lastState,e.nextState)?{action:`skip`}:{action:`present`}:e.overlayHidden?{action:`skip`}:{action:`hide`},Ul=()=>Ml,Wl=`mobile-overlay-root`;function Gl(e){let t=(0,Q.c)(28),n=Cr(),r;t[0]===n?r=t[1]:(r=n&&Pl(),t[0]=n,t[1]=r);let i=r,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=(0,Z.useRef)(!1),p=(0,Z.useRef)(!1),m=q(e.onTabChange),h;t[2]===e.tabs?h=t[3]:(h=JSON.stringify(e.tabs.map(ql)),t[2]=e.tabs,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=typeof document>`u`?`dark`:Fl(document.documentElement),t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=typeof document>`u`?``:Il(),t[5]=y):y=t[5];let b=y,x,S;t[6]===i?(x=t[7],S=t[8]):(x=()=>{if(!i||typeof document>`u`)return;let e=document.getElementById(Wl);e||(e=document.createElement(`div`),e.id=Wl,document.body.appendChild(e));let t=()=>u(mn(e.children));t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[wn]}),()=>n.disconnect()},S=[i],t[6]=i,t[7]=x,t[8]=S),(0,Z.useEffect)(x,S);let C;t[9]!==i||t[10]!==m?(C=()=>{if(!i)return;let e=!1,t=Ul(),n=[];return t.addListener(`tabSelected`,e=>{let t=Rl(e.tab);t&&m(t)}).then(t=>{if(e){t.remove();return}n.push(t)}),()=>{e=!0,d.current=null,t.hide();for(let e of n)e.remove();typeof document<`u`&&Bl(document.documentElement,!1)}},t[9]=i,t[10]=m,t[11]=C):C=t[11];let w;t[12]===i?w=t[13]:(w=[i],t[12]=i,t[13]=w),(0,Z.useEffect)(C,w);let T;t[14]!==e.activeTab||t[15]!==e.ariaLabel||t[16]!==e.tabs||t[17]!==e.visible||t[18]!==i||t[19]!==l?(T=()=>{if(!i||p.current)return;let t=!1,n=Ul(),r={tabs:e.tabs.map(Kl),selectedTab:e.activeTab,appearance:v,accentColor:b,ariaLabel:e.ariaLabel},a=Hl({visible:Vl(e.visible,l),overlayHidden:f.current,lastState:d.current,nextState:r});return(async()=>{if(a.action===`skip`)return;if(a.action===`hide`){f.current=!0,n.hide();return}let e=await n.present(r);if(!t){if(e.adopted!==!0){p.current=!0,c(!0),o(!1),typeof document<`u`&&Bl(document.documentElement,!1);return}f.current=!1,d.current=r,o(!0),typeof document<`u`&&Bl(document.documentElement,!0)}})().catch(()=>{t||(p.current=!0,c(!0),o(!1),typeof document<`u`&&Bl(document.documentElement,!1))}),()=>{t=!0}},t[14]=e.activeTab,t[15]=e.ariaLabel,t[16]=e.tabs,t[17]=e.visible,t[18]=i,t[19]=l,t[20]=T):T=t[20];let E;return t[21]!==e.activeTab||t[22]!==e.ariaLabel||t[23]!==e.visible||t[24]!==i||t[25]!==l||t[26]!==g?(E=[i,e.visible,l,e.activeTab,e.ariaLabel,v,b,g],t[21]=e.activeTab,t[22]=e.ariaLabel,t[23]=e.visible,t[24]=i,t[25]=l,t[26]=g,t[27]=E):E=t[27],(0,Z.useLayoutEffect)(T,E),!i||s?`web`:a?`native`:`pending`}function Kl(e){return{id:e.id,label:e.label,badge:e.badge??null,activity:e.activity===!0,activityLabel:e.activity===!0?e.activityLabel??null:null}}function ql(e){return[e.id,e.label,e.badge??null,e.activity===!0,e.activity===!0?e.activityLabel??null:null]}function Jl(e){let t=(0,Q.c)(51),{tabs:n,navigation:r,onTabChange:i,secondaryPages:a,showTabBar:o,tabBarCovered:s,className:c}=e,l=a===void 0?[]:a,u=o===void 0||o,d=s!==void 0&&s,{t:f}=ge(),p=r.activeTab,m=l.slice(-2),h=m.at(-1)??null,g=h?.key??null,_=h?.depth,v=m.length>1?m[m.length-2].key:null,y;t[0]===p?y=t[1]:(y=()=>new Set([p]),t[0]=p,t[1]=y);let[b,x]=Z.useState(y);b.has(p)||x(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t});let S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef(new Map),E=Z.useRef(null),D=Z.useRef(!1),O=Z.useRef(``),k=q(()=>h?.onBack());ka({id:h?`mobile-secondary:${h.key}`:`mobile-secondary:inactive`,active:!!h,onBack:k,surfaceRef:S,underlayRef:C}),Z.useLayoutEffect(()=>{let e=g===null?null:T.current.get(g)??null,t=v===null?w.current:T.current.get(v)??null;S.current=e,C.current=t},[g,_,v]);let A;t[2]===h?A=t[3]:(A=[h],t[2]=h,t[3]=A),Z.useLayoutEffect(()=>{if(h){if(!D.current){let e=document.activeElement;E.current=e instanceof HTMLElement?e:null,D.current=!0}O.current!==h.key&&(O.current=h.key,S.current?.focus());return}if(D.current){D.current=!1,O.current=``;let e=E.current;E.current=null,e&&e.isConnected&&e.focus()}},A);let j;t[4]===i?j=t[5]:(j=e=>{i(e)},t[4]=i,t[5]=j);let M=q(j),N=Me(),P=Oe(),F=De(),I;t[6]===f?I=t[7]:(I=f(`mobile.tabs.activity.loading`),t[6]=f,t[7]=I);let L=I,R;t[8]!==N||t[9]!==P?(R=Ol({unreadCount:N,working:P}),t[8]=N,t[9]=P,t[10]=R):R=t[10];let z=R,B;t[11]===F?B=t[12]:(B=Ol({unreadCount:0,working:F}),t[11]=F,t[12]=B);let V=B,H;t[13]!==z||t[14]!==N||t[15]!==L||t[16]!==V||t[17]!==f?(H=El.map(e=>{let t=e.id===`assistant`&&z===`loading`||e.id===`scheduled`&&V===`loading`;return{id:e.id,label:f(e.labelKey),badge:e.id===`assistant`&&z===`unread`?N>99?`99+`:String(N):null,activity:t,activityLabel:t?L:null}}),t[13]=z,t[14]=N,t[15]=L,t[16]=V,t[17]=f,t[18]=H):H=t[18];let ee=H,te=u&&!d&&!h,ne;t[19]===f?ne=t[20]:(ne=f(`mobile.nav.aria`),t[19]=f,t[20]=ne);let U;t[21]!==M||t[22]!==te||t[23]!==ee||t[24]!==p||t[25]!==ne?(U={visible:te,activeTab:p,tabs:ee,ariaLabel:ne,onTabChange:M},t[21]=M,t[22]=te,t[23]=ee,t[24]=p,t[25]=ne,t[26]=U):U=t[26];let re=Gl(U),ie=re===`native`,W=u&&re===`web`,ae=Cr(),oe,G;t[27]!==ae||t[28]!==ie?(oe=()=>{if(!ae){wr.shutdown();return}ie&&Or(!0)&&wr.warm()},G=[ae,ie],t[27]=ae,t[28]=ie,t[29]=oe,t[30]=G):(oe=t[29],G=t[30]),Z.useEffect(oe,G);let se;t[31]===c?se=t[32]:(se=J(`yuri-mobile-floating-shell relative isolate flex h-full min-h-0 flex-col overflow-hidden text-foreground`,`bg-[var(--yuri-mobile-page-background)]`,c),t[31]=c,t[32]=se);let ce=h?!0:void 0,le=h?!0:void 0,ue=h?`true`:void 0,de;t[33]!==p||t[34]!==u||t[35]!==W||t[36]!==f||t[37]!==n||t[38]!==b?(de=El.map(e=>{let t=b.has(e.id);return(0,$.jsx)(`section`,{id:`mobile-tabpanel-${e.id}`,role:`tabpanel`,"aria-labelledby":W?`mobile-tab-${e.id}`:void 0,"aria-label":W?void 0:f(e.labelKey),hidden:p!==e.id,tabIndex:0,className:J(`scrollbar-none h-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-[var(--yuri-mobile-page-inline-inset)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+1rem)] outline-none`,u?`pb-[calc(var(--yuri-mobile-dock-height)+2.5rem+var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px)))]`:`pb-0`),children:t?n?.[e.id]??(0,$.jsx)(Yl,{tab:e.id,icon:e.icon}):null},e.id)}),t[33]=p,t[34]=u,t[35]=W,t[36]=f,t[37]=n,t[38]=b,t[39]=de):de=t[39];let fe=u?(0,$.jsx)(`div`,{"data-mobile-navigation-dock-underlay":`true`,"aria-hidden":h||ie?!0:void 0,inert:h||ie?!0:void 0,children:W?(0,$.jsx)(Dl,{activeTab:p,onTabChange:M,tabMarks:{assistant:z===`loading`?`loading`:null,scheduled:V===`loading`?`loading`:null}}):null}):null,K;t[40]!==w||t[41]!==ce||t[42]!==le||t[43]!==ue||t[44]!==de||t[45]!==fe?(K=(0,$.jsxs)(`div`,{ref:w,"data-mobile-navigation-underlay":`true`,"aria-hidden":ce,inert:le,"data-mobile-navigation-parked":ue,className:`flex h-full min-h-0 flex-1 flex-col`,children:[de,fe]}),t[40]=w,t[41]=ce,t[42]=le,t[43]=ue,t[44]=de,t[45]=fe,t[46]=K):K=t[46];let pe=m.map((e,t)=>{let n=t===m.length-1;return(0,$.jsx)(`div`,{ref:t=>{t?T.current.set(e.key,t):T.current.delete(e.key)},"data-mobile-secondary-page":`true`,"data-mobile-secondary-active":n?`true`:`false`,role:n?`dialog`:void 0,"aria-modal":n?!0:void 0,"aria-label":n?e.ariaLabel??f(`mobile.nav.secondaryPageAria`):void 0,"aria-hidden":!n||void 0,inert:!n||void 0,tabIndex:n?-1:void 0,className:J(`absolute inset-0 flex h-full min-h-0 flex-col overflow-hidden bg-background outline-none`,n?`z-50`:`z-40`),children:e.content},e.key)}),me;return t[47]!==se||t[48]!==K||t[49]!==pe?(me=(0,$.jsxs)(`div`,{className:se,children:[K,pe]}),t[47]=se,t[48]=K,t[49]=pe,t[50]=me):me=t[50],me}function Yl(e){let t=(0,Q.c)(17),{tab:n,icon:r,className:i}=e,{t:a}=ge(),o,s,c,l;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=El.find(e=>e.id===n)??El[0];t[8]===i?c=t[9]:(c=J(`flex min-h-[70dvh] flex-col items-center justify-center gap-3 text-center`,i),t[8]=i,t[9]=c),l=(0,$.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-2xl bg-[var(--surface-muted)] text-muted-foreground`,children:(0,$.jsx)(X,{name:r??e.icon,className:`size-6`})}),o=`typography-ui-label font-semibold tracking-[-0.01em] text-foreground`,s=a(e.labelKey),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else o=t[4],s=t[5],c=t[6],l=t[7];let u;t[10]!==o||t[11]!==s?(u=(0,$.jsx)(`h1`,{className:o,children:s}),t[10]=o,t[11]=s,t[12]=u):u=t[12];let d;return t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`div`,{className:c,children:[l,u]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}var Xl={neutral:void 0,info:{color:`var(--status-info)`,backgroundColor:`var(--status-info-background)`},success:{color:`var(--status-success)`,backgroundColor:`var(--status-success-background)`},warning:{color:`var(--status-warning)`,backgroundColor:`var(--status-warning-background)`},error:{color:`var(--status-error)`,backgroundColor:`var(--status-error-background)`}},Zl=e=>{let t=e.replace(/\\/g,`/`).replace(/\/+$/g,``);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n.length<=1?t:n.length===2?n[0]:n.slice(-3,-1).join(`/`)};function Ql({project:e,expanded:t,embedded:n=!1,onToggle:r,onOpenActions:i,className:a,highlightQuery:o}){let{t:s}=ge(),[c,l]=Z.useState(!1),u=Z.useRef(null);u.current||=_i({onPressedKeyChange:t=>l(t===e.id)}),Z.useEffect(()=>()=>u.current?.reset(),[]);let d=q(()=>{u.current?.consumeClick(e.id)||r(e)}),f=q(()=>i?.(e)),p=q(t=>{if(!i||t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0)return;let n=i;u.current?.start({pointerId:t.pointerId,key:e.id,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>{l(!1),n(e)}})}),m=q(e=>{u.current?.move(e.pointerId,e.clientX,e.clientY)}),h=q(e=>{u.current?.end(e.pointerId)}),g=q(e=>{u.current?.cancel(e.pointerId)}),_=q(t=>{if(!i)return;let n=i;t.preventDefault(),t.stopPropagation(),u.current?.openFromContextMenu(e.id,()=>{l(!1),n(e)})}),v=e.sessionCount===1?s(`mobile.sessions.project.sessionsSingle`):s(`mobile.sessions.project.sessionsPlural`,{count:e.sessionCount}),y=Zl(e.path),b=(0,$.jsxs)(`article`,{"data-mobile-press-surface":`soft`,"data-pressed":c?`true`:void 0,className:J(`yuri-mobile-project-card relative flex items-stretch overflow-hidden rounded-[var(--yuri-mobile-surface-radius)]`,a),children:[(0,$.jsxs)(`button`,{type:`button`,"data-mobile-press-surface-trigger":!0,className:`yuri-mobile-project-trigger flex min-w-0 flex-1 items-center text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-expanded":t,onClick:d,onPointerDown:p,onPointerMove:m,onPointerUp:h,onPointerCancel:g,onContextMenu:_,style:{touchAction:`pan-y`},children:[(0,$.jsx)(`span`,{className:J(`yuri-mobile-project-icon yuri-mobile-glass-control flex shrink-0 items-center justify-center rounded-full text-muted-foreground`),style:Xl[e.tone??`neutral`],"aria-hidden":!0,children:(0,$.jsx)(X,{name:e.icon??`code-box`,className:`yuri-mobile-project-icon-glyph`})}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`yuri-mobile-project-title yuri-mobile-entity-title truncate font-semibold text-foreground`,children:o?Rn(e.name,o):e.name}),e.active?(0,$.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-[var(--status-success)] shadow-[0_0_0_3px_color-mix(in_srgb,var(--status-success)_12%,transparent)]`,"aria-label":s(`mobile.sessions.activeProjectAria`)}):null]}),(0,$.jsxs)(`span`,{className:`yuri-mobile-project-meta yuri-mobile-entity-meta flex min-w-0 items-center text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:v}),e.activityLabel?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`·`}),(0,$.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.activityLabel})]}):null,y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`·`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,title:e.path,children:y})]}):null]})]}),(0,$.jsx)(X,{name:`arrow-down-s`,className:J(`yuri-mobile-project-chevron shrink-0 text-muted-foreground transition-transform duration-150 motion-reduce:transition-none`,t?`rotate-0`:`-rotate-90`)})]}),i?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`yuri-mobile-project-action self-center rounded-full text-muted-foreground`,"aria-label":s(`sessions.sidebar.project.actions.projectMenu`),onClick:f,children:(0,$.jsx)(X,{name:`more-2`,className:`size-4`})}):null]});return n?b:(0,$.jsx)(Sa,{asChild:!0,children:b})}function $l(){let e=(0,Q.c)(26),{host:t,snapshot:n,inventory:r,loading:i,error:a,requested:o,requestLoad:s,refresh:c}=Un(),{t:l}=ge(),[u,d]=Z.useState(null);if(!r.some(tu)&&!n.pages.length)return null;let f=u!==null&&u!==`replaced`&&u.host===t,p;e[0]!==a||e[1]!==r?(p=!!a||r.some(eu),e[0]=a,e[1]=r,e[2]=p):p=e[2];let m=p,h;e[3]===l?h=e[4]:(h=l(`guiPlugins.apps`),e[3]=l,e[4]=h);let g;e[5]!==t||e[6]!==s||e[7]!==o?(g=()=>{o||s(),d({host:t})},e[5]=t,e[6]=s,e[7]=o,e[8]=g):g=e[8];let _;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(X,{name:`apps-2-ai`,className:`size-5`}),e[9]=_):_=e[9];let v;e[10]!==h||e[11]!==g?(v=(0,$.jsx)(Y,{variant:`mobileGlass`,size:`mobileIcon`,"aria-label":h,onClick:g,children:_}),e[10]=h,e[11]=g,e[12]=v):v=e[12];let y;e[13]!==m||e[14]!==t||e[15]!==i||e[16]!==f||e[17]!==u||e[18]!==c||e[19]!==o||e[20]!==n||e[21]!==l?(y=u===`replaced`?null:(0,$.jsx)(lr,{id:`gui-apps`,open:f,onOpenChange:e=>d(e?{host:t}:null),title:l(`settings.page.plugins.title`),showCloseButton:!1,ariaLabel:l(`settings.page.plugins.title`),closeAriaLabel:l(`guiPlugins.close`),resizeAriaLabel:l(`guiPlugins.resize`),children:n.pages.length?(0,$.jsx)(`div`,{className:`grid grid-cols-2 content-start gap-3 overflow-y-auto p-4`,"data-gui-apps":!0,children:n.pages.map(e=>(0,$.jsxs)(Y,{size:`lg`,className:`h-auto min-w-0 flex-col items-start gap-4 rounded-2xl p-4 text-left`,onClick:()=>{I.getState().openGuiPage(e.key)&&d(`replaced`)},children:[(0,$.jsx)(X,{name:oa(e.icon)??`window`,className:`size-8`}),(0,$.jsx)(`span`,{className:`line-clamp-2 w-full whitespace-normal break-words typography-ui-label`,children:e.title})]},e.key))}):i||!o||!t&&!m?(0,$.jsxs)(`div`,{role:`status`,className:`flex min-h-40 items-center justify-center gap-2 text-muted-foreground`,"data-gui-apps-loading":!0,children:[(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}),l(`guiPlugins.loading`)]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center`,"data-gui-apps-empty":!0,children:[(0,$.jsx)(Ma,{message:l(m?`guiPlugins.error`:`guiPlugins.mobile.noApps`)}),m?(0,$.jsx)(Y,{className:`mb-4`,onClick:c,children:l(`guiPlugins.mobile.retry`)}):null]})}),e[13]=m,e[14]=t,e[15]=i,e[16]=f,e[17]=u,e[18]=c,e[19]=o,e[20]=n,e[21]=l,e[22]=y):y=e[22];let b;return e[23]!==v||e[24]!==y?(b=(0,$.jsxs)($.Fragment,{children:[v,y]}),e[23]=v,e[24]=y,e[25]=b):b=e[25],b}function eu(e){return e.enabled&&e.error}function tu(e){return e.enabled}var nu=({hasPendingQuestion:e,hasPendingPermission:t,running:n,unread:r})=>e?`question`:t?`permission`:n?`running`:r?`completed-unread`:`idle`;function ru(e){let t=(0,Q.c)(131),{session:n,depth:r,hasChildren:i,expanded:a,paginationContinues:o,onToggleChildren:s,onSelect:c,onPin:l,onArchive:u,onOpenActions:d,indicator:f,className:p,highlightQuery:m}=e,h=r===void 0?0:r,g=i!==void 0&&i,_=a!==void 0&&a,v=o!==void 0&&o,{t:y}=ge(),b=Z.useContext(zi),x;t[0]!==c||t[1]!==n?(x=()=>c(n),t[0]=c,t[1]=n,t[2]=x):x=t[2];let S=hl(n.id,x,b),{offset:C,dragging:w,handleSelect:T,handlePointerDown:E,handlePointerMove:D,finishGesture:O,handlePointerCancel:k,handleContextMenu:A}=S,j;t[3]!==d||t[4]!==n?(j=()=>d(n),t[3]=d,t[4]=n,t[5]=j):j=t[5];let M=q(j),N;t[6]===s?N=t[7]:(N=()=>s?.(),t[6]=s,t[7]=N);let P=q(N),F;t[8]!==n.pinned||t[9]!==y?(F=n.pinned?y(`sessions.sidebar.session.menu.unpin`):y(`sessions.sidebar.session.menu.pin`),t[8]=n.pinned,t[9]=y,t[10]=F):F=t[10];let I=F,L;t[11]!==f||t[12]!==n.unread?(L=f??nu({hasPendingQuestion:!1,hasPendingPermission:!1,running:!1,unread:!!n.unread}),t[11]=f,t[12]=n.unread,t[13]=L):L=t[13];let R=L,z;t[14]!==R||t[15]!==y?(z=R===`question`?y(`sessions.sidebar.session.status.questionRequired`):R===`permission`?y(`sessions.sidebar.session.status.permissionRequired`):R===`running`?y(`sessions.sidebar.session.status.active`):R===`completed-unread`?y(`sessions.sidebar.session.status.unread`):void 0,t[14]=R,t[15]=y,t[16]=z):z=t[16];let B=z;if(n.kind===`pagination`){let e=v&&`yuri-mobile-session-pagination-continues`,r;t[17]!==p||t[18]!==e?(r=J(`yuri-mobile-session-row`,e,p),t[17]=p,t[18]=e,t[19]=r):r=t[19];let i;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(i={touchAction:`pan-y`},t[20]=i):i=t[20];let a;t[21]===n.title?a=t[22]:(a=(0,$.jsx)(`span`,{className:`yuri-mobile-entity-title min-w-0 flex-1 truncate text-left font-medium text-muted-foreground`,children:n.title}),t[21]=n.title,t[22]=a);let o;t[23]===n.subtitle?o=t[24]:(o=n.subtitle?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n.subtitle}):null,t[23]=n.subtitle,t[24]=o);let s;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-4 shrink-0 text-muted-foreground`}),t[25]=s):s=t[25];let c;t[26]!==T||t[27]!==a||t[28]!==o?(c=(0,$.jsxs)(`button`,{type:`button`,"data-mobile-press-feedback":`soft`,className:`yuri-mobile-session-pagination-row`,style:i,onClick:T,onPointerDown:iu,children:[a,o,s]}),t[26]=T,t[27]=a,t[28]=o,t[29]=c):c=t[29];let l;return t[30]!==r||t[31]!==c?(l=(0,$.jsx)(`div`,{className:r,children:c}),t[30]=r,t[31]=c,t[32]=l):l=t[32],l}let V;t[33]===p?V=t[34]:(V=J(`yuri-mobile-session-row relative isolate`,p),t[33]=p,t[34]=V);let H=n.pinned?`unpin`:`pushpin`,ee;t[35]!==l||t[36]!==n?(ee=()=>l(n),t[35]=l,t[36]=n,t[37]=ee):ee=t[37];let te;t[38]!==I||t[39]!==H||t[40]!==ee?(te={label:I,icon:H,onClick:ee},t[38]=I,t[39]=H,t[40]=ee,t[41]=te):te=t[41];let ne;t[42]===y?ne=t[43]:(ne=y(`sessions.sidebar.bulkActions.archive`),t[42]=y,t[43]=ne);let U;t[44]!==u||t[45]!==n?(U=()=>u(n),t[44]=u,t[45]=n,t[46]=U):U=t[46];let re;t[47]!==ne||t[48]!==U?(re={label:ne,icon:`archive`,destructive:!0,onClick:U},t[47]=ne,t[48]=U,t[49]=re):re=t[49];let ie;t[50]!==te||t[51]!==re?(ie=[te,re],t[50]=te,t[51]=re,t[52]=ie):ie=t[52];let W;t[53]!==S||t[54]!==ie?(W=(0,$.jsx)(dl,{swipe:S,actions:ie}),t[53]=S,t[54]=ie,t[55]=W):W=t[55];let ae=w?`transition-none`:`transition-[transform,background-color] duration-150`,oe=n.archived&&`opacity-55`,G;t[56]!==ae||t[57]!==oe?(G=J(`yuri-mobile-session-row-content relative z-10 flex items-center`,`text-foreground`,`ease-out motion-reduce:transition-none`,ae,oe),t[56]=ae,t[57]=oe,t[58]=G):G=t[58];let se=w?`true`:void 0,ce=`translate3d(${C}px, 0, 0)`,le=C===0?void 0:`transform`,ue;t[59]!==ce||t[60]!==le?(ue={transform:ce,willChange:le},t[59]=ce,t[60]=le,t[61]=ue):ue=t[61];let de;t[62]!==_||t[63]!==P||t[64]!==g||t[65]!==s||t[66]!==y?(de=g&&s?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`min-h-9 min-w-9 shrink-0 rounded-full text-muted-foreground`,"aria-label":y(_?`sessions.sidebar.session.subsessions.collapse`:`sessions.sidebar.session.subsessions.expand`),onClick:P,children:(0,$.jsx)(X,{name:`arrow-down-s`,className:J(`size-3.5 transition-transform duration-150 motion-reduce:transition-none`,_?`rotate-0`:`-rotate-90`)})}):null,t[62]=_,t[63]=P,t[64]=g,t[65]=s,t[66]=y,t[67]=de):de=t[67];let fe=16+Math.min(h,4)*12,K;t[68]===fe?K=t[69]:(K={paddingLeft:fe,touchAction:`pan-y`},t[68]=fe,t[69]=K);let pe=!B||void 0,me;t[70]===R?me=t[71]:(me=R===`running`?(0,$.jsx)(Ai,{className:`motion-reduce:[&_svg]:animate-none`}):R===`question`?(0,$.jsx)(X,{name:`question`,className:`size-3.5 text-[var(--status-warning)]`}):R===`permission`?(0,$.jsx)(X,{name:`shield`,className:`size-3.5 text-destructive`}):(0,$.jsx)(`span`,{className:J(`yuri-mobile-session-dot rounded-full`,R===`completed-unread`?`bg-[var(--status-info)]`:`bg-muted-foreground/35`)}),t[70]=R,t[71]=me);let he;t[72]!==B||t[73]!==R||t[74]!==pe||t[75]!==me?(he=(0,$.jsx)(`span`,{className:`yuri-mobile-session-status shrink-0`,"data-session-status":R,"aria-hidden":pe,"aria-label":B,title:B,children:me}),t[72]=B,t[73]=R,t[74]=pe,t[75]=me,t[76]=he):he=t[76];let _e=n.unread?`font-semibold`:`font-medium`,ve;t[77]===_e?ve=t[78]:(ve=J(`yuri-mobile-session-title truncate`,_e),t[77]=_e,t[78]=ve);let ye;t[79]!==m||t[80]!==n.title?(ye=m?Rn(n.title,m):n.title,t[79]=m,t[80]=n.title,t[81]=ye):ye=t[81];let be;t[82]!==ve||t[83]!==ye?(be=(0,$.jsx)(`span`,{className:ve,children:ye}),t[82]=ve,t[83]=ye,t[84]=be):be=t[84];let xe;t[85]===n.changes?xe=t[86]:(xe=n.changes?(0,$.jsx)(`span`,{className:`yuri-mobile-session-changes shrink-0 tabular-nums text-muted-foreground`,children:n.changes}):null,t[85]=n.changes,t[86]=xe);let Se;t[87]===n.archived?Se=t[88]:(Se=n.archived?(0,$.jsx)(X,{name:`archive`,className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":!0}):null,t[87]=n.archived,t[88]=Se);let Ce;t[89]!==be||t[90]!==xe||t[91]!==Se?(Ce=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[be,xe,Se]}),t[89]=be,t[90]=xe,t[91]=Se,t[92]=Ce):Ce=t[92];let we;t[93]!==m||t[94]!==n.subtitle?(we=n.subtitle?(0,$.jsx)(`span`,{className:`yuri-mobile-session-subtitle truncate text-muted-foreground`,children:m?Rn(n.subtitle,m):n.subtitle}):null,t[93]=m,t[94]=n.subtitle,t[95]=we):we=t[95];let Te;t[96]!==Ce||t[97]!==we?(Te=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[Ce,we]}),t[96]=Ce,t[97]=we,t[98]=Te):Te=t[98];let Ee;t[99]===n.activityLabel?Ee=t[100]:(Ee=n.activityLabel?(0,$.jsx)(`span`,{className:`yuri-mobile-session-time tabular-nums`,children:n.activityLabel}):null,t[99]=n.activityLabel,t[100]=Ee);let De;t[101]===Ee?De=t[102]:(De=(0,$.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-muted-foreground`,children:Ee}),t[101]=Ee,t[102]=De);let Oe;t[103]!==O||t[104]!==A||t[105]!==k||t[106]!==E||t[107]!==D||t[108]!==T||t[109]!==K||t[110]!==he||t[111]!==Te||t[112]!==De?(Oe=(0,$.jsxs)(`button`,{type:`button`,"data-mobile-press-feedback":`soft`,className:`yuri-mobile-session-row-main flex min-w-0 flex-1 items-center text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,style:K,onClick:T,onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:k,onContextMenu:A,children:[he,Te,De]}),t[103]=O,t[104]=A,t[105]=k,t[106]=E,t[107]=D,t[108]=T,t[109]=K,t[110]=he,t[111]=Te,t[112]=De,t[113]=Oe):Oe=t[113];let ke;t[114]===y?ke=t[115]:(ke=y(`sessions.sidebar.session.menu.label`),t[114]=y,t[115]=ke);let Ae;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,$.jsx)(X,{name:`more-2`,className:`size-3.5`}),t[116]=Ae):Ae=t[116];let je;t[117]!==M||t[118]!==ke?(je=(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`mr-1 min-h-9 min-w-9 shrink-0 rounded-full text-muted-foreground`,"aria-label":ke,"data-session-drag-ignore":!0,onClick:M,children:Ae}),t[117]=M,t[118]=ke,t[119]=je):je=t[119];let Me;t[120]!==G||t[121]!==se||t[122]!==ue||t[123]!==de||t[124]!==Oe||t[125]!==je?(Me=(0,$.jsxs)(`div`,{className:G,"data-dragging":se,style:ue,children:[de,Oe,je]}),t[120]=G,t[121]=se,t[122]=ue,t[123]=de,t[124]=Oe,t[125]=je,t[126]=Me):Me=t[126];let Ne;return t[127]!==V||t[128]!==W||t[129]!==Me?(Ne=(0,$.jsxs)(`div`,{className:V,children:[W,Me]}),t[127]=V,t[128]=W,t[129]=Me,t[130]=Ne):Ne=t[130],Ne}function iu(){}var au=Z.memo(ru),ou=10,su=`yuri:mobile-worktree-row-revealed`,cu=e=>{window.dispatchEvent(new CustomEvent(su,{detail:e}))};function lu(e){let t=(0,Q.c)(10),n=tt(e.session.id),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={bootstrap:!1},t[0]=r):r=t[0];let i=rt(e.session.id,e.session.directory,r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={bootstrap:!1},t[1]=a):a=t[1];let o=mt(e.session.id,e.session.directory,a).length>0,s=i.length>0,c=!!e.session.unread,l;t[2]!==n||t[3]!==o||t[4]!==s||t[5]!==c?(l=nu({hasPendingQuestion:o,hasPendingPermission:s,running:n,unread:c}),t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==e?(d=(0,$.jsx)(au,{...e,indicator:u}),t[7]=u,t[8]=e,t[9]=d):d=t[9],d}var uu=Z.memo(lu);function du(e){let t=(0,Q.c)(25),{sessions:n,onSelectSession:r,onPinSession:i,onArchiveSession:a,onOpenSessionActions:o,highlightQuery:s,orderScope:c,onReorderSessions:l}=e,u;t[0]===n?u=t[1]:(u=n.filter(hu).map(mu),t[0]=n,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=new Map(d.map(pu)),t[2]=d,t[3]=f);let p=f,m=!!(c&&l&&!s&&d.length>1),h;t[4]!==l||t[5]!==c||t[6]!==d?(h=(e,t)=>{c&&l?.(c,d,e,t)},t[4]=l,t[5]=c,t[6]=d,t[7]=h):h=t[7];let g=q(h),_;t[8]!==s||t[9]!==a||t[10]!==o||t[11]!==i||t[12]!==r||t[13]!==n||t[14]!==m?(_=n.map((e,t)=>{let c=e.kind===`pagination`&&n[t+1]?.kind===`pagination`,l=e.kind===`pagination`?au:uu,u=(0,$.jsx)(l,{session:e,paginationContinues:c,highlightQuery:s,onSelect:r,onPin:i,onArchive:a,onOpenActions:o},e.id);return m&&e.kind!==`pagination`?(0,$.jsx)($i,{sessionId:e.id,sessionDirectory:e.directory??null,sessionTitle:e.title,children:u},e.id):u}),t[8]=s,t[9]=a,t[10]=o,t[11]=i,t[12]=r,t[13]=n,t[14]=m,t[15]=_):_=t[15];let v;t[16]===_?v=t[17]:(v=(0,$.jsx)($.Fragment,{children:_}),t[16]=_,t[17]=v);let y=v,b;return t[18]!==p||t[19]!==g||t[20]!==c||t[21]!==y||t[22]!==d||t[23]!==m?(b=m?(0,$.jsx)(Vi,{scopeKey:c,sessionIds:d,folderIdBySessionId:p,onSessionDroppedOnFolder:fu,onSessionsReordered:g,children:y}):y,t[18]=p,t[19]=g,t[20]=c,t[21]=y,t[22]=d,t[23]=m,t[24]=b):b=t[24],b}function fu(){}function pu(e){return[e,null]}function mu(e){return e.id}function hu(e){return e.kind!==`pagination`}var gu=Z.memo(du);function _u({project:e,worktree:t,expanded:n,onToggle:r,onNewSession:i,onOpenActions:a,onDelete:o,highlightQuery:s}){let{t:c}=ge(),l=`${e.id}::${t.id}`,u=!!(i||o),d=!!a,f=Number(!!i)+Number(!!o),[p,m]=Z.useState(0),[h,g]=Z.useState(!1),[_,v]=Z.useState(!1),y=Z.useRef(null),b=Z.useRef(!1),x=Z.useRef(null),S=Z.useRef(null);S.current||=_i({onPressedKeyChange:e=>g(e===l)}),Z.useEffect(()=>()=>S.current?.reset(),[]),Z.useEffect(()=>{let e=e=>{e.detail!==l&&m(0)};return window.addEventListener(su,e),()=>window.removeEventListener(su,e)},[l]),Z.useEffect(()=>{m(0)},[l]);let C=q(()=>m(0)),w=p!==0,T=q(n=>{if(n.button===0&&(n.pointerType===`touch`||n.pointerType===`pen`)){if(u){let e=x.current?.offsetWidth??0;e>0&&(y.current={pointerId:n.pointerId,startX:n.clientX,startY:n.clientY,startOffset:p,actionWidth:e,intent:`pending`},b.current=!1)}d&&S.current?.start({pointerId:n.pointerId,key:l,clientX:n.clientX,clientY:n.clientY,onTrigger:()=>{g(!1),a?.(e,t)}})}}),E=q(e=>{let t=y.current;if(!t||t.pointerId!==e.pointerId){S.current?.move(e.pointerId,e.clientX,e.clientY);return}let n=e.clientX-t.startX,r=e.clientY-t.startY;if(S.current?.move(e.pointerId,e.clientX,e.clientY),t.intent===`pending`){let i=Math.abs(n),a=Math.abs(r);if(a>ou&&a>i){t.intent=`vertical`,y.current=null,S.current?.cancel(e.pointerId);return}if(i>ou&&i>a){t.intent=`horizontal`,v(!0),b.current=!0,S.current?.cancel(e.pointerId);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}cu(l)}}if(t.intent!==`horizontal`)return;e.preventDefault();let i=Math.max(-t.actionWidth,Math.min(0,t.startOffset+n));m(i)}),D=q(e=>{let t=y.current;S.current?.end(e.pointerId),!(!t||t.pointerId!==e.pointerId)&&(y.current=null,t.intent===`horizontal`&&(v(!1),m(e=>e<-(t.actionWidth*.35)?-t.actionWidth:0)))}),O=q(e=>{let t=y.current;y.current=null,S.current?.cancel(e.pointerId),v(!1),m(t?.startOffset??0)}),k=q(()=>{if(!S.current?.consumeClick(l)){if(b.current){b.current=!1;return}if(p!==0){C();return}r()}}),A=q(n=>{d&&(n.preventDefault(),n.stopPropagation(),S.current?.openFromContextMenu(l,()=>{g(!1),a?.(e,t)}))}),j=q(()=>{C(),i?.(e,t)}),M=q(()=>{C(),o?.(e,t)}),N=q(()=>a?.(e,t)),P=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`yuri-mobile-group-label-icon`,"aria-hidden":!0,children:(0,$.jsx)(X,{name:`git-branch`,className:`size-3.5`})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left yuri-mobile-entity-title font-semibold text-foreground`,children:s?Rn(t.name,s):t.name}),(0,$.jsx)(`span`,{className:`typography-small text-muted-foreground tabular-nums`,children:t.sessionCount===1?c(`mobile.sessions.project.sessionsSingle`):c(`mobile.sessions.project.sessionsPlural`,{count:t.sessionCount})}),(0,$.jsx)(X,{name:`arrow-down-s`,className:J(`size-3.5 text-muted-foreground transition-transform duration-150 motion-reduce:transition-none`,n?`rotate-0`:`-rotate-90`)})]});return(0,$.jsxs)(`div`,{className:`yuri-mobile-group-label yuri-mobile-worktree-label relative isolate overflow-hidden`,children:[u?(0,$.jsxs)(`div`,{ref:x,className:J(`yuri-mobile-worktree-actions absolute inset-y-0 right-0 z-0 flex items-stretch`,_?`transition-none`:`transition-transform duration-150 ease-out`,!w&&`invisible pointer-events-none`),style:{width:`calc(${f} * var(--yuri-mobile-worktree-action-width))`,transform:`translate3d(calc(100% + ${p}px), 0, 0)`,willChange:p===0?void 0:`transform`},"aria-hidden":!w,children:[i?(0,$.jsxs)(Y,{type:`button`,variant:`secondary`,className:`yuri-mobile-worktree-action h-full flex-col rounded-none border-0 bg-interactive-selection px-1 text-interactive-selection-foreground hover:bg-interactive-active`,"aria-label":c(`mobile.sessions.newSessionAria`),tabIndex:w?0:-1,onClick:j,children:[(0,$.jsx)(X,{name:`add`,className:`size-[18px]`}),(0,$.jsx)(`span`,{className:`yuri-mobile-session-action-label font-medium`,children:c(`sessions.sidebar.project.actions.newSession`)})]}):null,o?(0,$.jsxs)(Y,{type:`button`,variant:`destructive`,className:`yuri-mobile-worktree-action h-full flex-col rounded-none border-0 px-1`,"aria-label":c(`mobile.projectEdit.deleteWorktreeAria`,{label:t.name}),tabIndex:w?0:-1,onClick:M,children:[(0,$.jsx)(X,{name:`delete-bin`,className:`size-[18px]`}),(0,$.jsx)(`span`,{className:`yuri-mobile-session-action-label font-medium`,children:c(`mobile.projectEdit.deleteWorktreeConfirmButton`)})]}):null]}):null,(0,$.jsxs)(`div`,{className:J(`yuri-mobile-worktree-label-content relative z-10 flex min-w-0 flex-1 items-center`,`ease-out motion-reduce:transition-none`,_?`transition-none`:`transition-transform duration-150`),style:{transform:`translate3d(${p}px, 0, 0)`,willChange:p===0?void 0:`transform`},"data-pressed":h?`true`:void 0,children:[(0,$.jsx)(`button`,{type:`button`,"data-mobile-press-feedback":`soft`,className:`yuri-mobile-group-label-trigger yuri-mobile-worktree-label-trigger`,"aria-expanded":n,onClick:k,onPointerDown:T,onPointerMove:E,onPointerUp:D,onPointerCancel:O,onContextMenu:A,style:{touchAction:`pan-y`},children:P}),d?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,className:`yuri-mobile-worktree-more rounded-full text-muted-foreground`,"aria-label":c(`agentManager.detail.actions.worktreeActionsAria`),onClick:N,children:(0,$.jsx)(X,{name:`more-2`,className:`size-3.5`})}):null]})]})}function vu(e){let t=(0,Q.c)(96),{projects:n,pinnedSessions:r,inProgressSessions:i,onAddProject:a,onNewSession:o,onScanQr:s,onSwitchInstance:c,onRemoteDesktop:l,instanceOptions:u,onToggleProject:d,onOpenProjectActions:f,onToggleWorktree:p,onNewWorktreeSession:m,onOpenWorktreeActions:h,onDeleteWorktree:g,onSelectSession:_,onPinSession:v,onArchiveSession:y,onOpenSessionActions:b,className:x,onReorderSessions:S}=e,C;t[0]===i?C=t[1]:(C=i===void 0?[]:i,t[0]=i,t[1]=C);let w=C,{t:T}=ge(),[E,D]=Z.useState(!0),[O,k]=Z.useState(!1),A=q(a),j=q(o),M;t[2]===s?M=t[3]:(M=()=>s?.(),t[2]=s,t[3]=M);let N=q(M),P;t[4]===c?P=t[5]:(P=()=>c?.(),t[4]=c,t[5]=P);let F=q(P),I;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>k(e),t[6]=I):I=t[6];let L=q(I),R;t[7]===x?R=t[8]:(R=J(`relative isolate mx-auto flex w-full max-w-[26rem] flex-col gap-5`,x),t[7]=x,t[8]=R);let z;t[9]===T?z=t[10]:(z=T(`mobile.sessions.section.projects`),t[9]=T,t[10]=z);let B,V;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)($l,{}),V=(0,$.jsx)(Li,{mobile:!0}),t[11]=B,t[12]=V):(B=t[11],V=t[12]);let H;t[13]===T?H=t[14]:(H=T(`mobile.projects.menu.label`),t[13]=T,t[14]=H);let ee=O?`rotate-45`:`rotate-0`,te;t[15]===ee?te=t[16]:(te=J(`size-5 transition-transform duration-150 motion-reduce:transition-none`,ee),t[15]=ee,t[16]=te);let ne;t[17]===te?ne=t[18]:(ne=(0,$.jsx)(X,{name:`add`,className:te}),t[17]=te,t[18]=ne);let U;t[19]!==H||t[20]!==ne?(U=(0,$.jsx)(Vn,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`yuri-mobile-inverse-action`,"aria-label":H,children:ne})}),t[19]=H,t[20]=ne,t[21]=U):U=t[21];let re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(X,{name:`chat-new`,className:`size-4`}),t[22]=re):re=t[22];let ie;t[23]===T?ie=t[24]:(ie=T(`mobile.projects.menu.newChat`),t[23]=T,t[24]=ie);let W;t[25]!==j||t[26]!==ie?(W=(0,$.jsxs)(Fn,{className:`min-h-11`,onSelect:j,children:[re,ie]}),t[25]=j,t[26]=ie,t[27]=W):W=t[27];let ae;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(X,{name:`folder`,className:`size-4`}),t[28]=ae):ae=t[28];let oe;t[29]===T?oe=t[30]:(oe=T(`mobile.projects.menu.newProject`),t[29]=T,t[30]=oe);let G;t[31]!==A||t[32]!==oe?(G=(0,$.jsxs)(Fn,{className:`min-h-11`,onSelect:A,children:[ae,oe]}),t[31]=A,t[32]=oe,t[33]=G):G=t[33];let se;t[34]!==N||t[35]!==s||t[36]!==T?(se=s?(0,$.jsxs)(Fn,{className:`min-h-11`,onSelect:N,children:[(0,$.jsx)(X,{name:`scan-2`,className:`size-4`}),T(`mobile.projects.menu.scanQr`)]}):null,t[34]=N,t[35]=s,t[36]=T,t[37]=se):se=t[37];let ce;t[38]!==F||t[39]!==u||t[40]!==c||t[41]!==T?(ce=c&&u?.length?u.map(e=>(0,$.jsxs)(Fn,{className:J(`min-h-11`,e.active&&`bg-interactive-selection text-interactive-selection-foreground`),disabled:e.active||e.disabled,"aria-label":T(`desktopHostSwitcher.actions.switchToAria`,{instance:e.label}),onSelect:()=>c(e.id),children:[(0,$.jsx)(X,{name:`server`,className:`size-4`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.active?(0,$.jsx)(X,{name:`check`,className:`size-4`}):null]},e.id)):c?(0,$.jsxs)(Fn,{className:`min-h-11`,onSelect:F,children:[(0,$.jsx)(X,{name:`server`,className:`size-4`}),T(`mobile.projects.menu.switchInstance`)]}):null,t[38]=F,t[39]=u,t[40]=c,t[41]=T,t[42]=ce):ce=t[42];let le;t[43]!==l||t[44]!==T?(le=l?(0,$.jsxs)(Fn,{className:`min-h-11`,onSelect:l,children:[(0,$.jsx)(X,{name:`computer`,className:`size-4`}),T(`remoteDesktop.title`)]}):null,t[43]=l,t[44]=T,t[45]=le):le=t[45];let ue;t[46]!==W||t[47]!==G||t[48]!==se||t[49]!==ce||t[50]!==le?(ue=(0,$.jsxs)(Pn,{align:`end`,side:`bottom`,className:`min-w-44`,children:[W,G,se,ce,le]}),t[46]=W,t[47]=G,t[48]=se,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==L||t[53]!==O||t[54]!==U||t[55]!==ue?(de=(0,$.jsxs)($.Fragment,{children:[B,V,(0,$.jsxs)(Bn,{open:O,onOpenChange:L,children:[U,ue]})]}),t[52]=L,t[53]=O,t[54]=U,t[55]=ue,t[56]=de):de=t[56];let fe;t[57]!==de||t[58]!==z?(fe=(0,$.jsx)(ti,{title:z,trailing:de}),t[57]=de,t[58]=z,t[59]=fe):fe=t[59];let K;t[60]!==w||t[61]!==y||t[62]!==b||t[63]!==v||t[64]!==S||t[65]!==_||t[66]!==E||t[67]!==r||t[68]!==T?(K=r.length>0||w.length>0?(0,$.jsx)(Sa,{asChild:!0,children:(0,$.jsxs)(`section`,{className:`yuri-mobile-project-shell`,"aria-label":T(`mobile.sessions.section.pinned`),children:[(0,$.jsx)(Ql,{project:{id:`__pinned__`,name:T(`mobile.sessions.section.pinned`),path:``,icon:`pushpin`,sessionCount:r.length+w.length},expanded:E,embedded:!0,onToggle:()=>D(bu)}),E?(0,$.jsxs)(`div`,{className:`yuri-mobile-project-groups`,role:`group`,children:[r.length>0?(0,$.jsx)(`div`,{className:`yuri-mobile-labeled-surface-group`,children:(0,$.jsx)(gu,{sessions:r,orderScope:Zi,onReorderSessions:S,onSelectSession:_,onPinSession:v,onArchiveSession:y,onOpenSessionActions:b})}):null,w.length>0?(0,$.jsx)(`div`,{className:`yuri-mobile-labeled-surface-group`,children:(0,$.jsx)(gu,{sessions:w,onSelectSession:_,onPinSession:v,onArchiveSession:y,onOpenSessionActions:b})}):null]}):null]})}):null,t[60]=w,t[61]=y,t[62]=b,t[63]=v,t[64]=S,t[65]=_,t[66]=E,t[67]=r,t[68]=T,t[69]=K):K=t[69];let pe;t[70]!==A||t[71]!==y||t[72]!==g||t[73]!==m||t[74]!==f||t[75]!==b||t[76]!==h||t[77]!==v||t[78]!==S||t[79]!==_||t[80]!==d||t[81]!==p||t[82]!==n||t[83]!==T?(pe=n.length===0?(0,$.jsxs)(`section`,{className:`flex min-h-[52dvh] flex-col items-center justify-center px-6 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-4 flex size-14 items-center justify-center rounded-2xl bg-[var(--surface-muted)] text-muted-foreground`,children:(0,$.jsx)(X,{name:`folder-add`,className:`size-6`})}),(0,$.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:T(`mobile.sessions.empty.noProjectsTitle`)}),(0,$.jsx)(`p`,{className:`mt-1.5 max-w-xs typography-small text-muted-foreground`,children:T(`mobile.sessions.empty.noProjectsDescription`)}),(0,$.jsxs)(Y,{type:`button`,size:`lg`,className:`mt-4 min-h-10 rounded-full px-5`,onClick:A,children:[(0,$.jsx)(X,{name:`folder-add`,className:`size-4`}),T(`sessions.sidebar.header.actions.addProject`)]})]}):n.map(e=>{let t=e.expanded,n=e.worktrees.find(yu)??(e.worktrees.length===1&&!e.worktrees[0]?.kind?e.worktrees[0]:void 0),r=e.worktrees.filter(e=>e!==n),i=n?.sessions??[];return(0,$.jsx)(Sa,{asChild:!0,children:(0,$.jsxs)(`section`,{className:`yuri-mobile-project-shell`,"aria-label":e.name,children:[(0,$.jsx)(Ql,{project:e,expanded:t,embedded:!0,onToggle:()=>d(e),onOpenActions:()=>f(e)}),t?(0,$.jsxs)(`div`,{className:`yuri-mobile-project-groups`,role:`group`,"aria-label":e.name,children:[i.length>0?(0,$.jsx)(`div`,{className:`yuri-mobile-labeled-surface-group`,children:(0,$.jsx)(gu,{sessions:i,orderScope:n?.path,onReorderSessions:S,onSelectSession:_,onPinSession:v,onArchiveSession:y,onOpenSessionActions:b})}):null,r.map(t=>{let n=!!t.expanded;return(0,$.jsx)(ba,{className:`yuri-mobile-worktree-group`,ariaLabel:t.name,label:(0,$.jsx)(_u,{project:e,worktree:t,expanded:n,onToggle:()=>p(e,t),onNewSession:m,onOpenActions:h,onDelete:g}),children:n&&t.sessions.length>0?(0,$.jsx)(gu,{sessions:t.sessions,orderScope:t.path,onReorderSessions:S,onSelectSession:_,onPinSession:v,onArchiveSession:y,onOpenSessionActions:b}):null},t.id)})]}):null]})},e.id)}),t[70]=A,t[71]=y,t[72]=g,t[73]=m,t[74]=f,t[75]=b,t[76]=h,t[77]=v,t[78]=S,t[79]=_,t[80]=d,t[81]=p,t[82]=n,t[83]=T,t[84]=pe):pe=t[84];let me;t[85]===T?me=t[86]:(me=T(`sessions.sidebar.header.actions.addProject`),t[85]=T,t[86]=me);let he;t[87]!==A||t[88]!==me?(he=(0,$.jsx)(`button`,{type:`button`,className:`sr-only`,onClick:A,children:me}),t[87]=A,t[88]=me,t[89]=he):he=t[89];let _e;return t[90]!==fe||t[91]!==K||t[92]!==pe||t[93]!==he||t[94]!==R?(_e=(0,$.jsxs)(`main`,{className:R,children:[fe,K,pe,he]}),t[90]=fe,t[91]=K,t[92]=pe,t[93]=he,t[94]=R,t[95]=_e):_e=t[95],_e}function yu(e){return e.kind===`main`}function bu(e){return!e}function xu(e){let t=(0,Q.c)(14),{icon:n,label:r,onClick:i,destructive:a,disabled:o,spinning:s,divider:c}=e,l=a!==void 0&&a,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`below`:c,p;t[0]===i?p=t[1]:(p=()=>{nt(`light`),i()},t[0]=i,t[1]=p);let m=q(p),h=l?`destructive`:`ghost`,g=`h-auto min-h-14 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 leading-6 border-0 active:bg-interactive-active dark:active:bg-interactive-active ${f===`above`?`border-t border-[var(--yuri-popup-divider)]`:f===`below`?`border-b border-[var(--yuri-popup-divider)] last:border-b-0`:``}`,_=d?`size-5 text-inherit animate-spin`:`size-5 text-inherit`,v;t[2]!==n||t[3]!==_?(v=(0,$.jsx)(X,{name:n,className:_}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y;t[5]===r?y=t[6]:(y=(0,$.jsx)(`span`,{className:`truncate`,children:r}),t[5]=r,t[6]=y);let b;return t[7]!==u||t[8]!==m||t[9]!==y||t[10]!==h||t[11]!==g||t[12]!==v?(b=(0,$.jsxs)(Y,{type:`button`,variant:h,size:`lg`,className:g,"data-mobile-press-feedback":`none`,disabled:u,onClick:m,children:[v,y]}),t[7]=u,t[8]=m,t[9]=y,t[10]=h,t[11]=g,t[12]=v,t[13]=b):b=t[13],b}function Su(e,t,n,r=!1){return e.reduce((e,t)=>{let n=!r&&!!t.separated,i=e.at(-1);return i?.separated===n?i.items.push(t):e.push({separated:n,items:[t]}),e},[]).map(e=>(0,$.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-mobile-action-group":e.separated?`separated`:`standard`,children:e.items.map((e,i)=>(0,$.jsx)(xu,{icon:e.icon,label:ai(e,t),onClick:n(e.onClick),destructive:e.destructive,disabled:e.disabled,spinning:e.spinning,divider:r?e.separated&&i>0?`above`:`none`:`below`},e.id))},e.items[0]?.id))}function Cu(e){let t=(0,Q.c)(49),{open:n,target:r,actions:i,onOpenChange:a,refreshTranscriptDisabled:o,refreshTranscriptSpinning:s}=e,c=o!==void 0&&o,l=s!==void 0&&s,{t:u}=ge(),d;t[0]===a?d=t[1]:(d=e=>()=>{a(!1),e?.()},t[0]=a,t[1]=d);let f=d,p;bb0:{if(!r){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[2]=e):e=t[2],p=e;break bb0}if(r.kind===`session`){let e;t[3]!==i.onArchive||t[4]!==i.onCopyLink||t[5]!==i.onDelete||t[6]!==i.onRefreshTranscript||t[7]!==i.onRename||t[8]!==i.onShare||t[9]!==i.onTogglePin||t[10]!==i.onToggleRead||t[11]!==i.onUnshare||t[12]!==c||t[13]!==l||t[14]!==r.pinned||t[15]!==r.shared||t[16]!==r.unread?(e=Ci({pinned:r.pinned,shared:r.shared,unread:r.unread,onRename:i.onRename,onTogglePin:i.onTogglePin,onToggleRead:i.onToggleRead,onShare:i.onShare,onCopyLink:i.onCopyLink,onUnshare:i.onUnshare,onRefreshTranscript:i.onRefreshTranscript,onArchive:i.onArchive,onDelete:i.onDelete,refreshTranscriptDisabled:c,refreshTranscriptSpinning:l}),t[3]=i.onArchive,t[4]=i.onCopyLink,t[5]=i.onDelete,t[6]=i.onRefreshTranscript,t[7]=i.onRename,t[8]=i.onShare,t[9]=i.onTogglePin,t[10]=i.onToggleRead,t[11]=i.onUnshare,t[12]=c,t[13]=l,t[14]=r.pinned,t[15]=r.shared,t[16]=r.unread,t[17]=e):e=t[17],p=e;break bb0}if(r.kind===`project`){let e;t[18]!==i.onCloseProject||t[19]!==i.onEditProject||t[20]!==i.onNewSession||t[21]!==i.onNewWorktree||t[22]!==i.onSyncSessions||t[23]!==r.gitRepository?(e=vi({gitRepository:r.gitRepository,onNewSession:i.onNewSession,onNewWorktree:i.onNewWorktree,onSyncSessions:i.onSyncSessions,onEditProject:i.onEditProject,onCloseProject:i.onCloseProject}),t[18]=i.onCloseProject,t[19]=i.onEditProject,t[20]=i.onNewSession,t[21]=i.onNewWorktree,t[22]=i.onSyncSessions,t[23]=r.gitRepository,t[24]=e):e=t[24],p=e;break bb0}let e;t[25]!==i.onDeleteWorktree||t[26]!==i.onNewSession?(e=ha({onNewSession:i.onNewSession,onDeleteWorktree:i.onDeleteWorktree}),t[25]=i.onDeleteWorktree,t[26]=i.onNewSession,t[27]=e):e=t[27],p=e}let m=p;if(!r)return null;let h;t[28]===r.title?h=t[29]:(h=(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:r.title}),t[28]=r.title,t[29]=h);let g=r.title,_;t[30]===u?_=t[31]:(_=u(`mobile.surface.closeAria`),t[30]=u,t[31]=_);let v;t[32]===u?v=t[33]:(v=u(`mobile.sessions.sheet.resizeAria`),t[32]=u,t[33]=v);let y=r.kind===`project`,b;t[34]!==m||t[35]!==f||t[36]!==u||t[37]!==y?(b=Su(m,u,f,y),t[34]=m,t[35]=f,t[36]=u,t[37]=y,t[38]=b):b=t[38];let x;t[39]===b?x=t[40]:(x=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-5`,"data-page-scroll-lock":`true`,children:b})}),t[39]=b,t[40]=x);let S;return t[41]!==a||t[42]!==n||t[43]!==x||t[44]!==h||t[45]!==_||t[46]!==v||t[47]!==r.title?(S=(0,$.jsx)(lr,{id:`mobile-row-actions-sheet`,open:n,onOpenChange:a,title:h,ariaLabel:g,closeAriaLabel:_,resizeAriaLabel:v,fitContent:!0,children:x}),t[41]=a,t[42]=n,t[43]=x,t[44]=h,t[45]=_,t[46]=v,t[47]=r.title,t[48]=S):S=t[48],S}function wu(e,t){return e&&e.id===t.id&&e.kind===t.kind&&e.title===t.title&&e.subtitle===t.subtitle&&e.changes===t.changes&&e.activityLabel===t.activityLabel&&e.unread===t.unread&&e.pinned===t.pinned&&e.archived===t.archived&&e.active===t.active&&e.directory===t.directory&&e.expanded===t.expanded&&e.children===t.children?e:t}function Tu(e,t){if(!e||e.length===0)return t.slice();let n=new Map(e.map(e=>[e.id,e])),r=e.length===t.length,i=t.map((t,i)=>{let a=wu(n.get(t.id)??e[i],t);return a!==e[i]&&(r=!1),a});if(r){let t=!0;for(let n=0;n<i.length;n+=1)if(i[n]!==e[n]){t=!1;break}if(t)return e}return i}var Eu=`__show_more__:`,Du=`__show_fewer__:`,Ou=e=>e.startsWith(Eu),ku=e=>e.startsWith(Du),Au=e=>Ou(e)||ku(e),ju=e=>{let t=Ou(e)?Eu:ku(e)?Du:null;if(!t)return null;let n=e.slice(t.length),r=n.indexOf(`::`);return r<=0?null:{kind:t===`__show_more__:`?`more`:`fewer`,projectId:n.slice(0,r),bucketKey:n.slice(r+2)}},Mu=e=>e.parentID??null,Nu=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Pu=e=>{let t=e;return Nu(t.directory??t.project?.worktree??null)},Fu=(e,t)=>{if(t?.trim())return t.trim();let n=Nu(e);if(!n)return``;let r=n.split(`/`).filter(Boolean);return r[r.length-1]||n},Iu=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},Lu=e=>{if(e<=0)return``;let t=Date.now()-e;if(t<6e4)return`now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<7?`${i}d`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(new Date(e))},Ru=e=>{let t=e.time?.archived;return typeof t==`number`&&t>0},zu=(e,t)=>e.worktrees.find(e=>Nu(e.path)===t)??null,Bu=(e,t)=>{let n=t?.trim();return n?`${e} · ${n}`:e},Vu=(e,t)=>Ui(e,{pinnedSessionIds:t,omitPinnedSessions:!1}).map(e=>e.session);function Hu(){ji();let e=gt(e=>e.sessionOrderByScope),t=gt(e=>e.sessionOrderActivityByScope),{t:n}=ge(),r=Ue(),i=dt(e=>e.activeSessions),a=dt(e=>e.activePaginationByDirectory),o=Fe(e=>e.projects),s=$e(e=>e.projectSortOrder),c=Z.useMemo(()=>Mi(o,s),[o,s]),l=Fe(e=>e.activeProjectId),u=j(e=>e.currentDirectory),d=ft(e=>e.currentSessionId),f=ft(e=>e.availableWorktreesByProject),p=Et(e=>e.orderByProject),m=Ye(),h=Bc(e=>e.projectExpanded),g=Bc(e=>e.worktreeExpanded),_=Ke(e=>e.index.session.unseenCount),[v,y]=Z.useState(new Map),b=ra(),x=Z.useMemo(()=>Ni(b,d),[d,b]),S=Z.useMemo(()=>c.map(e=>{let t=Nu(e.path);return{id:e.id,label:Fu(t,e.label),path:t,icon:e.icon,worktrees:Dt(p[e.id],f.get(t)??[])}}),[c,p,f]),C=Z.useMemo(()=>{let e=new Map(r.map(e=>[e.id,e])),t=i.map(t=>{let n=e.get(t.id);return n?et(n,t):t}),n=new Set(t.map(e=>e.id));for(let e of r)n.has(e.id)||t.push(e);return t},[i,r]),w=Z.useMemo(()=>Qr(C,S.map(e=>({id:e.id,normalizedPath:e.path})),f,!1),[S,C,f]),T=Z.useMemo(()=>{let e=S.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===l,latestActivity:0})),t=new Map(e.map(e=>[e.project.id,e])),n=(e,t,n)=>{let r=Nu(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||n?.label||Fu(r),path:r,worktree:n,sessions:[]},e.buckets.push(a)),a};for(let t of e){n(t,t.project.path,null);for(let e of t.project.worktrees)n(t,e.path,e)}for(let e of C){let r=w.bySessionId.get(e.id);if(!r)continue;let i=t.get(r.projectId);if(!i)continue;let a=r.kind===`worktree`?zu(i.project,r.scopeDirectory):null;(a?n(i,a.path,a):n(i,i.project.path,null)).sessions.push(e)}for(let t of e)for(let e of t.buckets){e.sessions.sort((e,t)=>Ie(t)-Ie(e));let n=Vu(e.sessions,m);t.totalSessions+=n.length;for(let n of e.sessions){let e=Iu(n);e>t.latestActivity&&(t.latestActivity=e)}}return e},[l,w,m,S,C]),E=Z.useMemo(()=>{let e=new Map;for(let t of C)e.set(t.id,t);return e},[C]),D=Z.useMemo(()=>{let e=new Map;for(let t of S)e.set(t.id,t);return e},[S]),O=Z.useRef([]),k=Z.useRef([]),A=Z.useRef(new Map),{pinnedSessions:M,inProgressSessions:N}=Z.useMemo(()=>{let t=new Map(S.map(e=>[e.id,e])),r=n(`mobile.sessions.untitled`),i=new Map(O.current.map(e=>[e.id,e])),a=new Map(k.current.map(e=>[e.id,e])),o=(e,n,i)=>{let a=w.bySessionId.get(e.id),o=a?t.get(a.projectId):void 0;if(!o)return[];let s=a?.kind===`worktree`?zu(o,a.scopeDirectory):null,c={id:e.id,directory:Pu(e),title:e.title?.trim()||r,subtitle:Bu(o.label,s?.branch),changes:mr(pr(e))??void 0,activityLabel:Lu(Iu(e))||void 0,unread:(_[e.id]??0)>0,pinned:n,archived:Ru(e),active:d===e.id};return[wu(i.get(e.id),c)]},s=na(C,m,e[Zi]).flatMap(e=>o(e,!0,i)),c=Fi(C,m,b,_).flatMap(e=>o(e,!1,a)),l=Tu(O.current,s),u=Tu(k.current,c);return O.current=l,k.current=u,{pinnedSessions:l,inProgressSessions:u}},[d,w,e,m,S,b,C,n,_]),P=Z.useMemo(()=>{let e=new Map;for(let t of T){let n=t.project.worktrees.length>0;for(let r of t.buckets){let i=Vu(r.sessions,m).length;e.set(`${t.project.id}::${r.key}`,{path:r.path,rootCount:i,hasWorktrees:n})}}return e},[m,T]),F=Z.useMemo(()=>{let r=Nu(u),i=new Map,o=e=>(e.kind!==`pagination`&&i.set(e.id,e),e),s=T.map(s=>{let c=h[s.project.id]??!0,l=Oi(),u=s.project.icon?Ur[s.project.icon]:void 0,f=s.buckets.map(c=>{let u=`${s.project.id}::${c.key}`,f=g[u]??!1,p=v.get(u)??l,h=Nu(c.path),y=Vu(c.sessions,m).map(e=>({session:e})),b=y.sort(Wi(y,e[h],t[h],m)).map(e=>e.session),S=Ui(c.sessions,{pinnedSessionIds:m,omitPinnedSessions:!1}).map(e=>e.session),C=e=>{let t=Mu(e),r=(_[e.id]??0)>0&&!t,a={id:e.id,directory:c.path,title:e.title?.trim()||n(`mobile.sessions.untitled`),changes:mr(pr(e))??void 0,activityLabel:Lu(Iu(e))||void 0,unread:r,pinned:m.has(e.id),archived:Ru(e),active:d===e.id},s=wu(A.current.get(e.id)??i.get(e.id),a);return o(s)},w=aa(b,p,x).map(C),T=b.length-w.length,E=a.get(Nu(c.path)),D=E?.hasMore===!0,O=b.length>l&&p>l,k=[...w];O&&k.push({id:`${Du}${s.project.id}::${c.key}`,kind:`pagination`,title:n(`sessions.sidebar.group.showFewer`)}),(T>0||D)&&k.push({id:`${Eu}${s.project.id}::${c.key}`,kind:`pagination`,title:n(`sessions.sidebar.group.showMore`),subtitle:E?.loadingMore?`…`:void 0});let j=Nu(c.path),M=!!(s.isActive&&r&&j&&(r===j||r.startsWith(`${j}/`))),N=c.worktree==null;return{id:c.key,name:N?n(`mobile.sessions.mainWorkspace`):c.label,path:c.path,kind:N?`main`:`worktree`,active:M,expanded:N?!0:f,sessionCount:b.length,sessions:k,catalogSessions:S.map(C)}});return{id:s.project.id,name:s.project.label,path:s.project.path,icon:u,sessionCount:s.totalSessions,activityLabel:Lu(s.latestActivity)||void 0,active:s.isActive,expanded:c,worktrees:f}});return A.current=i,s},[a,x,u,d,m,h,e,t,T,n,_,v,g]),I=e=>{for(let[t,n]of P)if(t.startsWith(`${e}::`))return n.hasWorktrees;return!1},L=(e,t)=>P.get(`${e}::${t}`)?.rootCount??0,R=e=>Oi();return{projects:F,pinnedSessions:M,inProgressSessions:N,sessionById:E,projectMetaById:D,allSessions:C,projectHasWorktrees:I,getBucketRootCount:L,getBucketVisibleCount:(e,t)=>{let n=`${e}::${t}`;return v.get(n)??R(e)},getBucketPageSize:R,getBucketDirectory:(e,t)=>P.get(`${e}::${t}`)?.path??null,showMoreBucketSessions:(e,t)=>{let n=`${e}::${t}`,r=P.get(n),i=Oi(),a=mi(),o=v.get(n)??i,s=r?.rootCount??0;if(y(e=>{let t=new Map(e),r=Math.max(i,e.get(n)??i,o);return t.set(n,r+a),t}),Math.max(i,o)+a<s)return;let c=r?.path,l=Nu(c);if(!l)return;let u=dt.getState().activePaginationByDirectory.get(l);u?.hasMore&&!u.loadingMore&&He(l)},resetBucketVisibleCount:(e,t)=>{let n=`${e}::${t}`;y(e=>{if(!e.has(n))return e;let t=new Map(e);return t.delete(n),t})}}}var Uu=(e,t,n)=>e?.kind===`project`&&e.project.id===t?{...e,isGitRepository:n}:e;function Wu({onOpenChat:e,onAddProject:t,onNewSession:n,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:o,className:s}){let{t:c}=ge(),{git:l}=te(),u=vt(),d=Hu(),f=q((e,t,n,r)=>{let i=gt.getState(),a=e===`__pinned__`?e:le(e);if(!a||a!==`__pinned__`&&i.getSessionFolderId(a,n)!==i.getSessionFolderId(a,r))return;let o=a===`__pinned__`?{}:Xi(d.allSessions.filter(e=>Pu(e)===a));i.reorderSessions(a,t,n,r,o).catch(()=>Ct.error(c(`sessions.order.saveFailed`)))}),p=Bc(e=>e.setProjectExpanded),m=Bc(e=>e.setWorktreeExpanded),h=ot(),g=Ye(),_=ft(e=>e.archiveSessions),v=ft(e=>e.updateSessionTitle),y=ft(e=>e.requestSessionSmartTitle),b=ft(e=>e.shareSession),x=ft(e=>e.unshareSession),S=ft(e=>e.openNewSessionDraft),C=yt(e=>e.openDraft),w=yt(e=>e.openSession),T=Fe(e=>e.projects),E=Fe(e=>e.setActiveProjectIdOnly),D=Fe(e=>e.removeProject),O=Yt(),[k,A]=Z.useState(null),[j,M]=Z.useState(!1),[N,P]=Z.useState(null),[F,I]=Z.useState(null),[L,R]=Z.useState(null),[z,B]=Z.useState(``),[V,H]=Z.useState(!1),[ee,ne]=Z.useState(!1),[U,re]=Z.useState(null),[ie,W]=Z.useState(null),[ae,oe]=Z.useState(null),G=k?.kind===`session`?k.session.id:``,se=ht(G),ce=se?.type===`busy`||se?.type===`retry`,ue=k?.kind===`session`?Pu(k.session):``,{unread:de,onToggleRead:fe}=hi(k?.kind===`session`?k.session:null,ue),K=!!G&&ae===G,pe=!ue||K||ce,me=q(e=>{let t=new Map;for(let e of d.allSessions){let n=Mu(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n}),he=q(()=>{M(!1),A(null)}),_e=q(t=>{if(Au(t.id)){let e=ju(t.id);if(!e)return;e.kind===`more`?d.showMoreBucketSessions(e.projectId,e.bucketKey):d.resetBucketVisibleCount(e.projectId,e.bucketKey);return}let n=d.sessionById.get(t.id),r=n&&Pu(n)||null;e({sessionId:t.id,directory:r})}),ve=q(e=>{Au(e.id)||h(e.id)}),ye=q(async e=>{if(Au(e.id))return;let t=me(e.id),{archivedIds:n,failedIds:r}=await _(t);n.length>0&&gi({sessionIds:n,message:n.length===1?c(`sessions.sidebar.session.archive.success`):c(`sessions.sidebar.bulkActions.archivedPlural`,{count:n.length}),undoLabel:c(`sessions.sidebar.undo`),settingsLabel:c(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:n.length===1?c(`sessions.sidebar.session.archive.undoFailed`):c(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:n.length})}),r.length>0&&Ct.error(r.length===1?c(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:r.length}):c(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:r.length}))}),be=q(()=>{if(!k||k.kind!==`session`)return;let e=k.session,t=Pu(e),n=se?.type??`idle`;!t||ae===e.id||n===`busy`||n===`retry`||(oe(e.id),(async()=>{try{await O.refreshSessionTranscript(e.id,{directory:t}),Ct.success(c(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{Ct.error(c(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{oe(t=>t===e.id?null:t)}})())}),xe=q(e=>{if(Au(e.id))return;let t=d.sessionById.get(e.id);t&&(A({kind:`session`,session:t}),M(!0))}),Se=q(e=>{p(e.id,!e.expanded)}),Ce=q((e,t)=>{m(`${e.id}::${t.id}`,!t.expanded)}),we=q((e,t)=>{E(e.id),C({selectedProjectId:e.id,directoryOverride:t,preserveDirectoryOverride:!0})}),Te=q(()=>{if(n){n();return}S()}),Ee=q(e=>{let t=d.projectMetaById.get(e.id);t&&(A({kind:`project`,project:t,isGitRepository:!1}),M(!0),l.checkIsGitRepository(t.path).then(e=>{A(n=>Uu(n,t.id,e))}).catch(()=>{A(e=>Uu(e,t.id,!1))}))}),De=q((e,t)=>{let n=le(t);return n?e.worktrees.find(e=>le(e.path)===n)||((ft.getState().availableWorktreesByProject.get(e.path)??[]).find(e=>le(e.path)===n)??null):null}),Oe=q((e,t)=>{let n=d.projectMetaById.get(e.id);n&&we(n,t.path)}),ke=q((e,t)=>{let n=d.projectMetaById.get(e.id);n&&(A({kind:`worktree`,project:n,worktreePath:t.path,worktreeName:t.name}),M(!0))}),Ae=q((e,t)=>{let n=d.projectMetaById.get(e.id);if(!n)return;let r=De(n,t.path);if(!r){Ct.error(c(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}W({project:n,worktree:r})}),je=q(e=>{re(e),E(e),ne(!0)}),Me=q(e=>{(async()=>{let t=e.worktrees;try{t=(await Gr({id:e.id,path:e.path})).worktrees}catch(n){console.warn(`[MobileProjectsHome] Worktree refresh before session sync failed:`,n),t=ft.getState().availableWorktreesByProject.get(e.path)??e.worktrees}await qe([e.path,...t.map(e=>e.path)],d.allSessions)})()}),Ne=q((e,t)=>{let n=U;if(ne(!1),re(null),t?.sessionId){w({sessionId:t.sessionId,directory:e});return}C({selectedProjectId:n,directoryOverride:e,preserveDirectoryOverride:!0})}),Pe=q(async e=>{try{if(!(await b(e.id))?.share?.url){Ct.error(c(`sessions.sidebar.session.share.error`));return}Ct.success(c(`sessions.sidebar.session.share.successTitle`),{description:c(`sessions.sidebar.session.share.successDescription`)})}catch{Ct.error(c(`sessions.sidebar.session.share.error`))}}),Ie=q(async e=>{if((await at(e)).ok){Ct.success(c(`sessions.sidebar.session.menu.copied`));return}Ct.error(c(`sessions.sidebar.session.share.copyUrlError`))}),Le=q(async e=>{try{if(await x(e)){Ct.success(c(`sessions.sidebar.session.unshare.success`));return}Ct.error(c(`sessions.sidebar.session.unshare.error`))}catch{Ct.error(c(`sessions.sidebar.session.unshare.error`))}}),Re=q(e=>{let t=me(e.id);ea({sessionIds:t,message:t.length===1?c(`sessions.sidebar.session.delete.success`):c(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:c(`sessions.sidebar.undo`),commitFailedMessage:c(`sessions.sidebar.session.delete.error`)})}),J=q(async()=>{if(!L)return;let e=z.trim();if(e)try{await v(L.id,e),R(null),B(``)}catch{Ct.error(c(`sessions.sidebar.session.menu.rename`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}}),ze=q(async()=>{if(!L||V)return;let e=L.id;R(null),B(``),H(!0);try{await y(e)}catch{Ct.error(c(`sessions.sidebar.session.rename.smartTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{H(!1)}}),Be=Z.useMemo(()=>k?k.kind===`session`?{kind:`session`,title:k.session.title?.trim()||c(`mobile.sessions.untitled`),pinned:g.has(k.session.id),shared:!!k.session.share?.url,unread:de}:k.kind===`project`?{kind:`project`,title:k.project.label,gitRepository:k.isGitRepository}:{kind:`worktree`,title:k.worktreeName}:null,[k,de,g,c]),Ve=Z.useMemo(()=>{if(!k)return{};if(k.kind===`session`){let e=k.session;return{onRename:()=>{B(e.title?.trim()||c(`mobile.sessions.untitled`)),R(e)},onTogglePin:()=>h(e.id),onToggleRead:fe,onShare:u&&!e.share?.url?()=>{Pe(e)}:void 0,onCopyLink:u&&e.share?.url?()=>{Ie(e.share.url)}:void 0,onUnshare:u&&e.share?.url?()=>{Le(e.id)}:void 0,onRefreshTranscript:be,onArchive:()=>{ye({id:e.id,title:e.title?.trim()||c(`mobile.sessions.untitled`)})},onDelete:()=>Re(e)}}if(k.kind===`project`){let e=k.project;return{onNewSession:()=>we(e,e.path),onNewWorktree:()=>je(e.id),onSyncSessions:()=>Me(e),onEditProject:()=>P(e.id),onCloseProject:()=>I(e)}}let{project:e,worktreePath:t}=k;return{onNewSession:()=>we(e,t),onDeleteWorktree:()=>{let n=De(e,t);if(!n){Ct.error(c(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}W({project:e,worktree:n})}}},[k,ye,Ie,Re,be,je,Me,Pe,Le,fe,De,u,we,c,h]),He=Z.useMemo(()=>{if(!N)return null;let e=T.find(e=>e.id===N),t=d.projectMetaById.get(N);if(!e||!t)return null;let n=k?.kind===`project`&&k.project.id===N?k.isGitRepository:t.worktrees.length>0;return{id:e.id,label:e.label?.trim()||t.label,path:le(e.path)||t.path,icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:n,worktrees:t.worktrees}},[k,N,d.projectMetaById,T]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(vu,{className:s,projects:d.projects,pinnedSessions:d.pinnedSessions,inProgressSessions:d.inProgressSessions,onAddProject:t,onNewSession:Te,onScanQr:r,onSwitchInstance:i,instanceOptions:o,onRemoteDesktop:a,onToggleProject:Se,onOpenProjectActions:Ee,onToggleWorktree:Ce,onNewWorktreeSession:Oe,onOpenWorktreeActions:ke,onDeleteWorktree:Ae,onSelectSession:_e,onPinSession:ve,onArchiveSession:e=>{ye(e)},onOpenSessionActions:xe,onReorderSessions:f}),(0,$.jsx)(Cu,{open:j,target:Be,actions:Ve,refreshTranscriptDisabled:pe,refreshTranscriptSpinning:K,onOpenChange:e=>{e?M(!0):he()}}),(0,$.jsx)(Cn,{open:ee,projectId:U,onOpenChange:e=>{ne(e),e||re(null)},onWorktreeCreated:Ne}),ie?(0,$.jsx)(pi,{open:!0,project:{id:ie.project.id,path:ie.project.path},worktree:ie.worktree,onClose:()=>W(null)}):null,(0,$.jsx)(zn,{open:!!F,title:c(`sessions.sidebar.project.actions.closeProject`),onClose:()=>I(null),closeAriaLabel:c(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>I(null),children:c(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!F)return;let e=F;I(null),D(e.id),Ct.success(c(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:c(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:c(`mobile.projects.closeConfirmMessage`,{title:F?.label??``})})}),(0,$.jsx)(zn,{open:!!L,title:c(`sessions.sidebar.session.menu.rename`),onClose:()=>{V||(R(null),B(``))},closeAriaLabel:c(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:V,onClick:()=>{R(null),B(``)},children:c(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:!z.trim()||V,onClick:()=>void J(),children:c(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),J()},children:[(0,$.jsx)(On,{value:z,onChange:e=>B(e.target.value),autoFocus:!0,className:`h-12`,disabled:V}),(0,$.jsxs)(Y,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:V,onClick:()=>void ze(),children:[V?(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(X,{name:`ai-generate-2`,className:`size-4`}),c(`sessions.sidebar.session.rename.smartTitle`)]})]})}),(0,$.jsx)(ki,{open:N!==null,project:He,onClose:()=>P(null)})]})}function Gu(e){let t=(0,Q.c)(10),{children:n,content:r,className:i,contentClassName:a,showHeader:o}=e,s=o===void 0||o,{t:c}=ge(),l;t[0]===c?l=t[1]:(l=c(`sessions.scheduledTasks.dialog.title`),t[0]=c,t[1]=l);let u;t[2]===a?u=t[3]:(u=J(`yuri-mobile-scheduled-content`,a),t[2]=a,t[3]=u);let d=n??r,f;return t[4]!==i||t[5]!==s||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,$.jsx)(wa,{title:l,className:i,surface:!1,scrollsWithPage:!0,showHeader:s,surfaceClassName:u,children:d}),t[4]=i,t[5]=s,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ku(e){let t=(0,Q.c)(10),{className:n,contentClassName:r,instancesPage:i}=e,{t:a}=ge(),o;t[0]===a?o=t[1]:(o=a(`mobile.settings.placeholder.title`),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=[...Yn],t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,$.jsx)(Da,{forceMobile:!0,isWindowed:!0,hideMobileHeader:!0,flowMobile:!0,autoOpenMobilePage:!0,visiblePageSlugs:s,mobileInstancesPage:i}),t[3]=i,t[4]=c);let l;return t[5]!==n||t[6]!==r||t[7]!==o||t[8]!==c?(l=(0,$.jsx)(wa,{title:o,className:n,surface:!1,scrollsWithPage:!0,showHeader:!1,surfaceClassName:r,children:c}),t[5]=n,t[6]=r,t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function qu(e){let t=(0,Q.c)(112),{onAddProject:n,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,remoteDesktopActive:o,instanceOptions:s,onEnableAssistants:c,instancesPage:l,instancesSecondaryPage:u,parentSessionTarget:d,registerSecondaryBackHandler:f,scheduledContent:p,renderChat:m,className:h}=e,g=o!==void 0&&o,_=d===void 0?null:d,{t:v}=ge(),y=I(fd),b=yt(),x=yt(dd),S=yt(ud),C=yt(ld),w=yt(cd),T=yt(sd),E=yt(od),D=yt(ad),O=yt(id),k=yt(rd),A=yt(nd),j=yt(td),M=yt(ed),N;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[0]=N):N=t[0],Z.useEffect($u,N);let P=b.secondary?.kind===`chat`?b.secondary.btw??null:null,F=Z.useRef(null),L,R;t[1]===P?(L=t[2],R=t[3]):(L=()=>{let e=F.current;F.current=P,e&&e!==P&&hn.getState().clear({sessionId:e.sessionId,directory:e.directory}),P?Qt(dn):bn(dn)},R=[P],t[1]=P,t[2]=L,t[3]=R),Z.useEffect(L,R);let z;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[4]=z):z=t[4],Z.useEffect(Zu,z);let B;t[5]===x?B=t[6]:(B=e=>{e===`settings`&&I.getState().setSettingsPage(`home`),x(e)},t[5]=x,t[6]=B);let V=q(B),H;t[7]===S?H=t[8]:(H=e=>{S(e)},t[7]=S,t[8]=H);let ee=q(H),te;t[9]===D?te=t[10]:(te=()=>{D()},t[9]=D,t[10]=te);let ne=q(te),U;t[11]===C?U=t[12]:(U=()=>{C()},t[11]=C,t[12]=U);let re=q(U),ie;t[13]===w?ie=t[14]:(ie=e=>{w(e)},t[13]=w,t[14]=ie);let W=q(ie),ae=Z.useRef(null),[oe,G]=Z.useState(!1),se;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(se=e=>{ae.current=e},t[15]=se):se=t[15];let ce=q(se),ue;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{G(e)},t[16]=ue):ue=t[16];let de=q(ue),fe;t[17]!==ne||t[18]!==E||t[19]!==M||t[20]!==O?(fe=()=>{if(ae.current?.())return!0;let e=yt.getState().secondary;return e?.kind===`chat`&&e.btw?(M(),!0):e?.kind===`assistant`&&e.settingsAssistantID?(E(),!0):e?.kind===`chat`&&e.routes.length>1?(O(),!0):e?(ne(),!0):!1},t[17]=ne,t[18]=E,t[19]=M,t[20]=O,t[21]=fe):fe=t[21];let K=q(fe),pe=b.secondary!==null,me;t[22]!==K||t[23]!==f?(me=()=>{if(f)return f(()=>K()),()=>f(null)},t[22]=K,t[23]=f,t[24]=me):me=t[24];let he;t[25]!==K||t[26]!==f||t[27]!==pe?(he=[f,pe,K],t[25]=K,t[26]=f,t[27]=pe,t[28]=he):he=t[28],Z.useEffect(me,he);let _e=ft(Xu),ve;t[29]===_e?ve=t[30]:(ve=e=>_e?e.getDirectoryForSession(_e):null,t[29]=_e,t[30]=ve);let ye=ft(ve),be,xe;t[31]!==ye||t[32]!==_e||t[33]!==A||t[34]!==j?(be=()=>{let e=yt.getState().secondary;if(e?.kind===`draft`&&_e){A({sessionId:_e,directory:ye});return}if(e?.kind!==`chat`||!_e||xt({sessionId:_e,directory:ye})===`internal`)return;let t=e.routes.at(-1);(t?.sessionId!==_e||le(t.directory)!==le(ye))&&j({sessionId:_e,directory:ye})},xe=[ye,_e,A,j],t[31]=ye,t[32]=_e,t[33]=A,t[34]=j,t[35]=be,t[36]=xe):(be=t[35],xe=t[36]),Z.useEffect(be,xe);let Se,Ce;t[37]!==_e||t[38]!==_||t[39]!==k?(Se=()=>{let e=yt.getState().secondary;if(e?.kind!==`chat`||!_)return;let t=e.routes.at(-1);!t||t.sessionId!==_e||k({sessionId:_.id,directory:_.directory})},Ce=[_e,_,k],t[37]=_e,t[38]=_,t[39]=k,t[40]=Se,t[41]=Ce):(Se=t[40],Ce=t[41]),Z.useEffect(Se,Ce);let we;t[42]!==de||t[43]!==ce||t[44]!==p?(we=typeof p==`function`?p(ce,de):p,t[42]=de,t[43]=ce,t[44]=p,t[45]=we):we=t[45];let Te=we,Ee;t[46]!==re||t[47]!==s||t[48]!==n||t[49]!==a||t[50]!==r||t[51]!==i||t[52]!==ee?(Ee=(0,$.jsx)(Wu,{onOpenChat:ee,onAddProject:n,onNewSession:re,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:s}),t[46]=re,t[47]=s,t[48]=n,t[49]=a,t[50]=r,t[51]=i,t[52]=ee,t[53]=Ee):Ee=t[53];let De;t[54]!==c||t[55]!==W?(De=(0,$.jsx)(xl,{onEnable:c,onOpenAssistant:W}),t[54]=c,t[55]=W,t[56]=De):De=t[56];let Oe;t[57]===Te?Oe=t[58]:(Oe=(0,$.jsx)(Gu,{showHeader:!1,children:Te}),t[57]=Te,t[58]=Oe);let ke;t[59]===l?ke=t[60]:(ke=(0,$.jsx)(Ku,{instancesPage:l}),t[59]=l,t[60]=ke);let Ae;t[61]!==Ee||t[62]!==De||t[63]!==Oe||t[64]!==ke?(Ae={projects:Ee,assistant:De,scheduled:Oe,settings:ke},t[61]=Ee,t[62]=De,t[63]=Oe,t[64]=ke,t[65]=Ae):Ae=t[65];let je=Ae,Me=b.secondary?.kind??null,Ne;bb0:{if(!Me){Ne=null;break bb0}let e;t[66]!==K||t[67]!==T||t[68]!==v?(e=e=>({key:`assistant-secondary`,depth:1,ariaLabel:v(`assistants.title`),onBack:K,content:(0,$.jsx)(Ha,{activeOverride:e,onMobileBack:Yu,onMobileOpenSettings:T})}),t[66]=K,t[67]=T,t[68]=v,t[69]=e):e=t[69];let n=e;if(Me===`assistant`){let e=b.secondary?.kind===`assistant`?b.secondary.settingsAssistantID:void 0,r=!e,i;t[70]!==n||t[71]!==r?(i=n(r),t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;t[73]!==K||t[74]!==e||t[75]!==v?(a=e?[{key:`assistant-settings:${e}`,depth:2,ariaLabel:v(`assistants.conversation.openSettings`),onBack:K,content:(0,$.jsx)(Cl,{assistantID:e,onBack:Ju})}]:[],t[73]=K,t[74]=e,t[75]=v,t[76]=a):a=t[76];let o;t[77]!==i||t[78]!==a?(o=[i,...a],t[77]=i,t[78]=a,t[79]=o):o=t[79],Ne=o;break bb0}if(Me===`instances`){let e;t[80]===v?e=t[81]:(e=v(`mobile.settings.switchInstance`),t[80]=v,t[81]=e);let n;t[82]!==K||t[83]!==u||t[84]!==e?(n=[{key:`instances-secondary`,depth:1,ariaLabel:e,onBack:K,content:u}],t[82]=K,t[83]=u,t[84]=e,t[85]=n):n=t[85],Ne=n;break bb0}if(b.secondary?.kind===`draft`){let e;t[86]===v?e=t[87]:(e=v(`mobile.nav.secondaryPageAria`),t[86]=v,t[87]=e);let n;t[88]===m?n=t[89]:(n=m({sessionId:``,directory:null,viewKey:`chat-primary`,active:!0}),t[88]=m,t[89]=n);let r;t[90]!==K||t[91]!==e||t[92]!==n?(r=[{key:`chat-primary`,depth:1,ariaLabel:e,onBack:K,content:n}],t[90]=K,t[91]=e,t[92]=n,t[93]=r):r=t[93],Ne=r;break bb0}if(b.secondary?.kind!==`chat`){let e;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[94]=e):e=t[94],Ne=e;break bb0}let r=b.secondary.routes,i;if(t[95]!==n||t[96]!==K||t[97]!==b.secondary.btw||t[98]!==b.secondary.returnTo||t[99]!==m||t[100]!==r||t[101]!==v){let e=b.secondary.returnTo?[n(!1)]:[],a=b.secondary.btw,o=r.slice(a?-1:-2),s=r.length-o.length+1+e.length,c=o.map((e,t)=>{let n=!a&&t===o.length-1;return{key:e.key,depth:s+t,ariaLabel:v(`mobile.nav.secondaryPageAria`),onBack:K,content:m({sessionId:e.sessionId,directory:e.directory,viewKey:e.key,active:n})}});i=a?[...e,...c,{key:`chat-btw`,depth:r.length+1+e.length,ariaLabel:v(`chat.btw.title`),onBack:K,content:(0,$.jsx)(wl,{route:a})}]:[...e,...c],t[95]=n,t[96]=K,t[97]=b.secondary.btw,t[98]=b.secondary.returnTo,t[99]=m,t[100]=r,t[101]=v,t[102]=i}else i=t[102];Ne=i}let Pe=Ne,Fe;t[103]===Pe?Fe=t[104]:(Fe=Pe??[],t[103]=Pe,t[104]=Fe);let Ie=oe||y||g,Le;return t[105]!==h||t[106]!==b||t[107]!==V||t[108]!==Fe||t[109]!==Ie||t[110]!==je?(Le=(0,$.jsx)(Jl,{className:h,navigation:b,onTabChange:V,tabs:je,secondaryPages:Fe,tabBarCovered:Ie}),t[105]=h,t[106]=b,t[107]=V,t[108]=Fe,t[109]=Ie,t[110]=je,t[111]=Le):Le=t[111],Le}function Ju(){ja.requestAnimatedBack(`root`)}function Yu(){return ja.requestAnimatedBack(`root`)}function Xu(e){return e.currentSessionId}function Zu(){return Qu}function Qu(){return bn(dn)}function $u(){return ut()}function ed(e){return e.popBtw}function td(e){return e.replaceChatSession}function nd(e){return e.materializeDraftSession}function rd(e){return e.reconcileChatPredecessor}function id(e){return e.popChatSession}function ad(e){return e.closeSecondary}function od(e){return e.popAssistantSettings}function sd(e){return e.pushAssistantSettings}function cd(e){return e.openAssistant}function ld(e){return e.openDraft}function ud(e){return e.openSession}function dd(e){return e.setActiveTab}function fd(e){return e.isCommandPaletteOpen}function pd(e){let t=!1,n=0,r=0,i=!1,a,o,s,l=()=>e.transport===u()&&e.generation===f(),d=()=>document.visibilityState===`hidden`,p=()=>{r++;let e=a;a=void 0,clearTimeout(o),o=void 0,e?.close()},m=n=>{t||(t=!0,p(),x(),window.removeEventListener(`online`,_),window.removeEventListener(`pageshow`,y),window.removeEventListener(`yuri:system-resume`,v),document.removeEventListener(`visibilitychange`,b),e.onState(`closed`,n))},h=()=>{if(t||d())return;let e=navigator.onLine===!1||s===`permission_required`?6e4:Math.min(1e3*2**Math.min(n++,5),3e4);o=setTimeout(()=>{o=void 0,g()},e)},g=()=>{if(t||a||d())return;if(!l()){m(`runtime_changed`);return}if(clearTimeout(o),o=void 0,navigator.onLine===!1){h();return}let c=++r;a=md({...e,onState:(i,o)=>{if(!(t||c!==r)){if(i===`closed`){if(a=void 0,s=o,!o||[`runtime_changed`,`disabled`,`unsupported`,`helper_unavailable`,`authentication_required`,`permission_denied`].includes(o)){m(o);return}e.onState(i,o),h();return}(i===`webrtc`||i===`tunnel`)&&(n=0,s=void 0),e.onState(i,o)}}}),a.setZoomed(i)},_=()=>{!t&&!d()&&!a&&g()},v=()=>{t||(p(),_())},y=e=>{e.persisted&&v()},b=()=>{d()?(p(),e.onState(`connecting`,void 0)):_()},x=c(()=>m(`runtime_changed`));return window.addEventListener(`online`,_),window.addEventListener(`pageshow`,y),window.addEventListener(`yuri:system-resume`,v),document.addEventListener(`visibilitychange`,b),g(),{send:e=>{!t&&l()&&a?.send(e)},close:()=>m(),setZoomed:e=>{i=e,a?.setZoomed(e)}}}function md(e){let t=!1,n,i,a=!1,o,s,c=setTimeout(()=>E(`connection_failed`),6e4),d,p=Date.now(),m,h,g=!1,_=!1,v=!1,y=(t,n)=>{(m!==t||h!==n)&&(m=t,h=n,e.onState(t,n))},b=Promise.resolve(),x=0,S=[],C=()=>!t&&e.transport===u()&&e.generation===f(),w=e=>{if(!(!C()||n?.readyState!==1))try{n.send(JSON.stringify(e))}catch{E(`connection_failed`)}},T=()=>{!g||_===v||!C()||n?.readyState!==1||(w({type:`view`,zoomed:_}),v=_)},E=r=>{if(t)return;let a=C()&&n?.readyState===1;if(t=!0,a)try{n.send(JSON.stringify({type:`release`}))}catch{}clearInterval(s),clearTimeout(c),clearTimeout(d),n&&(n.onopen=null,n.onmessage=null,n.onerror=null,n.onclose=null,n.close()),i?.close();let l=e.video.srcObject;l instanceof MediaStream&&l.getTracks().forEach(e=>e.stop()),e.video.srcObject=null,e.video.onloadeddata=null,e.image.onload=null,e.image.onerror=null,e.image.removeAttribute(`src`),o&&URL.revokeObjectURL(o),y(`closed`,r)},D=()=>{!C()||a||(a=!0,i?.close(),clearTimeout(d),d=setTimeout(()=>E(`connection_failed`),15e3),w({type:`fallback`}))},O=async t=>{if(!C())return;if(p=Date.now(),t instanceof ArrayBuffer){if(t.byteLength>524288){E(`connection_failed`);return}o&&URL.revokeObjectURL(o),o=URL.createObjectURL(new Blob([t],{type:`image/jpeg`})),e.image.onload=()=>{C()&&(clearTimeout(c),clearTimeout(d),e.onSize(e.image.naturalWidth,e.image.naturalHeight),y(`tunnel`),w({type:`ack`}))},e.image.onerror=()=>E(`connection_failed`),e.image.src=o;return}let n=JSON.parse(t);if(n.type===`error`){E(typeof n.code==`string`?n.code:`connection_failed`);return}if(n.type===`ready`)g=n.zoomQuality===!0,T(),Number.isFinite(n.width)&&Number.isFinite(n.height)&&e.onSize(n.width,n.height);else if(n.type===`offer`&&!a){if(i||typeof n.sdp!=`string`||n.sdp.length>65536)throw Error(`invalid_offer`);if(typeof RTCPeerConnection>`u`){D();return}i=new RTCPeerConnection({iceServers:Array.isArray(n.iceServers)?n.iceServers:[]}),i.onicecandidate=e=>{e.candidate&&w({type:`ice`,candidate:e.candidate.toJSON()})},i.onconnectionstatechange=()=>{(i?.connectionState===`failed`||i?.connectionState===`disconnected`)&&D()},i.ontrack=t=>{C()&&(e.video.srcObject=new MediaStream([t.track]),e.video.onloadeddata=()=>{!C()||a||(clearTimeout(c),clearTimeout(d),e.onSize(e.video.videoWidth,e.video.videoHeight),y(`webrtc`))},e.video.play().catch(D))},await i.setRemoteDescription({type:`offer`,sdp:n.sdp});for(let e of S.splice(0))await i.addIceCandidate(e);if(await i.setLocalDescription(await i.createAnswer()),!C()||a)return;d=setTimeout(D,7e3),w({type:`answer`,sdp:i.localDescription?.sdp})}else n.type===`ice`&&n.candidate&&!a?i?.remoteDescription?await i.addIceCandidate(n.candidate):S.length<128&&S.push(n.candidate):n.type===`rtc-failed`&&D()};return y(`connecting`),(async()=>{try{if(await r(),!C())return;n=P(l().websocket(`/api/remote-desktop/ws`)),n.binaryType=`arraybuffer`,n.onopen=()=>{C()&&(p=Date.now(),s=setInterval(()=>{if(!C()){E(`runtime_changed`);return}if(Date.now()-p>3e4){E(`connection_failed`);return}w({type:`ping`})},5e3))},n.onmessage=e=>{if(C()){if(++x>128){E(`connection_failed`);return}b=b.then(()=>O(e.data)).catch(D).finally(()=>{x--})}},n.onerror=()=>E(`connection_failed`),n.onclose=e=>E(e.code===4001?`authentication_required`:`connection_failed`)}catch{E(`connection_failed`)}})(),{send:e=>w(e),close:E,setZoomed:e=>{_=e,T()}}}var hd={scale:1,x:0,y:0};function gd(e){let t=Math.min(e.width/e.remoteWidth,e.height/e.remoteHeight),n=e.remoteWidth*t,r=e.remoteHeight*t;return{width:n,height:r,x:(e.width-n)/2,y:(e.height-r)/2}}function _d(e,t,n){if(t.width<=0||t.height<=0||t.remoteWidth<=0||t.remoteHeight<=0)return null;let r=gd(t),i=((e.x-n.x)/n.scale-r.x)/r.width,a=((e.y-n.y)/n.scale-r.y)/r.height;return i>=0&&i<=1&&a>=0&&a<=1?{x:i,y:a}:null}function vd(e,t,n=1){let r=Math.max(n,Math.min(5,e.scale)),i=gd(t),a=(e,t,n,i)=>n*r<=i?(i-n*r)/2-t*r:Math.max(i-(t+n)*r,Math.min(-t*r,e));return{scale:r,x:a(e.x,i.x,i.width,t.width),y:a(e.y,i.y,i.height,t.height)}}function yd(e){let t=new Map,n={...hd},r=null,i=null,a=!1,o=!1,s=!1,c=!1,l,u=null,d=0,f=null,p=()=>{a&&e.send({type:`release`}),a=!1},m=()=>{(n.scale!==1||n.x!==0||n.y!==0)&&(n={...hd},e.apply(n,!0))},h=()=>{clearTimeout(l),p(),t.clear(),f=null,r=i=null,s=!1,u=null,n.scale<=1&&m()},g=()=>{let[e,n]=[...t.values()];return{midpoint:{x:(e.x+n.x)/2,y:(e.y+n.y)/2},distance:Math.max(1,Math.hypot(e.x-n.x,e.y-n.y))}},_={down(a,m){t.size>=2||(t.set(a,m),t.size===1&&(r=i=m,o=!1,s=!1,c=!1,d=Date.now(),e.mode()===`cursor`&&(l=setTimeout(()=>{let t=_d(m,e.viewport(),n);t&&!o&&!s&&(e.send({type:`pointer`,action:`right`,...t}),c=!0)},550))),t.size===2&&(clearTimeout(l),s=!0,u=null,p(),f={...g(),transform:{...n}}))},move(d,p){if(t.has(d)){if(t.set(d,p),t.size===2&&f){let{midpoint:t,distance:r}=g(),i=Math.max(.5,Math.min(5,f.transform.scale*r/f.distance)),a=i/f.transform.scale;n=vd({scale:i,x:t.x-(f.midpoint.x-f.transform.x)*a,y:t.y-(f.midpoint.y-f.transform.y)*a},e.viewport(),.5),e.apply(n);return}if(!(s||c||!r||!i)&&(Math.hypot(p.x-r.x,p.y-r.y)>6&&(o=!0,u=null,clearTimeout(l)),o)){if(e.mode()===`drag`)n={...n,x:n.x+p.x-i.x,y:n.y+p.y-i.y},e.apply(n);else{let t=_d(p,e.viewport(),n);if(t){let i=_d(r,e.viewport(),n);!a&&i&&(e.send({type:`pointer`,action:`down`,...i}),a=!0),a&&e.send({type:`pointer`,action:`move`,...t})}}i=p}}},moveMany(e){let n;for(let[r,i]of e)t.has(r)&&(t.set(r,i),n=[r,i]);n&&_.move(...n)},up(a,h,g=!1){if(t.has(a)){if(clearTimeout(l),t.delete(a),e.mode()===`cursor`&&!g&&!s&&!o&&!c){let t=_d(h,e.viewport(),n);t&&e.send({type:`pointer`,action:`click`,...t})}if(e.mode()===`drag`&&!g&&!s&&!o&&Date.now()-d<450){let t=Date.now(),r={x:h.x,y:h.y,time:t};if(kn(u,r)){if(n.scale>1)n={...hd};else{let t=2.5,r=t/n.scale;n=vd({scale:t,x:h.x-(h.x-n.x)*r,y:h.y-(h.y-n.y)*r},e.viewport())}e.apply(n,!0),u=null}else u=r}else u=null;p(),t.size||(f=null,r=i=null,s=!1,n.scale<=1&&m())}},cancel:h,refit(){if(n.scale<=1){m();return}n=vd(n,e.viewport()),e.apply(n)},reset(){h(),n={...hd},e.apply(n)}};return _}function bd(e,t,n){return n===90?{x:e.y-t.top,y:t.right-e.x}:n===-90?{x:t.bottom-e.y,y:e.x-t.left}:{x:e.x-t.left,y:e.y-t.top}}var xd=ie(`YuriOrientation`);function Sd(){return W.isNativePlatform()&&W.isPluginAvailable(`YuriOrientation`)}function Cd(e){return xd.lock({orientation:e})}function wd(e){let t=(0,Q.c)(14),[n,r]=(0,Z.useState)(Ad),[i]=(0,Z.useState)(kd),[a,o]=(0,Z.useState)(i),[s]=(0,Z.useState)(Sd),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{let[t]=e;if(!t)return;let{width:n,height:i}=t.contentRect;n>0&&i>0&&r(e=>e.width===n&&e.height===i?e:{width:n,height:i})},t[0]=c):c=t[0],me(e,c);let l,u;t[1]!==s||t[2]!==a?(l=()=>{s&&Cd(a).catch(Od)},u=[s,a],t[1]=s,t[2]=a,t[3]=l,t[4]=u):(l=t[3],u=t[4]),(0,Z.useEffect)(l,u);let d,f;t[5]===s?(d=t[6],f=t[7]):(d=()=>{if(s)return Ed},f=[s],t[5]=s,t[6]=d,t[7]=f),(0,Z.useEffect)(d,f);let p=!s&&a!==i,m=p?90:0,h=p?n.height:n.width,g=p?n.width:n.height,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>o(Td),t[8]=_):_=t[8];let v;return t[9]!==a||t[10]!==m||t[11]!==h||t[12]!==g?(v={orientation:a,rotation:m,width:h,height:g,toggle:_},t[9]=a,t[10]=m,t[11]=h,t[12]=g,t[13]=v):v=t[13],v}function Td(e){return e===`portrait`?`landscape`:`portrait`}function Ed(){Cd(`portrait`).catch(Dd)}function Dd(){}function Od(){}function kd(){return window.innerWidth>window.innerHeight?`landscape`:`portrait`}function Ad(){return{width:window.innerWidth,height:window.innerHeight}}var jd=(e,t)=>({queryKey:[e,`remote-desktop`,t],queryFn:async({signal:n})=>{let r=()=>{if(e!==u()||t!==f())throw Error(`runtime_changed`)};r();let i=new AbortController,a=()=>i.abort();n.addEventListener(`abort`,a,{once:!0}),n.aborted&&a();let o;try{return await Promise.race([(async()=>{let e=await g(`/api/remote-desktop`,{signal:i.signal,headers:{Accept:`application/json`}});if(r(),[401,403].includes(e.status))throw Error(`authentication_required`);if([404,501].includes(e.status))throw Error(`unsupported`);if(!e.ok)throw Error(`connection_failed`);if(!e.headers.get(`content-type`)?.includes(`application/json`))throw Error(`unsupported`);let t=await e.json();if(r(),!t||typeof t!=`object`||!(`supported`in t)||typeof t.supported!=`boolean`)throw Error(`unsupported`);return{supported:t.supported,enabled:`enabled`in t&&t.enabled===!0}})(),new Promise((e,t)=>{o=setTimeout(()=>{a(),t(Error(`connection_failed`))},1e4)})])}finally{clearTimeout(o),n.removeEventListener(`abort`,a)}},staleTime:3e4,retry:!1,refetchInterval:e=>{let t=e.state.error;return!t||[`unsupported`,`runtime_changed`,`authentication_required`].includes(t.message)?!1:Math.min(1e3*2**Math.min(Math.max(0,e.state.errorUpdateCount-1),5),3e4)},refetchIntervalInBackground:!1}),Md=(e,t)=>{let n=(0,Q.c)(3),r;return n[0]!==t||n[1]!==e?(r=jd(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2],z(r)},Nd=[{key:`Escape`,icon:`corner-up-left`},{key:`Tab`,icon:`arrow-right-to-line`},{key:`Backspace`,icon:`delete-back`},{key:`Enter`,icon:`corner-down-left`},{key:`ArrowLeft`,icon:`arrow-left`},{key:`ArrowUp`,icon:`arrow-up`},{key:`ArrowDown`,icon:`arrow-down`},{key:`ArrowRight`,icon:`arrow-right`}];function Pd({onClose:e,instanceName:t}){let{t:n}=ge(),[r]=Z.useState(()=>({transport:u(),generation:f()})),i=Md(r.transport,r.generation),[a,o]=Z.useState(0),[s,c]=Z.useState(`connecting`),[l,d]=Z.useState(),[p,m]=Z.useState(`drag`),[h,g]=Z.useState(!1),[_,v]=Z.useState(``),y=Z.useRef(null),b=Z.useRef(null),x=wd(b),S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef({width:1,height:1,remoteWidth:1920,remoteHeight:1080}),E=Z.useRef(null),D=Z.useRef(null),O=Z.useRef(new Map),k=Z.useRef(new Set),A=Z.useRef(!1),j=q(e=>{E.current?.send(e)}),M=q(()=>p),[N]=Z.useState(()=>yd({viewport:()=>T.current,send:j,mode:M,apply:(e,t)=>{let n=e.scale>(A.current?1.01:1.05);n!==A.current&&(A.current=n,E.current?.setZoomed(n)),S.current&&(S.current.style.transition=t&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`transform 180ms ease-out`:`none`,S.current.style.transform=`translate(${e.x}px, ${e.y}px) scale(${e.scale})`)}})),P=q(()=>{if(D.current!==null&&cancelAnimationFrame(D.current),D.current=null,O.current.size&&y.current){let e=y.current.getBoundingClientRect(),t=new Map([...O.current].map(([t,n])=>[t,bd(n,e,x.rotation)]));N.moveMany(t)}O.current.clear()}),F=q(()=>{P(),N.reset(),E.current?.close(),E.current=null}),I=q(()=>{F(),e()});ka({id:`remote-desktop-page`,active:!0,layer:`root`,onBack:I,surfaceRef:b}),Z.useEffect(()=>en(`remote-desktop-page`),[]),Z.useLayoutEffect(()=>{let e=document.activeElement;return b.current?.focus({preventScroll:!0}),()=>{e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[]),K(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),ja.requestBrowserBack())},()=>document);let L=q((e,t)=>{(e===`closed`||e===`connecting`)&&(O.current.clear(),k.current.clear(),N.cancel()),c(e),d(t)}),R=q((e,t)=>{if(e<=0||t<=0||T.current.remoteWidth===e&&T.current.remoteHeight===t)return;let n=T.current;T.current={...n,remoteWidth:e,remoteHeight:t},!(Math.abs(n.remoteWidth/n.remoteHeight-e/t)<.01)&&!k.current.size&&N.reset()});me(y,([e])=>{if(!e)return;let{width:t,height:n}=e.contentRect,r=Math.abs(T.current.width-t)>=1||Math.abs(T.current.height-n)>=1;T.current={...T.current,width:t,height:n},r&&!k.current.size&&N.refit()}),Ua(y),Z.useEffect(()=>{if(!i.data?.supported||!i.data.enabled||!C.current||!w.current)return;let e=pd({...r,video:C.current,image:w.current,onSize:R,onState:L});return E.current=e,e.setZoomed(A.current),()=>{e.close(),E.current=null}},[i.data?.supported,i.data?.enabled,r,a,R,L]),Z.useEffect(()=>()=>{P(),N.reset()},[P,N]);let z=e=>{let t=y.current.getBoundingClientRect();return bd({x:e.clientX,y:e.clientY},t,x.rotation)},B=s===`webrtc`||s===`tunnel`,V=i.data?.supported===!1||i.error?.message===`unsupported`,H=i.data?.supported===!0&&i.data.enabled!==!0,ee=V||l===`helper_unavailable`?n(`remoteDesktop.unsupported`):H||l===`disabled`?n(`settings.remoteDesktop.disabled`):l===`permission_required`?n(`remoteDesktop.permissions`):l===`permission_denied`?n(`remoteDesktop.denied`):l===`runtime_changed`||i.error?.message===`runtime_changed`?n(`remoteDesktop.runtimeChanged`):l||i.error||s===`closed`?n(`remoteDesktop.failed`):n(`remoteDesktop.connecting`);return(0,Zs.createPortal)((0,$.jsx)(`div`,{ref:b,tabIndex:-1,"data-remote-desktop-page":!0,className:`yuri-keyboard-inset-surface yuri-keyboard-inset-snap fixed inset-0 z-[150] overflow-clip bg-background text-foreground outline-none`,children:(0,$.jsxs)(`main`,{"aria-label":t?`${n(`remoteDesktop.title`)} · ${t}`:n(`remoteDesktop.title`),className:`absolute left-0 top-0 flex flex-col overflow-clip bg-background`,style:{width:x.width,height:x.height,transformOrigin:`top left`,"--desktop-safe-top":`env(safe-area-inset-${x.rotation===90?`right`:x.rotation===-90?`left`:`top`}, 0px)`,"--desktop-safe-right":`env(safe-area-inset-${x.rotation===90?`bottom`:x.rotation===-90?`top`:`right`}, 0px)`,"--desktop-safe-bottom":`env(safe-area-inset-${x.rotation===90?`left`:x.rotation===-90?`right`:`bottom`}, 0px)`,"--desktop-safe-left":`env(safe-area-inset-${x.rotation===90?`top`:x.rotation===-90?`bottom`:`left`}, 0px)`,transform:x.rotation===90?`translateX(${x.height}px) rotate(90deg)`:x.rotation===-90?`translateY(${x.width}px) rotate(-90deg)`:void 0},children:[(0,$.jsxs)(`div`,{"data-remote-desktop-stage-region":!0,className:`relative min-h-0 flex-1 overflow-clip`,children:[(0,$.jsxs)(`div`,{ref:y,className:`absolute inset-0 touch-none overflow-clip bg-background`,"aria-label":n(`remoteDesktop.screen`),onPointerDown:e=>{B&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),k.current.add(e.pointerId),P(),N.down(e.pointerId,z(e)))},onPointerMove:e=>{!B||!k.current.has(e.pointerId)||(e.preventDefault(),O.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),D.current===null&&(D.current=requestAnimationFrame(P)))},onPointerUp:e=>{P(),N.up(e.pointerId,z(e)),k.current.delete(e.pointerId),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:e=>{P(),N.up(e.pointerId,z(e),!0),k.current.delete(e.pointerId)},onContextMenu:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{ref:S,className:`absolute inset-0 origin-top-left will-change-transform`,children:[(0,$.jsx)(`video`,{ref:C,autoPlay:!0,muted:!0,playsInline:!0,className:`pointer-events-none absolute inset-0 size-full object-contain`,style:{visibility:s===`webrtc`?`visible`:`hidden`}}),(0,$.jsx)(`img`,{ref:w,alt:n(`remoteDesktop.screen`),draggable:!1,className:`pointer-events-none absolute inset-0 size-full object-contain`,style:{visibility:s===`tunnel`?`visible`:`hidden`}})]}),!B&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 p-6 text-center text-sm text-muted-foreground`,role:`status`,children:[s===`connecting`&&!l&&!i.error&&!V&&!H&&(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin`}),(0,$.jsx)(`p`,{children:ee}),(s===`closed`||i.error||H)&&!V&&l!==`runtime_changed`&&i.error?.message!==`runtime_changed`&&(0,$.jsx)(Y,{onClick:()=>{F(),d(void 0),c(`connecting`),i.error||H?i.refetch():o(e=>e+1)},children:n(`remoteDesktop.retry`)})]})]}),(0,$.jsxs)(`div`,{className:`pointer-events-none absolute left-[max(0.75rem,var(--desktop-safe-left))] right-[max(0.75rem,var(--desktop-safe-right))] top-[max(0.75rem,var(--desktop-safe-top))] flex items-start justify-between gap-3`,children:[(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto`,"aria-label":n(`header.actions.backAria`),onClick:()=>ja.requestBrowserBack(),children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto`,"aria-label":n(`remoteDesktop.rotate`),title:n(`remoteDesktop.rotate`),onClick:()=>{P(),N.reset(),g(!1),x.toggle()},children:(0,$.jsx)(X,{name:`smartphone`,className:`size-5 rotate-45`})})]}),(0,$.jsx)(`p`,{className:`sr-only`,children:n(`remoteDesktop.hint`)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-[max(0.75rem,var(--desktop-safe-left))] right-[max(0.75rem,var(--desktop-safe-right))] bottom-[max(0.75rem,var(--desktop-safe-bottom))] top-[calc(4rem+var(--desktop-safe-top))] flex flex-col items-end justify-end gap-3`,children:(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 items-end justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`pointer-events-auto flex gap-3`,children:[(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:p===`drag`?`yuri-mobile-inverse-action`:void 0,"aria-label":n(`remoteDesktop.drag`),title:n(`remoteDesktop.drag`),"aria-pressed":p===`drag`,disabled:!B,onClick:()=>{P(),N.cancel(),m(`drag`)},children:(0,$.jsx)(X,{name:`hand`,className:`size-5`})}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:p===`cursor`?`yuri-mobile-inverse-action`:void 0,"aria-label":n(`remoteDesktop.cursor`),title:n(`remoteDesktop.cursor`),"aria-pressed":p===`cursor`,disabled:!B,onClick:()=>{P(),N.cancel(),m(`cursor`)},children:(0,$.jsx)(X,{name:`cursor`,className:`size-5`})})]}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto${h?` yuri-mobile-inverse-action`:``}`,disabled:!B,"aria-label":n(`remoteDesktop.text`),title:n(`remoteDesktop.text`),"aria-pressed":h,"aria-expanded":h,onClick:()=>g(e=>!e),children:(0,$.jsx)(X,{name:`keyboard`,className:`size-5`})})]})})]}),h&&(0,$.jsxs)(`footer`,{"data-remote-desktop-keyboard":!0,className:`max-h-[50%] w-full shrink-0 overflow-y-auto overscroll-contain border-t border-border bg-[var(--surface-elevated)] pt-3 pl-[max(0.75rem,var(--desktop-safe-left))] pr-[max(0.75rem,var(--desktop-safe-right))] pb-[max(0.75rem,var(--desktop-safe-bottom))]`,children:[(0,$.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),_&&B&&(j({type:`text`,text:_}),v(``))},children:[(0,$.jsx)(On,{className:`min-w-0 flex-1`,value:_,maxLength:1024,onChange:e=>v(e.target.value),placeholder:n(`remoteDesktop.text`),"aria-label":n(`remoteDesktop.text`),disabled:!B,autoComplete:`off`}),(0,$.jsx)(Y,{type:`submit`,size:`icon`,disabled:!B||!_,"aria-label":n(`remoteDesktop.send`),children:(0,$.jsx)(X,{name:`send-plane-2`,className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`mt-2 grid grid-cols-4 gap-1 min-[360px]:grid-cols-8`,children:Nd.map(({key:e,icon:t})=>(0,$.jsx)(Y,{size:`icon`,variant:`ghost`,className:`w-full`,disabled:!B,onClick:()=>j({type:`key`,key:e}),"aria-label":n(`remoteDesktop.pressKey`,{key:e}),title:n(`remoteDesktop.pressKey`,{key:e}),children:(0,$.jsx)(X,{name:t,className:`size-4`})},e))})]})]})}),document.body)}var Fd=Z.memo(Pd);function Id(e){let t=(0,Q.c)(30),{percentage:n,pending:r}=e,i=r!==void 0&&r,{t:a}=ge(),o,s,c,l,u,d,f,p,m;if(t[0]!==i||t[1]!==n||t[2]!==a){c=i?0:Nn(n)??0;let e=In(n);s=i?`var(--surface-muted-foreground)`:e===`critical`?`var(--status-error)`:e===`warn`?`var(--status-warning)`:`var(--status-success)`,o=2*Math.PI*7.5,l=`0 0 18 18`,u=`size-[18px] -rotate-90`,d=`progressbar`,t[12]===a?f=t[13]:(f=a(`contextUsage.aria.label`),t[12]=a,t[13]=f),t[14]!==i||t[15]!==a?(p=i?a(`contextUsage.pending`):void 0,t[14]=i,t[15]=a,t[16]=p):p=t[16],m=i?void 0:Math.round(c),t[0]=i,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];let h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`circle`,{cx:9,cy:9,r:7.5,fill:`none`,stroke:`var(--interactive-border)`,strokeWidth:3}),t[17]=h):h=t[17];let g=o*(1-c/100),_;t[18]!==o||t[19]!==s||t[20]!==g?(_=(0,$.jsx)(`circle`,{cx:9,cy:9,r:7.5,fill:`none`,stroke:s,strokeWidth:3,strokeLinecap:`round`,strokeDasharray:o,strokeDashoffset:g,className:`transition-[stroke-dashoffset,stroke] duration-300`}),t[18]=o,t[19]=s,t[20]=g,t[21]=_):_=t[21];let v;return t[22]!==_||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m?(v=(0,$.jsxs)(`svg`,{viewBox:l,className:u,role:d,"aria-label":f,"aria-valuetext":p,"aria-valuenow":m,"aria-valuemin":0,"aria-valuemax":100,children:[h,_]}),t[22]=_,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=v):v=t[29],v}function Ld(e){let t=(0,Q.c)(19),{title:n,subtitle:r,onBack:i,onOpenMenu:a,menuOpen:o,elevated:s,trailing:c}=e,l=o!==void 0&&o,u=s!==void 0&&s,{t:d}=ge(),f=q(i),p=q(a),m;t[0]===d?m=t[1]:(m=d(`header.actions.backAria`),t[0]=d,t[1]=m);let h=u||l,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(ta,{mobile:!0}),t[2]=g):g=t[2];let _;t[3]===c?_=t[4]:(_=(0,$.jsxs)($.Fragment,{children:[g,c]}),t[3]=c,t[4]=_);let v;t[5]===d?v=t[6]:(v=d(`mobile.menu.titleAria`),t[5]=d,t[6]=v);let y;t[7]!==p||t[8]!==l||t[9]!==v?(y=[{icon:`more-2`,ariaLabel:v,onClick:p,pressed:l}],t[7]=p,t[8]=l,t[9]=v,t[10]=y):y=t[10];let b;return t[11]!==f||t[12]!==r||t[13]!==m||t[14]!==h||t[15]!==_||t[16]!==y||t[17]!==n?(b=(0,$.jsx)(Ae,{title:n,subtitle:r,backAriaLabel:m,onBack:f,overlay:!0,collapsible:!0,elevated:h,trailing:_,actions:y}),t[11]=f,t[12]=r,t[13]=m,t[14]=h,t[15]=_,t[16]=y,t[17]=n,t[18]=b):b=t[18],b}var Rd=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zd=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e),Bd=e=>e>=90?`text-[var(--status-error)]`:e>=75?`text-[var(--status-warning)]`:`text-[var(--status-success)]`,Vd=e=>{let{totalTokens:t,contextLimit:n,isDraft:r}=e;if(!r&&t===null)return{pending:!0,percentage:0,tokens:`—`,colorClass:`text-muted-foreground`};if(t===null||r||t<=0||n<=0)return null;let i=Math.min(t/n*100,999);return{percentage:i,tokens:`${zd(t)}/${zd(n)}`,colorClass:Bd(i)}},Hd=e=>{for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.role!==`user`)continue;let r=typeof n.model?.providerID==`string`&&n.model.providerID.trim().length>0?n.model.providerID:void 0,i=typeof n.model?.modelID==`string`&&n.model.modelID.trim().length>0?n.model.modelID:void 0;if(r&&i)return{providerID:r,modelID:i}}return null},Ud=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Wd=e=>{let t=e.usedPercent;return typeof t!=`number`||!Number.isFinite(t)?`text-foreground`:t>=80?`text-[var(--status-error)]`:t>=50?`text-[var(--status-warning)]`:`text-foreground`},Gd=e=>{let t=(0,Q.c)(13),{iconNode:n,iconName:r,label:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o=n??(r?(0,$.jsx)(X,{name:r,className:`size-[18px]`}):null),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]===o?s=t[4]:(s=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:o}),t[3]=o,t[4]=s);let c;t[5]===i?c=t[6]:(c=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:i}),t[5]=i,t[6]=c);let l;t[7]===a?l=t[8]:(l=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-right typography-ui-label font-medium text-foreground`,children:a}),t[7]=a,t[8]=l);let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5`,children:[s,c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u},Kd=e=>{let t=(0,Q.c)(30),{groups:n,displayMode:r,isLoading:i,timeFormatPreference:a}=e,{t:o}=ge(),s;t[0]!==r||t[1]!==o?(s=o(r===`remaining`?`header.services.remaining`:`header.services.used`),t[0]=r,t[1]=o,t[2]=s):s=t[2];let c=s;if(n.length===0)return null;let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(X,{name:`timer`,className:`size-[18px]`})}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=o(`mobile.header.metadata.usage`),t[4]=o,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:u}),t[6]=u,t[7]=d);let f;t[8]===i?f=t[9]:(f=i?(0,$.jsx)(X,{name:`refresh`,className:`size-3.5 animate-spin`}):null,t[8]=i,t[9]=f);let p;t[10]===c?p=t[11]:(p=(0,$.jsx)(`span`,{className:`truncate`,children:c}),t[10]=c,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-center justify-end gap-1.5 typography-ui-label text-muted-foreground`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 px-2.5 pb-1.5`,children:[l,d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;if(t[18]!==r||t[19]!==n||t[20]!==a){let e;t[22]!==r||t[23]!==a?(e=e=>(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-[var(--surface-muted)] p-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(br,{providerId:e.providerId,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground`,children:e.providerName}),e.status&&e.rows.length===0?(0,$.jsx)(`span`,{className:`min-w-0 max-w-[60%] truncate typography-micro text-muted-foreground`,children:e.status}):null]}),e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:e.rows.map((t,n)=>{let i=Gi(e.rows.map(mf),n),o=r===`remaining`?t.window.remainingPercent:t.window.usedPercent,s=Ln(t.window.valueLabel,o),c=Mn(t.window.resetAt,t.window.resetAfterFormatted??t.window.resetAtFormatted,a);return(0,$.jsxs)(Z.Fragment,{children:[i?(0,$.jsx)(`div`,{className:J(`typography-micro font-medium uppercase tracking-wide text-muted-foreground`,n>0&&`mt-3 border-t border-[var(--surface-subtle)] pt-2`),children:i}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate typography-ui-label text-muted-foreground`,children:t.subtitle?`${t.subtitle} · ${t.label}`:t.label}),c?(0,$.jsx)(`span`,{className:`min-w-0 truncate typography-micro text-muted-foreground/70`,children:c}):null]}),(0,$.jsx)(`span`,{className:J(`min-w-0 max-w-[60%] shrink-0 truncate typography-ui-label font-semibold tabular-nums`,Wd(t.window)),children:s===`-`?``:s})]})]},t.key)})}):null,e.status&&e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 truncate typography-micro text-muted-foreground`,title:e.status,children:e.status}):null]},e.providerId),t[22]=r,t[23]=a,t[24]=e):e=t[24],g=n.map(e),t[18]=r,t[19]=n,t[20]=a,t[21]=g}else g=t[21];let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(`div`,{className:`space-y-1.5`,children:g}),t[25]=g,t[26]=_);let v;return t[27]!==_||t[28]!==h?(v=(0,$.jsxs)(`div`,{className:`pt-2.5`,children:[h,_]}),t[27]=_,t[28]=h,t[29]=v):v=t[29],v},qd=e=>{let t=(0,Q.c)(47),{open:n,onClose:r,contextDisplay:i,branchLabel:a,usageGroups:o,usageDisplayMode:s,isUsageLoading:c,timeFormatPreference:l}=e,{t:u}=ge(),d=Z.useRef(null),[f,p]=Z.useState(n),[m,h]=Z.useState(!1),g,_;t[0]!==n||t[1]!==f?(g=()=>{if(n){p(!0),h(!1);return}if(!f)return;h(!0);let e=window.setTimeout(()=>{p(!1),h(!1)},140);return()=>window.clearTimeout(e)},_=[n,f],t[0]=n,t[1]=f,t[2]=g,t[3]=_):(g=t[2],_=t[3]),Z.useEffect(g,_);let v,y;if(t[4]!==r||t[5]!==n?(v=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},y=[r,n],t[4]=r,t[5]=n,t[6]=v,t[7]=y):(v=t[6],y=t[7]),Z.useEffect(v,y),!f)return null;let b;t[8]===u?b=t[9]:(b=u(`mobile.surface.closeAria`),t[8]=u,t[9]=b);let x;t[10]===r?x=t[11]:(x=e=>{e.preventDefault(),r()},t[10]=r,t[11]=x);let S;t[12]!==b||t[13]!==x?(S=(0,$.jsx)(`button`,{type:`button`,className:`pointer-events-auto absolute inset-x-0 bottom-0 cursor-default top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.25rem)]`,"aria-label":b,onPointerDown:x}),t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]===u?C=t[16]:(C=u(`mobile.header.openMetadataAria`),t[15]=u,t[16]=C);let w=m&&`pointer-events-none`,T;t[17]===w?T=t[18]:(T=J(`pointer-events-auto absolute inset-x-3 top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.5rem)] overflow-x-hidden overflow-y-auto overscroll-contain rounded-[20px] yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent p-2 will-change-transform`,w),t[17]=w,t[18]=T);let E=`${m?`session-metadata-out`:`session-metadata-in`} ${m?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`,D;t[19]===E?D=t[20]:(D={animation:E,maxHeight:`min(72dvh, calc(100dvh - var(--yuri-safe-area-top, 0px) - var(--yuri-mobile-detail-navigation-height, 3.5rem) - 1rem))`},t[19]=E,t[20]=D);let O;t[21]===u?O=t[22]:(O=u(`mobile.header.metadata.branch`),t[21]=u,t[22]=O);let k;t[23]!==a||t[24]!==O?(k=(0,$.jsx)(Gd,{iconName:`git-branch`,label:O,children:a}),t[23]=a,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==u?(A=i?(0,$.jsx)(Gd,{iconNode:(0,$.jsx)(Id,{percentage:i.percentage,pending:i.pending}),label:u(`mobile.header.metadata.context`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 tabular-nums`,children:[(0,$.jsx)(`span`,{className:J(`font-semibold`,i.colorClass),children:i.pending?u(`contextUsage.pending`):`${i.percentage.toFixed(1)}%`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:i.tokens})]})}):null,t[26]=i,t[27]=u,t[28]=A):A=t[28];let j;t[29]!==c||t[30]!==l||t[31]!==s||t[32]!==o?(j=(0,$.jsx)(Kd,{groups:o,displayMode:s,isLoading:c,timeFormatPreference:l}),t[29]=c,t[30]=l,t[31]=s,t[32]=o,t[33]=j):j=t[33];let M;t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[k,A,j]}),t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let N;t[38]!==T||t[39]!==D||t[40]!==M||t[41]!==C?(N=(0,$.jsx)(`div`,{ref:d,role:`dialog`,"aria-label":C,className:T,style:D,onPointerDown:hf,children:M}),t[38]=T,t[39]=D,t[40]=M,t[41]=C,t[42]=N):N=t[42];let P;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`style`,{children:`
|
|
7
|
-
@keyframes session-metadata-in {
|
|
8
|
-
from { opacity: 0; transform: translateY(-8px) scale(0.985); }
|
|
9
|
-
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
10
|
-
}
|
|
11
|
-
@keyframes session-metadata-out {
|
|
12
|
-
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
13
|
-
to { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
14
|
-
}
|
|
15
|
-
`}),t[43]=P):P=t[43];let F;return t[44]!==N||t[45]!==S?(F=(0,$.jsxs)(`div`,{className:`fixed inset-0 z-40 pointer-events-none`,children:[S,N,P]}),t[44]=N,t[45]=S,t[46]=F):F=t[46],F};function Jd(e){let t=(0,Q.c)(97),{sessionId:n,open:r,onOpenChange:i}=e,{t:a}=ge(),{git:o}=te(),[s,c]=Z.useState(!1),l=r!==void 0,u=l?r:s,d=n.length===0,f;t[0]!==l||t[1]!==i||t[2]!==u?(f=e=>{let t=typeof e==`function`?e(u):e;l||c(t),i?.(t)},t[0]=l,t[1]=i,t[2]=u,t[3]=f):f=t[3];let p=q(f),m=j(pf),h;t[4]===n?h=t[5]:(h=e=>n?e.getDirectoryForSession(n):null,t[4]=n,t[5]=h);let g=ft(h)||m,_;t[6]===g?_=t[7]:(_=Ud(g)||null,t[6]=g,t[7]=_);let v=_,y=ct(n,g||void 0),b=gr(v),x=vr(v),S=yr(ff),C=yr(df),w=ze(uf),T=ze(lf),E=ze(cf),D=ze(sf),O;t[8]===n?O=t[9]:(O=e=>n?e.sessionModelSelections.get(n)??null:null,t[8]=n,t[9]=O);let k=Ge(O),A=Zr(of),M=Zr(af),N=Zr(rf),P=Zr(nf),F=Zr(tf),L=Zr(ef),R=Zr($d),z=I(Qd);Xr();let B;t[10]===p?B=t[11]:(B=()=>{p(!1)},t[10]=p,t[11]=B);let V;t[12]!==g||t[13]!==n?(V=[n,g],t[12]=g,t[13]=n,t[14]=V):V=t[14],Z.useEffect(B,V);let H,ee;t[15]!==S||t[16]!==o||t[17]!==v?(H=()=>{v&&S(v,o)},ee=[S,o,v],t[15]=S,t[16]=o,t[17]=v,t[18]=H,t[19]=ee):(H=t[18],ee=t[19]),Z.useEffect(H,ee);let ne,U;t[20]!==C||t[21]!==o||t[22]!==v?(U=()=>{if(v)return Ze.onGitRefreshHint(e=>{Ud(e.directory)===v&&C(v,o)})},ne=[C,o,v],t[20]=C,t[21]=o,t[22]=v,t[23]=ne,t[24]=U):(ne=t[23],U=t[24]),Z.useEffect(U,ne);let re,ie;t[25]===M?(re=t[26],ie=t[27]):(re=()=>{M()},ie=[M],t[25]=M,t[26]=re,t[27]=ie),Z.useEffect(re,ie);let W,ae;t[28]===L?(W=t[29],ae=t[30]):(W=()=>{xr(L)},ae=[L],t[28]=L,t[29]=W,t[30]=ae),Z.useEffect(W,ae);let oe,G;t[31]!==L||t[32]!==N||t[33]!==P||t[34]!==u||t[35]!==A?(oe=()=>{!u||P||L.some(e=>!A.some(t=>t?.providerId===e))&&N()},G=[L,N,P,u,A],t[31]=L,t[32]=N,t[33]=P,t[34]=u,t[35]=A,t[36]=oe,t[37]=G):(oe=t[36],G=t[37]),Z.useEffect(oe,G);let se;t[38]===y?se=t[39]:(se=Hd(y),t[38]=y,t[39]=se);let ce=se,le;t[40]!==E||t[41]!==T||t[42]!==ce||t[43]!==k?(le=ce??(k?{providerID:k.providerId,modelID:k.modelId}:null)??(T&&E?{providerID:T,modelID:E}:null),t[40]=E,t[41]=T,t[42]=ce,t[43]=k,t[44]=le):le=t[44];let ue=le,de;if(t[45]!==D||t[46]!==ue||t[47]!==w){let e=(ue?w.find(e=>e.id===ue.providerID):void 0)?.models.find(e=>e.id===ue?.modelID),n;t[49]!==D||t[50]!==ue?(n=ue?D(ue.providerID,ue.modelID):void 0,t[49]=D,t[50]=ue,t[51]=n):n=t[51];let r=n;de=Rd(e?.limit,`context`)??r?.limit?.context??0,t[45]=D,t[46]=ue,t[47]=w,t[48]=de}else de=t[48];let fe=de,K=St(n,fe,0,g||void 0),pe=K?.pending?null:K?.totalTokens??0,me;t[52]!==fe||t[53]!==d||t[54]!==pe?(me=Vd({totalTokens:pe,contextLimit:fe,isDraft:d}),t[52]=fe,t[53]=d,t[54]=pe,t[55]=me):me=t[55];let he=me,_e;t[56]!==x?.current||t[57]!==b||t[58]!==a?(_e=b===!0?x?.current?.trim()||a(`gitView.branch.detachedHead`):a(`common.unavailable`),t[56]=x?.current,t[57]=b,t[58]=a,t[59]=_e):_e=t[59];let ve=_e,ye;if(t[60]!==L||t[61]!==A||t[62]!==R||t[63]!==a){let e=new Map(A.map(Zd)),n;t[65]===L?n=t[66]:(n=e=>L.includes(e.id),t[65]=L,t[66]=n),ye=Yr(A).filter(n).filter(t=>e.get(t.id)?.configured===!0).map(t=>{let n=e.get(t.id),r=[];for(let[e,t]of yi(Object.entries(n?.usage?.windows??{}),n?.usage?.accounts))r.push({key:`window-${e}`,label:jn(t.label??e),window:t});let i=Object.entries(n?.usage?.models??{}),o=R[t.id]??[],s=o.length>0?i.filter(e=>{let[t]=e;return o.includes(t)}):i;for(let[e,t]of s){let n=Object.entries(t.windows??{});if(n.length===0)continue;let[i,a]=n[0];r.push({key:`model-${e}-${i}`,label:jn(a.label??i),subtitle:$r(e),window:a})}let c=!n.ok&&n.error?n.error:r.length===0?a(`header.services.noRateLimitsReported`):null;return{providerId:t.id,providerName:t.name,rows:r,status:c}}),t[60]=L,t[61]=A,t[62]=R,t[63]=a,t[64]=ye}else ye=t[64];let be=ye,xe,Se;t[67]!==u||t[68]!==be?(xe=()=>{!u||be.length===0||xr(be.map(Xd))},Se=[u,be],t[67]=u,t[68]=be,t[69]=xe,t[70]=Se):(xe=t[69],Se=t[70]),Z.useEffect(xe,Se);let Ce;t[71]===p?Ce=t[72]:(Ce=()=>{p(Yd)},t[71]=p,t[72]=Ce);let we=q(Ce),Te;t[73]===p?Te=t[74]:(Te=()=>{p(!1)},t[73]=p,t[74]=Te);let Ee=q(Te),De;t[75]===a?De=t[76]:(De=a(`mobile.header.openMetadataAria`),t[75]=a,t[76]=De);let Oe=he?.percentage??0,ke=he?.pending,Ae;t[77]!==Oe||t[78]!==ke?(Ae=(0,$.jsx)(Id,{percentage:Oe,pending:ke}),t[77]=Oe,t[78]=ke,t[79]=Ae):Ae=t[79];let je;t[80]!==we||t[81]!==u||t[82]!==De||t[83]!==Ae?(je=(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,"aria-label":De,"aria-expanded":u,onClick:we,children:Ae})}),t[80]=we,t[81]=u,t[82]=De,t[83]=Ae,t[84]=je):je=t[84];let Me;t[85]!==ve||t[86]!==he||t[87]!==Ee||t[88]!==P||t[89]!==u||t[90]!==F||t[91]!==z||t[92]!==be?(Me=(0,$.jsx)(qd,{open:u,onClose:Ee,contextDisplay:he,branchLabel:ve,usageGroups:be,usageDisplayMode:F,isUsageLoading:P,timeFormatPreference:z}),t[85]=ve,t[86]=he,t[87]=Ee,t[88]=P,t[89]=u,t[90]=F,t[91]=z,t[92]=be,t[93]=Me):Me=t[93];let Ne;return t[94]!==je||t[95]!==Me?(Ne=(0,$.jsxs)($.Fragment,{children:[je,Me]}),t[94]=je,t[95]=Me,t[96]=Ne):Ne=t[96],Ne}function Yd(e){return!e}function Xd(e){return e.providerId}function Zd(e){return[e?.providerId,e]}function Qd(e){return e.timeFormatPreference}function $d(e){return e.selectedModels}function ef(e){return e.dropdownProviderIds}function tf(e){return e.displayMode}function nf(e){return e.isLoading}function rf(e){return e.fetchAllQuotas}function af(e){return e.loadSettings}function of(e){return e.results}function sf(e){return e.getModelMetadata}function cf(e){return e.currentModelId}function lf(e){return e.currentProviderId}function uf(e){return e.providers}function df(e){return e.fetchStatus}function ff(e){return e.ensureStatus}function pf(e){return e.currentDirectory}function mf(e){return e.window}function hf(e){e.stopPropagation()}function gf(e){return e.sessionId?e.userRefreshInFlight||e.backgroundResyncInFlight?`syncing`:e.hasRenderableTranscript?null:!e.isConnected&&e.connectionPhase===`reconnecting`||e.loadStatus!==`error`?`syncing`:null:null}function _f(e,t){let n=t?.showDelayMs??250,r=t?.hideGraceMs??1e3,i=!1,a=!1,o=null,s=()=>{o=null,a!==i&&(a=i,e(a))};return{setRaw(e){i=e,o&&clearTimeout(o),o=setTimeout(s,i?n:r)},cancel(){i=!1,o&&=(clearTimeout(o),null)}}}function vf(e,t){let n=(0,Q.c)(10),r;n[0]===t?r=n[1]:(r={key:t},n[0]=t,n[1]=r);let i=r,a;n[2]===i?a=n[3]:(a={scope:i,visible:!1},n[2]=i,n[3]=a);let[o,s]=(0,Z.useState)(a),c;n[4]===i?c=n[5]:(c=_f(e=>s({scope:i,visible:e})),n[4]=i,n[5]=c);let l=c,u,d;return n[6]!==e||n[7]!==l?(u=()=>(l.setRaw(e),()=>l.cancel()),d=[e,l],n[6]=e,n[7]=l,n[8]=u,n[9]=d):(u=n[8],d=n[9]),(0,Z.useEffect)(u,d),o.scope===i&&o.visible}function yf(e,t){let n=(0,Q.c)(20),{t:r}=ge(),i=bt(e,t),{renderable:a}=Je(e,t),o=ze(Cf),s=ze(Sf),c;n[0]!==t||n[1]!==e?(c=()=>A(e,t),n[0]=t,n[1]=e,n[2]=c):c=n[2];let l=(0,Z.useSyncExternalStore)(O,c,xf),u;n[3]!==t||n[4]!==e?(u=()=>Xe(e,t),n[3]=t,n[4]=e,n[5]=u):u=n[5];let d=(0,Z.useSyncExternalStore)(st,u,bf),f=i?.status,p;n[6]!==d||n[7]!==s||n[8]!==a||n[9]!==o||n[10]!==e||n[11]!==f||n[12]!==l?(p=gf({sessionId:e,hasRenderableTranscript:a,loadStatus:f,userRefreshInFlight:l,backgroundResyncInFlight:d,isConnected:o,connectionPhase:s}),n[6]=d,n[7]=s,n[8]=a,n[9]=o,n[10]=e,n[11]=f,n[12]=l,n[13]=p):p=n[13];let m=p,h;n[14]!==t||n[15]!==e?(h=JSON.stringify([t,e]),n[14]=t,n[15]=e,n[16]=h):h=n[16];let g=vf(m===`syncing`,h),_;return n[17]!==r||n[18]!==g?(_=g?r(`mobile.chat.syncingMessages`):null,n[17]=r,n[18]=g,n[19]=_):_=n[19],_}function bf(){return!1}function xf(){return!1}function Sf(e){return e.connectionPhase}function Cf(e){return e.isConnected}function wf(e){let t=(0,Q.c)(32),{sessionId:n,directory:r,title:i,onBack:a,onOpenMenu:o,onCloseMenu:s,menuOpen:c,children:l,className:u}=e,d=c!==void 0&&c,{t:f}=ge(),p=n.length===0,m=Le(p?null:n),h;t[0]!==p||t[1]!==m?.title||t[2]!==f||t[3]!==i?(h=p?i?.trim()||f(`mobile.menu.newSession`):i?.trim()||m?.title?.trim()||f(`mobile.sessions.untitled`),t[0]=p,t[1]=m?.title,t[2]=f,t[3]=i,t[4]=h):h=t[4];let g=h,_=yf(p?``:n,r||void 0),[v,y]=Z.useState(!1),b;t[5]!==d||t[6]!==s?(b=e=>{e&&d&&s?.(),y(e)},t[5]=d,t[6]=s,t[7]=b):b=t[7];let x=q(b),S;t[8]!==v||t[9]!==o?(S=()=>{v&&y(!1),o()},t[8]=v,t[9]=o,t[10]=S):S=t[10];let C=q(S),w=d||v,T;t[11]===u?T=t[12]:(T=J(`mobile-chat-screen relative isolate flex h-full min-h-0 w-full flex-col overflow-hidden bg-background text-foreground`,u),t[11]=u,t[12]=T);let E;t[13]!==v||t[14]!==x||t[15]!==n?(E=(0,$.jsx)(Jd,{sessionId:n,open:v,onOpenChange:x}),t[13]=v,t[14]=x,t[15]=n,t[16]=E):E=t[16];let D;t[17]!==C||t[18]!==w||t[19]!==d||t[20]!==a||t[21]!==g||t[22]!==_||t[23]!==E?(D=(0,$.jsx)(Ld,{title:g,subtitle:_,onBack:a,onOpenMenu:C,menuOpen:d,elevated:w,trailing:E}),t[17]=C,t[18]=w,t[19]=d,t[20]=a,t[21]=g,t[22]=_,t[23]=E,t[24]=D):D=t[24];let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=J(`mobile-chat-screen__content relative h-full min-h-0 flex-1`,`[&_[data-scrollbar=chat]>.yuri-chat-scroll-content]:pt-[calc(max(0.625rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height)+1.25rem)]`),t[25]=O):O=t[25];let k;t[26]===l?k=t[27]:(k=(0,$.jsx)(`div`,{className:O,children:l}),t[26]=l,t[27]=k);let A;return t[28]!==T||t[29]!==D||t[30]!==k?(A=(0,$.jsxs)(`main`,{className:T,children:[D,k]}),t[28]=T,t[29]=D,t[30]=k,t[31]=A):A=t[31],A}function Tf(e){let t=(0,Q.c)(4),n=e===void 0?2500:e,{uiFont:r}=ii(),[i,a]=Z.useState(!1),o,s;return t[0]!==n||t[1]!==r?(o=()=>{let e=!1,t=()=>{e||a(!0)},i=()=>{requestAnimationFrame(()=>requestAnimationFrame(t))},o=Promise.all([xn(r).catch(Af),document.fonts?.ready?.then(kf).catch(Of)??Promise.resolve(),qa.catch(Df)]).then(Ef),s=new Promise(e=>{window.setTimeout(e,n)});return Promise.race([o,s]).then(i),()=>{e=!0}},s=[r,n],t[0]=n,t[1]=r,t[2]=o,t[3]=s):(o=t[2],s=t[3]),Z.useEffect(o,s),i}function Ef(){}function Df(){}function Of(){}function kf(){}function Af(){}var jf=e=>e.replace(/^\/+|\/+$/g,``),Mf=e=>{let t=e.get(`directory`)||e.get(`dir`)||e.get(`path`);if(typeof t!=`string`)return;let n=t.trim();return n.length>0?n:void 0},Nf=e=>{let t=jf(e.pathname).split(`/`).filter(Boolean);return e.host?[e.host,...t]:t};function Pf(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(![`yuri:`,`openchamber:`,`openchambery:`].includes(t.protocol))return null;let n=Nf(t),r=(n[0]??``).toLowerCase(),i=n.slice(1),a=t.searchParams;switch(r){case`connect`:{let t=Ca(e);return t?{type:`connect`,pairing:t}:null}case`session`:{let e=i[0]||a.get(`id`)||``;return e?{type:`session`,sessionId:e,directory:Mf(a)}:null}case`assistant`:{let e=i[0]||a.get(`id`)||``;return e?{type:`assistant`,assistantId:e}:null}case`new`:case`new-session`:{let e=a.get(`prompt`)?.trim();return{type:`new-session`,directory:Mf(a),projectId:a.get(`project`)??void 0,agent:a.get(`agent`)??void 0,model:a.get(`model`)??void 0,prompt:e||void 0}}case`project`:case`open-project`:{let e;if(i.length>0)try{e=decodeURIComponent(i.join(`/`))}catch{e=i.join(`/`)}let t=Mf(a)||e;return t?{type:`open-project`,directory:t}:null}case`sessions`:{let e=a.get(`filter`);return{type:`sessions`,filter:e===`attention`||e===`recent`||e===`all`?e:void 0}}case`status`:return{type:`status`};case`settings`:return{type:`settings`,section:i[0]||a.get(`section`)||void 0};case`changes`:return{type:`changes`,path:i.join(`/`)||a.get(`path`)||void 0,staged:a.get(`staged`)===`true`};case`view`:{let e=(i[0]||``).toLowerCase();return e===`changes`?{type:`changes`}:e===`files`||e===`mcp`||e===`instances`||e===`update`?{type:`view`,target:e}:null}default:return null}}var Ff={},If=null,Lf=!1,Rf=null,zf=e=>{switch(e.type){case`connect`:return If?(If(e.pairing),!0):!1;case`session`:return v()?(ft.getState().setCurrentSession(e.sessionId,e.directory??null),!0):(yt.getState().openSession({sessionId:e.sessionId,directory:e.directory??null}),!0);case`assistant`:if(!v()){let t=yt.getState();return t.setActiveTab(`assistant`),t.openAssistant(e.assistantId),!0}return At(e.assistantId),!0;case`new-session`:return v()?(ft.getState().openNewSessionDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0):(yt.getState().openDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0);case`open-project`:return v()?(ft.getState().openNewSessionDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0):(yt.getState().openDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0);case`sessions`:return Ff.openSessions?(Ff.openSessions(e.filter),!0):!1;case`status`:return Ff.openSessions?(Ff.openSessions(),!0):(I.getState().setMobileSessionPanelOpen(!0),!0);case`view`:return Ff.openView?(Ff.openView(e.target),!0):!1;case`changes`:return Ff.openChanges?(Ff.openChanges({path:e.path,staged:e.staged}),!0):!1;case`settings`:return Ff.openSettings?(Ff.openSettings(e.section),!0):!1}return!1},Bf=()=>{if(!Rf||!Lf&&Rf.type!==`connect`)return;let e=Rf;Rf=null,zf(e)||(Rf=e)},Vf=e=>{Rf=e,Bf()},Hf=e=>{let t=Pf(e);t&&Vf(t)},Uf=e=>{Lf=e,Bf()},Wf=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Ff=e,Bf(),()=>{Ff===e&&(Ff={})}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Gf=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(If=e,Bf(),()=>{If===e&&(If=null)}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Kf=e=>{let{ready:t}=e,[n,r]=Z.useState(()=>_()?`pending`:`none`);return Z.useEffect(()=>{Uf(t)},[t]),Z.useEffect(()=>{if(!_())return;let e=!1,t=[];return ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:n})=>{if(e)return;let i=await n.addListener(`appUrlOpen`,e=>{Hf(e?.url)});if(e){i.remove();return}t.push(()=>void i.remove());let a=await n.getLaunchUrl().catch(()=>void 0);if(e)return;let o=Pf(a?.url);r(o?.type===`connect`?`connect`:o?`other`:`none`),o&&Vf(o)}).catch(()=>{e||r(`none`)}),ae(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([79,1,2])).then(async({PushNotifications:n})=>{if(e)return;let r=await n.addListener(`pushNotificationActionPerformed`,e=>{let t=e?.notification?.data,n=typeof t?.url==`string`?t.url:typeof t?.deeplink==`string`?t.deeplink:void 0;if(n){Hf(n);return}let r=typeof t?.assistantID==`string`?t.assistantID.trim():``;if(r){Vf({type:`assistant`,assistantId:r});return}let i=typeof t?.sessionId==`string`?t.sessionId:void 0;i&&Vf({type:`session`,sessionId:i})});if(e){r.remove();return}t.push(()=>void r.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e())}},[]),n},qf=.85,Jf=8,Yf=.35,Xf=.22,Zf=e=>({segmentStart:e,lastTouch:e,open:!1}),Qf=e=>e*Yf,$f=e=>e*Xf,ep=(e,t)=>Math.max(0,e-t),tp=(e,t)=>Math.max(0,t-e),np=(e,t)=>{let n=Math.abs(e);return n<Jf||Math.abs(t)<=n*qf},rp=(e,t,n)=>{let r=t.clientX-e.segmentStart.clientX,i=t.clientY-e.segmentStart.clientY,a=ep(e.segmentStart.clientX,t.clientX),o=Qf(n),s=$f(n),c=e.open;return c=a<=0?!1:e.open?a>=s:a>=o&&np(r,i),{segmentStart:e.segmentStart,lastTouch:t,open:c}},ip=e=>{if(e.disabled||e.startedOnExcludedTarget)return{open:!1,back:!1};let t=e.endX-e.startX,n=e.endY-e.startY,r=ep(e.startX,e.endX),i=tp(e.startX,e.endX),a=Qf(e.viewportWidth),o=np(t,n);return{open:r>=a&&o,back:i>=a&&o}},ap=(e,t,n)=>Math.min(ep(e,t)/Math.max(1,Qf(n)),1),op=(e,t,n)=>Math.min(tp(e,t)/Math.max(1,Qf(n)),1),sp=e=>{let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth)return!0;t=t.parentElement}return!1},cp=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!!t?.closest(`.yuri-mobile-composer`)||sp(t)},lp=1,up=(e,t)=>{if(!e||e.rangeCount===0||e.isCollapsed)return!1;if(!t)return!0;let n=e.anchorNode;if(!n)return!1;let r=n.nodeType===lp?n:n.parentElement;return!!(r&&t.contains(r))},dp=e=>up(window.getSelection(),e),fp=(e,t,n)=>{let r=Z.useRef(t.onOpen);r.current=t.onOpen;let i=Z.useRef(t.onPreviewStart);i.current=t.onPreviewStart;let a=Z.useRef(t.onPreviewCancel);a.current=t.onPreviewCancel;let o=Z.useRef(t.onProgress);o.current=t.onProgress;let s=Z.useRef(t.onBack);s.current=t.onBack;let c=Z.useRef(t.onBackProgress);c.current=t.onBackProgress;let l=Z.useRef(t.disabled);l.current=t.disabled,Z.useEffect(()=>{let t=e.current;if(!t)return;let n=!1,u=!1,d=null,f=!1,p=!1,m=!1,h=0,g=0,_=null,v=e=>{let t=Qf(g),n=Qe({thresholdReached:p,distance:e,enterDistance:t,cancelDistance:$f(g),available:!0});p=n.thresholdReached,n.event===`enter`&&(m=nt(`medium`,{bypassCadence:!0})),n.event===`cancel`&&(nt(`light`,{bypassCadence:!0}),m=!1)},y=e=>{o.current?.(null),p&&!e&&nt(`light`,{bypassCadence:!0}),p=!1,m=!1,e?r.current():f&&a.current?.(),f=!1},b=e=>{c.current?.(null),p&&!e&&nt(`light`,{bypassCadence:!0}),p=!1,m=!1,e&&s.current?.()},x=e=>{if(e.touches.length!==1){n=!1,_=null;return}if(l.current){n=!1,_=null;return}let r=e.touches[0];n=!0,g=window.innerWidth,u=cp(r)||dp(t),d=null,f=!1,p=!1,m=!1,h=0,_=Zf(r)},S=e=>{if(!n||u||!_)return;if(e.touches.length!==1){d===`sessions`&&y(!1),d===`back`&&b(!1),n=!1,_=null;return}let r=e.touches[0];_=rp(_,r,g);let a=r.clientX-_.segmentStart.clientX,l=r.clientY-_.segmentStart.clientY;if(d===null){if(dp(t))return;let e=Math.abs(a);if(e<Jf||Math.abs(l)>e*qf)return;if(a<0)d=`sessions`,f=!0,i.current?.();else if(s.current)d=`back`;else return}e.preventDefault(),h=d===`sessions`?ep(_.segmentStart.clientX,r.clientX):tp(_.segmentStart.clientX,r.clientX),v(h),d===`sessions`?o.current?.(ap(_.segmentStart.clientX,r.clientX,g)):c.current?.(op(_.segmentStart.clientX,r.clientX,g))},C=e=>{if(!n||!_)return;if(n=!1,!d){_=null;return}let t=e.changedTouches[0];t&&(_=rp(_,t,g),h=d===`sessions`?ep(_.segmentStart.clientX,t.clientX):tp(_.segmentStart.clientX,t.clientX),v(h));let r=d===`sessions`?_.open:ip({startX:_.segmentStart.clientX,startY:_.segmentStart.clientY,endX:_.lastTouch.clientX,endY:_.lastTouch.clientY,viewportWidth:g,disabled:!1,startedOnExcludedTarget:!1}).back;_=null,e.preventDefault(),r&&!m&&nt(`medium`,{bypassCadence:!0}),d===`sessions`?y(r):b(r)},w=()=>{d===`sessions`&&y(!1),d===`back`&&b(!1),n=!1,_=null};return t.addEventListener(`touchstart`,x,{passive:!0,capture:!0}),t.addEventListener(`touchmove`,S,{passive:!1,capture:!0}),t.addEventListener(`touchend`,C,{passive:!1,capture:!0}),t.addEventListener(`touchcancel`,w,{passive:!0,capture:!0}),()=>{f&&y(!1),d===`back`&&b(!1),t.removeEventListener(`touchstart`,x,!0),t.removeEventListener(`touchmove`,S,!0),t.removeEventListener(`touchend`,C,!0),t.removeEventListener(`touchcancel`,w,!0)}},[e,n])},pp=ie(`YuriNotifications`),mp=()=>W.getPlatform()===`android`&&W.isPluginAvailable(`YuriNotifications`);async function hp(e,n){let r=p(),a=t(),o=a?``:h();if(!a&&!/^https?:\/\//.test(o))return null;let s=await i();s.set(`Accept-Language`,n);let c=(await Se()).find(e=>we(e)===r)?.candidates.find(e=>e.kind===`relay`);return{runtimeKey:r,baseUrl:o,relay:a??(c?.kind===`relay`?c.relay:void 0),preferRelay:!!a,headers:Object.fromEntries(s.entries()),labels:e}}function gp(e){let t=0,n=!1;return{refresh:async()=>{let r=++t;try{if(await e.plugin.stop(),n||r!==t)return;let i=await e.resolveConfig();if(n||r!==t||!i)return;let a=await e.plugin.configure({config:i});!n&&r===t&&e.onState(a.state)}catch{!n&&r===t&&e.onError()}},stop:()=>{++t,e.plugin.stop().catch(e.onError)},dispose:()=>{n=!0,++t,e.plugin.stop().catch(e.onError)}}}var _p=()=>{if(mp()||typeof window>`u`)return!1;let e=window.Capacitor?.getPlatform?.();return e===`ios`||e===`android`},vp=(e,t)=>{x()?.push?.registerApnsToken?.({token:e,platform:y(),locale:t})},yp=e=>{let{enabled:t}=e,n=I(e=>e.nativeNotificationsEnabled),r=_e(e=>e.locale),i=Z.useRef(null),a=Z.useRef(r);a.current=r,Z.useEffect(()=>{if(!t||!n||!_p())return;let e=!1,r=[];return ae(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([79,1,2])).then(async({PushNotifications:t})=>{if(e)return;let n=await t.checkPermissions().catch(()=>null);if(n?.receive!==`granted`&&(n=await t.requestPermissions().catch(()=>null)),n?.receive!==`granted`)return;let o=await t.addListener(`registration`,e=>{i.current=e.value,vp(e.value,a.current)}),s=await t.addListener(`registrationError`,e=>{console.warn(`[Push] APNs registration error:`,e)});if(await t.register().catch(()=>void 0),e){o.remove(),s.remove();return}r.push(()=>void o.remove(),()=>void s.remove())}).catch(()=>void 0),()=>{e=!0,r.forEach(e=>e())}},[t,n]),Z.useEffect(()=>{if(!t||!n||!_p())return;let e=i.current;e&&vp(e,r)},[t,n,r]),Z.useEffect(()=>{if(n)return;let e=i.current;e&&(i.current=null,x()?.push?.unregisterApnsToken?.({token:e}))},[n])},bp=`YuriLiveActivity`,xp=5e3,Sp=3600,Cp=`live`,wp=ie(bp),Tp=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable;function Ep(){return typeof window>`u`?!1:Tp({isCapacitor:_(),platform:y(),pluginAvailable:W.isPluginAvailable(bp)})}var Dp=()=>wp,Op=new Set([`permission`,`input`,`retry`]),kp=()=>({trackedSessionId:null,started:!1,startedAt:null,busySince:null,lastStatus:null,eventVersion:0,items:[]}),Ap=(e,t)=>Math.max(Math.floor(e),t+1),jp=e=>e.failedEpoch===e.currentEpoch?e.previous:e.current,Mp=e=>e.failedEpoch===e.currentEpoch&&e.retryCount<1,Np=e=>e.hasSessionError?`error`:e.hasPendingPermissions?`permission`:e.hasPendingQuestions?`input`:e.statusType===`retry`?`retry`:e.statusType===`busy`?`working`:e.statusType===`idle`?`complete`:null,Pp=e=>{let t=e.trim();return t.length<=80?t:`${t.slice(0,79)}…`},Fp=e=>typeof e.parentID==`string`&&e.parentID.length>0?e.parentID:null,Ip=e=>{if(e.runningIds.size===0)return[];let t=[];for(let n of e.sessions)!e.runningIds.has(n.id)||Fp(n)||t.push({sessionId:n.id,title:Pp(n.title??``),statusType:e.statuses[n.id]?.type??`busy`});return t},Lp=e=>e!==`complete`&&e!==`error`,Rp=e=>e.some(e=>e.status===`permission`)?`permission`:e.some(e=>e.status===`input`)?`input`:e.some(e=>e.status===`retry`)?`retry`:e.some(e=>e.status===`tool`)?`tool`:e.some(e=>e.status===`stale`)?`stale`:e.some(e=>e.status===`working`)?`working`:e.some(e=>e.status===`error`)?`error`:`complete`,zp=e=>{if(e.length<=4)return e;let t=e.filter(e=>Lp(e.status)),n=e.filter(e=>!Lp(e.status)).sort((e,t)=>(t.endedAt??0)-(e.endedAt??0)),r=[...t];for(let e of n){if(r.length>=4)break;r.push(e)}return r.slice(0,4)},Bp=(e,t,n,r)=>{if(n&&n.length>0)return n;let i=r?.[e];return i&&i.length>0?i:t},Vp=(e,t,n,r,i)=>{let a=new Map;for(let e of t)a.set(e.sessionId,e);let o=[],s=new Set;for(let t of e){if(i&&!i.has(t.sessionId))continue;let e=a.get(t.sessionId);if(e){let i=Np({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:t.sessionId,title:Bp(t.sessionId,t.title,e.title,r),status:i,startedAt:t.startedAt,busySince:i===`working`?t.busySince??n:null})}else if(Lp(t.status))o.push({...t,title:Bp(t.sessionId,t.title,void 0,r),status:`complete`,endedAt:n,busySince:null});else{let e=Bp(t.sessionId,t.title,void 0,r);o.push(e===t.title?t:{...t,title:e})}s.add(t.sessionId)}for(let e of t){if(s.has(e.sessionId))continue;let t=Np({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:e.sessionId,title:e.title,status:t,startedAt:n,busySince:t===`working`?n:null})}return zp(o)},Hp=e=>e.map(e=>`${e.sessionId}\0${e.title}\0${e.status}\0${e.endedAt??``}`).join(`
|
|
16
|
-
`),Up=e=>e.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:e.startedAt};return e.endedAt!==void 0&&(t.endedAt=e.endedAt),t}),Wp=(e,t,n,r,i)=>{let a=e.filter(e=>Lp(e.status)),o=a[0]??e[0],s={sessionId:Cp,startedAt:o?.startedAt??r,status:t,eventVersion:n,updatedAt:r,title:o?.title,workingCount:a.length,items:Up(e)};return i?.endedAt!==void 0&&(s.endedAt=i.endedAt),i?.dismissalSeconds!==void 0&&(s.dismissalSeconds=i.dismissalSeconds),s},Gp=e=>{let t={sessionId:e.sessionId,startedAt:e.startedAt,status:e.status,eventVersion:e.eventVersion,updatedAt:e.updatedAt};return e.endedAt!==void 0&&(t.endedAt=e.endedAt),e.dismissalSeconds!==void 0&&(t.dismissalSeconds=e.dismissalSeconds),e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items),t},Kp=(e,t,n,r)=>{let i=e.trackedSessionId;if(!i||!e.started)return{state:kp(),commands:[]};let a=Ap(t,e.eventVersion);return{state:kp(),commands:[{type:`end`,payload:Gp({sessionId:i,startedAt:e.startedAt??t,status:n,eventVersion:a,updatedAt:t,endedAt:t,dismissalSeconds:r})}]}},qp=(e,t,n,r,i)=>{let a=Ap(r,i);return{state:{trackedSessionId:e,started:!0,startedAt:n,busySince:null,lastStatus:t,eventVersion:a,items:[]},commands:[{type:`start`,payload:Gp({sessionId:e,startedAt:n,status:t,eventVersion:a,updatedAt:r})}]}},Jp=(e,t,n)=>{let r=Np(t),i=e.busySince;if(r===`working`?i??=t.now:(!e.started&&!r||!e.started&&r===`complete`||!e.started&&r===`error`)&&(i=null),!e.started){if(r===`working`){let r=xp-(t.now-(i??t.now));if(r>0)return{state:{...e,trackedSessionId:n,busySince:i},commands:[{type:`wait`,delayMs:r}]}}else if(!r||!Op.has(r))return{state:{...kp(),trackedSessionId:n},commands:[]};return qp(n,r,i??t.now,t.now,e.eventVersion)}if(r===`complete`)return Kp({...e,busySince:i},t.now,`complete`,900);if(r===`error`)return Kp({...e,busySince:i},t.now,`error`,Sp);if(!r||r===e.lastStatus)return{state:{...e,trackedSessionId:n,busySince:i},commands:[]};let a=Ap(t.now,e.eventVersion);return{state:{trackedSessionId:n,started:!0,startedAt:e.startedAt??t.now,busySince:r===`working`?i:null,lastStatus:r,eventVersion:a,items:e.items},commands:[{type:`update`,payload:Gp({sessionId:n,startedAt:e.startedAt??t.now,status:r,eventVersion:a,updatedAt:t.now})}]}},Yp=(e,t,n)=>{let r=e.trackedSessionId;if(!r||!e.started)return{state:e,commands:[]};let i=Ap(n,e.eventVersion);return{state:{...e,busySince:null,lastStatus:t,eventVersion:i},commands:[{type:`update`,payload:Gp({sessionId:r,startedAt:e.startedAt??n,status:t,eventVersion:i,updatedAt:n})}]}},Xp=(e,t,n)=>{let r=Vp(e.items,n,t.now,t.sessionTitles,t.rootSessionIds),i=r.filter(e=>Lp(e.status)),a=Rp(r),o=i.reduce((e,t)=>{let n=t.busySince??t.startedAt;return e===null||n<e?n:e},null);if(!t.connected){let n=e.busySince===null?e:{...e,busySince:null};if(!n.started||n.lastStatus===`stale`)return{state:{...n,items:r},commands:[]};let i=Ap(t.now,n.eventVersion),a=r.map(e=>Lp(e.status)?{...e,status:`stale`}:e);return{state:{...n,items:a,lastStatus:`stale`,eventVersion:i,busySince:null},commands:[{type:`update`,payload:Gp(Wp(a,`stale`,i,t.now))}]}}if(!e.started){if(i.length===0)return{state:kp(),commands:[]};if(!i.some(e=>Op.has(e.status))){let n=xp-(t.now-(o??t.now));if(n>0)return{state:{...e,trackedSessionId:Cp,items:r,busySince:o},commands:[{type:`wait`,delayMs:n}]}}let n=o??t.now,s=r.map(e=>Lp(e.status)?{...e,startedAt:e.busySince??n}:e),c=Ap(t.now,e.eventVersion);return{state:{trackedSessionId:Cp,started:!0,startedAt:n,busySince:null,lastStatus:a,eventVersion:c,items:s},commands:[{type:`start`,payload:Gp(Wp(s,a,c,t.now))}]}}if(i.length===0){let n=r.some(e=>e.status===`error`)?`error`:`complete`,i=Ap(t.now,e.eventVersion);return{state:kp(),commands:[{type:`end`,payload:Gp(Wp(r,n,i,t.now,{endedAt:t.now,dismissalSeconds:n===`error`?Sp:900}))}]}}if(Hp(e.items)===Hp(r)&&e.lastStatus===a)return{state:{...e,trackedSessionId:Cp,items:r,busySince:null},commands:[]};let s=Ap(t.now,e.eventVersion);return{state:{trackedSessionId:Cp,started:!0,startedAt:e.startedAt??o??t.now,busySince:null,lastStatus:a,eventVersion:s,items:r},commands:[{type:`update`,payload:Gp(Wp(r,a,s,t.now))}]}},Zp=(e,t)=>{if(t.catalog)return Xp(e,t,t.catalog);if(!t.connected){let n=e.busySince===null?e:{...e,busySince:null};return!n.started||n.lastStatus===`stale`||!n.trackedSessionId?{state:n,commands:[]}:Yp(n,`stale`,t.now)}let n=[],r=e;if(r.trackedSessionId&&r.trackedSessionId!==t.sessionId)if(r.started){let e=Kp(r,t.now,r.lastStatus??`complete`,0);n.push(...e.commands),r=e.state}else r=kp();if(!t.sessionId){if(r.started){let e=Kp(r,t.now,`complete`,900);return{state:e.state,commands:[...n,...e.commands]}}return{state:kp(),commands:n}}let i=Jp(r,t,t.sessionId);return{state:i.state,commands:[...n,...i.commands]}},Qp=e=>e/1e3,$p=e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:Qp(e.startedAt)};return e.endedAt!==void 0&&(t.endedAt=Qp(e.endedAt)),t},em=e=>{let t={sessionId:e.sessionId,startedAt:Qp(e.startedAt),status:e.status,eventVersion:e.eventVersion,updatedAt:Qp(e.updatedAt)};return e.endedAt!==void 0&&(t.endedAt=Qp(e.endedAt)),e.dismissalSeconds!==void 0&&(t.dismissalSeconds=e.dismissalSeconds),e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items.map($p)),t},tm=e=>{let t={};return e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items),t},nm=(e,t,n)=>{if(!e||n.type===`wait`)return Promise.resolve();let r=em(n.payload),i=tm(r);return n.type===`start`?t.start({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,...i}):n.type===`update`?t.update({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,...i}):t.end({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,endedAt:r.endedAt,dismissalSeconds:r.dismissalSeconds,...i})},rm=e=>e.getCurrentEpoch()===e.epoch?!e.getCurrentSessionId||e.getCurrentSessionId()===e.observation.sessionId:!1,im=async e=>{let t=e.state;if(!rm(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let n=Zp(t,e.observation),r=n.commands.find(e=>e.type===`wait`),i=r?.type===`wait`?r.delayMs:null,a=n.commands.filter(e=>e.type!==`wait`);if(a.length===0)return rm(e)?{state:n.state,delayMs:i,retry:!1,superseded:!1}:{state:t,delayMs:null,retry:!1,superseded:!0};let o=t;try{for(let[r,i]of a.entries()){if(!rm(e)||(await nm(e.available,e.plugin,i),!rm(e)))return{state:t,delayMs:null,retry:!1,superseded:!0};let s=r===a.length-1;o=i.type===`end`&&!s?kp():n.state}return{state:n.state,delayMs:i,retry:!1,superseded:!1}}catch{if(!rm(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let r=jp({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),previous:o,current:n.state}),i=Mp({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),retryCount:e.retryCount});return{state:r,delayMs:i?250:null,retry:i,superseded:!1}}},am=()=>({desired:null,registered:null}),om=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null},sm=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=om(t.activityId),r=om(t.sessionId),i=om(t.token);return!n||!r||!i?null:{activityId:n,sessionId:r,token:i}},cm=(e,t)=>e.activityId===t.activityId&&e.token===t.token,lm=(e,t)=>{let n=e.registered?.runtimeIdentity===t?e.registered:null;return e.desired===null&&n===e.registered?e:{desired:null,registered:n}},um=(e,t)=>{if(!t.connected)return[];if(e.desired&&t.enabled&&t.selectedSessionId&&e.desired.sessionId===t.selectedSessionId){let n=e.registered;return n&&cm(n,e.desired)&&n.runtimeIdentity===t.runtimeIdentity?[]:[{type:`register`,payload:{activityId:e.desired.activityId,sessionId:e.desired.sessionId,token:e.desired.token},runtimeIdentity:t.runtimeIdentity}]}return e.registered&&e.registered.runtimeIdentity===t.runtimeIdentity?[{type:`unregister`,payload:{token:e.registered.token},runtimeIdentity:t.runtimeIdentity}]:[]},dm=(e,t,n)=>{let r=e;if(n.type===`pushToken`){if(!t.enabled||n.sessionId!==t.selectedSessionId)return{state:e,commands:[]};r={...e,desired:{activityId:n.activityId,sessionId:n.sessionId,token:n.token}}}else n.type===`localEndSucceeded`||n.type===`dispose`||!t.enabled||e.desired&&e.desired.sessionId!==t.selectedSessionId?r=lm(e,t.runtimeIdentity):e.registered&&e.registered.runtimeIdentity!==t.runtimeIdentity&&!e.desired&&(r={...e,registered:null});return{state:r,commands:um(r,t)}},fm=async e=>{try{return await e}catch{return null}},pm=async e=>{let t=e.state;for(let n of e.commands){if(n.runtimeIdentity!==e.getRuntimeIdentity()){n.type===`unregister`&&t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}if(n.type===`register`){let r=t.registered;if(n.runtimeIdentity!==e.getRuntimeIdentity()||(await fm(e.register(n.payload)))?.ok!==!0||n.runtimeIdentity!==e.getRuntimeIdentity())continue;if(t={...t,registered:{...n.payload,runtimeIdentity:n.runtimeIdentity}},r&&r.runtimeIdentity===n.runtimeIdentity&&r.token!==n.payload.token){if(n.runtimeIdentity!==e.getRuntimeIdentity())continue;await fm(e.unregister({token:r.token}))}continue}if(n.runtimeIdentity!==e.getRuntimeIdentity()){t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}(await fm(e.unregister(n.payload)))?.ok===!0&&t.registered?.token===n.payload.token&&(t={...t,registered:null})}return t},mm=new Map,hm=[];function gm(){let e=Ep(),t=ze(e=>e.isConnected),n=Ot({enabled:e}),r=Be(t=>e?t.statusById:mm),i=dt(t=>e?t.activeSessions:hm),a=(0,Z.useMemo)(()=>e?Pe(n,r):new Set,[e,r,n]),o=(0,Z.useMemo)(()=>e?Ip({runningIds:a,statuses:n,sessions:i}):[],[e,n,a,i]),s=(0,Z.useMemo)(()=>{if(!e)return{};let t={};for(let e of i){let n=e.parentID;if(typeof n==`string`&&n.length>0)continue;let r=typeof e.title==`string`?e.title.trim():``;r&&(t[e.id]=r.length<=80?r:`${r.slice(0,79)}…`)}return t},[e,i]),l=(0,Z.useMemo)(()=>{if(!e)return new Set;let t=new Set;for(let e of i){let n=e.parentID;typeof n==`string`&&n.length>0||t.add(e.id)}return t},[e,i]),d=(0,Z.useMemo)(()=>[o.map(e=>`${e.sessionId}\0${e.title}\0${e.statusType??``}`).join(`
|
|
17
|
-
`),Object.entries(s).map(([e,t])=>`${e}\0${t}`).join(`
|
|
18
|
-
`)].join(`
|
|
19
|
-
---
|
|
20
|
-
`),[o,s]),f=(0,Z.useRef)(kp()),p=(0,Z.useRef)(am()),m=(0,Z.useRef)(null),h=(0,Z.useRef)(0),g=(0,Z.useRef)(Promise.resolve()),_=(0,Z.useRef)(Promise.resolve()),v=(0,Z.useRef)(null),y=q(()=>({sessionId:Cp,statusType:void 0,hasPendingPermissions:!1,hasPendingQuestions:!1,hasSessionError:!1,now:Date.now(),connected:t,catalog:o,sessionTitles:s,rootSessionIds:l})),b=q(n=>{_.current=_.current.then(async()=>{let r=dm(p.current,{selectedSessionId:Cp,runtimeIdentity:u(),connected:t,enabled:e},n);p.current=r.state,r.commands.length!==0&&(p.current=await pm({state:p.current,commands:r.commands,getRuntimeIdentity:u,register:e=>x()?.push?.registerLiveActivityToken?.({...e,items:f.current.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:Qp(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:Qp(e.endedAt)}})})??Promise.resolve(null),unregister:e=>x()?.push?.unregisterLiveActivityToken?.(e)??Promise.resolve(null)}))}).catch(()=>void 0)}),S=q(e=>{let t=sm(e);t&&b({type:`pushToken`,...t,sessionId:Cp})});(0,Z.useEffect)(()=>{b({type:e?`sync`:`dispose`})},[e,t]),(0,Z.useEffect)(()=>c(()=>{b({type:`sync`})}),[]),(0,Z.useEffect)(()=>{if(!e){v.current?.remove(),v.current=null;return}let t=!1,n=null,r=0,i=Dp(),a=h.current+1;h.current=a;let o=()=>{g.current=g.current.then(async()=>{if(t||h.current!==a)return;if(m.current!==!0){if(m.current===!1)return;let e=await i.isSupported().catch(()=>({supported:!1}));if(t||h.current!==a||(m.current=e.supported===!0,!m.current))return}let e=y(),s=f.current.started,c=await im({available:!0,plugin:i,state:f.current,observation:e,epoch:a,getCurrentEpoch:()=>h.current,retryCount:r});if(!(t||h.current!==a||c.superseded)){if(f.current=c.state,s&&!c.state.started)b({type:`localEndSucceeded`});else if(c.state.started){let e=p.current.desired;e&&x()?.push?.registerLiveActivityToken?.({activityId:e.activityId,sessionId:Cp,token:e.token,items:c.state.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:Qp(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:Qp(e.endedAt)}})})}c.retry?r+=1:r=0,c.delayMs!=null&&(n=setTimeout(()=>{o()},c.delayMs))}}).catch(()=>void 0)};return g.current=g.current.then(async()=>{if(!(t||h.current!==a)&&!v.current)try{let e=await i.addListener(`pushToken`,e=>{S(e)});if(t){await e.remove();return}v.current=e}catch{return}}).then(()=>{!t&&h.current===a&&o()}).catch(()=>void 0),()=>{t=!0,h.current===a&&(h.current+=1),n!==null&&clearTimeout(n)}},[e,t,d]),(0,Z.useEffect)(()=>()=>{v.current?.remove(),v.current=null,b({type:`dispose`})},[])}function _m(){let e=(0,Q.c)(49),t=I(ym),{t:r,locale:i}=ge(),a;e[0]===r?a=e[1]:(a=r(`mobile.notifications.service`),e[0]=r,e[1]=a);let o=a,s;e[2]===r?s=e[3]:(s=r(`settings.page.notifications.title`),e[2]=r,e[3]=s);let l=s,u;e[4]===r?u=e[5]:(u=r(`mobile.connect.connecting`),e[4]=r,e[5]=u);let d=u,f;e[6]===r?f=e[7]:(f=r(`mobile.notifications.connected`),e[6]=r,e[7]=f);let p=f,m;e[8]===r?m=e[9]:(m=r(`layout.browserProvider.status.reconnecting`),e[8]=r,e[9]=m);let h=m,g;e[10]===r?g=e[11]:(g=r(`mobile.notifications.unavailable`),e[10]=r,e[11]=g);let _=g,v;e[12]===r?v=e[13]:(v=r(`mobile.notifications.gap`),e[12]=r,e[13]=v);let y=v,b;e[14]===r?b=e[15]:(b=r(`settings.notifications.page.toast.permissionDenied.title`),e[14]=r,e[15]=b);let x=b,S;e[16]===r?S=e[17]:(S=r(`settings.notifications.page.template.defaults.error.title`),e[16]=r,e[17]=S);let C=S,w;e[18]===r?w=e[19]:(w=r(`mobile.notifications.auth`),e[18]=r,e[19]=w);let T=w,E;e[20]===r?E=e[21]:(E=r(`mobile.notifications.endpoint`),e[20]=r,e[21]=E);let D=E,O;e[22]===r?O=e[23]:(O=r(`mobile.notifications.response`),e[22]=r,e[23]=O);let k=O,A;e[24]===r?A=e[25]:(A=r(`mobile.notifications.server`),e[24]=r,e[25]=A);let j=A,M;e[26]===r?M=e[27]:(M=r(`mobile.notifications.relay`),e[26]=r,e[27]=M);let N=M,P;e[28]===r?P=e[29]:(P=r(`mobile.notifications.identity`),e[28]=r,e[29]=P);let F=P,L,R;e[30]!==l||e[31]!==T||e[32]!==p||e[33]!==d||e[34]!==x||e[35]!==t||e[36]!==D||e[37]!==C||e[38]!==y||e[39]!==F||e[40]!==i||e[41]!==h||e[42]!==N||e[43]!==k||e[44]!==j||e[45]!==o||e[46]!==_?(L=()=>{if(!mp())return;if(!t){pp.stop().catch(vm);return}let e=!1,r=t=>{e||(e=!0,Ct.error(t))},a=gp({plugin:pp,resolveConfig:()=>hp({service:o,alerts:l,connecting:d,connected:p,reconnecting:h,unavailable:_,gap:y,error:C,auth:T,endpoint:D,response:k,server:j,relay:N,identity:F},i),onState:e=>{(e===`denied`||e===`unavailable`)&&r(e===`denied`?x:_)},onError:()=>r(_)}),s=c(()=>{a.refresh()}),u=n(e=>{let{reason:t}=e;t===`invalidate`?a.stop():t!==`endpoint-switch`&&a.refresh()});return a.refresh(),()=>{s(),u(),a.dispose()}},R=[t,i,o,l,d,p,h,_,y,x,C,T,D,k,j,N,F],e[30]=l,e[31]=T,e[32]=p,e[33]=d,e[34]=x,e[35]=t,e[36]=D,e[37]=C,e[38]=y,e[39]=F,e[40]=i,e[41]=h,e[42]=N,e[43]=k,e[44]=j,e[45]=o,e[46]=_,e[47]=L,e[48]=R):(L=e[47],R=e[48]),(0,Z.useEffect)(L,R)}function vm(){console.warn(`[Native notifications] stop failed`)}function ym(e){return e.nativeNotificationsEnabled}var bm=`mobile-direct-diff`,xm=`mobile-turn-diff`,Sm=`mobile-direct-file`,Cm=`mobile-files`,wm=`mobile-changes`,Tm=`mobile-mcp`,Em=`mobile-settings`,Dm=`mobile-update`,Om=`mobile-overflow-menu`,km=320,Am=380,jm=280,Mm=560,Nm=380,Pm=e=>Math.min(Mm,Math.max(jm,Math.round(e))),Fm=(e,t)=>{let n=e.current;n&&(n.style.width=`${t}px`,n.style.minWidth=`${t}px`,n.style.maxWidth=`${t}px`,n.style.setProperty(`--yuri-ipad-sidebar-width`,`${t}px`))};function Im(e,t,n){let r=(0,Q.c)(17),i=Z.useRef(null),a;r[0]!==n||r[1]!==t?(a=()=>{if(typeof window>`u`)return n;let e=Number.parseInt(window.localStorage.getItem(t)??``,10);return Number.isFinite(e)?Math.min(Mm,Math.max(jm,e)):n},r[0]=n,r[1]=t,r[2]=a):a=r[2];let[o,s]=Z.useState(a),[c,l]=Z.useState(!1),u=Z.useRef(0),d=Z.useRef(o),f=Z.useRef(null),p=Z.useRef(null),m;r[3]===o?m=r[4]:(m=e=>{try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}p.current=e.pointerId,u.current=e.clientX,d.current=o,f.current=o,l(!0),e.preventDefault()},r[3]=o,r[4]=m);let h=q(m),g;r[5]===e?g=r[6]:(g=t=>{if(p.current!==t.pointerId)return;let n=t.clientX-u.current,r=Pm(d.current+(e===`left`?n:-n));f.current!==r&&(f.current=r,Fm(i,r))},r[5]=e,r[6]=g);let _=q(g),v;r[7]===t?v=r[8]:(v=e=>{if(p.current!==e.pointerId)return;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let n=Pm(f.current??d.current);p.current=null,f.current=null,l(!1),s(n);try{window.localStorage.setItem(t,String(n))}catch{}},r[7]=t,r[8]=v);let y=q(v),b;r[9]!==h||r[10]!==y||r[11]!==_?(b={onPointerDown:h,onPointerMove:_,onPointerUp:y,onPointerCancel:y},r[9]=h,r[10]=y,r[11]=_,r[12]=b):b=r[12];let x=b,S;return r[13]!==x||r[14]!==c||r[15]!==o?(S={asideRef:i,width:o,isResizing:c,handleProps:x},r[13]=x,r[14]=c,r[15]=o,r[16]=S):S=r[16],S}var Lm=e=>{let t=(0,Q.c)(12),{side:n,isResizing:r,ariaLabel:i,handleProps:a}=e,o=n===`left`?`right-0`:`left-0`,s;t[0]===o?s=t[1]:(s=J(`absolute inset-y-0 z-30 w-6 cursor-col-resize touch-none`,o),t[0]=o,t[1]=s);let c=n===`left`?`right-0`:`left-0`,l=r&&`bg-[var(--interactive-border)]`,u;t[2]!==c||t[3]!==l?(u=J(`absolute inset-y-0 w-[3px] transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d;t[5]===u?d=t[6]:(d=(0,$.jsx)(`div`,{className:u}),t[5]=u,t[6]=d);let f;return t[7]!==i||t[8]!==a||t[9]!==s||t[10]!==d?(f=(0,$.jsx)(`div`,{className:s,role:`separator`,"aria-orientation":`vertical`,"aria-label":i,...a,children:d}),t[7]=i,t[8]=a,t[9]=s,t[10]=d,t[11]=f):f=t[11],f},Rm=()=>typeof window>`u`?!1:window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`,zm=()=>{Z.useEffect(()=>{if(!Rm())return;document.documentElement.classList.add(`yuri-native-app-active`);let e=!1,t=[],n=document.documentElement;n.classList.add(`yuri-capacitor-app`),window.Capacitor?.getPlatform?.()===`android`&&n.classList.add(`yuri-platform-android`);let r=e=>{n.style.setProperty(`--yuri-keyboard-inset`,`${Math.max(0,Math.round(e))}px`)};return ae(async()=>{let{StatusBar:e,Style:t}=await import(`./vendor-capacitor-status-bar-D9bcMr9Q.js`).then(e=>e.t);return{StatusBar:e,Style:t}},__vite__mapDeps([80,1,2])).then(async({StatusBar:n,Style:r})=>{if(e)return;let i=window.Capacitor?.getPlatform?.(),a=async()=>{if(i===`android`){let e=document.documentElement.classList.contains(`dark`),t=(e?localStorage.getItem(`splashBgDark`):localStorage.getItem(`splashBgLight`))||(e?`#121212`:`#FFFFFF`);await n.setOverlaysWebView({overlay:!1}).catch(()=>void 0),await n.setBackgroundColor({color:t}).catch(()=>void 0),await n.setStyle({style:e?r.Dark:r.Light}).catch(()=>void 0),await n.show().catch(()=>void 0);return}await n.setStyle({style:r.Default}).catch(()=>void 0),await n.setOverlaysWebView({overlay:!0}).catch(()=>void 0),await n.show().catch(()=>void 0)};await a();let o=window.setTimeout(()=>void a(),400);t.push(()=>window.clearTimeout(o));let{App:s}=await ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),c=await s.addListener(`appStateChange`,({isActive:e})=>{e&&a()});if(e){c.remove();return}t.push(()=>void c.remove())}).catch(()=>void 0),ae(async()=>{let{Keyboard:e}=await import(`./vendor-capacitor-keyboard-BRVcFyc9.js`).then(e=>e.t);return{Keyboard:e}},__vite__mapDeps([81,1,2])).then(async({Keyboard:i})=>{if(e)return;let a=window.Capacitor?.getPlatform?.(),o=a===`android`;await i.setAccessoryBarVisible({isVisible:!1}).catch(()=>void 0);let s=`cubic-bezier(0.38, 0.7, 0.125, 1)`,c=null,l=null,u=0,d=!1,f=0,p=!1,m=(e,t)=>{n.style.setProperty(e,`${Math.max(0,Math.round(t))}px`)},h=()=>{c!==null&&(window.clearTimeout(c),c=null)},g=(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))},_=e=>e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`,v=e=>{for(let t of document.querySelectorAll(e))if(_(t))return t;return null},y=e=>e instanceof HTMLElement&&(e.tagName===`TEXTAREA`||e.tagName===`INPUT`||e.isContentEditable),b=()=>{for(let e of document.querySelectorAll(`.yuri-mobile-composer, .yuri-draft-center`))e.style.transition=``,e.style.transform=``},x=()=>{let e=document.querySelector(`.yuri-mobile-app-shell`);f=e&&parseFloat(getComputedStyle(e).paddingBottom)||0},S=!o&&a===`ios`,C=()=>{let e=!n.classList.contains(Dr);e!==w&&(w=e,e&&(r(0),m(`--yuri-kb-layout`,0),m(`--yuri-kb-scroll-inset`,0),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),d=!1,p=!1),n.classList.toggle(`yuri-native-ime`,e),Is.setImeSync({enabled:e}).catch(()=>void 0))},w=null;if(o||S){o&&n.classList.add(`yuri-native-ime`),r(0),m(`--yuri-kb-layout`,0),m(`--yuri-kb-scroll-inset`,0);let i=e=>{let t=e;if(S&&!w)return;let r=t.detail??t;if(typeof r.open!=`boolean`)return;let i=r.phase===`start`;if(n.classList.toggle(`yuri-keyboard-open`,r.open||i),n.classList.toggle(`yuri-kb-animating`,i),i){g(`yuri:keyboard-anim`,{phase:r.open?`show`:`hide`,durationMs:r.durationMs??0,nativeResize:!0});return}!r.open&&y(document.activeElement)&&Hs(document.activeElement)&&document.activeElement.blur(),r.open||g(`yuri:keyboard-intent`,{open:!1}),g(`yuri:keyboard-settled`,{open:r.open,nativeResize:!0})};if(window.addEventListener(`yuri:ime-state`,i),t.push(()=>window.removeEventListener(`yuri:ime-state`,i)),e||t.push(Rs()),o)return;C();let a=new MutationObserver(C);a.observe(n,{attributes:!0,attributeFilter:[`class`]}),t.push(()=>{a.disconnect(),n.classList.remove(`yuri-native-ime`),Is.setImeSync({enabled:!1}).catch(()=>void 0)})}let T=()=>!(S&&w),E=`yuri.iosImeHeightRatio.v1`,D=e=>Number.isFinite(e)?Math.min(.68,Math.max(.28,e)):.39,O=()=>{try{let e=D(Number.parseFloat(localStorage.getItem(E)??``));return Math.round(window.innerHeight*e)}catch{return Math.round(window.innerHeight*.39)}},k=e=>{if(!(e<=0||window.innerHeight<=0))try{localStorage.setItem(E,String(D(e/window.innerHeight)))}catch{}},A=e=>{x();let t=Math.max(0,e-f);r(e),m(`--yuri-kb-layout`,e),m(`--yuri-kb-scroll-inset`,0),d=!0,b(),window.scrollTo(0,0),document.body.scrollTop!==0&&(document.body.scrollTop=0);let n=document.activeElement instanceof Element?document.activeElement.closest(`.yuri-mobile-composer`):null;return(n&&_(n)?n:v(`.yuri-mobile-composer`))?.scrollIntoView({block:`end`,inline:`nearest`}),t},j=e=>{if(!T()||Vs(n.classList.contains(`yuri-native-ios-composer`),document.activeElement)||e.detail?.open!==!0||d||y(document.activeElement)&&!Hs(document.activeElement))return;p=!0,n.classList.remove(`yuri-kb-hide`),n.classList.add(`yuri-keyboard-open`);let t=u>0?u:O(),r=A(t);g(`yuri:keyboard-anim`,{phase:`show`,slide:r,durationMs:0,easing:s}),g(`yuri:keyboard-settled`,{open:!0})};window.addEventListener(`yuri:keyboard-intent`,j);let M=await i.addListener(`keyboardWillShow`,e=>{if(!T()||Vs(n.classList.contains(`yuri-native-ios-composer`),document.activeElement))return;h(),u=e.keyboardHeight,k(u);let t=Hs(document.activeElement)||n.classList.contains(`yuri-keyboard-open`)&&!y(document.activeElement);if(p=!0,n.classList.remove(`yuri-kb-hide`),l!==null&&(window.clearTimeout(l),l=null),!t){r(u),m(`--yuri-kb-layout`,0),x(),m(`--yuri-kb-scroll-inset`,Math.max(0,u-f)),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`),b(),d=!1,g(`yuri:keyboard-settled`,{open:!0});return}n.classList.add(`yuri-keyboard-open`);let i=A(u);g(`yuri:keyboard-settled`,{open:!0}),g(`yuri:keyboard-anim`,{phase:`show`,slide:i,durationMs:0,easing:s})}),N=()=>{let e=document.activeElement;e instanceof HTMLElement&&Hs(e)&&e.blur()},P=()=>{p||(window.scrollTo(0,0),document.body.scrollTop!==0&&(document.body.scrollTop=0))},F=()=>{p=!1,h(),l!==null&&(window.clearTimeout(l),l=null),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),r(0),m(`--yuri-kb-scroll-inset`,0),m(`--yuri-kb-layout`,0),d=!1,b(),P(),window.setTimeout(P,350)},I=()=>{if(!T()){N();return}if(n.classList.contains(`yuri-native-ios-composer`)){F(),Tr().blur(),g(`yuri:keyboard-settled`,{open:!1});return}if(!p)return;p=!1,h(),g(`yuri:keyboard-intent`,{open:!1}),N(),window.setTimeout(()=>{p||Hs(document.activeElement)&&(N(),g(`yuri:keyboard-intent`,{open:!1}))},80),l!==null&&(window.clearTimeout(l),l=null),n.classList.remove(`yuri-kb-caret-hold`,`yuri-kb-animating`);let e=Math.max(0,u-f);n.classList.remove(`yuri-keyboard-open`),r(0),m(`--yuri-kb-scroll-inset`,0),m(`--yuri-kb-layout`,0),d=!1,b(),P(),window.setTimeout(P,350),g(`yuri:keyboard-anim`,{phase:`hide`,slide:e,durationMs:0,easing:s}),n.classList.add(`yuri-kb-animating`,`yuri-kb-hide`),c=window.setTimeout(()=>{c=null,n.classList.remove(`yuri-kb-animating`,`yuri-kb-hide`),g(`yuri:keyboard-settled`,{open:!1})},260)},L=await i.addListener(`keyboardWillHide`,I),R=e=>e instanceof HTMLElement&&(e.tagName===`TEXTAREA`||e.tagName===`INPUT`||e.isContentEditable),z=e=>{if(T()&&p&&R(e.target)){if(Us(e.relatedTarget)){m(`--yuri-kb-scroll-inset`,0);return}window.setTimeout(()=>{if(p&&!Hs(document.activeElement)){if(R(document.activeElement)){h(),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),r(u),m(`--yuri-kb-layout`,0),x(),m(`--yuri-kb-scroll-inset`,Math.max(0,u-f)),d=!1,b(),g(`yuri:keyboard-intent`,{open:!1}),g(`yuri:keyboard-settled`,{open:!0});return}I()}},0)}};if(document.addEventListener(`focusout`,z,!0),e){h(),document.removeEventListener(`focusout`,z,!0),window.removeEventListener(`yuri:keyboard-intent`,j),M.remove(),L.remove();return}t.push(h,()=>{l!==null&&(window.clearTimeout(l),l=null)},()=>document.removeEventListener(`focusout`,z,!0),()=>window.removeEventListener(`yuri:keyboard-intent`,j),()=>void M.remove(),()=>void L.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e()),n.classList.remove(`yuri-capacitor-app`,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`,`yuri-platform-android`),n.style.removeProperty(`--yuri-keyboard-inset`),n.style.removeProperty(`--yuri-kb-shift`),n.style.removeProperty(`--yuri-kb-layout`),n.style.removeProperty(`--yuri-kb-scroll-inset`)}},[])},Bm=e=>{let t=Z.useRef(!1);Z.useEffect(()=>{if(!Rm())return;let n=!1,r=[],i=()=>{t.current&&(t.current=!1,e())},a=()=>{if(document.visibilityState===`hidden`){t.current=!0;return}i()};return document.addEventListener(`visibilitychange`,a),r.push(()=>document.removeEventListener(`visibilitychange`,a)),ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:e})=>{if(n)return;let a=await e.getState().catch(()=>null);if(n)return;a&&document.documentElement.classList.toggle(`yuri-native-app-active`,a.isActive);let o=await e.addListener(`appStateChange`,({isActive:e})=>{if(document.documentElement.classList.toggle(`yuri-native-app-active`,e),!e){t.current=!0;return}i()}),s=await e.addListener(`resume`,i);if(n){o.remove(),s.remove();return}r.push(()=>void o.remove(),()=>void s.remove())}).catch(()=>void 0),()=>{n=!0,r.forEach(e=>e()),document.documentElement.classList.remove(`yuri-native-app-active`)}},[e])},Vm=e=>{Z.useEffect(()=>{if(!Rm())return;let t=!1,n=null;return ae(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:r})=>{if(t)return;let i=await r.addListener(`backButton`,()=>{e()||r.minimizeApp().catch(()=>void 0)});if(t){i.remove();return}n=()=>void i.remove()}).catch(()=>void 0),()=>{t=!0,n?.()}},[e])},Hm=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Um={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},Wm=1e3,Gm=e=>{let t=Hm(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},Km=(e,t)=>Gm(e?e.path:t),qm=({connection:e,onActiveConnectionDeleted:t,onConnect:n})=>{let{t:r}=ge(),i=e,{connections:a,isBusy:o,isPasswordBusy:s,error:c,pendingConnection:l,connect:u,submitPassword:d,cancelPassword:f,renameConnection:p,removeConnection:m,subscribeConnected:h,setError:g}=i,[_,v]=Z.useState(null),y=_?a.find(e=>e.id===_)??null:null,[b,x]=Z.useState(null),[S,C]=Z.useState(``),[w,T]=Z.useState(``),[E,D]=Z.useState(!1),O=Z.useId(),k=Z.useId(),[A,j]=Z.useState(``),[M,N]=Z.useState(!1),P=Z.useMemo(()=>es(),[]),[F,I]=Z.useState(null),[L,R]=Z.useState(null),z=q(()=>{D(!1),T(``),n()});Z.useEffect(()=>h(z),[z,h]);let B=q(()=>{v(null),C(``),R(null),g(null),D(!1)}),V=q(()=>{o||M||(D(!1),g(null))}),H=q(()=>{o||M||B()}),ee=q(e=>{e.preventDefault(),!(!_||!S.trim())&&p(_,S).then(e=>{e&&B()})}),te=q(e=>{i.redeemPairingConnection(e)}),ne=q(()=>{g(r(`mobile.connect.link.invalid`))}),U=q(async()=>{if(!M){g(null),R(null),N(!0);try{let e=await ts();switch(e.status){case`ok`:await u({url:e.url,label:e.label,clientToken:e.clientToken});break;case`pairing`:await i.redeemPairingConnection(e.pairing);break;case`permission-denied`:g(r(`mobile.connect.scan.permissionDenied`));break;case`invalid`:g(r(`mobile.connect.scan.invalid`));break;case`unsupported`:g(r(`mobile.connect.scan.unsupported`));break;case`failed`:g(r(`mobile.connect.scan.failed`))}}catch{g(r(`mobile.connect.scan.failed`))}finally{N(!1)}}}),re=q(e=>{e.preventDefault(),d(A)}),ie=q(()=>{j(``),f()}),W=q(e=>{x(t=>t===e?null:e)}),ae=q(e=>{x(null),_===e&&B();let n=a.length===1;m(e).then(e=>{e&&(n||ye(e))&&t()})});if(l)return l.reason===`pairing`?(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(ya,{label:r(`mobile.connect.pairing.expired`),itemId:`instances.manage`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(X,{name:`computer`,className:`size-6 shrink-0 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate typography-ui-label`,children:l.label}),a.some(e=>e.id===l.id)?(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,disabled:o||M,"aria-label":r(`mobile.instances.deleteAria`,{label:l.label}),onClick:()=>{x(l.id),ie()},children:(0,$.jsx)(X,{name:`delete-bin`,className:`size-5`})}):null]}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:r(`mobile.connect.pairing.reconnectHint`)}),c?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null,P?(0,$.jsxs)(Y,{size:`lg`,disabled:o||M,onClick:()=>void U(),children:[(0,$.jsx)(X,{name:`scan-2`,className:`size-5`}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(Y,{variant:P?`ghost`:`default`,size:`lg`,disabled:o||M,onClick:()=>{ie(),D(!0)},children:r(`mobile.connect.link.useLink`)})]})})}):(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(ya,{label:r(`mobile.connect.password.label`),itemId:`instances.manage`,children:(0,$.jsxs)(`form`,{className:`yuri-settings-group-row flex flex-col gap-3`,onSubmit:re,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[18px] border border-border/70 bg-surface-elevated px-3.5 py-3`,children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground`,children:(0,$.jsx)(X,{name:`lock`,className:`size-[18px]`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate typography-ui-label text-foreground`,children:l.label}),(0,$.jsx)(`p`,{className:`truncate typography-small text-muted-foreground`,children:l.candidates.some(e=>e.kind===`direct`)?Ce(l):r(`mobile.connect.relay.badge`)})]})]}),(0,$.jsx)(`input`,{...Um,value:A,onChange:e=>j(e.target.value),placeholder:r(`mobile.connect.password.placeholder`),"aria-label":r(`mobile.connect.password.label`),type:`password`,autoFocus:!0,className:`h-12 w-full rounded-[16px] border border-border/70 bg-surface-elevated px-4 text-[16px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-primary focus:ring-2 focus:ring-primary/20`}),c?(0,$.jsx)(`p`,{role:`alert`,className:`px-1 typography-small text-[var(--status-error)]`,children:c}):null,(0,$.jsx)(Y,{type:`submit`,size:`lg`,className:`mt-1 h-12 w-full`,disabled:s||!A.trim(),children:r(s?`mobile.connect.connecting`:`mobile.connect.unlockButton`)}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,onClick:ie,children:r(`mobile.connect.cancelPassword`)})]})})});let oe=(0,$.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:ee,children:[(0,$.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,$.jsx)(`span`,{className:`block typography-ui-label text-foreground`,children:r(`mobile.instances.label.label`)}),(0,$.jsx)(On,{value:S,onChange:e=>C(e.target.value),placeholder:r(`mobile.instances.label.placeholder`),autoComplete:`off`,autoCapitalize:`words`,autoCorrect:`off`,spellCheck:!1,maxLength:120,autoFocus:!0,disabled:o||M,className:`h-12 w-full text-[16px]`})]}),c?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null,(0,$.jsx)(Y,{type:`submit`,size:`lg`,className:`w-full`,disabled:o||M||!S.trim(),children:r(`mobile.instances.saveEdit`)})]});return(0,$.jsxs)(`div`,{className:`yuri-settings-page-content`,children:[(0,$.jsx)(ya,{label:r(`mobile.connect.saved.title`),itemId:`instances.manage`,children:a.length>0?a.map(e=>{let t=b===e.id,n=ye(e),i=F===e.id,a=r(i?`mobile.connect.connecting`:n?`mobile.instances.status.connected`:`mobile.instances.status.saved`);return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsxs)(`div`,{className:J(`yuri-settings-group-row relative flex items-center`,t&&`bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]`),children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":r(`desktopHostSwitcher.actions.switchToAria`,{instance:e.label}),"data-mobile-press-feedback":`none`,className:`absolute inset-0 z-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:pointer-events-none`,onClick:()=>{n||(g(null),R(e.id),I(e.id),u({id:e.id,candidates:e.candidates,clientToken:e.clientToken,label:e.label}).finally(()=>I(null)))},disabled:n||o&&!i||t,style:{touchAction:`manipulation`}}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative z-[1] flex min-w-0 flex-1 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`relative flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground`,children:(0,$.jsx)(X,{name:`server`,className:`size-[18px]`})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:(0,$.jsx)(`span`,{className:`block truncate typography-ui-label text-foreground`,children:e.label})}),(0,$.jsx)(`span`,{className:J(`block truncate typography-small`,n&&!i?`text-[var(--status-success)]`:`text-muted-foreground`),children:a})]})]}),(0,$.jsxs)(`div`,{className:`relative z-10 flex shrink-0 items-center gap-0.5 pr-2`,children:[t?(0,$.jsxs)(`button`,{type:`button`,"aria-label":r(`mobile.instances.confirmDeleteAria`,{label:e.label}),className:`flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-destructive px-3 text-destructive-foreground transition-opacity active:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive`,onClick:()=>ae(e.id),style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`delete-bin`,className:`size-[18px]`}),(0,$.jsx)(`span`,{className:`typography-ui-label`,children:r(`mobile.instances.delete`)})]}):i?(0,$.jsx)(`span`,{className:`flex size-9 items-center justify-center text-muted-foreground`,"aria-hidden":!0,children:(0,$.jsx)(X,{name:`loader-4`,className:`size-[18px] animate-spin`})}):(0,$.jsx)(`button`,{type:`button`,"aria-label":r(`mobile.instances.edit`),className:`flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:()=>{v(e.id),C(e.label),R(null),g(null)},style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`edit`,className:`size-[18px]`})}),(0,$.jsx)(`button`,{type:`button`,"aria-label":r(t?`mobile.instances.cancelDeleteAria`:`mobile.instances.deleteAria`,{label:e.label}),className:`flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:()=>W(e.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:t?`close`:`delete-bin`,className:`size-[18px]`})})]})]}),c&&L===e.id&&!t?(0,$.jsx)(`div`,{className:`yuri-settings-group-row`,role:`alert`,children:(0,$.jsx)(`p`,{className:`typography-small text-[var(--status-error)]`,children:c})}):null]},e.id)}):(0,$.jsx)(`div`,{className:`yuri-settings-group-row flex items-center justify-center text-center typography-small text-muted-foreground`,children:r(`mobile.connect.saved.empty`)})}),(0,$.jsx)(ya,{label:r(`mobile.instances.addTitle`),children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[P?(0,$.jsxs)(Y,{type:`button`,size:`lg`,className:`w-full`,onClick:()=>void U(),disabled:o||M,children:[(0,$.jsx)(X,{name:`scan-2`,className:J(`size-[18px]`,M&&`animate-pulse`)}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(Y,{type:`button`,variant:P?`ghost`:`default`,size:`lg`,className:`w-full`,disabled:o||M,onClick:()=>{R(null),g(null),D(!0)},children:r(`mobile.connect.link.useLink`)}),c&&!E&&!y&&!L?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null]})}),(0,$.jsx)(lr,{id:`mobile-instance-edit-${k}`,open:y!==null,onOpenChange:e=>{e||H()},fitContent:!0,ariaLabel:r(`mobile.instances.editTitle`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(zr,{className:`px-5 pb-5 pt-1`,disableHorizontal:!0,fillContainer:!1,children:oe})}),(0,$.jsx)(lr,{id:`mobile-instance-add-${O}`,open:E,onOpenChange:e=>{e||V()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:r(`mobile.connect.link.useLink`)}),ariaLabel:r(`mobile.connect.link.useLink`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(zr,{className:`px-5 py-5`,disableHorizontal:!0,fillContainer:!1,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:r(`mobile.connect.link.help`)}),(0,$.jsx)(rs,{value:w,onValueChange:e=>{T(e),g(null)},showPasteButton:!0,disabled:o||M,isBusy:o,inputClassName:`min-w-0 flex-1 text-[16px]`,buttonVariant:`default`,buttonClassName:`yuri-welcome-primary w-full`,error:c,onRedeem:te,onInvalid:ne})]})})})]})},Jm=e=>{let t=e.usedPercent;return typeof t!=`number`||!Number.isFinite(t)?`text-foreground`:t>=80?`text-[var(--status-error)]`:t>=50?`text-[var(--status-warning)]`:`text-foreground`},Ym=e=>{let t=(0,Q.c)(13),{icon:n,iconNode:r,label:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=r??(n?(0,$.jsx)(X,{name:n,className:`size-[18px]`}):null),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]===o?s=t[4]:(s=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:o}),t[3]=o,t[4]=s);let c;t[5]===i?c=t[6]:(c=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:i}),t[5]=i,t[6]=c);let l;t[7]===a?l=t[8]:(l=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-right typography-ui-label font-medium text-foreground`,children:a}),t[7]=a,t[8]=l);let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5`,children:[s,c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u},Xm=e=>{let t=(0,Q.c)(55),{open:n,onClose:r,anchorRef:i,contextDisplay:a,branchLabel:o,usageGroups:s,usageDisplayMode:c,isUsageLoading:l,timeFormatPreference:u}=e,{t:d}=ge(),f=Z.useRef(null),[p,m]=Z.useState(n),[h,g]=Z.useState(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=v(),t[0]=_):_=t[0];let y=_,b=Z.useRef(null),[x,S]=Z.useState(null),C,w;t[1]!==i||t[2]!==n||t[3]!==p?(C=()=>{if(!n||!y||!p)return;let e=()=>{let e=i.current?.getBoundingClientRect(),t=b.current?.getBoundingClientRect();if(!e||!t){S(null);return}let n=e.left-t.left,r=Math.min(Math.max(n,8),Math.max(8,t.width-Nm-8));S(r)};e();let t=b.current;if(typeof ResizeObserver>`u`||!t)return;let r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},w=[i,y,n,p],t[1]=i,t[2]=n,t[3]=p,t[4]=C,t[5]=w):(C=t[4],w=t[5]),Z.useLayoutEffect(C,w);let T=y&&x!==null,E,D;t[6]!==n||t[7]!==p?(E=()=>{if(n){m(!0),g(!1);return}if(!p)return;g(!0);let e=window.setTimeout(()=>{m(!1),g(!1)},140);return()=>window.clearTimeout(e)},D=[n,p],t[6]=n,t[7]=p,t[8]=E,t[9]=D):(E=t[8],D=t[9]),Z.useEffect(E,D);let O,k;t[10]!==r||t[11]!==n?(O=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},k=[r,n],t[10]=r,t[11]=n,t[12]=O,t[13]=k):(O=t[12],k=t[13]),Z.useEffect(O,k);let A,j;if(t[14]!==i||t[15]!==r||t[16]!==n?(A=()=>{if(!n)return;let e=e=>{let t=e.target;if(!(t instanceof Node)){r();return}f.current?.contains(t)||i.current?.contains(t)||r()};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`wheel`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`wheel`,e,!0)}},j=[i,r,n],t[14]=i,t[15]=r,t[16]=n,t[17]=A,t[18]=j):(A=t[17],j=t[18]),Z.useEffect(A,j),!p)return null;let M;t[19]===d?M=t[20]:(M=d(`mobile.header.openMetadataAria`),t[19]=d,t[20]=M);let N=T?`absolute origin-top-left`:`mx-3 mt-2`,P=h?`pointer-events-none`:`pointer-events-auto`,F;t[21]!==N||t[22]!==P?(F=J(`overflow-x-hidden overflow-y-auto overscroll-contain rounded-[20px] yuri-mobile-overlay-surface p-2 will-change-transform`,N,P),t[21]=N,t[22]=P,t[23]=F):F=t[23];let I=`${h?`session-metadata-out`:`session-metadata-in`} ${h?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`,L;t[24]!==x||t[25]!==T?(L=T?{top:8,left:x??8,width:`min(${Nm}px, calc(100% - 16px))`}:null,t[24]=x,t[25]=T,t[26]=L):L=t[26];let R;t[27]!==I||t[28]!==L?(R={animation:I,maxHeight:`min(72dvh, calc(100dvh - var(--yuri-safe-area-top, 0px) - var(--yuri-header-height, 56px) - 1rem))`,...L},t[27]=I,t[28]=L,t[29]=R):R=t[29];let z;t[30]===d?z=t[31]:(z=d(`mobile.header.metadata.branch`),t[30]=d,t[31]=z);let B;t[32]!==o||t[33]!==z?(B=(0,$.jsx)(Ym,{icon:`git-branch`,label:z,children:o}),t[32]=o,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==a||t[36]!==d?(V=a?(0,$.jsx)(Ym,{iconNode:(0,$.jsx)(Id,{percentage:a.percentage,pending:a.pending}),label:d(`mobile.header.metadata.context`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 tabular-nums`,children:[(0,$.jsx)(`span`,{className:J(`font-semibold`,a.colorClass),children:a.pending?d(`contextUsage.pending`):`${a.percentage.toFixed(1)}%`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:a.tokens})]})}):null,t[35]=a,t[36]=d,t[37]=V):V=t[37];let H;t[38]!==l||t[39]!==u||t[40]!==c||t[41]!==s?(H=(0,$.jsx)(Zm,{groups:s,displayMode:c,isLoading:l,timeFormatPreference:u}),t[38]=l,t[39]=u,t[40]=c,t[41]=s,t[42]=H):H=t[42];let ee;t[43]!==B||t[44]!==V||t[45]!==H?(ee=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[B,V,H]}),t[43]=B,t[44]=V,t[45]=H,t[46]=ee):ee=t[46];let te;t[47]!==M||t[48]!==F||t[49]!==R||t[50]!==ee?(te=(0,$.jsx)(`div`,{ref:f,role:`dialog`,"aria-label":M,className:F,style:R,children:ee}),t[47]=M,t[48]=F,t[49]=R,t[50]=ee,t[51]=te):te=t[51];let ne;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(`style`,{children:`
|
|
21
|
-
@keyframes session-metadata-in {
|
|
22
|
-
from { opacity: 0; transform: translateY(-8px) scale(0.985); }
|
|
23
|
-
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
24
|
-
}
|
|
25
|
-
@keyframes session-metadata-out {
|
|
26
|
-
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
27
|
-
to { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
28
|
-
}
|
|
29
|
-
`}),t[52]=ne):ne=t[52];let U;return t[53]===te?U=t[54]:(U=(0,$.jsxs)(`div`,{ref:b,className:`fixed inset-x-0 bottom-0 top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-header-height,56px))] z-20 pointer-events-none`,children:[te,ne]}),t[53]=te,t[54]=U),U},Zm=e=>{let t=(0,Q.c)(30),{groups:n,displayMode:r,isLoading:i,timeFormatPreference:a}=e,{t:o}=ge(),s;t[0]!==r||t[1]!==o?(s=o(r===`remaining`?`header.services.remaining`:`header.services.used`),t[0]=r,t[1]=o,t[2]=s):s=t[2];let c=s;if(n.length===0)return null;let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(X,{name:`timer`,className:`size-[18px]`})}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=o(`mobile.header.metadata.usage`),t[4]=o,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:u}),t[6]=u,t[7]=d);let f;t[8]===i?f=t[9]:(f=i?(0,$.jsx)(X,{name:`refresh`,className:`size-3.5 animate-spin`}):null,t[8]=i,t[9]=f);let p;t[10]===c?p=t[11]:(p=(0,$.jsx)(`span`,{className:`truncate`,children:c}),t[10]=c,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-center justify-end gap-1.5 typography-ui-label text-muted-foreground`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 px-2.5 pb-1.5`,children:[l,d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;if(t[18]!==r||t[19]!==n||t[20]!==a){let e;t[22]!==r||t[23]!==a?(e=e=>(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-[var(--surface-muted)] p-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(br,{providerId:e.providerId,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground`,children:e.providerName}),e.status&&e.rows.length===0?(0,$.jsx)(`span`,{className:`min-w-0 max-w-[60%] truncate typography-micro text-muted-foreground`,children:e.status}):null]}),e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:e.rows.map((t,n)=>{let i=Gi(e.rows.map(rh),n),o=r===`remaining`?t.window.remainingPercent:t.window.usedPercent,s=Ln(t.window.valueLabel,o),c=Mn(t.window.resetAt,t.window.resetAfterFormatted??t.window.resetAtFormatted,a);return(0,$.jsxs)(Z.Fragment,{children:[i?(0,$.jsx)(`div`,{className:J(`typography-micro font-medium uppercase tracking-wide text-muted-foreground`,n>0&&`mt-3 border-t border-[var(--surface-subtle)] pt-2`),children:i}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate typography-ui-label text-muted-foreground`,children:t.subtitle?`${t.subtitle} · ${t.label}`:t.label}),c?(0,$.jsx)(`span`,{className:`min-w-0 truncate typography-micro text-muted-foreground/70`,children:c}):null]}),(0,$.jsx)(`span`,{className:J(`min-w-0 max-w-[60%] shrink-0 truncate typography-ui-label font-semibold tabular-nums`,Jm(t.window)),children:s===`-`?``:s})]})]},t.key)})}):null,e.status&&e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 truncate typography-micro text-muted-foreground`,title:e.status,children:e.status}):null]},e.providerId),t[22]=r,t[23]=a,t[24]=e):e=t[24],g=n.map(e),t[18]=r,t[19]=n,t[20]=a,t[21]=g}else g=t[21];let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(`div`,{className:`space-y-1.5`,children:g}),t[25]=g,t[26]=_);let v;return t[27]!==_||t[28]!==h?(v=(0,$.jsxs)(`div`,{className:`pt-2.5`,children:[h,_]}),t[27]=_,t[28]=h,t[29]=v):v=t[29],v},Qm=e=>{let t=(0,Q.c)(35),{open:n,onClose:r,items:i,rightOffset:a}=e,o=a===void 0?0:a,{t:s}=ge(),c,l;if(t[0]!==r||t[1]!==n?(c=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},l=[r,n],t[0]=r,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),Z.useEffect(c,l),!n)return null;let u;t[4]===r?u=t[5]:(u=(e,t,n)=>(0,$.jsxs)(`button`,{type:`button`,role:n===void 0?`menuitem`:`menuitemcheckbox`,"aria-checked":n,className:J(`flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,t>0&&`border-t border-border/30`,e.disabled&&`cursor-not-allowed opacity-60`),style:{touchAction:`manipulation`},disabled:e.disabled,onClick:()=>{e.onSelect(),r()},children:[e.iconNode??(e.icon?(0,$.jsx)(X,{name:e.icon,className:J(`size-5 shrink-0 text-muted-foreground`,e.spinning&&`animate-spin`,e.key===`auto-read`&&`translate-x-px`)}):null),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:e.label}),e.badge&&e.badge>0?(0,$.jsx)(`span`,{className:`inline-flex size-2 shrink-0 rounded-full bg-primary`,"aria-hidden":!0}):null,n&&(0,$.jsx)(X,{name:`check`,className:`size-4 shrink-0 text-muted-foreground`})]},e.key),t[4]=r,t[5]=u);let d=u,f;t[6]===s?f=t[7]:(f=s(`mobile.menu.titleAria`),t[6]=s,t[7]=f);let p;t[8]===s?p=t[9]:(p=s(`mobile.surface.closeAria`),t[8]=s,t[9]=p);let m;t[10]===r?m=t[11]:(m=e=>{e.preventDefault(),r()},t[10]=r,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,$.jsx)(`button`,{type:`button`,className:`pointer-events-auto absolute inset-x-0 bottom-0 cursor-default top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.25rem)]`,"aria-label":p,onPointerDown:m}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g=`max(1rem, calc(8px + ${o}px + var(--yuri-safe-area-right, 0px)))`,_;t[15]===g?_=t[16]:(_={right:g,animation:`mobile-menu-in 160ms cubic-bezier(0.32, 0.72, 0, 1) forwards`},t[15]=g,t[16]=_);let v;if(t[17]!==i||t[18]!==d){let e;t[20]===d?e=t[21]:(e=(e,t)=>d(e,t),t[20]=d,t[21]=e),v=i.map(e),t[17]=i,t[18]=d,t[19]=v}else v=t[19];let y;t[22]!==i.length||t[23]!==d||t[24]!==s?(y=(0,$.jsx)(lo,{children:e=>{let{enabled:t,available:n,toggle:r}=e;return d({key:`auto-read`,icon:`volume-up`,label:s(`mobile.menu.autoRead`),disabled:!n,onSelect:r},i.length,t)}}),t[22]=i.length,t[23]=d,t[24]=s,t[25]=y):y=t[25];let b;t[26]!==_||t[27]!==v||t[28]!==y?(b=(0,$.jsxs)(`div`,{id:Om,className:`pointer-events-auto absolute top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.25rem)] w-[min(220px,calc(100vw-1rem))] origin-top-right overflow-hidden rounded-2xl yuri-mobile-overlay-surface`,role:`menu`,style:_,onAnimationEnd:ih,children:[v,y]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b):b=t[29];let x;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`style`,{children:`@keyframes mobile-menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }`}),t[30]=x):x=t[30];let S;return t[31]!==b||t[32]!==f||t[33]!==h?(S=(0,$.jsxs)(`div`,{className:`pointer-events-none fixed inset-0 z-50`,role:`dialog`,"aria-modal":`true`,"aria-label":f,children:[h,b,x]}),t[31]=b,t[32]=f,t[33]=h,t[34]=S):S=t[34],S},$m=Z.memo(function(e){let t=(0,Q.c)(94),{open:n,onOpenChange:r,currentSessionId:i,effectiveDirectory:a,gitDirectory:o,isNewSessionDraftOpen:s,primaryLabel:c,secondaryLabel:l}=e,{t:u}=ge(),{git:d}=te(),f=yf(i??``,a||void 0),p=f??l,m=Z.useRef(null),h=ct(i??``,a||void 0),g=gr(o),_=vr(o),v=yr(ah),y=yr(oh),b=ze(sh),x=ze(ch),S=ze(lh),C=ze(uh),w;t[0]===i?w=t[1]:(w=e=>i?e.sessionModelSelections.get(i)??null:null,t[0]=i,t[1]=w);let T=Ge(w),E=Zr(dh),D=Zr(fh),O=Zr(ph),k=Zr(mh),A=Zr(hh),j=Zr(gh),M=Zr(_h),N=I(vh);Xr();let P,F;t[2]!==v||t[3]!==d||t[4]!==o?(P=()=>{o&&v(o,d)},F=[v,d,o],t[2]=v,t[3]=d,t[4]=o,t[5]=P,t[6]=F):(P=t[5],F=t[6]),Z.useEffect(P,F);let L,R;t[7]!==y||t[8]!==d||t[9]!==o?(L=()=>{if(o)return Ze.onGitRefreshHint(e=>{Hm(e.directory)===o&&y(o,d)})},R=[y,d,o],t[7]=y,t[8]=d,t[9]=o,t[10]=L,t[11]=R):(L=t[10],R=t[11]),Z.useEffect(L,R);let z,B;t[12]===D?(z=t[13],B=t[14]):(z=()=>{D()},B=[D],t[12]=D,t[13]=z,t[14]=B),Z.useEffect(z,B);let V,H;t[15]===j?(V=t[16],H=t[17]):(V=()=>{xr(j)},H=[j],t[15]=j,t[16]=V,t[17]=H),Z.useEffect(V,H);let ee,ne;t[18]!==j||t[19]!==O||t[20]!==k||t[21]!==n||t[22]!==E?(ee=()=>{!n||k||j.some(e=>!E.some(t=>t?.providerId===e))&&O()},ne=[j,O,k,n,E],t[18]=j,t[19]=O,t[20]=k,t[21]=n,t[22]=E,t[23]=ee,t[24]=ne):(ee=t[23],ne=t[24]),Z.useEffect(ee,ne);let U;t[25]===h?U=t[26]:(U=Hd(h),t[25]=h,t[26]=U);let re=U,ie;t[27]!==S||t[28]!==x||t[29]!==re||t[30]!==T?(ie=re??(T?{providerID:T.providerId,modelID:T.modelId}:null)??(x&&S?{providerID:x,modelID:S}:null),t[27]=S,t[28]=x,t[29]=re,t[30]=T,t[31]=ie):ie=t[31];let W=ie,ae;if(t[32]!==C||t[33]!==W||t[34]!==b){let e=(W?b.find(e=>e.id===W.providerID):void 0)?.models.find(e=>e.id===W?.modelID),n;t[36]!==C||t[37]!==W?(n=W?C(W.providerID,W.modelID):void 0,t[36]=C,t[37]=W,t[38]=n):n=t[38];let r=n;ae=Rd(e?.limit,`context`)??r?.limit?.context??0,t[32]=C,t[33]=W,t[34]=b,t[35]=ae}else ae=t[35];let oe=ae,G=St(i??``,oe,0,a||void 0),se=G?.pending?null:G?.totalTokens??0,ce;t[39]!==oe||t[40]!==s||t[41]!==se?(ce=Vd({totalTokens:se,contextLimit:oe,isDraft:s}),t[39]=oe,t[40]=s,t[41]=se,t[42]=ce):ce=t[42];let le=ce,ue;t[43]!==_?.current||t[44]!==g||t[45]!==u?(ue=g===!0?_?.current?.trim()||u(`gitView.branch.detachedHead`):u(`common.unavailable`),t[43]=_?.current,t[44]=g,t[45]=u,t[46]=ue):ue=t[46];let de=ue,fe;if(t[47]!==j||t[48]!==E||t[49]!==M||t[50]!==u){let e=new Map(E.map(yh)),n;t[52]===j?n=t[53]:(n=e=>j.includes(e.id),t[52]=j,t[53]=n),fe=Yr(E).filter(n).filter(t=>e.get(t.id)?.configured===!0).map(t=>{let n=e.get(t.id),r=[];for(let[e,t]of yi(Object.entries(n?.usage?.windows??{}),n?.usage?.accounts))r.push({key:`window-${e}`,label:jn(t.label??e),window:t});let i=Object.entries(n?.usage?.models??{}),a=M[t.id]??[],o=a.length>0?i.filter(e=>{let[t]=e;return a.includes(t)}):i;for(let[e,t]of o){let n=Object.entries(t.windows??{});if(n.length===0)continue;let[i,a]=n[0];r.push({key:`model-${e}-${i}`,label:jn(a.label??i),subtitle:$r(e),window:a})}let s=!n.ok&&n.error?n.error:r.length===0?u(`header.services.noRateLimitsReported`):null;return{providerId:t.id,providerName:t.name,rows:r,status:s}}),t[47]=j,t[48]=E,t[49]=M,t[50]=u,t[51]=fe}else fe=t[51];let K=fe,pe,me;t[54]!==n||t[55]!==K?(pe=()=>{!n||K.length===0||xr(K.map(bh))},me=[n,K],t[54]=n,t[55]=K,t[56]=pe,t[57]=me):(pe=t[56],me=t[57]),Z.useEffect(pe,me);let q;t[58]===c?q=t[59]:(q=(0,$.jsx)(`span`,{className:`block truncate typography-ui-label text-foreground`,children:c}),t[58]=c,t[59]=q);let he;t[60]!==p||t[61]!==f?(he=p?(0,$.jsx)(`span`,{className:J(`block truncate`,f?`yuri-mobile-detail-subtitle text-muted-foreground`:`typography-micro text-muted-foreground`),"aria-live":`polite`,children:p}):null,t[60]=p,t[61]=f,t[62]=he):he=t[62];let _e;t[63]!==q||t[64]!==he?(_e=(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center px-2 py-1.5 text-left`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[q,he]})}),t[63]=q,t[64]=he,t[65]=_e):_e=t[65];let ve;t[66]===u?ve=t[67]:(ve=u(`mobile.header.openMetadataAria`),t[66]=u,t[67]=ve);let ye;t[68]===r?ye=t[69]:(ye=()=>r(xh),t[68]=r,t[69]=ye);let be;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(be={touchAction:`manipulation`},t[70]=be):be=t[70];let xe=le?.percentage??0,Se=le?.pending,Ce;t[71]!==xe||t[72]!==Se?(Ce=(0,$.jsx)(Id,{percentage:xe,pending:Se}),t[71]=xe,t[72]=Se,t[73]=Ce):Ce=t[73];let we;t[74]!==n||t[75]!==ve||t[76]!==ye||t[77]!==Ce?(we=(0,$.jsx)(`button`,{ref:m,type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":ve,"aria-expanded":n,onClick:ye,style:be,children:Ce}),t[74]=n,t[75]=ve,t[76]=ye,t[77]=Ce,t[78]=we):we=t[78];let Te;t[79]===r?Te=t[80]:(Te=()=>r(!1),t[79]=r,t[80]=Te);let Ee;t[81]!==de||t[82]!==le||t[83]!==k||t[84]!==n||t[85]!==A||t[86]!==Te||t[87]!==N||t[88]!==K?(Ee=(0,$.jsx)(Xm,{open:n,onClose:Te,anchorRef:m,contextDisplay:le,branchLabel:de,usageGroups:K,usageDisplayMode:A,isUsageLoading:k,timeFormatPreference:N}),t[81]=de,t[82]=le,t[83]=k,t[84]=n,t[85]=A,t[86]=Te,t[87]=N,t[88]=K,t[89]=Ee):Ee=t[89];let De;return t[90]!==_e||t[91]!==we||t[92]!==Ee?(De=(0,$.jsxs)($.Fragment,{children:[_e,we,Ee]}),t[90]=_e,t[91]=we,t[92]=Ee,t[93]=De):De=t[93],De}),eh=({onOpenSessions:e,menuOpen:t,onToggleMenu:n,surfaceShortcuts:r})=>{let{t:i}=ge(),[a,o]=Z.useState(!1),s=j(e=>e.currentDirectory),c=ft(e=>e.currentSessionId),l=Z.useMemo(()=>e=>c?e.getDirectoryForSession(c):null,[c]),u=ft(l)||s,d=Hm(u)||null,f=Fe(e=>e.projects),p=ft(e=>e.availableWorktreesByProject),m=Z.useMemo(()=>e=>c?e.worktreeMetadata.get(c)??null:null,[c]),h=ft(m),g=Le(c),_=ft(e=>!!e.newSessionDraft?.open),v=Z.useMemo(()=>{let e=Hm(u);return e&&Km((h?.projectDirectory?Tt(f,h.projectDirectory):null)??We(f,p,e),e)||i(`mobile.header.noProject`)},[p,h?.projectDirectory,u,f,i]),y=g?.title?.trim()||(c?i(`mobile.sessions.untitled`):v),b=c?v:``;Z.useEffect(()=>{o(!1)},[c,u]);let x=q(()=>{o(!1),e()}),S=q(()=>{o(!1),n()});return(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(bs,{children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":i(`mobile.sessions.openSheetAria`),onClick:x,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`folders`,className:`size-5`})}),(0,$.jsx)($m,{open:a,onOpenChange:o,currentSessionId:c,effectiveDirectory:u,gitDirectory:d,isNewSessionDraftOpen:_,primaryLabel:y,secondaryLabel:b}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:J(`flex size-10 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,r.activePanel===`files`?`bg-[var(--interactive-selection)] text-[var(--interactive-selectionForeground)]`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),"aria-label":i(`mobile.menu.files`),"aria-pressed":r.activePanel===`files`,onClick:r.onToggleFiles,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`file-text`,className:`size-5`})}),(0,$.jsxs)(`button`,{type:`button`,className:J(`relative flex size-10 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,r.activePanel===`changes`?`bg-[var(--interactive-selection)] text-[var(--interactive-selectionForeground)]`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),"aria-label":i(`mobile.menu.changes`),"aria-pressed":r.activePanel===`changes`,onClick:r.onToggleChanges,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`git-branch`,className:`size-5`}),r.changesDirty?(0,$.jsx)(`span`,{className:`absolute right-2 top-2 inline-flex size-2 rounded-full bg-primary`,"aria-hidden":!0}):null]})]}):null,(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":i(`mobile.header.openMenuAria`),"aria-controls":Om,"aria-expanded":t,"aria-haspopup":`menu`,onClick:S,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`more-2`,className:`size-5`})})]})})},th=({connection:e,onActiveConnectionDeleted:t})=>{let{t:n}=ge(),r=Yt();lt(),pt();let i=I(e=>e.mobileSessionPanelOpen),a=I(e=>e.setMobileSessionPanelOpen),o=I(e=>e.isScheduledTasksDialogOpen),s=I(e=>e.activeMainTab),c=ke(),l=I(e=>e.setActiveMainTab),[u,d]=Z.useState(!1),[f,p]=Z.useState(!1),[m,h]=Z.useState(null),[g,_]=Z.useState(!1),[y,b]=Z.useState(!1),[x,S]=Z.useState(null),[C,w]=Z.useState(null),[T,E]=Z.useState(null),[D,O]=Z.useState(0),[k,A]=Z.useState(!1),[M,N]=Z.useState(!1),[P,F]=Z.useState(!1),[L,R]=Z.useState(!1),[z,B]=Z.useState(!1),[V,H]=Z.useState(!1),[ee,te]=Z.useState(`nav`),[ne,U]=Z.useState(!1),[re,ie]=Z.useState(!1),W=q(()=>{U(!1),ie(!0)}),ae=q(()=>ie(!1)),[oe,G]=Z.useState(!1),se=q(()=>U(e=>!e)),ce=q(()=>U(!1)),[le,ue]=Z.useState(null),de=j(e=>e.currentDirectory),K=I(e=>e.setSettingsPage),pe=Kr(e=>e.available),me=Kr(e=>e.runtimeType),he=Z.useMemo(()=>Rm(),[]),_e=Z.useMemo(()=>es(),[]),{data:ve=[],refetch:be}=_a(de??null,{enabled:k}),{refetch:xe}=va(de??null,{enabled:k}),Se=xa(e=>e.setMcpDraft),Ce=xa(e=>e.setSelectedMcp),we=vr(Hm(de)||null)?.files?.length??0;Z.useEffect(()=>Ze.onDirectoryRequest(()=>B(!0)),[]);let Te=Z.useMemo(()=>v(),[]),Ee=Gn()===`portrait`,[De,Oe]=Z.useState(Te&&!Ee),[je,Me]=Z.useState(null),Ne=q(e=>{if(e&&K(e),Te){te(e?`page-content`:`nav`),F(!0);return}let t=yt.getState();if(e){t.openSettingsFromCurrent();return}K(`home`),t.setActiveTab(`settings`)}),Pe=q(()=>{Ne(`instances`)}),Fe=q(()=>{yt.getState().openInstances()}),Ie=q(async t=>{if(!t){Fe();return}let n=e.connections.find(e=>e.id===t);!n||e.isBusy||ye(n)||(await e.connect({id:n.id,candidates:n.candidates,clientToken:n.clientToken,label:n.label}),ye(n)||Fe())}),Le=q(()=>{yt.getState().closeSecondary()}),ze=q(async()=>{if(!V){H(!0);try{let t=await ts();switch(t.status){case`ok`:await e.connect({url:t.url,clientToken:t.clientToken,label:t.label});break;case`pairing`:await e.redeemPairingConnection(t.pairing);break;case`permission-denied`:fe.error(n(`mobile.connect.scan.permissionDenied`));break;case`invalid`:fe.error(n(`mobile.connect.scan.invalid`));break;case`unsupported`:fe.error(n(`mobile.connect.scan.unsupported`));break;case`failed`:fe.error(n(`mobile.connect.scan.failed`))}}finally{H(!1)}}});Aa({enabled:!Te,rootRoutesBlocked:i||u||f||g||y||o||k||P||L||z||ne});let Be=q(()=>{let e=!De;e&&Ee&&Me(null),Oe(e)}),Ve=q(()=>{if(b(!1),S(null),w(null),p(!1),h(null),Te){ue(null),Me(`files`),Ee&&Oe(!1);return}d(!0)}),He=q(()=>{p(!1),h(null)}),Ue=q(e=>{let t=e.path.trim();if(t){if(b(!1),S(null),w(null),ue(null),_(!1),Te){I.getState().setPendingFileFocusPath(t),Me(`files`),Ee&&Oe(!1);return}d(!1),h({path:t,targetLine:typeof e.targetLine==`number`&&Number.isFinite(e.targetLine)?Math.max(1,Math.trunc(e.targetLine)):void 0}),p(!0)}}),We=I(e=>e.pendingFileFocusPath);Z.useEffect(()=>{if(We){if(Te){Ve();return}Ue({path:We}),I.getState().setPendingFileFocusPath(null)}},[We,Te,Ve,Ue]);let Ge=q((e=null)=>{if(b(!1),S(null),w(null),E(null),p(!1),h(null),ue(e),Te){Me(`changes`),Ee&&Oe(!1);return}_(!0)}),Ke=q((e,t,n)=>{ue(null),_(!1),p(!1),h(null),S(e??null),w(typeof t==`string`&&t.trim()?t.trim():null);let r=typeof n==`string`&&n.trim()?n.trim():null;if(E(r),O(e=>e+1),Te){Me(`turn-diff`),Ee&&Oe(!1);return}b(!0)}),qe=q(()=>{Me(null),ue(null),E(null)}),Je=q(e=>{if(je===e){qe();return}e===`files`?Ve():Ge()}),Ye=Z.useRef(`changes`);je&&(Ye.current=je);let[Xe,Qe]=Z.useState(!1);Z.useEffect(()=>{if(!Te)return;if(je){Qe(!0);return}let e=window.setTimeout(()=>Qe(!1),240);return()=>window.clearTimeout(e)},[je,Te]);let $e=je??Ye.current,et=Im(`left`,`yuri.ipad.leftSidebarWidth`,km),tt=Im(`right`,`yuri.ipad.rightSidebarWidth`,Am),nt=Z.useMemo(()=>({openChanges:({diffPath:e,staged:t,targetLine:n}={})=>{Ge(e?{path:e,staged:t===!0,targetLine:n}:null)},openToolDiff:({diffPath:e,patches:t,targetLine:n})=>{Ge({path:e,staged:!1,targetLine:n,toolPatches:t})},openTurnDiff:Ke,openFile:({path:e,targetLine:t})=>{Ue({path:e,targetLine:t})},openFiles:()=>Ve(),openSettings:e=>{Ne(e)}}),[Ge,Ue,Ve,Ne,Ke]),rt=q(()=>{_(!1),ue(null)}),it=q(()=>{b(!1),E(null)});Wf(Z.useMemo(()=>({openSessions:()=>{if(Te){Oe(!0);return}yt.getState().setActiveTab(`projects`)},openView:e=>{e===`files`?Ve():e===`mcp`?A(!0):e===`instances`?Pe():e===`update`&&R(!0)},openChanges:({path:e,staged:t}={})=>{Ge(e?{path:e,staged:t===!0}:null)},openSettings:e=>{Ne(e)}}),[Te,Ge,Ve,Pe,Ne]));let at=Z.useRef(null),ot=Z.useRef(null),st=ft(e=>e.currentSessionId),ct=ft(e=>e.setCurrentSession),ut=Z.useMemo(()=>e=>st?e.getDirectoryForSession(st):null,[st]),dt=ft(ut),mt=Re(st,dt||de||void 0);gm();let ht=q(()=>{let e=st;if(!e||oe)return;let t=dt||de||void 0;G(!0),(async()=>{try{await r.refreshSessionTranscript(e,{directory:t}),fe.success(n(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{fe.error(n(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{G(!1)}})()}),gt=yt(e=>e.secondary?.kind??null),_t=!Te&&(gt===`chat`||gt===`draft`);Z.useEffect(()=>{!Te&&!_t&&U(!1)},[Te,_t]),Z.useEffect(()=>{U(!1)},[st]);let vt=Te&&s===`assistant`||!Te&&!_t||i||u||f||g||y||o||k||P||L||z||ne||re;fp(ot,{onOpen:q(()=>{nr(ur)?.finish(`commit`)}),onPreviewStart:q(()=>{nr(ur)?.begin(`present`)}),onPreviewCancel:q(()=>{nr(ur)?.finish(`cancel`)}),onProgress:q(e=>{e!==null&&nr(ur)?.update(e)}),disabled:vt},Te||_t);let bt=q(e=>{at.current=e});Vm(q(()=>re?(ae(),!0):ne?(U(!1),!0):z?(B(!1),!0):o?(window.dispatchEvent(new Event(`yuri:scheduled-tasks-close-request`)),!0):i?(a(!1),!0):ja.backImmediately(`overlay`)?!0:f?(He(),!0):u?(d(!1),!0):y?(it(),!0):g?(rt(),!0):k?(A(!1),!0):P?(F(!1),!0):L?(R(!1),!0):ja.requestAnimatedBack(`root`)||at.current?.()?!0:s===`assistant`?(l(`chat`),!0):mt?(ct(mt.id,mt.directory),!0):!1));let xt=pe&&(me===`desktop`||me===`web`),St=q(()=>{let e=`new-mcp-server`,t=e,n=1;for(;ve.some(e=>e.name===t);)t=`${e}-${n}`,n+=1;Se({name:t,scope:`user`,type:`local`,command:[],url:``,environment:[],headers:[],oauthEnabled:!0,oauthClientId:``,oauthClientSecret:``,oauthScope:``,oauthRedirectUri:``,timeout:``,enabled:!0}),Ce(t),A(!1),Ne(`mcp`)}),Ct=q(()=>{if(M)return;N(!0);let e=new Promise(e=>window.setTimeout(e,500));Promise.all([xe(),be(),e]).finally(()=>N(!1))}),wt=ft(e=>e.openNewSessionDraft),Tt=Z.useMemo(()=>{let e=[{key:`new-session`,icon:`chat-new`,label:n(`mobile.menu.newSession`),onSelect:()=>{if(Te){l(`chat`),wt();return}yt.getState().openDraft()}}];return Te||e.push({key:`files`,icon:`file-text`,label:n(`mobile.menu.files`),onSelect:()=>Ve()},{key:`changes`,icon:`git-branch`,label:n(`mobile.menu.changes`),badge:we,onSelect:()=>Ge()}),e.push({key:`mcp`,iconNode:(0,$.jsx)(qr,{className:`size-5 shrink-0 text-muted-foreground`}),label:n(`mobile.menu.mcp`),onSelect:()=>A(!0)}),xt&&e.push({key:`update`,icon:`download`,label:n(`mobile.menu.update`),onSelect:()=>R(!0)}),Te&&e.push({key:`settings`,icon:`settings-3`,label:n(`mobile.menu.settings`),onSelect:()=>Ne()}),st&&e.push({key:`refresh-transcript`,icon:`refresh`,label:n(`sessions.sidebar.session.menu.refreshTranscript`),disabled:oe,spinning:oe,onSelect:ht}),e.push({key:`remote-desktop`,icon:`computer`,label:n(`remoteDesktop.title`),onSelect:W}),e},[st,we,Te,oe,Ge,Ve,wt,W,Ne,ht,l,xt,n]);return(0,$.jsx)(co,{sessionId:st??``,directory:dt||de||void 0,active:Te?s!==`assistant`:gt===`chat`,children:(0,$.jsx)(fr,{actions:nt,children:(0,$.jsxs)(as,{children:[(0,$.jsxs)(`div`,{className:`yuri-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row text-foreground`,"data-page-scroll-lock":`true`,children:[Te?(0,$.jsxs)(`aside`,{ref:et.asideRef,className:J(`relative flex h-full shrink-0 flex-col overflow-hidden border-r border-border/50 bg-sidebar will-change-[width] motion-reduce:transition-none`,!De&&`border-r-0`),style:{width:De?et.width:0,minWidth:De?et.width:0,maxWidth:De?et.width:0,"--yuri-ipad-sidebar-width":`${et.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:et.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!De,"data-page-scroll-lock":`true`,children:[De?(0,$.jsx)(Lm,{side:`left`,isResizing:et.isResizing,ariaLabel:n(`sidebar.resize.leftPanelAria`),handleProps:et.handleProps}):null,(0,$.jsx)(`div`,{className:J(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,et.isResizing&&`pointer-events-none`,!De&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:(0,$.jsx)(Wn,{children:(0,$.jsx)(cl,{open:!0,variant:`sidebar`,onOpenChange:e=>{!e&&Ee&&Oe(!1)}})})})]}):null,(0,$.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col`,"data-page-scroll-lock":`true`,inert:re||void 0,"aria-hidden":re||void 0,children:Te?(0,$.jsxs)($.Fragment,{children:[s===`assistant`?null:(0,$.jsx)(`div`,{children:(0,$.jsx)(eh,{onOpenSessions:()=>Be(),menuOpen:ne,onToggleMenu:se,surfaceShortcuts:{activePanel:je===`turn-diff`?`changes`:je,changesDirty:we>0,onToggleFiles:()=>Je(`files`),onToggleChanges:()=>Je(`changes`)}})}),(0,$.jsx)(`main`,{ref:ot,className:`relative min-h-0 flex-1 overflow-hidden`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(`div`,{className:`relative h-full w-full bg-background`,children:(0,$.jsx)(Wn,{children:s===`assistant`?(0,$.jsx)(Ha,{}):(0,$.jsx)(Hi,{})})})})]}):(0,$.jsx)(qu,{className:`min-h-0 flex-1`,onAddProject:()=>B(!0),onScanQr:he&&_e?()=>{ze()}:void 0,onSwitchInstance:he?Ie:void 0,onRemoteDesktop:W,remoteDesktopActive:re,instanceOptions:he?e.connections.map(t=>({id:t.id,label:t.label,active:ye(t),disabled:e.isBusy})):void 0,onEnableAssistants:()=>{Ne(`assistants`)},instancesPage:he?(0,$.jsx)(qm,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t}):void 0,instancesSecondaryPage:he?(0,$.jsxs)(`div`,{className:`yuri-settings-workspace yuri-settings-workspace-mobile flex h-full min-h-0 flex-col bg-[var(--surface-background)]`,children:[(0,$.jsx)(Ae,{title:n(`mobile.settings.switchInstance`),backAriaLabel:n(`header.actions.backAria`),onBack:Le}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-[var(--yuri-mobile-page-inline-inset)]`,children:(0,$.jsx)(Sa,{className:`yuri-mobile-settings-detail-card`,children:(0,$.jsx)(qm,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t})})})]}):void 0,parentSessionTarget:mt?{id:mt.id,directory:mt.directory}:null,registerSecondaryBackHandler:bt,scheduledContent:(e,t)=>(0,$.jsx)(Ei,{presentation:`mobile-tab`,registerEditorBackHandler:e,onEditorActiveChange:t}),renderChat:e=>(0,$.jsx)(wf,{sessionId:e.sessionId,directory:e.directory,onBack:()=>{ce(),ja.requestAnimatedBack(`root`)},onOpenMenu:se,onCloseMenu:ce,menuOpen:e.active&&ne,children:(0,$.jsx)(`main`,{ref:e.active?ot:void 0,className:`relative h-full min-h-0 flex-1 overflow-hidden`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(`div`,{className:`relative h-full w-full bg-background`,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Hi,{readOnly:!e.active,active:e.active,selectionOverride:{sessionId:e.sessionId||null,directory:e.directory,viewKey:e.viewKey}})})})})})})}),Te?(0,$.jsxs)(`aside`,{ref:tt.asideRef,className:J(`relative flex h-full shrink-0 flex-col overflow-hidden border-l border-border/50 bg-background will-change-[width] motion-reduce:transition-none`,!je&&`border-l-0`),style:{width:je?tt.width:0,minWidth:je?tt.width:0,maxWidth:je?tt.width:0,"--yuri-ipad-sidebar-width":`${tt.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:tt.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!je,"data-page-scroll-lock":`true`,children:[je?(0,$.jsx)(Lm,{side:`right`,isResizing:tt.isResizing,ariaLabel:n(`sidebar.resize.rightPanelAria`),handleProps:tt.handleProps}):null,(0,$.jsx)(`div`,{className:J(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,tt.isResizing&&`pointer-events-none`,!je&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:Xe?(0,$.jsx)(Wn,{children:$e===`files`?(0,$.jsx)(Ec,{onClose:qe}):$e===`turn-diff`?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,children:[(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 border-b border-border/40 px-3`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.nav.changes`)}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:qe,"aria-label":n(`mobile.surface.closeAria`),className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(Ii,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:D,flushContent:!0})})]}):le?.toolPatches?.length?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,children:[(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 border-b border-border/40 px-3`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground`,children:le.toolPatches.length>1?n(`mobile.nav.changes`):le.path}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:qe,"aria-label":n(`mobile.surface.closeAria`),className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(Ii,{hideStackedFileSidebar:!0,diffScope:`turn`,targetFilePath:le.path,targetLine:le.targetLine??null,toolPatches:le.toolPatches,singleFileView:le.toolPatches.length===1,flushContent:!0})})]}):(0,$.jsx)(Js,{onClose:qe,initialDiffPath:le?.path??null,initialDiffStaged:le?.staged===!0,initialDiffTargetLine:le?.targetLine??null})}):null})]}):null,(0,$.jsx)(ui,{open:z,onOpenChange:B,forceMobile:!0}),(0,$.jsx)(Qm,{open:ne,onClose:()=>U(!1),items:Tt,rightOffset:Te&&je?tt.width:0}),(0,$.jsx)(ua,{}),re&&(0,$.jsx)(Fd,{onClose:ae,instanceName:e.connections.find(ye)?.label}),u?(0,$.jsx)(lr,{id:Cm,open:u,onOpenChange:e=>{e||d(!1)},ariaLabel:n(`mobile.menu.files`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Ec,{onClose:()=>d(!1)})})}):null,f&&m?(0,$.jsx)(lr,{id:Sm,open:f,onOpenChange:e=>{e||He()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:m.path.split(/[/\\]/).filter(Boolean).at(-1)??m.path}),ariaLabel:n(`mobile.menu.files`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Ec,{onClose:He,initialFilePath:m.path,directFilePreview:!0,hideFileHeader:!0},m.path)})}):null,(0,$.jsx)(lr,{id:xm,open:y,onOpenChange:e=>{e||it()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.nav.changes`)}),ariaLabel:n(`mobile.nav.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Ii,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,toolbarInSheetHeader:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:D,flushContent:!0})})}),g&&le?(0,$.jsx)(lr,{id:bm,open:g,onOpenChange:e=>{e||rt()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:le.toolPatches&&le.toolPatches.length>1?n(`mobile.nav.changes`):le.path}),ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:le.toolPatches?.length?(0,$.jsx)(Ii,{hideStackedFileSidebar:!0,toolbarInSheetHeader:!0,diffScope:`turn`,targetFilePath:le.path,targetLine:le.targetLine??null,toolPatches:le.toolPatches,singleFileView:le.toolPatches.length===1,flushContent:!0}):(0,$.jsx)(Js,{initialDiffPath:le.path,initialDiffStaged:le.staged,initialDiffTargetLine:le.targetLine??null,hideDiffHeader:!0})})}):g?(0,$.jsx)(lr,{id:wm,open:g,onOpenChange:e=>{e||rt()},ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Js,{onClose:rt,initialDiffPath:le?.path??null,initialDiffStaged:le?.staged===!0,initialDiffTargetLine:le?.targetLine??null})})}):null,k?(0,$.jsx)(lr,{id:Tm,open:k,onOpenChange:e=>{e||A(!1)},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mcpDropdown.title`)}),trailing:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:St,"aria-label":n(`settings.mcp.sidebar.actions.addServerTitle`),title:n(`settings.mcp.sidebar.actions.addServerTitle`),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`add`,className:`size-5`})}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:Ct,disabled:M,"aria-label":n(`mcpDropdown.actions.refreshAria`),title:n(`mcpDropdown.actions.refreshAria`),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`refresh`,className:J(`size-5`,M&&`animate-spin`)})})]}),ariaLabel:n(`mcpDropdown.title`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(di,{active:!0,className:`h-full`,listClassName:`max-h-none`,hideHeader:!0,mobileListDensity:!0})})}):null,P&&Te?(0,$.jsx)(lr,{id:Em,open:P,onOpenChange:e=>{e||F(!1)},ariaLabel:n(`mobile.menu.settings`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(Da,{forceMobile:!0,isWindowed:!0,initialMobileStage:ee,visiblePageSlugs:[...Yn],onClose:()=>F(!1),mobileInstancesPage:he?(0,$.jsx)(qm,{connection:e,onConnect:()=>F(!1),onActiveConnectionDeleted:t}):void 0})})}):null,L?(0,$.jsx)(lr,{id:Dm,open:L,onOpenChange:e=>{e||R(!1)},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.menu.update`)}),ariaLabel:n(`mobile.menu.update`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Wn,{children:(0,$.jsx)(`div`,{className:`h-full overflow-auto px-5 py-4`,children:(0,$.jsx)(Oa,{initialUpdateDialogOpen:!0})})})}):null]}),(0,$.jsx)(ys,{enabled:he&&s===`assistant`&&c.data?.supported===!0&&c.data?.enabled===!0}),(0,$.jsx)(Wn,{children:(0,$.jsx)(fi,{})}),(0,$.jsx)(si,{})]})})})};function nh({apis:e}){Z.useEffect(()=>it(),[]);let{t}=ge(),n=ze(e=>e.initializeApp),r=ze(e=>e.isInitialized),i=ze(e=>e.isConnected),a=ze(e=>e.connectionPhase),o=j(e=>e.currentDirectory),s=ft(e=>e.currentSessionId),l=ft(e=>!!e.newSessionDraft?.open),u=ft(e=>e.error),f=ft(e=>e.clearError),p=I(e=>e.setIsMobile),m=ei(e=>e.refreshStatus),g=Fe(e=>e.projects),[_,v]=Z.useState(0),[y,x]=Z.useState(0),[S,C]=Z.useState(!1),[w,T]=Z.useState(`pending`),E=Z.useMemo(()=>be(),[]),[,D]=Z.useReducer(e=>e+1,0),O=Z.useMemo(()=>Rm(),[]),k=Z.useRef(0),A=Z.useRef(0),N=Ee(()=>{T(`done`),v(e=>e+1)});Gf(q(e=>{N.redeemPairingConnection(e)}));let P=Kf({ready:O&&i&&r});Z.useEffect(()=>{!N.error||!h()||fe.error(N.error)},[N.error]);let F=q(()=>{let t=h(),r=A.current+1;if(A.current=r,!t){Te();return}let i=()=>{n(),m(e.github,{force:!0}),ze.getState().refreshMissingCatalogs({source:`mobileApp:nativeResume`})},a=()=>{d({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),v(e=>e+1)};xe().then(e=>{if(A.current===r){if(e===`no-connection`){a();return}if(e===`unreachable`){window.setTimeout(()=>{A.current===r&&xe().then(e=>{if(A.current===r&&e!==`switched`&&e===`unchanged`){i();return}})},4e3);return}e!==`switched`&&i()}});let o=Date.now();o-k.current>=Wm&&(k.current=o,window.dispatchEvent(new Event(`yuri:system-resume`)))});zm(),Bm(F),Z.useEffect(()=>{if(!O)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>F(),1500)};return window.addEventListener(`online`,t),()=>{window.removeEventListener(`online`,t),window.clearTimeout(e)}},[O,F]),Z.useEffect(()=>(b(e),()=>b(null)),[e]),Z.useEffect(()=>{O&&ue().then(e=>{e&&e.notifyAppReady().catch(()=>void 0)})},[O]),Z.useEffect(()=>{if(!O)return;let e=!1,t=[];return ue().then(async n=>{if(!(!n||e))try{let r=await n.addListener(`download`,e=>{Kr.getState().setOtaDownloadPercent(e.percent)}),i=await n.addListener(`downloadFailed`,()=>{Kr.getState().setOtaDownloadFailed()}),a=await n.addListener(`downloadComplete`,()=>{Kr.getState().setOtaPhase(`pending_restart`)}),o=await n.addListener(`appReloaded`,()=>{Kr.getState().setOtaPhase(`pending_restart`)}),s=await n.addListener(`autoRevert`,()=>{console.warn(`[OTA] Capgo auto-reverted the last bundle`),Kr.getState().setOtaPhase(`error`,`OTA update was reverted`)});if(e){r.remove(),i.remove(),a.remove(),o.remove(),s.remove();return}t.push(()=>void r.remove(),()=>void i.remove(),()=>void a.remove(),()=>void o.remove(),()=>void s.remove())}catch(e){console.warn(`[OTA] Failed to subscribe to Capgo updater events:`,e)}}),()=>{e=!0;for(let e of t)e()}},[O]),Z.useEffect(()=>c(e=>{if(e.runtimeKey&&e.runtimeKey===e.previousRuntimeKey){ia(),D();return}Yi(e),yt.getState().reset(),x(e=>e+1),v(e=>e+1)}),[]),Z.useEffect(()=>{if(P===`pending`)return;if(P===`connect`){T(`done`);return}if(!O||i||h()){T(`done`);return}let e=!1;return T(`attempting`),Nt().then(e=>e?!0:Te()).catch(()=>!1).then(()=>{e||T(`done`)}),()=>{e=!0}},[P]),Z.useEffect(()=>{p(!0)},[p]),Z.useEffect(()=>{O&&!h()||n()},[_,n,O]),Zt({enabled:!O||!!h(),source:`mobileApp:recovery`}),Z.useEffect(()=>{i&&M.setDirectory(o)},[o,i]),Z.useEffect(()=>{i&&m(e.github,{force:!0})},[e.github,i,m]),Z.useEffect(()=>{if(!i||g.length===0)return;let e=!1;return(async()=>{await Promise.all(g.map(async t=>{let n=Hm(t.path);if(n)try{if(!(yr.getState().directories.get(n)?.isGitRepo??await ae(()=>import(`./gitApi-BOyQ2o3N.js`).then(e=>e.S).then(e=>e.checkIsGitRepository(n)),__vite__mapDeps([82,1,5,4,6,7,9,43,8,12,10,44,45,13,14,11,15,2,16,46,20,18,17,19,21,22,38,39,47,42,48,34,35,36,37,40,41,49,50,51,52,53])))||e)return;await Gr({id:t.id,path:n},{isCurrent:()=>!e})}catch{}}))})(),()=>{e=!0}},[i,g]),Z.useEffect(()=>{if(!u)return;let e=window.setTimeout(()=>f(),5e3);return()=>window.clearTimeout(e)},[f,u]),Z.useEffect(()=>{if(!(!i&&(!O||h()))){C(!1);return}let e=window.setTimeout(()=>C(!0),8e3);return()=>window.clearTimeout(e)},[i,O,_,y]),Sn(),sn({enabled:!0}),En(),bi(),yp({enabled:O&&i}),_m();let L=Tf(),R=!i&&a===`reconnecting`;if(!L)return(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background text-foreground`,children:(0,$.jsx)(Hn,{width:120,height:120,isAnimated:!0})});let z=!!h();return O&&(!z||!i&&!R)?z?(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-4`,children:[(0,$.jsx)(Hn,{width:120,height:120,isAnimated:!S}),S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h1`,{className:`typography-h3 text-foreground`,children:t(`sessionAuth.error.networkTitle`)}),(0,$.jsx)(`p`,{className:`typography-body text-muted-foreground`,children:t(`sessionAuth.error.networkDescription`)})]}),(0,$.jsx)(Y,{type:`button`,variant:`outline`,onClick:()=>{d({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),v(e=>e+1)},children:t(`mobile.connect.cancelPassword`)})]}):null]})}):w===`done`?(0,$.jsx)(is,{connection:N}):(0,$.jsxs)(`main`,{className:`relative flex min-h-dvh items-center justify-center bg-background text-foreground`,children:[(0,$.jsx)(Hn,{width:120,height:120,isAnimated:!0}),E?(0,$.jsxs)(`div`,{className:`absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center`,children:[(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.splash.connectingTo`)}),(0,$.jsxs)(`p`,{className:`typography-small text-foreground`,children:[E,(0,$.jsx)(cn,{})]})]}):null]}):!i&&!R?S?(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground`,children:(0,$.jsxs)(`div`,{className:`max-w-sm space-y-3`,children:[(0,$.jsx)(`h1`,{className:`typography-h3 text-foreground`,children:t(`sessionAuth.error.networkTitle`)}),(0,$.jsx)(`p`,{className:`typography-body text-muted-foreground`,children:t(`sessionAuth.error.networkDescription`)})]})}):(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background text-foreground`,children:(0,$.jsx)(Hn,{width:120,height:120,isAnimated:!0})}):(0,$.jsx)(Wn,{children:(0,$.jsx)(Ne,{sdk:M.getSdkClient(),directory:o||``,bootstrapDirectory:!(l&&s===null),children:(0,$.jsx)(ln,{apis:e,children:(0,$.jsx)(Si,{ready:r,children:(0,$.jsx)(An,{delayDuration:300,skipDelayDuration:150,children:(0,$.jsxs)(`div`,{className:`h-full bg-background text-foreground`,children:[(0,$.jsx)(qi,{}),(0,$.jsx)(Pt,{}),(0,$.jsx)(ds,{}),(0,$.jsx)(gn,{embeddedBackgroundWorkEnabled:r}),(0,$.jsx)(da,{}),(0,$.jsx)(ho,{}),(0,$.jsx)(To,{}),(0,$.jsx)(th,{connection:N,onActiveConnectionDeleted:()=>{d({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),yt.getState().reset(),v(e=>e+1)}}),(0,$.jsx)(Tn,{position:`top-center`,offset:`calc(var(--yuri-safe-area-top, 0px) + 16px)`}),r?(0,$.jsx)(Ti,{}):null,r?(0,$.jsx)(xi,{}):null,r?(0,$.jsx)(li,{autoStart:!1}):null]})})})})},y)})}function rh(e){return e.window}function ih(e){e.currentTarget.style.transform=`none`}function ah(e){return e.ensureStatus}function oh(e){return e.fetchStatus}function sh(e){return e.providers}function ch(e){return e.currentProviderId}function lh(e){return e.currentModelId}function uh(e){return e.getModelMetadata}function dh(e){return e.results}function fh(e){return e.loadSettings}function ph(e){return e.fetchAllQuotas}function mh(e){return e.isLoading}function hh(e){return e.displayMode}function gh(e){return e.dropdownProviderIds}function _h(e){return e.selectedModels}function vh(e){return e.timeFormatPreference}function yh(e){return[e?.providerId,e]}function bh(e){return e.providerId}function xh(e){return!e}var Sh=()=>{ve(),D().then(()=>{Promise.all([k(),Jt()]).catch(e=>{console.error(`[mobile-main] settings init failed:`,e)}),qt(),yn(),rn()}).catch(e=>{console.error(`[mobile-main] appearance init failed:`,e)}).finally(()=>{Ja()})};function Ch(e){Qn(),Sh(),I.getState().setIsMobile(!0),no(),qn(),Kn();let t=document.getElementById(`root`);if(!t)throw Error(`Root element not found`);let n=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`;n&&document.documentElement.classList.add(`yuri-native-app-active`);let r=n?{...e,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:e,i=(0,$.jsx)(nh,{apis:r});(0,Wa.createRoot)(t).render((0,$.jsx)(Z.StrictMode,{children:(0,$.jsx)(Xt,{children:(0,$.jsx)(he,{children:(0,$.jsx)(_n,{children:(0,$.jsx)(tn,{children:(0,$.jsx)(Ki,{children:(0,$.jsx)(nn,{children:n?i:(0,$.jsx)(an,{children:i})})})})})})})}))}export{Ch as renderMobileApp};
|