@yuriai/web 0.3.2-beta.1 → 0.3.2-beta.12
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-B4_d0rQt.js → AgentAvatar-BJffjMB2.js} +1 -1
- package/dist/assets/AssistantConversationSurface--yxDjnQu.js +3 -0
- package/dist/assets/AssistantSessionCard-DdPqL_g8.js +2 -0
- package/dist/assets/{AssistantUnreadBadge-DzxFnL8M.js → AssistantUnreadBadge-DM_fwozo.js} +1 -1
- package/dist/assets/{AssistantView-TODFoL2I.js → AssistantView-dUWmrucP.js} +1 -1
- package/dist/assets/{DiagramView-x3sdXc97.js → DiagramView-CpoBNbaR.js} +1 -1
- package/dist/assets/{FadeInOnReveal-C5qpH3TY.js → FadeInOnReveal-CJqre5kV.js} +1 -1
- package/dist/assets/{GuiPluginPage-D5ajS2AA.js → GuiPluginPage-CM-Sop6a.js} +1 -1
- package/dist/assets/{GuiPluginSurface-bwXAUscV.js → GuiPluginSurface-CAN_zgP3.js} +1 -1
- package/dist/assets/{GuiPluginWindow-SsWHnc4g.js → GuiPluginWindow-unA50cUu.js} +1 -1
- package/dist/assets/{Icon-DBOSvb4U.js → Icon-DSX7wjSw.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CrJp1f5y.js → ImageLoadingPlaceholder-PLO0B9my.js} +1 -1
- package/dist/assets/{LoadingImage-zXRrm9H9.js → LoadingImage-BAUw--5b.js} +1 -1
- package/dist/assets/MarkdownRenderer-C-hlqlA0.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-BeJCqK7P.js → MarkdownRendererImpl-CA9zIauD.js} +2 -2
- package/dist/assets/{MarkstreamRendererImpl-DOYwdhQ_.js → MarkstreamRendererImpl-CwsjUaGC.js} +2 -2
- package/dist/assets/{MobileDetailNavigation-DVbLG15P.js → MobileDetailNavigation-FfSrd8rW.js} +1 -1
- package/dist/assets/{MobileResizableSheet-WTfrQdK8.js → MobileResizableSheet-_VhodKQ3.js} +1 -1
- package/dist/assets/{MobileShareBridge-CgVEGvAL.js → MobileShareBridge-DtCqMWXT.js} +1 -1
- package/dist/assets/MobileSurface-34aws7qB.js +2 -0
- package/dist/assets/{MultiRunWindow-CMBcfCOh.js → MultiRunWindow-DCCjgHNE.js} +1 -1
- package/dist/assets/{OnboardingScreen-DLMYQLFn.js → OnboardingScreen-D7YC-sBK.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CwmXL6W2.js → OverlayScrollbar-Ce9Mr4_V.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-vCSOg3_8.js → RemoteAssistantSessionCard-Csb19vol.js} +1 -1
- package/dist/assets/{SettingsView-DeS2ph7b.js → SettingsView-BF-DV5jC.js} +13 -13
- package/dist/assets/{SettingsWindow-CBh8oudq.js → SettingsWindow-BGec9rhJ.js} +1 -1
- package/dist/assets/{SetupTourDialog-C6SfskP3.js → SetupTourDialog-Du963bwh.js} +1 -1
- package/dist/assets/{TerminalView-CJDYSJWP.js → TerminalView-BLmis6W4.js} +1 -1
- package/dist/assets/ToolOutputDialog-D5vUeeCg.js +16 -0
- package/dist/assets/{VoiceSettings-C-W8KWvQ.js → VoiceSettings-Cz4DTeu1.js} +2 -2
- package/dist/assets/{YuriLogo-VXtP1vhh.js → YuriLogo-BKdnDJwl.js} +1 -1
- package/dist/assets/{YuriWordmark-B7lmpLRB.js → YuriWordmark-jFHGvbDP.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-D-LmCflm.js → assistant-attachment-cache-BYvIyn1x.js} +1 -1
- package/dist/assets/{capgoAdapter-vPx0i-Ad.js → capgoAdapter-vcXrgtcl.js} +1 -1
- package/dist/assets/{checkbox-QxG9Mpbu.js → checkbox-lnltTd4O.js} +1 -1
- package/dist/assets/{client-1Fk5IbQR.js → client-BsLh14yh.js} +1 -1
- package/dist/assets/{collapsible-BvteRbPh.js → collapsible-B3_mc5eD.js} +1 -1
- package/dist/assets/context-menu-CeBwB9rZ.js +1 -0
- package/dist/assets/{desktopHosts-135cuRCE.js → desktopHosts-BsTrBVja.js} +1 -1
- package/dist/assets/{desktopRelayRestore-1aUztDPU.js → desktopRelayRestore-BxbRKak_.js} +1 -1
- package/dist/assets/{device-QL8KNSLM.js → device-BlmHHWT1.js} +1 -1
- package/dist/assets/{diagram-D6B_k7M5.js → diagram-DUBp-_Yd.js} +1 -1
- package/dist/assets/dialog-DYOEW9DC.css +1 -0
- package/dist/assets/dialog-f0jnPiqM.js +1 -0
- package/dist/assets/{fileMentionTouchSelection-DiKjZQEm.js → fileMentionTouchSelection-D5yvbxbi.js} +1 -1
- package/dist/assets/{fileReferenceActions-cYqdsXFz.js → fileReferenceActions-DLTUzjwi.js} +1 -1
- package/dist/assets/{gitApi-CtJXK0WM.js → gitApi-BMcLfk7G.js} +1 -1
- package/dist/assets/{gitApiHttp-B0FJaIhU.js → gitApiHttp-Dk5fNrOy.js} +1 -1
- package/dist/assets/{gui-BMN3-WPc.js → gui-KxRdG4j0.js} +1 -1
- package/dist/assets/{historyImportQueries-D_9RlrLp.js → historyImportQueries-DiGQ8duS.js} +1 -1
- package/dist/assets/{host-Bx9gj-ju.js → host-BBp7NPZz.js} +1 -1
- package/dist/assets/{i18n-qHllte6P.js → i18n-BvjeIWrT.js} +1 -1
- package/dist/assets/{image-loading-DBqnxgDH.js → image-loading-Dlh4FIPJ.js} +1 -1
- package/dist/assets/{input-C16jIASm.js → input-CTFR9La6.js} +1 -1
- package/dist/assets/{input-store-CsY-uaSj.js → input-store-wWToFdzi.js} +1 -1
- package/dist/assets/{insertionBoundaries-62IwW9Ka.js → insertionBoundaries-CVbCae7y.js} +1 -1
- package/dist/assets/main-BJ6CmPDc.js +169 -0
- package/dist/assets/main-CUu7EunU.js +2 -0
- package/dist/assets/{markdownHeightCache-CDcoG7oI.js → markdownHeightCache-BXL8JbYG.js} +1 -1
- package/dist/assets/{markdownTheme-DFDWa8Gh.js → markdownTheme-C2LJ3cJo.js} +1 -1
- package/dist/assets/{mcpQueries-CQjcxaDQ.js → mcpQueries-CvgW0Bl6.js} +1 -1
- package/dist/assets/miniChat-J9pxSQyx.js +2 -0
- package/dist/assets/mobile-DYjeIixi.js +2 -0
- package/dist/assets/{mobileBackNavigation-BPncsZvR.js → mobileBackNavigation-hjJm8naw.js} +1 -1
- package/dist/assets/mobileConnections-BEr-iBDA.js +2 -0
- package/dist/assets/{multirun-B5DvrZRF.js → multirun-CntRJAjm.js} +1 -1
- package/dist/assets/{native-config-1ijMxxRj.js → native-config-DdAtv91r.js} +1 -1
- package/dist/assets/{navigation-guYHqUd5.js → navigation-XRMYLkiK.js} +2 -2
- package/dist/assets/openRemoteProjectSession-C9_o5Yvr.js +1 -0
- package/dist/assets/{platform-wF65ZFgV.js → platform-CiUKDeXd.js} +1 -1
- package/dist/assets/{project-preview-2H-TmJkd.js → project-preview-BjTq299L.js} +1 -1
- package/dist/assets/{projectActions-50e_f9dI.js → projectActions-BPmI9_mW.js} +1 -1
- package/dist/assets/projectMeta-DyXicvG2.js +1 -0
- package/dist/assets/{prompt-attachment-upload-9fjmgafL.js → prompt-attachment-upload-Bem87nmm.js} +1 -1
- package/dist/assets/pwa-B8e09BUU.js +2 -0
- package/dist/assets/qoder-zGvP_RLr.svg +5 -0
- package/dist/assets/{queue-abort-optimistic-BuYzwR0N.js → queue-abort-optimistic-Buq-SBlq.js} +1 -1
- package/dist/assets/{react-DEouUmkV.js → react-DAdu4yTi.js} +1 -1
- package/dist/assets/readiness-Bxbkh3nB.js +2 -0
- package/dist/assets/{reference-history-Dyzfrmw-.js → reference-history-DtWYTywa.js} +1 -1
- package/dist/assets/{remote-input-store-84i8uDyM.js → remote-input-store-BvlOGMu_.js} +1 -1
- package/dist/assets/{remoteProjectQueries-Dfms-cCx.js → remoteProjectQueries-B-IcENvi.js} +1 -1
- package/dist/assets/{remoteSessionReference-CqNXv4Qg.js → remoteSessionReference-BEtE3Q92.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-S8GzGGR7.js → renderElectronMiniChatApp-Dp6stG7q.js} +2 -2
- package/dist/assets/renderMobileApp-YITzRrOh.js +29 -0
- package/dist/assets/{runtime-auth-mjIpsk3N.js → runtime-auth-DA-qfGHk.js} +1 -1
- package/dist/assets/{runtime-fetch-DKZOpfzo.js → runtime-fetch-V-iMWR8t.js} +1 -1
- package/dist/assets/{runtime-file-download-D11Nnedg.js → runtime-file-download-DxL4XbME.js} +1 -1
- package/dist/assets/{runtime-file-resource-CuLP3xp7.js → runtime-file-resource-CKQQEwNv.js} +1 -1
- package/dist/assets/{runtime-switch-BMjl5Y5W.js → runtime-switch-DEPKHgdL.js} +1 -1
- package/dist/assets/{runtimeConfig-oElsA8Cz.js → runtimeConfig-Ccbs_U5j.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BUGfn7y0.css → runtimeEndpointReset-BIrMtGn5.css} +1 -1
- package/dist/assets/{runtimeEndpointReset-DT9dHdmQ.js → runtimeEndpointReset-CcoaDynZ.js} +9 -9
- package/dist/assets/{scheduledTaskNavigation-y5g8D2ee.js → scheduledTaskNavigation-CdBHn9ti.js} +1 -1
- package/dist/assets/{select-DpKqX1V6.js → select-CWX5Iu4G.js} +1 -1
- package/dist/assets/{sessionLookup-BHJgGHf0.js → sessionLookup-Cc1qteBf.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-a2sshnFf.js → sortable-tabs-strip-Dr7EhUHW.js} +1 -1
- package/dist/assets/{speechSettingsQueries-DKesZuQ3.js → speechSettingsQueries-C9SqPtzI.js} +1 -1
- package/dist/assets/src-BNTtvddA.css +2 -0
- package/dist/assets/{store-BOD3jjMl.js → store-Dj5cSf8B.js} +1 -1
- package/dist/assets/{terminalApi-Cq0vjFe1.js → terminalApi-Bk77qMTK.js} +1 -1
- package/dist/assets/{textarea-DPrUh2E_.js → textarea-C9CubBIs.js} +1 -1
- package/dist/assets/{tooltip-JO7-ziD9.js → tooltip-Bk9lQalb.js} +1 -1
- package/dist/assets/types-Dhselvhe.js +2 -0
- package/dist/assets/{useAppFontEffects-DhmTAaeq.js → useAppFontEffects-C7rRTGhP.js} +62 -61
- package/dist/assets/{useAssistantUIStore-jOKVcBK8.js → useAssistantUIStore-CI42fWZh.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-C3Bhl4tF.js → useDesktopWindowControlsLayout-PzEwONdf.js} +1 -1
- package/dist/assets/{useDictation-De8WB_Z7.js → useDictation-CLxZQYs_.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DsQiUzq0.js → useEffectiveDirectory-D0EiFP2j.js} +1 -1
- package/dist/assets/{useFontPreferences-CO-L-Gd7.js → useFontPreferences-DthR4yan.js} +1 -1
- package/dist/assets/{useMobileHtmlPreviewStore-EOAzZiAy.js → useMobileHtmlPreviewStore-DzzgY1eS.js} +1 -1
- package/dist/assets/useMobileNavigationStore-CWShXc31.js +13 -0
- package/dist/assets/{usePluginsStore-nTVPoJCl.js → usePluginsStore-CEq5xgbZ.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-CHhK626l.js → useProjectRuntimeAPIs-BDy_DoSn.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-CNJGj-_8.js → useStreamingTextThrottle-BZuJKyrE.js} +1 -1
- package/dist/assets/{useThemeSystem-C57Z9mV2.js → useThemeSystem-D2YBbLma.js} +1 -1
- package/dist/assets/{useUIStore-Cfmg-aDQ.js → useUIStore-DjizmHAt.js} +1 -1
- package/dist/assets/{vendor-base-ui-z2M4boRm.js → vendor-base-ui-fom6orB6.js} +1 -1
- package/dist/assets/{vendor-cmdk-BgHvMv5l.js → vendor-cmdk-BKc6RGpL.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-accessibility-gVi9ga0x.js → vendor-dnd-kit-accessibility-Cf9EEJvm.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-core-Dd5yS2-T.js → vendor-dnd-kit-core-DRyd7I0I.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-sortable-CV-SGi8y.js → vendor-dnd-kit-sortable-C8S8cyRO.js} +1 -1
- package/dist/assets/{vendor-framer-motion-CF9BQLta.js → vendor-framer-motion-DiGWHm7K.js} +1 -1
- package/dist/assets/{vendor-markstream-react-TwEpkgfP.js → vendor-markstream-react-Cwc-VXWM.js} +3 -3
- package/dist/assets/vendor-motion-DtmZZeEm.js +1 -0
- package/dist/assets/{vendor-pierre-diffs-tqo4Z3TC.js → vendor-pierre-diffs-HJfPTtu2.js} +1 -1
- package/dist/assets/{vendor-react-P8wFrkcT.js → vendor-react-D5BntRmA.js} +1 -1
- package/dist/assets/{vendor-react-drawio-CQW1YP2l.js → vendor-react-drawio-DXADKcSU.js} +1 -1
- package/dist/assets/{vendor-reactuses-core-Dyjw5sZR.js → vendor-reactuses-core-B8s-Rcd-.js} +1 -1
- package/dist/assets/{vendor-sonner-B5HgJenP.js → vendor-sonner-Y-KPX915.js} +1 -1
- package/dist/assets/{vendor-stream-diffs-DCMtZcS3.js → vendor-stream-diffs-BMT21f-n.js} +2 -2
- package/dist/assets/{vendor-tanstack-react-query-B-KblYBV.js → vendor-tanstack-react-query-ChSd65dm.js} +1 -1
- package/dist/assets/{vendor-tanstack-react-virtual-BkuqzrEV.js → vendor-tanstack-react-virtual-WY42p6U6.js} +1 -1
- package/dist/assets/{vendor-zustand-Cwko4FG1.js → vendor-zustand-CNn3HHhT.js} +1 -1
- package/dist/index.html +25 -25
- package/dist/mini-chat.html +25 -25
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/lib/gui-network/DOCUMENTATION.md +9 -1
- package/server/lib/notifications/DOCUMENTATION.md +11 -1
- package/server/lib/notifications/session-unread-store.js +20 -6
- package/server/lib/notifications/session-unread.test.js +80 -0
- package/server/lib/realtime-proxy.js +4 -2
- package/server/lib/realtime-proxy.test.js +5 -4
- package/server/lib/relay/tunnel-host.js +15 -5
- package/server/lib/relay/tunnel-host.test.js +24 -0
- package/server/lib/remote-hosts/DOCUMENTATION.md +8 -2
- package/server/lib/remote-hosts/routes.js +1 -1
- package/server/lib/remote-hosts/routes.test.js +75 -7
- package/server/lib/remote-hosts/transport.js +1 -1
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +14 -5
- package/server/lib/scheduled-tasks/runtime.js +29 -25
- package/server/lib/scheduled-tasks/runtime.test.js +88 -1
- package/server/lib/ui-auth/ui-auth.js +1 -1
- package/server/lib/ui-auth/ui-auth.test.js +3 -0
- package/dist/assets/AssistantConversationSurface-BlrOfc3x.js +0 -3
- package/dist/assets/AssistantSessionCard-B7cmrLAe.js +0 -2
- package/dist/assets/MarkdownRenderer-eeOXke_U.js +0 -2
- package/dist/assets/MobileSurface-BL4nGTY5.js +0 -2
- package/dist/assets/ToolOutputDialog-DF8dWVTm.js +0 -16
- package/dist/assets/context-menu-BYPUMFAX.js +0 -1
- package/dist/assets/dialog-BfjbsTOP.js +0 -1
- package/dist/assets/dialog-CTYD3Sbr.css +0 -1
- package/dist/assets/main-CAyhodbD.js +0 -169
- package/dist/assets/main-DZedJhQx.js +0 -2
- package/dist/assets/miniChat-DFXcicxI.js +0 -2
- package/dist/assets/mobile-CKNvVIUj.js +0 -2
- package/dist/assets/mobileConnections-BBNhczt8.js +0 -2
- package/dist/assets/openRemoteProjectSession-Dvg3pCz-.js +0 -1
- package/dist/assets/projectMeta-BOcz1XpN.js +0 -1
- package/dist/assets/pwa-D4vcI8VD.js +0 -2
- package/dist/assets/readiness-CzHlOvNr.js +0 -2
- package/dist/assets/renderMobileApp-Bbs497wM.js +0 -29
- package/dist/assets/src-INJJ62RE.css +0 -2
- package/dist/assets/types-CxdhW05G.js +0 -2
- package/dist/assets/useMobileNavigationStore-2N3dS8vX.js +0 -13
- package/dist/assets/vendor-motion-Dv27UnOI.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-DEPKHgdL.js";import{R as r,t as i}from"./platform-CiUKDeXd.js";import{ot as a,st as o}from"./vendor-base-ui-fom6orB6.js";import{n as s}from"./vendor-react-D5BntRmA.js";import{E as c,V as l}from"./runtime-file-resource-CKQQEwNv.js";import{i as u,m as d,r as f}from"./vendor-reactuses-core-B8s-Rcd-.js";import{r as p}from"./useUIStore-DjizmHAt.js";import{a as m,i as h,o as g,r as _}from"./useMobileHtmlPreviewStore-DzzgY1eS.js";import{n as v}from"./vendor-katex-DNVSTX6g.js";import{t as y}from"./i18n-BvjeIWrT.js";import{Cr as b,Rn as x,Wi as S}from"./useMobileNavigationStore-CWShXc31.js";import{t as C}from"./dualLimitLru-D8Sphgua.js";import{t as w}from"./useThemeSystem-D2YBbLma.js";import{r as T}from"./themes-BgDJcxRc.js";import{n as ee}from"./useEffectiveDirectory-D0EiFP2j.js";import{a as E,i as D,t as O}from"./image-loading-Dlh4FIPJ.js";import{c as k,i as A,l as j,n as te,o as M,r as ne}from"./FadeInOnReveal-CJqre5kV.js";import{i as re,r as N,t as ie}from"./markdownHeightCache-BXL8JbYG.js";import{t as ae}from"./vendor-marked-S3gCOYp1.js";import{n as oe,t as P}from"./markdownTheme-C2LJ3cJo.js";import{i as se,n as ce,t as F}from"./markdown-worker-oBGEB9Eg.js";import{t as I}from"./vendor-morphdom-BbKiNDAu.js";import{t as L}from"./vendor-dompurify-CeJNOzik.js";import{t as R}from"./vendor-pele-C1WTNWUm.js";import{t as le}from"./vendor-remend-C3cXc-tf.js";import{a as z,c as B,f as V,g as H,h as ue,i as U,l as W,n as G,o as de,p as fe,t as pe,u as me}from"./fileReferenceActions-DLTUzjwi.js";var K=t(o(),1),he=s(),ge=new C({maxEntries:100,maxBytes:8388608}),_e=(e,t)=>{let{surface:n,interactive:r,primary:i,status:a}=t.colors,o={bg:n.elevated,fg:n.foreground,muted:n.mutedForeground,line:r.border,surface:n.muted,"surface-alt":n.background,border:r.border,accent:i.base,critical:a.error,error:a.error,"series-1":i.base,"series-2":a.info,"series-3":a.success,"series-4":a.warning,"series-5":a.error,"series-6":i.hover??i.base,"series-7":a.infoForeground,"series-8":a.successForeground},s=JSON.stringify([o,new Date().toDateString(),e]),c=ge.get(s);if(c)return c;let l;try{let{svg:t}=R(e,{fontFamily:`system-ui, sans-serif`,autoDirection:!1,links:!1,images:!1}),n=L.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM_FRAGMENT:!0}).querySelector(`svg`);if(!n)throw Error(`Missing diagram SVG`);for(let[e,t]of Object.entries(o))n.style.setProperty(`--pele-${e}`,t);l={svg:n.outerHTML}}catch{l={}}return ge.set(s,l,(s.length+(l.svg?.length??0))*2),l},ve=`data-md-stream-fence`,ye=`data-md-stream-line`,q=`data-md-stream-src`,be=`data-md-stream-applied`,xe=(e,t)=>{let n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n},J=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-md-stream-line`)),Se=(e,t)=>{let n=document.createElement(`span`);return n.setAttribute(ye,String(t)),n.className=`line`,n.innerHTML=e,n},Ce=(e,t)=>{let n=J(e),r=n.map(e=>e.innerHTML),i=xe(r,t);if(n.length===0&&e.childNodes.length>0&&t.length>0){let n=document.createDocumentFragment();for(let e=0;e<t.length;e+=1)e>0&&n.appendChild(document.createTextNode(`
|
|
2
2
|
`)),n.appendChild(Se(t[e]??``,e));return e.replaceChildren(n),{reused:0,replaced:0,added:t.length,removed:0}}let a=0;for(let e=i;e<Math.min(n.length,t.length);e+=1)r[e]!==t[e]&&(n[e].innerHTML=t[e]??``,a+=1);let o=0;for(let r=n.length;r<t.length;r+=1)r>0&&e.appendChild(document.createTextNode(`
|
|
3
3
|
`)),e.appendChild(Se(t[r]??``,r)),o+=1;let s=0;for(let e=n.length-1;e>=t.length;--e){let t=n[e]?.previousSibling;t?.nodeType===Node.TEXT_NODE&&t.remove(),n[e]?.remove(),s+=1}return{reused:i,replaced:a,added:o,removed:s}},we=e=>{if(e.includes(`data-md-stream-fence=`))return e;let t=e.toLowerCase().lastIndexOf(`<pre`);return t<0?e:`${e.slice(0,t)}${e.slice(t).replace(/<pre\b/i,`<pre ${ve}="true"`)}`},Te=(e,t)=>{if(!(e instanceof HTMLElement)||!(t instanceof HTMLElement)||e.getAttribute(`data-md-stream-fence`)!==`true`||t.getAttribute(`data-md-stream-fence`)!==`true`)return!1;let n=e.tagName===`CODE`?e:e.querySelector(`code`),r=t.tagName===`CODE`?t:t.querySelector(`code`);if(n instanceof HTMLElement&&r instanceof HTMLElement){let e=Oe(n),t=n.closest(`pre`)??n,i=r.closest(`pre`)??r;for(let e of[`data-md-lang`,`data-md-label`]){let n=i.getAttribute(e);t.getAttribute(e)!==n&&(n===null?t.removeAttribute(e):t.setAttribute(e,n))}let a=r.getAttribute(`class`);n.getAttribute(`class`)!==a&&(a===null?n.removeAttribute(`class`):n.setAttribute(`class`,a)),Oe(n)!==e&&n.removeAttribute(be),n.setAttribute(q,r.textContent??``)}return!0},Ee=e=>e.getAttribute(`data-md-stream-src`)??e.textContent??``,De=e=>{let t=e.querySelectorAll(`pre[${ve}="true"]`),n=[];return t.forEach(e=>{let t=e.querySelector(`code`);t instanceof HTMLElement&&n.push(t)}),n},Oe=e=>e.closest(`pre`)?.getAttribute(`data-md-lang`)||e.className.match(/language-([^\s"]+)/)?.[1]||`text`,ke=async(e,t,n)=>{if(n?.signal?.aborted)return;let r=De(e);await Promise.all(r.map(async r=>{let i=Ee(r);if(!i||n?.signal?.aborted||r.getAttribute(`data-md-stream-applied`)===i)return;let a=Oe(r);if(a===`mermaid`)return;let o=await t(i,a,n);if(!(n?.signal?.aborted||!e.contains(r)||Ee(r)!==i||Oe(r)!==a)){if(!o){let e=J(r),t=document.createElement(`span`);Ce(r,i.split(`
|
|
4
4
|
`).map((n,r)=>{let i=e[r];return i?.textContent===n?i.innerHTML:(t.textContent=n,t.innerHTML)}));return}Ce(r,o),r.setAttribute(be,i),r.removeAttribute(q)}}))},Ae=`text`,je=/^(\d+):(\d+):(.+)$/,Me={ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,vue:`vue`,svelte:`svelte`,astro:`astro`,json:`json`,jsonc:`jsonc`,json5:`json5`,jsonl:`json`,ndjson:`json`,geojson:`json`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`properties`,env:`dotenv`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,styl:`stylus`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,md:`markdown`,markdown:`markdown`,mdown:`markdown`,mkd:`markdown`,mdx:`mdx`,py:`python`,pyw:`python`,pyi:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,kts:`kotlin`,swift:`swift`,scala:`scala`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,m:`objective-c`,mm:`objective-cpp`,cs:`csharp`,fs:`fsharp`,fsx:`fsharp`,vb:`vb`,php:`php`,pl:`perl`,pm:`perl`,lua:`lua`,r:`r`,dart:`dart`,ex:`elixir`,exs:`elixir`,erl:`erlang`,hrl:`erlang`,hs:`haskell`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,groovy:`groovy`,jl:`julia`,ml:`ocaml`,mli:`ocaml`,zig:`zig`,nix:`nix`,sol:`solidity`,prisma:`prisma`,proto:`proto`,graphql:`graphql`,gql:`graphql`,sql:`sql`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,fish:`shellscript`,ps1:`powershell`,psm1:`powershell`,bat:`bat`,cmd:`bat`,tf:`terraform`,tfvars:`terraform`,hcl:`hcl`,diff:`diff`,patch:`diff`,csv:`csv`,tex:`latex`,vim:`viml`,wgsl:`wgsl`,glsl:`glsl`,wat:`wasm`,mermaid:`mermaid`,mmd:`mermaid`},Ne={dockerfile:`docker`,containerfile:`docker`,makefile:`make`,gnumakefile:`make`,"cmakelists.txt":`cmake`,gemfile:`ruby`,rakefile:`ruby`,podfile:`ruby`,".env":`dotenv`,".bashrc":`shellscript`,".zshrc":`shellscript`,".profile":`shellscript`},Pe=e=>{let t=e.split(/[\\/]/).pop()?.toLowerCase()??``;if(!t)return Ae;let n=Ne[t];if(n)return n;let r=t.lastIndexOf(`.`);return r<=0?Ae:Me[t.slice(r+1)]??Ae},Fe=e=>{let t=e?.trim()??``;if(!t)return{lang:Ae,label:Ae,reference:!1};let n=je.exec(t);if(!n){let e=t.toLowerCase();return{lang:e,label:e,reference:!1}}let[,r=``,i=``,a=``]=n,o=r===i?r:`${r}-${i}`;return{lang:Pe(a),label:`${a}:${o}`,reference:!0}},Ie=e=>e===` `||e===` `||e===`
|
|
@@ -7,4 +7,4 @@ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./r
|
|
|
7
7
|
`)?r.split(`
|
|
8
8
|
`).length-1:r.split(`
|
|
9
9
|
`).length);for(let e=1;e<=i;e+=1){let n=document.createElement(`div`);n.className=`tabular-nums`,n.textContent=String(e),t.appendChild(n)}return t},wn=e=>{let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t},Tn=(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},En=(e,t)=>{let n=1/0,r=-1/0;for(let t=0;t<e.length;t+=1){let i=e[t];!i||i.width===0&&i.height===0||(i.top<n&&(n=i.top),i.bottom>r&&(r=i.bottom))}return!Number.isFinite(n)||r<=n?t:Math.max(t,r-n)},Dn=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`line`)),On=(e,t,n)=>{e.style.height=`${t}px`,e.style.lineHeight=`${n}px`},kn=(e,t,n)=>{let r=document.createRange();r.setStart(e.node,e.offset),r.setEnd(t.node,t.offset);let i=Math.max(En(r.getClientRects(),n),En([r.getBoundingClientRect()],n));return r.detach(),i},An=e=>{let t=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(t)){let t=e.querySelector(`pre code`),n=e.querySelector(`[data-md-code-line-numbers]`);if(!t||!n)continue;let r=Array.from(n.children),i=window.getComputedStyle(t),a=Number.parseFloat(i.lineHeight)||20;n.style.fontFamily=i.fontFamily,n.style.fontSize=i.fontSize,n.style.lineHeight=`${a}px`;let o=Dn(t);if(o.length===r.length){let e=o.map(e=>e.getBoundingClientRect()),t=e=>(e?.textContent??``).length===0;for(let n=0;n<r.length;n+=1){let i=r[n],s=o[n],c=e[n];if(!i||!s||!c)continue;if(t(s)){On(i,a,a);continue}let l=o[n+1],u=e[n+1],d=u&&!t(l)?u.top:c.bottom;On(i,En([{top:c.top,bottom:d,width:1,height:d-c.top}],a),a)}continue}let s=t.textContent??``,c=wn(t),l=0;for(let e=0;e<r.length;e+=1){let t=s.indexOf(`
|
|
10
|
-
`,l),n=t===-1?s.length:t,i=r[e];if(!i)continue;let o=Tn(c,l),u=Tn(c,n);!o||!u||l===n?On(i,a,a):On(i,kn(o,u,a),a),l=n+1}}},jn=e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>An(e))})},Mn=(e,t,n)=>{let r=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(r)){let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`);r&&i&&!r.querySelector(`[data-md-code-line-numbers]`)&&(r.classList.add(`flex`,`gap-3`),r.insertBefore(Cn(i),i)),Sn(e,t,n)}jn(e)},Nn=(e,t,n,r)=>{bn(e,vn.check),e.setAttribute(`title`,t),e.setAttribute(`aria-label`,t),window.setTimeout(()=>{bn(e,vn[n]),e.setAttribute(`title`,r),e.setAttribute(`aria-label`,r)},2e3)},Pn=e=>{let t=e.querySelectorAll(`:not(pre) > code`);for(let e of Array.from(t))e.getAttribute(`data-markdown`)!==`inline-code`&&e.setAttribute(`data-markdown`,`inline-code`)},Fn=(e,t)=>{let n=e.querySelectorAll(`pre`);for(let e of Array.from(n)){if(e.querySelector(`code.language-mermaid`))continue;let n=e.parentElement;if(!n||n.closest(`[data-component="markdown-code"]`))continue;let r=e.querySelector(`code`)?.className.match(/language-([^\s"]+)/)?.[1],i=e.getAttribute(`data-md-label`)??e.getAttribute(`data-md-lang`)??Fe(r).label,a=document.createElement(`div`);a.setAttribute(`data-component`,`markdown-code`),a.className=`my-4 group overflow-clip rounded-2xl border border-border/80 bg-[var(--surface-elevated)]`;let o=document.createElement(`div`);o.className=`flex items-center justify-between border-b border-border/70 px-3 py-1.5`;let s=document.createElement(`span`);s.className=`font-mono text-[13px] text-muted-foreground`,s.textContent=i;let c=xn(`copy`,t.labels.copy,`copy-code`),l=xn(`textWrap`,t.codeBlockLineWrap?t.labels.disableCodeWrap:t.labels.enableCodeWrap,`toggle-code-wrap`);o.appendChild(s);let u=document.createElement(`div`);u.className=`flex items-center gap-1`,u.appendChild(l),u.appendChild(c),o.appendChild(u);let d=document.createElement(`div`);d.setAttribute(`data-md-code-body`,``),d.className=`px-3 py-2.5 overflow-x-auto`,n.replaceChild(a,e),e.style.margin=`0`,e.style.background=`transparent`,e.classList.add(`min-w-0`,`w-full`,`flex-1`),d.appendChild(e),a.appendChild(o),a.appendChild(d),Sn(a,t.codeBlockLineWrap,t.labels)}},In=e=>{let t=e.querySelectorAll(`table`);for(let e of Array.from(t)){if(e.closest(`[data-markdown="table-wrapper"]`))continue;let t=document.createElement(`div`);t.className=`my-4`,t.setAttribute(`data-markdown`,`table-wrapper`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`table-scroll`);let r=e.parentElement;if(r){r.replaceChild(t,e),e.setAttribute(`data-markdown`,`table`);for(let t of Array.from(e.querySelectorAll(`tr`)))t.setAttribute(`data-markdown`,`table-row`);for(let t of Array.from(e.querySelectorAll(`th`)))t.setAttribute(`data-markdown`,`table-header-cell`);for(let t of Array.from(e.querySelectorAll(`td`)))t.setAttribute(`data-markdown`,`table-cell`);n.appendChild(e),t.appendChild(n)}}},Ln=0,Rn=(e,t)=>{let n=e.querySelectorAll(`pre > code.language-mermaid`);for(let e of Array.from(n)){let n=e.parentElement;if(!n)continue;let r=(e.textContent??``).replace(/\s+$/,``),i=t.renderMermaid(r),a=document.createElement(`div`);a.setAttribute(`data-markdown`,`mermaid-block`),a.setAttribute(`data-md-source`,r),a.className=`group relative`;let o=document.createElement(`div`);o.setAttribute(`data-markdown`,`mermaid-scroll`);let s=document.createElement(`div`);if(s.setAttribute(`data-markdown`,`mermaid-toolbar`),s.className=`absolute top-1 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,i.svg){a.setAttribute(`data-mermaid-render`,`svg`);let e=document.createElement(`div`);e.setAttribute(`data-markdown`,`mermaid-viewport`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`mermaid`),n.setAttribute(`data-md-original-svg`,i.svg),n.innerHTML=i.svg;let c=n.querySelector(`svg`),l=++Ln;for(let[e,t]of[[`title[id]`,`aria-labelledby`],[`desc[id]`,`aria-describedby`]]){let n=c?.querySelector(e);n&&(n.id=`yuri-mermaid-${l}-${n.localName}`,c?.setAttribute(t,n.id))}if(e.appendChild(n),o.appendChild(e),t.mermaidControls.showPanZoomControls&&(s.appendChild(xn(`zoomIn`,t.labels.zoomInDiagram,`mermaid-zoom-in`)),s.appendChild(xn(`zoomOut`,t.labels.zoomOutDiagram,`mermaid-zoom-out`)),s.appendChild(xn(`fit`,t.labels.resetDiagramView,`mermaid-fit`))),t.mermaidControls.copy){let e=xn(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}if(t.mermaidControls.download){let e=xn(`download`,t.labels.downloadDiagram,`mermaid-download`);e.setAttribute(`data-md-svg`,`1`),s.appendChild(e)}}else{a.setAttribute(`data-mermaid-render`,`source`);let e=document.createElement(`pre`);if(e.setAttribute(`data-markdown`,`mermaid-source`),e.textContent=r,o.appendChild(e),t.mermaidControls.copy){let e=xn(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}}a.appendChild(o),a.appendChild(s);let c=n.parentElement;c&&c.replaceChild(a,n)}},zn=(e,t)=>{let n=e.querySelectorAll(`a[href]`);for(let e of Array.from(n)){if(e.getAttribute(`data-md-link-decorated`)===`true`||e.getAttribute(`data-yuri-file-link`)===`true`)continue;let n=e.getAttribute(`href`)??``;if(!h(n))continue;e.setAttribute(`data-md-link-decorated`,`true`);let r=_(n);if(r){let t=document.createElement(`span`);t.className=`mr-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle`;let n=document.createElement(`img`);n.setAttribute(`data-md-link-favicon`,`true`),n.src=r,n.alt=``,n.setAttribute(`aria-hidden`,`true`),n.loading=`lazy`,n.decoding=`async`,n.className=`size-3.5 rounded-sm`,n.addEventListener(`error`,()=>t.remove(),{once:!0}),t.appendChild(n),e.parentNode?.insertBefore(t,e)}if(t.onPreviewLoopback&&m(n)){let r=document.createElement(`button`);r.type=`button`,r.className=`ml-1 align-middle ${yn}`,r.setAttribute(`data-md-action`,`preview-loopback`),r.setAttribute(`data-md-url`,n),r.setAttribute(`title`,t.labels.previewTitle),r.setAttribute(`aria-label`,t.labels.previewLabel),bn(r,vn.download),e.parentNode?.insertBefore(r,e.nextSibling)}}},Bn=`img:not([data-md-link-favicon="true"])`,Vn=`[data-md-image-presentation="true"]`,Hn=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="576" height="324" viewBox="0 0 576 324"%3E%3C/svg%3E`,Un=[`block`,`max-w-full`,`rounded-xl`,`border`,`border-border/80`,`bg-[var(--surface-muted)]`,`transition-colors`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-offset-2`,`focus-visible:outline-[var(--interactive-focus-ring)]`],Wn=[`cursor-pointer`,`hover:bg-interactive-hover/60`],Gn=[`object-contain`],Kn=e=>{let t=e.parentElement;if(t?.matches(Vn))return t;let n=document.createElement(`span`);n.setAttribute(`data-md-image-presentation`,`true`),n.className=`relative my-4 block w-fit max-w-full`;let r=document.createElement(`span`);r.setAttribute(`data-md-image-placeholder-visual`,`true`),r.setAttribute(`aria-hidden`,`true`),r.className=`pointer-events-none absolute inset-0 flex items-center justify-center text-muted-foreground`,r.classList.add(`yuri-image-loading`),x()&&n.setAttribute(`data-mobile-image`,`true`);let i=document.createElement(`span`);i.className=`relative flex size-14 items-center justify-center rounded-2xl border border-border/80 bg-[var(--surface-elevated)] shadow-sm`,bn(i,vn.image);let a=document.createElement(`span`);a.setAttribute(`data-md-image-download-badge`,`true`),a.className=`absolute -right-1.5 -bottom-1.5 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,bn(a,vn.imageDownload);let o=document.createElement(`span`);return o.setAttribute(`data-md-image-loading-badge`,`true`),o.className=`absolute -right-1.5 -bottom-1.5 hidden size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,bn(o,vn.imageLoading),i.appendChild(a),i.appendChild(o),r.appendChild(i),t?.replaceChild(n,e),n.appendChild(e),n.appendChild(r),n},qn=e=>{e.src=Hn,e.setAttribute(`data-md-placeholder-source`,Hn),e.setAttribute(`data-md-image-state`,`placeholder`),e.classList.add(...Gn)},Jn=e=>{e.removeAttribute(`data-md-image-state`),e.removeAttribute(`data-md-placeholder-source`),e.removeAttribute(`aria-busy`),e.classList.remove(...Gn)},Yn=(e,t)=>{if(!t.imagePreviewEnabled)return;let n=e.querySelectorAll(Bn);for(let e of Array.from(n)){let n=e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,r=E(n,t.imageEffectiveDirectory);if(!D(r)){e.setAttribute(`data-md-image-source`,n),Kn(e),e.setAttribute(`data-md-image-state`,e.complete&&e.naturalWidth>0?`loaded`:`loading`);continue}e.classList.add(...Un,...Wn),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-md-image-source`,n),Kn(e),qn(e)}},Xn=(e,t)=>{Pn(e),Rn(e,t),Fn(e,t),In(e),zn(e,t),Yn(e,t),H(e)},Zn=(e,t,n)=>{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},Qn=(e,t)=>{let n=e=>{let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`[data-md-action]`);if(!r)return;let i=r.getAttribute(`data-md-action`)??``;if(i===`copy-code`){let e=r.closest(`[data-component="markdown-code"]`)?.querySelector(`code`)?.textContent??``;e&&S(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copy));return}if(i===`toggle-code-wrap`){e.preventDefault(),t.onToggleCodeBlockLineWrap?.();return}if(i===`mermaid-copy`){let e=r.getAttribute(`data-md-source`)??``;e&&S(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copyDiagram));return}if(i===`mermaid-zoom-in`||i===`mermaid-zoom-out`||i===`mermaid-fit`){e.preventDefault();let t=ln(r.closest(`[data-markdown="mermaid-block"]`));i===`mermaid-zoom-in`?t?.zoomIn():i===`mermaid-zoom-out`?t?.zoomOut():t?.fit();return}if(i===`mermaid-download`){let e=r.closest(`[data-markdown="mermaid-block"]`)?.querySelector(`[data-markdown="mermaid"]`),t=e?.getAttribute(`data-md-original-svg`)??e?.innerHTML??``;t&&Zn(`diagram.svg`,t,`image/svg+xml;charset=utf-8`);return}if(i===`preview-loopback`){e.preventDefault();let n=r.getAttribute(`data-md-url`)??``;n&&t.onPreviewLoopback?.(n);return}};return e.addEventListener(`click`,n),()=>e.removeEventListener(`click`,n)},$n=e({MarkdownRenderer:()=>Cr,SimpleMarkdownRenderer:()=>wr}),Q=a(),er=()=>{let e=(0,he.c)(4),t=w(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=T(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=T(!0),e[1]=i):i=e[1];let a=i,o;return e[2]===t?.currentTheme?o=e[3]:(o=t?.currentTheme??(typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?a:r),e[2]=t?.currentTheme,e[3]=o),o},tr=e=>{let t=(0,he.c)(5),{containerRef:n,enabled:r,effectiveDirectory:i,openInAppBrowser:a,fileReference:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=e=>{if(r===!1||e.defaultPrevented||e.button!==0||e.altKey||e.shiftKey)return;let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||n.getAttribute(`data-yuri-file-link`)===`true`)return;let s=n.getAttribute(`href`)??``;if(ue(s)){e.preventDefault(),e.stopPropagation(),o&&z(s,o.effectiveDirectory,`href`)&&de(n,o);return}if(!h(s)||e.metaKey||e.ctrlKey)return;e.preventDefault(),e.stopPropagation();let c=(i||``).trim();if(!x()&&c&&a){a(c,s);return}g(s)},t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=f(s);u(`click`,c,n)},$=`img:not([data-md-link-favicon="true"])`,nr=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,rr=({containerRef:e,effectiveDirectory:t,onShowPopup:r})=>{let i=K.useRef(null),a=c(),o=a?.entry.location.hostId?a.entry:void 0;i.current??=n();let s=i.current,l=!!r,u=f(e=>r?.(e)),d=K.useRef(()=>{}),p=K.useRef(new Map),m=K.useRef(null),h=K.useMemo(()=>e=>d.current(e),[]);return K.useLayoutEffect(()=>{let n=p.current;if(m.current!==null&&(clearTimeout(m.current),m.current=null),d.current=()=>{},!l){for(let[e,t]of n)t.controller?.abort(),t.release?.(),n.delete(e);return}let r=e.current;if(!r)return;let i=e=>{let n=Array.from(r.querySelectorAll($));if(n.indexOf(e)<0)return;let i=n.map(e=>({url:nr(e),filename:e.alt||nr(e)||void 0})).filter(e=>e.url),a=nr(e),o=i.findIndex(e=>e.url===a),s=e.alt||a;u({open:!0,title:s,content:``,metadata:{tool:`image-preview`,filename:s},previewSource:e,image:{url:a,filename:s,gallery:i,index:Math.max(0,o),directory:t}})},a=e=>{let t=n.get(e);t&&(t.controller?.abort(),t.release?.(),n.delete(e))},c=e=>{let n=nr(e),r=E(n,t);if(D(r))return`${s}\n${t}\n${n}`},f=e=>{let t=c(e);if(!t){a(e);return}let r=n.get(e);if(r?.key===t)return r;a(e);let i={key:t};return n.set(e,i),i},h=(e,i)=>{if(i.controller||i.objectUrl||!r.contains(e))return;let s=nr(e),c=E(s,t);if(!D(c)){a(e);return}let l=new AbortController;i.controller=l,e.setAttribute(`data-md-image-state`,`loading`),e.setAttribute(`aria-busy`,`true`),O(c.path,l.signal,o).then(t=>{let r=n.get(e);if(!r||r!==i||r.controller!==l||l.signal.aborted){t.release();return}r.controller=void 0,r.objectUrl=t.url,r.release=t.release,e.src=t.url}).catch(()=>{let t=n.get(e);t===i&&(t.controller=void 0,e.removeAttribute(`aria-busy`),e.setAttribute(`data-md-image-state`,`error`))})};d.current=e=>{for(let[t,r]of n)(!e.contains(t)||c(t)!==r.key)&&a(t);for(let t of Array.from(e.querySelectorAll($))){let e=f(t);e&&!e.objectUrl&&h(t,e)}},d.current(r);let g=e=>{let t=f(e);if(t&&!t.objectUrl){h(e,t);return}i(e)},_=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&(e.preventDefault(),e.stopPropagation(),g(n))},v=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(e.preventDefault(),e.stopPropagation(),g(t))},y=e=>{let t=e.target;t instanceof Element&&t.closest($)&&(e.preventDefault(),e.stopPropagation())},b=e=>{let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||t.getAttribute(`src`)!==t.getAttribute(`data-md-placeholder-source`)&&(Jn(t),t.setAttribute(`data-md-image-state`,`loaded`))},x=e=>{let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(t.removeAttribute(`aria-busy`),t.setAttribute(`data-md-image-state`,`error`))};return r.addEventListener(`load`,b,!0),r.addEventListener(`error`,x,!0),r.addEventListener(`click`,_),r.addEventListener(`keydown`,v),r.addEventListener(`contextmenu`,y),()=>{d.current=()=>{},r.removeEventListener(`load`,b,!0),r.removeEventListener(`error`,x,!0),r.removeEventListener(`click`,_),r.removeEventListener(`keydown`,v),r.removeEventListener(`contextmenu`,y),m.current=setTimeout(()=>{m.current=null;for(let e of Array.from(n.keys()))r.contains(e)&&qn(e),a(e)},0)}},[e,t,l,s,o]),{reconcileMarkdownImageResources:h,transportIdentity:s}},ir={download:!0,copy:!0,showPanZoomControls:!0},ar=!0,or=e=>{let t=e.match(/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n[\s\S]*?\r?\n\1[^\S\r\n]*(?:\r?\n|$)/);return t?e.slice(t[0].length):e},sr=160,cr=e=>{let t=(0,he.c)(9),{containerRef:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,enabled:s}=e,l=c(),u=l?.entry.location.hostId?l.entry:void 0,d=K.useRef(null),f,p;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==u?(f=()=>{let e=n.current;if(!e)return;let t=!1,c=x(),l=U(),f=s,p=Tr,m=()=>{let t=e.querySelectorAll(V);for(let e of Array.from(t))p(e)};if(!f){m();return}let h=e=>{let n=e===void 0?0:e;if(d.current!==null&&typeof window<`u`&&window.clearTimeout(d.current),typeof window>`u`){g();return}d.current=window.setTimeout(()=>{d.current=null,window.requestAnimationFrame(()=>{t||g()})},n)},g=()=>{let n=e.querySelectorAll(`[data-markdown="inline-code"], a, ${me}`),i=0;for(let a of Array.from(n)){let n=G(a),o=z(n,r,a.tagName.toLowerCase()===`a`?`href`:`path`);if(!o){p(a);continue}if(i>=l){p(a);continue}i+=1,(a.getAttribute(`data-yuri-file-link`)!==`true`||a.getAttribute(`data-yuri-file-path`)!==o.resolvedPath)&&B(o.resolvedPath,r,u).then(n=>{if(t||!e.contains(a))return;let i=G(a),s=z(i,r,a.tagName.toLowerCase()===`a`?`href`:`path`);if(!(!s||s.resolvedPath!==o.resolvedPath)){if(!W(s.resolvedPath,n,c)){p(a);return}a.setAttribute(`data-yuri-file-link`,`true`),a.setAttribute(`data-yuri-file-ref`,i),a.setAttribute(`data-yuri-file-path`,s.resolvedPath),a.setAttribute(`data-yuri-file-binary`,String(n.isBinary)),a.setAttribute(`title`,pe),a.tagName.toLowerCase()!==`a`&&(a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`))}}).catch(Er)}},_=e=>de(e,{scope:u,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o}),v=e=>{let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(V);n instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),_(n))},y=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||t.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),_(t))};h(sr);let b=new MutationObserver(()=>{h(sr)});return b.observe(e,{childList:!0,subtree:!0}),e.addEventListener(`click`,v),e.addEventListener(`keydown`,y),()=>{t=!0,d.current!==null&&typeof window<`u`&&window.clearTimeout(d.current),d.current=null,b.disconnect(),e.removeEventListener(`click`,v),e.removeEventListener(`keydown`,y)}},p=[n,i,r,o,a,s,u],t[0]=n,t[1]=i,t[2]=r,t[3]=s,t[4]=o,t[5]=a,t[6]=u,t[7]=f,t[8]=p):(f=t[7],p=t[8]),K.useEffect(f,p)},lr=({containerRef:e,onShowPopup:t,enableFullscreen:n,enablePanZoom:r,allowMermaidWheelEvents:i})=>{let a=f(e=>t?.(e)),o=!!t,s=f(t=>{if(!n||!o)return;let r=e.current;if(!r)return;let i=t.target;if(!(i instanceof Element)||i.closest(`button, a, [role="button"]`))return;let s=i.closest(Jt);if(!s)return;if(s instanceof HTMLElement&&s.hasAttribute(`data-mermaid-suppress-click`)){s.removeAttribute(`data-mermaid-suppress-click`);return}let c=Array.from(r.querySelectorAll(Jt)).indexOf(s);if(c<0)return;let l=s instanceof HTMLElement?s.getAttribute(`data-md-source`):null;if(!l||l.trim().length===0)return;let u=`Diagram ${c+1}`;a({open:!0,title:u,content:``,metadata:{tool:`mermaid-preview`,filename:u},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(l)}`,source:l,filename:u},previewSource:s instanceof HTMLElement?s:void 0})}),c=f(e=>{if(i||r)return;let t=e.target;t instanceof Element&&t.closest(`[data-markdown="mermaid-block"]`)&&e.stopPropagation()});u(`click`,s,e),K.useEffect(()=>{let t=e.current;if(t)return t.addEventListener(`wheel`,c,{capture:!0,passive:!0}),()=>{t.removeEventListener(`wheel`,c,!0)}},[e])},ur=24,dr=1,fr=12,pr=/[\s.,!?;:)\]]/,mr=(e,t)=>{let n=e<=12?2:e<=48?4:e<=96?8:Math.min(24,Math.ceil(e/8));return Math.max(1,Math.round(t/ur*n))},hr=(e,t)=>mr(e,t)*(1e3/t),gr=(e,t,n)=>{let r=Math.min(e.length,t+n);for(let t=r;t<Math.min(e.length,r+8);t+=1)if(pr.test(e[t]??``))return t+1;return r},_r=(e,t,n)=>{let[r,i]=K.useState(()=>t?0:e.length),a=K.useRef(r),o=K.useRef(0),s=K.useRef(null);return a.current=r,K.useEffect(()=>{if(!t||typeof window>`u`){o.current=0,s.current=null,i(e.length);return}a.current>e.length&&(a.current=e.length,o.current=0,i(e.length));let r=null,c=t=>{let l=Math.min(a.current,e.length);if(l>=e.length){r=null,s.current=null;return}let u=s.current;if(u===null){s.current=t,r=window.requestAnimationFrame(c);return}let d=Math.min(t-u,100);s.current=t,o.current+=hr(e.length-l,n)*(d/1e3);let f=Math.min(fr,Math.floor(o.current));if(f>=dr){o.current-=f;let t=gr(e,l,f);a.current=t,i(t)}r=window.requestAnimationFrame(c)};return a.current<e.length&&(r=window.requestAnimationFrame(c)),()=>{r!==null&&window.cancelAnimationFrame(r)}},[e,t,n]),t?e.slice(0,Math.min(r,e.length)):e},vr=(e,t,r,i=ir,a=n(),o=``,s=!1)=>{let{t:c}=y(),l=K.useMemo(()=>({copy:c(`markdownRenderer.code.actions.copyTitle`),copied:c(`markdownRenderer.code.actions.copiedTitle`),enableCodeWrap:c(`markdownRenderer.code.actions.enableWrapTitle`),disableCodeWrap:c(`markdownRenderer.code.actions.disableWrapTitle`),copyDiagram:c(`markdownRenderer.mermaid.actions.copySourceTitle`),downloadDiagram:c(`markdownRenderer.mermaid.actions.downloadSvgTitle`),zoomInDiagram:c(`markdownRenderer.mermaid.actions.zoomInTitle`),zoomOutDiagram:c(`markdownRenderer.mermaid.actions.zoomOutTitle`),resetDiagramView:c(`markdownRenderer.mermaid.actions.resetViewTitle`),previewLabel:c(`terminalView.preview.open`),previewTitle:c(`terminalView.preview.openTitle`)}),[c]),u=p(e=>e.codeBlockLineWrap),d=p(e=>e.setCodeBlockLineWrap),m=f(()=>{d(!p.getState().codeBlockLineWrap)});return K.useMemo(()=>({labels:l,mermaidControls:i,codeBlockLineWrap:u,deferCodeLineNumberSync:t,onToggleCodeBlockLineWrap:m,renderMermaid:t=>_e(t,e),onPreviewLoopback:r,imageTransportIdentity:a,imageEffectiveDirectory:o,imagePreviewEnabled:s}),[e,l,i,u,t,r,a,o,s])},yr=({containerRef:e,text:t,streaming:n,cacheKey:r,syntaxVars:i,ctx:a,reconcileMarkdownImageResources:o,onRichContentReady:s})=>{K.useEffect(()=>{P()},[]);let c=K.useRef(null),l=f(()=>{s?.()}),u=f(()=>{let t=e.current;if(t){if(!c.current){if(!Yt(t))return;c.current=_n(t);return}c.current.refresh()}});K.useLayoutEffect(()=>{let r=e.current,i=r?.querySelector(`[data-markdown-content]`)??r;if(i&&t&&i.childNodes.length===0){for(let e of At(t)){let t=document.createElement(`div`);t.setAttribute(`data-md-block`,``),t.style.display=`contents`,t.innerHTML=e,Xn(t,a),i.appendChild(t)}o(i),n||l()}},[e,a,o,n,t]),K.useEffect(()=>()=>{c.current?.cleanup(),c.current=null},[]),K.useEffect(()=>{let i=e.current;if(!i)return;let s=i.querySelector(`[data-markdown-content]`)??i,c=!0,d=new AbortController,f=()=>{},p=()=>{},m=()=>{if(!c||n||d.signal.aborted)return;s.replaceChildren();let e=document.createElement(`div`);e.setAttribute(`data-md-block`,``),e.setAttribute(`data-md-render-fallback`,`text`),e.style.display=`contents`;let r=document.createElement(`span`);r.style.whiteSpace=`pre-wrap`,r.textContent=t,e.appendChild(r),s.appendChild(e),o(s),l()},h=e=>{if(!c)return;let t=Array.from(s.children);e.forEach((e,n)=>{let r=t[n];if(r||(r=document.createElement(`div`),r.setAttribute(`data-md-block`,``),r.style.display=`contents`,s.appendChild(r)),r.getAttribute(`data-md-id`)===e.id)return;let i=document.createElement(`div`);i.innerHTML=e.html,Xn(i,a);let o=Yt(r),c=Yt(i);I(r,i,{childrenOnly:!0,onBeforeElUpdated:(e,t)=>{if(Te(e,t))return!1;if(fe(e,t),e instanceof HTMLImageElement&&t instanceof HTMLImageElement){let n=e.getAttribute(`data-md-image-source`);if(n&&n===t.getAttribute(`data-md-image-source`)){let n=e.getAttribute(`src`);n===null?t.removeAttribute(`src`):t.setAttribute(`src`,n),t.className=e.className;for(let n of[`data-md-image-state`,`data-md-placeholder-source`,`aria-busy`]){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}}}return!e.isEqualNode(t)}}),r.setAttribute(`data-md-id`,e.id),(o||c||Yt(r))&&u()});let n=Yt(s),r=!1;for(let n=t.length-1;n>=e.length;--n){let e=t[n];e&&Yt(e)&&(r=!0),e?.remove()}(r||t.length>e.length&&n)&&u(),o(s),a.deferCodeLineNumberSync||Mn(s,a.codeBlockLineWrap,a.labels),ke(s,ce,{signal:d.signal,priority:`visible`}),l()},g=e=>{try{h(e)}catch{m()}},_=()=>{Lt(t,n,r,d.signal).then(e=>{if(c){if(n){g(e);return}p=A(()=>g(e),{priority:`visible`})}}).catch(m)};return n?_():f=A(_,{priority:`visible`}),()=>{c=!1,d.abort(),f(),p()}},[e,t,n,r,a,o]),K.useEffect(()=>{let t=e.current;if(t)return Qn(t,a)},[e,a]),K.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;if(n)for(let[e,t]of Object.entries(i))n.style.setProperty(e,t)},[e,i]),K.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(a.deferCodeLineNumberSync||Mn(n,a.codeBlockLineWrap,a.labels))},[e,a.codeBlockLineWrap,a.deferCodeLineNumberSync,a.labels]);let p=K.useRef(null),m=f(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(p.current!==null&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,An(n)}))});d(e,m),K.useEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current)},[])},br=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,xr=e=>{let t=(0,he.c)(4),[n,r]=K.useState(e),i=K.useRef(e),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{i.current||(i.current=!0,r(!0))},t[0]=a):a=t[0];let o=f(a),s;return t[1]!==o||t[2]!==n?(s=[n,o],t[1]=o,t[2]=n,t[3]=s):s=t[3],s},Sr=(e,t,n)=>{let r=K.useRef(n);r.current=n;let i=K.useRef(t);i.current=t;let a=f(e=>{if(!r.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],a=n?n.blockSize:t.contentRect.height,o=n?n.inlineSize:t.contentRect.width;N(i.current,a,o)});d(e,a)},Cr=K.memo(e=>{let t=(0,he.c)(65),{content:n,part:r,messageId:a,isAnimated:o,skipFadeIn:s,className:u,isStreaming:d,disableStreamAnimation:p,sourceIsPaced:m,variant:h,onShowPopup:g,enableFileReferences:_}=e,v=o===void 0||o,y=s!==void 0&&s,x=d!==void 0&&d,S=p!==void 0&&p,C=m!==void 0&&m,w=h===void 0?`assistant`:h,T=_===void 0||_,E=er(),{editor:D,runtime:O}=l(),k=c(),A=K.useRef(null),j=ee()??``,M=f(Dr),N;t[0]!==j||t[1]!==M?(N=e=>{j&&M(j,e)},t[0]=j,t[1]=M,t[2]=N):N=t[2];let ae=f(N),P=x&&!S,se;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(se=ne(i()),t[3]=se):se=t[3];let ce=_r(C?``:n,P&&!C,se.markdownPaceMs),F=C?n:ce,[I,L]=xr(P),R;t[4]===g?R=t[5]:(R={containerRef:A,onShowPopup:g,enableFullscreen:ar,enablePanZoom:ir.showPanZoomControls},t[4]=g,t[5]=R),lr(R);let le=T&&!x,z;t[6]!==D||t[7]!==j||t[8]!==g||t[9]!==O.isVSCode||t[10]!==le?(z={containerRef:A,effectiveDirectory:j,editor:D,preferRuntimeEditor:O.isVSCode,onShowPopup:g,enabled:le},t[6]=D,t[7]=j,t[8]=g,t[9]=O.isVSCode,t[10]=le,t[11]=z):z=t[11],cr(z);let B;t[12]!==D||t[13]!==j||t[14]!==T||t[15]!==k||t[16]!==x||t[17]!==g||t[18]!==O.isVSCode?(B=T&&!x?{effectiveDirectory:j,scope:k?.entry.location.hostId?k.entry:void 0,editor:D,preferRuntimeEditor:O.isVSCode,onShowPopup:g}:void 0,t[12]=D,t[13]=j,t[14]=T,t[15]=k,t[16]=x,t[17]=g,t[18]=O.isVSCode,t[19]=B):B=t[19];let V;t[20]!==j||t[21]!==M||t[22]!==B?(V={containerRef:A,effectiveDirectory:j,openInAppBrowser:M,fileReference:B},t[20]=j,t[21]=M,t[22]=B,t[23]=V):V=t[23],tr(V);let H;t[24]!==j||t[25]!==g?(H={containerRef:A,effectiveDirectory:j,onShowPopup:g},t[24]=j,t[25]=g,t[26]=H):H=t[26];let{reconcileMarkdownImageResources:ue,transportIdentity:U}=rr(H),W;t[27]===E?W=t[28]:(W=oe(E),t[27]=E,t[28]=W);let G=W,de=vr(E,P,j?ae:void 0,ir,U,j,!!g),fe=`markdown-${r?.id?`part-${r.id}`:`message-${a}`}`,pe;t[29]!==fe||t[30]!==de||t[31]!==F||t[32]!==P||t[33]!==ue||t[34]!==L||t[35]!==G?(pe={containerRef:A,text:F,streaming:P,cacheKey:fe,syntaxVars:G,ctx:de,reconcileMarkdownImageResources:ue,onRichContentReady:L},t[29]=fe,t[30]=de,t[31]=F,t[32]=P,t[33]=ue,t[34]=L,t[35]=G,t[36]=pe):pe=t[36],yr(pe);let me;t[37]!==n||t[38]!==x||t[39]!==I||t[40]!==w?(me=I&&!x?ie(n,w):``,t[37]=n,t[38]=x,t[39]=I,t[40]=w,t[41]=me):me=t[41],Sr(A,me,I&&!x);let ge=!I||void 0,_e;t[42]===u?_e=t[43]:(_e=b(`relative break-words w-full min-w-0`,u),t[42]=u,t[43]=_e);let ve=I?`true`:`false`,ye=I?`ready`:`pending`,q;t[44]!==F||t[45]!==I||t[46]!==w?(q=!I&&(0,Q.jsx)(`div`,{className:b(br(w),`pointer-events-none absolute inset-0 overflow-clip`),children:(0,Q.jsx)(re,{content:F})}),t[44]=F,t[45]=I,t[46]=w,t[47]=q):q=t[47];let be=!I||void 0,xe;t[48]!==I||t[49]!==w?(xe=b(br(w),!I&&`invisible`),t[48]=I,t[49]=w,t[50]=xe):xe=t[50];let J;t[51]!==be||t[52]!==xe?(J=(0,Q.jsx)(`div`,{"aria-hidden":be,className:xe,"data-markdown-content":!0}),t[51]=be,t[52]=xe,t[53]=J):J=t[53];let Se;t[54]!==ge||t[55]!==_e||t[56]!==ve||t[57]!==ye||t[58]!==q||t[59]!==J?(Se=(0,Q.jsxs)(`div`,{"aria-busy":ge,className:_e,"data-markdown-ready":ve,"data-markdown-hydration":ye,ref:A,children:[q,J]}),t[54]=ge,t[55]=_e,t[56]=ve,t[57]=ye,t[58]=q,t[59]=J,t[60]=Se):Se=t[60];let Ce=Se;if(v){let e;return t[61]!==fe||t[62]!==Ce||t[63]!==y?(e=(0,Q.jsx)(te,{skipAnimation:y,children:Ce},fe),t[61]=fe,t[62]=Ce,t[63]=y,t[64]=e):e=t[64],e}return Ce},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.sourceIsPaced===t.sourceIsPaced&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),wr=K.memo(e=>{let t=(0,he.c)(56),{content:n,className:r,variant:i,disableLinkSafety:a,stripFrontmatter:o,onShowPopup:s,mermaidControls:u,mermaidTheme:d,allowMermaidWheelEvents:p,enableFileReferences:m}=e,h=i===void 0?`assistant`:i,g=o!==void 0&&o,_=u===void 0?ir:u,v=p!==void 0&&p,y=m===void 0||m,{editor:x,runtime:S}=l(),C=c(),w=er(),T=K.useRef(null),[E,D]=xr(!1),O=ee()??``,k;t[0]!==n||t[1]!==g?(k=g?or(n):n,t[0]=n,t[1]=g,t[2]=k):k=t[2];let A=k,j;t[3]!==v||t[4]!==_.showPanZoomControls||t[5]!==s?(j={containerRef:T,onShowPopup:s,enableFullscreen:ar,enablePanZoom:_.showPanZoomControls,allowMermaidWheelEvents:v},t[3]=v,t[4]=_.showPanZoomControls,t[5]=s,t[6]=j):j=t[6],lr(j);let te=f(Or),M;t[7]!==x||t[8]!==O||t[9]!==y||t[10]!==s||t[11]!==S.isVSCode?(M={containerRef:T,effectiveDirectory:O,editor:x,preferRuntimeEditor:S.isVSCode,onShowPopup:s,enabled:y},t[7]=x,t[8]=O,t[9]=y,t[10]=s,t[11]=S.isVSCode,t[12]=M):M=t[12],cr(M);let ne=!a,N;t[13]!==x||t[14]!==O||t[15]!==y||t[16]!==C||t[17]!==s||t[18]!==S.isVSCode?(N=y?{effectiveDirectory:O,scope:C?.entry.location.hostId?C.entry:void 0,editor:x,preferRuntimeEditor:S.isVSCode,onShowPopup:s}:void 0,t[13]=x,t[14]=O,t[15]=y,t[16]=C,t[17]=s,t[18]=S.isVSCode,t[19]=N):N=t[19];let ie;t[20]!==O||t[21]!==te||t[22]!==N||t[23]!==ne?(ie={containerRef:T,enabled:ne,effectiveDirectory:O,openInAppBrowser:te,fileReference:N},t[20]=O,t[21]=te,t[22]=N,t[23]=ne,t[24]=ie):ie=t[24],tr(ie);let ae;t[25]!==O||t[26]!==s?(ae={containerRef:T,effectiveDirectory:O,onShowPopup:s},t[25]=O,t[26]=s,t[27]=ae):ae=t[27];let{reconcileMarkdownImageResources:P,transportIdentity:se}=rr(ae),ce;t[28]===w?ce=t[29]:(ce=oe(w),t[28]=w,t[29]=ce);let F=ce,I=vr(d??w,!1,void 0,_,se,O,!!s),L=`simple:${h}`,R;t[30]!==I||t[31]!==P||t[32]!==A||t[33]!==D||t[34]!==F||t[35]!==L?(R={containerRef:T,text:A,streaming:!1,cacheKey:L,syntaxVars:F,ctx:I,reconcileMarkdownImageResources:P,onRichContentReady:D},t[30]=I,t[31]=P,t[32]=A,t[33]=D,t[34]=F,t[35]=L,t[36]=R):R=t[36],yr(R);let le=!E||void 0,z;t[37]===r?z=t[38]:(z=b(`relative break-words w-full min-w-0`,r),t[37]=r,t[38]=z);let B=E?`true`:`false`,V=E?`ready`:`pending`,H;t[39]!==A||t[40]!==E||t[41]!==h?(H=!E&&(0,Q.jsx)(`div`,{className:b(br(h),`pointer-events-none absolute inset-0 overflow-clip`),children:(0,Q.jsx)(re,{content:A})}),t[39]=A,t[40]=E,t[41]=h,t[42]=H):H=t[42];let ue=!E||void 0,U;t[43]!==E||t[44]!==h?(U=b(br(h),!E&&`invisible`),t[43]=E,t[44]=h,t[45]=U):U=t[45];let W;t[46]!==ue||t[47]!==U?(W=(0,Q.jsx)(`div`,{"aria-hidden":ue,className:U,"data-markdown-content":!0}),t[46]=ue,t[47]=U,t[48]=W):W=t[48];let G;return t[49]!==le||t[50]!==z||t[51]!==B||t[52]!==V||t[53]!==H||t[54]!==W?(G=(0,Q.jsxs)(`div`,{"aria-busy":le,className:z,"data-markdown-ready":B,"data-markdown-hydration":V,ref:T,children:[H,W]}),t[49]=le,t[50]=z,t[51]=B,t[52]=V,t[53]=H,t[54]=W,t[55]=G):G=t[55],G},(e,t)=>{let n=e.mermaidControls??ir,r=t.mermaidControls??ir;return e.content===t.content&&e.variant===t.variant&&e.className===t.className&&e.disableLinkSafety===t.disableLinkSafety&&e.stripFrontmatter===t.stripFrontmatter&&e.onShowPopup===t.onShowPopup&&n.download===r.download&&n.copy===r.copy&&n.showPanZoomControls===r.showPanZoomControls&&e.mermaidTheme===t.mermaidTheme&&e.allowMermaidWheelEvents===t.allowMermaidWheelEvents&&e.enableFileReferences===t.enableFileReferences});function Tr(e){e.removeAttribute(`data-yuri-file-link`),e.removeAttribute(`data-yuri-file-ref`),e.removeAttribute(`data-yuri-file-path`),e.removeAttribute(`data-yuri-file-binary`),e.getAttribute(`title`)===`Open file`&&e.removeAttribute(`title`),e.tagName.toLowerCase()!==`a`&&(e.removeAttribute(`role`),e.removeAttribute(`tabindex`))}function Er(){}function Dr(e,t){p.getState().openContextBrowser(e,t)}function Or(e,t){p.getState().openContextBrowser(e,t)}export{$n as n,Ve as r,Cr as t};
|
|
10
|
+
`,l),n=t===-1?s.length:t,i=r[e];if(!i)continue;let o=Tn(c,l),u=Tn(c,n);!o||!u||l===n?On(i,a,a):On(i,kn(o,u,a),a),l=n+1}}},jn=e=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>An(e))})},Mn=(e,t,n)=>{let r=e.querySelectorAll(`[data-component="markdown-code"]`);for(let e of Array.from(r)){let r=e.querySelector(`[data-md-code-body]`),i=e.querySelector(`pre`);r&&i&&!r.querySelector(`[data-md-code-line-numbers]`)&&(r.classList.add(`flex`,`gap-3`),r.insertBefore(Cn(i),i)),Sn(e,t,n)}jn(e)},Nn=(e,t,n,r)=>{bn(e,vn.check),e.setAttribute(`title`,t),e.setAttribute(`aria-label`,t),window.setTimeout(()=>{bn(e,vn[n]),e.setAttribute(`title`,r),e.setAttribute(`aria-label`,r)},2e3)},Pn=e=>{let t=e.querySelectorAll(`:not(pre) > code`);for(let e of Array.from(t))e.getAttribute(`data-markdown`)!==`inline-code`&&e.setAttribute(`data-markdown`,`inline-code`)},Fn=(e,t)=>{let n=e.querySelectorAll(`pre`);for(let e of Array.from(n)){if(e.querySelector(`code.language-mermaid`))continue;let n=e.parentElement;if(!n||n.closest(`[data-component="markdown-code"]`))continue;let r=e.querySelector(`code`)?.className.match(/language-([^\s"]+)/)?.[1],i=e.getAttribute(`data-md-label`)??e.getAttribute(`data-md-lang`)??Fe(r).label,a=document.createElement(`div`);a.setAttribute(`data-component`,`markdown-code`),a.className=`my-4 group overflow-clip rounded-2xl border border-border/80 bg-[var(--surface-elevated)]`;let o=document.createElement(`div`);o.className=`flex items-center justify-between border-b border-border/70 px-3 py-1.5`;let s=document.createElement(`span`);s.className=`font-mono text-[13px] text-muted-foreground`,s.textContent=i;let c=xn(`copy`,t.labels.copy,`copy-code`),l=xn(`textWrap`,t.codeBlockLineWrap?t.labels.disableCodeWrap:t.labels.enableCodeWrap,`toggle-code-wrap`);o.appendChild(s);let u=document.createElement(`div`);u.className=`flex items-center gap-1`,u.appendChild(l),u.appendChild(c),o.appendChild(u);let d=document.createElement(`div`);d.setAttribute(`data-md-code-body`,``),d.className=`px-3 py-2.5 overflow-x-auto`,n.replaceChild(a,e),e.style.margin=`0`,e.style.background=`transparent`,e.classList.add(`min-w-0`,`w-full`,`flex-1`),d.appendChild(e),a.appendChild(o),a.appendChild(d),Sn(a,t.codeBlockLineWrap,t.labels)}},In=e=>{let t=e.querySelectorAll(`table`);for(let e of Array.from(t)){if(e.closest(`[data-markdown="table-wrapper"]`))continue;let t=document.createElement(`div`);t.className=`my-4`,t.setAttribute(`data-markdown`,`table-wrapper`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`table-scroll`);let r=e.parentElement;if(r){r.replaceChild(t,e),e.setAttribute(`data-markdown`,`table`);for(let t of Array.from(e.querySelectorAll(`tr`)))t.setAttribute(`data-markdown`,`table-row`);for(let t of Array.from(e.querySelectorAll(`th`)))t.setAttribute(`data-markdown`,`table-header-cell`);for(let t of Array.from(e.querySelectorAll(`td`)))t.setAttribute(`data-markdown`,`table-cell`);n.appendChild(e),t.appendChild(n)}}},Ln=0,Rn=(e,t)=>{let n=e.querySelectorAll(`pre > code.language-mermaid`);for(let e of Array.from(n)){let n=e.parentElement;if(!n)continue;let r=(e.textContent??``).replace(/\s+$/,``),i=t.renderMermaid(r),a=document.createElement(`div`);a.setAttribute(`data-markdown`,`mermaid-block`),a.setAttribute(`data-md-source`,r),a.className=`group relative`;let o=document.createElement(`div`);o.setAttribute(`data-markdown`,`mermaid-scroll`);let s=document.createElement(`div`);if(s.setAttribute(`data-markdown`,`mermaid-toolbar`),s.className=`absolute top-1 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity`,i.svg){a.setAttribute(`data-mermaid-render`,`svg`);let e=document.createElement(`div`);e.setAttribute(`data-markdown`,`mermaid-viewport`);let n=document.createElement(`div`);n.setAttribute(`data-markdown`,`mermaid`),n.setAttribute(`data-md-original-svg`,i.svg),n.innerHTML=i.svg;let c=n.querySelector(`svg`),l=++Ln;for(let[e,t]of[[`title[id]`,`aria-labelledby`],[`desc[id]`,`aria-describedby`]]){let n=c?.querySelector(e);n&&(n.id=`yuri-mermaid-${l}-${n.localName}`,c?.setAttribute(t,n.id))}if(e.appendChild(n),o.appendChild(e),t.mermaidControls.showPanZoomControls&&(s.appendChild(xn(`zoomIn`,t.labels.zoomInDiagram,`mermaid-zoom-in`)),s.appendChild(xn(`zoomOut`,t.labels.zoomOutDiagram,`mermaid-zoom-out`)),s.appendChild(xn(`fit`,t.labels.resetDiagramView,`mermaid-fit`))),t.mermaidControls.copy){let e=xn(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}if(t.mermaidControls.download){let e=xn(`download`,t.labels.downloadDiagram,`mermaid-download`);e.setAttribute(`data-md-svg`,`1`),s.appendChild(e)}}else{a.setAttribute(`data-mermaid-render`,`source`);let e=document.createElement(`pre`);if(e.setAttribute(`data-markdown`,`mermaid-source`),e.textContent=r,o.appendChild(e),t.mermaidControls.copy){let e=xn(`copy`,t.labels.copyDiagram,`mermaid-copy`);e.setAttribute(`data-md-source`,r),s.appendChild(e)}}a.appendChild(o),a.appendChild(s);let c=n.parentElement;c&&c.replaceChild(a,n)}},zn=(e,t)=>{let n=e.querySelectorAll(`a[href]`);for(let e of Array.from(n)){if(e.getAttribute(`data-md-link-decorated`)===`true`||e.getAttribute(`data-yuri-file-link`)===`true`)continue;let n=e.getAttribute(`href`)??``;if(!h(n))continue;e.setAttribute(`data-md-link-decorated`,`true`);let r=_(n);if(r){let t=document.createElement(`span`);t.className=`mr-1 inline-flex size-[18px] items-center justify-center rounded border border-[var(--border)] bg-[var(--interactive-hover)] align-middle`;let n=document.createElement(`img`);n.setAttribute(`data-md-link-favicon`,`true`),n.src=r,n.alt=``,n.setAttribute(`aria-hidden`,`true`),n.loading=`lazy`,n.decoding=`async`,n.className=`size-3.5 rounded-sm`,n.addEventListener(`error`,()=>t.remove(),{once:!0}),t.appendChild(n),e.parentNode?.insertBefore(t,e)}if(t.onPreviewLoopback&&m(n)){let r=document.createElement(`button`);r.type=`button`,r.className=`ml-1 align-middle ${yn}`,r.setAttribute(`data-md-action`,`preview-loopback`),r.setAttribute(`data-md-url`,n),r.setAttribute(`title`,t.labels.previewTitle),r.setAttribute(`aria-label`,t.labels.previewLabel),bn(r,vn.download),e.parentNode?.insertBefore(r,e.nextSibling)}}},Bn=`img:not([data-md-link-favicon="true"])`,Vn=`[data-md-image-presentation="true"]`,Hn=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="576" height="324" viewBox="0 0 576 324"%3E%3C/svg%3E`,Un=[`block`,`max-w-full`,`rounded-xl`,`border`,`border-border/80`,`bg-[var(--surface-muted)]`,`transition-colors`,`focus-visible:outline`,`focus-visible:outline-2`,`focus-visible:outline-offset-2`,`focus-visible:outline-[var(--interactive-focus-ring)]`],Wn=[`cursor-pointer`,`hover:bg-interactive-hover/60`],Gn=[`object-contain`],Kn=e=>{let t=e.parentElement;if(t?.matches(Vn))return t;let n=document.createElement(`span`);n.setAttribute(`data-md-image-presentation`,`true`),n.className=`relative my-4 block w-fit max-w-full`;let r=document.createElement(`span`);r.setAttribute(`data-md-image-placeholder-visual`,`true`),r.setAttribute(`aria-hidden`,`true`),r.className=`pointer-events-none absolute inset-0 flex items-center justify-center text-muted-foreground`,r.classList.add(`yuri-image-loading`),b()&&n.setAttribute(`data-mobile-image`,`true`);let i=document.createElement(`span`);i.className=`relative flex size-14 items-center justify-center rounded-2xl border border-border/80 bg-[var(--surface-elevated)] shadow-sm`,bn(i,vn.image);let a=document.createElement(`span`);a.setAttribute(`data-md-image-download-badge`,`true`),a.className=`absolute -right-1.5 -bottom-1.5 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,bn(a,vn.imageDownload);let o=document.createElement(`span`);return o.setAttribute(`data-md-image-loading-badge`,`true`),o.className=`absolute -right-1.5 -bottom-1.5 hidden size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] text-foreground shadow-sm`,bn(o,vn.imageLoading),i.appendChild(a),i.appendChild(o),r.appendChild(i),t?.replaceChild(n,e),n.appendChild(e),n.appendChild(r),n},qn=e=>{e.src=Hn,e.setAttribute(`data-md-placeholder-source`,Hn),e.setAttribute(`data-md-image-state`,`placeholder`),e.classList.add(...Gn)},Jn=e=>{e.removeAttribute(`data-md-image-state`),e.removeAttribute(`data-md-placeholder-source`),e.removeAttribute(`aria-busy`),e.classList.remove(...Gn)},Yn=(e,t)=>{if(!t.imagePreviewEnabled)return;let n=e.querySelectorAll(Bn);for(let e of Array.from(n)){let n=e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,r=E(n,t.imageEffectiveDirectory);if(!D(r)){e.setAttribute(`data-md-image-source`,n),Kn(e),e.setAttribute(`data-md-image-state`,e.complete&&e.naturalWidth>0?`loaded`:`loading`);continue}e.classList.add(...Un,...Wn),e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-md-image-source`,n),Kn(e),qn(e)}},Xn=(e,t)=>{Pn(e),Rn(e,t),Fn(e,t),In(e),zn(e,t),Yn(e,t),H(e)},Zn=(e,t,n)=>{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},Qn=(e,t)=>{let n=e=>{let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`[data-md-action]`);if(!r)return;let i=r.getAttribute(`data-md-action`)??``;if(i===`copy-code`){let e=r.closest(`[data-component="markdown-code"]`)?.querySelector(`code`)?.textContent??``;e&&S(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copy));return}if(i===`toggle-code-wrap`){e.preventDefault(),t.onToggleCodeBlockLineWrap?.();return}if(i===`mermaid-copy`){let e=r.getAttribute(`data-md-source`)??``;e&&S(e).then(()=>Nn(r,t.labels.copied,`copy`,t.labels.copyDiagram));return}if(i===`mermaid-zoom-in`||i===`mermaid-zoom-out`||i===`mermaid-fit`){e.preventDefault();let t=ln(r.closest(`[data-markdown="mermaid-block"]`));i===`mermaid-zoom-in`?t?.zoomIn():i===`mermaid-zoom-out`?t?.zoomOut():t?.fit();return}if(i===`mermaid-download`){let e=r.closest(`[data-markdown="mermaid-block"]`)?.querySelector(`[data-markdown="mermaid"]`),t=e?.getAttribute(`data-md-original-svg`)??e?.innerHTML??``;t&&Zn(`diagram.svg`,t,`image/svg+xml;charset=utf-8`);return}if(i===`preview-loopback`){e.preventDefault();let n=r.getAttribute(`data-md-url`)??``;n&&t.onPreviewLoopback?.(n);return}};return e.addEventListener(`click`,n),()=>e.removeEventListener(`click`,n)},$n=e({MarkdownRenderer:()=>Cr,SimpleMarkdownRenderer:()=>wr}),Q=a(),er=()=>{let e=(0,he.c)(4),t=w(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=T(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=T(!0),e[1]=i):i=e[1];let a=i,o;return e[2]===t?.currentTheme?o=e[3]:(o=t?.currentTheme??(typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?a:r),e[2]=t?.currentTheme,e[3]=o),o},tr=e=>{let t=(0,he.c)(5),{containerRef:n,enabled:r,effectiveDirectory:i,openInAppBrowser:a,fileReference:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=e=>{if(r===!1||e.defaultPrevented||e.button!==0||e.altKey||e.shiftKey)return;let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(`a[href]`);if(!(n instanceof HTMLAnchorElement)||n.getAttribute(`data-yuri-file-link`)===`true`)return;let s=n.getAttribute(`href`)??``;if(ue(s)){e.preventDefault(),e.stopPropagation(),o&&z(s,o.effectiveDirectory,`href`)&&de(n,o);return}if(!h(s)||e.metaKey||e.ctrlKey)return;e.preventDefault(),e.stopPropagation();let c=(i||``).trim();if(!b()&&c&&a){a(c,s);return}g(s)},t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=f(s);u(`click`,c,n)},$=`img:not([data-md-link-favicon="true"])`,nr=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,rr=({containerRef:e,effectiveDirectory:t,onShowPopup:r})=>{let i=K.useRef(null),a=c(),o=a?.entry.location.hostId?a.entry:void 0;i.current??=n();let s=i.current,l=!!r,u=f(e=>r?.(e)),d=K.useRef(()=>{}),p=K.useRef(new Map),m=K.useRef(null),h=K.useMemo(()=>e=>d.current(e),[]);return K.useLayoutEffect(()=>{let n=p.current;if(m.current!==null&&(clearTimeout(m.current),m.current=null),d.current=()=>{},!l){for(let[e,t]of n)t.controller?.abort(),t.release?.(),n.delete(e);return}let r=e.current;if(!r)return;let i=e=>{let n=Array.from(r.querySelectorAll($));if(n.indexOf(e)<0)return;let i=n.map(e=>({url:nr(e),filename:e.alt||nr(e)||void 0})).filter(e=>e.url),a=nr(e),o=i.findIndex(e=>e.url===a),s=e.alt||a;u({open:!0,title:s,content:``,metadata:{tool:`image-preview`,filename:s},previewSource:e,image:{url:a,filename:s,gallery:i,index:Math.max(0,o),directory:t}})},a=e=>{let t=n.get(e);t&&(t.controller?.abort(),t.release?.(),n.delete(e))},c=e=>{let n=nr(e),r=E(n,t);if(D(r))return`${s}\n${t}\n${n}`},f=e=>{let t=c(e);if(!t){a(e);return}let r=n.get(e);if(r?.key===t)return r;a(e);let i={key:t};return n.set(e,i),i},h=(e,i)=>{if(i.controller||i.objectUrl||!r.contains(e))return;let s=nr(e),c=E(s,t);if(!D(c)){a(e);return}let l=new AbortController;i.controller=l,e.setAttribute(`data-md-image-state`,`loading`),e.setAttribute(`aria-busy`,`true`),O(c.path,l.signal,o).then(t=>{let r=n.get(e);if(!r||r!==i||r.controller!==l||l.signal.aborted){t.release();return}r.controller=void 0,r.objectUrl=t.url,r.release=t.release,e.src=t.url}).catch(()=>{let t=n.get(e);t===i&&(t.controller=void 0,e.removeAttribute(`aria-busy`),e.setAttribute(`data-md-image-state`,`error`))})};d.current=e=>{for(let[t,r]of n)(!e.contains(t)||c(t)!==r.key)&&a(t);for(let t of Array.from(e.querySelectorAll($))){let e=f(t);e&&!e.objectUrl&&h(t,e)}},d.current(r);let g=e=>{let t=f(e);if(t&&!t.objectUrl){h(e,t);return}i(e)},_=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest($);n&&(e.preventDefault(),e.stopPropagation(),g(n))},v=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(e.preventDefault(),e.stopPropagation(),g(t))},y=e=>{let t=e.target;t instanceof Element&&t.closest($)&&(e.preventDefault(),e.stopPropagation())},b=e=>{let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||t.getAttribute(`src`)!==t.getAttribute(`data-md-placeholder-source`)&&(Jn(t),t.setAttribute(`data-md-image-state`,`loaded`))},x=e=>{let t=e.target;!(t instanceof HTMLImageElement)||!t.matches($)||(t.removeAttribute(`aria-busy`),t.setAttribute(`data-md-image-state`,`error`))};return r.addEventListener(`load`,b,!0),r.addEventListener(`error`,x,!0),r.addEventListener(`click`,_),r.addEventListener(`keydown`,v),r.addEventListener(`contextmenu`,y),()=>{d.current=()=>{},r.removeEventListener(`load`,b,!0),r.removeEventListener(`error`,x,!0),r.removeEventListener(`click`,_),r.removeEventListener(`keydown`,v),r.removeEventListener(`contextmenu`,y),m.current=setTimeout(()=>{m.current=null;for(let e of Array.from(n.keys()))r.contains(e)&&qn(e),a(e)},0)}},[e,t,l,s,o]),{reconcileMarkdownImageResources:h,transportIdentity:s}},ir={download:!0,copy:!0,showPanZoomControls:!0},ar=!0,or=e=>{let t=e.match(/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n[\s\S]*?\r?\n\1[^\S\r\n]*(?:\r?\n|$)/);return t?e.slice(t[0].length):e},sr=160,cr=e=>{let t=(0,he.c)(9),{containerRef:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,enabled:s}=e,l=c(),u=l?.entry.location.hostId?l.entry:void 0,d=K.useRef(null),f,p;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==u?(f=()=>{let e=n.current;if(!e)return;let t=!1,c=b(),l=U(),f=s,p=Tr,m=()=>{let t=e.querySelectorAll(V);for(let e of Array.from(t))p(e)};if(!f){m();return}let h=e=>{let n=e===void 0?0:e;if(d.current!==null&&typeof window<`u`&&window.clearTimeout(d.current),typeof window>`u`){g();return}d.current=window.setTimeout(()=>{d.current=null,window.requestAnimationFrame(()=>{t||g()})},n)},g=()=>{let n=e.querySelectorAll(`[data-markdown="inline-code"], a, ${me}`),i=0;for(let a of Array.from(n)){let n=G(a),o=z(n,r,a.tagName.toLowerCase()===`a`?`href`:`path`);if(!o){p(a);continue}if(i>=l){p(a);continue}i+=1,(a.getAttribute(`data-yuri-file-link`)!==`true`||a.getAttribute(`data-yuri-file-path`)!==o.resolvedPath)&&B(o.resolvedPath,r,u).then(n=>{if(t||!e.contains(a))return;let i=G(a),s=z(i,r,a.tagName.toLowerCase()===`a`?`href`:`path`);if(!(!s||s.resolvedPath!==o.resolvedPath)){if(!W(s.resolvedPath,n,c)){p(a);return}a.setAttribute(`data-yuri-file-link`,`true`),a.setAttribute(`data-yuri-file-ref`,i),a.setAttribute(`data-yuri-file-path`,s.resolvedPath),a.setAttribute(`data-yuri-file-binary`,String(n.isBinary)),a.setAttribute(`title`,pe),a.tagName.toLowerCase()!==`a`&&(a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`))}}).catch(Er)}},_=e=>de(e,{scope:u,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o}),v=e=>{let t=e.target;if(!(t instanceof Element)||t.closest($))return;let n=t.closest(V);n instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),_(n))},y=e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||t.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),_(t))};h(sr);let x=new MutationObserver(()=>{h(sr)});return x.observe(e,{childList:!0,subtree:!0}),e.addEventListener(`click`,v),e.addEventListener(`keydown`,y),()=>{t=!0,d.current!==null&&typeof window<`u`&&window.clearTimeout(d.current),d.current=null,x.disconnect(),e.removeEventListener(`click`,v),e.removeEventListener(`keydown`,y)}},p=[n,i,r,o,a,s,u],t[0]=n,t[1]=i,t[2]=r,t[3]=s,t[4]=o,t[5]=a,t[6]=u,t[7]=f,t[8]=p):(f=t[7],p=t[8]),K.useEffect(f,p)},lr=({containerRef:e,onShowPopup:t,enableFullscreen:n,enablePanZoom:r,allowMermaidWheelEvents:i})=>{let a=f(e=>t?.(e)),o=!!t,s=f(t=>{if(!n||!o)return;let r=e.current;if(!r)return;let i=t.target;if(!(i instanceof Element)||i.closest(`button, a, [role="button"]`))return;let s=i.closest(Jt);if(!s)return;if(s instanceof HTMLElement&&s.hasAttribute(`data-mermaid-suppress-click`)){s.removeAttribute(`data-mermaid-suppress-click`);return}let c=Array.from(r.querySelectorAll(Jt)).indexOf(s);if(c<0)return;let l=s instanceof HTMLElement?s.getAttribute(`data-md-source`):null;if(!l||l.trim().length===0)return;let u=`Diagram ${c+1}`;a({open:!0,title:u,content:``,metadata:{tool:`mermaid-preview`,filename:u},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(l)}`,source:l,filename:u},previewSource:s instanceof HTMLElement?s:void 0})}),c=f(e=>{if(i||r)return;let t=e.target;t instanceof Element&&t.closest(`[data-markdown="mermaid-block"]`)&&e.stopPropagation()});u(`click`,s,e),K.useEffect(()=>{let t=e.current;if(t)return t.addEventListener(`wheel`,c,{capture:!0,passive:!0}),()=>{t.removeEventListener(`wheel`,c,!0)}},[e])},ur=24,dr=1,fr=12,pr=/[\s.,!?;:)\]]/,mr=(e,t)=>{let n=e<=12?2:e<=48?4:e<=96?8:Math.min(24,Math.ceil(e/8));return Math.max(1,Math.round(t/ur*n))},hr=(e,t)=>mr(e,t)*(1e3/t),gr=(e,t,n)=>{let r=Math.min(e.length,t+n);for(let t=r;t<Math.min(e.length,r+8);t+=1)if(pr.test(e[t]??``))return t+1;return r},_r=(e,t,n)=>{let[r,i]=K.useState(()=>t?0:e.length),a=K.useRef(r),o=K.useRef(0),s=K.useRef(null);return a.current=r,K.useEffect(()=>{if(!t||typeof window>`u`){o.current=0,s.current=null,i(e.length);return}a.current>e.length&&(a.current=e.length,o.current=0,i(e.length));let r=null,c=t=>{let l=Math.min(a.current,e.length);if(l>=e.length){r=null,s.current=null;return}let u=s.current;if(u===null){s.current=t,r=window.requestAnimationFrame(c);return}let d=Math.min(t-u,100);s.current=t,o.current+=hr(e.length-l,n)*(d/1e3);let f=Math.min(fr,Math.floor(o.current));if(f>=dr){o.current-=f;let t=gr(e,l,f);a.current=t,i(t)}r=window.requestAnimationFrame(c)};return a.current<e.length&&(r=window.requestAnimationFrame(c)),()=>{r!==null&&window.cancelAnimationFrame(r)}},[e,t,n]),t?e.slice(0,Math.min(r,e.length)):e},vr=(e,t,r,i=ir,a=n(),o=``,s=!1)=>{let{t:c}=y(),l=K.useMemo(()=>({copy:c(`markdownRenderer.code.actions.copyTitle`),copied:c(`markdownRenderer.code.actions.copiedTitle`),enableCodeWrap:c(`markdownRenderer.code.actions.enableWrapTitle`),disableCodeWrap:c(`markdownRenderer.code.actions.disableWrapTitle`),copyDiagram:c(`markdownRenderer.mermaid.actions.copySourceTitle`),downloadDiagram:c(`markdownRenderer.mermaid.actions.downloadSvgTitle`),zoomInDiagram:c(`markdownRenderer.mermaid.actions.zoomInTitle`),zoomOutDiagram:c(`markdownRenderer.mermaid.actions.zoomOutTitle`),resetDiagramView:c(`markdownRenderer.mermaid.actions.resetViewTitle`),previewLabel:c(`terminalView.preview.open`),previewTitle:c(`terminalView.preview.openTitle`)}),[c]),u=p(e=>e.codeBlockLineWrap),d=p(e=>e.setCodeBlockLineWrap),m=f(()=>{d(!p.getState().codeBlockLineWrap)});return K.useMemo(()=>({labels:l,mermaidControls:i,codeBlockLineWrap:u,deferCodeLineNumberSync:t,onToggleCodeBlockLineWrap:m,renderMermaid:t=>_e(t,e),onPreviewLoopback:r,imageTransportIdentity:a,imageEffectiveDirectory:o,imagePreviewEnabled:s}),[e,l,i,u,t,r,a,o,s])},yr=({containerRef:e,text:t,streaming:n,cacheKey:r,syntaxVars:i,ctx:a,reconcileMarkdownImageResources:o,onRichContentReady:s})=>{K.useEffect(()=>{P()},[]);let c=K.useRef(null),l=f(()=>{s?.()}),u=f(()=>{let t=e.current;if(t){if(!c.current){if(!Yt(t))return;c.current=_n(t);return}c.current.refresh()}});K.useLayoutEffect(()=>{let r=e.current,i=r?.querySelector(`[data-markdown-content]`)??r;if(i&&t&&i.childNodes.length===0){for(let e of At(t)){let t=document.createElement(`div`);t.setAttribute(`data-md-block`,``),t.style.display=`contents`,t.innerHTML=e,Xn(t,a),i.appendChild(t)}o(i),n||l()}},[e,a,o,n,t]),K.useEffect(()=>()=>{c.current?.cleanup(),c.current=null},[]),K.useEffect(()=>{let i=e.current;if(!i)return;let s=i.querySelector(`[data-markdown-content]`)??i,c=!0,d=new AbortController,f=()=>{},p=()=>{},m=()=>{if(!c||n||d.signal.aborted)return;s.replaceChildren();let e=document.createElement(`div`);e.setAttribute(`data-md-block`,``),e.setAttribute(`data-md-render-fallback`,`text`),e.style.display=`contents`;let r=document.createElement(`span`);r.style.whiteSpace=`pre-wrap`,r.textContent=t,e.appendChild(r),s.appendChild(e),o(s),l()},h=e=>{if(!c)return;let t=Array.from(s.children);e.forEach((e,n)=>{let r=t[n];if(r||(r=document.createElement(`div`),r.setAttribute(`data-md-block`,``),r.style.display=`contents`,s.appendChild(r)),r.getAttribute(`data-md-id`)===e.id)return;let i=document.createElement(`div`);i.innerHTML=e.html,Xn(i,a);let o=Yt(r),c=Yt(i);I(r,i,{childrenOnly:!0,onBeforeElUpdated:(e,t)=>{if(Te(e,t))return!1;if(fe(e,t),e instanceof HTMLImageElement&&t instanceof HTMLImageElement){let n=e.getAttribute(`data-md-image-source`);if(n&&n===t.getAttribute(`data-md-image-source`)){let n=e.getAttribute(`src`);n===null?t.removeAttribute(`src`):t.setAttribute(`src`,n),t.className=e.className;for(let n of[`data-md-image-state`,`data-md-placeholder-source`,`aria-busy`]){let r=e.getAttribute(n);r===null?t.removeAttribute(n):t.setAttribute(n,r)}}}return!e.isEqualNode(t)}}),r.setAttribute(`data-md-id`,e.id),(o||c||Yt(r))&&u()});let n=Yt(s),r=!1;for(let n=t.length-1;n>=e.length;--n){let e=t[n];e&&Yt(e)&&(r=!0),e?.remove()}(r||t.length>e.length&&n)&&u(),o(s),a.deferCodeLineNumberSync||Mn(s,a.codeBlockLineWrap,a.labels),ke(s,ce,{signal:d.signal,priority:`visible`}),l()},g=e=>{try{h(e)}catch{m()}},_=()=>{Lt(t,n,r,d.signal).then(e=>{if(c){if(n){g(e);return}p=A(()=>g(e),{priority:`visible`})}}).catch(m)};return n?_():f=A(_,{priority:`visible`}),()=>{c=!1,d.abort(),f(),p()}},[e,t,n,r,a,o]),K.useEffect(()=>{let t=e.current;if(t)return Qn(t,a)},[e,a]),K.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;if(n)for(let[e,t]of Object.entries(i))n.style.setProperty(e,t)},[e,i]),K.useEffect(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(a.deferCodeLineNumberSync||Mn(n,a.codeBlockLineWrap,a.labels))},[e,a.codeBlockLineWrap,a.deferCodeLineNumberSync,a.labels]);let p=K.useRef(null),m=f(()=>{let t=e.current,n=t?.querySelector(`[data-markdown-content]`)??t;n&&(p.current!==null&&window.cancelAnimationFrame(p.current),p.current=window.requestAnimationFrame(()=>{p.current=null,An(n)}))});d(e,m),K.useEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current)},[])},br=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,xr=e=>{let t=(0,he.c)(4),[n,r]=K.useState(e),i=K.useRef(e),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{i.current||(i.current=!0,r(!0))},t[0]=a):a=t[0];let o=f(a),s;return t[1]!==o||t[2]!==n?(s=[n,o],t[1]=o,t[2]=n,t[3]=s):s=t[3],s},Sr=(e,t,n)=>{let r=K.useRef(n);r.current=n;let i=K.useRef(t);i.current=t;let a=f(e=>{if(!r.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],a=n?n.blockSize:t.contentRect.height,o=n?n.inlineSize:t.contentRect.width;N(i.current,a,o)});d(e,a)},Cr=K.memo(e=>{let t=(0,he.c)(65),{content:n,part:r,messageId:a,isAnimated:o,skipFadeIn:s,className:u,isStreaming:d,disableStreamAnimation:p,sourceIsPaced:m,variant:h,onShowPopup:g,enableFileReferences:_}=e,v=o===void 0||o,y=s!==void 0&&s,b=d!==void 0&&d,S=p!==void 0&&p,C=m!==void 0&&m,w=h===void 0?`assistant`:h,T=_===void 0||_,E=er(),{editor:D,runtime:O}=l(),k=c(),A=K.useRef(null),j=ee()??``,M=f(Dr),N;t[0]!==j||t[1]!==M?(N=e=>{j&&M(j,e)},t[0]=j,t[1]=M,t[2]=N):N=t[2];let ae=f(N),P=b&&!S,se;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(se=ne(i()),t[3]=se):se=t[3];let ce=_r(C?``:n,P&&!C,se.markdownPaceMs),F=C?n:ce,[I,L]=xr(P),R;t[4]===g?R=t[5]:(R={containerRef:A,onShowPopup:g,enableFullscreen:ar,enablePanZoom:ir.showPanZoomControls},t[4]=g,t[5]=R),lr(R);let le=T&&!b,z;t[6]!==D||t[7]!==j||t[8]!==g||t[9]!==O.isVSCode||t[10]!==le?(z={containerRef:A,effectiveDirectory:j,editor:D,preferRuntimeEditor:O.isVSCode,onShowPopup:g,enabled:le},t[6]=D,t[7]=j,t[8]=g,t[9]=O.isVSCode,t[10]=le,t[11]=z):z=t[11],cr(z);let B;t[12]!==D||t[13]!==j||t[14]!==T||t[15]!==k||t[16]!==b||t[17]!==g||t[18]!==O.isVSCode?(B=T&&!b?{effectiveDirectory:j,scope:k?.entry.location.hostId?k.entry:void 0,editor:D,preferRuntimeEditor:O.isVSCode,onShowPopup:g}:void 0,t[12]=D,t[13]=j,t[14]=T,t[15]=k,t[16]=b,t[17]=g,t[18]=O.isVSCode,t[19]=B):B=t[19];let V;t[20]!==j||t[21]!==M||t[22]!==B?(V={containerRef:A,effectiveDirectory:j,openInAppBrowser:M,fileReference:B},t[20]=j,t[21]=M,t[22]=B,t[23]=V):V=t[23],tr(V);let H;t[24]!==j||t[25]!==g?(H={containerRef:A,effectiveDirectory:j,onShowPopup:g},t[24]=j,t[25]=g,t[26]=H):H=t[26];let{reconcileMarkdownImageResources:ue,transportIdentity:U}=rr(H),W;t[27]===E?W=t[28]:(W=oe(E),t[27]=E,t[28]=W);let G=W,de=vr(E,P,j?ae:void 0,ir,U,j,!!g),fe=`markdown-${r?.id?`part-${r.id}`:`message-${a}`}`,pe;t[29]!==fe||t[30]!==de||t[31]!==F||t[32]!==P||t[33]!==ue||t[34]!==L||t[35]!==G?(pe={containerRef:A,text:F,streaming:P,cacheKey:fe,syntaxVars:G,ctx:de,reconcileMarkdownImageResources:ue,onRichContentReady:L},t[29]=fe,t[30]=de,t[31]=F,t[32]=P,t[33]=ue,t[34]=L,t[35]=G,t[36]=pe):pe=t[36],yr(pe);let me;t[37]!==n||t[38]!==b||t[39]!==I||t[40]!==w?(me=I&&!b?ie(n,w):``,t[37]=n,t[38]=b,t[39]=I,t[40]=w,t[41]=me):me=t[41],Sr(A,me,I&&!b);let ge=!I||void 0,_e;t[42]===u?_e=t[43]:(_e=x(`relative break-words w-full min-w-0`,u),t[42]=u,t[43]=_e);let ve=I?`true`:`false`,ye=I?`ready`:`pending`,q;t[44]!==F||t[45]!==I||t[46]!==w?(q=!I&&(0,Q.jsx)(`div`,{className:x(br(w),`pointer-events-none absolute inset-0 overflow-clip`),children:(0,Q.jsx)(re,{content:F})}),t[44]=F,t[45]=I,t[46]=w,t[47]=q):q=t[47];let be=!I||void 0,xe;t[48]!==I||t[49]!==w?(xe=x(br(w),!I&&`invisible`),t[48]=I,t[49]=w,t[50]=xe):xe=t[50];let J;t[51]!==be||t[52]!==xe?(J=(0,Q.jsx)(`div`,{"aria-hidden":be,className:xe,"data-markdown-content":!0}),t[51]=be,t[52]=xe,t[53]=J):J=t[53];let Se;t[54]!==ge||t[55]!==_e||t[56]!==ve||t[57]!==ye||t[58]!==q||t[59]!==J?(Se=(0,Q.jsxs)(`div`,{"aria-busy":ge,className:_e,"data-markdown-ready":ve,"data-markdown-hydration":ye,ref:A,children:[q,J]}),t[54]=ge,t[55]=_e,t[56]=ve,t[57]=ye,t[58]=q,t[59]=J,t[60]=Se):Se=t[60];let Ce=Se;if(v){let e;return t[61]!==fe||t[62]!==Ce||t[63]!==y?(e=(0,Q.jsx)(te,{skipAnimation:y,children:Ce},fe),t[61]=fe,t[62]=Ce,t[63]=y,t[64]=e):e=t[64],e}return Ce},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.sourceIsPaced===t.sourceIsPaced&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),wr=K.memo(e=>{let t=(0,he.c)(56),{content:n,className:r,variant:i,disableLinkSafety:a,stripFrontmatter:o,onShowPopup:s,mermaidControls:u,mermaidTheme:d,allowMermaidWheelEvents:p,enableFileReferences:m}=e,h=i===void 0?`assistant`:i,g=o!==void 0&&o,_=u===void 0?ir:u,v=p!==void 0&&p,y=m===void 0||m,{editor:b,runtime:S}=l(),C=c(),w=er(),T=K.useRef(null),[E,D]=xr(!1),O=ee()??``,k;t[0]!==n||t[1]!==g?(k=g?or(n):n,t[0]=n,t[1]=g,t[2]=k):k=t[2];let A=k,j;t[3]!==v||t[4]!==_.showPanZoomControls||t[5]!==s?(j={containerRef:T,onShowPopup:s,enableFullscreen:ar,enablePanZoom:_.showPanZoomControls,allowMermaidWheelEvents:v},t[3]=v,t[4]=_.showPanZoomControls,t[5]=s,t[6]=j):j=t[6],lr(j);let te=f(Or),M;t[7]!==b||t[8]!==O||t[9]!==y||t[10]!==s||t[11]!==S.isVSCode?(M={containerRef:T,effectiveDirectory:O,editor:b,preferRuntimeEditor:S.isVSCode,onShowPopup:s,enabled:y},t[7]=b,t[8]=O,t[9]=y,t[10]=s,t[11]=S.isVSCode,t[12]=M):M=t[12],cr(M);let ne=!a,N;t[13]!==b||t[14]!==O||t[15]!==y||t[16]!==C||t[17]!==s||t[18]!==S.isVSCode?(N=y?{effectiveDirectory:O,scope:C?.entry.location.hostId?C.entry:void 0,editor:b,preferRuntimeEditor:S.isVSCode,onShowPopup:s}:void 0,t[13]=b,t[14]=O,t[15]=y,t[16]=C,t[17]=s,t[18]=S.isVSCode,t[19]=N):N=t[19];let ie;t[20]!==O||t[21]!==te||t[22]!==N||t[23]!==ne?(ie={containerRef:T,enabled:ne,effectiveDirectory:O,openInAppBrowser:te,fileReference:N},t[20]=O,t[21]=te,t[22]=N,t[23]=ne,t[24]=ie):ie=t[24],tr(ie);let ae;t[25]!==O||t[26]!==s?(ae={containerRef:T,effectiveDirectory:O,onShowPopup:s},t[25]=O,t[26]=s,t[27]=ae):ae=t[27];let{reconcileMarkdownImageResources:P,transportIdentity:se}=rr(ae),ce;t[28]===w?ce=t[29]:(ce=oe(w),t[28]=w,t[29]=ce);let F=ce,I=vr(d??w,!1,void 0,_,se,O,!!s),L=`simple:${h}`,R;t[30]!==I||t[31]!==P||t[32]!==A||t[33]!==D||t[34]!==F||t[35]!==L?(R={containerRef:T,text:A,streaming:!1,cacheKey:L,syntaxVars:F,ctx:I,reconcileMarkdownImageResources:P,onRichContentReady:D},t[30]=I,t[31]=P,t[32]=A,t[33]=D,t[34]=F,t[35]=L,t[36]=R):R=t[36],yr(R);let le=!E||void 0,z;t[37]===r?z=t[38]:(z=x(`relative break-words w-full min-w-0`,r),t[37]=r,t[38]=z);let B=E?`true`:`false`,V=E?`ready`:`pending`,H;t[39]!==A||t[40]!==E||t[41]!==h?(H=!E&&(0,Q.jsx)(`div`,{className:x(br(h),`pointer-events-none absolute inset-0 overflow-clip`),children:(0,Q.jsx)(re,{content:A})}),t[39]=A,t[40]=E,t[41]=h,t[42]=H):H=t[42];let ue=!E||void 0,U;t[43]!==E||t[44]!==h?(U=x(br(h),!E&&`invisible`),t[43]=E,t[44]=h,t[45]=U):U=t[45];let W;t[46]!==ue||t[47]!==U?(W=(0,Q.jsx)(`div`,{"aria-hidden":ue,className:U,"data-markdown-content":!0}),t[46]=ue,t[47]=U,t[48]=W):W=t[48];let G;return t[49]!==le||t[50]!==z||t[51]!==B||t[52]!==V||t[53]!==H||t[54]!==W?(G=(0,Q.jsxs)(`div`,{"aria-busy":le,className:z,"data-markdown-ready":B,"data-markdown-hydration":V,ref:T,children:[H,W]}),t[49]=le,t[50]=z,t[51]=B,t[52]=V,t[53]=H,t[54]=W,t[55]=G):G=t[55],G},(e,t)=>{let n=e.mermaidControls??ir,r=t.mermaidControls??ir;return e.content===t.content&&e.variant===t.variant&&e.className===t.className&&e.disableLinkSafety===t.disableLinkSafety&&e.stripFrontmatter===t.stripFrontmatter&&e.onShowPopup===t.onShowPopup&&n.download===r.download&&n.copy===r.copy&&n.showPanZoomControls===r.showPanZoomControls&&e.mermaidTheme===t.mermaidTheme&&e.allowMermaidWheelEvents===t.allowMermaidWheelEvents&&e.enableFileReferences===t.enableFileReferences});function Tr(e){e.removeAttribute(`data-yuri-file-link`),e.removeAttribute(`data-yuri-file-ref`),e.removeAttribute(`data-yuri-file-path`),e.removeAttribute(`data-yuri-file-binary`),e.getAttribute(`title`)===`Open file`&&e.removeAttribute(`title`),e.tagName.toLowerCase()!==`a`&&(e.removeAttribute(`role`),e.removeAttribute(`tabindex`))}function Er(){}function Dr(e,t){p.getState().openContextBrowser(e,t)}function Or(e,t){p.getState().openContextBrowser(e,t)}export{$n as n,Ve as r,Cr as t};
|
package/dist/assets/{MarkstreamRendererImpl-DOYwdhQ_.js → MarkstreamRendererImpl-CwsjUaGC.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./platform-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./platform-CiUKDeXd.js";import{ot as n,st as r}from"./vendor-base-ui-fom6orB6.js";import{n as i}from"./vendor-react-D5BntRmA.js";import{E as a,V as o}from"./runtime-file-resource-CKQQEwNv.js";import{i as s,m as c,r as l}from"./vendor-reactuses-core-B8s-Rcd-.js";import{r as u}from"./useUIStore-DjizmHAt.js";import{i as d,o as f}from"./useMobileHtmlPreviewStore-DzzgY1eS.js";import{a as p,i as m,n as h,o as g,r as _,t as ee}from"./vendor-markstream-react-Cwc-VXWM.js";import{Cr as v,Rn as y}from"./useMobileNavigationStore-CWShXc31.js";import{t as te}from"./useThemeSystem-D2YBbLma.js";import{a as b,t as x}from"./vendor-framer-motion-DiGWHm7K.js";import{i as S,n as C,t as w}from"./tooltip-Bk9lQalb.js";import{n as T}from"./useEffectiveDirectory-D0EiFP2j.js";import{o as E}from"./image-loading-Dlh4FIPJ.js";import{t as D}from"./LoadingImage-BAUw--5b.js";import{r as O}from"./FadeInOnReveal-CJqre5kV.js";import{r as ne,t as re}from"./markdownHeightCache-BXL8JbYG.js";import{t as k}from"./useStreamingTextThrottle-BZuJKyrE.js";import{r as A,t as j}from"./MarkdownRendererImpl-CA9zIauD.js";import{n as M}from"./fileReferenceParser-1HHDBUum.js";import{a as N,c as P,f as F,h as I,i as ie,l as ae,m as L,o as R,s as oe,t as se}from"./fileReferenceActions-DLTUzjwi.js";var z=e(r(),1),B=i(),V=`img:not([data-md-link-favicon="true"])`,H=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,ce=(e,t)=>{if(e.defaultPrevented||e.button!==0||e.altKey||e.shiftKey)return;let n=e.target;if(!(n instanceof Element))return;if(e.metaKey||e.ctrlKey){let e=n.closest(`a[href]`);if(!(e instanceof HTMLAnchorElement)||!I(e.getAttribute(`href`)??``))return}let r=n.closest(V);if(r instanceof HTMLImageElement&&t.onShowPopup){let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let i=Array.from(n.querySelectorAll(V)).map(e=>({url:H(e),filename:e.alt||H(e)||void 0})).filter(e=>e.url),a=H(r),o=i.findIndex(e=>e.url===a);if(!a)return;e.preventDefault(),e.stopPropagation(),t.onShowPopup({open:!0,title:r.alt||a,content:``,previewSource:r,image:{url:a,...t.effectiveDirectory?{directory:t.effectiveDirectory}:{},filename:r.alt||a,gallery:i,index:o>=0?o:0}});return}if(t.fileReference){let r=n.closest(F);if(r instanceof HTMLElement){e.preventDefault(),e.stopPropagation(),R(r,t.fileReference);return}}let i=n.closest(`a[href]`);if(!(i instanceof HTMLAnchorElement))return;let a=i.getAttribute(`href`)??``;if(I(a)){e.preventDefault(),e.stopPropagation(),t.fileReference&&R(i,t.fileReference);return}if(!d(a))return;e.preventDefault(),e.stopPropagation();let o=(t.effectiveDirectory||``).trim();if(!v()&&o&&t.openInAppBrowser){t.openInAppBrowser(o,a);return}f(a)},le=(e,t)=>{if(e.key!==`Enter`&&e.key!==` `||!t.fileReference)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(F);!(r instanceof HTMLElement)||r.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),R(r,t.fileReference))},ue=(e,t)=>{let n=t>=2?e.slice(t-2,t):``;return(t>=1?e.charAt(t-1):``)===`:`||n===`:/`},U=e=>{if(!e.includes(`/`)||!e.includes(`.`))return[{kind:`text`,value:e}];M.lastIndex=0;let t=[],n=0,r=M.exec(e);for(;r;){let i=r[0];if(!i||ue(e,r.index)||!L(i)){r=M.exec(e);continue}r.index>n&&t.push({kind:`text`,value:e.slice(n,r.index)}),t.push({kind:`path`,value:i}),n=r.index+i.length,r=M.exec(e)}return n===0?[{kind:`text`,value:e}]:(n<e.length&&t.push({kind:`text`,value:e.slice(n)}),t)},W=z.createContext({messageId:`markstream`,isStreaming:!1,disableStreamAnimation:!1,variant:`assistant`,enableFileReferences:!0}),G=()=>z.useContext(W),K=n(),de=24,q=4,fe=new Intl.Segmenter(void 0,{granularity:`grapheme`});function pe({node:e}){let t=G(),n=x(),r=t.isStreaming&&!t.disableStreamAnimation&&!n,i=e.content??``,a=z.useRef(i),o=z.useRef(i),s=z.useRef(null),c=z.useRef(new Map);return z.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=t=>{c.current.delete(t),t.parentNode===e&&(t.replaceWith(document.createTextNode(t.textContent??``)),e.normalize())},n=()=>{for(let[e,n]of c.current)n.stop(),t(e)};if(!r||!i.startsWith(o.current)){n(),e.textContent=i,o.current=i;return}let a=i.slice(o.current.length);if(o.current=i,!a)return;let l=Array.from(fe.segment(a),e=>e.segment),u=Math.max(0,l.length-96),d=[];for(let e=u;e<l.length;e+=q)d.push(l.slice(e,e+q).join(``));c.current.size+d.length>de&&n(),u>0&&e.appendChild(document.createTextNode(l.slice(0,u).join(``))),d.forEach((n,r)=>{let i=document.createElement(`span`);i.dataset.motionStreamChunk=``,i.textContent=n,i.style.opacity=`0`,e.appendChild(i);let a=b([i],{opacity:[0,1]},{duration:.16,delay:Math.min(r*.008,.08),ease:`easeOut`});c.current.set(i,a),a.then(()=>t(i))})},[i,r]),z.useLayoutEffect(()=>{let e=c.current;return()=>{for(let t of e.values())t.stop();e.clear()}},[]),(0,K.jsx)(`span`,{ref:s,className:y(`text-node whitespace-pre-wrap break-words`,e.center&&`text-node-center`),children:a.current})}var J=z.createContext({enabled:!1,insideLink:!1,isMobileSurface:!1,effectiveDirectory:``,preferRuntimeEditor:!1,slots:{used:0,limit:0}}),me=e=>{let t=(0,B.c)(14),{enabled:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,content:s,children:c}=e,l=n?s:``,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=v(),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=ie(),t[1]=d):d=t[1];let f;t[2]===l?f=t[3]:(f={content:l,used:0,limit:d},t[2]=l,t[3]=f);let p;t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==o||t[8]!==a||t[9]!==f?(p={enabled:n,insideLink:!1,isMobileSurface:u,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,slots:f},t[4]=i,t[5]=r,t[6]=n,t[7]=o,t[8]=a,t[9]=f,t[10]=p):p=t[10];let m=p,h;return t[11]!==c||t[12]!==m?(h=(0,K.jsx)(J.Provider,{value:m,children:c}),t[11]=c,t[12]=m,t[13]=h):h=t[13],h},Y=({raw:e,referenceKind:t,children:n})=>{let r=z.useContext(J),i=N(e,r.effectiveDirectory,t),a=z.useRef(!1);r.enabled&&i&&!a.current&&r.slots.used<r.slots.limit&&(r.slots.used+=1,a.current=!0);let[o,s]=z.useState(i?oe(i.resolvedPath,r.effectiveDirectory)??null:null),c=i?.resolvedPath;if(z.useEffect(()=>{if(!r.enabled||!c||!a.current)return;let e=!1;return P(c,r.effectiveDirectory).then(t=>{e||s(t)}).catch(()=>{}),()=>{e=!0}},[r.enabled,r.effectiveDirectory,c]),!i)return n??e;let l=!!(a.current&&o&&ae(i.resolvedPath,o,r.isMobileSurface));return(0,K.jsx)(`span`,{"data-yuri-block-path-token":`true`,...l?{"data-yuri-file-link":`true`,"data-yuri-file-ref":e,"data-yuri-file-path":i.resolvedPath,"data-yuri-file-binary":String(o?.isBinary===!0),title:se,...n?{}:{role:`button`,tabIndex:0}}:{},children:n??e})};function he(e){let t=(0,B.c)(18),n=z.useContext(J),r=G(),i;t[0]===r?i=t[1]:(i=()=>r.isStreaming&&!r.disableStreamAnimation&&r.variant!==`tool`?pe:_,t[0]=r,t[1]=i);let[a]=z.useState(i),o=e.node.content??``;if(!n.enabled||n.insideLink){let n;return t[2]!==a||t[3]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[2]=a,t[3]=e,t[4]=n):n=t[4],n}let s,c;if(t[5]!==a||t[6]!==o||t[7]!==e){c=Symbol.for(`react.early_return_sentinel`);bb0:{let n=U(o);if(n.length===1&&n[0]?.kind!==`path`){let n;t[10]!==a||t[11]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[10]=a,t[11]=e,t[12]=n):n=t[12],c=n;break bb0}let r;t[13]!==a||t[14]!==e?(r=(t,n)=>t.kind===`path`?(0,K.jsx)(Y,{raw:t.value},`path-${n}-${t.value}`):(0,K.jsx)(a,{...e,fade:!1,node:{...e.node,content:t.value}},`text-${n}`),t[13]=a,t[14]=e,t[15]=r):r=t[15],s=n.map(r)}t[5]=a,t[6]=o,t[7]=e,t[8]=s,t[9]=c}else s=t[8],c=t[9];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[16]===s?l=t[17]:(l=(0,K.jsx)(K.Fragment,{children:s}),t[16]=s,t[17]=l),l}function ge(e){let t=(0,B.c)(7),n=z.useContext(J),r=e.node.code??``;if(!n.enabled||!L(r)){let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(m,{...e}),t[0]=e,t[1]=n),n}let i;t[2]===r?i=t[3]:(i=(0,K.jsx)(Y,{raw:r}),t[2]=r,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsx)(m,{...e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}function _e(e){let t=(0,B.c)(20),n=z.useContext(J),r=e.node.href??``,i;t[0]!==n.enabled||t[1]!==r?(i=n.enabled&&L(r),t[0]=n.enabled,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===e?o=t[4]:(o=(0,K.jsx)(h,{...e,showTooltip:!1}),t[3]=e,t[4]=o);let s=o,c;t[5]!==n.isMobileSurface||t[6]!==r||t[7]!==s||t[8]!==e.node.title||t[9]!==e.showTooltip?(c=n.isMobileSurface||e.showTooltip===!1?s:(0,K.jsxs)(w,{children:[(0,K.jsx)(S,{asChild:!0,children:(0,K.jsx)(`span`,{children:s})}),(0,K.jsx)(C,{children:e.node.title||r})]}),t[5]=n.isMobileSurface,t[6]=r,t[7]=s,t[8]=e.node.title,t[9]=e.showTooltip,t[10]=c):c=t[10];let l=c,u;t[11]===n?u=t[12]:(u={...n,insideLink:!0},t[11]=n,t[12]=u);let d;t[13]!==l||t[14]!==a||t[15]!==r?(d=a?(0,K.jsx)(Y,{raw:r,referenceKind:`href`,children:l}):l,t[13]=l,t[14]=a,t[15]=r,t[16]=d):d=t[16];let f;return t[17]!==u||t[18]!==d?(f=(0,K.jsx)(J.Provider,{value:u,children:d}),t[17]=u,t[18]=d,t[19]=f):f=t[19],f}var ve=/^[ \t]{0,3}(`{3,}|~{3,})/,ye=e=>{if(typeof e!=`string`||e.length===0)return!1;let t=e.split(/\r?\n/,1)[0]??``;return ve.test(t)},be=e=>{let t=0,n=0,r=e.match(/[`~]+/g)??[];for(let e of r)e[0]==="`"?t=Math.max(t,e.length):n=Math.max(n,e.length);return t>=3?"`".repeat(Math.max(3,t+1)):n>=3&&t===0?"```":n>=3?`~`.repeat(Math.max(3,n+1)):"```"},xe=e=>{let t=typeof e.raw==`string`?e.raw:``;if(ye(t))return t.endsWith(`
|
|
2
2
|
`)?t:`${t}\n`;let n=(e.language??``).trim(),r=e.code??``,i=be(r),a=r.endsWith(`
|
|
3
|
-
`)?r:`${r}\n`;return e.loading?`${i}${n}\n${a}`:`${i}${n}\n${a}${i}\n`},Se=e=>{let t=e.partId?`part-${e.partId}`:`body`,n=e.indexKey!==void 0&&e.indexKey!==null&&String(e.indexKey).length>0?String(e.indexKey):e.language&&e.language.length>0?e.language:`code`;return`${e.messageId}:${t}:code:${n}`};function Ce(e,t){let n=5381;for(let e=0;e<t.length;e+=1)n=Math.imul(n,33)^t.charCodeAt(e);return`${e}:${(n>>>0).toString(36)}:${t.length}`}function X(e){let t=(0,B.c)(7),n;if(t[0]!==e.indexKey||t[1]!==e.node.code||t[2]!==e.node.language){let r=(e.node.language??``).trim().toLowerCase()||`diagram`;n=e.indexKey??Ce(r,e.node.code??``),t[0]=e.indexKey,t[1]=e.node.code,t[2]=e.node.language,t[3]=n}else n=t[3];let r=n,i;return t[4]!==r||t[5]!==e?(i=(0,K.jsx)(Z,{...e,indexKey:r}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}function Z(e){let t=(0,B.c)(21),n=G(),r=e.node.language??``,i=e.node.code??``,a=e.node.raw??``,o=e.node.loading===!0||e.loading===!0,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=xe({type:`code_block`,language:r,code:i,raw:a,loading:o}),t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=s,l=n.isStreaming||e.loading===!0||e.node.loading===!0,u;t[5]!==n.messageId||t[6]!==n.partId||t[7]!==e.indexKey||t[8]!==e.node.language?(u=Se({messageId:n.messageId,partId:n.partId,indexKey:e.indexKey,language:e.node.language}),t[5]=n.messageId,t[6]=n.partId,t[7]=e.indexKey,t[8]=e.node.language,t[9]=u):u=t[9];let d=u,f=n.enableFileReferences&&!l,p;t[10]!==c||t[11]!==n.disableStreamAnimation||t[12]!==n.onShowPopup||t[13]!==n.variant||t[14]!==d||t[15]!==l||t[16]!==f?(p=(0,K.jsx)(j,{content:c,messageId:d,isAnimated:!1,skipFadeIn:!0,isStreaming:l,disableStreamAnimation:n.disableStreamAnimation,sourceIsPaced:!0,variant:n.variant,onShowPopup:n.onShowPopup,enableFileReferences:f}),t[10]=c,t[11]=n.disableStreamAnimation,t[12]=n.onShowPopup,t[13]=n.variant,t[14]=d,t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==d||t[19]!==p?(m=(0,K.jsx)(`div`,{className:`yuri-markstream-code-host min-w-0 w-full`,"data-yuri-markstream-code":`markdown-impl`,"data-yuri-markstream-code-id":d,children:p}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function we(e){let t=(0,B.c)(9),{node:n}=e,r=T()??``,i=E(n.src,r),{onShowPopup:a}=G(),o=l(Q),s=i.source||void 0,c=n.title??void 0,u=a?`button`:void 0,d=a?0:void 0,f=a?o:void 0,p;return t[0]!==n.alt||t[1]!==n.src||t[2]!==i.error||t[3]!==s||t[4]!==c||t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,K.jsx)(D,{contentFrame:!0,src:s,resourceError:i.error,"data-md-image-source":n.src,alt:n.alt,title:c,className:`rounded-lg`,role:u,tabIndex:d,onKeyDown:f}),t[0]=n.alt,t[1]=n.src,t[2]=i.error,t[3]=s,t[4]=c,t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8],p}function Q(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())}function Te(e){let t=(0,B.c)(4);if(e.node.type===`code_block`){let n=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(Z,{...n}),t[0]=n,t[1]=r),r}let n=e,r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(we,{...n}),t[2]=n,t[3]=r),r}var $=!1;function Ee(e){return e.node?.type===`code_block`?z.createElement(Z,e):z.createElement(he,e)}var De=()=>{$||($=!0,p({text:Ee,inline_code:ge,link:_e,image:Te,code_block:g(Z,`block`),mermaid:g(X,`block`),d2:g(X,`block`),d2lang:g(X,`block`),infographic:g(X,`block`)}))},Oe={parseOptions:{reuseStableTopLevelNodes:!0},maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1};De();var ke=e=>(e.inline.ruler.at(`math`,(e,t)=>{let n=e.src.slice(e.pos),r=A(n),i=n.startsWith(`\\(`)?/^\\\(([\s\S]+?)\\\)/.exec(n):null,a=r?.raw??i?.[0],o=r?.text??i?.[1];if(!a||!o)return!1;if(!t){let t=e.push(`math_inline`,`math`,0);t.content=o,t.markup=r?r.display?`$$`:`$`:`\\(\\)`}return e.pos+=a.length,!0}),e),Ae=e=>e===`tool`?`markdown-content markdown-tool yuri-markstream-host`:e===`reasoning`?`markdown-content markdown-reasoning yuri-markstream-host`:`markdown-content leading-relaxed yuri-markstream-host`,je=z.memo(({content:e,part:t,messageId:n,className:r,isStreaming:i=!1,disableStreamAnimation:d=!1,variant:f=`assistant`,onShowPopup:p,enableFileReferences:m=!0})=>{let h=te()?.currentTheme.metadata.variant===`dark`,{editor:g,runtime:_}=o(),
|
|
3
|
+
`)?r:`${r}\n`;return e.loading?`${i}${n}\n${a}`:`${i}${n}\n${a}${i}\n`},Se=e=>{let t=e.partId?`part-${e.partId}`:`body`,n=e.indexKey!==void 0&&e.indexKey!==null&&String(e.indexKey).length>0?String(e.indexKey):e.language&&e.language.length>0?e.language:`code`;return`${e.messageId}:${t}:code:${n}`};function Ce(e,t){let n=5381;for(let e=0;e<t.length;e+=1)n=Math.imul(n,33)^t.charCodeAt(e);return`${e}:${(n>>>0).toString(36)}:${t.length}`}function X(e){let t=(0,B.c)(7),n;if(t[0]!==e.indexKey||t[1]!==e.node.code||t[2]!==e.node.language){let r=(e.node.language??``).trim().toLowerCase()||`diagram`;n=e.indexKey??Ce(r,e.node.code??``),t[0]=e.indexKey,t[1]=e.node.code,t[2]=e.node.language,t[3]=n}else n=t[3];let r=n,i;return t[4]!==r||t[5]!==e?(i=(0,K.jsx)(Z,{...e,indexKey:r}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}function Z(e){let t=(0,B.c)(21),n=G(),r=e.node.language??``,i=e.node.code??``,a=e.node.raw??``,o=e.node.loading===!0||e.loading===!0,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=xe({type:`code_block`,language:r,code:i,raw:a,loading:o}),t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=s,l=n.isStreaming||e.loading===!0||e.node.loading===!0,u;t[5]!==n.messageId||t[6]!==n.partId||t[7]!==e.indexKey||t[8]!==e.node.language?(u=Se({messageId:n.messageId,partId:n.partId,indexKey:e.indexKey,language:e.node.language}),t[5]=n.messageId,t[6]=n.partId,t[7]=e.indexKey,t[8]=e.node.language,t[9]=u):u=t[9];let d=u,f=n.enableFileReferences&&!l,p;t[10]!==c||t[11]!==n.disableStreamAnimation||t[12]!==n.onShowPopup||t[13]!==n.variant||t[14]!==d||t[15]!==l||t[16]!==f?(p=(0,K.jsx)(j,{content:c,messageId:d,isAnimated:!1,skipFadeIn:!0,isStreaming:l,disableStreamAnimation:n.disableStreamAnimation,sourceIsPaced:!0,variant:n.variant,onShowPopup:n.onShowPopup,enableFileReferences:f}),t[10]=c,t[11]=n.disableStreamAnimation,t[12]=n.onShowPopup,t[13]=n.variant,t[14]=d,t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==d||t[19]!==p?(m=(0,K.jsx)(`div`,{className:`yuri-markstream-code-host min-w-0 w-full`,"data-yuri-markstream-code":`markdown-impl`,"data-yuri-markstream-code-id":d,children:p}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function we(e){let t=(0,B.c)(9),{node:n}=e,r=T()??``,i=E(n.src,r),{onShowPopup:a}=G(),o=l(Q),s=i.source||void 0,c=n.title??void 0,u=a?`button`:void 0,d=a?0:void 0,f=a?o:void 0,p;return t[0]!==n.alt||t[1]!==n.src||t[2]!==i.error||t[3]!==s||t[4]!==c||t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,K.jsx)(D,{contentFrame:!0,src:s,resourceError:i.error,"data-md-image-source":n.src,alt:n.alt,title:c,className:`rounded-lg`,role:u,tabIndex:d,onKeyDown:f}),t[0]=n.alt,t[1]=n.src,t[2]=i.error,t[3]=s,t[4]=c,t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8],p}function Q(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())}function Te(e){let t=(0,B.c)(4);if(e.node.type===`code_block`){let n=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(Z,{...n}),t[0]=n,t[1]=r),r}let n=e,r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(we,{...n}),t[2]=n,t[3]=r),r}var $=!1;function Ee(e){return e.node?.type===`code_block`?z.createElement(Z,e):z.createElement(he,e)}var De=()=>{$||($=!0,p({text:Ee,inline_code:ge,link:_e,image:Te,code_block:g(Z,`block`),mermaid:g(X,`block`),d2:g(X,`block`),d2lang:g(X,`block`),infographic:g(X,`block`)}))},Oe={parseOptions:{reuseStableTopLevelNodes:!0},maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1};De();var ke=e=>(e.inline.ruler.at(`math`,(e,t)=>{let n=e.src.slice(e.pos),r=A(n),i=n.startsWith(`\\(`)?/^\\\(([\s\S]+?)\\\)/.exec(n):null,a=r?.raw??i?.[0],o=r?.text??i?.[1];if(!a||!o)return!1;if(!t){let t=e.push(`math_inline`,`math`,0);t.content=o,t.markup=r?r.display?`$$`:`$`:`\\(\\)`}return e.pos+=a.length,!0}),e),Ae=e=>e===`tool`?`markdown-content markdown-tool yuri-markstream-host`:e===`reasoning`?`markdown-content markdown-reasoning yuri-markstream-host`:`markdown-content leading-relaxed yuri-markstream-host`,je=z.memo(({content:e,part:t,messageId:n,className:r,isStreaming:i=!1,disableStreamAnimation:d=!1,variant:f=`assistant`,onShowPopup:p,enableFileReferences:m=!0})=>{let h=te()?.currentTheme.metadata.variant===`dark`,{editor:g,runtime:_}=o(),v=a(),b=T()??``,x=z.useRef(null),S=t?.id?`yuri-ms-${t.id}`:`yuri-ms-${n}`,C=t?.id,w=!i,E=w?re(e,`markstream:${f}`):``,D=m&&!i,O=D?{effectiveDirectory:b,scope:v?.entry.location.hostId?v.entry:void 0,editor:g,preferRuntimeEditor:_.isVSCode,onShowPopup:p}:void 0,k=z.useMemo(()=>({messageId:n,partId:C,isStreaming:i,disableStreamAnimation:d,variant:f,onShowPopup:p,enableFileReferences:m}),[n,C,i,d,f,p,m]),A=z.useRef(w);A.current=w;let j=z.useRef(E);j.current=E;let M=l(e=>{if(!A.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],r=n?n.blockSize:t.contentRect.height,i=n?n.inlineSize:t.contentRect.width;ne(j.current,r,i)});c(x,M);let N=l((e,t)=>{u.getState().openContextBrowser(e,t)}),P=l(e=>{ce(e,{onShowPopup:p,fileReference:O,effectiveDirectory:b,openInAppBrowser:N})}),F=l(e=>{le(e,{fileReference:O})});return s(`click`,P,x),s(`keydown`,F,x),(0,K.jsx)(`div`,{ref:x,className:y(`relative break-words w-full min-w-0`,Ae(f),r),"data-markdown-ready":`true`,"data-markdown-hydration":`ready`,"data-yuri-markdown-engine":`markstream`,"data-yuri-markstream-virtual":`off`,"data-yuri-markstream-streaming":i?`true`:void 0,children:(0,K.jsx)(W.Provider,{value:k,children:(0,K.jsx)(me,{enabled:D,effectiveDirectory:b,editor:g,preferRuntimeEditor:_.isVSCode,onShowPopup:p,content:e,children:(0,K.jsx)(ee,{content:e,customMarkdownIt:ke,customId:S,final:!i,isDark:h,codeBlockStream:i,...Oe})})})})},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),Me=e=>{let n=(0,B.c)(7),r=e.content,i=e.isStreaming===!0,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=O(t()),n[0]=a):a=n[0];let o;n[1]!==e.content||n[2]!==i?(o={text:r,isStreaming:i,throttleMs:a.markdownPaceMs},n[1]=e.content,n[2]=i,n[3]=o):o=n[3];let s=k(o),c=e.isStreaming?s:e.content,l;return n[4]!==e||n[5]!==c?(l=(0,K.jsx)(je,{...e,content:c}),n[4]=e,n[5]=c,n[6]=l):l=n[6],l},Ne=e=>{let t=(0,B.c)(3),n=`${e.messageId}:${e.part?.id??`text`}`,r;return t[0]!==e||t[1]!==n?(r=(0,K.jsx)(Me,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};export{Ne as MarkstreamRenderer};
|
package/dist/assets/{MobileDetailNavigation-DVbLG15P.js → MobileDetailNavigation-FfSrd8rW.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-BMjl5Y5W.js";import{n as r}from"./runtime-fetch-DKZOpfzo.js";import{ot as i,st as a}from"./vendor-base-ui-z2M4boRm.js";import{n as o}from"./vendor-react-P8wFrkcT.js";import{s}from"./vendor-tanstack-react-query-B-KblYBV.js";import{L as c,q as l}from"./runtime-file-resource-CuLP3xp7.js";import{i as u}from"./store-BOD3jjMl.js";import{In as d,Rn as f,eo as p}from"./useMobileNavigationStore-2N3dS8vX.js";import{n as m}from"./Icon-DBOSvb4U.js";var h=e(a(),1),g=o(),_=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},v=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},y=class extends _{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},b=(e,t=200)=>{throw new _(`invalid_${e}_response`,t,e)},x=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:b(t),S=(e,t)=>typeof e==`string`?e:b(t),C=(e,t)=>e===null||typeof e==`string`?e:b(t),w=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:b(t),T=(e,t)=>e===null?null:w(e,t),E=(e,t)=>typeof e==`boolean`?e:b(t),D=(e,t,n)=>t.includes(e)?e:b(n),O=e=>{let t=x(e,`capability`);return{supported:E(t.supported,`capability`),enabled:E(t.enabled,`capability`),revision:w(t.revision,`capability`),serverInstanceID:C(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&E(t.sharingAvailable,`capability`)}},k=e=>{if(e==null)return null;let t=x(e,`assistant`);return{turnID:S(t.turnID,`assistant`),messageID:S(t.messageID,`assistant`),status:D(t.status,[`queued`,`running`],`assistant`),admittedAt:w(t.admittedAt,`assistant`)}},A=e=>{if(e==null)return null;let t=x(e,`assistant_preview`),n=w(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?b(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:w(t.createdAt,`assistant_preview`)},messageID:S(t.messageID,`assistant_preview`),ordinal:n,role:D(t.role,[`user`,`assistant`],`assistant_preview`),text:S(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:D(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},j=e=>{let t=w(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:b(`assistant_read`)},M=e=>{let t=x(e,`assistant_read`);return{generation:j(t.generation),ordinal:j(t.ordinal),messageID:S(t.messageID,`assistant_read`)}},N=e=>({unreadCount:e.unreadCount===void 0?0:j(e.unreadCount),readWatermark:e.readWatermark==null?null:M(e.readWatermark),readTip:e.readTip==null?null:M(e.readTip)}),P=e=>{let t=x(e,`assistant_read`);return{assistantID:S(t.assistantID,`assistant_read`),changed:E(t.changed,`assistant_read`),unreadCount:j(t.unreadCount),readWatermark:M(t.readWatermark),readTip:M(t.readTip),revision:j(t.revision)}},F=e=>{let t=x(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>S(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:w(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return b(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>S(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:k(t.activeContactTurn),o=t.working===void 0?a!=null:E(t.working,`assistant`);return{...N(t),pinnedAt:t.pinnedAt===void 0?void 0:T(t.pinnedAt,`assistant`),latestMessagePreview:A(t.latestMessagePreview),id:S(t.id,`assistant`),avatarSeed:S(t.avatarSeed??t.id,`assistant`),revision:w(t.revision,`assistant`),enabled:E(t.enabled,`assistant`),name:S(t.name,`assistant`),defaultPrompt:S(t.defaultPrompt,`assistant`),workspacePath:C(t.workspacePath,`assistant`),effectiveWorkspacePath:S(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:C(t.managedWorkspacePath??null,`assistant`),providerID:S(t.providerID,`assistant`),modelID:S(t.modelID,`assistant`),agent:C(t.agent,`assistant`),variant:C(t.variant??null,`assistant`),mode:D(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:C(t.sessionID,`assistant`),sessionGeneration:w(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:T(t.createdAt,`assistant`),updatedAt:w(t.updatedAt,`assistant`),tombstoneAt:T(t.tombstoneAt,`assistant`)}},I=e=>{let t=x(e,`snapshot`);return{revision:w(t.revision,`snapshot`),enabled:E(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(F):b(`snapshot`)}},L=e=>{let t=x(e,`binding`);return{sessionID:C(t.sessionID,`binding`),directory:S(t.directory,`binding`),sessionGeneration:w(t.sessionGeneration,`binding`)}},R=e=>{let t=x(e,`message_admission`);if(t.admitted!==!0)return b(`message_admission`);let n=t.revision===void 0||t.revision===null?null:w(t.revision,`message_admission`);return{binding:L(t.binding),messageID:S(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},z=e=>{let t=x(e,`share_operation`);return{operationID:S(t.operationID,`share_operation`),assistantID:S(t.assistantID,`share_operation`),sessionID:C(t.sessionID,`share_operation`),messageID:C(t.messageID,`share_operation`),state:D(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:S(t.phase,`share_operation`),attempt:w(t.attempt,`share_operation`),leaseExpiresAt:T(t.leaseExpiresAt,`share_operation`),errorCode:C(t.errorCode,`share_operation`)}},B=e=>{let t=x(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:S(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:S(t.filename,`assistant_contact_part`),n=S(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return b(`assistant_contact_part`);if(i){let r=w(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?b(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:S(t.attachmentID,`assistant_contact_part`),sha256:S(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:S(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:b(`assistant_contact_part`)}if(t.type===`card`){let e=D(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=x(t.target,`assistant_contact_part`),r=e=>{let t=S(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?b(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:S(t.sessionID,`assistant_contact_part`),directory:S(t.directory,`assistant_contact_part`),title:C(t.title??null,`assistant_contact_part`),status:C(t.status??null,`assistant_contact_part`),branch:C(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:S(t.assistantID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),providerID:S(t.providerID,`assistant_contact_part`),modelID:S(t.modelID,`assistant_contact_part`),mode:D(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:S(t.taskID,`assistant_contact_part`),projectID:S(t.projectID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),kind:C(t.kind??null,`assistant_contact_part`),time:C(t.time??null,`assistant_contact_part`),timezone:C(t.timezone??null,`assistant_contact_part`),prompt:C(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:C(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:C(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>S(e,`assistant_contact_part`)):b(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=w(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:b(`assistant_contact_part`)}):b(`assistant_contact_part`)}}}return b(`assistant_contact_part`)},V=e=>{let t=x(e,`assistant_contact`),n=C(t.nextCursor,`assistant_contact`),r=E(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return b(`assistant_contact`);let i=w(t.generation,`assistant_contact`),a=w(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?b(`assistant_contact`):{messages:t.messages.map(e=>{let t=x(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return b(`assistant_contact_message`);let n=t.parts.map(B);return{messageID:S(t.messageID,`assistant_contact_message`),assistantID:S(t.assistantID,`assistant_contact_message`),role:D(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:S(t.turnID,`assistant_contact_message`),bubbleIndex:w(t.bubbleIndex,`assistant_contact_message`),createdAt:w(t.createdAt,`assistant_contact_message`),ordinal:w(t.ordinal,`assistant_contact_message`),status:S(t.status,`assistant_contact_message`),fromAssistantID:C(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:C(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},ee=e=>{let t=x(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=x(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:x(t.task,`assistant_scheduled_task_live`);return{assistantID:S(t.assistantID,`assistant_scheduled_task`),projectID:S(t.projectID,`assistant_scheduled_task`),taskID:S(t.taskID,`assistant_scheduled_task`),createdAt:w(t.createdAt,`assistant_scheduled_task`),projectPath:C(t.projectPath??null,`assistant_scheduled_task`),projectLabel:C(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:b(`assistant_scheduled_tasks`)},H=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},U=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},te=e=>e===null||typeof e==`string`,ne=e=>e===null||typeof e==`number`&&Number.isFinite(e),re=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ie=e=>e===null||re(e),ae=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&te(t.sessionId)&&te(t.directory)&&te(t.error)&&re(t.startedAt)&&ie(t.finishedAt)&&ne(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},oe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(ae)||!te(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},se=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await H(a,`Failed to load scheduled task history`));return oe(await a.json().catch(()=>null))},ce=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await H(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},le=async(e,t)=>{let n=U(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await H(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ue=async(e,t)=>{let n=U(e),i=U(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await H(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},de=async(e,t)=>{let n=U(e),i=U(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await H(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},fe=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,pe=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},me=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(pe)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&fe({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},he=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),ge=e=>!!(e&&e.generation>=0),_e=(e,t)=>fe({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),W=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(_e)},ve=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},ye=e=>e.map(e=>e.messageID),be=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},xe=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),we=e=>({ordinal:e.ordinal,messageID:e.messageID}),Te=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>fe(we(e),we(r))<0),...t]},Ee=(e,t)=>{let n=e??he(),r=ge(n),i=[...t.messages].sort(_e),a=ye(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=Te(n.messages,i,t.complete);else{let e=ve(i);c=W(n.messages.filter(t=>t.ordinal<e),W(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=xe(a),d=l.length>0&&be(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},De=(e,t)=>{if(!ge(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=W(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},Oe=(e,t,n)=>{if(!ge(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=W(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=ye(t.messages),c=e.gapTargetIDs??[],l=xe(c);return c.length>0&&be(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},G={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},K=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new _(e,n.status,void 0,t)}return i},q=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),J=(e,r)=>{if(t()!==e||n()!==r)throw new _(`runtime_stale`,409)},ke=(e,t,r)=>{l.setQueryData(G.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),l.invalidateQueries({queryKey:G.snapshot(r)}),l.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},Ae=(e,t)=>{l.setQueryData(G.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),l.invalidateQueries({queryKey:G.snapshot(t)})},je=2500,Me=15e3,Ne=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Pe=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?je:Me}return Ne(e)?je:Me},Y=(e=t())=>({queryKey:G.snapshot(e),queryFn:async({signal:e})=>I(await K(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Pe(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),X=new Map,Fe=e=>{let r=X.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,s=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,l.getQueryCache().find({queryKey:G.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await l.invalidateQueries({queryKey:G.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&s())}finally{a=!1}}},d=c(t=>{if(!s())return;let n=l.getQueryData(G.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});X.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=X.get(e);t&&--t.count===0&&(t.dispose(),X.delete(e))}},Ie=e=>{let n=(0,g.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=s,r=Y(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let o;n[3]===e?o=n[4]:(o={...r,select:e},n[3]=e,n[4]=o);let c=i(o),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Fe(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),h.useEffect(l,u),c},Le=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Re=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Y(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Fe(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??0},ze=e=>e.enabled&&Ne(e),Be=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Y(i),select:ze},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Fe(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??!1},Ve=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},He=async(e,t,n)=>V(await K(Ve(e,t),n?{signal:n}:{})),Ue=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,Z=new Map,We=new Map,Q=e=>e.join(``),Ge=async(e,t,n,r,i)=>{let a=Q(t),o=We.get(a);if(o)return o;let s=(async()=>{let a=l.getQueryData(t)??n,o=0,s=!1,c=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){J(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await He(e,{limit:20,before:n},i);J(r.transport,r.runtimeGeneration);let c=l.getQueryData(t)??a;if(o.generation!==c.generation){a=c;break}let f=!u||!!(c.hasMessageGap&&c.gapRequestIDs&&c.gapRequestIDs.length===u.length&&c.gapRequestIDs.every((e,t)=>e===u[t]));if(a=Oe(c,o,u?{requestIDs:u,cursor:d}:void 0),l.setQueryData(t,a),!f)break;if(!a.hasMessageGap){s=!0;break}if(a.gapCursor&&a.gapCursor!==n)s=!0;else break}catch(e){if(i?.aborted||v(e))break;c=!0,a=l.getQueryData(t)??a;break}}return{view:l.getQueryData(t)??a,failed:c,progressed:s}})();We.set(a,s);try{return await s}finally{We.get(a)===s&&We.delete(a)}},Ke=(e,r=t(),i=n(),a={})=>({queryKey:G.contact(e,r,i),queryFn:async({signal:t})=>{J(r,i),await p(),J(r,i);let n=G.contact(e,r,i),a=l.getQueryData(n),o=await He(e,{limit:20},t);J(r,i);let s=Ee(l.getQueryData(n)??a??null,o);l.setQueryData(n,s);let c=Q(n);if(s.hasMessageGap&&s.gapCursor){Z.delete(c);let a=await Ge(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&Z.set(c,a.view.gapCursor)}else Z.delete(c);J(r,i);let u=l.getQueryData(n)??s;return a&&Ue(a,u)?a:u},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Pe(l.getQueryData(G.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),qe=(e,r=!0)=>{let i=t(),a=n(),[o,u]=h.useState(!1),[d,f]=h.useState(null),[p,m]=h.useState(!1),g=h.useRef(null),_=h.useRef(null),y=h.useRef(null),b=h.useRef(null),x=h.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=s({...Ke(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});h.useEffect(()=>{!r||!e||l.invalidateQueries({queryKey:G.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),h.useEffect(()=>c(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||l.invalidateQueries({queryKey:G.contact(e,i,a),exact:!0}))}),[e,a,i]),h.useEffect(()=>{let t=Q(G.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,g.current=null,_.current=null,Z.delete(t)}},[e,i,a,r]);let C=S.data,w=G.contact(e,i,a),T=async()=>{if(!e||!r)return;if(g.current)return g.current;let t=l.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;f(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},s=(async()=>{try{J(o.transport,o.runtimeGeneration);let e=await He(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(J(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=l.getQueryData(w)??t;if(e.generation!==r.generation)return;l.setQueryData(w,De(r,e))}catch(e){if(n.signal.aborted||v(e))return;let t=e instanceof Error?e:Error(String(e));throw f(t),t}finally{b.current===n&&(b.current=null),u(!1),g.current=null}})();return g.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(_.current)return _.current;let n=l.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&Z.get(o)===n.gapCursor)return;t===`explicit`&&Z.delete(o),m(!0);let s=new AbortController;y.current?.abort(),y.current=s;let c={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{J(c.transport,c.runtimeGeneration);let e=await Ge(c.assistantID,w,n,{transport:c.transport,runtimeGeneration:c.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(J(c.transport,c.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&Z.set(o,e.view.gapCursor);return}e.view.hasMessageGap||Z.delete(o)}catch(e){if(s.signal.aborted||v(e))return;throw Z.set(o,c.cursor),e}finally{y.current===s&&(y.current=null),m(!1),_.current=null}})();return _.current=u,u};return h.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||p)return;let t=Q(w);Z.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,p,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:o,previousPageError:d,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:p,retryMessageGap:()=>E(`explicit`)}},Je=async(e,r)=>{let i=t(),a=n();await p(),J(i,a);let o=await He(e,{messageID:r,limit:1});if(J(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;l.invalidateQueries({queryKey:G.contact(e,i,a),exact:!0}),l.invalidateQueries({queryKey:G.snapshot(i),exact:!0});let s=l.getQueryData(G.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ye=(e,r=t(),i=n())=>({queryKey:G.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{J(r,i);let n=ee(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return J(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof _&&t.status===404)&&e<2}),Xe=(e,r)=>{let i=(0,g.c)(6),a=r===void 0||r,o,c;if(i[0]!==e){let r=t(),a=n();c=s,o=Ye(e,r,a),i[0]=e,i[1]=o,i[2]=c}else o=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==o||i[4]!==l?(u={...o,enabled:l},i[3]=o,i[4]=l,i[5]=u):u=i[5],c(u)},Ze=(e=t())=>({queryKey:G.globalScheduledTasks(e),queryFn:ce,refetchOnMount:`always`}),Qe=e=>{let t=(0,g.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Ze(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),s(i)},$e=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),et=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Ze(i),select:$e,staleTime:0,refetchInterval:yt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>c(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&l.invalidateQueries({queryKey:Ze(i).queryKey,exact:!0})}),u=[i],e[3]=o,e[4]=u):(o=e[3],u=e[4]),h.useEffect(o,u),a.data===!0},tt=(e,r=t())=>{l.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},nt=(e=t())=>({queryKey:G.capability(e),queryFn:()=>gt(),retry:!1}),rt=()=>{let e=(0,g.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=nt(),e[0]=t):t=e[0],s(t)},it=(e=l,n=t())=>e.getQueryData(G.snapshot(n)),at=(e=l,n=t())=>e.fetchQuery(Y(n)),ot=async(e=l)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:G.snapshot(r),exact:!0}),J(r,i);let a=await e.fetchQuery(Y(r));return J(r,i),a},st=15e3,ct=e=>{throw e instanceof _?e:v(e)?new _(`admission_timeout`,408):e},lt=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(st);try{let t=R(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...q(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return J(a,o),ke(e,t.binding,a),tt(e,a),t}catch(e){return ct(e)}},ut=async(e,r,i,a,o)=>{let s=t(),c=n(),l=z(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,q(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return J(s,c),l},dt=async(e,r=t(),i=n())=>{J(r,i);let a=z(await K(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return J(r,i),a},ft=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)J(r,i),await new Promise(e=>setTimeout(e,750)),a=await dt(a.operationID,r,i);if(J(r,i),a.state===`completed`)return a;throw a.state===`failed`?new y(a.errorCode??`share_failed`,400,a):new y(`share_unresolved`,408,a)},pt=async e=>{let n=t(),r=F(await K(`/api/yuri/assistants`,q(`POST`,{...e,language:u.getState().locale})));return Ae(r,n),r},mt=async(e,r)=>{let i=t(),a=n(),o=F(await K(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,q(`PATCH`,{...r,expectedRevision:e.revision})));return J(i,a),r.pinned===void 0?Ae(o,i):(await l.cancelQueries({queryKey:G.snapshot(i),exact:!0}),J(i,a),await l.fetchQuery(Y(i)),J(i,a)),o},ht=async e=>{await K(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,q(`DELETE`,{expectedRevision:e.revision})),await l.invalidateQueries({queryKey:G.snapshot(t())})},gt=async()=>O(await K(`/api/yuri/assistants/capability`)),_t=async(e,r)=>{let i=t(),a=n(),o=M(r);try{let t=P(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...q(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(J(i,a),t.assistantID!==e)throw new _(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&l.invalidateQueries({queryKey:G.snapshot(i),exact:!0})}},vt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(J(i,a),_t(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function yt(e){return e.state.data&&$e(e.state.data)?2500:15e3}var $=i();function bt(e){let t=(0,g.c)(34),{title:n,className:r,subtitle:i,backAriaLabel:a,onBack:o,backDisabled:s,actions:c,trailing:l,sticky:u,overlay:p,elevated:h,collapsible:_}=e,v=s!==void 0&&s,y;t[0]===c?y=t[1]:(y=c===void 0?[]:c,t[0]=c,t[1]=y);let b=y,x=u!==void 0&&u,S=p!==void 0&&p,C=h!==void 0&&h,w=_!==void 0&&_,T=Array.isArray(l)?l.filter(Boolean).length:+!!l,E=C||b.some(St),D=w?`true`:void 0,O=x&&`yuri-mobile-detail-navigation-sticky`,k=S&&`absolute inset-x-0 top-0`,A=E?`z-[60]`:S?`z-30`:void 0,j;t[2]!==r||t[3]!==k||t[4]!==A||t[5]!==O?(j=f(`yuri-mobile-detail-navigation relative shrink-0 pt-[max(0.25rem,var(--yuri-safe-area-top,0px))]`,O,k,A,r),t[2]=r,t[3]=k,t[4]=A,t[5]=O,t[6]=j):j=t[6];let M=b.length+T>1?`grid-cols-[2.75rem_minmax(0,1fr)_auto]`:`grid-cols-[2.75rem_minmax(0,1fr)_2.75rem]`,N;t[7]===M?N=t[8]:(N=f(`yuri-mobile-detail-navigation-content grid items-center gap-1 px-4`,M),t[7]=M,t[8]=N);let P;t[9]!==a||t[10]!==v||t[11]!==o?(P=o?(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`justify-self-start`,onClick:o,disabled:v,"aria-label":a,children:(0,$.jsx)(m,{name:`arrow-left-s`,className:`size-5`})}):(0,$.jsx)(`span`,{"aria-hidden":`true`}),t[9]=a,t[10]=v,t[11]=o,t[12]=P):P=t[12];let F;t[13]===n?F=t[14]:(F=(0,$.jsx)(`div`,{className:`yuri-mobile-detail-title w-full truncate typography-ui-label font-medium text-foreground`,children:n}),t[13]=n,t[14]=F);let I;t[15]===i?I=t[16]:(I=i?(0,$.jsx)(`div`,{className:`yuri-mobile-detail-subtitle w-full truncate text-muted-foreground`,"aria-live":`polite`,children:i}):null,t[15]=i,t[16]=I);let L;t[17]!==F||t[18]!==I?(L=(0,$.jsxs)(`div`,{className:`flex w-full max-w-72 min-w-0 flex-col items-center justify-center justify-self-center px-1`,children:[F,I]}),t[17]=F,t[18]=I,t[19]=L):L=t[19];let R;t[20]===b?R=t[21]:(R=b.map(xt),t[20]=b,t[21]=R);let z;t[22]!==R||t[23]!==l?(z=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[l,R]}),t[22]=R,t[23]=l,t[24]=z):z=t[24];let B;t[25]!==N||t[26]!==P||t[27]!==L||t[28]!==z?(B=(0,$.jsxs)(`div`,{className:N,children:[P,L,z]}),t[25]=N,t[26]=P,t[27]=L,t[28]=z,t[29]=B):B=t[29];let V;return t[30]!==j||t[31]!==B||t[32]!==D?(V=(0,$.jsx)(`header`,{"data-yuri-collapsible-header":D,className:j,children:B}),t[30]=j,t[31]=B,t[32]=D,t[33]=V):V=t[33],V}function xt(e,t){return(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:f(e.elevated&&`relative z-[60]`),onClick:e.onClick,disabled:e.disabled,"aria-label":e.ariaLabel,"aria-expanded":e.pressed,title:e.title,children:(0,$.jsx)(m,{name:e.icon,className:`size-5`})},`${e.icon}:${t}`)}function St(e){return e.elevated}export{le as A,ft as C,ce as D,ue as E,y as M,v as N,se as O,et as S,pe as T,Xe as _,ht as a,Be as b,ot as c,it as d,lt as f,qe as g,rt as h,pt as i,_ as j,de as k,vt as l,mt as m,Ke as n,at as o,ut as p,Je as r,gt as s,bt as t,_t as u,Ie as v,me as w,Qe as x,Re as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{ot as i,st as a}from"./vendor-base-ui-fom6orB6.js";import{n as o}from"./vendor-react-D5BntRmA.js";import{s}from"./vendor-tanstack-react-query-ChSd65dm.js";import{L as c,q as l}from"./runtime-file-resource-CKQQEwNv.js";import{i as u}from"./store-Dj5cSf8B.js";import{In as d,Rn as f,to as p}from"./useMobileNavigationStore-CWShXc31.js";import{n as m}from"./Icon-DSX7wjSw.js";var h=e(a(),1),g=o(),_=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},v=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},y=class extends _{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},b=(e,t=200)=>{throw new _(`invalid_${e}_response`,t,e)},x=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:b(t),S=(e,t)=>typeof e==`string`?e:b(t),C=(e,t)=>e===null||typeof e==`string`?e:b(t),w=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:b(t),T=(e,t)=>e===null?null:w(e,t),E=(e,t)=>typeof e==`boolean`?e:b(t),D=(e,t,n)=>t.includes(e)?e:b(n),O=e=>{let t=x(e,`capability`);return{supported:E(t.supported,`capability`),enabled:E(t.enabled,`capability`),revision:w(t.revision,`capability`),serverInstanceID:C(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&E(t.sharingAvailable,`capability`)}},k=e=>{if(e==null)return null;let t=x(e,`assistant`);return{turnID:S(t.turnID,`assistant`),messageID:S(t.messageID,`assistant`),status:D(t.status,[`queued`,`running`],`assistant`),admittedAt:w(t.admittedAt,`assistant`)}},A=e=>{if(e==null)return null;let t=x(e,`assistant_preview`),n=w(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?b(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:w(t.createdAt,`assistant_preview`)},messageID:S(t.messageID,`assistant_preview`),ordinal:n,role:D(t.role,[`user`,`assistant`],`assistant_preview`),text:S(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:D(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},j=e=>{let t=w(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:b(`assistant_read`)},M=e=>{let t=x(e,`assistant_read`);return{generation:j(t.generation),ordinal:j(t.ordinal),messageID:S(t.messageID,`assistant_read`)}},N=e=>({unreadCount:e.unreadCount===void 0?0:j(e.unreadCount),readWatermark:e.readWatermark==null?null:M(e.readWatermark),readTip:e.readTip==null?null:M(e.readTip)}),P=e=>{let t=x(e,`assistant_read`);return{assistantID:S(t.assistantID,`assistant_read`),changed:E(t.changed,`assistant_read`),unreadCount:j(t.unreadCount),readWatermark:M(t.readWatermark),readTip:M(t.readTip),revision:j(t.revision)}},F=e=>{let t=x(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>S(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:w(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return b(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>S(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:k(t.activeContactTurn),o=t.working===void 0?a!=null:E(t.working,`assistant`);return{...N(t),pinnedAt:t.pinnedAt===void 0?void 0:T(t.pinnedAt,`assistant`),latestMessagePreview:A(t.latestMessagePreview),id:S(t.id,`assistant`),avatarSeed:S(t.avatarSeed??t.id,`assistant`),revision:w(t.revision,`assistant`),enabled:E(t.enabled,`assistant`),name:S(t.name,`assistant`),defaultPrompt:S(t.defaultPrompt,`assistant`),workspacePath:C(t.workspacePath,`assistant`),effectiveWorkspacePath:S(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:C(t.managedWorkspacePath??null,`assistant`),providerID:S(t.providerID,`assistant`),modelID:S(t.modelID,`assistant`),agent:C(t.agent,`assistant`),variant:C(t.variant??null,`assistant`),mode:D(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:C(t.sessionID,`assistant`),sessionGeneration:w(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:T(t.createdAt,`assistant`),updatedAt:w(t.updatedAt,`assistant`),tombstoneAt:T(t.tombstoneAt,`assistant`)}},I=e=>{let t=x(e,`snapshot`);return{revision:w(t.revision,`snapshot`),enabled:E(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(F):b(`snapshot`)}},L=e=>{let t=x(e,`binding`);return{sessionID:C(t.sessionID,`binding`),directory:S(t.directory,`binding`),sessionGeneration:w(t.sessionGeneration,`binding`)}},R=e=>{let t=x(e,`message_admission`);if(t.admitted!==!0)return b(`message_admission`);let n=t.revision===void 0||t.revision===null?null:w(t.revision,`message_admission`);return{binding:L(t.binding),messageID:S(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},z=e=>{let t=x(e,`share_operation`);return{operationID:S(t.operationID,`share_operation`),assistantID:S(t.assistantID,`share_operation`),sessionID:C(t.sessionID,`share_operation`),messageID:C(t.messageID,`share_operation`),state:D(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:S(t.phase,`share_operation`),attempt:w(t.attempt,`share_operation`),leaseExpiresAt:T(t.leaseExpiresAt,`share_operation`),errorCode:C(t.errorCode,`share_operation`)}},B=e=>{let t=x(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:S(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:S(t.filename,`assistant_contact_part`),n=S(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return b(`assistant_contact_part`);if(i){let r=w(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?b(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:S(t.attachmentID,`assistant_contact_part`),sha256:S(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:S(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:b(`assistant_contact_part`)}if(t.type===`card`){let e=D(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=x(t.target,`assistant_contact_part`),r=e=>{let t=S(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?b(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:S(t.sessionID,`assistant_contact_part`),directory:S(t.directory,`assistant_contact_part`),title:C(t.title??null,`assistant_contact_part`),status:C(t.status??null,`assistant_contact_part`),branch:C(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:S(t.assistantID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),providerID:S(t.providerID,`assistant_contact_part`),modelID:S(t.modelID,`assistant_contact_part`),mode:D(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:S(t.taskID,`assistant_contact_part`),projectID:S(t.projectID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),kind:C(t.kind??null,`assistant_contact_part`),time:C(t.time??null,`assistant_contact_part`),timezone:C(t.timezone??null,`assistant_contact_part`),prompt:C(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:C(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:C(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>S(e,`assistant_contact_part`)):b(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=w(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:b(`assistant_contact_part`)}):b(`assistant_contact_part`)}}}return b(`assistant_contact_part`)},V=e=>{let t=x(e,`assistant_contact`),n=C(t.nextCursor,`assistant_contact`),r=E(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return b(`assistant_contact`);let i=w(t.generation,`assistant_contact`),a=w(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?b(`assistant_contact`):{messages:t.messages.map(e=>{let t=x(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return b(`assistant_contact_message`);let n=t.parts.map(B);return{messageID:S(t.messageID,`assistant_contact_message`),assistantID:S(t.assistantID,`assistant_contact_message`),role:D(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:S(t.turnID,`assistant_contact_message`),bubbleIndex:w(t.bubbleIndex,`assistant_contact_message`),createdAt:w(t.createdAt,`assistant_contact_message`),ordinal:w(t.ordinal,`assistant_contact_message`),status:S(t.status,`assistant_contact_message`),fromAssistantID:C(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:C(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},ee=e=>{let t=x(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=x(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:x(t.task,`assistant_scheduled_task_live`);return{assistantID:S(t.assistantID,`assistant_scheduled_task`),projectID:S(t.projectID,`assistant_scheduled_task`),taskID:S(t.taskID,`assistant_scheduled_task`),createdAt:w(t.createdAt,`assistant_scheduled_task`),projectPath:C(t.projectPath??null,`assistant_scheduled_task`),projectLabel:C(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:b(`assistant_scheduled_tasks`)},H=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},U=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},te=e=>e===null||typeof e==`string`,ne=e=>e===null||typeof e==`number`&&Number.isFinite(e),re=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ie=e=>e===null||re(e),ae=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&te(t.sessionId)&&te(t.directory)&&te(t.error)&&re(t.startedAt)&&ie(t.finishedAt)&&ne(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},oe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(ae)||!te(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},se=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await H(a,`Failed to load scheduled task history`));return oe(await a.json().catch(()=>null))},ce=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await H(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},le=async(e,t)=>{let n=U(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await H(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ue=async(e,t)=>{let n=U(e),i=U(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await H(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},de=async(e,t)=>{let n=U(e),i=U(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await H(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},fe=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,pe=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},me=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(pe)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&fe({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},he=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),ge=e=>!!(e&&e.generation>=0),_e=(e,t)=>fe({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),W=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(_e)},ve=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},ye=e=>e.map(e=>e.messageID),be=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},xe=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),we=e=>({ordinal:e.ordinal,messageID:e.messageID}),Te=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>fe(we(e),we(r))<0),...t]},Ee=(e,t)=>{let n=e??he(),r=ge(n),i=[...t.messages].sort(_e),a=ye(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=Te(n.messages,i,t.complete);else{let e=ve(i);c=W(n.messages.filter(t=>t.ordinal<e),W(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=xe(a),d=l.length>0&&be(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},De=(e,t)=>{if(!ge(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=W(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},Oe=(e,t,n)=>{if(!ge(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=W(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=ye(t.messages),c=e.gapTargetIDs??[],l=xe(c);return c.length>0&&be(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},G={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},K=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new _(e,n.status,void 0,t)}return i},q=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),J=(e,r)=>{if(t()!==e||n()!==r)throw new _(`runtime_stale`,409)},ke=(e,t,r)=>{l.setQueryData(G.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),l.invalidateQueries({queryKey:G.snapshot(r)}),l.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},Ae=(e,t)=>{l.setQueryData(G.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),l.invalidateQueries({queryKey:G.snapshot(t)})},je=2500,Me=15e3,Ne=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Pe=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?je:Me}return Ne(e)?je:Me},Y=(e=t())=>({queryKey:G.snapshot(e),queryFn:async({signal:e})=>I(await K(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Pe(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),X=new Map,Fe=e=>{let r=X.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,s=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,l.getQueryCache().find({queryKey:G.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await l.invalidateQueries({queryKey:G.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&s())}finally{a=!1}}},d=c(t=>{if(!s())return;let n=l.getQueryData(G.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});X.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=X.get(e);t&&--t.count===0&&(t.dispose(),X.delete(e))}},Ie=e=>{let n=(0,g.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=s,r=Y(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let o;n[3]===e?o=n[4]:(o={...r,select:e},n[3]=e,n[4]=o);let c=i(o),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Fe(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),h.useEffect(l,u),c},Le=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Re=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Y(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Fe(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??0},ze=e=>e.enabled&&Ne(e),Be=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Y(i),select:ze},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Fe(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??!1},Ve=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},He=async(e,t,n)=>V(await K(Ve(e,t),n?{signal:n}:{})),Ue=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,Z=new Map,We=new Map,Q=e=>e.join(``),Ge=async(e,t,n,r,i)=>{let a=Q(t),o=We.get(a);if(o)return o;let s=(async()=>{let a=l.getQueryData(t)??n,o=0,s=!1,c=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){J(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await He(e,{limit:20,before:n},i);J(r.transport,r.runtimeGeneration);let c=l.getQueryData(t)??a;if(o.generation!==c.generation){a=c;break}let f=!u||!!(c.hasMessageGap&&c.gapRequestIDs&&c.gapRequestIDs.length===u.length&&c.gapRequestIDs.every((e,t)=>e===u[t]));if(a=Oe(c,o,u?{requestIDs:u,cursor:d}:void 0),l.setQueryData(t,a),!f)break;if(!a.hasMessageGap){s=!0;break}if(a.gapCursor&&a.gapCursor!==n)s=!0;else break}catch(e){if(i?.aborted||v(e))break;c=!0,a=l.getQueryData(t)??a;break}}return{view:l.getQueryData(t)??a,failed:c,progressed:s}})();We.set(a,s);try{return await s}finally{We.get(a)===s&&We.delete(a)}},Ke=(e,r=t(),i=n(),a={})=>({queryKey:G.contact(e,r,i),queryFn:async({signal:t})=>{J(r,i),await p(),J(r,i);let n=G.contact(e,r,i),a=l.getQueryData(n),o=await He(e,{limit:20},t);J(r,i);let s=Ee(l.getQueryData(n)??a??null,o);l.setQueryData(n,s);let c=Q(n);if(s.hasMessageGap&&s.gapCursor){Z.delete(c);let a=await Ge(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&Z.set(c,a.view.gapCursor)}else Z.delete(c);J(r,i);let u=l.getQueryData(n)??s;return a&&Ue(a,u)?a:u},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Pe(l.getQueryData(G.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),qe=(e,r=!0)=>{let i=t(),a=n(),[o,u]=h.useState(!1),[d,f]=h.useState(null),[p,m]=h.useState(!1),g=h.useRef(null),_=h.useRef(null),y=h.useRef(null),b=h.useRef(null),x=h.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=s({...Ke(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});h.useEffect(()=>{!r||!e||l.invalidateQueries({queryKey:G.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),h.useEffect(()=>c(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||l.invalidateQueries({queryKey:G.contact(e,i,a),exact:!0}))}),[e,a,i]),h.useEffect(()=>{let t=Q(G.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,g.current=null,_.current=null,Z.delete(t)}},[e,i,a,r]);let C=S.data,w=G.contact(e,i,a),T=async()=>{if(!e||!r)return;if(g.current)return g.current;let t=l.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;f(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},s=(async()=>{try{J(o.transport,o.runtimeGeneration);let e=await He(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(J(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=l.getQueryData(w)??t;if(e.generation!==r.generation)return;l.setQueryData(w,De(r,e))}catch(e){if(n.signal.aborted||v(e))return;let t=e instanceof Error?e:Error(String(e));throw f(t),t}finally{b.current===n&&(b.current=null),u(!1),g.current=null}})();return g.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(_.current)return _.current;let n=l.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&Z.get(o)===n.gapCursor)return;t===`explicit`&&Z.delete(o),m(!0);let s=new AbortController;y.current?.abort(),y.current=s;let c={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{J(c.transport,c.runtimeGeneration);let e=await Ge(c.assistantID,w,n,{transport:c.transport,runtimeGeneration:c.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(J(c.transport,c.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&Z.set(o,e.view.gapCursor);return}e.view.hasMessageGap||Z.delete(o)}catch(e){if(s.signal.aborted||v(e))return;throw Z.set(o,c.cursor),e}finally{y.current===s&&(y.current=null),m(!1),_.current=null}})();return _.current=u,u};return h.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||p)return;let t=Q(w);Z.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,p,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:o,previousPageError:d,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:p,retryMessageGap:()=>E(`explicit`)}},Je=async(e,r)=>{let i=t(),a=n();await p(),J(i,a);let o=await He(e,{messageID:r,limit:1});if(J(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;l.invalidateQueries({queryKey:G.contact(e,i,a),exact:!0}),l.invalidateQueries({queryKey:G.snapshot(i),exact:!0});let s=l.getQueryData(G.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ye=(e,r=t(),i=n())=>({queryKey:G.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{J(r,i);let n=ee(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return J(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof _&&t.status===404)&&e<2}),Xe=(e,r)=>{let i=(0,g.c)(6),a=r===void 0||r,o,c;if(i[0]!==e){let r=t(),a=n();c=s,o=Ye(e,r,a),i[0]=e,i[1]=o,i[2]=c}else o=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==o||i[4]!==l?(u={...o,enabled:l},i[3]=o,i[4]=l,i[5]=u):u=i[5],c(u)},Ze=(e=t())=>({queryKey:G.globalScheduledTasks(e),queryFn:ce,refetchOnMount:`always`}),Qe=e=>{let t=(0,g.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Ze(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),s(i)},$e=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),et=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Ze(i),select:$e,staleTime:0,refetchInterval:yt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>c(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&l.invalidateQueries({queryKey:Ze(i).queryKey,exact:!0})}),u=[i],e[3]=o,e[4]=u):(o=e[3],u=e[4]),h.useEffect(o,u),a.data===!0},tt=(e,r=t())=>{l.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},nt=(e=t())=>({queryKey:G.capability(e),queryFn:()=>gt(),retry:!1}),rt=()=>{let e=(0,g.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=nt(),e[0]=t):t=e[0],s(t)},it=(e=l,n=t())=>e.getQueryData(G.snapshot(n)),at=(e=l,n=t())=>e.fetchQuery(Y(n)),ot=async(e=l)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:G.snapshot(r),exact:!0}),J(r,i);let a=await e.fetchQuery(Y(r));return J(r,i),a},st=15e3,ct=e=>{throw e instanceof _?e:v(e)?new _(`admission_timeout`,408):e},lt=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(st);try{let t=R(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...q(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return J(a,o),ke(e,t.binding,a),tt(e,a),t}catch(e){return ct(e)}},ut=async(e,r,i,a,o)=>{let s=t(),c=n(),l=z(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,q(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return J(s,c),l},dt=async(e,r=t(),i=n())=>{J(r,i);let a=z(await K(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return J(r,i),a},ft=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)J(r,i),await new Promise(e=>setTimeout(e,750)),a=await dt(a.operationID,r,i);if(J(r,i),a.state===`completed`)return a;throw a.state===`failed`?new y(a.errorCode??`share_failed`,400,a):new y(`share_unresolved`,408,a)},pt=async e=>{let n=t(),r=F(await K(`/api/yuri/assistants`,q(`POST`,{...e,language:u.getState().locale})));return Ae(r,n),r},mt=async(e,r)=>{let i=t(),a=n(),o=F(await K(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,q(`PATCH`,{...r,expectedRevision:e.revision})));return J(i,a),r.pinned===void 0?Ae(o,i):(await l.cancelQueries({queryKey:G.snapshot(i),exact:!0}),J(i,a),await l.fetchQuery(Y(i)),J(i,a)),o},ht=async e=>{await K(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,q(`DELETE`,{expectedRevision:e.revision})),await l.invalidateQueries({queryKey:G.snapshot(t())})},gt=async()=>O(await K(`/api/yuri/assistants/capability`)),_t=async(e,r)=>{let i=t(),a=n(),o=M(r);try{let t=P(await K(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...q(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(J(i,a),t.assistantID!==e)throw new _(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&l.invalidateQueries({queryKey:G.snapshot(i),exact:!0})}},vt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(J(i,a),_t(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function yt(e){return e.state.data&&$e(e.state.data)?2500:15e3}var $=i();function bt(e){let t=(0,g.c)(34),{title:n,className:r,subtitle:i,backAriaLabel:a,onBack:o,backDisabled:s,actions:c,trailing:l,sticky:u,overlay:p,elevated:h,collapsible:_}=e,v=s!==void 0&&s,y;t[0]===c?y=t[1]:(y=c===void 0?[]:c,t[0]=c,t[1]=y);let b=y,x=u!==void 0&&u,S=p!==void 0&&p,C=h!==void 0&&h,w=_!==void 0&&_,T=Array.isArray(l)?l.filter(Boolean).length:+!!l,E=C||b.some(St),D=w?`true`:void 0,O=x&&`yuri-mobile-detail-navigation-sticky`,k=S&&`absolute inset-x-0 top-0`,A=E?`z-[60]`:S?`z-30`:void 0,j;t[2]!==r||t[3]!==k||t[4]!==A||t[5]!==O?(j=f(`yuri-mobile-detail-navigation relative shrink-0 pt-[max(0.25rem,var(--yuri-safe-area-top,0px))]`,O,k,A,r),t[2]=r,t[3]=k,t[4]=A,t[5]=O,t[6]=j):j=t[6];let M=b.length+T>1?`grid-cols-[2.75rem_minmax(0,1fr)_auto]`:`grid-cols-[2.75rem_minmax(0,1fr)_2.75rem]`,N;t[7]===M?N=t[8]:(N=f(`yuri-mobile-detail-navigation-content grid items-center gap-1 px-4`,M),t[7]=M,t[8]=N);let P;t[9]!==a||t[10]!==v||t[11]!==o?(P=o?(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`justify-self-start`,onClick:o,disabled:v,"aria-label":a,children:(0,$.jsx)(m,{name:`arrow-left-s`,className:`size-5`})}):(0,$.jsx)(`span`,{"aria-hidden":`true`}),t[9]=a,t[10]=v,t[11]=o,t[12]=P):P=t[12];let F;t[13]===n?F=t[14]:(F=(0,$.jsx)(`div`,{className:`yuri-mobile-detail-title w-full truncate typography-ui-label font-medium text-foreground`,children:n}),t[13]=n,t[14]=F);let I;t[15]===i?I=t[16]:(I=i?(0,$.jsx)(`div`,{className:`yuri-mobile-detail-subtitle w-full truncate text-muted-foreground`,"aria-live":`polite`,children:i}):null,t[15]=i,t[16]=I);let L;t[17]!==F||t[18]!==I?(L=(0,$.jsxs)(`div`,{className:`flex w-full max-w-72 min-w-0 flex-col items-center justify-center justify-self-center px-1`,children:[F,I]}),t[17]=F,t[18]=I,t[19]=L):L=t[19];let R;t[20]===b?R=t[21]:(R=b.map(xt),t[20]=b,t[21]=R);let z;t[22]!==R||t[23]!==l?(z=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[l,R]}),t[22]=R,t[23]=l,t[24]=z):z=t[24];let B;t[25]!==N||t[26]!==P||t[27]!==L||t[28]!==z?(B=(0,$.jsxs)(`div`,{className:N,children:[P,L,z]}),t[25]=N,t[26]=P,t[27]=L,t[28]=z,t[29]=B):B=t[29];let V;return t[30]!==j||t[31]!==B||t[32]!==D?(V=(0,$.jsx)(`header`,{"data-yuri-collapsible-header":D,className:j,children:B}),t[30]=j,t[31]=B,t[32]=D,t[33]=V):V=t[33],V}function xt(e,t){return(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:f(e.elevated&&`relative z-[60]`),onClick:e.onClick,disabled:e.disabled,"aria-label":e.ariaLabel,"aria-expanded":e.pressed,title:e.title,children:(0,$.jsx)(m,{name:e.icon,className:`size-5`})},`${e.icon}:${t}`)}function St(e){return e.elevated}export{le as A,ft as C,ce as D,ue as E,y as M,v as N,se as O,et as S,pe as T,Xe as _,ht as a,Be as b,ot as c,it as d,lt as f,qe as g,rt as h,pt as i,_ as j,de as k,vt as l,mt as m,Ke as n,at as o,ut as p,Je as r,gt as s,bt as t,_t as u,Ie as v,me as w,Qe as x,Re as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,ot as n,st as r}from"./vendor-base-ui-z2M4boRm.js";import{n as i}from"./vendor-react-P8wFrkcT.js";import{r as a}from"./vendor-reactuses-core-Dyjw5sZR.js";import{In as o,Rn as s}from"./useMobileNavigationStore-2N3dS8vX.js";import{a as c,c as l}from"./vendor-framer-motion-CF9BQLta.js";import{n as u}from"./Icon-DBOSvb4U.js";import{t as d}from"./MobileWindowStack-DGLdgoGr.js";var f=e(r(),1),p=i(),m=n(),h=e(t(),1),g=0,_=()=>{g=Date.now()+800},v=()=>Date.now()<g;function y(e){let t=(0,p.c)(9),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=s(`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,m.jsx)(`div`,{className:`pointer-events-none h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,m.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var b=100,x=.35;function S(e,t,n){let r=e.at(-1),i=e.at(-2);for(r&&i&&Math.abs(t-r.height)>2&&(t-r.height)*(r.height-i.height)<0&&e.splice(0,e.length-1),e.push({height:t,time:n});e.length>2&&(e.length>16||e[1].time<n-b);)e.shift()}function C(e,t){let n=e.at(-1);if(!n||t-n.time>=b)return 0;let r=e.find(e=>e.time>=t-b);return!r||n.time<=r.time?0:Math.max(-4,Math.min(4,(n.height-r.height)/Math.max(1,t-r.time)))}function w(e,t,n,r,i){let a=Math.abs(r)>=x&&Math.abs(i)>=8,o=n+(a?r*180:0),s=e.reduce((e,t)=>Math.abs(t.height-o)<Math.abs(e.height-o)?t:e),c=e.find(e=>e.id===t)??s;return!a||Math.abs(s.height-c.height)>1?s.id:[...e].sort((e,t)=>r>0?e.height-t.height:t.height-e.height).find(e=>r>0?e.height>c.height+1:e.height<c.height-1)?.id??s.id}function T(e,t,n){let r=e<t?t:e>n?n:e,i=e-r;return r+Math.sign(i)*48*(1-1/(1+Math.abs(i)*.55/48))}function E(e){let t=(0,p.c)(82),{surfaceRef:n,initialPoint:r,getPoints:i,minimumHeight:o,onRelease:s,onCommit:u,renderMode:d}=e,m=d===void 0?`height`:d,[h,g]=(0,f.useState)(r),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),x=(0,f.useRef)(r),E=(0,f.useRef)(null),A=(0,f.useRef)(null),j=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(!1),P=(0,f.useRef)(null),F;t[0]===n?F=t[1]:(F=()=>{let e=n.current;if(!e)return 0;if(!P.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return P.current.layoutHeight-t},t[0]=n,t[1]=F);let I=a(F),L;t[2]===n?L=t[3]:(L=e=>{let t=n.current;t&&(P.current?t.style.translate=`0 ${P.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=L);let R=a(L),z;t[4]!==m||t[5]!==n||t[6]!==R?(z=(e,t)=>{let r=n.current;if(r){if(m===`translate`&&!P.current){let e=Math.max(...t.map(k))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;P.current={layoutHeight:e,styles:{maxHeight:n,position:i,bottom:a,left:o,right:s}},Object.assign(r.style,{position:`absolute`,bottom:`0px`,left:`0px`,right:`0px`}),r.style.maxHeight=`none`,r.style.height=`${e}px`}r.setAttribute(`data-height-snap-active`,``),r.style.willChange=P.current?`translate`:`height`,R(e)}},t[4]=m,t[5]=n,t[6]=R,t[7]=z):z=t[7];let B=a(z),V;t[8]===n?V=t[9]:(V=()=>{let e=n.current;e&&(P.current&&(e.style.translate=``,Object.assign(e.style,P.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),P.current=null},t[8]=n,t[9]=V);let H=a(V),ae;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{A.current!==null&&cancelAnimationFrame(A.current),A.current=null,j.current=null,M.current?.cancel(),M.current=null},t[10]=ae):ae=t[10];let U=a(ae),W;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=E.current;E.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=W):W=t[11];let G=a(W),oe;t[12]!==U||t[13]!==H||t[14]!==i||t[15]!==u||t[16]!==B||t[17]!==I||t[18]!==G||t[19]!==n||t[20]!==R?(oe=(e,t,r,a)=>{let o=r===void 0||r,s=a===void 0?0:a,d=n.current;if(!d)return;let f=t??I();U(),R(f);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(B(f,p),G(),v(!1),b(!1),x.current=e,g(e),R(m.height),u?.(e),!o||Math.abs(f-m.height)<1||typeof d.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){H();return}b(!0);let h=P.current?.layoutHeight,_=m.height-f,y=c([d],h===void 0?{height:[`${f}px`,`${m.height}px`]}:{translate:[`0 ${h-f}px`,`0 ${h-m.height}px`]},{type:l,stiffness:576,damping:48,mass:1,velocity:s*1e3*100/_,restDelta:20/Math.abs(_),restSpeed:500/Math.abs(_)});M.current=y,y.finished.catch(ie).then(()=>{M.current===y&&(M.current=null,H(),b(!1))})},t[12]=U,t[13]=H,t[14]=i,t[15]=u,t[16]=B,t[17]=I,t[18]=G,t[19]=n,t[20]=R,t[21]=oe):oe=t[21];let K=a(oe),se;t[22]!==U||t[23]!==i||t[24]!==o||t[25]!==B||t[26]!==I||t[27]!==n||t[28]!==R?(se=e=>{if(E.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=I();U(),R(t);let r=i();r.length&&(b(!1),E.current={pointerId:e.pointerId,startY:e.clientY,height:t,point:x.current,points:r,handle:e.currentTarget,minimum:o??Math.min(...r.map(re)),maximum:Math.max(...r.map(O)),samples:[{height:t,time:e.timeStamp}]},N.current=!1,B(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=U,t[23]=i,t[24]=o,t[25]=B,t[26]=I,t[27]=n,t[28]=R,t[29]=se):se=t[29];let ce=a(se),le;t[30]!==m||t[31]!==R?(le=e=>{let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(N.current=!0),S(t.samples,t.height+n,e.timeStamp);let r=T(t.height+n,t.minimum,t.maximum);j.current=m===`height`?Math.max(t.minimum,r):r,A.current===null&&(A.current=requestAnimationFrame(()=>{A.current=null,j.current!==null&&R(j.current)})),e.preventDefault()},t[30]=m,t[31]=R,t[32]=le):le=t[32];let ue=a(le),de;t[33]!==U||t[34]!==s||t[35]!==I||t[36]!==G||t[37]!==K||t[38]!==n?(de=(e,t)=>{let r=E.current;if(!r||r.pointerId!==e.pointerId)return;let i=j.current??I(),a=r.height+r.startY-e.clientY;t||S(r.samples,a,e.timeStamp);let o=t?0:C(r.samples,e.timeStamp);if(G(),!t&&N.current&&s?.(i,o,r.height))U(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!N.current?r.point:w(r.points,r.point,i,o,a-r.height);K(e,i,!0,o)}e.preventDefault()},t[33]=U,t[34]=s,t[35]=I,t[36]=G,t[37]=K,t[38]=n,t[39]=de):de=t[39];let q=a(de),fe;t[40]!==i||t[41]!==K?(fe=e=>{let t=[...i()].sort(ne),n=t.find(e=>e.id===x.current);if(!n)return;let r=e>0?t.find(e=>e.height>n.height+1):t.sort(D).find(e=>e.height<n.height-1);r&&K(r.id)},t[40]=i,t[41]=K,t[42]=fe):fe=t[42];let J=a(fe),pe;t[43]!==i||t[44]!==K||t[45]!==J?(pe=()=>{if(N.current){N.current=!1;return}let e=[...i()].sort(te);x.current===e.at(-1)?.id?K(e[0].id):J(1)},t[43]=i,t[44]=K,t[45]=J,t[46]=pe):pe=t[46];let me=a(pe),Y;t[47]!==i||t[48]!==me||t[49]!==K||t[50]!==J?(Y=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(ee);t.length&&(e.key===`ArrowUp`?J(1):e.key===`ArrowDown`?J(-1):e.key===`Home`?K(t.at(-1).id):e.key===`End`?K(t[0].id):me())},t[47]=i,t[48]=me,t[49]=K,t[50]=J,t[51]=Y):Y=t[51];let X=a(Y),he;t[52]!==U||t[53]!==H||t[54]!==r||t[55]!==G||t[56]!==n?(he=()=>{U(),G(),H(),x.current=r,g(r),v(!1),b(!1),N.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=U,t[53]=H,t[54]=r,t[55]=G,t[56]=n,t[57]=he):he=t[57];let Z=a(he),Q,ge;t[58]!==U||t[59]!==H||t[60]!==G?(Q=()=>()=>{U(),G(),H()},ge=[U,G,H],t[58]=U,t[59]=H,t[60]=G,t[61]=Q,t[62]=ge):(Q=t[61],ge=t[62]),(0,f.useLayoutEffect)(Q,ge);let $;t[63]===q?$=t[64]:($=e=>q(e,!1),t[63]=q,t[64]=$);let _e=a($),ve;t[65]===q?ve=t[66]:(ve=e=>q(e,!0),t[65]=q,t[66]=ve);let ye=a(ve),be;t[67]===q?be=t[68]:(be=e=>q(e,!0),t[67]=q,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==me||t[71]!==X||t[72]!==ce||t[73]!==ue||t[74]!==Z||t[75]!==K||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:K,reset:Z,handlePointerDown:ce,handlePointerMove:ue,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:me,handleKeyDown:X},t[69]=_,t[70]=me,t[71]=X,t[72]=ce,t[73]=ue,t[74]=Z,t[75]=K,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function ee(e,t){return e.height-t.height}function te(e,t){return e.height-t.height}function D(e,t){return t.height-e.height}function ne(e,t){return e.height-t.height}function O(e){return e.height}function re(e){return e.height}function ie(){}function k(e){return e.height}var A=.72,j=.98,M=64,N=()=>Math.max(1,window.innerHeight),P=(e,t)=>{let n=Math.max(1,e)*A;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},F=e=>{let t=(0,p.c)(20),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{initialSnapPoint:r,fitContent:i,onDismiss:o,dismissThresholdPx:s}=n,c=r===void 0?A:r,l=i!==void 0&&i,u=s===void 0?M:s,d=f.useRef(null),m=f.useRef(null),h=f.useRef(c),g=o?0:void 0,_;t[2]===l?_=t[3]:(_=()=>{let e=N(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(m.current=P(e,d.current.getBoundingClientRect().height)),[{id:A,height:Math.min(t,P(e,l?m.current:void 0))},{id:j,height:Math.min(t,e*j)}]},t[2]=l,t[3]=_);let v;t[4]!==u||t[5]!==l||t[6]!==o?(v=(e,t,n)=>{let r=d.current?.parentElement?.clientHeight||N(),i=Math.min(r,P(N(),l?m.current:void 0)),a=t<-.55&&n<=i+1&&e<i-8;return!o||!a&&e>i-u?!1:(o(),!0)},t[4]=u,t[5]=l,t[6]=o,t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{h.current=e},t[8]=y):y=t[8];let b;t[9]!==c||t[10]!==g||t[11]!==_||t[12]!==v?(b={surfaceRef:d,initialPoint:c,renderMode:`translate`,minimumHeight:g,getPoints:_,onRelease:v,onCommit:y},t[9]=c,t[10]=g,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x=E(b),S;t[14]!==x||t[15]!==c?(S=()=>{m.current=null,h.current=c,x.reset()},t[14]=x,t[15]=c,t[16]=S):S=t[16];let C=a(S),w;return t[17]!==x||t[18]!==C?(w={...x,surfaceRef:d,reset:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w},I=e=>{let t=(0,p.c)(13),{controller:n,ariaLabel:r,compact:i}=e,a=i!==void 0&&i,o;t[0]===n.snapPoint?o=t[1]:(o=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=o);let s=`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)] ${a?`min-h-4 pt-1`:`min-h-8 pt-2.5`}`,c;return t[2]!==r||t[3]!==n.handleClick||t[4]!==n.handleKeyDown||t[5]!==n.handleLostPointerCapture||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==o||t[11]!==s?(c=(0,m.jsx)(y,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":A*100,"aria-valuemax":j*100,"aria-valuenow":o,className:s,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onLostPointerCapture:n.handleLostPointerCapture,onClick:n.handleClick,onKeyDown:n.handleKeyDown}),t[2]=r,t[3]=n.handleClick,t[4]=n.handleKeyDown,t[5]=n.handleLostPointerCapture,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=o,t[11]=s,t[12]=c):c=t[12],c},L=new WeakMap;function R(e){L.set(e.currentTarget,!0)}function z(e){if(L.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function B(e){e.target===e.currentTarget&&R(e)}function V(e){return e.target===e.currentTarget&&z(e)}var H=(0,f.createContext)(!0),ae=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},U=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),W=(e,t)=>{let n=U(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},G=(e,t)=>{let n=U(t);return e===`present`?n:1-n},oe=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,K=e=>+!!e,se=`mobile-sessions`,ce=new Map,le=e=>ce.get(e)??null,ue=(e,t)=>(ce.set(e,t),()=>{ce.get(e)===t&&ce.delete(e)}),de=`.overlay-scrollbar-container`,q=1,fe=e=>e===`left`||e===`right`?`x`:`y`,J=e=>e===`bottom`||e===`right`?1:-1,pe=(e,t,n)=>{let r=fe(e)===`x`?t:n;return Math.max(0,r*J(e))},me=(e,t,n,r,i)=>{let a=pe(e,t,n),o=Math.abs(fe(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},Y=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),X=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),he=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,Z=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,Q=(e,t,n=q)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},ge=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},$=(e,t)=>{let n=window.getComputedStyle(e),r=fe(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},_e=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if($(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&$(o,n)?o:null},ve=e=>{let t=f.useRef(e),n=f.useRef(null),r=f.useRef(null);return t.current=e,f.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=fe(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=Z(e.velocity,a,i,n-e.lastVelocityTime,J(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=pe(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=_e(e,n.target,a.edge,a.scrollContainerSelector??de);if(l&&!Q(l,a.edge))return;let u=e.getBoundingClientRect(),d=fe(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:fe(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:X(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=ge(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!me(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=le(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(Y(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=ge(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(Y(t.distance,t.motionDistance));let o=he(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},ye=`mobile-overlay-root`,be=200,xe=80,Se=`cubic-bezier(0.32, 0.72, 0, 1)`,Ce=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,we=()=>{if(typeof document>`u`)return null;let e=document.getElementById(ye);return e||(e=document.createElement(`div`),e.id=ye,document.body.appendChild(e)),e},Te=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,Ee=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:o,className:c,scrimClassName:l,surfaceClassName:u,surfaceElementRef:p,dismissGesture:g=!1,onExitComplete:_,onPreviewChange:y,ariaLabel:b})=>{let x=f.useRef(null),S=f.useRef(null),C=f.useRef(null),w=f.useRef(null),T=f.useRef(t),E=f.useRef(n),ee=f.useRef(_),te=f.useRef(y),D=f.useRef(0),ne=f.useRef(0),O=f.useRef(null),re=f.useRef([]),ie=f.useRef(null),k=f.useRef(`standard`),A=f.useRef(`present`),j=f.useRef(0),M=f.useRef(!1),N=f.useRef(t),P=f.useRef(!1),F=f.useRef(t),I=f.useRef(null),[L,R]=f.useState(t),[z,U]=f.useState(t),[se,ce]=f.useState(`standard`),[le,de]=f.useState(!1),q=se===`interactive-present`,fe=f.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),J=z&&!q&&fe===e,pe=ve({motionId:e,edge:a,disabled:!g,...typeof g==`object`?g:{}}),me=f.useCallback(e=>{C.current=e,pe(e),typeof p==`function`?p(e):p&&typeof p==`object`&&(p.current=e)},[pe,p]),Y=f.useCallback(()=>{F.current&&(F.current=!1,U(!1),r||R(!1),ee.current?.())},[r]);T.current=t,E.current=n,ee.current=_,te.current=y,f.useLayoutEffect(()=>{te.current?.(z&&q)},[z,q]),typeof document<`u`&&!x.current&&(x.current=we());let X=f.useCallback(e=>{let t=W(a,e);D.current=t.progress,!(!S.current||!C.current)&&(S.current.style.opacity=String(t.scrimOpacity),C.current.style.transform=t.surfaceTransform,C.current.style.opacity=String(t.surfaceOpacity))},[a]),he=f.useCallback(()=>{O.current!==null&&window.cancelAnimationFrame(O.current),O.current=null},[]),Z=f.useCallback(()=>{S.current&&(S.current.style.willChange=``),C.current&&(C.current.style.willChange=``)},[]),Q=f.useCallback((e=re.current)=>{for(let t of e)t.cancel();re.current=[]},[]),ge=f.useCallback(()=>{he();let e=ie.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;X(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:D.current),Q(e.animations),ie.current=null}else Q();Z(),de(!1)},[X,Q,he,Z]),$=f.useCallback((e,t)=>{if(ie.current?.target===e)return;ge();let n=D.current,r=S.current,i=C.current;if(de(!0),!r||!i||Te()||n===e){X(e),Z(),de(!1),t?.();return}let o=W(a,n),s=W(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(xe,be*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:Se,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:Se,fill:`forwards`})];re.current=l;let u={from:n,target:e,animations:l};ie.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{ie.current===u&&(X(e),Q(l),ie.current=null,Z(),de(!1),t?.())})},[X,Q,Z,a,ge]);if(f.useLayoutEffect(()=>{P.current=L,L&&X(ne.current)},[X,L]),f.useLayoutEffect(()=>{F.current=z},[z]),f.useEffect(()=>{t&&!P.current&&(ne.current=D.current,R(!0)),t&&!F.current&&(F.current=!0,U(!0)),P.current&&k.current===`standard`&&$(K(t),()=>{!T.current&&k.current===`standard`&&Y()})},[Y,t,$]),f.useLayoutEffect(()=>{!L||k.current!==`standard`||$(+!!t,()=>{!T.current&&k.current===`standard`&&Y()})},[Y,L,t,$]),f.useEffect(()=>{if(!(!z||q))return window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[z,q]),f.useEffect(()=>{if(!(!z||q))return d.add({id:e,onClose:()=>E.current(!1)},document.body)},[z,e,q]),f.useEffect(()=>{if(!z||q||!J)return;let e=C.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;w.current?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&d.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(Ce)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??w.current,i=n.at(-1)??w.current;!r||!i||(t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),v()||t?.focus({preventScroll:!0})}},[z,q,J]),I.current={begin:e=>{if(e===`dismiss`&&(!F.current||k.current===`interactive-present`))return!1;ge(),j.current+=1,M.current=!0,A.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return k.current=t,ce(t),de(!0),e===`present`&&(ne.current=D.current,F.current=!0,U(!0),R(!0)),!0},update:e=>{M.current&&(ne.current=G(A.current,e),O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,M.current&&X(ne.current)})))},finish:e=>{if(!M.current)return;M.current=!1;let t=j.current,n=A.current,r=oe(n,e);O.current!==null&&(he(),X(ne.current)),$(r,()=>{t===j.current&&(e===`commit`&&E.current(n===`present`),n===`present`&&e===`cancel`&&!T.current&&Y(),k.current=`standard`,ce(`standard`),r===0&&Y())})},interrupt:()=>{j.current+=1,M.current=!1;let e=k.current===`interactive-present`&&!T.current;e||(k.current=`standard`,ce(`standard`)),ge(),$(K(T.current),()=>{T.current||Y(),e&&(k.current=`standard`,ce(`standard`))})}},f.useLayoutEffect(()=>{let e=N.current;N.current=t,e&&!t&&k.current!==`standard`&&I.current?.interrupt()},[t]),f.useEffect(()=>{let t=ue(e,{begin:e=>I.current?.begin(e)??!1,update:e=>I.current?.update(e),finish:e=>I.current?.finish(e),interrupt:()=>I.current?.interrupt()});return()=>{t(),he(),Q(),ie.current=null,Z(),I.current=null}},[Q,he,Z,e]),!L||!x.current)return null;let _e=(0,m.jsx)(`div`,{ref:S,className:s(`yuri-mobile-window-motion yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,le&&`yuri-mobile-window-motion-active`,!z&&!q&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(z),role:q?void 0:`dialog`,"aria-label":q?void 0:b,"aria-modal":z&&J?`true`:void 0,"aria-hidden":q||!z||!J||void 0,inert:q||!z||!J||void 0,onPointerDown:B,onClick:e=>{!z||q||!J||V(e)&&E.current(!1)},children:(0,m.jsxs)(`div`,{ref:me,className:s(`yuri-mobile-floating-shell`,ae(i,a),u),"data-yuri-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(`span`,{ref:w,tabIndex:-1,className:`sr-only`,role:`group`,"aria-label":b}),(0,m.jsx)(H.Provider,{value:J,children:o})]})});return(0,h.createPortal)(_e,x.current)},De=f.createContext(null),Oe=e=>{let t=(0,p.c)(5),{children:n}=e,r=f.useContext(De);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,h.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},ke=e=>{let t=(0,p.c)(50),{id:n,open:r,onOpenChange:i,title:a,leading:c,trailing:l,ariaLabel:d,closeAriaLabel:h,showCloseButton:g,compactHeader:_,resizeAriaLabel:v,initiallyExpanded:y,fitContent:b,bodyClassName:x,className:S,children:C}=e,w=g===void 0||g,T=_!==void 0&&_,E=y!==void 0&&y,ee=b!==void 0&&b,te=E?j:void 0,D;t[0]!==i||t[1]!==r?(D=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=D):D=t[2];let ne;t[3]!==ee||t[4]!==te||t[5]!==D?(ne={initialSnapPoint:te,fitContent:ee,onDismiss:D},t[3]=ee,t[4]=te,t[5]=D,t[6]=ne):ne=t[6];let O=F(ne),[re,ie]=f.useState(null),k=a!=null||c!=null||l!=null,A=O.snapPoint===j,M=A||!ee,N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=N):N=t[7];let P=A?`h-[98dvh] max-h-[98dvh]`:ee?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,L=O.surfaceRef,R=O.reset,z=M&&`flex-1`,B;t[8]===z?B=t[9]:(B=s(`flex min-h-0 flex-col`,z),t[8]=z,t[9]=B);let V;t[10]!==T||t[11]!==v||t[12]!==O?(V=(0,m.jsx)(I,{controller:O,ariaLabel:v,compact:T}),t[10]=T,t[11]=v,t[12]=O,t[13]=V):V=t[13];let H;t[14]!==h||t[15]!==T||t[16]!==ee||t[17]!==k||t[18]!==c||t[19]!==i||t[20]!==w||t[21]!==a||t[22]!==l?(H=k?(0,m.jsxs)(`div`,{"data-mobile-sheet-header":!0,className:T?`flex min-h-6 items-center gap-2 px-3 text-xs`:ee?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[c?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:c}):null,(0,m.jsx)(`div`,{className:s(`min-w-0 flex-1`,T&&`truncate`),children:a}),l?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:l}):null,(0,m.jsx)(`div`,{ref:ie,className:`contents`}),w?(0,m.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":h,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,m.jsx)(u,{name:`close`,className:`size-5`})}):null]}):null,t[14]=h,t[15]=T,t[16]=ee,t[17]=k,t[18]=c,t[19]=i,t[20]=w,t[21]=a,t[22]=l,t[23]=H):H=t[23];let ae;t[24]!==V||t[25]!==H?(ae=(0,m.jsxs)(`div`,{className:`shrink-0`,children:[V,H]}),t[24]=V,t[25]=H,t[26]=ae):ae=t[26];let U=M&&`flex-1`,W;t[27]!==x||t[28]!==U?(W=s(`flex min-h-0 flex-col overflow-hidden`,U,x),t[27]=x,t[28]=U,t[29]=W):W=t[29];let G;t[30]!==C||t[31]!==W?(G=(0,m.jsx)(`div`,{className:W,"data-page-scroll-lock":`true`,children:C}),t[30]=C,t[31]=W,t[32]=G):G=t[32];let oe;t[33]!==B||t[34]!==ae||t[35]!==G?(oe=(0,m.jsxs)(`div`,{className:B,children:[ae,G]}),t[33]=B,t[34]=ae,t[35]=G,t[36]=oe):oe=t[36];let K;t[37]!==d||t[38]!==S||t[39]!==n||t[40]!==i||t[41]!==r||t[42]!==O.reset||t[43]!==O.surfaceRef||t[44]!==oe||t[45]!==P?(K=(0,m.jsx)(Ee,{id:n,className:S,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:N,ariaLabel:d,surfaceClassName:P,surfaceElementRef:L,onExitComplete:R,children:oe}),t[37]=d,t[38]=S,t[39]=n,t[40]=i,t[41]=r,t[42]=O.reset,t[43]=O.surfaceRef,t[44]=oe,t[45]=P,t[46]=K):K=t[46];let se;return t[47]!==re||t[48]!==K?(se=(0,m.jsx)(De.Provider,{value:re,children:K}),t[47]=re,t[48]=K,t[49]=se):se=t[49],se};export{_ as C,v as S,I as _,pe as a,E as b,me as c,le as d,H as f,V as g,B as h,X as i,he as l,R as m,Oe as n,Y as o,z as p,Ee as r,Z as s,ke as t,se as u,j as v,y as x,F as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,ot as n,st as r}from"./vendor-base-ui-fom6orB6.js";import{n as i}from"./vendor-react-D5BntRmA.js";import{r as a}from"./vendor-reactuses-core-B8s-Rcd-.js";import{In as o,Rn as s}from"./useMobileNavigationStore-CWShXc31.js";import{a as c,c as l}from"./vendor-framer-motion-DiGWHm7K.js";import{n as u}from"./Icon-DSX7wjSw.js";import{t as d}from"./MobileWindowStack-DGLdgoGr.js";var f=e(r(),1),p=i(),m=n(),h=e(t(),1),g=0,_=()=>{g=Date.now()+800},v=()=>Date.now()<g;function y(e){let t=(0,p.c)(9),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=s(`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,m.jsx)(`div`,{className:`pointer-events-none h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,m.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var b=100,x=.35;function S(e,t,n){let r=e.at(-1),i=e.at(-2);for(r&&i&&Math.abs(t-r.height)>2&&(t-r.height)*(r.height-i.height)<0&&e.splice(0,e.length-1),e.push({height:t,time:n});e.length>2&&(e.length>16||e[1].time<n-b);)e.shift()}function C(e,t){let n=e.at(-1);if(!n||t-n.time>=b)return 0;let r=e.find(e=>e.time>=t-b);return!r||n.time<=r.time?0:Math.max(-4,Math.min(4,(n.height-r.height)/Math.max(1,t-r.time)))}function w(e,t,n,r,i){let a=Math.abs(r)>=x&&Math.abs(i)>=8,o=n+(a?r*180:0),s=e.reduce((e,t)=>Math.abs(t.height-o)<Math.abs(e.height-o)?t:e),c=e.find(e=>e.id===t)??s;return!a||Math.abs(s.height-c.height)>1?s.id:[...e].sort((e,t)=>r>0?e.height-t.height:t.height-e.height).find(e=>r>0?e.height>c.height+1:e.height<c.height-1)?.id??s.id}function T(e,t,n){let r=e<t?t:e>n?n:e,i=e-r;return r+Math.sign(i)*48*(1-1/(1+Math.abs(i)*.55/48))}function E(e){let t=(0,p.c)(82),{surfaceRef:n,initialPoint:r,getPoints:i,minimumHeight:o,onRelease:s,onCommit:u,renderMode:d}=e,m=d===void 0?`height`:d,[h,g]=(0,f.useState)(r),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),x=(0,f.useRef)(r),E=(0,f.useRef)(null),A=(0,f.useRef)(null),j=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(!1),P=(0,f.useRef)(null),F;t[0]===n?F=t[1]:(F=()=>{let e=n.current;if(!e)return 0;if(!P.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return P.current.layoutHeight-t},t[0]=n,t[1]=F);let I=a(F),L;t[2]===n?L=t[3]:(L=e=>{let t=n.current;t&&(P.current?t.style.translate=`0 ${P.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=L);let R=a(L),z;t[4]!==m||t[5]!==n||t[6]!==R?(z=(e,t)=>{let r=n.current;if(r){if(m===`translate`&&!P.current){let e=Math.max(...t.map(k))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;P.current={layoutHeight:e,styles:{maxHeight:n,position:i,bottom:a,left:o,right:s}},Object.assign(r.style,{position:`absolute`,bottom:`0px`,left:`0px`,right:`0px`}),r.style.maxHeight=`none`,r.style.height=`${e}px`}r.setAttribute(`data-height-snap-active`,``),r.style.willChange=P.current?`translate`:`height`,R(e)}},t[4]=m,t[5]=n,t[6]=R,t[7]=z):z=t[7];let B=a(z),V;t[8]===n?V=t[9]:(V=()=>{let e=n.current;e&&(P.current&&(e.style.translate=``,Object.assign(e.style,P.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),P.current=null},t[8]=n,t[9]=V);let H=a(V),ae;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{A.current!==null&&cancelAnimationFrame(A.current),A.current=null,j.current=null,M.current?.cancel(),M.current=null},t[10]=ae):ae=t[10];let U=a(ae),W;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=E.current;E.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=W):W=t[11];let G=a(W),oe;t[12]!==U||t[13]!==H||t[14]!==i||t[15]!==u||t[16]!==B||t[17]!==I||t[18]!==G||t[19]!==n||t[20]!==R?(oe=(e,t,r,a)=>{let o=r===void 0||r,s=a===void 0?0:a,d=n.current;if(!d)return;let f=t??I();U(),R(f);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(B(f,p),G(),v(!1),b(!1),x.current=e,g(e),R(m.height),u?.(e),!o||Math.abs(f-m.height)<1||typeof d.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){H();return}b(!0);let h=P.current?.layoutHeight,_=m.height-f,y=c([d],h===void 0?{height:[`${f}px`,`${m.height}px`]}:{translate:[`0 ${h-f}px`,`0 ${h-m.height}px`]},{type:l,stiffness:576,damping:48,mass:1,velocity:s*1e3*100/_,restDelta:20/Math.abs(_),restSpeed:500/Math.abs(_)});M.current=y,y.finished.catch(ie).then(()=>{M.current===y&&(M.current=null,H(),b(!1))})},t[12]=U,t[13]=H,t[14]=i,t[15]=u,t[16]=B,t[17]=I,t[18]=G,t[19]=n,t[20]=R,t[21]=oe):oe=t[21];let K=a(oe),se;t[22]!==U||t[23]!==i||t[24]!==o||t[25]!==B||t[26]!==I||t[27]!==n||t[28]!==R?(se=e=>{if(E.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=I();U(),R(t);let r=i();r.length&&(b(!1),E.current={pointerId:e.pointerId,startY:e.clientY,height:t,point:x.current,points:r,handle:e.currentTarget,minimum:o??Math.min(...r.map(re)),maximum:Math.max(...r.map(O)),samples:[{height:t,time:e.timeStamp}]},N.current=!1,B(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=U,t[23]=i,t[24]=o,t[25]=B,t[26]=I,t[27]=n,t[28]=R,t[29]=se):se=t[29];let ce=a(se),le;t[30]!==m||t[31]!==R?(le=e=>{let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(N.current=!0),S(t.samples,t.height+n,e.timeStamp);let r=T(t.height+n,t.minimum,t.maximum);j.current=m===`height`?Math.max(t.minimum,r):r,A.current===null&&(A.current=requestAnimationFrame(()=>{A.current=null,j.current!==null&&R(j.current)})),e.preventDefault()},t[30]=m,t[31]=R,t[32]=le):le=t[32];let ue=a(le),de;t[33]!==U||t[34]!==s||t[35]!==I||t[36]!==G||t[37]!==K||t[38]!==n?(de=(e,t)=>{let r=E.current;if(!r||r.pointerId!==e.pointerId)return;let i=j.current??I(),a=r.height+r.startY-e.clientY;t||S(r.samples,a,e.timeStamp);let o=t?0:C(r.samples,e.timeStamp);if(G(),!t&&N.current&&s?.(i,o,r.height))U(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!N.current?r.point:w(r.points,r.point,i,o,a-r.height);K(e,i,!0,o)}e.preventDefault()},t[33]=U,t[34]=s,t[35]=I,t[36]=G,t[37]=K,t[38]=n,t[39]=de):de=t[39];let q=a(de),fe;t[40]!==i||t[41]!==K?(fe=e=>{let t=[...i()].sort(ne),n=t.find(e=>e.id===x.current);if(!n)return;let r=e>0?t.find(e=>e.height>n.height+1):t.sort(D).find(e=>e.height<n.height-1);r&&K(r.id)},t[40]=i,t[41]=K,t[42]=fe):fe=t[42];let J=a(fe),pe;t[43]!==i||t[44]!==K||t[45]!==J?(pe=()=>{if(N.current){N.current=!1;return}let e=[...i()].sort(te);x.current===e.at(-1)?.id?K(e[0].id):J(1)},t[43]=i,t[44]=K,t[45]=J,t[46]=pe):pe=t[46];let me=a(pe),Y;t[47]!==i||t[48]!==me||t[49]!==K||t[50]!==J?(Y=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(ee);t.length&&(e.key===`ArrowUp`?J(1):e.key===`ArrowDown`?J(-1):e.key===`Home`?K(t.at(-1).id):e.key===`End`?K(t[0].id):me())},t[47]=i,t[48]=me,t[49]=K,t[50]=J,t[51]=Y):Y=t[51];let X=a(Y),he;t[52]!==U||t[53]!==H||t[54]!==r||t[55]!==G||t[56]!==n?(he=()=>{U(),G(),H(),x.current=r,g(r),v(!1),b(!1),N.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=U,t[53]=H,t[54]=r,t[55]=G,t[56]=n,t[57]=he):he=t[57];let Z=a(he),Q,ge;t[58]!==U||t[59]!==H||t[60]!==G?(Q=()=>()=>{U(),G(),H()},ge=[U,G,H],t[58]=U,t[59]=H,t[60]=G,t[61]=Q,t[62]=ge):(Q=t[61],ge=t[62]),(0,f.useLayoutEffect)(Q,ge);let $;t[63]===q?$=t[64]:($=e=>q(e,!1),t[63]=q,t[64]=$);let _e=a($),ve;t[65]===q?ve=t[66]:(ve=e=>q(e,!0),t[65]=q,t[66]=ve);let ye=a(ve),be;t[67]===q?be=t[68]:(be=e=>q(e,!0),t[67]=q,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==me||t[71]!==X||t[72]!==ce||t[73]!==ue||t[74]!==Z||t[75]!==K||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:K,reset:Z,handlePointerDown:ce,handlePointerMove:ue,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:me,handleKeyDown:X},t[69]=_,t[70]=me,t[71]=X,t[72]=ce,t[73]=ue,t[74]=Z,t[75]=K,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function ee(e,t){return e.height-t.height}function te(e,t){return e.height-t.height}function D(e,t){return t.height-e.height}function ne(e,t){return e.height-t.height}function O(e){return e.height}function re(e){return e.height}function ie(){}function k(e){return e.height}var A=.72,j=.98,M=64,N=()=>Math.max(1,window.innerHeight),P=(e,t)=>{let n=Math.max(1,e)*A;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},F=e=>{let t=(0,p.c)(20),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{initialSnapPoint:r,fitContent:i,onDismiss:o,dismissThresholdPx:s}=n,c=r===void 0?A:r,l=i!==void 0&&i,u=s===void 0?M:s,d=f.useRef(null),m=f.useRef(null),h=f.useRef(c),g=o?0:void 0,_;t[2]===l?_=t[3]:(_=()=>{let e=N(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(m.current=P(e,d.current.getBoundingClientRect().height)),[{id:A,height:Math.min(t,P(e,l?m.current:void 0))},{id:j,height:Math.min(t,e*j)}]},t[2]=l,t[3]=_);let v;t[4]!==u||t[5]!==l||t[6]!==o?(v=(e,t,n)=>{let r=d.current?.parentElement?.clientHeight||N(),i=Math.min(r,P(N(),l?m.current:void 0)),a=t<-.55&&n<=i+1&&e<i-8;return!o||!a&&e>i-u?!1:(o(),!0)},t[4]=u,t[5]=l,t[6]=o,t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{h.current=e},t[8]=y):y=t[8];let b;t[9]!==c||t[10]!==g||t[11]!==_||t[12]!==v?(b={surfaceRef:d,initialPoint:c,renderMode:`translate`,minimumHeight:g,getPoints:_,onRelease:v,onCommit:y},t[9]=c,t[10]=g,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x=E(b),S;t[14]!==x||t[15]!==c?(S=()=>{m.current=null,h.current=c,x.reset()},t[14]=x,t[15]=c,t[16]=S):S=t[16];let C=a(S),w;return t[17]!==x||t[18]!==C?(w={...x,surfaceRef:d,reset:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w},I=e=>{let t=(0,p.c)(13),{controller:n,ariaLabel:r,compact:i}=e,a=i!==void 0&&i,o;t[0]===n.snapPoint?o=t[1]:(o=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=o);let s=`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)] ${a?`min-h-4 pt-1`:`min-h-8 pt-2.5`}`,c;return t[2]!==r||t[3]!==n.handleClick||t[4]!==n.handleKeyDown||t[5]!==n.handleLostPointerCapture||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==o||t[11]!==s?(c=(0,m.jsx)(y,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":A*100,"aria-valuemax":j*100,"aria-valuenow":o,className:s,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onLostPointerCapture:n.handleLostPointerCapture,onClick:n.handleClick,onKeyDown:n.handleKeyDown}),t[2]=r,t[3]=n.handleClick,t[4]=n.handleKeyDown,t[5]=n.handleLostPointerCapture,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=o,t[11]=s,t[12]=c):c=t[12],c},L=new WeakMap;function R(e){L.set(e.currentTarget,!0)}function z(e){if(L.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function B(e){e.target===e.currentTarget&&R(e)}function V(e){return e.target===e.currentTarget&&z(e)}var H=(0,f.createContext)(!0),ae=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},U=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),W=(e,t)=>{let n=U(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},G=(e,t)=>{let n=U(t);return e===`present`?n:1-n},oe=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,K=e=>+!!e,se=`mobile-sessions`,ce=new Map,le=e=>ce.get(e)??null,ue=(e,t)=>(ce.set(e,t),()=>{ce.get(e)===t&&ce.delete(e)}),de=`.overlay-scrollbar-container`,q=1,fe=e=>e===`left`||e===`right`?`x`:`y`,J=e=>e===`bottom`||e===`right`?1:-1,pe=(e,t,n)=>{let r=fe(e)===`x`?t:n;return Math.max(0,r*J(e))},me=(e,t,n,r,i)=>{let a=pe(e,t,n),o=Math.abs(fe(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},Y=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),X=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),he=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,Z=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,Q=(e,t,n=q)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},ge=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},$=(e,t)=>{let n=window.getComputedStyle(e),r=fe(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},_e=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if($(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&$(o,n)?o:null},ve=e=>{let t=f.useRef(e),n=f.useRef(null),r=f.useRef(null);return t.current=e,f.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=fe(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=Z(e.velocity,a,i,n-e.lastVelocityTime,J(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=pe(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=_e(e,n.target,a.edge,a.scrollContainerSelector??de);if(l&&!Q(l,a.edge))return;let u=e.getBoundingClientRect(),d=fe(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:fe(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:X(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=ge(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!me(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=le(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(Y(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=ge(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(Y(t.distance,t.motionDistance));let o=he(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},ye=`mobile-overlay-root`,be=200,xe=80,Se=`cubic-bezier(0.32, 0.72, 0, 1)`,Ce=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,we=()=>{if(typeof document>`u`)return null;let e=document.getElementById(ye);return e||(e=document.createElement(`div`),e.id=ye,document.body.appendChild(e)),e},Te=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,Ee=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:o,className:c,scrimClassName:l,surfaceClassName:u,surfaceElementRef:p,dismissGesture:g=!1,onExitComplete:_,onPreviewChange:y,ariaLabel:b})=>{let x=f.useRef(null),S=f.useRef(null),C=f.useRef(null),w=f.useRef(null),T=f.useRef(t),E=f.useRef(n),ee=f.useRef(_),te=f.useRef(y),D=f.useRef(0),ne=f.useRef(0),O=f.useRef(null),re=f.useRef([]),ie=f.useRef(null),k=f.useRef(`standard`),A=f.useRef(`present`),j=f.useRef(0),M=f.useRef(!1),N=f.useRef(t),P=f.useRef(!1),F=f.useRef(t),I=f.useRef(null),[L,R]=f.useState(t),[z,U]=f.useState(t),[se,ce]=f.useState(`standard`),[le,de]=f.useState(!1),q=se===`interactive-present`,fe=f.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),J=z&&!q&&fe===e,pe=ve({motionId:e,edge:a,disabled:!g,...typeof g==`object`?g:{}}),me=f.useCallback(e=>{C.current=e,pe(e),typeof p==`function`?p(e):p&&typeof p==`object`&&(p.current=e)},[pe,p]),Y=f.useCallback(()=>{F.current&&(F.current=!1,U(!1),r||R(!1),ee.current?.())},[r]);T.current=t,E.current=n,ee.current=_,te.current=y,f.useLayoutEffect(()=>{te.current?.(z&&q)},[z,q]),typeof document<`u`&&!x.current&&(x.current=we());let X=f.useCallback(e=>{let t=W(a,e);D.current=t.progress,!(!S.current||!C.current)&&(S.current.style.opacity=String(t.scrimOpacity),C.current.style.transform=t.surfaceTransform,C.current.style.opacity=String(t.surfaceOpacity))},[a]),he=f.useCallback(()=>{O.current!==null&&window.cancelAnimationFrame(O.current),O.current=null},[]),Z=f.useCallback(()=>{S.current&&(S.current.style.willChange=``),C.current&&(C.current.style.willChange=``)},[]),Q=f.useCallback((e=re.current)=>{for(let t of e)t.cancel();re.current=[]},[]),ge=f.useCallback(()=>{he();let e=ie.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;X(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:D.current),Q(e.animations),ie.current=null}else Q();Z(),de(!1)},[X,Q,he,Z]),$=f.useCallback((e,t)=>{if(ie.current?.target===e)return;ge();let n=D.current,r=S.current,i=C.current;if(de(!0),!r||!i||Te()||n===e){X(e),Z(),de(!1),t?.();return}let o=W(a,n),s=W(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(xe,be*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:Se,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:Se,fill:`forwards`})];re.current=l;let u={from:n,target:e,animations:l};ie.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{ie.current===u&&(X(e),Q(l),ie.current=null,Z(),de(!1),t?.())})},[X,Q,Z,a,ge]);if(f.useLayoutEffect(()=>{P.current=L,L&&X(ne.current)},[X,L]),f.useLayoutEffect(()=>{F.current=z},[z]),f.useEffect(()=>{t&&!P.current&&(ne.current=D.current,R(!0)),t&&!F.current&&(F.current=!0,U(!0)),P.current&&k.current===`standard`&&$(K(t),()=>{!T.current&&k.current===`standard`&&Y()})},[Y,t,$]),f.useLayoutEffect(()=>{!L||k.current!==`standard`||$(+!!t,()=>{!T.current&&k.current===`standard`&&Y()})},[Y,L,t,$]),f.useEffect(()=>{if(!(!z||q))return window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[z,q]),f.useEffect(()=>{if(!(!z||q))return d.add({id:e,onClose:()=>E.current(!1)},document.body)},[z,e,q]),f.useEffect(()=>{if(!z||q||!J)return;let e=C.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;w.current?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&d.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(Ce)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??w.current,i=n.at(-1)??w.current;!r||!i||(t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),v()||t?.focus({preventScroll:!0})}},[z,q,J]),I.current={begin:e=>{if(e===`dismiss`&&(!F.current||k.current===`interactive-present`))return!1;ge(),j.current+=1,M.current=!0,A.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return k.current=t,ce(t),de(!0),e===`present`&&(ne.current=D.current,F.current=!0,U(!0),R(!0)),!0},update:e=>{M.current&&(ne.current=G(A.current,e),O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,M.current&&X(ne.current)})))},finish:e=>{if(!M.current)return;M.current=!1;let t=j.current,n=A.current,r=oe(n,e);O.current!==null&&(he(),X(ne.current)),$(r,()=>{t===j.current&&(e===`commit`&&E.current(n===`present`),n===`present`&&e===`cancel`&&!T.current&&Y(),k.current=`standard`,ce(`standard`),r===0&&Y())})},interrupt:()=>{j.current+=1,M.current=!1;let e=k.current===`interactive-present`&&!T.current;e||(k.current=`standard`,ce(`standard`)),ge(),$(K(T.current),()=>{T.current||Y(),e&&(k.current=`standard`,ce(`standard`))})}},f.useLayoutEffect(()=>{let e=N.current;N.current=t,e&&!t&&k.current!==`standard`&&I.current?.interrupt()},[t]),f.useEffect(()=>{let t=ue(e,{begin:e=>I.current?.begin(e)??!1,update:e=>I.current?.update(e),finish:e=>I.current?.finish(e),interrupt:()=>I.current?.interrupt()});return()=>{t(),he(),Q(),ie.current=null,Z(),I.current=null}},[Q,he,Z,e]),!L||!x.current)return null;let _e=(0,m.jsx)(`div`,{ref:S,className:s(`yuri-mobile-window-motion yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,le&&`yuri-mobile-window-motion-active`,!z&&!q&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(z),role:q?void 0:`dialog`,"aria-label":q?void 0:b,"aria-modal":z&&J?`true`:void 0,"aria-hidden":q||!z||!J||void 0,inert:q||!z||!J||void 0,onPointerDown:B,onClick:e=>{!z||q||!J||V(e)&&E.current(!1)},children:(0,m.jsxs)(`div`,{ref:me,className:s(`yuri-mobile-floating-shell`,ae(i,a),u),"data-yuri-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(`span`,{ref:w,tabIndex:-1,className:`sr-only`,role:`group`,"aria-label":b}),(0,m.jsx)(H.Provider,{value:J,children:o})]})});return(0,h.createPortal)(_e,x.current)},De=f.createContext(null),Oe=e=>{let t=(0,p.c)(5),{children:n}=e,r=f.useContext(De);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,h.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},ke=e=>{let t=(0,p.c)(50),{id:n,open:r,onOpenChange:i,title:a,leading:c,trailing:l,ariaLabel:d,closeAriaLabel:h,showCloseButton:g,compactHeader:_,resizeAriaLabel:v,initiallyExpanded:y,fitContent:b,bodyClassName:x,className:S,children:C}=e,w=g===void 0||g,T=_!==void 0&&_,E=y!==void 0&&y,ee=b!==void 0&&b,te=E?j:void 0,D;t[0]!==i||t[1]!==r?(D=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=D):D=t[2];let ne;t[3]!==ee||t[4]!==te||t[5]!==D?(ne={initialSnapPoint:te,fitContent:ee,onDismiss:D},t[3]=ee,t[4]=te,t[5]=D,t[6]=ne):ne=t[6];let O=F(ne),[re,ie]=f.useState(null),k=a!=null||c!=null||l!=null,A=O.snapPoint===j,M=A||!ee,N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=N):N=t[7];let P=A?`h-[98dvh] max-h-[98dvh]`:ee?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,L=O.surfaceRef,R=O.reset,z=M&&`flex-1`,B;t[8]===z?B=t[9]:(B=s(`flex min-h-0 flex-col`,z),t[8]=z,t[9]=B);let V;t[10]!==T||t[11]!==v||t[12]!==O?(V=(0,m.jsx)(I,{controller:O,ariaLabel:v,compact:T}),t[10]=T,t[11]=v,t[12]=O,t[13]=V):V=t[13];let H;t[14]!==h||t[15]!==T||t[16]!==ee||t[17]!==k||t[18]!==c||t[19]!==i||t[20]!==w||t[21]!==a||t[22]!==l?(H=k?(0,m.jsxs)(`div`,{"data-mobile-sheet-header":!0,className:T?`flex min-h-6 items-center gap-2 px-3 text-xs`:ee?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[c?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:c}):null,(0,m.jsx)(`div`,{className:s(`min-w-0 flex-1`,T&&`truncate`),children:a}),l?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:l}):null,(0,m.jsx)(`div`,{ref:ie,className:`contents`}),w?(0,m.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":h,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,m.jsx)(u,{name:`close`,className:`size-5`})}):null]}):null,t[14]=h,t[15]=T,t[16]=ee,t[17]=k,t[18]=c,t[19]=i,t[20]=w,t[21]=a,t[22]=l,t[23]=H):H=t[23];let ae;t[24]!==V||t[25]!==H?(ae=(0,m.jsxs)(`div`,{className:`shrink-0`,children:[V,H]}),t[24]=V,t[25]=H,t[26]=ae):ae=t[26];let U=M&&`flex-1`,W;t[27]!==x||t[28]!==U?(W=s(`flex min-h-0 flex-col overflow-hidden`,U,x),t[27]=x,t[28]=U,t[29]=W):W=t[29];let G;t[30]!==C||t[31]!==W?(G=(0,m.jsx)(`div`,{className:W,"data-page-scroll-lock":`true`,children:C}),t[30]=C,t[31]=W,t[32]=G):G=t[32];let oe;t[33]!==B||t[34]!==ae||t[35]!==G?(oe=(0,m.jsxs)(`div`,{className:B,children:[ae,G]}),t[33]=B,t[34]=ae,t[35]=G,t[36]=oe):oe=t[36];let K;t[37]!==d||t[38]!==S||t[39]!==n||t[40]!==i||t[41]!==r||t[42]!==O.reset||t[43]!==O.surfaceRef||t[44]!==oe||t[45]!==P?(K=(0,m.jsx)(Ee,{id:n,className:S,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:N,ariaLabel:d,surfaceClassName:P,surfaceElementRef:L,onExitComplete:R,children:oe}),t[37]=d,t[38]=S,t[39]=n,t[40]=i,t[41]=r,t[42]=O.reset,t[43]=O.surfaceRef,t[44]=oe,t[45]=P,t[46]=K):K=t[46];let se;return t[47]!==re||t[48]!==K?(se=(0,m.jsx)(De.Provider,{value:re,children:K}),t[47]=re,t[48]=K,t[49]=se):se=t[49],se};export{_ as C,v as S,I as _,pe as a,E as b,me as c,le as d,H as f,V as g,B as h,X as i,he as l,R as m,Oe as n,Y as o,z as p,Ee as r,Z as s,ke as t,se as u,j as v,y as x,F as y};
|