@yuriai/web 0.2.38-beta.2 → 0.2.38-beta.4
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-DNVD6VCV.js → AgentAvatar-CjZAr6nn.js} +1 -1
- package/dist/assets/AssistantContactStatus-DoZk9r1D.js +3 -0
- package/dist/assets/AssistantUnreadBadge-BJHZUf6Z.js +1 -0
- package/dist/assets/AssistantView-DkjXm6xL.js +1 -0
- package/dist/assets/DiagramView-Byel_g4U.js +1 -0
- package/dist/assets/{FadeInOnReveal-CK7jBcu4.js → FadeInOnReveal-BrPG6IFE.js} +1 -1
- package/dist/assets/GuiPluginPage-C6iXAYM8.js +1 -0
- package/dist/assets/GuiPluginSurface-DPXPl4xG.js +1 -0
- package/dist/assets/GuiPluginWindow-BdtIwEmZ.js +1 -0
- package/dist/assets/{Icon-DsN23fuV.js → Icon-C5rHjO1K.js} +1 -1
- package/dist/assets/ImageLoadingPlaceholder-Cdj2zS3j.js +1 -0
- package/dist/assets/LoadingImage-Gh9OduKR.js +1 -0
- package/dist/assets/MarkdownRenderer-DErp8UoS.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-ecACjpZw.js → MarkdownRendererImpl-H41Q6Ds9.js} +3 -3
- package/dist/assets/MarkstreamRendererImpl-CJcHC4Ts.js +3 -0
- package/dist/assets/MobileDetailNavigation-fdYiFD76.js +1 -0
- package/dist/assets/MobileResizableSheet-DDzgYZmt.js +1 -0
- package/dist/assets/MobileShareBridge-BNPPhHGf.js +3 -0
- package/dist/assets/MobileTabPageHeader-ZZPrTJl4.js +2 -0
- package/dist/assets/MultiRunWindow-DoeszXM5.js +1 -0
- package/dist/assets/OnboardingScreen-BrYqOlrO.js +1 -0
- package/dist/assets/{OverlayScrollbar-BLhv7Nq-.js → OverlayScrollbar-8lCP3DZq.js} +1 -1
- package/dist/assets/SettingsView-UuXi7Uya.js +29 -0
- package/dist/assets/SettingsWindow-DIYoXakh.js +1 -0
- package/dist/assets/SetupTourDialog-BF50uUTW.js +1 -0
- package/dist/assets/TerminalView-uVsRpvjV.js +8 -0
- package/dist/assets/ToolOutputDialog-Bz23N8ob.js +10 -0
- package/dist/assets/VoiceSettings-DbbeM4JG.js +2 -0
- package/dist/assets/YuriLogo-DcoYyXzq.js +1 -0
- package/dist/assets/YuriWordmark-Dlsq3scd.js +1 -0
- package/dist/assets/appThemeRegistry-DE7vwd6j.js +1 -0
- package/dist/assets/{appearance--vFosLNi.js → appearance-DFsI3pnP.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-C-SlEpSB.js → assistant-attachment-cache-Cmzt4xXE.js} +1 -1
- package/dist/assets/bootstrap-BhC95qVC.js +1 -0
- package/dist/assets/{capgoAdapter-DceVw3SM.js → capgoAdapter-BPZyUAQO.js} +1 -1
- package/dist/assets/{checkbox-CJsiyoER.js → checkbox-Dgn0NjAK.js} +1 -1
- package/dist/assets/{collapsible-B3zojUm2.js → collapsible-DbkDwHwV.js} +1 -1
- package/dist/assets/{context-menu-DFRg1NJF.js → context-menu-HomYNhkr.js} +1 -1
- package/dist/assets/desktopHosts-DovfbQPm.js +1 -0
- package/dist/assets/desktopRelayRestore-D4pbpNKN.js +1 -0
- package/dist/assets/device-DNG0cNwQ.js +2 -0
- package/dist/assets/{diagram-OTF8YAve.js → diagram-if-ktgjK.js} +1 -1
- package/dist/assets/dialog-0fjbRGoX.js +1 -0
- package/dist/assets/{es-CrVDn7XV.js → es-30Wqm-Bx.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-CorehkTj.js → fileMentionTouchSelection-OwF_hr-t.js} +1 -1
- package/dist/assets/{fileQueries-BaEKb7SZ.js → fileQueries-D9l0crnM.js} +1 -1
- package/dist/assets/fileReferenceActions-BRF8f7uA.js +1 -0
- package/dist/assets/{fileReferenceParser-BayaidRM.js → fileReferenceParser-1HHDBUum.js} +1 -1
- package/dist/assets/{fr-CCwt5AOu.js → fr-BbWLXNYa.js} +1 -1
- package/dist/assets/{gitApi-C6rhS4rG.js → gitApi-dAPSCbXA.js} +8 -8
- package/dist/assets/gitApiHttp-B1mApXwC.js +9 -0
- package/dist/assets/{gui-CFdPKvfq.js → gui-DN2sVP96.js} +1 -1
- package/dist/assets/{historyImportQueries-BrhVXQhP.js → historyImportQueries-DkB2_92i.js} +1 -1
- package/dist/assets/host-kMLXU0hK.js +1 -0
- package/dist/assets/i18n-BU14awhU.js +1 -0
- package/dist/assets/image-loading-DEXNCcCm.js +1 -0
- package/dist/assets/{input-B7-PmgcW.js → input-DYmLJuhI.js} +1 -1
- package/dist/assets/insertionBoundaries-CYfwgLf1.js +1 -0
- package/dist/assets/{ja-BfwjUNPc.js → ja-BI7m9bgW.js} +1 -1
- package/dist/assets/{ko-CZQZFkal.js → ko-B89SVFZa.js} +1 -1
- package/dist/assets/main-CaueNFt7.js +169 -0
- package/dist/assets/main-DrIci_pj.js +2 -0
- package/dist/assets/{markdownHeightCache-DlRC53XG.js → markdownHeightCache-D8yqNy2h.js} +1 -1
- package/dist/assets/mcpQueries-DO2TKARf.js +1 -0
- package/dist/assets/miniChat-BTI2ObZ2.js +2 -0
- package/dist/assets/mobile-Cf_sQtW6.js +2 -0
- package/dist/assets/mobile-html-network-CsjZ_Ur0.js +2 -0
- package/dist/assets/mobile-network-bridge-B_h92A-9.js +1 -0
- package/dist/assets/mobileBackNavigation-DxG3cz8q.js +1 -0
- package/dist/assets/mobileConnections-CK4dMDCg.js +2 -0
- package/dist/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/dist/assets/multirun-Cd2-PUEk.js +3 -0
- package/dist/assets/native-config-C_nB8tLu.js +1 -0
- package/dist/assets/pages-CYkE04ml.js +1 -0
- package/dist/assets/path-utils-jGozTg9d.js +1 -0
- package/dist/assets/pathNormalization-ewtPqJWn.js +1 -0
- package/dist/assets/{pl-B6C3vXqv.js → pl-B55Lf3HE.js} +1 -1
- package/dist/assets/platform-DMsFWy1a.js +1 -0
- package/dist/assets/projectMeta-apTlCt8d.js +1 -0
- package/dist/assets/{pt-BR-BUDTNopP.js → pt-BR-CFZj-ECy.js} +1 -1
- package/dist/assets/pwa-wwvKWKhX.js +2 -0
- package/dist/assets/queue-abort-optimistic-BnynR3mX.js +1 -0
- package/dist/assets/react-B-mb0CtR.js +1 -0
- package/dist/assets/readiness-0tATst8c.js +1 -0
- package/dist/assets/reasoning-projection-client-BEhVknv9.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-xQdVdaLB.js +2 -0
- package/dist/assets/renderMobileApp-D95eHLRE.js +29 -0
- package/dist/assets/{runtime-auth-Bh3htXtG.js → runtime-auth-mjIpsk3N.js} +1 -1
- package/dist/assets/runtime-fetch-DKZOpfzo.js +1 -0
- package/dist/assets/runtime-file-download-DMY1k1af.js +1 -0
- package/dist/assets/runtime-file-resource-CL7EVzOG.js +2 -0
- package/dist/assets/runtime-switch-BMjl5Y5W.js +1 -0
- package/dist/assets/runtimeAPIRegistry-C2VogTny.js +1 -0
- package/dist/assets/runtimeConfig-BfzZj4LK.js +2 -0
- package/dist/assets/runtimeEndpointReset-CjKHwDvh.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-C8tBjNoP.js → scheduledTaskNavigation-PH-etFzZ.js} +1 -1
- package/dist/assets/select-B9Km1pk9.js +1 -0
- package/dist/assets/sessionLookup-8gdDN8Tx.js +1 -0
- package/dist/assets/sortable-tabs-strip-BU0Puyy0.js +1 -0
- package/dist/assets/{speechSettingsQueries-CJqxaC2Q.js → speechSettingsQueries-C9LCquzH.js} +1 -1
- package/dist/assets/src-BFQde2OG.css +2 -0
- package/dist/assets/{store-Myt_Fv8d.js → store-BNNIbb4k.js} +3 -3
- package/dist/assets/terminalApi-BXKIVBPo.js +1 -0
- package/dist/assets/textarea-bB6aD-GS.js +1 -0
- package/dist/assets/{tooltip-D5Xeh6py.js → tooltip-DgWHbKz2.js} +1 -1
- package/dist/assets/{types-DXSnGXVb.js → types-CnJjf4tP.js} +1 -1
- package/dist/assets/{uk-Ct9y1Y2t.js → uk-CS2c4Dtj.js} +1 -1
- package/dist/assets/{useAppFontEffects-Blo2lGTo.js → useAppFontEffects-DJp1u2mc.js} +35 -35
- package/dist/assets/{useAssistantUIStore-CVSFSgJV.js → useAssistantUIStore-Du8puXWz.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-DOmb8EnW.js +1 -0
- package/dist/assets/useDictation-CyWtsxSn.js +1 -0
- package/dist/assets/useEffectiveDirectory-DmGrksdp.js +1 -0
- package/dist/assets/{useFontPreferences-DqBoLHp6.js → useFontPreferences-CAdw6cBK.js} +1 -1
- package/dist/assets/useMobileHtmlPreviewStore-C03uVLfX.js +1 -0
- package/dist/assets/useMobileNavigationStore-CJBLQxTz.js +17 -0
- package/dist/assets/usePluginsStore-El9Tx9Q3.js +1 -0
- package/dist/assets/useStreamingTextThrottle-BbUkYQhX.js +1 -0
- package/dist/assets/useUIStore-BF882_0b.js +1 -0
- package/dist/assets/useWorkerHighlightedLines-CZ8YG-Hi.js +7 -0
- package/dist/assets/{zh-CN-BegPizz4.js → zh-CN-BpiwUUs4.js} +1 -1
- package/dist/assets/{zh-TW-4xftqQQG.js → zh-TW-Bl9CnlGi.js} +1 -1
- package/dist/index.html +26 -21
- package/dist/mini-chat.html +26 -21
- package/dist/mobile.html +4 -32
- package/package.json +1 -1
- package/server/index.js +10 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +2 -0
- package/server/lib/gui-customization/skill/SKILL.md +1 -1
- package/server/lib/gui-customization/skill/references/global-pages.md +19 -4
- package/server/lib/gui-customization/skill/references/gui-api.md +1 -1
- package/server/lib/gui-customization/skill/references/icons.md +35 -8
- package/server/lib/gui-network/DOCUMENTATION.md +123 -0
- package/server/lib/gui-network/native-ios.test.js +127 -0
- package/server/lib/gui-network/runtime.js +146 -0
- package/server/lib/gui-network/runtime.test.js +129 -0
- package/server/lib/preview/proxy-runtime.js +1 -1
- package/server/lib/preview/proxy-runtime.test.js +4 -0
- package/server/lib/relay/DOCUMENTATION.md +5 -0
- package/server/lib/relay/tunnel-host.js +2 -1
- package/server/lib/ui-auth/DOCUMENTATION.md +8 -0
- package/server/lib/ui-auth/ui-auth.js +6 -0
- package/server/lib/ui-auth/ui-auth.test.js +10 -0
- package/dist/assets/AssistantContactStatus-C5zpVdGa.js +0 -3
- package/dist/assets/AssistantUnreadBadge-7KpCtnd3.js +0 -1
- package/dist/assets/AssistantView-BZU6TlwK.js +0 -1
- package/dist/assets/DiagramView-CXgsVJ3A.js +0 -1
- package/dist/assets/GuiPluginSurface-Bk01hnV6.js +0 -1
- package/dist/assets/GuiPluginWindow-BgOCEgEb.js +0 -1
- package/dist/assets/ImageLoadingPlaceholder-MfVzv_y1.js +0 -1
- package/dist/assets/LoadingImage-MAgXscGl.js +0 -1
- package/dist/assets/MarkdownRenderer-DswMDaKf.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-Bqbq2VPn.js +0 -3
- package/dist/assets/MobileDetailNavigation-CXcMdlRH.js +0 -1
- package/dist/assets/MobileResizableSheet-D_PnyzR0.js +0 -1
- package/dist/assets/MobileShareBridge-DfgyncNh.js +0 -4
- package/dist/assets/MobileTabPageHeader-Bm8nYrzH.js +0 -2
- package/dist/assets/MultiRunWindow-CvCgKiyV.js +0 -1
- package/dist/assets/OnboardingScreen-BwJ3iMGY.js +0 -1
- package/dist/assets/SettingsView-DGduWj3I.js +0 -29
- package/dist/assets/SettingsWindow-BM8abllV.js +0 -1
- package/dist/assets/SetupTourDialog-vmNGHNXl.js +0 -1
- package/dist/assets/TerminalView-BZObkK0H.js +0 -8
- package/dist/assets/ToolOutputDialog-CbGuK5bP.css +0 -1
- package/dist/assets/ToolOutputDialog-D_CH2A0-.js +0 -10
- package/dist/assets/VoiceSettings-Ru8tm8eq.js +0 -2
- package/dist/assets/YuriLogo-C5K_9jSK.js +0 -1
- package/dist/assets/YuriWordmark-CJ8qJ14A.js +0 -1
- package/dist/assets/appThemeRegistry-CcdIpK3S.js +0 -1
- package/dist/assets/bootstrap-BzeQds0D.js +0 -9
- package/dist/assets/desktop-Brp3xDpd.js +0 -1
- package/dist/assets/desktopHosts-qQ2Rz26_.js +0 -1
- package/dist/assets/desktopRelayRestore-DifJHAur.js +0 -1
- package/dist/assets/device-Db_TcRdX.js +0 -2
- package/dist/assets/dialog-CgtwKUKd.js +0 -1
- package/dist/assets/fileReferenceActions-D06_lyuL.js +0 -1
- package/dist/assets/host-8TDDnZXo.js +0 -1
- package/dist/assets/image-loading-D1DfK_bJ.js +0 -1
- package/dist/assets/insertionBoundaries-B-ncem5c.js +0 -1
- package/dist/assets/main-BMvwUUi4.js +0 -2
- package/dist/assets/main-Chq1F31E.js +0 -169
- package/dist/assets/mcpQueries-BRFr-Gfm.js +0 -1
- package/dist/assets/miniChat-C3vDY9WG.js +0 -2
- package/dist/assets/mobile-B2KYTY1c.js +0 -2
- package/dist/assets/mobileBackNavigation-ByUDCJde.js +0 -1
- package/dist/assets/multirun-F1yOJb2_.js +0 -3
- package/dist/assets/native-config-C2j59qnN.js +0 -1
- package/dist/assets/path-utils-HRmerlyU.js +0 -1
- package/dist/assets/platform-Dids8J9D.js +0 -1
- package/dist/assets/projectMeta-C08trpZE.js +0 -1
- package/dist/assets/pwa-C956NPB0.js +0 -2
- package/dist/assets/queue-abort-optimistic-CWyeG_sJ.js +0 -1
- package/dist/assets/react-a6PrrNTm.js +0 -1
- package/dist/assets/readiness-CUPPcONt.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-DNK4YFG8.js +0 -2
- package/dist/assets/renderMobileApp-DagPx3n0.js +0 -28
- package/dist/assets/runtime-fetch-9B8F_rKW.js +0 -1
- package/dist/assets/runtime-file-download-D4WGSMk-.js +0 -1
- package/dist/assets/runtime-file-resource-tDTBpJT_.js +0 -2
- package/dist/assets/runtime-switch-ibQIZnws.js +0 -1
- package/dist/assets/runtimeConfig-D_McrwNd.js +0 -2
- package/dist/assets/runtimeEndpointReset-D-aHzKPN.js +0 -149
- package/dist/assets/select-DoYUmvbX.js +0 -1
- package/dist/assets/sessionLookup-D2JIMvDo.js +0 -1
- package/dist/assets/sortable-tabs-strip-B-W7ADKC.js +0 -1
- package/dist/assets/src-CzDk_0Pp.css +0 -2
- package/dist/assets/terminalApi-BXf0a2VZ.js +0 -1
- package/dist/assets/textarea-BCTNmuPZ.js +0 -1
- package/dist/assets/url-DO6Zrx1P.js +0 -1
- package/dist/assets/useDesktopWindowControlsLayout-YAxhtSDl.js +0 -1
- package/dist/assets/useDictation-Dp2Y3X49.js +0 -1
- package/dist/assets/useEffectiveDirectory-Uc8I6wXt.js +0 -1
- package/dist/assets/useMobileNavigationStore-SCjA_7jP.js +0 -17
- package/dist/assets/usePluginsStore-DfksbEZx.js +0 -1
- package/dist/assets/useStreamingTextThrottle-BY1Ynoj1.js +0 -1
- package/dist/assets/useUIStore-BsCfUWQw.js +0 -1
- package/dist/assets/useWorkerHighlightedLines-DAxMD3fK.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as e}from"./runtime-auth-Bh3htXtG.js";import{r as t,t as n}from"./runtime-switch-ibQIZnws.js";import{s as r}from"./path-utils-HRmerlyU.js";var i=[`local`,`remote`,null],a=[`ok`,`not-configured`,`unreachable`,`pairing-expired`,`incompatible`,`wrong-service`,`missing`];function o(e){if(!e||typeof e!=`object`)return{valid:!1};let t=e,n=t.target,r=t.status;if(n!==null&&(typeof n!=`string`||!i.includes(n))||typeof r!=`string`||!a.includes(r))return{valid:!1};if(n===`remote`||n===`local`){if(r===`ok`&&n===`local`)return{valid:!0,outcome:{target:`local`,status:`ok`}};if(r===`ok`&&n===`remote`)return typeof t.hostId!=`string`||typeof t.url!=`string`?{valid:!1}:{valid:!0,outcome:{target:`remote`,status:`ok`,hostId:t.hostId,url:t.url}};if(r===`unreachable`)return n===`local`?{valid:!0,outcome:{target:`local`,status:`unreachable`}}:typeof t.hostId!=`string`||typeof t.url!=`string`?{valid:!1}:{valid:!0,outcome:{target:`remote`,status:`unreachable`,hostId:t.hostId,url:t.url}};if(r===`incompatible`||r===`wrong-service`||r===`pairing-expired`)return n!==`remote`||typeof t.hostId!=`string`||typeof t.url!=`string`?{valid:!1}:{valid:!0,outcome:{target:`remote`,status:r,hostId:t.hostId,url:t.url}};if(r===`missing`)return n!==`remote`||typeof t.hostId!=`string`?{valid:!1}:{valid:!0,outcome:{target:`remote`,status:`missing`,hostId:t.hostId}}}if(n===null){if(r===`not-configured`)return{valid:!0,outcome:{target:null,status:`not-configured`}};if(r===`missing`)return{valid:!1}}return{valid:!1}}function s(e){if(!e.isDesktopShell)return null;let t=e.bootOutcome;if(!t)return null;if(t.status===`ok`){if(t.target===`local`)return{screen:`main`};if(t.target===`remote`)return{screen:`main`,hostId:t.hostId,url:t.url}}if(t.target===null&&t.status===`not-configured`)return{screen:`chooser`};if(t.target===`local`&&t.status===`unreachable`)return{screen:`recovery`,variant:`local-unavailable`};if(t.target===`remote`){if(t.status===`unreachable`)return{screen:`recovery`,variant:`remote-unreachable`,hostId:t.hostId,url:t.url};if(t.status===`pairing-expired`)return{screen:`recovery`,variant:`remote-pairing-expired`,hostId:t.hostId,url:t.url};if(t.status===`incompatible`)return{screen:`recovery`,variant:`remote-incompatible`,hostId:t.hostId,url:t.url};if(t.status===`wrong-service`)return{screen:`recovery`,variant:`remote-wrong-service`,hostId:t.hostId,url:t.url};if(t.status===`missing`)return{screen:`recovery`,variant:`remote-missing`,hostId:t.hostId}}return null}function c(e){return e.isDesktopShell?e.bootOutcomeKnown?e.bootViewIsMain===!1||e.isInitialized:!1:e.isInitialized}function l(e){return e.isDesktopShell&&!e.isDesktopLocalOriginActive}function u(){if(f()!==`valid`)return null;let e=o(d());return e.valid?e.outcome:null}var d=()=>{if(typeof window>`u`)return;let e=window.__YURI_DESKTOP_BOOT_OUTCOME__;if(e!=null)return e;let t=window.__YURI_DESKTOP_BOOT__;if(t&&typeof t.getOutcome==`function`)try{return t.getOutcome()}catch{return}return e};function f(){if(typeof window>`u`)return`not-injected`;let e=d();return e==null?`not-injected`:o(e).valid?`valid`:`malformed`}var p=()=>typeof window>`u`?null:window.__YURI_ELECTRON__??null,m=()=>typeof window>`u`?null:window.__YURI_DESKTOP__??null,h=()=>p()?.runtime===`electron`,g=()=>h()&&p()?.packaged===!0,_=e=>{if(!h())return null;let t=m()?.getPathForFile?.(e);return typeof t==`string`&&t.trim()?t:null},v=()=>{if(typeof window>`u`)return null;let e=window.__YURI_PLATFORM__;return typeof e==`string`?e:null},y=()=>{if(!h())return!1;let e=v();return e===`win32`||e===`linux`},b=(e=v())=>e===`linux`?`left`:`right`,x=(e,t=v())=>e===`left`||e===`right`?e:b(t),S=()=>typeof m()?.invoke==`function`,C=()=>h()&&S(),ee=()=>S()&&R()&&m()?.isDocumentRestricted?.()!==!0,w=()=>h()&&R()?m()?.guiPlugins:void 0,T=()=>h()?m()?.guiPlugins:void 0,E=()=>h()?m()?.viewExport:void 0,D=async(e,t)=>{let n=m();return typeof n?.invoke==`function`?n.invoke(e,t??{}):null},te=async e=>{if(!C()||!R())throw Error(`unsupported`);let t=await D(e.type===`status`?`desktop_remote_desktop_status`:e.type===`enabled`?`desktop_remote_desktop_enable`:`desktop_remote_desktop_permission`,{...e});if(!t||typeof t.supported!=`boolean`||typeof t.enabled!=`boolean`||typeof t.screenRecording!=`string`||typeof t.accessibility!=`boolean`||typeof t.helperAvailable!=`boolean`||typeof t.ready!=`boolean`)throw Error(`invalid_desktop_status`);return t},O=async()=>{if(!C()||!R())return null;try{let e=await D(`desktop_get_launch_at_login`);return!e||typeof e.supported!=`boolean`||typeof e.enabled!=`boolean`?null:e}catch(e){return console.warn(`Failed to get launch at login status`,e),null}},k=async e=>{if(!C()||!R())return null;try{let t=await D(`desktop_set_launch_at_login`,{enabled:e});return!t||typeof t.supported!=`boolean`||typeof t.enabled!=`boolean`?null:t}catch(e){return console.warn(`Failed to set launch at login status`,e),null}},A=async()=>{if(!C()||!R())return null;try{let e=await D(`desktop_get_minimize_to_tray`);return!e||typeof e.supported!=`boolean`||typeof e.enabled!=`boolean`?null:e}catch(e){return console.warn(`Failed to get minimize to tray status`,e),null}},j=async e=>{if(!C()||!R())return null;try{let t=await D(`desktop_set_minimize_to_tray`,{enabled:e});return!t||typeof t.supported!=`boolean`||typeof t.enabled!=`boolean`?null:t}catch(e){return console.warn(`Failed to set minimize to tray status`,e),null}},M=async()=>{if(!C()||!R())return null;try{let e=await D(`desktop_get_keep_awake`);return!e||typeof e.supported!=`boolean`||typeof e.enabled!=`boolean`||typeof e.active!=`boolean`?null:e}catch(e){return console.warn(`Failed to get keep awake status`,e),null}},N=async e=>{if(!C()||!R())return null;try{let t=await D(`desktop_set_keep_awake`,{enabled:e});return!t||typeof t.supported!=`boolean`||typeof t.enabled!=`boolean`||typeof t.active!=`boolean`?null:t}catch(e){return console.warn(`Failed to set keep awake status`,e),null}},P=e=>{let t=e.trim();if(!t)return null;try{return new URL(t).origin}catch{try{return new URL(t.endsWith(`/`)?t:`${t}/`).origin}catch{return null}}},F=e=>{let t=e.trim();if(!t)return null;try{return new URL(t)}catch{try{return new URL(t.endsWith(`/`)?t:`${t}/`)}catch{return null}}},I=e=>e.replace(/^\[|\]$/g,``).toLowerCase(),L=e=>{let t=I(e);return t===`localhost`||t===`127.0.0.1`||t===`::1`},R=()=>{if(typeof window>`u`||!z()||e())return!1;let r=t();if(r.startsWith(`host:`))return!1;if(r===`local`)return!0;let i=typeof window.__YURI_LOCAL_ORIGIN__==`string`?window.__YURI_LOCAL_ORIGIN__:``,a=F(i),o=F(n());if(!o&&a&&u()?.target===`local`)return!0;if(a&&o){if(a.origin===o.origin)return!0;let e=a.port||(a.protocol===`https:`?`443`:`80`),t=o.port||(o.protocol===`https:`?`443`:`80`);return a.protocol===o.protocol&&e===t&&L(a.hostname)&&L(o.hostname)}let s=F(window.location.origin);if(a&&s){if(a.origin===s.origin)return!0;let e=a.port||(a.protocol===`https:`?`443`:`80`),t=s.port||(s.protocol===`https:`?`443`:`80`);return a.protocol===s.protocol&&e===t&&L(a.hostname)&&L(s.hostname)}let c=P(i),l=P(window.location.origin)||window.location.origin;return c&&l&&c===l?!0:!!(s&&L(s.hostname))},z=()=>typeof window>`u`?!1:h(),B=async()=>{if(!z())return!1;try{return await D(`desktop_start_window_drag`),!0}catch{return!1}},V=()=>r()?.runtime?.isVSCode===!0,H=()=>{let e=r()?.runtime?.platform;return e===`web`?!0:e===`desktop`||e===`vscode`?!1:!V()},U=async()=>{if(typeof window<`u`){let e=window.__YURI_HOME__;if(e&&e.length>0)return e}return null},ne=async e=>{if(S()&&R())try{let e=await m()?.openDialog?.({directory:!0,multiple:!1,title:`Select Working Directory`});return!e||typeof e!=`string`?{success:!1,error:`Directory selection cancelled`}:{success:!0,path:e}}catch(e){return console.warn(`Failed to request directory access`,e),{success:!1,error:e instanceof Error?e.message:String(e)}}return{success:!0,path:e}},W=e=>typeof e==`object`&&!!e&&!Array.isArray(e),G=async e=>{if(S()&&R())try{let t=await m()?.openDialog?.({directory:!1,multiple:!1,title:`Select File`,returnGrant:!0,...e?.filters?{filters:e.filters}:{},...e?.defaultPath?{defaultPath:e.defaultPath}:{}});if(!t)return{success:!1,error:`File selection cancelled`};if(typeof t==`string`)return{success:!0,path:t};if(!W(t))return{success:!1,error:`File selection cancelled`};let n=typeof t.path==`string`?t.path:``;return n?{success:!0,path:n,outsideFileGrant:typeof t.outsideFileGrant==`string`?t.outsideFileGrant:void 0}:{success:!1,error:`File selection cancelled`}}catch(e){return console.warn(`Failed to request file access`,e),{success:!1,error:e instanceof Error?e.message:String(e)}}return{success:!1,error:`Native file picker not available`}},K=async e=>{let t=typeof e==`string`?e.trim():``;if(!t)return{success:!1,error:`Path is required`};if(!S()||!R())return{success:!1,error:`Native file access not available`};try{let e=await m()?.grantFileAccess?.(t);if(!W(e))return{success:!1,error:`File access was not granted`};let n=typeof e.path==`string`?e.path:``,r=typeof e.outsideFileGrant==`string`?e.outsideFileGrant:``;return!n||!r?{success:!1,error:`File access was not granted`}:{success:!0,path:n,outsideFileGrant:r}}catch(e){return console.warn(`Failed to request existing file access`,e),{success:!1,error:e instanceof Error?e.message:String(e)}}},q=async e=>({success:!0}),J=async e=>({success:!0}),Y=async e=>{if(!S())throw Error(`Desktop update checker is unavailable`);let t=await D(`desktop_check_for_updates`,{channelOverride:e});if(!t)throw Error(`Desktop update checker returned no result`);return t},X=async e=>{S()&&await D(`desktop_ota_ready`,{version:e})},Z=()=>D(`desktop_get_app_version`),re=async e=>{let t=m();return typeof t?.listen==`function`?t.listen(`yuri:update-progress`,t=>{let n=t?.payload;if(!n||typeof n!=`object`)return;let r=n;e({event:typeof r.event==`string`?r.event:void 0,data:r.data&&typeof r.data==`object`?r.data:void 0})}):null},ie=async e=>{let t=m();return typeof t?.listen==`function`?t.listen(`yuri:update-ready`,t=>{let n=t?.payload;if(!n||typeof n!=`object`)return;let r=n;e({version:typeof r.version==`string`?r.version:null,downloaded:r.downloaded===!0})}):null},ae=async e=>{if(!S())return!1;let t=m(),n=null,r=0,i;try{return typeof e==`function`&&t?.listen&&(n=await t.listen(`yuri:update-progress`,t=>{let n=t?.payload;if(!n||typeof n!=`object`)return;let a=n,o=typeof a.event==`string`?a.event:null,s=a.data&&typeof a.data==`object`?a.data:null;if(o===`Started`){r=0,i=typeof s?.contentLength==`number`?s.contentLength:void 0,e({downloaded:r,total:i});return}if(o===`Progress`){let t=s?.downloaded,n=s?.total;typeof t==`number`&&(r=t),typeof n==`number`&&(i=n),e({downloaded:r,total:i});return}o===`Finished`&&e({downloaded:r,total:i})})),await D(`desktop_download_and_install_update`),!0}catch(e){throw e instanceof Error?e:Error(String(e))}finally{if(n)try{let e=n();e instanceof Promise&&await e}catch{}}},oe=async()=>S()?Q({applyUpdate:!0}):!1,Q=async({applyUpdate:e=!1}={})=>{if(!S())return!1;try{return await D(`desktop_restart`,e?{applyUpdate:!0}:void 0),!0}catch(e){return console.warn(`Failed to restart desktop app`,e),!1}},se=async()=>{if(!S()||!R())return null;try{let e=await D(`desktop_get_lan_address`);return typeof e==`string`&&e.trim().length>0?e.trim():null}catch(e){return console.warn(`Failed to get desktop LAN address`,e),null}},$=async(e,t)=>{if(!S()||!R())return!1;let n=e?.trim();if(!n)return!1;try{return await D(`desktop_open_path`,{path:n,app:typeof t==`string`&&t.trim().length>0?t.trim():void 0}),!0}catch(e){return console.warn(`Failed to open path`,e),!1}},ce=async e=>{if(!S()||!R())return null;let t=e?.trim();if(!t)return null;try{let e=await D(`desktop_is_binary_path`,{path:t});return typeof e==`boolean`?e:null}catch{return null}},le=async e=>{if(!S()||!R()||!e.trim())return!1;try{return await D(`desktop_is_directory_path`,{path:e.trim()})===!0}catch{return!1}},ue=async e=>{if(!S()||!R())return!1;let t=e?.trim();if(!t)return!1;try{return await D(`desktop_reveal_path`,{path:t}),!0}catch{return $(t)}},de=async(e,t)=>{if(!S()||!R())return null;let n=e?.trim();if(!n)return null;try{let e=await D(`desktop_save_markdown_file`,{defaultFileName:n,content:t});return typeof e==`string`&&e.trim().length>0?e:null}catch(e){return console.warn(`Failed to save markdown file`,e),null}},fe=async(e,n,r,i)=>{if(!S()||!i&&!R())return!1;if(i)return t()===`host:${i}`&&(await D(`desktop_open_ssh_in_app`,{projectPath:e,appId:n,hostId:i}),!0);let a=e?.trim(),o=n?.trim(),s=r?.trim();if(!a||!o||!s)return!1;try{return await D(`desktop_open_in_app`,{projectPath:a,appId:o,appName:s}),!0}catch(e){return console.warn(`Failed to open project in app`,e),!1}},pe=async(e,t,n)=>{if(!S()||!R())return!1;let r=e?.trim(),i=t?.trim(),a=n?.trim();if(!r||!i||!a)return!1;try{return await D(`desktop_open_file_in_app`,{filePath:r,appId:i,appName:a}),!0}catch(e){return console.warn(`Failed to open file in app`,e),!1}},me=async(e,t)=>{if(!S())return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};if(v()===`linux`)return{apps:[],success:!0,hasCache:!1,isCacheStale:!1};let n=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];if(n.length===0)return{apps:[],success:!0,hasCache:!1,isCacheStale:!1};try{let e=await D(`desktop_get_installed_apps`,{apps:n,force:t===!0||void 0});if(!e||typeof e!=`object`)return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};let r=e;return r.supported===!1?{apps:[],success:!0,hasCache:!1,isCacheStale:!1}:Array.isArray(r.apps)?{apps:r.apps.filter(e=>e&&typeof e==`object`).map(e=>{let t=e;return{name:typeof t.name==`string`?t.name:``,iconDataUrl:typeof t.iconDataUrl==`string`?t.iconDataUrl:null}}).filter(e=>e.name.length>0),success:!0,hasCache:r.hasCache===!0,isCacheStale:r.isCacheStale===!0}:{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}catch(e){return console.warn(`Failed to fetch installed apps`,e),{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}};export{l as $,X as A,ue as B,z as C,H as D,V as E,K as F,q as G,N as H,G as I,y as J,B as K,x as L,$ as M,fe as N,re as O,ne as P,s as Q,Q as R,R as S,g as T,k as U,de as V,j as W,f as X,c as Y,u as Z,v as _,ae as a,ce as b,w as c,M as d,se as f,_ as g,E as h,te as i,pe as j,ie as k,T as l,A as m,C as n,me as o,O as p,J as q,Y as r,Z as s,ee as t,U as u,S as v,h as w,le as x,D as y,oe as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e}from"./runtime-auth-Bh3htXtG.js";import{v as t,y as n}from"./desktop-Brp3xDpd.js";var r=e=>typeof e==`object`&&!!e,i=e=>e.trim().toLowerCase()===`authorization`,a=e=>{if(!r(e))return;let t={};for(let[n,r]of Object.entries(e)){let e=n.trim(),a=typeof r==`string`?r.trim():``;!e||!a||/[\r\n:]/.test(e)||/[\r\n]/.test(a)||i(e)||(t[e]=a)}return Object.keys(t).length>0?t:void 0},o=`connect-link`,s=e=>!!(e.clientToken&&(e.source===`connect-link`||e.relay)),c=(e,t)=>e.source===`connect-link`||e.relay?!0:t.has(e.id),l=(e,t)=>!t.has(e.id)&&c(e,t),u=e=>`relay://${e}`,d=e=>{if(!r(e))return null;let t=_(e,`relayUrl`)||_(e,`relay_url`),n=_(e,`serverId`)||_(e,`server_id`),i=e.hostEncPubJwk??e.host_enc_pub_jwk;return!t||!n||!r(i)?null:{relayUrl:t,serverId:n,hostEncPubJwk:i}},f=/^(t|.*(?:token|auth|secret|api).*)$/i,p=e=>{let t=e.trim();if(!t)return null;try{let e=new URL(t);return e.protocol!==`http:`&&e.protocol!==`https:`?null:t.split(`#`)[0]||null}catch{return null}},m=e=>{let t=p(e);if(!t)return null;try{let e=new URL(t);if((e.pathname.replace(/\/+$/,``)||`/`)===`/connect`&&e.searchParams.has(`t`))return{persistedUrl:e.origin,redeemUrl:e.toString(),kind:`tunnel-connect-link`}}catch{return null}return{persistedUrl:t,redeemUrl:null,kind:`normal-host`}},h=e=>{let t=p(e);if(!t)return e;try{let e=new URL(t);(e.username||e.password)&&(e.username=``,e.password=``);let n=Array.from(new Set(Array.from(e.searchParams.keys())));for(let t of n)f.test(t)&&e.searchParams.set(t,`[REDACTED]`);return e.toString()}catch{return t}},g=(e,t)=>{let n=p(e),r=p(t);if(!n||!r)return!1;try{let e=new URL(n),t=new URL(r);if(e.origin!==t.origin||t.search&&e.search!==t.search)return!1;let i=t.pathname.length>1?t.pathname.replace(/\/+$/,``):t.pathname,a=e.pathname.length>1?e.pathname.replace(/\/+$/,``):e.pathname;return i===`/`||a===i||a.startsWith(`${i}/`)}catch{return!1}},_=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},v=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},y=e=>{if(!r(e))return null;let t=_(e,`id`),n=_(e,`label`),i=_(e,`url`),s=_(e,`apiUrl`)||_(e,`api_url`),c=_(e,`clientToken`)||_(e,`client_token`),l=a(e.requestHeaders),u=d(e.relay),f=_(e,`source`)===`connect-link`?o:void 0;return!t||!n||!i&&!u?null:{id:t,label:n,url:i||``,...s?{apiUrl:s}:{},...c?{clientToken:c}:{},...l?{requestHeaders:l}:{},...u?{relay:u}:{},...f?{source:f}:{}}},b=e=>p(e.apiUrl||e.url)||e.apiUrl||e.url,x=()=>t()?(e,t)=>n(e,t):null,S=async()=>{let e=x();if(!e)return{hosts:[],defaultHostId:null,initialHostChoiceCompleted:!1};let t=await e(`desktop_hosts_get`);if(!r(t))return{hosts:[],defaultHostId:null,initialHostChoiceCompleted:!1};let n=t.hosts,i=Array.isArray(n)?n.map(y).filter(e=>!!e):[],a=_(t,`defaultHostId`)||_(t,`default_host_id`)||_(t,`defaultHostID`),o=t.initialHostChoiceCompleted===!0||t.initial_host_choice_completed===!0,s=_(t,`localOrigin`)||_(t,`local_origin`),c=Array.isArray(t.sshHostIds)?t.sshHostIds.filter(e=>typeof e==`string`&&i.some(t=>t.id===e)):void 0;return{hosts:i,defaultHostId:a,initialHostChoiceCompleted:o,localOrigin:s,...c?{sshHostIds:c}:{}}},C=async e=>{let t=x();if(!t)return;let n={hosts:e.hosts,defaultHostId:e.defaultHostId,initialHostChoiceCompleted:e.initialHostChoiceCompleted};e.localClientToken!==void 0&&(n.localClientToken=e.localClientToken),await t(`desktop_hosts_set`,{input:n})},w=async e=>{let t=x();if(!t)throw Error(`Desktop host preparation is unavailable`);let n=y(await t(`desktop_host_prepare`,{hostId:e.id}));if(!n||n.id!==e.id)throw Error(`Invalid prepared desktop host`);return n},T=async()=>{let e=x();if(!e)throw Error(`Local host settings are unavailable`);await e(`desktop_open_local_host_settings`)},E=async()=>{let e=x();if(!e)return``;let t=await e(`desktop_local_client_token_get`).catch(()=>null);return typeof t==`string`?t.trim():``},D=async()=>{let e=x();if(!e)return``;let t=await e(`desktop_install_id_get`).catch(()=>null);return typeof t==`string`?t.trim():``},O=8e3,k=async(t,n)=>{let r=e({relayUrl:t.relayUrl,serverId:t.serverId,hostEncPubJwk:t.hostEncPubJwk}),i=Date.now(),a=!1,o;try{let e=await Promise.race([(async()=>{let e=await r.fetch(`/auth/session`,{headers:n?.clientToken?{Authorization:`Bearer ${n.clientToken}`}:{}});return{response:e,payload:e.ok?await e.json().catch(()=>null):null}})(),new Promise(e=>{o=setTimeout(()=>e(null),O)})]),t=e?.response;return t?.status===401||t?.status===403?{status:`auth`,latencyMs:Math.max(0,Date.now()-i)}:t?.ok?e?.payload?.authenticated===!0?(a=n?.keepTunnel===!0,{status:`ok`,latencyMs:Math.max(0,Date.now()-i),...a?{tunnel:r}:{}}):{status:`auth`,latencyMs:Math.max(0,Date.now()-i)}:{status:`unreachable`,latencyMs:0}}catch{return{status:`unreachable`,latencyMs:0}}finally{o!==void 0&&clearTimeout(o),a||r.close()}},A=async(e,t)=>{let n=x();if(!n)return{status:`unreachable`,latencyMs:0};let i=await n(`desktop_host_probe`,{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0,expectedServerId:t?.expectedServerId||void 0});if(!r(i))return{status:`unreachable`,latencyMs:0};let a=i.status;return{status:a===`ok`||a===`auth`||a===`update-recommended`||a===`incompatible`||a===`wrong-service`||a===`unreachable`?a:`unreachable`,latencyMs:v(i,`latencyMs`)??v(i,`latency_ms`)??0}},j=async(e,t)=>{let n=x();n&&await n(`desktop_new_window_at_url`,{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0})},M=async e=>{let t=x();t&&await t(`desktop_new_window_for_host`,{hostId:e})};export{k as _,D as a,m as b,j as c,b as d,s as f,p as g,g as h,C as i,M as l,c as m,A as n,E as o,l as p,S as r,T as s,o as t,w as u,h as v,u as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./runtime-auth-Bh3htXtG.js";import{l as t,n,r,t as i}from"./runtime-switch-ibQIZnws.js";import{n as a}from"./runtime-fetch-9B8F_rKW.js";import{Z as o,w as s}from"./desktop-Brp3xDpd.js";import{_ as c,d as l,f as u,g as d,i as f,n as p,r as m,u as h}from"./desktopHosts-qQ2Rz26_.js";var g=e=>e!==`ok`&&e!==`update-recommended`,_=e=>e.id===`local`?`local`:`host:${e.id}`,v=e=>r()===_(e),y=async(n,r)=>{if(!s())return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};n=await h(n);let i=d(l(n))||``;if(!i&&!n.relay)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`};let a=(r,i)=>{i&&e({relayUrl:r.relayUrl,serverId:r.serverId,hostEncPubJwk:r.hostEncPubJwk},i),t({apiBaseUrl:E(),clientToken:n.clientToken||null,runtimeKey:_(n),relay:r}),O(n.id)},o=e=>{t({apiBaseUrl:e,clientToken:n.clientToken||null,requestHeaders:n.requestHeaders||null,runtimeKey:_(n)})},u={status:`unreachable`,latencyMs:0},f=null,m;if(i){let e=await p(i,{clientToken:n.clientToken||null,requestHeaders:n.requestHeaders||null,expectedServerId:n.relay?.serverId||null}).catch(()=>({status:`unreachable`,latencyMs:0}));u={status:e.status,latencyMs:e.latencyMs},g(e.status)||(f=`direct`)}if(!f&&n.relay){let e=await c(n.relay,{keepTunnel:!0,clientToken:n.clientToken||null}).catch(()=>({status:`unreachable`,latencyMs:0}));e.status===`ok`?(u={status:e.status,latencyMs:e.latencyMs,via:`relay`},f=`relay`,m=`tunnel`in e?e.tunnel:void 0):(!i||e.status===`auth`)&&(u={status:e.status,latencyMs:e.latencyMs})}return f?f===`relay`&&n.relay?(a(n.relay,m),{ok:!0,via:`relay`,status:u}):(o(i),{ok:!0,via:`direct`,status:u}):{ok:!1,status:u,reason:`unreachable`}},b=5e3,x=1500,S=e=>e===`ok`||e===`update-recommended`,C=!1,w=()=>{if(typeof window>`u`)return``;let e=window.__YURI_LOCAL_ORIGIN__;return typeof e==`string`?e.trim():``},T=e=>{if(!e||e===`null`)return!1;try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.origin!==`null`}catch{return!1}},E=()=>{if(typeof window>`u`)return``;let e=window.location.origin;if(T(e))return e;let t=w();return T(t)?t:``},D=async e=>{if(!s()||C)return;let i=`host:${e}`;if(r()!==i)return;let o=n(),c=()=>r()===i&&n()===o;C=!0;try{let n=await m().catch(()=>null);if(!c())return;let r=n?.hosts.find(t=>t.id===e);if(!n||!r?.relay)return;let o=r.apiUrl?d(r.apiUrl):null;if(o&&o.startsWith(`https://`))return;let s=await a(`/api/client-auth/connection/candidates`).catch(()=>null);if(!s?.ok)return;let l=await s.json().catch(()=>null);if(!c()||!l||l.serverId!==r.relay.serverId)return;let u=Array.isArray(l.candidates)?l.candidates:[],h=[];for(let e of u){if(!e||typeof e!=`object`)continue;let t=e;if(t.type!==`lan`||typeof t.url!=`string`)continue;let n=d(t.url);n&&!h.includes(n)&&h.push(n)}if(h.length===0)return;let g=o&&h.includes(o)?o:h[0];if(g!==o&&await f({hosts:n.hosts.map(t=>t.id===e?{...t,apiUrl:g}:t),defaultHostId:n.defaultHostId,initialHostChoiceCompleted:n.initialHostChoiceCompleted}).catch(()=>void 0),!c()||!S((await p(g,{clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,expectedServerId:r.relay.serverId}).catch(()=>({status:`unreachable`,latencyMs:0}))).status)||!c())return;t({apiBaseUrl:g,clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,runtimeKey:i})}finally{C=!1}},O=e=>{typeof window>`u`||window.setTimeout(()=>{D(e).catch(()=>void 0)},b)},k=async a=>{if(!s())return;let f=r(),g=n(),v=()=>r()===f&&n()===g,y=await m().catch(()=>null);if(!y||!v())return;let b=o(),C=b?.target===`remote`?b.hostId:b?.target===`local`?`local`:null,w=a||C||(y.defaultHostId===`local`?null:y.defaultHostId);if(!w)return;let T=y.hosts.find(e=>e.id===w);if(!T)return;let D=_(T);if(r()===D)return;if(!T.relay){let e=d(l(T));e&&d(i())===e&&(!b||b.status===`ok`)&&t({apiBaseUrl:e,clientToken:T.clientToken||null,requestHeaders:T.requestHeaders||null,runtimeKey:D});return}let k=null,A=!1,j=async n=>{let r=n.apiUrl||!n.relay?d(l(n)):null;if(r){let e,i=await Promise.race([p(r,{clientToken:n.clientToken||null,requestHeaders:n.requestHeaders||null,expectedServerId:n.relay?.serverId}).catch(()=>null),new Promise(t=>{e=setTimeout(()=>t(null),x)})]).finally(()=>{e!==void 0&&clearTimeout(e)});if(!v())return!1;if(i?.status===`auth`&&u(n)&&(k=n.clientToken||null),i&&S(i.status))return t({apiBaseUrl:r,clientToken:n.clientToken||null,requestHeaders:n.requestHeaders||null,runtimeKey:D}),!0}if(!n.relay||!v())return!1;let i=await c(n.relay,{keepTunnel:!0,clientToken:n.clientToken||null});return v()?(i.status===`auth`&&u(n)&&(k=n.clientToken||null),i.status!==`ok`||!i.tunnel?!1:(e(n.relay,i.tunnel),t({apiBaseUrl:E(),clientToken:n.clientToken||null,runtimeKey:D,relay:n.relay}),O(n.id),!0)):(i.tunnel?.close(),!1)};try{if(await j(T)||!v()||(T=await h(T),!v())||await j(T)||!v())return;throw A=!0,Error(`Remote instance is unreachable after initialization`)}catch(e){throw v()&&(window.__YURI_DESKTOP_BOOT_OUTCOME__={target:`remote`,status:A&&k&&k===T.clientToken?`pairing-expired`:`unreachable`,hostId:w,url:l(T)}),e}};export{y as i,v as n,_ as r,k as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,E as n}from"./desktop-Brp3xDpd.js";import{st as r}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as o}from"./platform-Dids8J9D.js";var s=e(r(),1),c=i(),l=.85,u=1.2,d=10/9*1.05,f=.9,p=1.029,m=p/f,h=`yuri.designPtScale.v9`;function g(e){return!Number.isFinite(e)||e<=0?1:Math.min(u,Math.max(l,e))}function _(e){if(!e)return p;let t=e.density,n=(e.xdpi+e.ydpi)/2;if(!(t>0)||!(n>=50)||n>800)return p;let r=g(n/t/163);return Math.min(p,r*m)}function v(){if(typeof window>`u`)return 1;try{let e=Number.parseFloat(window.localStorage.getItem(`yuri.designPtScale.v9`)??``),t=window.Capacitor?.getPlatform?.();return t===`android`?!Number.isFinite(e)||e<=0?p:Math.min(p,g(e)):t===`ios`?d:g(e)}catch{return 1}}function y(e){if(!(typeof window>`u`))try{window.localStorage.setItem(h,String(e))}catch{}}function b(e,t=document.documentElement){let n=g(e);t.style.setProperty(`--dpt`,`${n}px`),t.style.setProperty(`--dpt-n`,String(n))}async function x(){if(typeof document>`u`)return 1;b(v());let{Capacitor:e,registerPlugin:t}=await a(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!e.isNativePlatform())return b(1),1;if(e.getPlatform()===`ios`)return b(d),y(d),d;if(e.getPlatform()!==`android`)return b(1),1;if(!e.isPluginAvailable(`YuriPhysicalScale`))return b(p),y(p),p;try{let e=_(await t(`YuriPhysicalScale`).getMetrics());return y(e),b(e),e}catch{return b(p),y(p),p}}var S=({screenWidth:e,...t})=>t,C={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},w={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},T=S(w),E=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,D=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},O=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`,o=(e,t)=>{r.classList.contains(e)!==t&&r.classList.toggle(e,t)},s=(e,t)=>{r.style.getPropertyValue(e)!==t&&r.style.setProperty(e,t)};o(`device-mobile`,i),o(`device-tablet`,a),o(`device-desktop`,t===`desktop`),o(`desktop-runtime`,e),o(`mobile-pointer`,!e&&n),e?(s(`--is-mobile`,`0`),s(`--device-type`,`desktop`),s(`--font-scale`,`1`),s(`--has-coarse-pointer`,`0`),s(`--has-touch-input`,`0`)):(s(`--is-mobile`,i?`1`:`0`),s(`--device-type`,t),s(`--font-scale`,i?`0.9`:a?`0.95`:`1`),s(`--has-coarse-pointer`,n?`1`:`0`),s(`--has-touch-input`,n?`1`:`0`));let c=e?1:v();(r.style.getPropertyValue(`--dpt`)!==`${c}px`||r.style.getPropertyValue(`--dpt-n`)!==String(c))&&b(c,r)};function k(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,a=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=a?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,u=t()||n()||E(),{isExplicitTablet:d}=D(l),f=s||c||l>0,p=s||c,m=e>C.md&&e<=C.lg,h=e<=C.md,g=f&&h,_=f&&!g&&(m||d),v=!f||!_&&e>C.lg,y=`desktop`;u?(g=!1,_=!1,v=!0,y=`desktop`):o()?(g=!0,_=!1,v=!1,y=`mobile`):g?y=`mobile`:_?y=`tablet`:(v=!0,y=`desktop`),O(u,y,f);let b=`xs`;for(let[t,n]of Object.entries(C))e>=n&&(b=t);return{isMobile:g,isTablet:_,isDesktop:v,deviceType:y,screenWidth:e,breakpoint:b,hasTouchInput:f,hasTouchOnlyPointer:p}}var A=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,j=new Set,M=new Set,N=null,P=null,F,I=null,L=()=>typeof window>`u`?w:(N||=k(),N),R=()=>typeof window>`u`?T:(P||=S(L()),P),z=()=>{F=void 0;let e=k(),t=!P||!A(P,e);if(!(!t&&N?.screenWidth===e.screenWidth)){if(N=e,t){P=S(e);for(let e of M)e()}for(let e of j)e()}},B=()=>{typeof window>`u`||F!==void 0||(F=window.requestAnimationFrame(z))},V=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},H=()=>{if(typeof window>`u`)return()=>{};z(),window.addEventListener(`resize`,B);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=V(e,B),r=V(t,B);return()=>{window.removeEventListener(`resize`,B),n(),r(),F!==void 0&&(window.cancelAnimationFrame(F),F=void 0)}},U=(e,t)=>typeof window>`u`?()=>{}:(e.add(t),I||=H(),()=>{e.delete(t),j.size===0&&M.size===0&&I&&(I(),I=null,N=null,P=null)}),W=e=>U(j,e),G=e=>U(M,e);function K(){if(typeof window>`u`||typeof window<`u`&&t())return!1;let e=document.documentElement,n=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return n===`1`||n===`true`}var q=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),J=()=>{if(typeof window>`u`||t())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return q()&&e>0&&window.innerWidth>C.md};function Y(){let e=(0,c.c)(2),[t,n]=s.useState(X),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(J()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),s.useEffect(r,i),t}function X(){return J()}var Z=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function Q(){let e=(0,c.c)(2),[t,n]=s.useState(Z),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),V(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),s.useEffect(r,i),t}function $(e){let t=(0,c.c)(2),n;return t[0]===e?.includeScreenWidth?n=t[1]:(n=()=>e?.includeScreenWidth?w:T,t[0]=e?.includeScreenWidth,t[1]=n),s.useSyncExternalStore(e?.includeScreenWidth?W:G,e?.includeScreenWidth?L:R,n)}export{Y as a,Q as i,K as n,x as o,$ as r,k as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,X as r,Z as i,et as a,nt as o,ot as s,rt as c,st as l,tt as u}from"./vendor-base-ui-CzHs0bHY.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{Jn as f,Va as p}from"./useMobileNavigationStore-SCjA_7jP.js";import{n as m}from"./Icon-DsN23fuV.js";var h=e(l(),1),g=d(),_=s(),v=0;function y(e,t){return e&&h.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,g.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,_.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function x(e){let t=(0,g.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=y(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,_.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function S(e){let n=(0,g.c)(4),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let i;return n[2]===r?i=n[3]:(i=(0,_.jsx)(t,{...r}),n[2]=r,n[3]=i),i}var C=h.forwardRef((e,t)=>{let n=(0,g.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],h.useEffect(A,a);let o=t,s;n[4]===r?s=n[5]:(s=f(`app-region-no-drag fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,r),n[4]=r,n[5]=s);let l;return n[6]!==i||n[7]!==o||n[8]!==s?(l=(0,_.jsx)(c,{ref:o,"data-slot":`dialog-overlay`,className:s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let t=(0,g.c)(33),n,r,i,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],s=t[4],c=t[5],l=t[6],u=t[7]):({className:r,overlayClassName:s,containerClassName:i,children:n,showCloseButton:l,presentation:u,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u);let d=u===void 0?`default`:u,{t:h}=p(),v=l??d!==`picker`,y=d===`picker`&&`bg-transparent dark:bg-transparent`,b;t[8]!==s||t[9]!==y?(b=f(`rounded-none`,y,s),t[8]=s,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,_.jsx)(C,{className:b}),t[11]=b,t[12]=x);let w=i??(d===`picker`?`block p-0`:`items-center p-4`),T;t[13]===w?T=t[14]:(T=f(`fixed inset-0 z-50 flex justify-center pointer-events-none`,w),t[13]=w,t[14]=T);let E=d===`picker`&&`yuri-picker-dialog yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent yuri-composer-autocomplete-surface fixed left-1/2 top-[10vh] w-[min(42rem,calc(100vw-3rem))] max-w-none -translate-x-1/2 translate-y-0 gap-0 overflow-hidden rounded-3xl border-0 p-0`,D;t[15]!==r||t[16]!==E?(D=f(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,E,r),t[15]=r,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==v||t[19]!==h?(O=v&&(0,_.jsxs)(o,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:h(`dialog.common.actions.close`)})]}),t[18]=v,t[19]=h,t[20]=O):O=t[20];let k;t[21]!==n||t[22]!==d||t[23]!==c||t[24]!==D||t[25]!==O?(k=(0,_.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,"data-presentation":d,className:D,...c,children:[n,O]}),t[21]=n,t[22]=d,t[23]=c,t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==k||t[28]!==T?(A=(0,_.jsx)(`div`,{className:T,children:k}),t[27]=k,t[28]=T,t[29]=A):A=t[29];let j;return t[30]!==A||t[31]!==x?(j=(0,_.jsxs)(S,{children:[x,A]}),t[30]=A,t[31]=x,t[32]=j):j=t[32],j}function T(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=f(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,_.jsx)(i,{"data-slot":`dialog-title`,className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(u,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-ibQIZnws.js";import{n}from"./runtime-fetch-9B8F_rKW.js";import{C as r,E as i,M as a,S as o,b as s,x as c}from"./desktop-Brp3xDpd.js";import{i as l,o as u,t as d}from"./path-utils-HRmerlyU.js";import{r as ee}from"./useUIStore-BsCfUWQw.js";import{c as f,i as p,s as m}from"./toolHelpers-iEHVHQ9p.js";import{a as h,i as g,n as _,o as v,r as te,t as y}from"./fileReferenceParser-BayaidRM.js";var b=`data-yuri-block-path-token`,x=`[${b}]`,S=`data-yuri-file-link`,C=`[${S}="true"]`,ne=[S,`data-yuri-file-ref`,`data-yuri-file-path`,`data-yuri-file-binary`,`title`,`role`,`tabindex`],w=`data-yuri-block-paths-scanned`,T=`data-yuri-paragraph-paths-scanned`,E=`pre, code, a, script, style, button, [${S}], ${x}`,D=2e5,O=e=>{let t=v(e);return t?g(t.path):!1},k=e=>{let t=e.trim();return!t||t.startsWith(`#`)||t.startsWith(`?`)||t.startsWith(`//`)?!1:/^[A-Za-z]:[\\/]/.test(t)||/^file:/i.test(t)||O(t)&&/:\d+(?:-\d+|:\d+)?$/.test(t)?!0:!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)},A=(e,t)=>{let n=0;for(let r of e){let e=n+r.data.length;if(t<=e)return{node:r,offset:Math.max(0,t-n)};n=e}let r=e.at(-1);return r?{node:r,offset:r.data.length}:null},re=e=>{let t=e.querySelectorAll(`pre code`);if(t.length===0)return;let n=e.ownerDocument;if(n)for(let e of Array.from(t)){if(e.getAttribute(w)===`true`)continue;if((e.textContent??``).length>D){e.setAttribute(w,`true`);continue}let t=n.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[],i=t.nextNode();for(;i;)r.push(i),i=t.nextNode();let a=e.textContent??``;if(!a.includes(`.`)){e.setAttribute(w,`true`);continue}y.lastIndex=0;let o=[],s=y.exec(a);for(;s;){let e=s[0];e&&O(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=y.exec(a)}for(let{start:e,end:t,raw:i}of o.reverse()){let a=A(r,e),o=A(r,t);if(!a||!o)continue;let s=n.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=n.createElement(`span`);c.setAttribute(b,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(w,`true`)}},j=e=>{let t=e.ownerDocument;if(!t)return;let n=e.querySelectorAll(`p, li, blockquote, h1, h2, h3, h4, h5, h6, td, th`);if(n.length!==0)for(let e of Array.from(n)){if(e.getAttribute(T)===`true`)continue;if(e.closest(E)){e.setAttribute(T,`true`);continue}let n=t.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>{let t=e.parentElement;return!t||t.closest(E)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[],i=n.nextNode();for(;i;)r.push(i),i=n.nextNode();if(r.length===0){e.setAttribute(T,`true`);continue}let a=r.map(e=>e.data).join(``);if(!a.includes(`/`)||!a.includes(`.`)){e.setAttribute(T,`true`);continue}_.lastIndex=0;let o=[],s=_.exec(a);for(;s;){let e=s[0];if(!e){s=_.exec(a);continue}let t=s.index>=2?a.slice(s.index-2,s.index):``;if((s.index>=1?a.charAt(s.index-1):``)===`:`||t===`:/`){s=_.exec(a);continue}O(e)&&o.push({start:s.index,end:s.index+e.length,raw:e}),s=_.exec(a)}for(let{start:e,end:n,raw:i}of o.reverse()){let a=A(r,e),o=A(r,n);if(!a||!o)continue;let s=t.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=t.createElement(`span`);c.setAttribute(b,`true`),c.textContent=i,s.deleteContents(),s.insertNode(c)}e.setAttribute(T,`true`)}},M=e=>{re(e),j(e)},N=(e,t)=>{if(e.getAttribute(`data-yuri-file-link`)!==`true`)return;let n=(e.getAttribute(`data-yuri-file-ref`)||e.textContent||``).trim(),r=(t.textContent||``).trim();if(!(!n||n!==r))for(let n of ne){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}},P=e({FILE_REFERENCE_OPEN_TITLE:()=>F,extractPathCandidateFromElement:()=>q,getFileReferenceInfo:()=>Y,getFileReferenceLinkLimit:()=>H,getResolvedReference:()=>J,openFileReference:()=>Q,openFileReferenceFromElement:()=>$,peekFileReferenceInfo:()=>K,probeFileReference:()=>X,resetFileReferenceStatCacheForTests:()=>ue,shouldOfferFileReference:()=>Z}),F=`Open file`,ie=4,ae=1e3,oe=200,se=80,ce=40,I=new Map,L=new Map,R=(e,n)=>JSON.stringify([t(),n,e]),z=0,B=[],V=()=>i()?oe:ae,H=()=>i()?ce:se,U=(e,t)=>{L.set(e,t)},W=()=>{let e=I.keys().next().value;typeof e==`string`&&(I.delete(e),L.delete(e))},G=(e,t)=>{let n=V();for(;I.size>=n;)W();I.set(e,t)},K=(e,t=``)=>{let n=h(e);if(n)return L.get(R(n,t))},q=e=>{if(e.tagName.toLowerCase()===`a`){let t=e.getAttribute(`href`)?.trim();if(t&&O(t))return t}return(e.textContent||``).trim()},J=(e,t,n=`path`)=>{let r=v(e);if(r&&n===`href`&&!/^file:/i.test(e.trim()))try{r.path=decodeURIComponent(r.path)}catch{}if(!r||(n===`href`?!k(e):!g(r.path)))return null;let i=te(r.path)?h(r.path):u(t,r.path);return i?{...r,resolvedPath:i}:null},Y=(e,t=``)=>{let r=h(e);if(!r)return Promise.resolve({exists:!1,isBinary:!1});let i=R(r,t),a=I.get(i);if(a)return I.delete(i),I.set(i,a),a;let o=new Promise((e,a)=>{let s=()=>{z+=1,n(`/api/fs/stat?path=${encodeURIComponent(r)}&optional=true`,{method:`GET`,cache:`no-store`,...t?{query:{directory:t}}:{}}).then(async t=>{if(!t.ok)throw Error(`File reference probe failed (${t.status})`);let n=await t.json();if(!n||typeof n.exists!=`boolean`&&n.isFile!==!0)throw Error(`Invalid file reference probe response`);let r={exists:n.exists!==!1,isBinary:n.isBinary===!0};U(i,r),e(r)}).catch(e=>{I.get(i)===o&&(I.delete(i),L.delete(i)),a(e)}).finally(()=>{z=Math.max(0,z-1),B.shift()?.()})};if(z<ie){s();return}B.push(s)});return G(i,o),o},X=(e,t)=>{if(!(r()&&o()&&!l(e,t)))return Y(e,t);let n=h(e);if(!n)return Promise.resolve({exists:!1,isBinary:!1});let i=R(n,t),a=I.get(i);if(a)return I.delete(i),I.set(i,a),a;let c=s(e).then(e=>{let t={exists:!0,isBinary:e===!0};return U(i,t),t});return G(i,c),c},Z=(e,t,n)=>!(!t.exists||n&&t.isBinary&&!f(e)&&!m(e)),le=(e,t)=>e||d(e,t),Q=async(e,t,n)=>{let i=J(e,n.effectiveDirectory,n.referenceKind);if(!i)return;if(n.referenceKind===`href`&&r()&&o()&&await c(i.resolvedPath)){await a(i.resolvedPath);return}if(!g(i.path))return;if(f(i.resolvedPath)&&n.onShowPopup){let e=i.resolvedPath.split(`/`).filter(Boolean).pop()??i.resolvedPath;n.onShowPopup({open:!0,title:e,content:``,metadata:{tool:`image-preview`,filename:e,mime:p(i.resolvedPath)},image:{url:i.resolvedPath,filename:e,mimeType:p(i.resolvedPath)}});return}let s=le(n.effectiveDirectory,i.resolvedPath),l=m(i.resolvedPath);if(n.preferRuntimeEditor&&n.editor&&!l){n.editor.openFile(i.resolvedPath,Number.isFinite(i.line??NaN)?Math.max(1,Math.trunc(i.line)):void 0,Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):void 0);return}let u=ee.getState();if(l){u.openContextFile(s,i.resolvedPath,{viewerMode:`preview`,closeFileTree:!0});return}if(Number.isFinite(i.line??NaN)){u.openContextFileAtLine(s,i.resolvedPath,Math.max(1,Math.trunc(i.line)),Number.isFinite(i.column??NaN)?Math.max(1,Math.trunc(i.column)):1,{closeFileTree:!0});return}u.openContextFile(s,i.resolvedPath,{closeFileTree:!0})},$=async(e,t)=>{let n=e.matches(`a[href]`)?e:e.querySelector(`a[href]`);await Q(n?.getAttribute(`href`)||e.getAttribute(`data-yuri-file-ref`)||q(e),e.getAttribute(`data-yuri-file-binary`)===`true`,{...t,referenceKind:n?`href`:`path`})},ue=()=>{I.clear(),L.clear(),z=0,B.length=0};export{J as a,X as c,S as d,C as f,M as g,k as h,H as i,Z as l,O as m,q as n,$ as o,N as p,P as r,K as s,F as t,x as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./path-utils-HRmerlyU.js";import{C as t,D as n,I as r,L as i,M as a,O as o,P as s,S as c,T as l,_ as u,a as d,b as f,c as p,j as m,n as h,o as g,r as _,s as v,t as y,v as b,w as x,y as S}from"./vendor-opencode-client-cQ47ywrT.js";import{i as ee}from"./vendor-tanstack-query-core-Y_YoRHtC.js";import{n as te,r as ne}from"./fileQueries-BaEKb7SZ.js";import{a as re,n as ie}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{a as ae,n as oe}from"./platform-Dids8J9D.js";import{Dt as se,ht as ce,mt as le,y as ue}from"./vendor-effect-X1Hqc7ba.js";import{t as C}from"./native-errors-06if6eu-.js";import{a as de,i as w,n as T,o as E,r as fe}from"./appearance--vFosLNi.js";import{i as pe,o as me}from"./fileReferenceParser-BayaidRM.js";import{n as he,t as ge}from"./vendor-solid-js-D98iXT7C.js";import{a as _e,c as ve,d as ye,f as be,g as D,h as O,i as k,l as A,m as j,n as M,o as N,p as P,r as xe,s as Se,t as Ce,u as we}from"./vendor-opencode-plugin-BmdTE4Te.js";var F={"@opencode/plugin/gui":N,"@opencode/plugin/gui/main":N,"@opencode/plugin/gui/file":_e,"@opencode/plugin/gui/review":k,"@opencode/plugin/gui/browser":xe,"@opencode/plugin/rpc":Ce,"@opencode/schema/rpc":M,"@opencode/client":_,"@opencode/client/effect":h,"@opencode/client/solid":y,effect:ue,"solid-js":s,"solid-js/web":he,"solid-js/store":v},I=new Set(`assert assert/strict async_hooks buffer child_process cluster console constants crypto dgram diagnostics_channel dns dns/promises domain events fs fs/promises http http2 https inspector inspector/promises module net os path path/posix path/win32 perf_hooks process punycode querystring readline readline/promises repl stream stream/consumers stream/promises stream/web string_decoder sys timers timers/promises tls trace_events tty url util util/types v8 vm wasi worker_threads zlib`.split(` `));function Te(){let e=new Proxy(function(){},{get:(t,n)=>n===`then`?void 0:n===Symbol.hasInstance?()=>!1:n===Symbol.toPrimitive||n===`toString`?()=>`[main-only module]`:e,apply:()=>e,construct:()=>e,set:()=>!0});return e}function Ee(e,t){if(e.length>16777216)throw Error(`GUI bundle exceeds 16 MiB`);let n={exports:{}};Function(`require`,`module`,`exports`,e)(e=>{if(Object.hasOwn(F,e))return F[e];if(e===`electron`||e.startsWith(`node:`)||I.has(e))return Te();throw Error(`Unsupported GUI shared module: ${e}`)},n,n.exports);let r=n.exports,i=r&&typeof r==`object`&&`default`in r?r.default:r;if(!i||typeof i!=`object`)throw Error(`GUI bundle must default-export Plugin.define`);if((!(`setup`in i)||typeof i.setup!=`function`)&&!(t&&`main`in i&&typeof i.main==`function`))throw new C(`GUI_PLUGIN_UNSUPPORTED`,`This host requires a window setup; main-only plugins are unsupported`);if(`os`in i&&i.os!==void 0){if(!t)throw new C(`GUI_PLUGIN_UNSUPPORTED`,`OS-restricted plugins require the native GUI host`);if(!Array.isArray(i.os)||!i.os.includes(t))throw new C(`GUI_PLUGIN_UNSUPPORTED`,`GUI plugin is unavailable on this OS`)}if(`main`in i&&i.main!==void 0&&typeof i.main!=`function`)throw Error(`Invalid GUI main entry`);if(`stores`in i&&i.stores!==void 0){if(!i.stores||typeof i.stores!=`object`||Array.isArray(i.stores))throw Error(`Invalid GUI stores`);for(let e of Object.values(i.stores))if(!e||typeof e!=`object`||!(`schema`in e)||!se(e.schema)||!(`scope`in e)||![`global`,`session`].includes(String(e.scope))||!(`initial`in e))throw Error(`Invalid GUI store declaration`)}if(`i18n`in i&&i.i18n!==void 0){if(!i.i18n||typeof i.i18n!=`object`||Array.isArray(i.i18n))throw Error(`Invalid GUI locale catalog`);for(let e of Object.values(i.i18n))if(!e||typeof e!=`object`||Array.isArray(e)||Object.values(e).some(e=>typeof e!=`string`))throw Error(`GUI locales must be inline string dictionaries`)}return i}function L(e){let t=e;if(/^file:/i.test(t)){let e=new URL(t);t=`${e.hostname&&e.hostname!==`localhost`?`//${e.hostname}`:``}${decodeURIComponent(e.pathname)}`,/^\/[a-z]:\//i.test(t)&&(t=t.slice(1))}let n=ae(t)??``;return n===`.`?``:n}var R=e=>/^(?:\/|[a-z]:\/)/i.test(e),z=()=>{throw Error(`Unsupported GUI file API: tree`)},B=class extends Error{},V=e=>new TextEncoder().encode(e).byteLength,De=class{files;query;transport;root;api;ended=!1;states=new Map;inflight=new Map;watches=new Map;apiLeases=new Map;registeredOwners=new WeakSet;endedOwners=new WeakSet;leaseCount=0;rerun=new Set;selections=new Map;scrolls=new Map;subscriptions=new Map;constructor(e,t,n,r){this.files=e,this.query=t,this.transport=n,this.root=r,this.root=L(r),this.api={root:this.root,ready:()=>!this.ended,resolve:e=>this.resolve(e),absolute:R,get:e=>{let t=this.track(e,`file`);return this.states.get(t)},missing:e=>{let t=this.track(e,`missing`);return this.states.get(t)?.notFound===!0},sync:(e,t)=>{let n=o();return this.ended||n&&this.endedOwners.has(n)?Promise.resolve():(this.acquireApiLease(e),this.sync(e,t?.force))},unwatch:e=>this.releaseApiLease(o(),this.resolve(e)),exists:async e=>{try{if(this.files.statFile)return(await this.query.fetchQuery(this.statOptions(e))).isFile;let t=this.full(e);return(await this.files.listDirectory(t.slice(0,t.lastIndexOf(`/`)))).entries.some(e=>!e.isDirectory&&L(e.path)===t)}catch{return!1}},search:async(e,t)=>{if(t?.kind===`any`)throw Error(`Unsupported GUI file search: directories`);t?.signal?.throwIfAborted();let r=await this.query.fetchQuery({queryKey:[`gui-plugin-files`,n,this.root,`search`,e,t?.limit],gcTime:3e4,queryFn:async({signal:n})=>(n.throwIfAborted(),this.files.search({directory:this.root,query:e,maxResults:t?.limit??100}))});if(t?.signal?.throwIfAborted(),this.ended)throw new DOMException(`GUI file model was disposed`,`AbortError`);return r.map(e=>this.resolve(e.path))},selection:{get:e=>this.selections.get(this.track(e,`selection`)),set:(e,t)=>{let n=this.resolve(e),r=this.selections.get(n);r===t||r&&t&&r.start===t.start&&r.end===t.end&&r.side===t.side&&r.endSide===t.endSide||(this.selections.set(n,t),this.trim(this.selections,`selection`),this.changed(n,`selection`))}},scroll:{get:e=>this.scrolls.get(this.track(e,`scroll`))??{},set:(e,t)=>{let n=this.resolve(e),r=this.scrolls.get(n),i={...r,...t};(r?.top!==i.top||r?.left!==i.left)&&(this.scrolls.set(n,i),this.trim(this.scrolls,`scroll`),this.changed(n,`scroll`))}},tree:{list:z,state:z,sync:z,expand:z,collapse:z}}}resolve(e){let t=L(e);if(!R(t))return t;if(t===this.root)return``;let n=this.root.endsWith(`/`)?this.root:`${this.root}/`;return t.startsWith(n)?t.slice(n.length):t}full(e){let t=this.resolve(e);return R(t)?t:L(`${this.root}/${t}`)}input(e){return{scopeDirectory:this.root,path:this.full(e),options:{directory:this.root}}}statOptions(e){return{...ne(this.files,this.input(e),this.transport),gcTime:3e4}}track(e,t){let r=this.resolve(e),i=n();if(!i||this.ended)return r;let o=`${t}:${r}`,s=this.subscriptions.get(o);s||(s={revision:l(0),listeners:new Set},this.subscriptions.set(o,s));let c=s;return c.listeners.has(i)||(c.listeners.add(i),a(i,()=>m(()=>{c.listeners.delete(i),!c.listeners.size&&this.subscriptions.get(o)===c&&this.subscriptions.delete(o)}))),c.revision[0](),r}changed(e,t){this.ended||this.subscriptions.get(`${t}:${e}`)?.revision[1](e=>e+1)}trim(e,t){for(;e.size>64;){let n=e.keys().next().value;e.delete(n),this.changed(n,t)}}setState(e,t){let n=this.states.get(e);n?.content?.content===t.content?.content&&n?.content?.type===t.content?.type&&(t.content=n?.content),!(n&&n.loaded===t.loaded&&n.loading===t.loading&&n.error===t.error&&n.notFound===t.notFound&&n.content===t.content)&&(this.states.set(e,t),u(()=>{this.changed(e,`file`),n?.notFound===!0!=(t.notFound===!0)&&this.changed(e,`missing`)}))}acquireApiLease(e){let t=o();if(this.ended||t&&this.endedOwners.has(t)||!this.files.statFile)return;let n=this.resolve(e),r=this.apiLeases.get(t);if(r?.has(n))return;if(this.leaseCount>=256)throw Error(`GUI file consumer limit exceeded`);let i=this.watch(n);r||(r=new Map,this.apiLeases.set(t,r)),r.set(n,i),this.leaseCount++,t&&!this.registeredOwners.has(t)&&(this.registeredOwners.add(t),m(()=>{`fn`in t||this.endedOwners.add(t),this.registeredOwners.delete(t);for(let e of[...this.apiLeases.get(t)?.keys()??[]])this.releaseApiLease(t,e)}))}releaseApiLease(e,t){let n=this.apiLeases.get(e),r=n?.get(t);r&&(n.delete(t),this.leaseCount--,n.size||this.apiLeases.delete(e),r())}reserve(e){if(!this.states.has(e)){if(this.states.size>=64){let e=[...this.states.keys()].find(e=>!this.watches.has(e)&&!this.inflight.has(e));if(!e)throw Error(`GUI file cache limit exceeded`);let t=this.states.get(e)?.notFound===!0;this.states.delete(e),u(()=>{this.changed(e,`file`),t&&this.changed(e,`missing`)})}this.states.set(e,{path:e,name:e.split(`/`).at(-1)??e})}}async sync(e,t=!1){if(this.ended)return;let n=this.resolve(e);if(this.inflight.has(n))return t&&this.rerun.add(n),this.inflight.get(n);if(!t&&this.states.get(n)?.loaded&&!this.states.get(n)?.error)return;this.reserve(n);let r=this.states.get(n);this.setState(n,{...r,path:n,name:n.split(`/`).at(-1)??n,loading:!r?.loaded&&!this.watches.get(n)?.failed});let i=(async()=>{try{do{this.rerun.delete(n);let e=this.watches.get(n),r=e?.epoch;try{let i=te(this.files,this.input(n),this.transport),a=await this.query.fetchQuery({...i,gcTime:3e4,staleTime:t?0:3e4,queryFn:async()=>{if(!this.files.readFile)throw Error(`File content reads are unavailable in this runtime`);let e=await this.files.readFile(this.full(n),{directory:this.root});if(e.exists===!1)throw new B(`File does not exist`);let t=e.content;if(V(t)>131072)throw Error(`GUI file preview exceeds 128 KiB`);return t}});if(this.ended)return;if(V(a)>131072)throw Error(`GUI file preview exceeds 128 KiB`);(!e||e.epoch===r&&!e.failed)&&this.setState(n,{path:n,name:n.split(`/`).at(-1)??n,loaded:!0,loading:!1,content:{type:`text`,content:a}})}catch(t){if(this.ended)return;if((!e||e.epoch===r&&!e.failed)&&this.setState(n,{...this.states.get(n),loading:!1,...t instanceof B?{notFound:!0}:{},error:String(t)}),!this.rerun.has(n))throw t}t=!0}while(!this.ended&&this.rerun.has(n))}finally{this.inflight.delete(n),this.rerun.delete(n)}})();return this.inflight.set(n,i),i}watch(e){if(this.ended||!this.files.statFile)return()=>{};let t=this.resolve(e),n=this.watches.get(t);if(!n){if(this.watches.size>=64)throw Error(`GUI file watch limit exceeded`);this.reserve(t),n={count:0,epoch:0,failed:!1,stop:()=>{}};let e=n;this.watches.set(t,e);let r,i=new ee(this.query,{...this.statOptions(t),refetchInterval:2e3,refetchIntervalInBackground:!1}),a=i.subscribe(n=>{if(this.ended||this.watches.get(t)!==e||n.isFetching)return;if(n.isError||n.isSuccess&&!n.data.isFile){e.failed=!0,e.epoch++,this.setState(t,{...this.states.get(t),loading:!1,notFound:n.isSuccess?!0:this.states.get(t)?.notFound,error:n.isError?String(n.error):`File does not exist`});return}if(!n.data||!n.isSuccess)return;let i=`${n.data.size}:${n.data.mtimeMs??``}`,a=e.failed||r!==void 0&&i!==r;e.failed=!1,r=i,a&&(e.epoch++,this.sync(t,!0).catch(()=>{}))});e.stop=()=>{a(),i.destroy()},this.states.get(t)?.loaded&&this.sync(t,!0).catch(()=>{})}n.count++;let r=!0;return()=>{r&&(r=!1,--n.count===0&&this.watches.get(t)===n&&this.stopWatch(t))}}stopWatch(e){this.watches.get(e)?.stop(),this.watches.delete(e)}dispose(){this.ended=!0;for(let e of this.watches.values())e.stop();this.watches.clear(),this.apiLeases.clear(),this.leaseCount=0,this.rerun.clear(),this.states.clear(),this.inflight.clear(),this.selections.clear(),this.scrolls.clear(),this.subscriptions.clear()}},H=256,U=2097152,W=e=>structuredClone(p(e)),Oe=class{backend;transport;memory=new Map;resets=new Map;constructor(e,t){this.backend=e,this.transport=t}forPlugin(e,t){let n=(t,n=`global`)=>{if(typeof n==`object`&&`session`in n&&!n.session.location)throw Error(`Unsupported GUI storage: session location is unknown`);let r=n===`global`?n:`session`in n?[n.session.server.id,n.session.id,n.session.location]:[n.server,n.directory];return`yuri.gui-plugin.${JSON.stringify([this.transport,e,r,t])}`},r=e=>{if(t.aborted)throw Error(`GUI plugin has been disposed`);if(e!==void 0)throw Error(`Unsupported GUI storage migration: from`)},i=new Map;return{store:(e,a)=>{r(a.from);let o=n(e,a.scope),s=i.get(o);if(s)return s;if(i.size>=H)throw Error(`GUI plugin store limit exceeded`);let c=le(a.schema),u=ce(a.schema),d=c(u(W(a.initial)));if(JSON.stringify(u(d)).length>U)throw Error(`GUI plugin store exceeds 2 MiB`);let f=d,p=this.backend.getItem(o);if(p!==null&&p.length<=U)try{f=c(JSON.parse(p))}catch{f=d}let[m,h]=l(f),g=e=>{r();let t=JSON.stringify(u(W(e)));if(t.length>U)throw Error(`GUI plugin store exceeds 2 MiB`);let n=c(JSON.parse(t));this.backend.setItem(o,t),h(()=>n)},_={get value(){return m()},ready:()=>!0,set:g,update:e=>{let t=W(m());if(e(t)!==void 0)throw Error(`Store update must not return a replacement`);g(t)}},v=()=>h(()=>W(d)),y=this.resets.get(o)??new Set;return y.add(v),this.resets.set(o,y),t.addEventListener(`abort`,()=>{y.delete(v),y.size||this.resets.delete(o),i.clear()},{once:!0}),i.set(o,_),_},memory:(e,t)=>{r();let i=n(e),a=this.memory.get(i);if(a)return[a[0],e=>{r(),a[1](e)}];if(this.memory.size>=H)throw Error(`GUI plugin memory store limit exceeded`);if(JSON.stringify(t.initial).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);let[o,s]=d(W(t.initial)),c=[o,e=>{r();let t=W(p(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);s(g(t))}];return this.memory.set(i,[o,e=>{let t=W(p(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);s(g(t))}]),c},remove:(e,t)=>{r(t?.from);let i=n(e,t?.scope);this.backend.removeItem(i);for(let e of this.resets.get(i)??[])e()}}}dispose(){this.memory.clear(),this.resets.clear()}},G=e=>e===`yuri.exportPDF`||e===`yuri.exportLongImage`,ke=class{api;probe;clients=new Map;ended=!1;constructor(e){this.api=e}use(e,t){let n=this.clients.get(t),r=n?.get(e);if(r)return r.live;let[i,a]=l(this.api&&!t.aborted&&!this.ended?{status:`pending`}:{status:`inactive`,reason:`disabled`}),o=()=>{a({status:`inactive`,reason:`disabled`}),t.removeEventListener(`abort`,o),this.clients.delete(t)},s={live:D(i),stop:o};if(this.ended||t.aborted||(n||(n=new Map,this.clients.set(t,n)),n.set(e,s),t.addEventListener(`abort`,o,{once:!0}),!this.api))return s.live;let c=this.api;return this.probe??=Promise.resolve().then(()=>c.capabilities()),this.probe.then(n=>{if(this.ended||t.aborted)return;let r=e===`yuri.exportPDF`?`exportPDF`:`exportLongImage`;if(n.version!==1||!n[r]){a({status:`inactive`,reason:`disabled`});return}let o=async(e,n={})=>{if(this.ended||t.aborted||i().status!==`active`)return{status:`cancelled`};let o=AbortSignal.any([t,...n.signal?[n.signal]:[]]);try{return await c[r](e,{...n,signal:o})}catch(e){throw e&&typeof e==`object`&&`code`in e&&e.code===`EXPORT_UNSUPPORTED`&&a({status:`inactive`,reason:`failed`}),e}},s=Object.freeze(e===`yuri.exportPDF`?{version:1,limits:n.limits,exportPDF:o}:{version:1,limits:n.limits,exportLongImage:o});a({status:`active`,generation:1,value:s})}).catch(()=>{!this.ended&&!t.aborted&&a({status:`inactive`,reason:`failed`})}),s.live}dispose(){this.ended=!0;for(let e of this.clients.values())for(let t of e.values())t.stop();this.clients.clear()}};function Ae(e,t){let n=new Map,r=Object.freeze({dismiss(){}});return e.addEventListener(`abort`,()=>{for(let e of[...n.values()])e.handle.dismiss()},{once:!0}),Object.freeze({show(i){if(e.aborted)return r;if(!t)throw new C(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast is unavailable`);if(!i||typeof i!=`object`)throw new C(`GUI_PLUGIN_INVALID_INPUT`,`Expected toast options`);let{title:a,description:o,variant:s=`default`,duration:c=5e3,persistent:l=!1,icon:u,actions:d}=i;if(typeof a!=`string`||o!==void 0&&typeof o!=`string`||![`default`,`success`,`error`,`loading`].includes(s)||typeof l!=`boolean`||typeof c!=`number`||!Number.isFinite(c)||c<0)throw new C(`GUI_PLUGIN_INVALID_INPUT`,`Invalid toast options`);if(u!==void 0||d!==void 0)throw new C(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast icon/actions are unsupported`);if(e.aborted)return r;let f=JSON.stringify([a,o??null,s,c,l]),p=n.get(f),m=()=>{let e=n.get(f);!e||e.id!==h||(clearTimeout(e.timer),n.delete(f))},h=(s==="default"?t:t[s])(a,{id:p?.id,description:o,duration:l?1/0:c,onDismiss:m,onAutoClose:m}),g=p?.handle??Object.freeze({dismiss(){m(),t.dismiss(h)}});clearTimeout(p?.timer);let _=s===`loading`&&!l?setTimeout(()=>g.dismiss(),c):void 0;return n.set(f,{id:h,handle:g,timer:_}),g}})}var je=re(`YuriMedia`);async function Me(e){let t=/\.html?$/i.test(e.name)?`text/html`:`text/plain`,n=new Blob([e.content],{type:t});if(oe()){if(!ie.isPluginAvailable(`YuriMedia`))throw new C(`GUI_PLUGIN_UNSUPPORTED`,`Native file saving is unavailable`);if(n.size>33554432)throw new C(`GUI_PLUGIN_INVALID_INPUT`,`File exceeds maximum size`);let r=await new Promise((e,t)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result!=`string`){t(Error(`Failed to encode file`));return}e(r.result.slice(r.result.indexOf(`,`)+1))},r.onerror=()=>t(r.error??Error(`Failed to encode file`)),r.readAsDataURL(n)});return!(await je.saveFile({dataBase64:r,mimeType:t,filename:e.name})).cancelled}let r=URL.createObjectURL(n),i=document.createElement(`a`);try{return i.href=r,i.download=e.name,document.body.append(i),i.click(),!0}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}}var K=f();function Ne(e){return{version:1,register(t){let n=i(K);if(!n||n.plugin!==e||n.signal.aborted||e.aborted)throw Error(`Preview actions require the owning mounted panel`);let r=new AbortController,a=AbortSignal.any([e,n.signal,r.signal]),o,s=()=>{a.removeEventListener(`abort`,s),r.abort(),o?.remove()};m(s),a.addEventListener(`abort`,s,{once:!0});try{o=t.render({element:t.element,signal:a,async snapshot(e={}){let r=AbortSignal.any([a,...e.signal?[e.signal]:[]]);if(r.throwIfAborted(),!n.content.contains(t.element)||n.target.contains(t.element))throw Error(`Preview capture region is no longer in its owning panel`);let i=await t.capture({...e,signal:r});if(r.throwIfAborted(),!n.content.contains(t.element))throw Error(`Preview capture region was replaced`);return i}}),a.throwIfAborted(),n.target.append(o)}catch(e){throw s(),e}return s}}}function q(e,t){return JSON.stringify([e,t])}function Pe(e){if(!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||!e.id.trim()||e.id.length>128||!(`title`in e)||typeof e.title!=`string`||!(`render`in e)||typeof e.render!=`function`)throw Error(`Invalid yuri.page contribution`);return e}var Fe=`yuri.work-status`;function J(e,t){return e===t||!!(e&&t&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>e[n]===t[n]))}var Y=e=>e&&Object.freeze({...e});function Ie(e,t,n){let r=new AbortController,[i,a]=l(!0),[o,s]=l(Y(e.project),{equals:J}),[c,d]=l(Y(e.worktree),{equals:J}),[f,p]=l(Object.freeze({...e.git}),{equals:J}),[m,h]=l(e.placement);return{props:Object.freeze({session:t,directory:e.directory,runtimeId:n,signal:r.signal,get active(){return i()},get project(){return o()},get worktree(){return c()},get git(){return f()},get placement(){return m()}}),matches:t=>t.sessionId===e.sessionId&&t.directory===e.directory,update(e){r.signal.aborted||u(()=>{s(Y(e.project)),d(Y(e.worktree)),p(Object.freeze({...e.git})),h(e.placement)})},dispose(){r.signal.aborted||(a(!1),r.abort())}}}var Le=class{plugins=new Map;order=new Map;snapshot=Object.freeze([]);generation=0;listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;setOrder(e){e.length===this.order.size&&e.every((e,t)=>this.order.get(e)===t)||(this.order=new Map(e.map((e,t)=>[e,t])),this.publish())}replace(e,t,n){let r=this.plugins.get(e)??[],i=new Set,a=n.map(n=>{if(!n||typeof n!=`object`||!(`id`in n)||typeof n.id!=`string`||!n.id.trim()||n.id.length>128||i.has(n.id)||!(`render`in n)||typeof n.render!=`function`||`order`in n&&n.order!==void 0&&(typeof n.order!=`number`||!Number.isFinite(n.order)))throw Error(`Invalid or duplicate yuri.work-status contribution`);i.add(n.id);let a=JSON.stringify([e,n.id]),o=`order`in n&&typeof n.order==`number`?n.order:0,s=n.render,c=r.find(e=>e.key===a),l=c&&c.revision===t&&c.render===s?c.generation:++this.generation;return c&&c.revision===t&&c.render===s&&c.order===o?c:Object.freeze({key:a,pluginId:e,revision:t,generation:l,order:o,render:s})});a.length?this.plugins.set(e,a):this.plugins.delete(e),this.publish()}contains(e){return this.plugins.get(e.pluginId)?.some(t=>t.key===e.key&&t.generation===e.generation)??!1}remove(e){this.plugins.delete(e)&&this.publish()}dispose(){this.plugins.clear(),this.publish(),this.listeners.clear()}publish(){let e=[...this.plugins.values()].flat().sort((e,t)=>e.order-t.order||(this.order.get(e.pluginId)??2**53-1)-(this.order.get(t.pluginId)??2**53-1));if(!(e.length===this.snapshot.length&&e.every((e,t)=>e===this.snapshot[t]))){this.snapshot=Object.freeze(e);for(let e of this.listeners)r(e)}}},X=e=>{throw new C(`GUI_PLUGIN_UNSUPPORTED`,`Unsupported GUI host API: ${e}`)};function Z(e,t){return new Proxy(t,{get:(t,n)=>n in t?Reflect.get(t,n):X(`${e}.${String(n)}`)})}var Q=e=>Object.freeze(e.map(e=>Object.freeze(e)));function Re(e,t){if(!e.fields||!t.fields)return!1;let n=Reflect.ownKeys(e.fields);return n.length===Reflect.ownKeys(t.fields).length&&n.every(n=>{let r=e.fields[n],i=t.fields[n];return i!==void 0&&`value`in r&&`value`in i&&Object.is(r.value,i.value)&&r.enumerable===i.enumerable&&r.configurable===i.configurable&&r.writable===i.writable})}function $(e,t){if(e){for(let n of e.owned??[])$(n,t);e.cleanups&&=e.cleanups.map(e=>()=>{try{Promise.resolve(e()).catch(t)}catch(e){t(e)}})}}var ze=class{options;fileIcons=new E;appearanceCatalog=new w;workStatus=new Le;instances=new Map;listeners=new Set;panelMounts=new Set;fileViews=new Map;changes=l(0);views=l(0);session=l();currentPage=l();appearance;layouts=new Map;files;storage;ended=!1;contracts=new Map;snapshot=Object.freeze({plugins:Object.freeze([]),commands:Object.freeze([]),titlebarItems:Object.freeze([]),panels:Object.freeze([]),pages:Object.freeze([]),settings:Object.freeze([]),menuItems:Object.freeze([]),activePanel:null});#e;viewExports;constructor(e){this.options=e,this.viewExports=new ke(e.viewExport),this.appearance=l({locale:e.locale,mode:e.mode,narrow:e.narrow}),this.storage=new Oe(e.storage,e.transport);let t=()=>(this.session[0](),this.files?.api??X(`screen.file without a session`));this.#e=Z(`screen`,{get file(){return t()}})}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;changed(e=!1){let t=this.snapshot;this.changes[1](e=>e+1),e&&t===this.snapshot&&this.publish()}setSession(e){if(this.ended)return;let t=this.session[0]();if(t?.id===e?.id&&t?.directory===e?.directory)return;if(!e)for(let e of[...this.panelMounts])e();this.files?.dispose(),this.files=e?new De(this.options.files,this.options.queryClient,this.options.transport,e.directory):void 0;let n=e?this.sessionReference(e):void 0,r=this.snapshot;this.session[1](n),r===this.snapshot&&this.publish()}sessionReference(e){let t=Z(`session.server`,{id:this.options.transport,name:this.options.transport,client:this.options.client});return Object.freeze(Z(`session`,{id:e.id,directory:e.directory,key:`${this.options.transport}\n${e.id}`,tab:e.id,server:t,pending:!1,visit:{},location:{directory:e.directory}}))}setAppearance(e){if(this.ended)return;let t=this.appearance[0]();(t.locale!==e.locale||t.mode!==e.mode||t.narrow!==e.narrow)&&this.appearance[1]({...e})}setPage(e){this.ended||this.currentPage[1](e)}install(e,n,i){let s=this.instances.get(e);if(this.ended||s?.status===`active`&&s.revision===n.revision&&s.native?.active!==!1){i?.dispose();return}s&&(this.instances.delete(e),this.release(s));let c={id:e,native:i,revision:n.revision,controller:new AbortController,status:`active`,cleanups:new Set,contributions:new Set,iconChanges:l(0),appearanceChanges:l(0),workStatusChanges:l(0),commands:[],titlebarItems:[],panels:[],pages:[],settings:[],menus:[]};this.instances.set(e,c);try{if(e===`yuri`||e.startsWith(`yuri.`))throw Error(`The yuri namespace is reserved to the host`);let s=Ee(n.code,i?.activation.os);x(e=>{c.dispose=e,c.root=o(),b(()=>S(O.Provider,{value:c.context=this.context(c,s,n.options),get children(){c.owner=o();let e=r(()=>s.setup?.(c.context));if(typeof e==`function`)c.cleanups.add(()=>{Promise.resolve(e()).catch(e=>{c.error=String(e)})});else if(e!==void 0)throw e&&typeof e==`object`&&`then`in e&&Promise.resolve(e).catch(()=>{}),Error(`GUI setup must be synchronous and return only cleanup`);return null}}),e=>this.fail(c,e)),c.controller.signal.aborted||a(c.owner,()=>t(()=>{if(c.iconChanges[0](),!c.controller.signal.aborted)try{let e=[...c.contributions].filter(e=>e.registry===de).map(e=>e.read()).filter(e=>e!==void 0);this.fileIcons.replace(c.id,e),c.iconError!==void 0&&r(()=>{c.iconError=void 0,this.publish()})}catch(e){r(()=>{this.fileIcons.remove(c.id),c.iconError=e instanceof Error?e.message:String(e),this.publish()})}})),c.controller.signal.aborted||a(c.owner,()=>t(()=>{if(c.appearanceChanges[0](),!c.controller.signal.aborted)try{let e=e=>[...c.contributions].filter(t=>t.registry===e).map(e=>e.read()).filter(e=>e!==void 0);this.appearanceCatalog.replace(c.id,e(fe),e(T),c.native?.activation.capabilities?.dockIcon===!0)}catch(e){r(()=>this.fail(c,e))}})),c.controller.signal.aborted||a(c.owner,()=>t(()=>{if(c.workStatusChanges[0](),!c.controller.signal.aborted)try{let e=[...c.contributions].filter(e=>e.registry===Fe).map(e=>e.read()).filter(e=>e!==void 0);this.workStatus.replace(c.id,c.revision,e)}catch(e){r(()=>this.fail(c,e))}})),c.controller.signal.aborted||a(c.owner,()=>t(()=>{this.changes[0](),this.session[0](),this.appearance[0]();try{this.derive(c)}catch(e){r(()=>this.fail(c,e))}r(()=>this.publish())}))})}catch(e){this.fail(c,e)}this.changed(!0)}release(e){e.controller.abort(),e.native?.dispose();for(let t of[...e.cleanups])try{t()}catch(t){e.error??=String(t)}e.cleanups.clear(),$(e.root,t=>{e.error??=String(t)});try{e.dispose?.()}catch(t){e.error??=String(t)}e.contributions.clear(),e.commands=[],e.titlebarItems=[],e.panels=[],e.pages=[],e.settings=[],e.menus=[],this.fileIcons.remove(e.id),this.appearanceCatalog.remove(e.id),this.workStatus.remove(e.id);for(let t of this.contracts.values())t.provider===e&&(t.provider=void 0,t.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))}fail(e,t){e.status!==`failed`&&this.instances.get(e.id)===e&&(e.status=`failed`,e.error=t instanceof Error?t.message:String(t),t instanceof C&&(e.errorCode=t.code),this.release(e),this.publish())}uninstall(e){let t=this.instances.get(e);if(t){this.instances.delete(e),this.release(t);for(let t of this.layouts.values())t.open=t.open.filter(t=>!t.startsWith(`${e}:`)),t.active?.startsWith(`${e}:`)&&(t.active=null);this.changed(!0)}}dispose(){this.ended||(this.ended=!0,u(()=>{for(let e of[...this.instances.keys()])this.uninstall(e)}),this.viewExports.dispose(),this.files?.dispose(),this.fileIcons.dispose(),this.appearanceCatalog.dispose(),this.workStatus.dispose(),this.storage.dispose(),this.layouts.clear(),this.fileViews.clear(),this.contracts.clear(),this.listeners.clear())}async setDockIcon(e,t){let n=this.instances.get(e),r=n?.native;if(!r?.active||!r.activation.capabilities?.dockIcon)return X(`Dock icon`);try{await r.setDockIcon(t)}catch(e){throw t!==null&&n&&this.fail(n,e),e}}own(e,t){let n=!0,r=()=>{n&&(n=!1,e.cleanups.delete(r),t())};return e.controller.signal.aborted||i(P)?.ended?(r(),r):(e.cleanups.add(r),o()&&m(r),r)}list(e){this.changes[0]();let t=[];for(let n of this.instances.values())if(n.status===`active`){for(let r of n.contributions)if(r.registry===e.id){let e=r.read();e!==void 0&&t.push(e)}}return t}context(e,n,a){let s=this.storage.forPlugin(e.id,e.controller.signal),l=Object.fromEntries(Object.entries(n.stores??{}).map(([e,t])=>[e,t.scope===`global`?s.store(e,{...t,scope:`global`}):n=>s.store(e,{...t,scope:{session:n}})])),u=(e,t)=>{let r=this.appearance[0]().locale;return(n.i18n?.[r]?.[e]??n.i18n?.[r.split(`-`)[0]]?.[e]??n.i18n?.en?.[e]??e).replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t?.[n]??e))},d=Z(`layout`,{narrow:()=>this.appearance[0]().narrow,ready:()=>!!this.session[0](),open:(t,n,r)=>{e.controller.signal.aborted||this.openPanel(t,n,r)},close:(t,n)=>{e.controller.signal.aborted||this.closeFor(t,n)},toggle:(e,t)=>d.state(e,t)===`visible`?d.close(e,t):d.open(e,t),hide:(t,n)=>{if(e.controller.signal.aborted)return;let r=this.layout(n);r.active===t&&r.shown&&(r.shown=!1,this.changed())},state:(e,t)=>{this.changes[0]();let n=this.layout(t);return n.active===e?n.shown?`visible`:`active`:n.open.includes(e)?`open`:`closed`},stored:t=>(this.changes[0](),this.layout(t).open.filter(t=>t.startsWith(`${e.id}:`)).map(t=>t.slice(e.id.length+1))),side:{opened:e=>(this.changes[0](),this.layout(e).shown),toggle:t=>{if(e.controller.signal.aborted)return;let n=this.layout(t);n.shown=!n.shown,this.changed()},menu:()=>this.list(A).filter(e=>e.menu===`session.panel`).sort((e,t)=>(e.order??0)-(t.order??0))},scroll:{get:(e,t)=>(this.changes[0](),this.layout(e).scroll.get(t)),set:(t,n,r)=>{if(e.controller.signal.aborted)return;let i=this.layout(t).scroll;if(!i.has(n)&&i.size>=128)throw Error(`GUI layout scroll limit exceeded`);i.set(n,{...r}),this.changed()}}}),f=Ne(e.controller.signal),p=D(()=>e.controller.signal.aborted?{status:`inactive`,reason:`disabled`}:{status:`active`,generation:1,value:f}),h={open:t=>e.controller.signal.aborted||this.appearance[0]().narrow||!e.pages.some(e=>e.id===t)?!1:this.options.openPage?.(q(e.id,t))??!1,current:()=>{let t=this.currentPage[0]();return e.pages.find(n=>q(e.id,n.id)===t)?.id}},g=D(()=>e.controller.signal.aborted||!this.options.openPage||this.appearance[0]().narrow?{status:`inactive`,reason:`disabled`}:{status:`active`,generation:1,value:h});return Z(`ctx`,{id:e.id,options:a,signal:e.controller.signal,client:this.options.client,storage:s,stores:l,toast:Ae(e.controller.signal,this.options.toast),app:{name:`yuri`,version:e.native?.activation.app.version??``,channel:e.native?.activation.app.packaged?`prod`:`local`,platform:e.native?`desktop`:`web`,packaged:e.native?.activation.app.packaged??!1},desktop:e.native?Z(`desktop`,{os:e.native.activation.os}):void 0,t:u,plural:(e,t,n)=>{let r=`${e}.${new Intl.PluralRules(this.appearance[0]().locale).select(t)}`;return u(r,{...n,count:t})===r?u(`${e}.other`,{...n,count:t}):u(r,{...n,count:t})},add:(n,a)=>{if(e.controller.signal.aborted||i(P)?.ended)return()=>{};if([`server`,`composer-pill`,`slot`,`file.viewer`,`menubar-item`].includes(n.id)&&X(`registry.${n.id}`),e.contributions.size>=256)throw Error(`GUI contribution limit exceeded`);let s=()=>{},l,u=x(r=>{s=r,l=o();let i=()=>typeof a==`function`?a():a,u;if(n.id===`yuri.file-icon`){let e=c(()=>{try{return{ok:!0,value:i()}}catch(e){return{ok:!1,error:e}}});u=()=>{let t=e();if(!t.ok)throw t.error;return t.value}}else u=c(i);if(n.id===`style`){let n=document.createElement(`style`);n.dataset.yuriPluginStyle=e.id,document.head.append(n),m(()=>n.remove()),t(()=>{let e=u();n.textContent=e===void 0?``:String(e)})}return{registry:n.id,read:u}},o()??e.owner);e.contributions.add(u);let d=()=>{n.id===`yuri.file-icon`&&e.iconChanges[1](e=>e+1)},f=()=>{(n.id===`yuri.theme`||n.id===`yuri.branding`)&&e.appearanceChanges[1](e=>e+1)},p=()=>{n.id===`yuri.work-status`&&e.workStatusChanges[1](e=>e+1)};return r(d),r(f),r(p),r(()=>this.changed()),this.own(e,()=>{$(l,t=>{e.error??=String(t)}),s(),e.contributions.delete(u),r(d),r(f),r(p),r(()=>this.changed())})},list:e=>this.list(e),provide:(t,n)=>{if(e.controller.signal.aborted||i(P)?.ended)return()=>{};if(G(t.id)||t.id===`yuri.previewActions`||t.id===`yuri.pages`)throw Error(`Preview/export/page contracts are provided only by the Yuri host`);if(t.kind!==`contract`||!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw Error(`Contract must belong to the providing plugin`);let r=this.contract(t.id);if(r.provider)throw Error(`Contract already provided: ${t.id}`);return r.provider=e,r.live[1]({status:`active`,value:n,generation:++r.generation}),this.own(e,()=>{r.provider===e&&(r.provider=void 0,r.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))})},use:t=>t.id===`yuri.pages`?t.kind===`contract`?g:X(`pages token must be a Contract`):t.id===`yuri.previewActions`?t.kind===`contract`?p:X(`preview actions token must be a Contract`):G(t.id)?t.kind===`contract`?this.viewExports.use(t.id,e.controller.signal):X(`export token must be a Contract`):t.kind===`ipc`&&e.native?e.native.token(t).live:this.contract(t.id,t.kind===`ipc`).live[0],main:t=>{if(!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw new C(`GUI_PLUGIN_FORBIDDEN`,`IPC must belong to the plugin`);return e.native?e.native.token(t).value:new Proxy({state:()=>void 0},{get:(e,t)=>t===`state`?e.state:t===`on`?()=>{throw new C(`GUI_PLUGIN_UNSUPPORTED`)}:()=>Promise.reject(new C(`GUI_PLUGIN_UNSUPPORTED`))})},sessions:{current:this.session[0],list:()=>{let e=this.session[0]();return e?[e]:[]}},screen:{current:()=>this.session[0]()?this.#e:void 0},layout:d,appearance:{mode:()=>this.appearance[0]().mode,font:()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`monospace`},locale:{locale:()=>this.appearance[0]().locale,direction:()=>/^(ar|fa|he|ur)(-|$)/i.test(this.appearance[0]().locale)?`rtl`:`ltr`},system:{copy:e=>navigator.clipboard.writeText(e),openExternal:e=>{let t=new URL(e);[`https:`,`http:`,`mailto:`].includes(t.protocol)||X(`system.openExternal protocol`),window.open(e,`_blank`,`noopener,noreferrer`)},save:Me},commands:{run:t=>e.controller.signal.aborted||!this.command(t)?!1:(this.runCommand(t),!0)},links:{open:t=>!e.controller.signal.aborted&&this.navigateLink(e,t),exists:t=>r(()=>{if(e.controller.signal.aborted)return!1;let n=this.linkHandler(t);try{return Promise.resolve(n?.value.exists?.(t)??!1).catch(()=>!1)}catch{return!1}})}})}contract(e,t=!1){let n=this.contracts.get(e);if(!n){if(this.contracts.size>=256)throw Error(`GUI contract limit exceeded`);let t=l({status:`inactive`,reason:`disabled`});n={live:[D(t[0]),t[1]],generation:0},this.contracts.set(e,n)}return t&&n.provider&&X(`IPC contract collision`),n}derive(e){if(e.status!==`active`)return;let t=[],n=[],i=[],a=[],o=[],s=[],c=this.session[0]();for(let r of e.contributions){if([`yuri.file-icon`,`yuri.theme`,`yuri.branding`,`yuri.work-status`].includes(r.registry))continue;let l=r.read();if(l!==void 0){if(r.registry===`yuri.page`){let e=Pe(l);if(s.some(t=>t.id===e.id))throw Error(`Duplicate yuri.page id`);s.push(e)}else if(r.registry===Se.id){let n=l;n.enabled!==!1&&t.push({key:`${e.id}.${n.id}`,pluginId:e.id,title:n.title,description:n.description,bind:n.bind,hidden:n.hidden,run:()=>this.invoke(e,()=>n.run())})}else if(r.registry===be.id){let t=l;o.push({key:JSON.stringify([e.id,t.id]),pluginId:e.id,label:t.label,title:t.title,icon:t.icon,busy:t.busy,pressed:t.pressed,actionable:!!t.run,run:t.run})}else if(r.registry===we.id&&c){let t=l,r=`${e.id}:`,i=this.layout(c).open.filter(e=>e.startsWith(r)).map(e=>e.slice(r.length));for(let r of t.list({session:c,screen:this.#e,open:i}))n.push({plugin:e,panel:t,tab:r})}else if(r.registry===ye.id){let e=l;(e.page||e.section)&&X(`SettingsPage host sections`),e.title,i.push(e)}else if(r.registry===A.id){let e=l;e.menu===`session.panel`?(e.title,a.push(e)):X(`MenuItem.${e.menu}`)}}}for(let e of n)e.tab.title;e.commands=t,e.titlebarItems=o,e.panels=n,e.pages=s,e.settings=i,e.menus=a,r(()=>this.views[1](e=>e+1))}publish(){let e=r(this.session[0]),t=e?this.layouts.get(e.key):void 0,n=[...this.instances.values()],i=n.filter(e=>e.status===`active`),a=i.flatMap(e=>e.panels.map(({tab:n})=>{let r=n.file?this.filePath(n.file):void 0;return{key:`${e.id}:${n.id}`,pluginId:e.id,title:n.title,file:r,inline:!!(r&&this.fileViews.has(r)),active:t?.shown===!0&&t.active===`${e.id}:${n.id}`}}));this.snapshot=Object.freeze({plugins:Q(n.map(({id:e,revision:t,status:n,error:r,errorCode:i,iconError:a})=>({id:e,revision:t,status:n,error:r??a,...i?{errorCode:i}:{}}))),commands:Q(i.flatMap(e=>e.commands.filter(e=>!e.hidden))),panels:Q(a),titlebarItems:Q(i.flatMap(e=>e.titlebarItems.map(({run:e,...t})=>t))),pages:Q(i.flatMap(e=>e.pages.map(t=>({key:q(e.id,t.id),pluginId:e.id,title:t.title,icon:t.icon})))),settings:Q(i.flatMap(e=>e.settings.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title})))),menuItems:Q(i.flatMap(e=>e.menus.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title,description:t.description,run:()=>{this.invoke(e,()=>t.run())}})))),activePanel:t?.shown&&a.some(e=>e.key===t.active)?t.active:null,sessionKey:e?.key});for(let e of this.listeners)e()}invoke(e,t){if(!e.controller.signal.aborted)try{let n=a(e.owner??null,t);if(n instanceof Promise)return n.catch(t=>this.fail(e,t))}catch(t){this.fail(e,t)}}command(e){return[...this.instances.values()].flatMap(e=>e.commands).find(t=>t.key===e)}runCommand(e){return this.command(e)?.run()}runTitlebarItem(e){for(let t of this.instances.values()){let n=t.titlebarItems.find(t=>t.key===e);if(n?.run&&!n.busy)return this.invoke(t,n.run)}}linkHandler(e){let t=[];for(let e of this.instances.values())for(let n of e.contributions)if(n.registry===ve.id){let r=n.read();r&&t.push({instance:e,value:r})}for(let n of t.sort((e,t)=>(t.value.priority??0)-(e.value.priority??0)))try{if(n.value.match(e))return n}catch(e){this.fail(n.instance,e)}}navigateLink(t,n){if(this.ended)return!1;let r=me(n.href);if(!r||!pe(r.path))return this.openLink(n);let i=this.session[0]();if(!i||n.session&&(n.session.key!==i.key||n.session.server.id!==i.server.id))return!1;if(!this.options.focusFile)return this.openLink(n);let a=e(n.base??i.directory,r.path),o=r.line===void 0?``:`:${r.line}${r.column===void 0?``:`:${r.column}`}`;return this.invoke(t,()=>this.options.focusFile(a+o,i.directory)),!0}openLink(e){if(this.ended)return!1;let t={...e,session:e.session??this.session[0]()},n=this.linkHandler(t);return n?(this.invoke(n.instance,()=>n.value.open(t)),!0):!1}filePath(e,t=this.session[0]()?.directory){let n=L(e);return/^(?:\/|[a-z]:\/)/i.test(n)||!t?n:L(`${t}/${n}`)}registerFileView(e,t){if(this.ended)return()=>{};let n=this.filePath(e,t),r=this.fileViews.get(n)??0;this.fileViews.set(n,r+1),r===0&&this.changed(!0);let i=!1;return()=>{if(i||this.ended)return;i=!0;let e=(this.fileViews.get(n)??1)-1;if(e){this.fileViews.set(n,e);return}{let e=this.session[0](),t=e&&this.layouts.get(e.key);t?.active&&this.snapshot.panels.some(e=>e.key===t.active&&e.file===n)&&(t.shown=!1),this.fileViews.delete(n)}this.changed(!0)}}filePanel(e,t){let n=this.filePath(e,t);return this.snapshot.panels.find(e=>e.file===n&&e.inline)}panelVisible(e){let t=this.session[0]();if(!t)return!1;let n=this.panel(e)?.tab.file;if(n&&this.fileViews.has(this.filePath(n)))return!0;let r=this.layouts.get(t.key);return!!(r?.shown&&r.active===e)}layout(e){let t=this.layouts.get(e.key);if(!t){if(this.layouts.size>=128)throw Error(`GUI session layout limit exceeded`);t={open:[],active:null,shown:!1,scroll:new Map},this.layouts.set(e.key,t)}return t}openPanel(e,t,n){if(this.ended)return;let r=this.layout(t),i=r.active,a=r.shown,o=r.open.length;if(!r.open.includes(e)){if(r.open.length>=64)throw Error(`GUI panel tab limit exceeded`);r.open=[...r.open,e]}n?.tab!==`append`&&(r.active=e,r.shown=!(this.appearance[0]().narrow&&n?.background)),(i!==r.active||a!==r.shown||o!==r.open.length)&&this.changed(!0);let s=this.panel(e);t.key===this.session[0]()?.key&&s&&n?.tab!==`append`&&this.invoke(s.plugin,()=>s.panel.focus?.({...this.props(e),restored:!1}))}selectPanel(e){let t=this.session[0]();t&&this.openPanel(e,t)}closeFor(e,t){let n=this.layout(t),r=t.key===this.session[0]()?.key?this.panel(e):void 0;if(!n.open.includes(e)||r?.tab.pinned||r?.tab.closable===!1)return;let i=this.session[0](),a=r&&i?{tab:r.tab,session:i,screen:this.#e}:void 0;n.open=n.open.filter(t=>t!==e),n.active===e&&(n.active=n.open.at(-1)??null),this.changed(!0),r&&a&&this.invoke(r.plugin,()=>r.panel.close?.(a))}closePanel(e){let t=this.session[0]();t&&this.closeFor(e,t)}hidePanel(){let e=this.session[0]();if(!e)return;let t=this.layout(e);t.shown&&(t.shown=!1,this.changed(!0))}panel(e){return[...this.instances.values()].flatMap(e=>e.panels).find(t=>`${t.plugin.id}:${t.tab.id}`===e)}props(e,t=!1){let n=this.panel(e)?.tab,r=()=>(this.views[0](),this.panel(e)?.tab??n??X(`panel no longer listed`)),i=t?c(()=>{let e=r();return{tab:e,fields:Object.getPrototypeOf(e)===Object.prototype?Object.getOwnPropertyDescriptors(e):void 0}},void 0,{equals:Re}):void 0,a=i?()=>i().tab:r,o=()=>this.session[0]()??X(`panel without session`);return{get tab(){return a()},get session(){return o()},screen:this.#e}}mountPanel(e,n,i){let a=this.panel(e);if(!a)return()=>{};let o=new AbortController,s=()=>{let s=c(()=>{this.session[0](),this.changes[0](),this.views[0]();let t=this.panel(e)?.tab.file;return t&&this.files&&this.panelVisible(e)?{model:this.files,file:t}:void 0},void 0,{equals:(e,t)=>e?.model===t?.model&&e?.file===t?.file});t(()=>{let e=s();e&&(m(e.model.watch(e.file)),e.model.sync(e.file).catch(()=>{}))});let l=()=>r(()=>a.panel.render(this.props(e,!0)));return S(K.Provider,{value:i?{plugin:a.plugin.controller.signal,signal:o.signal,content:n,target:i}:void 0,get children(){return l()}})},l=this.mount(a.plugin,n,()=>S(j.Provider,{value:{visible:()=>(this.changes[0](),this.panelVisible(e)),present:()=>(this.changes[0](),this.panelVisible(e)),placement:()=>this.appearance[0]().narrow?`mobile`:`side`,reserve:()=>!1,animate:()=>!1,sidebar:Z(`panel.sidebar`,{}),open:()=>{let e=this.session[0]();return e?a.plugin.context.layout.stored(e):[]}},get children(){return s()}})),u=()=>{this.panelMounts.delete(u),o.abort(),l()};return this.panelMounts.add(u),this.own(a.plugin,u)}mountSettings(e,t){for(let n of this.instances.values()){let r=n.settings.find(t=>`${n.id}:${t.id}`===e);if(r)return this.mount(n,t,()=>r.render({}))}return()=>{}}mountPage(e,t){if(this.appearance[0]().narrow)return()=>{};for(let n of this.instances.values()){let r=n.pages.find(t=>q(n.id,t.id)===e);if(r)return this.mount(n,t,()=>r.render())}return()=>{}}mountWorkStatus(e,t,n){let r=this.instances.get(e.pluginId);if(!r||!this.workStatus.contains(e)||this.ended)return{update(){},dispose(){}};let i=Ie(n,n.sessionId&&n.directory?this.sessionReference({id:n.sessionId,directory:n.directory}):void 0,this.options.transport),a=()=>{},o=()=>{},s=this.own(r,()=>{i.dispose(),o(),a()});return o=this.workStatus.subscribe(()=>{this.workStatus.contains(e)||s()}),a=this.mount(r,t,()=>e.render(i.props)),i.props.signal.aborted&&(o(),a()),{update:e=>{if(!i.matches(e)){s();return}i.update(e)},dispose:s}}mount(e,t,n){if(e.controller.signal.aborted)return()=>{};let i=()=>{},a,s=t=>{queueMicrotask(()=>this.fail(e,t))};try{i=ge(()=>S(O.Provider,{value:e.context,get children(){return a=o(),b(()=>r(n),s)}}),t)}catch(t){this.fail(e,t)}return this.own(e,()=>{$(a,t=>{e.error??=String(t)}),i(),t.replaceChildren()})}};export{ze as GuiPluginHost};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,s as n}from"./runtime-auth-Bh3htXtG.js";import{c as r,i}from"./runtime-switch-ibQIZnws.js";import{a,o,r as s}from"./path-utils-HRmerlyU.js";import{st as c}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{t as u}from"./runtime-file-resource-tDTBpJT_.js";var d=e(c(),1),f=l(),p=[0,250,750],m=e=>{try{return decodeURIComponent(e)}catch{return e}},h=e=>{try{let t=new URL(e),n=m(t.hostname),r=m(t.pathname);return/^[A-Za-z]$/.test(n)?r=`${n.toUpperCase()}:${r}`:n&&n.toLowerCase()!==`localhost`&&(r=`//${n}${r}`),/^\/[A-Za-z]:[\\/]/.test(r)&&(r=r.slice(1)),a(r)}catch{let t=m(e.replace(/^file:\/\//i,``));return/^\/[A-Za-z]:[\\/]/.test(t)&&(t=t.slice(1)),a(t)}},g=(e,t)=>{let n=e.trim();if(!n||/^https?:/i.test(n)||/^(?:data|blob):/i.test(n)||/^\/api(?=\/|[?#]|$)/.test(n))return{kind:`direct`,source:n};if(/^file:\/\//i.test(n))return{kind:`runtime-file`,source:n,path:h(n)};if(/^[a-z][a-z\d+.-]*:/i.test(n)&&!/^[A-Za-z]:[\\/]/.test(n))return{kind:`direct`,source:n};let r=m(n);return{kind:`runtime-file`,source:n,path:s(r)?a(r):o(t,r)}},_=(e,t)=>v(()=>u(e,t),t),v=async(e,t)=>{let r=i(),a=n(),o;for(let s of p){t.throwIfAborted(),s>0&&await new Promise((e,n)=>{let r=window.setTimeout(()=>{t.removeEventListener(`abort`,i),e()},s),i=()=>{window.clearTimeout(r),n(t.reason)};t.addEventListener(`abort`,i,{once:!0})});try{if(t.throwIfAborted(),r!==i()||a!==n())throw new DOMException(`Image request superseded`,`AbortError`);return await e()}catch(e){if(t.aborted||r!==i()||a!==n())throw e;o=e}}throw o instanceof Error?o:Error(`Image source request failed`)},y=()=>!1,b=e=>e.startsWith(`relay:`)||y(),x=(e,t)=>typeof t==`number`&&Number.isFinite(t)&&t>1048576&&b(e),S=()=>d.useSyncExternalStore(w,i,i),C=e=>e.kind===`runtime-file`&&!!e.path,w=e=>r(()=>e()),T=e=>t(()=>e()),E=(e,t,r)=>{let a=(0,f.c)(21),o=r===void 0?`inline`:r,s=d.useSyncExternalStore(T,n,n),c=d.useSyncExternalStore(w,i,i),l;a[0]!==t||a[1]!==e?(l=g(e,t),a[0]=t,a[1]=e,a[2]=l):l=a[2];let p=l,m;a[3]===p?m=a[4]:(m=C(p),a[3]=p,a[4]=m);let h=m,_=`${c}\n${s}\n${t}\n${e}\n${o}`,v=h?``:p.source,y=h,b;a[5]!==y||a[6]!==v||a[7]!==_?(b={key:_,source:v,loading:y,error:null},a[5]=y,a[6]=v,a[7]=_,a[8]=b):b=a[8];let[x,S]=d.useState(b),E,D;a[9]!==o||a[10]!==_||a[11]!==p||a[12]!==c||a[13]!==h?(E=()=>{if(!h||!C(p)){S({key:_,source:p.source,loading:!1,error:null});return}S({key:_,source:``,loading:!0,error:null});let e=new AbortController,t;return u(p.path,e.signal,o).then(n=>{if(e.signal.aborted||i()!==c){n.release();return}t=n.release,S({key:_,source:n.url,loading:!1,error:null})}).catch(t=>{e.signal.aborted||S({key:_,source:``,loading:!1,error:t instanceof Error?t.message:`Image source request failed`})}),()=>{e.abort(),t?.()}},D=[_,p,c,h,o],a[9]=o,a[10]=_,a[11]=p,a[12]=c,a[13]=h,a[14]=E,a[15]=D):(E=a[14],D=a[15]),d.useEffect(E,D);let O;return a[16]!==x||a[17]!==y||a[18]!==v||a[19]!==_?(O=x.key===_?x:{key:_,source:v,loading:y,error:null},a[16]=x,a[17]=y,a[18]=v,a[19]=_,a[20]=O):O=a[20],O},D=(e,t,n)=>E(e,t,n===void 0?`inline`:n).source;export{g as a,S as c,C as i,x as n,E as o,b as r,D as s,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-ibQIZnws.js";import{E as r}from"./desktop-Brp3xDpd.js";import{a as i,i as a,r as o}from"./vendor-zustand-vDaAPGfl.js";import{ot as s,st as c}from"./vendor-base-ui-CzHs0bHY.js";import{St as l,an as u,in as d,jt as f}from"./bootstrap-BzeQds0D.js";import{r as p,w as m}from"./useUIStore-BsCfUWQw.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{r as g}from"./vendor-reactuses-core-CuTmqEMK.js";import{$r as _,Ea as v,Jn as y,Li as b,Qi as x,R as S,Ta as C,Va as ee,ar as w,ca as te,ir as T,lt as ne,oi as re,p as E,tr as ie,v as ae,x as D,yt as O}from"./useMobileNavigationStore-SCjA_7jP.js";import{a as oe,g as k,o as se,p as ce,s as le}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as A}from"./AgentAvatar-DNVD6VCV.js";import{n as j}from"./Icon-DsN23fuV.js";import{g as M,v as ue}from"./gitApi-C6rhS4rG.js";import{c as de,d as fe,l as pe,n as me,r as he,t as ge}from"./fileMentionTouchSelection-CorehkTj.js";import{n as _e}from"./textarea-BCTNmuPZ.js";import{f as ve,o as N}from"./projectMeta-C08trpZE.js";var ye=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=k([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},be=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName&&e.agentName===r.agentName}),P=(e,t)=>e.highlightedIndex===t.highlightedIndex&&be(e.rows,t.rows),F=(e,t)=>be(e,t)?e:t.slice(),xe=(e,t,n)=>{e&&(t.current&&P(t.current,n)||(t.current=n,e(n)))},Se=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},I=e(c(),1),L=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},R=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,z=(e,t)=>{let n=L(t),r=L(e);if(!n||!r)return!1;let i=R(n),a=R(r);return a===i||a.startsWith(`${i}/`)},Ce=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=L(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>L(e)).filter(e=>z(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>L(e)).filter(e=>z(e,t)))):[],s=typeof i.selectedPath==`string`?L(i.selectedPath):null,c=s&&z(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},B=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},V=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},we=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=L((t||``).trim()),a=L((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:B({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=e=>R(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=R(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=R(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:B({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=L((t||``).trim()),a=n?L(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:B({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=L((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=L((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>L((e||``).trim())).filter(e=>e&&z(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=V(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:m(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Ce(t)}},partialize:e=>({byRoot:Ce(e.byRoot)})}),{name:`files-view-tabs-store`})),H=h(),Te=(e,t)=>{let n=(0,H.c)(4),r=t===void 0?200:t,[i,a]=I.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),I.useEffect(o,s),i},Ee=()=>{let e=(0,H.c)(17),t=E(De),n=O(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=D(r),a=E(Oe),o=E(ke),s=v(Ae),c=v(je),u=l(Me);if(t){let r;e[2]===i?r=e[3]:(r=ae(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return u??void 0};function De(e){return e.currentSessionId}function Oe(e){return e.worktreeMetadata}function ke(e){return e.newSessionDraft}function Ae(e){return e.activeProjectId}function je(e){return e.projects}function Me(e){return e.currentDirectory}var U=s(),W=`bg-transparent font-[inherit] text-[var(--primary-base)]`,G=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,U.jsx)(`mark`,{className:W,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},K=I.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),m=Ee()??``,h=E(e=>e.currentSessionId),C=re(e=>e.activeSessions),w=S({enabled:!!i}),T=v(e=>e.activeProjectId),ne=v(e=>e.projects),ae=I.useMemo(()=>ne.find(e=>e.id===T)?.path??null,[T,ne]),D=I.useMemo(()=>{let e=ae||m;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[ae,m]),O=we(e=>D?e.byRoot[D]:void 0),k=b(e=>e.agents),M=f(e=>e.searchFiles),ue=Te(e,180),fe=u(),pe=d(),[ve,N]=I.useState([]),[ye,be]=I.useState(!1),[P,F]=I.useState(0),L=I.useRef(0),R=I.useRef({query:e,directory:m,ids:[]}),[z,Ce]=I.useState(360),[B,V]=I.useState({}),[H,De]=I.useState({}),Oe=I.useRef([]),ke=I.useRef([]),Ae=I.useRef([]),je=I.useRef(null),Me=I.useRef(null),W=I.useRef(null);W.current||=ge();let K=p(e=>e.isMobile),q=(e??``).trim(),J=te({directory:m||null}),Ne=I.useMemo(()=>r?J.data??[]:[],[r,J.data]),Pe=I.useMemo(()=>{if(!D||!O)return[];let e=[O.selectedPath,...O.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${D}/`)?e.slice(D.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return le(n,q,{limit:6})},[q,D,O]),Fe=I.useMemo(()=>n?x(k).filter(e=>e.mode!==`primary`):[],[k,n]),Y=I.useMemo(()=>i?oe({sessions:_(C,w),currentSessionId:h,searchQuery:q}):[],[C,h,w,q,i]),Ie=Pe,Le=ve,X=I.useMemo(()=>de({skills:Ne,agents:Fe,sessions:Y,recentFiles:Ie,pathHits:Le,searchQuery:q,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Ne,Fe,Y,Ie,Le,q,l]);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!je.current||je.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),I.useEffect(()=>{if(!m){N([]);return}let e=(ue??``).trim(),t=ce(e);if(!t){N([]);return}let n=!1;be(!0);let r={includeHidden:fe,respectGitignore:!pe};return Promise.all([M(m,t,80,{...r,type:`file`}),M(m,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Pe.map(e=>e.path));N(se({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||N([])}).finally(()=>{n||be(!1)}),()=>{n=!0}},[m,ue,Pe,M,fe,pe]),I.useLayoutEffect(()=>{let t=R.current,n=t.ids[L.current],r=t.query===e&&t.directory===m?Math.max(0,X.findIndex(e=>e.id===n)):0;R.current={query:e,directory:m,ids:X.map(e=>e.id)},L.current=r,F(r)},[X,e,m]),I.useEffect(()=>{V({}),De({})},[X]),I.useEffect(()=>{Oe.current[P]?.scrollIntoView({block:`nearest`})},[P]),I.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ke.current.forEach((n,r)=>{if(!n)return;let i=Ae.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),V(e),De(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[X]),I.useEffect(()=>{let e=ke.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Ce(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let Re=g(e=>{t(e)}),ze=g(e=>{n?.(e)}),Be=g(e=>{i?.(e)}),Ve=g(e=>{r?.(e)}),He=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&W.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&W.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(W.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>W.current?.pointerCancel(),onClick:()=>{W.current?.click(t)},onMouseMove:()=>{L.current=e,F(e)}}),Ue=e=>{let t=X.length;if(t===0)return;let n=(e%t+t)%t,r=X[n];if(r.agentName!==void 0){ze(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Ne.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Ve(e);return}if(r.id.startsWith(`session:`)){let e=Y.find(e=>r.id===`session:${e.id}`);e&&Be(e);return}let i=r.id.startsWith(`recent:`)?Ie.find(e=>r.id===`recent:${e.path}`):Le.find(e=>r.id===`file:${e.path}`);i&&Re(i)};I.useEffect(()=>{xe(s,Me,{rows:X,highlightedIndex:P})},[s,P,X]);let We=I.useRef(s);return We.current=s,I.useEffect(()=>()=>{Se(We.current,Me)},[]),I.useImperativeHandle(c,()=>({acceptIndex:e=>{Ue(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=X.length;if(t!==0){if(e===`ArrowDown`){L.current=(L.current+1)%t,F(L.current);return}if(e===`ArrowUp`){L.current=(L.current-1+t)%t,F(L.current);return}(e===`Enter`||e===`Tab`)&&Ue(L.current)}}})),(0,U.jsxs)(me,{ref:je,isMobile:K,className:`max-w-[640px] max-h-64`,style:o,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,U.jsxs)(`div`,{className:`py-1`,children:[X.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?ie(e.title,{maxLength:60}):e.title,i=P===t,a=B[t]??!1,o=H[t]??2.6;return(0,U.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Oe.current[t]=e},className:y(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,he(K,i),!K&&i&&`text-interactive-selection-foreground`),...He(t,()=>Ue(t)),children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,U.jsx)(j,{name:e.iconName,className:`size-3.5 text-current`}):(0,U.jsx)(A,{name:e.agentName,size:20})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{ref:e=>{ke.current[t]=e},className:y(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${z}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,U.jsx)(`span`,{ref:e=>{Ae.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,U.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:G(e.title,q)}):(0,U.jsx)(`span`,{className:`block truncate`,children:G(r,q)})]}),e.trailingLabel?(0,U.jsx)(`span`,{className:y(`max-w-[40%] shrink-0 truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,U.jsx)(`div`,{className:y(`truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:G(e.subtitle,q)}):null]})]},e.id)}),ye&&Le.length===0?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,U.jsx)(j,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ye&&X.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),q=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),J=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&q.has(n))},Ne=(e,t)=>!e||t({name:e}),Pe=` `,Fe=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===Pe&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Y=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ie=y(Y,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Le=y(Y,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),X=y(Y,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),Re=y(Y,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ze=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Be=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},Ve=I.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),d=p(e=>e.isMobile),f=E(e=>e.currentSessionId),m=E(e=>!!e.newSessionDraft?.open),h=E(I.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),g=ne(f??``,h??void 0),_=I.useMemo(()=>s??{sessionID:f??null,hasMessages:g.length>0,hasNewDraft:m},[s,f,g.length,m]),{hasSession:v,canStartSessionCommand:b}=I.useMemo(()=>Be(_),[_]),x=_.hasMessages,[S,w]=I.useState([]),[te,T]=I.useState(!1),re=C({directory:i}),ie=I.useMemo(()=>re.data??[],[re.data]),ae=re.isFetching,[D,O]=I.useState(0),oe=I.useRef(0),k=I.useRef(!1),se=I.useRef([]),ce=I.useRef(null),le=I.useRef(!1),A=I.useRef(null),M=I.useRef(!1),ue=I.useRef(null);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!ce.current||ce.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),I.useEffect(()=>{(async()=>{T(ae);try{let t=ie.flatMap((e,t)=>e.source===`skill`?[]:[{id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,scope:e.scope,reference:e.reference}]),n=[{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!x?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...b?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...b?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...b?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...b?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...b?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...b?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...t],i=!x,a=ye(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);w(e=>ze(e,a)?e:a)}catch{let t=!x,n=ye([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!x?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],...v?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...b?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...b?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...b?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...b?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...b?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...b?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0)),e);w(e=>ze(e,n)?e:n)}finally{T(!1)}})()},[e,x,v,b,ie,ae,u,o]),I.useEffect(()=>{O(0)},[S]),I.useEffect(()=>{oe.current=D},[D]),I.useEffect(()=>{se.current[D]?.scrollIntoView({block:`nearest`})},[D]),I.useEffect(()=>{xe(c,ue,{rows:pe(S,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:D})},[S,c,D,u]);let de=I.useRef(c);de.current=c,I.useEffect(()=>()=>{Se(de.current,ue)},[]),I.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=S[e];r&&t(r,J(r,n))},handleKeyDown:e=>{let r=S.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){k.current=!0,O(e=>(e+1)%r);return}if(e===`ArrowUp`){k.current=!0,O(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(oe.current%r+r)%r,i=S[n];i&&t(i,J(i,e===`Enter`))}}}}),[S,n,t]);let ge=e=>{let t=fe(e);switch(e.name){case`new`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,U.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,U.jsxs)(me,{ref:ce,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:te?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,U.jsx)(j,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,U.jsxs)(`div`,{children:[S.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,U.jsxs)(`div`,{ref:e=>{se.current[r]=e},className:y(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,he(d,r===D),!d&&r===D&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(A.current={x:e.clientX,y:e.clientY},M.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!A.current)return;let t=e.clientX-A.current.x,n=e.clientY-A.current.y;Math.hypot(t,n)>6&&(M.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=M.current;A.current=null,M.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),le.current=!0,t(n,J(n,d)))},onPointerCancel:()=>{A.current=null,M.current=!1},onClick:()=>{if(le.current){le.current=!1;return}t(n,J(n,d))},onMouseMove:()=>{k.current=!1,O(r)},children:[(0,U.jsx)(`div`,{className:y(!d&&`mt-0.5`),children:ge(n)}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,G(n.name,e)]}),n.isSkill?(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,U.jsx)(`span`,{className:Re,children:`Yuri`}):i?(0,U.jsx)(`span`,{className:Re,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,U.jsx)(`span`,{className:n.scope===`project`?X:Le,children:n.scope}):null,n.agent&&(0,U.jsx)(`span`,{className:Re,children:n.agent})]}),n.description&&!d&&(0,U.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:G(n.description,e)})]})]},n.id)}),S.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Ve.displayName=`CommandAutocomplete`;var He=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,Ue=1e4,We=6e4,Ge=5e3,Ke=3e4,qe=6e4,Je=25,Ye=40,Xe=2,Ze=15e3,Qe=500,$e=30,et=20971520,tt=new Map,nt=new Map,rt=new Map,it=new Map,at=new Map,ot=new Map,st=new WeakMap,ct=e=>{let t=st.get(e);return t||(t=new Set(e.files.map(e=>e.path)),st.set(e,t)),t},lt=(e,t)=>`${t}:${e}`,ut=e=>nt.get(e)??0,dt=e=>{let t=ut(e)+1;return nt.set(e,t),t},ft=e=>{let t=(rt.get(e)??0)+1;return rt.set(e,t),t},pt=e=>{let t=tt.get(e);if(t)return t;let n=new Set;return tt.set(e,n),n},Z=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),mt=(e,t=$e,n=et)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,gt=e=>{let t=e?.trim()??``;return t===`?`?``:t},_t=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),gt(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&>(t.index)!==gt(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),gt(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},vt=e=>!e||e.trim().length===0,yt=e=>(e||``).trim()===`U`,bt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},xt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},St=e=>vt(e.index)&&vt(e.working_dir),Q=i()(o((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&dt(r),n&&dt(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Z()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=lt(n,a),s=it.get(o)??(a===`light`?it.get(lt(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Z(),!a){let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>We,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0),d=t().directories.get(n)??Z(),f=ot.get(n),p=f?.received===u&&f.stored===d.status?null:_t(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&dt(n);let m={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),ot.set(n,{received:u,stored:m})}else{ot.set(n,{received:u,stored:d.status});let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();it.set(o,c);try{return await c}finally{it.get(o)===c&&it.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?bt(e):xt(e);t!==e&&(l=!0),St(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=ft(r);{let n=new Map(t().directories),i=n.get(r)??Z();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await w(r,i,void 0,o):await T(r,i,void 0,o);if(s!==rt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Z();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(He(i)||console.error(`Failed to fetch git branches:`,i),s!==rt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Z();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Z();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Z();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Z();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>Ue||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Z(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=mt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{dt(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,Je);await t().prefetchDiffs(e,n,i,{maxFiles:Je})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=Ye}=a,c=Math.min(Math.max(1,s),$e),l=ct(o.status),u=o.status.diffStats,d=pt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Qe||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=ut(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,_=[],v=()=>{let e=g;return g+=1,e<m.length?m[e]:null},y=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Ze}ms`)),Ze)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},b=async()=>{for(;;){if(h!==ut(n))return;let e=v();if(!e)return;try{_.push(await y(e))}catch{}finally{d.delete(e)}}},x=Math.min(Xe,m.length);if(await Promise.allSettled(Array.from({length:x},()=>b())),m.forEach(e=>d.delete(e)),h!==ut(n))return;let S=new Map(t().directories),C=S.get(n);if(!C)return;let ee=new Map(C.diffCache),w=Date.now();_.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||ee.set(e.path,{...e.diff,fetchedAt:w})});let te=mt(ee);S.set(n,{...C,diffCache:te}),e({directories:S})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<Ge||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=at.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=Ge)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=Ke)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=Ue)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=qe)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return at.set(e,i),i.finally(()=>{at.get(e)===i&&at.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Ct=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),Q(n)},wt=e=>{let r=(0,H.c)(3),i=I.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],Q(a)},Tt=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),Q(n)},Et=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),Q(n)},Dt=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),Q(n)},Ot=e=>{let t=(0,H.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=I.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),Q(i)},kt=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),Q(n)},At=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),Q(n)},jt=e=>{let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),Q(n)},Mt=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},$=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),Nt=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),Pt=async e=>{let t=await ve(e);try{let n=Mt((await M(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await ue(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Ft=async(e,t)=>{let n=await Pt(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},It=async(e,t,n)=>{let r=Nt(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Ft(e,r):i&&$(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:$(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},Lt=async(e,t,n)=>{let r=await It(e.path,t,n);return N(e,r)},Rt=`yuri:lastWorktreeSourceBranch`,zt=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Bt=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},Vt=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},Ht=(e,t,n)=>{let r=Vt(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Ut=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Ht(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},Wt=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))||e.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},Gt=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Ne as C,we as D,Te as E,F as O,Fe as S,Ee as T,Ot as _,Rt as a,Et as b,Lt as c,Dt as d,wt as f,Tt as g,kt as h,Ht as i,Pt as l,At as m,Wt as n,Bt as o,jt as p,Ut as r,zt as s,Gt as t,It as u,Ct as v,K as w,Ve as x,Q as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-15MWHJyx.js","assets/rolldown-runtime-hePW80VL.js","assets/renderMobileApp-DagPx3n0.js","assets/runtime-auth-Bh3htXtG.js","assets/runtime-switch-ibQIZnws.js","assets/runtime-fetch-9B8F_rKW.js","assets/path-utils-HRmerlyU.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-base-ui-CzHs0bHY.js","assets/bootstrap-BzeQds0D.js","assets/desktop-Brp3xDpd.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BsCfUWQw.js","assets/vendor-react-DlzBev0S.js","assets/vendor-pathe-vBmvQE8f.js","assets/fileQueries-BaEKb7SZ.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-resource-tDTBpJT_.js","assets/runtime-file-store-BVRgEtI-.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-Dids8J9D.js","assets/runtime-ead7P81A.js","assets/capgoAdapter-DceVw3SM.js","assets/types-DXSnGXVb.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-SCjA_7jP.js","assets/store-Myt_Fv8d.js","assets/tour-DDI0Zg7l.js","assets/useAssistantUIStore-CVSFSgJV.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/MobileShareBridge-DfgyncNh.js","assets/MobileDetailNavigation-CXcMdlRH.js","assets/Icon-DsN23fuV.js","assets/AgentAvatar-DNVD6VCV.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-CgtwKUKd.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-C6rhS4rG.js","assets/useAppFontEffects-Blo2lGTo.js","assets/desktopHosts-qQ2Rz26_.js","assets/desktopRelayRestore-DifJHAur.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-CJsiyoER.js","assets/input-B7-PmgcW.js","assets/tooltip-D5Xeh6py.js","assets/pwa-C956NPB0.js","assets/MobileResizableSheet-D_PnyzR0.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-DoYUmvbX.js","assets/device-Db_TcRdX.js","assets/textarea-BCTNmuPZ.js","assets/OverlayScrollbar-BLhv7Nq-.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-C08trpZE.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/YuriLogo-C5K_9jSK.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-C8tBjNoP.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-D2JIMvDo.js","assets/useDictation-Dp2Y3X49.js","assets/LoadingImage-MAgXscGl.js","assets/ImageLoadingPlaceholder-MfVzv_y1.js","assets/image-loading-D1DfK_bJ.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-CorehkTj.js","assets/insertionBoundaries-B-ncem5c.js","assets/appThemeRegistry-CcdIpK3S.js","assets/queue-abort-optimistic-CWyeG_sJ.js","assets/MarkdownRenderer-DswMDaKf.js","assets/useEffectiveDirectory-Uc8I6wXt.js","assets/markdownHeightCache-DlRC53XG.js","assets/url-DO6Zrx1P.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-CK7jBcu4.js","assets/useWorkerHighlightedLines-DAxMD3fK.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-B-W7ADKC.js","assets/speechSettingsQueries-CJqxaC2Q.js","assets/vendor-marked-S3gCOYp1.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-BY1Ynoj1.js","assets/useFontPreferences-DqBoLHp6.js","assets/terminalApi-BXf0a2VZ.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-Bm8nYrzH.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-BRFr-Gfm.js","assets/usePluginsStore-DfksbEZx.js","assets/collapsible-B3zojUm2.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/AssistantContactStatus-C5zpVdGa.js","assets/assistant-attachment-cache-C-SlEpSB.js","assets/runtimeEndpointReset-D-aHzKPN.js","assets/YuriWordmark-CJ8qJ14A.js","assets/mobileBackNavigation-ByUDCJde.js","assets/AssistantUnreadBadge-7KpCtnd3.js","assets/context-menu-DFRg1NJF.js","assets/readiness-CUPPcONt.js","assets/native-errors-06if6eu-.js","assets/appearance--vFosLNi.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-6jhYadQt.css","assets/SettingsView-DGduWj3I.js","assets/native-config-C2j59qnN.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-Ru8tm8eq.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-BgOCEgEb.js","assets/vendor-yaml-C9KlJAlj.js","assets/AssistantView-BZU6TlwK.js","assets/touch-gestures-CErgaXZ7.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-CzDk_0Pp.css","assets/main-Chq1F31E.js","assets/useDesktopWindowControlsLayout-YAxhtSDl.js","assets/historyImportQueries-BrhVXQhP.js","assets/diagram-OTF8YAve.js","assets/vendor-react-drawio-Dyg1-39Q.js","assets/multirun-F1yOJb2_.js","assets/projectActions-C-9Z8R7y.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./runtimeConfig-D_McrwNd.js";import{o as n}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(e={}){let{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await n(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-15MWHJyx.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:t}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__YURI_RUNTIME_APIS__=t();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__YURI_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`yuri.dev.module-reload`,m=(e,t)=>{console.error(`[yuri] failed to load ${t}:`,e)};l===`mobile`?n(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-DagPx3n0.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__YURI_RUNTIME_APIS__??t())}).catch(e=>m(e,`renderMobileApp`)):e().then(()=>n(()=>import(`./main-Chq1F31E.js`),__vite__mapDeps([161,1,3,4,5,10,6,65,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,120,27,124,28,29,30,31,32,33,34,35,36,37,39,40,41,42,38,43,44,45,46,47,48,49,51,52,58,59,60,61,63,64,66,67,68,69,54,57,53,55,56,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,62,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,121,123,125,126,127,128,129,130,131,132,133,134,135,136,162,139,140,141,142,143,144,145,146,147,148,163,164,165,166,167,168,169,170,160]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();
|