@openchambery/web 1.18.2-beta.30 → 1.18.2-beta.32

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 (86) hide show
  1. package/dist/assets/{AgentAvatar-B4fj9PIe.js → AgentAvatar-SFzXgOdv.js} +1 -1
  2. package/dist/assets/AssistantView-BhLt99kH.js +1 -0
  3. package/dist/assets/{ChatContainer-BXit8m8H.js → ChatContainer-BlmxfoFd.js} +40 -40
  4. package/dist/assets/{DiagramView-BdhMAzT0.js → DiagramView-cv-vQB2f.js} +1 -1
  5. package/dist/assets/{FadeInOnReveal-CKKU6fKI.js → FadeInOnReveal-9uJN0g-H.js} +1 -1
  6. package/dist/assets/{Icon-DiIuWOuC.js → Icon-CBdklpKH.js} +1 -1
  7. package/dist/assets/{MarkdownRendererImpl-BtmidffL.js → MarkdownRendererImpl-ClKjHmC-.js} +1 -1
  8. package/dist/assets/{MobileDetailNavigation-UU07EhGy.js → MobileDetailNavigation-CeBAGm8g.js} +1 -1
  9. package/dist/assets/{MobileShareBridge-CIwA1gVb.js → MobileShareBridge-CPF_cu0F.js} +1 -1
  10. package/dist/assets/MobileSurface-RC5BWA3I.js +2 -0
  11. package/dist/assets/{MultiRunWindow-DCOP8Gcw.js → MultiRunWindow-S_3yVTw5.js} +1 -1
  12. package/dist/assets/{OnboardingScreen-CW21rCqC.js → OnboardingScreen-gMGdBXkS.js} +1 -1
  13. package/dist/assets/{OverlayScrollbar-isP804Zw.js → OverlayScrollbar-C3WqFk2J.js} +1 -1
  14. package/dist/assets/{SettingsView-sUF6jjPL.js → SettingsView-CAKZZQz7.js} +6 -6
  15. package/dist/assets/{SettingsWindow--LlmgmdV.js → SettingsWindow-CG98Gozw.js} +1 -1
  16. package/dist/assets/{TerminalView-cFZkmAgN.js → TerminalView-BdiPDeDu.js} +1 -1
  17. package/dist/assets/{ToolOutputDialog-BElR7uDu.js → ToolOutputDialog-D-6Ezjqs.js} +1 -1
  18. package/dist/assets/{appThemeRegistry-BG1qltDX.js → appThemeRegistry-DawdCrT-.js} +2 -2
  19. package/dist/assets/{button-DaAoVF4X.js → button-DimCg1lF.js} +1 -1
  20. package/dist/assets/{clipboard-ByPKHEt8.js → clipboard-DD27ttLy.js} +1 -1
  21. package/dist/assets/{collapsible-BmuQu0dq.js → collapsible-CF7TDu-T.js} +1 -1
  22. package/dist/assets/{context-menu-DlxAp9du.js → context-menu-DB0-VukO.js} +1 -1
  23. package/dist/assets/{desktopHosts-ZK_vkdzL.js → desktopHosts-Tqz56Y0u.js} +1 -1
  24. package/dist/assets/{desktopRelayRestore-CewM6-g5.js → desktopRelayRestore-DgHC01I5.js} +1 -1
  25. package/dist/assets/{diagram-DAE4CZy2.js → diagram-DObb9lfm.js} +1 -1
  26. package/dist/assets/{dialog-CQLvE6F6.js → dialog-M9TJGHb8.js} +1 -1
  27. package/dist/assets/{es-ZHyqPb3M.js → es-Dw9Q-ozz.js} +3 -3
  28. package/dist/assets/{fileQueries-CmWYnRVz.js → fileQueries-BjL2dHDF.js} +1 -1
  29. package/dist/assets/{fr-nXAAl4qu.js → fr-ColDJ2rK.js} +3 -3
  30. package/dist/assets/gitApi-DkIj7msF.js +7 -0
  31. package/dist/assets/{input-XiL2-2gG.js → input-BNj7D6h_.js} +1 -1
  32. package/dist/assets/{insertionBoundaries-CDNLmXA6.js → insertionBoundaries-Ci7W_si4.js} +1 -1
  33. package/dist/assets/{ja-CLcxQZ5K.js → ja-DK2Z5Adv.js} +3 -3
  34. package/dist/assets/{ko-KgjBt0nP.js → ko-BFhsYNY4.js} +3 -3
  35. package/dist/assets/main-Byam6OLJ.js +172 -0
  36. package/dist/assets/{main-Byhyzh0I.js → main-JxXeBGUv.js} +2 -2
  37. package/dist/assets/{markdown-worker-BDyY0vt6.js → markdown-worker-CJ8ooXEK.js} +1 -1
  38. package/dist/assets/{markdownTheme-D-aLQZaM.js → markdownTheme-CziN3c9i.js} +1 -1
  39. package/dist/assets/{miniChat-Cw4DM3Kk.js → miniChat-MBdDWNL8.js} +2 -2
  40. package/dist/assets/{mobile-BkWoFtBb.js → mobile-7J0N2edW.js} +2 -2
  41. package/dist/assets/multirun-BDLm-9p_.js +4 -0
  42. package/dist/assets/{persistence-D1lIuyqO.js → persistence-ZSrLIR97.js} +1 -1
  43. package/dist/assets/pl-9HDNVuJh.js +15 -0
  44. package/dist/assets/{platform-G8Cxe5wN.js → platform-BiSk9jV3.js} +1 -1
  45. package/dist/assets/projectMeta-6Y8eqOct.js +3 -0
  46. package/dist/assets/{pt-BR-B6nleSMM.js → pt-BR-BjC1-fOS.js} +3 -3
  47. package/dist/assets/radio-VgkIFFc0.js +1 -0
  48. package/dist/assets/renderElectronMiniChatApp-DtiL6bi8.js +2 -0
  49. package/dist/assets/renderMobileApp-xWa6AxDE.js +23 -0
  50. package/dist/assets/runtimeConfig-BgAUYwpw.js +2 -0
  51. package/dist/assets/runtimeEndpointReset-CjX8fEqz.js +145 -0
  52. package/dist/assets/{sortable-tabs-strip-C4abQGAg.js → sortable-tabs-strip-Z5_rGG_O.js} +1 -1
  53. package/dist/assets/src-BZ9v9Hhc.css +2 -0
  54. package/dist/assets/{store-BDxgw-Hx.js → store-CNhcDSiX.js} +3 -3
  55. package/dist/assets/{terminalApi-os4uWEou.js → terminalApi-CkknnXhV.js} +1 -1
  56. package/dist/assets/{tooltip-BLugzWq-.js → tooltip-BE6WDmtb.js} +1 -1
  57. package/dist/assets/{uk-KTDMzdyl.js → uk-Dz5dc1bK.js} +3 -3
  58. package/dist/assets/{url-DMs_PgIC.js → url-DQDmlZku.js} +1 -1
  59. package/dist/assets/{useAppFontEffects-DfjqolPi.js → useAppFontEffects-D79ls-ks.js} +4 -4
  60. package/dist/assets/{useDesktopWindowControlsLayout-Dk_J2R2l.js → useDesktopWindowControlsLayout-obujEeM2.js} +1 -1
  61. package/dist/assets/{useEffectiveDirectory-DvwBlXlV.js → useEffectiveDirectory-DFAdHJ0-.js} +1 -1
  62. package/dist/assets/{useFontPreferences-B2QwnhAp.js → useFontPreferences-ZvBF445N.js} +1 -1
  63. package/dist/assets/{useMobileNavigationStore-CtwYvj4I.js → useMobileNavigationStore-BADiWXJ3.js} +21 -21
  64. package/dist/assets/{useSessionAutoCleanup-jK8ZenbX.js → useSessionAutoCleanup-CulttT9K.js} +1 -1
  65. package/dist/assets/{useWorkerHighlightedLines-DCkxJxo9.js → useWorkerHighlightedLines-Cg5oIMcb.js} +1 -1
  66. package/dist/assets/{utils-BxJEIWv5.js → utils-Dh7UZFrA.js} +1 -1
  67. package/dist/assets/{zh-CN-BilLDIh_.js → zh-CN-CK_vXKLC.js} +3 -3
  68. package/dist/assets/{zh-TW-DBDsyRLQ.js → zh-TW-D1PJ5wPO.js} +3 -3
  69. package/dist/index.html +8 -8
  70. package/dist/mini-chat.html +8 -8
  71. package/dist/mobile.html +8 -8
  72. package/package.json +1 -1
  73. package/server/lib/message-queue/DOCUMENTATION.md +1 -1
  74. package/dist/assets/AssistantView-Bn-UFf4Z.js +0 -1
  75. package/dist/assets/MobileSurface-gtthIGYq.js +0 -2
  76. package/dist/assets/gitApi-B11XffZP.js +0 -7
  77. package/dist/assets/main-By-Um3x1.js +0 -172
  78. package/dist/assets/multirun-DvOlESuG.js +0 -4
  79. package/dist/assets/pl-ZJkD7N-8.js +0 -15
  80. package/dist/assets/projectMeta-DMM_G-a5.js +0 -3
  81. package/dist/assets/radio-DQ3ENkQN.js +0 -1
  82. package/dist/assets/renderElectronMiniChatApp-DQWu_vZ6.js +0 -2
  83. package/dist/assets/renderMobileApp-YBH3SUWo.js +0 -23
  84. package/dist/assets/runtimeConfig-w7pmXQY1.js +0 -2
  85. package/dist/assets/runtimeEndpointReset-BcEksuFy.js +0 -145
  86. package/dist/assets/src-De3WpqHP.css +0 -2
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Xt as t,cn as n,kn as r,r as i,un as a,vn as o}from"./persistence-D1lIuyqO.js";import{h as s,i as c,n as l,r as u,v as d}from"./desktopHosts-ZK_vkdzL.js";import{nt as f,rt as p}from"./vendor-base-ui-CnHfUmDN.js";import{n as m}from"./vendor-react-DLPElpoQ.js";import{n as h,t as g}from"./clipboard-ByPKHEt8.js";import{t as _}from"./utils-BxJEIWv5.js";import{n as v}from"./Icon-DiIuWOuC.js";import{t as y}from"./button-DaAoVF4X.js";import{t as b}from"./input-XiL2-2gG.js";var x=m(),S=e(p(),1),C=f();function w(e){switch(e){case`ok`:return null;case`auth`:return`onboarding.remoteConnection.probe.authMessage`;case`update-recommended`:return`onboarding.remoteConnection.probe.updateRecommendedMessage`;case`incompatible`:return`onboarding.remoteConnection.probe.incompatibleMessage`;case`wrong-service`:return`onboarding.remoteConnection.probe.wrongServiceMessage`;case`unreachable`:return`onboarding.remoteConnection.probe.unreachableMessage`;default:return null}}function T(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function E({onBack:e,showBackButton:n=!0,initialUrl:r=``,initialLabel:i=``,isRecoveryMode:o=!1,onConnect:s,onSwitchToLocal:f}){let{t:p}=h(),[m,g]=(0,S.useState)(r),[_,v]=(0,S.useState)(i),[x,E]=(0,S.useState)(`idle`),[D,O]=(0,S.useState)(null),[k,A]=(0,S.useState)(``),j=d(m),M=j?.persistedUrl??null,N=(0,S.useCallback)(e=>{g(e.target.value),E(`idle`),O(null),A(``)},[]),P=(0,S.useCallback)(e=>{v(e.target.value)},[]),F=(0,S.useCallback)(async()=>{if(M){E(`testing`),O(null),A(``);try{let e=await l(M);O(e),E(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),E(`error`)}}},[M,p]),I=(0,S.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;E(`testing`),O(null),A(``);try{let n=await l(e);if(O(n),T(n.status)){E(`error`);return}let r=await u(),i=_.trim()||e,o=r.hosts.find(t=>t.url===e),d=o?o.id:`host-${Date.now().toString(16)}`,f={id:d,label:i,url:e,apiUrl:e},p=o?r.hosts.map(e=>e.id===d?f:e):[...r.hosts,f];if(await c({hosts:p,defaultHostId:d,initialHostChoiceCompleted:!0}),s?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}t()&&await a()}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),E(`error`)}},[j,_,s,p]),L=x===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!T(D?.status??null),B=w(D?.status??null),V=D?.status===`ok`,H=D?.status===`update-recommended`,U=D?.status===`auth`,W=T(D?.status??null);return(0,C.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[n&&(0,C.jsx)(`div`,{className:`flex items-center`,children:(0,C.jsx)(y,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,C.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,C.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(o?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,C.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,C.jsx)(b,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,C.jsx)(b,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),D&&V&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-success)`,color:`var(--status-success)`},children:p(`onboarding.remoteConnection.status.connectedSuccessfully`,{latencyMs:D.latencyMs})}),D&&U&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:p(`onboarding.remoteConnection.status.authWarning`)}),D&&H&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),D&&W&&(0,C.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,C.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,C.jsx)(`div`,{className:`text-xs opacity-80`,children:D.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),k&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:k}),(0,C.jsxs)(`div`,{className:`flex gap-3`,children:[(0,C.jsx)(y,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,C.jsx)(y,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(y,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!o&&f&&(0,C.jsx)(y,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function D(){let e=await r(`/health`);if(!e.ok)return!1;let t=await e.json().catch(()=>null);return t?.openCodeRunning===!0||t?.isOpenCodeReady===!0}async function O(){return(await r(`/api/opencode/retry`,{method:`POST`})).ok?D():!1}var k=`curl -fsSL https://opencode.ai/install | bash`,A=`https://opencode.ai/docs`,j=2500,M=1e4;function N(e){let t=(0,x.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/install`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(v,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,C.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:r,"aria-label":r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function P({onCliAvailable:e}){let{t:s}=h(),[l,d]=S.useState(!1),[f,p]=S.useState(!1),[m,x]=S.useState(!1),[w,T]=S.useState(!1),[P,F]=S.useState(``),[I,L]=S.useState(`unknown`),[R,z]=S.useState(`local`),[B,V]=S.useState(!1),[H,U]=S.useState(!1),[W,G]=S.useState(null),K=S.useRef(!1);S.useEffect(()=>{p(t())},[]),S.useEffect(()=>{if(typeof navigator>`u`){L(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?L(`windows`):/Macintosh|Mac OS X/i.test(e)?L(`macos`):/Linux/i.test(e)?L(`linux`):L(`unknown`)},[]),S.useEffect(()=>{let e=!1;return(async()=>{try{let t=await r(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return;let n=await t.json().catch(()=>null);if(!n||e)return;let i=typeof n.opencodeBinary==`string`?n.opencodeBinary.trim():``;i&&F(i)}catch{}})(),()=>{e=!0}},[]);let q=S.useCallback(async e=>{let t=e.target;t.closest(`.app-region-no-drag`)||t.closest(`button, a, input, select, textarea, code, summary, details`)||e.button===0&&f&&await o()},[f]),J=S.useCallback(async e=>{if(!f)return;let t=await u();await c({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[f]),Y=S.useCallback(async()=>{if(!K.current){K.current=!0;try{f&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[f,e,J]);S.useEffect(()=>{if(R!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await D(),r=Date.now();if(!t&&r-n>=M&&(n=r,t=await O()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,j))}};return t=setTimeout(r,j),()=>{e=!0,t&&clearTimeout(t)}},[R,Y]);let X=S.useCallback(async()=>{T(!0),G(null);try{let e=await D();e||=await O(),e?await Y():G(s(`onboarding.localSetup.errors.cliNotReady`))}catch{G(s(`onboarding.localSetup.errors.detectionFailed`))}finally{T(!1)}},[Y,s]),Z=S.useCallback(async()=>{if(!(typeof window>`u`)&&f)try{let e=await n();e.success&&e.path&&e.path.trim().length>0&&F(e.path.trim())}catch{}},[f]),Q=S.useCallback(async()=>{x(!0);try{if(await i({opencodeBinary:P.trim()}),f){await J(`local`),await a();return}await r(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>x(!1),1e3)}},[f,P,J]),$=S.useCallback(async()=>{let e=await g(k);e.ok?(d(!0),setTimeout(()=>d(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=A,te=I===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:I===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!f||R===`local`;return(0,C.jsx)(`div`,{className:`app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto`,onMouseDown:q,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,C.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:s(`onboarding.chooser.title`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`onboarding.chooser.description`)})]}),f&&(0,C.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,C.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`local`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`local`),children:s(`onboarding.chooser.tabs.localInstall`)}),(0,C.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`remote`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`remote`),children:s(`onboarding.chooser.tabs.connectRemote`)})]}),f&&R===`remote`?(0,C.jsx)(`div`,{className:`app-region-no-drag`,children:(0,C.jsx)(E,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,C.jsxs)(`div`,{className:`space-y-4`,children:[I===`windows`&&(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground`,children:s(`onboarding.localSetup.windows.title`)}),(0,C.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:s(`onboarding.localSetup.intro`)}),(0,C.jsx)(`div`,{className:`app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm`,children:l?(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,C.jsx)(v,{name:`check`,className:`h-4 w-4`}),s(`onboarding.common.status.copiedToClipboard`)]}):(0,C.jsx)(N,{onCopy:$,copyTitle:s(`onboarding.common.copyToClipboard`)})}),(0,C.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,C.jsxs)(`a`,{href:ee,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1`,children:[s(I===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,C.jsx)(v,{name:`external-link`,className:`h-3 w-3`})]}),(0,C.jsx)(`button`,{type:`button`,onClick:X,disabled:w,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:s(w?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,C.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,C.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 flex items-center gap-3`,style:{borderColor:`color-mix(in srgb, var(--primary-base) 20%, transparent)`,backgroundColor:`color-mix(in srgb, var(--primary-base) 6%, transparent)`},role:`status`,"aria-live":`polite`,children:[(0,C.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,C.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,C.jsx)(`span`,{className:`absolute inset-[-4px] rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity-dim 1.6s ease-in-out infinite`,opacity:0}})]}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:s(`onboarding.localSetup.status.watching`)}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:s(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,C.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:B,onToggle:e=>V(e.currentTarget.open),children:[(0,C.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,C.jsx)(`span`,{children:s(`onboarding.localSetup.advanced.title`)}),(0,C.jsx)(v,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,C.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(b,{value:P,onChange:e=>F(e.target.value),placeholder:te,disabled:m,className:`flex-1 font-mono text-xs`}),(0,C.jsx)(y,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:m||!f,children:s(`onboarding.localSetup.actions.browse`)}),(0,C.jsx)(y,{type:`button`,size:`sm`,onClick:Q,disabled:m||!P.trim(),children:s(`onboarding.localSetup.actions.apply`)})]}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:s(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,C.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:H,onToggle:e=>U(e.currentTarget.open),children:[(0,C.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,C.jsx)(`span`,{children:s(`onboarding.localSetup.troubleshoot.title`)}),(0,C.jsx)(v,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,C.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:I===`windows`?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.ensurePath`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.setEnv`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var F=`curl -fsSL https://opencode.ai/install | bash`,I=`https://opencode.ai/docs`;function L(e){let t=(0,x.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsxs)(`code`,{children:[(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/install`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(v,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,C.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors`,title:r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}var R=3e4;function z({onBack:e,onCliAvailable:s,isFromRecovery:c=!1,onSwitchToRemote:l}){let{t:u}=h(),[d,f]=S.useState(!1),[p,m]=S.useState(!1),[_,x]=S.useState(!1),[w,T]=S.useState(!1),[E,k]=S.useState(!1),[A,j]=S.useState(null),[M,N]=S.useState(``),[P,z]=S.useState(`unknown`);S.useEffect(()=>{let e=setTimeout(()=>m(!0),R);return()=>clearTimeout(e)},[]),S.useEffect(()=>{x(t())},[]),S.useEffect(()=>{if(typeof navigator>`u`){z(`unknown`);return}let e=navigator.userAgent||``;if(/Windows/i.test(e)){z(`windows`);return}if(/Macintosh|Mac OS X/i.test(e)){z(`macos`);return}if(/Linux/i.test(e)){z(`linux`);return}z(`unknown`)},[]),S.useEffect(()=>{let e=!1;return(async()=>{try{let t=await r(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return;let n=await t.json().catch(()=>null);if(!n||e)return;let i=typeof n.opencodeBinary==`string`?n.opencodeBinary.trim():``;i&&N(i)}catch{}})(),()=>{e=!0}},[]);let B=S.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&_&&await o()},[_]),V=S.useCallback(async()=>{if(!(typeof window>`u`)&&_)try{let e=await n();e.success&&e.path&&e.path.trim().length>0&&N(e.path.trim())}catch{}},[_]),H=S.useCallback(async()=>{T(!0);try{if(await i({opencodeBinary:M.trim()}),_){await a();return}await r(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>T(!1),1e3)}},[_,M]),U=S.useCallback(async()=>{let e=await g(F);e.ok?(f(!0),setTimeout(()=>f(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=S.useCallback(async()=>{k(!0),j(null);try{let e=await D();e||=await O(),e?s?.():j(u(`onboarding.localSetup.errors.cliNotReady`))}catch(e){j(e instanceof Error?e.message:u(`onboarding.localSetup.errors.detectionFailed`))}finally{k(!1)}},[s,u]),G=I,K=P===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:P===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`;return(0,C.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:B,children:[(0,C.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,C.jsx)(`div`,{className:`flex items-center`,children:(0,C.jsx)(y,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:u(`onboarding.common.actions.back`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:u(`onboarding.localSetup.title`)}),(0,C.jsx)(`p`,{className:`text-muted-foreground`,children:u(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,C.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground`,children:u(`onboarding.localSetup.windows.title`)}),(0,C.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,C.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,C.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,C.jsx)(`div`,{className:`flex justify-center`,children:(0,C.jsx)(`div`,{className:`bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit`,children:d?(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,C.jsx)(v,{name:`check`,className:`h-4 w-4`}),u(`onboarding.common.status.copiedToClipboard`)]}):(0,C.jsx)(L,{onCopy:U,copyTitle:u(`onboarding.common.copyToClipboard`)})})}),(0,C.jsxs)(`a`,{href:G,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center`,children:[u(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,C.jsx)(v,{name:`external-link`,className:`h-3 w-3`})]}),A&&(0,C.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:A}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(y,{type:`button`,onClick:W,disabled:E,className:`w-full max-w-xs`,size:`lg`,children:u(E?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,C.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`onboarding.localSetup.field.alreadyInstalled`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(b,{value:M,onChange:e=>N(e.target.value),placeholder:K,disabled:w,className:`flex-1 font-mono text-xs`}),(0,C.jsx)(y,{type:`button`,variant:`secondary`,onClick:V,disabled:w||!_,children:u(`onboarding.localSetup.actions.browse`)}),(0,C.jsx)(y,{type:`button`,onClick:H,disabled:w,children:u(`onboarding.localSetup.actions.apply`)})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:u(`onboarding.localSetup.helper.saveAndReload`)})]})}),c&&l&&(0,C.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:u(`onboarding.localSetup.remotePreference`)}),(0,C.jsx)(y,{variant:`link`,onClick:l,children:u(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),p&&(0,C.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.ensurePath`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.setEnv`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function B(e,t){if(e?.trim())return s(e.trim());if(t)return s(t)}function V(e,t,n){switch(e){case`local-unavailable`:return{title:`Local OpenCode Unavailable`,description:`OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.`,titleKey:`onboarding.desktopRecovery.localUnavailable.title`,descriptionKey:`onboarding.desktopRecovery.localUnavailable.description`,iconKey:`local`,showRetry:!0,retryLabel:`Retry Local`,retryLabelKey:`onboarding.desktopRecovery.localUnavailable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Set Up Local`,useLocalLabelKey:`onboarding.desktopRecovery.localUnavailable.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-missing`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-unreachable`:{let e=B(t,n);return{title:`Remote Server Unreachable`,description:`Could not connect to "${e||`the remote server`}". Check your network connection and verify the server address.`,titleKey:`onboarding.desktopRecovery.remoteUnreachable.title`,descriptionKey:`onboarding.desktopRecovery.remoteUnreachable.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-wrong-service`:{let e=B(t,n);return{title:`Incompatible Server`,description:`The server at "${e||`unknown`}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:`onboarding.desktopRecovery.incompatibleServer.title`,descriptionKey:`onboarding.desktopRecovery.incompatibleServer.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-incompatible`:{let e=B(t,n);return{title:`Server Update Required`,description:`The OpenChamber server at "${e||`unknown`}" is not compatible with this app version. Update OpenChamber on the server, then try again.`,titleKey:`onboarding.desktopRecovery.remoteIncompatible.title`,descriptionKey:`onboarding.desktopRecovery.remoteIncompatible.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`missing-default-host`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};default:throw Error(`Unknown recovery variant: ${e}`)}}function H(e){switch(e){case`local`:return(0,C.jsx)(v,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,C.jsx)(v,{name:`server`,className:`h-8 w-8`})}}function U({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:c}=h(),l=V(e,t,n),u=l.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,d=S.useMemo(()=>{if(l.descriptionParams?.host)return l.descriptionParams;if(e===`remote-unreachable`)return{host:c(`onboarding.desktopRecovery.placeholders.remoteServer`)};if(e===`remote-wrong-service`||e===`remote-incompatible`)return{host:c(`onboarding.desktopRecovery.placeholders.unknownServer`)}},[l.descriptionParams,c,e]);return(0,C.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,C.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,C.jsx)(`div`,{style:{color:`var(--status-warning)`},children:H(l.iconKey)})}),(0,C.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:c(l.titleKey)}),(0,C.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:c(l.descriptionKey,d)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:c(`onboarding.remoteConnection.field.serverAddress`)}),(0,C.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:s(n)})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l.showRetry&&r&&(0,C.jsxs)(y,{onClick:r,disabled:o,className:`w-full`,children:[(0,C.jsx)(v,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),c(o?`onboarding.desktopRecovery.actions.retrying`:u)]}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[l.showUseLocal&&i&&(0,C.jsxs)(y,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,C.jsx)(v,{name:`macbook`,className:`h-4 w-4`}),c(l.useLocalLabelKey)]}),l.showUseRemote&&a&&(0,C.jsxs)(y,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,C.jsx)(v,{name:`server`,className:`h-4 w-4`}),c(l.useRemoteLabelKey)]})]})]})]})})}function W(e,t){if(t===`use-remote`)return{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-incompatible`:case`remote-wrong-service`:case`remote-missing`:case`missing-default-host`:return{kind:`switch-default-to-local`};default:throw Error(`Unhandled RecoveryVariant: ${e}`)}}function G(e){let n=(0,x.c)(27),{variant:i,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:u,onCloseRemoteForm:d,onSwitchToLocalFromRemote:f,onEnterLocalSetup:p,isRetrying:m}=e,h=u!==void 0&&u,g=m!==void 0&&m,_=K,v;n[0]===c?v=n[1]:(v=async()=>{if(t()){await a();return}await r(`/api/config/reload`,{method:`POST`}),c?.()},n[0]=c,n[1]=v);let y=v,b;n[2]!==p||n[3]!==i?(b=async()=>{if(W(i,`use-local`).kind===`local-setup`){p?.();return}if(await _(`local`),t()){await a();return}window.location.reload()},n[2]=p,n[3]=i,n[4]=b):b=n[4];let S=b,w;n[5]!==l||n[6]!==i?(w=()=>{W(i,`use-remote`).kind===`remote-form`&&l?.()},n[5]=l,n[6]=i,n[7]=w):w=n[7];let T=w;if(h){let e=i===`remote-wrong-service`?``:o||``,r=i===`remote-wrong-service`?``:s||``,c;n[8]!==l||n[9]!==d?(c=d||(()=>l?.()),n[8]=l,n[9]=d,n[10]=c):c=n[10];let u;n[11]!==p||n[12]!==f?(u=f||(()=>{_(`local`).then(()=>{t()?a():p?.()})}),n[11]=p,n[12]=f,n[13]=u):u=n[13];let m;return n[14]!==r||n[15]!==e||n[16]!==c||n[17]!==u?(m=(0,C.jsx)(E,{onBack:c,initialUrl:e,initialLabel:r,isRecoveryMode:!0,onSwitchToLocal:u}),n[14]=r,n[15]=e,n[16]=c,n[17]=u,n[18]=m):m=n[18],m}let D;return n[19]!==y||n[20]!==S||n[21]!==T||n[22]!==s||n[23]!==o||n[24]!==g||n[25]!==i?(D=(0,C.jsx)(U,{variant:i,hostLabel:s,hostUrl:o,onRetry:y,onUseLocal:S,onUseRemote:T,isRetrying:g}),n[19]=y,n[20]=S,n[21]=T,n[22]=s,n[23]=o,n[24]=g,n[25]=i,n[26]=D):D=n[26],D}async function K(e){if(!t())return;let n=await u();await c({...n,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function q(e){let t=(0,x.c)(26),{onBack:n,onCliAvailable:r,mode:i,recoveryVariant:a,recoveryHostUrl:o,recoveryHostLabel:s,onEnterLocalSetup:c}=e,l=i===void 0?`first-launch`:i,u=a===void 0?`missing-default-host`:a,[d,f]=S.useState(!1),[p,m]=S.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1),f(!1)},t[0]=h):h=t[0];let g;t[1]!==l||t[2]!==s||t[3]!==o||t[4]!==u?(g=[l,u,o,s],t[1]=l,t[2]=s,t[3]=o,t[4]=u,t[5]=g):g=t[5],S.useEffect(h,g);let _=p?`local-setup`:l;if(_===`recovery`){let e,n;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>f(!1),n=()=>{f(!1),m(!0)},t[6]=e,t[7]=n):(e=t[6],n=t[7]);let r;t[8]===c?r=t[9]:(r=()=>{m(!0),c?.()},t[8]=c,t[9]=r);let i;return t[10]!==s||t[11]!==o||t[12]!==u||t[13]!==d||t[14]!==r?(i=(0,C.jsx)(G,{variant:u,hostUrl:o,hostLabel:s,showRemoteForm:d,onCloseRemoteForm:e,onSwitchToLocalFromRemote:n,onEnterLocalSetup:r}),t[10]=s,t[11]=o,t[12]=u,t[13]=d,t[14]=r,t[15]=i):i=t[15],i}if(_===`local-setup`){let e;t[16]!==n||t[17]!==p?(e=()=>{p?m(!1):n?.()},t[16]=n,t[17]=p,t[18]=e):e=t[18];let i;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>f(!0),t[19]=i):i=t[19];let a;return t[20]!==r||t[21]!==p||t[22]!==e?(a=(0,C.jsx)(z,{onBack:e,onCliAvailable:r,isFromRecovery:p,onSwitchToRemote:i}),t[20]=r,t[21]=p,t[22]=e,t[23]=a):a=t[23],a}let v;return t[24]===r?v=t[25]:(v=(0,C.jsx)(P,{onCliAvailable:r}),t[24]=r,t[25]=v),v}export{q as OnboardingScreen};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Xt as t,cn as n,kn as r,r as i,un as a,vn as o}from"./persistence-ZSrLIR97.js";import{h as s,i as c,n as l,r as u,v as d}from"./desktopHosts-Tqz56Y0u.js";import{nt as f,rt as p}from"./vendor-base-ui-CnHfUmDN.js";import{n as m}from"./vendor-react-DLPElpoQ.js";import{n as h,t as g}from"./clipboard-DD27ttLy.js";import{t as _}from"./utils-Dh7UZFrA.js";import{n as v}from"./Icon-CBdklpKH.js";import{t as y}from"./button-DimCg1lF.js";import{t as b}from"./input-BNj7D6h_.js";var x=m(),S=e(p(),1),C=f();function w(e){switch(e){case`ok`:return null;case`auth`:return`onboarding.remoteConnection.probe.authMessage`;case`update-recommended`:return`onboarding.remoteConnection.probe.updateRecommendedMessage`;case`incompatible`:return`onboarding.remoteConnection.probe.incompatibleMessage`;case`wrong-service`:return`onboarding.remoteConnection.probe.wrongServiceMessage`;case`unreachable`:return`onboarding.remoteConnection.probe.unreachableMessage`;default:return null}}function T(e){return e===`wrong-service`||e===`unreachable`||e===`incompatible`}function E({onBack:e,showBackButton:n=!0,initialUrl:r=``,initialLabel:i=``,isRecoveryMode:o=!1,onConnect:s,onSwitchToLocal:f}){let{t:p}=h(),[m,g]=(0,S.useState)(r),[_,v]=(0,S.useState)(i),[x,E]=(0,S.useState)(`idle`),[D,O]=(0,S.useState)(null),[k,A]=(0,S.useState)(``),j=d(m),M=j?.persistedUrl??null,N=(0,S.useCallback)(e=>{g(e.target.value),E(`idle`),O(null),A(``)},[]),P=(0,S.useCallback)(e=>{v(e.target.value)},[]),F=(0,S.useCallback)(async()=>{if(M){E(`testing`),O(null),A(``);try{let e=await l(M);O(e),E(e.status===`ok`||e.status===`update-recommended`?`success`:`error`)}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.connectionTestFailed`)),E(`error`)}}},[M,p]),I=(0,S.useCallback)(async()=>{if(!j)return;let e=j.persistedUrl;E(`testing`),O(null),A(``);try{let n=await l(e);if(O(n),T(n.status)){E(`error`);return}let r=await u(),i=_.trim()||e,o=r.hosts.find(t=>t.url===e),d=o?o.id:`host-${Date.now().toString(16)}`,f={id:d,label:i,url:e,apiUrl:e},p=o?r.hosts.map(e=>e.id===d?f:e):[...r.hosts,f];if(await c({hosts:p,defaultHostId:d,initialHostChoiceCompleted:!0}),s?.(),j.redeemUrl){window.location.assign(j.redeemUrl);return}t()&&await a()}catch(e){A(e instanceof Error?e.message:p(`onboarding.remoteConnection.errors.failedToSaveConnection`)),E(`error`)}},[j,_,s,p]),L=x===`testing`,R=M!==null&&!L,z=M!==null&&!L&&!T(D?.status??null),B=w(D?.status??null),V=D?.status===`ok`,H=D?.status===`update-recommended`,U=D?.status===`auth`,W=T(D?.status??null);return(0,C.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[n&&(0,C.jsx)(`div`,{className:`flex items-center`,children:(0,C.jsx)(y,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:p(`onboarding.common.actions.back`)})}),(0,C.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,C.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:p(o?`onboarding.remoteConnection.titleRecovery`:`onboarding.remoteConnection.title`)}),(0,C.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:p(`onboarding.remoteConnection.description`)})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{htmlFor:`remote-url`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.serverAddress`)}),(0,C.jsx)(b,{id:`remote-url`,type:`url`,value:m,onChange:N,placeholder:p(`onboarding.remoteConnection.field.serverAddressPlaceholder`),disabled:L})]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{htmlFor:`remote-label`,className:`text-sm text-foreground`,children:p(`onboarding.remoteConnection.field.nameOptional`)}),(0,C.jsx)(b,{id:`remote-label`,type:`text`,value:_,onChange:P,placeholder:p(`onboarding.remoteConnection.field.namePlaceholder`),disabled:L})]})]}),D&&V&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-success)`,color:`var(--status-success)`},children:p(`onboarding.remoteConnection.status.connectedSuccessfully`,{latencyMs:D.latencyMs})}),D&&U&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:p(`onboarding.remoteConnection.status.authWarning`)}),D&&H&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-warning)`,color:`var(--status-warning)`},children:B?p(B):null}),D&&W&&(0,C.jsxs)(`div`,{className:`rounded-lg border p-3 text-sm space-y-3`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-semibold mb-1`,children:p(`onboarding.remoteConnection.status.connectionFailed`)}),(0,C.jsx)(`div`,{className:`opacity-90`,children:B?p(B):null})]}),(0,C.jsx)(`div`,{className:`text-xs opacity-80`,children:D.status===`unreachable`?p(`onboarding.remoteConnection.status.suggestionsUnreachable`):p(`onboarding.remoteConnection.status.suggestionsWrongService`)})]}),k&&(0,C.jsx)(`div`,{className:`rounded-lg border p-3 text-sm`,style:{borderColor:`var(--status-error)`,color:`var(--status-error)`},children:k}),(0,C.jsxs)(`div`,{className:`flex gap-3`,children:[(0,C.jsx)(y,{variant:`outline`,onClick:F,disabled:!R,children:p(L?`onboarding.remoteConnection.actions.testing`:`onboarding.remoteConnection.actions.testConnection`)}),(0,C.jsx)(y,{onClick:I,disabled:!z,children:p(`onboarding.remoteConnection.actions.connectAndRestart`)})]}),W&&(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 border-t border-border`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:p(`onboarding.remoteConnection.actions.whatToDo`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(y,{variant:`outline`,size:`sm`,onClick:e,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.chooseDifferentServer`)}),!o&&f&&(0,C.jsx)(y,{variant:`outline`,size:`sm`,onClick:f,className:`flex-1`,children:p(`onboarding.remoteConnection.actions.useLocalInstead`)})]})]})]})})}async function D(){let e=await r(`/health`);if(!e.ok)return!1;let t=await e.json().catch(()=>null);return t?.openCodeRunning===!0||t?.isOpenCodeReady===!0}async function O(){return(await r(`/api/opencode/retry`,{method:`POST`})).ok?D():!1}var k=`curl -fsSL https://opencode.ai/install | bash`,A=`https://opencode.ai/docs`,j=2500,M=1e4;function N(e){let t=(0,x.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsxs)(`code`,{className:`flex-1 text-left overflow-x-auto whitespace-nowrap`,children:[(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/install`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(v,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 w-full`,children:[i,(0,C.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:r,"aria-label":r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function P({onCliAvailable:e}){let{t:s}=h(),[l,d]=S.useState(!1),[f,p]=S.useState(!1),[m,x]=S.useState(!1),[w,T]=S.useState(!1),[P,F]=S.useState(``),[I,L]=S.useState(`unknown`),[R,z]=S.useState(`local`),[B,V]=S.useState(!1),[H,U]=S.useState(!1),[W,G]=S.useState(null),K=S.useRef(!1);S.useEffect(()=>{p(t())},[]),S.useEffect(()=>{if(typeof navigator>`u`){L(`unknown`);return}let e=navigator.userAgent||``;/Windows/i.test(e)?L(`windows`):/Macintosh|Mac OS X/i.test(e)?L(`macos`):/Linux/i.test(e)?L(`linux`):L(`unknown`)},[]),S.useEffect(()=>{let e=!1;return(async()=>{try{let t=await r(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return;let n=await t.json().catch(()=>null);if(!n||e)return;let i=typeof n.opencodeBinary==`string`?n.opencodeBinary.trim():``;i&&F(i)}catch{}})(),()=>{e=!0}},[]);let q=S.useCallback(async e=>{let t=e.target;t.closest(`.app-region-no-drag`)||t.closest(`button, a, input, select, textarea, code, summary, details`)||e.button===0&&f&&await o()},[f]),J=S.useCallback(async e=>{if(!f)return;let t=await u();await c({...t,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})},[f]),Y=S.useCallback(async()=>{if(!K.current){K.current=!0;try{f&&await J(`local`),await e?.()}catch(e){throw K.current=!1,e}}},[f,e,J]);S.useEffect(()=>{if(R!==`local`)return;let e=!1,t=null,n=0,r=async()=>{if(!e){try{let t=await D(),r=Date.now();if(!t&&r-n>=M&&(n=r,t=await O()),e)return;if(t){await Y();return}}catch{}e||(t=setTimeout(r,j))}};return t=setTimeout(r,j),()=>{e=!0,t&&clearTimeout(t)}},[R,Y]);let X=S.useCallback(async()=>{T(!0),G(null);try{let e=await D();e||=await O(),e?await Y():G(s(`onboarding.localSetup.errors.cliNotReady`))}catch{G(s(`onboarding.localSetup.errors.detectionFailed`))}finally{T(!1)}},[Y,s]),Z=S.useCallback(async()=>{if(!(typeof window>`u`)&&f)try{let e=await n();e.success&&e.path&&e.path.trim().length>0&&F(e.path.trim())}catch{}},[f]),Q=S.useCallback(async()=>{x(!0);try{if(await i({opencodeBinary:P.trim()}),f){await J(`local`),await a();return}await r(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>x(!1),1e3)}},[f,P,J]),$=S.useCallback(async()=>{let e=await g(k);e.ok?(d(!0),setTimeout(()=>d(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),ee=A,te=I===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:I===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`,ne=!f||R===`local`;return(0,C.jsx)(`div`,{className:`app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto`,onMouseDown:q,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-7`,children:[(0,C.jsxs)(`header`,{className:`text-center space-y-1.5`,children:[(0,C.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground`,children:s(`onboarding.chooser.title`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s(`onboarding.chooser.description`)})]}),f&&(0,C.jsxs)(`div`,{className:`app-region-no-drag flex gap-1.5`,children:[(0,C.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`local`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`local`),children:s(`onboarding.chooser.tabs.localInstall`)}),(0,C.jsx)(`button`,{type:`button`,className:_(`flex-1 px-4 py-2 rounded-lg border transition-colors text-sm`,R===`remote`?`border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10`:`border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground`),onClick:()=>z(`remote`),children:s(`onboarding.chooser.tabs.connectRemote`)})]}),f&&R===`remote`?(0,C.jsx)(`div`,{className:`app-region-no-drag`,children:(0,C.jsx)(E,{onBack:()=>z(`local`),showBackButton:!1,onSwitchToLocal:()=>z(`local`)})}):null,ne&&(0,C.jsxs)(`div`,{className:`space-y-4`,children:[I===`windows`&&(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-4`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground`,children:s(`onboarding.localSetup.windows.title`)}),(0,C.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground text-center leading-relaxed`,children:s(`onboarding.localSetup.intro`)}),(0,C.jsx)(`div`,{className:`app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm`,children:l?(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,style:{color:`var(--status-success)`},children:[(0,C.jsx)(v,{name:`check`,className:`h-4 w-4`}),s(`onboarding.common.status.copiedToClipboard`)]}):(0,C.jsx)(N,{onCopy:$,copyTitle:s(`onboarding.common.copyToClipboard`)})}),(0,C.jsxs)(`div`,{className:`app-region-no-drag flex items-center justify-between`,children:[(0,C.jsxs)(`a`,{href:ee,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1`,children:[s(I===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,C.jsx)(v,{name:`external-link`,className:`h-3 w-3`})]}),(0,C.jsx)(`button`,{type:`button`,onClick:X,disabled:w,className:`text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,children:s(w?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkNow`)})]}),W&&(0,C.jsx)(`p`,{role:`alert`,className:`text-center text-xs text-[var(--status-error-foreground)]`,children:W}),(0,C.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 flex items-center gap-3`,style:{borderColor:`color-mix(in srgb, var(--primary-base) 20%, transparent)`,backgroundColor:`color-mix(in srgb, var(--primary-base) 6%, transparent)`},role:`status`,"aria-live":`polite`,children:[(0,C.jsxs)(`span`,{className:`relative inline-flex h-2.5 w-2.5 shrink-0`,"aria-hidden":!0,children:[(0,C.jsx)(`span`,{className:`absolute inset-0 rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity 1.6s ease-in-out infinite`}}),(0,C.jsx)(`span`,{className:`absolute inset-[-4px] rounded-full`,style:{backgroundColor:`var(--primary-base)`,animation:`pulse-opacity-dim 1.6s ease-in-out infinite`,opacity:0}})]}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground leading-tight`,children:s(`onboarding.localSetup.status.watching`)}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground leading-tight mt-0.5`,children:s(`onboarding.localSetup.status.autoContinue`)})]})]}),(0,C.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:B,onToggle:e=>V(e.currentTarget.open),children:[(0,C.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,C.jsx)(`span`,{children:s(`onboarding.localSetup.advanced.title`)}),(0,C.jsx)(v,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,C.jsxs)(`div`,{className:`pb-4 space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(b,{value:P,onChange:e=>F(e.target.value),placeholder:te,disabled:m,className:`flex-1 font-mono text-xs`}),(0,C.jsx)(y,{type:`button`,variant:`secondary`,size:`sm`,onClick:Z,disabled:m||!f,children:s(`onboarding.localSetup.actions.browse`)}),(0,C.jsx)(y,{type:`button`,size:`sm`,onClick:Q,disabled:m||!P.trim(),children:s(`onboarding.localSetup.actions.apply`)})]}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:s(`onboarding.localSetup.helper.saveAndReload`)})]})]}),(0,C.jsxs)(`details`,{className:`app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors`,open:H,onToggle:e=>U(e.currentTarget.open),children:[(0,C.jsxs)(`summary`,{className:`flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden`,children:[(0,C.jsx)(`span`,{children:s(`onboarding.localSetup.troubleshoot.title`)}),(0,C.jsx)(v,{name:`arrow-down-s`,className:`h-4 w-4 transition-transform group-open:rotate-180`})]}),(0,C.jsx)(`ul`,{className:`pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4`,children:I===`windows`?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.ensurePath`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.setEnv`)}),(0,C.jsx)(`li`,{children:s(`onboarding.localSetup.hint.missingRuntime`)})]})})]})]})]})})}var F=`curl -fsSL https://opencode.ai/install | bash`,I=`https://opencode.ai/docs`;function L(e){let t=(0,x.c)(5),{onCopy:n,copyTitle:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsxs)(`code`,{children:[(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`curl`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` -fsSL `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-string)`},children:`https://opencode.ai/install`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:` | `}),(0,C.jsx)(`span`,{style:{color:`var(--syntax-keyword)`},children:`bash`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,C.jsx)(v,{name:`file-copy`,className:`h-4 w-4`}),t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[i,(0,C.jsx)(`button`,{onClick:n,className:`inline-flex items-center text-muted-foreground hover:text-foreground transition-colors`,title:r,children:a})]}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}var R=3e4;function z({onBack:e,onCliAvailable:s,isFromRecovery:c=!1,onSwitchToRemote:l}){let{t:u}=h(),[d,f]=S.useState(!1),[p,m]=S.useState(!1),[_,x]=S.useState(!1),[w,T]=S.useState(!1),[E,k]=S.useState(!1),[A,j]=S.useState(null),[M,N]=S.useState(``),[P,z]=S.useState(`unknown`);S.useEffect(()=>{let e=setTimeout(()=>m(!0),R);return()=>clearTimeout(e)},[]),S.useEffect(()=>{x(t())},[]),S.useEffect(()=>{if(typeof navigator>`u`){z(`unknown`);return}let e=navigator.userAgent||``;if(/Windows/i.test(e)){z(`windows`);return}if(/Macintosh|Mac OS X/i.test(e)){z(`macos`);return}if(/Linux/i.test(e)){z(`linux`);return}z(`unknown`)},[]),S.useEffect(()=>{let e=!1;return(async()=>{try{let t=await r(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return;let n=await t.json().catch(()=>null);if(!n||e)return;let i=typeof n.opencodeBinary==`string`?n.opencodeBinary.trim():``;i&&N(i)}catch{}})(),()=>{e=!0}},[]);let B=S.useCallback(async e=>{e.target.closest(`button, a, input, select, textarea, code`)||e.button===0&&_&&await o()},[_]),V=S.useCallback(async()=>{if(!(typeof window>`u`)&&_)try{let e=await n();e.success&&e.path&&e.path.trim().length>0&&N(e.path.trim())}catch{}},[_]),H=S.useCallback(async()=>{T(!0);try{if(await i({opencodeBinary:M.trim()}),_){await a();return}await r(`/api/config/reload`,{method:`POST`})}finally{setTimeout(()=>T(!1),1e3)}},[_,M]),U=S.useCallback(async()=>{let e=await g(F);e.ok?(f(!0),setTimeout(()=>f(!1),2e3)):console.error(`Failed to copy:`,e.error)},[]),W=S.useCallback(async()=>{k(!0),j(null);try{let e=await D();e||=await O(),e?s?.():j(u(`onboarding.localSetup.errors.cliNotReady`))}catch(e){j(e instanceof Error?e.message:u(`onboarding.localSetup.errors.detectionFailed`))}finally{k(!1)}},[s,u]),G=I,K=P===`windows`?`C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd`:P===`linux`?`/home/you/.bun/bin/opencode`:`/Users/you/.bun/bin/opencode`;return(0,C.jsxs)(`div`,{className:`h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none`,onMouseDown:B,children:[(0,C.jsxs)(`div`,{className:`w-full max-w-lg space-y-4 text-center`,children:[(0,C.jsx)(`div`,{className:`flex items-center`,children:(0,C.jsx)(y,{variant:`ghost`,onClick:e,className:`p-0 text-muted-foreground hover:text-foreground`,children:u(`onboarding.common.actions.back`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:u(`onboarding.localSetup.title`)}),(0,C.jsx)(`p`,{className:`text-muted-foreground`,children:u(`onboarding.localSetup.description`)})]}),P===`windows`&&(0,C.jsxs)(`div`,{className:`mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left`,children:[(0,C.jsx)(`div`,{className:`text-sm text-foreground`,children:u(`onboarding.localSetup.windows.title`)}),(0,C.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground`,children:[(0,C.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepRunInstallInWsl`)}),(0,C.jsx)(`li`,{children:u(`onboarding.localSetup.windows.stepSetBinaryPath`)})]})]}),(0,C.jsx)(`div`,{className:`flex justify-center`,children:(0,C.jsx)(`div`,{className:`bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit`,children:d?(0,C.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,style:{color:`var(--status-success)`},children:[(0,C.jsx)(v,{name:`check`,className:`h-4 w-4`}),u(`onboarding.common.status.copiedToClipboard`)]}):(0,C.jsx)(L,{onCopy:U,copyTitle:u(`onboarding.common.copyToClipboard`)})})}),(0,C.jsxs)(`a`,{href:G,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center`,children:[u(P===`windows`?`onboarding.localSetup.docs.windows`:`onboarding.localSetup.docs.default`),(0,C.jsx)(v,{name:`external-link`,className:`h-3 w-3`})]}),A&&(0,C.jsx)(`div`,{className:`mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:A}),(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(y,{type:`button`,onClick:W,disabled:E,className:`w-full max-w-xs`,size:`lg`,children:u(E?`onboarding.localSetup.actions.checking`:`onboarding.localSetup.actions.checkAndContinue`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`onboarding.localSetup.helper.checkAndContinue`)})]}),(0,C.jsx)(`div`,{className:`mx-auto w-full max-w-xl pt-4`,children:(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u(`onboarding.localSetup.field.alreadyInstalled`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(b,{value:M,onChange:e=>N(e.target.value),placeholder:K,disabled:w,className:`flex-1 font-mono text-xs`}),(0,C.jsx)(y,{type:`button`,variant:`secondary`,onClick:V,disabled:w||!_,children:u(`onboarding.localSetup.actions.browse`)}),(0,C.jsx)(y,{type:`button`,onClick:H,disabled:w,children:u(`onboarding.localSetup.actions.apply`)})]}),(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground/70`,children:u(`onboarding.localSetup.helper.saveAndReload`)})]})}),c&&l&&(0,C.jsxs)(`div`,{className:`text-center pt-4`,children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:u(`onboarding.localSetup.remotePreference`)}),(0,C.jsx)(y,{variant:`link`,onClick:l,children:u(`onboarding.localSetup.actions.connectRemoteServer`)})]})]}),p&&(0,C.jsx)(`div`,{className:`absolute bottom-8 left-0 right-0 text-center space-y-1`,children:P===`windows`?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.windows.hintDetectionFailed`)})}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.ensurePath`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.setEnv`)}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground/70`,children:u(`onboarding.localSetup.hint.missingRuntime`)})]})})]})}function B(e,t){if(e?.trim())return s(e.trim());if(t)return s(t)}function V(e,t,n){switch(e){case`local-unavailable`:return{title:`Local OpenCode Unavailable`,description:`OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.`,titleKey:`onboarding.desktopRecovery.localUnavailable.title`,descriptionKey:`onboarding.desktopRecovery.localUnavailable.description`,iconKey:`local`,showRetry:!0,retryLabel:`Retry Local`,retryLabelKey:`onboarding.desktopRecovery.localUnavailable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Set Up Local`,useLocalLabelKey:`onboarding.desktopRecovery.localUnavailable.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-missing`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};case`remote-unreachable`:{let e=B(t,n);return{title:`Remote Server Unreachable`,description:`Could not connect to "${e||`the remote server`}". Check your network connection and verify the server address.`,titleKey:`onboarding.desktopRecovery.remoteUnreachable.title`,descriptionKey:`onboarding.desktopRecovery.remoteUnreachable.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-wrong-service`:{let e=B(t,n);return{title:`Incompatible Server`,description:`The server at "${e||`unknown`}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:`onboarding.desktopRecovery.incompatibleServer.title`,descriptionKey:`onboarding.desktopRecovery.incompatibleServer.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`remote-incompatible`:{let e=B(t,n);return{title:`Server Update Required`,description:`The OpenChamber server at "${e||`unknown`}" is not compatible with this app version. Update OpenChamber on the server, then try again.`,titleKey:`onboarding.desktopRecovery.remoteIncompatible.title`,descriptionKey:`onboarding.desktopRecovery.remoteIncompatible.description`,descriptionParams:e?{host:e}:void 0,iconKey:`remote`,showRetry:!0,retryLabel:`Retry Connection`,retryLabelKey:`onboarding.desktopRecovery.remoteUnreachable.retry`,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`}}case`missing-default-host`:return{title:`No Default Connection`,description:`Your saved default connection could not be found. Choose how you want to connect.`,titleKey:`onboarding.desktopRecovery.noDefaultConnection.title`,descriptionKey:`onboarding.desktopRecovery.noDefaultConnection.description`,iconKey:`local`,showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:`Use Local`,useLocalLabelKey:`onboarding.desktopRecovery.common.useLocal`,useRemoteLabel:`Use Remote`,useRemoteLabelKey:`onboarding.desktopRecovery.common.useRemote`};default:throw Error(`Unknown recovery variant: ${e}`)}}function H(e){switch(e){case`local`:return(0,C.jsx)(v,{name:`macbook`,className:`h-8 w-8`});case`remote`:return(0,C.jsx)(v,{name:`server`,className:`h-8 w-8`})}}function U({variant:e,hostLabel:t,hostUrl:n,onRetry:r,onUseLocal:i,onUseRemote:a,isRetrying:o=!1}){let{t:c}=h(),l=V(e,t,n),u=l.retryLabelKey??`onboarding.desktopRecovery.actions.retryConnection`,d=S.useMemo(()=>{if(l.descriptionParams?.host)return l.descriptionParams;if(e===`remote-unreachable`)return{host:c(`onboarding.desktopRecovery.placeholders.remoteServer`)};if(e===`remote-wrong-service`||e===`remote-incompatible`)return{host:c(`onboarding.desktopRecovery.placeholders.unknownServer`)}},[l.descriptionParams,c,e]);return(0,C.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-8`,children:(0,C.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col items-center space-y-3 text-center`,children:[(0,C.jsx)(`div`,{className:`p-3 rounded-full`,style:{backgroundColor:`var(--status-warning)`,opacity:.15},children:(0,C.jsx)(`div`,{style:{color:`var(--status-warning)`},children:H(l.iconKey)})}),(0,C.jsx)(`h1`,{className:`typography-ui-header text-xl font-semibold text-foreground`,children:c(l.titleKey)}),(0,C.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-sm`,children:c(l.descriptionKey,d)})]}),n&&(e===`remote-unreachable`||e===`remote-wrong-service`||e===`remote-incompatible`)&&(0,C.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/50 p-3`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:c(`onboarding.remoteConnection.field.serverAddress`)}),(0,C.jsx)(`div`,{className:`font-mono text-sm text-foreground truncate`,children:s(n)})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l.showRetry&&r&&(0,C.jsxs)(y,{onClick:r,disabled:o,className:`w-full`,children:[(0,C.jsx)(v,{name:`refresh`,className:_(`h-4 w-4`,o&&`animate-spin`)}),c(o?`onboarding.desktopRecovery.actions.retrying`:u)]}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[l.showUseLocal&&i&&(0,C.jsxs)(y,{variant:`outline`,onClick:i,disabled:o,className:`flex-1`,children:[(0,C.jsx)(v,{name:`macbook`,className:`h-4 w-4`}),c(l.useLocalLabelKey)]}),l.showUseRemote&&a&&(0,C.jsxs)(y,{variant:`outline`,onClick:a,disabled:o,className:`flex-1`,children:[(0,C.jsx)(v,{name:`server`,className:`h-4 w-4`}),c(l.useRemoteLabelKey)]})]})]})]})})}function W(e,t){if(t===`use-remote`)return{kind:`remote-form`};switch(e){case`local-unavailable`:return{kind:`local-setup`};case`remote-unreachable`:case`remote-incompatible`:case`remote-wrong-service`:case`remote-missing`:case`missing-default-host`:return{kind:`switch-default-to-local`};default:throw Error(`Unhandled RecoveryVariant: ${e}`)}}function G(e){let n=(0,x.c)(27),{variant:i,hostUrl:o,hostLabel:s,onRetry:c,onChooseRemote:l,showRemoteForm:u,onCloseRemoteForm:d,onSwitchToLocalFromRemote:f,onEnterLocalSetup:p,isRetrying:m}=e,h=u!==void 0&&u,g=m!==void 0&&m,_=K,v;n[0]===c?v=n[1]:(v=async()=>{if(t()){await a();return}await r(`/api/config/reload`,{method:`POST`}),c?.()},n[0]=c,n[1]=v);let y=v,b;n[2]!==p||n[3]!==i?(b=async()=>{if(W(i,`use-local`).kind===`local-setup`){p?.();return}if(await _(`local`),t()){await a();return}window.location.reload()},n[2]=p,n[3]=i,n[4]=b):b=n[4];let S=b,w;n[5]!==l||n[6]!==i?(w=()=>{W(i,`use-remote`).kind===`remote-form`&&l?.()},n[5]=l,n[6]=i,n[7]=w):w=n[7];let T=w;if(h){let e=i===`remote-wrong-service`?``:o||``,r=i===`remote-wrong-service`?``:s||``,c;n[8]!==l||n[9]!==d?(c=d||(()=>l?.()),n[8]=l,n[9]=d,n[10]=c):c=n[10];let u;n[11]!==p||n[12]!==f?(u=f||(()=>{_(`local`).then(()=>{t()?a():p?.()})}),n[11]=p,n[12]=f,n[13]=u):u=n[13];let m;return n[14]!==r||n[15]!==e||n[16]!==c||n[17]!==u?(m=(0,C.jsx)(E,{onBack:c,initialUrl:e,initialLabel:r,isRecoveryMode:!0,onSwitchToLocal:u}),n[14]=r,n[15]=e,n[16]=c,n[17]=u,n[18]=m):m=n[18],m}let D;return n[19]!==y||n[20]!==S||n[21]!==T||n[22]!==s||n[23]!==o||n[24]!==g||n[25]!==i?(D=(0,C.jsx)(U,{variant:i,hostLabel:s,hostUrl:o,onRetry:y,onUseLocal:S,onUseRemote:T,isRetrying:g}),n[19]=y,n[20]=S,n[21]=T,n[22]=s,n[23]=o,n[24]=g,n[25]=i,n[26]=D):D=n[26],D}async function K(e){if(!t())return;let n=await u();await c({...n,...e===`local`?{defaultHostId:`local`}:{},initialHostChoiceCompleted:!0})}function q(e){let t=(0,x.c)(26),{onBack:n,onCliAvailable:r,mode:i,recoveryVariant:a,recoveryHostUrl:o,recoveryHostLabel:s,onEnterLocalSetup:c}=e,l=i===void 0?`first-launch`:i,u=a===void 0?`missing-default-host`:a,[d,f]=S.useState(!1),[p,m]=S.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1),f(!1)},t[0]=h):h=t[0];let g;t[1]!==l||t[2]!==s||t[3]!==o||t[4]!==u?(g=[l,u,o,s],t[1]=l,t[2]=s,t[3]=o,t[4]=u,t[5]=g):g=t[5],S.useEffect(h,g);let _=p?`local-setup`:l;if(_===`recovery`){let e,n;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>f(!1),n=()=>{f(!1),m(!0)},t[6]=e,t[7]=n):(e=t[6],n=t[7]);let r;t[8]===c?r=t[9]:(r=()=>{m(!0),c?.()},t[8]=c,t[9]=r);let i;return t[10]!==s||t[11]!==o||t[12]!==u||t[13]!==d||t[14]!==r?(i=(0,C.jsx)(G,{variant:u,hostUrl:o,hostLabel:s,showRemoteForm:d,onCloseRemoteForm:e,onSwitchToLocalFromRemote:n,onEnterLocalSetup:r}),t[10]=s,t[11]=o,t[12]=u,t[13]=d,t[14]=r,t[15]=i):i=t[15],i}if(_===`local-setup`){let e;t[16]!==n||t[17]!==p?(e=()=>{p?m(!1):n?.()},t[16]=n,t[17]=p,t[18]=e):e=t[18];let i;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>f(!0),t[19]=i):i=t[19];let a;return t[20]!==r||t[21]!==p||t[22]!==e?(a=(0,C.jsx)(z,{onBack:e,onCliAvailable:r,isFromRecovery:p,onSwitchToRemote:i}),t[20]=r,t[21]=p,t[22]=e,t[23]=a):a=t[23],a}let v;return t[24]===r?v=t[25]:(v=(0,C.jsx)(P,{onCliAvailable:r}),t[24]=r,t[25]=v),v}export{q as OnboardingScreen};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/rolldown-runtime-C0FnF6B9.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t,Xt as n}from"./persistence-D1lIuyqO.js";import{nt as r,rt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./platform-G8Cxe5wN.js";import{o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{t as c}from"./utils-BxJEIWv5.js";var l=e(i(),1),u=s(),ee=.85,d=1.2,f=`openchamber.designPtScale.v1`;function p(e){return!Number.isFinite(e)||e<=0?1:Math.min(d,Math.max(ee,e))}function m(e){if(!e)return 1;let t=e.density,n=(e.xdpi+e.ydpi)/2;return!(t>0)||!(n>=50)||n>800?1:p(n/t/163)}function h(){if(typeof window>`u`)return 1;try{return p(Number.parseFloat(window.localStorage.getItem(`openchamber.designPtScale.v1`)??``))}catch{return 1}}function g(e){if(!(typeof window>`u`))try{window.localStorage.setItem(f,String(e))}catch{}}function _(e,t=document.documentElement){let n=p(e);t.style.setProperty(`--dpt`,`${n}px`)}async function v(){if(typeof document>`u`)return 1;let e=h();_(e);let{Capacitor:t,registerPlugin:n}=await o(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!t.isNativePlatform()||t.getPlatform()!==`android`)return _(1),1;if(!t.isPluginAvailable(`OpenChamberPhysicalScale`))return e;try{let e=m(await n(`OpenChamberPhysicalScale`).getMetrics());return g(e),_(e),e}catch{return e}}var y={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},b={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},x=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,te=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},S=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),_(e?1:h(),r)};function C(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,u=n()||t()||x(),{isExplicitTablet:ee}=te(l),d=s||c||l>0,f=s||c,p=e>y.md&&e<=y.lg,m=e<=y.md,h=d&&m,g=d&&!h&&(p||ee),_=!d||!g&&e>y.lg,v=`desktop`;u?(h=!1,g=!1,_=!0,v=`desktop`):a()?(h=!0,g=!1,_=!1,v=`mobile`):h?v=`mobile`:g?v=`tablet`:(_=!0,v=`desktop`),S(u,v,d);let b=`xs`;for(let[t,n]of Object.entries(y))e>=n&&(b=t);return{isMobile:h,isTablet:g,isDesktop:_,deviceType:v,screenWidth:e,breakpoint:b,hasTouchInput:d,hasTouchOnlyPointer:f}}var ne=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,w=new Set,T=null,E,D=null,O=()=>typeof window>`u`?b:(T||=C(),T),re=()=>{for(let e of w)e()},k=()=>{E=void 0;let e=C();T&&ne(T,e)||(T=e,re())},A=()=>{typeof window>`u`||E!==void 0||(E=window.requestAnimationFrame(k))},j=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},M=()=>{if(typeof window>`u`)return()=>{};T=C(),window.addEventListener(`resize`,A);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=j(e,A),r=j(t,A);return()=>{window.removeEventListener(`resize`,A),n(),r(),E!==void 0&&(window.cancelAnimationFrame(E),E=void 0)}},N=e=>typeof window>`u`?()=>{}:(w.add(e),D||=M(),()=>{w.delete(e),w.size===0&&D&&(D(),D=null,T=null)});function P(){if(typeof window>`u`||typeof window<`u`&&n())return!1;let e=document.documentElement,t=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return t===`1`||t===`true`}var F=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),I=()=>{if(typeof window>`u`||n())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return F()&&e>0&&window.innerWidth>y.md};function L(){let e=(0,u.c)(2),[t,n]=l.useState(R),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(I()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function R(){return I()}var ie=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function z(){let e=(0,u.c)(2),[t,n]=l.useState(ie),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),j(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function B(){return l.useSyncExternalStore(N,O,V)}function V(){return b}var ae=r(),oe=1e3,H=.5,se={length:0,offset:0},ce=(e,t)=>Math.abs(e.length-t.length)<H&&Math.abs(e.offset-t.offset)<H,U=e=>{let t=(0,u.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:ee,userIntentOnly:d}=e,f=r===void 0?32:r,p=i===void 0?1e3:i,m=o!==void 0&&o,h=s===void 0||s,g=ee!==void 0&&ee,_=d!==void 0&&d,[v,y]=l.useState(!1),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={length:0,offset:0},t[0]=b):b=t[0];let[x,te]=l.useState(b),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={length:0,offset:0},t[1]=S):S=t[1];let[C,ne]=l.useState(S),w=l.useRef(null),T=l.useRef(null),E=l.useRef(null),D=l.useRef(!1),O=l.useRef(!1),re=l.useRef(0),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=k):k=t[2];let A=l.useRef(k),j=l.useRef(null),M;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(M=new Set,t[3]=M):M=t[3];let N=l.useRef(M),P;t[4]!==n||t[5]!==m||t[6]!==f?(P=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=se;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(f,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}te(e=>ce(e,c)?e:c);let l=se;if(!m&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(f,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}ne(e=>ce(e,l)?e:l)},t[4]=n,t[5]=m,t[6]=f,t[7]=P):P=t[7];let F=P,I;t[8]===F?I=t[9]:(I=()=>{E.current===null&&(E.current=requestAnimationFrame(()=>{E.current=null,F()}))},t[8]=F,t[9]=I);let L=I,R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(e,t)=>{if(!t){N.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),N.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{N.current.has(e)||t.observe(e)}),N.current=n},t[10]=R):R=t[10];let ie=R,z;t[11]===p?z=t[12]:(z=()=>{w.current&&clearTimeout(w.current),!O.current&&(w.current=setTimeout(()=>y(!1),p))},t[11]=p,t[12]=z);let B=z,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{re.current=Date.now()},t[13]=V):V=t[13];let H=V,U;t[14]!==B||t[15]!==g||t[16]!==F||t[17]!==_?(U=()=>{T.current&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{if(F(),g&&!D.current){y(!1);return}if(_&&!D.current&&!(Date.now()-re.current<=oe)){y(!1);return}y(!0),B()})},t[14]=B,t[15]=g,t[16]=F,t[17]=_,t[18]=U):U=t[18];let W=U,le,ue;t[19]!==n||t[20]!==W||t[21]!==h||t[22]!==L||t[23]!==F||t[24]!==_?(le=()=>{let e=n.current;if(!e)return;F(),y(!1);let t=()=>W(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&H()};e.addEventListener(`scroll`,t,{passive:!0}),_&&(e.addEventListener(`wheel`,H,{passive:!0}),e.addEventListener(`touchstart`,H,{passive:!0}),e.addEventListener(`touchmove`,H,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{L()}):null;ie(e,i);let a=h&&typeof MutationObserver<`u`?new MutationObserver(()=>{ie(e,i),L()}):null;a?.observe(e,{childList:!0});let o=()=>L(),s=()=>L();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),_&&(e.removeEventListener(`wheel`,H),e.removeEventListener(`touchstart`,H),e.removeEventListener(`touchmove`,H),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),N.current.clear(),w.current&&clearTimeout(w.current),T.current&&cancelAnimationFrame(T.current),E.current&&cancelAnimationFrame(E.current)}},ue=[n,W,H,h,L,ie,F,_],t[19]=n,t[20]=W,t[21]=h,t[22]=L,t[23]=F,t[24]=_,t[25]=le,t[26]=ue):(le=t[25],ue=t[26]),l.useEffect(le,ue);let de,fe;t[27]===g?(de=t[28],fe=t[29]):(de=()=>{g&&(D.current||(y(!1),w.current&&=(clearTimeout(w.current),null)))},fe=[g],t[27]=g,t[28]=de,t[29]=fe),l.useEffect(de,fe);let pe;t[30]===n?pe=t[31]:(pe=(e,t)=>{let r=n.current;r&&(D.current=!0,A.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},j.current=t,H(),y(!0),w.current&&clearTimeout(w.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=pe);let G=pe,K;t[32]!==n||t[33]!==C.length||t[34]!==x.length?(K=e=>{if(!D.current)return;let t=n.current;if(!t)return;let r=j.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=A.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-x.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=A.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-C.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=C.length,t[34]=x.length,t[35]=K):K=t[35];let q=K,me;t[36]===B?me=t[37]:(me=e=>{D.current&&(D.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),B())},t[36]=B,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{O.current=!0,w.current&&=(clearTimeout(w.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===B?_e=t[40]:(_e=()=>{O.current=!1,B()},t[39]=B,t[40]=_e);let Y=_e,ve=x.length>0,ye=C.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!v,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==G||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==x.length||t[51]!==x.offset?(Q=ve&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${x.length}px`,top:`${8+x.offset}px`,right:`4px`},onPointerDown:e=>G(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=G,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=x.length,t[51]=x.offset,t[52]=Q):Q=t[52];let $;t[53]!==G||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==C.length||t[58]!==C.offset||t[59]!==ye?($=ye&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${C.length}px`,left:`${8+C.offset}px`,bottom:`4px`},onPointerDown:e=>G(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=G,t[54]=q,t[55]=J,t[56]=Y,t[57]=C.length,t[58]=C.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,ae.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};U.displayName=`OverlayScrollbar`;var W=U;export{z as a,B as i,C as n,L as o,P as r,v as s,W as t};
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t,Xt as n}from"./persistence-ZSrLIR97.js";import{nt as r,rt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./platform-BiSk9jV3.js";import{o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{t as c}from"./utils-Dh7UZFrA.js";var l=e(i(),1),u=s(),ee=.85,d=1.2,f=`openchamber.designPtScale.v1`;function p(e){return!Number.isFinite(e)||e<=0?1:Math.min(d,Math.max(ee,e))}function m(e){if(!e)return 1;let t=e.density,n=(e.xdpi+e.ydpi)/2;return!(t>0)||!(n>=50)||n>800?1:p(n/t/163)}function h(){if(typeof window>`u`)return 1;try{return p(Number.parseFloat(window.localStorage.getItem(`openchamber.designPtScale.v1`)??``))}catch{return 1}}function g(e){if(!(typeof window>`u`))try{window.localStorage.setItem(f,String(e))}catch{}}function _(e,t=document.documentElement){let n=p(e);t.style.setProperty(`--dpt`,`${n}px`)}async function v(){if(typeof document>`u`)return 1;let e=h();_(e);let{Capacitor:t,registerPlugin:n}=await o(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!t.isNativePlatform()||t.getPlatform()!==`android`)return _(1),1;if(!t.isPluginAvailable(`OpenChamberPhysicalScale`))return e;try{let e=m(await n(`OpenChamberPhysicalScale`).getMetrics());return g(e),_(e),e}catch{return e}}var y={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},b={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},x=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,te=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},S=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),_(e?1:h(),r)};function C(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,u=n()||t()||x(),{isExplicitTablet:ee}=te(l),d=s||c||l>0,f=s||c,p=e>y.md&&e<=y.lg,m=e<=y.md,h=d&&m,g=d&&!h&&(p||ee),_=!d||!g&&e>y.lg,v=`desktop`;u?(h=!1,g=!1,_=!0,v=`desktop`):a()?(h=!0,g=!1,_=!1,v=`mobile`):h?v=`mobile`:g?v=`tablet`:(_=!0,v=`desktop`),S(u,v,d);let b=`xs`;for(let[t,n]of Object.entries(y))e>=n&&(b=t);return{isMobile:h,isTablet:g,isDesktop:_,deviceType:v,screenWidth:e,breakpoint:b,hasTouchInput:d,hasTouchOnlyPointer:f}}var ne=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,w=new Set,T=null,E,D=null,O=()=>typeof window>`u`?b:(T||=C(),T),re=()=>{for(let e of w)e()},k=()=>{E=void 0;let e=C();T&&ne(T,e)||(T=e,re())},A=()=>{typeof window>`u`||E!==void 0||(E=window.requestAnimationFrame(k))},j=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},M=()=>{if(typeof window>`u`)return()=>{};T=C(),window.addEventListener(`resize`,A);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=j(e,A),r=j(t,A);return()=>{window.removeEventListener(`resize`,A),n(),r(),E!==void 0&&(window.cancelAnimationFrame(E),E=void 0)}},N=e=>typeof window>`u`?()=>{}:(w.add(e),D||=M(),()=>{w.delete(e),w.size===0&&D&&(D(),D=null,T=null)});function P(){if(typeof window>`u`||typeof window<`u`&&n())return!1;let e=document.documentElement,t=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return t===`1`||t===`true`}var F=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),I=()=>{if(typeof window>`u`||n())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return F()&&e>0&&window.innerWidth>y.md};function L(){let e=(0,u.c)(2),[t,n]=l.useState(R),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(I()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function R(){return I()}var ie=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function z(){let e=(0,u.c)(2),[t,n]=l.useState(ie),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),j(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function B(){return l.useSyncExternalStore(N,O,V)}function V(){return b}var ae=r(),oe=1e3,H=.5,se={length:0,offset:0},ce=(e,t)=>Math.abs(e.length-t.length)<H&&Math.abs(e.offset-t.offset)<H,U=e=>{let t=(0,u.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:ee,userIntentOnly:d}=e,f=r===void 0?32:r,p=i===void 0?1e3:i,m=o!==void 0&&o,h=s===void 0||s,g=ee!==void 0&&ee,_=d!==void 0&&d,[v,y]=l.useState(!1),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={length:0,offset:0},t[0]=b):b=t[0];let[x,te]=l.useState(b),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={length:0,offset:0},t[1]=S):S=t[1];let[C,ne]=l.useState(S),w=l.useRef(null),T=l.useRef(null),E=l.useRef(null),D=l.useRef(!1),O=l.useRef(!1),re=l.useRef(0),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=k):k=t[2];let A=l.useRef(k),j=l.useRef(null),M;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(M=new Set,t[3]=M):M=t[3];let N=l.useRef(M),P;t[4]!==n||t[5]!==m||t[6]!==f?(P=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=se;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(f,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}te(e=>ce(e,c)?e:c);let l=se;if(!m&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(f,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}ne(e=>ce(e,l)?e:l)},t[4]=n,t[5]=m,t[6]=f,t[7]=P):P=t[7];let F=P,I;t[8]===F?I=t[9]:(I=()=>{E.current===null&&(E.current=requestAnimationFrame(()=>{E.current=null,F()}))},t[8]=F,t[9]=I);let L=I,R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(e,t)=>{if(!t){N.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),N.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{N.current.has(e)||t.observe(e)}),N.current=n},t[10]=R):R=t[10];let ie=R,z;t[11]===p?z=t[12]:(z=()=>{w.current&&clearTimeout(w.current),!O.current&&(w.current=setTimeout(()=>y(!1),p))},t[11]=p,t[12]=z);let B=z,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{re.current=Date.now()},t[13]=V):V=t[13];let H=V,U;t[14]!==B||t[15]!==g||t[16]!==F||t[17]!==_?(U=()=>{T.current&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{if(F(),g&&!D.current){y(!1);return}if(_&&!D.current&&!(Date.now()-re.current<=oe)){y(!1);return}y(!0),B()})},t[14]=B,t[15]=g,t[16]=F,t[17]=_,t[18]=U):U=t[18];let W=U,le,ue;t[19]!==n||t[20]!==W||t[21]!==h||t[22]!==L||t[23]!==F||t[24]!==_?(le=()=>{let e=n.current;if(!e)return;F(),y(!1);let t=()=>W(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&H()};e.addEventListener(`scroll`,t,{passive:!0}),_&&(e.addEventListener(`wheel`,H,{passive:!0}),e.addEventListener(`touchstart`,H,{passive:!0}),e.addEventListener(`touchmove`,H,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{L()}):null;ie(e,i);let a=h&&typeof MutationObserver<`u`?new MutationObserver(()=>{ie(e,i),L()}):null;a?.observe(e,{childList:!0});let o=()=>L(),s=()=>L();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),_&&(e.removeEventListener(`wheel`,H),e.removeEventListener(`touchstart`,H),e.removeEventListener(`touchmove`,H),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),N.current.clear(),w.current&&clearTimeout(w.current),T.current&&cancelAnimationFrame(T.current),E.current&&cancelAnimationFrame(E.current)}},ue=[n,W,H,h,L,ie,F,_],t[19]=n,t[20]=W,t[21]=h,t[22]=L,t[23]=F,t[24]=_,t[25]=le,t[26]=ue):(le=t[25],ue=t[26]),l.useEffect(le,ue);let de,fe;t[27]===g?(de=t[28],fe=t[29]):(de=()=>{g&&(D.current||(y(!1),w.current&&=(clearTimeout(w.current),null)))},fe=[g],t[27]=g,t[28]=de,t[29]=fe),l.useEffect(de,fe);let pe;t[30]===n?pe=t[31]:(pe=(e,t)=>{let r=n.current;r&&(D.current=!0,A.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},j.current=t,H(),y(!0),w.current&&clearTimeout(w.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=pe);let G=pe,K;t[32]!==n||t[33]!==C.length||t[34]!==x.length?(K=e=>{if(!D.current)return;let t=n.current;if(!t)return;let r=j.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=A.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-x.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=A.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-C.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=C.length,t[34]=x.length,t[35]=K):K=t[35];let q=K,me;t[36]===B?me=t[37]:(me=e=>{D.current&&(D.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),B())},t[36]=B,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{O.current=!0,w.current&&=(clearTimeout(w.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===B?_e=t[40]:(_e=()=>{O.current=!1,B()},t[39]=B,t[40]=_e);let Y=_e,ve=x.length>0,ye=C.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!v,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==G||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==x.length||t[51]!==x.offset?(Q=ve&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${x.length}px`,top:`${8+x.offset}px`,right:`4px`},onPointerDown:e=>G(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=G,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=x.length,t[51]=x.offset,t[52]=Q):Q=t[52];let $;t[53]!==G||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==C.length||t[58]!==C.offset||t[59]!==ye?($=ye&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${C.length}px`,left:`${8+C.offset}px`,bottom:`4px`},onPointerDown:e=>G(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=G,t[54]=q,t[55]=J,t[56]=Y,t[57]=C.length,t[58]=C.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,ae.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};U.displayName=`OverlayScrollbar`;var W=U;export{z as a,B as i,C as n,L as o,P as r,v as s,W as t};