@yuriai/web 0.2.38-beta.5 → 0.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/assets/{AgentAvatar-CfpejA-o.js → AgentAvatar-B2GEBJBG.js} +1 -1
  2. package/dist/assets/{AssistantContactStatus-_0PxmEHN.js → AssistantContactStatus-CGFpgAuL.js} +3 -3
  3. package/dist/assets/{AssistantUnreadBadge-O-9phsEJ.js → AssistantUnreadBadge-DDw7a4MF.js} +1 -1
  4. package/dist/assets/{AssistantView-CqFwkHDU.js → AssistantView-DpYyl49H.js} +1 -1
  5. package/dist/assets/{DiagramView-qYMnnPzv.js → DiagramView-CrjS-7Qg.js} +1 -1
  6. package/dist/assets/{FadeInOnReveal-B6GGwaY7.js → FadeInOnReveal-BWkJi5dK.js} +1 -1
  7. package/dist/assets/{GuiPluginPage-D8Tl5eZe.js → GuiPluginPage-Ct7QUMjH.js} +1 -1
  8. package/dist/assets/{GuiPluginSurface-CxcYHPiw.js → GuiPluginSurface-C1a1HAzL.js} +1 -1
  9. package/dist/assets/{GuiPluginWindow-BuGtfRjB.js → GuiPluginWindow-CGnY_Jp_.js} +1 -1
  10. package/dist/assets/{Icon-AqWbQ-aO.js → Icon-Co7WGN1G.js} +1 -1
  11. package/dist/assets/{ImageLoadingPlaceholder-BaWRq0Oj.js → ImageLoadingPlaceholder-KEVw1Pg-.js} +1 -1
  12. package/dist/assets/{LoadingImage-CsNAJ7VA.js → LoadingImage-PH45V6oj.js} +1 -1
  13. package/dist/assets/MarkdownRenderer-CZpY_qyH.js +2 -0
  14. package/dist/assets/{MarkdownRendererImpl-Dk1Ph8dy.js → MarkdownRendererImpl-v1YoJHFp.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-DyPRvrql.js → MarkstreamRendererImpl-UwcR7nzW.js} +1 -1
  16. package/dist/assets/{MobileDetailNavigation-EEjgCwp2.js → MobileDetailNavigation-B8t6gz_S.js} +1 -1
  17. package/dist/assets/{MobileResizableSheet-CBHcyf1Z.js → MobileResizableSheet-Dd1w8a-6.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-Dswz4WUo.js → MobileShareBridge-DCE_Ahre.js} +1 -1
  19. package/dist/assets/{MobileTabPageHeader-D3SrcPki.js → MobileTabPageHeader-BYRAlNQp.js} +1 -1
  20. package/dist/assets/{MultiRunWindow-CVicaUFS.js → MultiRunWindow-CxjpWlHn.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-DRunDbYQ.js → OnboardingScreen-4LgzNqG4.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-D5p2e1RO.js → OverlayScrollbar-BQua3Ko6.js} +1 -1
  23. package/dist/assets/{SettingsView-U-pIjcB4.js → SettingsView-DxqpYiwv.js} +1 -1
  24. package/dist/assets/{SettingsWindow-hd-ADhd3.js → SettingsWindow-DmhZHg_E.js} +1 -1
  25. package/dist/assets/{SetupTourDialog-Cahv5gkl.js → SetupTourDialog-CzNscVSi.js} +1 -1
  26. package/dist/assets/{TerminalView-D2ouVtum.js → TerminalView-BAqu9LRw.js} +1 -1
  27. package/dist/assets/{ToolOutputDialog-CNm-8Knm.js → ToolOutputDialog-C5b57FEy.js} +1 -1
  28. package/dist/assets/{VoiceSettings-BUo82XOD.js → VoiceSettings-D4aaoz88.js} +1 -1
  29. package/dist/assets/{appThemeRegistry-BbpJh1HH.js → appThemeRegistry-DDaIHQum.js} +1 -1
  30. package/dist/assets/{capgoAdapter-gTKxaGbj.js → capgoAdapter-CXcqPnFa.js} +1 -1
  31. package/dist/assets/{checkbox-BQ_mKqEF.js → checkbox-o8x1LJC4.js} +1 -1
  32. package/dist/assets/{collapsible-Dr6Y1Igi.js → collapsible-ZLW5y35Q.js} +1 -1
  33. package/dist/assets/{context-menu-Dfu9gzKB.js → context-menu-Bv2RsqQe.js} +1 -1
  34. package/dist/assets/{diagram-B_HmL8LL.js → diagram-hqhzT9yo.js} +1 -1
  35. package/dist/assets/{dialog-pjai4m5O.js → dialog-C7D331XW.js} +1 -1
  36. package/dist/assets/{fileMentionTouchSelection-DxRRqdQ2.js → fileMentionTouchSelection-C3_guqVF.js} +1 -1
  37. package/dist/assets/{gitApi-Dj03_3PE.js → gitApi-BOyQ2o3N.js} +1 -1
  38. package/dist/assets/{input-BlKTIfXo.js → input-os0CMgxY.js} +1 -1
  39. package/dist/assets/{insertionBoundaries-Dmg74pH8.js → insertionBoundaries-CGcJ-kUX.js} +1 -1
  40. package/dist/assets/{main-D1vPyHl8.js → main-DmQr5rK8.js} +4 -4
  41. package/dist/assets/{main-B0RPbUtx.js → main-x_36xEI7.js} +2 -2
  42. package/dist/assets/{markdownHeightCache-Ct6RXQq8.js → markdownHeightCache-BWCMEzOk.js} +1 -1
  43. package/dist/assets/{mcpQueries-DqfD7_kv.js → mcpQueries-C3EdKlJU.js} +1 -1
  44. package/dist/assets/{miniChat-xjOkZhpT.js → miniChat-Dz4oT5h0.js} +2 -2
  45. package/dist/assets/{mobile-8PDO4RhV.js → mobile-C2wjDVrA.js} +2 -2
  46. package/dist/assets/{mobile-html-network-CPZnAlje.js → mobile-html-network-DuXwrtnU.js} +2 -2
  47. package/dist/assets/{mobileBackNavigation-CnA0UqIL.js → mobileBackNavigation-C456iV52.js} +1 -1
  48. package/dist/assets/{mobileConnections-DMkh6DCw.js → mobileConnections-DrUWc7kd.js} +2 -2
  49. package/dist/assets/{multirun-DsNq2b4Z.js → multirun-CdraBH9O.js} +1 -1
  50. package/dist/assets/{native-config-DpErLDXn.js → native-config-3LSj_OuN.js} +1 -1
  51. package/dist/assets/{projectMeta-C3NpB0dz.js → projectMeta-CyhJE6CA.js} +1 -1
  52. package/dist/assets/{pwa-DCktk4PB.js → pwa-BzFEQ5Js.js} +1 -1
  53. package/dist/assets/{queue-abort-optimistic-BA_Hnkq2.js → queue-abort-optimistic-CMMw3KSM.js} +1 -1
  54. package/dist/assets/{react-Bch1-zoe.js → react-BJAlol6I.js} +1 -1
  55. package/dist/assets/{readiness-_wHN9DvW.js → readiness-DmMVD6xM.js} +1 -1
  56. package/dist/assets/{renderElectronMiniChatApp-Cp7Nw-Bb.js → renderElectronMiniChatApp-CVNOL7vy.js} +2 -2
  57. package/dist/assets/{renderMobileApp-C0aEpXl8.js → renderMobileApp-rVz5UaT-.js} +4 -4
  58. package/dist/assets/{runtimeConfig-DySpB2Ms.js → runtimeConfig-CAAd0cno.js} +1 -1
  59. package/dist/assets/{runtimeEndpointReset-CTX1Lp2P.js → runtimeEndpointReset-DKk9B2jX.js} +3 -3
  60. package/dist/assets/{select-dzuHSnKA.js → select-ClX56nrO.js} +1 -1
  61. package/dist/assets/{sessionLookup-CEo8HV6T.js → sessionLookup-DC2xZn-T.js} +1 -1
  62. package/dist/assets/{sortable-tabs-strip-CQipbMoB.js → sortable-tabs-strip-BQbGMaz-.js} +1 -1
  63. package/dist/assets/{speechSettingsQueries-grq8zufg.js → speechSettingsQueries-85xpCH5y.js} +1 -1
  64. package/dist/assets/{textarea-C1IkHndn.js → textarea-DpsaIedI.js} +1 -1
  65. package/dist/assets/{tooltip-UtVoXY1Q.js → tooltip-pELJ38kd.js} +1 -1
  66. package/dist/assets/types-D-KYekEQ.js +2 -0
  67. package/dist/assets/{useAppFontEffects-ji7bphac.js → useAppFontEffects-CMJ-srCU.js} +5 -5
  68. package/dist/assets/{useDesktopWindowControlsLayout-B0tAK_6s.js → useDesktopWindowControlsLayout-DBBGRsuU.js} +1 -1
  69. package/dist/assets/{useEffectiveDirectory-D5CBpzcV.js → useEffectiveDirectory--tyiZ84r.js} +1 -1
  70. package/dist/assets/{useMobileNavigationStore-C90n-pQY.js → useMobileNavigationStore-Dr61mYqA.js} +4 -4
  71. package/dist/assets/{usePluginsStore-BdCWVg9s.js → usePluginsStore-P6_c6c0m.js} +1 -1
  72. package/dist/assets/{useStreamingTextThrottle-CDpeNtel.js → useStreamingTextThrottle-D3YtOLbE.js} +1 -1
  73. package/dist/assets/{useWorkerHighlightedLines-BFi-QWq2.js → useWorkerHighlightedLines-CO7SlSqM.js} +1 -1
  74. package/dist/index.html +5 -5
  75. package/dist/mini-chat.html +5 -5
  76. package/dist/mobile.html +1 -1
  77. package/package.json +1 -1
  78. package/dist/assets/MarkdownRenderer-BdfXY4lC.js +0 -2
  79. package/dist/assets/types-9U-qp6Dn.js +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{k as t,n,t as r}from"./platform-DMsFWy1a.js";import{at as i,ot as a,st as o}from"./vendor-base-ui-CzHs0bHY.js";import{Br as s,Lr as c,Mr as l,Nr as u,Rr as d,kn as f}from"./gitApiHttp-B1mApXwC.js";import{n as p}from"./vendor-react-DlzBev0S.js";import{a as m,n as h}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{p as g,r as _}from"./vendor-reactuses-core-CuTmqEMK.js";import{t as v}from"./i18n-BU14awhU.js";import{Jn as y,Kn as b,Li as x,Mi as S,fi as C,oi as w,ri as ee,ui as T}from"./useMobileNavigationStore-C90n-pQY.js";import{n as E}from"./Icon-AqWbQ-aO.js";import{r as D}from"./themes-BgDJcxRc.js";import{t as O}from"./MobileResizableSheet-CBHcyf1Z.js";import{n as te,t as k}from"./useDictation-CyWtsxSn.js";import{t as A}from"./LoadingImage-CsNAJ7VA.js";import{t as j}from"./textarea-C1IkHndn.js";var M=e(o(),1),N=p(),P=a(),ne=e(i(),1),re=m(`YuriMedia`);function F(e){return e.platform===`android`||/Android/i.test(e.userAgent)||e.userAgentDataPlatform===`Android`}function ie(){if(typeof window>`u`)return!1;let e=navigator.userAgentData;return F({platform:r(),userAgent:navigator.userAgent||``,userAgentDataPlatform:e?.platform})}function I(){return n()&&h.getPlatform()===`android`&&h.isPluginAvailable(`YuriMedia`)}async function ae(e){if(!I())return null;let t=await re.pickMedia({limit:e});if(t.cancelled)return[];let n=[];for(let e of t.files){let t=await fetch(h.convertFileSrc(e.path));if(!t.ok)throw Error(`Native media fetch failed (${t.status})`);let r=await t.blob();n.push(new File([r],e.name,{type:e.mimeType}))}return n}var L=`h-auto min-h-12 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 border-b border-[var(--surface-subtle)] last:border-b-0`,oe=e=>{let t=(0,N.c)(38),{id:n,open:r,onOpenChange:i,onPickPhotos:a,onPickFiles:o}=e,{t:s}=v(),c;t[0]===s?c=t[1]:(c=s(`chat.chatInput.actions.addAttachment`),t[0]=s,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,P.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:c}),t[2]=c,t[3]=l);let u;t[4]===s?u=t[5]:(u=s(`chat.chatInput.actions.addAttachment`),t[4]=s,t[5]=u);let d;t[6]===s?d=t[7]:(d=s(`mobile.surface.closeAria`),t[6]=s,t[7]=d);let f;t[8]===s?f=t[9]:(f=s(`mobile.sessions.sheet.resizeAria`),t[8]=s,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,P.jsx)(E,{name:`file-image`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===s?m=t[12]:(m=s(`chat.chatInput.actions.attachPhotos`),t[11]=s,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,P.jsx)(`span`,{className:`truncate`,children:m}),t[13]=m,t[14]=h);let g;t[15]!==a||t[16]!==h?(g=(0,P.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:L,"data-mobile-press-feedback":`none`,onClick:a,children:[p,h]}),t[15]=a,t[16]=h,t[17]=g):g=t[17];let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,P.jsx)(E,{name:`attachment-2`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[18]=_):_=t[18];let y;t[19]===s?y=t[20]:(y=s(`chat.chatInput.actions.attachFiles`),t[19]=s,t[20]=y);let x;t[21]===y?x=t[22]:(x=(0,P.jsx)(`span`,{className:`truncate`,children:y}),t[21]=y,t[22]=x);let S;t[23]!==o||t[24]!==x?(S=(0,P.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:L,"data-mobile-press-feedback":`none`,onClick:o,children:[_,x]}),t[23]=o,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==g?(C=(0,P.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-page-scroll-lock":`true`,children:[g,S]})}),t[26]=S,t[27]=g,t[28]=C):C=t[28];let w;return t[29]!==n||t[30]!==i||t[31]!==r||t[32]!==C||t[33]!==l||t[34]!==u||t[35]!==d||t[36]!==f?(w=(0,P.jsx)(O,{id:n,open:r,onOpenChange:i,title:l,ariaLabel:u,closeAriaLabel:d,resizeAriaLabel:f,fitContent:!0,children:C}),t[29]=n,t[30]=i,t[31]=r,t[32]=C,t[33]=l,t[34]=u,t[35]=d,t[36]=f,t[37]=w):w=t[37],w},R={glyph:`_glyph_1xs2e_1`,lens:`_lens_1xs2e_12`,shape:`_shape_1xs2e_21`,revolve:`_revolve_1xs2e_1`};function se(e){let t=(0,N.c)(18),{decorative:n,size:r}=e,i=n!==void 0&&n,a=r===void 0?20:r,{t:o}=v(),s;t[0]===a?s=t[1]:(s={width:a,height:a},t[0]=a,t[1]=s);let c=i||void 0,l=i?void 0:`img`,u;t[2]!==i||t[3]!==o?(u=i?void 0:o(`common.loading`),t[2]=i,t[3]=o,t[4]=u):u=t[4];let d=`scale(${a/28})`,f;t[5]===d?f=t[6]:(f={transform:d},t[5]=d,t[6]=f);let p,m,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,P.jsx)(`span`,{className:R.shape}),p=(0,P.jsx)(`span`,{className:R.shape}),m=(0,P.jsx)(`span`,{className:R.shape}),t[7]=p,t[8]=m,t[9]=h):(p=t[7],m=t[8],h=t[9]);let g;t[10]===f?g=t[11]:(g=(0,P.jsxs)(`span`,{className:R.lens,style:f,children:[h,p,m]}),t[10]=f,t[11]=g);let _;return t[12]!==g||t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==u?(_=(0,P.jsx)(`span`,{"data-dictation-loading":!0,className:R.glyph,style:s,"aria-hidden":c,role:l,"aria-label":u,children:g}),t[12]=g,t[13]=s,t[14]=c,t[15]=l,t[16]=u,t[17]=_):_=t[17],_}var z=D(!1).colors,ce=`M-50 74.564 A600 600 0 0 1 147.707 22.283 A38 38 0 0 1 154.330 97.994 A524 524 0 0 0 -18.333 143.653 Z`,le=`M450 74.564 A600 600 0 0 0 252.293 22.283 A38 38 0 0 0 245.670 97.994 A524 524 0 0 1 418.333 143.653 Z`,ue={colorScheme:`light`,"--surface-background":z.surface.background,"--surface-foreground":z.surface.foreground,"--primary-base":z.primary.base,"--foreground":z.surface.background,"--interactive-hover":`color-mix(in srgb, var(--surface-background) 12%, transparent)`,"--interactive-active":`color-mix(in srgb, var(--surface-background) 20%, transparent)`,"--ring":z.interactive.focusRing,"--status-error":z.status.error};function de(e){let t=(0,N.c)(85),{containerRef:n,disabled:r,onInsert:i,onSend:a,onRelease:o,onError:s,onHintChange:c}=e,{t:l}=v(),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(!1),[m,h]=(0,M.useState)(`send`),g=(0,M.useRef)(null),y=(0,M.useRef)(null),b=(0,M.useRef)(`insert`),x=(0,M.useRef)(null),S=(0,M.useId)(),w=(0,M.useId)(),ee=(0,M.useId)(),T;t[0]!==i||t[1]!==a?(T=e=>b.current===`send`?a(e):i(e),t[0]=i,t[1]=a,t[2]=T):T=t[2];let E;t[3]!==s||t[4]!==T?(E={onTranscript:T,onError:s},t[3]=s,t[4]=T,t[5]=E):E=t[5];let D=k(E),{status:O,isStarting:te,partialTranscript:A,error:j,volume:re}=D,F=_(c),ie=u?m===`cancel`?`cancelling`:m===`edit`?`editing`:`recording`:f?`processing`:null,I,ae;t[6]!==ie||t[7]!==F?(I=()=>{F(ie)},ae=[ie,F],t[6]=ie,t[7]=F,t[8]=I,t[9]=ae):(I=t[8],ae=t[9]),(0,M.useEffect)(I,ae);let L,oe;t[10]===F?(L=t[11],oe=t[12]):(L=()=>()=>F(null),oe=[F],t[10]=F,t[11]=L,t[12]=oe),(0,M.useEffect)(L,oe);let R;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{y.current&&clearTimeout(y.current),y.current=null},t[13]=R):R=t[13];let z=_(R),de;t[14]!==n||t[15]!==r?(de=e=>{if(r||!(e instanceof HTMLElement))return null;let t=n.current?.querySelector(`textarea`);return!t||t.value!==``||t.disabled||t.readOnly||t.ownerDocument.activeElement===t||e!==t&&!e.closest(`[data-yuri-composer-compact-surface]`)||e.closest(`button, [data-composer-action]`)?null:t},t[14]=n,t[15]=r,t[16]=de):de=t[16];let V=_(de),fe;t[17]!==z||t[18]!==D||t[19]!==j||t[20]!==f||t[21]!==O?(fe=()=>{f||(z(),g.current=null,d(!1),h(`send`),O===`failed`||O===`idle`&&j?D.discardFailedDictation():D.cancelDictation())},t[17]=z,t[18]=D,t[19]=j,t[20]=f,t[21]=O,t[22]=fe):fe=t[22];let H=_(fe),pe;t[23]!==D||t[24]!==r||t[25]!==V||t[26]!==f||t[27]!==O?(pe=e=>{let t=e.target;r||f||O!==`idle`||g.current||!e.isPrimary||e.button!==0||!(t instanceof HTMLElement)||V(t)&&(e.preventDefault(),e.stopPropagation(),g.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,intent:`send`,started:!1},y.current=setTimeout(()=>{if(y.current=null,!g.current)return;let e=V(t);if(!e){g.current=null;return}e.blur(),g.current.started=!0,b.current=`insert`,d(!0),h(`send`),D.startDictation()},300))},t[23]=D,t[24]=r,t[25]=V,t[26]=f,t[27]=O,t[28]=pe):pe=t[28];let U=_(pe),me;t[29]===z?me=t[30]:(me=e=>{let t=g.current;if(!t||t.pointer!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let n=e.clientX-t.x,r=x.current?.getBoundingClientRect(),i=r&&r.width>0&&e.clientY>=r.top&&e.clientY<=r.bottom?e.clientX<r.left+r.width/2?`cancel`:`edit`:n<=-64?`cancel`:n>=64?`edit`:`send`;if(!t.started&&Math.hypot(n,t.y-e.clientY)>12){z(),g.current=null;return}t.started&&i!==t.intent&&(t.intent=i,h(i),C(i===`send`?`light`:`medium`,{bypassCadence:!0}))},t[29]=z,t[30]=me);let W=_(me),he;t[31]!==H||t[32]!==z||t[33]!==n||t[34]!==D||t[35]!==j||t[36]!==o||t[37]!==A||t[38]!==O?(he=e=>{let t=g.current;if(!(!t||t.pointer!==e.pointerId)){if(e.preventDefault(),e.stopPropagation(),z(),j||O===`failed`){H();return}g.current=null,d(!1),t.started?t.intent===`cancel`?D.cancelDictation():(b.current=t.intent===`edit`?`insert`:`send`,o(A),p(!0),Promise.resolve(D.confirmDictation()).finally(()=>{p(!1),D.discardFailedDictation(),t.intent===`edit`&&n.current?.querySelector(`textarea`)?.focus()})):n.current?.querySelector(`textarea`)?.focus()}},t[31]=H,t[32]=z,t[33]=n,t[34]=D,t[35]=j,t[36]=o,t[37]=A,t[38]=O,t[39]=he):he=t[39];let G=_(he),ge;t[40]===H?ge=t[41]:(ge=e=>{g.current?.pointer===e.pointerId&&H()},t[40]=H,t[41]=ge);let _e=_(ge),ve;t[42]===V?ve=t[43]:(ve=e=>{V(e.target)&&e.preventDefault()},t[42]=V,t[43]=ve);let K=_(ve),q,J;t[44]!==H||t[45]!==z||t[46]!==n||t[47]!==U||t[48]!==_e||t[49]!==W||t[50]!==K||t[51]!==G?(q=()=>{let e=n.current;if(!e)return;let t=()=>{document.visibilityState===`hidden`&&H()};return e.addEventListener(`pointerdown`,U,!0),e.addEventListener(`touchstart`,K,{capture:!0,passive:!1}),window.addEventListener(`pointermove`,W,{capture:!0,passive:!1}),window.addEventListener(`pointerup`,G,!0),window.addEventListener(`pointercancel`,_e,!0),e.addEventListener(`contextmenu`,K,!0),e.addEventListener(`selectstart`,K,!0),window.addEventListener(`blur`,H),document.addEventListener(`visibilitychange`,t),()=>{z(),e.removeEventListener(`pointerdown`,U,!0),e.removeEventListener(`touchstart`,K,!0),window.removeEventListener(`pointermove`,W,!0),window.removeEventListener(`pointerup`,G,!0),window.removeEventListener(`pointercancel`,_e,!0),e.removeEventListener(`contextmenu`,K,!0),e.removeEventListener(`selectstart`,K,!0),window.removeEventListener(`blur`,H),document.removeEventListener(`visibilitychange`,t)}},J=[n,U,W,G,_e,H,z,K],t[44]=H,t[45]=z,t[46]=n,t[47]=U,t[48]=_e,t[49]=W,t[50]=K,t[51]=G,t[52]=q,t[53]=J):(q=t[52],J=t[53]),(0,M.useEffect)(q,J);let ye,Y;if(t[54]!==H||t[55]!==r?(ye=()=>{r&&H()},Y=[r,H],t[54]=H,t[55]=r,t[56]=ye,t[57]=Y):(ye=t[56],Y=t[57]),(0,M.useEffect)(ye,Y),!u&&!f)return null;let be=Math.min(1,Math.max(0,re))**.6,X=!!j,xe=j?H:void 0,Se;t[58]===be?Se=t[59]:(Se={...ue,"--speech-energy":be},t[58]=be,t[59]=Se);let Ce=Se,we;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,P.jsx)(`div`,{className:`yuri-speech-light-field`,"aria-hidden":`true`,children:[`ice`,`lilac`,`mint`,`blush`,`mid`,`core`].map(B)}),t[60]=we):we=t[60];let Te=te||f,Z;t[61]!==j||t[62]!==te||t[63]!==A||t[64]!==f||t[65]!==O||t[66]!==l?(Z=j&&!f?(0,P.jsx)(`p`,{role:`alert`,className:`yuri-speech-caption yuri-speech-error`,children:j}):(0,P.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`yuri-speech-caption`,children:te||f?(0,P.jsx)(se,{size:72}):A?(0,P.jsx)(`span`,{className:`yuri-speech-interim`,children:A}):l(O===`uploading`?`chat.dictation.processing`:`chat.dictation.listening`)}),t[61]=j,t[62]=te,t[63]=A,t[64]=f,t[65]=O,t[66]=l,t[67]=Z):Z=t[67];let Q;t[68]!==Te||t[69]!==Z?(Q=(0,P.jsx)(`div`,{className:`yuri-speech-content`,"data-starting":Te,children:Z}),t[68]=Te,t[69]=Z,t[70]=Q):Q=t[70];let $;t[71]!==S||t[72]!==w||t[73]!==ee||t[74]!==u||t[75]!==m||t[76]!==l?($=u&&(0,P.jsx)(`div`,{className:`yuri-speech-gesture-stage`,"aria-hidden":`true`,children:(0,P.jsxs)(`div`,{className:`yuri-speech-gesture-surfaces`,children:[(0,P.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${w})`}}),(0,P.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${ee})`}}),(0,P.jsxs)(`svg`,{className:`yuri-speech-geometry`,viewBox:`0 0 400 226`,focusable:`false`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(`clipPath`,{id:w,clipPathUnits:`objectBoundingBox`,children:(0,P.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:ce})}),(0,P.jsx)(`clipPath`,{id:ee,clipPathUnits:`objectBoundingBox`,children:(0,P.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:le})}),(0,P.jsxs)(`linearGradient`,{id:S,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,P.jsx)(`stop`,{offset:`0%`,className:`yuri-speech-arc-top`}),(0,P.jsx)(`stop`,{offset:`100%`,className:`yuri-speech-arc-bottom`})]})]}),(0,P.jsxs)(`g`,{className:`yuri-speech-targets`,ref:x,children:[(0,P.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--cancel`,"data-active":m===`cancel`,children:[(0,P.jsx)(`path`,{d:ce}),(0,P.jsx)(`text`,{x:`95`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(-11 95 68)`,children:l(`chat.dictation.cancelGesture`)})]}),(0,P.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--edit`,"data-active":m===`edit`,children:[(0,P.jsx)(`path`,{d:le}),(0,P.jsx)(`text`,{x:`305`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(11 305 68)`,children:l(`chat.dictation.edit`)})]})]}),(0,P.jsx)(`path`,{className:`yuri-speech-hold-arc`,fill:`url(#${S})`,d:`M-50 186.987 A500 500 0 0 1 450 186.987 L450 300 H-50 Z`})]})]})}),t[71]=S,t[72]=w,t[73]=ee,t[74]=u,t[75]=m,t[76]=l,t[77]=$):$=t[77];let Ee;return t[78]!==m||t[79]!==X||t[80]!==xe||t[81]!==Ce||t[82]!==Q||t[83]!==$?(Ee=(0,ne.createPortal)((0,P.jsxs)(`div`,{className:`yuri-speech-overlay`,"data-intent":m,"data-error":X,onClick:xe,style:Ce,children:[we,Q,$]}),document.body),t[78]=m,t[79]=X,t[80]=xe,t[81]=Ce,t[82]=Q,t[83]=$,t[84]=Ee):Ee=t[84],Ee}function B(e){return(0,P.jsx)(`div`,{className:`yuri-speech-reactor yuri-speech-reactor--${e}`,children:(0,P.jsx)(`div`,{className:`yuri-speech-light`})},e)}function V(e){let n=(0,N.c)(7),{available:r}=e,i=x(fe),[a,o]=(0,M.useState)(null),s;n[0]!==r||n[1]!==i?(s=r&&i&&!t()&&te(),n[0]=r,n[1]=i,n[2]=s):s=n[2];let c=s,l=c?a:null,u;return n[3]!==c||n[4]!==i||n[5]!==l?(u={globallyEnabled:i,enabled:c,hint:l,onHintChange:o},n[3]=c,n[4]=i,n[5]=l,n[6]=u):u=n[6],u}function fe(e){return e.dictationEnabled}var H=M.createContext(null),pe=e=>{let t=(0,N.c)(3),{actions:n,children:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,P.jsx)(H.Provider,{value:n,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},U=()=>M.useContext(H),me=e=>e.nativeEvent.isComposing||e.nativeEvent.keyCode===229;function W(e){let t=(0,N.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`inline-flex shrink-0 items-center justify-center rounded-full bg-foreground text-background`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,P.jsx)(`span`,{className:a,...i,"aria-hidden":!0,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function he(e){let t=(0,N.c)(7),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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(`span`,{"data-stop-glyph":`true`,className:`block size-[38%] rounded-[20%] bg-current`}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,P.jsx)(W,{className:n,...r,children:i}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function G(e){let t=(0,N.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,spinning:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i,o=a?`loader-4`:`arrow-up`,s=a?`size-[50%] animate-spin`:`size-[56%]`,c;t[4]===s?c=t[5]:(c=y(s),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,P.jsx)(E,{name:o,weight:`medium`,className:c}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==l?(u=(0,P.jsx)(W,{className:n,...r,children:l}),t[9]=n,t[10]=r,t[11]=l,t[12]=u):u=t[12],u}var ge=M.forwardRef((e,t)=>{let n=(0,N.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({children:r,className:i,expanded:s,style:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=s!==void 0&&s&&`min-h-0 flex-1`,l;n[6]!==i||n[7]!==c?(l=y(`relative flex flex-col overflow-visible border border-[color-mix(in_srgb,var(--interactive-border)_50%,transparent)] dark:border-transparent`,`bg-[var(--surface-background)] shadow-[0_2px_6px_-3px_color-mix(in_srgb,var(--surface-foreground)_4%,transparent),inset_0_1px_0_var(--yuri-mobile-glass-highlight)] transition-colors duration-150 motion-reduce:transition-none`,`dark:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_8%)] dark:shadow-none dark:hover:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)] dark:focus-within:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)]`,c,i),n[6]=i,n[7]=c,n[8]=l):l=n[8];let u;n[9]===o?u=n[10]:(u={borderRadius:`var(--radius-xl)`,...o},n[9]=o,n[10]=u);let d;return n[11]!==r||n[12]!==a||n[13]!==t||n[14]!==l||n[15]!==u?(d=(0,P.jsx)(`div`,{ref:t,className:l,style:u,...a,children:r}),n[11]=r,n[12]=a,n[13]=t,n[14]=l,n[15]=u,n[16]=d):d=n[16],d});ge.displayName=`ChatComposerSurface`;var _e=M.forwardRef((e,t)=>{let n=(0,N.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,P.jsx)(j,{ref:t,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});_e.displayName=`ChatPromptTextarea`;var ve=e=>{let t=(0,N.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`flex shrink-0 items-center gap-2 bg-transparent px-2.5 py-1.5`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,P.jsx)(`div`,{className:a,"data-chat-input-footer":`true`,...i,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},K=(e,t)=>{typeof e==`function`?e(t):e&&(e.current=t)},q=({value:e,attachments:t=[],disabled:n=!1,pending:r=!1,placeholder:i,isMobile:a=!1,onChange:o,onSubmit:s,onStop:c,onAddFiles:l,onRemoveAttachment:u,addFilesLabel:d,removeAttachmentLabel:f,fileAccept:p=`image/*`,sendLabel:m,stopLabel:h,hint:b,leftControls:x,rightControls:S,footerContent:C,inputHeader:w,attachmentContent:ee,highlightedContent:D,highlightRef:O,inputRef:te,textareaProps:k,textLayoutClassName:j,inputClassName:N,inputOuterClassName:ne,inputStyle:re,footerClassName:F,footerStyle:L,contentClassName:R,inputSectionClassName:se,autoResize:z=!0,disableInputWhilePending:ce=!0,layout:le=`stacked`,children:ue,className:de,expanded:B=!1,...V})=>{let{t:fe}=v(),H=le===`inline`,[pe,U]=M.useState(!1),[W,q]=M.useState(!1),J=ie(),ye=t.length>0||pe,Y=M.useRef(null),be=M.useRef(null),X=M.useRef(null),xe=M.useId().replace(/:/g,``),Se=_(()=>{if(!z||B||k?.fillContainer){H&&U(!1);return}let e=Y.current;if(!e)return;e.style.height=H?`0px`:`auto`;let t=window.getComputedStyle(e),n=Number.parseFloat(t.maxHeight),r=H?Math.max(Number.parseFloat(t.minHeight)||0,(Number.parseFloat(t.lineHeight)||0)+(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0)):0,i=H?Math.max(e.scrollHeight,r):e.scrollHeight,a=Number.isFinite(n)?Math.min(i,n):i;e.style.height=`${a}px`,e.style.overflowY=Number.isFinite(n)&&i>n?`auto`:`hidden`;let o=a>Math.ceil(r);H&&U(e=>e===o?e:o)});M.useLayoutEffect(()=>{Se()},[z,B,H,k?.fillContainer,e]),g(H&&z&&!B&&!k?.fillContainer?Y:null,Se);let Ce=e=>{k?.onKeyDown?.(e),!(e.defaultPrevented||me(e))&&e.key===`Enter`&&!e.shiftKey&&!a&&(e.preventDefault(),!n&&(!r||!ce)&&s())},we=e=>{l?.(e.target.files),e.target.value=``},Te=_(()=>{Y.current?.blur(),q(!0)}),Z=_(e=>{q(!1),requestAnimationFrame(()=>e?.click())}),Q=_(()=>{q(!1),requestAnimationFrame(()=>{(async()=>{if(!I()){X.current?.click();return}try{let e=await ae(20);if(e===null){X.current?.click();return}e.length>0&&l?.(e)}catch(e){console.error(`Native photo pick failed`,e),T.error(fe(`chat.chatInput.toast.attachFileFailed`))}})()})}),$=e.trim().length>0||t.length>0,Ee=t.filter(e=>e.mime.startsWith(`image/`)),De=t.filter(e=>!e.mime.startsWith(`image/`)),Oe=l?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`input`,{ref:be,type:`file`,accept:p,multiple:!0,className:`hidden`,onChange:we}),J?(0,P.jsx)(`input`,{ref:X,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:we}):null,(0,P.jsx)(`button`,{type:`button`,className:`flex size-8 shrink-0 items-center justify-center rounded-md text-foreground outline-none hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>J?Te():be.current?.click(),onMouseDown:a?e=>e.preventDefault():void 0,onPointerDownCapture:a?e=>e.preventDefault():void 0,disabled:n||r,"aria-label":d,children:(0,P.jsx)(E,{name:`attachment-2`,className:`size-[18px]`})})]}):null,ke=!n&&!r&&$,Ae=a?`size-6`:`size-full`,je=r&&c?(0,P.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,P.jsx)(he,{className:Ae})}):(0,P.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":ke?`true`:void 0,className:y(`flex size-8 shrink-0 items-center justify-center outline-none`,ke?`rounded-full hover:opacity-80`:`rounded-md text-primary hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-30`),disabled:n||r||!$,"aria-label":m,children:ke?(0,P.jsx)(G,{className:Ae}):(0,P.jsx)(E,{name:r?`loader-4`:`send-plane-2`,className:y(`size-4`,r&&`animate-spin`)})}),Me=r&&c?(0,P.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,P.jsx)(he,{className:Ae})}):(0,P.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":`true`,className:y(`flex size-8 shrink-0 items-center justify-center rounded-full outline-none`,ke?`hover:opacity-80`:`cursor-not-allowed opacity-30`),disabled:n||r||!$,"aria-busy":r||void 0,"aria-label":m,onClick:()=>Y.current?.focus({preventScroll:!0}),onMouseDown:e=>e.preventDefault(),onPointerDownCapture:a?e=>e.preventDefault():void 0,children:(0,P.jsx)(G,{className:Ae,spinning:r})}),Ne=H?Me:je,Pe=x===void 0?Oe:x;return(0,P.jsxs)(ge,{className:de,expanded:B,...V,children:[ue,(0,P.jsxs)(`div`,{"data-composer-content":`true`,"data-composer-layout":le,className:y(`relative flex min-h-0`,H?y(`min-h-12 flex-row`,ye?`items-end`:`items-center`):`flex-col`,B&&`flex-1`,R),children:[H&&Pe?(0,P.jsx)(`div`,{className:`flex h-12 shrink-0 items-center pl-1.5`,"data-composer-inline-attach":`true`,children:Pe}):null,(0,P.jsxs)(`div`,{className:y(`overflow-hidden`,H&&`min-w-0 flex-1`,B&&`flex min-h-0 flex-1 flex-col`,se),children:[w,ee,Ee.length>0?(0,P.jsx)(`div`,{className:`flex gap-2 overflow-x-auto px-3 pt-3`,"data-chat-prompt-attachments":`true`,children:Ee.map(e=>(0,P.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,P.jsx)(`span`,{className:`block size-16`,children:(0,P.jsx)(A,{fill:!0,src:e.url,alt:e.name,className:`size-16 rounded-lg border border-border object-cover`})}),u?(0,P.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] shadow-sm hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,P.jsx)(E,{name:`close`,className:`size-3`})}):null]},e.id))}):null,De.length>0?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,"data-chat-prompt-file-attachments":`true`,children:De.map(e=>(0,P.jsxs)(`div`,{className:`relative flex max-w-[12rem] items-center gap-1.5 rounded-lg border border-border bg-[var(--surface-elevated)] px-2 py-1`,children:[(0,P.jsx)(E,{name:`file-text`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`min-w-0 truncate typography-micro`,children:e.name}),u?(0,P.jsx)(`button`,{type:`button`,className:`flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,P.jsx)(E,{name:`close`,className:`size-3`})}):null]},e.id))}):null,(0,P.jsxs)(`div`,{className:y(`relative overflow-hidden`,H&&y(`flex min-h-12`,pe?`items-end`:`items-center`),B&&`flex min-h-0 flex-1 flex-col`),"data-composer-input-shell":`true`,children:[D?(0,P.jsx)(`div`,{ref:O,"aria-hidden":!0,"data-composer-highlight":`true`,className:y(`pointer-events-none absolute inset-0 z-0 rounded-b-none`,j,N),children:D}):null,(0,P.jsx)(_e,{...k,simple:!0,fillContainer:!H&&k?.fillContainer,ref:e=>{Y.current=e,K(te,e)},"data-chat-input":`true`,value:e,onChange:e=>o(e.target.value,e),onKeyDown:Ce,disabled:n||r&&ce,placeholder:i,enterKeyHint:a?`enter`:k?.enterKeyHint,outerClassName:y(`ring-0 bg-transparent shadow-none hover:bg-transparent focus-within:ring-0`,H&&`flex-none`,B&&`min-h-0 flex-1`,ne),className:y(`relative z-10 resize-none overflow-y-hidden appearance-none border-0 bg-transparent typography-markdown hover:border-transparent md:typography-ui-label`,H?`field-sizing-fixed min-h-12 max-h-32 px-3 py-3 leading-6`:`min-h-[52px] max-h-40 rounded-b-none px-3 pb-2 pt-4`,j,N,D&&`text-transparent caret-[var(--surface-foreground)]`),style:re,rows:k?.rows??1})]})]}),H?(0,P.jsx)(`div`,{className:y(`flex h-12 shrink-0 items-center pr-1.5`,F),style:L,"data-composer-inline-send":`true`,children:S??Ne}):(0,P.jsx)(ve,{className:F,style:L,children:C??(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5`,children:x??Oe}),b?(0,P.jsx)(`div`,{className:`min-w-0 flex-1 truncate typography-micro text-muted-foreground`,children:b}):(0,P.jsx)(`div`,{className:`flex-1`}),(0,P.jsx)(`div`,{className:`flex items-center gap-1.5`,children:S??Ne})]})})]}),J&&l?(0,P.jsx)(oe,{id:`mobile-attach-pick-${xe}`,open:W,onOpenChange:e=>{e||q(!1)},onPickPhotos:Q,onPickFiles:()=>Z(be.current)}):null]})},J={dictation:102,mentionFile:100,mentionAgent:100,mentionSession:100,mentionCommand:100,mentionPaste:100,code:90,codeFence:90,link:80,linkUrl:78,heading:70,blockquote:40,listMarker:35,marker:10},ye={dictation:`text-foreground underline decoration-current underline-offset-4`,mentionFile:`text-[var(--primary)]`,mentionAgent:`text-[var(--primary)]`,mentionSession:`text-[var(--primary)]`,mentionCommand:`text-[var(--primary)]`,mentionPaste:`text-[var(--primary)]`,code:`rounded-[3px] bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,codeFence:`bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,link:`text-[var(--status-info)] underline`,linkUrl:`text-muted-foreground`,heading:`text-[var(--syntax-keyword)]`,blockquote:`text-muted-foreground`,listMarker:`text-[var(--syntax-keyword)]`,marker:`text-muted-foreground`},Y=`text-foreground`;function be(e,t){if(!e||t.length===0)return null;let n=e.length,r=new Set([0,n]);for(let e of t)e.start>0&&e.start<n&&r.add(e.start),e.end>0&&e.end<n&&r.add(e.end);let i=[...r].sort((e,t)=>e-t),a=t.map((e,t)=>({range:e,index:t})).filter(e=>e.range.end>e.range.start).sort((e,t)=>e.range.start-t.range.start),o=[],c=[],l=0;for(let t=0;t<i.length-1;t+=1){let n=i[t],r=i[t+1];if(r<=n)continue;for(;l<a.length&&a[l].range.start<=n;)c.push(a[l]),l+=1;for(let e=c.length-1;e>=0;--e)c[e].range.end<=n&&c.splice(e,1);let u=null,d=-1,f=1/0;for(let{range:e,index:t}of c){let n=e.priority??J[e.style];(n>d||n===d&&t<f)&&(d=n,f=t,u=e)}let p=u?u.className??ye[u.style]:Y,m=e.slice(n,r),h=u?.visual,g=u?.skillName,_=o[o.length-1];_&&_.className===p&&s(_.visual,h)&&_.skillName===g?_.text+=m:o.push({text:m,className:p,visual:h,skillName:g})}return o.length>0?o:null}function X(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase())),r=[];for(let t of[/(^|\s)\/(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)/gi,/(^|\s)@(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)(?=$|\s|[),.;:!?])/gi]){let i;for(;(i=t.exec(e))!==null;){let e=i[2]??``,t=i[3]||``;if(!n.has(t.toLowerCase()))continue;let a=i.index+(i[1]?.length??0);r.push({start:a,end:a+1+e.length+t.length,name:t})}}return r}function xe(e,t,n){if(e===t){let t=n.find(t=>e>t.start&&e<t.end);return t?{start:t.start,end:t.end}:null}let r=n.filter(n=>n.start<t&&n.end>e);return r.length===0?null:{start:Math.min(e,...r.map(e=>e.start)),end:Math.max(t,...r.map(e=>e.end))}}function Se(e,t,n){let r=X(e,t),i=Math.max(0,Math.min(n.selectionStart,e.length)),a=Math.max(i,Math.min(n.selectionEnd,e.length)),o=i,s=a;if(i===a)if(n.altKey)if(n.key===`Backspace`){for(;o>0&&/\s/.test(e[o-1]);)--o;for(;o>0&&!/\s/.test(e[o-1]);)--o}else{for(;s<e.length&&/\s/.test(e[s]);)s+=1;for(;s<e.length&&!/\s/.test(e[s]);)s+=1}else n.key===`Backspace`?o=Math.max(0,i-1):s=Math.min(e.length,i+1);if(o===s)return null;let c=r.filter(e=>e.start<s&&e.end>o);if(c.length===0)return null;let l=Math.min(o,...c.map(e=>e.start)),u=Math.max(s,...c.map(e=>e.end));return u<e.length&&/\s/.test(e[u])&&(l===0||/\s/.test(e[l-1]))?u+=1:u===e.length&&l>0&&/\s/.test(e[l-1])&&--l,{text:`${e.slice(0,l)}${e.slice(u)}`,caret:l,removedSkillNames:c.map(e=>e.name)}}function Ce(e){return e.map(e=>({start:e.start,end:e.end,style:e.kind===`file`?`mentionFile`:e.kind===`session`?`mentionSession`:`mentionAgent`,visual:e.kind===`session`&&e.label?d({trigger:`@`,icon:`chat-thread`,label:e.label},c({trigger:`@`,icon:`chat-thread`,label:e.label})):void 0}))}function we(e){let t=(0,N.c)(28),{visual:n,text:r}=e,i=n.trigger.length,a=i+n.label.length,o=a+(n.suffix?.length??0),s;t[0]!==a||t[1]!==i||t[2]!==r?(s=r.slice(i,Math.min(a,r.length)),t[0]=a,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c=s,d;t[4]!==a||t[5]!==o||t[6]!==r?(d=r.slice(a,Math.min(o,r.length)),t[4]=a,t[5]=o,t[6]=r,t[7]=d):d=t[7];let f=d,p;t[8]!==o||t[9]!==r?(p=r.slice(Math.min(o,r.length)),t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=p,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h={left:l,right:l},t[11]=h):h=t[11];let g=n.icon,_;t[12]===g?_=t[13]:(_=(0,P.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 inline-flex items-center justify-center`,style:h,children:(0,P.jsx)(E,{name:g,className:`${u} shrink-0 text-[var(--primary)]`,"aria-hidden":`true`})}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==n.trigger?(v=(0,P.jsxs)(`span`,{className:`relative inline-block align-baseline text-transparent leading-none`,children:[n.trigger,_]}),t[14]=_,t[15]=n.trigger,t[16]=v):v=t[16];let y;t[17]===c?y=t[18]:(y=(0,P.jsx)(`span`,{children:c}),t[17]=c,t[18]=y);let b;t[19]===f?b=t[20]:(b=f?(0,P.jsx)(`span`,{className:`text-transparent`,children:f}):null,t[19]=f,t[20]=b);let x;t[21]===m?x=t[22]:(x=m?(0,P.jsx)(`span`,{className:`text-transparent`,children:m}):null,t[21]=m,t[22]=x);let S;return t[23]!==x||t[24]!==v||t[25]!==y||t[26]!==b?(S=(0,P.jsxs)(P.Fragment,{children:[v,y,b,x]}),t[23]=x,t[24]=v,t[25]=y,t[26]=b,t[27]=S):S=t[27],S}var Te=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return!1;switch(e.key){case`ArrowUp`:case`PageUp`:case`Home`:return!0;default:return!1}},Z=(e,t,n)=>{let r=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;r&&r!==e;){if(r instanceof HTMLElement){let e=r.scrollHeight-r.clientHeight;if(e>1&&(n===`up`?r.scrollTop>0:r.scrollTop<e-1))return!0}r=r.parentElement}return!1},Q=(e,t)=>Z(e,t,`up`),$=(e,t)=>Z(e,t,`down`),Ee=e=>({text:e.text,references:e.references.map(e=>({...e}))}),De=e=>e.map(e=>({...e,range:{...e.range}})),Oe=(e,t)=>e.text===t.text&&JSON.stringify(e.references)===JSON.stringify(t.references),ke=(e,t,n)=>({document:Ee(e),mentions:De(t),selection:{...n}}),Ae=()=>({undo:[],redo:[]}),je=(e,t)=>({undo:[...e.undo,t].slice(-100),redo:[]}),Me=(e,t)=>{let n=e.undo.at(-1);return!n||!Oe(n.after.document,t)?null:{history:{undo:e.undo.slice(0,-1),redo:[...e.redo,n]},snapshot:ke(n.before.document,n.before.mentions,n.before.selection)}},Ne=(e,t)=>{let n=e.redo.at(-1);return!n||!Oe(n.before.document,t)?null:{history:{undo:[...e.undo,n],redo:e.redo.slice(0,-1)},snapshot:ke(n.after.document,n.after.mentions,n.after.selection)}},Pe=e=>{if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.trunc(e);return t>=0?t:void 0},Fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.summary;return!t||typeof t!=`object`||Array.isArray(t)?null:t},Ie=e=>{let t=Pe(e);return t!==void 0&&t>0?t:void 0};function Le(e){let t=Fe(e);if(!t)return null;let n=Ie(t.additions),r=Ie(t.deletions),i=Ie(t.files)??Ie(t.diffCount);return n===void 0&&r===void 0&&i===void 0?null:{...n===void 0?{}:{additions:n},...r===void 0?{}:{deletions:r},...i===void 0?{}:{files:i}}}function Re(e){if(!e)return null;let t=[];return e.additions!==void 0&&e.additions>0&&t.push(`+${e.additions}`),e.deletions!==void 0&&e.deletions>0&&t.push(`−${e.deletions}`),t.length>0?t.join(` `):null}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.providerID==`string`?t.providerID.trim():``,r=typeof t.modelID==`string`?t.modelID.trim():``;if(n&&r)return`${n}/${r}`;let i=t.model;if(typeof i==`string`&&i.trim())return i.trim();if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i,t=typeof e.providerID==`string`?e.providerID.trim():typeof e.provider==`string`?e.provider.trim():``,n=typeof e.modelID==`string`?e.modelID.trim():typeof e.id==`string`?e.id.trim():``;if(t&&n)return`${t}/${n}`}return null}function Be(e){if(!e||e.trim().length===0)return null;let t=w.getState(),n=t.activeSessions.find(t=>t.id===e)??t.archivedSessions.find(t=>t.id===e)??null;if(!n)return null;let r=ee(n);return r?{sessionId:e,directory:r,session:n,fromCache:!t.hasLoaded,source:`memory`}:null}function Ve(e){return Be(e)?.directory??null}var He=new Map;async function Ue(e,t){let n=e.trim();if(!n)return null;let r=Be(n);if(r)return r;let i=He.get(n);if(i)return i;let a=(async()=>{let e=Be(n);if(e)return e;let r=await S(n,{signal:t?.signal});if(r?.directory)return{sessionId:r.id,directory:r.directory,session:null,fromCache:!1,source:`session-index`};if(t?.trySessionGet===!1)return null;try{let e=await f.getSession(n),t=typeof e.directory==`string`&&e.directory.trim()||(typeof e.project?.worktree==`string`?e.project.worktree.trim():``)||null;return t?{sessionId:n,directory:t,session:e,fromCache:!1,source:`session-get`}:null}catch{return null}})().finally(()=>{He.get(n)===a&&He.delete(n)});return He.set(n,a),a}export{oe as A,he as C,V as D,U as E,ae as M,ie as N,de as O,G as S,pe as T,X as _,Le as a,Se as b,Ae as c,Me as d,Te as f,be as g,we as h,Re as i,I as j,se as k,je as l,Q as m,Ve as n,ze as o,$ as p,Ue as r,ke as s,Be as t,Ne as u,Ce as v,me as w,q as x,xe as y};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{k as t,n,t as r}from"./platform-DMsFWy1a.js";import{at as i,ot as a,st as o}from"./vendor-base-ui-CzHs0bHY.js";import{Br as s,Lr as c,Mr as l,Nr as u,Rr as d,kn as f}from"./gitApiHttp-B1mApXwC.js";import{n as p}from"./vendor-react-DlzBev0S.js";import{a as m,n as h}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{p as g,r as _}from"./vendor-reactuses-core-CuTmqEMK.js";import{t as v}from"./i18n-BU14awhU.js";import{Jn as y,Kn as b,Li as x,Mi as S,fi as C,oi as w,ri as ee,ui as T}from"./useMobileNavigationStore-Dr61mYqA.js";import{n as E}from"./Icon-Co7WGN1G.js";import{r as D}from"./themes-BgDJcxRc.js";import{t as O}from"./MobileResizableSheet-Dd1w8a-6.js";import{n as te,t as k}from"./useDictation-CyWtsxSn.js";import{t as A}from"./LoadingImage-PH45V6oj.js";import{t as j}from"./textarea-DpsaIedI.js";var M=e(o(),1),N=p(),P=a(),ne=e(i(),1),re=m(`YuriMedia`);function F(e){return e.platform===`android`||/Android/i.test(e.userAgent)||e.userAgentDataPlatform===`Android`}function ie(){if(typeof window>`u`)return!1;let e=navigator.userAgentData;return F({platform:r(),userAgent:navigator.userAgent||``,userAgentDataPlatform:e?.platform})}function I(){return n()&&h.getPlatform()===`android`&&h.isPluginAvailable(`YuriMedia`)}async function ae(e){if(!I())return null;let t=await re.pickMedia({limit:e});if(t.cancelled)return[];let n=[];for(let e of t.files){let t=await fetch(h.convertFileSrc(e.path));if(!t.ok)throw Error(`Native media fetch failed (${t.status})`);let r=await t.blob();n.push(new File([r],e.name,{type:e.mimeType}))}return n}var L=`h-auto min-h-12 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 border-b border-[var(--surface-subtle)] last:border-b-0`,oe=e=>{let t=(0,N.c)(38),{id:n,open:r,onOpenChange:i,onPickPhotos:a,onPickFiles:o}=e,{t:s}=v(),c;t[0]===s?c=t[1]:(c=s(`chat.chatInput.actions.addAttachment`),t[0]=s,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,P.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:c}),t[2]=c,t[3]=l);let u;t[4]===s?u=t[5]:(u=s(`chat.chatInput.actions.addAttachment`),t[4]=s,t[5]=u);let d;t[6]===s?d=t[7]:(d=s(`mobile.surface.closeAria`),t[6]=s,t[7]=d);let f;t[8]===s?f=t[9]:(f=s(`mobile.sessions.sheet.resizeAria`),t[8]=s,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,P.jsx)(E,{name:`file-image`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===s?m=t[12]:(m=s(`chat.chatInput.actions.attachPhotos`),t[11]=s,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,P.jsx)(`span`,{className:`truncate`,children:m}),t[13]=m,t[14]=h);let g;t[15]!==a||t[16]!==h?(g=(0,P.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:L,"data-mobile-press-feedback":`none`,onClick:a,children:[p,h]}),t[15]=a,t[16]=h,t[17]=g):g=t[17];let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,P.jsx)(E,{name:`attachment-2`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[18]=_):_=t[18];let y;t[19]===s?y=t[20]:(y=s(`chat.chatInput.actions.attachFiles`),t[19]=s,t[20]=y);let x;t[21]===y?x=t[22]:(x=(0,P.jsx)(`span`,{className:`truncate`,children:y}),t[21]=y,t[22]=x);let S;t[23]!==o||t[24]!==x?(S=(0,P.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:L,"data-mobile-press-feedback":`none`,onClick:o,children:[_,x]}),t[23]=o,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==g?(C=(0,P.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,P.jsxs)(`div`,{className:`overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-page-scroll-lock":`true`,children:[g,S]})}),t[26]=S,t[27]=g,t[28]=C):C=t[28];let w;return t[29]!==n||t[30]!==i||t[31]!==r||t[32]!==C||t[33]!==l||t[34]!==u||t[35]!==d||t[36]!==f?(w=(0,P.jsx)(O,{id:n,open:r,onOpenChange:i,title:l,ariaLabel:u,closeAriaLabel:d,resizeAriaLabel:f,fitContent:!0,children:C}),t[29]=n,t[30]=i,t[31]=r,t[32]=C,t[33]=l,t[34]=u,t[35]=d,t[36]=f,t[37]=w):w=t[37],w},R={glyph:`_glyph_1xs2e_1`,lens:`_lens_1xs2e_12`,shape:`_shape_1xs2e_21`,revolve:`_revolve_1xs2e_1`};function se(e){let t=(0,N.c)(18),{decorative:n,size:r}=e,i=n!==void 0&&n,a=r===void 0?20:r,{t:o}=v(),s;t[0]===a?s=t[1]:(s={width:a,height:a},t[0]=a,t[1]=s);let c=i||void 0,l=i?void 0:`img`,u;t[2]!==i||t[3]!==o?(u=i?void 0:o(`common.loading`),t[2]=i,t[3]=o,t[4]=u):u=t[4];let d=`scale(${a/28})`,f;t[5]===d?f=t[6]:(f={transform:d},t[5]=d,t[6]=f);let p,m,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,P.jsx)(`span`,{className:R.shape}),p=(0,P.jsx)(`span`,{className:R.shape}),m=(0,P.jsx)(`span`,{className:R.shape}),t[7]=p,t[8]=m,t[9]=h):(p=t[7],m=t[8],h=t[9]);let g;t[10]===f?g=t[11]:(g=(0,P.jsxs)(`span`,{className:R.lens,style:f,children:[h,p,m]}),t[10]=f,t[11]=g);let _;return t[12]!==g||t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==u?(_=(0,P.jsx)(`span`,{"data-dictation-loading":!0,className:R.glyph,style:s,"aria-hidden":c,role:l,"aria-label":u,children:g}),t[12]=g,t[13]=s,t[14]=c,t[15]=l,t[16]=u,t[17]=_):_=t[17],_}var z=D(!1).colors,ce=`M-50 74.564 A600 600 0 0 1 147.707 22.283 A38 38 0 0 1 154.330 97.994 A524 524 0 0 0 -18.333 143.653 Z`,le=`M450 74.564 A600 600 0 0 0 252.293 22.283 A38 38 0 0 0 245.670 97.994 A524 524 0 0 1 418.333 143.653 Z`,ue={colorScheme:`light`,"--surface-background":z.surface.background,"--surface-foreground":z.surface.foreground,"--primary-base":z.primary.base,"--foreground":z.surface.background,"--interactive-hover":`color-mix(in srgb, var(--surface-background) 12%, transparent)`,"--interactive-active":`color-mix(in srgb, var(--surface-background) 20%, transparent)`,"--ring":z.interactive.focusRing,"--status-error":z.status.error};function de(e){let t=(0,N.c)(85),{containerRef:n,disabled:r,onInsert:i,onSend:a,onRelease:o,onError:s,onHintChange:c}=e,{t:l}=v(),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(!1),[m,h]=(0,M.useState)(`send`),g=(0,M.useRef)(null),y=(0,M.useRef)(null),b=(0,M.useRef)(`insert`),x=(0,M.useRef)(null),S=(0,M.useId)(),w=(0,M.useId)(),ee=(0,M.useId)(),T;t[0]!==i||t[1]!==a?(T=e=>b.current===`send`?a(e):i(e),t[0]=i,t[1]=a,t[2]=T):T=t[2];let E;t[3]!==s||t[4]!==T?(E={onTranscript:T,onError:s},t[3]=s,t[4]=T,t[5]=E):E=t[5];let D=k(E),{status:O,isStarting:te,partialTranscript:A,error:j,volume:re}=D,F=_(c),ie=u?m===`cancel`?`cancelling`:m===`edit`?`editing`:`recording`:f?`processing`:null,I,ae;t[6]!==ie||t[7]!==F?(I=()=>{F(ie)},ae=[ie,F],t[6]=ie,t[7]=F,t[8]=I,t[9]=ae):(I=t[8],ae=t[9]),(0,M.useEffect)(I,ae);let L,oe;t[10]===F?(L=t[11],oe=t[12]):(L=()=>()=>F(null),oe=[F],t[10]=F,t[11]=L,t[12]=oe),(0,M.useEffect)(L,oe);let R;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{y.current&&clearTimeout(y.current),y.current=null},t[13]=R):R=t[13];let z=_(R),de;t[14]!==n||t[15]!==r?(de=e=>{if(r||!(e instanceof HTMLElement))return null;let t=n.current?.querySelector(`textarea`);return!t||t.value!==``||t.disabled||t.readOnly||t.ownerDocument.activeElement===t||e!==t&&!e.closest(`[data-yuri-composer-compact-surface]`)||e.closest(`button, [data-composer-action]`)?null:t},t[14]=n,t[15]=r,t[16]=de):de=t[16];let V=_(de),fe;t[17]!==z||t[18]!==D||t[19]!==j||t[20]!==f||t[21]!==O?(fe=()=>{f||(z(),g.current=null,d(!1),h(`send`),O===`failed`||O===`idle`&&j?D.discardFailedDictation():D.cancelDictation())},t[17]=z,t[18]=D,t[19]=j,t[20]=f,t[21]=O,t[22]=fe):fe=t[22];let H=_(fe),pe;t[23]!==D||t[24]!==r||t[25]!==V||t[26]!==f||t[27]!==O?(pe=e=>{let t=e.target;r||f||O!==`idle`||g.current||!e.isPrimary||e.button!==0||!(t instanceof HTMLElement)||V(t)&&(e.preventDefault(),e.stopPropagation(),g.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,intent:`send`,started:!1},y.current=setTimeout(()=>{if(y.current=null,!g.current)return;let e=V(t);if(!e){g.current=null;return}e.blur(),g.current.started=!0,b.current=`insert`,d(!0),h(`send`),D.startDictation()},300))},t[23]=D,t[24]=r,t[25]=V,t[26]=f,t[27]=O,t[28]=pe):pe=t[28];let U=_(pe),me;t[29]===z?me=t[30]:(me=e=>{let t=g.current;if(!t||t.pointer!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let n=e.clientX-t.x,r=x.current?.getBoundingClientRect(),i=r&&r.width>0&&e.clientY>=r.top&&e.clientY<=r.bottom?e.clientX<r.left+r.width/2?`cancel`:`edit`:n<=-64?`cancel`:n>=64?`edit`:`send`;if(!t.started&&Math.hypot(n,t.y-e.clientY)>12){z(),g.current=null;return}t.started&&i!==t.intent&&(t.intent=i,h(i),C(i===`send`?`light`:`medium`,{bypassCadence:!0}))},t[29]=z,t[30]=me);let W=_(me),he;t[31]!==H||t[32]!==z||t[33]!==n||t[34]!==D||t[35]!==j||t[36]!==o||t[37]!==A||t[38]!==O?(he=e=>{let t=g.current;if(!(!t||t.pointer!==e.pointerId)){if(e.preventDefault(),e.stopPropagation(),z(),j||O===`failed`){H();return}g.current=null,d(!1),t.started?t.intent===`cancel`?D.cancelDictation():(b.current=t.intent===`edit`?`insert`:`send`,o(A),p(!0),Promise.resolve(D.confirmDictation()).finally(()=>{p(!1),D.discardFailedDictation(),t.intent===`edit`&&n.current?.querySelector(`textarea`)?.focus()})):n.current?.querySelector(`textarea`)?.focus()}},t[31]=H,t[32]=z,t[33]=n,t[34]=D,t[35]=j,t[36]=o,t[37]=A,t[38]=O,t[39]=he):he=t[39];let G=_(he),ge;t[40]===H?ge=t[41]:(ge=e=>{g.current?.pointer===e.pointerId&&H()},t[40]=H,t[41]=ge);let _e=_(ge),ve;t[42]===V?ve=t[43]:(ve=e=>{V(e.target)&&e.preventDefault()},t[42]=V,t[43]=ve);let K=_(ve),q,J;t[44]!==H||t[45]!==z||t[46]!==n||t[47]!==U||t[48]!==_e||t[49]!==W||t[50]!==K||t[51]!==G?(q=()=>{let e=n.current;if(!e)return;let t=()=>{document.visibilityState===`hidden`&&H()};return e.addEventListener(`pointerdown`,U,!0),e.addEventListener(`touchstart`,K,{capture:!0,passive:!1}),window.addEventListener(`pointermove`,W,{capture:!0,passive:!1}),window.addEventListener(`pointerup`,G,!0),window.addEventListener(`pointercancel`,_e,!0),e.addEventListener(`contextmenu`,K,!0),e.addEventListener(`selectstart`,K,!0),window.addEventListener(`blur`,H),document.addEventListener(`visibilitychange`,t),()=>{z(),e.removeEventListener(`pointerdown`,U,!0),e.removeEventListener(`touchstart`,K,!0),window.removeEventListener(`pointermove`,W,!0),window.removeEventListener(`pointerup`,G,!0),window.removeEventListener(`pointercancel`,_e,!0),e.removeEventListener(`contextmenu`,K,!0),e.removeEventListener(`selectstart`,K,!0),window.removeEventListener(`blur`,H),document.removeEventListener(`visibilitychange`,t)}},J=[n,U,W,G,_e,H,z,K],t[44]=H,t[45]=z,t[46]=n,t[47]=U,t[48]=_e,t[49]=W,t[50]=K,t[51]=G,t[52]=q,t[53]=J):(q=t[52],J=t[53]),(0,M.useEffect)(q,J);let ye,Y;if(t[54]!==H||t[55]!==r?(ye=()=>{r&&H()},Y=[r,H],t[54]=H,t[55]=r,t[56]=ye,t[57]=Y):(ye=t[56],Y=t[57]),(0,M.useEffect)(ye,Y),!u&&!f)return null;let be=Math.min(1,Math.max(0,re))**.6,X=!!j,xe=j?H:void 0,Se;t[58]===be?Se=t[59]:(Se={...ue,"--speech-energy":be},t[58]=be,t[59]=Se);let Ce=Se,we;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,P.jsx)(`div`,{className:`yuri-speech-light-field`,"aria-hidden":`true`,children:[`ice`,`lilac`,`mint`,`blush`,`mid`,`core`].map(B)}),t[60]=we):we=t[60];let Te=te||f,Z;t[61]!==j||t[62]!==te||t[63]!==A||t[64]!==f||t[65]!==O||t[66]!==l?(Z=j&&!f?(0,P.jsx)(`p`,{role:`alert`,className:`yuri-speech-caption yuri-speech-error`,children:j}):(0,P.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`yuri-speech-caption`,children:te||f?(0,P.jsx)(se,{size:72}):A?(0,P.jsx)(`span`,{className:`yuri-speech-interim`,children:A}):l(O===`uploading`?`chat.dictation.processing`:`chat.dictation.listening`)}),t[61]=j,t[62]=te,t[63]=A,t[64]=f,t[65]=O,t[66]=l,t[67]=Z):Z=t[67];let Q;t[68]!==Te||t[69]!==Z?(Q=(0,P.jsx)(`div`,{className:`yuri-speech-content`,"data-starting":Te,children:Z}),t[68]=Te,t[69]=Z,t[70]=Q):Q=t[70];let $;t[71]!==S||t[72]!==w||t[73]!==ee||t[74]!==u||t[75]!==m||t[76]!==l?($=u&&(0,P.jsx)(`div`,{className:`yuri-speech-gesture-stage`,"aria-hidden":`true`,children:(0,P.jsxs)(`div`,{className:`yuri-speech-gesture-surfaces`,children:[(0,P.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${w})`}}),(0,P.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${ee})`}}),(0,P.jsxs)(`svg`,{className:`yuri-speech-geometry`,viewBox:`0 0 400 226`,focusable:`false`,children:[(0,P.jsxs)(`defs`,{children:[(0,P.jsx)(`clipPath`,{id:w,clipPathUnits:`objectBoundingBox`,children:(0,P.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:ce})}),(0,P.jsx)(`clipPath`,{id:ee,clipPathUnits:`objectBoundingBox`,children:(0,P.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:le})}),(0,P.jsxs)(`linearGradient`,{id:S,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,P.jsx)(`stop`,{offset:`0%`,className:`yuri-speech-arc-top`}),(0,P.jsx)(`stop`,{offset:`100%`,className:`yuri-speech-arc-bottom`})]})]}),(0,P.jsxs)(`g`,{className:`yuri-speech-targets`,ref:x,children:[(0,P.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--cancel`,"data-active":m===`cancel`,children:[(0,P.jsx)(`path`,{d:ce}),(0,P.jsx)(`text`,{x:`95`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(-11 95 68)`,children:l(`chat.dictation.cancelGesture`)})]}),(0,P.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--edit`,"data-active":m===`edit`,children:[(0,P.jsx)(`path`,{d:le}),(0,P.jsx)(`text`,{x:`305`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(11 305 68)`,children:l(`chat.dictation.edit`)})]})]}),(0,P.jsx)(`path`,{className:`yuri-speech-hold-arc`,fill:`url(#${S})`,d:`M-50 186.987 A500 500 0 0 1 450 186.987 L450 300 H-50 Z`})]})]})}),t[71]=S,t[72]=w,t[73]=ee,t[74]=u,t[75]=m,t[76]=l,t[77]=$):$=t[77];let Ee;return t[78]!==m||t[79]!==X||t[80]!==xe||t[81]!==Ce||t[82]!==Q||t[83]!==$?(Ee=(0,ne.createPortal)((0,P.jsxs)(`div`,{className:`yuri-speech-overlay`,"data-intent":m,"data-error":X,onClick:xe,style:Ce,children:[we,Q,$]}),document.body),t[78]=m,t[79]=X,t[80]=xe,t[81]=Ce,t[82]=Q,t[83]=$,t[84]=Ee):Ee=t[84],Ee}function B(e){return(0,P.jsx)(`div`,{className:`yuri-speech-reactor yuri-speech-reactor--${e}`,children:(0,P.jsx)(`div`,{className:`yuri-speech-light`})},e)}function V(e){let n=(0,N.c)(7),{available:r}=e,i=x(fe),[a,o]=(0,M.useState)(null),s;n[0]!==r||n[1]!==i?(s=r&&i&&!t()&&te(),n[0]=r,n[1]=i,n[2]=s):s=n[2];let c=s,l=c?a:null,u;return n[3]!==c||n[4]!==i||n[5]!==l?(u={globallyEnabled:i,enabled:c,hint:l,onHintChange:o},n[3]=c,n[4]=i,n[5]=l,n[6]=u):u=n[6],u}function fe(e){return e.dictationEnabled}var H=M.createContext(null),pe=e=>{let t=(0,N.c)(3),{actions:n,children:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,P.jsx)(H.Provider,{value:n,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},U=()=>M.useContext(H),me=e=>e.nativeEvent.isComposing||e.nativeEvent.keyCode===229;function W(e){let t=(0,N.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`inline-flex shrink-0 items-center justify-center rounded-full bg-foreground text-background`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,P.jsx)(`span`,{className:a,...i,"aria-hidden":!0,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function he(e){let t=(0,N.c)(7),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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(`span`,{"data-stop-glyph":`true`,className:`block size-[38%] rounded-[20%] bg-current`}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,P.jsx)(W,{className:n,...r,children:i}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function G(e){let t=(0,N.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,spinning:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i,o=a?`loader-4`:`arrow-up`,s=a?`size-[50%] animate-spin`:`size-[56%]`,c;t[4]===s?c=t[5]:(c=y(s),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,P.jsx)(E,{name:o,weight:`medium`,className:c}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==l?(u=(0,P.jsx)(W,{className:n,...r,children:l}),t[9]=n,t[10]=r,t[11]=l,t[12]=u):u=t[12],u}var ge=M.forwardRef((e,t)=>{let n=(0,N.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({children:r,className:i,expanded:s,style:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=s!==void 0&&s&&`min-h-0 flex-1`,l;n[6]!==i||n[7]!==c?(l=y(`relative flex flex-col overflow-visible border border-[color-mix(in_srgb,var(--interactive-border)_50%,transparent)] dark:border-transparent`,`bg-[var(--surface-background)] shadow-[0_2px_6px_-3px_color-mix(in_srgb,var(--surface-foreground)_4%,transparent),inset_0_1px_0_var(--yuri-mobile-glass-highlight)] transition-colors duration-150 motion-reduce:transition-none`,`dark:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_8%)] dark:shadow-none dark:hover:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)] dark:focus-within:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)]`,c,i),n[6]=i,n[7]=c,n[8]=l):l=n[8];let u;n[9]===o?u=n[10]:(u={borderRadius:`var(--radius-xl)`,...o},n[9]=o,n[10]=u);let d;return n[11]!==r||n[12]!==a||n[13]!==t||n[14]!==l||n[15]!==u?(d=(0,P.jsx)(`div`,{ref:t,className:l,style:u,...a,children:r}),n[11]=r,n[12]=a,n[13]=t,n[14]=l,n[15]=u,n[16]=d):d=n[16],d});ge.displayName=`ChatComposerSurface`;var _e=M.forwardRef((e,t)=>{let n=(0,N.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,P.jsx)(j,{ref:t,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});_e.displayName=`ChatPromptTextarea`;var ve=e=>{let t=(0,N.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`flex shrink-0 items-center gap-2 bg-transparent px-2.5 py-1.5`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,P.jsx)(`div`,{className:a,"data-chat-input-footer":`true`,...i,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},K=(e,t)=>{typeof e==`function`?e(t):e&&(e.current=t)},q=({value:e,attachments:t=[],disabled:n=!1,pending:r=!1,placeholder:i,isMobile:a=!1,onChange:o,onSubmit:s,onStop:c,onAddFiles:l,onRemoveAttachment:u,addFilesLabel:d,removeAttachmentLabel:f,fileAccept:p=`image/*`,sendLabel:m,stopLabel:h,hint:b,leftControls:x,rightControls:S,footerContent:C,inputHeader:w,attachmentContent:ee,highlightedContent:D,highlightRef:O,inputRef:te,textareaProps:k,textLayoutClassName:j,inputClassName:N,inputOuterClassName:ne,inputStyle:re,footerClassName:F,footerStyle:L,contentClassName:R,inputSectionClassName:se,autoResize:z=!0,disableInputWhilePending:ce=!0,layout:le=`stacked`,children:ue,className:de,expanded:B=!1,...V})=>{let{t:fe}=v(),H=le===`inline`,[pe,U]=M.useState(!1),[W,q]=M.useState(!1),J=ie(),ye=t.length>0||pe,Y=M.useRef(null),be=M.useRef(null),X=M.useRef(null),xe=M.useId().replace(/:/g,``),Se=_(()=>{if(!z||B||k?.fillContainer){H&&U(!1);return}let e=Y.current;if(!e)return;e.style.height=H?`0px`:`auto`;let t=window.getComputedStyle(e),n=Number.parseFloat(t.maxHeight),r=H?Math.max(Number.parseFloat(t.minHeight)||0,(Number.parseFloat(t.lineHeight)||0)+(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0)):0,i=H?Math.max(e.scrollHeight,r):e.scrollHeight,a=Number.isFinite(n)?Math.min(i,n):i;e.style.height=`${a}px`,e.style.overflowY=Number.isFinite(n)&&i>n?`auto`:`hidden`;let o=a>Math.ceil(r);H&&U(e=>e===o?e:o)});M.useLayoutEffect(()=>{Se()},[z,B,H,k?.fillContainer,e]),g(H&&z&&!B&&!k?.fillContainer?Y:null,Se);let Ce=e=>{k?.onKeyDown?.(e),!(e.defaultPrevented||me(e))&&e.key===`Enter`&&!e.shiftKey&&!a&&(e.preventDefault(),!n&&(!r||!ce)&&s())},we=e=>{l?.(e.target.files),e.target.value=``},Te=_(()=>{Y.current?.blur(),q(!0)}),Z=_(e=>{q(!1),requestAnimationFrame(()=>e?.click())}),Q=_(()=>{q(!1),requestAnimationFrame(()=>{(async()=>{if(!I()){X.current?.click();return}try{let e=await ae(20);if(e===null){X.current?.click();return}e.length>0&&l?.(e)}catch(e){console.error(`Native photo pick failed`,e),T.error(fe(`chat.chatInput.toast.attachFileFailed`))}})()})}),$=e.trim().length>0||t.length>0,Ee=t.filter(e=>e.mime.startsWith(`image/`)),De=t.filter(e=>!e.mime.startsWith(`image/`)),Oe=l?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`input`,{ref:be,type:`file`,accept:p,multiple:!0,className:`hidden`,onChange:we}),J?(0,P.jsx)(`input`,{ref:X,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:we}):null,(0,P.jsx)(`button`,{type:`button`,className:`flex size-8 shrink-0 items-center justify-center rounded-md text-foreground outline-none hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>J?Te():be.current?.click(),onMouseDown:a?e=>e.preventDefault():void 0,onPointerDownCapture:a?e=>e.preventDefault():void 0,disabled:n||r,"aria-label":d,children:(0,P.jsx)(E,{name:`attachment-2`,className:`size-[18px]`})})]}):null,ke=!n&&!r&&$,Ae=a?`size-6`:`size-full`,je=r&&c?(0,P.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,P.jsx)(he,{className:Ae})}):(0,P.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":ke?`true`:void 0,className:y(`flex size-8 shrink-0 items-center justify-center outline-none`,ke?`rounded-full hover:opacity-80`:`rounded-md text-primary hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-30`),disabled:n||r||!$,"aria-label":m,children:ke?(0,P.jsx)(G,{className:Ae}):(0,P.jsx)(E,{name:r?`loader-4`:`send-plane-2`,className:y(`size-4`,r&&`animate-spin`)})}),Me=r&&c?(0,P.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,P.jsx)(he,{className:Ae})}):(0,P.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":`true`,className:y(`flex size-8 shrink-0 items-center justify-center rounded-full outline-none`,ke?`hover:opacity-80`:`cursor-not-allowed opacity-30`),disabled:n||r||!$,"aria-busy":r||void 0,"aria-label":m,onClick:()=>Y.current?.focus({preventScroll:!0}),onMouseDown:e=>e.preventDefault(),onPointerDownCapture:a?e=>e.preventDefault():void 0,children:(0,P.jsx)(G,{className:Ae,spinning:r})}),Ne=H?Me:je,Pe=x===void 0?Oe:x;return(0,P.jsxs)(ge,{className:de,expanded:B,...V,children:[ue,(0,P.jsxs)(`div`,{"data-composer-content":`true`,"data-composer-layout":le,className:y(`relative flex min-h-0`,H?y(`min-h-12 flex-row`,ye?`items-end`:`items-center`):`flex-col`,B&&`flex-1`,R),children:[H&&Pe?(0,P.jsx)(`div`,{className:`flex h-12 shrink-0 items-center pl-1.5`,"data-composer-inline-attach":`true`,children:Pe}):null,(0,P.jsxs)(`div`,{className:y(`overflow-hidden`,H&&`min-w-0 flex-1`,B&&`flex min-h-0 flex-1 flex-col`,se),children:[w,ee,Ee.length>0?(0,P.jsx)(`div`,{className:`flex gap-2 overflow-x-auto px-3 pt-3`,"data-chat-prompt-attachments":`true`,children:Ee.map(e=>(0,P.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,P.jsx)(`span`,{className:`block size-16`,children:(0,P.jsx)(A,{fill:!0,src:e.url,alt:e.name,className:`size-16 rounded-lg border border-border object-cover`})}),u?(0,P.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] shadow-sm hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,P.jsx)(E,{name:`close`,className:`size-3`})}):null]},e.id))}):null,De.length>0?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,"data-chat-prompt-file-attachments":`true`,children:De.map(e=>(0,P.jsxs)(`div`,{className:`relative flex max-w-[12rem] items-center gap-1.5 rounded-lg border border-border bg-[var(--surface-elevated)] px-2 py-1`,children:[(0,P.jsx)(E,{name:`file-text`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`min-w-0 truncate typography-micro`,children:e.name}),u?(0,P.jsx)(`button`,{type:`button`,className:`flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,P.jsx)(E,{name:`close`,className:`size-3`})}):null]},e.id))}):null,(0,P.jsxs)(`div`,{className:y(`relative overflow-hidden`,H&&y(`flex min-h-12`,pe?`items-end`:`items-center`),B&&`flex min-h-0 flex-1 flex-col`),"data-composer-input-shell":`true`,children:[D?(0,P.jsx)(`div`,{ref:O,"aria-hidden":!0,"data-composer-highlight":`true`,className:y(`pointer-events-none absolute inset-0 z-0 rounded-b-none`,j,N),children:D}):null,(0,P.jsx)(_e,{...k,simple:!0,fillContainer:!H&&k?.fillContainer,ref:e=>{Y.current=e,K(te,e)},"data-chat-input":`true`,value:e,onChange:e=>o(e.target.value,e),onKeyDown:Ce,disabled:n||r&&ce,placeholder:i,enterKeyHint:a?`enter`:k?.enterKeyHint,outerClassName:y(`ring-0 bg-transparent shadow-none hover:bg-transparent focus-within:ring-0`,H&&`flex-none`,B&&`min-h-0 flex-1`,ne),className:y(`relative z-10 resize-none overflow-y-hidden appearance-none border-0 bg-transparent typography-markdown hover:border-transparent md:typography-ui-label`,H?`field-sizing-fixed min-h-12 max-h-32 px-3 py-3 leading-6`:`min-h-[52px] max-h-40 rounded-b-none px-3 pb-2 pt-4`,j,N,D&&`text-transparent caret-[var(--surface-foreground)]`),style:re,rows:k?.rows??1})]})]}),H?(0,P.jsx)(`div`,{className:y(`flex h-12 shrink-0 items-center pr-1.5`,F),style:L,"data-composer-inline-send":`true`,children:S??Ne}):(0,P.jsx)(ve,{className:F,style:L,children:C??(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5`,children:x??Oe}),b?(0,P.jsx)(`div`,{className:`min-w-0 flex-1 truncate typography-micro text-muted-foreground`,children:b}):(0,P.jsx)(`div`,{className:`flex-1`}),(0,P.jsx)(`div`,{className:`flex items-center gap-1.5`,children:S??Ne})]})})]}),J&&l?(0,P.jsx)(oe,{id:`mobile-attach-pick-${xe}`,open:W,onOpenChange:e=>{e||q(!1)},onPickPhotos:Q,onPickFiles:()=>Z(be.current)}):null]})},J={dictation:102,mentionFile:100,mentionAgent:100,mentionSession:100,mentionCommand:100,mentionPaste:100,code:90,codeFence:90,link:80,linkUrl:78,heading:70,blockquote:40,listMarker:35,marker:10},ye={dictation:`text-foreground underline decoration-current underline-offset-4`,mentionFile:`text-[var(--primary)]`,mentionAgent:`text-[var(--primary)]`,mentionSession:`text-[var(--primary)]`,mentionCommand:`text-[var(--primary)]`,mentionPaste:`text-[var(--primary)]`,code:`rounded-[3px] bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,codeFence:`bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,link:`text-[var(--status-info)] underline`,linkUrl:`text-muted-foreground`,heading:`text-[var(--syntax-keyword)]`,blockquote:`text-muted-foreground`,listMarker:`text-[var(--syntax-keyword)]`,marker:`text-muted-foreground`},Y=`text-foreground`;function be(e,t){if(!e||t.length===0)return null;let n=e.length,r=new Set([0,n]);for(let e of t)e.start>0&&e.start<n&&r.add(e.start),e.end>0&&e.end<n&&r.add(e.end);let i=[...r].sort((e,t)=>e-t),a=t.map((e,t)=>({range:e,index:t})).filter(e=>e.range.end>e.range.start).sort((e,t)=>e.range.start-t.range.start),o=[],c=[],l=0;for(let t=0;t<i.length-1;t+=1){let n=i[t],r=i[t+1];if(r<=n)continue;for(;l<a.length&&a[l].range.start<=n;)c.push(a[l]),l+=1;for(let e=c.length-1;e>=0;--e)c[e].range.end<=n&&c.splice(e,1);let u=null,d=-1,f=1/0;for(let{range:e,index:t}of c){let n=e.priority??J[e.style];(n>d||n===d&&t<f)&&(d=n,f=t,u=e)}let p=u?u.className??ye[u.style]:Y,m=e.slice(n,r),h=u?.visual,g=u?.skillName,_=o[o.length-1];_&&_.className===p&&s(_.visual,h)&&_.skillName===g?_.text+=m:o.push({text:m,className:p,visual:h,skillName:g})}return o.length>0?o:null}function X(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase())),r=[];for(let t of[/(^|\s)\/(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)/gi,/(^|\s)@(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)(?=$|\s|[),.;:!?])/gi]){let i;for(;(i=t.exec(e))!==null;){let e=i[2]??``,t=i[3]||``;if(!n.has(t.toLowerCase()))continue;let a=i.index+(i[1]?.length??0);r.push({start:a,end:a+1+e.length+t.length,name:t})}}return r}function xe(e,t,n){if(e===t){let t=n.find(t=>e>t.start&&e<t.end);return t?{start:t.start,end:t.end}:null}let r=n.filter(n=>n.start<t&&n.end>e);return r.length===0?null:{start:Math.min(e,...r.map(e=>e.start)),end:Math.max(t,...r.map(e=>e.end))}}function Se(e,t,n){let r=X(e,t),i=Math.max(0,Math.min(n.selectionStart,e.length)),a=Math.max(i,Math.min(n.selectionEnd,e.length)),o=i,s=a;if(i===a)if(n.altKey)if(n.key===`Backspace`){for(;o>0&&/\s/.test(e[o-1]);)--o;for(;o>0&&!/\s/.test(e[o-1]);)--o}else{for(;s<e.length&&/\s/.test(e[s]);)s+=1;for(;s<e.length&&!/\s/.test(e[s]);)s+=1}else n.key===`Backspace`?o=Math.max(0,i-1):s=Math.min(e.length,i+1);if(o===s)return null;let c=r.filter(e=>e.start<s&&e.end>o);if(c.length===0)return null;let l=Math.min(o,...c.map(e=>e.start)),u=Math.max(s,...c.map(e=>e.end));return u<e.length&&/\s/.test(e[u])&&(l===0||/\s/.test(e[l-1]))?u+=1:u===e.length&&l>0&&/\s/.test(e[l-1])&&--l,{text:`${e.slice(0,l)}${e.slice(u)}`,caret:l,removedSkillNames:c.map(e=>e.name)}}function Ce(e){return e.map(e=>({start:e.start,end:e.end,style:e.kind===`file`?`mentionFile`:e.kind===`session`?`mentionSession`:`mentionAgent`,visual:e.kind===`session`&&e.label?d({trigger:`@`,icon:`chat-thread`,label:e.label},c({trigger:`@`,icon:`chat-thread`,label:e.label})):void 0}))}function we(e){let t=(0,N.c)(28),{visual:n,text:r}=e,i=n.trigger.length,a=i+n.label.length,o=a+(n.suffix?.length??0),s;t[0]!==a||t[1]!==i||t[2]!==r?(s=r.slice(i,Math.min(a,r.length)),t[0]=a,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c=s,d;t[4]!==a||t[5]!==o||t[6]!==r?(d=r.slice(a,Math.min(o,r.length)),t[4]=a,t[5]=o,t[6]=r,t[7]=d):d=t[7];let f=d,p;t[8]!==o||t[9]!==r?(p=r.slice(Math.min(o,r.length)),t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=p,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h={left:l,right:l},t[11]=h):h=t[11];let g=n.icon,_;t[12]===g?_=t[13]:(_=(0,P.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 inline-flex items-center justify-center`,style:h,children:(0,P.jsx)(E,{name:g,className:`${u} shrink-0 text-[var(--primary)]`,"aria-hidden":`true`})}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==n.trigger?(v=(0,P.jsxs)(`span`,{className:`relative inline-block align-baseline text-transparent leading-none`,children:[n.trigger,_]}),t[14]=_,t[15]=n.trigger,t[16]=v):v=t[16];let y;t[17]===c?y=t[18]:(y=(0,P.jsx)(`span`,{children:c}),t[17]=c,t[18]=y);let b;t[19]===f?b=t[20]:(b=f?(0,P.jsx)(`span`,{className:`text-transparent`,children:f}):null,t[19]=f,t[20]=b);let x;t[21]===m?x=t[22]:(x=m?(0,P.jsx)(`span`,{className:`text-transparent`,children:m}):null,t[21]=m,t[22]=x);let S;return t[23]!==x||t[24]!==v||t[25]!==y||t[26]!==b?(S=(0,P.jsxs)(P.Fragment,{children:[v,y,b,x]}),t[23]=x,t[24]=v,t[25]=y,t[26]=b,t[27]=S):S=t[27],S}var Te=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return!1;switch(e.key){case`ArrowUp`:case`PageUp`:case`Home`:return!0;default:return!1}},Z=(e,t,n)=>{let r=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;r&&r!==e;){if(r instanceof HTMLElement){let e=r.scrollHeight-r.clientHeight;if(e>1&&(n===`up`?r.scrollTop>0:r.scrollTop<e-1))return!0}r=r.parentElement}return!1},Q=(e,t)=>Z(e,t,`up`),$=(e,t)=>Z(e,t,`down`),Ee=e=>({text:e.text,references:e.references.map(e=>({...e}))}),De=e=>e.map(e=>({...e,range:{...e.range}})),Oe=(e,t)=>e.text===t.text&&JSON.stringify(e.references)===JSON.stringify(t.references),ke=(e,t,n)=>({document:Ee(e),mentions:De(t),selection:{...n}}),Ae=()=>({undo:[],redo:[]}),je=(e,t)=>({undo:[...e.undo,t].slice(-100),redo:[]}),Me=(e,t)=>{let n=e.undo.at(-1);return!n||!Oe(n.after.document,t)?null:{history:{undo:e.undo.slice(0,-1),redo:[...e.redo,n]},snapshot:ke(n.before.document,n.before.mentions,n.before.selection)}},Ne=(e,t)=>{let n=e.redo.at(-1);return!n||!Oe(n.before.document,t)?null:{history:{undo:[...e.undo,n],redo:e.redo.slice(0,-1)},snapshot:ke(n.after.document,n.after.mentions,n.after.selection)}},Pe=e=>{if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.trunc(e);return t>=0?t:void 0},Fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.summary;return!t||typeof t!=`object`||Array.isArray(t)?null:t},Ie=e=>{let t=Pe(e);return t!==void 0&&t>0?t:void 0};function Le(e){let t=Fe(e);if(!t)return null;let n=Ie(t.additions),r=Ie(t.deletions),i=Ie(t.files)??Ie(t.diffCount);return n===void 0&&r===void 0&&i===void 0?null:{...n===void 0?{}:{additions:n},...r===void 0?{}:{deletions:r},...i===void 0?{}:{files:i}}}function Re(e){if(!e)return null;let t=[];return e.additions!==void 0&&e.additions>0&&t.push(`+${e.additions}`),e.deletions!==void 0&&e.deletions>0&&t.push(`−${e.deletions}`),t.length>0?t.join(` `):null}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.providerID==`string`?t.providerID.trim():``,r=typeof t.modelID==`string`?t.modelID.trim():``;if(n&&r)return`${n}/${r}`;let i=t.model;if(typeof i==`string`&&i.trim())return i.trim();if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i,t=typeof e.providerID==`string`?e.providerID.trim():typeof e.provider==`string`?e.provider.trim():``,n=typeof e.modelID==`string`?e.modelID.trim():typeof e.id==`string`?e.id.trim():``;if(t&&n)return`${t}/${n}`}return null}function Be(e){if(!e||e.trim().length===0)return null;let t=w.getState(),n=t.activeSessions.find(t=>t.id===e)??t.archivedSessions.find(t=>t.id===e)??null;if(!n)return null;let r=ee(n);return r?{sessionId:e,directory:r,session:n,fromCache:!t.hasLoaded,source:`memory`}:null}function Ve(e){return Be(e)?.directory??null}var He=new Map;async function Ue(e,t){let n=e.trim();if(!n)return null;let r=Be(n);if(r)return r;let i=He.get(n);if(i)return i;let a=(async()=>{let e=Be(n);if(e)return e;let r=await S(n,{signal:t?.signal});if(r?.directory)return{sessionId:r.id,directory:r.directory,session:null,fromCache:!1,source:`session-index`};if(t?.trySessionGet===!1)return null;try{let e=await f.getSession(n),t=typeof e.directory==`string`&&e.directory.trim()||(typeof e.project?.worktree==`string`?e.project.worktree.trim():``)||null;return t?{sessionId:n,directory:t,session:e,fromCache:!1,source:`session-get`}:null}catch{return null}})().finally(()=>{He.get(n)===a&&He.delete(n)});return He.set(n,a),a}export{oe as A,he as C,V as D,U as E,ae as M,ie as N,de as O,G as S,pe as T,X as _,Le as a,Se as b,Ae as c,Me as d,Te as f,be as g,we as h,Re as i,I as j,se as k,je as l,Q as m,Ve as n,ze as o,$ as p,Ue as r,ke as s,Be as t,Ne as u,Ce as v,me as w,q as x,xe as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-BF882_0b.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{t as a}from"./i18n-BU14awhU.js";import{Jn as o}from"./useMobileNavigationStore-C90n-pQY.js";import{n as s}from"./Icon-AqWbQ-aO.js";import{r as c}from"./device-DNG0cNwQ.js";import{_ as l,l as u,n as d,s as ee,t as f,v as p,y as m}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{o as h,r as te,t as g}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";var ne=i(),_=e(n(),1),v=t(),re=({transform:e})=>({...e,y:0}),ie=e=>{let t=(0,ne.c)(18),{id:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a={id:n},t[0]=n,t[1]=a);let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:ee}=h(a),f;t[2]===u?f=t[3]:(f=m.Transform.toString(u),t[2]=u,t[3]=f);let p;t[4]!==f||t[5]!==d?(p={transform:f,transition:d},t[4]=f,t[5]=d,t[6]=p):p=t[6];let te=ee&&`opacity-50`,g;t[7]!==i||t[8]!==te?(g=o(`h-full rounded-md`,i,te),t[7]=i,t[8]=te,t[9]=g):g=t[9];let _;return t[10]!==s||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==p||t[16]!==g?(_=(0,v.jsx)(`div`,{ref:l,"data-sortable-tab-id":n,style:p,className:g,...s,...c,children:r}),t[10]=s,t[11]=r,t[12]=n,t[13]=c,t[14]=l,t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ae=e=>{let t=(0,ne.c)(6),{id:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=o(`h-full`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==n||t[4]!==a?(s=(0,v.jsx)(`div`,{className:a,"data-sortable-tab-id":n,children:r}),t[2]=r,t[3]=n,t[4]=a,t[5]=s):s=t[5],s},y=e=>{let t=(0,ne.c)(124),{items:n,activeId:i,onSelect:m,onClose:h,onReorder:y,layoutMode:he,variant:ge,activePillInsetClassName:_e,activePillButtonClassName:b,inactiveTabsIconOnly:ve,iconOnlyActiveTab:ye,animateActivePill:be,activePillLowercase:xe,className:Se}=e,Ce=he===void 0?`scrollable`:he,we=ge===void 0?`default`:ge,x=ve!==void 0&&ve,S=ye!==void 0&&ye,C=xe===void 0||xe,{t:Te}=a(),w=r(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},t[0]=De):De=t[0];let[D,Oe]=_.useState(De),ke;t[1]===n?ke=t[2]:(ke=n.map(se),t[1]=n,t[2]=ke);let Ae=ke,O=Ce===`scrollable`,je=we==="default",k=we===`compact`,A=we===`active-pill`,Me=we===`animated`,j=A||Me,M=je,N=j||M,P=A&&O,Ne=j,Pe=be??Me,Fe=typeof y==`function`,F=Fe?ie:ae,Ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[3]=Ie):Ie=t[3];let Le=_.useRef(Ie),[I,Re]=_.useState(null),ze;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ze={activationConstraint:{distance:8}},t[4]=ze):ze=t[4];let Be=p(l(ee,ze)),Ve=ce,He;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(He=(e,t)=>{if(t){Le.current.set(e,t);return}Le.current.delete(e)},t[5]=He):He=t[5];let Ue=He,We;t[6]!==i||t[7]!==N?(We=()=>{if(!N||!i){Re(le);return}let e=E.current,t=Le.current.get(i);if(!e||!t){Re(ue);return}let n=0,r=0,a=t;for(;a&&a!==e;)n+=a.offsetLeft,r+=a.offsetTop,a=a.offsetParent;let o={left:n,top:r,width:t.offsetWidth,height:t.offsetHeight};Re(e=>Ve(e,o)?e:o)},t[6]=i,t[7]=N,t[8]=We):We=t[8];let L=We,R;t[9]===O?R=t[10]:(R=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e){Oe({left:!1,right:!1});return}Oe({left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})},t[9]=O,t[10]=R);let z=R,Ge;t[11]!==O||t[12]!==z?(Ge=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e)return;z(),e.addEventListener(`scroll`,z,{passive:!0});let t=new ResizeObserver(z);return t.observe(e),()=>{e.removeEventListener(`scroll`,z),t.disconnect()}},t[11]=O,t[12]=z,t[13]=Ge):Ge=t[13];let B;t[14]!==O||t[15]!==n.length||t[16]!==z?(B=[O,n.length,z],t[14]=O,t[15]=n.length,t[16]=z,t[17]=B):B=t[17],_.useEffect(Ge,B);let V;t[18]!==i||t[19]!==L||t[20]!==N?(V=()=>{if(!N){Re(null);return}L();let e=E.current;if(!e)return;let t=new ResizeObserver(L);if(t.observe(e),i){let e=Le.current.get(i);e&&t.observe(e)}return()=>{t.disconnect()}},t[18]=i,t[19]=L,t[20]=N,t[21]=V):V=t[21];let H;t[22]!==i||t[23]!==n.length||t[24]!==L||t[25]!==N?(H=[i,n.length,L,N],t[22]=i,t[23]=n.length,t[24]=L,t[25]=N,t[26]=H):H=t[26],_.useEffect(V,H);let Ke;t[27]===L?Ke=t[28]:(Ke=()=>{L()},t[27]=L,t[28]=Ke),_.useLayoutEffect(Ke);let qe;t[29]!==i||t[30]!==O||t[31]!==z?(qe=()=>{if(!O||!i)return;let e=E.current;if(!e)return;let t=window.requestAnimationFrame(()=>{let t=typeof window.CSS?.escape==`function`?window.CSS.escape(i):i.replace(/"/g,`\\"`),n=e.querySelector(`[data-sortable-tab-id="${t}"]`);n&&(n.scrollIntoView({block:`nearest`,inline:`nearest`}),z())});return()=>{window.cancelAnimationFrame(t)}},t[29]=i,t[30]=O,t[31]=z,t[32]=qe):qe=t[32];let Je;t[33]!==i||t[34]!==O||t[35]!==n.length||t[36]!==z?(Je=[i,O,n.length,z],t[33]=i,t[34]=O,t[35]=n.length,t[36]=z,t[37]=Je):Je=t[37],_.useEffect(qe,Je);let Ye;t[38]===y?Ye=t[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},t[38]=y,t[39]=Ye);let Xe=Ye,U;t[40]===Se?U=t[41]:(U=o(`relative flex h-full min-w-0 flex-1`,Se),t[40]=Se,t[41]=U);let W;t[42]!==O||t[43]!==D||t[44]!==j?(W=O&&D.left?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 left-0 z-20 bg-gradient-to-r to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[42]=O,t[43]=D,t[44]=j,t[45]=W):W=t[45];let G;t[46]!==O||t[47]!==D||t[48]!==j?(G=O&&D.right?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 right-0 z-20 bg-gradient-to-l to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[46]=O,t[47]=D,t[48]=j,t[49]=G):G=t[49];let Ze=j?`items-center overflow-x-hidden overflow-y-hidden`:`items-stretch`,Qe=j&&`@container/pill-tabs`,$e=j&&`pill-tabs__track`,et=j&&(_e??`gap-0.5 py-0.5`),tt=M&&`items-center overflow-y-hidden`,nt=k&&`items-center gap-1 overflow-y-hidden`,rt=Ne&&`rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] bg-[color-mix(in_srgb,var(--foreground)_2%,transparent)] p-0.5 gap-0.5`,it=O?`overflow-x-auto scrollbar-none`:`overflow-x-hidden`,K;t[50]!==Ze||t[51]!==Qe||t[52]!==$e||t[53]!==et||t[54]!==tt||t[55]!==nt||t[56]!==rt||t[57]!==it?(K=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt,it),t[50]=Ze,t[51]=Qe,t[52]=$e,t[53]=et,t[54]=tt,t[55]=nt,t[56]=rt,t[57]=it,t[58]=K):K=t[58];let q;t[59]===O?q=t[60]:(q=O?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,t[59]=O,t[60]=q);let J;t[61]===Te?J=t[62]:(J=Te(`sortableTabsStrip.aria.tabs`),t[61]=Te,t[62]=J);let Y;t[63]!==I||t[64]!==Pe||t[65]!==j?(Y=j&&I?(0,v.jsx)(`div`,{className:o(`yuri-segmented-selected-pill pointer-events-none absolute left-0 top-0 z-0 rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px]`),style:{transform:`translate3d(${I.left}px, ${I.top}px, 0)`,width:`${I.width}px`,height:`${I.height}px`,transition:Pe?`transform 300ms cubic-bezier(0.65, 0, 0.35, 1), width 300ms cubic-bezier(0.65, 0, 0.35, 1), height 300ms cubic-bezier(0.65, 0, 0.35, 1)`:void 0}}):null,t[63]=I,t[64]=Pe,t[65]=j,t[66]=Y):Y=t[66];let X;t[67]!==I||t[68]!==M?(X=M&&I?(0,v.jsx)(`div`,{className:`pointer-events-none absolute left-0 -bottom-px z-10 h-[3px] rounded-t-[2px] bg-[var(--primary-base)]`,style:{transform:`translate3d(${I.left}px, 0, 0)`,width:`${I.width}px`},"aria-hidden":!0}):null,t[67]=I,t[68]=M,t[69]=X):X=t[69];let Z;if(t[70]!==F||t[71]!==i||t[72]!==b||t[73]!==C||t[74]!==T||t[75]!==S||t[76]!==x||t[77]!==A||t[78]!==k||t[79]!==w||t[80]!==O||t[81]!==n||t[82]!==h||t[83]!==m||t[84]!==P||t[85]!==j){let e;t[87]!==F||t[88]!==i||t[89]!==b||t[90]!==C||t[91]!==T||t[92]!==S||t[93]!==x||t[94]!==A||t[95]!==k||t[96]!==w||t[97]!==O||t[98]!==h||t[99]!==m||t[100]!==P||t[101]!==j?(e=e=>{let t=e.id===i,n=x&&j&&!t&&!!e.icon,r=!n,a=!!e.icon&&(!S||t),c=x&&j&&t&&!O&&!P,l=e.closable!==!1&&!!h,u=l&&!!e.icon&&!k,d=O||P?void 0:j?c?`flex-none basis-auto`:w?`flex-1 basis-0 min-w-0`:`flex-1 basis-0 min-w-fit`:`min-w-0 flex-1 basis-0`,ee=l?t=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),h?.(e.id))}:void 0,f=l?de:void 0;return(0,v.jsx)(F,{id:e.id,className:d,children:(0,v.jsxs)(`div`,{ref:t=>Ue(e.id,t),onAuxClick:ee,onMouseDown:f,className:o(`group flex h-full min-w-0 flex-nowrap items-center`,O||P?`shrink-0`:j?`w-full`:`w-full min-w-0`,k?o(`relative rounded-md transition-colors`,t?`bg-interactive-selection text-interactive-selection-foreground`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`):j?`relative z-10 bg-transparent`:t?`relative z-10 bg-transparent text-foreground`:`relative z-10 bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,v.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-label":n?e.title??e.label:void 0,onClick:()=>m(e.id),className:o(k?`flex h-full max-w-56 min-w-0 flex-nowrap items-center rounded-md px-2 text-left text-xs font-normal !min-h-0 !min-w-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`:j?`animated-tabs__button pill-tabs__button relative z-10 flex flex-1 min-w-0 flex-nowrap items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0`:`flex h-full min-w-0 flex-nowrap items-center typography-micro`,j&&C?`lowercase`:null,j&&(n?`gap-0`:`gap-1.5`),j?P?`shrink-0 whitespace-nowrap px-3 text-center`:O?`max-w-56 shrink-0 px-3 text-center`:n?`px-2 !min-w-0 text-center`:c?`shrink-0 whitespace-nowrap px-3 text-center`:`px-3 text-center`:k?null:O?`max-w-56 justify-start truncate px-3 text-left`:`w-full justify-center truncate px-3 text-center`,j?b??(A?w?`h-[38px]`:`h-[31px]`:`h-7`):null,j?t?`text-foreground`:`text-muted-foreground hover:text-foreground`:null,j?`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`:null),title:e.title??e.label,children:j?(0,v.jsxs)(v.Fragment,{children:[a?(0,v.jsxs)(`span`,{className:`relative flex h-4 w-4 shrink-0 items-center justify-center`,children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:fe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,r?(0,v.jsx)(`span`,{className:`animated-tabs__label truncate`,children:e.label}):null]}):(0,v.jsxs)(`span`,{className:o(`flex min-w-0 flex-nowrap items-center gap-1.5`,!O&&`justify-center`),children:[a?(0,v.jsxs)(`span`,{className:o(`relative flex h-4 w-4 shrink-0 items-center justify-center transition-colors duration-200 ease-out`,!k&&(t?`text-[var(--primary-base)]`:`text-muted-foreground`)),children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:pe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,(0,v.jsx)(`span`,{className:`truncate leading-[1.2]`,children:e.label})]})}),l&&!u?(0,v.jsx)(`button`,{type:`button`,onPointerDown:me,onClick:t=>{t.stopPropagation(),h?.(e.id)},className:o(`relative z-20 inline-flex !min-h-0 !min-w-0 items-center justify-center transition-opacity`,k?`mr-1 size-4 shrink-0 self-center rounded-sm text-muted-foreground hover:bg-interactive-hover hover:text-foreground`:j?`-ml-2.5 mr-1 h-[88%] w-5 self-center !aspect-auto rounded-md`:`aspect-square h-[65%] min-h-4 max-h-5 rounded-sm mr-1`,!k&&(j?t?`text-muted-foreground hover:bg-transparent hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-transparent hover:text-foreground group-hover:opacity-100`:t?`text-muted-foreground hover:bg-interactive-hover/60 hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-interactive-hover/80 hover:text-foreground group-hover:opacity-100`)),"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3 w-3`})}):null]})},e.id)},t[87]=F,t[88]=i,t[89]=b,t[90]=C,t[91]=T,t[92]=S,t[93]=x,t[94]=A,t[95]=k,t[96]=w,t[97]=O,t[98]=h,t[99]=m,t[100]=P,t[101]=j,t[102]=e):e=t[102],Z=n.map(e),t[70]=F,t[71]=i,t[72]=b,t[73]=C,t[74]=T,t[75]=S,t[76]=x,t[77]=A,t[78]=k,t[79]=w,t[80]=O,t[81]=n,t[82]=h,t[83]=m,t[84]=P,t[85]=j,t[86]=Z}else Z=t[86];let Q;t[103]!==K||t[104]!==q||t[105]!==J||t[106]!==Y||t[107]!==X||t[108]!==Z?(Q=(0,v.jsxs)(`div`,{ref:E,className:K,style:q,role:`tablist`,"aria-label":J,children:[Y,X,Z]}),t[103]=K,t[104]=q,t[105]=J,t[106]=Y,t[107]=X,t[108]=Z,t[109]=Q):Q=t[109];let at;t[110]!==U||t[111]!==W||t[112]!==G||t[113]!==Q?(at=(0,v.jsxs)(`div`,{className:U,children:[W,G,Q]}),t[110]=U,t[111]=W,t[112]=G,t[113]=Q,t[114]=at):at=t[114];let ot=at;if(!Fe)return ot;let st;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(st=[re],t[115]=st):st=t[115];let $;t[116]!==Ae||t[117]!==ot?($=(0,v.jsx)(g,{items:Ae,strategy:te,children:ot}),t[116]=Ae,t[117]=ot,t[118]=$):$=t[118];let ct;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,v.jsx)(d,{dropAnimation:null}),t[119]=ct):ct=t[119];let lt;return t[120]!==Xe||t[121]!==Be||t[122]!==$?(lt=(0,v.jsxs)(f,{sensors:Be,collisionDetection:u,onDragEnd:Xe,modifiers:st,children:[$,ct]}),t[120]=Xe,t[121]=Be,t[122]=$,t[123]=lt):lt=t[123],lt};function oe(e){return e.isMobile}function se(e){return e.id}function ce(e,t){return!e||!t?e===t:Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function le(e){return e===null?e:null}function ue(e){return e===null?e:null}function de(e){e.button===1&&e.preventDefault()}function fe(e){e.stopPropagation()}function pe(e){e.stopPropagation()}function me(e){e.stopPropagation()}export{y as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-BF882_0b.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{t as a}from"./i18n-BU14awhU.js";import{Jn as o}from"./useMobileNavigationStore-Dr61mYqA.js";import{n as s}from"./Icon-Co7WGN1G.js";import{r as c}from"./device-DNG0cNwQ.js";import{_ as l,l as u,n as d,s as ee,t as f,v as p,y as m}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{o as h,r as te,t as g}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";var ne=i(),_=e(n(),1),v=t(),re=({transform:e})=>({...e,y:0}),ie=e=>{let t=(0,ne.c)(18),{id:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a={id:n},t[0]=n,t[1]=a);let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:ee}=h(a),f;t[2]===u?f=t[3]:(f=m.Transform.toString(u),t[2]=u,t[3]=f);let p;t[4]!==f||t[5]!==d?(p={transform:f,transition:d},t[4]=f,t[5]=d,t[6]=p):p=t[6];let te=ee&&`opacity-50`,g;t[7]!==i||t[8]!==te?(g=o(`h-full rounded-md`,i,te),t[7]=i,t[8]=te,t[9]=g):g=t[9];let _;return t[10]!==s||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==p||t[16]!==g?(_=(0,v.jsx)(`div`,{ref:l,"data-sortable-tab-id":n,style:p,className:g,...s,...c,children:r}),t[10]=s,t[11]=r,t[12]=n,t[13]=c,t[14]=l,t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ae=e=>{let t=(0,ne.c)(6),{id:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=o(`h-full`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==n||t[4]!==a?(s=(0,v.jsx)(`div`,{className:a,"data-sortable-tab-id":n,children:r}),t[2]=r,t[3]=n,t[4]=a,t[5]=s):s=t[5],s},y=e=>{let t=(0,ne.c)(124),{items:n,activeId:i,onSelect:m,onClose:h,onReorder:y,layoutMode:he,variant:ge,activePillInsetClassName:_e,activePillButtonClassName:b,inactiveTabsIconOnly:ve,iconOnlyActiveTab:ye,animateActivePill:be,activePillLowercase:xe,className:Se}=e,Ce=he===void 0?`scrollable`:he,we=ge===void 0?`default`:ge,x=ve!==void 0&&ve,S=ye!==void 0&&ye,C=xe===void 0||xe,{t:Te}=a(),w=r(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},t[0]=De):De=t[0];let[D,Oe]=_.useState(De),ke;t[1]===n?ke=t[2]:(ke=n.map(se),t[1]=n,t[2]=ke);let Ae=ke,O=Ce===`scrollable`,je=we==="default",k=we===`compact`,A=we===`active-pill`,Me=we===`animated`,j=A||Me,M=je,N=j||M,P=A&&O,Ne=j,Pe=be??Me,Fe=typeof y==`function`,F=Fe?ie:ae,Ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[3]=Ie):Ie=t[3];let Le=_.useRef(Ie),[I,Re]=_.useState(null),ze;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ze={activationConstraint:{distance:8}},t[4]=ze):ze=t[4];let Be=p(l(ee,ze)),Ve=ce,He;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(He=(e,t)=>{if(t){Le.current.set(e,t);return}Le.current.delete(e)},t[5]=He):He=t[5];let Ue=He,We;t[6]!==i||t[7]!==N?(We=()=>{if(!N||!i){Re(le);return}let e=E.current,t=Le.current.get(i);if(!e||!t){Re(ue);return}let n=0,r=0,a=t;for(;a&&a!==e;)n+=a.offsetLeft,r+=a.offsetTop,a=a.offsetParent;let o={left:n,top:r,width:t.offsetWidth,height:t.offsetHeight};Re(e=>Ve(e,o)?e:o)},t[6]=i,t[7]=N,t[8]=We):We=t[8];let L=We,R;t[9]===O?R=t[10]:(R=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e){Oe({left:!1,right:!1});return}Oe({left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})},t[9]=O,t[10]=R);let z=R,Ge;t[11]!==O||t[12]!==z?(Ge=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e)return;z(),e.addEventListener(`scroll`,z,{passive:!0});let t=new ResizeObserver(z);return t.observe(e),()=>{e.removeEventListener(`scroll`,z),t.disconnect()}},t[11]=O,t[12]=z,t[13]=Ge):Ge=t[13];let B;t[14]!==O||t[15]!==n.length||t[16]!==z?(B=[O,n.length,z],t[14]=O,t[15]=n.length,t[16]=z,t[17]=B):B=t[17],_.useEffect(Ge,B);let V;t[18]!==i||t[19]!==L||t[20]!==N?(V=()=>{if(!N){Re(null);return}L();let e=E.current;if(!e)return;let t=new ResizeObserver(L);if(t.observe(e),i){let e=Le.current.get(i);e&&t.observe(e)}return()=>{t.disconnect()}},t[18]=i,t[19]=L,t[20]=N,t[21]=V):V=t[21];let H;t[22]!==i||t[23]!==n.length||t[24]!==L||t[25]!==N?(H=[i,n.length,L,N],t[22]=i,t[23]=n.length,t[24]=L,t[25]=N,t[26]=H):H=t[26],_.useEffect(V,H);let Ke;t[27]===L?Ke=t[28]:(Ke=()=>{L()},t[27]=L,t[28]=Ke),_.useLayoutEffect(Ke);let qe;t[29]!==i||t[30]!==O||t[31]!==z?(qe=()=>{if(!O||!i)return;let e=E.current;if(!e)return;let t=window.requestAnimationFrame(()=>{let t=typeof window.CSS?.escape==`function`?window.CSS.escape(i):i.replace(/"/g,`\\"`),n=e.querySelector(`[data-sortable-tab-id="${t}"]`);n&&(n.scrollIntoView({block:`nearest`,inline:`nearest`}),z())});return()=>{window.cancelAnimationFrame(t)}},t[29]=i,t[30]=O,t[31]=z,t[32]=qe):qe=t[32];let Je;t[33]!==i||t[34]!==O||t[35]!==n.length||t[36]!==z?(Je=[i,O,n.length,z],t[33]=i,t[34]=O,t[35]=n.length,t[36]=z,t[37]=Je):Je=t[37],_.useEffect(qe,Je);let Ye;t[38]===y?Ye=t[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},t[38]=y,t[39]=Ye);let Xe=Ye,U;t[40]===Se?U=t[41]:(U=o(`relative flex h-full min-w-0 flex-1`,Se),t[40]=Se,t[41]=U);let W;t[42]!==O||t[43]!==D||t[44]!==j?(W=O&&D.left?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 left-0 z-20 bg-gradient-to-r to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[42]=O,t[43]=D,t[44]=j,t[45]=W):W=t[45];let G;t[46]!==O||t[47]!==D||t[48]!==j?(G=O&&D.right?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 right-0 z-20 bg-gradient-to-l to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[46]=O,t[47]=D,t[48]=j,t[49]=G):G=t[49];let Ze=j?`items-center overflow-x-hidden overflow-y-hidden`:`items-stretch`,Qe=j&&`@container/pill-tabs`,$e=j&&`pill-tabs__track`,et=j&&(_e??`gap-0.5 py-0.5`),tt=M&&`items-center overflow-y-hidden`,nt=k&&`items-center gap-1 overflow-y-hidden`,rt=Ne&&`rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] bg-[color-mix(in_srgb,var(--foreground)_2%,transparent)] p-0.5 gap-0.5`,it=O?`overflow-x-auto scrollbar-none`:`overflow-x-hidden`,K;t[50]!==Ze||t[51]!==Qe||t[52]!==$e||t[53]!==et||t[54]!==tt||t[55]!==nt||t[56]!==rt||t[57]!==it?(K=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt,it),t[50]=Ze,t[51]=Qe,t[52]=$e,t[53]=et,t[54]=tt,t[55]=nt,t[56]=rt,t[57]=it,t[58]=K):K=t[58];let q;t[59]===O?q=t[60]:(q=O?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,t[59]=O,t[60]=q);let J;t[61]===Te?J=t[62]:(J=Te(`sortableTabsStrip.aria.tabs`),t[61]=Te,t[62]=J);let Y;t[63]!==I||t[64]!==Pe||t[65]!==j?(Y=j&&I?(0,v.jsx)(`div`,{className:o(`yuri-segmented-selected-pill pointer-events-none absolute left-0 top-0 z-0 rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px]`),style:{transform:`translate3d(${I.left}px, ${I.top}px, 0)`,width:`${I.width}px`,height:`${I.height}px`,transition:Pe?`transform 300ms cubic-bezier(0.65, 0, 0.35, 1), width 300ms cubic-bezier(0.65, 0, 0.35, 1), height 300ms cubic-bezier(0.65, 0, 0.35, 1)`:void 0}}):null,t[63]=I,t[64]=Pe,t[65]=j,t[66]=Y):Y=t[66];let X;t[67]!==I||t[68]!==M?(X=M&&I?(0,v.jsx)(`div`,{className:`pointer-events-none absolute left-0 -bottom-px z-10 h-[3px] rounded-t-[2px] bg-[var(--primary-base)]`,style:{transform:`translate3d(${I.left}px, 0, 0)`,width:`${I.width}px`},"aria-hidden":!0}):null,t[67]=I,t[68]=M,t[69]=X):X=t[69];let Z;if(t[70]!==F||t[71]!==i||t[72]!==b||t[73]!==C||t[74]!==T||t[75]!==S||t[76]!==x||t[77]!==A||t[78]!==k||t[79]!==w||t[80]!==O||t[81]!==n||t[82]!==h||t[83]!==m||t[84]!==P||t[85]!==j){let e;t[87]!==F||t[88]!==i||t[89]!==b||t[90]!==C||t[91]!==T||t[92]!==S||t[93]!==x||t[94]!==A||t[95]!==k||t[96]!==w||t[97]!==O||t[98]!==h||t[99]!==m||t[100]!==P||t[101]!==j?(e=e=>{let t=e.id===i,n=x&&j&&!t&&!!e.icon,r=!n,a=!!e.icon&&(!S||t),c=x&&j&&t&&!O&&!P,l=e.closable!==!1&&!!h,u=l&&!!e.icon&&!k,d=O||P?void 0:j?c?`flex-none basis-auto`:w?`flex-1 basis-0 min-w-0`:`flex-1 basis-0 min-w-fit`:`min-w-0 flex-1 basis-0`,ee=l?t=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),h?.(e.id))}:void 0,f=l?de:void 0;return(0,v.jsx)(F,{id:e.id,className:d,children:(0,v.jsxs)(`div`,{ref:t=>Ue(e.id,t),onAuxClick:ee,onMouseDown:f,className:o(`group flex h-full min-w-0 flex-nowrap items-center`,O||P?`shrink-0`:j?`w-full`:`w-full min-w-0`,k?o(`relative rounded-md transition-colors`,t?`bg-interactive-selection text-interactive-selection-foreground`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`):j?`relative z-10 bg-transparent`:t?`relative z-10 bg-transparent text-foreground`:`relative z-10 bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,v.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-label":n?e.title??e.label:void 0,onClick:()=>m(e.id),className:o(k?`flex h-full max-w-56 min-w-0 flex-nowrap items-center rounded-md px-2 text-left text-xs font-normal !min-h-0 !min-w-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`:j?`animated-tabs__button pill-tabs__button relative z-10 flex flex-1 min-w-0 flex-nowrap items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0`:`flex h-full min-w-0 flex-nowrap items-center typography-micro`,j&&C?`lowercase`:null,j&&(n?`gap-0`:`gap-1.5`),j?P?`shrink-0 whitespace-nowrap px-3 text-center`:O?`max-w-56 shrink-0 px-3 text-center`:n?`px-2 !min-w-0 text-center`:c?`shrink-0 whitespace-nowrap px-3 text-center`:`px-3 text-center`:k?null:O?`max-w-56 justify-start truncate px-3 text-left`:`w-full justify-center truncate px-3 text-center`,j?b??(A?w?`h-[38px]`:`h-[31px]`:`h-7`):null,j?t?`text-foreground`:`text-muted-foreground hover:text-foreground`:null,j?`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`:null),title:e.title??e.label,children:j?(0,v.jsxs)(v.Fragment,{children:[a?(0,v.jsxs)(`span`,{className:`relative flex h-4 w-4 shrink-0 items-center justify-center`,children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:fe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,r?(0,v.jsx)(`span`,{className:`animated-tabs__label truncate`,children:e.label}):null]}):(0,v.jsxs)(`span`,{className:o(`flex min-w-0 flex-nowrap items-center gap-1.5`,!O&&`justify-center`),children:[a?(0,v.jsxs)(`span`,{className:o(`relative flex h-4 w-4 shrink-0 items-center justify-center transition-colors duration-200 ease-out`,!k&&(t?`text-[var(--primary-base)]`:`text-muted-foreground`)),children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:pe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,(0,v.jsx)(`span`,{className:`truncate leading-[1.2]`,children:e.label})]})}),l&&!u?(0,v.jsx)(`button`,{type:`button`,onPointerDown:me,onClick:t=>{t.stopPropagation(),h?.(e.id)},className:o(`relative z-20 inline-flex !min-h-0 !min-w-0 items-center justify-center transition-opacity`,k?`mr-1 size-4 shrink-0 self-center rounded-sm text-muted-foreground hover:bg-interactive-hover hover:text-foreground`:j?`-ml-2.5 mr-1 h-[88%] w-5 self-center !aspect-auto rounded-md`:`aspect-square h-[65%] min-h-4 max-h-5 rounded-sm mr-1`,!k&&(j?t?`text-muted-foreground hover:bg-transparent hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-transparent hover:text-foreground group-hover:opacity-100`:t?`text-muted-foreground hover:bg-interactive-hover/60 hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-interactive-hover/80 hover:text-foreground group-hover:opacity-100`)),"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3 w-3`})}):null]})},e.id)},t[87]=F,t[88]=i,t[89]=b,t[90]=C,t[91]=T,t[92]=S,t[93]=x,t[94]=A,t[95]=k,t[96]=w,t[97]=O,t[98]=h,t[99]=m,t[100]=P,t[101]=j,t[102]=e):e=t[102],Z=n.map(e),t[70]=F,t[71]=i,t[72]=b,t[73]=C,t[74]=T,t[75]=S,t[76]=x,t[77]=A,t[78]=k,t[79]=w,t[80]=O,t[81]=n,t[82]=h,t[83]=m,t[84]=P,t[85]=j,t[86]=Z}else Z=t[86];let Q;t[103]!==K||t[104]!==q||t[105]!==J||t[106]!==Y||t[107]!==X||t[108]!==Z?(Q=(0,v.jsxs)(`div`,{ref:E,className:K,style:q,role:`tablist`,"aria-label":J,children:[Y,X,Z]}),t[103]=K,t[104]=q,t[105]=J,t[106]=Y,t[107]=X,t[108]=Z,t[109]=Q):Q=t[109];let at;t[110]!==U||t[111]!==W||t[112]!==G||t[113]!==Q?(at=(0,v.jsxs)(`div`,{className:U,children:[W,G,Q]}),t[110]=U,t[111]=W,t[112]=G,t[113]=Q,t[114]=at):at=t[114];let ot=at;if(!Fe)return ot;let st;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(st=[re],t[115]=st):st=t[115];let $;t[116]!==Ae||t[117]!==ot?($=(0,v.jsx)(g,{items:Ae,strategy:te,children:ot}),t[116]=Ae,t[117]=ot,t[118]=$):$=t[118];let ct;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,v.jsx)(d,{dropAnimation:null}),t[119]=ct):ct=t[119];let lt;return t[120]!==Xe||t[121]!==Be||t[122]!==$?(lt=(0,v.jsxs)(f,{sensors:Be,collisionDetection:u,onDragEnd:Xe,modifiers:st,children:[$,ct]}),t[120]=Xe,t[121]=Be,t[122]=$,t[123]=lt):lt=t[123],lt};function oe(e){return e.isMobile}function se(e){return e.id}function ce(e,t){return!e||!t?e===t:Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function le(e){return e===null?e:null}function ue(e){return e===null?e:null}function de(e){e.button===1&&e.preventDefault()}function fe(e){e.stopPropagation()}function pe(e){e.stopPropagation()}function me(e){e.stopPropagation()}export{y as t};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,n as r}from"./runtime-switch-BMjl5Y5W.js";import{n as i}from"./runtime-fetch-DKZOpfzo.js";import{st as a}from"./vendor-base-ui-CzHs0bHY.js";import{Rt as o}from"./gitApiHttp-B1mApXwC.js";import{n as s}from"./vendor-react-DlzBev0S.js";import{s as c}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{g as l}from"./fileQueries-D9l0crnM.js";import{r as u}from"./vendor-reactuses-core-CuTmqEMK.js";import{Ma as d}from"./useMobileNavigationStore-C90n-pQY.js";import{a as f,c as p,d as m,i as h,l as g,o as _,r as v,s as y,u as b}from"./useDictation-CyWtsxSn.js";var x=e(a(),1),S=e=>e.replace(/[^\p{L}\p{N}]/gu,``).toLowerCase();function C(e){let t=[],n=``;for(let r=0;r<e.length;){let i=String.fromCodePoint(e.codePointAt(r)),a=S(i);for(let e=0;e<a.length;e++)t.push(r);n+=a,r+=i.length}let r=[],i=0,a=[];return{append(o){if(!o||typeof o!=`object`)throw Error(`Invalid speech subtitle`);let{text:s,words:c}=o;if(typeof s!=`string`||s.length>1e4||!Array.isArray(c)||c.length>1e4)throw Error(`Invalid speech subtitle`);if(!c.length||!s.trim())return;let l=1/0,u=0,d=-1;for(let e of c){if(!e||typeof e!=`object`||typeof e.word!=`string`||!Number.isFinite(e.startTime)||!Number.isFinite(e.endTime)||e.startTime<0||e.endTime<e.startTime||e.endTime>7200||e.startTime<d)throw Error(`Invalid speech subtitle timestamp`);l=Math.min(l,e.startTime),u=Math.max(u,e.endTime),d=e.startTime}if(r.some(e=>e.startTime===l&&e.text===s))return;if(i+=s.length,r.length>=1e3||i>2e4)throw Error(`Speech subtitle limit exceeded`);r.push({text:s,startTime:l,endTime:u}),r.sort((e,t)=>e.startTime-t.startTime);let f=0;a=[];for(let i of r){let r=S(i.text),o=r?n.indexOf(r,f):-1;if(o<0)continue;let s=t[o],c=t[o+r.length-1],l=c+(e.codePointAt(c)>65535?2:1);l+=e.slice(l).match(/^[^\p{L}\p{N}]*/u)[0].length,a.push({...i,start:s,end:l}),f=o+r.length}},at(e){let t=0,n=a.length;for(;t<n;){let r=t+n>>>1;a[r].startTime<=e?t=r+1:n=r}let r=a[t-1];return r&&e<=r.endTime?r:void 0},lastBefore(e){for(let t=a.length-1;t>=0;t--)if(a[t].endTime<=e)return a[t]}}}function w(e){return{chunks:[],samples:0,complete:!1,position:0,timeline:C(e)}}async function T(e,t,n){if(e&&!e.body)throw Error(`Speech response has no stream`);let r=n.cache??w(``),i=e?.body?.getReader(),a=t.createGain();a.gain.value=n.volume,a.connect(t.destination);let o=new Set,s=new Set,c=new Set,l=()=>{for(let e of c)e();c.clear()},u=()=>new Promise(e=>{c.add(e)}),d=new TextDecoder,f=[],p=t.currentTime,m=!1,h=!1,g=!i,_=!i,v,y=-1,b=2**(n.pitch-1),x=i?0:r.position,S=()=>{let e=t.getOutputTimestamp?.().contextTime,i=e!==void 0&&Number.isFinite(e)&&e>=0?e:Math.max(0,t.currentTime-(t.outputLatency||0));for(;f.length&&i>=f[0].at;){h=!0;let e=f[0];if(r.position=e.offset+Math.min(e.duration,(i-e.at)*b),i<e.end)break;f.shift()}let a=r.timeline.at(r.position);a&&a.start>y&&h&&(y=a.start,n.onProgress?.(a))},C=()=>{for(let e of o)e.stop();l()},T=()=>{S(),i?.cancel().catch(()=>void 0),C()};n.signal.addEventListener(`abort`,T,{once:!0});let E=setInterval(S,50),D=()=>{if(n.signal.throwIfAborted(),v)throw v},O=(async()=>{if(!i)return;let e=``,t,a=0,o=e=>{if(!e.trim())return;if(_)throw Error(`Unexpected audio after speech completion`);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`);let n=JSON.parse(e);if(n.type===`error`)throw Error(`Speech synthesis interrupted or failed`);if(n.type===`done`){_=!0,l();return}if(n.type===`subtitle`){r.timeline.append(n),S();return}if(n.type!==`audio`||typeof n.data!=`string`||n.data.length>12800)throw Error(`Invalid speech audio frame`);let i=atob(n.data),a=new Uint8Array(i.length+(t===void 0?0:1)),o=0;t!==void 0&&(a[o++]=t);for(let e=0;e<i.length;e++)a[o+e]=i.charCodeAt(e);if(t=a.length%2?a[a.length-1]:void 0,a.length>1){if(r.samples*2+a.length>25165824||r.chunks.length>=8192)throw Error(`Speech cache exceeds the size limit`);let e=t===void 0?a:a.slice(0,-1);r.chunks.push(e),r.samples+=e.length/2,l()}};try{for(;;){let t=await i.read();if(n.signal.throwIfAborted(),t.done)break;if(a+=t.value.length,a>33554432)throw Error(`Speech stream exceeds the size limit`);e+=d.decode(t.value,{stream:!0});let r;for(;(r=e.indexOf(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,n as r}from"./runtime-switch-BMjl5Y5W.js";import{n as i}from"./runtime-fetch-DKZOpfzo.js";import{st as a}from"./vendor-base-ui-CzHs0bHY.js";import{Rt as o}from"./gitApiHttp-B1mApXwC.js";import{n as s}from"./vendor-react-DlzBev0S.js";import{s as c}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{g as l}from"./fileQueries-D9l0crnM.js";import{r as u}from"./vendor-reactuses-core-CuTmqEMK.js";import{Ma as d}from"./useMobileNavigationStore-Dr61mYqA.js";import{a as f,c as p,d as m,i as h,l as g,o as _,r as v,s as y,u as b}from"./useDictation-CyWtsxSn.js";var x=e(a(),1),S=e=>e.replace(/[^\p{L}\p{N}]/gu,``).toLowerCase();function C(e){let t=[],n=``;for(let r=0;r<e.length;){let i=String.fromCodePoint(e.codePointAt(r)),a=S(i);for(let e=0;e<a.length;e++)t.push(r);n+=a,r+=i.length}let r=[],i=0,a=[];return{append(o){if(!o||typeof o!=`object`)throw Error(`Invalid speech subtitle`);let{text:s,words:c}=o;if(typeof s!=`string`||s.length>1e4||!Array.isArray(c)||c.length>1e4)throw Error(`Invalid speech subtitle`);if(!c.length||!s.trim())return;let l=1/0,u=0,d=-1;for(let e of c){if(!e||typeof e!=`object`||typeof e.word!=`string`||!Number.isFinite(e.startTime)||!Number.isFinite(e.endTime)||e.startTime<0||e.endTime<e.startTime||e.endTime>7200||e.startTime<d)throw Error(`Invalid speech subtitle timestamp`);l=Math.min(l,e.startTime),u=Math.max(u,e.endTime),d=e.startTime}if(r.some(e=>e.startTime===l&&e.text===s))return;if(i+=s.length,r.length>=1e3||i>2e4)throw Error(`Speech subtitle limit exceeded`);r.push({text:s,startTime:l,endTime:u}),r.sort((e,t)=>e.startTime-t.startTime);let f=0;a=[];for(let i of r){let r=S(i.text),o=r?n.indexOf(r,f):-1;if(o<0)continue;let s=t[o],c=t[o+r.length-1],l=c+(e.codePointAt(c)>65535?2:1);l+=e.slice(l).match(/^[^\p{L}\p{N}]*/u)[0].length,a.push({...i,start:s,end:l}),f=o+r.length}},at(e){let t=0,n=a.length;for(;t<n;){let r=t+n>>>1;a[r].startTime<=e?t=r+1:n=r}let r=a[t-1];return r&&e<=r.endTime?r:void 0},lastBefore(e){for(let t=a.length-1;t>=0;t--)if(a[t].endTime<=e)return a[t]}}}function w(e){return{chunks:[],samples:0,complete:!1,position:0,timeline:C(e)}}async function T(e,t,n){if(e&&!e.body)throw Error(`Speech response has no stream`);let r=n.cache??w(``),i=e?.body?.getReader(),a=t.createGain();a.gain.value=n.volume,a.connect(t.destination);let o=new Set,s=new Set,c=new Set,l=()=>{for(let e of c)e();c.clear()},u=()=>new Promise(e=>{c.add(e)}),d=new TextDecoder,f=[],p=t.currentTime,m=!1,h=!1,g=!i,_=!i,v,y=-1,b=2**(n.pitch-1),x=i?0:r.position,S=()=>{let e=t.getOutputTimestamp?.().contextTime,i=e!==void 0&&Number.isFinite(e)&&e>=0?e:Math.max(0,t.currentTime-(t.outputLatency||0));for(;f.length&&i>=f[0].at;){h=!0;let e=f[0];if(r.position=e.offset+Math.min(e.duration,(i-e.at)*b),i<e.end)break;f.shift()}let a=r.timeline.at(r.position);a&&a.start>y&&h&&(y=a.start,n.onProgress?.(a))},C=()=>{for(let e of o)e.stop();l()},T=()=>{S(),i?.cancel().catch(()=>void 0),C()};n.signal.addEventListener(`abort`,T,{once:!0});let E=setInterval(S,50),D=()=>{if(n.signal.throwIfAborted(),v)throw v},O=(async()=>{if(!i)return;let e=``,t,a=0,o=e=>{if(!e.trim())return;if(_)throw Error(`Unexpected audio after speech completion`);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`);let n=JSON.parse(e);if(n.type===`error`)throw Error(`Speech synthesis interrupted or failed`);if(n.type===`done`){_=!0,l();return}if(n.type===`subtitle`){r.timeline.append(n),S();return}if(n.type!==`audio`||typeof n.data!=`string`||n.data.length>12800)throw Error(`Invalid speech audio frame`);let i=atob(n.data),a=new Uint8Array(i.length+(t===void 0?0:1)),o=0;t!==void 0&&(a[o++]=t);for(let e=0;e<i.length;e++)a[o+e]=i.charCodeAt(e);if(t=a.length%2?a[a.length-1]:void 0,a.length>1){if(r.samples*2+a.length>25165824||r.chunks.length>=8192)throw Error(`Speech cache exceeds the size limit`);let e=t===void 0?a:a.slice(0,-1);r.chunks.push(e),r.samples+=e.length/2,l()}};try{for(;;){let t=await i.read();if(n.signal.throwIfAborted(),t.done)break;if(a+=t.value.length,a>33554432)throw Error(`Speech stream exceeds the size limit`);e+=d.decode(t.value,{stream:!0});let r;for(;(r=e.indexOf(`
2
2
  `))!==-1;)o(e.slice(0,r)),e=e.slice(r+1);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`)}if(e+=d.decode(),e.trim()&&o(e),!_||!r.samples||t!==void 0)throw Error(`Incomplete speech audio stream`);r.complete=!0}finally{g=!0,l()}})().catch(e=>{v=e,C()}),k=async(e,r)=>{for(;p-t.currentTime>2&&s.size;)await Promise.race([Promise.race(s),u()]),D();D();let i=Math.min(e.length/2,Math.max(0,Math.round(((n.endAt??1/0)-r)*24e3))),c=Math.max(0,Math.round((x-r)*24e3));if(c>=i)return;let d=t.createBuffer(1,i-c,24e3),h=d.getChannelData(0),g=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=c;e<i;e++)h[e-c]=g.getInt16(e*2,!0)/32768;let _=t.createBufferSource();_.buffer=d,_.detune.value=(n.pitch-1)*1200,_.connect(a);let v,y=new Promise(e=>{v=e});s.add(y),o.add(_),_.onended=()=>{S(),o.delete(_),s.delete(y),_.disconnect(),v(),l()};let C=Math.max(p,t.currentTime+.02);p=C+d.duration/b,f.push({at:C,end:p,offset:r+c/24e3,duration:d.duration}),_.start(C),m||(m=!0,n.onStart())};try{D();let e=0,i=0,a=!0;for(;D(),!(i>=(n.endAt??1/0));){if(e>=r.chunks.length){if(g)break;await u();continue}p<t.currentTime+.02&&(a=!0);let n=(r.samples/24e3-Math.max(i,x))/b;if(a&&!_&&n<.4){await u();continue}a=!1;let o=r.chunks[e++];await k(o,i),i+=o.length/48e3}if(await O,D(),!m&&x<Math.min(r.samples/24e3,n.endAt??1/0))throw Error(`Incomplete speech audio stream`);await Promise.all(s),D(),r.position=Math.min(r.samples/24e3,n.endAt??1/0)}finally{S(),clearInterval(E),n.signal.removeEventListener(`abort`,T),await i?.cancel().catch(()=>void 0),await O,i?.releaseLock();for(let e of o)e.onended=null,e.stop(),e.disconnect();a.disconnect()}}async function*E(e,t,n){let r=await y(m(e,`tts`),n),i=crypto.randomUUID(),a=new TextEncoder,o={speaker:e.voice,audio_params:{format:`pcm`,sample_rate:24e3,speech_rate:Math.round((e.speed-1)*100),...[`seed-tts-2.0`,`seed-icl-2.0`].includes(e.resourceId)?{enable_subtitle:!0}:{}},...e.resourceId===`seed-tts-2.0`&&e.voice===`zh_female_vv_uranus_bigtts`?{additions:JSON.stringify({context_texts:[`请用自然、温暖的对话语气朗读,根据文本内容表达恰当的情感,保持清晰自然的停顿与重音,避免夸张的播音腔。`]})}:{}},s=(e,n=!1)=>({user:{uid:`yuri`},namespace:`BidirectionalTTS`,event:e,req_params:{...o,...n?{text:t}:{}}}),c=`connection`,l=0;try{for(r.send(g(1));;){let e=await _(await r.read(),`tts`);if(n.throwIfAborted(),e.event===51||e.event===153||e.event===151)throw Error(`Speech synthesis failed`);if(e.event>=100&&e.sessionId!==i)throw Error(`Unexpected speech session`);if(e.event===50&&c===`connection`)c=`session`,r.send(g(100,i,s(100)));else if(e.event===150&&c===`session`)c=`audio`,r.send(g(200,i,s(200,!0))),r.send(g(102,i));else if(e.event===352&&c===`audio`&&e.type===11){if(l+=e.payload.length,l>33554432)throw Error(`Speech audio exceeds size limit`);for(let t=0;t<e.payload.length;t+=9600){let n=e.payload.subarray(t,t+9600),r=``;for(let e of n)r+=String.fromCharCode(e);yield a.encode(`${JSON.stringify({type:`audio`,data:btoa(r)})}\n`)}}else if(e.event===364&&c===`audio`){let t=p(e.payload);yield a.encode(`${JSON.stringify({type:`subtitle`,text:t.text,words:t.words})}\n`)}else if(e.event===152&&c===`audio`){let t=p(e.payload);if(t.status_code!==void 0&&t.status_code!==0&&t.status_code!==2e7)throw Error(`Speech synthesis failed`);if(!l)throw Error(`Speech returned no audio`);try{r.send(g(2))}catch{}yield a.encode(`{"type":"done"}
3
3
  `);return}else if(e.event!==350&&e.event!==351)throw Error(`Unexpected speech synthesis event`)}}finally{r.close()}}async function D(e,t){if(!e.trim())throw Error(`Speech text is required`);let n=await b(`tts`,t);if(!n)return i(`/api/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/x-ndjson, audio/*`},body:JSON.stringify({text:e.trim()}),signal:t});if(e.length>1e4)throw Error(`Speech text must contain 1–10000 characters`);let r=new AbortController,a=E(n,e.trim(),AbortSignal.any([t,r.signal])),o=new ReadableStream({async pull(e){try{let t=await a.next();t.done?e.close():e.enqueue(t.value)}catch(t){e.error(t)}},async cancel(){r.abort(),await a.return(void 0)}});return new Response(o,{headers:{"Content-Type":`application/x-ndjson`,"X-Speech-Pitch":String(n.pitch),"X-Speech-Volume":String(n.volume)}})}var O=3e4,k=new Map,A=new Map;async function j(e){let t=Date.now(),n=k.get(e);if(n&&t-n.checkedAt<O)return n.available;let r=A.get(e);if(r)return r;let a=(async()=>{try{let t=await i(`/api/tts/status`);if(!t.ok)return k.set(e,{available:!1,checkedAt:Date.now()}),!1;let n=!!(await t.json()).available;return k.set(e,{available:n,checkedAt:Date.now()}),n}catch{return k.set(e,{available:!1,checkedAt:Date.now()}),!1}finally{A.delete(e)}})();return A.set(e,a),a}var M=null,N=null;function P(){return h(),N||=new(window.AudioContext||window.webkitAudioContext),N}function F(e={}){let r=e.enabled??!0,[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null),d=(0,x.useRef)(null),p=(0,x.useRef)(null),m=(0,x.useRef)(0),h=u(async()=>{let e=++m.current,t=n(),i=r=>(e===m.current&&n()===t&&s(r),r);if(!r)return i(!1);try{return i(await j(t))}catch{return i(!1)}});(0,x.useEffect)(()=>{h()},[r,h]),(0,x.useEffect)(()=>t(()=>{h()}),[h]);let g=u(()=>{let e=p.current;if(p.current=null,e?.abort.abort(),d.current){try{d.current.onended=null,d.current.stop()}catch{}d.current=null}a(!1)}),_=u(async()=>{try{let e=P();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch(e){console.error(`[useServerTTS] Failed to unlock audio:`,e)}}),v=u(async(e,t)=>{if(g(),!e.trim()){l(`No text to speak`),t?.onError?.(`No text to speak`);return}l(null);let r={abort:new AbortController};p.current=r;try{let i=P();i.state===`suspended`&&await i.resume();let o=i.createBuffer(1,1,22050),s=i.createBufferSource();s.buffer=o,s.connect(i.destination),s.start(0);let c=n(),l=t?.resume&&t.playbackKey&&M?.key===t.playbackKey&&M.identity===c&&M.text===e?M:null,u=Math.max(0,Math.min(e.length,t?.resumeOffset??0)),f=async(e,n,o,s,c,l)=>{await T(e,i,{signal:r.abort.signal,pitch:o,volume:s,cache:n,endAt:l,onStart:()=>{p.current===r&&(a(!0),t?.onStart?.())},onProgress:e=>{p.current===r&&t?.onProgress?.({...e,start:e.start+c,end:e.end+c})}})},m=()=>{p.current===r&&(M?.key===t?.playbackKey&&(M=null),p.current=null,a(!1),t?.onEnd?.())};if(l){if(l.pcm.complete){await f(null,l.pcm,l.pitch,l.volume,l.offset),m();return}let t=l.pcm.timeline.lastBefore(l.pcm.samples/24e3);t&&l.offset+t.end<e.trimEnd().length&&(t.endTime>l.pcm.position&&await f(null,l.pcm,l.pitch,l.volume,l.offset,t.endTime),u=Math.max(u,l.offset+t.end))}if(r.abort.signal.throwIfAborted(),M=null,u+=e.slice(u).match(/^\s*/u)[0].length,u===e.length){m();return}let h=await D(e.slice(u),r.abort.signal);if(p.current!==r){await h.body?.cancel();return}if(!h.ok){let e=await h.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${h.status}`)}let g=Number(h.headers.get(`X-Speech-Pitch`)??1),_=Number(h.headers.get(`X-Speech-Volume`)??1);if(h.headers.get(`content-type`)?.includes(`application/x-ndjson`)){let n=w(e.slice(u));t?.playbackKey&&(M={key:t.playbackKey,identity:c,text:e,offset:u,pcm:n,pitch:g,volume:_}),await f(h,n,g,_,u),m();return}let v=await(await h.blob()).arrayBuffer();if(p.current!==r)return;let y=await i.decodeAudioData(v);if(p.current!==r)return;let b=i.createBufferSource();b.buffer=y,g!==1&&(b.detune.value=(g-1)*1200);let x=i.createGain();if(x.gain.value=_,b.connect(x),x.connect(i.destination),d.current=b,b.onended=()=>{p.current===r&&d.current===b&&(a(!1),d.current=null,p.current=null,t?.onEnd?.())},a(!0),t?.onStart?.(),p.current!==r||d.current!==b)return;b.start(0)}catch(e){if(e.name===`AbortError`||p.current!==r)return;let n=e instanceof Error?e.message:`Failed to speak`;console.error(`[useServerTTS] Error:`,n),l(n),t?.onError?.(n),a(!1),d.current&&=(d.current.onended=null,null),p.current=null}});return(0,x.useEffect)(()=>t(()=>{g(),M=null}),[g]),(0,x.useEffect)(()=>f(g),[g]),(0,x.useEffect)(()=>()=>{g()},[g]),{isPlaying:i,isAvailable:o,error:c,speak:v,stop:g,checkAvailability:h,unlockAudio:_}}var I=60,L=400;function R(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return[];let n=t.match(/[^.!?…]+[.!?…]+["')\]]*\s*|[^.!?…]+$/g)??[t],r=[],i=``;for(let e of n)for(let t=0;t<e.length;t+=L){let n=e.slice(t,t+L);i&&i.length+n.length>L&&(r.push(i.trim()),i=``),i+=n,i.length>=I&&/[.!?…]["')\]]*\s*$/.test(i)&&(r.push(i.trim()),i=``)}if(i.trim()&&r.push(i.trim()),r.length>0&&r[0].length>120){let e=r[0],t=/[,;:]\s/g,n=-1,i;for(;(i=t.exec(e))!==null;){let e=i.index+1;if(!(e<40)){if(e>160)break;n=e;break}}if(n>0){let t=e.slice(0,n).trim(),i=e.slice(n).trim();r.splice(0,1,t,i)}}return r}var z=null;function B(){return h(),z||=new(window.AudioContext||window.webkitAudioContext),z}function V(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),a=(0,x.useRef)(null),o=(0,x.useRef)(null),s=(0,x.useCallback)(async()=>{try{let e=B();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch{}},[]),c=(0,x.useCallback)(()=>{let e=o.current;if(e&&(e.cancelled=!0,e.abort.abort(),o.current=null),a.current){try{a.current.onended=null,a.current.stop()}catch{}a.current=null}t(!1)},[]),l=(0,x.useCallback)(async(e,n)=>{c();let s=R(e);if(s.length===0){r(`No text to speak`),n?.onError?.(`No text to speak`);return}r(null);let l={cancelled:!1,abort:new AbortController};o.current=l;let u=async e=>{let t=await i(`/api/dictation/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e}),signal:l.abort.signal});if(!t.ok){let e=await t.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${t.status}`)}return(await t.blob()).arrayBuffer()},d=async e=>{let t=B();t.state===`suspended`&&await t.resume();let n=await t.decodeAudioData(e);l.cancelled||await new Promise(e=>{let r=t.createBufferSource();r.buffer=n,r.connect(t.destination),a.current=r,r.onended=()=>{a.current===r&&(a.current=null),e()},r.start(0)})};try{t(!0),n?.onStart?.();let e=u(s[0]);for(let t=0;t<s.length;t+=1){let n=await e;if(l.cancelled||(t+1<s.length&&(e=u(s[t+1])),await d(n),l.cancelled))return}t(!1),n?.onEnd?.()}catch(e){if(e.name===`AbortError`||l.cancelled)return;let i=e instanceof Error?e.message:`Failed to speak`;r(i),n?.onError?.(i),t(!1)}finally{o.current===l&&(o.current=null)}},[c]);return(0,x.useEffect)(()=>f(c),[c]),(0,x.useEffect)(()=>()=>{c()},[c]),{isPlaying:e,error:n,speak:l,stop:c,unlockAudio:s}}var H=new class{recognition=null;isListening=!1;currentLang=`en-US`;onResultCallback=null;onErrorCallback=null;restartOnEnd=!1;conversationMode=!1;isSpeaking=!1;audioContext=null;audioUnlockRequired=!1;speechGeneration=0;isSupported(){let e=`SpeechRecognition`in window||`webkitSpeechRecognition`in window,t=`speechSynthesis`in window;return e&&t}getSupportDetails(){return{recognition:`SpeechRecognition`in window||`webkitSpeechRecognition`in window,synthesis:`speechSynthesis`in window,prefixed:!(`SpeechRecognition`in window)&&`webkitSpeechRecognition`in window,secureContext:window.isSecureContext}}setConversationMode(e){this.conversationMode=e,e||(this.restartOnEnd=!1)}isConversationMode(){return this.conversationMode}pauseListening(){if(this.restartOnEnd=!1,this.recognition)try{this.recognition.stop()}catch{}this.isListening=!1}resumeListening(){if(this.conversationMode,this.onResultCallback,this.isSpeaking,this.currentLang,this.conversationMode&&this.onResultCallback&&!this.isSpeaking)try{this.startListeningSync(this.currentLang,this.onResultCallback,this.onErrorCallback||void 0)}catch(e){console.error(`[BrowserVoiceService] Failed to resume listening:`,e)}}async checkMicrophonePermission(){try{return`permissions`in navigator&&(await navigator.permissions.query({name:`microphone`})).state===`granted`}catch{return!1}}async prepareListening(){if(!this.isSupported())throw Error(`Web Speech API not supported in this browser`);if(typeof navigator>`u`||typeof navigator.mediaDevices?.getUserMedia!=`function`)return!0;try{return v(),(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),!0}catch(e){let t=typeof e==`object`&&e&&`name`in e?String(e.name):``;if(t===`NotAllowedError`)throw Error(`Microphone permission denied`);if(t===`NotFoundError`)throw Error(`No microphone found`);let n=e instanceof Error?e.message:`Unable to access microphone`;throw Error(n)}}startListeningSync(e,t,n){if(!this.isSupported()){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}this.stopListening(),v(),this.isSpeaking=!1;let r=window.SpeechRecognition||window.webkitSpeechRecognition;if(!r){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}let i=new r;this.recognition=i,this.currentLang=e,this.onResultCallback=t,this.onErrorCallback=n||null,i.continuous=!0,i.interimResults=!0,i.lang=e,i.onstart=()=>{this.isListening=!0,this.restartOnEnd=!0},i.onaudiostart=()=>{},i.onsoundstart=()=>{},i.onresult=e=>{e.results.length;let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r++){let i=e.results[r];i.isFinal?t+=i[0].transcript:n+=i[0].transcript}n&&this.onResultCallback?.(n,!1),t&&this.onResultCallback?.(t,!0)},i.onerror=e=>{if(e.error===`aborted`)return;let t=this.getErrorMessage(e.error);this.onErrorCallback?.(t),(e.error===`not-allowed`||e.error===`service-not-allowed`||e.error===`network`)&&(this.restartOnEnd=!1,this.isListening=!1)},i.onend=()=>{if(this.isListening=!1,this.restartOnEnd&&this.recognition&&!this.isSpeaking)try{this.recognition.start()}catch{}};try{i.start()}catch(e){let t=e instanceof Error?e.message:`Failed to start speech recognition`;throw n?.(t),Error(t)}}async startListening(e,t,n){this.startListeningSync(e,t,n)}stopListening(){if(this.restartOnEnd=!1,this.recognition){try{this.recognition.stop()}catch{}this.recognition=null}this.isListening=!1}getIsListening(){return this.isListening}getCurrentLang(){return this.currentLang}async resumeAudioContext(){h(),this.audioContext||=new(window.AudioContext||window.webkitAudioContext),this.audioContext.state===`suspended`&&await this.audioContext.resume()}isAudioUnlockRequired(){return this.audioUnlockRequired}async unlockAudio(){h();try{let e=new Audio;if(e.src=`data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA`,e.volume=.01,await e.play(),await this.resumeAudioContext(),this.isMobileDevice()&&`speechSynthesis`in window){let e=new SpeechSynthesisUtterance(``);e.volume=0,window.speechSynthesis.speak(e),window.speechSynthesis.cancel()}return this.audioUnlockRequired=!1,!0}catch(e){return console.error(`[BrowserVoiceService] Failed to unlock audio:`,e),!1}}async speakText(e,t,n,r){if(!(`speechSynthesis`in window))throw Error(`Speech synthesis not supported`);let i=++this.speechGeneration;await this.resumeAudioContext();let a=await this.waitForVoices();if(await new Promise(e=>setTimeout(e,50)),i!==this.speechGeneration)return;this.isSpeaking=!0,this.pauseListening(),window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.lang=t,o.rate=r?.rate??1,o.pitch=r?.pitch??1,o.volume=r?.volume??1;let s=null;return r?.voiceName&&(s=a.find(e=>e.name===r.voiceName)||null,s?`${s.name}${s.lang}`:console.warn(`[BrowserVoiceService] Selected voice "${r.voiceName}" not found, falling back to language match`)),s||(s=this.findBestVoice(a,t),s?`${s.name}${s.lang}`:console.warn(`[BrowserVoiceService] No voice found for language: ${t}, using default`)),s&&(o.voice=s),`${e.length}${t}`,new Promise((e,t)=>{let a=!1;o.onstart=()=>{i===this.speechGeneration&&(a=!0,r?.onStart?.(),e())},o.onend=()=>{i===this.speechGeneration&&(this.isSpeaking=!1,n?.())},o.onerror=e=>{if(i!==this.speechGeneration)return;this.isSpeaking=!1,console.error(`[BrowserVoiceService] Speech synthesis error:`,e.error),(e.error===`not-allowed`||e.error===`interrupted`)&&(this.audioUnlockRequired=!0);let n=`Speech synthesis error: ${e.error||`unknown`}`;e.error===`not-allowed`?n=`Audio blocked by browser autoplay policy. Please interact with the page first.`:e.error===`interrupted`&&(n=`Speech was interrupted. Please try again.`),r?.onError?.(n),t(Error(n))},setTimeout(()=>{a||(console.warn(`[BrowserVoiceService] Speech start timeout - audio may be blocked`),this.audioUnlockRequired=!0)},2e3),window.speechSynthesis.speak(o)})}cancelSpeech(){this.speechGeneration+=1,this.isSpeaking=!1,`speechSynthesis`in window&&window.speechSynthesis.cancel()}getVoices(){return`speechSynthesis`in window?window.speechSynthesis.getVoices():[]}async waitForVoices(){if(!(`speechSynthesis`in window))return[];let e=window.speechSynthesis.getVoices();return e.length>0?e:new Promise(e=>{let t=()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null};window.speechSynthesis.onvoiceschanged=t,setTimeout(()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null},1e3)})}findBestVoice(e,t){let n=e.find(e=>e.lang===t);if(!n){let r=t.split(`-`)[0];n=e.find(e=>e.lang.startsWith(r))}return n||=e.find(e=>e.lang.startsWith(t.split(`-`)[0])&&e.localService),n||null}isMobileDevice(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|android|mobile|webos|blackberry|iemobile|opera mini/i.test(e)}isIOSSafari(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase(),t=/iphone|ipad|ipod/i.test(e),n=/safari/i.test(e)&&!/chrome|crios|crmo/i.test(e);return t&&n}getErrorMessage(e){let t=this.isMobileDevice(),n=this.isIOSSafari();return{"no-speech":`No speech detected`,aborted:`Speech recognition aborted`,"audio-capture":`No microphone found`,network:`Network error - check connection`,"not-allowed":t?`Microphone permission denied. Check Settings > Safari > Microphone`:`Microphone permission denied`,"service-not-allowed":n?`Speech recognition requires a user gesture. Please tap the microphone button again.`:`Speech recognition service not allowed`,"bad-grammar":`Grammar error`,"language-not-supported":`Language not supported`}[e]||`Speech recognition error: ${e}`}};f(()=>H.cancelSpeech());var U=s(),W=(e=n())=>({queryKey:[e,`speech`,`settings`],queryFn:({signal:e})=>o(e,async e=>{let t=await i(`/api/voice/settings`,{signal:e});if(!t.ok)throw Error(`Unable to load speech settings`);return d(await t.json())}),staleTime:3e4,networkMode:`always`,retry:1,refetchOnWindowFocus:!0}),G=()=>{let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=W(),e[0]=t):t=e[0],c(t)};async function K(e,t=r(),a=n()){let{queryKey:s}=W(a);if(await l.cancelQueries({queryKey:s,exact:!0}),t!==r())throw Error(`Runtime changed`);let c=await o(new AbortController().signal,async t=>{let n=await i(`/api/voice/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t});if(!n.ok)throw Error(`Unable to save speech settings`);return d(await n.json())});if(t!==r()||a!==n()||(await l.cancelQueries({queryKey:s,exact:!0}),t!==r()))throw Error(`Runtime changed`);return l.setQueryData(s,c),c}export{V as a,H as i,W as n,F as o,G as r,K as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{n as r}from"./vendor-react-DlzBev0S.js";import{t as i}from"./i18n-BU14awhU.js";import{Jn as a}from"./useMobileNavigationStore-C90n-pQY.js";import{t as o}from"./OverlayScrollbar-D5p2e1RO.js";var s=r(),c=e(n(),1),l=t();function u(e,t){let n=(0,s.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{[e,t].forEach(e=>{typeof e==`function`?e(n):e&&typeof e==`object`&&(e.current=n)})},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}var d=c.forwardRef((e,t)=>{let n=(0,s.c)(28),{as:r,orientation:i,offset:a,size:o,isEnabled:d,hideTopShadow:m,hideBottomShadow:h,observeMutations:g,onVisibilityChange:_,style:v,className:y,children:b,...x}=e,S=r===void 0?`div`:r,C=i===void 0?`vertical`:i,w=a===void 0?0:a,T=o===void 0?48:o,E=d===void 0||d,D=m!==void 0&&m,O=h!==void 0&&h,k=g===void 0||g,A=c.useRef(null),j=c.useRef(`none`),M=x[`data-scroll-shadow`];delete x[`data-scroll-shadow`];let N=v,P;n[0]!==T||n[1]!==N?(P={...N},P[`--scroll-shadow-size`]=`${T}px`,n[0]=T,n[1]=N,n[2]=P):P=n[2];let F=P,I=f,L=p,R;n[3]!==O||n[4]!==D||n[5]!==E||n[6]!==w||n[7]!==_||n[8]!==C?(R=()=>{let e=A.current;if(!e)return;if(!E){L(e),j.current!==`none`&&(j.current=`none`,_?.(`none`));return}let t=C===`vertical`?e.scrollTop>w+1:e.scrollLeft>w+1,n=C===`vertical`?e.scrollHeight-(e.scrollTop+e.clientHeight)>w+1:e.scrollWidth-(e.scrollLeft+e.clientWidth)>w+1,r=D&&C===`vertical`?!1:t;O&&C===`vertical`&&(n=!1),I(e,r,n,C===`vertical`?`top`:`left`,C===`vertical`?`bottom`:`right`);let i=r&&n?`both`:r?C===`vertical`?`top`:`left`:n?C===`vertical`?`bottom`:`right`:`none`;i!==j.current&&(j.current=i,_?.(i))},n[3]=O,n[4]=D,n[5]=E,n[6]=w,n[7]=_,n[8]=C,n[9]=R):R=n[9];let z=R,B,V;n[10]!==z||n[11]!==E?(B=()=>{E||z()},V=[z,E],n[10]=z,n[11]=E,n[12]=B,n[13]=V):(B=n[12],V=n[13]),c.useLayoutEffect(B,V);let H,U;n[14]!==z||n[15]!==E||n[16]!==k?(H=()=>{let e=A.current;if(!e||!E)return;let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,z()}))},r=n,i=typeof ResizeObserver<`u`?new ResizeObserver(n):null,a=k&&typeof MutationObserver<`u`?new MutationObserver(n):null;return z(),e.addEventListener(`scroll`,r,{passive:!0}),i?.observe(e),a?.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t!==null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,r),i?.disconnect(),a?.disconnect()}},U=[z,E,k],n[14]=z,n[15]=E,n[16]=k,n[17]=H,n[18]=U):(H=n[17],U=n[18]),c.useEffect(H,U);let W=u(A,t),G=M??!0,K;return n[19]!==S||n[20]!==b||n[21]!==y||n[22]!==W||n[23]!==F||n[24]!==C||n[25]!==x||n[26]!==G?(K=(0,l.jsx)(S,{...x,ref:W,className:y,"data-orientation":C,"data-scroll-shadow":G,style:F,children:b}),n[19]=S,n[20]=b,n[21]=y,n[22]=W,n[23]=F,n[24]=C,n[25]=x,n[26]=G,n[27]=K):K=n[27],K});d.displayName=`ScrollShadow`;function f(e,t,n,r,i){let a=`${r}${i.charAt(0).toUpperCase()}${i.slice(1)}Scroll`;t&&n?(e.dataset[a]=`true`,e.removeAttribute(`data-${r}-scroll`),e.removeAttribute(`data-${i}-scroll`)):(e.dataset[`${r}Scroll`]=String(t),e.dataset[`${i}Scroll`]=String(n),e.removeAttribute(`data-${r}-${i}-scroll`))}function p(e){[`top`,`bottom`,`top-bottom`,`left`,`right`,`left-right`].forEach(t=>{e.removeAttribute(`data-${t}-scroll`)})}var m=c.forwardRef((e,t)=>{let n=(0,s.c)(45),r,i,u,f,p,m,h,g,_,v,y,b,x,S,C,w;n[0]===e?(r=n[1],i=n[2],u=n[3],f=n[4],p=n[5],m=n[6],h=n[7],g=n[8],_=n[9],v=n[10],y=n[11],b=n[12],x=n[13],S=n[14],C=n[15],w=n[16]):({className:i,outerClassName:p,children:r,style:_,minThumbSize:f,hideDelayMs:u,as:v,scrollbarClassName:g,disableHorizontal:y,observeMutations:b,fillContainer:x,preventOverscroll:S,useScrollShadow:C,scrollShadowSize:h,userIntentOnly:w,...m}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=u,n[4]=f,n[5]=p,n[6]=m,n[7]=h,n[8]=g,n[9]=_,n[10]=v,n[11]=y,n[12]=b,n[13]=x,n[14]=S,n[15]=C,n[16]=w);let T=v===void 0?`div`:v,E=y!==void 0&&y,D=b===void 0||b,O=x===void 0||x,k=S!==void 0&&S,A=C!==void 0&&C,j=w!==void 0&&w,M=c.useRef(null),N,P;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>M.current,P=[],n[17]=N,n[18]=P):(N=n[17],P=n[18]),c.useImperativeHandle(t,N,P);let F=k&&`overscroll-none`,I;n[19]!==p||n[20]!==F?(I=a(`relative flex flex-col min-h-0 w-full overflow-hidden`,F,p),n[19]=p,n[20]=F,n[21]=I):I=n[21];let L;n[22]!==T||n[23]!==r||n[24]!==i||n[25]!==E||n[26]!==O||n[27]!==D||n[28]!==k||n[29]!==m||n[30]!==h||n[31]!==_||n[32]!==A?(L=A?(0,l.jsx)(d,{as:T,ref:M,size:h,className:a(`overlay-scrollbar-target overlay-scrollbar-container`,k&&`overscroll-none`,O?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,E?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:_,observeMutations:D,...m,children:r}):(0,l.jsx)(T,{ref:M,className:a(`overlay-scrollbar-target overlay-scrollbar-container`,k&&`overscroll-none`,O?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,E?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:_,...m,children:r}),n[22]=T,n[23]=r,n[24]=i,n[25]=E,n[26]=O,n[27]=D,n[28]=k,n[29]=m,n[30]=h,n[31]=_,n[32]=A,n[33]=L):L=n[33];let R;n[34]!==E||n[35]!==u||n[36]!==f||n[37]!==D||n[38]!==g||n[39]!==j?(R=(0,l.jsx)(o,{containerRef:M,minThumbSize:f,hideDelayMs:u,className:g,disableHorizontal:E,observeMutations:D,userIntentOnly:j}),n[34]=E,n[35]=u,n[36]=f,n[37]=D,n[38]=g,n[39]=j,n[40]=R):R=n[40];let z;return n[41]!==I||n[42]!==L||n[43]!==R?(z=(0,l.jsxs)(`div`,{className:I,children:[L,R]}),n[41]=I,n[42]=L,n[43]=R,n[44]=z):z=n[44],z});m.displayName=`ScrollableOverlay`;function h(e){let t=(0,s.c)(4),{onResizeStart:n,ariaLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,l.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,l.jsx)(`path`,{d:`M9.11111 2L2 9.11111M10 6.44444L6.44444 10`,className:`stroke-muted-foreground`,strokeLinecap:`round`})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,l.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":r,onPointerDown:n,className:`pointer-events-auto -m-2 flex size-7 cursor-ns-resize items-end justify-end p-2 touch-none select-none`,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}var g=c.forwardRef((e,t)=>{let n=(0,s.c)(69),r,o,u,d,f,p,g,_,v,y,b,x,S,C;n[0]===e?(r=n[1],o=n[2],u=n[3],d=n[4],f=n[5],p=n[6],g=n[7],_=n[8],v=n[9],y=n[10],b=n[11],x=n[12],S=n[13],C=n[14]):({className:r,outerClassName:g,scrollbarClassName:y,fillContainer:x,useScrollShadow:S,scrollShadowSize:v,hasError:f,resizedHeight:o,onResizeHeightChange:p,disabled:u,simple:b,embedded:C,endSlot:d,..._}=e,n[0]=e,n[1]=r,n[2]=o,n[3]=u,n[4]=d,n[5]=f,n[6]=p,n[7]=g,n[8]=_,n[9]=v,n[10]=y,n[11]=b,n[12]=x,n[13]=S,n[14]=C);let w=x!==void 0&&x,T=S!==void 0&&S,E=C!==void 0&&C,{t:D}=i(),O=c.useRef(null),k=c.useRef(null),[A,j]=c.useState(null),M=o??A,N;n[15]===p?N=n[16]:(N=e=>{let t=O.current;if(!t)return;k.current={startY:e.clientY,startHeight:t.getBoundingClientRect().height};let n=e.currentTarget;n.setPointerCapture(e.pointerId);let r=e=>{let t=k.current;if(!t)return;let n=t.startHeight+(e.clientY-t.startY),r=Math.max(82,n);p?p(r):j(r)},i=()=>{k.current=null,n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i),e.preventDefault()},n[15]=p,n[16]=N);let P=N,F;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{if(e.target.closest(`textarea, button, [role="separator"]`))return;let t=O.current?.querySelector(`textarea`);t&&document.activeElement!==t&&(e.preventDefault(),t.focus())},n[17]=F):F=n[17];let I=F;if(b){let e=f||void 0,i=t,o;n[18]===g?o=n[19]:(o=a(`yuri-textarea-simple`,g),n[18]=g,n[19]=o);let s=w?`[field-sizing:fixed]`:`field-sizing-content`,c;n[20]!==r||n[21]!==s?(c=a(`block w-full appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`px-3 py-2 md:typography-ui-label`,`placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,s,r),n[20]=r,n[21]=s,n[22]=c):c=n[22];let d;return n[23]!==u||n[24]!==w||n[25]!==_||n[26]!==v||n[27]!==y||n[28]!==c||n[29]!==e||n[30]!==i||n[31]!==o||n[32]!==T?(d=(0,l.jsx)(m,{as:`textarea`,"data-slot":`textarea`,"aria-invalid":e,ref:i,disableHorizontal:!0,fillContainer:w,useScrollShadow:T,scrollShadowSize:v,outerClassName:o,scrollbarClassName:y,className:c,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:u,..._}),n[23]=u,n[24]=w,n[25]=_,n[26]=v,n[27]=y,n[28]=c,n[29]=e,n[30]=i,n[31]=o,n[32]=T,n[33]=d):d=n[33],d}let L=f||void 0,R;n[34]===M?R=n[35]:(R=M===null?void 0:{height:`${M}px`},n[34]=M,n[35]=R);let z;if(n[36]!==E||n[37]!==f||n[38]!==g){let e;n[40]===f?e=n[41]:(e=f&&[`ring-[var(--status-error)]`,`focus-within:ring-2 focus-within:ring-[var(--status-error)]`],n[40]=f,n[41]=e);let t;n[42]===E?t=n[43]:(t=E&&[`rounded-none bg-transparent ring-0`,`hover:[&:not(:focus-within)]:bg-transparent`,`has-[[disabled]]:bg-transparent`],n[42]=E,n[43]=t),z=a(`group/textarea relative flex w-full flex-col rounded-[var(--radius-xl)] bg-[var(--surface-elevated)] pb-2.5`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)]`,`has-[[disabled]]:pointer-events-none has-[[disabled]]:bg-[var(--surface-subtle)] has-[[disabled]]:ring-transparent`,!f&&[`hover:[&:not(:focus-within)]:ring-transparent`,`focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`],e,t,g),n[36]=E,n[37]=f,n[38]=g,n[39]=z}else z=n[39];let B=f||void 0,V;n[44]!==r||n[45]!==u?(V=a(`block w-full flex-1 min-h-0 appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`min-h-[82px] pl-3 pr-2.5 pt-2.5 md:typography-ui-label`,`focus-visible:outline-none disabled:cursor-not-allowed`,!u&&[`placeholder:select-none placeholder:text-muted-foreground placeholder:transition placeholder:duration-200 placeholder:ease-out`,`group-hover/textarea:placeholder:text-foreground/80`,`focus:placeholder:text-foreground/80`],u&&`text-muted-foreground/60 placeholder:text-muted-foreground/60`,r),n[44]=r,n[45]=u,n[46]=V):V=n[46];let H;n[47]!==u||n[48]!==_||n[49]!==t||n[50]!==V||n[51]!==B?(H=(0,l.jsx)(`textarea`,{ref:t,"data-slot":`textarea-input`,"aria-invalid":B,className:V,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:u,..._}),n[47]=u,n[48]=_,n[49]=t,n[50]=V,n[51]=B,n[52]=H):H=n[52];let U;n[53]===D?U=n[54]:(U=D(`textarea.resizeHandleAria`),n[53]=D,n[54]=U);let W;n[55]!==P||n[56]!==U?(W=(0,l.jsx)(h,{onResizeStart:P,ariaLabel:U}),n[55]=P,n[56]=U,n[57]=W):W=n[57];let G;n[58]!==d||n[59]!==W?(G=(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pl-3 pr-2.5`,children:[d,W]}),n[58]=d,n[59]=W,n[60]=G):G=n[60];let K;n[61]!==H||n[62]!==G?(K=(0,l.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-2`,children:[H,G]}),n[61]=H,n[62]=G,n[63]=K):K=n[63];let q;return n[64]!==K||n[65]!==L||n[66]!==R||n[67]!==z?(q=(0,l.jsx)(`div`,{ref:O,"data-slot":`textarea`,"data-invalid":L,onPointerDown:I,style:R,className:z,children:K}),n[64]=K,n[65]=L,n[66]=R,n[67]=z,n[68]=q):q=n[68],q});g.displayName=`Textarea`;export{m as n,d as r,g as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{n as r}from"./vendor-react-DlzBev0S.js";import{t as i}from"./i18n-BU14awhU.js";import{Jn as a}from"./useMobileNavigationStore-Dr61mYqA.js";import{t as o}from"./OverlayScrollbar-BQua3Ko6.js";var s=r(),c=e(n(),1),l=t();function u(e,t){let n=(0,s.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{[e,t].forEach(e=>{typeof e==`function`?e(n):e&&typeof e==`object`&&(e.current=n)})},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}var d=c.forwardRef((e,t)=>{let n=(0,s.c)(28),{as:r,orientation:i,offset:a,size:o,isEnabled:d,hideTopShadow:m,hideBottomShadow:h,observeMutations:g,onVisibilityChange:_,style:v,className:y,children:b,...x}=e,S=r===void 0?`div`:r,C=i===void 0?`vertical`:i,w=a===void 0?0:a,T=o===void 0?48:o,E=d===void 0||d,D=m!==void 0&&m,O=h!==void 0&&h,k=g===void 0||g,A=c.useRef(null),j=c.useRef(`none`),M=x[`data-scroll-shadow`];delete x[`data-scroll-shadow`];let N=v,P;n[0]!==T||n[1]!==N?(P={...N},P[`--scroll-shadow-size`]=`${T}px`,n[0]=T,n[1]=N,n[2]=P):P=n[2];let F=P,I=f,L=p,R;n[3]!==O||n[4]!==D||n[5]!==E||n[6]!==w||n[7]!==_||n[8]!==C?(R=()=>{let e=A.current;if(!e)return;if(!E){L(e),j.current!==`none`&&(j.current=`none`,_?.(`none`));return}let t=C===`vertical`?e.scrollTop>w+1:e.scrollLeft>w+1,n=C===`vertical`?e.scrollHeight-(e.scrollTop+e.clientHeight)>w+1:e.scrollWidth-(e.scrollLeft+e.clientWidth)>w+1,r=D&&C===`vertical`?!1:t;O&&C===`vertical`&&(n=!1),I(e,r,n,C===`vertical`?`top`:`left`,C===`vertical`?`bottom`:`right`);let i=r&&n?`both`:r?C===`vertical`?`top`:`left`:n?C===`vertical`?`bottom`:`right`:`none`;i!==j.current&&(j.current=i,_?.(i))},n[3]=O,n[4]=D,n[5]=E,n[6]=w,n[7]=_,n[8]=C,n[9]=R):R=n[9];let z=R,B,V;n[10]!==z||n[11]!==E?(B=()=>{E||z()},V=[z,E],n[10]=z,n[11]=E,n[12]=B,n[13]=V):(B=n[12],V=n[13]),c.useLayoutEffect(B,V);let H,U;n[14]!==z||n[15]!==E||n[16]!==k?(H=()=>{let e=A.current;if(!e||!E)return;let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,z()}))},r=n,i=typeof ResizeObserver<`u`?new ResizeObserver(n):null,a=k&&typeof MutationObserver<`u`?new MutationObserver(n):null;return z(),e.addEventListener(`scroll`,r,{passive:!0}),i?.observe(e),a?.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t!==null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,r),i?.disconnect(),a?.disconnect()}},U=[z,E,k],n[14]=z,n[15]=E,n[16]=k,n[17]=H,n[18]=U):(H=n[17],U=n[18]),c.useEffect(H,U);let W=u(A,t),G=M??!0,K;return n[19]!==S||n[20]!==b||n[21]!==y||n[22]!==W||n[23]!==F||n[24]!==C||n[25]!==x||n[26]!==G?(K=(0,l.jsx)(S,{...x,ref:W,className:y,"data-orientation":C,"data-scroll-shadow":G,style:F,children:b}),n[19]=S,n[20]=b,n[21]=y,n[22]=W,n[23]=F,n[24]=C,n[25]=x,n[26]=G,n[27]=K):K=n[27],K});d.displayName=`ScrollShadow`;function f(e,t,n,r,i){let a=`${r}${i.charAt(0).toUpperCase()}${i.slice(1)}Scroll`;t&&n?(e.dataset[a]=`true`,e.removeAttribute(`data-${r}-scroll`),e.removeAttribute(`data-${i}-scroll`)):(e.dataset[`${r}Scroll`]=String(t),e.dataset[`${i}Scroll`]=String(n),e.removeAttribute(`data-${r}-${i}-scroll`))}function p(e){[`top`,`bottom`,`top-bottom`,`left`,`right`,`left-right`].forEach(t=>{e.removeAttribute(`data-${t}-scroll`)})}var m=c.forwardRef((e,t)=>{let n=(0,s.c)(45),r,i,u,f,p,m,h,g,_,v,y,b,x,S,C,w;n[0]===e?(r=n[1],i=n[2],u=n[3],f=n[4],p=n[5],m=n[6],h=n[7],g=n[8],_=n[9],v=n[10],y=n[11],b=n[12],x=n[13],S=n[14],C=n[15],w=n[16]):({className:i,outerClassName:p,children:r,style:_,minThumbSize:f,hideDelayMs:u,as:v,scrollbarClassName:g,disableHorizontal:y,observeMutations:b,fillContainer:x,preventOverscroll:S,useScrollShadow:C,scrollShadowSize:h,userIntentOnly:w,...m}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=u,n[4]=f,n[5]=p,n[6]=m,n[7]=h,n[8]=g,n[9]=_,n[10]=v,n[11]=y,n[12]=b,n[13]=x,n[14]=S,n[15]=C,n[16]=w);let T=v===void 0?`div`:v,E=y!==void 0&&y,D=b===void 0||b,O=x===void 0||x,k=S!==void 0&&S,A=C!==void 0&&C,j=w!==void 0&&w,M=c.useRef(null),N,P;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>M.current,P=[],n[17]=N,n[18]=P):(N=n[17],P=n[18]),c.useImperativeHandle(t,N,P);let F=k&&`overscroll-none`,I;n[19]!==p||n[20]!==F?(I=a(`relative flex flex-col min-h-0 w-full overflow-hidden`,F,p),n[19]=p,n[20]=F,n[21]=I):I=n[21];let L;n[22]!==T||n[23]!==r||n[24]!==i||n[25]!==E||n[26]!==O||n[27]!==D||n[28]!==k||n[29]!==m||n[30]!==h||n[31]!==_||n[32]!==A?(L=A?(0,l.jsx)(d,{as:T,ref:M,size:h,className:a(`overlay-scrollbar-target overlay-scrollbar-container`,k&&`overscroll-none`,O?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,E?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:_,observeMutations:D,...m,children:r}):(0,l.jsx)(T,{ref:M,className:a(`overlay-scrollbar-target overlay-scrollbar-container`,k&&`overscroll-none`,O?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,E?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:_,...m,children:r}),n[22]=T,n[23]=r,n[24]=i,n[25]=E,n[26]=O,n[27]=D,n[28]=k,n[29]=m,n[30]=h,n[31]=_,n[32]=A,n[33]=L):L=n[33];let R;n[34]!==E||n[35]!==u||n[36]!==f||n[37]!==D||n[38]!==g||n[39]!==j?(R=(0,l.jsx)(o,{containerRef:M,minThumbSize:f,hideDelayMs:u,className:g,disableHorizontal:E,observeMutations:D,userIntentOnly:j}),n[34]=E,n[35]=u,n[36]=f,n[37]=D,n[38]=g,n[39]=j,n[40]=R):R=n[40];let z;return n[41]!==I||n[42]!==L||n[43]!==R?(z=(0,l.jsxs)(`div`,{className:I,children:[L,R]}),n[41]=I,n[42]=L,n[43]=R,n[44]=z):z=n[44],z});m.displayName=`ScrollableOverlay`;function h(e){let t=(0,s.c)(4),{onResizeStart:n,ariaLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,l.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,l.jsx)(`path`,{d:`M9.11111 2L2 9.11111M10 6.44444L6.44444 10`,className:`stroke-muted-foreground`,strokeLinecap:`round`})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,l.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":r,onPointerDown:n,className:`pointer-events-auto -m-2 flex size-7 cursor-ns-resize items-end justify-end p-2 touch-none select-none`,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}var g=c.forwardRef((e,t)=>{let n=(0,s.c)(69),r,o,u,d,f,p,g,_,v,y,b,x,S,C;n[0]===e?(r=n[1],o=n[2],u=n[3],d=n[4],f=n[5],p=n[6],g=n[7],_=n[8],v=n[9],y=n[10],b=n[11],x=n[12],S=n[13],C=n[14]):({className:r,outerClassName:g,scrollbarClassName:y,fillContainer:x,useScrollShadow:S,scrollShadowSize:v,hasError:f,resizedHeight:o,onResizeHeightChange:p,disabled:u,simple:b,embedded:C,endSlot:d,..._}=e,n[0]=e,n[1]=r,n[2]=o,n[3]=u,n[4]=d,n[5]=f,n[6]=p,n[7]=g,n[8]=_,n[9]=v,n[10]=y,n[11]=b,n[12]=x,n[13]=S,n[14]=C);let w=x!==void 0&&x,T=S!==void 0&&S,E=C!==void 0&&C,{t:D}=i(),O=c.useRef(null),k=c.useRef(null),[A,j]=c.useState(null),M=o??A,N;n[15]===p?N=n[16]:(N=e=>{let t=O.current;if(!t)return;k.current={startY:e.clientY,startHeight:t.getBoundingClientRect().height};let n=e.currentTarget;n.setPointerCapture(e.pointerId);let r=e=>{let t=k.current;if(!t)return;let n=t.startHeight+(e.clientY-t.startY),r=Math.max(82,n);p?p(r):j(r)},i=()=>{k.current=null,n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i),e.preventDefault()},n[15]=p,n[16]=N);let P=N,F;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{if(e.target.closest(`textarea, button, [role="separator"]`))return;let t=O.current?.querySelector(`textarea`);t&&document.activeElement!==t&&(e.preventDefault(),t.focus())},n[17]=F):F=n[17];let I=F;if(b){let e=f||void 0,i=t,o;n[18]===g?o=n[19]:(o=a(`yuri-textarea-simple`,g),n[18]=g,n[19]=o);let s=w?`[field-sizing:fixed]`:`field-sizing-content`,c;n[20]!==r||n[21]!==s?(c=a(`block w-full appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`px-3 py-2 md:typography-ui-label`,`placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,s,r),n[20]=r,n[21]=s,n[22]=c):c=n[22];let d;return n[23]!==u||n[24]!==w||n[25]!==_||n[26]!==v||n[27]!==y||n[28]!==c||n[29]!==e||n[30]!==i||n[31]!==o||n[32]!==T?(d=(0,l.jsx)(m,{as:`textarea`,"data-slot":`textarea`,"aria-invalid":e,ref:i,disableHorizontal:!0,fillContainer:w,useScrollShadow:T,scrollShadowSize:v,outerClassName:o,scrollbarClassName:y,className:c,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:u,..._}),n[23]=u,n[24]=w,n[25]=_,n[26]=v,n[27]=y,n[28]=c,n[29]=e,n[30]=i,n[31]=o,n[32]=T,n[33]=d):d=n[33],d}let L=f||void 0,R;n[34]===M?R=n[35]:(R=M===null?void 0:{height:`${M}px`},n[34]=M,n[35]=R);let z;if(n[36]!==E||n[37]!==f||n[38]!==g){let e;n[40]===f?e=n[41]:(e=f&&[`ring-[var(--status-error)]`,`focus-within:ring-2 focus-within:ring-[var(--status-error)]`],n[40]=f,n[41]=e);let t;n[42]===E?t=n[43]:(t=E&&[`rounded-none bg-transparent ring-0`,`hover:[&:not(:focus-within)]:bg-transparent`,`has-[[disabled]]:bg-transparent`],n[42]=E,n[43]=t),z=a(`group/textarea relative flex w-full flex-col rounded-[var(--radius-xl)] bg-[var(--surface-elevated)] pb-2.5`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)]`,`has-[[disabled]]:pointer-events-none has-[[disabled]]:bg-[var(--surface-subtle)] has-[[disabled]]:ring-transparent`,!f&&[`hover:[&:not(:focus-within)]:ring-transparent`,`focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`],e,t,g),n[36]=E,n[37]=f,n[38]=g,n[39]=z}else z=n[39];let B=f||void 0,V;n[44]!==r||n[45]!==u?(V=a(`block w-full flex-1 min-h-0 appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`min-h-[82px] pl-3 pr-2.5 pt-2.5 md:typography-ui-label`,`focus-visible:outline-none disabled:cursor-not-allowed`,!u&&[`placeholder:select-none placeholder:text-muted-foreground placeholder:transition placeholder:duration-200 placeholder:ease-out`,`group-hover/textarea:placeholder:text-foreground/80`,`focus:placeholder:text-foreground/80`],u&&`text-muted-foreground/60 placeholder:text-muted-foreground/60`,r),n[44]=r,n[45]=u,n[46]=V):V=n[46];let H;n[47]!==u||n[48]!==_||n[49]!==t||n[50]!==V||n[51]!==B?(H=(0,l.jsx)(`textarea`,{ref:t,"data-slot":`textarea-input`,"aria-invalid":B,className:V,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:u,..._}),n[47]=u,n[48]=_,n[49]=t,n[50]=V,n[51]=B,n[52]=H):H=n[52];let U;n[53]===D?U=n[54]:(U=D(`textarea.resizeHandleAria`),n[53]=D,n[54]=U);let W;n[55]!==P||n[56]!==U?(W=(0,l.jsx)(h,{onResizeStart:P,ariaLabel:U}),n[55]=P,n[56]=U,n[57]=W):W=n[57];let G;n[58]!==d||n[59]!==W?(G=(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pl-3 pr-2.5`,children:[d,W]}),n[58]=d,n[59]=W,n[60]=G):G=n[60];let K;n[61]!==H||n[62]!==G?(K=(0,l.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-2`,children:[H,G]}),n[61]=H,n[62]=G,n[63]=K):K=n[63];let q;return n[64]!==K||n[65]!==L||n[66]!==R||n[67]!==z?(q=(0,l.jsx)(`div`,{ref:O,"data-slot":`textarea`,"data-invalid":L,onPointerDown:I,style:R,className:z,children:K}),n[64]=K,n[65]=L,n[66]=R,n[67]=z,n[68]=q):q=n[68],q});g.displayName=`Textarea`;export{m as n,d as r,g as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{G as t,H as n,K as r,U as i,V as a,W as o,ot as s,q as c,st as l}from"./vendor-base-ui-CzHs0bHY.js";import{n as u}from"./vendor-react-DlzBev0S.js";import{Jn as d}from"./useMobileNavigationStore-C90n-pQY.js";var f=u(),p=e(l(),1),m=s(),h=600,g=1600,_=12,v=p.createContext(null),y=class extends p.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function b(e){let t=(0,f.c)(12),n,r,i,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6]):({delayDuration:s,skipDelayDuration:o,delay:r,closeDelay:n,timeout:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c);let l=r??(s===void 0?0:s),u=n??o,d;return t[7]!==i||t[8]!==l||t[9]!==u||t[10]!==c?(d=(0,m.jsx)(a,{delay:l,closeDelay:u,timeout:c,...i}),t[7]=i,t[8]=l,t[9]=u,t[10]=c,t[11]=d):d=t[11],d}function x(e){let t=(0,f.c)(35),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({delayDuration:n,open:i,onOpenChange:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let[o,s]=p.useState(!1),l=p.useRef(null),u=p.useRef(null),d=p.useRef(null),y=p.useRef(!1),x=i!==void 0,S=x?i:o,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},t[5]=C):C=t[5];let w=C,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},t[6]=T):T=t[6];let E=T,D;t[7]===x?D=t[8]:(D=e=>{x||s(e)},t[7]=x,t[8]=D);let O=D,k;t[9]!==x||t[10]!==O?(k=e=>{(e.pointerType===`touch`||e.pointerType===`pen`)&&(w(),E(),d.current={x:e.clientX,y:e.clientY},l.current=window.setTimeout(()=>{x||(y.current=!0,O(!0))},h))},t[9]=x,t[10]=O,t[11]=k):k=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=d.current;if(!t)return;let n=Math.abs(e.clientX-t.x),r=Math.abs(e.clientY-t.y);(n>_||r>_)&&(w(),d.current=null)},t[12]=A):A=t[12];let j;t[13]===O?j=t[14]:(j=()=>{w(),d.current=null,y.current&&(E(),u.current=window.setTimeout(()=>{y.current=!1,O(!1)},g))},t[13]=O,t[14]=j);let M,N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{y.current&&(y.current=!1,e.preventDefault(),e.stopPropagation())},N=e=>{y.current&&e.preventDefault()},t[15]=M,t[16]=N):(M=t[15],N=t[16]);let P;t[17]!==k||t[18]!==j?(P={handlePointerDown:k,handlePointerMove:A,handlePointerEnd:j,handleClickCapture:M,handleContextMenu:N},t[17]=k,t[18]=j,t[19]=P):P=t[19];let F=P,I,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{w(),E()},L=[E,w],t[20]=I,t[21]=L):(I=t[20],L=t[21]),p.useEffect(I,L);let R;t[22]!==x||t[23]!==r?(R=(e,t)=>{x||s(e),r?.(e,t)},t[22]=x,t[23]=r,t[24]=R):R=t[24];let z=R,B;t[25]!==z||t[26]!==a||t[27]!==S?(B=(0,m.jsx)(c,{open:S,onOpenChange:z,...a}),t[25]=z,t[26]=a,t[27]=S,t[28]=B):B=t[28];let V;t[29]!==F||t[30]!==B?(V=(0,m.jsx)(v.Provider,{value:F,children:B}),t[29]=F,t[30]=B,t[31]=V):V=t[31];let H=V;if(n===void 0)return H;let U;return t[32]!==n||t[33]!==H?(U=(0,m.jsx)(b,{delayDuration:n,children:H}),t[32]=n,t[33]=H,t[34]=U):U=t[34],U}function S(e){let t=(0,f.c)(43),n,i,a,o,s,c,l,u,d;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9]):({asChild:n,children:i,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:s,onClickCapture:a,onContextMenu:o,...d}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d);let h=p.useContext(v),g;t[10]!==n||t[11]!==i?(g=n&&p.isValidElement(i)?{render:i}:{children:i},t[10]=n,t[11]=i,t[12]=g):g=t[12];let _=g,b;t[13]!==h||t[14]!==c?(b=e=>{c?.(e),h?.handlePointerDown(e)},t[13]=h,t[14]=c,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l?(x=e=>{l?.(e),h?.handlePointerMove(e)},t[16]=h,t[17]=l,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==u?(S=e=>{u?.(e),h?.handlePointerEnd()},t[19]=h,t[20]=u,t[21]=S):S=t[21];let C;t[22]!==h||t[23]!==s?(C=e=>{s?.(e),h?.handlePointerEnd()},t[22]=h,t[23]=s,t[24]=C):C=t[24];let w;t[25]!==h||t[26]!==a?(w=e=>{h?.handleClickCapture(e),!e.defaultPrevented&&a?.(e)},t[25]=h,t[26]=a,t[27]=w):w=t[27];let T;t[28]!==h||t[29]!==o?(T=e=>{h?.handleContextMenu(e),!e.defaultPrevented&&o?.(e)},t[28]=h,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==d||t[32]!==_||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,m.jsx)(r,{"data-slot":`tooltip-trigger`,onPointerDown:b,onPointerMove:x,onPointerUp:S,onPointerCancel:C,onClickCapture:w,onContextMenu:T,...d,..._}),t[31]=d,t[32]=_,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D;return t[40]!==i||t[41]!==E?(D=(0,m.jsx)(y,{fallback:i,children:E}),t[40]=i,t[41]=E,t[42]=D):D=t[42],D}function C(e){let r=(0,f.c)(25),a,s,c,l,u,p,h,g;r[0]===e?(a=r[1],s=r[2],c=r[3],l=r[4],u=r[5],p=r[6],h=r[7],g=r[8]):({className:l,sideOffset:g,side:p,align:a,anchor:s,children:c,style:h,...u}=e,r[0]=e,r[1]=a,r[2]=s,r[3]=c,r[4]=l,r[5]=u,r[6]=p,r[7]=h,r[8]=g);let _=g===void 0?0:g,v;r[9]===l?v=r[10]:(v=d(`bg-[var(--surface-elevated)] text-[var(--surface-elevated-foreground)] border border-border/60 transition-all duration-150 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 z-50 w-fit origin-[var(--transform-origin)] rounded-xl px-3 py-1.5 typography-meta text-balance overflow-hidden`,l),r[9]=l,r[10]=v);let b;r[11]===h?b=r[12]:(b={...h},r[11]=h,r[12]=b);let x;r[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,m.jsx)(n,{className:`fill-[var(--surface-elevated)] z-50 size-2`}),r[13]=x):x=r[13];let S;r[14]!==c||r[15]!==u||r[16]!==v||r[17]!==b?(S=(0,m.jsxs)(i,{"data-slot":`tooltip-content`,className:v,style:b,...u,children:[c,x]}),r[14]=c,r[15]=u,r[16]=v,r[17]=b,r[18]=S):S=r[18];let C;return r[19]!==a||r[20]!==s||r[21]!==p||r[22]!==_||r[23]!==S?(C=(0,m.jsx)(y,{children:(0,m.jsx)(t,{children:(0,m.jsx)(o,{sideOffset:_,side:p,align:a,anchor:s,className:`z-50`,children:S})})}),r[19]=a,r[20]=s,r[21]=p,r[22]=_,r[23]=S,r[24]=C):C=r[24],C}export{S as i,C as n,b as r,x as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{G as t,H as n,K as r,U as i,V as a,W as o,ot as s,q as c,st as l}from"./vendor-base-ui-CzHs0bHY.js";import{n as u}from"./vendor-react-DlzBev0S.js";import{Jn as d}from"./useMobileNavigationStore-Dr61mYqA.js";var f=u(),p=e(l(),1),m=s(),h=600,g=1600,_=12,v=p.createContext(null),y=class extends p.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function b(e){let t=(0,f.c)(12),n,r,i,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6]):({delayDuration:s,skipDelayDuration:o,delay:r,closeDelay:n,timeout:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c);let l=r??(s===void 0?0:s),u=n??o,d;return t[7]!==i||t[8]!==l||t[9]!==u||t[10]!==c?(d=(0,m.jsx)(a,{delay:l,closeDelay:u,timeout:c,...i}),t[7]=i,t[8]=l,t[9]=u,t[10]=c,t[11]=d):d=t[11],d}function x(e){let t=(0,f.c)(35),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({delayDuration:n,open:i,onOpenChange:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let[o,s]=p.useState(!1),l=p.useRef(null),u=p.useRef(null),d=p.useRef(null),y=p.useRef(!1),x=i!==void 0,S=x?i:o,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},t[5]=C):C=t[5];let w=C,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},t[6]=T):T=t[6];let E=T,D;t[7]===x?D=t[8]:(D=e=>{x||s(e)},t[7]=x,t[8]=D);let O=D,k;t[9]!==x||t[10]!==O?(k=e=>{(e.pointerType===`touch`||e.pointerType===`pen`)&&(w(),E(),d.current={x:e.clientX,y:e.clientY},l.current=window.setTimeout(()=>{x||(y.current=!0,O(!0))},h))},t[9]=x,t[10]=O,t[11]=k):k=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=d.current;if(!t)return;let n=Math.abs(e.clientX-t.x),r=Math.abs(e.clientY-t.y);(n>_||r>_)&&(w(),d.current=null)},t[12]=A):A=t[12];let j;t[13]===O?j=t[14]:(j=()=>{w(),d.current=null,y.current&&(E(),u.current=window.setTimeout(()=>{y.current=!1,O(!1)},g))},t[13]=O,t[14]=j);let M,N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{y.current&&(y.current=!1,e.preventDefault(),e.stopPropagation())},N=e=>{y.current&&e.preventDefault()},t[15]=M,t[16]=N):(M=t[15],N=t[16]);let P;t[17]!==k||t[18]!==j?(P={handlePointerDown:k,handlePointerMove:A,handlePointerEnd:j,handleClickCapture:M,handleContextMenu:N},t[17]=k,t[18]=j,t[19]=P):P=t[19];let F=P,I,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{w(),E()},L=[E,w],t[20]=I,t[21]=L):(I=t[20],L=t[21]),p.useEffect(I,L);let R;t[22]!==x||t[23]!==r?(R=(e,t)=>{x||s(e),r?.(e,t)},t[22]=x,t[23]=r,t[24]=R):R=t[24];let z=R,B;t[25]!==z||t[26]!==a||t[27]!==S?(B=(0,m.jsx)(c,{open:S,onOpenChange:z,...a}),t[25]=z,t[26]=a,t[27]=S,t[28]=B):B=t[28];let V;t[29]!==F||t[30]!==B?(V=(0,m.jsx)(v.Provider,{value:F,children:B}),t[29]=F,t[30]=B,t[31]=V):V=t[31];let H=V;if(n===void 0)return H;let U;return t[32]!==n||t[33]!==H?(U=(0,m.jsx)(b,{delayDuration:n,children:H}),t[32]=n,t[33]=H,t[34]=U):U=t[34],U}function S(e){let t=(0,f.c)(43),n,i,a,o,s,c,l,u,d;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9]):({asChild:n,children:i,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:s,onClickCapture:a,onContextMenu:o,...d}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d);let h=p.useContext(v),g;t[10]!==n||t[11]!==i?(g=n&&p.isValidElement(i)?{render:i}:{children:i},t[10]=n,t[11]=i,t[12]=g):g=t[12];let _=g,b;t[13]!==h||t[14]!==c?(b=e=>{c?.(e),h?.handlePointerDown(e)},t[13]=h,t[14]=c,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l?(x=e=>{l?.(e),h?.handlePointerMove(e)},t[16]=h,t[17]=l,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==u?(S=e=>{u?.(e),h?.handlePointerEnd()},t[19]=h,t[20]=u,t[21]=S):S=t[21];let C;t[22]!==h||t[23]!==s?(C=e=>{s?.(e),h?.handlePointerEnd()},t[22]=h,t[23]=s,t[24]=C):C=t[24];let w;t[25]!==h||t[26]!==a?(w=e=>{h?.handleClickCapture(e),!e.defaultPrevented&&a?.(e)},t[25]=h,t[26]=a,t[27]=w):w=t[27];let T;t[28]!==h||t[29]!==o?(T=e=>{h?.handleContextMenu(e),!e.defaultPrevented&&o?.(e)},t[28]=h,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==d||t[32]!==_||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,m.jsx)(r,{"data-slot":`tooltip-trigger`,onPointerDown:b,onPointerMove:x,onPointerUp:S,onPointerCancel:C,onClickCapture:w,onContextMenu:T,...d,..._}),t[31]=d,t[32]=_,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D;return t[40]!==i||t[41]!==E?(D=(0,m.jsx)(y,{fallback:i,children:E}),t[40]=i,t[41]=E,t[42]=D):D=t[42],D}function C(e){let r=(0,f.c)(25),a,s,c,l,u,p,h,g;r[0]===e?(a=r[1],s=r[2],c=r[3],l=r[4],u=r[5],p=r[6],h=r[7],g=r[8]):({className:l,sideOffset:g,side:p,align:a,anchor:s,children:c,style:h,...u}=e,r[0]=e,r[1]=a,r[2]=s,r[3]=c,r[4]=l,r[5]=u,r[6]=p,r[7]=h,r[8]=g);let _=g===void 0?0:g,v;r[9]===l?v=r[10]:(v=d(`bg-[var(--surface-elevated)] text-[var(--surface-elevated-foreground)] border border-border/60 transition-all duration-150 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 z-50 w-fit origin-[var(--transform-origin)] rounded-xl px-3 py-1.5 typography-meta text-balance overflow-hidden`,l),r[9]=l,r[10]=v);let b;r[11]===h?b=r[12]:(b={...h},r[11]=h,r[12]=b);let x;r[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,m.jsx)(n,{className:`fill-[var(--surface-elevated)] z-50 size-2`}),r[13]=x):x=r[13];let S;r[14]!==c||r[15]!==u||r[16]!==v||r[17]!==b?(S=(0,m.jsxs)(i,{"data-slot":`tooltip-content`,className:v,style:b,...u,children:[c,x]}),r[14]=c,r[15]=u,r[16]=v,r[17]=b,r[18]=S):S=r[18];let C;return r[19]!==a||r[20]!==s||r[21]!==p||r[22]!==_||r[23]!==S?(C=(0,m.jsx)(y,{children:(0,m.jsx)(t,{children:(0,m.jsx)(o,{sideOffset:_,side:p,align:a,anchor:s,className:`z-50`,children:S})})}),r[19]=a,r[20]=s,r[21]=p,r[22]=_,r[23]=S,r[24]=C):C=r[24],C}export{S as i,C as n,b as r,x as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./platform-DMsFWy1a.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";var n=async()=>{if(!e())return null;let{App:n}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),{id:r}=await n.getInfo();if(typeof r!=`string`||!/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(r))throw Error(`Native app identity unavailable`);return r},r=e=>typeof e==`string`&&e.trim().length>0?e.trim():null,i=()=>r(`0.2.38`),a=(e,t)=>r(t)||r(e),o=(e,t)=>{let n=r(e);return n?typeof t!=`number`||!Number.isFinite(t)?n:`${n} (${t})`:null},s=async()=>{let n=i();if(!e())return n;try{let{App:e}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2]));return a((await e.getInfo()).version,n)}catch{return n}},c=async()=>{if(!e())return null;try{let{App:e}=await t(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),n=await e.getInfo(),r=typeof n.build==`string`?n.build.trim():``;if(r.length===0)return null;let i=Number.parseInt(r,10);return Number.isFinite(i)?i:null}catch{return null}},l=class extends Error{code=`mobile_updates_unsupported`;constructor(e=`Mobile OTA updates are only available in the Capacitor native app`){super(e),this.name=`MobileUpdatesUnsupportedError`}};export{s as a,c as i,o as n,n as r,l as t};