most-box 0.3.5 → 0.3.6

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 (53) hide show
  1. package/out/about/index.html +2 -2
  2. package/out/admin/index.html +0 -0
  3. package/out/app/index.html +0 -0
  4. package/out/assets/{AccountMenu-D-wa5tux.js → AccountMenu-B26qus-Q.js} +1 -1
  5. package/out/assets/{AppShell-BdRKZIZ9.js → AppShell-BiYQsNO8.js} +1 -1
  6. package/out/assets/{AppTop-BE5kKBYH.js → AppTop-D-qYC0ep.js} +1 -1
  7. package/out/assets/ChatRestoringIndicator-CLV78gNW.js +1 -0
  8. package/out/assets/{CopyButton-DnFqfCN9.js → CopyButton-BrEkzqEq.js} +1 -1
  9. package/out/assets/{MarketingHeader-8gNzHawY.js → MarketingHeader-CJXpogPY.js} +1 -1
  10. package/out/assets/{MarketingLayout-BPdjpEfc.js → MarketingLayout-Ch4sw5Qm.js} +1 -1
  11. package/out/assets/{MilkdownEditor-C388llV6.js → MilkdownEditor-DfhuT9eU.js} +1 -1
  12. package/out/assets/{OpenSidebarButton-OP8zl7ad.js → OpenSidebarButton-Bvwr7B6k.js} +1 -1
  13. package/out/assets/{chatJoinInvite-CeC6H6t8.js → chatJoinInvite-7tuD-STm.js} +1 -1
  14. package/out/assets/i18n-DKsg67mH.js +1 -0
  15. package/out/assets/index-FEwag7ej.css +1 -0
  16. package/out/assets/{index-D1mozno-.js → index-mjFWLwue.js} +3 -3
  17. package/out/assets/{index.lazy-B1iJsXQ8.js → index.lazy-8GSHLIGt.js} +1 -1
  18. package/out/assets/{index.lazy-CX2l1_Gi.js → index.lazy-B3jH9yBA.js} +1 -1
  19. package/out/assets/index.lazy-B5JMiv3z.js +1 -0
  20. package/out/assets/{index.lazy-CVFcovqX.js → index.lazy-BAr7-dhf.js} +1 -1
  21. package/out/assets/index.lazy-BMFwyE_Z.js +3 -0
  22. package/out/assets/{index.lazy-Bz77Jlzu.js → index.lazy-BbA_1LnY.js} +1 -1
  23. package/out/assets/{index.lazy-m9XAzMt1.js → index.lazy-BmpOpQqg.js} +1 -1
  24. package/out/assets/{index.lazy-FvXAYdEO.js → index.lazy-CB3C6kMj.js} +1 -1
  25. package/out/assets/{index.lazy-ClrSkRx5.js → index.lazy-CVOAOO0_.js} +1 -1
  26. package/out/assets/{index.lazy-CflWbocP.js → index.lazy-CyFSwJuo.js} +1 -1
  27. package/out/assets/{index.lazy-DzaN9qwA.js → index.lazy-D3iEq2ZW.js} +2 -2
  28. package/out/assets/{index.lazy-CsTaY5WS.js → index.lazy-F3iHN_Ao.js} +1 -1
  29. package/out/assets/{index.lazy-D7E1pb1S.js → index.lazy-PnZR3z1V.js} +1 -1
  30. package/out/assets/{index.lazy-59kmyNMW.js → index.lazy-qDpRLqXu.js} +1 -1
  31. package/out/assets/{index.lazy-C_J9afOY.js → index.lazy-s6Ok77GI.js} +1 -1
  32. package/out/assets/{saveLocalFile-2CNt4X0T.js → saveLocalFile-BLTn3Z18.js} +1 -1
  33. package/out/assets/useChannelMessages-DKlO_2oW.js +4 -0
  34. package/out/assets/{useGameRoom-asr2gyY6.js → useGameRoom-DLN636mz.js} +1 -1
  35. package/out/chat/index.html +0 -0
  36. package/out/chat/join/demo/index.html +0 -0
  37. package/out/chat/join/index.html +0 -0
  38. package/out/download/index.html +2 -2
  39. package/out/game/gandengyan/index.html +0 -0
  40. package/out/game/index.html +0 -0
  41. package/out/game/zhajinhua/index.html +0 -0
  42. package/out/index.html +2 -2
  43. package/out/note/index.html +0 -0
  44. package/out/ping/index.html +2 -2
  45. package/out/profile/index.html +0 -0
  46. package/out/web3/index.html +0 -0
  47. package/package.json +1 -1
  48. package/server/src/index.js +191 -76
  49. package/out/assets/i18n-C6yaqRst.js +0 -1
  50. package/out/assets/index-C6IjeTBh.css +0 -1
  51. package/out/assets/index.lazy-CazlK1-Y.js +0 -3
  52. package/out/assets/index.lazy-JwrS2vDI.js +0 -1
  53. package/out/assets/useChannelMessages-DDBqKBXU.js +0 -4
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,c as o,n as s,o as c,t as l}from"./useAppStore-DNhyhD20.js";import{a as u}from"./i18n-DKsg67mH.js";import{t as d}from"./circle-alert-DXVkx8p8.js";import{a as ee,o as f,r as p,t as te}from"./chatNoteDraft-DTy6In5R.js";import{t as ne}from"./OpenSidebarButton-Bvwr7B6k.js";import{a as m,i as h,n as re,o as ie,r as ae,t as oe}from"./saveLocalFile-BLTn3Z18.js";import{t as g}from"./arrow-right-BsHzC0ZL.js";import{n as se,t as _}from"./trash-2-B9gno5q6.js";import{t as v}from"./download-Cy2BlfKM.js";import{t as ce}from"./external-link-D_AQSgxW.js";import{t as le}from"./file-text-zvTER2mN.js";import{t as y}from"./loader-C4pED_QP.js";import{r as ue,t as de}from"./AppShell-BiYQsNO8.js";import{t as fe}from"./message-square-CfApq8Ou.js";import{t as pe}from"./music-Br2x8TKX.js";import{t as me}from"./search-DLBOUfny.js";import{A as he,C as ge,M as _e,O as ve,S as ye,T as be,g as xe,j as Se,n as Ce,r as we,w as Te}from"./index-mjFWLwue.js";import{t as Ee}from"./AppTop-D-qYC0ep.js";import{t as De}from"./LogoIcon-B2fFe0l1.js";import{t as Oe}from"./format-CAKfypjK.js";import{a as ke,i as Ae,n as b,o as je,r as Me,t as Ne}from"./downloadValidation-Dd43i9_9.js";import{t as x}from"./channelApi-C5eHetoJ.js";import{t as Pe}from"./useChannelMessages-DKlO_2oW.js";import{t as Fe}from"./ChatRestoringIndicator-CLV78gNW.js";var Ie=r(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Le=r(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Re=r(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),ze=r(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Be=r(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),S=t(e(),1),C=n();function Ve(e){return String(e||``).split(`/`).pop()||e}function He(e){return e===`image`?(0,C.jsx)(h,{size:20}):e===`video`?(0,C.jsx)(m,{size:20}):e===`audio`?(0,C.jsx)(pe,{size:20}):(0,C.jsx)(le,{size:20})}function Ue({attachment:e,status:t=`idle`,message:n,pending:r=!1,onOpen:i}){let{t:a}=u(),o=t===`checking`,s=t===`downloading`,c=r||o||s,l=`ui-file-action chat-attachment-action ${t===`error`?`error`:t===`available`?`available`:``}`.trim(),ee=Number.isFinite(e.size)&&e.size>0?Oe(e.size):a(`chat.mostboxFile`),f=r?a(`chat.sending`):n||ee,p=a(r?`chat.sending`:o?`chat.checking`:s?`chat.attachment.downloading`:t===`available`?`chat.attachment.preview`:t===`error`?`chat.attachment.retry`:`chat.attachment.download`);return(0,C.jsxs)(`button`,{type:`button`,className:`ui-file-card chat-attachment-card`,onClick:()=>i?.(e),disabled:c,title:e.link,translate:`no`,children:[(0,C.jsx)(`span`,{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:c?(0,C.jsx)(y,{size:20,className:`ui-spinner chat-attachment-spinner`}):He(e.kind)}),(0,C.jsxs)(`span`,{className:`ui-file-info chat-attachment-info`,children:[(0,C.jsx)(`span`,{className:`ui-file-name chat-attachment-name`,translate:`no`,children:Ve(e.fileName)}),(0,C.jsx)(`span`,{className:`ui-file-meta chat-attachment-meta`,translate:`yes`,children:f})]}),(0,C.jsxs)(`span`,{className:l,translate:`yes`,children:[c?(0,C.jsx)(y,{size:15,className:`ui-spinner chat-attachment-spinner`}):t===`available`?(0,C.jsx)(_e,{size:16}):t===`error`?(0,C.jsx)(d,{size:17}):(0,C.jsx)(v,{size:16}),(0,C.jsx)(`span`,{className:`chat-attachment-action-label`,children:p})]})]})}var w=[{key:`image`,labelKey:`chat.attachment.image`,accept:`image/*`,icon:h},{key:`video`,labelKey:`chat.attachment.video`,accept:`video/*`,icon:m},{key:`file`,labelKey:`chat.attachment.file`,accept:``,icon:le}],We={key:`voice`,labelKey:`chat.voice.menu`,icon:Se},Ge=w.map(e=>e.accept).join(`,`);function Ke({children:e}){return(0,C.jsx)(`div`,{className:`message-bubble`,translate:`no`,children:e})}function qe({children:e}){return(0,C.jsx)(`div`,{className:`message-bubble has-attachment`,children:e})}function Je({children:e}){return(0,C.jsx)(`div`,{className:`chat-system-message`,children:e})}function Ye({variant:e,pending:t=!1,avatarSrc:n,isOnline:r=!1,author:i,time:a,children:o}){return(0,C.jsxs)(`div`,{className:[`chat-message`,e,t?`pending`:``].filter(Boolean).join(` `),children:[(0,C.jsxs)(`span`,{className:`chat-avatar-wrap`,children:[(0,C.jsx)(`img`,{className:`msg-avatar`,src:n,alt:`avatar`}),r&&(0,C.jsx)(`span`,{className:`chat-online-dot`,"aria-hidden":`true`})]}),(0,C.jsxs)(`div`,{className:`msg-content`,children:[(0,C.jsx)(`span`,{className:`message-header`,children:(0,C.jsx)(`span`,{className:`message-author`,translate:`no`,children:i})}),o,(0,C.jsx)(`span`,{className:`message-time`,children:a})]})]})}function Xe({active:e=!1,pinned:t=!1,unread:n=!1,title:r,menuClassName:i,onSelect:a,onTogglePin:o,onRename:s,onLeave:c}){let{t:l}=u(),d=!!(o||s||c);return(0,C.jsxs)(`div`,{className:[`sidebar-nav-btn`,e?`active`:``,t?`pinned`:``,n?`unread`:``].filter(Boolean).join(` `),onClick:a,role:`button`,tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&e.key===`Enter`&&a?.()},children:[(0,C.jsxs)(`span`,{className:`chat-channel-icon-wrap`,children:[(0,C.jsx)(fe,{size:16}),n&&(0,C.jsx)(`span`,{className:`chat-channel-unread-dot`,title:l(`chat.unread`),"aria-hidden":`true`})]}),(0,C.jsx)(`span`,{className:`chat-channel-title`,children:(0,C.jsx)(`span`,{className:`chat-channel-title-text`,translate:`no`,children:r})}),d&&(0,C.jsx)(ye,{ariaLabel:l(`chat.channelActions`),className:`channel-actions-anchor`,menuClassName:i,placement:`bottom-end`,items:[{key:`pin`,label:l(t?`chat.unpin`:`chat.pin`),icon:t?(0,C.jsx)(Re,{size:16}):(0,C.jsx)(ze,{size:16}),onSelect:()=>o?.()},{key:`rename`,label:l(`chat.rename`),icon:(0,C.jsx)(ie,{size:16}),onSelect:()=>s?.()},{key:`delete`,label:l(`chat.delete`),icon:(0,C.jsx)(_,{size:16}),onSelect:()=>c?.()}],renderTrigger:e=>(0,C.jsx)(`button`,{...e,className:`leave-channel-btn channel-actions-trigger`,title:l(`common.moreActions`),"aria-label":l(`common.moreActions`),children:(0,C.jsx)(f,{size:16})})})]})}function Ze({members:e}){let{t}=u();return e.length===0?(0,C.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:t(`chat.noMembers`)}):(0,C.jsx)(`div`,{className:`channel-members-grid`,children:e.map(e=>(0,C.jsxs)(`div`,{className:`channel-member`,children:[(0,C.jsxs)(`span`,{className:`channel-member-avatar-wrap`,children:[(0,C.jsx)(`img`,{className:`channel-member-avatar`,src:e.avatarSrc,alt:`avatar`}),e.online&&(0,C.jsx)(`span`,{className:`chat-online-dot`,"aria-hidden":`true`})]}),(0,C.jsx)(`span`,{className:`channel-member-name`,translate:`no`,children:e.name})]},e.id))})}function Qe({message:e,placeholder:t,disabled:n=!1,isPublishingAttachment:r=!1,attachmentButtonTitle:i,attachmentInputRef:a,attachmentMenuClassName:o,showVoiceRoom:s=!0,onMessageChange:c,onSend:l,onOpenVoiceRoom:d,onSelectAttachmentFiles:f}){let{t:p}=u(),te=n||r,ne=n||!e.trim(),m=i||p(`chat.attachment.add`);function h(e,t){let n=e.currentTarget.files?Array.from(e.currentTarget.files):null;t?.(n),e.currentTarget.value=``}function re(t){t.key===`Enter`&&(t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.trim()&&l()))}function ie(e){if(te)return;let t=a?.current;t&&(t.accept=e,t.click())}return(0,C.jsxs)(`div`,{className:`chat-input-area`,children:[(0,C.jsx)(`input`,{ref:a,type:`file`,accept:Ge,className:`chat-file-input`,onChange:e=>h(e,f)}),(0,C.jsx)(ye,{ariaLabel:p(`chat.attachmentType`),placement:`top-start`,disabled:te,menuClassName:o,items:[...w.map(e=>{let t=e.icon;return{key:e.key,label:p(e.labelKey),icon:(0,C.jsx)(t,{size:16}),onSelect:()=>ie(e.accept)}}),...s?[{key:We.key,label:p(We.labelKey),icon:(0,C.jsx)(Se,{size:16}),onSelect:()=>d?.()}]:[]],renderTrigger:e=>(0,C.jsx)(`button`,{...e,className:`btn btn-circle chat-tool-btn`,"aria-label":m,children:r?(0,C.jsx)(y,{size:18,className:`ui-spinner chat-attachment-spinner`}):(0,C.jsx)(ee,{size:18})})}),(0,C.jsx)(`textarea`,{className:`textarea chat-composer-input`,placeholder:t,value:e,disabled:n,rows:1,onChange:e=>c(e.target.value),onKeyDown:re}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-circle btn-primary send-btn`,onClick:l,disabled:ne,title:p(`chat.sendMessage`),children:(0,C.jsx)(g,{size:18})})]})}var $e=`mostbox.chat.lastReadAt`;function T(e){return Date.parse(e?.lastMessageAt||``)||Date.parse(e?.createdAt||``)||0}function et(e){let t=String(e||``).trim().toLowerCase();return t?`${$e}:${t}`:``}function tt(e,t=Date.now()){let n=Number(e);return Math.max(0,Math.floor(Number.isFinite(n)&&n>0?n:t))}function nt(e,t=E()){if(!e||!t)return{};try{let n=t.getItem(e);if(!n)return{};let r=JSON.parse(n);return!r||typeof r!=`object`?{}:Object.entries(r).reduce((e,[t,n])=>{let r=Number(n);return t&&Number.isFinite(r)&&r>=0&&(e[t]=r),e},{})}catch{return{}}}function rt(e,t,n=E()){if(!(!e||!n))try{n.setItem(e,JSON.stringify(t))}catch{}}function it(e,t,n=Date.now(),r=Date.now()){if(!t)return{changed:!1,value:e};let i=tt(n,r);return(e[t]||0)>=i?{changed:!1,value:e}:{changed:!0,value:{...e,[t]:i}}}function at(e,t,n=Date.now()){let r=!1,i={...e};for(let e of t){let t=e?.channelKey||e?.name;!t||i[t]!==void 0||(i[t]=tt(T(e),n),r=!0)}return{changed:r,value:r?i:e}}function ot(e,{channelName:t,messageTime:n,activeChannelName:r=``,messageAuthor:i=``,userAddress:a=``,now:o=Date.now()}){if(!t)return{changed:!1,notify:!1,value:e};let s=tt(n,o),c=t===r;if(String(i||``).toLowerCase()===String(a||``).toLowerCase())return{...it(e,t,s,o),notify:!1};if(c)return{...it(e,t,s,o),notify:!0};let l=e[t]||0;if(l<s)return{changed:!1,notify:!0,value:e};let u=Math.max(0,s-1);return l===u?{changed:!1,notify:!0,value:e}:{changed:!0,notify:!0,value:{...e,[t]:u}}}function st(e,t){let n=e?.channelKey||e?.name;return T(e)>(t[n]||0)}function E(){if(!(typeof window>`u`))return window.localStorage}var ct=3,lt=30,ut=/^[a-zA-Z0-9_-]+$/,dt=1e4,ft=12e3,pt=1200,mt=800,ht=`channel.member.joined`;function D(e){return e?.channelKey||e?.name||``}function O(e){return e?.channelId||e?.name||``}function k(e){return e&&typeof e==`object`?e:{}}function gt(e){let t=k(e),n=new Set,r=e=>{let t=String(e||``).trim();t&&n.add(t)};return r(t.channelKey),r(t.channel),Array.isArray(t.channels)&&t.channels.forEach(e=>{let t=k(e);r(t.channelKey),r(t.channel),r(t.name)}),[...n]}function A(e){return e?.remark||O(e)}function _t(e){return e.type===`system`&&e.event===ht}function vt(){return typeof window>`u`?``:(new URLSearchParams(window.location.search).get(`channel`)||``).trim()}function yt(e){let t=new Date(e||Date.now());return Number.isNaN(t.getTime())?String(Date.now()):t.toISOString().slice(0,16).replace(`T`,` `).replace(`:`,`-`)}function j(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function bt(e,t){return`[${j(e)}](<${t.replace(/>/g,`%3E`)}>)`}function xt(e){let t=String(e||``).trim().split(/\r?\n/);return t.length>0?t.map(e=>`> ${e}`).join(`
2
+ `):`> `}var St=`chat-file`;function Ct(e,t){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:e.type.startsWith(`audio/`)?`audio`:e.type.startsWith(`text/`)?`text`:ae(t)}function wt(e){return e?`${e.slice(0,6)}...${e.slice(-4)}`:`Unknown`}function Tt(e){return/#[a-fA-F0-9]{4}$/.test(String(e||``).trim())}function M(e){return String(e||``).trim().toLowerCase()}function Et(){if(typeof window>`u`)return;let e=window;return e.AudioContext||e.webkitAudioContext}function N(){let e=l(e=>e.hasBackend),t=l(e=>e.isDarkMode),n=l(e=>e.addToast),r=l(e=>e.openConnectModal),a=i(e=>e.identity),d=i(e=>e.openLoginModal),[f,m]=(0,S.useState)([]),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(``),[le,y]=(0,S.useState)(!1),[pe,_e]=(0,S.useState)(``),[ye,Se]=(0,S.useState)(``),[Oe,Re]=ue(!1),[ze,He]=(0,S.useState)(``),[w,We]=(0,S.useState)(!1),[Ge,$e]=(0,S.useState)(!1),[tt,E]=ue(!1),[ht,k]=(0,S.useState)(null),[j,N]=(0,S.useState)(null),[Dt,P]=(0,S.useState)(!1),[Ot,kt]=(0,S.useState)(``),[At,jt]=(0,S.useState)(!1),[Mt,Nt]=(0,S.useState)(null),[Pt,Ft]=(0,S.useState)(!1),[F,I]=(0,S.useState)({}),[L,R]=(0,S.useState)(null),[It,Lt]=(0,S.useState)(!1),[Rt,zt]=(0,S.useState)(!1),[Bt,Vt]=(0,S.useState)(!1),[Ht,Ut]=(0,S.useState)({}),[Wt,Gt]=(0,S.useState)([]),z=a?.theme===`sparkbit`,Kt=z&&a?.data?a.data:``,qt=z&&a?.logo||``,Jt=z&&t&&a?.logo_dark||``,Yt=Jt||qt,Xt=Jt&&qt&&Jt!==qt?qt:``,Zt=Yt&&!Rt?Yt:Xt&&!Bt?Xt:``,Qt=(0,S.useRef)(null),$t=(0,S.useRef)(null),en=(0,S.useRef)(``),tn=(0,S.useRef)(new Set),nn=(0,S.useRef)(new Set),B=(0,S.useRef)(null),rn=(0,S.useRef)(!1),an=(0,S.useRef)(0),on=(0,S.useRef)(async()=>[]),sn=(0,S.useRef)(new Map),V=(0,S.useRef)(new Map),H=(0,S.useRef)(new Set),U=e===!0,{t:W,compareStrings:cn,formatDate:ln,formatTime:un}=u(),G=Ce(),K=(0,S.useCallback)(async(e,t)=>{n(await c(e,t),`error`)},[n]),q=(0,S.useMemo)(()=>et(a?.address),[a?.address]),dn=(0,S.useCallback)((e,t=Date.now())=>{e&&Ut(n=>{let r=it(n,e,t);return r.changed?(rt(q,r.value),r.value):n})},[q]),fn=(0,S.useCallback)(()=>{if(rn.current||typeof window>`u`)return;let e=Et();if(e)try{let t=B.current||new e;B.current=t,t.state===`suspended`&&t.resume().catch(()=>{}),rn.current=!0}catch{}},[]),pn=(0,S.useCallback)(()=>{if(!rn.current)return;let e=Date.now();if(e-an.current<pt)return;an.current=e;let t=Et();if(t)try{let e=B.current||new t;if(B.current=e,e.state===`suspended`){e.resume().catch(()=>{});return}let n=e.createGain();n.gain.setValueAtTime(1e-4,e.currentTime),n.gain.exponentialRampToValueAtTime(.08,e.currentTime+.015),n.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+.18),n.connect(e.destination),[740,980].forEach((t,r)=>{let i=e.createOscillator();i.type=`sine`,i.frequency.setValueAtTime(t,e.currentTime),i.connect(n),i.start(e.currentTime+r*.035),i.stop(e.currentTime+.16+r*.035)})}catch{}},[]),mn=(0,S.useCallback)(async(e=h)=>{let t=D(e);if(!t||!U){Gt([]);return}try{let e=await x.getChannelPresence(t);if(en.current!==t)return;Gt(e)}catch(e){console.warn(`[Chat] Failed to fetch channel presence:`,e instanceof Error?e.message:e)}},[h,U]),hn=(0,S.useCallback)((e=``)=>{let t=en.current;if(!e||e!==t||!U)return;let n=sn.current,r=n.get(e);r&&window.clearTimeout(r);let i=window.setTimeout(()=>{n.delete(e),on.current(e)},mt);n.set(e,i)},[U]);function gn(e,t){switch(e){case`channel:message`:{let e=t?.channelKey||t?.channel,n=t?.message,r=Number(n?.timestamp)||Date.now();if(e){m(t=>t.map(t=>D(t)===e?{...t,lastMessageAt:new Date(r).toISOString()}:t));let t=e===en.current;Ut(i=>{let o=ot(i,{channelName:e,messageTime:r,activeChannelName:t?e:``,messageAuthor:n?.author,userAddress:a?.address});return o.changed&&rt(q,o.value),o.notify&&pn(),o.changed?o.value:i})}break}case`channel:peer:online`:case`channel:sync:available`:{let e=gt(t),n=en.current;$(),e.includes(n)&&(hn(n),h&&mn(h));break}case`channel:presence`:{let e=t?.channelKey||t?.channel;h&&(!e||e===D(h))&&mn(h);break}case`channel:joined`:case`channel:left`:$();break;case`user:metadata:updated`:t?.scope===`channels`&&$();break;case`download:success`:{let e=V.current.get(t.taskId);e&&(V.current.delete(t.taskId),H.current.delete(e.cid),I(t=>({...t,[e.cid]:{status:`available`,message:W(`chat.attachment.previewAvailable`)}})),n(W(`chat.attachment.downloadCompleted`,{fileName:t.fileName||Ve(e.fileName)}),`success`),kn(e,t.fileName||e.fileName));break}case`download:error`:case`download:cancelled`:{let r=V.current.get(t.taskId);r&&(V.current.delete(t.taskId),H.current.delete(r.cid),I(n=>({...n,[r.cid]:{status:`error`,message:e===`download:cancelled`?W(`chat.attachment.downloadCancelled`):t.error||W(`chat.attachment.downloadFailed`)}})),n(e===`download:cancelled`?W(`chat.attachment.downloadCancelled`):t.error||W(`chat.attachment.downloadFailed`),`error`));break}}}let _n=(0,S.useMemo)(()=>f.map(e=>D(e)),[f]),J=D(h),vn=(0,S.useMemo)(()=>a?{...we(a),profileUpdatedAt:a.profileUpdatedAt}:{},[a?.avatar,a?.displayName,a?.profileUpdatedAt,a?.username]),Y=(0,S.useMemo)(()=>!h||!J?null:{channelName:J,title:A(h)},[h,J]),{clearMessages:yn,messages:X,sendMessage:bn,syncedChannelName:xn,syncMessages:Sn}=Pe({isReady:U,enabled:!!a,channelName:J,extraSubscribedChannelNames:_n,peerId:ze,waitForPeerId:!0,onSyncError:e=>K(e,W(`chat.error.messages`)),onSocketEvent:gn,onReconnect:()=>{$(),h&&mn(h)},presenceEnabled:!!(h&&a),presenceProfile:vn});(0,S.useEffect)(()=>{on.current=Sn},[Sn]),(0,S.useEffect)(()=>{let e=sn.current;return()=>{for(let t of e.values())window.clearTimeout(t);e.clear()}},[]);let Cn=(0,S.useMemo)(()=>{let e=new Map;return X.forEach((t,n)=>{let r=String(t.author||``).trim();if(!r)return;let i=r.toLowerCase(),a=Number(t.timestamp)||0,o=String(t.authorName||``).trim(),s=String(t.avatar||``).trim(),c=e.get(i);if(!c){e.set(i,{address:r,displayName:o,...s?{avatar:s}:{},firstSeenAt:a,lastSeenAt:a,index:n});return}a>=c.lastSeenAt&&(c.lastSeenAt=a,o&&(c.displayName=o),s&&(c.avatar=s))}),[...e.values()].sort((e,t)=>e.firstSeenAt-t.firstSeenAt||e.index-t.index)},[X]),wn=(0,S.useMemo)(()=>new Map(Cn.map(e=>[M(e.address),e])),[Cn]),Tn=(0,S.useMemo)(()=>{let e=new Map;return Wt.forEach(t=>{let n=M(t.address);!n||!t.online||e.set(n,t)}),e},[Wt]),En=(0,S.useMemo)(()=>{let e=new Map(wn);return Wt.forEach((t,n)=>{let r=M(t.address);!r||e.has(r)||e.set(r,{address:t.address,displayName:t.displayName||``,...t.avatar?{avatar:t.avatar}:{},firstSeenAt:t.lastSeen||Date.now(),lastSeenAt:t.lastSeen||Date.now(),index:Cn.length+n})}),[...e.values()]},[Cn,Wt,wn]),Dn=(0,S.useMemo)(()=>new Set(Tn.keys()),[Tn]);function Z(){return U?!0:(r(),!1)}function Q(){return a?!0:(d(),!1)}(0,S.useEffect)(()=>{let e=()=>{v(vt())};return e(),window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,S.useEffect)(()=>{a&&v(vt())},[a?.address]),(0,S.useEffect)(()=>{zt(!1),Vt(!1)},[Yt,Xt]),(0,S.useEffect)(()=>{en.current=D(h)},[h]),(0,S.useEffect)(()=>(G.setPreviewRoom(a&&Y?Y:null),()=>{G.setPreviewRoom(null)}),[Y,a,G.setPreviewRoom]),(0,S.useEffect)(()=>{Ut(nt(q))},[q]),(0,S.useEffect)(()=>{!q||f.length===0||Ut(e=>{let t=at(e,f);return t.changed&&rt(q,t.value),t.changed?t.value:e})},[q,f]),(0,S.useEffect)(()=>(window.addEventListener(`pointerdown`,fn,{passive:!0}),window.addEventListener(`keydown`,fn),()=>{window.removeEventListener(`pointerdown`,fn),window.removeEventListener(`keydown`,fn)}),[fn]),(0,S.useEffect)(()=>()=>{B.current?.close().catch(()=>{}),B.current=null,rn.current=!1},[]),(0,S.useEffect)(()=>{Qt.current?.scrollIntoView({behavior:`smooth`})},[X]),(0,S.useEffect)(()=>{if(!U){He(``);return}s.get(`/api/node-id`).json().then(e=>He(e.id)).catch(e=>{console.warn(`[Chat] Failed to fetch node ID:`,e.message),K(e,W(`chat.error.nodeId`))})},[U,K,W]),(0,S.useEffect)(()=>{U&&a?(y(!1),$()):y(!1)},[e,U,a?.address]),(0,S.useEffect)(()=>{if(h){if(U){let e=D(h);Gt([]),Sn(e,{replace:!0}),mn(h)}}else Gt([])},[h,U,mn,Sn]),(0,S.useEffect)(()=>{if(!_)return;if(!a){nn.current.has(_)||(nn.current.add(_),d());return}if(!U||!le)return;let e=f.find(e=>D(e)===_)||f.find(e=>O(e)===_);if(e&&(!h||D(h)!==D(e))){Pn(e);return}if(e&&h&&D(h)===D(e)&&(h.createdAt!==e.createdAt||h.coreKey!==e.coreKey||h.lastMessageAt!==e.lastMessageAt||h.pinned!==e.pinned||h.remark!==e.remark||h.type!==e.type)){g(e);return}if(e)return;let t=`${a.address}:${_}`;if(tn.current.has(t)||w)return;let r=On(_);if(tn.current.add(t),r){n(r,`error`);return}Ln(_)},[f,h,_,le,U,w,a?.address]),(0,S.useEffect)(()=>{a||(m([]),y(!1),g(null),v(vt()),N(null),yn(),Se(``),He(``),P(!1),Nt(null),I({}),Ut({}),H.current.clear(),V.current.clear())},[yn,a?.address]);function On(e){return e.length<ct?W(`chat.validation.nameMin`,{count:ct}):e.length>lt?W(`chat.validation.nameMax`,{count:lt}):e.includes(`.`)?W(`chat.validation.dotReserved`):ut.test(e)?``:W(`chat.validation.allowedChars`)}async function $(){if(!U){y(!1);return}try{m(await x.getChannels()),y(!0)}catch(e){m([]),y(!1),await K(e,W(`chat.error.channelList`))}}function kn(e,t=e.fileName){let n=ae(t);Nt({cid:e.cid,fileName:t,subtype:n===`file`?e.kind:n})}async function An(e){if(Q()&&Z())try{n((await oe({cid:e.cid,fileName:e.fileName,getFileDownloadUrl:b.getFileDownloadUrl,getRequestHeaders:o,loadFailedMessage:W(`app.toast.getFileFailed`)})).method===`picker`?W(`app.toast.fileSaved`):W(`app.toast.fileDownloaded`),`success`)}catch(e){e.name!==`AbortError`&&n(W(`app.saveFailedWithError`,{error:e.message}),`error`)}}async function jn(e){let t=Ne(e.link,W);if(t)return I(n=>({...n,[e.cid]:{status:`error`,message:t}})),!1;try{I(t=>({...t,[e.cid]:{status:`checking`}}));let t=await b.checkDownload(e.link,{timeout:dt,requestTimeout:ft});return I(n=>({...n,[e.cid]:{status:t.alreadyExists?`available`:`ready`,message:t.alreadyExists?W(`chat.attachment.localAvailable`):W(`chat.attachment.downloadAvailable`)}})),!0}catch(t){let n=await Me(t);return I(t=>({...t,[e.cid]:{status:`error`,message:n}})),!1}}async function Mn(e){R(null),await jn(e)&&await Nn(e)}async function Nn(e){if(!H.current.has(e.cid)){H.current.add(e.cid),I(t=>({...t,[e.cid]:{status:`downloading`,message:W(`chat.attachment.downloading`)}}));try{let t=await b.downloadFile(e.link);if(t.alreadyExists||t.fileName){H.current.delete(e.cid),I(t=>({...t,[e.cid]:{status:`available`,message:W(`chat.attachment.previewAvailable`)}})),kn({...e,fileName:t.fileName||e.fileName},t.fileName||e.fileName);return}t.taskId&&(V.current.set(t.taskId,e),n(W(`chat.attachment.downloadStarted`),`success`))}catch(t){let n=await Me(t);H.current.delete(e.cid),I(t=>({...t,[e.cid]:{status:`error`,message:n}}))}}}async function Pn(e){if(!Q()||!Z())return;let t=D(e);dn(t,Math.max(T(e),Date.now())),g(e),v(t),window.history.pushState({},``,`?channel=${encodeURIComponent(t)}`)}async function Fn(e,t){if(t&&t.stopPropagation(),Q()&&Z()&&!Ge){$e(!0);try{if(await x.leaveChannel(e),D(h)===e){g(null),v(``),yn();let e=new URL(window.location.href);e.searchParams.delete(`channel`),window.history.pushState({},``,e.pathname)}$(),E.close(),k(null)}catch(e){await K(e,W(`chat.error.leave`))}finally{$e(!1)}}}async function In(e){if(!Q()||!Z())return;let t=!e.pinned,n=D(e);try{let e=await x.setChannelPinned(n,t);m(t=>t.map(t=>D(t)===n?{...t,pinned:e.pinned}:t)),g(t=>t&&D(t)===n?{...t,pinned:e.pinned}:t)}catch(e){await K(e,W(t?`chat.error.pin`:`chat.error.unpin`))}}async function Ln(e){let t=e.trim();if(!t||w)return;let r=On(t);if(r){n(r,`error`);return}if(Q()&&Z()){We(!0);try{let e=await x.createChannel(t,`public`,we(a)),n=e.channelKey||e.key||e.name||t,r=f.find(e=>D(e)===n),i={...r,name:e.name||t,channelId:e.channelId||e.name||t,channelKey:e.channelKey||e.key||r?.channelKey,type:e.type||r?.type||`public`,createdAt:e.createdAt||r?.createdAt,coreKey:e.coreKey||e.key||r?.coreKey,localWriterCoreKey:e.localWriterCoreKey||r?.localWriterCoreKey,writerCoreKeys:e.writerCoreKeys||r?.writerCoreKeys,remark:e.remark||r?.remark},o=D(i);m(e=>e.some(e=>D(e)===o)?e.map(e=>D(e)===o?{...e,...i}:e):[...e,i]),Re.close(),await Pn(i),$()}catch(e){await K(e,W(`chat.error.join`))}finally{We(!1)}}}async function Rn(e,t){if(!e.trim()||!h||!Q()||!Z())return!1;let n=e.trim(),r=D(h);try{let e=await bn({channelName:r,content:n,attachment:t});return m(t=>t.map(t=>D(t)===r?{...t,lastMessageAt:new Date(Number(e?.timestamp)||Date.now()).toISOString()}:t)),e&&dn(r,Number(e.timestamp)||Date.now()),!0}catch(e){return await K(e,W(`chat.error.send`)),!1}}async function zn(){if(!ye.trim())return;let e=ye.trim();Se(``),await Rn(e)}function Bn(e,t){return`${St}/${e}/${t}`}async function Vn(e){if(!e||e.length===0||!h||!Q()||!Z()||Pt)return;Ft(!0);let t=``;try{let r=await b.getNodePolicy().catch(()=>null);for(let i of Array.from(e)){t=i.name;let e=ke(i,r,W);if(e){n(e,`error`);continue}let a=Bn(O(h),i.name),o=await b.publishFile(i,a),s=o.fileName||a,c=o.link||je(o.cid,s);await Rn(c,{kind:Ct(i,s),cid:o.cid,fileName:s,link:c,mimeType:i.type||void 0,size:i.size})}}catch(e){n(await Ae(e,W(`chat.error.attachmentSend`),W,t),`error`)}finally{Ft(!1)}}async function Hn(e){if(!Q()||!Z())return;let t=F[e.cid];if(!(t?.status===`checking`||t?.status===`downloading`)){if(t?.status===`error`){R(e);return}if(t?.status===`ready`||t?.status===`available`){await Nn(e);return}if(!t){await jn(e)&&await Nn(e);return}}}function Un(e){let t=M(e.author),n=Tn.get(t),r=wn.get(t);return Qn(n?.displayName||r?.displayName||e.authorName,e.author)}function Wn(e){return e.type!==`system`&&!e.pending&&(!!e.attachment||!!e.content.trim())}function Gn(e,t){let n=Un(t),r=`${ln(t.timestamp)} ${un(t.timestamp)}`,i=t.content.trim();e.push(`## ${r} ${n}`,``),i&&(!t.attachment||i!==t.attachment.link)&&e.push(xt(i),``),t.attachment&&e.push(`**${W(`chat.noteDraft.attachment`)}**`,``,`- ${W(`chat.noteDraft.file`)}: ${bt(Ve(t.attachment.fileName),t.attachment.link)}`,`- CID: \`${t.attachment.cid}\``,``)}function Kn(e){let t=h?A(h):``,n=`${ln(Date.now())} ${un(Date.now())}`,r=[`# ${W(`chat.noteDraft.heading`)}`,``,`- ${W(`chat.noteDraft.room`)}: ${t}`,`- ${W(`chat.noteDraft.exportedAt`)}: ${n}`,`- ${W(`chat.noteDraft.messageCount`)}: ${e.length}`,``];return e.forEach(e=>Gn(r,e)),`${r.join(`
3
+ `).trimEnd()}\n`}function qn(){let e=X.filter(Wn);if(e.length===0){n(W(`chat.noteDraft.empty`),`warning`);return}let t=te({title:W(`chat.noteDraft.historyTitle`,{room:h?A(h):W(`chat.title`),time:yt()}),content:Kn(e)});if(!t){n(W(`chat.noteDraft.saveFailed`),`error`);return}P(!1),window.location.assign(p(t.id))}async function Jn(e,t){if(!Q()||!Z())return;let n=D(e),r=await x.setChannelRemark(n,t);return m(e=>e.map(e=>D(e)===n?{...e,remark:r.remark}:e)),g(e=>e&&D(e)===n?{...e,remark:r.remark}:e),r.remark}async function Yn(){if(h)try{await Jn(h,Ot)}catch(e){await K(e,W(`chat.error.remark`))}}async function Xn(e){if(!(!j||At)){jt(!0);try{await Jn(j,e),N(null)}catch(e){await K(e,W(`chat.error.rename`))}finally{jt(!1)}}}function Zn(e){if(!e.attachment)return(0,C.jsx)(Ke,{children:e.content});let t=e.attachment,n=F[t.cid],r=n?.status;return(0,C.jsx)(qe,{children:(0,C.jsx)(Ue,{attachment:t,status:r,message:n?.message,pending:e.pending,onOpen:Hn})})}function Qn(e,t){let n=String(e||``).trim();return n?It?Tt(n)?n:t?`${n}#${t.slice(-4).toUpperCase()}`:n:n.replace(/#[a-fA-F0-9]{4}$/,``):wt(t)}function $n(){return(0,C.jsx)(Ze,{members:En.map(e=>{let t=Tn.get(M(e.address)),n=t?.displayName||e.displayName,r=t?.avatar||e.avatar;return{id:e.address,name:Qn(n,e.address),avatarSrc:xe(e.address,r),online:Dn.has(M(e.address))}})})}let er=z&&!!_&&(!h||!!(J&&J!==xn)),tr=[`chat-app-layout`,z?`sparkbit-chat-layout`:``].filter(Boolean).join(` `),nr=z?`sparkbit-chat-action-menu`:void 0,rr=h?(0,C.jsx)(`h2`,{className:`header-title`,translate:`no`,children:A(h)}):(0,C.jsx)(`h2`,{className:`header-title`,children:W(`chat.title`)}),ir=!!(Y&&G.room?.channelName===Y.channelName),ar=G.participants.filter(e=>!e.local).length,or=G.joined?ar:G.participants.length,sr=!z&&ir&&(G.joined||G.participants.length>0),cr=G.joined?W(`chat.voice.bannerJoined`,{count:or}):W(`chat.voice.bannerActive`,{count:or});function lr(){Y&&G.openRoom(Y)}let ur=pe.trim().toLowerCase(),dr=(0,S.useMemo)(()=>[...f].sort((e,t)=>{let n=Number(!!t.pinned)-Number(!!e.pinned);if(n!==0)return n;let r=T(t)-T(e);return r===0?cn(A(e),A(t)):r}),[f,cn]),fr=ur?dr.filter(e=>[A(e),O(e),D(e)].some(e=>e.toLowerCase().includes(ur))):dr;return(0,C.jsxs)(de,{className:tr,defaultHide:z,hideAccountMenu:z,sidebar:({closeSidebar:e})=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Ee,{onNavigate:e}),(0,C.jsx)(`div`,{className:`chat-channel-search`,children:(0,C.jsxs)(`div`,{className:`ui-input-control`,children:[(0,C.jsx)(me,{className:`ui-input-icon`,size:15}),(0,C.jsx)(`input`,{type:`search`,className:`input input-compact`,placeholder:W(`chat.search.placeholder`),value:pe,onChange:e=>_e(e.target.value),"aria-label":W(`chat.search.placeholder`)})]})}),(0,C.jsx)(`nav`,{className:`sidebar-nav`,children:f.length===0?(0,C.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,C.jsx)(`p`,{children:W(`chat.empty.noChannels`)})}):fr.length===0?(0,C.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,C.jsx)(`p`,{children:W(`chat.empty.noMatches`)})}):fr.map(t=>(0,C.jsx)(Xe,{active:D(h)===D(t),pinned:!!t.pinned,unread:st(t,Ht),title:A(t),menuClassName:nr,onSelect:()=>{Pn(t),e()},onTogglePin:()=>void In(t),onRename:()=>N(t),onLeave:()=>{k(t),E.open()}},D(t)))}),(0,C.jsxs)(`button`,{className:`ui-action-dashed create-channel-btn`,onClick:()=>{!Q()||!Z()||Re.open()},children:[(0,C.jsx)(ee,{size:16}),W(`chat.joinChannel`)]})]}),headerTitle:rr,sidebarToggleReplacement:z?(0,C.jsx)(`span`,{className:`sidebar-toggle-static-logo`,"aria-hidden":`true`,children:Zt?(0,C.jsx)(`img`,{className:`sidebar-toggle-static-logo-img`,src:Zt,alt:``,onError:()=>{if(Zt===Xt){Vt(!0);return}zt(!0)}}):(0,C.jsx)(De,{size:18})}):void 0,headerRight:(0,C.jsx)(`div`,{className:`header-right-actions`,children:h&&(0,C.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>P(!0),title:W(`chat.channelSettings`),children:(0,C.jsx)(Be,{size:16})})}),children:[er?(0,C.jsx)(Fe,{}):h?(0,C.jsxs)(C.Fragment,{children:[sr&&(0,C.jsxs)(`button`,{type:`button`,className:`chat-voice-banner`,onClick:lr,title:W(`chat.voice.expand`),children:[(0,C.jsx)(`span`,{className:`chat-voice-banner-icon`,children:(0,C.jsx)(he,{size:18})}),(0,C.jsx)(`span`,{className:`chat-voice-banner-label`,children:cr}),(0,C.jsx)(se,{size:18})]}),(0,C.jsxs)(`div`,{className:`chat-messages`,children:[X.length===0?(0,C.jsxs)(`div`,{className:`ui-empty-state chat-messages-empty`,children:[(0,C.jsx)(`div`,{className:`ui-empty-icon empty-icon`,children:(0,C.jsx)(fe,{size:28})}),(0,C.jsx)(`p`,{children:W(`chat.empty.noMessages`)})]}):X.map(e=>{if(_t(e))return(0,C.jsx)(Je,{children:W(`chat.system.memberJoined`,{name:Un(e)})},e.id||`${e.author}-${e.timestamp}`);let t=e.author?.toLowerCase()===a?.address.toLowerCase(),n=Tn.get(M(e.author)),r=wn.get(M(e.author)),i=Dn.has(M(e.author)),o=n?.avatar||r?.avatar||e.avatar||(t?a.avatar:void 0),s=Un(e);return(0,C.jsx)(Ye,{variant:t?`self`:`other`,pending:e.pending,isOnline:i,avatarSrc:xe(e.author,o),author:s,time:un(e.timestamp),children:Zn(e)},e.id||`${e.author}-${e.timestamp}`)}),(0,C.jsx)(`div`,{ref:Qt})]}),(0,C.jsx)(Qe,{message:ye,placeholder:W(a?`chat.composer.placeholder`:`chat.composer.signInPlaceholder`),disabled:!a,isPublishingAttachment:Pt,attachmentInputRef:$t,attachmentMenuClassName:nr,showVoiceRoom:!z,onMessageChange:Se,onSend:zn,onOpenVoiceRoom:lr,onSelectAttachmentFiles:e=>{Vn(e)}})]}):(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(`div`,{className:`ui-empty-state chat-welcome`,children:[(0,C.jsx)(`div`,{className:`ui-empty-icon ui-empty-icon-lg welcome-icon`,children:(0,C.jsx)(fe,{size:36})}),(0,C.jsx)(`h2`,{className:`ui-empty-title`,children:W(`chat.select.title`)}),(0,C.jsx)(`p`,{className:`ui-empty-desc`,children:W(`chat.select.desc`)}),(0,C.jsx)(ne,{label:W(`chat.openChannelList`)})]})}),Oe&&(0,C.jsx)(ge,{title:W(`chat.joinChannel`),placeholder:W(`chat.join.placeholder`),confirmText:W(`chat.join.confirm`),validate:On,onConfirm:Ln,onClose:()=>Re.close(),isLoading:w,loadingText:W(`chat.join.joining`)}),j&&(0,C.jsx)(ge,{title:W(`chat.renameChannel`),placeholder:W(`chat.remark.placeholder`),defaultValue:j.remark||``,confirmText:W(`chat.remark.save`),onConfirm:Xn,onClose:()=>{At||N(null)},isLoading:At,loadingText:W(`chat.remark.saving`),allowEmpty:!0,validate:e=>e.length>50?W(`chat.remark.tooLong`):``}),tt&&ht&&(0,C.jsx)(Te,{title:W(`chat.leaveChannel`),message:W(`chat.leaveConfirm`,{channel:A(ht)}),confirmText:W(Ge?`chat.leaving`:`chat.leaveChannel`),onConfirm:()=>Fn(D(ht),void 0),danger:!0,onClose:()=>{E.close(),k(null)}}),L&&(0,C.jsx)(be,{onClose:()=>R(null),children:(0,C.jsxs)(`div`,{className:`confirm-modal`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`modal-header`,children:[(0,C.jsx)(`h3`,{children:W(`chat.attachment.noSeedsTitle`)}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>R(null),"aria-label":W(`common.close`),children:(0,C.jsx)(ve,{size:18})})]}),(0,C.jsx)(`p`,{children:F[L.cid]?.message||W(`chat.attachment.noSeedsFallback`)}),(0,C.jsxs)(`div`,{className:`modal-actions`,children:[(0,C.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>R(null),children:W(`common.cancel`)}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>Mn(L),disabled:F[L.cid]?.status===`checking`,children:F[L.cid]?.status===`checking`?W(`app.checking`):W(`chat.attachment.retryCheck`)})]})]})}),Mt&&(0,C.jsx)(re,{item:Mt,isBackendReady:U,getFileDownloadUrl:b.getFileDownloadUrl,onSaveAs:An,onClose:()=>Nt(null)}),Dt&&h&&(0,C.jsx)(`div`,{className:`channel-detail-overlay`,onClick:()=>P(!1),children:(0,C.jsxs)(`div`,{className:`channel-detail-drawer`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`channel-detail-header`,children:[(0,C.jsx)(`h3`,{children:W(`chat.details.title`)}),(0,C.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>P(!1),children:(0,C.jsx)(ve,{size:18})})]}),(0,C.jsxs)(`div`,{className:`channel-detail-body`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-section channel-members-section`,children:[(0,C.jsx)(`div`,{className:`channel-detail-label`,children:(0,C.jsx)(`span`,{children:W(`chat.details.members`,{count:En.length})})}),$n()]}),Kt&&(0,C.jsx)(`div`,{className:`channel-detail-section`,children:(0,C.jsxs)(`a`,{className:`btn btn-primary btn-block`,href:Kt,target:`_blank`,rel:`noreferrer`,children:[(0,C.jsx)(ce,{size:16}),W(`chat.ticket.create`)]})}),!z&&(0,C.jsx)(`div`,{className:`channel-detail-section`,children:(0,C.jsxs)(`label`,{className:`setting-switch`,children:[(0,C.jsx)(`span`,{children:W(`chat.details.showAddressSuffix`)}),(0,C.jsx)(`input`,{type:`checkbox`,checked:It,onChange:e=>Lt(e.target.checked)})]})}),!z&&(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(Le,{size:14}),(0,C.jsx)(`span`,{children:W(`chat.details.channelId`)})]}),(0,C.jsx)(`div`,{className:`ui-meta-box channel-detail-value channel-detail-mono`,translate:`no`,children:O(h)})]}),!z&&(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(ie,{size:14}),(0,C.jsx)(`span`,{children:W(`chat.remark.placeholder`)})]}),(0,C.jsx)(`input`,{type:`text`,className:`input input-compact`,placeholder:W(`chat.remark.placeholder`),value:Ot,onChange:e=>kt(e.target.value),onFocus:()=>kt(h.remark||``),onBlur:()=>Yn(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},maxLength:50})]}),(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(Ie,{size:14}),(0,C.jsx)(`span`,{children:W(`chat.channel.createdAt`)})]}),(0,C.jsx)(`div`,{className:`ui-meta-box channel-detail-value`,children:h.createdAt?ln(h.createdAt):`-`})]}),!z&&(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsx)(`div`,{className:`channel-detail-label`,children:(0,C.jsx)(`span`,{children:W(`chat.noteDraft.settingsTitle`)})}),(0,C.jsx)(`p`,{className:`channel-detail-hint`,children:W(`chat.noteDraft.saveAllDesc`)}),(0,C.jsx)(`button`,{className:`btn btn-secondary btn-block`,onClick:qn,children:W(`chat.noteDraft.saveAll`)})]})]}),!z&&(0,C.jsx)(`div`,{className:`channel-detail-footer`,children:(0,C.jsx)(`button`,{className:`btn btn-secondary btn-block`,onClick:()=>{P(!1),k(h),E.open()},children:W(`chat.leaveChannel`)})})]})})]})}var Dt=a(`/chat/`)({component:N});export{Dt as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a,t as o}from"./useAppStore-DNhyhD20.js";import{a as s}from"./i18n-C6yaqRst.js";import{t as c}from"./arrow-right-BsHzC0ZL.js";import{a as l}from"./AccountMenu-D-wa5tux.js";import{t as u}from"./download-Cy2BlfKM.js";import{t as d}from"./external-link-D_AQSgxW.js";import{t as f}from"./folder-open-DOJ4bB58.js";import{t as p}from"./gamepad-2-BYqNgCQr.js";import{t as m}from"./hard-drive-DL1KJHmG.js";import{t as h}from"./message-square-CfApq8Ou.js";import{t as g}from"./notebook-pen-Bcd3MrtD.js";import{t as _}from"./wallet-D6HZocla.js";import{E as v,k as y}from"./index-D1mozno-.js";import{t as b}from"./MarketingLayout-BPdjpEfc.js";var x=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),S=t(e(),1),C=n(),w=[{id:`app`,titleKey:`portal.feature.app.title`,subtitleKey:`portal.feature.app.subtitle`,icon:(0,C.jsx)(f,{size:28}),path:`/app/`,requiresBackend:!0,heroKey:`portal.feature.app.hero`,descKey:`portal.feature.app.desc`,featureKeys:[`portal.feature.app.bullet.localIdentity`,`portal.feature.app.bullet.hyperswarm`,`portal.feature.app.bullet.largeFiles`,`portal.feature.app.bullet.cid`,`portal.feature.app.bullet.seedAfterDownload`,`portal.feature.app.bullet.noCloud`,`portal.feature.app.bullet.desktop`,`portal.feature.app.bullet.openSource`],steps:[{num:`1`,titleKey:`portal.feature.app.step.download.title`,descKey:`portal.feature.app.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.app.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.app.step.install.title`,descKey:`portal.feature.app.step.install.desc`,hideInDesktopClient:!0},{num:`3`,titleKey:`portal.feature.app.step.share.title`,descKey:`portal.feature.app.step.share.desc`}]},{id:`chat`,titleKey:`portal.feature.chat.title`,subtitleKey:`portal.feature.chat.subtitle`,icon:(0,C.jsx)(h,{size:28}),path:`/chat/`,requiresBackend:!0,heroKey:`portal.feature.chat.hero`,descKey:`portal.feature.chat.desc`,featureKeys:[`portal.feature.chat.bullet.encrypted`,`portal.feature.chat.bullet.identity`,`portal.feature.chat.bullet.sync`,`portal.feature.chat.bullet.offline`,`portal.feature.chat.bullet.noAccount`],steps:[{num:`1`,titleKey:`portal.feature.chat.step.download.title`,descKey:`portal.feature.chat.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.chat.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.chat.step.create.title`,descKey:`portal.feature.chat.step.create.desc`},{num:`3`,titleKey:`portal.feature.chat.step.send.title`,descKey:`portal.feature.chat.step.send.desc`}]},{id:`note`,titleKey:`portal.feature.note.title`,subtitleKey:`portal.feature.note.subtitle`,icon:(0,C.jsx)(g,{size:28}),path:`/note/`,requiresBackend:!1,heroKey:`portal.feature.note.hero`,descKey:`portal.feature.note.desc`,featureKeys:[`portal.feature.note.bullet.markdown`,`portal.feature.note.bullet.privacy`,`portal.feature.note.bullet.folders`,`portal.feature.note.bullet.web3`,`portal.feature.note.bullet.backup`,`portal.feature.note.bullet.independent`],steps:[{num:`1`,titleKey:`portal.feature.note.step.account.title`,descKey:`portal.feature.note.step.account.desc`},{num:`2`,titleKey:`portal.feature.note.step.create.title`,descKey:`portal.feature.note.step.create.desc`},{num:`3`,titleKey:`portal.feature.note.step.backup.title`,descKey:`portal.feature.note.step.backup.desc`}]},{id:`gandengyan`,titleKey:`portal.feature.game.title`,subtitleKey:`portal.feature.game.subtitle`,icon:(0,C.jsx)(p,{size:28}),path:`/game/gandengyan/`,requiresBackend:!0,heroKey:`portal.feature.game.hero`,descKey:`portal.feature.game.desc`,featureKeys:[`portal.feature.game.bullet.account`,`portal.feature.game.bullet.channel`,`portal.feature.game.bullet.link`,`portal.feature.game.bullet.rules`,`portal.feature.game.bullet.maintain`],steps:[{num:`1`,titleKey:`portal.feature.game.step.login.title`,descKey:`portal.feature.game.step.login.desc`},{num:`2`,titleKey:`portal.feature.game.step.create.title`,descKey:`portal.feature.game.step.create.desc`},{num:`3`,titleKey:`portal.feature.game.step.test.title`,descKey:`portal.feature.game.step.test.desc`}]},{id:`web3`,titleKey:`portal.feature.web3.title`,subtitleKey:`portal.feature.web3.subtitle`,icon:(0,C.jsx)(_,{size:28}),path:`/web3/`,requiresBackend:!1,heroKey:`portal.feature.web3.hero`,descKey:`portal.feature.web3.desc`,featureKeys:[`portal.feature.web3.bullet.frontend`,`portal.feature.web3.bullet.keys`,`portal.feature.web3.bullet.mnemonic`,`portal.feature.web3.bullet.eth`,`portal.feature.web3.bullet.pem`,`portal.feature.web3.bullet.qr`],steps:[{num:`1`,titleKey:`portal.feature.web3.step.username.title`,descKey:`portal.feature.web3.step.username.desc`},{num:`2`,titleKey:`portal.feature.web3.step.keys.title`,descKey:`portal.feature.web3.step.keys.desc`},{num:`3`,titleKey:`portal.feature.web3.step.export.title`,descKey:`portal.feature.web3.step.export.desc`}]}],T=[`chat`,`app`,`note`,`gandengyan`,`web3`];function E(){let e=o(e=>e.hasBackend),t=o(e=>e.openConnectModal),[n,r]=(0,S.useState)(`chat`),{t:i}=s(),f=v(),p=T.map(e=>w.find(t=>t.id===e)).filter(e=>!!e),h=p.find(e=>e.id===n)||p[0],g=i(h.titleKey),_=h.steps.filter(e=>!(f&&e.hideInDesktopClient));return(0,C.jsxs)(`div`,{className:`portal-page`,children:[(0,C.jsx)(`section`,{className:`portal-hero`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`h1`,{className:`portal-hero-title`,children:i(`common.brand`)}),(0,C.jsx)(`p`,{className:`portal-hero-subtitle`,children:i(`portal.hero.subtitle`)})]})}),(0,C.jsx)(`section`,{className:`portal-cards-section`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`div`,{className:`portal-cards`,children:p.map(t=>{let o=n===t.id,s=t.requiresBackend,c=s?e===!0?`connected`:e===!1?`disconnected`:`checking`:`none`,l=i(t.titleKey);return(0,C.jsxs)(`button`,{className:`portal-card ${o?`active`:``}`,onClick:()=>r(t.id),children:[(0,C.jsx)(a,{to:t.path,className:`btn btn-icon portal-card-open-btn`,onClick:e=>e.stopPropagation(),title:i(`portal.openFeature`,{title:l}),children:(0,C.jsx)(x,{size:16})}),(0,C.jsx)(`div`,{className:`portal-card-icon`,children:t.icon}),(0,C.jsx)(`div`,{className:`portal-card-title`,children:l}),(0,C.jsx)(`div`,{className:`portal-card-subtitle`,children:i(t.subtitleKey)}),s?(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ${c}`,children:[c===`checking`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot checking`}),i(`common.status.checking`)]}),c===`connected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot connected`}),i(`common.status.connected`)]}),c===`disconnected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot disconnected`}),i(`common.status.needsConnection`)]})]}):(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ready`,children:[(0,C.jsx)(`span`,{className:`status-dot ready`}),i(`common.status.ready`)]})]},t.id)})}),(0,C.jsxs)(`div`,{className:`portal-node-actions`,"aria-label":i(`portal.nodeEntry`),children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),(0,C.jsxs)(a,{to:`/admin/`,className:`btn btn-secondary`,children:[(0,C.jsx)(m,{size:16}),i(`portal.nodeAdmin`)]})]})]})}),(0,C.jsx)(`section`,{className:`portal-marketing`,children:(0,C.jsx)(`div`,{className:`mkt-container`,children:(0,C.jsxs)(`div`,{className:`portal-marketing-inner`,children:[(0,C.jsxs)(`div`,{className:`portal-marketing-header`,children:[(0,C.jsx)(`h2`,{children:i(h.heroKey)}),(0,C.jsx)(`p`,{children:i(h.descKey)})]}),(0,C.jsx)(`div`,{className:`portal-marketing-features`,children:h.featureKeys.map(e=>(0,C.jsxs)(`div`,{className:`portal-feature-item`,children:[(0,C.jsx)(`span`,{className:`portal-feature-icon`,children:(0,C.jsx)(l,{size:14,strokeWidth:3})}),(0,C.jsx)(`span`,{children:i(e)})]},e))}),(0,C.jsx)(`div`,{className:`portal-marketing-steps`,children:_.map((e,t)=>(0,C.jsxs)(`div`,{className:`portal-step`,children:[(0,C.jsx)(`span`,{className:`portal-step-num`,children:t+1}),(0,C.jsxs)(`div`,{className:`portal-step-content`,children:[(0,C.jsx)(`strong`,{children:i(e.titleKey)}),(0,C.jsx)(`p`,{children:i(e.descKey)}),e.code&&(0,C.jsx)(`code`,{className:`portal-step-code`,translate:`no`,children:e.code}),e.link&&e.linkTextKey&&(0,C.jsx)(`p`,{className:`portal-step-link`,children:(0,C.jsxs)(a,{to:e.link,children:[i(e.linkTextKey),` `,(0,C.jsx)(d,{size:12})]})})]})]},e.num))}),(0,C.jsxs)(`div`,{className:`portal-actions`,children:[(0,C.jsxs)(a,{to:h.path,className:`btn btn-primary`,children:[i(`portal.enterFeature`,{title:g}),(0,C.jsx)(c,{size:16})]}),h.requiresBackend&&e===!1&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),!f&&(0,C.jsxs)(a,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(u,{size:16}),i(`nav.downloadClient`)]})]})]})]})})})]})}function D(){return(0,C.jsx)(b,{children:(0,C.jsx)(E,{})})}var O=i(`/`)({component:D});export{O as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a,t as o}from"./useAppStore-DNhyhD20.js";import{a as s}from"./i18n-DKsg67mH.js";import{t as c}from"./arrow-right-BsHzC0ZL.js";import{a as l}from"./AccountMenu-B26qus-Q.js";import{t as u}from"./download-Cy2BlfKM.js";import{t as d}from"./external-link-D_AQSgxW.js";import{t as f}from"./folder-open-DOJ4bB58.js";import{t as p}from"./gamepad-2-BYqNgCQr.js";import{t as m}from"./hard-drive-DL1KJHmG.js";import{t as h}from"./message-square-CfApq8Ou.js";import{t as g}from"./notebook-pen-Bcd3MrtD.js";import{t as _}from"./wallet-D6HZocla.js";import{E as v,k as y}from"./index-mjFWLwue.js";import{t as b}from"./MarketingLayout-Ch4sw5Qm.js";var x=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),S=t(e(),1),C=n(),w=[{id:`app`,titleKey:`portal.feature.app.title`,subtitleKey:`portal.feature.app.subtitle`,icon:(0,C.jsx)(f,{size:28}),path:`/app/`,requiresBackend:!0,heroKey:`portal.feature.app.hero`,descKey:`portal.feature.app.desc`,featureKeys:[`portal.feature.app.bullet.localIdentity`,`portal.feature.app.bullet.hyperswarm`,`portal.feature.app.bullet.largeFiles`,`portal.feature.app.bullet.cid`,`portal.feature.app.bullet.seedAfterDownload`,`portal.feature.app.bullet.noCloud`,`portal.feature.app.bullet.desktop`,`portal.feature.app.bullet.openSource`],steps:[{num:`1`,titleKey:`portal.feature.app.step.download.title`,descKey:`portal.feature.app.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.app.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.app.step.install.title`,descKey:`portal.feature.app.step.install.desc`,hideInDesktopClient:!0},{num:`3`,titleKey:`portal.feature.app.step.share.title`,descKey:`portal.feature.app.step.share.desc`}]},{id:`chat`,titleKey:`portal.feature.chat.title`,subtitleKey:`portal.feature.chat.subtitle`,icon:(0,C.jsx)(h,{size:28}),path:`/chat/`,requiresBackend:!0,heroKey:`portal.feature.chat.hero`,descKey:`portal.feature.chat.desc`,featureKeys:[`portal.feature.chat.bullet.encrypted`,`portal.feature.chat.bullet.identity`,`portal.feature.chat.bullet.sync`,`portal.feature.chat.bullet.offline`,`portal.feature.chat.bullet.noAccount`],steps:[{num:`1`,titleKey:`portal.feature.chat.step.download.title`,descKey:`portal.feature.chat.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.chat.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.chat.step.create.title`,descKey:`portal.feature.chat.step.create.desc`},{num:`3`,titleKey:`portal.feature.chat.step.send.title`,descKey:`portal.feature.chat.step.send.desc`}]},{id:`note`,titleKey:`portal.feature.note.title`,subtitleKey:`portal.feature.note.subtitle`,icon:(0,C.jsx)(g,{size:28}),path:`/note/`,requiresBackend:!1,heroKey:`portal.feature.note.hero`,descKey:`portal.feature.note.desc`,featureKeys:[`portal.feature.note.bullet.markdown`,`portal.feature.note.bullet.privacy`,`portal.feature.note.bullet.folders`,`portal.feature.note.bullet.web3`,`portal.feature.note.bullet.backup`,`portal.feature.note.bullet.independent`],steps:[{num:`1`,titleKey:`portal.feature.note.step.account.title`,descKey:`portal.feature.note.step.account.desc`},{num:`2`,titleKey:`portal.feature.note.step.create.title`,descKey:`portal.feature.note.step.create.desc`},{num:`3`,titleKey:`portal.feature.note.step.backup.title`,descKey:`portal.feature.note.step.backup.desc`}]},{id:`gandengyan`,titleKey:`portal.feature.game.title`,subtitleKey:`portal.feature.game.subtitle`,icon:(0,C.jsx)(p,{size:28}),path:`/game/gandengyan/`,requiresBackend:!0,heroKey:`portal.feature.game.hero`,descKey:`portal.feature.game.desc`,featureKeys:[`portal.feature.game.bullet.account`,`portal.feature.game.bullet.channel`,`portal.feature.game.bullet.link`,`portal.feature.game.bullet.rules`,`portal.feature.game.bullet.maintain`],steps:[{num:`1`,titleKey:`portal.feature.game.step.login.title`,descKey:`portal.feature.game.step.login.desc`},{num:`2`,titleKey:`portal.feature.game.step.create.title`,descKey:`portal.feature.game.step.create.desc`},{num:`3`,titleKey:`portal.feature.game.step.test.title`,descKey:`portal.feature.game.step.test.desc`}]},{id:`web3`,titleKey:`portal.feature.web3.title`,subtitleKey:`portal.feature.web3.subtitle`,icon:(0,C.jsx)(_,{size:28}),path:`/web3/`,requiresBackend:!1,heroKey:`portal.feature.web3.hero`,descKey:`portal.feature.web3.desc`,featureKeys:[`portal.feature.web3.bullet.frontend`,`portal.feature.web3.bullet.keys`,`portal.feature.web3.bullet.mnemonic`,`portal.feature.web3.bullet.eth`,`portal.feature.web3.bullet.pem`,`portal.feature.web3.bullet.qr`],steps:[{num:`1`,titleKey:`portal.feature.web3.step.username.title`,descKey:`portal.feature.web3.step.username.desc`},{num:`2`,titleKey:`portal.feature.web3.step.keys.title`,descKey:`portal.feature.web3.step.keys.desc`},{num:`3`,titleKey:`portal.feature.web3.step.export.title`,descKey:`portal.feature.web3.step.export.desc`}]}],T=[`chat`,`app`,`note`,`gandengyan`,`web3`];function E(){let e=o(e=>e.hasBackend),t=o(e=>e.openConnectModal),[n,r]=(0,S.useState)(`chat`),{t:i}=s(),f=v(),p=T.map(e=>w.find(t=>t.id===e)).filter(e=>!!e),h=p.find(e=>e.id===n)||p[0],g=i(h.titleKey),_=h.steps.filter(e=>!(f&&e.hideInDesktopClient));return(0,C.jsxs)(`div`,{className:`portal-page`,children:[(0,C.jsx)(`section`,{className:`portal-hero`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`h1`,{className:`portal-hero-title`,children:i(`common.brand`)}),(0,C.jsx)(`p`,{className:`portal-hero-subtitle`,children:i(`portal.hero.subtitle`)})]})}),(0,C.jsx)(`section`,{className:`portal-cards-section`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`div`,{className:`portal-cards`,children:p.map(t=>{let o=n===t.id,s=t.requiresBackend,c=s?e===!0?`connected`:e===!1?`disconnected`:`checking`:`none`,l=i(t.titleKey);return(0,C.jsxs)(`button`,{className:`portal-card ${o?`active`:``}`,onClick:()=>r(t.id),children:[(0,C.jsx)(a,{to:t.path,className:`btn btn-icon portal-card-open-btn`,onClick:e=>e.stopPropagation(),title:i(`portal.openFeature`,{title:l}),children:(0,C.jsx)(x,{size:16})}),(0,C.jsx)(`div`,{className:`portal-card-icon`,children:t.icon}),(0,C.jsx)(`div`,{className:`portal-card-title`,children:l}),(0,C.jsx)(`div`,{className:`portal-card-subtitle`,children:i(t.subtitleKey)}),s?(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ${c}`,children:[c===`checking`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot checking`}),i(`common.status.checking`)]}),c===`connected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot connected`}),i(`common.status.connected`)]}),c===`disconnected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot disconnected`}),i(`common.status.needsConnection`)]})]}):(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ready`,children:[(0,C.jsx)(`span`,{className:`status-dot ready`}),i(`common.status.ready`)]})]},t.id)})}),(0,C.jsxs)(`div`,{className:`portal-node-actions`,"aria-label":i(`portal.nodeEntry`),children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),(0,C.jsxs)(a,{to:`/admin/`,className:`btn btn-secondary`,children:[(0,C.jsx)(m,{size:16}),i(`portal.nodeAdmin`)]})]})]})}),(0,C.jsx)(`section`,{className:`portal-marketing`,children:(0,C.jsx)(`div`,{className:`mkt-container`,children:(0,C.jsxs)(`div`,{className:`portal-marketing-inner`,children:[(0,C.jsxs)(`div`,{className:`portal-marketing-header`,children:[(0,C.jsx)(`h2`,{children:i(h.heroKey)}),(0,C.jsx)(`p`,{children:i(h.descKey)})]}),(0,C.jsx)(`div`,{className:`portal-marketing-features`,children:h.featureKeys.map(e=>(0,C.jsxs)(`div`,{className:`portal-feature-item`,children:[(0,C.jsx)(`span`,{className:`portal-feature-icon`,children:(0,C.jsx)(l,{size:14,strokeWidth:3})}),(0,C.jsx)(`span`,{children:i(e)})]},e))}),(0,C.jsx)(`div`,{className:`portal-marketing-steps`,children:_.map((e,t)=>(0,C.jsxs)(`div`,{className:`portal-step`,children:[(0,C.jsx)(`span`,{className:`portal-step-num`,children:t+1}),(0,C.jsxs)(`div`,{className:`portal-step-content`,children:[(0,C.jsx)(`strong`,{children:i(e.titleKey)}),(0,C.jsx)(`p`,{children:i(e.descKey)}),e.code&&(0,C.jsx)(`code`,{className:`portal-step-code`,translate:`no`,children:e.code}),e.link&&e.linkTextKey&&(0,C.jsx)(`p`,{className:`portal-step-link`,children:(0,C.jsxs)(a,{to:e.link,children:[i(e.linkTextKey),` `,(0,C.jsx)(d,{size:12})]})})]})]},e.num))}),(0,C.jsxs)(`div`,{className:`portal-actions`,children:[(0,C.jsxs)(a,{to:h.path,className:`btn btn-primary`,children:[i(`portal.enterFeature`,{title:g}),(0,C.jsx)(c,{size:16})]}),h.requiresBackend&&e===!1&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),!f&&(0,C.jsxs)(a,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(u,{size:16}),i(`nav.downloadClient`)]})]})]})]})})})]})}function D(){return(0,C.jsx)(b,{children:(0,C.jsx)(E,{})})}var O=i(`/`)({component:D});export{O as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,G as a,H as o,W as s,o as ee,t as c,u as te}from"./useAppStore-DNhyhD20.js";import{a as l}from"./i18n-C6yaqRst.js";import{t as u}from"./triangle-alert-BhNtjKm2.js";import{t as d}from"./download-Cy2BlfKM.js";import{t as ne}from"./external-link-D_AQSgxW.js";import{t as re}from"./file-text-zvTER2mN.js";import{t as f}from"./hard-drive-DL1KJHmG.js";import{t as p}from"./refresh-cw-CfkUlTK9.js";import{I as m,L as h}from"./index-D1mozno-.js";import{t as ie}from"./MarketingHeader-8gNzHawY.js";import{t as g}from"./format-CAKfypjK.js";import{n as _,r as ae,s as oe,t as v}from"./downloadValidation-Dd43i9_9.js";var se=r(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),y=r(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),b=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),x=r(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),S=t(e(),1),C=n(),ce=1800;function w(e,t){return`most://${e}${t||``}`}function le(e,t){let n=e.trim().replace(/[\\/]+$/,``);return n?`${n}${n.includes(`\\`)?`\\`:`/`}downloads`:t}function T(e,t){let n=e[t];return typeof n==`string`?n:void 0}function E(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function D(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t,r=T(n,`event`),i=n.data;if(!r||!i||typeof i!=`object`)return null;let a=i;return{event:r,payload:{taskId:T(a,`taskId`),percent:E(a,`percent`),loaded:E(a,`loaded`),total:E(a,`total`),file:T(a,`file`),fileName:T(a,`fileName`),error:T(a,`error`)}}}function O(){let{t:e}=l(),{cid:t}=a({from:`/cid/$cid/`}),n=h({select:e=>e.searchStr}),r=c(e=>e.hasBackend),o=c(e=>e.addToast),m=c(e=>e.openConnectModal),T=i(e=>e.identity),E=i(e=>e.openLoginModal),O=(0,S.useMemo)(()=>w(t,n),[t,n]),k=(0,S.useMemo)(()=>oe(O),[O]),A=(0,S.useMemo)(()=>v(O,e),[O,e]),fe=k.fileName||t,[j,M]=(0,S.useState)({status:`idle`,message:``}),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)({status:`idle`,message:``}),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)(0),[V,H]=(0,S.useState)(null),[U,W]=(0,S.useState)(null),[pe,G]=(0,S.useState)(``),[me,K]=(0,S.useState)(!1),q=(0,S.useRef)(0),J=(0,S.useRef)(null),Y=N?.fileName||fe,X=N?.size??U,Z=j.status===`available`||j.status===`already-local`,Q=F.status===`starting`||F.status===`downloading`,he=le(pe,e(`cid.saveToFallback`)),$=(0,S.useCallback)(async()=>{let t=q.current+1;if(q.current=t,R(``),B(0),H(null),W(null),I({status:`idle`,message:``}),A){P(null),M({status:`error`,message:A});return}if(r===null){P(null),M({status:`waiting-backend`,message:e(`cid.status.waitingBackend`)});return}if(r!==!0){P(null),M({status:`backend-missing`,message:e(`cid.status.backendMissing`)});return}if(!T){P(null),M({status:`login-required`,message:e(`cid.status.loginRequired`)});return}M({status:`checking`,message:e(`cid.status.checking`)}),P(null);try{let n=await _.checkDownload(O);if(q.current!==t)return;P(n),M({status:n.alreadyExists?`already-local`:`available`,message:n.alreadyExists?e(`cid.status.alreadyLocal`,{fileName:n.fileName}):e(`cid.status.available`,{fileName:n.fileName})})}catch(e){if(q.current!==t)return;M({status:`error`,message:await ae(e)}),P(null)}},[r,O,e,T,A]);(0,S.useEffect)(()=>{document.title=e(`cid.meta.title`)},[e]),(0,S.useEffect)(()=>{let e=()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},t=()=>{document.visibilityState===`hidden`&&(e(),K(!1))};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,t),()=>{e(),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,t)}},[]),(0,S.useEffect)(()=>{$()},[$]),(0,S.useEffect)(()=>{if(r!==!0)return;let e=!1;return _.getDataPath().then(t=>{e||G(t.dataPath)}).catch(()=>{e||G(``)}),()=>{e=!0}},[r]),(0,S.useEffect)(()=>{if(!L||!T)return;let t=null,n=!1;return(async()=>{if(t=new WebSocket(await te(`/ws`)),n){t.close();return}t.onmessage=t=>{let n=D(t.data);!n||n.payload.taskId!==L||(n.event===`download:progress`&&(B(n.payload.percent||0),H(n.payload.loaded??null),W(n.payload.total??null)),n.event===`download:status`&&I({status:`downloading`,message:n.payload.file?e(`cid.status.downloadingFile`,{fileName:n.payload.file}):e(`cid.status.downloading`)}),n.event===`download:success`&&(B(100),I({status:`completed`,message:e(`cid.status.downloadComplete`,{fileName:n.payload.fileName||Y})}),o(e(`cid.toast.downloadComplete`),`success`)),n.event===`download:error`&&(I({status:`error`,message:n.payload.error||e(`cid.status.downloadFailed`,{error:``})}),o(e(`cid.toast.downloadFailed`,{error:n.payload.error||e(`cid.errorFallback`)}),`error`)),n.event===`download:cancelled`&&(I({status:`cancelled`,message:e(`cid.status.cancelled`)}),o(e(`cid.toast.cancelled`),`warning`)))}})(),()=>{n=!0,t?.close()}},[o,Y,e,L,T]);let ge=async()=>{if(!T){E();return}if(r!==!0){m();return}if(!(!Z||Q)){I({status:`starting`,message:e(`cid.status.startingDownload`)}),B(0);try{let t=await _.downloadFile(O);if(t.alreadyExists){I({status:`completed`,message:e(`cid.status.alreadyLocal`,{fileName:t.fileName||Y})}),o(e(`cid.toast.alreadyLocal`),`warning`);return}t.taskId&&(R(t.taskId),I({status:`downloading`,message:e(`cid.status.downloading`)}),o(e(`cid.toast.downloadStarted`),`info`))}catch(t){let n=await ee(t,e(`cid.status.downloadFailed`,{error:e(`cid.errorFallback`)}));I({status:`error`,message:n}),o(n,`error`)}}},_e=()=>{K(!1),J.current!==null&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{J.current=null,document.visibilityState!==`hidden`&&K(!0)},ce)},ve=async()=>{L&&await _.cancelDownload(L).catch(()=>{})},ye=ue(j.status,F.status);return(0,C.jsxs)(`div`,{className:`cid-layout`,children:[(0,C.jsx)(ie,{}),(0,C.jsx)(`main`,{className:`cid-page`,children:(0,C.jsxs)(`section`,{className:`cid-shell`,children:[(0,C.jsxs)(`div`,{className:`cid-heading`,children:[(0,C.jsx)(`span`,{className:`cid-kicker`,children:e(`cid.kicker`)}),(0,C.jsx)(`h1`,{children:e(`cid.title`)}),(0,C.jsx)(`p`,{children:e(`cid.subtitle`)})]}),(0,C.jsxs)(`div`,{className:`cid-panel`,children:[(0,C.jsxs)(`div`,{className:`cid-handoff`,"aria-label":e(`cid.handoff.title`),children:[(0,C.jsxs)(`div`,{className:`cid-handoff-copy`,children:[(0,C.jsx)(`p`,{className:`cid-handoff-title`,children:e(`cid.handoff.title`)}),(0,C.jsx)(`p`,{children:e(`cid.handoff.desc`)})]}),(0,C.jsxs)(`a`,{className:`btn btn-primary`,href:O,onClick:_e,children:[(0,C.jsx)(ne,{size:16}),e(`cid.handoff.action`)]})]}),me&&(0,C.jsxs)(`div`,{className:`cid-handoff-fallback`,role:`status`,children:[(0,C.jsx)(u,{size:18}),(0,C.jsx)(`p`,{children:e(`cid.handoff.fallback`)}),(0,C.jsxs)(s,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(d,{size:16}),e(`cid.handoff.downloadAction`)]})]}),(0,C.jsxs)(`div`,{className:`cid-status`,children:[(0,C.jsx)(`span`,{className:`cid-status-icon ${j.status}`,children:ye}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`cid-status-label`,children:de(j.status,e)}),(0,C.jsx)(`p`,{className:`cid-status-message`,children:j.message})]})]}),(0,C.jsxs)(`dl`,{className:`cid-details`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`dt`,{children:[(0,C.jsx)(re,{size:16}),e(`cid.fileNameLabel`)]}),(0,C.jsx)(`dd`,{children:Y})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:e(`cid.cidLabel`)}),(0,C.jsx)(`dd`,{className:`cid-mono`,children:t})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:e(`cid.sizeLabel`)}),(0,C.jsx)(`dd`,{children:X?g(X):e(`cid.unknownSize`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`dt`,{children:[(0,C.jsx)(f,{size:16}),e(`cid.saveToLabel`)]}),(0,C.jsx)(`dd`,{children:he})]})]}),F.status!==`idle`&&(0,C.jsxs)(`div`,{className:`cid-download-state ${F.status}`,children:[(0,C.jsx)(`p`,{children:F.message}),(F.status===`starting`||F.status===`downloading`)&&(0,C.jsxs)(`div`,{className:`cid-progress`,children:[(0,C.jsx)(`progress`,{className:`cid-progress-bar`,value:z,max:100}),(0,C.jsx)(`span`,{children:V!==null&&U!==null?`${g(V)} / ${g(U)}`:`${z}%`})]})]}),(0,C.jsxs)(`div`,{className:`cid-actions`,children:[j.status===`login-required`&&(0,C.jsxs)(`button`,{className:`btn btn-primary`,onClick:E,children:[(0,C.jsx)(b,{size:16}),e(`cid.loginAction`)]}),j.status===`backend-missing`&&(0,C.jsxs)(`button`,{className:`btn btn-primary`,onClick:m,children:[(0,C.jsx)(x,{size:16}),e(`cid.connectAction`)]}),(0,C.jsxs)(`button`,{className:`btn btn-primary`,disabled:!Z||Q,onClick:ge,children:[Q?(0,C.jsx)(y,{className:`cid-spin-icon`,size:16}):(0,C.jsx)(d,{size:16}),e(Q?`cid.downloadingAction`:`cid.startAction`)]}),L&&F.status===`downloading`&&(0,C.jsxs)(`button`,{className:`btn btn-secondary`,onClick:ve,children:[(0,C.jsx)(se,{size:16}),e(`cid.cancelAction`)]}),(0,C.jsxs)(`button`,{className:`btn btn-secondary`,disabled:j.status===`checking`,onClick:$,children:[(0,C.jsx)(p,{size:16}),e(`cid.retryAction`)]}),(0,C.jsx)(s,{to:`/app/`,className:`btn btn-secondary`,children:e(`cid.openAppAction`)})]})]})]})})]})}function ue(e,t){return t===`completed`?(0,C.jsx)(m,{size:28}):t===`error`||e===`error`?(0,C.jsx)(u,{size:28}):e===`checking`||e===`waiting-backend`||t===`starting`||t===`downloading`?(0,C.jsx)(y,{size:28}):e===`backend-missing`?(0,C.jsx)(x,{size:28}):e===`login-required`?(0,C.jsx)(b,{size:28}):(0,C.jsx)(m,{size:28})}function de(e,t){switch(e){case`checking`:return t(`cid.label.checking`);case`available`:return t(`cid.label.available`);case`already-local`:return t(`cid.label.alreadyLocal`);case`login-required`:return t(`cid.label.loginRequired`);case`backend-missing`:return t(`cid.label.backendMissing`);case`waiting-backend`:return t(`cid.label.waitingBackend`);case`error`:return t(`cid.label.error`);default:return t(`cid.label.idle`)}}var k=o(`/cid/$cid/`)({component:O});export{k as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,G as a,H as o,W as s,o as ee,t as c,u as te}from"./useAppStore-DNhyhD20.js";import{a as l}from"./i18n-DKsg67mH.js";import{t as u}from"./triangle-alert-BhNtjKm2.js";import{t as d}from"./download-Cy2BlfKM.js";import{t as ne}from"./external-link-D_AQSgxW.js";import{t as re}from"./file-text-zvTER2mN.js";import{t as f}from"./hard-drive-DL1KJHmG.js";import{t as p}from"./refresh-cw-CfkUlTK9.js";import{I as m,L as h}from"./index-mjFWLwue.js";import{t as ie}from"./MarketingHeader-CJXpogPY.js";import{t as g}from"./format-CAKfypjK.js";import{n as _,r as ae,s as oe,t as v}from"./downloadValidation-Dd43i9_9.js";var se=r(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),y=r(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),b=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),x=r(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),S=t(e(),1),C=n(),ce=1800;function w(e,t){return`most://${e}${t||``}`}function le(e,t){let n=e.trim().replace(/[\\/]+$/,``);return n?`${n}${n.includes(`\\`)?`\\`:`/`}downloads`:t}function T(e,t){let n=e[t];return typeof n==`string`?n:void 0}function E(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function D(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t,r=T(n,`event`),i=n.data;if(!r||!i||typeof i!=`object`)return null;let a=i;return{event:r,payload:{taskId:T(a,`taskId`),percent:E(a,`percent`),loaded:E(a,`loaded`),total:E(a,`total`),file:T(a,`file`),fileName:T(a,`fileName`),error:T(a,`error`)}}}function O(){let{t:e}=l(),{cid:t}=a({from:`/cid/$cid/`}),n=h({select:e=>e.searchStr}),r=c(e=>e.hasBackend),o=c(e=>e.addToast),m=c(e=>e.openConnectModal),T=i(e=>e.identity),E=i(e=>e.openLoginModal),O=(0,S.useMemo)(()=>w(t,n),[t,n]),k=(0,S.useMemo)(()=>oe(O),[O]),A=(0,S.useMemo)(()=>v(O,e),[O,e]),fe=k.fileName||t,[j,M]=(0,S.useState)({status:`idle`,message:``}),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)({status:`idle`,message:``}),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)(0),[V,H]=(0,S.useState)(null),[U,W]=(0,S.useState)(null),[pe,G]=(0,S.useState)(``),[me,K]=(0,S.useState)(!1),q=(0,S.useRef)(0),J=(0,S.useRef)(null),Y=N?.fileName||fe,X=N?.size??U,Z=j.status===`available`||j.status===`already-local`,Q=F.status===`starting`||F.status===`downloading`,he=le(pe,e(`cid.saveToFallback`)),$=(0,S.useCallback)(async()=>{let t=q.current+1;if(q.current=t,R(``),B(0),H(null),W(null),I({status:`idle`,message:``}),A){P(null),M({status:`error`,message:A});return}if(r===null){P(null),M({status:`waiting-backend`,message:e(`cid.status.waitingBackend`)});return}if(r!==!0){P(null),M({status:`backend-missing`,message:e(`cid.status.backendMissing`)});return}if(!T){P(null),M({status:`login-required`,message:e(`cid.status.loginRequired`)});return}M({status:`checking`,message:e(`cid.status.checking`)}),P(null);try{let n=await _.checkDownload(O);if(q.current!==t)return;P(n),M({status:n.alreadyExists?`already-local`:`available`,message:n.alreadyExists?e(`cid.status.alreadyLocal`,{fileName:n.fileName}):e(`cid.status.available`,{fileName:n.fileName})})}catch(e){if(q.current!==t)return;M({status:`error`,message:await ae(e)}),P(null)}},[r,O,e,T,A]);(0,S.useEffect)(()=>{document.title=e(`cid.meta.title`)},[e]),(0,S.useEffect)(()=>{let e=()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},t=()=>{document.visibilityState===`hidden`&&(e(),K(!1))};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,t),()=>{e(),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,t)}},[]),(0,S.useEffect)(()=>{$()},[$]),(0,S.useEffect)(()=>{if(r!==!0)return;let e=!1;return _.getDataPath().then(t=>{e||G(t.dataPath)}).catch(()=>{e||G(``)}),()=>{e=!0}},[r]),(0,S.useEffect)(()=>{if(!L||!T)return;let t=null,n=!1;return(async()=>{if(t=new WebSocket(await te(`/ws`)),n){t.close();return}t.onmessage=t=>{let n=D(t.data);!n||n.payload.taskId!==L||(n.event===`download:progress`&&(B(n.payload.percent||0),H(n.payload.loaded??null),W(n.payload.total??null)),n.event===`download:status`&&I({status:`downloading`,message:n.payload.file?e(`cid.status.downloadingFile`,{fileName:n.payload.file}):e(`cid.status.downloading`)}),n.event===`download:success`&&(B(100),I({status:`completed`,message:e(`cid.status.downloadComplete`,{fileName:n.payload.fileName||Y})}),o(e(`cid.toast.downloadComplete`),`success`)),n.event===`download:error`&&(I({status:`error`,message:n.payload.error||e(`cid.status.downloadFailed`,{error:``})}),o(e(`cid.toast.downloadFailed`,{error:n.payload.error||e(`cid.errorFallback`)}),`error`)),n.event===`download:cancelled`&&(I({status:`cancelled`,message:e(`cid.status.cancelled`)}),o(e(`cid.toast.cancelled`),`warning`)))}})(),()=>{n=!0,t?.close()}},[o,Y,e,L,T]);let ge=async()=>{if(!T){E();return}if(r!==!0){m();return}if(!(!Z||Q)){I({status:`starting`,message:e(`cid.status.startingDownload`)}),B(0);try{let t=await _.downloadFile(O);if(t.alreadyExists){I({status:`completed`,message:e(`cid.status.alreadyLocal`,{fileName:t.fileName||Y})}),o(e(`cid.toast.alreadyLocal`),`warning`);return}t.taskId&&(R(t.taskId),I({status:`downloading`,message:e(`cid.status.downloading`)}),o(e(`cid.toast.downloadStarted`),`info`))}catch(t){let n=await ee(t,e(`cid.status.downloadFailed`,{error:e(`cid.errorFallback`)}));I({status:`error`,message:n}),o(n,`error`)}}},_e=()=>{K(!1),J.current!==null&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{J.current=null,document.visibilityState!==`hidden`&&K(!0)},ce)},ve=async()=>{L&&await _.cancelDownload(L).catch(()=>{})},ye=ue(j.status,F.status);return(0,C.jsxs)(`div`,{className:`cid-layout`,children:[(0,C.jsx)(ie,{}),(0,C.jsx)(`main`,{className:`cid-page`,children:(0,C.jsxs)(`section`,{className:`cid-shell`,children:[(0,C.jsxs)(`div`,{className:`cid-heading`,children:[(0,C.jsx)(`span`,{className:`cid-kicker`,children:e(`cid.kicker`)}),(0,C.jsx)(`h1`,{children:e(`cid.title`)}),(0,C.jsx)(`p`,{children:e(`cid.subtitle`)})]}),(0,C.jsxs)(`div`,{className:`cid-panel`,children:[(0,C.jsxs)(`div`,{className:`cid-handoff`,"aria-label":e(`cid.handoff.title`),children:[(0,C.jsxs)(`div`,{className:`cid-handoff-copy`,children:[(0,C.jsx)(`p`,{className:`cid-handoff-title`,children:e(`cid.handoff.title`)}),(0,C.jsx)(`p`,{children:e(`cid.handoff.desc`)})]}),(0,C.jsxs)(`a`,{className:`btn btn-primary`,href:O,onClick:_e,children:[(0,C.jsx)(ne,{size:16}),e(`cid.handoff.action`)]})]}),me&&(0,C.jsxs)(`div`,{className:`cid-handoff-fallback`,role:`status`,children:[(0,C.jsx)(u,{size:18}),(0,C.jsx)(`p`,{children:e(`cid.handoff.fallback`)}),(0,C.jsxs)(s,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(d,{size:16}),e(`cid.handoff.downloadAction`)]})]}),(0,C.jsxs)(`div`,{className:`cid-status`,children:[(0,C.jsx)(`span`,{className:`cid-status-icon ${j.status}`,children:ye}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`p`,{className:`cid-status-label`,children:de(j.status,e)}),(0,C.jsx)(`p`,{className:`cid-status-message`,children:j.message})]})]}),(0,C.jsxs)(`dl`,{className:`cid-details`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`dt`,{children:[(0,C.jsx)(re,{size:16}),e(`cid.fileNameLabel`)]}),(0,C.jsx)(`dd`,{children:Y})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:e(`cid.cidLabel`)}),(0,C.jsx)(`dd`,{className:`cid-mono`,children:t})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`dt`,{children:e(`cid.sizeLabel`)}),(0,C.jsx)(`dd`,{children:X?g(X):e(`cid.unknownSize`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`dt`,{children:[(0,C.jsx)(f,{size:16}),e(`cid.saveToLabel`)]}),(0,C.jsx)(`dd`,{children:he})]})]}),F.status!==`idle`&&(0,C.jsxs)(`div`,{className:`cid-download-state ${F.status}`,children:[(0,C.jsx)(`p`,{children:F.message}),(F.status===`starting`||F.status===`downloading`)&&(0,C.jsxs)(`div`,{className:`cid-progress`,children:[(0,C.jsx)(`progress`,{className:`cid-progress-bar`,value:z,max:100}),(0,C.jsx)(`span`,{children:V!==null&&U!==null?`${g(V)} / ${g(U)}`:`${z}%`})]})]}),(0,C.jsxs)(`div`,{className:`cid-actions`,children:[j.status===`login-required`&&(0,C.jsxs)(`button`,{className:`btn btn-primary`,onClick:E,children:[(0,C.jsx)(b,{size:16}),e(`cid.loginAction`)]}),j.status===`backend-missing`&&(0,C.jsxs)(`button`,{className:`btn btn-primary`,onClick:m,children:[(0,C.jsx)(x,{size:16}),e(`cid.connectAction`)]}),(0,C.jsxs)(`button`,{className:`btn btn-primary`,disabled:!Z||Q,onClick:ge,children:[Q?(0,C.jsx)(y,{className:`cid-spin-icon`,size:16}):(0,C.jsx)(d,{size:16}),e(Q?`cid.downloadingAction`:`cid.startAction`)]}),L&&F.status===`downloading`&&(0,C.jsxs)(`button`,{className:`btn btn-secondary`,onClick:ve,children:[(0,C.jsx)(se,{size:16}),e(`cid.cancelAction`)]}),(0,C.jsxs)(`button`,{className:`btn btn-secondary`,disabled:j.status===`checking`,onClick:$,children:[(0,C.jsx)(p,{size:16}),e(`cid.retryAction`)]}),(0,C.jsx)(s,{to:`/app/`,className:`btn btn-secondary`,children:e(`cid.openAppAction`)})]})]})]})})]})}function ue(e,t){return t===`completed`?(0,C.jsx)(m,{size:28}):t===`error`||e===`error`?(0,C.jsx)(u,{size:28}):e===`checking`||e===`waiting-backend`||t===`starting`||t===`downloading`?(0,C.jsx)(y,{size:28}):e===`backend-missing`?(0,C.jsx)(x,{size:28}):e===`login-required`?(0,C.jsx)(b,{size:28}):(0,C.jsx)(m,{size:28})}function de(e,t){switch(e){case`checking`:return t(`cid.label.checking`);case`available`:return t(`cid.label.available`);case`already-local`:return t(`cid.label.alreadyLocal`);case`login-required`:return t(`cid.label.loginRequired`);case`backend-missing`:return t(`cid.label.backendMissing`);case`waiting-backend`:return t(`cid.label.waitingBackend`);case`error`:return t(`cid.label.error`);default:return t(`cid.label.idle`)}}var k=o(`/cid/$cid/`)({component:O});export{k as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,O as ee,W as o,n as te,o as ne,t as s}from"./useAppStore-DNhyhD20.js";import{a as c}from"./i18n-C6yaqRst.js";import{t as l}from"./fingerprint-pattern-BT73ASEB.js";import{t as u}from"./circle-alert-DXVkx8p8.js";import{a as d,i as f}from"./AccountMenu-D-wa5tux.js";import{t as re}from"./download-Cy2BlfKM.js";import{t as ie}from"./external-link-D_AQSgxW.js";import{n as ae,t as p}from"./CopyButton-DnFqfCN9.js";import{t as m}from"./loader-C4pED_QP.js";import{t as h}from"./save-CfYzXcxH.js";import{t as g}from"./shield-check-2-h_eEXp.js";import{t as _}from"./upload-BmufnMFu.js";import{I as v,O as y,T as b,_ as x,g as S,h as C,o as oe,v as w,w as se,y as T}from"./index-D1mozno-.js";import{t as E}from"./MarketingLayout-BPdjpEfc.js";import{t as ce}from"./MarketingHeader-8gNzHawY.js";import{n as le}from"./mp-cEQteKUC.js";var ue=r(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),de=r(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),fe=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),pe=r(`wallet-cards`,[[`path`,{d:`M3 11h3.75a2 2 0 0 1 1.6.8l.45.6a4 4 0 0 0 6.4 0l.45-.6a2 2 0 0 1 1.6-.8H21`,key:`1vwh6y`}],[`path`,{d:`M3 7h18`,key:`1uiuf2`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),D=t(e(),1),O=n(),k=[{value:``,labelKey:`profile.avatar.address`},...C.map(e=>({value:x(e),labelKey:`profile.avatar.${e}`}))];function A(e){if(w(e))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function j(e){return e===`disabled`?`is-disabled`:e===`working`?`is-working`:e===`synced`?`is-synced`:e===`error`?`is-error`:`is-idle`}function M({status:e,busy:t}){return t||e===`working`?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):e===`synced`?(0,O.jsx)(v,{size:16}):e===`error`?(0,O.jsx)(u,{size:16}):(0,O.jsx)(g,{size:16})}function N(){let{formatNumber:e,t}=c(),n=s(e=>e.addToast),r=s(e=>e.hasBackend),a=i(e=>e.identity),u=i(e=>e.openLoginModal),v=i(e=>e.setUserIdentity),x=i(e=>e.logoutUser),C=oe(),[w,N]=(0,D.useState)(``),[I,L]=(0,D.useState)(``),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1),[H,U]=(0,D.useState)(null),W=(0,O.jsx)(ce,{});(0,D.useEffect)(()=>{if(!a){N(``),L(``),z(``);return}N(a.displayName||a.username),L(T(a.avatar)||a.avatar||``),z(``)},[a]),(0,D.useEffect)(()=>{a&&C.refreshBackupSummary()},[C.refreshBackupSummary,r,a]);let G=(0,D.useMemo)(()=>a?ee(a.danger):null,[a]),me=(0,D.useMemo)(()=>G?le(G.private_key,G.ed_public_key):``,[G]);if(!a)return(0,O.jsx)(E,{header:W,children:(0,O.jsx)(`section`,{className:`profile-page`,children:(0,O.jsx)(`div`,{className:`profile-container narrow`,children:(0,O.jsxs)(`div`,{className:`profile-empty glass`,children:[(0,O.jsx)(`div`,{className:`profile-empty-icon`,children:(0,O.jsx)(f,{size:34})}),(0,O.jsx)(`h1`,{children:t(`profile.signedOut.title`)}),(0,O.jsx)(`p`,{children:t(`profile.signedOut.desc`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:u,children:[(0,O.jsx)(f,{size:16}),t(`account.signIn`)]})]})})})});let he=T(a.avatar)||a.avatar||``,ge=S(a.address,a.avatar),K=a.address.toLowerCase(),_e=I.trim().length>0,ve=j(C.status),q=C.action===`backup`,J=C.action===`restore`,Y=C.action===`export`,X=C.action===`import`,ye=[{key:`notes`,label:t(`profile.backup.summary.notes`),value:C.notesCount},{key:`files`,label:t(`profile.backup.summary.files`),value:C.backupSummary.filesCount},{key:`trash`,label:t(`profile.backup.summary.trash`),value:C.backupSummary.trashFilesCount},{key:`channels`,label:t(`profile.backup.summary.channels`),value:C.backupSummary.channelsCount}];function be(){U({title:t(`profile.backup.confirm.backupTitle`),message:t(`profile.backup.confirm.backupMessage`),confirmText:t(`profile.backup.action.cloudBackup`),onConfirm:async()=>{U(null),await C.backupToCloud()}})}function xe(){U({title:t(`profile.backup.confirm.restoreTitle`),message:t(`profile.backup.confirm.restoreMessage`),confirmText:t(`profile.backup.action.cloudRestore`),onConfirm:async()=>{U(null),await C.restoreFromCloud({confirm:!1})}})}function Se(){return new Promise(e=>{let n=t=>{U(null),e(t)};U({title:t(`profile.backup.confirm.importTitle`),message:t(`profile.backup.confirm.restore`),confirmText:t(`profile.backup.action.importLocal`),onConfirm:()=>n(!0),onClose:()=>n(!1)})})}function Z(){C.importLocalBackup({requestConfirm:Se})}let Ce=[{key:`cloud-backup`,tone:`cloud-backup`,label:t(q?`profile.backup.status.backingUp`:`profile.backup.action.cloudBackup`),icon:q?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(de,{size:16}),onClick:be},{key:`cloud-restore`,tone:`cloud-restore`,label:t(J?`profile.backup.status.restoring`:`profile.backup.action.cloudRestore`),icon:J?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(ue,{size:16}),onClick:xe},{key:`export-local`,tone:`export-local`,label:t(Y?`profile.backup.status.exporting`:`profile.backup.action.exportLocal`),icon:Y?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(re,{size:16}),onClick:C.exportLocalBackup},{key:`import-local`,tone:`import-local`,label:t(X?`profile.backup.status.importing`:`profile.backup.action.importLocal`),icon:X?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(_,{size:16}),onClick:Z}];async function Q(e){if(r===!0)try{await te.put(`/api/user/profile`,{json:{displayName:e.displayName||e.username,avatar:e.avatar||``,updatedAt:e.profileUpdatedAt||Date.now()}}).json()}catch(e){n(await ne(e,t(`profile.backup.error.profileSaveFailed`)),`error`)}}function $(e){if(!a)return;let r={...a,avatar:e||void 0,profileUpdatedAt:Date.now()};v(r),Q(r),z(``),n(t(`profile.toast.avatarUpdated`),`success`)}function we(){if(!a)return;let e=w.trim()||a.username,r={...a,displayName:e,profileUpdatedAt:Date.now()};v(r),Q(r),N(e),n(t(`profile.toast.saved`),`success`)}function Te(){let e=I.trim();if(!e){$(void 0);return}if(!A(e)){z(t(`nav.avatarUrlInvalid`));return}$(e)}function Ee(){x(),V(!1)}return(0,O.jsxs)(E,{header:W,children:[(0,O.jsx)(`section`,{className:`profile-page`,children:(0,O.jsxs)(`div`,{className:`profile-container`,children:[(0,O.jsxs)(`section`,{className:`profile-panel profile-backup-card`,children:[(0,O.jsxs)(`div`,{className:`profile-panel-header profile-backup-header`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.backup`)}),(0,O.jsx)(`p`,{children:t(`profile.section.backup.desc`)})]}),(0,O.jsxs)(`span`,{className:`profile-backup-status ${ve}`,children:[(0,O.jsx)(M,{status:C.status,busy:C.busy}),C.statusLabel]})]}),(0,O.jsx)(`div`,{className:`profile-backup-summary`,"aria-label":t(`profile.backup.summary.label`),children:ye.map(t=>(0,O.jsxs)(`div`,{className:`profile-backup-stat`,children:[(0,O.jsx)(`span`,{className:`profile-backup-stat-value`,children:t.value===null?C.backupSummary.loading?`...`:`-`:e(t.value)}),(0,O.jsx)(`span`,{className:`profile-backup-stat-label`,children:t.label})]},t.key))}),(0,O.jsx)(`div`,{className:`profile-backup-actions`,children:Ce.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:[`btn`,`profile-backup-action`,`is-${e.tone}`].join(` `),disabled:C.busy,onClick:e.onClick,children:[e.icon,e.label]},e.key))})]}),(0,O.jsxs)(`header`,{className:`profile-header`,children:[(0,O.jsx)(`img`,{className:`profile-avatar-large`,src:ge,alt:``}),(0,O.jsxs)(`div`,{className:`profile-heading`,children:[(0,O.jsx)(`p`,{className:`profile-kicker`,children:t(`profile.kicker`)}),(0,O.jsx)(`h1`,{children:a.displayName||a.username}),(0,O.jsxs)(`div`,{className:`profile-address-line`,children:[(0,O.jsx)(`code`,{translate:`no`,children:K}),(0,O.jsx)(p,{text:K}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${a.address}`,target:`_blank`,rel:`noopener noreferrer`,className:`btn btn-secondary btn-sm`,children:[(0,O.jsx)(ie,{size:14}),t(`web3.action.view`)]})]})]}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-secondary profile-logout-btn`,onClick:()=>V(!0),children:[(0,O.jsx)(fe,{size:16}),t(`account.logout`)]})]}),(0,O.jsxs)(`div`,{className:`profile-grid`,children:[(0,O.jsxs)(`section`,{className:`profile-panel`,children:[(0,O.jsx)(`div`,{className:`profile-panel-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.account`)}),(0,O.jsx)(`p`,{children:t(`profile.section.account.desc`)})]})}),(0,O.jsxs)(`label`,{className:`profile-field`,children:[(0,O.jsx)(`span`,{children:t(`profile.label.displayName`)}),(0,O.jsxs)(`div`,{className:`profile-field-row`,children:[(0,O.jsx)(`input`,{className:`input`,value:w,onChange:e=>N(e.target.value),placeholder:t(`nav.displayNamePlaceholder`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:we,children:[(0,O.jsx)(h,{size:16}),t(`profile.action.save`)]})]})]}),(0,O.jsx)(`div`,{className:`profile-facts`,children:(0,O.jsx)(P,{label:t(`profile.label.username`),value:a.username})})]}),(0,O.jsxs)(`section`,{className:`profile-panel`,children:[(0,O.jsx)(`div`,{className:`profile-panel-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.avatar`)}),(0,O.jsx)(`p`,{children:t(`profile.section.avatar.desc`)})]})}),(0,O.jsx)(`div`,{className:`profile-avatar-grid`,role:`list`,children:k.map(e=>{let n=he===e.value;return(0,O.jsxs)(`button`,{type:`button`,className:[`profile-avatar-option`,n?`selected`:``].filter(Boolean).join(` `),onClick:()=>$(e.value),"aria-pressed":n,title:t(e.labelKey),children:[(0,O.jsx)(`img`,{src:S(a.address,e.value),alt:``,"aria-hidden":`true`}),(0,O.jsx)(`span`,{children:t(e.labelKey)}),n&&(0,O.jsx)(`span`,{className:`profile-avatar-check`,children:(0,O.jsx)(d,{size:14})})]},e.value||`address`)})}),(0,O.jsxs)(`div`,{className:`profile-avatar-url`,children:[(0,O.jsxs)(`label`,{className:`profile-field`,htmlFor:`profile-avatar-url`,children:[(0,O.jsx)(`span`,{children:t(`profile.label.customAvatar`)}),(0,O.jsxs)(`div`,{className:`profile-field-row`,children:[(0,O.jsx)(`input`,{id:`profile-avatar-url`,className:`input`,value:I,onChange:e=>{L(e.target.value),z(``)},placeholder:t(`nav.avatarUrlPlaceholder`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:Te,disabled:!_e,children:[(0,O.jsx)(h,{size:16}),t(`profile.action.save`)]})]})]}),R&&(0,O.jsx)(`p`,{className:`profile-error`,children:R})]})]})]}),(0,O.jsxs)(`section`,{className:`profile-panel profile-identity-panel`,children:[(0,O.jsxs)(`div`,{className:`profile-panel-header`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.identity`)}),(0,O.jsx)(`p`,{children:t(`profile.section.identity.desc`)})]}),(0,O.jsxs)(o,{to:`/web3/`,hash:`wallet`,className:`btn btn-secondary`,children:[(0,O.jsx)(pe,{size:16}),t(`profile.action.openWallet`)]})]}),(0,O.jsxs)(`div`,{className:`profile-key-grid`,children:[G&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(F,{title:t(`web3.label.ed25519Public`),icon:(0,O.jsx)(l,{size:18}),value:G.ed_public_key}),(0,O.jsx)(F,{title:t(`web3.label.x25519Public`),icon:(0,O.jsx)(ae,{size:18}),value:G.public_key})]}),(0,O.jsx)(F,{title:`IPNS ID`,icon:(0,O.jsx)(g,{size:18}),value:me||`-`})]})]})]})}),H&&(0,O.jsx)(se,{title:H.title,message:H.message,confirmText:H.confirmText,danger:H.danger,onConfirm:H.onConfirm,onClose:H.onClose||(()=>U(null))}),B&&(0,O.jsx)(b,{className:`profile-logout-overlay`,onClose:()=>V(!1),children:(0,O.jsxs)(`div`,{className:`confirm-modal profile-logout-modal`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`modal-header`,children:[(0,O.jsx)(`h3`,{children:t(`account.logoutTitle`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>V(!1),"aria-label":t(`common.close`),children:(0,O.jsx)(y,{size:18})})]}),(0,O.jsx)(`p`,{className:`profile-logout-reminder`,children:t(`profile.logout.backupReminder`)}),(0,O.jsxs)(`div`,{className:`profile-logout-backup-actions`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,disabled:C.busy,onClick:()=>void C.backupToCloud(),children:t(`profile.backup.action.cloudBackup`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,disabled:C.busy,onClick:()=>void C.exportLocalBackup(),children:t(`profile.backup.action.exportLocal`)})]}),(0,O.jsxs)(`div`,{className:`modal-actions`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>V(!1),children:t(`common.cancel`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-danger`,onClick:Ee,children:t(`account.logout`)})]})]})})]})}function P({label:e,value:t,copy:n=!1}){return(0,O.jsxs)(`div`,{className:`profile-fact`,children:[(0,O.jsx)(`span`,{children:e}),(0,O.jsxs)(`div`,{className:`profile-fact-value`,children:[(0,O.jsx)(`code`,{translate:`no`,children:t}),n&&(0,O.jsx)(p,{text:t})]})]})}function F({title:e,icon:t,value:n}){return(0,O.jsxs)(`div`,{className:`profile-key-card`,children:[(0,O.jsxs)(`div`,{className:`profile-key-card-header`,children:[(0,O.jsx)(`span`,{className:`profile-key-card-icon`,children:t}),(0,O.jsx)(`span`,{children:e})]}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(p,{text:n})]})]})}var I=a(`/profile/`)({component:N});export{I as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,O as ee,W as o,n as te,o as ne,t as s}from"./useAppStore-DNhyhD20.js";import{a as c}from"./i18n-DKsg67mH.js";import{t as l}from"./fingerprint-pattern-BT73ASEB.js";import{t as u}from"./circle-alert-DXVkx8p8.js";import{a as d,i as f}from"./AccountMenu-B26qus-Q.js";import{t as re}from"./download-Cy2BlfKM.js";import{t as ie}from"./external-link-D_AQSgxW.js";import{n as ae,t as p}from"./CopyButton-BrEkzqEq.js";import{t as m}from"./loader-C4pED_QP.js";import{t as h}from"./save-CfYzXcxH.js";import{t as g}from"./shield-check-2-h_eEXp.js";import{t as _}from"./upload-BmufnMFu.js";import{I as v,O as y,T as b,_ as x,g as S,h as C,o as oe,v as w,w as se,y as T}from"./index-mjFWLwue.js";import{t as E}from"./MarketingLayout-Ch4sw5Qm.js";import{t as ce}from"./MarketingHeader-CJXpogPY.js";import{n as le}from"./mp-cEQteKUC.js";var ue=r(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),de=r(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),fe=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),pe=r(`wallet-cards`,[[`path`,{d:`M3 11h3.75a2 2 0 0 1 1.6.8l.45.6a4 4 0 0 0 6.4 0l.45-.6a2 2 0 0 1 1.6-.8H21`,key:`1vwh6y`}],[`path`,{d:`M3 7h18`,key:`1uiuf2`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),D=t(e(),1),O=n(),k=[{value:``,labelKey:`profile.avatar.address`},...C.map(e=>({value:x(e),labelKey:`profile.avatar.${e}`}))];function A(e){if(w(e))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function j(e){return e===`disabled`?`is-disabled`:e===`working`?`is-working`:e===`synced`?`is-synced`:e===`error`?`is-error`:`is-idle`}function M({status:e,busy:t}){return t||e===`working`?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):e===`synced`?(0,O.jsx)(v,{size:16}):e===`error`?(0,O.jsx)(u,{size:16}):(0,O.jsx)(g,{size:16})}function N(){let{formatNumber:e,t}=c(),n=s(e=>e.addToast),r=s(e=>e.hasBackend),a=i(e=>e.identity),u=i(e=>e.openLoginModal),v=i(e=>e.setUserIdentity),x=i(e=>e.logoutUser),C=oe(),[w,N]=(0,D.useState)(``),[I,L]=(0,D.useState)(``),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1),[H,U]=(0,D.useState)(null),W=(0,O.jsx)(ce,{});(0,D.useEffect)(()=>{if(!a){N(``),L(``),z(``);return}N(a.displayName||a.username),L(T(a.avatar)||a.avatar||``),z(``)},[a]),(0,D.useEffect)(()=>{a&&C.refreshBackupSummary()},[C.refreshBackupSummary,r,a]);let G=(0,D.useMemo)(()=>a?ee(a.danger):null,[a]),me=(0,D.useMemo)(()=>G?le(G.private_key,G.ed_public_key):``,[G]);if(!a)return(0,O.jsx)(E,{header:W,children:(0,O.jsx)(`section`,{className:`profile-page`,children:(0,O.jsx)(`div`,{className:`profile-container narrow`,children:(0,O.jsxs)(`div`,{className:`profile-empty glass`,children:[(0,O.jsx)(`div`,{className:`profile-empty-icon`,children:(0,O.jsx)(f,{size:34})}),(0,O.jsx)(`h1`,{children:t(`profile.signedOut.title`)}),(0,O.jsx)(`p`,{children:t(`profile.signedOut.desc`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:u,children:[(0,O.jsx)(f,{size:16}),t(`account.signIn`)]})]})})})});let he=T(a.avatar)||a.avatar||``,ge=S(a.address,a.avatar),K=a.address.toLowerCase(),_e=I.trim().length>0,ve=j(C.status),q=C.action===`backup`,J=C.action===`restore`,Y=C.action===`export`,X=C.action===`import`,ye=[{key:`notes`,label:t(`profile.backup.summary.notes`),value:C.notesCount},{key:`files`,label:t(`profile.backup.summary.files`),value:C.backupSummary.filesCount},{key:`trash`,label:t(`profile.backup.summary.trash`),value:C.backupSummary.trashFilesCount},{key:`channels`,label:t(`profile.backup.summary.channels`),value:C.backupSummary.channelsCount}];function be(){U({title:t(`profile.backup.confirm.backupTitle`),message:t(`profile.backup.confirm.backupMessage`),confirmText:t(`profile.backup.action.cloudBackup`),onConfirm:async()=>{U(null),await C.backupToCloud()}})}function xe(){U({title:t(`profile.backup.confirm.restoreTitle`),message:t(`profile.backup.confirm.restoreMessage`),confirmText:t(`profile.backup.action.cloudRestore`),onConfirm:async()=>{U(null),await C.restoreFromCloud({confirm:!1})}})}function Se(){return new Promise(e=>{let n=t=>{U(null),e(t)};U({title:t(`profile.backup.confirm.importTitle`),message:t(`profile.backup.confirm.restore`),confirmText:t(`profile.backup.action.importLocal`),onConfirm:()=>n(!0),onClose:()=>n(!1)})})}function Z(){C.importLocalBackup({requestConfirm:Se})}let Ce=[{key:`cloud-backup`,tone:`cloud-backup`,label:t(q?`profile.backup.status.backingUp`:`profile.backup.action.cloudBackup`),icon:q?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(de,{size:16}),onClick:be},{key:`cloud-restore`,tone:`cloud-restore`,label:t(J?`profile.backup.status.restoring`:`profile.backup.action.cloudRestore`),icon:J?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(ue,{size:16}),onClick:xe},{key:`export-local`,tone:`export-local`,label:t(Y?`profile.backup.status.exporting`:`profile.backup.action.exportLocal`),icon:Y?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(re,{size:16}),onClick:C.exportLocalBackup},{key:`import-local`,tone:`import-local`,label:t(X?`profile.backup.status.importing`:`profile.backup.action.importLocal`),icon:X?(0,O.jsx)(m,{size:16,className:`ui-spinner`}):(0,O.jsx)(_,{size:16}),onClick:Z}];async function Q(e){if(r===!0)try{await te.put(`/api/user/profile`,{json:{displayName:e.displayName||e.username,avatar:e.avatar||``,updatedAt:e.profileUpdatedAt||Date.now()}}).json()}catch(e){n(await ne(e,t(`profile.backup.error.profileSaveFailed`)),`error`)}}function $(e){if(!a)return;let r={...a,avatar:e||void 0,profileUpdatedAt:Date.now()};v(r),Q(r),z(``),n(t(`profile.toast.avatarUpdated`),`success`)}function we(){if(!a)return;let e=w.trim()||a.username,r={...a,displayName:e,profileUpdatedAt:Date.now()};v(r),Q(r),N(e),n(t(`profile.toast.saved`),`success`)}function Te(){let e=I.trim();if(!e){$(void 0);return}if(!A(e)){z(t(`nav.avatarUrlInvalid`));return}$(e)}function Ee(){x(),V(!1)}return(0,O.jsxs)(E,{header:W,children:[(0,O.jsx)(`section`,{className:`profile-page`,children:(0,O.jsxs)(`div`,{className:`profile-container`,children:[(0,O.jsxs)(`section`,{className:`profile-panel profile-backup-card`,children:[(0,O.jsxs)(`div`,{className:`profile-panel-header profile-backup-header`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.backup`)}),(0,O.jsx)(`p`,{children:t(`profile.section.backup.desc`)})]}),(0,O.jsxs)(`span`,{className:`profile-backup-status ${ve}`,children:[(0,O.jsx)(M,{status:C.status,busy:C.busy}),C.statusLabel]})]}),(0,O.jsx)(`div`,{className:`profile-backup-summary`,"aria-label":t(`profile.backup.summary.label`),children:ye.map(t=>(0,O.jsxs)(`div`,{className:`profile-backup-stat`,children:[(0,O.jsx)(`span`,{className:`profile-backup-stat-value`,children:t.value===null?C.backupSummary.loading?`...`:`-`:e(t.value)}),(0,O.jsx)(`span`,{className:`profile-backup-stat-label`,children:t.label})]},t.key))}),(0,O.jsx)(`div`,{className:`profile-backup-actions`,children:Ce.map(e=>(0,O.jsxs)(`button`,{type:`button`,className:[`btn`,`profile-backup-action`,`is-${e.tone}`].join(` `),disabled:C.busy,onClick:e.onClick,children:[e.icon,e.label]},e.key))})]}),(0,O.jsxs)(`header`,{className:`profile-header`,children:[(0,O.jsx)(`img`,{className:`profile-avatar-large`,src:ge,alt:``}),(0,O.jsxs)(`div`,{className:`profile-heading`,children:[(0,O.jsx)(`p`,{className:`profile-kicker`,children:t(`profile.kicker`)}),(0,O.jsx)(`h1`,{children:a.displayName||a.username}),(0,O.jsxs)(`div`,{className:`profile-address-line`,children:[(0,O.jsx)(`code`,{translate:`no`,children:K}),(0,O.jsx)(p,{text:K}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${a.address}`,target:`_blank`,rel:`noopener noreferrer`,className:`btn btn-secondary btn-sm`,children:[(0,O.jsx)(ie,{size:14}),t(`web3.action.view`)]})]})]}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-secondary profile-logout-btn`,onClick:()=>V(!0),children:[(0,O.jsx)(fe,{size:16}),t(`account.logout`)]})]}),(0,O.jsxs)(`div`,{className:`profile-grid`,children:[(0,O.jsxs)(`section`,{className:`profile-panel`,children:[(0,O.jsx)(`div`,{className:`profile-panel-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.account`)}),(0,O.jsx)(`p`,{children:t(`profile.section.account.desc`)})]})}),(0,O.jsxs)(`label`,{className:`profile-field`,children:[(0,O.jsx)(`span`,{children:t(`profile.label.displayName`)}),(0,O.jsxs)(`div`,{className:`profile-field-row`,children:[(0,O.jsx)(`input`,{className:`input`,value:w,onChange:e=>N(e.target.value),placeholder:t(`nav.displayNamePlaceholder`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:we,children:[(0,O.jsx)(h,{size:16}),t(`profile.action.save`)]})]})]}),(0,O.jsx)(`div`,{className:`profile-facts`,children:(0,O.jsx)(P,{label:t(`profile.label.username`),value:a.username})})]}),(0,O.jsxs)(`section`,{className:`profile-panel`,children:[(0,O.jsx)(`div`,{className:`profile-panel-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.avatar`)}),(0,O.jsx)(`p`,{children:t(`profile.section.avatar.desc`)})]})}),(0,O.jsx)(`div`,{className:`profile-avatar-grid`,role:`list`,children:k.map(e=>{let n=he===e.value;return(0,O.jsxs)(`button`,{type:`button`,className:[`profile-avatar-option`,n?`selected`:``].filter(Boolean).join(` `),onClick:()=>$(e.value),"aria-pressed":n,title:t(e.labelKey),children:[(0,O.jsx)(`img`,{src:S(a.address,e.value),alt:``,"aria-hidden":`true`}),(0,O.jsx)(`span`,{children:t(e.labelKey)}),n&&(0,O.jsx)(`span`,{className:`profile-avatar-check`,children:(0,O.jsx)(d,{size:14})})]},e.value||`address`)})}),(0,O.jsxs)(`div`,{className:`profile-avatar-url`,children:[(0,O.jsxs)(`label`,{className:`profile-field`,htmlFor:`profile-avatar-url`,children:[(0,O.jsx)(`span`,{children:t(`profile.label.customAvatar`)}),(0,O.jsxs)(`div`,{className:`profile-field-row`,children:[(0,O.jsx)(`input`,{id:`profile-avatar-url`,className:`input`,value:I,onChange:e=>{L(e.target.value),z(``)},placeholder:t(`nav.avatarUrlPlaceholder`)}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:Te,disabled:!_e,children:[(0,O.jsx)(h,{size:16}),t(`profile.action.save`)]})]})]}),R&&(0,O.jsx)(`p`,{className:`profile-error`,children:R})]})]})]}),(0,O.jsxs)(`section`,{className:`profile-panel profile-identity-panel`,children:[(0,O.jsxs)(`div`,{className:`profile-panel-header`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`profile.section.identity`)}),(0,O.jsx)(`p`,{children:t(`profile.section.identity.desc`)})]}),(0,O.jsxs)(o,{to:`/web3/`,hash:`wallet`,className:`btn btn-secondary`,children:[(0,O.jsx)(pe,{size:16}),t(`profile.action.openWallet`)]})]}),(0,O.jsxs)(`div`,{className:`profile-key-grid`,children:[G&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(F,{title:t(`web3.label.ed25519Public`),icon:(0,O.jsx)(l,{size:18}),value:G.ed_public_key}),(0,O.jsx)(F,{title:t(`web3.label.x25519Public`),icon:(0,O.jsx)(ae,{size:18}),value:G.public_key})]}),(0,O.jsx)(F,{title:`IPNS ID`,icon:(0,O.jsx)(g,{size:18}),value:me||`-`})]})]})]})}),H&&(0,O.jsx)(se,{title:H.title,message:H.message,confirmText:H.confirmText,danger:H.danger,onConfirm:H.onConfirm,onClose:H.onClose||(()=>U(null))}),B&&(0,O.jsx)(b,{className:`profile-logout-overlay`,onClose:()=>V(!1),children:(0,O.jsxs)(`div`,{className:`confirm-modal profile-logout-modal`,onClick:e=>e.stopPropagation(),children:[(0,O.jsxs)(`div`,{className:`modal-header`,children:[(0,O.jsx)(`h3`,{children:t(`account.logoutTitle`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>V(!1),"aria-label":t(`common.close`),children:(0,O.jsx)(y,{size:18})})]}),(0,O.jsx)(`p`,{className:`profile-logout-reminder`,children:t(`profile.logout.backupReminder`)}),(0,O.jsxs)(`div`,{className:`profile-logout-backup-actions`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,disabled:C.busy,onClick:()=>void C.backupToCloud(),children:t(`profile.backup.action.cloudBackup`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,disabled:C.busy,onClick:()=>void C.exportLocalBackup(),children:t(`profile.backup.action.exportLocal`)})]}),(0,O.jsxs)(`div`,{className:`modal-actions`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>V(!1),children:t(`common.cancel`)}),(0,O.jsx)(`button`,{type:`button`,className:`btn btn-danger`,onClick:Ee,children:t(`account.logout`)})]})]})})]})}function P({label:e,value:t,copy:n=!1}){return(0,O.jsxs)(`div`,{className:`profile-fact`,children:[(0,O.jsx)(`span`,{children:e}),(0,O.jsxs)(`div`,{className:`profile-fact-value`,children:[(0,O.jsx)(`code`,{translate:`no`,children:t}),n&&(0,O.jsx)(p,{text:t})]})]})}function F({title:e,icon:t,value:n}){return(0,O.jsxs)(`div`,{className:`profile-key-card`,children:[(0,O.jsxs)(`div`,{className:`profile-key-card-header`,children:[(0,O.jsx)(`span`,{className:`profile-key-card-icon`,children:t}),(0,O.jsx)(`span`,{children:e})]}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(p,{text:n})]})]})}var I=a(`/profile/`)({component:N});export{I as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a}from"./useAppStore-DNhyhD20.js";import{a as o}from"./i18n-C6yaqRst.js";import{n as s,t as c}from"./smartphone-CrsocYJo.js";import{t as l}from"./download-Cy2BlfKM.js";import{I as u}from"./index-D1mozno-.js";import{t as d}from"./MarketingHeader-8gNzHawY.js";import{n as f}from"./format-CAKfypjK.js";var p=r(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),m=r(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),h=r(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),g=r(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),_=r(`tablet-smartphone`,[[`rect`,{width:`10`,height:`14`,x:`3`,y:`8`,rx:`2`,key:`1vrsiq`}],[`path`,{d:`M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4`,key:`1j4zmg`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),v=t(e(),1),y=[`windows`,`macos`,`linux`,`android`],b=[`x64`,`arm64`,`universal`],x=[`installer`],S=Object.freeze([{platform:`windows`,arch:`x64`},{platform:`windows`,arch:`arm64`},{platform:`macos`,arch:`x64`},{platform:`macos`,arch:`arm64`},{platform:`linux`,arch:`x64`},{platform:`linux`,arch:`arm64`},{platform:`android`,arch:`universal`}]);function C(e){return`${e.platform}:${e.arch}`}var w=new Set(y),T=new Set(b),E=new Set(x),D=new Set(S.map(C));function O(e){return typeof e==`object`&&!!e}function k(e){return typeof e==`string`&&e.trim().length>0}function A(e){return Number.isFinite(e)&&e>0}function j(e){return e===void 0||k(e)}function M(e){return O(e)?w.has(e.platform)&&T.has(e.arch)&&D.has(C(e))&&E.has(e.kind)&&k(e.filename)&&A(e.size)&&k(e.cid)&&k(e.githubUrl)&&j(e.r2Url):!1}function N(e){return!O(e)||!k(e.version)||!k(e.publishedAt)||!Array.isArray(e.assets)?!1:e.assets.every(M)}function P(e){return C(e)}function F(e){return N(e)?e.assets.filter(e=>e.kind===`installer`):[]}function I(e){return Array.isArray(e)?e.some(e=>O(e)&&k(e.r2Url)):!1}function L(e,t=`r2`){return t===`r2`&&O(e)&&k(e.r2Url)?{source:`r2`,url:e.r2Url}:{source:`github`,url:O(e)&&k(e.githubUrl)?e.githubUrl:``}}var R=`https://github.com/most-people/most/releases/latest`,z=[{platform:`windows`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`windows`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`android`,arch:`universal`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R}];function B(e){return e.VITE_RELEASE_MANIFEST_URL||`${(e.VITE_R2_PUBLIC_BASE_URL||`https://download.most.box`).replace(/\/+$/,``)}/releases/latest.json`}function V({manifest:e,currentKey:t,requestedSource:n}){let r=e?F(e):[],i=r.length?r:z,a=I(i),o=n===`r2`&&a?`r2`:`github`,s=i.find(e=>P(e)===t)||null;return{assets:i,currentAsset:s,otherAssets:s?i.filter(e=>P(e)!==t):i,hasR2Assets:a,activeSource:o,currentDownload:s?L(s,o):null}}function H(e,t){return L(e,t)}var U=n(),W=B({VITE_RELEASE_MANIFEST_URL:void 0,VITE_R2_PUBLIC_BASE_URL:void 0}),G={windows:{name:`Windows`,ext:`.exe`,descKey:`download.platform.windows.desc`,icon:g},macos:{name:`macOS`,ext:`.dmg`,descKey:`download.platform.macos.desc`,icon:p},linux:{name:`Linux`,ext:`.AppImage`,descKey:`download.platform.linux.desc`,icon:h},android:{name:`Android`,ext:`.apk`,descKey:`download.platform.android.desc`,icon:_}},K=[{key:`ios`,nameKey:`download.platform.ios.name`,descKey:`download.platform.ios.desc`,icon:c}],q=`android:universal`;function J(){return[navigator.userAgentData?.platform,navigator.platform,navigator.userAgent].filter(Boolean).join(` `).toLowerCase()}function Y(){if(typeof navigator>`u`)return`windows:x64`;let e=J(),t=/arm|aarch64/.test(e)?`arm64`:`x64`;return/android/.test(e)?q:/mac|darwin/.test(e)?`macos:${t}`:/linux/.test(e)?`linux:${t}`:`windows:${t}`}function X(){let{t:e}=o(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(W?`loading`:`fallback`),[a,c]=(0,v.useState)(`windows:x64`),[d,p]=(0,v.useState)(`r2`);(0,v.useEffect)(()=>{c(Y())},[]),(0,v.useEffect)(()=>{if(!W)return;let e=new AbortController;return fetch(W,{cache:`no-store`,signal:e.signal}).then(e=>{if(!e.ok)throw Error(`Manifest request failed: ${e.status}`);return e.json()}).then(e=>{if(!N(e))throw Error(`Invalid download manifest`);n(e),i(`ready`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(n(null),i(`fallback`))}),()=>e.abort()},[]),(0,v.useEffect)(()=>{r===`fallback`&&p(`github`)},[r]);let{currentAsset:h,otherAssets:g,hasR2Assets:_,activeSource:y}=V({manifest:t,currentKey:a,requestedSource:d}),b=t=>H(t,y).source===`r2`?e(`download.source.r2Mirror`):`GitHub Releases`,x=e=>H(e,y).url,S=t=>{let n=G[t.platform],r=n.icon;return(0,U.jsxs)(`article`,{className:`download-current-card`,children:[(0,U.jsxs)(`div`,{className:`download-current-main`,children:[(0,U.jsx)(`div`,{className:`download-current-icon`,children:(0,U.jsx)(r,{size:34})}),(0,U.jsxs)(`div`,{className:`download-current-copy`,children:[(0,U.jsxs)(`div`,{className:`download-current-labels`,children:[(0,U.jsxs)(`span`,{className:`download-current-kicker`,children:[(0,U.jsx)(u,{size:14}),e(`download.platform.currentSystem`)]}),(0,U.jsx)(`span`,{className:`download-current-recommended`,children:e(`download.platform.recommended`)})]}),(0,U.jsxs)(`div`,{className:`download-current-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-current-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`download-current-actions`,children:[(0,U.jsx)(`span`,{children:e(`download.platform.matchedSystem`)}),(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:17}),e(`download.platform.action`,{ext:n.ext})]}),(0,U.jsx)(`p`,{children:b(t)})]})]})},C=t=>{let n=G[t.platform],r=n.icon,i=P(t),o=i===a;return(0,U.jsxs)(`article`,{className:[`download-platform-card`,o?`is-recommended`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(`div`,{className:`download-platform-icon`,children:(0,U.jsx)(r,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-platform-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]}),(0,U.jsx)(`div`,{className:`download-platform-actions`,children:(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:16}),e(`download.platform.action`,{ext:n.ext})]})})]}),o?(0,U.jsx)(`span`,{className:`download-recommended-badge`,children:e(`download.platform.current`)}):null]},i)},w=t=>{let n=t.icon;return(0,U.jsxs)(`article`,{className:`download-coming-soon-card`,children:[(0,U.jsx)(`div`,{className:`download-platform-icon download-coming-soon-icon`,children:(0,U.jsx)(n,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:e(t.nameKey)}),(0,U.jsx)(`span`,{children:e(`download.platform.comingSoon`)})]}),(0,U.jsx)(`p`,{children:e(t.descKey)})]})]},t.key)};return(0,U.jsxs)(`div`,{className:`download-options`,children:[(0,U.jsxs)(`div`,{className:`ui-segmented-control download-source-tabs`,role:`tablist`,"aria-label":e(`download.source.label`),children:[(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`r2`,disabled:!_,className:y===`r2`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`r2`),children:[(0,U.jsx)(s,{size:15}),`Cloudflare R2`]}),(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`github`,className:y===`github`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`github`),children:[(0,U.jsx)(m,{size:15}),`GitHub Releases`]})]}),(0,U.jsx)(`p`,{className:`download-source-note`,children:r===`loading`?e(`download.source.loading`):r===`ready`&&t?e(`download.source.ready`,{version:t.version}):e(`download.source.fallback`)}),h?(0,U.jsx)(`div`,{className:`download-current-platform`,"aria-label":e(`download.platform.currentSystem`),children:S(h)}):null,g.length?(0,U.jsxs)(`div`,{className:`download-other-platforms`,children:[(0,U.jsx)(`p`,{className:`download-other-platforms-title`,children:e(`download.platform.otherPlatforms`)}),(0,U.jsx)(`div`,{className:`download-platform-grid`,children:g.map(e=>C(e))}),(0,U.jsxs)(`div`,{className:`download-coming-soon`,children:[(0,U.jsx)(`p`,{className:`download-coming-soon-title`,children:e(`download.platform.mobilePlatforms`)}),(0,U.jsx)(`div`,{className:`download-coming-soon-grid`,children:K.map(e=>w(e))})]})]}):null]})}var Z=[{featureKey:`download.comparison.node`,webKey:`download.comparison.webConnectsNode`,desktopKey:`download.comparison.desktopBuiltinNode`},{featureKey:`download.comparison.fileSharing`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.verification`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.seeding`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopDefaultOn`},{featureKey:`download.comparison.largeFiles`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktop10gb`}];function Q(){let{t:e}=o();return(0,v.useEffect)(()=>{document.title=e(`download.meta.title`)},[e]),(0,U.jsxs)(`div`,{className:`download-page`,children:[(0,U.jsx)(d,{}),(0,U.jsx)(`section`,{className:`download-hero`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`div`,{className:`download-hero-icon`,children:(0,U.jsx)(l,{size:40})}),(0,U.jsx)(`h1`,{className:`download-hero-title`,children:e(`download.hero.title`)}),(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.hero.desc`)})]})}),(0,U.jsx)(`section`,{className:`download-platforms`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.platforms.title`)}),(0,U.jsx)(X,{})]})}),(0,U.jsx)(`section`,{className:`download-comparison`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.comparison.title`)}),(0,U.jsx)(`div`,{className:`download-table-wrap`,children:(0,U.jsxs)(`table`,{className:`download-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:e(`download.comparison.feature`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.web`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.desktop`)})]})}),(0,U.jsx)(`tbody`,{children:Z.map(t=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e(t.featureKey)}),(0,U.jsx)(`td`,{className:`col-web`,children:e(t.webKey)}),(0,U.jsx)(`td`,{className:`col-desktop`,children:e(t.desktopKey)})]},t.featureKey))})]})})]})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.npmNote`)})})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(a,{to:`/`,className:`btn btn-primary`,children:e(`common.backHome`)})})}),(0,U.jsx)(`footer`,{className:`mkt-footer`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`div`,{className:`mkt-footer-inner`,children:(0,U.jsx)(`p`,{className:`mkt-footer-copy`,children:`MostBox`})})})})]})}var $=i(`/download/`)({component:Q});export{$ as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a}from"./useAppStore-DNhyhD20.js";import{a as o}from"./i18n-DKsg67mH.js";import{n as s,t as c}from"./smartphone-CrsocYJo.js";import{t as l}from"./download-Cy2BlfKM.js";import{I as u}from"./index-mjFWLwue.js";import{t as d}from"./MarketingHeader-CJXpogPY.js";import{n as f}from"./format-CAKfypjK.js";var p=r(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),m=r(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),h=r(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),g=r(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),_=r(`tablet-smartphone`,[[`rect`,{width:`10`,height:`14`,x:`3`,y:`8`,rx:`2`,key:`1vrsiq`}],[`path`,{d:`M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4`,key:`1j4zmg`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),v=t(e(),1),y=[`windows`,`macos`,`linux`,`android`],b=[`x64`,`arm64`,`universal`],x=[`installer`],S=Object.freeze([{platform:`windows`,arch:`x64`},{platform:`windows`,arch:`arm64`},{platform:`macos`,arch:`x64`},{platform:`macos`,arch:`arm64`},{platform:`linux`,arch:`x64`},{platform:`linux`,arch:`arm64`},{platform:`android`,arch:`universal`}]);function C(e){return`${e.platform}:${e.arch}`}var w=new Set(y),T=new Set(b),E=new Set(x),D=new Set(S.map(C));function O(e){return typeof e==`object`&&!!e}function k(e){return typeof e==`string`&&e.trim().length>0}function A(e){return Number.isFinite(e)&&e>0}function j(e){return e===void 0||k(e)}function M(e){return O(e)?w.has(e.platform)&&T.has(e.arch)&&D.has(C(e))&&E.has(e.kind)&&k(e.filename)&&A(e.size)&&k(e.cid)&&k(e.githubUrl)&&j(e.r2Url):!1}function N(e){return!O(e)||!k(e.version)||!k(e.publishedAt)||!Array.isArray(e.assets)?!1:e.assets.every(M)}function P(e){return C(e)}function F(e){return N(e)?e.assets.filter(e=>e.kind===`installer`):[]}function I(e){return Array.isArray(e)?e.some(e=>O(e)&&k(e.r2Url)):!1}function L(e,t=`r2`){return t===`r2`&&O(e)&&k(e.r2Url)?{source:`r2`,url:e.r2Url}:{source:`github`,url:O(e)&&k(e.githubUrl)?e.githubUrl:``}}var R=`https://github.com/most-people/most/releases/latest`,z=[{platform:`windows`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`windows`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`android`,arch:`universal`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R}];function B(e){return e.VITE_RELEASE_MANIFEST_URL||`${(e.VITE_R2_PUBLIC_BASE_URL||`https://download.most.box`).replace(/\/+$/,``)}/releases/latest.json`}function V({manifest:e,currentKey:t,requestedSource:n}){let r=e?F(e):[],i=r.length?r:z,a=I(i),o=n===`r2`&&a?`r2`:`github`,s=i.find(e=>P(e)===t)||null;return{assets:i,currentAsset:s,otherAssets:s?i.filter(e=>P(e)!==t):i,hasR2Assets:a,activeSource:o,currentDownload:s?L(s,o):null}}function H(e,t){return L(e,t)}var U=n(),W=B({VITE_RELEASE_MANIFEST_URL:void 0,VITE_R2_PUBLIC_BASE_URL:void 0}),G={windows:{name:`Windows`,ext:`.exe`,descKey:`download.platform.windows.desc`,icon:g},macos:{name:`macOS`,ext:`.dmg`,descKey:`download.platform.macos.desc`,icon:p},linux:{name:`Linux`,ext:`.AppImage`,descKey:`download.platform.linux.desc`,icon:h},android:{name:`Android`,ext:`.apk`,descKey:`download.platform.android.desc`,icon:_}},K=[{key:`ios`,nameKey:`download.platform.ios.name`,descKey:`download.platform.ios.desc`,icon:c}],q=`android:universal`;function J(){return[navigator.userAgentData?.platform,navigator.platform,navigator.userAgent].filter(Boolean).join(` `).toLowerCase()}function Y(){if(typeof navigator>`u`)return`windows:x64`;let e=J(),t=/arm|aarch64/.test(e)?`arm64`:`x64`;return/android/.test(e)?q:/mac|darwin/.test(e)?`macos:${t}`:/linux/.test(e)?`linux:${t}`:`windows:${t}`}function X(){let{t:e}=o(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(W?`loading`:`fallback`),[a,c]=(0,v.useState)(`windows:x64`),[d,p]=(0,v.useState)(`r2`);(0,v.useEffect)(()=>{c(Y())},[]),(0,v.useEffect)(()=>{if(!W)return;let e=new AbortController;return fetch(W,{cache:`no-store`,signal:e.signal}).then(e=>{if(!e.ok)throw Error(`Manifest request failed: ${e.status}`);return e.json()}).then(e=>{if(!N(e))throw Error(`Invalid download manifest`);n(e),i(`ready`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(n(null),i(`fallback`))}),()=>e.abort()},[]),(0,v.useEffect)(()=>{r===`fallback`&&p(`github`)},[r]);let{currentAsset:h,otherAssets:g,hasR2Assets:_,activeSource:y}=V({manifest:t,currentKey:a,requestedSource:d}),b=t=>H(t,y).source===`r2`?e(`download.source.r2Mirror`):`GitHub Releases`,x=e=>H(e,y).url,S=t=>{let n=G[t.platform],r=n.icon;return(0,U.jsxs)(`article`,{className:`download-current-card`,children:[(0,U.jsxs)(`div`,{className:`download-current-main`,children:[(0,U.jsx)(`div`,{className:`download-current-icon`,children:(0,U.jsx)(r,{size:34})}),(0,U.jsxs)(`div`,{className:`download-current-copy`,children:[(0,U.jsxs)(`div`,{className:`download-current-labels`,children:[(0,U.jsxs)(`span`,{className:`download-current-kicker`,children:[(0,U.jsx)(u,{size:14}),e(`download.platform.currentSystem`)]}),(0,U.jsx)(`span`,{className:`download-current-recommended`,children:e(`download.platform.recommended`)})]}),(0,U.jsxs)(`div`,{className:`download-current-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-current-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`download-current-actions`,children:[(0,U.jsx)(`span`,{children:e(`download.platform.matchedSystem`)}),(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:17}),e(`download.platform.action`,{ext:n.ext})]}),(0,U.jsx)(`p`,{children:b(t)})]})]})},C=t=>{let n=G[t.platform],r=n.icon,i=P(t),o=i===a;return(0,U.jsxs)(`article`,{className:[`download-platform-card`,o?`is-recommended`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(`div`,{className:`download-platform-icon`,children:(0,U.jsx)(r,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-platform-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]}),(0,U.jsx)(`div`,{className:`download-platform-actions`,children:(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:16}),e(`download.platform.action`,{ext:n.ext})]})})]}),o?(0,U.jsx)(`span`,{className:`download-recommended-badge`,children:e(`download.platform.current`)}):null]},i)},w=t=>{let n=t.icon;return(0,U.jsxs)(`article`,{className:`download-coming-soon-card`,children:[(0,U.jsx)(`div`,{className:`download-platform-icon download-coming-soon-icon`,children:(0,U.jsx)(n,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:e(t.nameKey)}),(0,U.jsx)(`span`,{children:e(`download.platform.comingSoon`)})]}),(0,U.jsx)(`p`,{children:e(t.descKey)})]})]},t.key)};return(0,U.jsxs)(`div`,{className:`download-options`,children:[(0,U.jsxs)(`div`,{className:`ui-segmented-control download-source-tabs`,role:`tablist`,"aria-label":e(`download.source.label`),children:[(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`r2`,disabled:!_,className:y===`r2`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`r2`),children:[(0,U.jsx)(s,{size:15}),`Cloudflare R2`]}),(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`github`,className:y===`github`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`github`),children:[(0,U.jsx)(m,{size:15}),`GitHub Releases`]})]}),(0,U.jsx)(`p`,{className:`download-source-note`,children:r===`loading`?e(`download.source.loading`):r===`ready`&&t?e(`download.source.ready`,{version:t.version}):e(`download.source.fallback`)}),h?(0,U.jsx)(`div`,{className:`download-current-platform`,"aria-label":e(`download.platform.currentSystem`),children:S(h)}):null,g.length?(0,U.jsxs)(`div`,{className:`download-other-platforms`,children:[(0,U.jsx)(`p`,{className:`download-other-platforms-title`,children:e(`download.platform.otherPlatforms`)}),(0,U.jsx)(`div`,{className:`download-platform-grid`,children:g.map(e=>C(e))}),(0,U.jsxs)(`div`,{className:`download-coming-soon`,children:[(0,U.jsx)(`p`,{className:`download-coming-soon-title`,children:e(`download.platform.mobilePlatforms`)}),(0,U.jsx)(`div`,{className:`download-coming-soon-grid`,children:K.map(e=>w(e))})]})]}):null]})}var Z=[{featureKey:`download.comparison.node`,webKey:`download.comparison.webConnectsNode`,desktopKey:`download.comparison.desktopBuiltinNode`},{featureKey:`download.comparison.fileSharing`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.verification`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.seeding`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopDefaultOn`},{featureKey:`download.comparison.largeFiles`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktop10gb`}];function Q(){let{t:e}=o();return(0,v.useEffect)(()=>{document.title=e(`download.meta.title`)},[e]),(0,U.jsxs)(`div`,{className:`download-page`,children:[(0,U.jsx)(d,{}),(0,U.jsx)(`section`,{className:`download-hero`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`div`,{className:`download-hero-icon`,children:(0,U.jsx)(l,{size:40})}),(0,U.jsx)(`h1`,{className:`download-hero-title`,children:e(`download.hero.title`)}),(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.hero.desc`)})]})}),(0,U.jsx)(`section`,{className:`download-platforms`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.platforms.title`)}),(0,U.jsx)(X,{})]})}),(0,U.jsx)(`section`,{className:`download-comparison`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.comparison.title`)}),(0,U.jsx)(`div`,{className:`download-table-wrap`,children:(0,U.jsxs)(`table`,{className:`download-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:e(`download.comparison.feature`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.web`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.desktop`)})]})}),(0,U.jsx)(`tbody`,{children:Z.map(t=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e(t.featureKey)}),(0,U.jsx)(`td`,{className:`col-web`,children:e(t.webKey)}),(0,U.jsx)(`td`,{className:`col-desktop`,children:e(t.desktopKey)})]},t.featureKey))})]})})]})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.npmNote`)})})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(a,{to:`/`,className:`btn btn-primary`,children:e(`common.backHome`)})})}),(0,U.jsx)(`footer`,{className:`mkt-footer`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`div`,{className:`mkt-footer-inner`,children:(0,U.jsx)(`p`,{className:`mkt-footer-copy`,children:`MostBox`})})})})]})}var $=i(`/download/`)({component:Q});export{$ as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,F as a,H as o,O as s}from"./useAppStore-DNhyhD20.js";import{a as ee}from"./i18n-C6yaqRst.js";import{t as te}from"./external-link-D_AQSgxW.js";import{n as ne,t as re}from"./CopyButton-DnFqfCN9.js";import{t as ie}from"./AppShell-BdRKZIZ9.js";import{t as ae}from"./refresh-cw-CfkUlTK9.js";import{b as oe}from"./index-D1mozno-.js";import{t as se}from"./AppTop-BE5kKBYH.js";import{n as ce,r as le,t as c}from"./chatJoinInvite-CeC6H6t8.js";var l=i(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),u=t(e(),1),d=n(),f=`chat-join-demo`,p=``,m=`chatjoin_support`,ue=/^[a-zA-Z0-9_-]{3,30}$/,h=/^0x[a-fA-F0-9]{64}$/,de=c,fe=[{value:`dark`,label:`dark`},{value:`light`,label:`light`}],pe=[{value:`zh-CN`,label:`zh-CN`},{value:`zh-TW`,label:`zh-TW`},{value:`en`,label:`en`}];function g(){return typeof window>`u`?`https://most.box`:window.location.origin}function me(e){return(e.trim()||g()).replace(/\/+$/,``)}function he(e,t){let n=s(a(e.trim()||f,t).danger);return{publicKey:n.public_key,privateKey:n.private_key}}function _(e){return e.trim()||void 0}function ge(e){try{return JSON.parse(e)}catch{return null}}function _e(e){let t=e.trim();if(!t)return null;let n,r;try{let e=new URL(t,g());n=e.searchParams,r=e.origin}catch{n=new URLSearchParams(t.replace(/^\?/,``))}let i=n.get(`token`)?.trim()||``,a=n.get(`pub`)?.trim()||``;return!i||!a?null:{token:i,pub:a,origin:r}}function v({name:e,description:t}){return(0,d.jsxs)(`span`,{className:`chat-join-demo-label`,children:[(0,d.jsx)(`span`,{className:`chat-join-demo-label-key`,children:e}),(0,d.jsx)(`span`,{className:`chat-join-demo-label-desc`,children:t})]})}function y({name:e,description:t,children:n,wide:r=!1}){return(0,d.jsxs)(`label`,{className:`chat-join-demo-field ${r?`wide`:``}`,children:[(0,d.jsx)(v,{name:e,description:t}),n]})}function b(){let{t:e}=ee(),[t,n]=(0,u.useState)(g),[i,a]=(0,u.useState)(`demo-user`),[o,s]=(0,u.useState)(`Demo User`),[c,b]=(0,u.useState)(m),[x,S]=(0,u.useState)(`Chat Join Demo`),[C,w]=(0,u.useState)(`zh-CN`),[T,E]=(0,u.useState)(`sparkbit`),[D,O]=(0,u.useState)(),[k,A]=(0,u.useState)(``),[j,M]=(0,u.useState)(``),[N,P]=(0,u.useState)(``),[F,I]=(0,u.useState)(``),[L,R]=(0,u.useState)(``),[z,B]=(0,u.useState)(``),[V,ve]=(0,u.useState)(ce),[H,ye]=(0,u.useState)(f),[U,be]=(0,u.useState)(p),[W,xe]=(0,u.useState)(()=>he(f,p)),[Se,Ce]=(0,u.useState)(``),[we,G]=(0,u.useState)(``),[Te,K]=(0,u.useState)(``),[Ee,De]=(0,u.useState)(!1),[Oe,q]=(0,u.useState)(``),[ke,J]=(0,u.useState)(``),[Y,X]=(0,u.useState)(``),[Z,Q]=(0,u.useState)(``),Ae=(0,u.useMemo)(()=>{let e={uid:i.trim(),locale:C,channels:[{id:c.trim(),name:_(x)}]};return T&&(e.theme=T),D&&(e.appearance=D),e.node_url=_(L),e.node_invite=_(z),e.logo=_(k),e.logo_dark=_(j),e.data=_(F),e.avatar=_(N),e.name=_(o),e},[D,N,c,x,F,o,C,k,j,z,L,T,i]),$=(0,u.useMemo)(()=>JSON.stringify(Ae,null,2),[Ae]);function je(){xe(he(H,U)),q(``),J(``),X(``),Q(``)}function Me(e){let t=e.channels[0];a(e.uid),w(e.locale||`zh-CN`),E(e.theme),O(e.appearance),R(e.node_url||``),B(e.node_invite||``),A(e.logo||``),M(e.logo_dark||``),I(e.data||``),P(e.avatar||``),s(e.name||``),b(t?.id||m),S(t?.name||``)}async function Ne(){let r=_e(Se);if(!r){G(``),K(e(`chatJoin.demo.error.linkInvalid`));return}let i=r.origin||me(t),a=`${i}/chat/join?token=${encodeURIComponent(r.token)}&pub=${encodeURIComponent(r.pub)}`;n(i),q(r.token),J(r.pub),X(a),G(e(`chatJoin.demo.status.linkParsed`)),K(``),De(!0);try{let t=await fetch(`${de}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r.token,pub:r.pub})}),n=await t.text(),i=ge(n);if(!t.ok){let t=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:n;throw Error(t||e(`chatJoin.error.decrypt`))}let a=le(i);if(!a){K(e(`chatJoin.demo.error.parseInvalidPayload`)),G(e(`chatJoin.demo.status.linkParsed`));return}Me(a),G(e(`chatJoin.demo.status.linkDecrypted`)),K(``)}catch(t){K(e(`chatJoin.demo.error.parseDecryptFailed`,{message:t instanceof Error?t.message:String(t)}))}finally{De(!1)}}function Pe(){let n=i.trim(),a=c.trim(),o=V.trim();if(!n){Q(e(`chatJoin.demo.error.uidRequired`));return}if(!ue.test(a)){Q(e(`chatJoin.demo.error.channelInvalid`));return}if(!h.test(o)){Q(e(`chatJoin.demo.error.recipientPublicInvalid`));return}if(!h.test(W.publicKey)||!h.test(W.privateKey)){Q(e(`chatJoin.demo.error.senderKeysInvalid`));return}try{let e=r($,{senderPrivateKey:W.privateKey,recipientPublicKey:o}),n=W.publicKey,i=`${me(t)}/chat/join?token=${encodeURIComponent(e)}&pub=${encodeURIComponent(n)}`;q(e),J(n),X(i),Q(``)}catch{Q(e(`chatJoin.demo.error.encryptFailed`))}}return(0,d.jsx)(ie,{sidebar:()=>(0,d.jsx)(se,{}),headerTitle:(0,d.jsx)(`h2`,{className:`header-title`,children:e(`chatJoin.demo.title`)}),children:(0,d.jsx)(`div`,{className:`chat-join-container`,children:(0,d.jsxs)(`div`,{className:`chat-join-demo-panel`,children:[(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.parseSection`)})]}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.existingLink`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Se,onChange:e=>Ce(e.target.value),rows:4,translate:`no`})}),(0,d.jsx)(`div`,{className:`chat-join-demo-actions`,children:(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:Ne,disabled:Ee,children:[(0,d.jsx)(l,{size:16}),e(Ee?`chatJoin.demo.action.parsing`:`chatJoin.demo.action.parseLink`)]})}),we&&(0,d.jsx)(`p`,{className:`chat-join-demo-success`,children:we}),Te&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Te})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.inviteSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`origin`,description:e(`chatJoin.demo.field.origin`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:t,onChange:e=>n(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`uid`,description:e(`chatJoin.demo.field.uid`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:i,onChange:e=>a(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`name`,description:e(`chatJoin.demo.field.name`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:o,onChange:e=>s(e.target.value)})}),(0,d.jsx)(y,{name:`locale`,description:e(`chatJoin.demo.field.locale`),children:(0,d.jsx)(oe,{ariaLabel:e(`chatJoin.demo.field.locale`),value:C,options:pe,onChange:w,size:`compact`})}),(0,d.jsx)(y,{name:`channels[0].id`,description:e(`chatJoin.demo.field.channelId`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:c,onChange:e=>b(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`channels[0].name`,description:e(`chatJoin.demo.field.channelName`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:x,onChange:e=>S(e.target.value)})}),(0,d.jsx)(y,{name:`node_url`,description:e(`chatJoin.demo.field.nodeUrl`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:L,onChange:e=>R(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`node_invite`,description:e(`chatJoin.demo.field.nodeInvite`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:z,onChange:e=>B(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo`,description:e(`chatJoin.demo.field.logo`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:k,onChange:e=>A(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo_dark`,description:e(`chatJoin.demo.field.logoDark`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:j,onChange:e=>M(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`avatar`,description:e(`chatJoin.demo.field.avatar`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:N,onChange:e=>P(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`theme`,description:e(`chatJoin.demo.field.theme`)}),(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-theme`,value:`sparkbit`,checked:T===`sparkbit`,onClick:()=>E(T===`sparkbit`?void 0:`sparkbit`),readOnly:!0}),(0,d.jsx)(`span`,{children:`sparkbit`})]})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`appearance`,description:e(`chatJoin.demo.field.appearance`)}),(0,d.jsx)(`div`,{className:`chat-join-demo-radio-options`,children:fe.map(e=>(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-appearance`,value:e.value,checked:D===e.value,onClick:()=>O(D===e.value?void 0:e.value),readOnly:!0}),(0,d.jsx)(`span`,{children:e.label})]},e.value))})]}),(0,d.jsx)(y,{name:`data`,description:e(`chatJoin.demo.field.data`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:F,onChange:e=>I(e.target.value),rows:3,translate:`no`})})]})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(ne,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.cryptoSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`recipientPublicKey`,description:e(`chatJoin.demo.field.recipientPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:V,onChange:e=>ve(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`,translate:`no`})}),(0,d.jsx)(y,{name:`senderUsername`,description:e(`chatJoin.demo.field.senderUsername`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:H,onChange:e=>ye(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`senderPassword`,description:e(`chatJoin.demo.field.senderPassword`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:U,onChange:e=>be(e.target.value),type:`password`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:je,children:[(0,d.jsx)(ae,{size:16}),e(`chatJoin.demo.action.deriveSender`)]}),(0,d.jsxs)(`button`,{className:`btn btn-primary`,type:`button`,onClick:Pe,children:[(0,d.jsx)(l,{size:16}),e(`chatJoin.demo.action.generate`)]})]}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.senderPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:W.publicKey,readOnly:!0,translate:`no`})})]}),Z&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Z})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.outputSection`)})]}),(0,d.jsx)(y,{name:`payload`,description:e(`chatJoin.demo.field.payload`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:$,readOnly:!0,rows:9,translate:`no`})}),(0,d.jsx)(y,{name:`token`,description:e(`chatJoin.demo.field.token`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Oe,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.pub`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:ke,readOnly:!0,translate:`no`})}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.link`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Y,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsx)(re,{className:`btn btn-secondary`,text:Y,label:e(`common.copy`)}),(0,d.jsxs)(`a`,{className:`btn btn-primary`,href:Y||void 0,target:`_blank`,rel:`noreferrer`,"aria-disabled":!Y,children:[(0,d.jsx)(te,{size:16}),e(`chatJoin.demo.action.openLink`)]})]})]})]})})})}var x=o(`/chat/join/demo/`)({component:b});export{x as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,F as a,H as o,O as s}from"./useAppStore-DNhyhD20.js";import{a as ee}from"./i18n-DKsg67mH.js";import{t as te}from"./external-link-D_AQSgxW.js";import{n as ne,t as re}from"./CopyButton-BrEkzqEq.js";import{t as ie}from"./AppShell-BiYQsNO8.js";import{t as ae}from"./refresh-cw-CfkUlTK9.js";import{b as oe}from"./index-mjFWLwue.js";import{t as se}from"./AppTop-D-qYC0ep.js";import{n as ce,r as le,t as c}from"./chatJoinInvite-7tuD-STm.js";var l=i(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),u=t(e(),1),d=n(),f=`chat-join-demo`,p=``,m=`chatjoin_support`,ue=/^[a-zA-Z0-9_-]{3,30}$/,h=/^0x[a-fA-F0-9]{64}$/,de=c,fe=[{value:`dark`,label:`dark`},{value:`light`,label:`light`}],pe=[{value:`zh-CN`,label:`zh-CN`},{value:`zh-TW`,label:`zh-TW`},{value:`en`,label:`en`}];function g(){return typeof window>`u`?`https://most.box`:window.location.origin}function me(e){return(e.trim()||g()).replace(/\/+$/,``)}function he(e,t){let n=s(a(e.trim()||f,t).danger);return{publicKey:n.public_key,privateKey:n.private_key}}function _(e){return e.trim()||void 0}function ge(e){try{return JSON.parse(e)}catch{return null}}function _e(e){let t=e.trim();if(!t)return null;let n,r;try{let e=new URL(t,g());n=e.searchParams,r=e.origin}catch{n=new URLSearchParams(t.replace(/^\?/,``))}let i=n.get(`token`)?.trim()||``,a=n.get(`pub`)?.trim()||``;return!i||!a?null:{token:i,pub:a,origin:r}}function v({name:e,description:t}){return(0,d.jsxs)(`span`,{className:`chat-join-demo-label`,children:[(0,d.jsx)(`span`,{className:`chat-join-demo-label-key`,children:e}),(0,d.jsx)(`span`,{className:`chat-join-demo-label-desc`,children:t})]})}function y({name:e,description:t,children:n,wide:r=!1}){return(0,d.jsxs)(`label`,{className:`chat-join-demo-field ${r?`wide`:``}`,children:[(0,d.jsx)(v,{name:e,description:t}),n]})}function b(){let{t:e}=ee(),[t,n]=(0,u.useState)(g),[i,a]=(0,u.useState)(`demo-user`),[o,s]=(0,u.useState)(`Demo User`),[c,b]=(0,u.useState)(m),[x,S]=(0,u.useState)(`Chat Join Demo`),[C,w]=(0,u.useState)(`zh-CN`),[T,E]=(0,u.useState)(`sparkbit`),[D,O]=(0,u.useState)(),[k,A]=(0,u.useState)(``),[j,M]=(0,u.useState)(``),[N,P]=(0,u.useState)(``),[F,I]=(0,u.useState)(``),[L,R]=(0,u.useState)(``),[z,B]=(0,u.useState)(``),[V,ve]=(0,u.useState)(ce),[H,ye]=(0,u.useState)(f),[U,be]=(0,u.useState)(p),[W,xe]=(0,u.useState)(()=>he(f,p)),[Se,Ce]=(0,u.useState)(``),[we,G]=(0,u.useState)(``),[Te,K]=(0,u.useState)(``),[Ee,De]=(0,u.useState)(!1),[Oe,q]=(0,u.useState)(``),[ke,J]=(0,u.useState)(``),[Y,X]=(0,u.useState)(``),[Z,Q]=(0,u.useState)(``),Ae=(0,u.useMemo)(()=>{let e={uid:i.trim(),locale:C,channels:[{id:c.trim(),name:_(x)}]};return T&&(e.theme=T),D&&(e.appearance=D),e.node_url=_(L),e.node_invite=_(z),e.logo=_(k),e.logo_dark=_(j),e.data=_(F),e.avatar=_(N),e.name=_(o),e},[D,N,c,x,F,o,C,k,j,z,L,T,i]),$=(0,u.useMemo)(()=>JSON.stringify(Ae,null,2),[Ae]);function je(){xe(he(H,U)),q(``),J(``),X(``),Q(``)}function Me(e){let t=e.channels[0];a(e.uid),w(e.locale||`zh-CN`),E(e.theme),O(e.appearance),R(e.node_url||``),B(e.node_invite||``),A(e.logo||``),M(e.logo_dark||``),I(e.data||``),P(e.avatar||``),s(e.name||``),b(t?.id||m),S(t?.name||``)}async function Ne(){let r=_e(Se);if(!r){G(``),K(e(`chatJoin.demo.error.linkInvalid`));return}let i=r.origin||me(t),a=`${i}/chat/join?token=${encodeURIComponent(r.token)}&pub=${encodeURIComponent(r.pub)}`;n(i),q(r.token),J(r.pub),X(a),G(e(`chatJoin.demo.status.linkParsed`)),K(``),De(!0);try{let t=await fetch(`${de}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r.token,pub:r.pub})}),n=await t.text(),i=ge(n);if(!t.ok){let t=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:n;throw Error(t||e(`chatJoin.error.decrypt`))}let a=le(i);if(!a){K(e(`chatJoin.demo.error.parseInvalidPayload`)),G(e(`chatJoin.demo.status.linkParsed`));return}Me(a),G(e(`chatJoin.demo.status.linkDecrypted`)),K(``)}catch(t){K(e(`chatJoin.demo.error.parseDecryptFailed`,{message:t instanceof Error?t.message:String(t)}))}finally{De(!1)}}function Pe(){let n=i.trim(),a=c.trim(),o=V.trim();if(!n){Q(e(`chatJoin.demo.error.uidRequired`));return}if(!ue.test(a)){Q(e(`chatJoin.demo.error.channelInvalid`));return}if(!h.test(o)){Q(e(`chatJoin.demo.error.recipientPublicInvalid`));return}if(!h.test(W.publicKey)||!h.test(W.privateKey)){Q(e(`chatJoin.demo.error.senderKeysInvalid`));return}try{let e=r($,{senderPrivateKey:W.privateKey,recipientPublicKey:o}),n=W.publicKey,i=`${me(t)}/chat/join?token=${encodeURIComponent(e)}&pub=${encodeURIComponent(n)}`;q(e),J(n),X(i),Q(``)}catch{Q(e(`chatJoin.demo.error.encryptFailed`))}}return(0,d.jsx)(ie,{sidebar:()=>(0,d.jsx)(se,{}),headerTitle:(0,d.jsx)(`h2`,{className:`header-title`,children:e(`chatJoin.demo.title`)}),children:(0,d.jsx)(`div`,{className:`chat-join-container`,children:(0,d.jsxs)(`div`,{className:`chat-join-demo-panel`,children:[(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.parseSection`)})]}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.existingLink`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Se,onChange:e=>Ce(e.target.value),rows:4,translate:`no`})}),(0,d.jsx)(`div`,{className:`chat-join-demo-actions`,children:(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:Ne,disabled:Ee,children:[(0,d.jsx)(l,{size:16}),e(Ee?`chatJoin.demo.action.parsing`:`chatJoin.demo.action.parseLink`)]})}),we&&(0,d.jsx)(`p`,{className:`chat-join-demo-success`,children:we}),Te&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Te})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.inviteSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`origin`,description:e(`chatJoin.demo.field.origin`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:t,onChange:e=>n(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`uid`,description:e(`chatJoin.demo.field.uid`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:i,onChange:e=>a(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`name`,description:e(`chatJoin.demo.field.name`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:o,onChange:e=>s(e.target.value)})}),(0,d.jsx)(y,{name:`locale`,description:e(`chatJoin.demo.field.locale`),children:(0,d.jsx)(oe,{ariaLabel:e(`chatJoin.demo.field.locale`),value:C,options:pe,onChange:w,size:`compact`})}),(0,d.jsx)(y,{name:`channels[0].id`,description:e(`chatJoin.demo.field.channelId`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:c,onChange:e=>b(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`channels[0].name`,description:e(`chatJoin.demo.field.channelName`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:x,onChange:e=>S(e.target.value)})}),(0,d.jsx)(y,{name:`node_url`,description:e(`chatJoin.demo.field.nodeUrl`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:L,onChange:e=>R(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`node_invite`,description:e(`chatJoin.demo.field.nodeInvite`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:z,onChange:e=>B(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo`,description:e(`chatJoin.demo.field.logo`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:k,onChange:e=>A(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo_dark`,description:e(`chatJoin.demo.field.logoDark`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:j,onChange:e=>M(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`avatar`,description:e(`chatJoin.demo.field.avatar`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:N,onChange:e=>P(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`theme`,description:e(`chatJoin.demo.field.theme`)}),(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-theme`,value:`sparkbit`,checked:T===`sparkbit`,onClick:()=>E(T===`sparkbit`?void 0:`sparkbit`),readOnly:!0}),(0,d.jsx)(`span`,{children:`sparkbit`})]})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`appearance`,description:e(`chatJoin.demo.field.appearance`)}),(0,d.jsx)(`div`,{className:`chat-join-demo-radio-options`,children:fe.map(e=>(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-appearance`,value:e.value,checked:D===e.value,onClick:()=>O(D===e.value?void 0:e.value),readOnly:!0}),(0,d.jsx)(`span`,{children:e.label})]},e.value))})]}),(0,d.jsx)(y,{name:`data`,description:e(`chatJoin.demo.field.data`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:F,onChange:e=>I(e.target.value),rows:3,translate:`no`})})]})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(ne,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.cryptoSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`recipientPublicKey`,description:e(`chatJoin.demo.field.recipientPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:V,onChange:e=>ve(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`,translate:`no`})}),(0,d.jsx)(y,{name:`senderUsername`,description:e(`chatJoin.demo.field.senderUsername`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:H,onChange:e=>ye(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`senderPassword`,description:e(`chatJoin.demo.field.senderPassword`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:U,onChange:e=>be(e.target.value),type:`password`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:je,children:[(0,d.jsx)(ae,{size:16}),e(`chatJoin.demo.action.deriveSender`)]}),(0,d.jsxs)(`button`,{className:`btn btn-primary`,type:`button`,onClick:Pe,children:[(0,d.jsx)(l,{size:16}),e(`chatJoin.demo.action.generate`)]})]}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.senderPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:W.publicKey,readOnly:!0,translate:`no`})})]}),Z&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Z})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.outputSection`)})]}),(0,d.jsx)(y,{name:`payload`,description:e(`chatJoin.demo.field.payload`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:$,readOnly:!0,rows:9,translate:`no`})}),(0,d.jsx)(y,{name:`token`,description:e(`chatJoin.demo.field.token`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Oe,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.pub`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:ke,readOnly:!0,translate:`no`})}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.link`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Y,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsx)(re,{className:`btn btn-secondary`,text:Y,label:e(`common.copy`)}),(0,d.jsxs)(`a`,{className:`btn btn-primary`,href:Y||void 0,target:`_blank`,rel:`noreferrer`,"aria-disabled":!Y,children:[(0,d.jsx)(te,{size:16}),e(`chatJoin.demo.action.openLink`)]})]})]})]})})})}var x=o(`/chat/join/demo/`)({component:b});export{x as Route};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MilkdownEditor-C388llV6.js","assets/jsx-runtime-Bt-cYkS5.js","assets/i18n-C6yaqRst.js","assets/index-D1mozno-.js","assets/useAppStore-DNhyhD20.js","assets/useNavigate-DWlBD_-b.js","assets/index-C6IjeTBh.css","assets/dist-CSyRxrry.js","assets/dist-RU_cpjXQ.js"])))=>i.map(i=>d[i]);
2
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,C as i,E as a,H as o,M as s,d as c,j as l,o as u,t as d,w as f}from"./useAppStore-DNhyhD20.js";import{n as ee}from"./useNavigate-DWlBD_-b.js";import{a as te}from"./i18n-C6yaqRst.js";import{a as ne,i as re,n as ie,o as p}from"./chatNoteDraft-DTy6In5R.js";import{t as ae}from"./OpenSidebarButton-OP8zl7ad.js";import{n as m,t as oe}from"./trash-2-B9gno5q6.js";import{t as h}from"./folder-open-DOJ4bB58.js";import{t as g}from"./folder-6pYYnS2-.js";import{t as _}from"./lock-yG7M7GkB.js";import{t as se}from"./AppShell-BdRKZIZ9.js";import{t as v}from"./notebook-pen-Bcd3MrtD.js";import{t as ce}from"./save-CfYzXcxH.js";import{t as le}from"./search-DLBOUfny.js";import{C as ue,E as y,L as de,M as b,O as fe,P as x,S as pe,T as me,c as S,d as C,f as w,l as he,m as T,p as ge,s as _e,t as E,u as ve,w as ye}from"./index-D1mozno-.js";import{t as D}from"./AppTop-BE5kKBYH.js";var be=r(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),xe=r(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),O=t(e(),1),k=n();function A(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function Se({target:e,targetLabel:t,directories:n,onMove:r,onClose:i}){let{t:a}=te(),o=f(e.path||``),s=A(e),c=n.filter(t=>e.type===`directory`?t.path!==s&&!t.path.startsWith(`${s}/`):!0),[l,u]=(0,O.useState)(o),[d,ee]=(0,O.useState)(``),[ne,re]=(0,O.useState)(new Set),ie=f(d),p=d.trim()?ie:l,ae=f(p)===o,oe=a(`note.move.rootDirectory`),h=new Map;for(let e of c){let t=h.get(e.parentPath)||[];t.push(e),h.set(e.parentPath,t)}let _=c.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>ne.has(t.slice(0,n+1).join(`/`)))}),se=[{label:oe,path:``},...l.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function v(e){u(f(e)),ee(``)}function ce(e){v(e),h.has(e)&&re(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function le(){ae||r(p)}return(0,k.jsx)(me,{onClose:i,children:(0,k.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,k.jsxs)(`div`,{className:`modal-header`,children:[(0,k.jsx)(`h3`,{children:a(`note.move.title`)}),(0,k.jsx)(`button`,{className:`btn btn-icon`,onClick:i,children:(0,k.jsx)(fe,{size:18})})]}),(0,k.jsxs)(`div`,{className:`note-move-target`,children:[(0,k.jsx)(`span`,{children:a(`note.move.moving`)}),(0,k.jsx)(`strong`,{translate:`no`,children:t||e.name})]}),(0,k.jsx)(`div`,{className:`note-move-path`,children:se.map((e,t)=>(0,k.jsxs)(O.Fragment,{children:[t>0&&(0,k.jsx)(`span`,{children:`/`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>v(e.path),children:(0,k.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,k.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${l===``?`selected`:``}`,onClick:()=>v(``),children:[(0,k.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,k.jsx)(g,{className:`note-move-folder-icon`,size:16}),(0,k.jsx)(`span`,{children:oe})]}),c.length===0?(0,k.jsx)(`p`,{className:`note-move-empty`,children:a(`note.move.noFolders`)}):_.map(e=>{let t=h.has(e.path),n=ne.has(e.path);return(0,k.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${l===e.path?`selected`:``}`,onClick:()=>ce(e.path),children:[t?n?(0,k.jsx)(x,{className:`note-move-expander`,size:14}):(0,k.jsx)(m,{className:`note-move-expander`,size:14}):(0,k.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,k.jsx)(g,{className:`note-move-folder-icon`,size:16}),(0,k.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,k.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,k.jsx)(`input`,{className:`input input-compact`,value:d,onChange:e=>ee(e.target.value),placeholder:a(`note.move.pathPlaceholder`),translate:`no`}),(0,k.jsxs)(`div`,{className:`note-move-destination`,children:[(0,k.jsx)(`span`,{children:a(`note.move.destinationLabel`)}),(0,k.jsx)(`span`,{translate:p?`no`:`yes`,children:p||oe})]}),(0,k.jsxs)(`div`,{className:`modal-actions`,children:[(0,k.jsx)(`button`,{className:`btn btn-secondary`,onClick:i,children:a(`common.cancel`)}),(0,k.jsx)(`button`,{className:`btn btn-primary`,onClick:le,disabled:ae,children:a(`note.action.move`)})]})]})})}function Ce({children:e}){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(D,{}),e]})}var we=(0,O.lazy)(async()=>({default:(await E(()=>import(`./MilkdownEditor-C388llV6.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).MilkdownEditor})),j=/\[\[([^\]\n]+?)\]\]/g,M=/(```[\s\S]*?```)/g;function Te(e){let t=new URLSearchParams(e),n=t.get(`mode`);return{cid:t.get(`cid`)||void 0,file:t.get(`file`)||void 0,path:t.get(`path`)||void 0,chatDraft:t.get(`chatDraft`)||void 0,mode:n===`edit`?`edit`:void 0}}function N(e={}){let t=new URLSearchParams;e.cid&&t.set(`cid`,e.cid),e.file&&t.set(`file`,e.file),e.path&&t.set(`path`,e.path),e.chatDraft&&t.set(`chatDraft`,e.chatDraft),e.mode&&t.set(`mode`,e.mode);let n=t.toString();return n?`/note/?${n}`:`/note/`}function Ee(e){let t=e.indexOf(`?`),n=t>=0?e.slice(t):``;if(typeof window>`u`)return Te(n);try{return Te(new URL(e,window.location.origin).search)}catch{return Te(n)}}var P={"note.error.nameRequired":`note.error.nameRequired`,"note.error.nameNoSlash":`note.error.nameNoSlash`,"note.error.nameNoBackslash":`note.error.nameNoBackslash`,"note.error.nameInvalid":`note.error.nameInvalid`,"note.error.nameConflict":`note.error.nameConflict`,"note.error.moveIntoSelf":`note.error.moveIntoSelf`};function De(e,t,n){let r=e instanceof Error?e.message:``,i=P[r];return i?n(i):r||t}function Oe(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function F(e=``){return String(e).trim().replace(/\.md$/i,``)}function I(e){let t=F(e);return t?`${t}.md`:``}function ke(e,t,n){let r=F(e)||t;for(let e=0;e<1e3;e+=1){let t=I(e===0?r:`${r} ${e+1}`);if(t&&!n(t))return t}return I(`${r} ${Date.now()}`)}function Ae(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=I(t[n]),t.join(`/`)}function je(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=F(t[n]),t.join(`/`)}function Me(e){return je(i(e))}function L(e){let t=e.trim().replace(/^\/+/,``),n=t.search(/[#^]/);return je(n>=0?t.slice(0,n):t)}function Ne(e,t){let n=t?.trim();if(n)return n;let r=e.split(`/`).filter(Boolean);return r[r.length-1]||e}function R(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function Pe(e,t){return`[${R(e)}](<${t.replace(/>/g,`%3E`)}>)`}function Fe(e,t,n=``){let r=L(t);if(!r)return null;let i=r.toLowerCase(),a=e=>Me(e).toLowerCase();if(r.includes(`/`))return e.find(e=>a(e)===i)||null;let o=f(n);if(o){let t=f(`${o}/${r}`).toLowerCase(),n=e.find(e=>a(e)===t);if(n)return n}return e.find(e=>F(e.name).toLowerCase()===i)||null}function Ie(e,t,n,r=``,i){let a=e.indexOf(`|`),o=a>=0?e.slice(0,a):e,s=a>=0?e.slice(a+1):void 0,c=L(o);if(!c)return null;let l=Fe(t,o,r),u=l?n(l):i?.(c);return u?{label:Ne(c,s),href:u}:null}function Le(e,t,n,r=``,i){return e.includes(`[[`)?e.split(M).map(e=>e.startsWith("```")?e:e.replace(j,(e,a)=>{let o=Ie(a,t,n,r,i);return o?Pe(o.label,o.href):e})).join(``):e}function z(e){return e.type===`file`?F(e.name):e.name}function B(e){return e.type===`file`?je(e.fullPath):e.fullPath}function Re(e){return e.type===`file`?F(e.name):e.name}function ze(e=``){let t=f(e).split(`/`).filter(Boolean);return t.map((e,n)=>t.slice(0,n+1).join(`/`))}function Be(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Ve(e,t){if(t.length===0)return e;let n=!1,r=new Set(e);for(let e of t)r.has(e)||(r.add(e),n=!0);return n?r:e}function He(e){return{name:e.name,cid:`__dir__${e.fullPath}`,path:e.path,type:`directory`,size:0,created_at:e.updatedAt,updated_at:e.updatedAt}}function Ue(e,t){let n=[],r=new Map;function a(e){return e&&r.get(e)?.children||n}function o(e,t,n){let i=f(t?`${t}/${e}`:e),o=r.get(i);if(o)return o.updatedAt=Math.max(o.updatedAt,n),o;let s={id:`directory:${i}`,type:`directory`,name:e,path:t,fullPath:i,updatedAt:n,children:[]};return r.set(i,s),a(t).push(s),s}for(let t of e){let e=f(t.path||``),n=e.split(`/`).filter(Boolean),r=t.updated_at||t.created_at||0,s=``;for(let e of n)s=o(e,s,r).fullPath;a(s).push({id:`file:${t.cid}:${i(t)}`,type:`file`,name:t.name,path:e,fullPath:i(t),updatedAt:r,note:t,children:[]})}function s(e){e.sort((e,n)=>{if(e.type!==n.type)return e.type===`directory`?-1:1;let r=t(z(e),z(n));return r===0?t(B(e),B(n)):r});for(let t of e)t.type===`directory`&&s(t.children)}return s(n),n}function We(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=z(e).toLowerCase(),r=B(e).toLowerCase(),i=t.includes(n)||r.includes(n);if(e.type===`file`)return i?[e]:[];let a=i?e.children:We(e.children,n);return!i&&a.length===0?[]:[{...e,children:a}]}):e}function Ge({nodes:e,searchQuery:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=t.trim().length>0;return(0,k.jsx)(`div`,{className:`note-tree`,role:`tree`,children:e.map(e=>(0,k.jsx)(V,{node:e,forceExpanded:c,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})}function V({node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=e.type===`directory`,l=c&&(t||n.has(e.fullPath)),u=e.type===`file`&&e.note?.cid===r,d=c&&f(i)===e.fullPath,ee=c?He(e):e.note||null,te=ee&&s?s(ee):null;return(0,k.jsxs)(`div`,{className:`note-tree-node`,role:`none`,children:[(0,k.jsxs)(`div`,{className:`note-tree-row ${c?`is-directory`:`is-file`} ${u?`is-active`:``} ${d?`is-folder-active`:``} ${te?`has-actions`:``}`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`note-tree-item`,role:`treeitem`,"aria-expanded":c?l:void 0,onClick:()=>{if(c){a(e);return}e.note&&o(e.note)},children:[(0,k.jsx)(`span`,{className:`note-tree-toggle`,"aria-hidden":`true`,children:c?l?(0,k.jsx)(x,{size:16}):(0,k.jsx)(m,{size:16}):(0,k.jsx)(`span`,{className:`note-tree-toggle-placeholder`})}),(0,k.jsx)(`span`,{className:`note-tree-label`,translate:`no`,children:z(e)}),e.note?.isSecret&&(0,k.jsx)(_,{className:`note-tree-lock`,size:14,"aria-hidden":`true`})]}),te]}),c&&l&&e.children.length>0&&(0,k.jsx)(`div`,{className:`note-tree-children`,role:`group`,children:e.children.map(e=>(0,k.jsx)(V,{node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})]})}function Ke(e,t){let n=new Set;for(let t of e){let e=f(t.path).split(`/`).filter(Boolean);for(let t=0;t<e.length;t+=1)n.add(e.slice(0,t+1).join(`/`))}return Array.from(n).sort(t).map(e=>{let t=e.split(`/`);return{path:e,name:t[t.length-1]||e,parentPath:t.slice(0,-1).join(`/`),depth:Math.max(t.length-1,0)}})}function H(e){return e.map(e=>({name:e.name,cid:e.path,path:f(e.directory),content:``,size:e.size,type:`file`,created_at:Number(e.mtimeMs)||Date.now(),updated_at:Number(e.mtimeMs)||Date.now(),isSecret:!1}))}function U(e,t){let n=I(t);return f(e?`${e}/${n}`:n)}function qe(e){let t=e||typeof window<`u`&&window.location.origin||``;if(!t)return!1;try{let e=new URL(t).hostname.toLowerCase();return e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}catch{return!1}}function W(e,t=``){let[n,r]=(0,O.useState)(!1);return(0,O.useEffect)(()=>{let n=!1;return!e||!t?(r(!1),()=>{n=!0}):(ve().then(e=>{n||r(e.configured===!0)}).catch(()=>{n||r(!1)}),()=>{n=!0})},[e,t]),n}function G(){let{t:e,formatDate:t,compareStrings:n}=te(),r=ee(),i=de({select:e=>e.searchStr}),o=(0,O.useMemo)(()=>Te(i),[i]),c=(0,O.useRef)(null),u=d(e=>e.addToast),p=a(e=>e.wallet),m=a(e=>e.openLoginModal),h=d(e=>e.notes),g=d(e=>e.notesPath),y=d(e=>e.setNotesPath),x=d(e=>e.saveNote),pe=d(e=>e.deleteNote),me=d(e=>e.renameNote),S=d(e=>e.localDataReady),C=o.cid||``,w=h.find(e=>e.cid===C),he=!!C,T=he&&o.mode===`edit`,[ge,_e]=(0,O.useState)(``),[E,ve]=(0,O.useState)(null),[D,A]=(0,O.useState)(null),[j,M]=(0,O.useState)(null),P=(0,O.useRef)(``),je=(0,O.useRef)(``),[Me,L]=(0,O.useState)(``),[Ne,R]=(0,O.useState)(``),[Pe,z]=(0,O.useState)(``),[B,He]=(0,O.useState)(``),[V,H]=(0,O.useState)(``),[U,qe]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),[K,q]=(0,O.useState)(!1),[Je,Ye]=(0,O.useState)(()=>new Set(ze(g)));(0,O.useEffect)(()=>{if(!C){L(``),R(``);return}if(!w){L(``),R(S?e(`note.error.notFound`):``);return}if(w.content.startsWith(`mp://1`)){if(!p){L(``),R(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){L(``),R(e(`note.error.decryptFailed`));return}L(t),R(``);return}L(w.content||``),R(``)},[C,S,w,e,p]),(0,O.useEffect)(()=>{if(!T){q(!1);return}if(!C||!w){z(``),He(``),H(``),qe(!1),G(S?e(`note.error.notFound`):``);return}if(z(F(w.name)),He(w.path||``),qe(w.isSecret===!0||w.content.startsWith(`mp://1`)),w.content.startsWith(`mp://1`)){if(!p){H(``),G(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){H(``),G(e(`note.error.decryptFailed`));return}H(t),G(``);return}H(w.content||``),G(``)},[C,T,S,w,e,p]);let Xe=(0,O.useMemo)(()=>Ue(h,n),[n,h]),Ze=(0,O.useMemo)(()=>We(Xe,ge),[Xe,ge]),Qe=w?.isSecret===!0||w?.content.startsWith(`mp://1`)===!0,J=e(T?U?`note.privacy.secret`:`note.privacy.public`:Qe?`note.privacy.secret`:`note.privacy.public`),$e=(0,O.useMemo)(()=>Ke(h,n),[n,h]),et=(0,O.useMemo)(()=>Le(Me,h,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[h,Me,w?.path]),tt=(0,O.useCallback)(e=>Ie(e,h,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[h,w?.path]);(0,O.useEffect)(()=>{w?.path&&Ye(e=>Ve(e,ze(w.path)))},[w?.path]),(0,O.useEffect)(()=>{if(!o.path||C||h.length===0)return;let e=Fe(h,o.path);e&&(y(f(e.path||``)),r({href:N({cid:e.cid}),replace:!0}))},[C,r,h,o.path,y]),(0,O.useEffect)(()=>{let t=o.chatDraft||``;if(!t||P.current===t||!S)return;if(!p){let e=`${t}:auth`;je.current!==e&&(je.current=e,m());return}let n=re(t);if(!n){P.current=t,u(e(`note.chatDraft.missing`),`warning`),Y({},!0);return}P.current=t,at(n)},[u,S,o.chatDraft,e,p]);function Y(e={},t=!1){r({href:N(e),replace:t})}function nt(e){Y(Ee(e))}function rt(e){y(f(e.path||``)),Y({cid:e.cid})}function it(e){y(e.fullPath),Ye(t=>Be(t,e.fullPath))}function X(e){Y({cid:e.cid,mode:`edit`})}function Z(){return p?!0:(m(),!1)}async function at(t){if(p)try{let n=await x({name:ke(t.title,e(`note.chatDraft.defaultTitle`),e=>h.some(t=>f(t.path||``)===f(g)&&t.name===e)),path:g,content:t.content,isSecret:!1});ie(t.id),u(e(`note.chatDraft.created`),`success`),Y({cid:n,mode:`edit`},!0)}catch(t){P.current=``,u(De(t,e(`note.toast.createFailed`),e),`error`)}}function ot(){Y(w?{cid:w.cid}:{})}async function st(){if(!Z())return;if(!w){u(e(`note.toast.notFound`),`error`);return}let t=I(Pe);if(!t){u(e(`note.toast.nameRequired`),`warning`);return}q(!0);try{let n=c.current?.getMarkdown()??V,r=U?s(n,p.danger):n,i=await x({cid:w.cid,name:t,path:B,content:r,isSecret:U});H(n),Y({cid:i},!0),u(e(`note.toast.saved`),`success`)}catch(t){u(De(t,e(`note.toast.saveFailed`),e),`error`)}finally{q(!1)}}function ct(){Z()&&ve({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(Z())try{let n=await x({name:I(t),path:g,content:``,isSecret:!1});ve(null),u(e(`note.toast.created`),`success`),Y({cid:n,mode:`edit`})}catch(t){u(De(t,e(`note.toast.createFailed`),e),`error`)}}})}function lt(e){Z()&&M(e)}async function Q(t){if(j)try{me(Oe(j),t,j.name),M(null),u(e(`note.toast.moved`),`success`)}catch(t){u(De(t,e(`note.toast.moveFailed`),e),`error`)}}function $(t){if(!Z())return;let n=t.type===`directory`;A({title:e(n?`note.delete.folderTitle`:`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{pe(n?void 0:t.cid,t.path,t.name),A(null),u(e(`note.toast.deleted`),`success`),t.type===`file`&&t.cid===C&&Y()}})}let ut=(0,k.jsxs)(`div`,{className:`note-header-title`,children:[(0,k.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,k.jsx)(`span`,{children:e(`note.count`,{count:h.length})})]}),dt=(0,k.jsx)(`div`,{className:`note-theme-wrap`}),ft=(0,k.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,k.jsxs)(`div`,{className:`note-search`,children:[(0,k.jsx)(le,{size:16}),(0,k.jsx)(`input`,{className:`input input-flex`,value:ge,onChange:e=>_e(e.target.value),placeholder:e(`note.search.placeholder`)})]}),Ze.length===0?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(ge?`note.empty.noMatches`:`note.empty.noNotes`)})]}):(0,k.jsx)(Ge,{nodes:Ze,searchQuery:ge,expandedPaths:Je,activeFileId:C,activeFolderPath:C?``:g,onToggleDirectory:it,onOpenFile:rt}),(0,k.jsx)(`div`,{className:`note-create-btn`,children:(0,k.jsxs)(`button`,{className:`btn`,onClick:ct,children:[(0,k.jsx)(ne,{size:16}),e(`note.newNote`)]})})]});return(0,k.jsxs)(se,{sidebar:()=>(0,k.jsx)(Ce,{children:ft}),headerTitle:ut,headerRight:dt,children:[(0,k.jsx)(`main`,{className:`note-page note-browser-page ${he?`has-editor`:``}`,children:(0,k.jsx)(`section`,{className:`note-workspace`,children:(0,k.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(T?`note.editorLabel.edit`:`note.editorLabel.read`),children:he?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,k.jsxs)(`div`,{className:`note-editor-title-area`,children:[T?(0,k.jsx)(`input`,{className:`note-title-input`,value:Pe,onChange:e=>z(e.target.value),placeholder:e(`note.namePlaceholder`),translate:`no`,disabled:!w}):w?(0,k.jsx)(`h3`,{translate:`no`,children:F(w.name)}):(0,k.jsx)(`h3`,{children:e(`note.untitled`)}),w&&(0,k.jsxs)(`div`,{className:`note-editor-info`,children:[(0,k.jsx)(`span`,{children:e(T?`note.mode.edit`:`note.mode.read`)}),(0,k.jsx)(`span`,{children:J}),(0,k.jsx)(`span`,{children:t(w.updated_at)})]})]}),(0,k.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:T?ot:()=>Y(),title:e(T?`common.cancel`:`common.close`),"aria-label":e(T?`common.cancel`:`common.close`),children:(0,k.jsx)(fe,{size:16})}),T?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`button`,{className:`btn btn-sm ${U?`btn-warning`:`btn-secondary`}`,onClick:()=>qe(!U),disabled:!w,children:[U?(0,k.jsx)(_,{size:16}):(0,k.jsx)(b,{size:16}),e(U?`note.privacy.secret`:`note.privacy.public`)]}),(0,k.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:st,disabled:K||!!W||!w,children:[(0,k.jsx)(ce,{size:16}),e(K?`note.action.saving`:`note.action.save`)]})]}):w&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>lt(w),title:e(`note.action.move`),"aria-label":e(`note.action.move`),children:(0,k.jsx)(be,{size:16})}),(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon note-editor-action-danger`,onClick:()=>$(w),title:e(`note.action.delete`),"aria-label":e(`note.action.delete`),children:(0,k.jsx)(oe,{size:16})}),(0,k.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:()=>X(w),disabled:!!Ne,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,k.jsx)(xe,{size:16}),e(`note.action.edit`)]})]})]})]}),T?W?(0,k.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:W})]}):w?(0,k.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,k.jsx)(we,{ref:c,content:V,onChange:H,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]}):Ne?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:Ne})]}):w?(0,k.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,k.jsx)(we,{content:et,readOnly:!0,onInternalNoteLinkOpen:nt,resolveWikiNoteLink:tt,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]})]}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,k.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,k.jsx)(v,{size:32})}),(0,k.jsx)(`h3`,{className:`ui-empty-title`,children:e(`note.noOpen.title`)}),(0,k.jsx)(`p`,{className:`ui-empty-desc`,children:h.length>0?e(`note.noOpen.select`):e(`note.noOpen.createFirst`)}),(0,k.jsx)(ae,{label:e(`note.openList`),variant:`default`})]})})})}),E&&(0,k.jsx)(ue,{title:E.title,placeholder:E.placeholder,defaultValue:E.defaultValue,confirmText:E.confirmText,onConfirm:E.onConfirm,onClose:()=>ve(null)}),D&&(0,k.jsx)(ye,{title:D.title,message:D.message,confirmText:D.confirmText,danger:!0,onConfirm:D.onConfirm,onClose:()=>A(null)}),j&&(0,k.jsx)(Se,{target:j,targetLabel:Re(j),directories:$e,onMove:Q,onClose:()=>M(null)})]})}function K(){let{t:e,formatDate:t,compareStrings:n}=te(),r=ee(),i=de({select:e=>e.searchStr}),o=(0,O.useMemo)(()=>Te(i),[i]),s=(0,O.useRef)(null),c=d(e=>e.addToast),l=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=o.file||``,y=!!g,b=y&&o.mode===`edit`,[x,me]=(0,O.useState)(null),[E,D]=(0,O.useState)([]),[A,j]=(0,O.useState)(``),[M,P]=(0,O.useState)(!0),[De,Me]=(0,O.useState)(``),[L,Ne]=(0,O.useState)(``),[R,Pe]=(0,O.useState)(!1),[z,B]=(0,O.useState)(null),[He,V]=(0,O.useState)(``),[qe,W]=(0,O.useState)(``),[G,K]=(0,O.useState)(!1),[q,Je]=(0,O.useState)(``),[Ye,Xe]=(0,O.useState)(!1),[Ze,Qe]=(0,O.useState)(()=>new Set(ze(A))),[J,$e]=(0,O.useState)(null),[et,tt]=(0,O.useState)(null),[Y,nt]=(0,O.useState)(null),rt=(0,O.useRef)(``),it=(0,O.useRef)(``),X=(0,O.useMemo)(()=>H(E),[E]),Z=X.find(e=>e.cid===g),at=(0,O.useMemo)(()=>Ke(X,n),[n,X]),ot=(0,O.useMemo)(()=>Ue(X,n),[n,X]),st=(0,O.useMemo)(()=>We(ot,L),[ot,L]),ct=(0,O.useMemo)(()=>Le(z?.content||``,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.content,z?.directory,Z?.path,X]),lt=(0,O.useCallback)(e=>Ie(e,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.directory,Z?.path,X]);(0,O.useEffect)(()=>{Z?.path&&Qe(e=>Ve(e,ze(Z.path)))},[Z?.path]),(0,O.useEffect)(()=>{if(!o.path||g||X.length===0)return;let e=Fe(X,o.path);e&&(j(f(e.path||``)),r({href:N({file:e.cid}),replace:!0}))},[g,r,o.path,X]),(0,O.useEffect)(()=>{let t=o.chatDraft||``;if(!t||rt.current===t||M)return;if(!l){let e=`${t}:auth`;it.current!==e&&(it.current=e,m());return}if(x?.configured!==!0){let n=`${t}:vault`;it.current!==n&&(it.current=n,c(e(`note.chatDraft.openVaultFirst`),`warning`));return}let n=re(t);if(!n){rt.current=t,c(e(`note.chatDraft.missing`),`warning`),$({},!0);return}rt.current=t,_t(n)},[c,o.chatDraft,e,M,x?.configured,l]);let Q=(0,O.useCallback)(async()=>{if(!l){me(null),D([]),Me(e(`note.vault.loginRequired`)),P(!1);return}P(!0),Me(``);try{let e=await ve();me(e),e.configured?D(await C()):D([])}catch(t){me(null),D([]),Me(await u(t,e(`note.vault.loadFailed`)))}finally{P(!1)}},[e,l]);(0,O.useEffect)(()=>{Q()},[Q]),(0,O.useEffect)(()=>{V(F(z?.name||Z?.name||``))},[z?.name,Z?.name]),(0,O.useEffect)(()=>{let t=!1;async function n(){if(!g){B(null),W(``),Je(``),K(!1);return}if(!l){B(null),W(``),Je(e(`note.vault.loginRequired`)),K(!1);return}if(x?.configured!==!0){B(null),W(``),Je(``),K(!1);return}K(!0),Je(``);try{let e=await ge(g);if(t)return;B(e),W(e.content)}catch(n){if(t)return;B(null),W(``),Je(await u(n,e(`note.error.notFound`)))}finally{t||K(!1)}}return n(),()=>{t=!0}},[g,e,x?.configured,l]);function $(e={},t=!1){r({href:N(e),replace:t})}function ut(e){$(Ee(e))}function dt(e){j(f(e.path||``)),$({file:e.cid})}function ft(e){j(e.fullPath),Qe(t=>Be(t,e.fullPath))}function pt(){g&&$({file:g,mode:`edit`})}function mt(){V(F(z?.name||Z?.name||``)),$(g?{file:g}:{})}async function ht(){if(!l){m();return}let t=window.electronAPI?.selectNoteVaultDirectory;if(!t){c(e(`note.vault.selectFailed`),`error`);return}Pe(!0);try{let n=await t();if(!n)return;await _e(n),await Q(),$({},!0),c(e(`note.vault.opened`),`success`)}catch(t){c(await u(t,e(`note.vault.selectFailed`)),`error`)}finally{Pe(!1)}}function gt(){return l?x?.configured===!0?!0:(c(e(`note.vault.emptyPrompt`),`warning`),!1):(m(),!1)}async function _t(t){if(gt())try{let n=ke(t.title,e(`note.chatDraft.defaultTitle`),e=>E.some(t=>f(t.directory)===f(A)&&t.name===e)),r=await S(f(A?`${A}/${n}`:n),t.content);ie(t.id),await Q(),c(e(`note.chatDraft.created`),`success`),$({file:r.path,mode:`edit`},!0)}catch(t){rt.current=``,c(await u(t,e(`note.toast.createFailed`)),`error`)}}function vt(){gt()&&$e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(!gt())return;let n=U(A,t);if(!n){c(e(`note.toast.nameRequired`),`warning`);return}try{let t=await S(n,``);$e(null),await Q(),$({file:t.path,mode:`edit`}),c(e(`note.toast.created`),`success`)}catch(t){c(await u(t,e(`note.toast.createFailed`)),`error`)}}})}function yt(e){gt()&&nt(e)}async function bt(t){if(!(!Y||!gt()))try{let n=g;if(Y.type===`directory`){let e=Oe(Y),r=f(t?`${t}/${Y.name}`:Y.name),i=E.filter(t=>t.path.startsWith(`${e}/`));for(let t of i){let i=f(`${r}/${t.path.slice(e.length+1)}`);await w(t.path,i),g===t.path&&(n=i)}}else{let e=f(t?`${t}/${Y.name}`:Y.name),r=await w(Y.cid,e);g===Y.cid&&(n=r.path)}nt(null),await Q(),$(n?{file:n}:{},!0),c(e(`note.toast.moved`),`success`)}catch(t){c(await u(t,e(`note.toast.moveFailed`)),`error`)}}function xt(t){gt()&&tt({title:t.type===`directory`?e(`note.delete.folderTitle`):e(`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{try{if(t.type===`directory`){let e=Oe(t),n=E.filter(t=>t.path.startsWith(`${e}/`));for(let e of n)await he(e.path);g.startsWith(`${e}/`)&&$({},!0)}else await he(t.cid),g===t.cid&&$({},!0);tt(null),await Q(),c(e(`note.toast.deleted`),`success`)}catch(t){c(await u(t,e(`note.toast.deleteFailed`)),`error`)}}})}async function St(){if(!l){m();return}if(!g||!z){c(e(`note.toast.notFound`),`error`);return}let t=I(He);if(!t){c(e(`note.toast.nameRequired`),`warning`);return}Xe(!0);try{let n=s.current?.getMarkdown()??qe,r=z.path;if(t!==z.name){r=f(z.directory?`${z.directory}/${t}`:t);let e=await w(z.path,r);B(e),V(F(e.name)),r=e.path}let i=await T(r,n);B(i),V(F(i.name)),W(i.content),await Q(),$({file:i.path},!0),c(e(`note.toast.saved`),`success`)}catch(t){c(await u(t,e(`note.toast.saveFailed`)),`error`)}finally{Xe(!1)}}let Ct=(0,k.jsxs)(`div`,{className:`note-header-title`,children:[(0,k.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,k.jsx)(`span`,{children:e(`note.count`,{count:E.length})})]}),wt=(0,k.jsx)(`div`,{className:`note-theme-wrap`,children:(0,k.jsxs)(`button`,{className:`btn btn-sm`,onClick:ht,disabled:R,title:e(`note.vault.open`),"aria-label":e(`note.vault.open`),children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})}),Tt=(0,k.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,k.jsxs)(`div`,{className:`note-search`,children:[(0,k.jsx)(le,{size:16}),(0,k.jsx)(`input`,{className:`input input-flex`,value:L,onChange:e=>Ne(e.target.value),placeholder:e(`note.search.placeholder`)})]}),M?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(`note.loading`)})]}):De?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(_,{size:32}),(0,k.jsx)(`p`,{children:De})]}):x?.configured===!0?st.length===0?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(L?`note.empty.noMatches`:`note.vault.noFiles`)})]}):(0,k.jsx)(Ge,{nodes:st,searchQuery:L,expandedPaths:Ze,activeFileId:g,activeFolderPath:g?``:A,onToggleDirectory:ft,onOpenFile:dt,renderActions:t=>(0,k.jsx)(pe,{ariaLabel:e(`common.moreActions`),className:`note-list-actions-anchor`,placement:`bottom-end`,items:[{key:`move`,label:e(`note.action.move`),icon:(0,k.jsx)(be,{size:16}),onSelect:()=>yt(t)},{key:`delete`,label:e(`note.action.delete`),icon:(0,k.jsx)(oe,{size:16}),danger:!0,onSelect:()=>xt(t)}],renderTrigger:t=>(0,k.jsx)(`button`,{...t,className:`note-list-actions-trigger`,title:e(`common.moreActions`),"aria-label":e(`common.moreActions`),children:(0,k.jsx)(p,{size:16})})})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(h,{size:32}),(0,k.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]}),x?.configured===!0&&(0,k.jsx)(`div`,{className:`note-create-btn`,children:(0,k.jsxs)(`button`,{className:`btn`,onClick:vt,children:[(0,k.jsx)(ne,{size:16}),e(`note.newNote`)]})})]}),Et=z?.mtimeMs||Z?.updated_at||Date.now(),Dt=F(z?.name||Z?.name||``)||e(`note.untitled`);return(0,k.jsxs)(se,{sidebar:()=>(0,k.jsx)(Ce,{children:Tt}),headerTitle:Ct,headerRight:wt,children:[(0,k.jsx)(`main`,{className:`note-page note-browser-page ${y?`has-editor`:``}`,children:(0,k.jsx)(`section`,{className:`note-workspace`,children:(0,k.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(b?`note.editorLabel.edit`:`note.editorLabel.read`),children:y?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,k.jsxs)(`div`,{className:`note-editor-title-area`,children:[b&&z?(0,k.jsx)(`input`,{className:`note-title-input`,value:He,onChange:e=>V(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){e.currentTarget.blur();return}e.key===`Escape`&&(V(F(z.name)),e.currentTarget.blur())},placeholder:e(`note.namePlaceholder`),translate:`no`}):(0,k.jsx)(`h3`,{translate:`no`,children:Dt}),(0,k.jsxs)(`div`,{className:`note-editor-info`,children:[(0,k.jsx)(`span`,{children:e(b?`note.mode.edit`:`note.mode.read`)}),(0,k.jsx)(`span`,{translate:`no`,children:je(g)}),(0,k.jsx)(`span`,{children:t(Et)})]})]}),(0,k.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:b?mt:()=>$(),title:e(b?`common.cancel`:`common.close`),"aria-label":e(b?`common.cancel`:`common.close`),children:(0,k.jsx)(fe,{size:16})}),b?(0,k.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:St,disabled:Ye||!!q||!z,children:[(0,k.jsx)(ce,{size:16}),e(Ye?`note.action.saving`:`note.action.save`)]}):Z&&(0,k.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:pt,disabled:!!q||!z,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,k.jsx)(xe,{size:16}),e(`note.action.edit`)]})]})]}),G?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(`note.loading`)})]}):q?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:q})]}):b?(0,k.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,k.jsx)(we,{ref:s,content:qe,onChange:W,className:`milkdown-editor`})}):z?(0,k.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,k.jsx)(we,{content:ct,readOnly:!0,onInternalNoteLinkOpen:ut,resolveWikiNoteLink:lt,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(`note.error.notFound`)})]})]}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,k.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,k.jsx)(v,{size:32})}),(0,k.jsx)(`h3`,{className:`ui-empty-title`,children:x?.configured?e(`note.noOpen.title`):e(`note.vault.open`)}),(0,k.jsx)(`p`,{className:`ui-empty-desc`,children:x?.configured?e(`note.noOpen.select`):e(`note.vault.emptyPrompt`)}),x?.configured?(0,k.jsx)(ae,{label:e(`note.openList`),variant:`default`}):(0,k.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]})})})}),J&&(0,k.jsx)(ue,{title:J.title,placeholder:J.placeholder,defaultValue:J.defaultValue,confirmText:J.confirmText,onConfirm:J.onConfirm,onClose:()=>$e(null)}),et&&(0,k.jsx)(ye,{title:et.title,message:et.message,confirmText:et.confirmText,danger:!0,onConfirm:et.onConfirm,onClose:()=>tt(null)}),Y&&(0,k.jsx)(Se,{target:Y,targetLabel:Re(Y),directories:at,onMove:bt,onClose:()=>nt(null)})]})}function q(){let{t:e}=te(),t=d(e=>e.hasBackend),n=a(e=>e.wallet),r=y(),i=t===!0&&qe(c()),o=W(i,n?.address||``),s=i&&(r||o);return(0,k.jsx)(O.Suspense,{fallback:(0,k.jsx)(`div`,{className:`note-editor-loading`,children:e(`note.loading`)}),children:s?(0,k.jsx)(K,{}):(0,k.jsx)(G,{})})}var Je=o(`/note/`)({component:q});export{Je as Route};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MilkdownEditor-DfhuT9eU.js","assets/jsx-runtime-Bt-cYkS5.js","assets/i18n-DKsg67mH.js","assets/index-mjFWLwue.js","assets/useAppStore-DNhyhD20.js","assets/useNavigate-DWlBD_-b.js","assets/index-FEwag7ej.css","assets/dist-CSyRxrry.js","assets/dist-RU_cpjXQ.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,C as i,E as a,H as o,M as s,d as c,j as l,o as u,t as d,w as f}from"./useAppStore-DNhyhD20.js";import{n as ee}from"./useNavigate-DWlBD_-b.js";import{a as te}from"./i18n-DKsg67mH.js";import{a as ne,i as re,n as ie,o as p}from"./chatNoteDraft-DTy6In5R.js";import{t as ae}from"./OpenSidebarButton-Bvwr7B6k.js";import{n as m,t as oe}from"./trash-2-B9gno5q6.js";import{t as h}from"./folder-open-DOJ4bB58.js";import{t as g}from"./folder-6pYYnS2-.js";import{t as _}from"./lock-yG7M7GkB.js";import{t as se}from"./AppShell-BiYQsNO8.js";import{t as v}from"./notebook-pen-Bcd3MrtD.js";import{t as ce}from"./save-CfYzXcxH.js";import{t as le}from"./search-DLBOUfny.js";import{C as ue,E as y,L as de,M as b,O as fe,P as x,S as pe,T as me,c as S,d as C,f as w,l as he,m as T,p as ge,s as _e,t as E,u as ve,w as ye}from"./index-mjFWLwue.js";import{t as D}from"./AppTop-D-qYC0ep.js";var be=r(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),xe=r(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),O=t(e(),1),k=n();function A(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function Se({target:e,targetLabel:t,directories:n,onMove:r,onClose:i}){let{t:a}=te(),o=f(e.path||``),s=A(e),c=n.filter(t=>e.type===`directory`?t.path!==s&&!t.path.startsWith(`${s}/`):!0),[l,u]=(0,O.useState)(o),[d,ee]=(0,O.useState)(``),[ne,re]=(0,O.useState)(new Set),ie=f(d),p=d.trim()?ie:l,ae=f(p)===o,oe=a(`note.move.rootDirectory`),h=new Map;for(let e of c){let t=h.get(e.parentPath)||[];t.push(e),h.set(e.parentPath,t)}let _=c.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>ne.has(t.slice(0,n+1).join(`/`)))}),se=[{label:oe,path:``},...l.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function v(e){u(f(e)),ee(``)}function ce(e){v(e),h.has(e)&&re(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function le(){ae||r(p)}return(0,k.jsx)(me,{onClose:i,children:(0,k.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,k.jsxs)(`div`,{className:`modal-header`,children:[(0,k.jsx)(`h3`,{children:a(`note.move.title`)}),(0,k.jsx)(`button`,{className:`btn btn-icon`,onClick:i,children:(0,k.jsx)(fe,{size:18})})]}),(0,k.jsxs)(`div`,{className:`note-move-target`,children:[(0,k.jsx)(`span`,{children:a(`note.move.moving`)}),(0,k.jsx)(`strong`,{translate:`no`,children:t||e.name})]}),(0,k.jsx)(`div`,{className:`note-move-path`,children:se.map((e,t)=>(0,k.jsxs)(O.Fragment,{children:[t>0&&(0,k.jsx)(`span`,{children:`/`}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>v(e.path),children:(0,k.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,k.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${l===``?`selected`:``}`,onClick:()=>v(``),children:[(0,k.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,k.jsx)(g,{className:`note-move-folder-icon`,size:16}),(0,k.jsx)(`span`,{children:oe})]}),c.length===0?(0,k.jsx)(`p`,{className:`note-move-empty`,children:a(`note.move.noFolders`)}):_.map(e=>{let t=h.has(e.path),n=ne.has(e.path);return(0,k.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${l===e.path?`selected`:``}`,onClick:()=>ce(e.path),children:[t?n?(0,k.jsx)(x,{className:`note-move-expander`,size:14}):(0,k.jsx)(m,{className:`note-move-expander`,size:14}):(0,k.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,k.jsx)(g,{className:`note-move-folder-icon`,size:16}),(0,k.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,k.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,k.jsx)(`input`,{className:`input input-compact`,value:d,onChange:e=>ee(e.target.value),placeholder:a(`note.move.pathPlaceholder`),translate:`no`}),(0,k.jsxs)(`div`,{className:`note-move-destination`,children:[(0,k.jsx)(`span`,{children:a(`note.move.destinationLabel`)}),(0,k.jsx)(`span`,{translate:p?`no`:`yes`,children:p||oe})]}),(0,k.jsxs)(`div`,{className:`modal-actions`,children:[(0,k.jsx)(`button`,{className:`btn btn-secondary`,onClick:i,children:a(`common.cancel`)}),(0,k.jsx)(`button`,{className:`btn btn-primary`,onClick:le,disabled:ae,children:a(`note.action.move`)})]})]})})}function Ce({children:e}){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(D,{}),e]})}var we=(0,O.lazy)(async()=>({default:(await E(()=>import(`./MilkdownEditor-DfhuT9eU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))).MilkdownEditor})),j=/\[\[([^\]\n]+?)\]\]/g,M=/(```[\s\S]*?```)/g;function Te(e){let t=new URLSearchParams(e),n=t.get(`mode`);return{cid:t.get(`cid`)||void 0,file:t.get(`file`)||void 0,path:t.get(`path`)||void 0,chatDraft:t.get(`chatDraft`)||void 0,mode:n===`edit`?`edit`:void 0}}function N(e={}){let t=new URLSearchParams;e.cid&&t.set(`cid`,e.cid),e.file&&t.set(`file`,e.file),e.path&&t.set(`path`,e.path),e.chatDraft&&t.set(`chatDraft`,e.chatDraft),e.mode&&t.set(`mode`,e.mode);let n=t.toString();return n?`/note/?${n}`:`/note/`}function Ee(e){let t=e.indexOf(`?`),n=t>=0?e.slice(t):``;if(typeof window>`u`)return Te(n);try{return Te(new URL(e,window.location.origin).search)}catch{return Te(n)}}var P={"note.error.nameRequired":`note.error.nameRequired`,"note.error.nameNoSlash":`note.error.nameNoSlash`,"note.error.nameNoBackslash":`note.error.nameNoBackslash`,"note.error.nameInvalid":`note.error.nameInvalid`,"note.error.nameConflict":`note.error.nameConflict`,"note.error.moveIntoSelf":`note.error.moveIntoSelf`};function De(e,t,n){let r=e instanceof Error?e.message:``,i=P[r];return i?n(i):r||t}function Oe(e){return e.type===`directory`?f(e.path?`${e.path}/${e.name}`:e.name):i(e)}function F(e=``){return String(e).trim().replace(/\.md$/i,``)}function I(e){let t=F(e);return t?`${t}.md`:``}function ke(e,t,n){let r=F(e)||t;for(let e=0;e<1e3;e+=1){let t=I(e===0?r:`${r} ${e+1}`);if(t&&!n(t))return t}return I(`${r} ${Date.now()}`)}function Ae(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=I(t[n]),t.join(`/`)}function je(e=``){let t=f(e).split(`/`).filter(Boolean);if(t.length===0)return``;let n=t.length-1;return t[n]=F(t[n]),t.join(`/`)}function Me(e){return je(i(e))}function L(e){let t=e.trim().replace(/^\/+/,``),n=t.search(/[#^]/);return je(n>=0?t.slice(0,n):t)}function Ne(e,t){let n=t?.trim();if(n)return n;let r=e.split(`/`).filter(Boolean);return r[r.length-1]||e}function R(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function Pe(e,t){return`[${R(e)}](<${t.replace(/>/g,`%3E`)}>)`}function Fe(e,t,n=``){let r=L(t);if(!r)return null;let i=r.toLowerCase(),a=e=>Me(e).toLowerCase();if(r.includes(`/`))return e.find(e=>a(e)===i)||null;let o=f(n);if(o){let t=f(`${o}/${r}`).toLowerCase(),n=e.find(e=>a(e)===t);if(n)return n}return e.find(e=>F(e.name).toLowerCase()===i)||null}function Ie(e,t,n,r=``,i){let a=e.indexOf(`|`),o=a>=0?e.slice(0,a):e,s=a>=0?e.slice(a+1):void 0,c=L(o);if(!c)return null;let l=Fe(t,o,r),u=l?n(l):i?.(c);return u?{label:Ne(c,s),href:u}:null}function Le(e,t,n,r=``,i){return e.includes(`[[`)?e.split(M).map(e=>e.startsWith("```")?e:e.replace(j,(e,a)=>{let o=Ie(a,t,n,r,i);return o?Pe(o.label,o.href):e})).join(``):e}function z(e){return e.type===`file`?F(e.name):e.name}function B(e){return e.type===`file`?je(e.fullPath):e.fullPath}function Re(e){return e.type===`file`?F(e.name):e.name}function ze(e=``){let t=f(e).split(`/`).filter(Boolean);return t.map((e,n)=>t.slice(0,n+1).join(`/`))}function Be(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Ve(e,t){if(t.length===0)return e;let n=!1,r=new Set(e);for(let e of t)r.has(e)||(r.add(e),n=!0);return n?r:e}function He(e){return{name:e.name,cid:`__dir__${e.fullPath}`,path:e.path,type:`directory`,size:0,created_at:e.updatedAt,updated_at:e.updatedAt}}function Ue(e,t){let n=[],r=new Map;function a(e){return e&&r.get(e)?.children||n}function o(e,t,n){let i=f(t?`${t}/${e}`:e),o=r.get(i);if(o)return o.updatedAt=Math.max(o.updatedAt,n),o;let s={id:`directory:${i}`,type:`directory`,name:e,path:t,fullPath:i,updatedAt:n,children:[]};return r.set(i,s),a(t).push(s),s}for(let t of e){let e=f(t.path||``),n=e.split(`/`).filter(Boolean),r=t.updated_at||t.created_at||0,s=``;for(let e of n)s=o(e,s,r).fullPath;a(s).push({id:`file:${t.cid}:${i(t)}`,type:`file`,name:t.name,path:e,fullPath:i(t),updatedAt:r,note:t,children:[]})}function s(e){e.sort((e,n)=>{if(e.type!==n.type)return e.type===`directory`?-1:1;let r=t(z(e),z(n));return r===0?t(B(e),B(n)):r});for(let t of e)t.type===`directory`&&s(t.children)}return s(n),n}function We(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=z(e).toLowerCase(),r=B(e).toLowerCase(),i=t.includes(n)||r.includes(n);if(e.type===`file`)return i?[e]:[];let a=i?e.children:We(e.children,n);return!i&&a.length===0?[]:[{...e,children:a}]}):e}function Ge({nodes:e,searchQuery:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=t.trim().length>0;return(0,k.jsx)(`div`,{className:`note-tree`,role:`tree`,children:e.map(e=>(0,k.jsx)(V,{node:e,forceExpanded:c,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})}function V({node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s}){let c=e.type===`directory`,l=c&&(t||n.has(e.fullPath)),u=e.type===`file`&&e.note?.cid===r,d=c&&f(i)===e.fullPath,ee=c?He(e):e.note||null,te=ee&&s?s(ee):null;return(0,k.jsxs)(`div`,{className:`note-tree-node`,role:`none`,children:[(0,k.jsxs)(`div`,{className:`note-tree-row ${c?`is-directory`:`is-file`} ${u?`is-active`:``} ${d?`is-folder-active`:``} ${te?`has-actions`:``}`,children:[(0,k.jsxs)(`button`,{type:`button`,className:`note-tree-item`,role:`treeitem`,"aria-expanded":c?l:void 0,onClick:()=>{if(c){a(e);return}e.note&&o(e.note)},children:[(0,k.jsx)(`span`,{className:`note-tree-toggle`,"aria-hidden":`true`,children:c?l?(0,k.jsx)(x,{size:16}):(0,k.jsx)(m,{size:16}):(0,k.jsx)(`span`,{className:`note-tree-toggle-placeholder`})}),(0,k.jsx)(`span`,{className:`note-tree-label`,translate:`no`,children:z(e)}),e.note?.isSecret&&(0,k.jsx)(_,{className:`note-tree-lock`,size:14,"aria-hidden":`true`})]}),te]}),c&&l&&e.children.length>0&&(0,k.jsx)(`div`,{className:`note-tree-children`,role:`group`,children:e.children.map(e=>(0,k.jsx)(V,{node:e,forceExpanded:t,expandedPaths:n,activeFileId:r,activeFolderPath:i,onToggleDirectory:a,onOpenFile:o,renderActions:s},e.id))})]})}function Ke(e,t){let n=new Set;for(let t of e){let e=f(t.path).split(`/`).filter(Boolean);for(let t=0;t<e.length;t+=1)n.add(e.slice(0,t+1).join(`/`))}return Array.from(n).sort(t).map(e=>{let t=e.split(`/`);return{path:e,name:t[t.length-1]||e,parentPath:t.slice(0,-1).join(`/`),depth:Math.max(t.length-1,0)}})}function H(e){return e.map(e=>({name:e.name,cid:e.path,path:f(e.directory),content:``,size:e.size,type:`file`,created_at:Number(e.mtimeMs)||Date.now(),updated_at:Number(e.mtimeMs)||Date.now(),isSecret:!1}))}function U(e,t){let n=I(t);return f(e?`${e}/${n}`:n)}function qe(e){let t=e||typeof window<`u`&&window.location.origin||``;if(!t)return!1;try{let e=new URL(t).hostname.toLowerCase();return e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}catch{return!1}}function W(e,t=``){let[n,r]=(0,O.useState)(!1);return(0,O.useEffect)(()=>{let n=!1;return!e||!t?(r(!1),()=>{n=!0}):(ve().then(e=>{n||r(e.configured===!0)}).catch(()=>{n||r(!1)}),()=>{n=!0})},[e,t]),n}function G(){let{t:e,formatDate:t,compareStrings:n}=te(),r=ee(),i=de({select:e=>e.searchStr}),o=(0,O.useMemo)(()=>Te(i),[i]),c=(0,O.useRef)(null),u=d(e=>e.addToast),p=a(e=>e.wallet),m=a(e=>e.openLoginModal),h=d(e=>e.notes),g=d(e=>e.notesPath),y=d(e=>e.setNotesPath),x=d(e=>e.saveNote),pe=d(e=>e.deleteNote),me=d(e=>e.renameNote),S=d(e=>e.localDataReady),C=o.cid||``,w=h.find(e=>e.cid===C),he=!!C,T=he&&o.mode===`edit`,[ge,_e]=(0,O.useState)(``),[E,ve]=(0,O.useState)(null),[D,A]=(0,O.useState)(null),[j,M]=(0,O.useState)(null),P=(0,O.useRef)(``),je=(0,O.useRef)(``),[Me,L]=(0,O.useState)(``),[Ne,R]=(0,O.useState)(``),[Pe,z]=(0,O.useState)(``),[B,He]=(0,O.useState)(``),[V,H]=(0,O.useState)(``),[U,qe]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),[K,q]=(0,O.useState)(!1),[Je,Ye]=(0,O.useState)(()=>new Set(ze(g)));(0,O.useEffect)(()=>{if(!C){L(``),R(``);return}if(!w){L(``),R(S?e(`note.error.notFound`):``);return}if(w.content.startsWith(`mp://1`)){if(!p){L(``),R(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){L(``),R(e(`note.error.decryptFailed`));return}L(t),R(``);return}L(w.content||``),R(``)},[C,S,w,e,p]),(0,O.useEffect)(()=>{if(!T){q(!1);return}if(!C||!w){z(``),He(``),H(``),qe(!1),G(S?e(`note.error.notFound`):``);return}if(z(F(w.name)),He(w.path||``),qe(w.isSecret===!0||w.content.startsWith(`mp://1`)),w.content.startsWith(`mp://1`)){if(!p){H(``),G(e(`note.error.loginToDecrypt`));return}let t=l(w.content,p.danger);if(!t){H(``),G(e(`note.error.decryptFailed`));return}H(t),G(``);return}H(w.content||``),G(``)},[C,T,S,w,e,p]);let Xe=(0,O.useMemo)(()=>Ue(h,n),[n,h]),Ze=(0,O.useMemo)(()=>We(Xe,ge),[Xe,ge]),Qe=w?.isSecret===!0||w?.content.startsWith(`mp://1`)===!0,J=e(T?U?`note.privacy.secret`:`note.privacy.public`:Qe?`note.privacy.secret`:`note.privacy.public`),$e=(0,O.useMemo)(()=>Ke(h,n),[n,h]),et=(0,O.useMemo)(()=>Le(Me,h,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[h,Me,w?.path]),tt=(0,O.useCallback)(e=>Ie(e,h,e=>N({cid:e.cid}),w?.path||``,e=>N({path:Ae(e)})),[h,w?.path]);(0,O.useEffect)(()=>{w?.path&&Ye(e=>Ve(e,ze(w.path)))},[w?.path]),(0,O.useEffect)(()=>{if(!o.path||C||h.length===0)return;let e=Fe(h,o.path);e&&(y(f(e.path||``)),r({href:N({cid:e.cid}),replace:!0}))},[C,r,h,o.path,y]),(0,O.useEffect)(()=>{let t=o.chatDraft||``;if(!t||P.current===t||!S)return;if(!p){let e=`${t}:auth`;je.current!==e&&(je.current=e,m());return}let n=re(t);if(!n){P.current=t,u(e(`note.chatDraft.missing`),`warning`),Y({},!0);return}P.current=t,at(n)},[u,S,o.chatDraft,e,p]);function Y(e={},t=!1){r({href:N(e),replace:t})}function nt(e){Y(Ee(e))}function rt(e){y(f(e.path||``)),Y({cid:e.cid})}function it(e){y(e.fullPath),Ye(t=>Be(t,e.fullPath))}function X(e){Y({cid:e.cid,mode:`edit`})}function Z(){return p?!0:(m(),!1)}async function at(t){if(p)try{let n=await x({name:ke(t.title,e(`note.chatDraft.defaultTitle`),e=>h.some(t=>f(t.path||``)===f(g)&&t.name===e)),path:g,content:t.content,isSecret:!1});ie(t.id),u(e(`note.chatDraft.created`),`success`),Y({cid:n,mode:`edit`},!0)}catch(t){P.current=``,u(De(t,e(`note.toast.createFailed`),e),`error`)}}function ot(){Y(w?{cid:w.cid}:{})}async function st(){if(!Z())return;if(!w){u(e(`note.toast.notFound`),`error`);return}let t=I(Pe);if(!t){u(e(`note.toast.nameRequired`),`warning`);return}q(!0);try{let n=c.current?.getMarkdown()??V,r=U?s(n,p.danger):n,i=await x({cid:w.cid,name:t,path:B,content:r,isSecret:U});H(n),Y({cid:i},!0),u(e(`note.toast.saved`),`success`)}catch(t){u(De(t,e(`note.toast.saveFailed`),e),`error`)}finally{q(!1)}}function ct(){Z()&&ve({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(Z())try{let n=await x({name:I(t),path:g,content:``,isSecret:!1});ve(null),u(e(`note.toast.created`),`success`),Y({cid:n,mode:`edit`})}catch(t){u(De(t,e(`note.toast.createFailed`),e),`error`)}}})}function lt(e){Z()&&M(e)}async function Q(t){if(j)try{me(Oe(j),t,j.name),M(null),u(e(`note.toast.moved`),`success`)}catch(t){u(De(t,e(`note.toast.moveFailed`),e),`error`)}}function $(t){if(!Z())return;let n=t.type===`directory`;A({title:e(n?`note.delete.folderTitle`:`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{pe(n?void 0:t.cid,t.path,t.name),A(null),u(e(`note.toast.deleted`),`success`),t.type===`file`&&t.cid===C&&Y()}})}let ut=(0,k.jsxs)(`div`,{className:`note-header-title`,children:[(0,k.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,k.jsx)(`span`,{children:e(`note.count`,{count:h.length})})]}),dt=(0,k.jsx)(`div`,{className:`note-theme-wrap`}),ft=(0,k.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,k.jsxs)(`div`,{className:`note-search`,children:[(0,k.jsx)(le,{size:16}),(0,k.jsx)(`input`,{className:`input input-flex`,value:ge,onChange:e=>_e(e.target.value),placeholder:e(`note.search.placeholder`)})]}),Ze.length===0?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(ge?`note.empty.noMatches`:`note.empty.noNotes`)})]}):(0,k.jsx)(Ge,{nodes:Ze,searchQuery:ge,expandedPaths:Je,activeFileId:C,activeFolderPath:C?``:g,onToggleDirectory:it,onOpenFile:rt}),(0,k.jsx)(`div`,{className:`note-create-btn`,children:(0,k.jsxs)(`button`,{className:`btn`,onClick:ct,children:[(0,k.jsx)(ne,{size:16}),e(`note.newNote`)]})})]});return(0,k.jsxs)(se,{sidebar:()=>(0,k.jsx)(Ce,{children:ft}),headerTitle:ut,headerRight:dt,children:[(0,k.jsx)(`main`,{className:`note-page note-browser-page ${he?`has-editor`:``}`,children:(0,k.jsx)(`section`,{className:`note-workspace`,children:(0,k.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(T?`note.editorLabel.edit`:`note.editorLabel.read`),children:he?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,k.jsxs)(`div`,{className:`note-editor-title-area`,children:[T?(0,k.jsx)(`input`,{className:`note-title-input`,value:Pe,onChange:e=>z(e.target.value),placeholder:e(`note.namePlaceholder`),translate:`no`,disabled:!w}):w?(0,k.jsx)(`h3`,{translate:`no`,children:F(w.name)}):(0,k.jsx)(`h3`,{children:e(`note.untitled`)}),w&&(0,k.jsxs)(`div`,{className:`note-editor-info`,children:[(0,k.jsx)(`span`,{children:e(T?`note.mode.edit`:`note.mode.read`)}),(0,k.jsx)(`span`,{children:J}),(0,k.jsx)(`span`,{children:t(w.updated_at)})]})]}),(0,k.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:T?ot:()=>Y(),title:e(T?`common.cancel`:`common.close`),"aria-label":e(T?`common.cancel`:`common.close`),children:(0,k.jsx)(fe,{size:16})}),T?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`button`,{className:`btn btn-sm ${U?`btn-warning`:`btn-secondary`}`,onClick:()=>qe(!U),disabled:!w,children:[U?(0,k.jsx)(_,{size:16}):(0,k.jsx)(b,{size:16}),e(U?`note.privacy.secret`:`note.privacy.public`)]}),(0,k.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:st,disabled:K||!!W||!w,children:[(0,k.jsx)(ce,{size:16}),e(K?`note.action.saving`:`note.action.save`)]})]}):w&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>lt(w),title:e(`note.action.move`),"aria-label":e(`note.action.move`),children:(0,k.jsx)(be,{size:16})}),(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon note-editor-action-danger`,onClick:()=>$(w),title:e(`note.action.delete`),"aria-label":e(`note.action.delete`),children:(0,k.jsx)(oe,{size:16})}),(0,k.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:()=>X(w),disabled:!!Ne,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,k.jsx)(xe,{size:16}),e(`note.action.edit`)]})]})]})]}),T?W?(0,k.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:W})]}):w?(0,k.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,k.jsx)(we,{ref:c,content:V,onChange:H,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]}):Ne?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:Ne})]}):w?(0,k.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,k.jsx)(we,{content:et,readOnly:!0,onInternalNoteLinkOpen:nt,resolveWikiNoteLink:tt,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(S?`note.error.notFound`:`note.loading`)})]})]}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,k.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,k.jsx)(v,{size:32})}),(0,k.jsx)(`h3`,{className:`ui-empty-title`,children:e(`note.noOpen.title`)}),(0,k.jsx)(`p`,{className:`ui-empty-desc`,children:h.length>0?e(`note.noOpen.select`):e(`note.noOpen.createFirst`)}),(0,k.jsx)(ae,{label:e(`note.openList`),variant:`default`})]})})})}),E&&(0,k.jsx)(ue,{title:E.title,placeholder:E.placeholder,defaultValue:E.defaultValue,confirmText:E.confirmText,onConfirm:E.onConfirm,onClose:()=>ve(null)}),D&&(0,k.jsx)(ye,{title:D.title,message:D.message,confirmText:D.confirmText,danger:!0,onConfirm:D.onConfirm,onClose:()=>A(null)}),j&&(0,k.jsx)(Se,{target:j,targetLabel:Re(j),directories:$e,onMove:Q,onClose:()=>M(null)})]})}function K(){let{t:e,formatDate:t,compareStrings:n}=te(),r=ee(),i=de({select:e=>e.searchStr}),o=(0,O.useMemo)(()=>Te(i),[i]),s=(0,O.useRef)(null),c=d(e=>e.addToast),l=a(e=>e.wallet),m=a(e=>e.openLoginModal),g=o.file||``,y=!!g,b=y&&o.mode===`edit`,[x,me]=(0,O.useState)(null),[E,D]=(0,O.useState)([]),[A,j]=(0,O.useState)(``),[M,P]=(0,O.useState)(!0),[De,Me]=(0,O.useState)(``),[L,Ne]=(0,O.useState)(``),[R,Pe]=(0,O.useState)(!1),[z,B]=(0,O.useState)(null),[He,V]=(0,O.useState)(``),[qe,W]=(0,O.useState)(``),[G,K]=(0,O.useState)(!1),[q,Je]=(0,O.useState)(``),[Ye,Xe]=(0,O.useState)(!1),[Ze,Qe]=(0,O.useState)(()=>new Set(ze(A))),[J,$e]=(0,O.useState)(null),[et,tt]=(0,O.useState)(null),[Y,nt]=(0,O.useState)(null),rt=(0,O.useRef)(``),it=(0,O.useRef)(``),X=(0,O.useMemo)(()=>H(E),[E]),Z=X.find(e=>e.cid===g),at=(0,O.useMemo)(()=>Ke(X,n),[n,X]),ot=(0,O.useMemo)(()=>Ue(X,n),[n,X]),st=(0,O.useMemo)(()=>We(ot,L),[ot,L]),ct=(0,O.useMemo)(()=>Le(z?.content||``,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.content,z?.directory,Z?.path,X]),lt=(0,O.useCallback)(e=>Ie(e,X,e=>N({file:e.cid}),Z?.path||z?.directory||``,e=>N({path:Ae(e)})),[z?.directory,Z?.path,X]);(0,O.useEffect)(()=>{Z?.path&&Qe(e=>Ve(e,ze(Z.path)))},[Z?.path]),(0,O.useEffect)(()=>{if(!o.path||g||X.length===0)return;let e=Fe(X,o.path);e&&(j(f(e.path||``)),r({href:N({file:e.cid}),replace:!0}))},[g,r,o.path,X]),(0,O.useEffect)(()=>{let t=o.chatDraft||``;if(!t||rt.current===t||M)return;if(!l){let e=`${t}:auth`;it.current!==e&&(it.current=e,m());return}if(x?.configured!==!0){let n=`${t}:vault`;it.current!==n&&(it.current=n,c(e(`note.chatDraft.openVaultFirst`),`warning`));return}let n=re(t);if(!n){rt.current=t,c(e(`note.chatDraft.missing`),`warning`),$({},!0);return}rt.current=t,_t(n)},[c,o.chatDraft,e,M,x?.configured,l]);let Q=(0,O.useCallback)(async()=>{if(!l){me(null),D([]),Me(e(`note.vault.loginRequired`)),P(!1);return}P(!0),Me(``);try{let e=await ve();me(e),e.configured?D(await C()):D([])}catch(t){me(null),D([]),Me(await u(t,e(`note.vault.loadFailed`)))}finally{P(!1)}},[e,l]);(0,O.useEffect)(()=>{Q()},[Q]),(0,O.useEffect)(()=>{V(F(z?.name||Z?.name||``))},[z?.name,Z?.name]),(0,O.useEffect)(()=>{let t=!1;async function n(){if(!g){B(null),W(``),Je(``),K(!1);return}if(!l){B(null),W(``),Je(e(`note.vault.loginRequired`)),K(!1);return}if(x?.configured!==!0){B(null),W(``),Je(``),K(!1);return}K(!0),Je(``);try{let e=await ge(g);if(t)return;B(e),W(e.content)}catch(n){if(t)return;B(null),W(``),Je(await u(n,e(`note.error.notFound`)))}finally{t||K(!1)}}return n(),()=>{t=!0}},[g,e,x?.configured,l]);function $(e={},t=!1){r({href:N(e),replace:t})}function ut(e){$(Ee(e))}function dt(e){j(f(e.path||``)),$({file:e.cid})}function ft(e){j(e.fullPath),Qe(t=>Be(t,e.fullPath))}function pt(){g&&$({file:g,mode:`edit`})}function mt(){V(F(z?.name||Z?.name||``)),$(g?{file:g}:{})}async function ht(){if(!l){m();return}let t=window.electronAPI?.selectNoteVaultDirectory;if(!t){c(e(`note.vault.selectFailed`),`error`);return}Pe(!0);try{let n=await t();if(!n)return;await _e(n),await Q(),$({},!0),c(e(`note.vault.opened`),`success`)}catch(t){c(await u(t,e(`note.vault.selectFailed`)),`error`)}finally{Pe(!1)}}function gt(){return l?x?.configured===!0?!0:(c(e(`note.vault.emptyPrompt`),`warning`),!1):(m(),!1)}async function _t(t){if(gt())try{let n=ke(t.title,e(`note.chatDraft.defaultTitle`),e=>E.some(t=>f(t.directory)===f(A)&&t.name===e)),r=await S(f(A?`${A}/${n}`:n),t.content);ie(t.id),await Q(),c(e(`note.chatDraft.created`),`success`),$({file:r.path,mode:`edit`},!0)}catch(t){rt.current=``,c(await u(t,e(`note.toast.createFailed`)),`error`)}}function vt(){gt()&&$e({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if(!gt())return;let n=U(A,t);if(!n){c(e(`note.toast.nameRequired`),`warning`);return}try{let t=await S(n,``);$e(null),await Q(),$({file:t.path,mode:`edit`}),c(e(`note.toast.created`),`success`)}catch(t){c(await u(t,e(`note.toast.createFailed`)),`error`)}}})}function yt(e){gt()&&nt(e)}async function bt(t){if(!(!Y||!gt()))try{let n=g;if(Y.type===`directory`){let e=Oe(Y),r=f(t?`${t}/${Y.name}`:Y.name),i=E.filter(t=>t.path.startsWith(`${e}/`));for(let t of i){let i=f(`${r}/${t.path.slice(e.length+1)}`);await w(t.path,i),g===t.path&&(n=i)}}else{let e=f(t?`${t}/${Y.name}`:Y.name),r=await w(Y.cid,e);g===Y.cid&&(n=r.path)}nt(null),await Q(),$(n?{file:n}:{},!0),c(e(`note.toast.moved`),`success`)}catch(t){c(await u(t,e(`note.toast.moveFailed`)),`error`)}}function xt(t){gt()&&tt({title:t.type===`directory`?e(`note.delete.folderTitle`):e(`note.delete.noteTitle`),message:e(`note.delete.message`,{name:Re(t)}),confirmText:e(`note.action.delete`),onConfirm:async()=>{try{if(t.type===`directory`){let e=Oe(t),n=E.filter(t=>t.path.startsWith(`${e}/`));for(let e of n)await he(e.path);g.startsWith(`${e}/`)&&$({},!0)}else await he(t.cid),g===t.cid&&$({},!0);tt(null),await Q(),c(e(`note.toast.deleted`),`success`)}catch(t){c(await u(t,e(`note.toast.deleteFailed`)),`error`)}}})}async function St(){if(!l){m();return}if(!g||!z){c(e(`note.toast.notFound`),`error`);return}let t=I(He);if(!t){c(e(`note.toast.nameRequired`),`warning`);return}Xe(!0);try{let n=s.current?.getMarkdown()??qe,r=z.path;if(t!==z.name){r=f(z.directory?`${z.directory}/${t}`:t);let e=await w(z.path,r);B(e),V(F(e.name)),r=e.path}let i=await T(r,n);B(i),V(F(i.name)),W(i.content),await Q(),$({file:i.path},!0),c(e(`note.toast.saved`),`success`)}catch(t){c(await u(t,e(`note.toast.saveFailed`)),`error`)}finally{Xe(!1)}}let Ct=(0,k.jsxs)(`div`,{className:`note-header-title`,children:[(0,k.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,k.jsx)(`span`,{children:e(`note.count`,{count:E.length})})]}),wt=(0,k.jsx)(`div`,{className:`note-theme-wrap`,children:(0,k.jsxs)(`button`,{className:`btn btn-sm`,onClick:ht,disabled:R,title:e(`note.vault.open`),"aria-label":e(`note.vault.open`),children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})}),Tt=(0,k.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,k.jsxs)(`div`,{className:`note-search`,children:[(0,k.jsx)(le,{size:16}),(0,k.jsx)(`input`,{className:`input input-flex`,value:L,onChange:e=>Ne(e.target.value),placeholder:e(`note.search.placeholder`)})]}),M?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(`note.loading`)})]}):De?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(_,{size:32}),(0,k.jsx)(`p`,{children:De})]}):x?.configured===!0?st.length===0?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(v,{size:32}),(0,k.jsx)(`p`,{children:e(L?`note.empty.noMatches`:`note.vault.noFiles`)})]}):(0,k.jsx)(Ge,{nodes:st,searchQuery:L,expandedPaths:Ze,activeFileId:g,activeFolderPath:g?``:A,onToggleDirectory:ft,onOpenFile:dt,renderActions:t=>(0,k.jsx)(pe,{ariaLabel:e(`common.moreActions`),className:`note-list-actions-anchor`,placement:`bottom-end`,items:[{key:`move`,label:e(`note.action.move`),icon:(0,k.jsx)(be,{size:16}),onSelect:()=>yt(t)},{key:`delete`,label:e(`note.action.delete`),icon:(0,k.jsx)(oe,{size:16}),danger:!0,onSelect:()=>xt(t)}],renderTrigger:t=>(0,k.jsx)(`button`,{...t,className:`note-list-actions-trigger`,title:e(`common.moreActions`),"aria-label":e(`common.moreActions`),children:(0,k.jsx)(p,{size:16})})})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,k.jsx)(h,{size:32}),(0,k.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]}),x?.configured===!0&&(0,k.jsx)(`div`,{className:`note-create-btn`,children:(0,k.jsxs)(`button`,{className:`btn`,onClick:vt,children:[(0,k.jsx)(ne,{size:16}),e(`note.newNote`)]})})]}),Et=z?.mtimeMs||Z?.updated_at||Date.now(),Dt=F(z?.name||Z?.name||``)||e(`note.untitled`);return(0,k.jsxs)(se,{sidebar:()=>(0,k.jsx)(Ce,{children:Tt}),headerTitle:Ct,headerRight:wt,children:[(0,k.jsx)(`main`,{className:`note-page note-browser-page ${y?`has-editor`:``}`,children:(0,k.jsx)(`section`,{className:`note-workspace`,children:(0,k.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(b?`note.editorLabel.edit`:`note.editorLabel.read`),children:y?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,k.jsxs)(`div`,{className:`note-editor-title-area`,children:[b&&z?(0,k.jsx)(`input`,{className:`note-title-input`,value:He,onChange:e=>V(e.target.value),onKeyDown:e=>{if(e.key===`Enter`){e.currentTarget.blur();return}e.key===`Escape`&&(V(F(z.name)),e.currentTarget.blur())},placeholder:e(`note.namePlaceholder`),translate:`no`}):(0,k.jsx)(`h3`,{translate:`no`,children:Dt}),(0,k.jsxs)(`div`,{className:`note-editor-info`,children:[(0,k.jsx)(`span`,{children:e(b?`note.mode.edit`:`note.mode.read`)}),(0,k.jsx)(`span`,{translate:`no`,children:je(g)}),(0,k.jsx)(`span`,{children:t(Et)})]})]}),(0,k.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,k.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:b?mt:()=>$(),title:e(b?`common.cancel`:`common.close`),"aria-label":e(b?`common.cancel`:`common.close`),children:(0,k.jsx)(fe,{size:16})}),b?(0,k.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:St,disabled:Ye||!!q||!z,children:[(0,k.jsx)(ce,{size:16}),e(Ye?`note.action.saving`:`note.action.save`)]}):Z&&(0,k.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:pt,disabled:!!q||!z,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,k.jsx)(xe,{size:16}),e(`note.action.edit`)]})]})]}),G?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(`note.loading`)})]}):q?(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(_,{size:36}),(0,k.jsx)(`p`,{children:q})]}):b?(0,k.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,k.jsx)(we,{ref:s,content:qe,onChange:W,className:`milkdown-editor`})}):z?(0,k.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,k.jsx)(we,{content:ct,readOnly:!0,onInternalNoteLinkOpen:ut,resolveWikiNoteLink:lt,className:`milkdown-editor`})}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,k.jsx)(v,{size:36}),(0,k.jsx)(`p`,{children:e(`note.error.notFound`)})]})]}):(0,k.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,k.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,k.jsx)(v,{size:32})}),(0,k.jsx)(`h3`,{className:`ui-empty-title`,children:x?.configured?e(`note.noOpen.title`):e(`note.vault.open`)}),(0,k.jsx)(`p`,{className:`ui-empty-desc`,children:x?.configured?e(`note.noOpen.select`):e(`note.vault.emptyPrompt`)}),x?.configured?(0,k.jsx)(ae,{label:e(`note.openList`),variant:`default`}):(0,k.jsxs)(`button`,{className:`btn btn-primary`,onClick:ht,disabled:R,children:[(0,k.jsx)(h,{size:16}),e(R?`note.vault.opening`:`note.vault.open`)]})]})})})}),J&&(0,k.jsx)(ue,{title:J.title,placeholder:J.placeholder,defaultValue:J.defaultValue,confirmText:J.confirmText,onConfirm:J.onConfirm,onClose:()=>$e(null)}),et&&(0,k.jsx)(ye,{title:et.title,message:et.message,confirmText:et.confirmText,danger:!0,onConfirm:et.onConfirm,onClose:()=>tt(null)}),Y&&(0,k.jsx)(Se,{target:Y,targetLabel:Re(Y),directories:at,onMove:bt,onClose:()=>nt(null)})]})}function q(){let{t:e}=te(),t=d(e=>e.hasBackend),n=a(e=>e.wallet),r=y(),i=t===!0&&qe(c()),o=W(i,n?.address||``),s=i&&(r||o);return(0,k.jsx)(O.Suspense,{fallback:(0,k.jsx)(`div`,{className:`note-editor-loading`,children:e(`note.loading`)}),children:s?(0,k.jsx)(K,{}):(0,k.jsx)(G,{})})}var Je=o(`/note/`)({component:q});export{Je as Route};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{B as t,H as n,W as r}from"./useAppStore-DNhyhD20.js";import{a as i}from"./i18n-C6yaqRst.js";import{t as a}from"./fingerprint-pattern-BT73ASEB.js";import{t as o}from"./arrow-right-BsHzC0ZL.js";import{a as s}from"./AccountMenu-D-wa5tux.js";import{t as c}from"./download-Cy2BlfKM.js";import{t as l}from"./gamepad-2-BYqNgCQr.js";import{t as u}from"./message-square-CfApq8Ou.js";import{t as d}from"./notebook-pen-Bcd3MrtD.js";import{t as f}from"./wallet-D6HZocla.js";import{t as p}from"./AppTop-BE5kKBYH.js";import{t as m}from"./MarketingLayout-BPdjpEfc.js";var h=t(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=t(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),_=e(),v=[`about.summary.cid`,`about.summary.seed`,`about.summary.toolbox`,`about.summary.opensource`],y=[{icon:(0,_.jsx)(a,{size:22}),titleKey:`about.section.identity.title`,bodyKey:`about.section.identity.body`,bulletKeys:[`about.section.identity.bullet.filename`,`about.section.identity.bullet.verify`,`about.section.identity.bullet.local`]},{icon:(0,_.jsx)(g,{size:22}),titleKey:`about.section.spread.title`,bodyKey:`about.section.spread.body`,bulletKeys:[`about.section.spread.bullet.seedAfterDownload`,`about.section.spread.bullet.restart`,`about.section.spread.bullet.status`]},{icon:(0,_.jsx)(h,{size:22}),titleKey:`about.section.boundary.title`,bodyKey:`about.section.boundary.body`,bulletKeys:[`about.section.boundary.bullet.keepData`,`about.section.boundary.bullet.noMarket`,`about.section.boundary.bullet.availability`]},{icon:(0,_.jsx)(u,{size:22}),titleKey:`about.section.chat.title`,bodyKey:`about.section.chat.body`,bulletKeys:[`about.section.chat.bullet.room`,`about.section.chat.bullet.voice`,`about.section.chat.bullet.attachments`]},{icon:(0,_.jsx)(d,{size:22}),titleKey:`about.section.note.title`,bodyKey:`about.section.note.body`,bulletKeys:[`about.section.note.bullet.markdown`,`about.section.note.bullet.fromChat`,`about.section.note.bullet.backup`]},{icon:(0,_.jsx)(l,{size:22}),titleKey:`about.section.game.title`,bodyKey:`about.section.game.body`,bulletKeys:[`about.section.game.bullet.channel`,`about.section.game.bullet.rooms`,`about.section.game.bullet.lightweight`]},{icon:(0,_.jsx)(f,{size:22}),titleKey:`about.section.web3.title`,bodyKey:`about.section.web3.body`,bulletKeys:[`about.section.web3.bullet.accounts`,`about.section.web3.bullet.integrate`,`about.section.web3.bullet.export`,`about.section.web3.bullet.separate`],featured:!0}];function b(){let{t:e}=i();return(0,_.jsx)(m,{header:(0,_.jsx)(x,{}),children:(0,_.jsxs)(`div`,{className:`about-page`,children:[(0,_.jsx)(`section`,{className:`about-hero`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`p`,{className:`about-kicker`,children:e(`about.hero.kicker`)}),(0,_.jsx)(`h1`,{className:`about-title`,children:e(`about.hero.title`)}),(0,_.jsx)(`p`,{className:`about-lede`,children:e(`about.hero.desc`)}),(0,_.jsx)(`code`,{className:`about-link-example`,translate:`no`,children:e(`about.link.example`)}),(0,_.jsx)(`ul`,{className:`about-summary`,children:v.map(t=>(0,_.jsxs)(`li`,{className:`about-summary-item`,children:[(0,_.jsx)(`span`,{className:`about-summary-icon`,children:(0,_.jsx)(s,{size:15,strokeWidth:3})}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]})}),(0,_.jsx)(`section`,{className:`about-section-band`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`div`,{className:`about-section-grid`,children:y.map(t=>(0,_.jsxs)(`article`,{className:t.featured?`about-topic featured`:`about-topic`,children:[(0,_.jsx)(`div`,{className:`about-topic-icon`,children:t.icon}),(0,_.jsx)(`h2`,{children:e(t.titleKey)}),(0,_.jsx)(`p`,{children:e(t.bodyKey)}),(0,_.jsx)(`ul`,{children:t.bulletKeys.map(t=>(0,_.jsxs)(`li`,{children:[(0,_.jsx)(s,{size:14,strokeWidth:3}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]},t.titleKey))}),(0,_.jsxs)(`div`,{className:`about-actions`,children:[(0,_.jsxs)(r,{to:`/chat/`,className:`btn btn-primary`,children:[e(`about.cta.chat`),(0,_.jsx)(o,{size:16})]}),(0,_.jsxs)(r,{to:`/download/`,className:`btn btn-secondary`,children:[(0,_.jsx)(c,{size:16}),e(`about.cta.download`)]})]})]})})]})})}function x(){return(0,_.jsx)(`header`,{className:`about-app-header`,children:(0,_.jsx)(`div`,{className:`mkt-container`,children:(0,_.jsx)(p,{})})})}var S=n(`/about/`)({component:b});export{S as Route};
1
+ import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{B as t,H as n,W as r}from"./useAppStore-DNhyhD20.js";import{a as i}from"./i18n-DKsg67mH.js";import{t as a}from"./fingerprint-pattern-BT73ASEB.js";import{t as o}from"./arrow-right-BsHzC0ZL.js";import{a as s}from"./AccountMenu-B26qus-Q.js";import{t as c}from"./download-Cy2BlfKM.js";import{t as l}from"./gamepad-2-BYqNgCQr.js";import{t as u}from"./message-square-CfApq8Ou.js";import{t as d}from"./notebook-pen-Bcd3MrtD.js";import{t as f}from"./wallet-D6HZocla.js";import{t as p}from"./AppTop-D-qYC0ep.js";import{t as m}from"./MarketingLayout-Ch4sw5Qm.js";var h=t(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=t(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),_=e(),v=[`about.summary.cid`,`about.summary.seed`,`about.summary.toolbox`,`about.summary.opensource`],y=[{icon:(0,_.jsx)(a,{size:22}),titleKey:`about.section.identity.title`,bodyKey:`about.section.identity.body`,bulletKeys:[`about.section.identity.bullet.filename`,`about.section.identity.bullet.verify`,`about.section.identity.bullet.local`]},{icon:(0,_.jsx)(g,{size:22}),titleKey:`about.section.spread.title`,bodyKey:`about.section.spread.body`,bulletKeys:[`about.section.spread.bullet.seedAfterDownload`,`about.section.spread.bullet.restart`,`about.section.spread.bullet.status`]},{icon:(0,_.jsx)(h,{size:22}),titleKey:`about.section.boundary.title`,bodyKey:`about.section.boundary.body`,bulletKeys:[`about.section.boundary.bullet.keepData`,`about.section.boundary.bullet.noMarket`,`about.section.boundary.bullet.availability`]},{icon:(0,_.jsx)(u,{size:22}),titleKey:`about.section.chat.title`,bodyKey:`about.section.chat.body`,bulletKeys:[`about.section.chat.bullet.room`,`about.section.chat.bullet.voice`,`about.section.chat.bullet.attachments`]},{icon:(0,_.jsx)(d,{size:22}),titleKey:`about.section.note.title`,bodyKey:`about.section.note.body`,bulletKeys:[`about.section.note.bullet.markdown`,`about.section.note.bullet.fromChat`,`about.section.note.bullet.backup`]},{icon:(0,_.jsx)(l,{size:22}),titleKey:`about.section.game.title`,bodyKey:`about.section.game.body`,bulletKeys:[`about.section.game.bullet.channel`,`about.section.game.bullet.rooms`,`about.section.game.bullet.lightweight`]},{icon:(0,_.jsx)(f,{size:22}),titleKey:`about.section.web3.title`,bodyKey:`about.section.web3.body`,bulletKeys:[`about.section.web3.bullet.accounts`,`about.section.web3.bullet.integrate`,`about.section.web3.bullet.export`,`about.section.web3.bullet.separate`],featured:!0}];function b(){let{t:e}=i();return(0,_.jsx)(m,{header:(0,_.jsx)(x,{}),children:(0,_.jsxs)(`div`,{className:`about-page`,children:[(0,_.jsx)(`section`,{className:`about-hero`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`p`,{className:`about-kicker`,children:e(`about.hero.kicker`)}),(0,_.jsx)(`h1`,{className:`about-title`,children:e(`about.hero.title`)}),(0,_.jsx)(`p`,{className:`about-lede`,children:e(`about.hero.desc`)}),(0,_.jsx)(`code`,{className:`about-link-example`,translate:`no`,children:e(`about.link.example`)}),(0,_.jsx)(`ul`,{className:`about-summary`,children:v.map(t=>(0,_.jsxs)(`li`,{className:`about-summary-item`,children:[(0,_.jsx)(`span`,{className:`about-summary-icon`,children:(0,_.jsx)(s,{size:15,strokeWidth:3})}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]})}),(0,_.jsx)(`section`,{className:`about-section-band`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`div`,{className:`about-section-grid`,children:y.map(t=>(0,_.jsxs)(`article`,{className:t.featured?`about-topic featured`:`about-topic`,children:[(0,_.jsx)(`div`,{className:`about-topic-icon`,children:t.icon}),(0,_.jsx)(`h2`,{children:e(t.titleKey)}),(0,_.jsx)(`p`,{children:e(t.bodyKey)}),(0,_.jsx)(`ul`,{children:t.bulletKeys.map(t=>(0,_.jsxs)(`li`,{children:[(0,_.jsx)(s,{size:14,strokeWidth:3}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]},t.titleKey))}),(0,_.jsxs)(`div`,{className:`about-actions`,children:[(0,_.jsxs)(r,{to:`/chat/`,className:`btn btn-primary`,children:[e(`about.cta.chat`),(0,_.jsx)(o,{size:16})]}),(0,_.jsxs)(r,{to:`/download/`,className:`btn btn-secondary`,children:[(0,_.jsx)(c,{size:16}),e(`about.cta.download`)]})]})]})})]})})}function x(){return(0,_.jsx)(`header`,{className:`about-app-header`,children:(0,_.jsx)(`div`,{className:`mkt-container`,children:(0,_.jsx)(p,{})})})}var S=n(`/about/`)({component:b});export{S as Route};