@yuriai/web 0.2.12-beta.1 → 0.2.12-beta.2
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-DJCC3Aqe.js +1 -0
- package/dist/assets/AssistantView-BGwT_cnj.js +3 -0
- package/dist/assets/{DiagramView-uXRgHwPJ.js → DiagramView-DRVSHYyW.js} +1 -1
- package/dist/assets/{GuiPluginSurface-BvqTFEHC.js → GuiPluginSurface-CXDLKbI2.js} +1 -1
- package/dist/assets/{GuiPluginWindow-C_4UCN15.js → GuiPluginWindow-BKPe8p8t.js} +1 -1
- package/dist/assets/MarkdownRenderer-B8xi-szc.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-sX2gsKdk.js → MarkdownRendererImpl-Do8KAqlC.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-BTpFp4v9.js → MarkstreamRendererImpl-L2-fHtpA.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-S5rvNlSw.js → MobileDetailNavigation-BtLQo_Rl.js} +1 -1
- package/dist/assets/{MobileResizableSheet-BGOvJkaP.js → MobileResizableSheet-CVZyFmiP.js} +1 -1
- package/dist/assets/{MobileShareBridge-ByOex64p.js → MobileShareBridge-B3fVcVe4.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CGJV-jLT.js → MobileTabPageHeader-DnIyAEmt.js} +1 -1
- package/dist/assets/{MultiRunWindow-DT81Yvu2.js → MultiRunWindow-CexoBVhb.js} +1 -1
- package/dist/assets/{SettingsView-r_-tw_wf.js → SettingsView-B1Nn2sIu.js} +8 -8
- package/dist/assets/{SettingsWindow-Dp4UefGQ.js → SettingsWindow-DDCNdxmH.js} +1 -1
- package/dist/assets/{TerminalView-D2EL5uEI.js → TerminalView-BH93XSrJ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-D3DPQCI-.js → ToolOutputDialog-fZ_4z7wi.js} +1 -1
- package/dist/assets/{appThemeRegistry-Br1Y4kMh.js → appThemeRegistry-PpiWCZgq.js} +1 -1
- package/dist/assets/{capgoAdapter-MylXZ4IG.js → capgoAdapter-B9VrK7jw.js} +1 -1
- package/dist/assets/fileMentionTouchSelection-C5BslzWG.js +2 -0
- package/dist/assets/{gitApi-JgIRgqCy.js → gitApi-Q5-lN46d.js} +4 -4
- package/dist/assets/grok-recipes-CGfuXW4M.json +8309 -0
- package/dist/assets/insertionBoundaries-ewtT_GYv.js +1 -0
- package/dist/assets/{main-C3aeL1x1.js → main-BejI5g8K.js} +13 -13
- package/dist/assets/{main-CJK9gObM.js → main-DZFZc2Cz.js} +2 -2
- package/dist/assets/{mcpQueries-D4WzRCEf.js → mcpQueries-DhdyzBPI.js} +1 -1
- package/dist/assets/miniChat-BoLIKdEU.js +2 -0
- package/dist/assets/{mobile-CPqhIAEq.js → mobile-qUsKQQrt.js} +2 -2
- package/dist/assets/{mobileBackNavigation-DQMX_niL.js → mobileBackNavigation-B_x92p6I.js} +1 -1
- package/dist/assets/{multirun-Vnl8MPmG.js → multirun-Cs1-2PJ3.js} +1 -1
- package/dist/assets/{native-config-Ci8to5sR.js → native-config-Qpfr4t6J.js} +1 -1
- package/dist/assets/{projectMeta-BJQWTMtw.js → projectMeta-BpdNCDci.js} +1 -1
- package/dist/assets/{readiness-C5z74Apg.js → readiness-BjyrMWQ4.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-CfIulG-U.js → renderElectronMiniChatApp-DMuZlrFu.js} +2 -2
- package/dist/assets/renderMobileApp-BiGLm-5i.js +28 -0
- package/dist/assets/{runtimeConfig-52a7OLrA.js → runtimeConfig-B25zh-JV.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-CsdwEKof.js → runtimeEndpointReset-j5Tq4J9B.js} +7 -7
- package/dist/assets/{sessionChangeSummary-BbgIDcOI.js → sessionChangeSummary-CnUPwOh6.js} +1 -1
- package/dist/assets/{sessionLookup-D8693snn.js → sessionLookup-DpKDj2Pl.js} +1 -1
- package/dist/assets/speechSettingsQueries-JtXEoFYP.js +4 -0
- package/dist/assets/src-DZ4-mHgg.css +2 -0
- package/dist/assets/{types-Dy7vKiLX.js → types-CM0lXtmR.js} +1 -1
- package/dist/assets/{useAppFontEffects-CTOXRBGw.js → useAppFontEffects-fKQ6i4QC.js} +30 -30
- package/dist/assets/{useDesktopWindowControlsLayout-DFeMqtSs.js → useDesktopWindowControlsLayout-aCAOBpZH.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-CecIEYsD.js → useEffectiveDirectory-HWABaJoo.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-CPjPkSWE.js → useMobileNavigationStore-CjljWARe.js} +22 -22
- package/dist/assets/{useWorkerHighlightedLines-CHbIxbid.js → useWorkerHighlightedLines-DWTiInlP.js} +1 -1
- package/dist/assets/{vendor-framer-motion-DsGBcZHB.js → vendor-framer-motion-D8hQsul-.js} +1 -1
- package/dist/assets/vendor-motion-DufQFNcM.js +1 -0
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AgentAvatar-C2FL0Qg-.js +0 -22
- package/dist/assets/AssistantView-B8ijrLf8.js +0 -3
- package/dist/assets/MarkdownRenderer-JZtxgA3l.js +0 -2
- package/dist/assets/fileMentionTouchSelection-BUTfQOa7.js +0 -2
- package/dist/assets/insertionBoundaries-DJn6sacB.js +0 -1
- package/dist/assets/miniChat-B0j7f5Gr.js +0 -2
- package/dist/assets/renderMobileApp-CXUJdxZW.js +0 -28
- package/dist/assets/speechSettingsQueries-CVzYcD_d.js +0 -4
- package/dist/assets/src-D4rfdktg.css +0 -2
- package/dist/assets/vendor-motion-CIQx6DBb.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{f as i,t as a}from"./button-DFX-UCuQ.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./vendor-react-BP2cRVqX.js";import{f as i,t as a}from"./button-DFX-UCuQ.js";import{Br as o}from"./useMobileNavigationStore-CjljWARe.js";import{r as s}from"./device-B7GyZCPd.js";import{i as c}from"./react-BYRXYlGz.js";import{n as l,r as u,t as d}from"./readiness-BjyrMWQ4.js";import{t as f}from"./GuiPluginWindow-BKPe8p8t.js";var p=r(),m=e(t(),1),h=n();function g(){let e=(0,p.c)(21),{host:t,snapshot:n,error:r}=c(),{t:g}=i(),{isMobile:v}=s(),[y]=m.useState(_),b;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Set,e[0]=b):b=e[0];let x;e[1]===t?x=e[2]:(x={host:t,errors:b},e[1]=t,e[2]=x);let S=m.useRef(x),C,w;e[3]!==t||e[4]!==n.plugins||e[5]!==g?(C=()=>{S.current.host!==t&&(S.current={host:t,errors:new Set});let e=new Set;for(let t of n.plugins){if(t.status!==`failed`)continue;let n=t.error||g(`guiPlugins.failed`),r=JSON.stringify([t.id,n]);e.add(r),S.current.errors.has(r)||o.error(`${t.id}: ${n}`)}S.current.errors=e},w=[t,n.plugins,g],e[3]=t,e[4]=n.plugins,e[5]=g,e[6]=C,e[7]=w):(C=e[6],w=e[7]),m.useEffect(C,w);let T;if(e[8]!==y||e[9]!==r||e[10]!==t||e[11]!==v||e[12]!==n.activePanel||e[13]!==n.panels||e[14]!==n.plugins||e[15]!==g){let i;e[17]===n.activePanel?i=e[18]:(i=e=>e.key===n.activePanel&&!e.inline,e[17]=n.activePanel,e[18]=i);let o=n.panels.find(i),s;e[19]===t?s=e[20]:(s=()=>t?.hidePanel(),e[19]=t,e[20]=s),T=(0,h.jsx)(f,{id:`gui-plugin-panel`,open:!!(t&&o),title:o?.title??g(`guiPlugins.title`),onClose:s,actions:v&&o?(0,h.jsx)(u,{target:y}):null,children:t&&o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":g(`guiPlugins.panels`),children:n.panels.map(e=>(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(a,{variant:`chip`,size:`sm`,"aria-pressed":e.key===o.key,onClick:()=>t.selectPanel(e.key),className:`max-w-64 truncate`,children:e.title}),(0,h.jsx)(a,{variant:`ghost`,size:`xs`,"aria-label":g(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:g(`guiPlugins.close`)})]},e.key))}),r?(0,h.jsx)(`div`,{role:`alert`,className:`text-[var(--status-error)]`,children:r}):null,(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,h.jsx)(l,{host:t,contributionKey:o.key,kind:`panel`,actions:v?y:void 0,revision:d(n.plugins,o.pluginId)})})]}):null}),e[8]=y,e[9]=r,e[10]=t,e[11]=v,e[12]=n.activePanel,e[13]=n.panels,e[14]=n.plugins,e[15]=g,e[16]=T}else T=e[16];return T}function _(){return document.createElement(`div`)}export{g as GuiPluginSurface};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{rt as e}from"./vendor-base-ui-CdzJ6My_.js";import{n as t}from"./vendor-react-BP2cRVqX.js";import{f as n}from"./button-DFX-UCuQ.js";import{a as r,n as i,o as a,t as o}from"./dialog-jQrYy1B7.js";import{r as s}from"./device-B7GyZCPd.js";import{t as c}from"./MobileResizableSheet-
|
|
1
|
+
import{rt as e}from"./vendor-base-ui-CdzJ6My_.js";import{n as t}from"./vendor-react-BP2cRVqX.js";import{f as n}from"./button-DFX-UCuQ.js";import{a as r,n as i,o as a,t as o}from"./dialog-jQrYy1B7.js";import{r as s}from"./device-B7GyZCPd.js";import{t as c}from"./MobileResizableSheet-CVZyFmiP.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=s(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let r;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(r=(0,u.jsx)(c,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=r):r=t[14],r}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(r,{children:(0,u.jsx)(a,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(i,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(o,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-L2-fHtpA.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-NMQx_cnG.js","assets/runtime-switch-CAZiOV2G.js","assets/runtime-auth-ef9W7A43.js","assets/vendor-zustand-o69pgTEK.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-BP2cRVqX.js","assets/fileQueries-DbUx7NwP.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/queryRuntime-BuRnpVtK.js","assets/runtime-fetch-BAN5Gnnp.js","assets/vendor-markstream-react-Bm0cO70Z.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-BJ-jJ4YM.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-DFX-UCuQ.js","assets/desktop-dp2Z0toS.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/store-CKaWYiP4.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-CjljWARe.js","assets/platform-DXeTzJHG.js","assets/vendor-opencode-client-fxfj4IA_.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-BfjCXjLZ.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-D3k0hKDj.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-rdsbsVts.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/useThemeSystem-8jhE4Zyk.js","assets/tooltip-Byl6nrXB.js","assets/image-loading-FUFYiO1j.js","assets/image-loading-D9Z_BASK.css","assets/url-MRa-FtQa.js","assets/useEffectiveDirectory-HWABaJoo.js","assets/LoadingImage-ByZs_EGY.js","assets/ImageLoadingPlaceholder-B5t9zOYn.js","assets/markdownHeightCache-BsFt9Iuh.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-Do8KAqlC.js","assets/vendor-katex-DNVSTX6g.js","assets/FadeInOnReveal-CxIQc2_J.js","assets/markdownTheme-DHoKvD6O.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-No7p4Kdo.js","assets/toolHelpers-DL452NVK.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-EpBnVy9J.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-o69pgTEK.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-DFX-UCuQ.js";import{t as s}from"./useEffectiveDirectory-HWABaJoo.js";import{i as c,n as l,t as u}from"./markdownHeightCache-BsFt9Iuh.js";var d=i(),f=e(n(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.12-beta.2:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-L2-fHtpA.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-Do8KAqlC.js`).then(e=>e.n),__vite__mapDeps([54,1,4,5,24,25,2,30,14,6,31,32,7,8,3,33,9,13,12,34,35,36,10,11,37,38,16,55,20,21,22,23,26,27,28,29,39,40,41,42,43,53,44,46,47,48,49,56,52,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=r(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-CAZiOV2G.js";import{C as r}from"./desktop-dp2Z0toS.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{t as o}from"./platform-DXeTzJHG.js";import{n as s}from"./useUIStore-NMQx_cnG.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{u as l}from"./fileQueries-DbUx7NwP.js";import{n as u}from"./vendor-katex-DNVSTX6g.js";import{i as d,p as f,r as p}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{d as m,f as h,r as g}from"./button-DFX-UCuQ.js";import{
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n}from"./runtime-switch-CAZiOV2G.js";import{C as r}from"./desktop-dp2Z0toS.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{t as o}from"./platform-DXeTzJHG.js";import{n as s}from"./useUIStore-NMQx_cnG.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{u as l}from"./fileQueries-DbUx7NwP.js";import{n as u}from"./vendor-katex-DNVSTX6g.js";import{i as d,p as f,r as p}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{d as m,f as h,r as g}from"./button-DFX-UCuQ.js";import{Yi as _}from"./useMobileNavigationStore-CjljWARe.js";import{t as v}from"./dualLimitLru-D8Sphgua.js";import{t as y}from"./useThemeSystem-8jhE4Zyk.js";import{a as b,d as x,i as S,t as C}from"./image-loading-FUFYiO1j.js";import{a as w,i as T,n as E,r as D}from"./url-MRa-FtQa.js";import{n as ee}from"./useEffectiveDirectory-HWABaJoo.js";import{c as O,i as k,l as te,n as ne,o as A,r as re}from"./FadeInOnReveal-CxIQc2_J.js";import{i as ie,r as j,t as ae}from"./markdownHeightCache-BsFt9Iuh.js";import{n as oe,t as M}from"./markdownTheme-DHoKvD6O.js";import{i as N,n as P,t as F}from"./markdown-worker-oBGEB9Eg.js";import{t as se}from"./vendor-morphdom-BbKiNDAu.js";import{t as I}from"./vendor-dompurify-CeJNOzik.js";import{t as L}from"./vendor-pele-C1WTNWUm.js";import{t as R}from"./vendor-marked-WVekxjAN.js";import{t as z}from"./vendor-remend-C3cXc-tf.js";import{a as B,c as ce,f as V,g as le,h as H,i as U,l as W,n as ue,o as de,p as fe,t as pe,u as me}from"./fileReferenceActions-No7p4Kdo.js";var G=t(i(),1),he=c(),K=new v({maxEntries:100,maxBytes:8388608}),ge=(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=K.get(s);if(c)return c;let l;try{let{svg:t}=L(e,{fontFamily:`system-ui, sans-serif`,autoDirection:!1,links:!1,images:!1}),n=I.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 K.set(s,l,(s.length+(l.svg?.length??0))*2),l},q=`data-md-stream-fence`,J=`data-md-stream-line`,_e=`data-md-stream-src`,ve=`data-md-stream-applied`,ye=(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},be=e=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-md-stream-line`)),xe=(e,t)=>{let n=document.createElement(`span`);return n.setAttribute(J,String(t)),n.className=`line`,n.innerHTML=e,n},Se=(e,t)=>{let n=be(e),r=ye(n.map(e=>e.innerHTML),t);if(n.length===0&&e.childNodes.length>0&&t.length>0){e.replaceChildren();for(let n=0;n<t.length;n+=1)n>0&&e.appendChild(document.createTextNode(`
|
|
2
2
|
`)),e.appendChild(xe(t[n]??``,n));return{reused:0,replaced:0,added:t.length,removed:0}}let i=0;if(r<n.length&&r<t.length){let e=n[r];e&&(e.innerHTML=t[r]??``,e.setAttribute(J,String(r)),i=1)}let a=0;for(let e=n.length-1;e>=r+i;--e){let t=n[e]?.previousSibling;t?.nodeType===Node.TEXT_NODE&&t.remove(),n[e]?.remove(),a+=1}let o=0;for(let n=r+i;n<t.length;n+=1)n>0&&e.appendChild(document.createTextNode(`
|
|
3
3
|
`)),e.appendChild(xe(t[n]??``,n)),o+=1;return{reused:r,replaced:i,added:o,removed:a}},Ce=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 ${q}="true"`)}`},we=(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`);return n instanceof HTMLElement&&r instanceof HTMLElement&&n.setAttribute(_e,r.textContent??``),!0},Te=e=>e.getAttribute(`data-md-stream-src`)??e.textContent??``,Ee=e=>{let t=e.querySelectorAll(`pre[${q}="true"]`),n=[];return t.forEach(e=>{let t=e.querySelector(`code`);t instanceof HTMLElement&&n.push(t)}),n},De=e=>e.closest(`pre`)?.getAttribute(`data-md-lang`)||e.className.match(/language-([^\s"]+)/)?.[1]||`text`,Oe=async(e,t,n)=>{if(n?.signal?.aborted)return;let r=Ee(e);await Promise.all(r.map(async r=>{let i=Te(r);if(!i||n?.signal?.aborted||r.getAttribute(`data-md-stream-applied`)===i)return;let a=De(r);if(a===`mermaid`)return;let o=await t(i,a,n);if(!(n?.signal?.aborted||!e.contains(r)||Te(r)!==i)){if(!o){let e=be(r),t=document.createElement(`span`);Se(r,i.split(`
|
|
4
4
|
`).map((n,r)=>{let i=e[r];return i?.textContent===n?i.innerHTML:(t.textContent=n,t.innerHTML)}));return}Se(r,o),r.setAttribute(ve,i),r.removeAttribute(_e)}}))},ke=`text`,Ae=/^(\d+):(\d+):(.+)$/,je={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`},Me={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`},Ne=e=>{let t=e.split(/[\\/]/).pop()?.toLowerCase()??``;if(!t)return ke;let n=Me[t];if(n)return n;let r=t.lastIndexOf(`.`);return r<=0?ke:je[t.slice(r+1)]??ke},Pe=e=>{let t=e?.trim()??``;if(!t)return{lang:ke,label:ke,reference:!1};let n=Ae.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:Ne(a),label:`${a}:${o}`,reference:!0}},Fe=e=>e===` `||e===` `||e===`
|
package/dist/assets/{MarkstreamRendererImpl-BTpFp4v9.js → MarkstreamRendererImpl-L2-fHtpA.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{u as a}from"./fileQueries-DbUx7NwP.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./vendor-markstream-react-Bm0cO70Z.js";import{i as f,p,r as m}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{r as h}from"./button-DFX-UCuQ.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{n as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{u as a}from"./fileQueries-DbUx7NwP.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./vendor-markstream-react-Bm0cO70Z.js";import{i as f,p,r as m}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{r as h}from"./button-DFX-UCuQ.js";import{Yi as g}from"./useMobileNavigationStore-CjljWARe.js";import{t as _}from"./useThemeSystem-8jhE4Zyk.js";import{i as v,n as y,t as b}from"./tooltip-Byl6nrXB.js";import{o as x}from"./image-loading-FUFYiO1j.js";import{a as S,r as C}from"./url-MRa-FtQa.js";import{n as w}from"./useEffectiveDirectory-HWABaJoo.js";import{t as T}from"./LoadingImage-ByZs_EGY.js";import{r as ee,t as E}from"./markdownHeightCache-BsFt9Iuh.js";import{r as D,t as O}from"./MarkdownRendererImpl-Do8KAqlC.js";import{n as k}from"./fileReferenceParser-1HHDBUum.js";import{a as A,c as j,f as M,h as N,i as P,l as F,m as I,o as L,s as te,t as ne}from"./fileReferenceActions-No7p4Kdo.js";var R=e(t(),1),z=`img:not([data-md-link-favicon="true"])`,B=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,re=(e,t)=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(z);if(r instanceof HTMLImageElement&&t.onShowPopup){let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let i=Array.from(n.querySelectorAll(z)).map(e=>({url:B(e),filename:e.alt||B(e)||void 0})).filter(e=>e.url),a=B(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(M);if(r instanceof HTMLElement){e.preventDefault(),e.stopPropagation(),L(r,t.fileReference);return}}let i=n.closest(`a[href]`);if(!(i instanceof HTMLAnchorElement))return;let a=i.getAttribute(`href`)??``;if(N(a)){e.preventDefault(),e.stopPropagation(),t.fileReference&&I(a)&&L(i,t.fileReference);return}if(!C(a))return;e.preventDefault(),e.stopPropagation();let o=(t.effectiveDirectory||``).trim();if(!g()&&o&&t.openInAppBrowser){t.openInAppBrowser(o,a);return}S(a)},V=(e,t)=>{if(e.key!==`Enter`&&e.key!==` `||!t.fileReference)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(M);!(r instanceof HTMLElement)||r.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),L(r,t.fileReference))},H=i(),ie=(e,t)=>{let n=t>=2?e.slice(t-2,t):``;return(t>=1?e.charAt(t-1):``)===`:`||n===`:/`},ae=e=>{if(!e.includes(`/`)||!e.includes(`.`))return[{kind:`text`,value:e}];k.lastIndex=0;let t=[],n=0,r=k.exec(e);for(;r;){let i=r[0];if(!i||ie(e,r.index)||!I(i)){r=k.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=k.exec(e)}return n===0?[{kind:`text`,value:e}]:(n<e.length&&t.push({kind:`text`,value:e.slice(n)}),t)},U=n(),W=R.createContext({enabled:!1,insideLink:!1,isMobileSurface:!1,effectiveDirectory:``,preferRuntimeEditor:!1,slots:{used:0,limit:0}}),G=e=>{let t=(0,H.c)(11),{enabled:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,content:s,children:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=g(),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={used:0,limit:P()},t[1]=u):u=t[1];let d;t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==o||t[6]!==a?(d={enabled:n,insideLink:!1,isMobileSurface:l,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,slots:u},t[2]=i,t[3]=r,t[4]=n,t[5]=o,t[6]=a,t[7]=d):d=t[7];let f=d,p;return t[8]!==c||t[9]!==f?(p=(0,U.jsx)(W.Provider,{value:f,children:c}),t[8]=c,t[9]=f,t[10]=p):p=t[10],p},K=({raw:e,referenceKind:t,children:n})=>{let r=R.useContext(W),i=A(e,r.effectiveDirectory,t),a=R.useRef(!1);r.enabled&&i&&!a.current&&r.slots.used<r.slots.limit&&(r.slots.used+=1,a.current=!0);let[o,s]=R.useState(i?te(i.resolvedPath,r.effectiveDirectory)??null:null),c=i?.resolvedPath;if(R.useEffect(()=>{if(!r.enabled||!c||!a.current)return;let e=!1;return j(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&&F(i.resolvedPath,o,r.isMobileSurface));return(0,U.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:ne,...n?{}:{role:`button`,tabIndex:0}}:{},children:n??e})};function q(e){let t=(0,H.c)(12),n=R.useContext(W),r=e.node.content??``;if(!n.enabled||n.insideLink){let n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(u,{...e}),t[0]=e,t[1]=n),n}let i,a;if(t[2]!==r||t[3]!==e){a=Symbol.for(`react.early_return_sentinel`);bb0:{let n=ae(r);if(n.length===1&&n[0]?.kind!==`path`){let n;t[6]===e?n=t[7]:(n=(0,U.jsx)(u,{...e}),t[6]=e,t[7]=n),a=n;break bb0}let o;t[8]===e?o=t[9]:(o=(t,n)=>t.kind===`path`?(0,U.jsx)(K,{raw:t.value},`path-${n}-${t.value}`):(0,U.jsx)(u,{...e,node:{...e.node,content:t.value}},`text-${n}`),t[8]=e,t[9]=o),i=n.map(o)}t[2]=r,t[3]=e,t[4]=i,t[5]=a}else i=t[4],a=t[5];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[10]===i?o=t[11]:(o=(0,U.jsx)(U.Fragment,{children:i}),t[10]=i,t[11]=o),o}function oe(e){let t=(0,H.c)(7),n=R.useContext(W),r=e.node.code??``;if(!n.enabled||!I(r)){let n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(s,{...e}),t[0]=e,t[1]=n),n}let i;t[2]===r?i=t[3]:(i=(0,U.jsx)(K,{raw:r}),t[2]=r,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,U.jsx)(s,{...e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}function se(e){let t=(0,H.c)(20),n=R.useContext(W),r=e.node.href??``,i;t[0]!==n.enabled||t[1]!==r?(i=n.enabled&&I(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,U.jsx)(c,{...e,showTooltip:!1}),t[3]=e,t[4]=o);let s=o,l;t[5]!==n.isMobileSurface||t[6]!==r||t[7]!==s||t[8]!==e.node.title||t[9]!==e.showTooltip?(l=n.isMobileSurface||e.showTooltip===!1?s:(0,U.jsxs)(b,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(`span`,{children:s})}),(0,U.jsx)(y,{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]=l):l=t[10];let u=l,d;t[11]===n?d=t[12]:(d={...n,insideLink:!0},t[11]=n,t[12]=d);let f;t[13]!==u||t[14]!==a||t[15]!==r?(f=a?(0,U.jsx)(K,{raw:r,referenceKind:`href`,children:u}):u,t[13]=u,t[14]=a,t[15]=r,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,U.jsx)(W.Provider,{value:d,children:f}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}var J=/^[ \t]{0,3}(`{3,}|~{3,})/,ce=e=>{if(typeof e!=`string`||e.length===0)return!1;let t=e.split(/\r?\n/,1)[0]??``;return J.test(t)},le=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)):"```"},ue=e=>{let t=typeof e.raw==`string`?e.raw:``;if(ce(t))return t.endsWith(`
|
|
2
2
|
`)?t:`${t}\n`;let n=(e.language??``).trim(),r=e.code??``,i=le(r),a=r.endsWith(`
|
|
3
3
|
`)?r:`${r}\n`;return e.loading?`${i}${n}\n${a}`:`${i}${n}\n${a}${i}\n`},de=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}`},Y=R.createContext({messageId:`markstream`,isStreaming:!1,disableStreamAnimation:!1,variant:`assistant`,enableFileReferences:!0}),X=()=>R.useContext(Y);function fe(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 Z(e){let t=(0,H.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??fe(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,U.jsx)(Q,{...e,indexKey:r}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}function Q(e){let t=(0,H.c)(21),n=X(),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=ue({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=n.part?.id,d;t[5]!==n.messageId||t[6]!==e.indexKey||t[7]!==e.node.language||t[8]!==u?(d=de({messageId:n.messageId,partId:u,indexKey:e.indexKey,language:e.node.language}),t[5]=n.messageId,t[6]=e.indexKey,t[7]=e.node.language,t[8]=u,t[9]=d):d=t[9];let f=d,p=n.enableFileReferences&&!l,m;t[10]!==c||t[11]!==n.disableStreamAnimation||t[12]!==n.onShowPopup||t[13]!==n.variant||t[14]!==f||t[15]!==l||t[16]!==p?(m=(0,U.jsx)(O,{content:c,messageId:f,isAnimated:!1,skipFadeIn:!0,isStreaming:l,disableStreamAnimation:n.disableStreamAnimation,variant:n.variant,onShowPopup:n.onShowPopup,enableFileReferences:p}),t[10]=c,t[11]=n.disableStreamAnimation,t[12]=n.onShowPopup,t[13]=n.variant,t[14]=f,t[15]=l,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==f||t[19]!==m?(h=(0,U.jsx)(`div`,{className:`yuri-markstream-code-host min-w-0 w-full`,"data-yuri-markstream-code":`markdown-impl`,"data-yuri-markstream-code-id":f,children:m}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function pe(e){let t=(0,H.c)(9),{node:n}=e,r=w()??``,i=x(n.src,r),{onShowPopup:a}=X(),o=m(me),s=i.source||void 0,c=n.title??void 0,l=a?`button`:void 0,u=a?0:void 0,d=a?o:void 0,f;return t[0]!==n.alt||t[1]!==n.src||t[2]!==i.error||t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==d?(f=(0,U.jsx)(T,{contentFrame:!0,src:s,resourceError:i.error,"data-md-image-source":n.src,alt:n.alt,title:c,className:`rounded-lg`,role:l,tabIndex:u,onKeyDown:d}),t[0]=n.alt,t[1]=n.src,t[2]=i.error,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function me(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())}function he(e){let t=(0,H.c)(4);if(e.node.type===`code_block`){let n=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(Q,{...n}),t[0]=n,t[1]=r),r}let n=e,r;return t[2]===n?r=t[3]:(r=(0,U.jsx)(pe,{...n}),t[2]=n,t[3]=r),r}var $=!1;function ge(e){return e.node?.type===`code_block`?R.createElement(Q,e):R.createElement(q,e)}var _e=()=>{$||($=!0,o({text:ge,inline_code:oe,link:se,image:he,code_block:l(Q,`block`),mermaid:l(Z,`block`),d2:l(Z,`block`),d2lang:l(Z,`block`),infographic:l(Z,`block`)}))},ve={maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1};_e();var ye=e=>(e.inline.ruler.at(`math`,(e,t)=>{let n=e.src.slice(e.pos),r=D(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),be=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`,xe=R.memo(({content:e,part:t,messageId:n,className:i,isStreaming:o=!1,disableStreamAnimation:s=!1,variant:c=`assistant`,onShowPopup:l,enableFileReferences:u=!0})=>{let g=_()?.currentTheme.metadata.variant===`dark`,{editor:v,runtime:y}=a(),b=w()??``,x=R.useRef(null),S=t?.id?`yuri-ms-${t.id}`:`yuri-ms-${n}`,C=E(e,`markstream:${c}`),T=!o,D=u&&!o,O=D?{effectiveDirectory:b,editor:v,preferRuntimeEditor:y.isVSCode,onShowPopup:l}:void 0,k=R.useMemo(()=>({messageId:n,part:t,isStreaming:o,disableStreamAnimation:s,variant:c,onShowPopup:l,enableFileReferences:u}),[n,t,o,s,c,l,u]),A=R.useRef(T);A.current=T;let j=R.useRef(C);j.current=C;let M=m(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;ee(j.current,r,i)});p(x,M);let N=m((e,t)=>{r.getState().openContextBrowser(e,t)}),P=m(e=>{re(e,{onShowPopup:l,fileReference:O,effectiveDirectory:b,openInAppBrowser:N})}),F=m(e=>{V(e,{fileReference:O})});return f(`click`,P,x),f(`keydown`,F,x),(0,U.jsx)(`div`,{ref:x,className:h(`relative break-words w-full min-w-0`,be(c),i),"data-markdown-ready":`true`,"data-markdown-hydration":`ready`,"data-yuri-markdown-engine":`markstream`,"data-yuri-markstream-virtual":`off`,children:(0,U.jsx)(Y.Provider,{value:k,children:(0,U.jsx)(G,{enabled:D,effectiveDirectory:b,editor:v,preferRuntimeEditor:y.isVSCode,onShowPopup:l,content:e,children:(0,U.jsx)(d,{content:e,customMarkdownIt:ye,customId:S,final:!o,isDark:g,codeBlockStream:o,...ve})})})})},(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);export{xe as MarkstreamRenderer};
|
package/dist/assets/{MobileDetailNavigation-S5rvNlSw.js → MobileDetailNavigation-BtLQo_Rl.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-CAZiOV2G.js";import{n as r}from"./runtime-fetch-BAN5Gnnp.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{s}from"./vendor-tanstack-react-query-CdqCAt40.js";import{a as c}from"./queryRuntime-BuRnpVtK.js";import{r as l,t as u}from"./button-DFX-UCuQ.js";import{i as d}from"./store-CKaWYiP4.js";import{Co as f,wo as p}from"./useMobileNavigationStore-CPjPkSWE.js";import{n as m}from"./Icon-C1nXIg7J.js";var h=e(i(),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),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`)}},ee=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}:{}}},te=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`)}},ne=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`);return e===`session`?{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===`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`)}}return b(`assistant_contact_part`)},re=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(ne);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}},ie=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`)},R=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},z=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},B=e=>e===null||typeof e==`string`,ae=e=>e===null||typeof e==`number`&&Number.isFinite(e),oe=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,se=e=>e===null||oe(e),ce=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`)&&B(t.sessionId)&&B(t.directory)&&B(t.error)&&oe(t.startedAt)&&se(t.finishedAt)&&ae(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},le=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(ce)||!B(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}},ue=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 R(a,`Failed to load scheduled task history`));return le(await a.json().catch(()=>null))},de=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await R(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`):[]}},fe=async(e,t)=>{let n=z(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 R(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},pe=async(e,t)=>{let n=z(e),i=z(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await R(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},me=async(e,t)=>{let n=z(e),i=z(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 R(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}},V=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,he=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.`)},ge=(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(he)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&V({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},_e=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),ve=e=>!!(e&&e.generation>=0),ye=(e,t)=>V({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),H=(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(ye)},be=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},xe=e=>e.map(e=>e.messageID),Se=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},Ce=e=>new Set(e),we=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Te=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),Ee=e=>({ordinal:e.ordinal,messageID:e.messageID}),De=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>V(Ee(e),Ee(r))<0),...t]},Oe=(e,t)=>{let n=e??_e(),r=ve(n),i=[...t.messages].sort(ye),a=xe(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=De(n.messages,i,t.complete);else{let e=be(i);c=H(n.messages.filter(t=>t.ordinal<e),H(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=Ce(a),d=l.length>0&&Se(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}},ke=(e,t)=>{if(!ve(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=H(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}},Ae=(e,t,n)=>{if(!ve(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=H(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&we(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=xe(t.messages),c=e.gapTargetIDs??[],l=Ce(c);return c.length>0&&Se(s,l)||t.complete||!t.nextCursor?Te({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},U={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`]},W=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},G=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),K=(e,r)=>{if(t()!==e||n()!==r)throw new _(`runtime_stale`,409)},je=(e,t,r)=>{c.setQueryData(U.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})}),c.invalidateQueries({queryKey:U.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},Me=(e,t)=>{c.setQueryData(U.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]}),c.invalidateQueries({queryKey:U.snapshot(t)})},Ne=2500,Pe=15e3,Fe=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ie=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ne:Pe}return Fe(e)?Ne:Pe},q=(e=t())=>({queryKey:U.snapshot(e),queryFn:async({signal:e})=>I(await W(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ie(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),J=new Map,Le=e=>{let n=J.get(e);if(n)n.count+=1;else{let n=p(n=>{if(t()!==e)return;let r=c.getQueryData(U.snapshot(e));(n.type===`event-stream-ready`||n.type===`contact-turn-start`||n.type===`contact-turn-end`||n.type===`assistants-changed`&&(!r||n.revision>r.revision))&&c.invalidateQueries({queryKey:U.snapshot(e),exact:!0})});J.set(e,{count:1,dispose:n})}return()=>{let t=J.get(e);t&&--t.count===0&&(t.dispose(),J.delete(e))}},Re=e=>{let n=(0,g.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=s,r=q(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=()=>Le(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),h.useEffect(l,u),c},ze=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Be=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...q(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=()=>Le(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??0},Ve=e=>e.enabled&&Fe(e),He=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...q(i),select:Ve},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=()=>Le(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??!1},Ue=(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}`},Y=async(e,t,n)=>re(await W(Ue(e,t),n?{signal:n}:{})),We=(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,X=new Map,Z=new Map,Q=e=>e.join(``),Ge=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let s=(async()=>{let a=c.getQueryData(t)??n,o=0,s=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){K(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);K(r.transport,r.runtimeGeneration);let l=c.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=Ae(l,o,u?{requestIDs:u,cursor:d}:void 0),c.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;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();Z.set(a,s);try{return await s}finally{Z.get(a)===s&&Z.delete(a)}},Ke=(e,r=t(),i=n(),a={})=>({queryKey:U.contact(e,r,i),queryFn:async({signal:t})=>{K(r,i),await f(),K(r,i);let n=U.contact(e,r,i),a=c.getQueryData(n),o=await Y(e,{limit:20},t);K(r,i);let s=Oe(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let l=Q(n);if(s.hasMessageGap&&s.gapCursor){X.delete(l);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&&X.set(l,a.view.gapCursor)}else X.delete(l);K(r,i);let u=c.getQueryData(n)??s;return a&&We(a,u)?a:u},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ie(c.getQueryData(U.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),qe=(e,r=!0)=>{let i=t(),a=n(),[o,l]=h.useState(!1),[u,d]=h.useState(null),[f,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||c.invalidateQueries({queryKey:U.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),h.useEffect(()=>p(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||c.invalidateQueries({queryKey:U.contact(e,i,a),exact:!0}))}),[e,a,i]),h.useEffect(()=>{let t=Q(U.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,g.current=null,_.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=U.contact(e,i,a),T=async()=>{if(!e||!r)return;if(g.current)return g.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;d(null),l(!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{K(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(K(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=c.getQueryData(w)??t;if(e.generation!==r.generation)return;c.setQueryData(w,ke(r,e))}catch(e){if(n.signal.aborted||v(e))return;let t=e instanceof Error?e:Error(String(e));throw d(t),t}finally{b.current===n&&(b.current=null),l(!1),g.current=null}})();return g.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(_.current)return _.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),m(!0);let s=new AbortController;y.current?.abort(),y.current=s;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{K(l.transport,l.runtimeGeneration);let e=await Ge(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(K(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(s.signal.aborted||v(e))return;throw X.set(o,l.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||f)return;let t=Q(w);X.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,f,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:u,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:f,retryMessageGap:()=>E(`explicit`)}},Je=async(e,r)=>{let i=t(),a=n();await f(),K(i,a);let o=await Y(e,{messageID:r,limit:1});if(K(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:U.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:U.snapshot(i),exact:!0});let s=c.getQueryData(U.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ye=(e,r=t(),i=n())=>({queryKey:U.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{K(r,i);let n=ie(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return K(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:U.globalScheduledTasks(e),queryFn:de,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:bt,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,l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>p(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:Ze(i).queryKey,exact:!0})}),l=[i],e[3]=o,e[4]=l):(o=e[3],l=e[4]),h.useEffect(o,l),a.data===!0},tt=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},nt=(e=t())=>({queryKey:U.capability(e),queryFn:()=>_t(),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=c,n=t())=>e.getQueryData(U.snapshot(n)),at=(e=c,n=t())=>e.fetchQuery(q(n)),ot=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:U.snapshot(r),exact:!0}),K(r,i);let a=await e.fetchQuery(q(r));return K(r,i),a},st=async(e,r)=>{let i=t(),a=n();await W(`/api/yuri/assistants/${encodeURIComponent(e)}/session/abort`,G(`POST`,{sessionID:r.sessionID,sessionGeneration:r.sessionGeneration})),K(i,a),c.invalidateQueries({queryKey:U.snapshot(i),exact:!0})},ct=15e3,lt=e=>{throw e instanceof _?e:v(e)?new _(`admission_timeout`,408):e},ut=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(ct);try{let t=ee(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...G(`POST`,{messageID:r,parts:s,language:d.getState().locale}),signal:c}));return K(a,o),je(e,t.binding,a),tt(e,a),t}catch(e){return lt(e)}},dt=async(e,r,i,a,o)=>{let s=t(),c=n(),l=te(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,G(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return K(s,c),l},ft=async(e,r=t(),i=n())=>{K(r,i);let a=te(await W(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return K(r,i),a},pt=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)K(r,i),await new Promise(e=>setTimeout(e,750)),a=await ft(a.operationID,r,i);if(K(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)},mt=async e=>{let n=t(),r=F(await W(`/api/yuri/assistants`,G(`POST`,e)));return Me(r,n),r},ht=async(e,r)=>{let i=t(),a=n(),o=F(await W(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,G(`PATCH`,{...r,expectedRevision:e.revision})));return K(i,a),Me(o,i),o},gt=async e=>{await W(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,G(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:U.snapshot(t())})},_t=async()=>O(await W(`/api/yuri/assistants/capability`)),vt=async(e,r)=>{let i=t(),a=n(),o=M(r);try{let t=P(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...G(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(K(i,a),t.assistantID!==e)throw new _(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:U.snapshot(i),exact:!0})}},yt=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=>(K(i,a),vt(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function bt(e){return e.state.data&&$e(e.state.data)?2500:15e3}var $=a();function xt(e){let t=(0,g.c)(32),{title:n,subtitle:r,backAriaLabel:i,onBack:a,backDisabled:o,actions:s,trailing:c,sticky:d,overlay:f,elevated:p}=e,h=o!==void 0&&o,_;t[0]===s?_=t[1]:(_=s===void 0?[]:s,t[0]=s,t[1]=_);let v=_,y=d!==void 0&&d,b=f!==void 0&&f,x=p!==void 0&&p,S=Array.isArray(c)?c.filter(Boolean).length:+!!c,C=x||v.some(Ct),w=y&&`yuri-mobile-detail-navigation-sticky`,T=b&&`absolute inset-x-0 top-0`,E=C?`z-[60]`:b?`z-30`:void 0,D;t[2]!==w||t[3]!==T||t[4]!==E?(D=l(`yuri-mobile-detail-navigation relative shrink-0 pt-[max(0.25rem,var(--yuri-safe-area-top,0px))]`,w,T,E),t[2]=w,t[3]=T,t[4]=E,t[5]=D):D=t[5];let O=v.length+S>1?`grid-cols-[2.75rem_minmax(0,1fr)_auto]`:`grid-cols-[2.75rem_minmax(0,1fr)_2.75rem]`,k;t[6]===O?k=t[7]:(k=l(`yuri-mobile-detail-navigation-content grid items-center gap-1 px-4`,O),t[6]=O,t[7]=k);let A;t[8]!==i||t[9]!==h||t[10]!==a?(A=a?(0,$.jsx)(u,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`justify-self-start`,onClick:a,disabled:h,"aria-label":i,children:(0,$.jsx)(m,{name:`arrow-left-s`,className:`size-5`})}):(0,$.jsx)(`span`,{"aria-hidden":`true`}),t[8]=i,t[9]=h,t[10]=a,t[11]=A):A=t[11];let j;t[12]===n?j=t[13]:(j=(0,$.jsx)(`div`,{className:`yuri-mobile-detail-title w-full truncate typography-ui-label font-medium text-foreground`,children:n}),t[12]=n,t[13]=j);let M;t[14]===r?M=t[15]:(M=r?(0,$.jsx)(`div`,{className:`yuri-mobile-detail-subtitle w-full truncate text-muted-foreground`,"aria-live":`polite`,children:r}):null,t[14]=r,t[15]=M);let N;t[16]!==j||t[17]!==M?(N=(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:[j,M]}),t[16]=j,t[17]=M,t[18]=N):N=t[18];let P;t[19]===v?P=t[20]:(P=v.map(St),t[19]=v,t[20]=P);let F;t[21]!==P||t[22]!==c?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c,P]}),t[21]=P,t[22]=c,t[23]=F):F=t[23];let I;t[24]!==k||t[25]!==A||t[26]!==N||t[27]!==F?(I=(0,$.jsxs)(`div`,{className:k,children:[A,N,F]}),t[24]=k,t[25]=A,t[26]=N,t[27]=F,t[28]=I):I=t[28];let L;return t[29]!==D||t[30]!==I?(L=(0,$.jsx)(`header`,{className:D,children:I}),t[29]=D,t[30]=I,t[31]=L):L=t[31],L}function St(e,t){return(0,$.jsx)(u,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:l(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 Ct(e){return e.elevated}export{me as A,et as C,pe as D,he as E,_ as M,y as N,de as O,v as P,Qe as S,ge as T,qe as _,mt as a,Be as b,_t as c,vt as d,it as f,rt as g,ht as h,Je as i,fe as j,ue as k,ot as l,dt as m,st as n,gt as o,ut as p,Ke as r,at as s,xt as t,yt as u,Xe as v,pt as w,He as x,Re as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-CAZiOV2G.js";import{n as r}from"./runtime-fetch-BAN5Gnnp.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{s}from"./vendor-tanstack-react-query-CdqCAt40.js";import{a as c}from"./queryRuntime-BuRnpVtK.js";import{r as l,t as u}from"./button-DFX-UCuQ.js";import{i as d}from"./store-CKaWYiP4.js";import{Eo as f,To as p}from"./useMobileNavigationStore-CjljWARe.js";import{n as m}from"./Icon-C1nXIg7J.js";var h=e(i(),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),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`)}},ee=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}:{}}},te=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`)}},ne=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`);return e===`session`?{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===`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`)}}return b(`assistant_contact_part`)},re=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(ne);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}},ie=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`)},R=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},z=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},B=e=>e===null||typeof e==`string`,ae=e=>e===null||typeof e==`number`&&Number.isFinite(e),oe=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,se=e=>e===null||oe(e),ce=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`)&&B(t.sessionId)&&B(t.directory)&&B(t.error)&&oe(t.startedAt)&&se(t.finishedAt)&&ae(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},le=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(ce)||!B(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}},ue=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 R(a,`Failed to load scheduled task history`));return le(await a.json().catch(()=>null))},de=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await R(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`):[]}},fe=async(e,t)=>{let n=z(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 R(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},pe=async(e,t)=>{let n=z(e),i=z(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await R(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},me=async(e,t)=>{let n=z(e),i=z(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 R(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}},V=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,he=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.`)},ge=(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(he)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&V({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},_e=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),ve=e=>!!(e&&e.generation>=0),ye=(e,t)=>V({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),H=(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(ye)},be=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},xe=e=>e.map(e=>e.messageID),Se=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},Ce=e=>new Set(e),we=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Te=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),Ee=e=>({ordinal:e.ordinal,messageID:e.messageID}),De=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>V(Ee(e),Ee(r))<0),...t]},Oe=(e,t)=>{let n=e??_e(),r=ve(n),i=[...t.messages].sort(ye),a=xe(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=De(n.messages,i,t.complete);else{let e=be(i);c=H(n.messages.filter(t=>t.ordinal<e),H(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=Ce(a),d=l.length>0&&Se(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}},ke=(e,t)=>{if(!ve(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=H(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}},Ae=(e,t,n)=>{if(!ve(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=H(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&we(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=xe(t.messages),c=e.gapTargetIDs??[],l=Ce(c);return c.length>0&&Se(s,l)||t.complete||!t.nextCursor?Te({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},U={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`]},W=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},G=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),K=(e,r)=>{if(t()!==e||n()!==r)throw new _(`runtime_stale`,409)},je=(e,t,r)=>{c.setQueryData(U.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})}),c.invalidateQueries({queryKey:U.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},Me=(e,t)=>{c.setQueryData(U.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]}),c.invalidateQueries({queryKey:U.snapshot(t)})},Ne=2500,Pe=15e3,Fe=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ie=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ne:Pe}return Fe(e)?Ne:Pe},q=(e=t())=>({queryKey:U.snapshot(e),queryFn:async({signal:e})=>I(await W(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ie(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),J=new Map,Le=e=>{let n=J.get(e);if(n)n.count+=1;else{let n=f(n=>{if(t()!==e)return;let r=c.getQueryData(U.snapshot(e));(n.type===`event-stream-ready`||n.type===`contact-turn-start`||n.type===`contact-turn-end`||n.type===`assistants-changed`&&(!r||n.revision>r.revision))&&c.invalidateQueries({queryKey:U.snapshot(e),exact:!0})});J.set(e,{count:1,dispose:n})}return()=>{let t=J.get(e);t&&--t.count===0&&(t.dispose(),J.delete(e))}},Re=e=>{let n=(0,g.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=s,r=q(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=()=>Le(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),h.useEffect(l,u),c},ze=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Be=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...q(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=()=>Le(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??0},Ve=e=>e.enabled&&Fe(e),He=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...q(i),select:Ve},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=()=>Le(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??!1},Ue=(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}`},Y=async(e,t,n)=>re(await W(Ue(e,t),n?{signal:n}:{})),We=(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,X=new Map,Z=new Map,Q=e=>e.join(``),Ge=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let s=(async()=>{let a=c.getQueryData(t)??n,o=0,s=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){K(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);K(r.transport,r.runtimeGeneration);let l=c.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=Ae(l,o,u?{requestIDs:u,cursor:d}:void 0),c.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;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();Z.set(a,s);try{return await s}finally{Z.get(a)===s&&Z.delete(a)}},Ke=(e,r=t(),i=n(),a={})=>({queryKey:U.contact(e,r,i),queryFn:async({signal:t})=>{K(r,i),await p(),K(r,i);let n=U.contact(e,r,i),a=c.getQueryData(n),o=await Y(e,{limit:20},t);K(r,i);let s=Oe(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let l=Q(n);if(s.hasMessageGap&&s.gapCursor){X.delete(l);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&&X.set(l,a.view.gapCursor)}else X.delete(l);K(r,i);let u=c.getQueryData(n)??s;return a&&We(a,u)?a:u},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ie(c.getQueryData(U.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),qe=(e,r=!0)=>{let i=t(),a=n(),[o,l]=h.useState(!1),[u,d]=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||c.invalidateQueries({queryKey:U.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),h.useEffect(()=>f(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||c.invalidateQueries({queryKey:U.contact(e,i,a),exact:!0}))}),[e,a,i]),h.useEffect(()=>{let t=Q(U.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,g.current=null,_.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=U.contact(e,i,a),T=async()=>{if(!e||!r)return;if(g.current)return g.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;d(null),l(!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{K(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(K(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=c.getQueryData(w)??t;if(e.generation!==r.generation)return;c.setQueryData(w,ke(r,e))}catch(e){if(n.signal.aborted||v(e))return;let t=e instanceof Error?e:Error(String(e));throw d(t),t}finally{b.current===n&&(b.current=null),l(!1),g.current=null}})();return g.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(_.current)return _.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),m(!0);let s=new AbortController;y.current?.abort(),y.current=s;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{K(l.transport,l.runtimeGeneration);let e=await Ge(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(K(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(s.signal.aborted||v(e))return;throw X.set(o,l.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);X.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:u,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:p,retryMessageGap:()=>E(`explicit`)}},Je=async(e,r)=>{let i=t(),a=n();await p(),K(i,a);let o=await Y(e,{messageID:r,limit:1});if(K(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:U.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:U.snapshot(i),exact:!0});let s=c.getQueryData(U.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ye=(e,r=t(),i=n())=>({queryKey:U.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{K(r,i);let n=ie(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return K(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:U.globalScheduledTasks(e),queryFn:de,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:bt,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,l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>f(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:Ze(i).queryKey,exact:!0})}),l=[i],e[3]=o,e[4]=l):(o=e[3],l=e[4]),h.useEffect(o,l),a.data===!0},tt=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},nt=(e=t())=>({queryKey:U.capability(e),queryFn:()=>_t(),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=c,n=t())=>e.getQueryData(U.snapshot(n)),at=(e=c,n=t())=>e.fetchQuery(q(n)),ot=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:U.snapshot(r),exact:!0}),K(r,i);let a=await e.fetchQuery(q(r));return K(r,i),a},st=async(e,r)=>{let i=t(),a=n();await W(`/api/yuri/assistants/${encodeURIComponent(e)}/session/abort`,G(`POST`,{sessionID:r.sessionID,sessionGeneration:r.sessionGeneration})),K(i,a),c.invalidateQueries({queryKey:U.snapshot(i),exact:!0})},ct=15e3,lt=e=>{throw e instanceof _?e:v(e)?new _(`admission_timeout`,408):e},ut=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(ct);try{let t=ee(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...G(`POST`,{messageID:r,parts:s,language:d.getState().locale}),signal:c}));return K(a,o),je(e,t.binding,a),tt(e,a),t}catch(e){return lt(e)}},dt=async(e,r,i,a,o)=>{let s=t(),c=n(),l=te(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,G(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return K(s,c),l},ft=async(e,r=t(),i=n())=>{K(r,i);let a=te(await W(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return K(r,i),a},pt=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)K(r,i),await new Promise(e=>setTimeout(e,750)),a=await ft(a.operationID,r,i);if(K(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)},mt=async e=>{let n=t(),r=F(await W(`/api/yuri/assistants`,G(`POST`,e)));return Me(r,n),r},ht=async(e,r)=>{let i=t(),a=n(),o=F(await W(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,G(`PATCH`,{...r,expectedRevision:e.revision})));return K(i,a),Me(o,i),o},gt=async e=>{await W(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,G(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:U.snapshot(t())})},_t=async()=>O(await W(`/api/yuri/assistants/capability`)),vt=async(e,r)=>{let i=t(),a=n(),o=M(r);try{let t=P(await W(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...G(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(K(i,a),t.assistantID!==e)throw new _(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:U.snapshot(i),exact:!0})}},yt=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=>(K(i,a),vt(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function bt(e){return e.state.data&&$e(e.state.data)?2500:15e3}var $=a();function xt(e){let t=(0,g.c)(32),{title:n,subtitle:r,backAriaLabel:i,onBack:a,backDisabled:o,actions:s,trailing:c,sticky:d,overlay:f,elevated:p}=e,h=o!==void 0&&o,_;t[0]===s?_=t[1]:(_=s===void 0?[]:s,t[0]=s,t[1]=_);let v=_,y=d!==void 0&&d,b=f!==void 0&&f,x=p!==void 0&&p,S=Array.isArray(c)?c.filter(Boolean).length:+!!c,C=x||v.some(Ct),w=y&&`yuri-mobile-detail-navigation-sticky`,T=b&&`absolute inset-x-0 top-0`,E=C?`z-[60]`:b?`z-30`:void 0,D;t[2]!==w||t[3]!==T||t[4]!==E?(D=l(`yuri-mobile-detail-navigation relative shrink-0 pt-[max(0.25rem,var(--yuri-safe-area-top,0px))]`,w,T,E),t[2]=w,t[3]=T,t[4]=E,t[5]=D):D=t[5];let O=v.length+S>1?`grid-cols-[2.75rem_minmax(0,1fr)_auto]`:`grid-cols-[2.75rem_minmax(0,1fr)_2.75rem]`,k;t[6]===O?k=t[7]:(k=l(`yuri-mobile-detail-navigation-content grid items-center gap-1 px-4`,O),t[6]=O,t[7]=k);let A;t[8]!==i||t[9]!==h||t[10]!==a?(A=a?(0,$.jsx)(u,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`justify-self-start`,onClick:a,disabled:h,"aria-label":i,children:(0,$.jsx)(m,{name:`arrow-left-s`,className:`size-5`})}):(0,$.jsx)(`span`,{"aria-hidden":`true`}),t[8]=i,t[9]=h,t[10]=a,t[11]=A):A=t[11];let j;t[12]===n?j=t[13]:(j=(0,$.jsx)(`div`,{className:`yuri-mobile-detail-title w-full truncate typography-ui-label font-medium text-foreground`,children:n}),t[12]=n,t[13]=j);let M;t[14]===r?M=t[15]:(M=r?(0,$.jsx)(`div`,{className:`yuri-mobile-detail-subtitle w-full truncate text-muted-foreground`,"aria-live":`polite`,children:r}):null,t[14]=r,t[15]=M);let N;t[16]!==j||t[17]!==M?(N=(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:[j,M]}),t[16]=j,t[17]=M,t[18]=N):N=t[18];let P;t[19]===v?P=t[20]:(P=v.map(St),t[19]=v,t[20]=P);let F;t[21]!==P||t[22]!==c?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c,P]}),t[21]=P,t[22]=c,t[23]=F):F=t[23];let I;t[24]!==k||t[25]!==A||t[26]!==N||t[27]!==F?(I=(0,$.jsxs)(`div`,{className:k,children:[A,N,F]}),t[24]=k,t[25]=A,t[26]=N,t[27]=F,t[28]=I):I=t[28];let L;return t[29]!==D||t[30]!==I?(L=(0,$.jsx)(`header`,{className:D,children:I}),t[29]=D,t[30]=I,t[31]=L):L=t[31],L}function St(e,t){return(0,$.jsx)(u,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:l(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 Ct(e){return e.elevated}export{me as A,et as C,pe as D,he as E,_ as M,y as N,de as O,v as P,Qe as S,ge as T,qe as _,mt as a,Be as b,_t as c,vt as d,it as f,rt as g,ht as h,Je as i,fe as j,ue as k,ot as l,dt as m,st as n,gt as o,ut as p,Ke as r,at as s,xt as t,yt as u,Xe as v,pt as w,He as x,Re as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,nt as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{r as a}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{r as o,t as s}from"./button-DFX-UCuQ.js";import{n as c}from"./Icon-C1nXIg7J.js";import{a as l,s as u}from"./vendor-framer-motion-DsGBcZHB.js";import{t as d}from"./MobileWindowStack-DGLdgoGr.js";var f=e(t(),1),p=i(),m=r(),h=e(n(),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=o(`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 s;return t[6]!==r||t[7]!==i?(s=(0,m.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=s):s=t[8],s}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:c,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),k=(0,f.useRef)(null),A=(0,f.useRef)(null),oe=(0,f.useRef)(null),j=(0,f.useRef)(!1),M=(0,f.useRef)(null),N;t[0]===n?N=t[1]:(N=()=>{let e=n.current;if(!e)return 0;if(!M.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return M.current.layoutHeight-t},t[0]=n,t[1]=N);let P=a(N),F;t[2]===n?F=t[3]:(F=e=>{let t=n.current;t&&(M.current?t.style.translate=`0 ${M.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=F);let I=a(F),L;t[4]!==m||t[5]!==n||t[6]!==I?(L=(e,t)=>{let r=n.current;if(r){if(m===`translate`&&!M.current){let e=Math.max(...t.map(ae))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;M.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=M.current?`translate`:`height`,I(e)}},t[4]=m,t[5]=n,t[6]=I,t[7]=L):L=t[7];let R=a(L),z;t[8]===n?z=t[9]:(z=()=>{let e=n.current;e&&(M.current&&(e.style.translate=``,Object.assign(e.style,M.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),M.current=null},t[8]=n,t[9]=z);let B=a(z),V;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{k.current!==null&&cancelAnimationFrame(k.current),k.current=null,A.current=null,oe.current?.cancel(),oe.current=null},t[10]=V):V=t[10];let H=a(V),U;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{let e=E.current;E.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=U):U=t[11];let W=a(U),se;t[12]!==H||t[13]!==B||t[14]!==i||t[15]!==c||t[16]!==R||t[17]!==P||t[18]!==W||t[19]!==n||t[20]!==I?(se=(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??P();H(),I(f);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(R(f,p),W(),v(!1),b(!1),x.current=e,g(e),I(m.height),c?.(e),!o||Math.abs(f-m.height)<1||typeof d.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){B();return}b(!0);let h=M.current?.layoutHeight,_=m.height-f,y=l([d],h===void 0?{height:[`${f}px`,`${m.height}px`]}:{translate:[`0 ${h-f}px`,`0 ${h-m.height}px`]},{type:u,stiffness:576,damping:48,mass:1,velocity:s*1e3*100/_,restDelta:20/Math.abs(_),restSpeed:500/Math.abs(_)});oe.current=y,y.finished.catch(O).then(()=>{oe.current===y&&(oe.current=null,B(),b(!1))})},t[12]=H,t[13]=B,t[14]=i,t[15]=c,t[16]=R,t[17]=P,t[18]=W,t[19]=n,t[20]=I,t[21]=se):se=t[21];let G=a(se),ce;t[22]!==H||t[23]!==i||t[24]!==o||t[25]!==R||t[26]!==P||t[27]!==n||t[28]!==I?(ce=e=>{if(E.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=P();H(),I(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(ie)),maximum:Math.max(...r.map(re)),samples:[{height:t,time:e.timeStamp}]},j.current=!1,R(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=H,t[23]=i,t[24]=o,t[25]=R,t[26]=P,t[27]=n,t[28]=I,t[29]=ce):ce=t[29];let le=a(ce),K;t[30]!==m||t[31]!==I?(K=e=>{let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(j.current=!0),S(t.samples,t.height+n,e.timeStamp);let r=T(t.height+n,t.minimum,t.maximum);A.current=m===`height`?Math.max(t.minimum,r):r,k.current===null&&(k.current=requestAnimationFrame(()=>{k.current=null,A.current!==null&&I(A.current)})),e.preventDefault()},t[30]=m,t[31]=I,t[32]=K):K=t[32];let ue=a(K),q;t[33]!==H||t[34]!==s||t[35]!==P||t[36]!==W||t[37]!==G||t[38]!==n?(q=(e,t)=>{let r=E.current;if(!r||r.pointerId!==e.pointerId)return;let i=A.current??P(),a=r.height+r.startY-e.clientY;t||S(r.samples,a,e.timeStamp);let o=t?0:C(r.samples,e.timeStamp);if(W(),!t&&j.current&&s?.(i,o,r.height))H(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!j.current?r.point:w(r.points,r.point,i,o,a-r.height);G(e,i,!0,o)}e.preventDefault()},t[33]=H,t[34]=s,t[35]=P,t[36]=W,t[37]=G,t[38]=n,t[39]=q):q=t[39];let de=a(q),J;t[40]!==i||t[41]!==G?(J=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(te).find(e=>e.height<n.height-1);r&&G(r.id)},t[40]=i,t[41]=G,t[42]=J):J=t[42];let fe=a(J),pe;t[43]!==i||t[44]!==G||t[45]!==fe?(pe=()=>{if(j.current){j.current=!1;return}let e=[...i()].sort(ee);x.current===e.at(-1)?.id?G(e[0].id):fe(1)},t[43]=i,t[44]=G,t[45]=fe,t[46]=pe):pe=t[46];let Y=a(pe),X;t[47]!==i||t[48]!==Y||t[49]!==G||t[50]!==fe?(X=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(D);t.length&&(e.key===`ArrowUp`?fe(1):e.key===`ArrowDown`?fe(-1):e.key===`Home`?G(t.at(-1).id):e.key===`End`?G(t[0].id):Y())},t[47]=i,t[48]=Y,t[49]=G,t[50]=fe,t[51]=X):X=t[51];let me=a(X),Z;t[52]!==H||t[53]!==B||t[54]!==r||t[55]!==W||t[56]!==n?(Z=()=>{H(),W(),B(),x.current=r,g(r),v(!1),b(!1),j.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=H,t[53]=B,t[54]=r,t[55]=W,t[56]=n,t[57]=Z):Z=t[57];let Q=a(Z),he,$;t[58]!==H||t[59]!==B||t[60]!==W?(he=()=>()=>{H(),W(),B()},$=[H,W,B],t[58]=H,t[59]=B,t[60]=W,t[61]=he,t[62]=$):(he=t[61],$=t[62]),(0,f.useLayoutEffect)(he,$);let ge;t[63]===de?ge=t[64]:(ge=e=>de(e,!1),t[63]=de,t[64]=ge);let _e=a(ge),ve;t[65]===de?ve=t[66]:(ve=e=>de(e,!0),t[65]=de,t[66]=ve);let ye=a(ve),be;t[67]===de?be=t[68]:(be=e=>de(e,!0),t[67]=de,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==Y||t[71]!==me||t[72]!==le||t[73]!==ue||t[74]!==Q||t[75]!==G||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:G,reset:Q,handlePointerDown:le,handlePointerMove:ue,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:Y,handleKeyDown:me},t[69]=_,t[70]=Y,t[71]=me,t[72]=le,t[73]=ue,t[74]=Q,t[75]=G,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function D(e,t){return e.height-t.height}function ee(e,t){return e.height-t.height}function te(e,t){return t.height-e.height}function ne(e,t){return e.height-t.height}function re(e){return e.height}function ie(e){return e.height}function O(){}function ae(e){return e.height}var k=.72,A=.98,oe=64,j=()=>Math.max(1,window.innerHeight),M=(e,t)=>{let n=Math.max(1,e)*k;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},N=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?k:r,l=i!==void 0&&i,u=s===void 0?oe: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=j(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(m.current=M(e,d.current.getBoundingClientRect().height)),[{id:k,height:Math.min(t,M(e,l?m.current:void 0))},{id:A,height:Math.min(t,e*A)}]},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||j(),i=Math.min(r,M(j(),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},P=e=>{let t=(0,p.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;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]!==i?(a=(0,m.jsx)(y,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":k*100,"aria-valuemax":A*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,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]=i,t[11]=a):a=t[11],a},F=new WeakMap;function I(e){F.set(e.currentTarget,!0)}function L(e){if(F.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 R(e){e.target===e.currentTarget&&I(e)}function z(e){return e.target===e.currentTarget&&L(e)}var B=(0,f.createContext)(!0),V=(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)))]`},H=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),U=(e,t)=>{let n=H(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)`}},W=(e,t)=>{let n=H(t);return e===`present`?n:1-n},se=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,G=e=>+!!e,ce=`mobile-sessions`,le=new Map,K=e=>le.get(e)??null,ue=(e,t)=>(le.set(e,t),()=>{le.get(e)===t&&le.delete(e)}),q=`.overlay-scrollbar-container`,de=1,J=e=>e===`left`||e===`right`?`x`:`y`,fe=e=>e===`bottom`||e===`right`?1:-1,pe=(e,t,n)=>{let r=J(e)===`x`?t:n;return Math.max(0,r*fe(e))},Y=(e,t,n,r,i)=>{let a=pe(e,t,n),o=Math.abs(J(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},X=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),me=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),Z=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,Q=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,he=(e,t,n=de)=>{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},$=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},ge=(e,t)=>{let n=window.getComputedStyle(e),r=J(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(ge(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&ge(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=J(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=Q(e.velocity,a,i,n-e.lastVelocityTime,fe(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??q);if(l&&!he(l,a.edge))return;let u=e.getBoundingClientRect(),d=J(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:J(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:me(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=$(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(!Y(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=K(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(X(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=$(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(X(t.distance,t.motionDistance));let o=Z(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:s,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(t),T=f.useRef(n),E=f.useRef(_),D=f.useRef(y),ee=f.useRef(0),te=f.useRef(0),ne=f.useRef(null),re=f.useRef([]),ie=f.useRef(null),O=f.useRef(`standard`),ae=f.useRef(`present`),k=f.useRef(0),A=f.useRef(!1),oe=f.useRef(t),j=f.useRef(!1),M=f.useRef(t),N=f.useRef(null),[P,F]=f.useState(t),[I,L]=f.useState(t),[H,ce]=f.useState(`standard`),[le,K]=f.useState(!1),q=H===`interactive-present`,de=f.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),J=I&&!q&&de===e,fe=ve({motionId:e,edge:a,disabled:!g,...typeof g==`object`?g:{}}),pe=f.useCallback(e=>{C.current=e,fe(e),typeof p==`function`?p(e):p&&typeof p==`object`&&(p.current=e)},[fe,p]),Y=f.useCallback(()=>{M.current&&(M.current=!1,L(!1),r||F(!1),E.current?.())},[r]);w.current=t,T.current=n,E.current=_,D.current=y,f.useLayoutEffect(()=>{D.current?.(I&&q)},[I,q]),typeof document<`u`&&!x.current&&(x.current=we());let X=f.useCallback(e=>{let t=U(a,e);ee.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]),me=f.useCallback(()=>{ne.current!==null&&window.cancelAnimationFrame(ne.current),ne.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=[]},[]),he=f.useCallback(()=>{me();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:ee.current),Q(e.animations),ie.current=null}else Q();Z(),K(!1)},[X,Q,me,Z]),$=f.useCallback((e,t)=>{if(ie.current?.target===e)return;he();let n=ee.current,r=S.current,i=C.current;if(K(!0),!r||!i||Te()||n===e){X(e),Z(),K(!1),t?.();return}let o=U(a,n),s=U(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(),K(!1),t?.())})},[X,Q,Z,a,he]);if(f.useLayoutEffect(()=>{j.current=P,P&&X(te.current)},[X,P]),f.useLayoutEffect(()=>{M.current=I},[I]),f.useEffect(()=>{t&&!j.current&&(te.current=ee.current,F(!0)),t&&!M.current&&(M.current=!0,L(!0)),j.current&&O.current===`standard`&&$(G(t),()=>{!w.current&&O.current===`standard`&&Y()})},[Y,t,$]),f.useLayoutEffect(()=>{!P||O.current!==`standard`||$(+!!t,()=>{!w.current&&O.current===`standard`&&Y()})},[Y,P,t,$]),f.useEffect(()=>{if(!(!I||q))return window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[I,q]),f.useEffect(()=>{if(!(!I||q))return d.add({id:e,onClose:()=>T.current(!1)},document.body)},[I,e,q]),f.useEffect(()=>{if(!I||q||!J)return;let e=C.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;e?.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]??e,i=n.at(-1)??e;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})}},[I,q,J]),N.current={begin:e=>{if(e===`dismiss`&&(!M.current||O.current===`interactive-present`))return!1;he(),k.current+=1,A.current=!0,ae.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return O.current=t,ce(t),K(!0),e===`present`&&(te.current=ee.current,M.current=!0,L(!0),F(!0)),!0},update:e=>{A.current&&(te.current=W(ae.current,e),ne.current===null&&(ne.current=window.requestAnimationFrame(()=>{ne.current=null,A.current&&X(te.current)})))},finish:e=>{if(!A.current)return;A.current=!1;let t=k.current,n=ae.current,r=se(n,e);ne.current!==null&&(me(),X(te.current)),$(r,()=>{t===k.current&&(e===`commit`&&T.current(n===`present`),n===`present`&&e===`cancel`&&!w.current&&Y(),O.current=`standard`,ce(`standard`),r===0&&Y())})},interrupt:()=>{k.current+=1,A.current=!1;let e=O.current===`interactive-present`&&!w.current;e||(O.current=`standard`,ce(`standard`)),he(),$(G(w.current),()=>{w.current||Y(),e&&(O.current=`standard`,ce(`standard`))})}},f.useLayoutEffect(()=>{let e=oe.current;oe.current=t,e&&!t&&O.current!==`standard`&&N.current?.interrupt()},[t]),f.useEffect(()=>{let t=ue(e,{begin:e=>N.current?.begin(e)??!1,update:e=>N.current?.update(e),finish:e=>N.current?.finish(e),interrupt:()=>N.current?.interrupt()});return()=>{t(),me(),Q(),ie.current=null,Z(),N.current=null}},[Q,me,Z,e]),!P||!x.current)return null;let ge=(0,m.jsx)(`div`,{ref:S,className:o(`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`,!I&&!q&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(I),role:q?void 0:`dialog`,"aria-label":q?void 0:b,"aria-modal":I&&J?`true`:void 0,"aria-hidden":q||!I||!J||void 0,inert:q||!I||!J||void 0,onPointerDown:R,onClick:e=>{!I||q||!J||z(e)&&T.current(!1)},children:(0,m.jsx)(`div`,{ref:pe,tabIndex:-1,className:o(`yuri-mobile-floating-shell`,V(i,a),u),"data-yuri-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:(0,m.jsx)(B.Provider,{value:J,children:s})})});return(0,h.createPortal)(ge,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)(47),{id:n,open:r,onOpenChange:i,title:a,leading:l,trailing:u,ariaLabel:d,closeAriaLabel:h,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,className:b,children:x}=e,S=_!==void 0&&_,C=v!==void 0&&v,w=S?A:void 0,T;t[0]!==i||t[1]!==r?(T=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=T):T=t[2];let E;t[3]!==C||t[4]!==w||t[5]!==T?(E={initialSnapPoint:w,fitContent:C,onDismiss:T},t[3]=C,t[4]=w,t[5]=T,t[6]=E):E=t[6];let D=N(E),[ee,te]=f.useState(null),ne=a!=null||l!=null||u!=null,re=D.snapPoint===A,ie=re||!C,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=O):O=t[7];let ae=re?`h-[98dvh] max-h-[98dvh]`:C?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,k=D.surfaceRef,oe=D.reset,j=ie&&`flex-1`,M;t[8]===j?M=t[9]:(M=o(`flex min-h-0 flex-col`,j),t[8]=j,t[9]=M);let F;t[10]!==g||t[11]!==D?(F=(0,m.jsx)(P,{controller:D,ariaLabel:g}),t[10]=g,t[11]=D,t[12]=F):F=t[12];let I;t[13]!==h||t[14]!==C||t[15]!==ne||t[16]!==l||t[17]!==i||t[18]!==a||t[19]!==u?(I=ne?(0,m.jsxs)(`div`,{className:C?`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:[l?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:l}):null,(0,m.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}),u?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:u}):null,(0,m.jsx)(`div`,{ref:te,className:`contents`}),(0,m.jsx)(s,{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)(c,{name:`close`,className:`size-5`})})]}):null,t[13]=h,t[14]=C,t[15]=ne,t[16]=l,t[17]=i,t[18]=a,t[19]=u,t[20]=I):I=t[20];let L;t[21]!==F||t[22]!==I?(L=(0,m.jsxs)(`div`,{className:`shrink-0`,children:[F,I]}),t[21]=F,t[22]=I,t[23]=L):L=t[23];let R=ie&&`flex-1`,z;t[24]!==y||t[25]!==R?(z=o(`flex min-h-0 flex-col overflow-hidden`,R,y),t[24]=y,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==x||t[28]!==z?(B=(0,m.jsx)(`div`,{className:z,"data-page-scroll-lock":`true`,children:x}),t[27]=x,t[28]=z,t[29]=B):B=t[29];let V;t[30]!==M||t[31]!==L||t[32]!==B?(V=(0,m.jsxs)(`div`,{className:M,children:[L,B]}),t[30]=M,t[31]=L,t[32]=B,t[33]=V):V=t[33];let H;t[34]!==d||t[35]!==b||t[36]!==n||t[37]!==i||t[38]!==r||t[39]!==D.reset||t[40]!==D.surfaceRef||t[41]!==V||t[42]!==ae?(H=(0,m.jsx)(Ee,{id:n,className:b,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:O,ariaLabel:d,surfaceClassName:ae,surfaceElementRef:k,onExitComplete:oe,children:V}),t[34]=d,t[35]=b,t[36]=n,t[37]=i,t[38]=r,t[39]=D.reset,t[40]=D.surfaceRef,t[41]=V,t[42]=ae,t[43]=H):H=t[43];let U;return t[44]!==ee||t[45]!==H?(U=(0,m.jsx)(De.Provider,{value:ee,children:H}),t[44]=ee,t[45]=H,t[46]=U):U=t[46],U};export{_ as C,v as S,P as _,pe as a,E as b,Y as c,K as d,B as f,z as g,R as h,me as i,Z as l,I as m,Oe as n,X as o,L as p,Ee as r,Q as s,ke as t,ce as u,A as v,y as x,N as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,nt as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{r as a}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{r as o,t as s}from"./button-DFX-UCuQ.js";import{a as c,s as l}from"./vendor-framer-motion-D8hQsul-.js";import{n as u}from"./Icon-C1nXIg7J.js";import{t as d}from"./MobileWindowStack-DGLdgoGr.js";var f=e(t(),1),p=i(),m=r(),h=e(n(),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=o(`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 s;return t[6]!==r||t[7]!==i?(s=(0,m.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=s):s=t[8],s}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),k=(0,f.useRef)(null),A=(0,f.useRef)(null),oe=(0,f.useRef)(null),j=(0,f.useRef)(!1),M=(0,f.useRef)(null),N;t[0]===n?N=t[1]:(N=()=>{let e=n.current;if(!e)return 0;if(!M.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return M.current.layoutHeight-t},t[0]=n,t[1]=N);let P=a(N),F;t[2]===n?F=t[3]:(F=e=>{let t=n.current;t&&(M.current?t.style.translate=`0 ${M.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=F);let I=a(F),L;t[4]!==m||t[5]!==n||t[6]!==I?(L=(e,t)=>{let r=n.current;if(r){if(m===`translate`&&!M.current){let e=Math.max(...t.map(ae))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;M.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=M.current?`translate`:`height`,I(e)}},t[4]=m,t[5]=n,t[6]=I,t[7]=L):L=t[7];let R=a(L),z;t[8]===n?z=t[9]:(z=()=>{let e=n.current;e&&(M.current&&(e.style.translate=``,Object.assign(e.style,M.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),M.current=null},t[8]=n,t[9]=z);let B=a(z),V;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{k.current!==null&&cancelAnimationFrame(k.current),k.current=null,A.current=null,oe.current?.cancel(),oe.current=null},t[10]=V):V=t[10];let H=a(V),U;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{let e=E.current;E.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=U):U=t[11];let W=a(U),se;t[12]!==H||t[13]!==B||t[14]!==i||t[15]!==u||t[16]!==R||t[17]!==P||t[18]!==W||t[19]!==n||t[20]!==I?(se=(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??P();H(),I(f);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(R(f,p),W(),v(!1),b(!1),x.current=e,g(e),I(m.height),u?.(e),!o||Math.abs(f-m.height)<1||typeof d.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){B();return}b(!0);let h=M.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(_)});oe.current=y,y.finished.catch(O).then(()=>{oe.current===y&&(oe.current=null,B(),b(!1))})},t[12]=H,t[13]=B,t[14]=i,t[15]=u,t[16]=R,t[17]=P,t[18]=W,t[19]=n,t[20]=I,t[21]=se):se=t[21];let G=a(se),ce;t[22]!==H||t[23]!==i||t[24]!==o||t[25]!==R||t[26]!==P||t[27]!==n||t[28]!==I?(ce=e=>{if(E.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=P();H(),I(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(ie)),maximum:Math.max(...r.map(re)),samples:[{height:t,time:e.timeStamp}]},j.current=!1,R(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=H,t[23]=i,t[24]=o,t[25]=R,t[26]=P,t[27]=n,t[28]=I,t[29]=ce):ce=t[29];let le=a(ce),K;t[30]!==m||t[31]!==I?(K=e=>{let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(j.current=!0),S(t.samples,t.height+n,e.timeStamp);let r=T(t.height+n,t.minimum,t.maximum);A.current=m===`height`?Math.max(t.minimum,r):r,k.current===null&&(k.current=requestAnimationFrame(()=>{k.current=null,A.current!==null&&I(A.current)})),e.preventDefault()},t[30]=m,t[31]=I,t[32]=K):K=t[32];let ue=a(K),q;t[33]!==H||t[34]!==s||t[35]!==P||t[36]!==W||t[37]!==G||t[38]!==n?(q=(e,t)=>{let r=E.current;if(!r||r.pointerId!==e.pointerId)return;let i=A.current??P(),a=r.height+r.startY-e.clientY;t||S(r.samples,a,e.timeStamp);let o=t?0:C(r.samples,e.timeStamp);if(W(),!t&&j.current&&s?.(i,o,r.height))H(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!j.current?r.point:w(r.points,r.point,i,o,a-r.height);G(e,i,!0,o)}e.preventDefault()},t[33]=H,t[34]=s,t[35]=P,t[36]=W,t[37]=G,t[38]=n,t[39]=q):q=t[39];let de=a(q),J;t[40]!==i||t[41]!==G?(J=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(te).find(e=>e.height<n.height-1);r&&G(r.id)},t[40]=i,t[41]=G,t[42]=J):J=t[42];let fe=a(J),pe;t[43]!==i||t[44]!==G||t[45]!==fe?(pe=()=>{if(j.current){j.current=!1;return}let e=[...i()].sort(ee);x.current===e.at(-1)?.id?G(e[0].id):fe(1)},t[43]=i,t[44]=G,t[45]=fe,t[46]=pe):pe=t[46];let Y=a(pe),X;t[47]!==i||t[48]!==Y||t[49]!==G||t[50]!==fe?(X=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(D);t.length&&(e.key===`ArrowUp`?fe(1):e.key===`ArrowDown`?fe(-1):e.key===`Home`?G(t.at(-1).id):e.key===`End`?G(t[0].id):Y())},t[47]=i,t[48]=Y,t[49]=G,t[50]=fe,t[51]=X):X=t[51];let me=a(X),Z;t[52]!==H||t[53]!==B||t[54]!==r||t[55]!==W||t[56]!==n?(Z=()=>{H(),W(),B(),x.current=r,g(r),v(!1),b(!1),j.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=H,t[53]=B,t[54]=r,t[55]=W,t[56]=n,t[57]=Z):Z=t[57];let Q=a(Z),he,$;t[58]!==H||t[59]!==B||t[60]!==W?(he=()=>()=>{H(),W(),B()},$=[H,W,B],t[58]=H,t[59]=B,t[60]=W,t[61]=he,t[62]=$):(he=t[61],$=t[62]),(0,f.useLayoutEffect)(he,$);let ge;t[63]===de?ge=t[64]:(ge=e=>de(e,!1),t[63]=de,t[64]=ge);let _e=a(ge),ve;t[65]===de?ve=t[66]:(ve=e=>de(e,!0),t[65]=de,t[66]=ve);let ye=a(ve),be;t[67]===de?be=t[68]:(be=e=>de(e,!0),t[67]=de,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==Y||t[71]!==me||t[72]!==le||t[73]!==ue||t[74]!==Q||t[75]!==G||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:G,reset:Q,handlePointerDown:le,handlePointerMove:ue,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:Y,handleKeyDown:me},t[69]=_,t[70]=Y,t[71]=me,t[72]=le,t[73]=ue,t[74]=Q,t[75]=G,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function D(e,t){return e.height-t.height}function ee(e,t){return e.height-t.height}function te(e,t){return t.height-e.height}function ne(e,t){return e.height-t.height}function re(e){return e.height}function ie(e){return e.height}function O(){}function ae(e){return e.height}var k=.72,A=.98,oe=64,j=()=>Math.max(1,window.innerHeight),M=(e,t)=>{let n=Math.max(1,e)*k;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},N=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?k:r,l=i!==void 0&&i,u=s===void 0?oe: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=j(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(m.current=M(e,d.current.getBoundingClientRect().height)),[{id:k,height:Math.min(t,M(e,l?m.current:void 0))},{id:A,height:Math.min(t,e*A)}]},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||j(),i=Math.min(r,M(j(),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},P=e=>{let t=(0,p.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;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]!==i?(a=(0,m.jsx)(y,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":k*100,"aria-valuemax":A*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,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]=i,t[11]=a):a=t[11],a},F=new WeakMap;function I(e){F.set(e.currentTarget,!0)}function L(e){if(F.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 R(e){e.target===e.currentTarget&&I(e)}function z(e){return e.target===e.currentTarget&&L(e)}var B=(0,f.createContext)(!0),V=(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)))]`},H=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),U=(e,t)=>{let n=H(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)`}},W=(e,t)=>{let n=H(t);return e===`present`?n:1-n},se=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,G=e=>+!!e,ce=`mobile-sessions`,le=new Map,K=e=>le.get(e)??null,ue=(e,t)=>(le.set(e,t),()=>{le.get(e)===t&&le.delete(e)}),q=`.overlay-scrollbar-container`,de=1,J=e=>e===`left`||e===`right`?`x`:`y`,fe=e=>e===`bottom`||e===`right`?1:-1,pe=(e,t,n)=>{let r=J(e)===`x`?t:n;return Math.max(0,r*fe(e))},Y=(e,t,n,r,i)=>{let a=pe(e,t,n),o=Math.abs(J(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},X=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),me=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),Z=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,Q=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,he=(e,t,n=de)=>{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},$=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},ge=(e,t)=>{let n=window.getComputedStyle(e),r=J(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(ge(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&ge(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=J(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=Q(e.velocity,a,i,n-e.lastVelocityTime,fe(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??q);if(l&&!he(l,a.edge))return;let u=e.getBoundingClientRect(),d=J(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:J(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:me(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=$(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(!Y(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=K(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(X(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=$(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(X(t.distance,t.motionDistance));let o=Z(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:s,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(t),T=f.useRef(n),E=f.useRef(_),D=f.useRef(y),ee=f.useRef(0),te=f.useRef(0),ne=f.useRef(null),re=f.useRef([]),ie=f.useRef(null),O=f.useRef(`standard`),ae=f.useRef(`present`),k=f.useRef(0),A=f.useRef(!1),oe=f.useRef(t),j=f.useRef(!1),M=f.useRef(t),N=f.useRef(null),[P,F]=f.useState(t),[I,L]=f.useState(t),[H,ce]=f.useState(`standard`),[le,K]=f.useState(!1),q=H===`interactive-present`,de=f.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),J=I&&!q&&de===e,fe=ve({motionId:e,edge:a,disabled:!g,...typeof g==`object`?g:{}}),pe=f.useCallback(e=>{C.current=e,fe(e),typeof p==`function`?p(e):p&&typeof p==`object`&&(p.current=e)},[fe,p]),Y=f.useCallback(()=>{M.current&&(M.current=!1,L(!1),r||F(!1),E.current?.())},[r]);w.current=t,T.current=n,E.current=_,D.current=y,f.useLayoutEffect(()=>{D.current?.(I&&q)},[I,q]),typeof document<`u`&&!x.current&&(x.current=we());let X=f.useCallback(e=>{let t=U(a,e);ee.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]),me=f.useCallback(()=>{ne.current!==null&&window.cancelAnimationFrame(ne.current),ne.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=[]},[]),he=f.useCallback(()=>{me();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:ee.current),Q(e.animations),ie.current=null}else Q();Z(),K(!1)},[X,Q,me,Z]),$=f.useCallback((e,t)=>{if(ie.current?.target===e)return;he();let n=ee.current,r=S.current,i=C.current;if(K(!0),!r||!i||Te()||n===e){X(e),Z(),K(!1),t?.();return}let o=U(a,n),s=U(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(),K(!1),t?.())})},[X,Q,Z,a,he]);if(f.useLayoutEffect(()=>{j.current=P,P&&X(te.current)},[X,P]),f.useLayoutEffect(()=>{M.current=I},[I]),f.useEffect(()=>{t&&!j.current&&(te.current=ee.current,F(!0)),t&&!M.current&&(M.current=!0,L(!0)),j.current&&O.current===`standard`&&$(G(t),()=>{!w.current&&O.current===`standard`&&Y()})},[Y,t,$]),f.useLayoutEffect(()=>{!P||O.current!==`standard`||$(+!!t,()=>{!w.current&&O.current===`standard`&&Y()})},[Y,P,t,$]),f.useEffect(()=>{if(!(!I||q))return window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[I,q]),f.useEffect(()=>{if(!(!I||q))return d.add({id:e,onClose:()=>T.current(!1)},document.body)},[I,e,q]),f.useEffect(()=>{if(!I||q||!J)return;let e=C.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;e?.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]??e,i=n.at(-1)??e;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})}},[I,q,J]),N.current={begin:e=>{if(e===`dismiss`&&(!M.current||O.current===`interactive-present`))return!1;he(),k.current+=1,A.current=!0,ae.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return O.current=t,ce(t),K(!0),e===`present`&&(te.current=ee.current,M.current=!0,L(!0),F(!0)),!0},update:e=>{A.current&&(te.current=W(ae.current,e),ne.current===null&&(ne.current=window.requestAnimationFrame(()=>{ne.current=null,A.current&&X(te.current)})))},finish:e=>{if(!A.current)return;A.current=!1;let t=k.current,n=ae.current,r=se(n,e);ne.current!==null&&(me(),X(te.current)),$(r,()=>{t===k.current&&(e===`commit`&&T.current(n===`present`),n===`present`&&e===`cancel`&&!w.current&&Y(),O.current=`standard`,ce(`standard`),r===0&&Y())})},interrupt:()=>{k.current+=1,A.current=!1;let e=O.current===`interactive-present`&&!w.current;e||(O.current=`standard`,ce(`standard`)),he(),$(G(w.current),()=>{w.current||Y(),e&&(O.current=`standard`,ce(`standard`))})}},f.useLayoutEffect(()=>{let e=oe.current;oe.current=t,e&&!t&&O.current!==`standard`&&N.current?.interrupt()},[t]),f.useEffect(()=>{let t=ue(e,{begin:e=>N.current?.begin(e)??!1,update:e=>N.current?.update(e),finish:e=>N.current?.finish(e),interrupt:()=>N.current?.interrupt()});return()=>{t(),me(),Q(),ie.current=null,Z(),N.current=null}},[Q,me,Z,e]),!P||!x.current)return null;let ge=(0,m.jsx)(`div`,{ref:S,className:o(`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`,!I&&!q&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(I),role:q?void 0:`dialog`,"aria-label":q?void 0:b,"aria-modal":I&&J?`true`:void 0,"aria-hidden":q||!I||!J||void 0,inert:q||!I||!J||void 0,onPointerDown:R,onClick:e=>{!I||q||!J||z(e)&&T.current(!1)},children:(0,m.jsx)(`div`,{ref:pe,tabIndex:-1,className:o(`yuri-mobile-floating-shell`,V(i,a),u),"data-yuri-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:(0,m.jsx)(B.Provider,{value:J,children:s})})});return(0,h.createPortal)(ge,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)(47),{id:n,open:r,onOpenChange:i,title:a,leading:c,trailing:l,ariaLabel:d,closeAriaLabel:h,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,className:b,children:x}=e,S=_!==void 0&&_,C=v!==void 0&&v,w=S?A:void 0,T;t[0]!==i||t[1]!==r?(T=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=T):T=t[2];let E;t[3]!==C||t[4]!==w||t[5]!==T?(E={initialSnapPoint:w,fitContent:C,onDismiss:T},t[3]=C,t[4]=w,t[5]=T,t[6]=E):E=t[6];let D=N(E),[ee,te]=f.useState(null),ne=a!=null||c!=null||l!=null,re=D.snapPoint===A,ie=re||!C,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=O):O=t[7];let ae=re?`h-[98dvh] max-h-[98dvh]`:C?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,k=D.surfaceRef,oe=D.reset,j=ie&&`flex-1`,M;t[8]===j?M=t[9]:(M=o(`flex min-h-0 flex-col`,j),t[8]=j,t[9]=M);let F;t[10]!==g||t[11]!==D?(F=(0,m.jsx)(P,{controller:D,ariaLabel:g}),t[10]=g,t[11]=D,t[12]=F):F=t[12];let I;t[13]!==h||t[14]!==C||t[15]!==ne||t[16]!==c||t[17]!==i||t[18]!==a||t[19]!==l?(I=ne?(0,m.jsxs)(`div`,{className:C?`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:`min-w-0 flex-1`,children:a}),l?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:l}):null,(0,m.jsx)(`div`,{ref:te,className:`contents`}),(0,m.jsx)(s,{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,t[13]=h,t[14]=C,t[15]=ne,t[16]=c,t[17]=i,t[18]=a,t[19]=l,t[20]=I):I=t[20];let L;t[21]!==F||t[22]!==I?(L=(0,m.jsxs)(`div`,{className:`shrink-0`,children:[F,I]}),t[21]=F,t[22]=I,t[23]=L):L=t[23];let R=ie&&`flex-1`,z;t[24]!==y||t[25]!==R?(z=o(`flex min-h-0 flex-col overflow-hidden`,R,y),t[24]=y,t[25]=R,t[26]=z):z=t[26];let B;t[27]!==x||t[28]!==z?(B=(0,m.jsx)(`div`,{className:z,"data-page-scroll-lock":`true`,children:x}),t[27]=x,t[28]=z,t[29]=B):B=t[29];let V;t[30]!==M||t[31]!==L||t[32]!==B?(V=(0,m.jsxs)(`div`,{className:M,children:[L,B]}),t[30]=M,t[31]=L,t[32]=B,t[33]=V):V=t[33];let H;t[34]!==d||t[35]!==b||t[36]!==n||t[37]!==i||t[38]!==r||t[39]!==D.reset||t[40]!==D.surfaceRef||t[41]!==V||t[42]!==ae?(H=(0,m.jsx)(Ee,{id:n,className:b,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:O,ariaLabel:d,surfaceClassName:ae,surfaceElementRef:k,onExitComplete:oe,children:V}),t[34]=d,t[35]=b,t[36]=n,t[37]=i,t[38]=r,t[39]=D.reset,t[40]=D.surfaceRef,t[41]=V,t[42]=ae,t[43]=H):H=t[43];let U;return t[44]!==ee||t[45]!==H?(U=(0,m.jsx)(De.Provider,{value:ee,children:H}),t[44]=ee,t[45]=H,t[46]=U):U=t[46],U};export{_ as C,v as S,P as _,pe as a,E as b,Y as c,K as d,B as f,z as g,R as h,me as i,Z as l,I as m,Oe as n,X as o,L as p,Ee as r,Q as s,ke as t,ce as u,A as v,y as x,N as y};
|