most-box 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +7 -6
  2. package/out/about/index.html +20 -0
  3. package/out/admin/index.html +0 -0
  4. package/out/app/index.html +0 -0
  5. package/out/assets/AccountMenu-D-wa5tux.js +1 -0
  6. package/out/assets/AppShell-BdRKZIZ9.js +1 -0
  7. package/out/assets/AppTop-BE5kKBYH.js +1 -0
  8. package/out/assets/CopyButton-DnFqfCN9.js +1 -0
  9. package/out/assets/MarketingHeader-8gNzHawY.js +1 -0
  10. package/out/assets/MarketingLayout-BPdjpEfc.js +1 -0
  11. package/out/assets/{MilkdownEditor-DXVbZsH_.js → MilkdownEditor-C388llV6.js} +1 -1
  12. package/out/assets/OpenSidebarButton-OP8zl7ad.js +1 -0
  13. package/out/assets/arrow-right-BsHzC0ZL.js +1 -0
  14. package/out/assets/{arrow-up-down-B-677ip8.js → arrow-up-down-DvLSz6Ma.js} +1 -1
  15. package/out/assets/{userProfile-BZvkCuet.js → channelApi-C5eHetoJ.js} +1 -1
  16. package/out/assets/chatJoinInvite-CeC6H6t8.js +1 -0
  17. package/out/assets/{chatNoteDraft-CYbvcEvC.js → chatNoteDraft-DTy6In5R.js} +1 -1
  18. package/out/assets/{circle-alert-dfN4T6Nq.js → circle-alert-DXVkx8p8.js} +1 -1
  19. package/out/assets/{copy-B7pPZ2MP.js → copy-OwXDsstV.js} +1 -1
  20. package/out/assets/{download-COQOcPqI.js → download-Cy2BlfKM.js} +1 -1
  21. package/out/assets/downloadValidation-Dd43i9_9.js +1 -0
  22. package/out/assets/{external-link-D6tHlYgS.js → external-link-D_AQSgxW.js} +1 -1
  23. package/out/assets/{file-text-DiyIGL1I.js → file-text-zvTER2mN.js} +1 -1
  24. package/out/assets/fingerprint-pattern-BT73ASEB.js +1 -0
  25. package/out/assets/{folder-BS_GbpPQ.js → folder-6pYYnS2-.js} +1 -1
  26. package/out/assets/folder-open-DOJ4bB58.js +1 -0
  27. package/out/assets/format-CAKfypjK.js +1 -0
  28. package/out/assets/gamepad-2-BYqNgCQr.js +1 -0
  29. package/out/assets/{hard-drive-Cqa7Rstj.js → hard-drive-DL1KJHmG.js} +1 -1
  30. package/out/assets/i18n-C6yaqRst.js +1 -0
  31. package/out/assets/index-C6IjeTBh.css +1 -0
  32. package/out/assets/index-D1mozno-.js +31 -0
  33. package/out/assets/index.lazy-59kmyNMW.js +1 -0
  34. package/out/assets/index.lazy-B1iJsXQ8.js +3 -0
  35. package/out/assets/index.lazy-Bz77Jlzu.js +1 -0
  36. package/out/assets/index.lazy-CVFcovqX.js +1 -0
  37. package/out/assets/index.lazy-CX2l1_Gi.js +1 -0
  38. package/out/assets/index.lazy-C_J9afOY.js +1 -0
  39. package/out/assets/index.lazy-CazlK1-Y.js +3 -0
  40. package/out/assets/index.lazy-CflWbocP.js +1 -0
  41. package/out/assets/index.lazy-ClrSkRx5.js +1 -0
  42. package/out/assets/index.lazy-CsTaY5WS.js +1 -0
  43. package/out/assets/index.lazy-D7E1pb1S.js +5 -0
  44. package/out/assets/index.lazy-DzaN9qwA.js +2 -0
  45. package/out/assets/index.lazy-FvXAYdEO.js +1 -0
  46. package/out/assets/index.lazy-JwrS2vDI.js +1 -0
  47. package/out/assets/index.lazy-m9XAzMt1.js +1 -0
  48. package/out/assets/{loader-CwyHYZdX.js → loader-C4pED_QP.js} +1 -1
  49. package/out/assets/lock-yG7M7GkB.js +1 -0
  50. package/out/assets/{message-square-BgsNXPft.js → message-square-CfApq8Ou.js} +1 -1
  51. package/out/assets/mp-cEQteKUC.js +1 -0
  52. package/out/assets/{music-Dn9nm9Qb.js → music-Br2x8TKX.js} +1 -1
  53. package/out/assets/notebook-pen-Bcd3MrtD.js +1 -0
  54. package/out/assets/play-DSHtNcOe.js +1 -0
  55. package/out/assets/{refresh-cw-D4BsHvhi.js → refresh-cw-CfkUlTK9.js} +1 -1
  56. package/out/assets/{save-B02sbO9Y.js → save-CfYzXcxH.js} +1 -1
  57. package/out/assets/saveLocalFile-2CNt4X0T.js +1 -0
  58. package/out/assets/search-DLBOUfny.js +1 -0
  59. package/out/assets/{send-4dhnJGuS.js → send-Bie9hgHI.js} +1 -1
  60. package/out/assets/{shield-check-Boae7Nc6.js → shield-check-2-h_eEXp.js} +1 -1
  61. package/out/assets/{smartphone-JXH-zQXB.js → smartphone-CrsocYJo.js} +1 -1
  62. package/out/assets/trash-2-B9gno5q6.js +1 -0
  63. package/out/assets/{triangle-alert-B9sMiA9l.js → triangle-alert-BhNtjKm2.js} +1 -1
  64. package/out/assets/{upload-DVuXJt_o.js → upload-BmufnMFu.js} +1 -1
  65. package/out/assets/{useAppStore-DOnk608w.js → useAppStore-DNhyhD20.js} +1 -1
  66. package/out/assets/useChannelMessages-DDBqKBXU.js +4 -0
  67. package/out/assets/useGameRoom-asr2gyY6.js +1 -0
  68. package/out/assets/{wallet-D9Iw4YWE.js → wallet-D6HZocla.js} +1 -1
  69. package/out/assets/{wifi-ljEI_ySA.js → wifi-CILQyKk0.js} +1 -1
  70. package/out/chat/index.html +0 -0
  71. package/out/chat/join/demo/index.html +0 -0
  72. package/out/chat/join/index.html +0 -0
  73. package/out/download/index.html +2 -2
  74. package/out/game/gandengyan/index.html +0 -0
  75. package/out/game/index.html +0 -0
  76. package/out/game/zhajinhua/index.html +0 -0
  77. package/out/index.html +2 -2
  78. package/out/note/index.html +0 -0
  79. package/out/ping/index.html +2 -2
  80. package/out/profile/index.html +0 -0
  81. package/out/web3/index.html +0 -0
  82. package/package.json +1 -1
  83. package/server/index.js +18 -1
  84. package/server/src/core/channelVoice.js +164 -0
  85. package/server/src/core/mostLink.js +30 -13
  86. package/server/src/core/releaseManifest.js +10 -3
  87. package/server/src/http/nodeStatus.js +2 -2
  88. package/server/src/http/routes/fileRoutes.js +10 -8
  89. package/server/src/http/uploads.js +53 -15
  90. package/server/src/index.js +126 -57
  91. package/server/src/node/config.js +4 -4
  92. package/server/src/utils/api.js +9 -1
  93. package/server/src/utils/avatar.js +1 -10
  94. package/server/src/utils/downloadMessages.js +7 -7
  95. package/server/src/utils/errors.js +11 -1
  96. package/server/src/utils/userIdentity.js +0 -1
  97. package/out/assets/AccountMenu-D36x3rKH.js +0 -1
  98. package/out/assets/AppTop-qtp-3wqv.js +0 -1
  99. package/out/assets/CopyButton-C00LHzxo.js +0 -1
  100. package/out/assets/FilePreviewOverlay-BvOCftIV.js +0 -1
  101. package/out/assets/MarketingHeader-D7AjEmWU.js +0 -1
  102. package/out/assets/MarketingLayout-BVw4vr-u.js +0 -1
  103. package/out/assets/OpenSidebarButton-DI6Ld8um.js +0 -1
  104. package/out/assets/arrow-right-CXzRt0Fp.js +0 -1
  105. package/out/assets/chatJoinInvite-aCHhLrlm.js +0 -1
  106. package/out/assets/check-iBCQl0yr.js +0 -1
  107. package/out/assets/chevron-right-D75NRNNs.js +0 -1
  108. package/out/assets/downloadValidation-UPgpJbKz.js +0 -1
  109. package/out/assets/format-CR8oUWq6.js +0 -1
  110. package/out/assets/index-CUzbruyP.js +0 -31
  111. package/out/assets/index-FV6RZlVI.css +0 -1
  112. package/out/assets/index.lazy-08bEbzIk.js +0 -1
  113. package/out/assets/index.lazy-6b-8jxXI.js +0 -1
  114. package/out/assets/index.lazy-B4pxVFWK.js +0 -2
  115. package/out/assets/index.lazy-Bi5KZylP.js +0 -5
  116. package/out/assets/index.lazy-CJnFeoy4.js +0 -1
  117. package/out/assets/index.lazy-CRV2-Y6z.js +0 -3
  118. package/out/assets/index.lazy-CzCHV559.js +0 -1
  119. package/out/assets/index.lazy-DrfZ9XTR.js +0 -1
  120. package/out/assets/index.lazy-DuvCRtpm.js +0 -1
  121. package/out/assets/index.lazy-DxOIgf3c.js +0 -1
  122. package/out/assets/index.lazy-FNVWBYth.js +0 -1
  123. package/out/assets/index.lazy-Itk05ouU.js +0 -1
  124. package/out/assets/index.lazy-_CazgyO7.js +0 -1
  125. package/out/assets/index.lazy-odd8ydDw.js +0 -3
  126. package/out/assets/key-round-JR8M3aHl.js +0 -1
  127. package/out/assets/lock-CuwwlXlx.js +0 -1
  128. package/out/assets/mp-Dv12gDTx.js +0 -1
  129. package/out/assets/notebook-pen-BzrCXQJE.js +0 -1
  130. package/out/assets/play-CvWKSMwY.js +0 -1
  131. package/out/assets/search-HW4oPOBP.js +0 -1
  132. package/out/assets/trash-2-BLwoM0ME.js +0 -1
  133. package/out/assets/useChannelMessages-CDvw-f_x.js +0 -4
  134. package/out/assets/useGameRoom-CATo4XWU.js +0 -1
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,_ as o,g as s,t as c}from"./useAppStore-DNhyhD20.js";import{a as l}from"./i18n-C6yaqRst.js";import{t as ee}from"./copy-OwXDsstV.js";import{t as te}from"./AppShell-BdRKZIZ9.js";import{t as ne}from"./play-DSHtNcOe.js";import{t as re}from"./send-Bie9hgHI.js";import{i as ie,n as ae,r as oe,t as se}from"./useGameRoom-asr2gyY6.js";import{g as u}from"./index-D1mozno-.js";var ce=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),d=t(e(),1),f=[`S`,`H`,`C`,`D`],p=[`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`J`,`Q`,`K`,`A`,`2`],m=p.filter(e=>e!==`2`),h=new Map(p.map((e,t)=>[e,t+3])),g=5,_=20,v=1e3;function le({roomCode:e,ownerAddress:t,ownerName:n,players:r=[],random:i=Math.random}){let a=E(r);return a.some(e=>e.address===s(t))||a.unshift({address:s(t),name:K(n),avatar:``}),y({id:String(e||``).toUpperCase(),ownerAddress:s(t),status:`lobby`,seq:1,players:a.slice(0,6).map((e,t)=>({address:e.address,name:K(e.name),avatar:o(e.avatar),seat:t,hand:[],handCount:0,score:v,playedCards:0})),deck:[],discard:[],table:null,currentSeat:0,lastWinnerSeat:null,previousWinnerSeat:null,passSeats:[],baseScore:1,bombCount:0,diceRolls:[],roundResult:null,log:[`房间已创建`],winnerSeat:null,random:i})}function ue(e,t=[]){let n=b(e);if(!n||n.status!==`lobby`)return n;let r=new Map(n.players.map(e=>[e.address,e.score]));return n.players=E(t).slice(0,6).map((e,t)=>({address:e.address,name:K(e.name),avatar:o(e.avatar),seat:t,hand:[],handCount:0,score:r.get(e.address)??v,playedCards:0})),n.seq+=1,y(n)}function de(e,t=Math.random){let n=b(e);if(!n||n.players.length<2)throw Error(`至少需要 2 名玩家`);n.deck=N(M(),t),n.discard=[],n.table=null,n.passSeats=[],n.winnerSeat=null,n.roundResult=null,n.baseScore=1,n.bombCount=0,n.status=`playing`;for(let e of R(n))e.hand=P(n,g),e.handCount=e.hand.length,e.playedCards=0,F(e.hand);let r=k(n,t);return n.currentSeat=r.seat,n.lastWinnerSeat=null,n.log=[`新一局开始,${r.name} 先出牌`],n.diceRolls.length>0&&n.log.unshift(`骰子结果:${n.diceRolls.map(e=>`${e.name} ${e.value}`).join(`,`)}`),n.seq+=1,y(n)}function fe(e,t,n){let r=b(e),i=I(r),a=s(t);if(!i||i.address!==a)return{ok:!1,error:`还没轮到你`,state:y(r)};let o=n.map(e=>i.hand.find(t=>t.id===e));if(o.length===0||o.some(e=>!e))return{ok:!1,error:`手牌不存在`,state:y(r)};let c=he(o);return c?T(c,r.table?.combo)?(o.sort(V),i.hand=i.hand.filter(e=>!n.includes(e.id)),i.handCount=i.hand.length,i.playedCards+=o.length,r.discard.push(...o),r.table={seat:i.seat,playerName:i.name,cards:o,combo:c},r.passSeats=[],r.lastWinnerSeat=i.seat,c.type===`bomb`&&(r.bombCount+=1,r.baseScore*=2),r.log.unshift(`${i.name} 出 ${c.label} ${o.map(G).join(` `)}${c.type===`bomb`?`,底分 ${r.baseScore}`:``}`),i.hand.length===0?A(r,i):z(r),r.seq+=1,{ok:!0,state:y(r)}):{ok:!1,error:`出的牌压不过上一手`,state:y(r)}:{ok:!1,error:`这个牌型不合法`,state:y(r)}}function pe(e,t){let n=b(e),r=I(n),i=s(t);return!r||r.address!==i?{ok:!1,error:`还没轮到你`,state:y(n)}:n.table?(n.passSeats.includes(r.seat)||n.passSeats.push(r.seat),n.log.unshift(`${r.name} 不要`),L(n).map(e=>e.seat).filter(e=>e!==n.lastWinnerSeat).every(e=>n.passSeats.includes(e))?(j(n),n.currentSeat=n.lastWinnerSeat,n.table=null,n.passSeats=[],n.log.unshift(`本轮结束,所有玩家各补 1 张,重新领出`)):z(n),n.seq+=1,{ok:!0,state:y(n)}):{ok:!1,error:`领出时不能不要`,state:y(n)}}function me(e,t){let n=b(e);if(!n)return null;let r=s(t),i=n.players.findIndex(e=>e.address===r);if(i===-1)return y(n);let a=n.players[i],o=n.currentSeat===a.seat,c=n.lastWinnerSeat===a.seat;n.players.splice(i,1),n.passSeats=n.passSeats.filter(e=>e!==a.seat),n.log.unshift(`${a.name} 已退出房间`);let l=R(n);if(n.status===`playing`)if(l.length<=1)l.length===1?A(n,l[0]):(n.status=`finished`,n.log.unshift(`玩家不足,本局结束`));else{if(o){let e=L(n);if(e.length>0){let t=e.findIndex(e=>e.seat>a.seat);n.currentSeat=e[t>=0?t:0].seat}}c&&n.table&&(n.table=null,n.passSeats=[])}return n.seq+=1,y(n)}function y(e){return e?{id:e.id,ownerAddress:e.ownerAddress,status:e.status,seq:Number(e.seq||1),deck:Array.isArray(e.deck)?e.deck.map(W):[],deckCount:e.deck?.length||Number(e.deckCount||0),discard:Array.isArray(e.discard)?e.discard.map(W):[],discardCount:e.discard?.length||Number(e.discardCount||0),currentSeat:Number(e.currentSeat||0),lastWinnerSeat:e.lastWinnerSeat===null||e.lastWinnerSeat===void 0?null:Number(e.lastWinnerSeat),previousWinnerSeat:e.previousWinnerSeat===null||e.previousWinnerSeat===void 0?null:Number(e.previousWinnerSeat),baseScore:Number(e.baseScore||1),bombCount:Number(e.bombCount||0),diceRolls:Array.isArray(e.diceRolls)?e.diceRolls:[],roundResult:e.roundResult||null,table:e.table?{...e.table,cards:e.table.cards.map(W)}:null,passSeats:Array.isArray(e.passSeats)?e.passSeats:[],winnerSeat:e.winnerSeat===null||e.winnerSeat===void 0?null:Number(e.winnerSeat),log:Array.isArray(e.log)?e.log.slice(0,18):[],players:R(e).map(e=>({address:e.address,name:e.name,avatar:o(e.avatar),seat:e.seat,handCount:e.hand?.length??e.handCount??0,score:Number(e.score??v),playedCards:Number(e.playedCards||0),hand:Array.isArray(e.hand)?e.hand.map(W):[]}))}:null}function b(e){return!e||typeof e!=`object`?null:{id:String(e.id||``).toUpperCase(),ownerAddress:s(e.ownerAddress),status:e.status===`playing`||e.status===`finished`?e.status:`lobby`,seq:Number(e.seq||1),players:Array.isArray(e.players)?e.players.map(D).filter(Boolean):[],deck:Array.isArray(e.deck)?e.deck.map(ve).filter(Boolean):[],discard:Array.isArray(e.discard)?e.discard.map(O).filter(Boolean):[],table:e.table&&typeof e.table==`object`?{...e.table,cards:Array.isArray(e.table.cards)?e.table.cards.map(O).filter(Boolean):[]}:null,currentSeat:Number(e.currentSeat||0),lastWinnerSeat:e.lastWinnerSeat===null||e.lastWinnerSeat===void 0?null:Number(e.lastWinnerSeat),previousWinnerSeat:e.previousWinnerSeat===null||e.previousWinnerSeat===void 0?null:Number(e.previousWinnerSeat),passSeats:Array.isArray(e.passSeats)?e.passSeats.map(Number):[],baseScore:Number(e.baseScore||1),bombCount:Number(e.bombCount||0),diceRolls:Array.isArray(e.diceRolls)?e.diceRolls:[],roundResult:e.roundResult||null,log:Array.isArray(e.log)?e.log.map(String):[],winnerSeat:e.winnerSeat===null||e.winnerSeat===void 0?null:Number(e.winnerSeat)}}function he(e){if(!e?.length)return null;e=[...e].sort(V);let t=e.filter(U).length,n=e.filter(e=>!U(e));if(n.length===0)return null;let r=x(e,n,t);if(r)return r;if(e.length===1&&t===0)return w(`single`,H(e[0]),1,[H(e[0])]);if(e.length===2&&B(n,t)){let e=ge(n);return w(`pair`,e,2,[e,e])}return S(e)||C(e)}function x(e,t,n){if(e.length<3||!B(t,n))return null;let r=ge(t);return w(`bomb`,r,e.length,Array(e.length).fill(r),n===0)}function S(e){if(e.length<3)return null;let t=e.filter(U).length,n=e.filter(e=>!U(e));for(let r=0;r<=m.length-e.length;r+=1){let i=m.slice(r,r+e.length).map(e=>h.get(e)),a=[...i],o=0;for(let e of n){let t=a.indexOf(H(e));t!==-1&&(a.splice(t,1),o+=1)}if(o+t===e.length&&a.length===t)return w(`straight`,i.at(-1),e.length,i)}return null}function C(e){if(e.length<4||e.length%2!=0)return null;let t=e.length/2,n=e.filter(U).length,r=e.filter(e=>!U(e));for(let i=0;i<=m.length-t;i+=1){let a=m.slice(i,i+t).map(e=>h.get(e)),o=a.flatMap(e=>[e,e]),s=0;for(let e of r){let t=o.indexOf(H(e));t!==-1&&(o.splice(t,1),s+=1)}if(s+n===e.length&&o.length===n){let t=a.flatMap(e=>[e,e]);return w(`pairStraight`,a.at(-1),e.length,t)}}return null}function w(e,t,n,r,i=!0){return{type:e,value:t,length:n,resolvedValues:r,pure:i,label:xe({type:e,value:t,length:n,resolvedValues:r,pure:i})}}function T(e,t){return e?!t||e.type===`bomb`&&t.type!==`bomb`?!0:e.type===t.type?e.type===`bomb`?e.length===t.length?e.value===t.value?e.pure&&!t.pure:e.value>t.value:e.length>t.length:e.length===t.length?e.type===`single`||e.type===`pair`?e.value===Ce(t.value)||e.value===h.get(`2`)&&t.value!==h.get(`2`):e.value===Ce(t.value):!1:!1:!1}function E(e){let t=new Set;return e.map(e=>({address:s(e.address),name:K(e.name),avatar:o(e.avatar),publicKey:String(e.publicKey||``)})).filter(e=>!e.address||t.has(e.address)?!1:(t.add(e.address),!0))}function D(e){let t=s(e.address);return t?{address:t,name:K(e.name),avatar:o(e.avatar),seat:Number(e.seat||0),hand:Array.isArray(e.hand)?e.hand.map(O).filter(Boolean):[],handCount:Number(e.handCount||0),score:Number(e.score??v),playedCards:Number(e.playedCards||0)}:null}function O(e){if(!e||typeof e!=`object`)return null;let t=String(e.rank||``),n=String(e.suit||``);return!h.has(t)&&t!==`SJ`&&t!==`BJ`||!f.includes(n)&&n!==`Joker`?null:{id:String(e.id||`${n}-${t}`),suit:n,rank:t,label:e.label||G({suit:n,rank:t}),color:e.color||be({suit:n,rank:t})}}function k(e,t){if(e.previousWinnerSeat!==null)return e.diceRolls=[],R(e).find(t=>t.seat===e.previousWinnerSeat)||R(e)[0];let n=R(e),r=[];for(;n.length>1;){r=n.map(e=>({seat:e.seat,name:e.name,value:we(t)}));let i=Math.max(...r.map(e=>e.value)),a=r.filter(e=>e.value===i);if(a.length===1)return e.diceRolls=r,n.find(e=>e.seat===a[0].seat);n=n.filter(e=>a.some(t=>t.seat===e.seat))}return e.diceRolls=r,n[0]}function A(e,t){e.status=`finished`,e.winnerSeat=t.seat,e.previousWinnerSeat=t.seat;let n=[],r=0;for(let i of R(e)){if(i.seat===t.seat)continue;let a=i.playedCards===0,o=a?_:i.hand.length*e.baseScore*.5;i.score-=o,r+=o,n.push({seat:i.seat,name:i.name,loss:o,sealed:a,cardsLeft:i.hand.length})}t.score+=r,e.roundResult={winnerSeat:t.seat,winnerName:t.name,winnerGain:r,baseScore:e.baseScore,bombCount:e.bombCount,losers:n},e.log.unshift(`${t.name} 获胜,赢 ${r} 分`)}function j(e){for(let t of L(e)){if(e.deck.length===0)break;t.hand.push(...P(e,1)),t.handCount=t.hand.length,F(t.hand)}}function M(){let e=[];for(let t of f)for(let n of p)e.push({id:`${t}-${n}`,suit:t,rank:n});return e.push({id:`SJ`,suit:`Joker`,rank:`SJ`}),e.push({id:`BJ`,suit:`Joker`,rank:`BJ`}),e.map(W)}function N(e,t){let n=[...e];for(let e=n.length-1;e>0;--e){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function P(e,t){return e.deck.splice(0,t)}function F(e){e.sort(V)}function I(e){return e.players.find(t=>t.seat===e.currentSeat)}function L(e){return R(e).filter(e=>e.hand.length>0)}function R(e){return[...e?.players||[]].sort((e,t)=>e.seat-t.seat)}function z(e){let t=L(e).map(e=>e.seat);e.currentSeat=t[(t.indexOf(e.currentSeat)+1)%t.length]}function B(e,t=0){if(e.length===0)return!1;let n=e[0].rank;return e.every(e=>e.rank===n)&&e.length+t>=2}function ge(e){return H(e[0])}function V(e,t){return H(e)-H(t)||_e(e.suit)-_e(t.suit)}function H(e){return h.get(e.rank)||99}function U(e){return e.rank===`SJ`||e.rank===`BJ`}function _e(e){return{D:0,C:1,H:2,S:3,Joker:4}[e]||0}function ve(e){if(typeof e==`string`){let[t,n]=e.split(`-`);return O({id:e,suit:t,rank:n})}return O(e)}function W(e){return{id:e.id,suit:e.suit,rank:e.rank,label:G(e),color:be(e)}}function G(e){return e.rank===`SJ`?`小王`:e.rank===`BJ`?`大王`:`${ye(e.suit)}${e.rank}`}function ye(e){return{S:`♠`,H:`♥`,C:`♣`,D:`♦`}[e]||``}function be(e){return e.suit===`H`||e.suit===`D`||e.rank===`BJ`?`red`:`black`}function xe(e){let t=e.resolvedValues?.length?`(${e.resolvedValues.map(Se).join(` `)})`:``;return`${{single:`单张`,pair:`对子`,straight:`顺子`,pairStraight:`连对`,bomb:e.pure?`纯炸弹`:`带王炸弹`}[e.type]}${t}`}function Se(e){return p.find(t=>h.get(t)===e)||String(e)}function Ce(e){let t=p.findIndex(t=>h.get(t)===e);return t===-1||t>=p.length-1?null:h.get(p[t+1])}function we(e){return Math.floor(e()*6)+1}function K(e){return String(e||`玩家`).trim().slice(0,16)||`玩家`}var q={page:`_page_1c8jk_1`,headerActions:`_headerActions_1c8jk_7`,entry:`_entry_1c8jk_13`,entryBrand:`_entryBrand_1c8jk_23`,cardMark:`_cardMark_1c8jk_29`,entryPanel:`_entryPanel_1c8jk_59`,panel:`_panel_1c8jk_60`,handPanel:`_handPanel_1c8jk_61`,accountLine:`_accountLine_1c8jk_74`,scoreMeta:`_scoreMeta_1c8jk_75`,roomBar:`_roomBar_1c8jk_76`,badges:`_badges_1c8jk_77`,actions:`_actions_1c8jk_78`,joinForm:`_joinForm_1c8jk_98`,status:`_status_1c8jk_119`,gameGrid:`_gameGrid_1c8jk_125`,tablePanel:`_tablePanel_1c8jk_136`,seats:`_seats_1c8jk_170`,player:`_player_1c8jk_176`,active:`_active_1c8jk_193`,winner:`_winner_1c8jk_197`,avatar:`_avatar_1c8jk_201`,avatarOffline:`_avatarOffline_1c8jk_222`,onlineDot:`_onlineDot_1c8jk_227`,centerTable:`_centerTable_1c8jk_253`,deckBox:`_deckBox_1c8jk_260`,playedBox:`_playedBox_1c8jk_261`,playedCards:`_playedCards_1c8jk_289`,notice:`_notice_1c8jk_297`,resultDetail:`_resultDetail_1c8jk_305`,sidePanel:`_sidePanel_1c8jk_316`,scoreRow:`_scoreRow_1c8jk_341`,logPanel:`_logPanel_1c8jk_349`,hand:`_hand_1c8jk_61`,cardButton:`_cardButton_1c8jk_376`,picked:`_picked_1c8jk_386`,card:`_card_1c8jk_29`,red:`_red_1c8jk_417`,black:`_black_1c8jk_421`,small:`_small_1c8jk_425`,preview:`_preview_1c8jk_443`,valid:`_valid_1c8jk_466`},J=n(),Y=`gandengyan`;function X(...e){return e.filter(Boolean).join(` `)}function Te(e,t){return String(e||``).toLowerCase()===String(t||``).toLowerCase()}function Ee(e,t){if(typeof window>`u`||!(`speechSynthesis`in window)||!e)return;window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);n.lang=t,n.rate=1.1,window.speechSynthesis.speak(n)}function De(){let{t:e,locale:t}=l(),n=c(e=>e.addToast),r=i(e=>e.initializeUser),[a,o]=(0,d.useState)(``),[s,u]=(0,d.useState)([]),[f,p]=(0,d.useState)(!1),m=(0,d.useRef)(``),h=(0,d.useRef)(!1),g=se({gameId:Y,onError:e=>n(e,`error`)});(0,d.useEffect)(()=>{r()},[r]),(0,d.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`room`)?.toUpperCase();e&&(o(e),m.current=e)},[]),(0,d.useEffect)(()=>{let t=m.current;!t||h.current||!g.isBackendReady||!g.userIdentity||(h.current=!0,m.current=``,g.joinRoom(t).then(t=>{t&&n(e(`game.toast.joinedRoom`),`success`)}))},[g.isBackendReady,g.userIdentity,g.joinRoom,n,e]),(0,d.useEffect)(()=>{if(!g.roomCode)return;let e=`/game/gandengyan?room=${g.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,``,e)},[g.roomCode]);let _=(0,d.useMemo)(()=>ae(g.messages,g.roomCode?{gameId:Y,roomCode:g.roomCode}:{gameId:Y}),[g.messages,g.roomCode]),v=(0,d.useMemo)(()=>oe(g.messages,{gameId:Y,roomCode:g.roomCode}),[g.messages,g.roomCode]),y=v?.payload?.state,b=y?.players.find(e=>Te(e.address,g.userIdentity?.address)),x=Te(y?.ownerAddress||_.hostAddress,g.userIdentity?.address),S=y?.status===`playing`&&y.currentSeat===b?.seat,C=(0,d.useMemo)(()=>s.map(e=>b?.hand.find(t=>t.id===e)).filter(Boolean),[s,b]),w=(0,d.useMemo)(()=>he(C),[C]),T=g.roomCode&&typeof window<`u`?`${window.location.origin}/game/gandengyan?room=${g.roomCode}`:``,E=(0,d.useRef)(-1),D=(0,d.useRef)(!1);(0,d.useEffect)(()=>{u([])},[y?.seq]),(0,d.useEffect)(()=>{if(!y)return;let n=y.seq;if(E.current<0){E.current=n;return}if(n!==E.current&&(E.current=n,y.status!==`finished`&&(D.current=!1),y.status===`finished`&&y.winnerSeat!==null)){D.current||(D.current=!0,Ee(e(`game.gandengyan.speech.gameOver`),t));return}},[t,y?.seq,e]),(0,d.useEffect)(()=>{if(!x||!g.roomCode||!g.userIdentity||v||_.players.length===0)return;let e=le({roomCode:g.roomCode,ownerAddress:g.userIdentity.address,ownerName:g.userIdentity.displayName||g.userIdentity.username,players:_.players});g.sendRoomEvent(`room:state`,{state:e,seq:e.seq})},[g,x,v,_.players]),(0,d.useEffect)(()=>{if(!y||!x||y.status!==`lobby`)return;let e=ue(y,_.players);e&&ke(y.players,e.players)&&g.sendRoomEvent(`room:state`,{state:e,seq:e.seq})},[g,x,_.players,y]);let O=(0,d.useRef)(0),k=(0,d.useMemo)(()=>g.roomEvents.filter(e=>e.event?.event===`player:leave`),[g.roomEvents]);(0,d.useEffect)(()=>{if(k.length<=O.current)return;let t=k.slice(O.current);O.current=k.length;for(let r of t)n(e(`game.toast.playerLeft`,{player:r.event?.payload?.player?.name||e(`game.player`)}),`info`)},[k,n,e]),(0,d.useEffect)(()=>{if(!y||!x||y.status!==`playing`)return;let e=new Set(_.players.map(e=>e.address.toLowerCase())),t=y.players.find(t=>!e.has(t.address.toLowerCase()));if(!t)return;let n=me(y,t.address);n&&N(n)},[g,x,_.players,y]);async function A(){await g.createRoom()&&n(e(`game.toast.roomCreated`),`success`)}async function j(t){t.preventDefault(),await g.joinRoom(a)&&n(e(`game.toast.joinedRoom`),`success`)}async function M(){T&&(await navigator.clipboard.writeText(T),p(!0),setTimeout(()=>p(!1),1400))}async function N(e){await g.sendRoomEvent(`room:state`,{state:e,seq:e.seq})}async function P(){if(!(!y||!x))try{await N(de(y))}catch(t){n(t instanceof Error?t.message:e(`game.zhajinhua.error.startFailed`),`error`)}}async function F(){await P()}async function I(){if(!y||!g.userIdentity)return;let t=fe(y,g.userIdentity.address,s);if(!t.ok){n(t.error||e(`game.gandengyan.error.playFailed`),`error`);return}await N(t.state)}async function L(){if(!y||!g.userIdentity)return;let t=pe(y,g.userIdentity.address);if(!t.ok){n(t.error||e(`game.gandengyan.error.actionFailed`),`error`);return}await N(t.state)}function R(e){u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,J.jsx)(te,{sidebar:({closeSidebar:e})=>(0,J.jsx)(ie,{activeGame:`gandengyan`,closeSidebar:e}),headerTitle:(0,J.jsx)(`h2`,{className:`header-title`,children:e(`game.gandengyan.title`)}),headerRight:(0,J.jsx)(`div`,{className:q.headerActions,children:y&&(0,J.jsxs)(`button`,{className:`btn btn-sm`,onClick:M,children:[(0,J.jsx)(ee,{size:14}),e(f?`common.copied`:`game.action.shareRoom`)]})}),children:(0,J.jsx)(`main`,{className:q.page,children:y?(0,J.jsxs)(`section`,{className:q.gameGrid,children:[(0,J.jsxs)(`div`,{className:q.tablePanel,children:[(0,J.jsxs)(`div`,{className:q.roomBar,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{translate:`no`,children:e(`game.roomLabel`,{room:y.id})}),(0,J.jsx)(`span`,{children:y.status===`lobby`?e(`game.status.waitingStart`):y.status===`finished`?e(`game.status.finished`):e(`game.status.playing`)})]}),(0,J.jsx)(`div`,{className:q.badges,children:(0,J.jsx)(`span`,{children:g.connected?e(`game.status.online`):e(`game.status.offline`)})})]}),(0,J.jsx)(`div`,{className:q.seats,children:y.players.map(t=>(0,J.jsx)(Oe,{player:t,active:y.currentSeat===t.seat,winner:y.winnerSeat===t.seat,relation:Me(b,t,y.players.length,e),presenceByAddress:g.presenceByAddress,onlineAddresses:g.onlineAddresses},t.seat))}),(0,J.jsxs)(`div`,{className:q.centerTable,children:[(0,J.jsxs)(`div`,{className:q.deckBox,children:[(0,J.jsx)(`span`,{children:e(`game.gandengyan.deck`)}),(0,J.jsx)(`strong`,{children:y.deckCount})]}),(0,J.jsx)(`div`,{className:q.playedBox,children:y.table?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`strong`,{children:e(`game.gandengyan.tablePlay`,{player:Q(y.players.find(e=>e.seat===y.table?.seat),g.presenceByAddress)||y.table.playerName,combo:y.table.combo?.label||e(`game.card`)})}),(0,J.jsx)(`div`,{className:q.playedCards,children:y.table.cards.map(e=>(0,J.jsx)($,{card:e,small:!0},e.id))})]}):(0,J.jsx)(`span`,{children:e(`game.gandengyan.waitingLead`)})}),(0,J.jsxs)(`div`,{className:q.deckBox,children:[(0,J.jsx)(`span`,{children:e(`game.gandengyan.baseScore`)}),(0,J.jsx)(`strong`,{children:y.baseScore})]})]}),(0,J.jsx)(`div`,{className:q.notice,children:y.status===`finished`?y.roundResult?(0,J.jsxs)(`div`,{className:q.resultDetail,children:[(0,J.jsxs)(`p`,{children:[e(`game.gandengyan.result.winnerGain`,{player:y.roundResult.winnerName,score:y.roundResult.winnerGain}),y.roundResult.bombCount>0&&e(`game.gandengyan.result.bombCount`,{count:y.roundResult.bombCount})]}),y.roundResult.losers.map(t=>(0,J.jsx)(`p`,{children:t.sealed?e(`game.gandengyan.result.sealedLoss`,{player:t.name,loss:20}):e(`game.gandengyan.result.cardsLeftLoss`,{player:t.name,cards:t.cardsLeft,loss:t.loss})},t.seat))]}):e(`game.gandengyan.result.winner`,{player:Q(y.players.find(e=>e.seat===y.winnerSeat),g.presenceByAddress)||e(`game.player`)}):S?e(`game.gandengyan.status.yourTurn`):e(`game.zhajinhua.status.waitingPlayer`,{player:Q(y.players.find(e=>e.seat===y.currentSeat),g.presenceByAddress)||e(`game.player`)})})]}),(0,J.jsxs)(`aside`,{className:q.sidePanel,children:[(0,J.jsxs)(`section`,{className:q.panel,children:[(0,J.jsx)(`h3`,{children:e(`game.gandengyan.roundPanel`)}),x&&y.status===`lobby`&&(0,J.jsxs)(`button`,{className:`btn btn-primary`,disabled:y.players.length<2,onClick:P,children:[(0,J.jsx)(ne,{size:16}),e(`game.action.startRound`)]}),x&&y.status===`finished`&&(0,J.jsxs)(`button`,{className:`btn btn-primary`,onClick:F,children:[(0,J.jsx)(ce,{size:16}),e(`game.action.nextRound`)]}),!x&&(0,J.jsx)(`p`,{className:q.status,children:e(`game.waitingHost`)})]}),(0,J.jsxs)(`section`,{className:q.panel,children:[(0,J.jsx)(`h3`,{children:e(`game.gandengyan.score`)}),(0,J.jsxs)(`div`,{className:q.scoreMeta,children:[(0,J.jsx)(`span`,{children:e(`game.gandengyan.bombCount`,{count:y.bombCount})}),(0,J.jsx)(`span`,{children:e(`game.gandengyan.discardCount`,{count:y.discardCount})})]}),y.players.map(e=>(0,J.jsxs)(`div`,{className:q.scoreRow,children:[(0,J.jsx)(`span`,{translate:`no`,children:Q(e,g.presenceByAddress)}),(0,J.jsx)(`strong`,{children:e.score})]},e.seat))]}),(0,J.jsxs)(`section`,{className:X(q.panel,q.logPanel),children:[(0,J.jsx)(`h3`,{children:e(`game.gandengyan.log`)}),y.log.map((e,t)=>(0,J.jsx)(`p`,{translate:`no`,children:e},`${e}-${t}`))]})]}),(0,J.jsxs)(`div`,{className:q.handPanel,children:[(0,J.jsx)(Oe,{player:b,active:S,winner:y.winnerSeat===b?.seat,presenceByAddress:g.presenceByAddress,onlineAddresses:g.onlineAddresses}),(0,J.jsx)(`div`,{className:q.hand,children:b?.hand.map(e=>(0,J.jsx)(`button`,{className:X(q.cardButton,s.includes(e.id)&&q.picked),onClick:()=>R(e.id),children:(0,J.jsx)($,{card:e})},e.id))}),(0,J.jsxs)(`div`,{className:q.actions,children:[(0,J.jsxs)(`div`,{className:X(q.preview,w&&q.valid),children:[(0,J.jsx)(`strong`,{children:w?w.label:s.length?e(`game.gandengyan.invalidCombo`):e(`game.gandengyan.selectCards`)}),(0,J.jsx)(`span`,{children:C.map(e=>e.label).join(` `)||e(`game.gandengyan.jokerOrderHint`)})]}),(0,J.jsxs)(`button`,{className:`btn btn-primary`,disabled:!S||s.length===0||!w,onClick:I,children:[(0,J.jsx)(re,{size:16}),e(`game.gandengyan.action.play`)]}),(0,J.jsx)(`button`,{className:`btn`,disabled:!S||!y.table,onClick:L,children:e(`game.gandengyan.action.pass`)})]})]})]}):(0,J.jsxs)(`section`,{className:q.entry,children:[(0,J.jsxs)(`div`,{className:q.entryBrand,children:[(0,J.jsx)(`div`,{className:q.cardMark,children:e(`game.gandengyan.mark`)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{children:e(`game.gandengyan.hero.title`)}),(0,J.jsx)(`p`,{children:e(`game.hero.desc`)})]})]}),(0,J.jsxs)(`div`,{className:q.entryPanel,children:[(0,J.jsxs)(`div`,{className:q.accountLine,children:[(0,J.jsx)(`span`,{children:e(`game.currentAccount`)}),(0,J.jsx)(`strong`,{translate:`no`,children:g.userIdentity?.displayName||e(`web3.notSignedIn`)})]}),(0,J.jsxs)(`button`,{className:`btn btn-primary`,disabled:g.joining,onClick:A,children:[(0,J.jsx)(ne,{size:16}),e(`game.action.createRoom`)]}),(0,J.jsxs)(`form`,{onSubmit:j,className:q.joinForm,children:[(0,J.jsxs)(`label`,{children:[e(`game.roomCode`),(0,J.jsx)(`input`,{value:a,maxLength:8,onChange:e=>o(e.target.value.toUpperCase()),placeholder:e(`game.roomCode.placeholder`)})]}),(0,J.jsx)(`button`,{className:`btn`,disabled:g.joining||!a,children:e(`game.action.joinRoom`)})]}),(0,J.jsx)(`p`,{className:q.status,children:g.isBackendReady?e(`game.status.nodeConnected`):e(`game.status.nodeConnecting`)})]})]})})})}function Oe({player:e,active:t,winner:n,relation:r=``,presenceByAddress:i,onlineAddresses:a}){let{t:o}=l();if(!e)return null;let s=je(e,i,a);return(0,J.jsxs)(`div`,{className:X(q.player,t&&q.active,n&&q.winner),children:[(0,J.jsxs)(`div`,{className:X(q.avatar,!s.online&&q.avatarOffline),translate:`no`,children:[(0,J.jsx)(`img`,{src:u(e.address,s.avatar),alt:``}),s.online&&(0,J.jsx)(`span`,{className:q.onlineDot})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{translate:`no`,children:s.name}),(0,J.jsxs)(`span`,{children:[r,r?` · `:``,o(`game.gandengyan.handCount`,{count:e.handCount})]})]})]})}function ke(e,t){return e.length===t.length?t.some((t,n)=>{let r=e[n];return Z(r?.address)!==Z(t.address)||r?.name!==t.name||(r?.avatar||``)!==(t.avatar||``)}):!0}function Z(e=``){return String(e||``).trim().toLowerCase()}function Ae(e=``){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function Q(e,t){if(!e)return``;let n=Z(e.address),r=t.get(n)?.displayName||e.name;return String(r||Ae(e.address)).trim()}function je(e,t,n){let r=Z(e.address),i=t.get(r);return{name:Q(e,t),avatar:i?.avatar||e.avatar||``,online:r?n.has(r):!1}}function $({card:e,small:t=!1}){return(0,J.jsxs)(`div`,{className:X(q.card,q[e.color],t&&q.small),children:[(0,J.jsx)(`span`,{children:e.label}),(0,J.jsx)(`i`,{children:e.suit===`Joker`?`*`:e.label.slice(0,1)})]})}function Me(e,t,n,r){if(!e)return r(`game.gandengyan.position.seat`,{seat:t.seat+1});let i=(t.seat-e.seat+n)%n;return i===0?r(`game.gandengyan.position.me`):n===2?r(`game.gandengyan.position.opponent`):n===3?r(i===1?`game.gandengyan.position.nextOpponent`:`game.gandengyan.position.prevOpponent`):n===4?r(i===1?`game.gandengyan.position.nextOpponent`:i===2?`game.gandengyan.position.partner`:`game.gandengyan.position.prevOpponent`):i%2==0?r(`game.gandengyan.position.seatPartner`,{seat:t.seat+1}):r(`game.gandengyan.position.seatOpponent`,{seat:t.seat+1})}var Ne=a(`/game/gandengyan/`)({component:De});export{Ne as Route};
@@ -0,0 +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-C6yaqRst.js";import{t as h}from"./fingerprint-pattern-BT73ASEB.js";import{i as g}from"./AccountMenu-D-wa5tux.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-DnFqfCN9.js";import{t as x}from"./lock-yG7M7GkB.js";import{t as S}from"./AppShell-BdRKZIZ9.js";import{t as C}from"./wallet-D6HZocla.js";import{M as w,N as T,P as E,g as ee}from"./index-D1mozno-.js";import{t as te}from"./AppTop-BE5kKBYH.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(`
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
+ `)}\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};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a,t as o}from"./useAppStore-DNhyhD20.js";import{a as s}from"./i18n-C6yaqRst.js";import{t as c}from"./arrow-right-BsHzC0ZL.js";import{a as l}from"./AccountMenu-D-wa5tux.js";import{t as u}from"./download-Cy2BlfKM.js";import{t as d}from"./external-link-D_AQSgxW.js";import{t as f}from"./folder-open-DOJ4bB58.js";import{t as p}from"./gamepad-2-BYqNgCQr.js";import{t as m}from"./hard-drive-DL1KJHmG.js";import{t as h}from"./message-square-CfApq8Ou.js";import{t as g}from"./notebook-pen-Bcd3MrtD.js";import{t as _}from"./wallet-D6HZocla.js";import{E as v,k as y}from"./index-D1mozno-.js";import{t as b}from"./MarketingLayout-BPdjpEfc.js";var x=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),S=t(e(),1),C=n(),w=[{id:`app`,titleKey:`portal.feature.app.title`,subtitleKey:`portal.feature.app.subtitle`,icon:(0,C.jsx)(f,{size:28}),path:`/app/`,requiresBackend:!0,heroKey:`portal.feature.app.hero`,descKey:`portal.feature.app.desc`,featureKeys:[`portal.feature.app.bullet.localIdentity`,`portal.feature.app.bullet.hyperswarm`,`portal.feature.app.bullet.largeFiles`,`portal.feature.app.bullet.cid`,`portal.feature.app.bullet.seedAfterDownload`,`portal.feature.app.bullet.noCloud`,`portal.feature.app.bullet.desktop`,`portal.feature.app.bullet.openSource`],steps:[{num:`1`,titleKey:`portal.feature.app.step.download.title`,descKey:`portal.feature.app.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.app.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.app.step.install.title`,descKey:`portal.feature.app.step.install.desc`,hideInDesktopClient:!0},{num:`3`,titleKey:`portal.feature.app.step.share.title`,descKey:`portal.feature.app.step.share.desc`}]},{id:`chat`,titleKey:`portal.feature.chat.title`,subtitleKey:`portal.feature.chat.subtitle`,icon:(0,C.jsx)(h,{size:28}),path:`/chat/`,requiresBackend:!0,heroKey:`portal.feature.chat.hero`,descKey:`portal.feature.chat.desc`,featureKeys:[`portal.feature.chat.bullet.encrypted`,`portal.feature.chat.bullet.identity`,`portal.feature.chat.bullet.sync`,`portal.feature.chat.bullet.offline`,`portal.feature.chat.bullet.noAccount`],steps:[{num:`1`,titleKey:`portal.feature.chat.step.download.title`,descKey:`portal.feature.chat.step.download.desc`,link:`/download/`,linkTextKey:`portal.feature.chat.step.download.link`,hideInDesktopClient:!0},{num:`2`,titleKey:`portal.feature.chat.step.create.title`,descKey:`portal.feature.chat.step.create.desc`},{num:`3`,titleKey:`portal.feature.chat.step.send.title`,descKey:`portal.feature.chat.step.send.desc`}]},{id:`note`,titleKey:`portal.feature.note.title`,subtitleKey:`portal.feature.note.subtitle`,icon:(0,C.jsx)(g,{size:28}),path:`/note/`,requiresBackend:!1,heroKey:`portal.feature.note.hero`,descKey:`portal.feature.note.desc`,featureKeys:[`portal.feature.note.bullet.markdown`,`portal.feature.note.bullet.privacy`,`portal.feature.note.bullet.folders`,`portal.feature.note.bullet.web3`,`portal.feature.note.bullet.backup`,`portal.feature.note.bullet.independent`],steps:[{num:`1`,titleKey:`portal.feature.note.step.account.title`,descKey:`portal.feature.note.step.account.desc`},{num:`2`,titleKey:`portal.feature.note.step.create.title`,descKey:`portal.feature.note.step.create.desc`},{num:`3`,titleKey:`portal.feature.note.step.backup.title`,descKey:`portal.feature.note.step.backup.desc`}]},{id:`gandengyan`,titleKey:`portal.feature.game.title`,subtitleKey:`portal.feature.game.subtitle`,icon:(0,C.jsx)(p,{size:28}),path:`/game/gandengyan/`,requiresBackend:!0,heroKey:`portal.feature.game.hero`,descKey:`portal.feature.game.desc`,featureKeys:[`portal.feature.game.bullet.account`,`portal.feature.game.bullet.channel`,`portal.feature.game.bullet.link`,`portal.feature.game.bullet.rules`,`portal.feature.game.bullet.maintain`],steps:[{num:`1`,titleKey:`portal.feature.game.step.login.title`,descKey:`portal.feature.game.step.login.desc`},{num:`2`,titleKey:`portal.feature.game.step.create.title`,descKey:`portal.feature.game.step.create.desc`},{num:`3`,titleKey:`portal.feature.game.step.test.title`,descKey:`portal.feature.game.step.test.desc`}]},{id:`web3`,titleKey:`portal.feature.web3.title`,subtitleKey:`portal.feature.web3.subtitle`,icon:(0,C.jsx)(_,{size:28}),path:`/web3/`,requiresBackend:!1,heroKey:`portal.feature.web3.hero`,descKey:`portal.feature.web3.desc`,featureKeys:[`portal.feature.web3.bullet.frontend`,`portal.feature.web3.bullet.keys`,`portal.feature.web3.bullet.mnemonic`,`portal.feature.web3.bullet.eth`,`portal.feature.web3.bullet.pem`,`portal.feature.web3.bullet.qr`],steps:[{num:`1`,titleKey:`portal.feature.web3.step.username.title`,descKey:`portal.feature.web3.step.username.desc`},{num:`2`,titleKey:`portal.feature.web3.step.keys.title`,descKey:`portal.feature.web3.step.keys.desc`},{num:`3`,titleKey:`portal.feature.web3.step.export.title`,descKey:`portal.feature.web3.step.export.desc`}]}],T=[`chat`,`app`,`note`,`gandengyan`,`web3`];function E(){let e=o(e=>e.hasBackend),t=o(e=>e.openConnectModal),[n,r]=(0,S.useState)(`chat`),{t:i}=s(),f=v(),p=T.map(e=>w.find(t=>t.id===e)).filter(e=>!!e),h=p.find(e=>e.id===n)||p[0],g=i(h.titleKey),_=h.steps.filter(e=>!(f&&e.hideInDesktopClient));return(0,C.jsxs)(`div`,{className:`portal-page`,children:[(0,C.jsx)(`section`,{className:`portal-hero`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`h1`,{className:`portal-hero-title`,children:i(`common.brand`)}),(0,C.jsx)(`p`,{className:`portal-hero-subtitle`,children:i(`portal.hero.subtitle`)})]})}),(0,C.jsx)(`section`,{className:`portal-cards-section`,children:(0,C.jsxs)(`div`,{className:`mkt-container`,children:[(0,C.jsx)(`div`,{className:`portal-cards`,children:p.map(t=>{let o=n===t.id,s=t.requiresBackend,c=s?e===!0?`connected`:e===!1?`disconnected`:`checking`:`none`,l=i(t.titleKey);return(0,C.jsxs)(`button`,{className:`portal-card ${o?`active`:``}`,onClick:()=>r(t.id),children:[(0,C.jsx)(a,{to:t.path,className:`btn btn-icon portal-card-open-btn`,onClick:e=>e.stopPropagation(),title:i(`portal.openFeature`,{title:l}),children:(0,C.jsx)(x,{size:16})}),(0,C.jsx)(`div`,{className:`portal-card-icon`,children:t.icon}),(0,C.jsx)(`div`,{className:`portal-card-title`,children:l}),(0,C.jsx)(`div`,{className:`portal-card-subtitle`,children:i(t.subtitleKey)}),s?(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ${c}`,children:[c===`checking`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot checking`}),i(`common.status.checking`)]}),c===`connected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot connected`}),i(`common.status.connected`)]}),c===`disconnected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot disconnected`}),i(`common.status.needsConnection`)]})]}):(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ready`,children:[(0,C.jsx)(`span`,{className:`status-dot ready`}),i(`common.status.ready`)]})]},t.id)})}),(0,C.jsxs)(`div`,{className:`portal-node-actions`,"aria-label":i(`portal.nodeEntry`),children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),(0,C.jsxs)(a,{to:`/admin/`,className:`btn btn-secondary`,children:[(0,C.jsx)(m,{size:16}),i(`portal.nodeAdmin`)]})]})]})}),(0,C.jsx)(`section`,{className:`portal-marketing`,children:(0,C.jsx)(`div`,{className:`mkt-container`,children:(0,C.jsxs)(`div`,{className:`portal-marketing-inner`,children:[(0,C.jsxs)(`div`,{className:`portal-marketing-header`,children:[(0,C.jsx)(`h2`,{children:i(h.heroKey)}),(0,C.jsx)(`p`,{children:i(h.descKey)})]}),(0,C.jsx)(`div`,{className:`portal-marketing-features`,children:h.featureKeys.map(e=>(0,C.jsxs)(`div`,{className:`portal-feature-item`,children:[(0,C.jsx)(`span`,{className:`portal-feature-icon`,children:(0,C.jsx)(l,{size:14,strokeWidth:3})}),(0,C.jsx)(`span`,{children:i(e)})]},e))}),(0,C.jsx)(`div`,{className:`portal-marketing-steps`,children:_.map((e,t)=>(0,C.jsxs)(`div`,{className:`portal-step`,children:[(0,C.jsx)(`span`,{className:`portal-step-num`,children:t+1}),(0,C.jsxs)(`div`,{className:`portal-step-content`,children:[(0,C.jsx)(`strong`,{children:i(e.titleKey)}),(0,C.jsx)(`p`,{children:i(e.descKey)}),e.code&&(0,C.jsx)(`code`,{className:`portal-step-code`,translate:`no`,children:e.code}),e.link&&e.linkTextKey&&(0,C.jsx)(`p`,{className:`portal-step-link`,children:(0,C.jsxs)(a,{to:e.link,children:[i(e.linkTextKey),` `,(0,C.jsx)(d,{size:12})]})})]})]},e.num))}),(0,C.jsxs)(`div`,{className:`portal-actions`,children:[(0,C.jsxs)(a,{to:h.path,className:`btn btn-primary`,children:[i(`portal.enterFeature`,{title:g}),(0,C.jsx)(c,{size:16})]}),h.requiresBackend&&e===!1&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(y,{size:16}),i(`portal.webConnectNode`)]}),!f&&(0,C.jsxs)(a,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(u,{size:16}),i(`nav.downloadClient`)]})]})]})]})})})]})}function D(){return(0,C.jsx)(b,{children:(0,C.jsx)(E,{})})}var O=i(`/`)({component:D});export{O as Route};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i}from"./useAppStore-DNhyhD20.js";import{a}from"./i18n-C6yaqRst.js";import{n as o,t as s}from"./smartphone-CrsocYJo.js";import{t as c}from"./message-square-CfApq8Ou.js";import{t as l}from"./music-Br2x8TKX.js";import{t as u}from"./play-DSHtNcOe.js";import{t as d}from"./search-DLBOUfny.js";import{t as f}from"./send-Bie9hgHI.js";import{t as p}from"./wifi-CILQyKk0.js";import{t as m}from"./MarketingLayout-BPdjpEfc.js";var h=r(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),g=r(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),_=r(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=r(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),y=r(`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`}]]),b=r(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),x=r(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),ee=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),te=r(`triangle`,[[`path`,{d:`M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`,key:`14u9p9`}]]),S=t(e(),1);function ne(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var re=Object.freeze({left:0,top:0,width:16,height:16}),C=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),w=Object.freeze({...re,...C}),T=Object.freeze({...w,body:``,hidden:!1});function ie(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function E(e,t){let n=ie(e,t);for(let r in T)r in C?r in e&&!(r in n)&&(n[r]=C[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function ae(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=E(r[e]||i[e],a)}return o(t),n.forEach(o),E(e,a)}function oe(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=ne(e);for(let i in r){let a=r[i];a&&(t(i,ae(e,i,a)),n.push(i))}return n}var se={provider:``,aliases:{},not_found:{},...re};function D(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function O(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!D(e,se))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!D(t,T))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!D(t,T))return null}return t}var k=Object.create(null);function ce(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function A(e,t){let n=k[e]||(k[e]=Object.create(null));return n[t]||(n[t]=ce(e,t))}function le(e,t){return O(t)?oe(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ue(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var de=/^[a-z0-9]+(-[a-z0-9]+)*$/,j=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!M(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!M(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!M(e,n)?null:e}return null},M=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,N=!1;function P(e){return typeof e==`boolean`&&(N=e),N}function F(e){let t=typeof e==`string`?j(e,!0,N):e;if(t){let e=A(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function fe(e,t){let n=j(e,!0,N);if(!n)return!1;let r=A(n.provider,n.prefix);return t?ue(r,n.name,t):(r.missing.add(n.name),!0)}function pe(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),N&&!t&&!e.prefix){let t=!1;return O(e)&&(e.prefix=``,oe(e,(e,n)=>{fe(e,n)&&(t=!0)})),t}let n=e.prefix;return M({prefix:n,name:`a`})?!!le(A(t,n),e):!1}var I=Object.freeze({width:null,height:null}),L=Object.freeze({...I,...C}),me=/(-?[0-9.]*[0-9]+[0-9.]*)/g,he=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function R(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(me);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=he.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ge(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function _e(e,t){return e?`<defs>`+e+`</defs>`+t:t}function ve(e,t,n){let r=ge(e);return _e(r.defs,t+r.content+n)}var ye=e=>e===`unset`||e===`undefined`||e===`none`;function be(e,t){let n={...w,...e},r={...L,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=ve(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=R(d,c/l)):(u=o===`auto`?c:o,d=s===null?R(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{ye(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var xe=/\sid="(\S+)"/g,Se=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Ce=0;function we(e,t=Se){let n=[],r;for(;r=xe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(Ce++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var z=Object.create(null);function Te(e,t){z[e]=t}function B(e){return z[e]||z[``]}function V(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var H=Object.create(null),U=[`https://api.simplesvg.com`,`https://api.unisvg.com`],W=[];U.length>0;)U.length===1||Math.random()>.5?W.push(U.shift()):W.push(U.pop());H[``]=V({resources:[`https://api.iconify.design`].concat(W)});function Ee(e,t){let n=V(t);return n===null?!1:(H[e]=n,!0)}function G(e){return H[e]}var K=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function De(e,t){let n=G(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Oe(e){return e===404}var ke=(e,t,n)=>{let r=[],i=De(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Ae(e){if(typeof e==`string`){let t=G(e);if(t)return t.path}return`/`}var je={prepare:ke,send:(e,t,n)=>{if(!K){n(`abort`,424);return}let r=Ae(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;K(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Oe(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function q(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Me(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||q([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ne=0;function Pe(e,t,n){let r=Ne++,i=q.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Fe(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=A(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Ie(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?j(e,t,n):e;i&&r.push(i)}),r}var Le={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Re(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function ze(e){let t={...Le,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Re(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Be(){}var J=Object.create(null);function Ve(e){if(!J[e]){let t=G(e);if(!t)return;J[e]={config:t,redundancy:ze(t)}}return J[e]}function He(e,t,n){let r,i;if(typeof e==`string`){let t=B(e);if(!t)return n(void 0,424),Be;i=t.send;let a=Ve(e);a&&(r=a.redundancy)}else{let t=V(e);if(t){r=ze(t);let n=B(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Be):r.query(t,i,n)().abort}function Ue(){}function We(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Me(e)}))}function Ge(e){let t=[],n=[];return e.forEach(e=>{(e.match(de)?t:n).push(e)}),{valid:t,invalid:n}}function Y(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!le(e,n).length){r();return}}catch(e){console.error(e)}r(),We(e)}function Ke(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function qe(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ke(e.loadIcons(r,n,t),t=>{Y(e,r,t)});return}if(i){r.forEach(r=>{Ke(i(r,n,t),t=>{Y(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Ge(r);if(o.length&&Y(e,o,null),!a.length)return;let s=n.match(de)?B(t):null;if(!s){Y(e,a,null);return}s.prepare(t,n,a).forEach(n=>{He(t,n,t=>{Y(e,n.icons,t)})})}))}var Je=(e,t)=>{let n=Fe(Ie(e,!0,P()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Ue)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(A(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=A(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&qe(e,t)}),t?Pe(t,n,i):Ue};function Ye(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in I?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Xe=/[\s,]+/;function Ze(e,t){t.split(Xe).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Qe(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function $e(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function et(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function tt(e){return`data:image/svg+xml,`+et(e)}function nt(e){return`url("`+tt(e)+`")`}var X;function rt(){try{X=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{X=null}}function it(e){return X===void 0&&rt(),X?X.createHTML(e):e}var at={...L,inline:!1},ot={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},st={display:`inline-block`},Z={backgroundColor:`currentColor`},ct={backgroundColor:`transparent`},lt={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},ut={WebkitMask:Z,mask:Z,background:ct};for(let e in ut){let t=ut[e];for(let n in lt)t[e+n]=lt[n]}var dt={...at,inline:!0};function ft(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var pt=(e,t,n)=>{let r=t.inline?dt:at,i=Ye(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?ot:{}};if(n){let e=j(n,!1,!0);if(e){let t=[`iconify`];for(let n of[`provider`,`prefix`])e[n]&&t.push(`iconify--`+e[n]);c.className=t.join(` `)}}for(let e in t){let n=t[e];if(n!==void 0)switch(e){case`icon`:case`style`:case`children`:case`onLoad`:case`mode`:case`ssr`:case`fallback`:break;case`_ref`:c.ref=n;break;case`className`:c[e]=(c[e]?c[e]+` `:``)+n;break;case`inline`:case`hFlip`:case`vFlip`:i[e]=n===!0||n===`true`||n===1;break;case`flip`:typeof n==`string`&&Ze(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=Qe(n):typeof n==`number`&&(i[e]=n);break;case`ariaHidden`:case`aria-hidden`:n!==!0&&n!==`true`&&delete c[`aria-hidden`];break;default:r[e]===void 0&&(c[e]=n)}}let l=be(e,i),u=l.attributes;if(i.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){c.style={...o,...s},Object.assign(c,u);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),c.dangerouslySetInnerHTML={__html:it(we(l.body,n?()=>n+`ID`+e++:`iconifyReact`))},(0,S.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=$e(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":nt(h),width:ft(u.width),height:ft(u.height),...st,...m?Z:ct,...s},(0,S.createElement)(`span`,c)};if(P(!0),Te(``,je),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!pe(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Ee(e,r)||console.error(n)}catch{console.error(n)}}}}function mt(e){let[t,n]=(0,S.useState)(!!e.ssr),[r,i]=(0,S.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=F(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,S.useState)(a(!!e.ssr));function c(){let e=r.callback;e&&(e(),i({}))}function l(e){if(JSON.stringify(o)!==JSON.stringify(e))return c(),s(e),!0}function u(){var t;let n=e.icon;if(typeof n==`object`){l({name:``,data:n});return}let r=F(n);l({name:n,data:r})&&(r===void 0?i({callback:Je([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,S.useEffect)(()=>(n(!0),c),[]),(0,S.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?pt({...w,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,S.createElement)(`span`,{})}var ht=(0,S.forwardRef)((e,t)=>mt({...e,_ref:t}));(0,S.forwardRef)((e,t)=>mt({inline:!0,...e,_ref:t}));var Q=n(),$=[{name:`Google`,host:`google.com`,icon:`simple-icons:google`,fallback:(0,Q.jsx)(d,{size:20})},{name:`Cloudflare`,host:`cloudflare.com`,icon:`simple-icons:cloudflare`,fallback:(0,Q.jsx)(o,{size:20})},{name:`YouTube`,host:`youtube.com`,icon:`simple-icons:youtube`,fallback:(0,Q.jsx)(u,{size:20})},{name:`GitHub`,host:`github.com`,icon:`simple-icons:github`,fallback:(0,Q.jsx)(ee,{size:20})},{name:`ChatGPT`,host:`chatgpt.com`,icon:`simple-icons:openai`,fallback:(0,Q.jsx)(_,{size:20})},{name:`X`,host:`x.com`,icon:`simple-icons:x`,fallback:(0,Q.jsx)(h,{size:20})},{name:`Instagram`,host:`instagram.com`,icon:`simple-icons:instagram`,fallback:(0,Q.jsx)(v,{size:20})},{name:`Reddit`,host:`reddit.com`,icon:`simple-icons:reddit`,fallback:(0,Q.jsx)(c,{size:20})},{name:`Wikipedia`,host:`wikipedia.org`,icon:`simple-icons:wikipedia`,fallback:(0,Q.jsx)(g,{size:20})},{name:`Apple`,host:`apple.com`,icon:`simple-icons:apple`,fallback:(0,Q.jsx)(s,{size:20})},{name:`Telegram`,host:`telegram.org`,icon:`simple-icons:telegram`,fallback:(0,Q.jsx)(f,{size:20})},{name:`Discord`,host:`discord.com`,icon:`simple-icons:discord`,fallback:(0,Q.jsx)(y,{size:20})},{name:`TikTok`,host:`tiktok.com`,icon:`simple-icons:tiktok`,fallback:(0,Q.jsx)(l,{size:20})},{name:`npm`,host:`npmjs.com`,icon:`simple-icons:npm`,fallback:(0,Q.jsx)(b,{size:20})},{name:`Vercel`,host:`vercel.com`,icon:`simple-icons:vercel`,fallback:(0,Q.jsx)(te,{size:20})}],gt=5e3;function _t({icon:e,fallback:t}){let[n,r]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let t=new Image;t.onload=()=>r(!0),t.onerror=()=>r(!1),t.src=`https://api.iconify.design/${e.replace(`:`,`/`)}.svg`},[e]),(0,Q.jsxs)(`span`,{className:`brand-icon-wrap`,children:[(0,Q.jsx)(`span`,{className:`brand-icon-fallback ${n?`hidden`:``}`,children:t}),(0,Q.jsx)(`span`,{className:`brand-icon-real ${n?`visible`:``}`,children:(0,Q.jsx)(ht,{icon:e,width:20,height:20})})]})}function vt(){let{t:e,formatNumber:t}=a(),[n,r]=(0,S.useState)(new Map),[i,o]=(0,S.useState)(!1),s=(0,S.useRef)(new Map);(0,S.useEffect)(()=>{document.title=e(`ping.meta.title`)},[e]);let c=(0,S.useCallback)(e=>{r(t=>{let n=new Map(t);return n.set(e,{status:`pending`,latency:0}),n});let t=new AbortController;s.current.set(e,t);let n=performance.now(),i=(t,n)=>{r(r=>{let i=new Map(r);return i.set(e,{status:t,latency:n}),i})},a=setTimeout(()=>{t.abort()},gt);fetch(`https://${e}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:t.signal}).then(()=>{clearTimeout(a),i(`ok`,Math.round(performance.now()-n))}).catch(()=>{clearTimeout(a),i(`timeout`,0)})},[]),l=(0,S.useCallback)(()=>{o(!0);let e=new Map;$.forEach(t=>{e.set(t.host,{status:`pending`,latency:0})}),r(e);let t=new Set($.map(e=>e.host));$.forEach(e=>{let n=new AbortController;s.current.set(e.host,n);let i=performance.now(),a=(n,i)=>{t.has(e.host)&&(t.delete(e.host),r(t=>{let r=new Map(t);return r.set(e.host,{status:n,latency:i}),r}),t.size===0&&o(!1))},c=setTimeout(()=>{n.abort()},gt);fetch(`https://${e.host}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:n.signal}).then(()=>{clearTimeout(c),a(`ok`,Math.round(performance.now()-i))}).catch(()=>{clearTimeout(c),a(`timeout`,0)})})},[]);return(0,S.useEffect)(()=>(l(),()=>{s.current.forEach(e=>e.abort()),s.current.clear()}),[l]),(0,Q.jsxs)(`div`,{className:`ping-page`,children:[(0,Q.jsxs)(`div`,{className:`ping-header`,children:[(0,Q.jsxs)(`div`,{className:`ping-title-wrap`,children:[(0,Q.jsx)(p,{size:28,className:`ping-title-icon`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`ping-title`,children:e(`ping.title`)}),(0,Q.jsx)(`p`,{className:`ping-subtitle`,children:e(`ping.subtitle`)})]})]}),(0,Q.jsx)(`button`,{className:`btn btn-icon`,onClick:l,disabled:i,"aria-label":e(`ping.retryAll`),title:e(`ping.retryAll`),children:(0,Q.jsx)(x,{size:18,className:i?`ping-spin`:``})})]}),(0,Q.jsx)(`div`,{className:`ping-grid`,children:$.map(r=>{let i=n.get(r.host),a=!i||i.status===`pending`,o=i?.status===`timeout`;return(0,Q.jsxs)(`div`,{className:`ping-card ${a?`pending`:``}`,children:[(0,Q.jsxs)(`div`,{className:`ping-card-top`,children:[(0,Q.jsx)(`span`,{className:`ping-card-icon`,children:(0,Q.jsx)(_t,{icon:r.icon,fallback:r.fallback})}),(0,Q.jsx)(`a`,{href:`https://${r.host}`,target:`_blank`,rel:`noreferrer`,className:`ping-card-name`,children:r.name}),(0,Q.jsx)(`button`,{className:`ping-card-refresh`,onClick:()=>c(r.host),disabled:a,"aria-label":e(`ping.retryOne`,{name:r.name}),title:e(`ping.retry`),children:(0,Q.jsx)(x,{size:13,className:a?`ping-spin`:``})})]}),(0,Q.jsxs)(`div`,{className:`ping-card-bottom`,children:[a?(0,Q.jsx)(`span`,{className:`ping-pulse-dot`}):(0,Q.jsx)(`span`,{className:`ping-status-label ${o?`is-error`:`is-success`}`,children:e(o?`ping.unavailable`:`ping.available`)}),(0,Q.jsx)(`span`,{className:`ping-latency ${a?`is-muted`:o?`is-error`:`is-success`}`,children:a?`--`:o?e(`ping.timeout`):`${t(i.latency)} ms`})]})]},r.host)})})]})}function yt(){return(0,Q.jsx)(m,{children:(0,Q.jsx)(vt,{})})}var bt=i(`/ping/`)({component:yt});export{bt as Route};
@@ -0,0 +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,E as a,H as o,O as s,_ as c,g as l,h as u,k as d,t as f,x as p,y as m}from"./useAppStore-DNhyhD20.js";import{a as h}from"./i18n-C6yaqRst.js";import{t as g}from"./copy-OwXDsstV.js";import{t as _}from"./AppShell-BdRKZIZ9.js";import{t as ee}from"./play-DSHtNcOe.js";import{a as v,i as te,n as ne,r as re,t as ie}from"./useGameRoom-asr2gyY6.js";import{M as ae,g as oe}from"./index-D1mozno-.js";var se=i(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),y=t(e(),1),b=[10,20,50,100],x=[`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`J`,`Q`,`K`,`A`],S=[`D`,`C`,`H`,`S`],C=new Map(x.map((e,t)=>[e,t+2])),ce=new Map(S.map((e,t)=>[e,t+1])),w={high:1,pair:2,straight:3,flush:4,straightFlush:5,triple:6},le={[w.high]:`散牌`,[w.pair]:`对子`,[w.straight]:`顺子`,[w.flush]:`金花`,[w.straightFlush]:`顺金`,[w.triple]:`豹子`};function T(e){return m(e)}function E(e=`zhajinhua`){return u(e)}function D(){return E(`round`)}function O(){let e=[];for(let t of S)for(let n of x)e.push(`${n}${t}`);return e}function k(e=O(),t=Math.random){let n=[...e];for(let e=n.length-1;e>0;e--){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function A(e){let t=String(e||``).trim().toUpperCase(),n=t.slice(-1),r=t.slice(0,-1);if(!C.has(r)||!ce.has(n))throw Error(`Invalid card: ${e}`);return{id:`${r}${n}`,rank:r,suit:n,rankValue:C.get(r),suitValue:ce.get(n)}}function j(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r]||0,i=t[r]||0;if(n!==i)return n-i}return 0}function M(e){let t=[...new Set(e)].sort((e,t)=>e-t);return t.length===3?t[0]===2&&t[1]===3&&t[2]===14?3:t[0]+1===t[1]&&t[1]+1===t[2]?t[2]:0:0}function N(e){if(!Array.isArray(e)||e.length!==3)throw Error(`炸金花手牌必须是 3 张牌`);let t=e.map(A),n=t.map(e=>e.rankValue),r=new Map;for(let e of n)r.set(e,(r.get(e)||0)+1);let i=new Set(t.map(e=>e.suit)).size===1,a=M(n),o=[...n].sort((e,t)=>t-e),s=Math.max(...t.map(e=>e.suitValue)),c=w.high,l=o;return r.size===1?(c=w.triple,l=[o[0]]):a&&i?(c=w.straightFlush,l=[a]):i?(c=w.flush,l=o):a?(c=w.straight,l=[a]):r.size===2&&(c=w.pair,l=[[...r.entries()].find(([,e])=>e===2)[0],[...r.entries()].find(([,e])=>e===1)[0]]),{category:c,label:le[c],tiebreakers:l,tieSuit:s,cards:t.map(e=>e.id)}}function P(e,t){let n=N(e),r=N(t);if(n.category!==r.category)return n.category-r.category;let i=j(n.tiebreakers,r.tiebreakers);return i===0?n.tieSuit-r.tieSuit:i}function ue(e){return N(e).label}function de({roundId:e,action:t,amount:n,target:r}){return{roundId:e,eventId:E(`action`),action:t,amount:n,target:r}}function fe(e=[]){let t=e.filter(e=>Number(e.chips)>=10);return t.length>=2&&t.length<=5}function pe({roomCode:e,players:t,hostAddress:n,previousSeq:r=0,previousWinner:i=``,roundId:a=D(),random:o=Math.random}){let s=t.filter(e=>Number(e.chips)>=10).slice(0,5);if(s.length<2)throw Error(`至少需要 2 名有足够筹码的玩家`);let u=k(O(),o),d={},f=s.map((e,t)=>{let n=u.slice(t*3,t*3+3);return d[e.address]=n,{address:e.address,name:e.name,avatar:c(e.avatar),publicKey:e.publicKey,chips:Number(e.chips)-10,status:`active`,looked:!1,bet:10}}),p,m=l(i),h=m?f.findIndex(e=>l(e.address)===m):-1;return p=h>=0?f[h].address:f[Math.floor(o()*f.length)].address,{roomCode:T(e),roundId:a,status:`playing`,host:l(n),seq:r+1,startedAt:Date.now(),ante:10,pot:10*f.length,currentBet:10,turnAddress:p,players:f,lastAction:`本局开始`,winner:null,showdown:null,appliedEventIds:[],hands:d,actionCounts:{},compareReveal:{}}}function me(e){if(!e)return null;let t={...e};return delete t.hands,W(t)}function he(e,t){let n=F(e);return!n||!t||typeof t!=`object`?null:{...n,hands:W(t)}}function F(e){return!e||typeof e!=`object`||!e.roundId||!Array.isArray(e.players)?null:{roomCode:T(e.roomCode),roundId:String(e.roundId),status:e.status===`finished`?`finished`:`playing`,host:l(e.host),seq:Number(e.seq)||1,startedAt:Number(e.startedAt)||Date.now(),ante:Number(e.ante)||10,pot:Math.max(0,Number(e.pot)||0),currentBet:Math.max(0,Number(e.currentBet)||10),turnAddress:l(e.turnAddress),players:e.players.map(U).filter(Boolean),lastAction:String(e.lastAction||``),winner:e.winner?l(e.winner):null,showdown:e.showdown&&typeof e.showdown==`object`?W(e.showdown):null,appliedEventIds:Array.isArray(e.appliedEventIds)?e.appliedEventIds.map(String):[],actionCounts:e.actionCounts&&typeof e.actionCounts==`object`?W(e.actionCounts):{},compareReveal:e.compareReveal&&typeof e.compareReveal==`object`?W(e.compareReveal):{},lastCompare:e.lastCompare&&typeof e.lastCompare==`object`?W(e.lastCompare):null,finishedAt:e.finishedAt?Number(e.finishedAt):null}}function I(e,t,n){let r=F(e);if(!r||r.status!==`playing`)return{ok:!1,error:`当前没有进行中的牌局`};let i=l(n),a=r.players.find(e=>e.address===i);if(!a||a.status!==`active`)return{ok:!1,error:`玩家不在本轮牌局中`};if(r.turnAddress!==i)return{ok:!1,error:`还没有轮到你操作`};let o=t?.action;if(![`look`,`call`,`raise`,`compare`,`fold`].includes(o))return{ok:!1,error:`未知操作`};if(o===`look`)return a.looked?{ok:!1,error:`已经看过牌`}:{ok:!0};if(o===`call`)return a.chips>=10?{ok:!0}:{ok:!1,error:`筹码不足,不能跟注`};if(o===`raise`){let e=Number(t.amount);if(!b.includes(e))return{ok:!1,error:`加注档位无效`};let n=r.currentBet+e-a.bet;return a.chips>=n?{ok:!0}:{ok:!1,error:`筹码不足,不能加注`}}if(o===`compare`){let e=l(t.target),n=r.players.find(t=>t.address===e);if(!e||e===i||!n||n.status!==`active`)return{ok:!1,error:`请选择有效的比牌对象`};if(!r.players.filter(e=>e.status===`active`).every(e=>(r.actionCounts?.[e.address]||0)>=1))return{ok:!1,error:`第一轮不能比牌,请先跟注或加注`};let o=Math.max(0,r.currentBet-a.bet);return a.chips>=o?{ok:!0}:{ok:!1,error:`筹码不足,不能比牌`}}return{ok:!0}}function L(e,t,n){let r=I(e,t,n);if(!r.ok)return{ok:!1,error:r.error,state:e};let i=W(e),a=l(n),o=i.players.find(e=>e.address===a),s=String(t.eventId);if(i.appliedEventIds?.includes(s))return{ok:!0,state:i,duplicate:!0};if(Array.isArray(i.appliedEventIds)||(i.appliedEventIds=[]),i.appliedEventIds.push(s),t.action===`look`)return o.looked=!0,i.lastAction=`${o.name} 看牌`,H(i);if(t.action===`fold`)return o.status=`folded`,i.lastAction=`${o.name} 弃牌`,B(i,a),V(i,a);if(t.action===`call`)return o.chips-=10,o.bet+=10,i.pot+=10,i.lastAction=`${o.name} 跟注`,B(i,a),V(i,a);if(t.action===`raise`){let e=Number(t.amount);return i.currentBet+=e,z(i,o),i.lastAction=`${o.name} 加注 ${e}`,B(i,a),V(i,a)}if(t.action===`compare`){z(i,o);let e=l(t.target),n=i.players.find(t=>t.address===e),r=o.looked,s=n.looked,c=P(i.hands?.[a]||[],i.hands?.[e]||[]),u=c>=0?o:n,d=c>=0?n:o;d.status=`folded`,d.looked=!0,i.compareReveal||={};let f=r&&s,p=!r&&!s;if(f)i.compareReveal[a]=i.hands?.[e]||[],i.compareReveal[e]=i.hands?.[a]||[];else if(p)i.compareReveal[d.address]=i.hands?.[u.address]||[];else{let e=r?o:n,t=r?n:o;i.compareReveal[e.address]=i.hands?.[t.address]||[],i.compareReveal[d.address]=i.hands?.[u.address]||[]}return i.lastCompare={initiator:a,target:e,winner:u.address,loser:d.address,initiatorLooked:r,targetLooked:s,timestamp:Date.now()},i.lastAction=`${o.name} 与 ${n.name} 比牌,${d.name} 出局`,B(i,a),V(i,a)}return{ok:!1,error:`未知操作`,state:e}}function R(e){return(e?.players||[]).filter(e=>e.status===`active`)}function ge(e,t){let n=(e?.players||[]).find(e=>e.address===l(t));if(!e||e.status!==`playing`||!n||n.status!==`active`||e.turnAddress!==n.address)return[];let r=[];return n.looked||r.push(`look`),I(e,{action:`call`},n.address).ok&&r.push(`call`),b.some(t=>I(e,{action:`raise`,amount:t},n.address).ok)&&r.push(`raise`),R(e).length>1&&e.players.filter(e=>e.status===`active`).every(t=>(e.actionCounts?.[t.address]||0)>=1)&&r.push(`compare`),r.push(`fold`),r}function z(e,t){let n=Math.max(0,e.currentBet-t.bet);t.chips-=n,t.bet+=n,e.pot+=n}function B(e,t){e.actionCounts||={},e.actionCounts[t]=(e.actionCounts[t]||0)+1}function V(e,t){let n=R(e);return n.length===1?_e(e,n[0].address):(e.turnAddress=ve(e,t),H(e))}function _e(e,t){let n=e.players.find(e=>e.address===t),r=e.pot;return n&&(n.chips+=e.pot),e.status=`finished`,e.winner=t,e.winAmount=r,e.turnAddress=``,e.showdown=e.hands?W(e.hands):null,e.lastAction=n?`${n.name} 赢得 ${r} 筹码`:`本局结束`,e.pot=0,e.finishedAt=Date.now(),H(e)}function ve(e,t){let n=e.players,r=Math.max(0,n.findIndex(e=>e.address===l(t)));for(let e=1;e<=n.length;e++){let t=n[(r+e)%n.length];if(t.status===`active`)return t.address}return``}function H(e){return e.seq=Number(e.seq||0)+1,{ok:!0,state:e}}function U(e){if(!e||typeof e!=`object`)return null;let t=l(e.address);return t?{address:t,name:String(e.name||p(t)).slice(0,50),avatar:c(e.avatar),publicKey:String(e.publicKey||``),chips:Math.max(0,Number(e.chips)||0),status:e.status===`folded`?`folded`:`active`,looked:e.looked===!0,bet:Math.max(0,Number(e.bet)||0)}:null}function W(e){return JSON.parse(JSON.stringify(e))}var G={page:`_page_p8eol_1`,headerActions:`_headerActions_p8eol_12`,entry:`_entry_p8eol_18`,entryBrand:`_entryBrand_p8eol_28`,cardMark:`_cardMark_p8eol_34`,entryPanel:`_entryPanel_p8eol_62`,accountLine:`_accountLine_p8eol_72`,joinForm:`_joinForm_p8eol_89`,status:`_status_p8eol_110`,board:`_board_p8eol_116`,table:`_table_p8eol_123`,tableCenter:`_tableCenter_p8eol_144`,finishBanner:`_finishBanner_p8eol_173`,finishBannerIcon:`_finishBannerIcon_p8eol_192`,seats:`_seats_p8eol_196`,seat:`_seat_p8eol_196`,seatTurn:`_seatTurn_p8eol_218`,seatWinner:`_seatWinner_p8eol_223`,seatFolded:`_seatFolded_p8eol_228`,seatAvatar:`_seatAvatar_p8eol_232`,seatAvatarOffline:`_seatAvatarOffline_p8eol_252`,onlineDot:`_onlineDot_p8eol_257`,seatMain:`_seatMain_p8eol_269`,seatMeta:`_seatMeta_p8eol_270`,panel:`_panel_p8eol_301`,panelSection:`_panelSection_p8eol_308`,panelTitle:`_panelTitle_p8eol_318`,hand:`_hand_p8eol_328`,card:`_card_p8eol_34`,red:`_red_p8eol_362`,black:`_black_p8eol_366`,cardBack:`_cardBack_p8eol_370`,handLabel:`_handLabel_p8eol_391`,actionGrid:`_actionGrid_p8eol_398`,raiseRow:`_raiseRow_p8eol_399`,statusGrid:`_statusGrid_p8eol_410`,muted:`_muted_p8eol_428`,compareOverlay:`_compareOverlay_p8eol_435`,compareBox:`_compareBox_p8eol_447`,compareTitle:`_compareTitle_p8eol_461`,comparePlayers:`_comparePlayers_p8eol_467`,compareSide:`_compareSide_p8eol_474`,compareWinner:`_compareWinner_p8eol_486`,compareName:`_compareName_p8eol_491`,compareCards:`_compareCards_p8eol_502`,compareLabel:`_compareLabel_p8eol_527`,compareVs:`_compareVs_p8eol_533`,compareResult:`_compareResult_p8eol_540`},K=n(),q=`zhajinhua`;function J(...e){return e.filter(Boolean).join(` `)}function Y(e,t){return String(e||``).toLowerCase()===String(t||``).toLowerCase()}function ye(e=``){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function be(e){return e.displayName||e.username}function xe(e){let t=String(e||``),n=t.slice(-1);return{rank:t.slice(0,-1),suit:{S:`♠`,H:`♥`,C:`♣`,D:`♦`}[n]||n,color:n===`H`||n===`D`?`red`:`black`}}function X(){let{t:e}=h(),t=f(e=>e.addToast),n=a(e=>e.initializeUser),[i,o]=(0,y.useState)(``),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)(``),p=(0,y.useRef)(!1),[m,x]=(0,y.useState)(20),[S,C]=(0,y.useState)(``),[ce,w]=(0,y.useState)({}),[le,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(!1),O=(0,y.useRef)(null),k=(0,y.useRef)(new Set),A=ie({gameId:q,onError:e=>t(e,`error`),getPlayerPayload:e=>{let t=s(e.danger);return{address:e.address,name:be(e),avatar:e.avatar||``,publicKey:t.public_key,joinedAt:Date.now()}}}),j=(0,y.useMemo)(()=>A.userIdentity?.danger?s(A.userIdentity.danger):null,[A.userIdentity?.danger]);(0,y.useEffect)(()=>{n()},[n]),(0,y.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`room`)?.toUpperCase();e&&(o(e),u.current=e)},[]),(0,y.useEffect)(()=>{let n=u.current;!n||p.current||!A.isBackendReady||!A.userIdentity||(p.current=!0,u.current=``,A.joinRoom(n).then(n=>{n&&t(e(`game.toast.joinedRoom`),`success`)}))},[A.isBackendReady,A.userIdentity,A.joinRoom,t,e]),(0,y.useEffect)(()=>{if(!A.roomCode)return;let e=`/game/zhajinhua?room=${A.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,``,e)},[A.roomCode]);let M=(0,y.useMemo)(()=>ne(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode]),N=(0,y.useMemo)(()=>re(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode])?.payload?.round||null,P=N?.host||M.hostAddress,F=Y(P,A.userIdentity?.address),I=A.userIdentity?.address?.toLowerCase()||``,z=N?.players.find(e=>Y(e.address,I)),B=z||M.players.find(e=>Y(e.address,I)),V=ce[N?.roundId||``]||null,_e=N?.showdown&&I?N.showdown[I]:null,ve=N?.compareReveal&&I?N.compareReveal[I]:null,H=_e||ve||(z?.looked?V:null),U=ge(N,I),W=R(N),X=F&&fe(M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3}))),Q=A.roomCode&&typeof window<`u`?`${window.location.origin}/game/zhajinhua?room=${A.roomCode}`:``;(0,y.useEffect)(()=>{if(!(!N||!A.userIdentity||!j||!P))for(let e of A.roomEvents){let t=e.event;if(!t||t.event!==`deal:private`)continue;let n=t.payload;if(n.roundId!==N.roundId||!Y(n.recipient,A.userIdentity.address))continue;let r=d(n.encrypted||``,{senderPublicKey:n.senderPublicKey||``,recipientPrivateKey:j.private_key});if(r)try{let e=JSON.parse(r);Array.isArray(e)&&w(t=>({...t,[N.roundId]:e.map(String)}))}catch{}}},[N?.roundId,A.roomEvents,A.userIdentity,P,j?.private_key]),(0,y.useEffect)(()=>{if(N?.status===`finished`&&N.winner){T(!0);let e=setTimeout(()=>T(!1),5e3);return()=>clearTimeout(e)}},[N?.finishedAt,N?.status,N?.winner]),(0,y.useEffect)(()=>{if(N?.lastCompare?.timestamp){D(!0);let e=setTimeout(()=>D(!1),5e3);return()=>clearTimeout(e)}else D(!1)},[N?.lastCompare?.timestamp,N?.roundId]),(0,y.useEffect)(()=>{if(!F||!N||N.status!==`playing`)return;let e=O.current;if(!e)return;let t=A.roomEvents.filter(e=>{let t=e.event;if(!t||t.event!==`player:action`)return!1;let n=t.payload.actionEvent;return!(!n||n.roundId!==N.roundId||k.current.has(n.eventId)||N.appliedEventIds?.includes(n.eventId))});if(t.length===0)return;let n=!1;async function r(){let r=he(N,e);if(r)for(let e of t){if(n)return;let t=(e.event?.payload).actionEvent,i=L(r,t,e.message.author);if(!i.ok){let n=e.message.author;if(!Y(n,A.userIdentity?.address)&&r.status===`playing`&&Y(r.turnAddress,n)){let e=L(r,de({roundId:r.roundId,action:`call`,amount:void 0,target:void 0}),n);if(e.ok)i=e;else{let e=L(r,de({roundId:r.roundId,action:`fold`,amount:void 0,target:void 0}),n);e.ok&&(i=e)}}if(!i.ok){k.current.add(t.eventId);continue}}if(r=i.state,O.current=i.state.hands,await De(i.state)&&k.current.add(t.eventId),i.state.status===`finished`)break}}return r(),()=>{n=!0}},[N?.roundId,N?.seq,N?.status,A.roomEvents,F]);async function we(){await A.createRoom()&&t(e(`game.toast.roomCreated`),`success`)}async function Te(n){n.preventDefault(),await A.joinRoom(i)&&t(e(`game.toast.joinedRoom`),`success`)}async function Ee(){Q&&(await navigator.clipboard.writeText(Q),l(!0),setTimeout(()=>l(!1),1400))}async function De(e){return A.sendRoomEvent(`room:state`,{round:me(e),seq:e.seq})}async function Oe(){if(!A.userIdentity||!j||!X){t(e(`game.zhajinhua.error.notEnoughPlayers`),`error`);return}try{let n=M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3})),i=pe({roomCode:A.roomCode,players:n,hostAddress:A.userIdentity.address,previousSeq:N?.seq||0,previousWinner:N?.winner||``});O.current=i.hands,k.current.clear(),await De(i);for(let e of i.players){let t=r(JSON.stringify(i.hands[e.address]),{senderPrivateKey:j.private_key,recipientPublicKey:e.publicKey});await A.sendRoomEvent(`deal:private`,{roundId:i.roundId,recipient:e.address,senderPublicKey:j.public_key,encrypted:t})}w(e=>({...e,[i.roundId]:i.hands[A.userIdentity.address.toLowerCase()]})),t(e(`game.zhajinhua.toast.roundStarted`),`success`)}catch(n){t(n instanceof Error?n.message:e(`game.zhajinhua.error.startFailed`),`error`)}}async function $(e,t={}){if(!N||!A.userIdentity)return;let n=de({roundId:N.roundId,action:e,amount:t.amount,target:t.target});await A.sendRoomEvent(`player:action`,{actionEvent:n})}let ke=N?.status===`playing`?Y(N.turnAddress,I)?e(`game.zhajinhua.status.yourTurn`):N.turnAddress?e(`game.zhajinhua.status.waitingPlayer`,{player:Z(N.turnAddress,M.players,A.presenceByAddress)}):e(`game.status.playing`):N?.status===`finished`?e(`game.status.finished`):e(`game.status.waitingStart`),Ae=W.filter(e=>!Y(e.address,I));return(0,K.jsx)(_,{sidebar:({closeSidebar:e})=>(0,K.jsx)(te,{activeGame:`zhajinhua`,closeSidebar:e}),headerTitle:(0,K.jsx)(`h2`,{className:`header-title`,children:e(`game.zhajinhua.title`)}),headerRight:(0,K.jsx)(`div`,{className:G.headerActions,children:A.roomCode&&(0,K.jsxs)(`button`,{className:`btn btn-sm`,onClick:Ee,children:[(0,K.jsx)(g,{size:14}),e(c?`common.copied`:`game.action.shareRoom`)]})}),children:(0,K.jsx)(`main`,{className:G.page,children:A.roomCode?(0,K.jsxs)(`div`,{className:G.board,children:[(0,K.jsxs)(`section`,{className:G.table,children:[N?.status===`finished`&&N.winner&&le&&(0,K.jsxs)(`div`,{className:G.finishBanner,children:[(0,K.jsx)(`span`,{className:G.finishBannerIcon,children:`🏆`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.result.winChips`,{player:Z(N.winner,M.players,A.presenceByAddress),amount:N.winAmount??0})})]}),N?.lastCompare&&E&&(0,K.jsx)(Se,{lastCompare:N.lastCompare,compareReveal:N.compareReveal||{},myAddress:I,myDealtHand:V,lobbyPlayers:M.players,presenceByAddress:A.presenceByAddress,onClose:()=>D(!1)}),(0,K.jsxs)(`div`,{className:G.tableCenter,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.pot`)}),(0,K.jsx)(`strong`,{children:N?.pot||0}),(0,K.jsx)(`small`,{children:e(`game.zhajinhua.currentBet`,{amount:N?.currentBet||0})})]}),(0,K.jsx)(`div`,{className:G.seats,children:M.players.map(t=>{let n=N?.players.find(e=>Y(e.address,t.address)),r=Ce(t,A.presenceByAddress,A.onlineAddresses),i=N?.turnAddress===t.address,a=N?.winner===t.address,o=n?.status===`folded`;return(0,K.jsxs)(`div`,{className:J(G.seat,i&&G.seatTurn,a&&G.seatWinner,o&&G.seatFolded),children:[(0,K.jsxs)(`div`,{className:J(G.seatAvatar,!r.online&&G.seatAvatarOffline),children:[(0,K.jsx)(`img`,{src:oe(t.address,r.avatar),alt:``}),r.online&&(0,K.jsx)(`span`,{className:G.onlineDot})]}),(0,K.jsxs)(`div`,{className:G.seatMain,children:[(0,K.jsx)(`strong`,{translate:`no`,children:r.name}),(0,K.jsx)(`span`,{translate:`no`,children:ye(t.address)})]}),(0,K.jsxs)(`div`,{className:G.seatMeta,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.chips`,{amount:n?.chips??1e3})}),(0,K.jsx)(`span`,{children:n?.status===`folded`?e(`game.zhajinhua.player.folded`):n?.looked?e(`game.zhajinhua.player.looked`):e(N?`game.zhajinhua.player.inRound`:`game.status.waitingStart`)})]})]},t.address)})})]}),(0,K.jsxs)(`aside`,{className:G.panel,children:[(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(v,{size:16}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myHand`)})]}),(0,K.jsx)(`div`,{className:G.hand,children:H?H.map(e=>{let t=xe(e),n=`${t.suit}${t.rank}`;return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),(0,K.jsx)(`p`,{className:G.handLabel,children:H?ue(H):e(V?`game.zhajinhua.hand.unlooked`:`game.zhajinhua.hand.waitingDeal`)})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(ee,{size:16}),(0,K.jsx)(`span`,{children:e(`game.actions`)})]}),F?(0,K.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:Oe,disabled:!X||N?.status===`playing`,children:[(0,K.jsx)(se,{size:16}),N?.status===`finished`?e(`game.action.nextRound`):e(`game.action.startRound`)]}):(0,K.jsx)(`p`,{className:G.muted,children:e(`game.waitingHost`)}),F&&N?.status===`finished`&&!X&&(0,K.jsx)(`p`,{className:G.muted,children:e(`game.zhajinhua.error.tooManyLowChips`)}),(0,K.jsxs)(`div`,{className:G.actionGrid,children:[(0,K.jsxs)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`look`),onClick:()=>$(`look`),children:[(0,K.jsx)(ae,{size:16}),e(`game.zhajinhua.action.look`)]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`call`),onClick:()=>$(`call`),children:e(`game.zhajinhua.action.call`)}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`fold`),onClick:()=>$(`fold`),children:e(`game.zhajinhua.action.fold`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsx)(`select`,{className:`input input-compact`,value:m,onChange:e=>x(Number(e.target.value)),children:b.map(t=>(0,K.jsx)(`option`,{value:t,children:e(`game.zhajinhua.action.raiseOption`,{amount:t})},t))}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`raise`),onClick:()=>$(`raise`,{amount:m}),children:e(`game.zhajinhua.action.raise`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsxs)(`select`,{className:`input input-compact`,value:S,onChange:e=>C(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:e(`game.zhajinhua.action.comparePlaceholder`)}),Ae.map(e=>(0,K.jsx)(`option`,{value:e.address,children:Z(e.address,Ae,A.presenceByAddress)},e.address))]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`compare`)||!S,onClick:()=>$(`compare`,{target:S}),children:e(`game.zhajinhua.action.compare`)})]})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsx)(`div`,{className:G.panelTitle,children:e(`game.status.title`)}),(0,K.jsxs)(`div`,{className:G.statusGrid,children:[(0,K.jsx)(`span`,{children:e(`game.host`)}),(0,K.jsx)(`strong`,{children:P?ye(P):`-`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myChips`)}),(0,K.jsx)(`strong`,{children:B?.chips??1e3}),(0,K.jsx)(`span`,{children:e(`game.round`)}),(0,K.jsx)(`strong`,{children:ke}),(0,K.jsx)(`span`,{children:e(`game.hint`)}),(0,K.jsx)(`strong`,{children:N?.lastAction||e(`game.waitingPlayers`)})]})]})]})]}):(0,K.jsxs)(`section`,{className:G.entry,children:[(0,K.jsxs)(`div`,{className:G.entryBrand,children:[(0,K.jsx)(`div`,{className:G.cardMark,children:(0,K.jsx)(v,{size:48})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:e(`game.zhajinhua.hero.title`)}),(0,K.jsx)(`p`,{children:e(`game.hero.desc`)})]})]}),(0,K.jsxs)(`div`,{className:G.entryPanel,children:[(0,K.jsxs)(`div`,{className:G.accountLine,children:[(0,K.jsx)(`span`,{children:e(`game.currentAccount`)}),(0,K.jsx)(`strong`,{translate:`no`,children:A.userIdentity?.displayName||e(`web3.notSignedIn`)})]}),(0,K.jsxs)(`button`,{className:`btn btn-primary`,disabled:A.joining,onClick:we,children:[(0,K.jsx)(ee,{size:16}),e(`game.action.createRoom`)]}),(0,K.jsxs)(`form`,{onSubmit:Te,className:G.joinForm,children:[(0,K.jsxs)(`label`,{children:[e(`game.roomCode`),(0,K.jsx)(`input`,{value:i,maxLength:8,onChange:e=>o(e.target.value.toUpperCase()),placeholder:e(`game.roomCode.placeholder`)})]}),(0,K.jsx)(`button`,{className:`btn`,disabled:A.joining||!i,children:e(`game.action.joinRoom`)})]}),(0,K.jsx)(`p`,{className:G.status,children:A.isBackendReady?e(`game.status.nodeConnected`):e(`game.status.nodeConnecting`)})]})]})})})}function Se({lastCompare:e,compareReveal:t,myAddress:n,myDealtHand:r,lobbyPlayers:i,presenceByAddress:a,onClose:o}){let{t:s}=h(),c=Z(e.initiator,i,a),l=Z(e.target,i,a),u=Z(e.winner,i,a),d=Y(n,e.initiator),f=Y(n,e.target),p=d||f;function m(e,i){return t[e]||(p&&Y(e,n)&&i&&r?r:null)}let g=m(e.initiator,e.initiatorLooked),_=m(e.target,e.targetLooked);return(0,K.jsx)(`div`,{className:G.compareOverlay,onClick:o,children:(0,K.jsxs)(`div`,{className:G.compareBox,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:G.compareTitle,children:s(`game.zhajinhua.compareResult`)}),(0,K.jsxs)(`div`,{className:G.comparePlayers,children:[(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.initiator)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:c}),(0,K.jsx)(`div`,{className:G.compareCards,children:g?g.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),g&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(g)})]}),(0,K.jsx)(`div`,{className:G.compareVs,children:`VS`}),(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.target)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:l}),(0,K.jsx)(`div`,{className:G.compareCards,children:_?_.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),_&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(_)})]})]}),(0,K.jsx)(`div`,{className:G.compareResult,children:s(`game.zhajinhua.result.winner`,{player:u})}),(0,K.jsx)(`button`,{className:`btn btn-sm`,onClick:o,children:s(`common.close`)})]})})}function Z(e,t,n){let r=Q(e);return n.get(r)?.displayName||t.find(e=>Q(e.address)===r)?.name||ye(e)}function Q(e=``){return String(e||``).trim().toLowerCase()}function Ce(e,t,n){let r=Q(e.address),i=t.get(r);return{name:Z(e.address,[e],t),avatar:i?.avatar||e.avatar||``,online:r?n.has(r):!1}}var we=o(`/game/zhajinhua/`)({component:X});export{we as Route};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,c as o,o as s,t as c,u as l}from"./useAppStore-DNhyhD20.js";import{a as ee}from"./i18n-C6yaqRst.js";import{t as te}from"./OpenSidebarButton-OP8zl7ad.js";import{a as u,i as d,n as ne,o as re,r as f,t as ie}from"./saveLocalFile-2CNt4X0T.js";import{t as ae}from"./arrow-up-down-DvLSz6Ma.js";import{a as p}from"./AccountMenu-D-wa5tux.js";import{n as oe,t as se}from"./trash-2-B9gno5q6.js";import{t as ce}from"./copy-OwXDsstV.js";import{t as le}from"./download-Cy2BlfKM.js";import{t as ue}from"./file-text-zvTER2mN.js";import{t as m}from"./folder-6pYYnS2-.js";import{t as de}from"./loader-C4pED_QP.js";import{r as h,t as fe}from"./AppShell-BdRKZIZ9.js";import{t as g}from"./music-Br2x8TKX.js";import{t as pe}from"./search-DLBOUfny.js";import{t as me}from"./upload-BmufnMFu.js";import{C as he,O as _,T as v,w as ge}from"./index-D1mozno-.js";import{t as _e}from"./AppTop-BE5kKBYH.js";import{t as ve}from"./format-CAKfypjK.js";import{a as ye,i as be,n as y,r as xe,t as Se}from"./downloadValidation-Dd43i9_9.js";var Ce=r(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),we=r(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Te=r(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),b=t(e(),1);function Ee(e={}){let t=e.timeout??2e3,[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!1),o=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var x=n();function De(e){let t=e.lastIndexOf(`/`);return t===-1?{folder:``,name:e}:{folder:e.substring(0,t),name:e.substring(t+1)}}function Oe({file:e,isSelected:t,onSelect:n,onPreview:r}){let i=f(e.fileName),a=(0,x.jsx)(ue,{size:24,color:`#fff`});return i===`image`?a=(0,x.jsx)(d,{size:24,color:`#fff`}):i===`video`?a=(0,x.jsx)(u,{size:24,color:`#fff`}):i===`audio`&&(a=(0,x.jsx)(g,{size:24,color:`#fff`})),(0,x.jsxs)(`div`,{"data-id":e.cid,onClick:()=>n(e.cid),onDoubleClick:()=>r(e),className:`card ${t?`selected`:``}`,children:[(0,x.jsx)(`div`,{className:`card-icon ${e.starred?`starred`:`file`}`,children:a}),(0,x.jsx)(`p`,{className:`card-name`,translate:`no`,children:De(e.fileName).name})]})}function ke({folder:e,onClick:t}){return(0,x.jsxs)(`div`,{onClick:t,className:`card`,children:[(0,x.jsx)(`div`,{className:`card-icon folder`,children:(0,x.jsx)(m,{size:28,color:`#fff`})}),(0,x.jsx)(`p`,{className:`card-name`,translate:`no`,children:e.name})]})}function S(e,t){return e?[{path:``,name:t},...e.split(`/`).filter(Boolean).map((e,t,n)=>({path:n.slice(0,t+1).join(`/`),name:e}))]:[]}function Ae({items:e,allFolders:t,currentPath:n,onMove:r,onClose:i}){let[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(n),{t:l}=ee(),te=S(a,l(`move.root`));function u(){r(a||s.trim())}let d=t.filter(e=>{if(a===``)return!e.path.includes(`/`);let t=a+`/`;return e.path.startsWith(t)?!e.path.substring(t.length).includes(`/`):!1});return(0,x.jsx)(v,{onClose:i,children:(0,x.jsxs)(`div`,{className:`move-modal`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`modal-header`,children:[(0,x.jsx)(`h3`,{children:l(`move.title`)}),(0,x.jsx)(`button`,{type:`button`,onClick:i,className:`btn btn-icon`,children:(0,x.jsx)(_,{size:18})})]}),(0,x.jsx)(`p`,{className:`move-modal-desc`,children:l(`move.selectedCount`,{count:e.length})}),(0,x.jsx)(`div`,{className:`move-new-folder`,children:(0,x.jsx)(`input`,{type:`text`,className:`input`,value:s,onChange:e=>c(e.target.value),placeholder:l(`move.pathPlaceholder`),translate:`no`})}),(0,x.jsx)(`p`,{className:`move-modal-hint`,children:l(`move.pathExample`)}),(0,x.jsx)(`div`,{className:`move-breadcrumb`,children:te.map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[t>0&&(0,x.jsx)(`span`,{className:`breadcrumb-separator`,children:`/`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>{o(e.path),c(e.path)},className:`move-breadcrumb-btn ${a===e.path&&!s?`active`:``}`,children:(0,x.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.name})})]},e.path))}),(0,x.jsxs)(`div`,{className:`move-folder-list`,children:[d.length===0&&(0,x.jsx)(`p`,{className:`move-modal-empty`,children:l(`move.noSubfolders`)}),d.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:`move-folder-item ${a===e.path&&!s?`selected`:``}`,children:[(0,x.jsx)(m,{size:16}),(0,x.jsx)(`span`,{translate:`no`,children:e.name})]},e.path))]}),(0,x.jsxs)(`div`,{className:`modal-actions`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:i,className:`btn btn-secondary`,children:l(`common.cancel`)}),(0,x.jsx)(`button`,{type:`button`,onClick:u,className:`btn btn-primary`,children:l(`move.action`)})]})]})})}var C=`https://most.box`;function w(e){return String(e||``).trim()}function je(e,t){let n=w(t);return n?`most://${e}?filename=${encodeURIComponent(n)}`:`most://${e}`}function Me(e,t){let n=w(t),r=`${C}/cid/${encodeURIComponent(e)}`;return n?`${r}?filename=${encodeURIComponent(n)}`:r}function T(e){return De(e)}function Ne(e){let t=new Set;return e.forEach(e=>{let{folder:n}=T(e.fileName),r=n.split(`/`).filter(Boolean),i=``;for(let e of r)i+=(i?`/`:``)+e,t.add(i)}),[...t].sort()}function Pe(e,t){let n=t?t+`/`:``;return e.filter(e=>{let t=e.toLowerCase().startsWith(n.toLowerCase()),r=e.substring(n.length);return t&&!r.includes(`/`)}).map(e=>({name:e.substring(n.length),path:e}))}function Fe(e,t,n){return{folders:Pe(t,n),files:e.filter(e=>T(e.fileName).folder===n)}}function Ie(e,t){return e?[{path:``,name:t},...e.split(`/`).filter(Boolean).map((e,t,n)=>({path:n.slice(0,t+1).join(`/`),name:e}))]:[]}function E(){let e=c(e=>e.addToast),t=c(e=>e.hasBackend),n=c(e=>e.openConnectModal),r=i(e=>e.identity),a=i(e=>e.openLoginModal),[u,d]=(0,b.useState)([]),[m,g]=(0,b.useState)([]),[De,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(`all`),[Pe,E]=(0,b.useState)(!1),[D,O]=(0,b.useState)([]),[Le,k]=(0,b.useState)(null),[A,j]=(0,b.useState)(null),[Re,ze]=h(!1),[Be,Ve]=(0,b.useState)(``),[M,N]=(0,b.useState)(null),[P,He]=(0,b.useState)(!1),[Ue,F]=(0,b.useState)([]),[We,I]=h(!1),[L,R]=(0,b.useState)(``),{copy:Ge,copied:Ke}=Ee({timeout:2e3}),{copy:qe,copied:Je}=Ee({timeout:2e3}),[Ye,Xe]=h(!1),[z,B]=(0,b.useState)(null),[V,Ze]=(0,b.useState)(null),[Qe,$e]=(0,b.useState)(!1),{t:H,formatDate:et}=ee(),U=t===!0,tt=e=>e?et(e):``,W=De||``,nt=Ne(u),{folders:rt,files:it}=Fe(u,nt,W);function G(){return U?!0:(n(),!1)}function K(){return r?!0:(a(),!1)}let at=L?u.filter(e=>T(e.fileName).name.toLowerCase().includes(L.toLowerCase())):it,q=async()=>{if(!U||!r){d([]);return}try{d(await y.listPublishedFiles()||[])}catch{d([])}},J=async()=>{if(!U||!r){g([]);return}try{g(await y.listTrashFiles()||[])}catch{g([])}},ot=e=>{O(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},st=async t=>{if(K()&&G())try{await y.restoreTrashFile(t),e(H(`app.toast.restored`),`success`),q(),J()}catch(t){e(await s(t,H(`app.toast.restoreFailed`)),`error`)}},ct=async()=>{K()&&G()&&B({title:H(`app.clearTrash.title`),message:H(`app.clearTrash.message`),confirmText:H(`app.clear`),danger:!0,onConfirm:async()=>{B(null);try{await y.emptyTrash(),e(H(`app.toast.trashEmptied`),`success`),J()}catch(t){e(await s(t,H(`app.toast.emptyFailed`)),`error`)}}})},lt=async t=>{if(K()&&G())try{let n=await y.toggleStar(t);d(e=>e.map(e=>e.cid===t?{...e,starred:n.starred}:e)),e(n.starred?H(`app.toast.favorited`):H(`app.toast.unfavorited`),`success`)}catch(t){e(await s(t,H(`app.toast.actionFailed`)),`error`)}},ut=async()=>{if(!K()||!G())return;let t=C===`trash`;B({title:H(t?`app.permanentDelete`:`app.batchDelete`),message:H(t?`app.deleteSelectedPermanent`:`app.deleteSelected`,{count:D.length}),confirmText:H(t?`app.permanentDelete`:`app.delete`),danger:!0,onConfirm:async()=>{B(null);try{for(let e of D)t?await y.permanentDeleteTrashFile(e):e.startsWith(`__`)||await y.deletePublishedFile(e);O([]),e(H(t?`app.toast.deletedPermanently`:`app.toast.deleted`),`success`),q(),J()}catch(t){e(await s(t,H(`app.toast.deleteFailed`)),`error`)}}})},dt=async t=>{if(K()&&G())try{for(let e of D){let n=u.find(t=>t.cid===e);if(!n)continue;let{name:r}=T(n.fileName),i=t?`${t}/${r}`:r;n.fileName!==i&&await y.moveFile(e,i)}O([]),Xe.close(),e(H(`app.toast.moved`),`success`),q()}catch(t){e(await s(t,H(`app.toast.moveFailed`)),`error`)}},ft=t=>{let n=!!t.path,r=n?t.name:T(t.fileName).name;Ze({title:H(n?`app.renameFolder`:`app.renameFile`),placeholder:H(`app.enterNewName`),defaultValue:r,confirmText:H(`app.rename`),onConfirm:async i=>{if(i!==r&&K()&&G()){$e(!0);try{if(n){let n=t.path.lastIndexOf(`/`),r=n===-1?``:t.path.substring(0,n),a=r?`${r}/${i}`:i;await y.renameFolder(t.path,a),e(H(`app.toast.renamed`),`success`),q(),Q(a)}else{let{folder:n}=T(t.fileName),r=n?`${n}/${i}`:i;await y.moveFile(t.cid,r),e(H(`app.toast.renamed`),`success`),q()}Ze(null)}catch(t){e(await s(t,H(`app.toast.renameFailed`)),`error`)}finally{$e(!1)}}}})},pt=async t=>{if(!r){a(),e(H(`app.toast.signInBeforePublish`),`warning`);return}if(!G())return;let n=W?W+`/`:``,i=[],o=await y.getNodePolicy().catch(()=>null),s=Array.from(t);for(let t of s){let r=n+t.name,a=ye(t,o,H);if(a){e(a,`error`);continue}if(u.some(e=>e.fileName===r)){e(H(`app.fileAlreadyExists`,{fileName:t.name}),`warning`);continue}let s=`upload_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,c={id:s,fileName:t.name,progress:0,type:`upload`,status:`uploading`};i.push(c),F(e=>[...e,c]),i.length>0&&I.open();try{(await y.publishFile(t,r)).alreadyExists?(F(e=>e.map(e=>e.id===s?{...e,status:`completed`}:e)),e(H(`app.fileAlreadyExists`,{fileName:t.name}),`warning`)):F(e=>e.map(e=>e.id===s?{...e,progress:100,status:`completed`}:e))}catch(n){F(e=>e.map(e=>e.id===s?{...e,status:`error`}:e)),e(await be(n,H(`app.publishFailedWithFile`,{fileName:t.name}),H,t.name),`error`)}}setTimeout(()=>{F(e=>e.filter(e=>e.status!==`completed`&&e.status!==`error`&&e.status!==`cancelled`))},3e3),q()},mt=A?je(A.cid,A.fileName):``,ht=A?Me(A.cid,A.fileName):``,gt=()=>{mt&&Ge(mt)},_t=()=>{ht&&qe(ht)},[Y,vt]=(0,b.useState)(!1),X=Be.trim(),Z=M?.status===`success`&&M.link===X,yt=()=>{ze.close(),N(null)},bt=e=>{Ve(e.target.value),N(null)},xt=async()=>{let t=Se(X,H);if(t){N({status:`error`,link:X,message:t}),e(t,`warning`);return}if(!(P||Y)&&K()&&G()){He(!0),N(null);try{let t=await y.checkDownload(X);N({status:`success`,link:X,message:t.alreadyExists?H(`app.fileAlreadyLocal`,{fileName:t.fileName}):H(`app.fileAvailable`,{fileName:t.fileName})}),e(t.alreadyExists?H(`app.fileAlreadyExists`,{fileName:t.fileName}):H(`app.toast.checkPassed`),t.alreadyExists?`warning`:`success`)}catch(t){let n=await xe(t);N({status:`error`,link:X,message:n}),e(n,`error`)}finally{He(!1)}}},St=async()=>{if(!r){a(),e(H(`app.toast.signInBeforeDownload`),`warning`);return}if(!G())return;let t=Se(X,H);if(t){e(t,`warning`);return}if(!Z){e(H(`app.toast.checkLinkFirst`),`warning`);return}if(!Y){vt(!0);try{let t=await y.downloadFile(X);if(Ve(``),N(null),yt(),t.alreadyExists)e(H(`app.fileAlreadyExists`,{fileName:t.fileName}),`warning`);else if(t.localAvailable)q();else{let n={id:t.taskId,fileName:H(`app.downloadFallbackName`),progress:0,type:`download`,status:`downloading`};F(e=>[...e,n]),I.open(),e(H(`app.toast.downloadStarted`),`info`)}}catch(t){e(await s(t,H(`app.toast.downloadFailed`)),`error`)}finally{vt(!1)}}},Ct=async t=>{if(K()&&G()&&t.type===`download`&&t.status===`downloading`){F(e=>e.map(e=>e.id===t.id?{...e,status:`cancelling`}:e));try{await y.cancelDownload(t.id)}catch(n){F(e=>e.map(e=>e.id===t.id?{...e,status:`downloading`}:e)),e(await s(n,H(`app.toast.cancelFailed`)),`error`)}}},wt=async t=>{if(K()&&G()){if(t.localAvailable===!1){e(H(`app.toast.fileNotLocal`),`warning`);return}try{(await ie({cid:t.cid,fileName:t.fileName,getFileDownloadUrl:y.getFileDownloadUrl,getRequestHeaders:o,loadFailedMessage:H(`app.toast.getFileFailed`)})).method===`picker`?e(H(`app.toast.fileSaved`),`success`):e(H(`app.toast.fileDownloaded`),`success`)}catch(t){t.name!==`AbortError`&&e(H(`app.saveFailedWithError`,{error:t.message}),`error`)}}},Tt=async t=>{if(K()&&G())try{e(H(`app.toast.startPullLocal`),`info`),await y.cacheFile(t.cid),e(H(`app.toast.pulledAndSeeding`),`success`),q()}catch(t){e(await s(t,H(`app.toast.pullFailed`)),`error`)}},Q=e=>{S(e||null),O([])};(0,b.useEffect)(()=>{if(t!==!0)return;let n=null,r=!1;return(async()=>{if(n=new WebSocket(await l(`/ws`)),r){n.close();return}n.onmessage=t=>{try{let{event:n,data:r}=JSON.parse(t.data);if(n===`publish:success`||n===`download:success`){q();let t=r.taskId||r.fileName;F(e=>e.map(e=>e.id===t||e.fileName===r.fileName?{...e,progress:100,status:`completed`}:e)),n===`download:success`&&(r.alreadyExists?e(H(`app.fileAlreadyExists`,{fileName:r.fileName}),`warning`):e(H(`app.fileDownloadCompleted`,{fileName:r.fileName}),`success`),setTimeout(()=>{F(e=>e.filter(e=>!(e.id===t&&e.status===`completed`)))},3e3))}n===`publish:progress`&&F(e=>e.map(e=>{if(r.file&&e.fileName===r.file&&e.type===`upload`){let t=50;return r.stage===`calculating-cid`?t=25:r.stage===`uploading`?t=75:r.stage===`complete`&&(t=100),{...e,progress:t}}return e})),n===`download:progress`&&F(e=>e.map(e=>e.id===r.taskId?{...e,progress:r.percent||0,loaded:r.loaded,total:r.total}:e)),n===`download:error`&&(F(e=>e.map(e=>e.id===r.taskId?{...e,status:`error`}:e)),e(H(`app.downloadFailedWithError`,{error:r.error}),`error`)),n===`download:status`&&F(e=>e.map(e=>e.id===r.taskId?{...e,fileName:r.file||e.fileName}:e)),n===`download:cancelled`&&(F(e=>e.map(e=>e.id===r.taskId?{...e,status:`cancelled`}:e)),e(H(`app.toast.downloadCancelled`),`warning`)),n===`user:metadata:updated`&&(q(),J())}catch(e){console.warn(`[App WS] Failed to parse message:`,e.message)}}})(),()=>{r=!0,n?.close()}},[t,r?.address]),(0,b.useEffect)(()=>{if(t===!0&&r){q(),J();return}t===!1&&(d([]),g([]))},[t,r?.address]),(0,b.useEffect)(()=>{r||(O([]),k(null),j(null),Ve(``),N(null),F([]),R(``),S(null),w(`all`))},[r?.address]);let Et=H(C===`all`?`app.nav.local`:C===`starred`?`app.nav.favorites`:`app.nav.trash`),$=C===`all`?at:C===`starred`?u.filter(e=>e.starred&&T(e.fileName).name.toLowerCase().includes(L.toLowerCase())):m.filter(e=>T(e.fileName).name.toLowerCase().includes(L.toLowerCase())),Dt=C===`starred`?[]:rt.filter(e=>e.name.toLowerCase().includes(L.toLowerCase())),Ot=Ie(W,H(`app.allContent`));return(0,x.jsxs)(fe,{sidebar:({closeSidebar:e})=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(_e,{onNavigate:e}),(0,x.jsx)(`nav`,{className:`sidebar-nav`,children:[{id:`all`,icon:(0,x.jsx)(Ce,{size:18}),label:H(`app.nav.local`)},{id:`starred`,icon:(0,x.jsx)(Te,{size:18}),label:H(`app.nav.favorites`)},{id:`trash`,icon:(0,x.jsx)(se,{size:18}),label:H(`app.nav.trash`)}].map(t=>(0,x.jsxs)(`button`,{onClick:()=>{w(t.id),S(null),O([]),R(``),e()},className:`sidebar-nav-btn ${C===t.id?`active`:``}`,children:[t.icon,(0,x.jsx)(`span`,{children:t.label})]},t.id))})]}),headerTitle:(0,x.jsx)(`h2`,{className:`header-title`,children:Et}),headerRight:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`search-box`,children:[(0,x.jsx)(pe,{size:14}),(0,x.jsx)(`input`,{type:`text`,value:L,onChange:e=>R(e.target.value),placeholder:H(`app.search.placeholder`)}),L&&(0,x.jsx)(`button`,{onClick:()=>R(``),children:(0,x.jsx)(_,{size:12})})]}),C===`trash`&&m.length>0&&(0,x.jsx)(`button`,{onClick:ct,className:`btn btn-sm btn-empty-trash`,children:H(`app.emptyTrash`)}),(0,x.jsx)(`button`,{onClick:()=>I.open(),className:`btn btn-icon`,children:(0,x.jsx)(ae,{size:16})})]}),children:[C===`all`&&(0,x.jsxs)(`div`,{className:`action-grid`,children:[(0,x.jsxs)(`div`,{className:`action-card upload ${Pe?`drag-over`:``}`,onDragOver:e=>{e.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:e=>{e.preventDefault(),E(!1),!(!K()||!G())&&pt(e.dataTransfer.files)},children:[(0,x.jsx)(`input`,{type:`file`,multiple:!0,onClick:e=>{(!K()||!G())&&e.preventDefault()},onChange:e=>{let t=Array.from(e.target.files||[]);e.target.value=``,pt(t)},className:`action-card-input`}),(0,x.jsx)(me,{size:20,className:`action-grid-icon`}),(0,x.jsx)(`p`,{children:H(`app.publishFile`)})]}),(0,x.jsxs)(`div`,{className:`action-card action-card-download`,onClick:()=>{!K()||!G()||ze.open()},children:[(0,x.jsx)(le,{size:20,className:`action-grid-icon`}),(0,x.jsx)(`p`,{children:H(`app.downloadFile`)})]})]}),C===`all`&&(0,x.jsx)(`div`,{className:`breadcrumb`,children:W?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{onClick:()=>Q(``),children:H(`app.allContent`)}),Ot.slice(1).map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[(0,x.jsx)(oe,{size:12}),(0,x.jsx)(`button`,{onClick:()=>Q(e.path),className:t===Ot.length-2?`current`:``,children:(0,x.jsx)(`span`,{translate:`no`,children:e.name})}),t===Ot.length-2&&(0,x.jsx)(`button`,{onClick:()=>ft(e),className:`breadcrumb-edit-btn`,children:(0,x.jsx)(re,{size:12})})]},e.path))]}):null}),(0,x.jsxs)(`div`,{className:`content-grid`,children:[C===`trash`&&($.length===0?(0,x.jsxs)(`div`,{className:`empty-state app-empty-state`,children:[(0,x.jsx)(`p`,{children:H(L?`app.noMatches`:`app.trashEmpty`)}),(0,x.jsx)(te,{label:H(`app.openFileNavigation`)})]}):(0,x.jsx)(`div`,{className:`file-grid`,children:$.map(e=>(0,x.jsxs)(`div`,{onClick:()=>O(t=>t.includes(e.cid)?t.filter(t=>t!==e.cid):[...t,e.cid]),onDoubleClick:()=>st(e.cid),className:`card ${D.includes(e.cid)?`selected`:``}`,children:[(0,x.jsx)(`div`,{className:`card-icon trash`,children:(0,x.jsx)(ue,{size:24,color:`#fff`})}),(0,x.jsx)(`p`,{className:`card-name`,translate:`no`,children:T(e.fileName).name}),(0,x.jsx)(`p`,{className:`card-date`,children:H(`app.deletedOn`,{date:tt(e.deletedAt)})})]},e.cid))})),C!==`trash`&&($.length===0&&Dt.length===0?(0,x.jsxs)(`div`,{className:`empty-state app-empty-state`,children:[(0,x.jsx)(`p`,{children:H(L?`app.noMatches`:C===`starred`?`app.noFavorites`:`app.noLocalFiles`)}),(0,x.jsx)(te,{label:H(`app.openFileNavigation`)})]}):(0,x.jsxs)(`div`,{className:`file-grid`,children:[Dt.map(e=>(0,x.jsx)(ke,{folder:e,onClick:()=>Q(e.path)},e.path)),$.map(t=>(0,x.jsx)(Oe,{file:t,isSelected:D.includes(t.cid),onSelect:ot,onPreview:t=>{if(t.localAvailable===!1){e(H(`app.toast.fileNotLocal`),`warning`);return}k({...t,subtype:f(t.fileName)})}},t.cid))]}))]}),z&&(0,x.jsx)(ge,{title:z.title,message:z.message,confirmText:z.confirmText,danger:z.danger,onConfirm:z.onConfirm,onClose:()=>B(null)}),V&&(0,x.jsx)(he,{title:V.title,placeholder:V.placeholder,defaultValue:V.defaultValue,confirmText:V.confirmText,isLoading:Qe,onConfirm:V.onConfirm,onClose:()=>Ze(null)}),Ye&&(0,x.jsx)(Ae,{items:D.map(e=>u.find(t=>t.cid===e)).filter(Boolean),allFolders:nt.map(e=>({path:e,name:e.split(`/`).pop()})),currentPath:W,onMove:dt,onClose:()=>Xe.close()}),A&&(0,x.jsx)(v,{onClose:()=>j(null),children:(0,x.jsxs)(`div`,{className:`share-modal`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`modal-header`,children:[(0,x.jsx)(`h3`,{children:H(`app.shareLink`)}),(0,x.jsx)(`button`,{onClick:()=>j(null),className:`btn btn-icon`,children:(0,x.jsx)(_,{size:18})})]}),(0,x.jsxs)(`div`,{className:`share-link-list`,children:[(0,x.jsxs)(`div`,{className:`share-link-box`,children:[(0,x.jsxs)(`div`,{className:`share-link-content`,children:[(0,x.jsx)(`span`,{className:`share-link-label`,children:H(`app.shareMostLink`)}),(0,x.jsx)(`div`,{className:`share-link-text`,translate:`no`,children:mt})]}),(0,x.jsx)(`button`,{type:`button`,"aria-label":H(`app.copyMostShareLink`),onClick:gt,className:`btn btn-circle btn-primary ${Ke?`copied`:``}`,children:Ke?(0,x.jsx)(p,{size:18}):(0,x.jsx)(ce,{size:18})})]}),(0,x.jsxs)(`div`,{className:`share-link-box`,children:[(0,x.jsxs)(`div`,{className:`share-link-content`,children:[(0,x.jsx)(`span`,{className:`share-link-label`,children:H(`app.shareWebLink`)}),(0,x.jsx)(`div`,{className:`share-link-text`,translate:`no`,children:ht})]}),(0,x.jsx)(`button`,{type:`button`,"aria-label":H(`app.copyWebShareLink`),onClick:_t,className:`btn btn-circle btn-primary ${Je?`copied`:``}`,children:Je?(0,x.jsx)(p,{size:18}):(0,x.jsx)(ce,{size:18})})]})]}),(0,x.jsx)(`div`,{className:`share-storage-note`,children:(0,x.jsx)(`span`,{children:H(`app.shareSeedNote`)})})]})}),Re&&(0,x.jsx)(v,{onClose:yt,children:(0,x.jsxs)(`div`,{className:`download-modal`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`modal-header`,children:[(0,x.jsx)(`h3`,{children:H(`app.downloadFile`)}),(0,x.jsx)(`button`,{onClick:yt,className:`btn btn-icon`,children:(0,x.jsx)(_,{size:18})})]}),(0,x.jsxs)(`div`,{className:`download-link-row`,children:[(0,x.jsx)(`input`,{type:`text`,className:`input`,value:Be,onChange:bt,placeholder:H(`app.downloadLink.placeholder`)}),(0,x.jsxs)(`button`,{type:`button`,onClick:xt,disabled:!X||P||Y,className:`btn btn-secondary download-check-btn`,children:[P?(0,x.jsx)(de,{size:14,className:`spin`}):Z?(0,x.jsx)(p,{size:14}):(0,x.jsx)(pe,{size:14}),H(P?`app.checking`:Z?`app.passed`:`app.check`)]})]}),M&&(0,x.jsxs)(`div`,{className:`download-check-status ${M.status}`,children:[M.status===`success`?(0,x.jsx)(p,{size:14}):(0,x.jsx)(we,{size:14}),(0,x.jsx)(`span`,{children:M.message})]}),(0,x.jsxs)(`button`,{onClick:St,disabled:!Z||Y||P,className:`btn btn-info btn-full`,children:[Y?(0,x.jsx)(de,{size:14,className:`spin`}):(0,x.jsx)(le,{size:14}),H(Y?`app.downloading`:`app.startDownload`)]})]})}),Le&&(0,x.jsx)(ne,{item:Le,isBackendReady:U,getFileDownloadUrl:y.getFileDownloadUrl,onSaveAs:wt,onClose:()=>k(null)}),D.length>0&&(0,x.jsxs)(`div`,{className:`batch-bar`,children:[(0,x.jsx)(`span`,{className:`batch-info`,children:H(`app.selectedItems`,{count:D.length})}),(0,x.jsx)(`button`,{onClick:()=>O([]),className:`batch-dismiss`,children:(0,x.jsx)(_,{size:16})}),(0,x.jsx)(`div`,{className:`batch-divider`}),C===`trash`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{onClick:async()=>{K()&&G()&&(await Promise.all(D.map(e=>y.restoreTrashFile(e))),O([]),e(H(`app.toast.restored`),`success`),q(),J())},className:`btn btn-sm`,children:H(`app.restore`)}),(0,x.jsx)(`button`,{onClick:ut,className:`btn btn-sm btn-danger`,children:H(`app.permanentDelete`)})]}):(0,x.jsxs)(x.Fragment,{children:[D.length===1&&(()=>{let e=u.find(e=>e.cid===D[0]);return e&&f(e.fileName)!==`file`})()&&(0,x.jsx)(`button`,{onClick:()=>{let t=u.find(e=>e.cid===D[0]);if(t){if(t.localAvailable===!1){e(H(`app.toast.fileNotLocal`),`warning`);return}let n=f(t.fileName);k({...t,subtype:n})}},className:`btn btn-sm`,children:H(`app.preview`)}),(0,x.jsx)(`button`,{onClick:()=>{let e=D.some(e=>{let t=u.find(t=>t.cid===e);return t&&!t.starred});D.forEach(t=>{let n=u.find(e=>e.cid===t);n&&(e?!n.starred:n.starred)&&lt(t)})},className:`btn btn-sm btn-star`,children:H(`app.favorite`)}),D.length===1&&(0,x.jsx)(`button`,{onClick:()=>{let e=u.find(e=>e.cid===D[0]);e&&ft(e)},className:`btn btn-sm`,children:H(`app.rename`)}),(0,x.jsx)(`button`,{onClick:()=>Xe.open(),className:`btn btn-sm btn-move`,children:H(`app.move`)}),(0,x.jsx)(`button`,{onClick:ut,className:`btn btn-sm btn-danger`,children:H(`app.delete`)}),D.length===1&&(()=>{let e=u.find(e=>e.cid===D[0]);return e&&e.localAvailable===!1})()&&(0,x.jsx)(`button`,{onClick:()=>{let e=u.find(e=>e.cid===D[0]);e&&Tt(e)},className:`btn btn-sm`,children:H(`app.pullToLocal`)}),D.length===1&&(0,x.jsx)(`button`,{onClick:()=>j(u.find(e=>e.cid===D[0])),className:`btn btn-sm`,children:H(`app.share`)}),D.length===1&&(0,x.jsx)(`button`,{onClick:()=>{let e=u.find(e=>e.cid===D[0]);e&&wt(e)},className:`btn btn-sm`,children:H(`app.saveAs`)})]})]}),We&&(0,x.jsx)(v,{onClose:()=>I.close(),children:(0,x.jsxs)(`div`,{className:`transfer-modal`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`modal-header`,children:[(0,x.jsx)(`h3`,{children:H(`app.transfers`)}),(0,x.jsx)(`button`,{onClick:()=>I.close(),className:`btn btn-icon`,children:(0,x.jsx)(_,{size:18})})]}),Ue.length===0?(0,x.jsx)(`div`,{className:`empty-transfer`,children:H(`app.noTransfers`)}):Ue.map(e=>(0,x.jsxs)(`div`,{className:`transfer-item`,children:[(0,x.jsxs)(`div`,{className:`transfer-item-header`,children:[e.type===`upload`?(0,x.jsx)(me,{size:14}):(0,x.jsx)(le,{size:14}),(0,x.jsx)(`span`,{className:`transfer-item-name`,translate:`no`,children:e.fileName}),e.status===`downloading`&&e.type===`download`&&(0,x.jsx)(`button`,{onClick:()=>Ct(e),className:`transfer-item-cancel`,children:(0,x.jsx)(_,{size:14})})]}),(0,x.jsxs)(`div`,{className:`transfer-progress-row`,children:[(0,x.jsx)(`progress`,{className:`transfer-progress-meter ${e.type===`download`?`download`:``} ${e.status===`error`?`error`:``} ${e.status===`cancelled`?`cancelled`:``}`,value:Math.max(0,Math.min(100,e.progress)),max:100,"aria-label":H(`app.transferProgress`,{fileName:e.fileName})}),(0,x.jsx)(`span`,{className:`transfer-progress-text`,children:e.status===`completed`?H(`app.completed`):e.status===`error`?H(`app.failed`):e.status===`cancelled`?H(`app.cancelled`):e.status===`cancelling`?H(`app.cancelling`):e.loaded&&e.total?`${ve(e.loaded)}/${ve(e.total)}`:`${e.progress}%`})]})]},e.id))]})})]})}var D=a(`/app/`)({component:E});export{D as Route};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,E as i,H as a,c as o,n as s,o as c,t as l}from"./useAppStore-DNhyhD20.js";import{a as u}from"./i18n-C6yaqRst.js";import{t as ee}from"./circle-alert-DXVkx8p8.js";import{a as te,o as d,r as f,t as ne}from"./chatNoteDraft-DTy6In5R.js";import{t as re}from"./OpenSidebarButton-OP8zl7ad.js";import{a as p,i as m,n as ie,o as ae,r as oe,t as se}from"./saveLocalFile-2CNt4X0T.js";import{t as h}from"./arrow-right-BsHzC0ZL.js";import{n as ce,t as g}from"./trash-2-B9gno5q6.js";import{t as _}from"./download-Cy2BlfKM.js";import{t as le}from"./external-link-D_AQSgxW.js";import{t as ue}from"./file-text-zvTER2mN.js";import{t as de}from"./loader-C4pED_QP.js";import{r as fe,t as pe}from"./AppShell-BdRKZIZ9.js";import{t as me}from"./message-square-CfApq8Ou.js";import{t as v}from"./music-Br2x8TKX.js";import{t as he}from"./search-DLBOUfny.js";import{A as ge,C as _e,M as ve,O as ye,S as be,T as xe,g as Se,j as Ce,n as we,r as Te,w as Ee}from"./index-D1mozno-.js";import{t as De}from"./AppTop-BE5kKBYH.js";import{t as Oe}from"./LogoIcon-B2fFe0l1.js";import{t as ke}from"./format-CAKfypjK.js";import{a as Ae,i as je,n as y,o as Me,r as Ne,t as Pe}from"./downloadValidation-Dd43i9_9.js";import{t as b}from"./channelApi-C5eHetoJ.js";import{t as Fe}from"./useChannelMessages-DDBqKBXU.js";var Ie=r(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Le=r(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Re=r(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),ze=r(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Be=r(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),x=t(e(),1),S=n();function Ve(e){return String(e||``).split(`/`).pop()||e}function He(e){return e===`image`?(0,S.jsx)(m,{size:20}):e===`video`?(0,S.jsx)(p,{size:20}):e===`audio`?(0,S.jsx)(v,{size:20}):(0,S.jsx)(ue,{size:20})}function Ue({attachment:e,status:t=`idle`,message:n,pending:r=!1,onOpen:i}){let{t:a}=u(),o=t===`checking`,s=t===`downloading`,c=r||o||s,l=`ui-file-action chat-attachment-action ${t===`error`?`error`:t===`available`?`available`:``}`.trim(),te=Number.isFinite(e.size)&&e.size>0?ke(e.size):a(`chat.mostboxFile`),d=r?a(`chat.sending`):n||te,f=a(r?`chat.sending`:o?`chat.checking`:s?`chat.attachment.downloading`:t===`available`?`chat.attachment.preview`:t===`error`?`chat.attachment.retry`:`chat.attachment.download`);return(0,S.jsxs)(`button`,{type:`button`,className:`ui-file-card chat-attachment-card`,onClick:()=>i?.(e),disabled:c,title:e.link,translate:`no`,children:[(0,S.jsx)(`span`,{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:c?(0,S.jsx)(de,{size:20,className:`ui-spinner chat-attachment-spinner`}):He(e.kind)}),(0,S.jsxs)(`span`,{className:`ui-file-info chat-attachment-info`,children:[(0,S.jsx)(`span`,{className:`ui-file-name chat-attachment-name`,translate:`no`,children:Ve(e.fileName)}),(0,S.jsx)(`span`,{className:`ui-file-meta chat-attachment-meta`,translate:`yes`,children:d})]}),(0,S.jsxs)(`span`,{className:l,translate:`yes`,children:[c?(0,S.jsx)(de,{size:15,className:`ui-spinner chat-attachment-spinner`}):t===`available`?(0,S.jsx)(ve,{size:16}):t===`error`?(0,S.jsx)(ee,{size:17}):(0,S.jsx)(_,{size:16}),(0,S.jsx)(`span`,{className:`chat-attachment-action-label`,children:f})]})]})}var C=[{key:`image`,labelKey:`chat.attachment.image`,accept:`image/*`,icon:m},{key:`video`,labelKey:`chat.attachment.video`,accept:`video/*`,icon:p},{key:`file`,labelKey:`chat.attachment.file`,accept:``,icon:ue}],w={key:`voice`,labelKey:`chat.voice.menu`,icon:Ce},We=C.map(e=>e.accept).join(`,`);function Ge({children:e}){return(0,S.jsx)(`div`,{className:`message-bubble`,translate:`no`,children:e})}function Ke({children:e}){return(0,S.jsx)(`div`,{className:`message-bubble has-attachment`,children:e})}function qe({children:e}){return(0,S.jsx)(`div`,{className:`chat-system-message`,children:e})}function Je({variant:e,pending:t=!1,avatarSrc:n,isOnline:r=!1,author:i,time:a,children:o}){return(0,S.jsxs)(`div`,{className:[`chat-message`,e,t?`pending`:``].filter(Boolean).join(` `),children:[(0,S.jsxs)(`span`,{className:`chat-avatar-wrap`,children:[(0,S.jsx)(`img`,{className:`msg-avatar`,src:n,alt:`avatar`}),r&&(0,S.jsx)(`span`,{className:`chat-online-dot`,"aria-hidden":`true`})]}),(0,S.jsxs)(`div`,{className:`msg-content`,children:[(0,S.jsx)(`span`,{className:`message-header`,children:(0,S.jsx)(`span`,{className:`message-author`,translate:`no`,children:i})}),o,(0,S.jsx)(`span`,{className:`message-time`,children:a})]})]})}function Ye({active:e=!1,pinned:t=!1,unread:n=!1,title:r,menuClassName:i,onSelect:a,onTogglePin:o,onRename:s,onLeave:c}){let{t:l}=u(),ee=!!(o||s||c);return(0,S.jsxs)(`div`,{className:[`sidebar-nav-btn`,e?`active`:``,t?`pinned`:``,n?`unread`:``].filter(Boolean).join(` `),onClick:a,role:`button`,tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&e.key===`Enter`&&a?.()},children:[(0,S.jsxs)(`span`,{className:`chat-channel-icon-wrap`,children:[(0,S.jsx)(me,{size:16}),n&&(0,S.jsx)(`span`,{className:`chat-channel-unread-dot`,title:l(`chat.unread`),"aria-hidden":`true`})]}),(0,S.jsx)(`span`,{className:`chat-channel-title`,children:(0,S.jsx)(`span`,{className:`chat-channel-title-text`,translate:`no`,children:r})}),ee&&(0,S.jsx)(be,{ariaLabel:l(`chat.channelActions`),className:`channel-actions-anchor`,menuClassName:i,placement:`bottom-end`,items:[{key:`pin`,label:l(t?`chat.unpin`:`chat.pin`),icon:t?(0,S.jsx)(Re,{size:16}):(0,S.jsx)(ze,{size:16}),onSelect:()=>o?.()},{key:`rename`,label:l(`chat.rename`),icon:(0,S.jsx)(ae,{size:16}),onSelect:()=>s?.()},{key:`delete`,label:l(`chat.delete`),icon:(0,S.jsx)(g,{size:16}),onSelect:()=>c?.()}],renderTrigger:e=>(0,S.jsx)(`button`,{...e,className:`leave-channel-btn channel-actions-trigger`,title:l(`common.moreActions`),"aria-label":l(`common.moreActions`),children:(0,S.jsx)(d,{size:16})})})]})}function Xe({members:e}){let{t}=u();return e.length===0?(0,S.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:t(`chat.noMembers`)}):(0,S.jsx)(`div`,{className:`channel-members-grid`,children:e.map(e=>(0,S.jsxs)(`div`,{className:`channel-member`,children:[(0,S.jsxs)(`span`,{className:`channel-member-avatar-wrap`,children:[(0,S.jsx)(`img`,{className:`channel-member-avatar`,src:e.avatarSrc,alt:`avatar`}),e.online&&(0,S.jsx)(`span`,{className:`chat-online-dot`,"aria-hidden":`true`})]}),(0,S.jsx)(`span`,{className:`channel-member-name`,translate:`no`,children:e.name})]},e.id))})}function Ze({message:e,placeholder:t,disabled:n=!1,isPublishingAttachment:r=!1,attachmentButtonTitle:i,attachmentInputRef:a,attachmentMenuClassName:o,showVoiceRoom:s=!0,onMessageChange:c,onSend:l,onOpenVoiceRoom:ee,onSelectAttachmentFiles:d}){let{t:f}=u(),ne=n||r,re=n||!e.trim(),p=i||f(`chat.attachment.add`);function m(e,t){let n=e.currentTarget.files?Array.from(e.currentTarget.files):null;t?.(n),e.currentTarget.value=``}function ie(t){t.key===`Enter`&&(t.shiftKey||t.nativeEvent.isComposing||(t.preventDefault(),e.trim()&&l()))}function ae(e){if(ne)return;let t=a?.current;t&&(t.accept=e,t.click())}return(0,S.jsxs)(`div`,{className:`chat-input-area`,children:[(0,S.jsx)(`input`,{ref:a,type:`file`,accept:We,className:`chat-file-input`,onChange:e=>m(e,d)}),(0,S.jsx)(be,{ariaLabel:f(`chat.attachmentType`),placement:`top-start`,disabled:ne,menuClassName:o,items:[...C.map(e=>{let t=e.icon;return{key:e.key,label:f(e.labelKey),icon:(0,S.jsx)(t,{size:16}),onSelect:()=>ae(e.accept)}}),...s?[{key:w.key,label:f(w.labelKey),icon:(0,S.jsx)(Ce,{size:16}),onSelect:()=>ee?.()}]:[]],renderTrigger:e=>(0,S.jsx)(`button`,{...e,className:`btn btn-circle chat-tool-btn`,"aria-label":p,children:r?(0,S.jsx)(de,{size:18,className:`ui-spinner chat-attachment-spinner`}):(0,S.jsx)(te,{size:18})})}),(0,S.jsx)(`textarea`,{className:`textarea chat-composer-input`,placeholder:t,value:e,disabled:n,rows:1,onChange:e=>c(e.target.value),onKeyDown:ie}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-circle btn-primary send-btn`,onClick:l,disabled:re,title:f(`chat.sendMessage`),children:(0,S.jsx)(h,{size:18})})]})}var Qe=`mostbox.chat.lastReadAt`;function T(e){return Date.parse(e?.lastMessageAt||``)||Date.parse(e?.createdAt||``)||0}function $e(e){let t=String(e||``).trim().toLowerCase();return t?`${Qe}:${t}`:``}function et(e,t=Date.now()){let n=Number(e);return Math.max(0,Math.floor(Number.isFinite(n)&&n>0?n:t))}function tt(e,t=st()){if(!e||!t)return{};try{let n=t.getItem(e);if(!n)return{};let r=JSON.parse(n);return!r||typeof r!=`object`?{}:Object.entries(r).reduce((e,[t,n])=>{let r=Number(n);return t&&Number.isFinite(r)&&r>=0&&(e[t]=r),e},{})}catch{return{}}}function nt(e,t,n=st()){if(!(!e||!n))try{n.setItem(e,JSON.stringify(t))}catch{}}function rt(e,t,n=Date.now(),r=Date.now()){if(!t)return{changed:!1,value:e};let i=et(n,r);return(e[t]||0)>=i?{changed:!1,value:e}:{changed:!0,value:{...e,[t]:i}}}function it(e,t,n=Date.now()){let r=!1,i={...e};for(let e of t){let t=e?.channelKey||e?.name;!t||i[t]!==void 0||(i[t]=et(T(e),n),r=!0)}return{changed:r,value:r?i:e}}function at(e,{channelName:t,messageTime:n,activeChannelName:r=``,messageAuthor:i=``,userAddress:a=``,now:o=Date.now()}){if(!t)return{changed:!1,notify:!1,value:e};let s=et(n,o),c=t===r;if(String(i||``).toLowerCase()===String(a||``).toLowerCase())return{...rt(e,t,s,o),notify:!1};if(c)return{...rt(e,t,s,o),notify:!0};let l=e[t]||0;if(l<s)return{changed:!1,notify:!0,value:e};let u=Math.max(0,s-1);return l===u?{changed:!1,notify:!0,value:e}:{changed:!0,notify:!0,value:{...e,[t]:u}}}function ot(e,t){let n=e?.channelKey||e?.name;return T(e)>(t[n]||0)}function st(){if(!(typeof window>`u`))return window.localStorage}var ct=3,lt=30,ut=/^[a-zA-Z0-9_-]+$/,dt=1e4,ft=12e3,pt=1200,mt=800,ht=`channel.member.joined`;function E(e){return e?.channelKey||e?.name||``}function gt(e){return e?.channelId||e?.name||``}function D(e){return e&&typeof e==`object`?e:{}}function _t(e){let t=D(e),n=new Set,r=e=>{let t=String(e||``).trim();t&&n.add(t)};return r(t.channelKey),r(t.channel),Array.isArray(t.channels)&&t.channels.forEach(e=>{let t=D(e);r(t.channelKey),r(t.channel),r(t.name)}),[...n]}function O(e){return e?.remark||gt(e)}function vt(e){return e.type===`system`&&e.event===ht}function yt(){return typeof window>`u`?``:(new URLSearchParams(window.location.search).get(`channel`)||``).trim()}function bt(e){let t=new Date(e||Date.now());return Number.isNaN(t.getTime())?String(Date.now()):t.toISOString().slice(0,16).replace(`T`,` `).replace(`:`,`-`)}function k(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`)}function xt(e,t){return`[${k(e)}](<${t.replace(/>/g,`%3E`)}>)`}function St(e){let t=String(e||``).trim().split(/\r?\n/);return t.length>0?t.map(e=>`> ${e}`).join(`
2
+ `):`> `}var Ct=`chat-file`;function wt(e,t){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:e.type.startsWith(`audio/`)?`audio`:e.type.startsWith(`text/`)?`text`:oe(t)}function Tt(e){return e?`${e.slice(0,6)}...${e.slice(-4)}`:`Unknown`}function Et(e){return/#[a-fA-F0-9]{4}$/.test(String(e||``).trim())}function A(e){return String(e||``).trim().toLowerCase()}function Dt(){if(typeof window>`u`)return;let e=window;return e.AudioContext||e.webkitAudioContext}function j(){let e=l(e=>e.hasBackend),t=l(e=>e.isDarkMode),n=l(e=>e.addToast),r=l(e=>e.openConnectModal),a=i(e=>e.identity),ee=i(e=>e.openLoginModal),[d,p]=(0,x.useState)([]),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(``),[ue,v]=(0,x.useState)(!1),[ve,be]=(0,x.useState)(``),[Ce,ke]=(0,x.useState)(``),[Re,ze]=fe(!1),[He,C]=(0,x.useState)(``),[w,We]=(0,x.useState)(!1),[Qe,et]=(0,x.useState)(!1),[st,ht]=fe(!1),[D,k]=(0,x.useState)(null),[j,M]=(0,x.useState)(null),[Ot,N]=(0,x.useState)(!1),[kt,At]=(0,x.useState)(``),[jt,Mt]=(0,x.useState)(!1),[Nt,Pt]=(0,x.useState)(null),[Ft,It]=(0,x.useState)(!1),[P,F]=(0,x.useState)({}),[I,L]=(0,x.useState)(null),[Lt,Rt]=(0,x.useState)(!1),[zt,Bt]=(0,x.useState)(!1),[Vt,Ht]=(0,x.useState)(!1),[Ut,R]=(0,x.useState)({}),[Wt,Gt]=(0,x.useState)([]),z=a?.theme===`sparkbit`,Kt=z&&a?.data?a.data:``,qt=z&&a?.logo||``,Jt=z&&t&&a?.logo_dark||``,Yt=Jt||qt,Xt=Jt&&qt&&Jt!==qt?qt:``,Zt=Yt&&!zt?Yt:Xt&&!Vt?Xt:``,Qt=(0,x.useRef)(null),$t=(0,x.useRef)(null),B=(0,x.useRef)(``),en=(0,x.useRef)(new Set),tn=(0,x.useRef)(new Set),V=(0,x.useRef)(null),nn=(0,x.useRef)(!1),rn=(0,x.useRef)(0),an=(0,x.useRef)(async()=>[]),on=(0,x.useRef)(new Map),H=(0,x.useRef)(new Map),U=(0,x.useRef)(new Set),W=e===!0,{t:G,compareStrings:sn,formatDate:cn,formatTime:ln}=u(),K=we(),q=(0,x.useCallback)(async(e,t)=>{n(await c(e,t),`error`)},[n]),J=(0,x.useMemo)(()=>$e(a?.address),[a?.address]),un=(0,x.useCallback)((e,t=Date.now())=>{e&&R(n=>{let r=rt(n,e,t);return r.changed?(nt(J,r.value),r.value):n})},[J]),dn=(0,x.useCallback)(()=>{if(nn.current||typeof window>`u`)return;let e=Dt();if(e)try{let t=V.current||new e;V.current=t,t.state===`suspended`&&t.resume().catch(()=>{}),nn.current=!0}catch{}},[]),fn=(0,x.useCallback)(()=>{if(!nn.current)return;let e=Date.now();if(e-rn.current<pt)return;rn.current=e;let t=Dt();if(t)try{let e=V.current||new t;if(V.current=e,e.state===`suspended`){e.resume().catch(()=>{});return}let n=e.createGain();n.gain.setValueAtTime(1e-4,e.currentTime),n.gain.exponentialRampToValueAtTime(.08,e.currentTime+.015),n.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+.18),n.connect(e.destination),[740,980].forEach((t,r)=>{let i=e.createOscillator();i.type=`sine`,i.frequency.setValueAtTime(t,e.currentTime),i.connect(n),i.start(e.currentTime+r*.035),i.stop(e.currentTime+.16+r*.035)})}catch{}},[]),pn=(0,x.useCallback)(async(e=m)=>{let t=E(e);if(!t||!W){Gt([]);return}try{let e=await b.getChannelPresence(t);if(B.current!==t)return;Gt(e)}catch(e){console.warn(`[Chat] Failed to fetch channel presence:`,e instanceof Error?e.message:e)}},[m,W]),mn=(0,x.useCallback)((e=``)=>{let t=B.current;if(!e||e!==t||!W)return;let n=on.current,r=n.get(e);r&&window.clearTimeout(r);let i=window.setTimeout(()=>{n.delete(e),an.current(e)},mt);n.set(e,i)},[W]);function hn(e,t){switch(e){case`channel:message`:{let e=t?.channelKey||t?.channel,n=t?.message,r=Number(n?.timestamp)||Date.now();if(e){p(t=>t.map(t=>E(t)===e?{...t,lastMessageAt:new Date(r).toISOString()}:t));let t=e===B.current;R(i=>{let o=at(i,{channelName:e,messageTime:r,activeChannelName:t?e:``,messageAuthor:n?.author,userAddress:a?.address});return o.changed&&nt(J,o.value),o.notify&&fn(),o.changed?o.value:i})}break}case`channel:peer:online`:case`channel:sync:available`:{let e=_t(t),n=B.current;$(),e.includes(n)&&(mn(n),m&&pn(m));break}case`channel:presence`:{let e=t?.channelKey||t?.channel;m&&(!e||e===E(m))&&pn(m);break}case`channel:joined`:case`channel:left`:$();break;case`user:metadata:updated`:t?.scope===`channels`&&$();break;case`download:success`:{let e=H.current.get(t.taskId);e&&(H.current.delete(t.taskId),U.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`available`,message:G(`chat.attachment.previewAvailable`)}})),n(G(`chat.attachment.downloadCompleted`,{fileName:t.fileName||Ve(e.fileName)}),`success`),Dn(e,t.fileName||e.fileName));break}case`download:error`:case`download:cancelled`:{let r=H.current.get(t.taskId);r&&(H.current.delete(t.taskId),U.current.delete(r.cid),F(n=>({...n,[r.cid]:{status:`error`,message:e===`download:cancelled`?G(`chat.attachment.downloadCancelled`):t.error||G(`chat.attachment.downloadFailed`)}})),n(e===`download:cancelled`?G(`chat.attachment.downloadCancelled`):t.error||G(`chat.attachment.downloadFailed`),`error`));break}}}let gn=(0,x.useMemo)(()=>d.map(e=>E(e)),[d]),_n=(0,x.useMemo)(()=>a?{...Te(a),profileUpdatedAt:a.profileUpdatedAt}:{},[a?.avatar,a?.displayName,a?.profileUpdatedAt,a?.username]),Y=(0,x.useMemo)(()=>m?{channelName:E(m),title:O(m)}:null,[m]),{clearMessages:vn,messages:X,sendMessage:yn,syncMessages:bn}=Fe({isReady:W,enabled:!!a,channelName:E(m),extraSubscribedChannelNames:gn,peerId:He,waitForPeerId:!0,onSyncError:e=>q(e,G(`chat.error.messages`)),onSocketEvent:hn,onReconnect:()=>{$(),m&&pn(m)},presenceEnabled:!!(m&&a),presenceProfile:_n});(0,x.useEffect)(()=>{an.current=bn},[bn]),(0,x.useEffect)(()=>{let e=on.current;return()=>{for(let t of e.values())window.clearTimeout(t);e.clear()}},[]);let xn=(0,x.useMemo)(()=>{let e=new Map;return X.forEach((t,n)=>{let r=String(t.author||``).trim();if(!r)return;let i=r.toLowerCase(),a=Number(t.timestamp)||0,o=String(t.authorName||``).trim(),s=String(t.avatar||``).trim(),c=e.get(i);if(!c){e.set(i,{address:r,displayName:o,...s?{avatar:s}:{},firstSeenAt:a,lastSeenAt:a,index:n});return}a>=c.lastSeenAt&&(c.lastSeenAt=a,o&&(c.displayName=o),s&&(c.avatar=s))}),[...e.values()].sort((e,t)=>e.firstSeenAt-t.firstSeenAt||e.index-t.index)},[X]),Sn=(0,x.useMemo)(()=>new Map(xn.map(e=>[A(e.address),e])),[xn]),Cn=(0,x.useMemo)(()=>{let e=new Map;return Wt.forEach(t=>{let n=A(t.address);!n||!t.online||e.set(n,t)}),e},[Wt]),wn=(0,x.useMemo)(()=>{let e=new Map(Sn);return Wt.forEach((t,n)=>{let r=A(t.address);!r||e.has(r)||e.set(r,{address:t.address,displayName:t.displayName||``,...t.avatar?{avatar:t.avatar}:{},firstSeenAt:t.lastSeen||Date.now(),lastSeenAt:t.lastSeen||Date.now(),index:xn.length+n})}),[...e.values()]},[xn,Wt,Sn]),Tn=(0,x.useMemo)(()=>new Set(Cn.keys()),[Cn]);function Z(){return W?!0:(r(),!1)}function Q(){return a?!0:(ee(),!1)}(0,x.useEffect)(()=>{let e=()=>{_(yt())};return e(),window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,x.useEffect)(()=>{a&&_(yt())},[a?.address]),(0,x.useEffect)(()=>{Bt(!1),Ht(!1)},[Yt,Xt]),(0,x.useEffect)(()=>{B.current=E(m)},[m]),(0,x.useEffect)(()=>(K.setPreviewRoom(a&&Y?Y:null),()=>{K.setPreviewRoom(null)}),[Y,a,K.setPreviewRoom]),(0,x.useEffect)(()=>{R(tt(J))},[J]),(0,x.useEffect)(()=>{!J||d.length===0||R(e=>{let t=it(e,d);return t.changed&&nt(J,t.value),t.changed?t.value:e})},[J,d]),(0,x.useEffect)(()=>(window.addEventListener(`pointerdown`,dn,{passive:!0}),window.addEventListener(`keydown`,dn),()=>{window.removeEventListener(`pointerdown`,dn),window.removeEventListener(`keydown`,dn)}),[dn]),(0,x.useEffect)(()=>()=>{V.current?.close().catch(()=>{}),V.current=null,nn.current=!1},[]),(0,x.useEffect)(()=>{Qt.current?.scrollIntoView({behavior:`smooth`})},[X]),(0,x.useEffect)(()=>{if(!W){C(``);return}s.get(`/api/node-id`).json().then(e=>C(e.id)).catch(e=>{console.warn(`[Chat] Failed to fetch node ID:`,e.message),q(e,G(`chat.error.nodeId`))})},[W,q,G]),(0,x.useEffect)(()=>{W&&a?(v(!1),$()):v(!1)},[e,W,a?.address]),(0,x.useEffect)(()=>{if(m){if(W){let e=E(m);Gt([]),bn(e,{replace:!0}),pn(m)}}else Gt([])},[m,W,pn,bn]),(0,x.useEffect)(()=>{if(!g)return;if(!a){tn.current.has(g)||(tn.current.add(g),ee());return}if(!W||!ue)return;let e=d.find(e=>E(e)===g)||d.find(e=>gt(e)===g);if(e&&(!m||E(m)!==E(e))){Mn(e);return}if(e&&m&&E(m)===E(e)&&(m.createdAt!==e.createdAt||m.coreKey!==e.coreKey||m.lastMessageAt!==e.lastMessageAt||m.pinned!==e.pinned||m.remark!==e.remark||m.type!==e.type)){h(e);return}if(e)return;let t=`${a.address}:${g}`;if(en.current.has(t)||w)return;let r=En(g);if(en.current.add(t),r){n(r,`error`);return}Fn(g)},[d,m,g,ue,W,w,a?.address]),(0,x.useEffect)(()=>{a||(p([]),v(!1),h(null),_(yt()),M(null),vn(),ke(``),C(``),N(!1),Pt(null),F({}),R({}),U.current.clear(),H.current.clear())},[vn,a?.address]);function En(e){return e.length<ct?G(`chat.validation.nameMin`,{count:ct}):e.length>lt?G(`chat.validation.nameMax`,{count:lt}):e.includes(`.`)?G(`chat.validation.dotReserved`):ut.test(e)?``:G(`chat.validation.allowedChars`)}async function $(){if(!W){v(!1);return}try{p(await b.getChannels()),v(!0)}catch(e){p([]),v(!1),await q(e,G(`chat.error.channelList`))}}function Dn(e,t=e.fileName){let n=oe(t);Pt({cid:e.cid,fileName:t,subtype:n===`file`?e.kind:n})}async function On(e){if(Q()&&Z())try{n((await se({cid:e.cid,fileName:e.fileName,getFileDownloadUrl:y.getFileDownloadUrl,getRequestHeaders:o,loadFailedMessage:G(`app.toast.getFileFailed`)})).method===`picker`?G(`app.toast.fileSaved`):G(`app.toast.fileDownloaded`),`success`)}catch(e){e.name!==`AbortError`&&n(G(`app.saveFailedWithError`,{error:e.message}),`error`)}}async function kn(e){let t=Pe(e.link,G);if(t)return F(n=>({...n,[e.cid]:{status:`error`,message:t}})),!1;try{F(t=>({...t,[e.cid]:{status:`checking`}}));let t=await y.checkDownload(e.link,{timeout:dt,requestTimeout:ft});return F(n=>({...n,[e.cid]:{status:t.alreadyExists?`available`:`ready`,message:t.alreadyExists?G(`chat.attachment.localAvailable`):G(`chat.attachment.downloadAvailable`)}})),!0}catch(t){let n=await Ne(t);return F(t=>({...t,[e.cid]:{status:`error`,message:n}})),!1}}async function An(e){L(null),await kn(e)&&await jn(e)}async function jn(e){if(!U.current.has(e.cid)){U.current.add(e.cid),F(t=>({...t,[e.cid]:{status:`downloading`,message:G(`chat.attachment.downloading`)}}));try{let t=await y.downloadFile(e.link);if(t.alreadyExists||t.fileName){U.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`available`,message:G(`chat.attachment.previewAvailable`)}})),Dn({...e,fileName:t.fileName||e.fileName},t.fileName||e.fileName);return}t.taskId&&(H.current.set(t.taskId,e),n(G(`chat.attachment.downloadStarted`),`success`))}catch(t){let n=await Ne(t);U.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`error`,message:n}}))}}}async function Mn(e){if(!Q()||!Z())return;let t=E(e);un(t,Math.max(T(e),Date.now())),h(e),_(t),window.history.pushState({},``,`?channel=${encodeURIComponent(t)}`)}async function Nn(e,t){if(t&&t.stopPropagation(),Q()&&Z()&&!Qe){et(!0);try{if(await b.leaveChannel(e),E(m)===e){h(null),_(``),vn();let e=new URL(window.location.href);e.searchParams.delete(`channel`),window.history.pushState({},``,e.pathname)}$(),ht.close(),k(null)}catch(e){await q(e,G(`chat.error.leave`))}finally{et(!1)}}}async function Pn(e){if(!Q()||!Z())return;let t=!e.pinned,n=E(e);try{let e=await b.setChannelPinned(n,t);p(t=>t.map(t=>E(t)===n?{...t,pinned:e.pinned}:t)),h(t=>t&&E(t)===n?{...t,pinned:e.pinned}:t)}catch(e){await q(e,G(t?`chat.error.pin`:`chat.error.unpin`))}}async function Fn(e){let t=e.trim();if(!t||w)return;let r=En(t);if(r){n(r,`error`);return}if(Q()&&Z()){We(!0);try{let e=await b.createChannel(t,`public`,Te(a)),n=e.channelKey||e.key||e.name||t,r=d.find(e=>E(e)===n),i={...r,name:e.name||t,channelId:e.channelId||e.name||t,channelKey:e.channelKey||e.key||r?.channelKey,type:e.type||r?.type||`public`,createdAt:e.createdAt||r?.createdAt,coreKey:e.coreKey||e.key||r?.coreKey,localWriterCoreKey:e.localWriterCoreKey||r?.localWriterCoreKey,writerCoreKeys:e.writerCoreKeys||r?.writerCoreKeys,remark:e.remark||r?.remark},o=E(i);p(e=>e.some(e=>E(e)===o)?e.map(e=>E(e)===o?{...e,...i}:e):[...e,i]),ze.close(),await Mn(i),$()}catch(e){await q(e,G(`chat.error.join`))}finally{We(!1)}}}async function In(e,t){if(!e.trim()||!m||!Q()||!Z())return!1;let n=e.trim(),r=E(m);try{let e=await yn({channelName:r,content:n,attachment:t});return p(t=>t.map(t=>E(t)===r?{...t,lastMessageAt:new Date(Number(e?.timestamp)||Date.now()).toISOString()}:t)),e&&un(r,Number(e.timestamp)||Date.now()),!0}catch(e){return await q(e,G(`chat.error.send`)),!1}}async function Ln(){if(!Ce.trim())return;let e=Ce.trim();ke(``),await In(e)}function Rn(e,t){return`${Ct}/${e}/${t}`}async function zn(e){if(!e||e.length===0||!m||!Q()||!Z()||Ft)return;It(!0);let t=``;try{let r=await y.getNodePolicy().catch(()=>null);for(let i of Array.from(e)){t=i.name;let e=Ae(i,r,G);if(e){n(e,`error`);continue}let a=Rn(gt(m),i.name),o=await y.publishFile(i,a),s=o.fileName||a,c=o.link||Me(o.cid,s);await In(c,{kind:wt(i,s),cid:o.cid,fileName:s,link:c,mimeType:i.type||void 0,size:i.size})}}catch(e){n(await je(e,G(`chat.error.attachmentSend`),G,t),`error`)}finally{It(!1)}}async function Bn(e){if(!Q()||!Z())return;let t=P[e.cid];if(!(t?.status===`checking`||t?.status===`downloading`)){if(t?.status===`error`){L(e);return}if(t?.status===`ready`||t?.status===`available`){await jn(e);return}if(!t){await kn(e)&&await jn(e);return}}}function Vn(e){let t=A(e.author),n=Cn.get(t),r=Sn.get(t);return Xn(n?.displayName||r?.displayName||e.authorName,e.author)}function Hn(e){return e.type!==`system`&&!e.pending&&(!!e.attachment||!!e.content.trim())}function Un(e,t){let n=Vn(t),r=`${cn(t.timestamp)} ${ln(t.timestamp)}`,i=t.content.trim();e.push(`## ${r} ${n}`,``),i&&(!t.attachment||i!==t.attachment.link)&&e.push(St(i),``),t.attachment&&e.push(`**${G(`chat.noteDraft.attachment`)}**`,``,`- ${G(`chat.noteDraft.file`)}: ${xt(Ve(t.attachment.fileName),t.attachment.link)}`,`- CID: \`${t.attachment.cid}\``,``)}function Wn(e){let t=m?O(m):``,n=`${cn(Date.now())} ${ln(Date.now())}`,r=[`# ${G(`chat.noteDraft.heading`)}`,``,`- ${G(`chat.noteDraft.room`)}: ${t}`,`- ${G(`chat.noteDraft.exportedAt`)}: ${n}`,`- ${G(`chat.noteDraft.messageCount`)}: ${e.length}`,``];return e.forEach(e=>Un(r,e)),`${r.join(`
3
+ `).trimEnd()}\n`}function Gn(){let e=X.filter(Hn);if(e.length===0){n(G(`chat.noteDraft.empty`),`warning`);return}let t=ne({title:G(`chat.noteDraft.historyTitle`,{room:m?O(m):G(`chat.title`),time:bt()}),content:Wn(e)});if(!t){n(G(`chat.noteDraft.saveFailed`),`error`);return}N(!1),window.location.assign(f(t.id))}async function Kn(e,t){if(!Q()||!Z())return;let n=E(e),r=await b.setChannelRemark(n,t);return p(e=>e.map(e=>E(e)===n?{...e,remark:r.remark}:e)),h(e=>e&&E(e)===n?{...e,remark:r.remark}:e),r.remark}async function qn(){if(m)try{await Kn(m,kt)}catch(e){await q(e,G(`chat.error.remark`))}}async function Jn(e){if(!(!j||jt)){Mt(!0);try{await Kn(j,e),M(null)}catch(e){await q(e,G(`chat.error.rename`))}finally{Mt(!1)}}}function Yn(e){if(!e.attachment)return(0,S.jsx)(Ge,{children:e.content});let t=e.attachment,n=P[t.cid],r=n?.status;return(0,S.jsx)(Ke,{children:(0,S.jsx)(Ue,{attachment:t,status:r,message:n?.message,pending:e.pending,onOpen:Bn})})}function Xn(e,t){let n=String(e||``).trim();return n?Lt?Et(n)?n:t?`${n}#${t.slice(-4).toUpperCase()}`:n:n.replace(/#[a-fA-F0-9]{4}$/,``):Tt(t)}function Zn(){return(0,S.jsx)(Xe,{members:wn.map(e=>{let t=Cn.get(A(e.address)),n=t?.displayName||e.displayName,r=t?.avatar||e.avatar;return{id:e.address,name:Xn(n,e.address),avatarSrc:Se(e.address,r),online:Tn.has(A(e.address))}})})}let Qn=z&&!!g&&!m,$n=[`chat-app-layout`,z?`sparkbit-chat-layout`:``].filter(Boolean).join(` `),er=z?`sparkbit-chat-action-menu`:void 0,tr=m?(0,S.jsx)(`h2`,{className:`header-title`,translate:`no`,children:O(m)}):(0,S.jsx)(`h2`,{className:`header-title`,children:G(`chat.title`)}),nr=!!(Y&&K.room?.channelName===Y.channelName),rr=K.participants.filter(e=>!e.local).length,ir=K.joined?rr:K.participants.length,ar=!z&&nr&&(K.joined||K.participants.length>0),or=K.joined?G(`chat.voice.bannerJoined`,{count:ir}):G(`chat.voice.bannerActive`,{count:ir});function sr(){Y&&K.openRoom(Y)}let cr=ve.trim().toLowerCase(),lr=(0,x.useMemo)(()=>[...d].sort((e,t)=>{let n=Number(!!t.pinned)-Number(!!e.pinned);if(n!==0)return n;let r=T(t)-T(e);return r===0?sn(O(e),O(t)):r}),[d,sn]),ur=cr?lr.filter(e=>[O(e),gt(e),E(e)].some(e=>e.toLowerCase().includes(cr))):lr;return(0,S.jsxs)(pe,{className:$n,defaultHide:z,hideAccountMenu:z,sidebar:({closeSidebar:e})=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(De,{onNavigate:e}),(0,S.jsx)(`div`,{className:`chat-channel-search`,children:(0,S.jsxs)(`div`,{className:`ui-input-control`,children:[(0,S.jsx)(he,{className:`ui-input-icon`,size:15}),(0,S.jsx)(`input`,{type:`search`,className:`input input-compact`,placeholder:G(`chat.search.placeholder`),value:ve,onChange:e=>be(e.target.value),"aria-label":G(`chat.search.placeholder`)})]})}),(0,S.jsx)(`nav`,{className:`sidebar-nav`,children:d.length===0?(0,S.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,S.jsx)(`p`,{children:G(`chat.empty.noChannels`)})}):ur.length===0?(0,S.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,S.jsx)(`p`,{children:G(`chat.empty.noMatches`)})}):ur.map(t=>(0,S.jsx)(Ye,{active:E(m)===E(t),pinned:!!t.pinned,unread:ot(t,Ut),title:O(t),menuClassName:er,onSelect:()=>{Mn(t),e()},onTogglePin:()=>void Pn(t),onRename:()=>M(t),onLeave:()=>{k(t),ht.open()}},E(t)))}),(0,S.jsxs)(`button`,{className:`ui-action-dashed create-channel-btn`,onClick:()=>{!Q()||!Z()||ze.open()},children:[(0,S.jsx)(te,{size:16}),G(`chat.joinChannel`)]})]}),headerTitle:tr,sidebarToggleReplacement:z?(0,S.jsx)(`span`,{className:`sidebar-toggle-static-logo`,"aria-hidden":`true`,children:Zt?(0,S.jsx)(`img`,{className:`sidebar-toggle-static-logo-img`,src:Zt,alt:``,onError:()=>{if(Zt===Xt){Ht(!0);return}Bt(!0)}}):(0,S.jsx)(Oe,{size:18})}):void 0,headerRight:(0,S.jsx)(`div`,{className:`header-right-actions`,children:m&&(0,S.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>N(!0),title:G(`chat.channelSettings`),children:(0,S.jsx)(Be,{size:16})})}),children:[m?(0,S.jsxs)(S.Fragment,{children:[ar&&(0,S.jsxs)(`button`,{type:`button`,className:`chat-voice-banner`,onClick:sr,title:G(`chat.voice.expand`),children:[(0,S.jsx)(`span`,{className:`chat-voice-banner-icon`,children:(0,S.jsx)(ge,{size:18})}),(0,S.jsx)(`span`,{className:`chat-voice-banner-label`,children:or}),(0,S.jsx)(ce,{size:18})]}),(0,S.jsxs)(`div`,{className:`chat-messages`,children:[X.length===0?(0,S.jsxs)(`div`,{className:`ui-empty-state chat-messages-empty`,children:[(0,S.jsx)(`div`,{className:`ui-empty-icon empty-icon`,children:(0,S.jsx)(me,{size:28})}),(0,S.jsx)(`p`,{children:G(`chat.empty.noMessages`)})]}):X.map(e=>{if(vt(e))return(0,S.jsx)(qe,{children:G(`chat.system.memberJoined`,{name:Vn(e)})},e.id||`${e.author}-${e.timestamp}`);let t=e.author?.toLowerCase()===a?.address.toLowerCase(),n=Cn.get(A(e.author)),r=Sn.get(A(e.author)),i=Tn.has(A(e.author)),o=n?.avatar||r?.avatar||e.avatar||(t?a.avatar:void 0),s=Vn(e);return(0,S.jsx)(Je,{variant:t?`self`:`other`,pending:e.pending,isOnline:i,avatarSrc:Se(e.author,o),author:s,time:ln(e.timestamp),children:Yn(e)},e.id||`${e.author}-${e.timestamp}`)}),(0,S.jsx)(`div`,{ref:Qt})]}),(0,S.jsx)(Ze,{message:Ce,placeholder:G(a?`chat.composer.placeholder`:`chat.composer.signInPlaceholder`),disabled:!a,isPublishingAttachment:Ft,attachmentInputRef:$t,attachmentMenuClassName:er,showVoiceRoom:!z,onMessageChange:ke,onSend:Ln,onOpenVoiceRoom:sr,onSelectAttachmentFiles:e=>{zn(e)}})]}):Qn?(0,S.jsxs)(`div`,{className:`ui-empty-state chat-welcome`,children:[(0,S.jsx)(`div`,{className:`ui-empty-icon ui-empty-icon-lg welcome-icon`,children:(0,S.jsx)(de,{size:36,className:`ui-spinner`})}),(0,S.jsx)(`h2`,{className:`ui-empty-title`,children:G(`chat.restoring.title`)}),(0,S.jsx)(`p`,{className:`ui-empty-desc`,children:G(`chat.restoring.desc`)})]}):(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)(`div`,{className:`ui-empty-state chat-welcome`,children:[(0,S.jsx)(`div`,{className:`ui-empty-icon ui-empty-icon-lg welcome-icon`,children:(0,S.jsx)(me,{size:36})}),(0,S.jsx)(`h2`,{className:`ui-empty-title`,children:G(`chat.select.title`)}),(0,S.jsx)(`p`,{className:`ui-empty-desc`,children:G(`chat.select.desc`)}),(0,S.jsx)(re,{label:G(`chat.openChannelList`)})]})}),Re&&(0,S.jsx)(_e,{title:G(`chat.joinChannel`),placeholder:G(`chat.join.placeholder`),confirmText:G(`chat.join.confirm`),validate:En,onConfirm:Fn,onClose:()=>ze.close(),isLoading:w,loadingText:G(`chat.join.joining`)}),j&&(0,S.jsx)(_e,{title:G(`chat.renameChannel`),placeholder:G(`chat.remark.placeholder`),defaultValue:j.remark||``,confirmText:G(`chat.remark.save`),onConfirm:Jn,onClose:()=>{jt||M(null)},isLoading:jt,loadingText:G(`chat.remark.saving`),allowEmpty:!0,validate:e=>e.length>50?G(`chat.remark.tooLong`):``}),st&&D&&(0,S.jsx)(Ee,{title:G(`chat.leaveChannel`),message:G(`chat.leaveConfirm`,{channel:O(D)}),confirmText:G(Qe?`chat.leaving`:`chat.leaveChannel`),onConfirm:()=>Nn(E(D),void 0),danger:!0,onClose:()=>{ht.close(),k(null)}}),I&&(0,S.jsx)(xe,{onClose:()=>L(null),children:(0,S.jsxs)(`div`,{className:`confirm-modal`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`modal-header`,children:[(0,S.jsx)(`h3`,{children:G(`chat.attachment.noSeedsTitle`)}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>L(null),"aria-label":G(`common.close`),children:(0,S.jsx)(ye,{size:18})})]}),(0,S.jsx)(`p`,{children:P[I.cid]?.message||G(`chat.attachment.noSeedsFallback`)}),(0,S.jsxs)(`div`,{className:`modal-actions`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>L(null),children:G(`common.cancel`)}),(0,S.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>An(I),disabled:P[I.cid]?.status===`checking`,children:P[I.cid]?.status===`checking`?G(`app.checking`):G(`chat.attachment.retryCheck`)})]})]})}),Nt&&(0,S.jsx)(ie,{item:Nt,isBackendReady:W,getFileDownloadUrl:y.getFileDownloadUrl,onSaveAs:On,onClose:()=>Pt(null)}),Ot&&m&&(0,S.jsx)(`div`,{className:`channel-detail-overlay`,onClick:()=>N(!1),children:(0,S.jsxs)(`div`,{className:`channel-detail-drawer`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`channel-detail-header`,children:[(0,S.jsx)(`h3`,{children:G(`chat.details.title`)}),(0,S.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>N(!1),children:(0,S.jsx)(ye,{size:18})})]}),(0,S.jsxs)(`div`,{className:`channel-detail-body`,children:[(0,S.jsxs)(`div`,{className:`channel-detail-section channel-members-section`,children:[(0,S.jsx)(`div`,{className:`channel-detail-label`,children:(0,S.jsx)(`span`,{children:G(`chat.details.members`,{count:wn.length})})}),Zn()]}),Kt&&(0,S.jsx)(`div`,{className:`channel-detail-section`,children:(0,S.jsxs)(`a`,{className:`btn btn-primary btn-block`,href:Kt,target:`_blank`,rel:`noreferrer`,children:[(0,S.jsx)(le,{size:16}),G(`chat.ticket.create`)]})}),!z&&(0,S.jsx)(`div`,{className:`channel-detail-section`,children:(0,S.jsxs)(`label`,{className:`setting-switch`,children:[(0,S.jsx)(`span`,{children:G(`chat.details.showAddressSuffix`)}),(0,S.jsx)(`input`,{type:`checkbox`,checked:Lt,onChange:e=>Rt(e.target.checked)})]})}),!z&&(0,S.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,S.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,S.jsx)(Le,{size:14}),(0,S.jsx)(`span`,{children:G(`chat.details.channelId`)})]}),(0,S.jsx)(`div`,{className:`ui-meta-box channel-detail-value channel-detail-mono`,translate:`no`,children:gt(m)})]}),!z&&(0,S.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,S.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,S.jsx)(ae,{size:14}),(0,S.jsx)(`span`,{children:G(`chat.remark.placeholder`)})]}),(0,S.jsx)(`input`,{type:`text`,className:`input input-compact`,placeholder:G(`chat.remark.placeholder`),value:kt,onChange:e=>At(e.target.value),onFocus:()=>At(m.remark||``),onBlur:()=>qn(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},maxLength:50})]}),(0,S.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,S.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,S.jsx)(Ie,{size:14}),(0,S.jsx)(`span`,{children:G(`chat.channel.createdAt`)})]}),(0,S.jsx)(`div`,{className:`ui-meta-box channel-detail-value`,children:m.createdAt?cn(m.createdAt):`-`})]}),!z&&(0,S.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,S.jsx)(`div`,{className:`channel-detail-label`,children:(0,S.jsx)(`span`,{children:G(`chat.noteDraft.settingsTitle`)})}),(0,S.jsx)(`p`,{className:`channel-detail-hint`,children:G(`chat.noteDraft.saveAllDesc`)}),(0,S.jsx)(`button`,{className:`btn btn-secondary btn-block`,onClick:Gn,children:G(`chat.noteDraft.saveAll`)})]})]}),!z&&(0,S.jsx)(`div`,{className:`channel-detail-footer`,children:(0,S.jsx)(`button`,{className:`btn btn-secondary btn-block`,onClick:()=>{N(!1),k(m),ht.open()},children:G(`chat.leaveChannel`)})})]})})]})}var M=a(`/chat/`)({component:j});export{M as Route};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,F as a,H as o,O as s}from"./useAppStore-DNhyhD20.js";import{a as ee}from"./i18n-C6yaqRst.js";import{t as te}from"./external-link-D_AQSgxW.js";import{n as ne,t as re}from"./CopyButton-DnFqfCN9.js";import{t as ie}from"./AppShell-BdRKZIZ9.js";import{t as ae}from"./refresh-cw-CfkUlTK9.js";import{b as oe}from"./index-D1mozno-.js";import{t as se}from"./AppTop-BE5kKBYH.js";import{n as ce,r as le,t as c}from"./chatJoinInvite-CeC6H6t8.js";var l=i(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),u=t(e(),1),d=n(),f=`chat-join-demo`,p=``,m=`chatjoin_support`,ue=/^[a-zA-Z0-9_-]{3,30}$/,h=/^0x[a-fA-F0-9]{64}$/,de=c,fe=[{value:`dark`,label:`dark`},{value:`light`,label:`light`}],pe=[{value:`zh-CN`,label:`zh-CN`},{value:`zh-TW`,label:`zh-TW`},{value:`en`,label:`en`}];function g(){return typeof window>`u`?`https://most.box`:window.location.origin}function me(e){return(e.trim()||g()).replace(/\/+$/,``)}function he(e,t){let n=s(a(e.trim()||f,t).danger);return{publicKey:n.public_key,privateKey:n.private_key}}function _(e){return e.trim()||void 0}function ge(e){try{return JSON.parse(e)}catch{return null}}function _e(e){let t=e.trim();if(!t)return null;let n,r;try{let e=new URL(t,g());n=e.searchParams,r=e.origin}catch{n=new URLSearchParams(t.replace(/^\?/,``))}let i=n.get(`token`)?.trim()||``,a=n.get(`pub`)?.trim()||``;return!i||!a?null:{token:i,pub:a,origin:r}}function v({name:e,description:t}){return(0,d.jsxs)(`span`,{className:`chat-join-demo-label`,children:[(0,d.jsx)(`span`,{className:`chat-join-demo-label-key`,children:e}),(0,d.jsx)(`span`,{className:`chat-join-demo-label-desc`,children:t})]})}function y({name:e,description:t,children:n,wide:r=!1}){return(0,d.jsxs)(`label`,{className:`chat-join-demo-field ${r?`wide`:``}`,children:[(0,d.jsx)(v,{name:e,description:t}),n]})}function b(){let{t:e}=ee(),[t,n]=(0,u.useState)(g),[i,a]=(0,u.useState)(`demo-user`),[o,s]=(0,u.useState)(`Demo User`),[c,b]=(0,u.useState)(m),[x,S]=(0,u.useState)(`Chat Join Demo`),[C,w]=(0,u.useState)(`zh-CN`),[T,E]=(0,u.useState)(`sparkbit`),[D,O]=(0,u.useState)(),[k,A]=(0,u.useState)(``),[j,M]=(0,u.useState)(``),[N,P]=(0,u.useState)(``),[F,I]=(0,u.useState)(``),[L,R]=(0,u.useState)(``),[z,B]=(0,u.useState)(``),[V,ve]=(0,u.useState)(ce),[H,ye]=(0,u.useState)(f),[U,be]=(0,u.useState)(p),[W,xe]=(0,u.useState)(()=>he(f,p)),[Se,Ce]=(0,u.useState)(``),[we,G]=(0,u.useState)(``),[Te,K]=(0,u.useState)(``),[Ee,De]=(0,u.useState)(!1),[Oe,q]=(0,u.useState)(``),[ke,J]=(0,u.useState)(``),[Y,X]=(0,u.useState)(``),[Z,Q]=(0,u.useState)(``),Ae=(0,u.useMemo)(()=>{let e={uid:i.trim(),locale:C,channels:[{id:c.trim(),name:_(x)}]};return T&&(e.theme=T),D&&(e.appearance=D),e.node_url=_(L),e.node_invite=_(z),e.logo=_(k),e.logo_dark=_(j),e.data=_(F),e.avatar=_(N),e.name=_(o),e},[D,N,c,x,F,o,C,k,j,z,L,T,i]),$=(0,u.useMemo)(()=>JSON.stringify(Ae,null,2),[Ae]);function je(){xe(he(H,U)),q(``),J(``),X(``),Q(``)}function Me(e){let t=e.channels[0];a(e.uid),w(e.locale||`zh-CN`),E(e.theme),O(e.appearance),R(e.node_url||``),B(e.node_invite||``),A(e.logo||``),M(e.logo_dark||``),I(e.data||``),P(e.avatar||``),s(e.name||``),b(t?.id||m),S(t?.name||``)}async function Ne(){let r=_e(Se);if(!r){G(``),K(e(`chatJoin.demo.error.linkInvalid`));return}let i=r.origin||me(t),a=`${i}/chat/join?token=${encodeURIComponent(r.token)}&pub=${encodeURIComponent(r.pub)}`;n(i),q(r.token),J(r.pub),X(a),G(e(`chatJoin.demo.status.linkParsed`)),K(``),De(!0);try{let t=await fetch(`${de}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r.token,pub:r.pub})}),n=await t.text(),i=ge(n);if(!t.ok){let t=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:n;throw Error(t||e(`chatJoin.error.decrypt`))}let a=le(i);if(!a){K(e(`chatJoin.demo.error.parseInvalidPayload`)),G(e(`chatJoin.demo.status.linkParsed`));return}Me(a),G(e(`chatJoin.demo.status.linkDecrypted`)),K(``)}catch(t){K(e(`chatJoin.demo.error.parseDecryptFailed`,{message:t instanceof Error?t.message:String(t)}))}finally{De(!1)}}function Pe(){let n=i.trim(),a=c.trim(),o=V.trim();if(!n){Q(e(`chatJoin.demo.error.uidRequired`));return}if(!ue.test(a)){Q(e(`chatJoin.demo.error.channelInvalid`));return}if(!h.test(o)){Q(e(`chatJoin.demo.error.recipientPublicInvalid`));return}if(!h.test(W.publicKey)||!h.test(W.privateKey)){Q(e(`chatJoin.demo.error.senderKeysInvalid`));return}try{let e=r($,{senderPrivateKey:W.privateKey,recipientPublicKey:o}),n=W.publicKey,i=`${me(t)}/chat/join?token=${encodeURIComponent(e)}&pub=${encodeURIComponent(n)}`;q(e),J(n),X(i),Q(``)}catch{Q(e(`chatJoin.demo.error.encryptFailed`))}}return(0,d.jsx)(ie,{sidebar:()=>(0,d.jsx)(se,{}),headerTitle:(0,d.jsx)(`h2`,{className:`header-title`,children:e(`chatJoin.demo.title`)}),children:(0,d.jsx)(`div`,{className:`chat-join-container`,children:(0,d.jsxs)(`div`,{className:`chat-join-demo-panel`,children:[(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.parseSection`)})]}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.existingLink`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Se,onChange:e=>Ce(e.target.value),rows:4,translate:`no`})}),(0,d.jsx)(`div`,{className:`chat-join-demo-actions`,children:(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:Ne,disabled:Ee,children:[(0,d.jsx)(l,{size:16}),e(Ee?`chatJoin.demo.action.parsing`:`chatJoin.demo.action.parseLink`)]})}),we&&(0,d.jsx)(`p`,{className:`chat-join-demo-success`,children:we}),Te&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Te})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.inviteSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`origin`,description:e(`chatJoin.demo.field.origin`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:t,onChange:e=>n(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`uid`,description:e(`chatJoin.demo.field.uid`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:i,onChange:e=>a(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`name`,description:e(`chatJoin.demo.field.name`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:o,onChange:e=>s(e.target.value)})}),(0,d.jsx)(y,{name:`locale`,description:e(`chatJoin.demo.field.locale`),children:(0,d.jsx)(oe,{ariaLabel:e(`chatJoin.demo.field.locale`),value:C,options:pe,onChange:w,size:`compact`})}),(0,d.jsx)(y,{name:`channels[0].id`,description:e(`chatJoin.demo.field.channelId`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:c,onChange:e=>b(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`channels[0].name`,description:e(`chatJoin.demo.field.channelName`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:x,onChange:e=>S(e.target.value)})}),(0,d.jsx)(y,{name:`node_url`,description:e(`chatJoin.demo.field.nodeUrl`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:L,onChange:e=>R(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`node_invite`,description:e(`chatJoin.demo.field.nodeInvite`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:z,onChange:e=>B(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo`,description:e(`chatJoin.demo.field.logo`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:k,onChange:e=>A(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`logo_dark`,description:e(`chatJoin.demo.field.logoDark`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:j,onChange:e=>M(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`avatar`,description:e(`chatJoin.demo.field.avatar`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:N,onChange:e=>P(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`theme`,description:e(`chatJoin.demo.field.theme`)}),(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-theme`,value:`sparkbit`,checked:T===`sparkbit`,onClick:()=>E(T===`sparkbit`?void 0:`sparkbit`),readOnly:!0}),(0,d.jsx)(`span`,{children:`sparkbit`})]})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-field`,children:[(0,d.jsx)(v,{name:`appearance`,description:e(`chatJoin.demo.field.appearance`)}),(0,d.jsx)(`div`,{className:`chat-join-demo-radio-options`,children:fe.map(e=>(0,d.jsxs)(`label`,{className:`chat-join-demo-toggle`,children:[(0,d.jsx)(`input`,{type:`radio`,name:`chat-join-demo-appearance`,value:e.value,checked:D===e.value,onClick:()=>O(D===e.value?void 0:e.value),readOnly:!0}),(0,d.jsx)(`span`,{children:e.label})]},e.value))})]}),(0,d.jsx)(y,{name:`data`,description:e(`chatJoin.demo.field.data`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:F,onChange:e=>I(e.target.value),rows:3,translate:`no`})})]})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(ne,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.cryptoSection`)})]}),(0,d.jsxs)(`div`,{className:`chat-join-demo-grid`,children:[(0,d.jsx)(y,{name:`recipientPublicKey`,description:e(`chatJoin.demo.field.recipientPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:V,onChange:e=>ve(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`,translate:`no`})}),(0,d.jsx)(y,{name:`senderUsername`,description:e(`chatJoin.demo.field.senderUsername`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:H,onChange:e=>ye(e.target.value),autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`})}),(0,d.jsx)(y,{name:`senderPassword`,description:e(`chatJoin.demo.field.senderPassword`),children:(0,d.jsx)(`input`,{className:`input input-compact`,value:U,onChange:e=>be(e.target.value),type:`password`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsxs)(`button`,{className:`btn btn-secondary`,type:`button`,onClick:je,children:[(0,d.jsx)(ae,{size:16}),e(`chatJoin.demo.action.deriveSender`)]}),(0,d.jsxs)(`button`,{className:`btn btn-primary`,type:`button`,onClick:Pe,children:[(0,d.jsx)(l,{size:16}),e(`chatJoin.demo.action.generate`)]})]}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.senderPublicKey`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:W.publicKey,readOnly:!0,translate:`no`})})]}),Z&&(0,d.jsx)(`p`,{className:`chat-join-demo-error`,children:Z})]}),(0,d.jsxs)(`section`,{className:`chat-join-demo-section`,children:[(0,d.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,d.jsx)(l,{size:18}),(0,d.jsx)(`h3`,{children:e(`chatJoin.demo.outputSection`)})]}),(0,d.jsx)(y,{name:`payload`,description:e(`chatJoin.demo.field.payload`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:$,readOnly:!0,rows:9,translate:`no`})}),(0,d.jsx)(y,{name:`token`,description:e(`chatJoin.demo.field.token`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Oe,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsx)(y,{name:`pub`,description:e(`chatJoin.demo.field.pub`),wide:!0,children:(0,d.jsx)(`input`,{className:`input input-compact`,value:ke,readOnly:!0,translate:`no`})}),(0,d.jsx)(y,{name:`link`,description:e(`chatJoin.demo.field.link`),wide:!0,children:(0,d.jsx)(`textarea`,{className:`textarea mono`,value:Y,readOnly:!0,rows:4,translate:`no`})}),(0,d.jsxs)(`div`,{className:`chat-join-demo-actions`,children:[(0,d.jsx)(re,{className:`btn btn-secondary`,text:Y,label:e(`common.copy`)}),(0,d.jsxs)(`a`,{className:`btn btn-primary`,href:Y||void 0,target:`_blank`,rel:`noreferrer`,"aria-disabled":!Y,children:[(0,d.jsx)(te,{size:16}),e(`chatJoin.demo.action.openLink`)]})]})]})]})})})}var x=o(`/chat/join/demo/`)({component:b});export{x as Route};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i,W as a}from"./useAppStore-DNhyhD20.js";import{a as o}from"./i18n-C6yaqRst.js";import{n as s,t as c}from"./smartphone-CrsocYJo.js";import{t as l}from"./download-Cy2BlfKM.js";import{I as u}from"./index-D1mozno-.js";import{t as d}from"./MarketingHeader-8gNzHawY.js";import{n as f}from"./format-CAKfypjK.js";var p=r(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),m=r(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),h=r(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),g=r(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),_=r(`tablet-smartphone`,[[`rect`,{width:`10`,height:`14`,x:`3`,y:`8`,rx:`2`,key:`1vrsiq`}],[`path`,{d:`M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4`,key:`1j4zmg`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]),v=t(e(),1),y=[`windows`,`macos`,`linux`,`android`],b=[`x64`,`arm64`,`universal`],x=[`installer`],S=Object.freeze([{platform:`windows`,arch:`x64`},{platform:`windows`,arch:`arm64`},{platform:`macos`,arch:`x64`},{platform:`macos`,arch:`arm64`},{platform:`linux`,arch:`x64`},{platform:`linux`,arch:`arm64`},{platform:`android`,arch:`universal`}]);function C(e){return`${e.platform}:${e.arch}`}var w=new Set(y),T=new Set(b),E=new Set(x),D=new Set(S.map(C));function O(e){return typeof e==`object`&&!!e}function k(e){return typeof e==`string`&&e.trim().length>0}function A(e){return Number.isFinite(e)&&e>0}function j(e){return e===void 0||k(e)}function M(e){return O(e)?w.has(e.platform)&&T.has(e.arch)&&D.has(C(e))&&E.has(e.kind)&&k(e.filename)&&A(e.size)&&k(e.cid)&&k(e.githubUrl)&&j(e.r2Url):!1}function N(e){return!O(e)||!k(e.version)||!k(e.publishedAt)||!Array.isArray(e.assets)?!1:e.assets.every(M)}function P(e){return C(e)}function F(e){return N(e)?e.assets.filter(e=>e.kind===`installer`):[]}function I(e){return Array.isArray(e)?e.some(e=>O(e)&&k(e.r2Url)):!1}function L(e,t=`r2`){return t===`r2`&&O(e)&&k(e.r2Url)?{source:`r2`,url:e.r2Url}:{source:`github`,url:O(e)&&k(e.githubUrl)?e.githubUrl:``}}var R=`https://github.com/most-people/most/releases/latest`,z=[{platform:`windows`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`windows`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`macos`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`linux`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R},{platform:`android`,arch:`universal`,kind:`installer`,filename:`GitHub Releases`,githubUrl:R}];function B(e){return e.VITE_RELEASE_MANIFEST_URL||`${(e.VITE_R2_PUBLIC_BASE_URL||`https://download.most.box`).replace(/\/+$/,``)}/releases/latest.json`}function V({manifest:e,currentKey:t,requestedSource:n}){let r=e?F(e):[],i=r.length?r:z,a=I(i),o=n===`r2`&&a?`r2`:`github`,s=i.find(e=>P(e)===t)||null;return{assets:i,currentAsset:s,otherAssets:s?i.filter(e=>P(e)!==t):i,hasR2Assets:a,activeSource:o,currentDownload:s?L(s,o):null}}function H(e,t){return L(e,t)}var U=n(),W=B({VITE_RELEASE_MANIFEST_URL:void 0,VITE_R2_PUBLIC_BASE_URL:void 0}),G={windows:{name:`Windows`,ext:`.exe`,descKey:`download.platform.windows.desc`,icon:g},macos:{name:`macOS`,ext:`.dmg`,descKey:`download.platform.macos.desc`,icon:p},linux:{name:`Linux`,ext:`.AppImage`,descKey:`download.platform.linux.desc`,icon:h},android:{name:`Android`,ext:`.apk`,descKey:`download.platform.android.desc`,icon:_}},K=[{key:`ios`,nameKey:`download.platform.ios.name`,descKey:`download.platform.ios.desc`,icon:c}],q=`android:universal`;function J(){return[navigator.userAgentData?.platform,navigator.platform,navigator.userAgent].filter(Boolean).join(` `).toLowerCase()}function Y(){if(typeof navigator>`u`)return`windows:x64`;let e=J(),t=/arm|aarch64/.test(e)?`arm64`:`x64`;return/android/.test(e)?q:/mac|darwin/.test(e)?`macos:${t}`:/linux/.test(e)?`linux:${t}`:`windows:${t}`}function X(){let{t:e}=o(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(W?`loading`:`fallback`),[a,c]=(0,v.useState)(`windows:x64`),[d,p]=(0,v.useState)(`r2`);(0,v.useEffect)(()=>{c(Y())},[]),(0,v.useEffect)(()=>{if(!W)return;let e=new AbortController;return fetch(W,{cache:`no-store`,signal:e.signal}).then(e=>{if(!e.ok)throw Error(`Manifest request failed: ${e.status}`);return e.json()}).then(e=>{if(!N(e))throw Error(`Invalid download manifest`);n(e),i(`ready`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(n(null),i(`fallback`))}),()=>e.abort()},[]),(0,v.useEffect)(()=>{r===`fallback`&&p(`github`)},[r]);let{currentAsset:h,otherAssets:g,hasR2Assets:_,activeSource:y}=V({manifest:t,currentKey:a,requestedSource:d}),b=t=>H(t,y).source===`r2`?e(`download.source.r2Mirror`):`GitHub Releases`,x=e=>H(e,y).url,S=t=>{let n=G[t.platform],r=n.icon;return(0,U.jsxs)(`article`,{className:`download-current-card`,children:[(0,U.jsxs)(`div`,{className:`download-current-main`,children:[(0,U.jsx)(`div`,{className:`download-current-icon`,children:(0,U.jsx)(r,{size:34})}),(0,U.jsxs)(`div`,{className:`download-current-copy`,children:[(0,U.jsxs)(`div`,{className:`download-current-labels`,children:[(0,U.jsxs)(`span`,{className:`download-current-kicker`,children:[(0,U.jsx)(u,{size:14}),e(`download.platform.currentSystem`)]}),(0,U.jsx)(`span`,{className:`download-current-recommended`,children:e(`download.platform.recommended`)})]}),(0,U.jsxs)(`div`,{className:`download-current-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-current-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`download-current-actions`,children:[(0,U.jsx)(`span`,{children:e(`download.platform.matchedSystem`)}),(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:17}),e(`download.platform.action`,{ext:n.ext})]}),(0,U.jsx)(`p`,{children:b(t)})]})]})},C=t=>{let n=G[t.platform],r=n.icon,i=P(t),o=i===a;return(0,U.jsxs)(`article`,{className:[`download-platform-card`,o?`is-recommended`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(`div`,{className:`download-platform-icon`,children:(0,U.jsx)(r,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:n.name}),(0,U.jsx)(`span`,{children:t.arch})]}),(0,U.jsx)(`p`,{children:e(n.descKey)}),(0,U.jsxs)(`dl`,{className:`download-platform-meta`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,U.jsx)(`dd`,{children:b(t)})]}),t.size?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,U.jsx)(`dd`,{children:f(t.size)})]}):null,t.cid?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`CID`}),(0,U.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]}),(0,U.jsx)(`div`,{className:`download-platform-actions`,children:(0,U.jsxs)(`a`,{href:x(t),className:`btn btn-primary`,children:[(0,U.jsx)(l,{size:16}),e(`download.platform.action`,{ext:n.ext})]})})]}),o?(0,U.jsx)(`span`,{className:`download-recommended-badge`,children:e(`download.platform.current`)}):null]},i)},w=t=>{let n=t.icon;return(0,U.jsxs)(`article`,{className:`download-coming-soon-card`,children:[(0,U.jsx)(`div`,{className:`download-platform-icon download-coming-soon-icon`,children:(0,U.jsx)(n,{size:32})}),(0,U.jsxs)(`div`,{className:`download-platform-content`,children:[(0,U.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,U.jsx)(`h3`,{children:e(t.nameKey)}),(0,U.jsx)(`span`,{children:e(`download.platform.comingSoon`)})]}),(0,U.jsx)(`p`,{children:e(t.descKey)})]})]},t.key)};return(0,U.jsxs)(`div`,{className:`download-options`,children:[(0,U.jsxs)(`div`,{className:`ui-segmented-control download-source-tabs`,role:`tablist`,"aria-label":e(`download.source.label`),children:[(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`r2`,disabled:!_,className:y===`r2`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`r2`),children:[(0,U.jsx)(s,{size:15}),`Cloudflare R2`]}),(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===`github`,className:y===`github`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`github`),children:[(0,U.jsx)(m,{size:15}),`GitHub Releases`]})]}),(0,U.jsx)(`p`,{className:`download-source-note`,children:r===`loading`?e(`download.source.loading`):r===`ready`&&t?e(`download.source.ready`,{version:t.version}):e(`download.source.fallback`)}),h?(0,U.jsx)(`div`,{className:`download-current-platform`,"aria-label":e(`download.platform.currentSystem`),children:S(h)}):null,g.length?(0,U.jsxs)(`div`,{className:`download-other-platforms`,children:[(0,U.jsx)(`p`,{className:`download-other-platforms-title`,children:e(`download.platform.otherPlatforms`)}),(0,U.jsx)(`div`,{className:`download-platform-grid`,children:g.map(e=>C(e))}),(0,U.jsxs)(`div`,{className:`download-coming-soon`,children:[(0,U.jsx)(`p`,{className:`download-coming-soon-title`,children:e(`download.platform.mobilePlatforms`)}),(0,U.jsx)(`div`,{className:`download-coming-soon-grid`,children:K.map(e=>w(e))})]})]}):null]})}var Z=[{featureKey:`download.comparison.node`,webKey:`download.comparison.webConnectsNode`,desktopKey:`download.comparison.desktopBuiltinNode`},{featureKey:`download.comparison.fileSharing`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.verification`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.seeding`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopDefaultOn`},{featureKey:`download.comparison.largeFiles`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktop10gb`}];function Q(){let{t:e}=o();return(0,v.useEffect)(()=>{document.title=e(`download.meta.title`)},[e]),(0,U.jsxs)(`div`,{className:`download-page`,children:[(0,U.jsx)(d,{}),(0,U.jsx)(`section`,{className:`download-hero`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`div`,{className:`download-hero-icon`,children:(0,U.jsx)(l,{size:40})}),(0,U.jsx)(`h1`,{className:`download-hero-title`,children:e(`download.hero.title`)}),(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.hero.desc`)})]})}),(0,U.jsx)(`section`,{className:`download-platforms`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.platforms.title`)}),(0,U.jsx)(X,{})]})}),(0,U.jsx)(`section`,{className:`download-comparison`,children:(0,U.jsxs)(`div`,{className:`mkt-container`,children:[(0,U.jsx)(`h2`,{className:`download-section-title`,children:e(`download.comparison.title`)}),(0,U.jsx)(`div`,{className:`download-table-wrap`,children:(0,U.jsxs)(`table`,{className:`download-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{children:e(`download.comparison.feature`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.web`)}),(0,U.jsx)(`th`,{children:e(`download.comparison.desktop`)})]})}),(0,U.jsx)(`tbody`,{children:Z.map(t=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{children:e(t.featureKey)}),(0,U.jsx)(`td`,{className:`col-web`,children:e(t.webKey)}),(0,U.jsx)(`td`,{className:`col-desktop`,children:e(t.desktopKey)})]},t.featureKey))})]})})]})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.npmNote`)})})}),(0,U.jsx)(`section`,{className:`download-cta`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(a,{to:`/`,className:`btn btn-primary`,children:e(`common.backHome`)})})}),(0,U.jsx)(`footer`,{className:`mkt-footer`,children:(0,U.jsx)(`div`,{className:`mkt-container`,children:(0,U.jsx)(`div`,{className:`mkt-footer-inner`,children:(0,U.jsx)(`p`,{className:`mkt-footer-copy`,children:`MostBox`})})})})]})}var $=i(`/download/`)({component:Q});export{$ as Route};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{B as t,H as n,W as r}from"./useAppStore-DNhyhD20.js";import{a as i}from"./i18n-C6yaqRst.js";import{t as a}from"./fingerprint-pattern-BT73ASEB.js";import{t as o}from"./arrow-right-BsHzC0ZL.js";import{a as s}from"./AccountMenu-D-wa5tux.js";import{t as c}from"./download-Cy2BlfKM.js";import{t as l}from"./gamepad-2-BYqNgCQr.js";import{t as u}from"./message-square-CfApq8Ou.js";import{t as d}from"./notebook-pen-Bcd3MrtD.js";import{t as f}from"./wallet-D6HZocla.js";import{t as p}from"./AppTop-BE5kKBYH.js";import{t as m}from"./MarketingLayout-BPdjpEfc.js";var h=t(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),g=t(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),_=e(),v=[`about.summary.cid`,`about.summary.seed`,`about.summary.toolbox`,`about.summary.opensource`],y=[{icon:(0,_.jsx)(a,{size:22}),titleKey:`about.section.identity.title`,bodyKey:`about.section.identity.body`,bulletKeys:[`about.section.identity.bullet.filename`,`about.section.identity.bullet.verify`,`about.section.identity.bullet.local`]},{icon:(0,_.jsx)(g,{size:22}),titleKey:`about.section.spread.title`,bodyKey:`about.section.spread.body`,bulletKeys:[`about.section.spread.bullet.seedAfterDownload`,`about.section.spread.bullet.restart`,`about.section.spread.bullet.status`]},{icon:(0,_.jsx)(h,{size:22}),titleKey:`about.section.boundary.title`,bodyKey:`about.section.boundary.body`,bulletKeys:[`about.section.boundary.bullet.keepData`,`about.section.boundary.bullet.noMarket`,`about.section.boundary.bullet.availability`]},{icon:(0,_.jsx)(u,{size:22}),titleKey:`about.section.chat.title`,bodyKey:`about.section.chat.body`,bulletKeys:[`about.section.chat.bullet.room`,`about.section.chat.bullet.voice`,`about.section.chat.bullet.attachments`]},{icon:(0,_.jsx)(d,{size:22}),titleKey:`about.section.note.title`,bodyKey:`about.section.note.body`,bulletKeys:[`about.section.note.bullet.markdown`,`about.section.note.bullet.fromChat`,`about.section.note.bullet.backup`]},{icon:(0,_.jsx)(l,{size:22}),titleKey:`about.section.game.title`,bodyKey:`about.section.game.body`,bulletKeys:[`about.section.game.bullet.channel`,`about.section.game.bullet.rooms`,`about.section.game.bullet.lightweight`]},{icon:(0,_.jsx)(f,{size:22}),titleKey:`about.section.web3.title`,bodyKey:`about.section.web3.body`,bulletKeys:[`about.section.web3.bullet.accounts`,`about.section.web3.bullet.integrate`,`about.section.web3.bullet.export`,`about.section.web3.bullet.separate`],featured:!0}];function b(){let{t:e}=i();return(0,_.jsx)(m,{header:(0,_.jsx)(x,{}),children:(0,_.jsxs)(`div`,{className:`about-page`,children:[(0,_.jsx)(`section`,{className:`about-hero`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`p`,{className:`about-kicker`,children:e(`about.hero.kicker`)}),(0,_.jsx)(`h1`,{className:`about-title`,children:e(`about.hero.title`)}),(0,_.jsx)(`p`,{className:`about-lede`,children:e(`about.hero.desc`)}),(0,_.jsx)(`code`,{className:`about-link-example`,translate:`no`,children:e(`about.link.example`)}),(0,_.jsx)(`ul`,{className:`about-summary`,children:v.map(t=>(0,_.jsxs)(`li`,{className:`about-summary-item`,children:[(0,_.jsx)(`span`,{className:`about-summary-icon`,children:(0,_.jsx)(s,{size:15,strokeWidth:3})}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]})}),(0,_.jsx)(`section`,{className:`about-section-band`,children:(0,_.jsxs)(`div`,{className:`mkt-container`,children:[(0,_.jsx)(`div`,{className:`about-section-grid`,children:y.map(t=>(0,_.jsxs)(`article`,{className:t.featured?`about-topic featured`:`about-topic`,children:[(0,_.jsx)(`div`,{className:`about-topic-icon`,children:t.icon}),(0,_.jsx)(`h2`,{children:e(t.titleKey)}),(0,_.jsx)(`p`,{children:e(t.bodyKey)}),(0,_.jsx)(`ul`,{children:t.bulletKeys.map(t=>(0,_.jsxs)(`li`,{children:[(0,_.jsx)(s,{size:14,strokeWidth:3}),(0,_.jsx)(`span`,{children:e(t)})]},t))})]},t.titleKey))}),(0,_.jsxs)(`div`,{className:`about-actions`,children:[(0,_.jsxs)(r,{to:`/chat/`,className:`btn btn-primary`,children:[e(`about.cta.chat`),(0,_.jsx)(o,{size:16})]}),(0,_.jsxs)(r,{to:`/download/`,className:`btn btn-secondary`,children:[(0,_.jsx)(c,{size:16}),e(`about.cta.download`)]})]})]})})]})})}function x(){return(0,_.jsx)(`header`,{className:`about-app-header`,children:(0,_.jsx)(`div`,{className:`mkt-container`,children:(0,_.jsx)(p,{})})})}var S=n(`/about/`)({component:b});export{S as Route};