most-box 0.3.8 → 0.3.9

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 (63) hide show
  1. package/README.md +12 -12
  2. package/electron/main.js +1 -1
  3. package/out/about/index.html +2 -2
  4. package/out/admin/index.html +0 -0
  5. package/out/app/index.html +0 -0
  6. package/out/assets/{AccountMenu-C3wvcWtn.js → AccountMenu-BpUGPUSa.js} +1 -1
  7. package/out/assets/{AppShell-BN1uaxn1.js → AppShell-kfQyRhZy.js} +1 -1
  8. package/out/assets/{AppTop-iPNi3cv5.js → AppTop-DydClKUv.js} +1 -1
  9. package/out/assets/{CopyButton-BfQ-TOoR.js → CopyButton-BN_vYKM8.js} +1 -1
  10. package/out/assets/{MarketingHeader-Bh6LcQOj.js → MarketingHeader-B0jpxRYu.js} +1 -1
  11. package/out/assets/MarketingLayout-D42kTRyf.js +1 -0
  12. package/out/assets/{MilkdownEditor-4FuwE6Td.js → MilkdownEditor-B9vfoUP9.js} +1 -1
  13. package/out/assets/{OpenSidebarButton-09yeNDLa.js → OpenSidebarButton-BxKh_O5b.js} +1 -1
  14. package/out/assets/{chatJoinInvite-7tuD-STm.js → chatJoinInvite-Cwot1ykh.js} +1 -1
  15. package/out/assets/i18n-BPfshhQc.js +1 -0
  16. package/out/assets/{index-CCU5Z4K-.js → index-AZPpawN1.js} +3 -3
  17. package/out/assets/index-BP12tZtg.css +1 -0
  18. package/out/assets/{index.lazy-CbtY_wql.js → index.lazy-1oSrUtEc.js} +1 -1
  19. package/out/assets/index.lazy-B3eWk7i-.js +1 -0
  20. package/out/assets/{index.lazy-D9zm7DgW.js → index.lazy-BszFGhgk.js} +1 -1
  21. package/out/assets/{index.lazy-DhhSG0Me.js → index.lazy-CBPOnT1S.js} +1 -1
  22. package/out/assets/index.lazy-CJVtmxt4.js +1 -0
  23. package/out/assets/index.lazy-CJlJl0xA.js +1 -0
  24. package/out/assets/index.lazy-CUZLrlgS.js +2 -0
  25. package/out/assets/{index.lazy-DQA4yE6c.js → index.lazy-CV52vPw7.js} +1 -1
  26. package/out/assets/{index.lazy-Dl8LX4dH.js → index.lazy-CfmDMCbY.js} +1 -1
  27. package/out/assets/{index.lazy-DH1bcYry.js → index.lazy-ClcVulXE.js} +1 -1
  28. package/out/assets/index.lazy-DRAWcYlR.js +1 -0
  29. package/out/assets/index.lazy-Duk6GK1e.js +1 -0
  30. package/out/assets/{index.lazy-BMh0Oy3C.js → index.lazy-DxIMDfLH.js} +1 -1
  31. package/out/assets/{index.lazy-B2-v2OGR.js → index.lazy-e02LZDAI.js} +1 -1
  32. package/out/assets/{index.lazy-CsgZmOLX.js → index.lazy-qvhZXEAD.js} +1 -1
  33. package/out/assets/messages-square-Dr9v7Ilv.js +1 -0
  34. package/out/assets/plus-C7wBmZvh.js +1 -0
  35. package/out/assets/{saveLocalFile-DkrpR5WS.js → saveLocalFile-Dsoo9PmH.js} +1 -1
  36. package/out/assets/{useChannelMessages-Ea1I0HsF.js → useChannelMessages-ncgJxjR8.js} +1 -1
  37. package/out/assets/{useGameRoom-CqeouPP_.js → useGameRoom-BHZNzWJt.js} +1 -1
  38. package/out/chat/index.html +0 -0
  39. package/out/chat/join/demo/index.html +0 -0
  40. package/out/chat/join/index.html +0 -0
  41. package/out/download/index.html +2 -2
  42. package/out/game/gandengyan/index.html +0 -0
  43. package/out/game/index.html +0 -0
  44. package/out/game/zhajinhua/index.html +0 -0
  45. package/out/index.html +2 -2
  46. package/out/note/index.html +0 -0
  47. package/out/ping/index.html +2 -2
  48. package/out/profile/index.html +0 -0
  49. package/out/web3/index.html +0 -0
  50. package/package.json +2 -1
  51. package/server/src/core/cid.js +1 -1
  52. package/server/src/core/zhajinhua.js +0 -88
  53. package/out/assets/MarketingLayout-9X-D6xx4.js +0 -1
  54. package/out/assets/chatNoteDraft-D6FEmSXK.js +0 -1
  55. package/out/assets/i18n-DKsg67mH.js +0 -1
  56. package/out/assets/index-FEwag7ej.css +0 -1
  57. package/out/assets/index.lazy-1YPf8Ys8.js +0 -1
  58. package/out/assets/index.lazy-7EjTGodD.js +0 -1
  59. package/out/assets/index.lazy-BBsa7aDt.js +0 -1
  60. package/out/assets/index.lazy-BJh0zxMI.js +0 -3
  61. package/out/assets/index.lazy-Bi5tHgok.js +0 -1
  62. package/out/assets/index.lazy-Q-Lr-abQ.js +0 -2
  63. package/out/assets/message-square-0kQmuMcd.js +0 -1
@@ -1,3 +1,3 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-Pjif7nCR.js";import{a as m}from"./i18n-DKsg67mH.js";import{t as h}from"./fingerprint-pattern-Z6NfIcxC.js";import{i as g}from"./AccountMenu-C3wvcWtn.js";import{t as _}from"./download-nQ9X-v0q.js";import{t as v}from"./external-link-LcGMVTLE.js";import{n as y,t as b}from"./CopyButton-BfQ-TOoR.js";import{t as x}from"./lock-Cigqt_VP.js";import{t as S}from"./AppShell-BN1uaxn1.js";import{t as C}from"./wallet-Ts6jdQzi.js";import{M as w,N as T,P as E,g as ee}from"./index-CCU5Z4K-.js";import{t as te}from"./AppTop-iPNi3cv5.js";import{n as ne,t as re}from"./mp-CFhRibX9.js";var ie=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),oe=i(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),se=i(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ce=i(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),D=t(e()),O=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function k({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=m();return(0,O.jsxs)(`div`,{className:`web3-box-account`,children:[(0,O.jsx)(`div`,{className:`web3-box-account-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:e}),(0,O.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,O.jsxs)(`div`,{className:`web3-box-login`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,O.jsx)(y,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,O.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.address`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,O.jsx)(b,{text:a.address.toLowerCase()})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,O.jsx)(b,{text:a.publicKey})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})]})]}):null]})}function ue(e,t){return Number.isFinite(e)?t(e):`-`}function A({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:h}){let{t:g,formatDateTime:_}=m(),v=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=c(r);return(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:e}),(0,O.jsx)(`p`,{children:t})]})}),(0,O.jsx)(`label`,{className:`web3-box-label`,htmlFor:v,children:g(`web3.box.plaintext`)}),(0,O.jsx)(`textarea`,{id:v,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,O.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,O.jsx)(x,{size:16}),o]}),(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,O.jsx)(y,{size:16}),s]})]}),a&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(0,O.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),b&&(0,O.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.timestamp`)}),(0,O.jsx)(`code`,{translate:`no`,children:ue(b.timestampMs,_)})]}),(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,O.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function de(e){let{t}=m();return(0,O.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,O.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,O.jsx)(k,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,O.jsx)(k,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsx)(A,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,O.jsx)(A,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,O.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,O.jsx)(x,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,O.jsx)(y,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function j({icon:e,message:t,className:n=`empty-state glass`}){return(0,O.jsxs)(`div`,{className:n,children:[(0,O.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,O.jsx)(`p`,{children:t})]})}function fe({label:e,pem:t,filename:n}){let{t:r}=m();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}return(0,O.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,O.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,O.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,O.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,O.jsx)(b,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,O.jsx)(_,{size:14}),r(`common.download`)]})]})]}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function pe({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=m();if(!t||!n)return(0,O.jsx)(j,{icon:(0,O.jsx)(x,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,O.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,O.jsx)(fe,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,O.jsx)(fe,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var me=Object.defineProperty,M=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,he=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||={})N.call(t,n)&&he(e,n,t[n]);if(M)for(var n of M(t))P.call(t,n)&&he(e,n,t[n]);return e},I=(e,t)=>{var n={};for(var r in e)N.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&M)for(var r of M(e))t.indexOf(r)<0&&P.call(e,r)&&(n[r]=e[r]);return n},L;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(L||={});var R=L,ge={L:R.QrCode.Ecc.LOW,M:R.QrCode.Ecc.MEDIUM,Q:R.QrCode.Ecc.QUARTILE,H:R.QrCode.Ecc.HIGH},z=128,B=`L`,V=`#FFFFFF`,H=`#000000`,U=!1,W=1,_e=4,ve=0,G=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*G),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?_e:ve:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=D.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...R.QrSegment.makeSegments(t)),e),[]);return R.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=D.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,marginSize:d,imageSettings:f}=n,p=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=I(p,[`style`]),g=f?.src,_=D.useRef(null),v=D.useRef(null),y=D.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=D.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});D.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),D.useEffect(()=>{x(!1)},[g]);let E=F({height:i,width:i},m),ee=null;return g!=null&&(ee=D.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),D.createElement(D.Fragment,null,D.createElement(`canvas`,F({style:E,height:i,width:i,ref:y,role:`img`},h)),ee)});Ce.displayName=`QRCodeCanvas`;var J=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=D.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return D.createElement(`svg`,F({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&D.createElement(`title`,null,d),D.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),D.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:h,onToggleDerivePrivateKey:g,onDerive:_}){let{t:v}=m(),x=e?.address||``;return!e||!x?(0,O.jsx)(j,{icon:(0,O.jsx)(C,{size:36}),message:v(`web3.empty.walletTools`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,O.jsx)(oe,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),s&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,O.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:x}),(0,O.jsx)(b,{text:x})]}),(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:x,size:200})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,O.jsx)(y,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),c&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,O.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,O.jsx)(b,{text:t})]}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.mnemonic`)]}),(0,O.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:t,size:260})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsx)(`div`,{children:(0,O.jsx)(`button`,{className:`btn btn-primary`,onClick:_,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.privateKey`)]}),r.length>0&&(0,O.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,O.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{onClick:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,O.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,O.jsx)(`th`,{onClick:g,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,O.jsx)(`tbody`,{children:r.map(e=>(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{children:i?e.index+1:``}),(0,O.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,O.jsx)(`td`,{className:`danger`,children:(0,O.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,O.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,O.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,O.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,O.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,O.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=m(),s=e?.address||``;return!e||!s?(0,O.jsx)(j,{icon:(0,O.jsx)(g,{size:36}),message:o(`web3.empty.identity`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,O.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,O.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,O.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,O.jsx)(b,{text:s.toLowerCase()}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,O.jsx)(v,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,O.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,O.jsx)(h,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,O.jsx)(b,{text:t.ed_public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,O.jsx)(y,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,O.jsx)(b,{text:t.public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,O.jsx)(ce,{size:18}),accent:!0,children:(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})}),(0,O.jsx)(Y,{title:`IPNS ID`,icon:(0,O.jsx)(ae,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(b,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=m();return(0,O.jsxs)(`div`,{className:`input-panel`,children:[(0,O.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]})]}),(0,O.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-Pjif7nCR.js";import{a as m}from"./i18n-BPfshhQc.js";import{t as h}from"./fingerprint-pattern-Z6NfIcxC.js";import{i as g}from"./AccountMenu-BpUGPUSa.js";import{t as _}from"./download-nQ9X-v0q.js";import{t as v}from"./external-link-LcGMVTLE.js";import{n as y,t as b}from"./CopyButton-BN_vYKM8.js";import{t as x}from"./lock-Cigqt_VP.js";import{t as S}from"./AppShell-kfQyRhZy.js";import{t as C}from"./wallet-Ts6jdQzi.js";import{M as w,N as T,P as E,g as ee}from"./index-AZPpawN1.js";import{t as te}from"./AppTop-DydClKUv.js";import{n as ne,t as re}from"./mp-CFhRibX9.js";var ie=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),oe=i(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),se=i(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ce=i(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),D=t(e()),O=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function k({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=m();return(0,O.jsxs)(`div`,{className:`web3-box-account`,children:[(0,O.jsx)(`div`,{className:`web3-box-account-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:e}),(0,O.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,O.jsxs)(`div`,{className:`web3-box-login`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,O.jsx)(y,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,O.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.address`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,O.jsx)(b,{text:a.address.toLowerCase()})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,O.jsx)(b,{text:a.publicKey})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})]})]}):null]})}function ue(e,t){return Number.isFinite(e)?t(e):`-`}function A({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:h}){let{t:g,formatDateTime:_}=m(),v=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=c(r);return(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:e}),(0,O.jsx)(`p`,{children:t})]})}),(0,O.jsx)(`label`,{className:`web3-box-label`,htmlFor:v,children:g(`web3.box.plaintext`)}),(0,O.jsx)(`textarea`,{id:v,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,O.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,O.jsx)(x,{size:16}),o]}),(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,O.jsx)(y,{size:16}),s]})]}),a&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(0,O.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),b&&(0,O.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.timestamp`)}),(0,O.jsx)(`code`,{translate:`no`,children:ue(b.timestampMs,_)})]}),(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,O.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function de(e){let{t}=m();return(0,O.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,O.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,O.jsx)(k,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,O.jsx)(k,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsx)(A,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,O.jsx)(A,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,O.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,O.jsx)(x,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,O.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,O.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,O.jsx)(y,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function j({icon:e,message:t,className:n=`empty-state glass`}){return(0,O.jsxs)(`div`,{className:n,children:[(0,O.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,O.jsx)(`p`,{children:t})]})}function fe({label:e,pem:t,filename:n}){let{t:r}=m();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}return(0,O.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,O.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,O.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,O.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,O.jsx)(b,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,O.jsx)(_,{size:14}),r(`common.download`)]})]})]}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function pe({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=m();if(!t||!n)return(0,O.jsx)(j,{icon:(0,O.jsx)(x,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,O.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,O.jsx)(fe,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,O.jsx)(fe,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var me=Object.defineProperty,M=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,he=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||={})N.call(t,n)&&he(e,n,t[n]);if(M)for(var n of M(t))P.call(t,n)&&he(e,n,t[n]);return e},I=(e,t)=>{var n={};for(var r in e)N.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&M)for(var r of M(e))t.indexOf(r)<0&&P.call(e,r)&&(n[r]=e[r]);return n},L;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(L||={});var R=L,ge={L:R.QrCode.Ecc.LOW,M:R.QrCode.Ecc.MEDIUM,Q:R.QrCode.Ecc.QUARTILE,H:R.QrCode.Ecc.HIGH},z=128,B=`L`,V=`#FFFFFF`,H=`#000000`,U=!1,W=1,_e=4,ve=0,G=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*G),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?_e:ve:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=D.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...R.QrSegment.makeSegments(t)),e),[]);return R.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=D.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,marginSize:d,imageSettings:f}=n,p=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=I(p,[`style`]),g=f?.src,_=D.useRef(null),v=D.useRef(null),y=D.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=D.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});D.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),D.useEffect(()=>{x(!1)},[g]);let E=F({height:i,width:i},m),ee=null;return g!=null&&(ee=D.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),D.createElement(D.Fragment,null,D.createElement(`canvas`,F({style:E,height:i,width:i,ref:y,role:`img`},h)),ee)});Ce.displayName=`QRCodeCanvas`;var J=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=D.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return D.createElement(`svg`,F({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&D.createElement(`title`,null,d),D.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),D.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:h,onToggleDerivePrivateKey:g,onDerive:_}){let{t:v}=m(),x=e?.address||``;return!e||!x?(0,O.jsx)(j,{icon:(0,O.jsx)(C,{size:36}),message:v(`web3.empty.walletTools`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,O.jsx)(oe,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),s&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,O.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:x}),(0,O.jsx)(b,{text:x})]}),(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:x,size:200})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,O.jsx)(y,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),c&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,O.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,O.jsx)(b,{text:t})]}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.mnemonic`)]}),(0,O.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:t,size:260})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsx)(`div`,{children:(0,O.jsx)(`button`,{className:`btn btn-primary`,onClick:_,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.privateKey`)]}),r.length>0&&(0,O.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,O.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{onClick:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,O.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,O.jsx)(`th`,{onClick:g,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,O.jsx)(`tbody`,{children:r.map(e=>(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{children:i?e.index+1:``}),(0,O.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,O.jsx)(`td`,{className:`danger`,children:(0,O.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,O.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,O.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,O.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,O.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,O.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=m(),s=e?.address||``;return!e||!s?(0,O.jsx)(j,{icon:(0,O.jsx)(g,{size:36}),message:o(`web3.empty.identity`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,O.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,O.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,O.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,O.jsx)(b,{text:s.toLowerCase()}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,O.jsx)(v,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,O.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,O.jsx)(h,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,O.jsx)(b,{text:t.ed_public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,O.jsx)(y,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,O.jsx)(b,{text:t.public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,O.jsx)(ce,{size:18}),accent:!0,children:(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})}),(0,O.jsx)(Y,{title:`IPNS ID`,icon:(0,O.jsx)(ae,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(b,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=m();return(0,O.jsxs)(`div`,{className:`input-panel`,children:[(0,O.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]})]}),(0,O.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
2
2
  `)}\n-----END PRIVATE KEY-----`},ke=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([3,33,0,...e]),r=t.length+n.length,i=new Uint8Array(2+r);i[0]=48,i[1]=r;let a=2;return i.set(t,a),a+=t.length,i.set(n,a),`-----BEGIN PUBLIC KEY-----\n${X(i).match(/.{1,64}/g)?.join(`
3
3
  `)}\n-----END PUBLIC KEY-----`},Ae=[`wallet`,`pem`,`export`,`EA`];function je(){let e=window.location.hash.replace(`#`,``);return Ae.includes(e)?e:`wallet`}function Me(){let{t:e}=m(),t=p(e=>e.addToast),n=a(e=>e.setUserIdentity),[i,s]=(0,D.useState)(`wallet`),[c,h]=(0,D.useState)(``),[_,v]=(0,D.useState)(``),[b,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(null),[ie,ae]=(0,D.useState)(null),[oe,se]=(0,D.useState)(``),[ce,le]=(0,D.useState)(``),[k,ue]=(0,D.useState)(``),[A,j]=(0,D.useState)(``),[fe,me]=(0,D.useState)([]),[M,N]=(0,D.useState)(0),[P,he]=(0,D.useState)(!0),[F,I]=(0,D.useState)(!0),[L,R]=(0,D.useState)(!1),[ge,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(!1),[H,U]=(0,D.useState)(!1),[W,_e]=(0,D.useState)(!1),[ve,G]=(0,D.useState)(!1),[K,ye]=(0,D.useState)(``),[be,xe]=(0,D.useState)(``),[q,Se]=(0,D.useState)(!1),[Ce,J]=(0,D.useState)(!1),[Y,Te]=(0,D.useState)(null),[X,Ae]=(0,D.useState)(``),[Me,Ne]=(0,D.useState)(``),[Pe,Fe]=(0,D.useState)(!1),[Ie,Le]=(0,D.useState)(!1),[Z,Re]=(0,D.useState)(null),[ze,Be]=(0,D.useState)(`Hello B. This is from A.`),[Ve,He]=(0,D.useState)(``),[Ue,We]=(0,D.useState)(``),[Ge,Ke]=(0,D.useState)(``),[qe,Je]=(0,D.useState)(`Hello A. This is from B.`),[Ye,Xe]=(0,D.useState)(``),[Ze,Qe]=(0,D.useState)(``),[$e,et]=(0,D.useState)(``),[tt,nt]=(0,D.useState)(``),[rt,it]=(0,D.useState)(``),[at,ot]=(0,D.useState)(``),[st,ct]=(0,D.useState)(``),[lt,Q]=(0,D.useState)(``),[ut,dt]=(0,D.useState)(!1),[ft,pt]=(0,D.useState)(``),[mt,ht]=(0,D.useState)(``),[gt,_t]=(0,D.useState)(``),[vt,yt]=(0,D.useState)(``),[bt,$]=(0,D.useState)(``),[xt,St]=(0,D.useState)(!1);(0,D.useEffect)(()=>{s(je());let e=()=>s(je());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let Ct=e=>{s(e),window.location.hash=e},wt=(0,D.useCallback)(async()=>{if(!c.trim())return;G(!0),await new Promise(e=>setTimeout(e,0));let r=o(c.trim(),_),i=`${r.username}#${r.address.slice(-4).toUpperCase()}`;E(r),n({...r,displayName:i}),t(e(`login.toast.signedIn`,{username:r.username}),`success`),j(l(r.danger));let a=u(r.danger);ae(a),se(ne(a.private_key,a.ed_public_key));let s=re(a.private_key,a.ed_public_key);le(Oe(s.secretKey)),ue(ke(s.publicKey)),me([]),N(0),z(!1),V(!1),U(!1),_e(!1),G(!1)},[t,_,n,e,c]);function Tt(n,r,i){let a=n.trim();if(!a)return;let s=o(a,r),c=u(s.danger);i({username:s.username,address:s.address,publicKey:c.public_key,privateKey:c.private_key}),We(``),Ke(``),Qe(``),et(``),t(e(`web3.toast.accountGenerated`),`success`)}function Et({senderAccount:t,recipientAccount:n,message:i,setCipherText:a,setDecryptedText:o,setError:s}){if(!t||!n){s(e(`web3.error.accountsRequired`));return}if(!i.trim()){s(e(`web3.error.messageRequired`));return}a(r(i,{senderPrivateKey:t.privateKey,recipientPublicKey:n.publicKey})),o(``),s(``)}function Dt({senderAccount:t,recipientAccount:n,cipherText:r,setDecryptedText:i,setError:a}){if(!t||!n){a(e(`web3.error.accountsRequired`));return}if(!r.trim()){a(e(`web3.error.cipherRequired`));return}let o=f(r,{senderPublicKey:t.publicKey,recipientPrivateKey:n.privateKey});if(!o){a(e(`web3.error.decryptFailed`)),i(``);return}i(o),a(``)}function Ot(){if(!tt.trim()){Q(e(`web3.error.senderPublicRequired`));return}if(!rt.trim()){Q(e(`web3.error.recipientPrivateRequired`));return}if(!at.trim()){Q(e(`web3.error.cipherRequired`));return}let t=f(at,{senderPublicKey:tt.trim(),recipientPrivateKey:rt.trim()});if(!t){Q(e(`web3.error.decryptFailed`)),ct(``);return}ct(t),Q(``)}function kt(){if(!ft.trim()){$(e(`web3.error.senderPrivateRequired`));return}if(!mt.trim()){$(e(`web3.error.recipientPublicRequired`));return}if(!gt.trim()){$(e(`web3.error.messageRequired`));return}yt(r(gt,{senderPrivateKey:ft.trim(),recipientPublicKey:mt.trim()})),$(``)}let At=()=>{if(!A)return;let e=[];for(let t=M;t<M+10;t++){let n=`m/44'/60'/0'/0/${t}`,r=d.fromPhrase(A,void 0,n);e.push({index:t,address:r.address,privateKey:r.privateKey})}me(t=>[...t,...e]),N(e=>e+10)},jt=ee(T?.address||void 0),Mt=i===`wallet`?`web3.view.wallet`:i===`pem`?`web3.view.pem`:i===`EA`?`web3.view.asymmetric`:`web3.view.export`,Nt=[{id:`wallet`,icon:(0,O.jsx)(g,{size:16}),labelKey:`web3.view.wallet`},{id:`pem`,icon:(0,O.jsx)(x,{size:16}),labelKey:`web3.view.pem`},{id:`export`,icon:(0,O.jsx)(C,{size:16}),labelKey:`web3.view.export`},{id:`EA`,icon:(0,O.jsx)(y,{size:16}),labelKey:`web3.view.asymmetric`}],Pt=i!==`EA`;return(0,O.jsx)(S,{sidebar:({closeSidebar:t})=>(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(te,{onNavigate:t}),(0,O.jsx)(`nav`,{className:`sidebar-nav`,children:Nt.map(n=>(0,O.jsxs)(`button`,{onClick:()=>{Ct(n.id),t()},className:`sidebar-nav-btn ${i===n.id?`active`:``}`,children:[n.icon,(0,O.jsx)(`span`,{children:e(n.labelKey)})]},n.id))})]}),headerTitle:(0,O.jsx)(`h2`,{className:`header-title`,children:e(Mt)}),children:(0,O.jsx)(`div`,{className:`web3-page`,children:(0,O.jsxs)(`div`,{className:`web3-container ${i===`EA`?`wide`:``}`,children:[Pt&&(0,O.jsx)(De,{username:c,password:_,showPassword:b,generating:ve,onUsernameChange:h,onPasswordChange:v,onTogglePassword:()=>w(!b),onGenerate:wt}),i===`wallet`&&(0,O.jsx)(Ee,{walletResult:T,keys:ie,ipns:oe,avatarSrc:jt,showPrivateKey:W,onTogglePrivateKey:()=>_e(!W)}),i===`pem`&&(0,O.jsx)(pe,{walletResult:T,publicPem:k,privatePem:ce}),i===`export`&&(0,O.jsx)(we,{walletResult:T,mnemonicPhrase:A,deriveBatch:10,deriveList:fe,deriveShowIndex:P,deriveShowAddress:F,deriveShowPrivateKey:L,showAddressQr:ge,showMnemonicReveal:B,showMnemonicQr:H,onToggleAddressQr:()=>z(!ge),onToggleMnemonicReveal:()=>V(!B),onToggleMnemonicQr:()=>U(!H),onToggleDeriveIndex:()=>he(!P),onToggleDeriveAddress:()=>I(!F),onToggleDerivePrivateKey:()=>R(!L),onDerive:At}),i===`EA`&&(0,O.jsx)(de,{boxAUsername:K,boxAPassword:be,boxAShowPassword:q,boxAShowPrivateKey:Ce,boxAAccount:Y,boxBUsername:X,boxBPassword:Me,boxBShowPassword:Pe,boxBShowPrivateKey:Ie,boxBAccount:Z,boxABMessage:ze,boxABCipherText:Ve,boxABDecryptedText:Ue,boxABError:Ge,boxBAMessage:qe,boxBACipherText:Ye,boxBADecryptedText:Ze,boxBAError:$e,boxEncryptSenderPrivateKey:ft,boxEncryptRecipientPublicKey:mt,boxEncryptMessage:gt,boxEncryptCipherText:vt,boxEncryptError:bt,boxEncryptShowPrivateKey:xt,boxDecryptSenderPublicKey:tt,boxDecryptRecipientPrivateKey:rt,boxDecryptCipherText:at,boxDecryptResult:st,boxDecryptError:lt,boxDecryptShowPrivateKey:ut,onBoxAUsernameChange:ye,onBoxAPasswordChange:xe,onBoxAShowPasswordToggle:()=>Se(!q),onBoxAShowPrivateKeyToggle:()=>J(!Ce),onGenerateBoxA:()=>Tt(K,be,Te),onBoxBUsernameChange:Ae,onBoxBPasswordChange:Ne,onBoxBShowPasswordToggle:()=>Fe(!Pe),onBoxBShowPrivateKeyToggle:()=>Le(!Ie),onGenerateBoxB:()=>Tt(X,Me,Re),onBoxABMessageChange:Be,onBoxABCipherTextChange:He,onEncryptBoxAB:()=>Et({senderAccount:Y,recipientAccount:Z,message:ze,setCipherText:He,setDecryptedText:We,setError:Ke}),onDecryptBoxAB:()=>Dt({senderAccount:Y,recipientAccount:Z,cipherText:Ve,setDecryptedText:We,setError:Ke}),onBoxBAMessageChange:Je,onBoxBACipherTextChange:Xe,onEncryptBoxBA:()=>Et({senderAccount:Z,recipientAccount:Y,message:qe,setCipherText:Xe,setDecryptedText:Qe,setError:et}),onDecryptBoxBA:()=>Dt({senderAccount:Z,recipientAccount:Y,cipherText:Ye,setDecryptedText:Qe,setError:et}),onBoxEncryptSenderPrivateKeyChange:pt,onBoxEncryptRecipientPublicKeyChange:ht,onBoxEncryptMessageChange:_t,onBoxEncryptShowPrivateKeyToggle:()=>St(!xt),onEncryptOnly:kt,onBoxDecryptSenderPublicKeyChange:nt,onBoxDecryptRecipientPrivateKeyChange:it,onBoxDecryptCipherTextChange:ot,onBoxDecryptShowPrivateKeyToggle:()=>dt(!ut),onDecryptOnly:Ot})]})})})}var Ne=s(`/web3/`)({component:Me});export{Ne 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-Pjif7nCR.js";import{a as ee}from"./i18n-DKsg67mH.js";import{t as te}from"./external-link-LcGMVTLE.js";import{n as ne,t as re}from"./CopyButton-BfQ-TOoR.js";import{t as ie}from"./AppShell-BN1uaxn1.js";import{t as ae}from"./refresh-cw-Bxmcm8cn.js";import{b as oe}from"./index-CCU5Z4K-.js";import{t as se}from"./AppTop-iPNi3cv5.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
+ 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-Pjif7nCR.js";import{a as ee}from"./i18n-BPfshhQc.js";import{t as te}from"./external-link-LcGMVTLE.js";import{n as ne,t as re}from"./CopyButton-BN_vYKM8.js";import{t as ie}from"./AppShell-kfQyRhZy.js";import{t as ae}from"./refresh-cw-Bxmcm8cn.js";import{b as oe}from"./index-AZPpawN1.js";import{t as se}from"./AppTop-DydClKUv.js";import{n as ce,r as le,t as c}from"./chatJoinInvite-Cwot1ykh.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};
@@ -0,0 +1 @@
1
+ import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),n=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,c as i}from"./useAppStore-Pjif7nCR.js";import{a}from"./i18n-DKsg67mH.js";import{t as o}from"./download-nQ9X-v0q.js";import{t as s}from"./file-text-f1ij7Al1.js";import{t as c}from"./loader-DAMqAKH7.js";import{t as l}from"./music-U7NZcQ6S.js";import{O as u}from"./index-CCU5Z4K-.js";var d=r(`pen`,[[`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`}]]),f=r(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),p=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]);function m(e){let t=String(e||``).split(`.`).pop()?.toLowerCase()||``,n=[`jpg`,`jpeg`,`png`,`gif`,`webp`,`svg`,`bmp`,`ico`,`tiff`,`heic`,`heif`],r=[`mp4`,`webm`,`mov`,`avi`,`mkv`,`flv`,`wmv`,`m4v`,`mpeg`,`3gp`],i=[`mp3`,`wav`,`ogg`,`flac`,`aac`,`m4a`,`wma`,`opus`],a=`txt.md.js.ts.jsx.tsx.css.scss.less.json.xml.html.htm.yaml.yml.toml.ini.cfg.conf.log.sh.bash.py.rb.go.rs.java.c.cpp.h.hpp.cs.php.sql.graphql.env.gitignore.dockerfile.readme`.split(`.`);return n.includes(t)?`image`:r.includes(t)?`video`:i.includes(t)?`audio`:a.includes(t)?`text`:`file`}var h=t(e(),1),g=n();function _(e){return e===`image`||e===`video`||e===`audio`}function v({item:e,isBackendReady:t,getFileDownloadUrl:n,onClose:r,onSaveAs:d}){let{t:f}=a(),[p,m]=(0,h.useState)(``),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(e.subtype!==`text`)return;let r=!1;if(m(``),C(``),!t){m(f(`preview.loadFailed`));return}return y(!0),(async()=>{try{let t=await fetch(n(e.cid),{headers:{...await i(`GET`,`/api/files/${e.cid}/download`),Range:`bytes=0-9999`}});if(!t.ok)throw Error(f(`preview.loadFailed`));let a=await t.text();r||m(a||f(`preview.emptyFile`))}catch{r||m(f(`preview.loadFailed`))}finally{r||y(!1)}})(),()=>{r=!0}},[n,t,e.cid,e.subtype]),(0,h.useEffect)(()=>{if(!_(e.subtype)){x(``);return}if(x(``),C(``),!t){C(f(`preview.loadFailed`));return}let r=``,a=!1;return(async()=>{try{let t=await fetch(n(e.cid),{headers:await i(`GET`,`/api/files/${e.cid}/download`)});if(!t.ok)throw Error(f(`preview.loadFailed`));let o=URL.createObjectURL(await t.blob());r=o,a||x(o)}catch{a||C(f(`preview.loadFailed`))}})(),()=>{a=!0,r&&URL.revokeObjectURL(r)}},[n,t,e.cid,e.subtype]);async function E(t){if(t.stopPropagation(),!(!d||w)){T(!0);try{await d(e)}finally{T(!1)}}}return(0,g.jsxs)(`div`,{className:`preview-overlay`,onClick:r,children:[(0,g.jsxs)(`div`,{className:`preview-actions`,children:[d&&(0,g.jsxs)(`button`,{type:`button`,className:`preview-save`,onClick:E,disabled:!t||w,"aria-label":f(`app.saveAs`),title:f(`app.saveAs`),children:[w?(0,g.jsx)(c,{size:17,className:`preview-text-spinner`}):(0,g.jsx)(o,{size:17}),(0,g.jsx)(`span`,{children:f(`app.saveAs`)})]}),(0,g.jsx)(`button`,{type:`button`,className:`preview-close`,onClick:r,"aria-label":f(`preview.close`),children:(0,g.jsx)(u,{size:20})})]}),(0,g.jsxs)(`div`,{onClick:e=>e.stopPropagation(),children:[e.subtype===`image`&&(0,g.jsx)(`div`,{className:`preview-media-wrapper`,children:b?(0,g.jsx)(`img`,{src:b,alt:e.fileName,translate:`no`}):S?(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:S})]}):(0,g.jsx)(`div`,{className:`preview-loading`,children:(0,g.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`video`&&(0,g.jsx)(`div`,{className:`preview-media-wrapper`,children:b?(0,g.jsx)(`video`,{src:b,controls:!0}):S?(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:S})]}):(0,g.jsx)(`div`,{className:`preview-loading`,children:(0,g.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`audio`&&(0,g.jsxs)(`div`,{className:`preview-audio`,children:[(0,g.jsx)(`div`,{className:`preview-audio-icon`,children:(0,g.jsx)(l,{size:36,color:`var(--accent)`})}),(0,g.jsx)(`p`,{className:`preview-audio-filename`,translate:`no`,children:e.fileName}),b?(0,g.jsx)(`audio`,{className:`preview-audio-player`,src:b,controls:!0}):(0,g.jsx)(`div`,{className:`preview-text-loading`,children:S?(0,g.jsx)(`p`,{children:S}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c,{size:24,className:`preview-text-spinner`}),(0,g.jsx)(`p`,{children:f(`preview.audioLoading`)})]})})]}),e.subtype===`file`&&(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:f(`preview.unsupported`)})]}),e.subtype===`text`&&(0,g.jsxs)(`div`,{className:`preview-text-container`,children:[(0,g.jsx)(`div`,{className:`preview-text-header`,children:(0,g.jsx)(`span`,{translate:`no`,children:e.fileName})}),v?(0,g.jsxs)(`div`,{className:`preview-text-loading`,children:[(0,g.jsx)(c,{size:24,className:`preview-text-spinner`}),(0,g.jsx)(`p`,{children:f(`preview.textLoading`)}),(0,g.jsx)(`p`,{className:`preview-text-loading-hint`,children:f(`preview.firstSyncHint`)})]}):(0,g.jsx)(`pre`,{className:`preview-text`,translate:`no`,children:p||f(`preview.emptyFile`)})]})]})]})}function y(){if(typeof fetch!=`function`)throw Error(`Browser fetch unavailable`);return fetch.bind(globalThis)}function b(){let e=globalThis.showSaveFilePicker;return typeof e==`function`?e.bind(globalThis):null}function x(){let e=globalThis.document;if(!e?.body||typeof e.createElement!=`function`)throw Error(`Browser download unavailable`);return e}function S(e){return String(e||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||`download`}async function C({cid:e,getFileDownloadUrl:t,loadFailedMessage:n,getRequestHeaders:r,fetchFile:i}){let a=`/api/files/${e}/download`,o=r?await r(`GET`,a):{},s=await(i||y())(t(e),{headers:o});if(!s.ok)throw Error(n||`Failed to get file`);return s.blob()}async function w(e,t,n){let r=await(await e({suggestedName:t})).createWritable();await r.write(n),await r.close()}function T(e,t,n,r){let i=t.createObjectURL(r),a=null,o=!1;try{a=e.createElement(`a`),a.href=i,a.download=n,e.body.appendChild(a),o=!0,a.click()}finally{a&&o&&e.body.removeChild(a),t.revokeObjectURL(i)}}async function E(e){let t=await C(e),n=S(e.fileName),r=e.showSaveFilePicker===void 0?b():e.showSaveFilePicker;return r?(await w(r,n,t),{method:`picker`}):(T(e.documentRef||x(),e.urlApi||URL,n,t),{method:`download`})}export{f as a,p as i,v as n,d as o,m as r,E as t};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,c as i}from"./useAppStore-Pjif7nCR.js";import{a}from"./i18n-BPfshhQc.js";import{t as o}from"./download-nQ9X-v0q.js";import{t as s}from"./file-text-f1ij7Al1.js";import{t as c}from"./loader-DAMqAKH7.js";import{t as l}from"./music-U7NZcQ6S.js";import{O as u}from"./index-AZPpawN1.js";var d=r(`pen`,[[`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`}]]),f=r(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),p=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]);function m(e){let t=String(e||``).split(`.`).pop()?.toLowerCase()||``,n=[`jpg`,`jpeg`,`png`,`gif`,`webp`,`svg`,`bmp`,`ico`,`tiff`,`heic`,`heif`],r=[`mp4`,`webm`,`mov`,`avi`,`mkv`,`flv`,`wmv`,`m4v`,`mpeg`,`3gp`],i=[`mp3`,`wav`,`ogg`,`flac`,`aac`,`m4a`,`wma`,`opus`],a=`txt.md.js.ts.jsx.tsx.css.scss.less.json.xml.html.htm.yaml.yml.toml.ini.cfg.conf.log.sh.bash.py.rb.go.rs.java.c.cpp.h.hpp.cs.php.sql.graphql.env.gitignore.dockerfile.readme`.split(`.`);return n.includes(t)?`image`:r.includes(t)?`video`:i.includes(t)?`audio`:a.includes(t)?`text`:`file`}var h=t(e(),1),g=n();function _(e){return e===`image`||e===`video`||e===`audio`}function v({item:e,isBackendReady:t,getFileDownloadUrl:n,onClose:r,onSaveAs:d}){let{t:f}=a(),[p,m]=(0,h.useState)(``),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(``),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(e.subtype!==`text`)return;let r=!1;if(m(``),C(``),!t){m(f(`preview.loadFailed`));return}return y(!0),(async()=>{try{let t=await fetch(n(e.cid),{headers:{...await i(`GET`,`/api/files/${e.cid}/download`),Range:`bytes=0-9999`}});if(!t.ok)throw Error(f(`preview.loadFailed`));let a=await t.text();r||m(a||f(`preview.emptyFile`))}catch{r||m(f(`preview.loadFailed`))}finally{r||y(!1)}})(),()=>{r=!0}},[n,t,e.cid,e.subtype]),(0,h.useEffect)(()=>{if(!_(e.subtype)){x(``);return}if(x(``),C(``),!t){C(f(`preview.loadFailed`));return}let r=``,a=!1;return(async()=>{try{let t=await fetch(n(e.cid),{headers:await i(`GET`,`/api/files/${e.cid}/download`)});if(!t.ok)throw Error(f(`preview.loadFailed`));let o=URL.createObjectURL(await t.blob());r=o,a||x(o)}catch{a||C(f(`preview.loadFailed`))}})(),()=>{a=!0,r&&URL.revokeObjectURL(r)}},[n,t,e.cid,e.subtype]);async function E(t){if(t.stopPropagation(),!(!d||w)){T(!0);try{await d(e)}finally{T(!1)}}}return(0,g.jsxs)(`div`,{className:`preview-overlay`,onClick:r,children:[(0,g.jsxs)(`div`,{className:`preview-actions`,children:[d&&(0,g.jsxs)(`button`,{type:`button`,className:`preview-save`,onClick:E,disabled:!t||w,"aria-label":f(`app.saveAs`),title:f(`app.saveAs`),children:[w?(0,g.jsx)(c,{size:17,className:`preview-text-spinner`}):(0,g.jsx)(o,{size:17}),(0,g.jsx)(`span`,{children:f(`app.saveAs`)})]}),(0,g.jsx)(`button`,{type:`button`,className:`preview-close`,onClick:r,"aria-label":f(`preview.close`),children:(0,g.jsx)(u,{size:20})})]}),(0,g.jsxs)(`div`,{onClick:e=>e.stopPropagation(),children:[e.subtype===`image`&&(0,g.jsx)(`div`,{className:`preview-media-wrapper`,children:b?(0,g.jsx)(`img`,{src:b,alt:e.fileName,translate:`no`}):S?(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:S})]}):(0,g.jsx)(`div`,{className:`preview-loading`,children:(0,g.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`video`&&(0,g.jsx)(`div`,{className:`preview-media-wrapper`,children:b?(0,g.jsx)(`video`,{src:b,controls:!0}):S?(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:S})]}):(0,g.jsx)(`div`,{className:`preview-loading`,children:(0,g.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`audio`&&(0,g.jsxs)(`div`,{className:`preview-audio`,children:[(0,g.jsx)(`div`,{className:`preview-audio-icon`,children:(0,g.jsx)(l,{size:36,color:`var(--accent)`})}),(0,g.jsx)(`p`,{className:`preview-audio-filename`,translate:`no`,children:e.fileName}),b?(0,g.jsx)(`audio`,{className:`preview-audio-player`,src:b,controls:!0}):(0,g.jsx)(`div`,{className:`preview-text-loading`,children:S?(0,g.jsx)(`p`,{children:S}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c,{size:24,className:`preview-text-spinner`}),(0,g.jsx)(`p`,{children:f(`preview.audioLoading`)})]})})]}),e.subtype===`file`&&(0,g.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,g.jsx)(s,{size:48,className:`preview-file-icon`}),(0,g.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,g.jsx)(`p`,{className:`preview-unsupported-hint`,children:f(`preview.unsupported`)})]}),e.subtype===`text`&&(0,g.jsxs)(`div`,{className:`preview-text-container`,children:[(0,g.jsx)(`div`,{className:`preview-text-header`,children:(0,g.jsx)(`span`,{translate:`no`,children:e.fileName})}),v?(0,g.jsxs)(`div`,{className:`preview-text-loading`,children:[(0,g.jsx)(c,{size:24,className:`preview-text-spinner`}),(0,g.jsx)(`p`,{children:f(`preview.textLoading`)}),(0,g.jsx)(`p`,{className:`preview-text-loading-hint`,children:f(`preview.firstSyncHint`)})]}):(0,g.jsx)(`pre`,{className:`preview-text`,translate:`no`,children:p||f(`preview.emptyFile`)})]})]})]})}function y(){if(typeof fetch!=`function`)throw Error(`Browser fetch unavailable`);return fetch.bind(globalThis)}function b(){let e=globalThis.showSaveFilePicker;return typeof e==`function`?e.bind(globalThis):null}function x(){let e=globalThis.document;if(!e?.body||typeof e.createElement!=`function`)throw Error(`Browser download unavailable`);return e}function S(e){return String(e||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||`download`}async function C({cid:e,getFileDownloadUrl:t,loadFailedMessage:n,getRequestHeaders:r,fetchFile:i}){let a=`/api/files/${e}/download`,o=r?await r(`GET`,a):{},s=await(i||y())(t(e),{headers:o});if(!s.ok)throw Error(n||`Failed to get file`);return s.blob()}async function w(e,t,n){let r=await(await e({suggestedName:t})).createWritable();await r.write(n),await r.close()}function T(e,t,n,r){let i=t.createObjectURL(r),a=null,o=!1;try{a=e.createElement(`a`),a.href=i,a.download=n,e.body.appendChild(a),o=!0,a.click()}finally{a&&o&&e.body.removeChild(a),t.revokeObjectURL(i)}}async function E(e){let t=await C(e),n=S(e.fileName),r=e.showSaveFilePicker===void 0?b():e.showSaveFilePicker;return r?(await w(r,n,t),{method:`picker`}):(T(e.documentRef||x(),e.urlApi||URL,n,t),{method:`download`})}export{f as a,p as i,v as n,d as o,m as r,E as t};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./jsx-runtime-Bt-cYkS5.js";import{E as n,u as r}from"./useAppStore-Pjif7nCR.js";import{a as i}from"./index-CCU5Z4K-.js";import{t as a}from"./channelApi-DA2GY-k4.js";var o=t(e(),1);function s(e=``,t=[]){let n=[e,...t];return[...new Set(n.filter(Boolean))]}function c(e=[]){return s(``,e).join(`
1
+ import{n as e,o as t}from"./jsx-runtime-Bt-cYkS5.js";import{E as n,u as r}from"./useAppStore-Pjif7nCR.js";import{a as i}from"./index-AZPpawN1.js";import{t as a}from"./channelApi-DA2GY-k4.js";var o=t(e(),1);function s(e=``,t=[]){let n=[e,...t];return[...new Set(n.filter(Boolean))]}function c(e=[]){return s(``,e).join(`
2
2
  `)}function ee(e,t){let n=new Set(e),r=new Set(t);return{subscribe:[...r].filter(e=>!n.has(e)),unsubscribe:[...n].filter(e=>!r.has(e))}}var l=`channel.member.joined`;function u(e){return e?.type===`system`&&e?.event===`channel.member.joined`}function d(e){let t=String(e?.author||``).trim().toLowerCase();return u(e)&&t?`system:${l}:${t}`:String(e?.id||[e?.author||``,e?.timestamp||``,e?.content||``].join(`-`))}function te(e){let t=new Set;return e.filter(e=>{let n=d(e);return t.has(n)?!1:(t.add(n),!0)})}var ne=15*1e3;function re(e){return d(e)}function f(e){let t=Number(e.timestamp);return Number.isFinite(t)?t:0}function p(e){return e.map((e,t)=>({message:e,index:t})).sort((e,t)=>{let n=f(e.message)-f(t.message);return n===0?e.index-t.index:n}).map(e=>e.message)}function ie(){return`presence-${Date.now()}-${Math.random().toString(36).slice(2)}`}function m({isReady:e,enabled:t=!0,channelName:l=``,extraSubscribedChannelNames:u=[],peerId:d=``,waitForPeerId:f=!1,limit:m=100,reconnectBaseDelay:h=2500,acceptMessage:g,getMessageKey:_=re,onSyncError:v,onSocketEvent:y,onReconnect:b,presenceEnabled:x=!1,presenceProfile:S={}}){let C=n(e=>e.identity),[ae,w]=(0,o.useState)([]),[T,E]=(0,o.useState)(!1),[oe,D]=(0,o.useState)(``),O=(0,o.useMemo)(()=>c(u),[u]),k=(0,o.useRef)(null),A=(0,o.useRef)(l),j=(0,o.useRef)(u),M=(0,o.useRef)(null),N=(0,o.useRef)(0),P=(0,o.useRef)(g),F=(0,o.useRef)(_),I=(0,o.useRef)(y),L=(0,o.useRef)(v),R=(0,o.useRef)(b),z=(0,o.useRef)(d),B=(0,o.useRef)(new Set),V=(0,o.useRef)(x),H=(0,o.useRef)(S),U=(0,o.useRef)(ie()),W=(0,o.useRef)(``);(0,o.useEffect)(()=>{j.current=O?O.split(`
3
3
  `):[]},[O]),(0,o.useEffect)(()=>{P.current=g},[g]),(0,o.useEffect)(()=>{F.current=_},[_]),(0,o.useEffect)(()=>{I.current=y},[y]),(0,o.useEffect)(()=>{L.current=v},[v]),(0,o.useEffect)(()=>{R.current=b},[b]),(0,o.useEffect)(()=>{V.current=x},[x]),(0,o.useEffect)(()=>{H.current=S},[S]);let G=(0,o.useCallback)(e=>{let t=P.current;return t?e.filter(t):e},[]),K=(0,o.useCallback)((e,t,n=!0)=>{let r=[...e];for(let e of G(t)){let t=F.current(e);if(n){let n=r.findIndex(t=>t.pending&&t.author?.toLowerCase()===e.author?.toLowerCase()&&t.content===e.content);if(n!==-1){r[n]={...e,id:e.id||t};continue}}r.some(e=>F.current(e)===t)||r.push({...e,id:e.id||t})}return p(r)},[G]),q=(0,o.useCallback)((e,t)=>{k.current?.readyState===WebSocket.OPEN&&k.current.send(JSON.stringify({event:e,data:t}))},[]),J=(0,o.useCallback)(e=>({channel:e,sessionId:U.current,...H.current}),[]),Y=(0,o.useCallback)((e=W.current)=>{e&&(q(`channel:presence:leave`,{channel:e,sessionId:U.current}),W.current===e&&(W.current=``))},[q]),X=(0,o.useCallback)(e=>{!e||!V.current||!C||(q(`channel:presence:join`,J(e)),W.current=e)},[J,C,q]),Z=(0,o.useCallback)(e=>{let t=new Set(e.filter(Boolean)),n=ee(B.current,t);for(let e of n.unsubscribe)q(`channel:unsubscribe`,{channel:e});for(let e of n.subscribe)q(`channel:subscribe`,{channel:e});B.current=t},[q]),Q=(0,o.useCallback)(()=>s(A.current,j.current),[]),$=(0,o.useCallback)(async(t=A.current,n={})=>{if(!t||!e)return[];try{let e=G(await a.getChannelMessages(t,m));return w(t=>n.replace?p(te(e)):K(t,e,!1)),n.replace&&A.current===t&&D(t),e}catch(e){return n.replace&&(w([]),A.current===t&&D(t)),await L.current?.(e),[]}},[G,e,m,K]);(0,o.useEffect)(()=>{z.current=d,d&&(q(`register`,{peerId:d}),f&&(Z(Q()),A.current&&$(A.current,{replace:!0})))},[Q,d,Z,$,f,q]);let se=(0,o.useCallback)(()=>{w([]),D(``)},[]),ce=(0,o.useCallback)(async({channelName:e=A.current,content:t,attachment:n,optimisticId:r})=>{let o=t.trim();if(!e||!o||!C)return null;let s=i(C),c={id:r||`${s.author}-${Date.now()}-${Math.random().toString(36).slice(2)}`,...s,content:o,timestamp:Date.now(),pending:!0,attachment:n};w(e=>p([...e,c]));try{let t=await a.sendChannelMessage({channelName:e,content:o,...s,attachment:n});return w(e=>p(e.map(e=>e.id===c.id?{...t.message,id:t.message.id||F.current(t.message)}:e))),t.message}catch(e){throw w(e=>e.filter(e=>e.id!==c.id)),e}},[C]);return(0,o.useEffect)(()=>{A.current=l,!(!e||!t)&&(l&&$(l,{replace:!0}),(!f||z.current)&&Z(Q()))},[l,t,O,Q,e,Z,$,f]),(0,o.useEffect)(()=>{if(!T||!x||!C||!l){Y();return}let e=W.current;e&&e!==l&&Y(e),W.current!==l&&X(l)},[l,T,X,Y,x,C]),(0,o.useEffect)(()=>{let e=W.current;!T||!x||!e||!C||q(`channel:presence:profile`,J(e))},[T,J,x,(0,o.useMemo)(()=>[S.displayName||``,S.avatar||``,S.profileUpdatedAt||``].join(`
4
4
  `),[S.avatar,S.displayName,S.profileUpdatedAt]),C,q]),(0,o.useEffect)(()=>{if(!T||!x||!C)return;let e=window.setInterval(()=>{let e=W.current;e&&q(`channel:presence:heartbeat`,{channel:e,sessionId:U.current})},ne);return()=>window.clearInterval(e)},[T,x,C,q]),(0,o.useEffect)(()=>{!e||!t||f&&!z.current||Z(Q())},[t,Q,e,Z,f]),(0,o.useEffect)(()=>{if(!e||!t){E(!1);return}let n=!1;N.current=0;async function i(){let e=new WebSocket(await r(`/ws`));if(n){e.close();return}e.onopen=()=>{E(!0),N.current=0,z.current&&e.send(JSON.stringify({event:`register`,data:{peerId:z.current}})),(!f||z.current)&&(B.current.clear(),Z(Q()),A.current&&$(A.current,{replace:!0}),R.current?.())},e.onmessage=e=>{try{let t=JSON.parse(e.data);I.current?.(t.event,t.data),t.event===`channel:message`&&t.data?.channel===A.current&&t.data?.message&&w(e=>K(e,[t.data.message])),t.event===`user:metadata:updated`&&t.data?.scope===`channels`&&A.current&&$(A.current,{replace:!0})}catch{}},e.onclose=()=>{if(E(!1),W.current=``,n)return;let e=N.current;if(e>=20)return;let t=Math.min(h*2**e,3e4);N.current=e+1,M.current=setTimeout(i,t)},e.onerror=()=>e.close(),k.current=e}return i(),()=>{n=!0,M.current&&clearTimeout(M.current),Y(),k.current?.close(),k.current=null,B.current.clear()}},[t,Q,e,Y,K,h,Z,$,f]),{clearMessages:se,connected:T,messages:ae,sendMessage:ce,setMessages:w,syncedChannelName:oe,syncMessages:$}}export{u as n,m as t};
@@ -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,W as a,_ as o,b as s,g as c,h as l,o as u,t as d,v as f,x as p,y as m}from"./useAppStore-Pjif7nCR.js";import{a as h}from"./i18n-DKsg67mH.js";import{a as g,i as _,r as v}from"./index-CCU5Z4K-.js";import{t as y}from"./AppTop-iPNi3cv5.js";import{t as b}from"./channelApi-DA2GY-k4.js";import{t as x}from"./useChannelMessages-Ea1I0HsF.js";var S=r(`spade`,[[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5`,key:`1aw2pz`}]]),C=r(`swords`,[[`polyline`,{points:`14.5 17.5 3 6 3 3 6 3 17.5 14.5`,key:`1hfsw2`}],[`line`,{x1:`13`,x2:`19`,y1:`19`,y2:`13`,key:`1vrmhu`}],[`line`,{x1:`16`,x2:`20`,y1:`16`,y2:`20`,key:`1bron3`}],[`line`,{x1:`19`,x2:`21`,y1:`21`,y2:`19`,key:`13pww6`}],[`polyline`,{points:`14.5 6.5 18 3 21 3 21 6 17.5 9.5`,key:`hbey2j`}],[`line`,{x1:`5`,x2:`9`,y1:`14`,y2:`18`,key:`1hf58s`}],[`line`,{x1:`7`,x2:`4`,y1:`17`,y2:`20`,key:`pidxm4`}],[`line`,{x1:`3`,x2:`5`,y1:`19`,y2:`21`,key:`1pehsh`}]]),w=n(),T=[{id:`gandengyan`,labelKey:`game.gandengyan.title`,href:`/game/gandengyan/`,icon:(0,w.jsx)(C,{size:16})},{id:`zhajinhua`,labelKey:`game.zhajinhua.title`,href:`/game/zhajinhua/`,icon:(0,w.jsx)(S,{size:16})}];function E({activeGame:e,closeSidebar:t}){let{t:n}=h();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y,{onNavigate:t}),(0,w.jsx)(`nav`,{className:`sidebar-nav`,children:T.map(r=>(0,w.jsxs)(a,{to:r.href,className:`sidebar-nav-btn ${e===r.id?`active`:``}`,onClick:t,children:[r.icon,(0,w.jsx)(`span`,{children:n(r.labelKey)})]},r.id))})]})}var D=t(e(),1),O=`game`,k=`mostbox.game.event`,A=[`gandengyan`,`zhajinhua`],j=`ABCDEFGHJKLMNPQRSTUVWXYZ23456789`;function M(e){let t=String(e||``).trim().toLowerCase();return A.includes(t)?t:``}function N(e){return m(e)}function P(e){return/^[A-Z0-9]{4,8}$/.test(String(e||``))}function F(){let e=``;for(let t=0;t<6;t++)e+=j[s(32)];return e}function I(e,t){let n=M(e),r=N(t);return!n||!P(r)?``:`game.${n}.${r.toLowerCase()}`}function L({gameId:e,roomCode:t,event:n,payload:r}){let i=M(e);return{kind:k,version:1,gameId:i,roomCode:N(t),event:String(n||``),eventId:l(i||`game`),payload:r||{}}}function R(e,t={}){try{let n=JSON.parse(String(e||``));if(!n||n.kind!==`mostbox.game.event`||n.version!==1||typeof n.event!=`string`||typeof n.eventId!=`string`)return null;let r=M(n.gameId),i=N(n.roomCode);return!r||!P(i)||t.gameId&&r!==M(t.gameId)||t.roomCode&&i!==N(t.roomCode)?null:{...n,gameId:r,roomCode:i,payload:n.payload&&typeof n.payload==`object`?n.payload:{}}}catch{return null}}function z(e=[],t={}){let n=[],r=new Map,i=``;for(let a of U(e)){let e=R(a.content,t);if(e){if(e.event===`room:create`){let t=V(e.payload?.player,a);if(!t)continue;i||=t.address,H(n,r,t);continue}if(e.event===`player:join`){let t=V(e.payload?.player,a);t&&H(n,r,t);continue}if(e.event===`player:leave`){let t=c(e.payload?.player?.address||a.author);if(t){let e=n.findIndex(e=>e.address===t);e!==-1&&(n.splice(e,1),r.delete(t))}}}}return{gameId:M(t.gameId),roomCode:N(t.roomCode),hostAddress:i,players:n}}function B(e=[],t={}){let n=null;for(let r of U(e)){let e=R(r.content,t);if(!e||e.event!==`room:state`)continue;let i=Number(e.payload?.seq||0);(!n||i>=Number(n.payload?.seq||0))&&(n=e)}return n}function V(e,t){if(!e||typeof e!=`object`)return null;let n=t&&typeof t==`object`?t:{author:t},r=n.author,i=c(e.address||r);if(!i||c(r)!==i)return null;let a=f(n.authorName||e.name,p(i)),s=o(n.avatar||e.avatar),l={address:i,name:a,publicKey:String(e.publicKey||``).trim(),joinedAt:Number(e.joinedAt||Date.now())};return s&&(l.avatar=s),l}function H(e,t,n){let r=t.get(n.address);if(r){Object.assign(r,n);return}e.push(n),t.set(n.address,n)}function U(e){return[...e].sort((e,t)=>Number(e.timestamp||0)-Number(t.timestamp||0))}function W({gameId:e,onError:t,getPlayerPayload:n}){let{t:r}=h(),a=d(e=>e.hasBackend),o=d(e=>e.checkBackend),s=d(e=>e.openConnectModal),l=i(e=>e.identity),f=i(e=>e.openLoginModal),[p,m]=(0,D.useState)(``),[g,_]=(0,D.useState)(``),[y,S]=(0,D.useState)([]),[C,w]=(0,D.useState)(!1),T=(0,D.useRef)(g);T.current=g;let E=a===!0,k=(0,D.useMemo)(()=>l?{...v(l),profileUpdatedAt:l.profileUpdatedAt}:{},[l?.avatar,l?.displayName,l?.profileUpdatedAt,l?.username]),A=(0,D.useCallback)(async(e,n)=>{let r=await u(e,n);t&&t(r)},[t]),j=(0,D.useCallback)(async(e=T.current)=>{if(!e||!E)return S([]),[];try{let t=await b.getChannelPresence(e);return T.current===e?(S(t),t):[]}catch(e){return console.warn(`[Game] Failed to fetch channel presence:`,e instanceof Error?e.message:e),[]}},[E]),M=(0,D.useCallback)((e,t)=>{if(e!==`channel:presence`)return;let n=String(t?.channelKey||t?.channel||``).trim(),r=T.current;r&&(!n||n===r)&&j(r)},[j]),P=(0,D.useCallback)(t=>!!R(t.content,{gameId:e,roomCode:p}),[e,p]),z=(0,D.useCallback)(t=>{let n=R(t.content,{gameId:e,roomCode:p});return n?`${t.author}-${n.eventId}`:`${t.author}-${t.timestamp}-${t.content}`},[e,p]),{clearMessages:B,connected:V,messages:H,sendMessage:U,syncMessages:W}=x({isReady:E,enabled:!!l,channelName:g,limit:500,acceptMessage:P,getMessageKey:z,onSyncError:e=>A(e,r(`game.room.error.readLog`)),onSocketEvent:M,onReconnect:()=>{j()},presenceEnabled:!!(g&&l),presenceProfile:k});(0,D.useEffect)(()=>{if(!g||!E){S([]);return}j(g)},[g,E,j]);let K=(0,D.useMemo)(()=>H.map(t=>({message:t,event:R(t.content,{gameId:e,roomCode:p})})).filter(e=>e.event),[e,H,p]),J=(0,D.useMemo)(()=>{let e=new Map;return y.forEach(t=>{let n=c(t.address);!n||!t.online||e.set(n,t)}),e},[y]),Y=(0,D.useMemo)(()=>new Set(J.keys()),[J]),X=(0,D.useCallback)(()=>l?E?!0:(s(),!1):(f(),!1),[E,s,f,l]);(0,D.useEffect)(()=>{a===null&&o()},[o,a]);let Z=(0,D.useCallback)(async(i,a=!1)=>{if(!X()||!l)return!1;let o=a?F():N(i),s=I(e,o);if(!s)return t&&t(r(`game.room.error.invalidCode`)),!1;w(!0);try{let t=await b.createChannel(s,O,v(l)),r=t.channelKey||t.key||s;return await G(r,l,e,o,a?`room:create`:`player:join`,{player:q(l,n?.(l))}),m(o),_(r),B(),!0}catch(e){return await A(e,r(a?`game.room.error.createFailed`:`game.room.error.joinFailed`)),!1}finally{w(!1)}},[X,e,n,t,A,B,r,l]);return{channelName:g,channelPresence:y,connected:V,createRoom:(0,D.useCallback)(()=>Z(``,!0),[Z]),ensureReady:X,isBackendReady:E,joinRoom:(0,D.useCallback)(e=>Z(e),[Z]),joining:C,messages:H,onlineAddresses:Y,presenceByAddress:J,roomCode:p,roomEvents:K,sendRoomEvent:(0,D.useCallback)(async(t,n={})=>{if(!X()||!l||!g||!p)return!1;let i=L({gameId:e,roomCode:p,event:t,payload:n}),a=JSON.stringify(i);try{return await U({channelName:g,content:a,optimisticId:`${l.address}-${i.eventId}`}),!0}catch(e){return await A(e,r(`game.room.error.sendEventFailed`)),!1}},[g,X,e,A,p,U,r,l]),setRoomCode:m,syncMessages:W,userIdentity:l}}async function G(e,t,n,r,i,a){let o=L({gameId:n,roomCode:r,event:i,payload:a});await b.sendChannelMessage({channelName:e,content:JSON.stringify(o),...g(t)})}function K(e){return{address:e.address,name:_(e),avatar:e.avatar||``,publicKey:``,joinedAt:Date.now()}}function q(e,t={}){let n=K(e),r={...n,...t};return Object.prototype.hasOwnProperty.call(t,`avatar`)||(r.avatar=n.avatar),r}export{S as a,E as i,z as n,B as r,W as t};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,W as a,_ as o,b as s,g as c,h as l,o as u,t as d,v as f,x as p,y as m}from"./useAppStore-Pjif7nCR.js";import{a as h}from"./i18n-BPfshhQc.js";import{a as g,i as _,r as v}from"./index-AZPpawN1.js";import{t as y}from"./AppTop-DydClKUv.js";import{t as b}from"./channelApi-DA2GY-k4.js";import{t as x}from"./useChannelMessages-ncgJxjR8.js";var S=r(`spade`,[[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5`,key:`1aw2pz`}]]),C=r(`swords`,[[`polyline`,{points:`14.5 17.5 3 6 3 3 6 3 17.5 14.5`,key:`1hfsw2`}],[`line`,{x1:`13`,x2:`19`,y1:`19`,y2:`13`,key:`1vrmhu`}],[`line`,{x1:`16`,x2:`20`,y1:`16`,y2:`20`,key:`1bron3`}],[`line`,{x1:`19`,x2:`21`,y1:`21`,y2:`19`,key:`13pww6`}],[`polyline`,{points:`14.5 6.5 18 3 21 3 21 6 17.5 9.5`,key:`hbey2j`}],[`line`,{x1:`5`,x2:`9`,y1:`14`,y2:`18`,key:`1hf58s`}],[`line`,{x1:`7`,x2:`4`,y1:`17`,y2:`20`,key:`pidxm4`}],[`line`,{x1:`3`,x2:`5`,y1:`19`,y2:`21`,key:`1pehsh`}]]),w=n(),T=[{id:`gandengyan`,labelKey:`game.gandengyan.title`,href:`/game/gandengyan/`,icon:(0,w.jsx)(C,{size:16})},{id:`zhajinhua`,labelKey:`game.zhajinhua.title`,href:`/game/zhajinhua/`,icon:(0,w.jsx)(S,{size:16})}];function E({activeGame:e,closeSidebar:t}){let{t:n}=h();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y,{onNavigate:t}),(0,w.jsx)(`nav`,{className:`sidebar-nav`,children:T.map(r=>(0,w.jsxs)(a,{to:r.href,className:`sidebar-nav-btn ${e===r.id?`active`:``}`,onClick:t,children:[r.icon,(0,w.jsx)(`span`,{children:n(r.labelKey)})]},r.id))})]})}var D=t(e(),1),O=`game`,k=`mostbox.game.event`,A=[`gandengyan`,`zhajinhua`],j=`ABCDEFGHJKLMNPQRSTUVWXYZ23456789`;function M(e){let t=String(e||``).trim().toLowerCase();return A.includes(t)?t:``}function N(e){return m(e)}function P(e){return/^[A-Z0-9]{4,8}$/.test(String(e||``))}function F(){let e=``;for(let t=0;t<6;t++)e+=j[s(32)];return e}function I(e,t){let n=M(e),r=N(t);return!n||!P(r)?``:`game.${n}.${r.toLowerCase()}`}function L({gameId:e,roomCode:t,event:n,payload:r}){let i=M(e);return{kind:k,version:1,gameId:i,roomCode:N(t),event:String(n||``),eventId:l(i||`game`),payload:r||{}}}function R(e,t={}){try{let n=JSON.parse(String(e||``));if(!n||n.kind!==`mostbox.game.event`||n.version!==1||typeof n.event!=`string`||typeof n.eventId!=`string`)return null;let r=M(n.gameId),i=N(n.roomCode);return!r||!P(i)||t.gameId&&r!==M(t.gameId)||t.roomCode&&i!==N(t.roomCode)?null:{...n,gameId:r,roomCode:i,payload:n.payload&&typeof n.payload==`object`?n.payload:{}}}catch{return null}}function z(e=[],t={}){let n=[],r=new Map,i=``;for(let a of U(e)){let e=R(a.content,t);if(e){if(e.event===`room:create`){let t=V(e.payload?.player,a);if(!t)continue;i||=t.address,H(n,r,t);continue}if(e.event===`player:join`){let t=V(e.payload?.player,a);t&&H(n,r,t);continue}if(e.event===`player:leave`){let t=c(e.payload?.player?.address||a.author);if(t){let e=n.findIndex(e=>e.address===t);e!==-1&&(n.splice(e,1),r.delete(t))}}}}return{gameId:M(t.gameId),roomCode:N(t.roomCode),hostAddress:i,players:n}}function B(e=[],t={}){let n=null;for(let r of U(e)){let e=R(r.content,t);if(!e||e.event!==`room:state`)continue;let i=Number(e.payload?.seq||0);(!n||i>=Number(n.payload?.seq||0))&&(n=e)}return n}function V(e,t){if(!e||typeof e!=`object`)return null;let n=t&&typeof t==`object`?t:{author:t},r=n.author,i=c(e.address||r);if(!i||c(r)!==i)return null;let a=f(n.authorName||e.name,p(i)),s=o(n.avatar||e.avatar),l={address:i,name:a,publicKey:String(e.publicKey||``).trim(),joinedAt:Number(e.joinedAt||Date.now())};return s&&(l.avatar=s),l}function H(e,t,n){let r=t.get(n.address);if(r){Object.assign(r,n);return}e.push(n),t.set(n.address,n)}function U(e){return[...e].sort((e,t)=>Number(e.timestamp||0)-Number(t.timestamp||0))}function W({gameId:e,onError:t,getPlayerPayload:n}){let{t:r}=h(),a=d(e=>e.hasBackend),o=d(e=>e.checkBackend),s=d(e=>e.openConnectModal),l=i(e=>e.identity),f=i(e=>e.openLoginModal),[p,m]=(0,D.useState)(``),[g,_]=(0,D.useState)(``),[y,S]=(0,D.useState)([]),[C,w]=(0,D.useState)(!1),T=(0,D.useRef)(g);T.current=g;let E=a===!0,k=(0,D.useMemo)(()=>l?{...v(l),profileUpdatedAt:l.profileUpdatedAt}:{},[l?.avatar,l?.displayName,l?.profileUpdatedAt,l?.username]),A=(0,D.useCallback)(async(e,n)=>{let r=await u(e,n);t&&t(r)},[t]),j=(0,D.useCallback)(async(e=T.current)=>{if(!e||!E)return S([]),[];try{let t=await b.getChannelPresence(e);return T.current===e?(S(t),t):[]}catch(e){return console.warn(`[Game] Failed to fetch channel presence:`,e instanceof Error?e.message:e),[]}},[E]),M=(0,D.useCallback)((e,t)=>{if(e!==`channel:presence`)return;let n=String(t?.channelKey||t?.channel||``).trim(),r=T.current;r&&(!n||n===r)&&j(r)},[j]),P=(0,D.useCallback)(t=>!!R(t.content,{gameId:e,roomCode:p}),[e,p]),z=(0,D.useCallback)(t=>{let n=R(t.content,{gameId:e,roomCode:p});return n?`${t.author}-${n.eventId}`:`${t.author}-${t.timestamp}-${t.content}`},[e,p]),{clearMessages:B,connected:V,messages:H,sendMessage:U,syncMessages:W}=x({isReady:E,enabled:!!l,channelName:g,limit:500,acceptMessage:P,getMessageKey:z,onSyncError:e=>A(e,r(`game.room.error.readLog`)),onSocketEvent:M,onReconnect:()=>{j()},presenceEnabled:!!(g&&l),presenceProfile:k});(0,D.useEffect)(()=>{if(!g||!E){S([]);return}j(g)},[g,E,j]);let K=(0,D.useMemo)(()=>H.map(t=>({message:t,event:R(t.content,{gameId:e,roomCode:p})})).filter(e=>e.event),[e,H,p]),J=(0,D.useMemo)(()=>{let e=new Map;return y.forEach(t=>{let n=c(t.address);!n||!t.online||e.set(n,t)}),e},[y]),Y=(0,D.useMemo)(()=>new Set(J.keys()),[J]),X=(0,D.useCallback)(()=>l?E?!0:(s(),!1):(f(),!1),[E,s,f,l]);(0,D.useEffect)(()=>{a===null&&o()},[o,a]);let Z=(0,D.useCallback)(async(i,a=!1)=>{if(!X()||!l)return!1;let o=a?F():N(i),s=I(e,o);if(!s)return t&&t(r(`game.room.error.invalidCode`)),!1;w(!0);try{let t=await b.createChannel(s,O,v(l)),r=t.channelKey||t.key||s;return await G(r,l,e,o,a?`room:create`:`player:join`,{player:q(l,n?.(l))}),m(o),_(r),B(),!0}catch(e){return await A(e,r(a?`game.room.error.createFailed`:`game.room.error.joinFailed`)),!1}finally{w(!1)}},[X,e,n,t,A,B,r,l]);return{channelName:g,channelPresence:y,connected:V,createRoom:(0,D.useCallback)(()=>Z(``,!0),[Z]),ensureReady:X,isBackendReady:E,joinRoom:(0,D.useCallback)(e=>Z(e),[Z]),joining:C,messages:H,onlineAddresses:Y,presenceByAddress:J,roomCode:p,roomEvents:K,sendRoomEvent:(0,D.useCallback)(async(t,n={})=>{if(!X()||!l||!g||!p)return!1;let i=L({gameId:e,roomCode:p,event:t,payload:n}),a=JSON.stringify(i);try{return await U({channelName:g,content:a,optimisticId:`${l.address}-${i.eventId}`}),!0}catch(e){return await A(e,r(`game.room.error.sendEventFailed`)),!1}},[g,X,e,A,p,U,r,l]),setRoomCode:m,syncMessages:W,userIdentity:l}}async function G(e,t,n,r,i,a){let o=L({gameId:n,roomCode:r,event:i,payload:a});await b.sendChannelMessage({channelName:e,content:JSON.stringify(o),...g(t)})}function K(e){return{address:e.address,name:_(e),avatar:e.avatar||``,publicKey:``,joinedAt:Date.now()}}function q(e,t={}){let n=K(e),r={...n,...t};return Object.prototype.hasOwnProperty.call(t,`avatar`)||(r.avatar=n.avatar),r}export{S as a,E as i,z as n,B as r,W as t};
Binary file
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html lang="zh-CN" data-scroll-behavior="smooth"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="stylesheet" href="/assets/index-FEwag7ej.css" data-precedence="default"/><title>下载 MostBox 客户端</title><meta name="theme-color" content="#5e6ad2"/><meta name="description" content="下载 MostBox 桌面或 Android 客户端,获得 P2P 文件分享、下载校验和持续做种能力"/><link rel="modulepreload" href="/assets/index-CCU5Z4K-.js"/><link rel="modulepreload" href="/assets/jsx-runtime-Bt-cYkS5.js"/><link rel="modulepreload" href="/assets/useAppStore-Pjif7nCR.js"/><link rel="modulepreload" href="/assets/useNavigate-DWlBD_-b.js"/><link rel="modulepreload" href="/assets/i18n-DKsg67mH.js"/><link rel="icon" href="/logo.svg" type="image/svg+xml"/><script>
1
+ <!DOCTYPE html><html lang="zh-CN" data-scroll-behavior="smooth"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="stylesheet" href="/assets/index-BP12tZtg.css" data-precedence="default"/><title>下载 MostBox 客户端</title><meta name="theme-color" content="#5e6ad2"/><meta name="description" content="下载 MostBox 桌面或 Android 客户端,获得 P2P 文件分享、下载校验和持续做种能力"/><link rel="modulepreload" href="/assets/index-AZPpawN1.js"/><link rel="modulepreload" href="/assets/jsx-runtime-Bt-cYkS5.js"/><link rel="modulepreload" href="/assets/useAppStore-Pjif7nCR.js"/><link rel="modulepreload" href="/assets/useNavigate-DWlBD_-b.js"/><link rel="modulepreload" href="/assets/i18n-BPfshhQc.js"/><link rel="icon" href="/logo.svg" type="image/svg+xml"/><script>
2
2
  (function() {
3
3
  var theme = localStorage.getItem('theme');
4
4
  var resolvedTheme = theme === 'dark' || (!theme && window.matchMedia('(prefers-color-scheme: dark)').matches)
@@ -18,4 +18,4 @@
18
18
  window.onunhandledrejection = function(event) {
19
19
  console.error('[Unhandled Promise Rejection]', event.reason);
20
20
  };
21
- </script><!--$--><div class="download-page"><nav class="mkt-nav"><div class="mkt-nav-inner"><button type="button" class="mkt-nav-logo"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-left" aria-hidden="true"><path d="m12 19-7-7 7-7"></path><path d="M19 12H5"></path></svg><span>MOST PEOPLE</span></button><div class="mkt-nav-cta"><button type="button" class="btn btn-icon" title="切换外观" aria-label="切换外观" aria-pressed="false"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button><span class="ui-action-menu-anchor language-toggle"><button type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="_R_2heb6_" class="btn btn-icon" title="选择语言" aria-label="选择语言"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages" aria-hidden="true"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg></button></span><a title="个人资料" aria-label="个人资料" href="/profile/" class="account-profile-link"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg></a></div></div></nav><section class="download-hero"><div class="mkt-container"><div class="download-hero-icon"><svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg></div><h1 class="download-hero-title">下载客户端</h1><p class="download-hero-desc">桌面客户端内置本地 P2P 节点,提供发布、下载校验和持续做种的完整能力;Android Alpha 支持前台聊天附件、下载校验和做种。Web 端只连接已有 MostBox 节点。</p></div></section><section class="download-platforms"><div class="mkt-container"><h2 class="download-section-title">选择你的平台</h2><div class="download-options"><div class="ui-segmented-control download-source-tabs" role="tablist" aria-label="下载来源"><button type="button" role="tab" aria-selected="false" disabled="" class="ui-segmented-option download-source-tab"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud" aria-hidden="true"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path></svg>Cloudflare R2</button><button type="button" role="tab" aria-selected="true" class="ui-segmented-option download-source-tab is-active"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code" aria-hidden="true"><path d="m16 18 6-6-6-6"></path><path d="m8 6-6 6 6 6"></path></svg>GitHub Releases</button></div><p class="download-source-note">正在获取 Cloudflare R2 高速镜像。</p><div class="download-current-platform" aria-label="当前系统"><article class="download-current-card"><div class="download-current-main"><div class="download-current-icon"><svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-monitor" aria-hidden="true"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg></div><div class="download-current-copy"><div class="download-current-labels"><span class="download-current-kicker"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-check" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><path d="m9 12 2 2 4-4"></path></svg>当前系统</span><span class="download-current-recommended">推荐下载</span></div><div class="download-current-heading"><h3>Windows</h3><span>x64</span></div><p>Windows 10 或更高版本</p><dl class="download-current-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl></div></div><div class="download-current-actions"><span>已匹配你的设备</span><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .exe</a><p>GitHub Releases</p></div></article></div><div class="download-other-platforms"><p class="download-other-platforms-title">其他可下载客户端</p><div class="download-platform-grid"><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-monitor" aria-hidden="true"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Windows</h3><span>arm64</span></div><p>Windows 10 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .exe</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-apple" aria-hidden="true"><path d="M12 6.528V3a1 1 0 0 1 1-1h0"></path><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"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>macOS</h3><span>x64</span></div><p>macOS 12 Monterey 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .dmg</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-apple" aria-hidden="true"><path d="M12 6.528V3a1 1 0 0 1 1-1h0"></path><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"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>macOS</h3><span>arm64</span></div><p>macOS 12 Monterey 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .dmg</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-laptop" aria-hidden="true"><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"></path><path d="M20.054 15.987H3.946"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Linux</h3><span>x64</span></div><p>Ubuntu 20.04+ / Debian 11+ / 其他主流发行版</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .AppImage</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-laptop" aria-hidden="true"><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"></path><path d="M20.054 15.987H3.946"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Linux</h3><span>arm64</span></div><p>Ubuntu 20.04+ / Debian 11+ / 其他主流发行版</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .AppImage</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-tablet-smartphone" aria-hidden="true"><rect width="10" height="14" x="3" y="8" rx="2"></rect><path d="M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4"></path><path d="M8 18h.01"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Android</h3><span>universal</span></div><p>Android Alpha APK,支持前台聊天附件、下载校验和做种</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .apk</a></div></div></article></div><div class="download-coming-soon"><p class="download-coming-soon-title">移动端</p><div class="download-coming-soon-grid"><article class="download-coming-soon-card"><div class="download-platform-icon download-coming-soon-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-smartphone" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>iOS</h3><span>敬请期待</span></div><p>iPhone / iPad 客户端规划中</p></div></article></div></div></div></div></div></section><section class="download-comparison"><div class="mkt-container"><h2 class="download-section-title">Web 端 vs 桌面端</h2><div class="download-table-wrap"><table class="download-table"><thead><tr><th>功能</th><th>Web 端</th><th>桌面端</th></tr></thead><tbody><tr><td>节点能力</td><td class="col-web">连接已有节点</td><td class="col-desktop">内置本地节点</td></tr><tr><td>P2P 文件分享</td><td class="col-web">依赖所连节点</td><td class="col-desktop">完整支持</td></tr><tr><td>下载校验</td><td class="col-web">依赖所连节点</td><td class="col-desktop">完整支持</td></tr><tr><td>持续做种</td><td class="col-web">依赖所连节点</td><td class="col-desktop">默认开启</td></tr><tr><td>大文件传输</td><td class="col-web">依赖所连节点</td><td class="col-desktop">10GB 上限内</td></tr></tbody></table></div></div></section><section class="download-cta"><div class="mkt-container"><p class="download-hero-desc">使用 npm 入口请先安装 Node.js &gt;= 22.12,然后运行 npx most-box@latest 启动本机完整节点。</p></div></section><section class="download-cta"><div class="mkt-container"><a href="/" class="btn btn-primary">回首页</a></div></section><footer class="mkt-footer"><div class="mkt-container"><div class="mkt-footer-inner"><p class="mkt-footer-copy">MostBox</p></div></div></footer></div><script>(function(a,f){let l;try{l=JSON.parse(sessionStorage.getItem(a)||"{}")}catch{return}const n=l?.[f||history.state?.__TSR_key];let c=!1;for(const t in n){const e=n[t],o=e?.scrollX,s=e?.scrollY;if(Number.isFinite(o)&&Number.isFinite(s)){if(t==="window")scrollTo(o,s),c=!0;else if(t)try{const r=document.querySelector(t);r&&(r.scrollLeft=o,r.scrollTop=s)}catch{}}}if(c)return;const i=location.hash.slice(1);if(i){const t=history.state?.__hashScrollIntoViewOptions??!0;if(t){const e=document.getElementById(i);e&&e.scrollIntoView(t)}return}scrollTo(0,0)})("tsr-scroll-restoration-v1_3");document.currentScript.remove()</script><!--/$--><script class="$tsr" id="$tsr-stream-barrier">(self.$R=self.$R||{})["tsr"]=[];self.$_TSR={h(){this.hydrated=!0,this.c()},e(){this.streamEnded=!0,this.c()},c(){this.hydrated&&this.streamEnded&&(delete self.$_TSR,delete self.$R.tsr)},p(e){this.initialized?e():this.buffer.push(e)},buffer:[]};$_TSR.router=($R=>$R[0]={manifest:$R[1]={routes:$R[2]={__root__:$R[3]={preloads:$R[4]=["/assets/index-CCU5Z4K-.js","/assets/jsx-runtime-Bt-cYkS5.js","/assets/useAppStore-Pjif7nCR.js","/assets/useNavigate-DWlBD_-b.js","/assets/i18n-DKsg67mH.js"],scripts:$R[5]=[$R[6]={attrs:$R[7]={type:"module",async:!0,src:"/assets/index-CCU5Z4K-.js"}}],css:$R[8]=["/assets/index-FEwag7ej.css"]}}},matches:$R[9]=[$R[10]={i:"__root__",u:1783082754537,s:"success",ssr:!0},$R[11]={i:"downloaddownload",u:1783082754539,s:"success",ssr:!0}],lastMatchId:"downloaddownload"})($R["tsr"]);$_TSR.e();document.currentScript.remove()</script><script type="module" async="" src="/assets/index-CCU5Z4K-.js"></script></body></html>
21
+ </script><!--$--><div class="download-page"><nav class="mkt-nav"><div class="mkt-nav-inner"><button type="button" class="mkt-nav-logo"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-left" aria-hidden="true"><path d="m12 19-7-7 7-7"></path><path d="M19 12H5"></path></svg><span>MOST PEOPLE</span></button><div class="mkt-nav-cta"><button type="button" class="btn btn-icon" title="切换外观" aria-label="切换外观" aria-pressed="false"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button><span class="ui-action-menu-anchor language-toggle"><button type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="_R_2heb6_" class="btn btn-icon" title="选择语言" aria-label="选择语言"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages" aria-hidden="true"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg></button></span><a title="个人资料" aria-label="个人资料" href="/profile/" class="account-profile-link"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg></a></div></div></nav><section class="download-hero"><div class="mkt-container"><div class="download-hero-icon"><svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg></div><h1 class="download-hero-title">下载客户端</h1><p class="download-hero-desc">桌面客户端内置本地 P2P 节点,提供发布、下载校验和持续做种的完整能力;Android Alpha 支持前台聊天附件、下载校验和做种。Web 端只连接已有 MostBox 节点。</p></div></section><section class="download-platforms"><div class="mkt-container"><h2 class="download-section-title">选择你的平台</h2><div class="download-options"><div class="ui-segmented-control download-source-tabs" role="tablist" aria-label="下载来源"><button type="button" role="tab" aria-selected="false" disabled="" class="ui-segmented-option download-source-tab"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud" aria-hidden="true"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path></svg>Cloudflare R2</button><button type="button" role="tab" aria-selected="true" class="ui-segmented-option download-source-tab is-active"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code" aria-hidden="true"><path d="m16 18 6-6-6-6"></path><path d="m8 6-6 6 6 6"></path></svg>GitHub Releases</button></div><p class="download-source-note">正在获取 Cloudflare R2 高速镜像。</p><div class="download-current-platform" aria-label="当前系统"><article class="download-current-card"><div class="download-current-main"><div class="download-current-icon"><svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-monitor" aria-hidden="true"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg></div><div class="download-current-copy"><div class="download-current-labels"><span class="download-current-kicker"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-check" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><path d="m9 12 2 2 4-4"></path></svg>当前系统</span><span class="download-current-recommended">推荐下载</span></div><div class="download-current-heading"><h3>Windows</h3><span>x64</span></div><p>Windows 10 或更高版本</p><dl class="download-current-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl></div></div><div class="download-current-actions"><span>已匹配你的设备</span><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .exe</a><p>GitHub Releases</p></div></article></div><div class="download-other-platforms"><p class="download-other-platforms-title">其他可下载客户端</p><div class="download-platform-grid"><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-monitor" aria-hidden="true"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Windows</h3><span>arm64</span></div><p>Windows 10 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .exe</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-apple" aria-hidden="true"><path d="M12 6.528V3a1 1 0 0 1 1-1h0"></path><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"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>macOS</h3><span>x64</span></div><p>macOS 12 Monterey 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .dmg</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-apple" aria-hidden="true"><path d="M12 6.528V3a1 1 0 0 1 1-1h0"></path><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"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>macOS</h3><span>arm64</span></div><p>macOS 12 Monterey 或更高版本</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .dmg</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-laptop" aria-hidden="true"><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"></path><path d="M20.054 15.987H3.946"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Linux</h3><span>x64</span></div><p>Ubuntu 20.04+ / Debian 11+ / 其他主流发行版</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .AppImage</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-laptop" aria-hidden="true"><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"></path><path d="M20.054 15.987H3.946"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Linux</h3><span>arm64</span></div><p>Ubuntu 20.04+ / Debian 11+ / 其他主流发行版</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .AppImage</a></div></div></article><article class="download-platform-card"><div class="download-platform-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-tablet-smartphone" aria-hidden="true"><rect width="10" height="14" x="3" y="8" rx="2"></rect><path d="M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4"></path><path d="M8 18h.01"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>Android</h3><span>universal</span></div><p>Android Alpha APK,支持前台聊天附件、下载校验和做种</p><dl class="download-platform-meta"><div><dt>来源</dt><dd>GitHub Releases</dd></div></dl><div class="download-platform-actions"><a href="https://github.com/most-people/most/releases/latest" class="btn btn-primary"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载 .apk</a></div></div></article></div><div class="download-coming-soon"><p class="download-coming-soon-title">移动端</p><div class="download-coming-soon-grid"><article class="download-coming-soon-card"><div class="download-platform-icon download-coming-soon-icon"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-smartphone" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path></svg></div><div class="download-platform-content"><div class="download-platform-heading"><h3>iOS</h3><span>敬请期待</span></div><p>iPhone / iPad 客户端规划中</p></div></article></div></div></div></div></div></section><section class="download-comparison"><div class="mkt-container"><h2 class="download-section-title">Web 端 vs 桌面端</h2><div class="download-table-wrap"><table class="download-table"><thead><tr><th>功能</th><th>Web 端</th><th>桌面端</th></tr></thead><tbody><tr><td>节点能力</td><td class="col-web">连接已有节点</td><td class="col-desktop">内置本地节点</td></tr><tr><td>P2P 文件分享</td><td class="col-web">依赖所连节点</td><td class="col-desktop">完整支持</td></tr><tr><td>下载校验</td><td class="col-web">依赖所连节点</td><td class="col-desktop">完整支持</td></tr><tr><td>持续做种</td><td class="col-web">依赖所连节点</td><td class="col-desktop">默认开启</td></tr><tr><td>大文件传输</td><td class="col-web">依赖所连节点</td><td class="col-desktop">10GB 上限内</td></tr></tbody></table></div></div></section><section class="download-cta"><div class="mkt-container"><p class="download-hero-desc">使用 npm 入口请先安装 Node.js &gt;= 22.12,然后运行 npx most-box@latest 启动本机完整节点。</p></div></section><section class="download-cta"><div class="mkt-container"><a href="/" class="btn btn-primary">回首页</a></div></section><footer class="mkt-footer"><div class="mkt-container"><div class="mkt-footer-inner"><p class="mkt-footer-copy">MostBox</p></div></div></footer></div><script>(function(a,f){let l;try{l=JSON.parse(sessionStorage.getItem(a)||"{}")}catch{return}const n=l?.[f||history.state?.__TSR_key];let c=!1;for(const t in n){const e=n[t],o=e?.scrollX,s=e?.scrollY;if(Number.isFinite(o)&&Number.isFinite(s)){if(t==="window")scrollTo(o,s),c=!0;else if(t)try{const r=document.querySelector(t);r&&(r.scrollLeft=o,r.scrollTop=s)}catch{}}}if(c)return;const i=location.hash.slice(1);if(i){const t=history.state?.__hashScrollIntoViewOptions??!0;if(t){const e=document.getElementById(i);e&&e.scrollIntoView(t)}return}scrollTo(0,0)})("tsr-scroll-restoration-v1_3");document.currentScript.remove()</script><!--/$--><script class="$tsr" id="$tsr-stream-barrier">(self.$R=self.$R||{})["tsr"]=[];self.$_TSR={h(){this.hydrated=!0,this.c()},e(){this.streamEnded=!0,this.c()},c(){this.hydrated&&this.streamEnded&&(delete self.$_TSR,delete self.$R.tsr)},p(e){this.initialized?e():this.buffer.push(e)},buffer:[]};$_TSR.router=($R=>$R[0]={manifest:$R[1]={routes:$R[2]={__root__:$R[3]={preloads:$R[4]=["/assets/index-AZPpawN1.js","/assets/jsx-runtime-Bt-cYkS5.js","/assets/useAppStore-Pjif7nCR.js","/assets/useNavigate-DWlBD_-b.js","/assets/i18n-BPfshhQc.js"],scripts:$R[5]=[$R[6]={attrs:$R[7]={type:"module",async:!0,src:"/assets/index-AZPpawN1.js"}}],css:$R[8]=["/assets/index-BP12tZtg.css"]}}},matches:$R[9]=[$R[10]={i:"__root__",u:1783416011668,s:"success",ssr:!0},$R[11]={i:"downloaddownload",u:1783416011671,s:"success",ssr:!0}],lastMatchId:"downloaddownload"})($R["tsr"]);$_TSR.e();document.currentScript.remove()</script><script type="module" async="" src="/assets/index-AZPpawN1.js"></script></body></html>
Binary file
Binary file
Binary file