most-box 0.3.7 → 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.
- package/README.md +12 -12
- package/electron/main.js +1 -1
- package/out/about/index.html +6 -5
- package/out/admin/index.html +0 -0
- package/out/app/index.html +0 -0
- package/out/assets/AccountMenu-BpUGPUSa.js +1 -0
- package/out/assets/{AppShell-CKP_dglR.js → AppShell-kfQyRhZy.js} +1 -1
- package/out/assets/{AppTop-C03PsDr_.js → AppTop-DydClKUv.js} +1 -1
- package/out/assets/{CopyButton-ClwBN6Iy.js → CopyButton-BN_vYKM8.js} +1 -1
- package/out/assets/{MarketingHeader-ChTIIzXG.js → MarketingHeader-B0jpxRYu.js} +1 -1
- package/out/assets/MarketingLayout-D42kTRyf.js +1 -0
- package/out/assets/{MilkdownEditor-X9MUH_0q.js → MilkdownEditor-B9vfoUP9.js} +1 -1
- package/out/assets/{OpenSidebarButton-CXBAjjCE.js → OpenSidebarButton-BxKh_O5b.js} +1 -1
- package/out/assets/arrow-right-DcTPIyLV.js +1 -0
- package/out/assets/{arrow-up-down-DvLSz6Ma.js → arrow-up-down-gcWLrYup.js} +1 -1
- package/out/assets/{channelApi-C5eHetoJ.js → channelApi-DA2GY-k4.js} +1 -1
- package/out/assets/{chatJoinInvite-7tuD-STm.js → chatJoinInvite-Cwot1ykh.js} +1 -1
- package/out/assets/{circle-alert-DXVkx8p8.js → circle-alert-Dg9cBJgj.js} +1 -1
- package/out/assets/{copy-OwXDsstV.js → copy-BofKiKH_.js} +1 -1
- package/out/assets/{download-Cy2BlfKM.js → download-nQ9X-v0q.js} +1 -1
- package/out/assets/{downloadValidation-Dd43i9_9.js → downloadValidation-C0PecvKC.js} +1 -1
- package/out/assets/{external-link-D_AQSgxW.js → external-link-LcGMVTLE.js} +1 -1
- package/out/assets/{file-text-zvTER2mN.js → file-text-f1ij7Al1.js} +1 -1
- package/out/assets/{fingerprint-pattern-BT73ASEB.js → fingerprint-pattern-Z6NfIcxC.js} +1 -1
- package/out/assets/{folder-6pYYnS2-.js → folder-DGTODlX0.js} +1 -1
- package/out/assets/{folder-open-DOJ4bB58.js → folder-open-BKTeAP5z.js} +1 -1
- package/out/assets/{gamepad-2-BYqNgCQr.js → gamepad-2-q3ssU_CE.js} +1 -1
- package/out/assets/{hard-drive-DL1KJHmG.js → hard-drive-CMNAmPI5.js} +1 -1
- package/out/assets/i18n-BPfshhQc.js +1 -0
- package/out/assets/{index-DJzLHA0V.js → index-AZPpawN1.js} +7 -6
- package/out/assets/index-BP12tZtg.css +1 -0
- package/out/assets/{index.lazy-DA98XQ0Q.js → index.lazy-1oSrUtEc.js} +1 -1
- package/out/assets/index.lazy-B3eWk7i-.js +1 -0
- package/out/assets/{index.lazy-Cgrv1NmQ.js → index.lazy-BszFGhgk.js} +1 -1
- package/out/assets/{index.lazy-CTLlLPjy.js → index.lazy-CBPOnT1S.js} +1 -1
- package/out/assets/index.lazy-CJVtmxt4.js +1 -0
- package/out/assets/index.lazy-CJlJl0xA.js +1 -0
- package/out/assets/index.lazy-CUZLrlgS.js +2 -0
- package/out/assets/{index.lazy-BEDWJZPP.js → index.lazy-CV52vPw7.js} +1 -1
- package/out/assets/{index.lazy-C0L9TDqK.js → index.lazy-CfmDMCbY.js} +1 -1
- package/out/assets/{index.lazy-B8ud1tpC.js → index.lazy-ClcVulXE.js} +1 -1
- package/out/assets/index.lazy-DRAWcYlR.js +1 -0
- package/out/assets/index.lazy-Duk6GK1e.js +1 -0
- package/out/assets/{index.lazy-C8luNCxY.js → index.lazy-DxIMDfLH.js} +1 -1
- package/out/assets/{index.lazy-CT5TGyGl.js → index.lazy-e02LZDAI.js} +1 -1
- package/out/assets/{index.lazy-psYKmxdW.js → index.lazy-qvhZXEAD.js} +1 -1
- package/out/assets/{loader-C4pED_QP.js → loader-DAMqAKH7.js} +1 -1
- package/out/assets/{lock-yG7M7GkB.js → lock-Cigqt_VP.js} +1 -1
- package/out/assets/messages-square-Dr9v7Ilv.js +1 -0
- package/out/assets/{mp-cEQteKUC.js → mp-CFhRibX9.js} +1 -1
- package/out/assets/{music-Br2x8TKX.js → music-U7NZcQ6S.js} +1 -1
- package/out/assets/{notebook-pen-Bcd3MrtD.js → notebook-pen-CMRWy6ni.js} +1 -1
- package/out/assets/play-B6IGTGxm.js +1 -0
- package/out/assets/plus-C7wBmZvh.js +1 -0
- package/out/assets/{refresh-cw-CfkUlTK9.js → refresh-cw-Bxmcm8cn.js} +1 -1
- package/out/assets/{save-CfYzXcxH.js → save-CQyJvrmI.js} +1 -1
- package/out/assets/{saveLocalFile-DTgdBgO9.js → saveLocalFile-Dsoo9PmH.js} +1 -1
- package/out/assets/search-CURHlVZZ.js +1 -0
- package/out/assets/{send-Bie9hgHI.js → send-yxXCy-t8.js} +1 -1
- package/out/assets/{shield-check-2-h_eEXp.js → shield-check-Cq1PKT30.js} +1 -1
- package/out/assets/{smartphone-CrsocYJo.js → smartphone-D9j5h2Pg.js} +1 -1
- package/out/assets/{trash-2-B9gno5q6.js → trash-2-DQI0V0Rl.js} +1 -1
- package/out/assets/{triangle-alert-BhNtjKm2.js → triangle-alert-D8P4Ikwc.js} +1 -1
- package/out/assets/{upload-BmufnMFu.js → upload-PpzkqJnf.js} +1 -1
- package/out/assets/{useAppStore-DNhyhD20.js → useAppStore-Pjif7nCR.js} +1 -1
- package/out/assets/{useChannelMessages-BrqZa2SG.js → useChannelMessages-ncgJxjR8.js} +1 -1
- package/out/assets/{useGameRoom-B3wvUICl.js → useGameRoom-BHZNzWJt.js} +1 -1
- package/out/assets/{wallet-D6HZocla.js → wallet-Ts6jdQzi.js} +1 -1
- package/out/assets/{wifi-CILQyKk0.js → wifi-B1v_i_dr.js} +1 -1
- package/out/chat/index.html +0 -0
- package/out/chat/join/demo/index.html +0 -0
- package/out/chat/join/index.html +0 -0
- package/out/download/index.html +6 -5
- package/out/game/gandengyan/index.html +0 -0
- package/out/game/index.html +0 -0
- package/out/game/zhajinhua/index.html +0 -0
- package/out/index.html +6 -5
- package/out/note/index.html +0 -0
- package/out/ping/index.html +6 -5
- package/out/profile/index.html +0 -0
- package/out/web3/index.html +0 -0
- package/package.json +2 -1
- package/server/src/core/cid.js +1 -1
- package/server/src/core/zhajinhua.js +0 -88
- package/out/assets/AccountMenu-D_rcXDZr.js +0 -1
- package/out/assets/MarketingLayout-hkPAtieL.js +0 -1
- package/out/assets/arrow-right-BsHzC0ZL.js +0 -1
- package/out/assets/chatNoteDraft-DTy6In5R.js +0 -1
- package/out/assets/i18n-DKsg67mH.js +0 -1
- package/out/assets/index-FEwag7ej.css +0 -1
- package/out/assets/index.lazy-BQ_Dyw5C.js +0 -1
- package/out/assets/index.lazy-CnpeKB4C.js +0 -1
- package/out/assets/index.lazy-CwAN1t6l.js +0 -2
- package/out/assets/index.lazy-Cy249kq1.js +0 -1
- package/out/assets/index.lazy-DYhpVW5B.js +0 -3
- package/out/assets/index.lazy-b811JgFg.js +0 -1
- package/out/assets/message-square-CfApq8Ou.js +0 -1
- package/out/assets/play-DSHtNcOe.js +0 -1
- package/out/assets/search-DLBOUfny.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-DNhyhD20.js";import{a as m}from"./i18n-DKsg67mH.js";import{t as h}from"./fingerprint-pattern-BT73ASEB.js";import{i as g}from"./AccountMenu-D_rcXDZr.js";import{t as _}from"./download-Cy2BlfKM.js";import{t as v}from"./external-link-D_AQSgxW.js";import{n as y,t as b}from"./CopyButton-ClwBN6Iy.js";import{t as x}from"./lock-yG7M7GkB.js";import{t as S}from"./AppShell-CKP_dglR.js";import{t as C}from"./wallet-D6HZocla.js";import{M as w,N as T,P as E,g as ee}from"./index-DJzLHA0V.js";import{t as te}from"./AppTop-C03PsDr_.js";import{n as ne,t as re}from"./mp-cEQteKUC.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-DNhyhD20.js";import{a as ee}from"./i18n-DKsg67mH.js";import{t as te}from"./external-link-D_AQSgxW.js";import{n as ne,t as re}from"./CopyButton-ClwBN6Iy.js";import{t as ie}from"./AppShell-CKP_dglR.js";import{t as ae}from"./refresh-cw-CfkUlTK9.js";import{b as oe}from"./index-DJzLHA0V.js";import{t as se}from"./AppTop-C03PsDr_.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]);export{t};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./jsx-runtime-Bt-cYkS5.js";import{L as t,z as n}from"./useAppStore-
|
|
1
|
+
import{o as e}from"./jsx-runtime-Bt-cYkS5.js";import{L as t,z as n}from"./useAppStore-Pjif7nCR.js";import{t as r}from"./dayjs.min-Dcc0B6Je.js";var i=e(t(),1);r();var a=`0123456789abcdefghijklmnopqrstuvwxyz`,o=e=>{let t=[];for(;e>=128;)t.push(e&127|128),e>>=7;return t.push(e),t},s=e=>{let t=new Uint8Array([8,1,18,...o(e.length)]),n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n},c=(e,t)=>{if(e.length===0)return``;let n=t.length,r=0;for(;r<e.length&&e[r]===0;)r++;let i=[0];for(let t=r;t<e.length;t++){let r=e[t];for(let e=0;e<i.length;e++){let t=i[e]*256+r;i[e]=t%n,r=Math.floor(t/n)}for(;r>0;)i.push(r%n),r=Math.floor(r/n)}let a=``;for(let e=0;e<r;e++)a+=t[0];for(let e=i.length-1;e>=0;e--)a+=t[i[e]];return a},l=(e,t)=>{let r=t.slice(2),a=new Uint8Array(n(e+r));return i.default.sign.keyPair.fromSecretKey(a)},u=(e,t)=>{let n=s(l(e,t).publicKey),r=new Uint8Array(2+n.length);r[0]=0,r[1]=36,r.set(n,2);let i=new Uint8Array([1,114]),o=new Uint8Array(i.length+r.length);return o.set(i,0),o.set(r,i.length),`k`+c(o,a)};export{u as n,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);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{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);export{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-
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`shield-check`,[[`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:`m9 12 2 2 4-4`,key:`dzmm74`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),n=e(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]);export{t as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e}from"./useAppStore-
|
|
1
|
+
import{B as e}from"./useAppStore-Pjif7nCR.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
|