most-box 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/out/admin/index.html +0 -0
  2. package/out/app/index.html +0 -0
  3. package/out/assets/{FilePreviewOverlay-D8H61qbp.js → FilePreviewOverlay-BYZIAMJ-.js} +1 -1
  4. package/out/assets/{MarketingHeader-CrYsQsQ5.js → MarketingHeader-ceWdRCpe.js} +1 -1
  5. package/out/assets/{MarketingLayout-CQurMOSD.js → MarketingLayout-Bun1d2wL.js} +1 -1
  6. package/out/assets/{MilkdownEditor-DrsyaR4h.js → MilkdownEditor-CT6SHYKG.js} +1 -1
  7. package/out/assets/{OpenSidebarButton-DnEgqP0S.js → OpenSidebarButton-CLSCB7CG.js} +1 -1
  8. package/out/assets/{SidebarAccount-B4OAl0as.js → SidebarAccount-CNh0kvtB.js} +1 -1
  9. package/out/assets/{SidebarHomeLink-BdsUM4Kt.js → SidebarHomeLink-DXv0c9Ob.js} +1 -1
  10. package/out/assets/{downloadValidation-DbVOwdmC.js → downloadValidation-Bzl7cci9.js} +1 -1
  11. package/out/assets/index-BHZhApbo.css +1 -0
  12. package/out/assets/{index-BZ-f0CZd.js → index-BI8oNSVC.js} +2 -2
  13. package/out/assets/{index.lazy-zpQXhgmn.js → index.lazy-7omTRykl.js} +1 -1
  14. package/out/assets/{index.lazy-B7AbDiMU.js → index.lazy-BOMHingE.js} +1 -1
  15. package/out/assets/{index.lazy-hF807bh0.js → index.lazy-BSY5_gby.js} +1 -1
  16. package/out/assets/{index.lazy-DB9Ht9LJ.js → index.lazy-C4ipXKZ7.js} +1 -1
  17. package/out/assets/{index.lazy-CgKPe02l.js → index.lazy-CPZbEnJZ.js} +1 -1
  18. package/out/assets/{index.lazy-rfgjFZNH.js → index.lazy-Ch4Y17pJ.js} +1 -1
  19. package/out/assets/{index.lazy-CKbrHko5.js → index.lazy-CvBIIYbm.js} +1 -1
  20. package/out/assets/{index.lazy-BxoGfWEW.js → index.lazy-Cz-OZwYL.js} +1 -1
  21. package/out/assets/{index.lazy-CvKEcWlH.js → index.lazy-D4zNn3D6.js} +2 -2
  22. package/out/assets/index.lazy-DRY3xoQp.js +1 -0
  23. package/out/assets/{index.lazy-BsciBHf_.js → index.lazy-_mEd0Q_u.js} +1 -1
  24. package/out/assets/{index.lazy-DVeqmqaA.js → index.lazy-bAp_Hgck.js} +1 -1
  25. package/out/assets/{index.lazy-oFaoa4qT.js → index.lazy-ur0joIFl.js} +1 -1
  26. package/out/assets/{useChannelMessages-B6RMaNDH.js → useChannelMessages-BeKF0gwo.js} +1 -1
  27. package/out/assets/{useGameRoom-CRJL0kcm.js → useGameRoom-cs9YpYt7.js} +1 -1
  28. package/out/assets/{userProfile-DBkH4s29.js → userProfile-qcc60tHK.js} +1 -1
  29. package/out/chat/index.html +0 -0
  30. package/out/chat/join/index.html +0 -0
  31. package/out/download/index.html +2 -2
  32. package/out/game/gandengyan/index.html +0 -0
  33. package/out/game/index.html +0 -0
  34. package/out/game/zhajinhua/index.html +0 -0
  35. package/out/index.html +2 -2
  36. package/out/note/index.html +0 -0
  37. package/out/ping/index.html +2 -2
  38. package/out/profile/index.html +0 -0
  39. package/out/web3/index.html +0 -0
  40. package/package.json +1 -1
  41. package/server/src/index.js +34 -2
  42. package/out/assets/index-Cde4g_dk.css +0 -1
  43. package/out/assets/index.lazy-Citucq1G.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-s6irY8hS.js","assets/jsx-runtime-Bt-cYkS5.js","assets/useNavigate-DWlBD_-b.js","assets/index.lazy-hF807bh0.js","assets/ui-BpDGD3IR.js","assets/i18n-NjvOSuV6.js","assets/arrow-right-BU9c_SL4.js","assets/LanguageToggle-CSQtRZ3A.js","assets/download-jEPn2njL.js","assets/external-link-BFaoZeK0.js","assets/hard-drive-Dar_AZEq.js","assets/message-square-Dp09WY1I.js","assets/notebook-pen-C8TlK5sB.js","assets/wallet-T7ONZ3Kg.js","assets/MarketingLayout-CQurMOSD.js","assets/MarketingThemeToggle-CIKP8x9W.js","assets/LogoIcon-B2fFe0l1.js","assets/index.lazy-B7AbDiMU.js","assets/SidebarHomeLink-BdsUM4Kt.js","assets/lock-CLIE8cct.js","assets/mp-B6kdA94c.js","assets/dayjs.min-Dcc0B6Je.js","assets/copy-DEzFUzeX.js","assets/key-round-DNcpSuMw.js","assets/index.lazy-DB9Ht9LJ.js","assets/loader-BXQtdens.js","assets/save-BjrbPwhJ.js","assets/shield-check-DzDuWO8r.js","assets/upload-CoCptKya.js","assets/MarketingHeader-CrYsQsQ5.js","assets/index.lazy-rfgjFZNH.js","assets/smartphone-tRRFFO0a.js","assets/music-B19Tg557.js","assets/play-B-BjsTZz.js","assets/search-DSkiWdvX.js","assets/send-BL4d5iOt.js","assets/wifi-Bgo8eHY0.js","assets/index.lazy-CvKEcWlH.js","assets/folder-Cfgc70_F.js","assets/file-text-DPA1riJ_.js","assets/OpenSidebarButton-DnEgqP0S.js","assets/plus-4hygj-1Z.js","assets/trash-2-V12tJ8lI.js","assets/SidebarAccount-B4OAl0as.js","assets/index.lazy-DVeqmqaA.js","assets/format-CR8oUWq6.js","assets/index.lazy-Citucq1G.js","assets/circle-alert-iuHzciph.js","assets/FilePreviewOverlay-D8H61qbp.js","assets/downloadValidation-DbVOwdmC.js","assets/useChannelMessages-B6RMaNDH.js","assets/userProfile-DBkH4s29.js","assets/index.lazy-oFaoa4qT.js","assets/index.lazy-zpQXhgmn.js","assets/triangle-alert-DGWc8ZHu.js","assets/index.lazy-CKbrHko5.js","assets/useGameRoom-CRJL0kcm.js","assets/index-3OD3Chi9.css","assets/index.lazy-BxoGfWEW.js","assets/index-BSOvFG3o.css","assets/index.lazy-CgKPe02l.js","assets/index.lazy-BsciBHf_.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-s6irY8hS.js","assets/jsx-runtime-Bt-cYkS5.js","assets/useNavigate-DWlBD_-b.js","assets/index.lazy-BSY5_gby.js","assets/ui-BpDGD3IR.js","assets/i18n-NjvOSuV6.js","assets/arrow-right-BU9c_SL4.js","assets/LanguageToggle-CSQtRZ3A.js","assets/download-jEPn2njL.js","assets/external-link-BFaoZeK0.js","assets/hard-drive-Dar_AZEq.js","assets/message-square-Dp09WY1I.js","assets/notebook-pen-C8TlK5sB.js","assets/wallet-T7ONZ3Kg.js","assets/MarketingLayout-Bun1d2wL.js","assets/MarketingThemeToggle-CIKP8x9W.js","assets/LogoIcon-B2fFe0l1.js","assets/index.lazy-BOMHingE.js","assets/SidebarHomeLink-DXv0c9Ob.js","assets/lock-CLIE8cct.js","assets/mp-B6kdA94c.js","assets/dayjs.min-Dcc0B6Je.js","assets/copy-DEzFUzeX.js","assets/key-round-DNcpSuMw.js","assets/index.lazy-C4ipXKZ7.js","assets/loader-BXQtdens.js","assets/save-BjrbPwhJ.js","assets/shield-check-DzDuWO8r.js","assets/upload-CoCptKya.js","assets/MarketingHeader-ceWdRCpe.js","assets/index.lazy-Ch4Y17pJ.js","assets/smartphone-tRRFFO0a.js","assets/music-B19Tg557.js","assets/play-B-BjsTZz.js","assets/search-DSkiWdvX.js","assets/send-BL4d5iOt.js","assets/wifi-Bgo8eHY0.js","assets/index.lazy-D4zNn3D6.js","assets/folder-Cfgc70_F.js","assets/file-text-DPA1riJ_.js","assets/OpenSidebarButton-CLSCB7CG.js","assets/plus-4hygj-1Z.js","assets/trash-2-V12tJ8lI.js","assets/SidebarAccount-CNh0kvtB.js","assets/index.lazy-bAp_Hgck.js","assets/format-CR8oUWq6.js","assets/index.lazy-DRY3xoQp.js","assets/circle-alert-iuHzciph.js","assets/FilePreviewOverlay-BYZIAMJ-.js","assets/downloadValidation-Bzl7cci9.js","assets/useChannelMessages-BeKF0gwo.js","assets/userProfile-qcc60tHK.js","assets/index.lazy-ur0joIFl.js","assets/index.lazy-7omTRykl.js","assets/triangle-alert-DGWc8ZHu.js","assets/index.lazy-CvBIIYbm.js","assets/useGameRoom-cs9YpYt7.js","assets/index-3OD3Chi9.css","assets/index.lazy-Cz-OZwYL.js","assets/index-BSOvFG3o.css","assets/index.lazy-CPZbEnJZ.js","assets/index.lazy-_mEd0Q_u.js"])))=>i.map(i=>d[i]);
2
2
  import{i as e,n as t,o as n,r,t as i}from"./jsx-runtime-Bt-cYkS5.js";import{$ as a,A as o,B as s,C as c,D as l,E as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,P as y,Q as b,R as x,S,U as C,V as ee,W as te,X as ne,Y as re,Z as ie,a as ae,at as oe,ct as se,dt as ce,et as le,f as w,ft as E,h as ue,i as de,it as fe,j as pe,k as D,lt as O,mt as me,nt as he,ot as ge,p as _e,pt as ve,q as ye,rt as be,s as k,st as xe,tt as Se,ut as Ce,w as we,x as Te,z as Ee}from"./ui-BpDGD3IR.js";import{a as De,c as Oe,i as ke,l as Ae,n as je,r as Me}from"./useNavigate-DWlBD_-b.js";import{a as Ne,i as Pe,r as Fe,s as Ie,t as Le}from"./i18n-NjvOSuV6.js";var Re=r((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,ie());else{var t=n(l);t!==null&&se(x,t.startTime-e)}}var S=!1,C=-1,ee=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<ee)}function re(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():S=!1}}}var ie;if(typeof y==`function`)ie=function(){y(re)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=re,ie=function(){oe.postMessage(null)}}else ie=function(){_(re,0)};function se(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,se(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ie()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ze=r(((e,t)=>{t.exports=Re()})),Be=r((e=>{var n=ze(),r=t(),i=me();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),ie=Symbol.for(`react.memo_cache_sentinel`),ae=Symbol.iterator;function oe(e){return typeof e!=`object`||!e?null:(e=ae&&e[ae]||e[`@@iterator`],typeof e==`function`?e:null)}var se=Symbol.for(`react.client.reference`);function ce(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case ee:return`SuspenseList`;case re:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case te:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}var le=Array.isArray,w=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},de=[],fe=-1;function pe(e){return{current:e}}function D(e){0>fe||(e.current=de[fe],de[fe]=null,fe--)}function O(e,t){fe++,de[fe]=e.current,e.current=t}var he=pe(null),ge=pe(null),_e=pe(null),ve=pe(null);function ye(e,t){switch(O(_e,t),O(ge,e),O(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hd(t),e=Ud(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}D(he),O(he,e)}function be(){D(he),D(ge),D(_e)}function k(e){e.memoizedState!==null&&O(ve,e);var t=he.current,n=Ud(t,e.type);t!==n&&(O(ge,e),O(he,n))}function xe(e){ge.current===e&&(D(he),D(ge)),ve.current===e&&(D(ve),$f._currentValue=ue)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -28,4 +28,4 @@ Error generating stack: `+e.message+`
28
28
  window.onunhandledrejection = function(event) {
29
29
  console.error('[Unhandled Promise Rejection]', event.reason);
30
30
  };
31
- `}})}var op=we(`/`)({}),sp=we(`/web3/`)({}),cp=we(`/profile/`)({head:()=>({meta:[{title:Pe(`profile.meta.title`)},{name:`description`,content:Pe(`profile.meta.desc`)}]})}),lp=we(`/ping/`)({head:()=>({meta:[{title:Pe(`ping.meta.title`)},{name:`description`,content:Pe(`ping.meta.desc`)}]})}),up=we(`/note/`)({validateSearch:e=>({cid:typeof e.cid==`string`?e.cid:void 0,mode:e.mode===`edit`?`edit`:void 0})}),dp=`modulepreload`,fp=function(e){return`/`+e},pp={},mp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=fp(t,n),t in pp)return;pp[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:dp,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},hp=we(`/game/`)({component:hs(()=>mp(()=>import(`./game-s6irY8hS.js`),__vite__mapDeps([0,1,2])),`component`)}),gp=we(`/download/`)({head:()=>({meta:[{title:Pe(`download.meta.title`)},{name:`description`,content:Pe(`download.meta.desc`)}]})}),_p=we(`/chat/`)({}),vp=we(`/app/`)({}),yp=we(`/admin/`)({}),bp=we(`/game/zhajinhua/`)({}),xp=we(`/game/gandengyan/`)({}),Sp=we(`/cid/$cid/`)({head:()=>({meta:[{title:Pe(`cid.meta.title`)},{name:`description`,content:Pe(`cid.meta.desc`)}]})}),Cp=we(`/chat/join/`)({validateSearch:e=>({token:typeof e.token==`string`?e.token:void 0,pub:typeof e.pub==`string`?e.pub:void 0,fixture:typeof e.fixture==`string`?e.fixture:void 0})}),wp=op.update({id:`/`,path:`/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-hF807bh0.js`).then(e=>e.Route),__vite__mapDeps([3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16]))),Tp=sp.update({id:`/web3/`,path:`/web3/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-B7AbDiMU.js`).then(e=>e.Route),__vite__mapDeps([17,1,18,4,2,5,7,19,8,9,20,21,22,23,13]))),Ep=cp.update({id:`/profile/`,path:`/profile/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-DB9Ht9LJ.js`).then(e=>e.Route),__vite__mapDeps([24,1,4,2,5,7,8,9,20,21,22,23,25,26,27,28,14,15,16,29]))),Dp=lp.update({id:`/ping/`,path:`/ping/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-rfgjFZNH.js`).then(e=>e.Route),__vite__mapDeps([30,1,4,2,5,31,11,32,33,34,35,36,14,7,8,15,16]))),Op=up.update({id:`/note/`,path:`/note/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-CvKEcWlH.js`).then(e=>e.Route),__vite__mapDeps([37,1,18,4,2,5,7,19,38,39,12,40,41,26,34,42,43]))),kp=hp.update({id:`/game/`,path:`/game/`,getParentRoute:()=>np}),Ap=gp.update({id:`/download/`,path:`/download/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-DVeqmqaA.js`).then(e=>e.Route),__vite__mapDeps([44,1,4,2,5,31,8,29,7,15,45]))),jp=_p.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-Citucq1G.js`).then(e=>e.Route),__vite__mapDeps([46,1,18,4,2,5,7,6,47,8,39,48,25,32,11,40,41,34,42,49,43,16,50,51,45]))),Mp=vp.update({id:`/app/`,path:`/app/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-oFaoa4qT.js`).then(e=>e.Route),__vite__mapDeps([52,1,18,4,2,5,7,38,22,8,39,48,25,32,40,34,42,28,49,43,45]))),Np=yp.update({id:`/admin/`,path:`/admin/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-zpQXhgmn.js`).then(e=>e.Route),__vite__mapDeps([53,1,4,2,5,21,8,39,10,54,26,27,42,36,29,7,15,45]))),Pp=bp.update({id:`/game/zhajinhua/`,path:`/game/zhajinhua/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-CKbrHko5.js`).then(e=>e.Route),__vite__mapDeps([55,1,18,4,2,5,7,22,33,56,43,50,51,57]))),Fp=xp.update({id:`/game/gandengyan/`,path:`/game/gandengyan/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-BxoGfWEW.js`).then(e=>e.Route),__vite__mapDeps([58,1,18,4,2,5,7,22,33,35,56,43,50,51,59]))),Ip=Sp.update({id:`/cid/$cid/`,path:`/cid/$cid/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-CgKPe02l.js`).then(e=>e.Route),__vite__mapDeps([60,1,4,2,5,8,9,39,10,54,49,29,7,15,45]))),Lp={IndexRoute:wp,AdminIndexRoute:Np,AppIndexRoute:Mp,ChatIndexRoute:jp,DownloadIndexRoute:Ap,GameIndexRoute:kp,NoteIndexRoute:Op,PingIndexRoute:Dp,ProfileIndexRoute:Ep,Web3IndexRoute:Tp,ChatJoinIndexRoute:Cp.update({id:`/chat/join/`,path:`/chat/join/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-BsciBHf_.js`).then(e=>e.Route),__vite__mapDeps([61,1,18,4,2,5,7,47,23,51]))),CidCidIndexRoute:Ip,GameGandengyanIndexRoute:Fp,GameZhajinhuaIndexRoute:Pp},Rp=np._addFileChildren(Lp);function zp(){return ks({routeTree:Rp,defaultPreload:`intent`,scrollRestoration:!0,trailingSlash:`always`})}async function Bp(){let e=await zp(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(Vo),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:``,serializationAdapters:t}),e.stores.matchesId.get().length||await Wo(e),e}var Vp=Bp;async function Hp(){let e=await Vp();return window.$_TSR?.h(),e}var Up;function Wp(){return Up||=Hp(),(0,B.jsx)(Ko,{promise:Up,children:e=>(0,B.jsx)(Ms,{router:e})})}var Gp=Ve();(0,z.startTransition)(()=>{(0,Gp.hydrateRoot)(document,(0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Wp,{})}))});export{Yc as A,Ou as C,pl as D,Eu as E,Gs as F,Ws as I,Ns as L,Zs as M,Js as N,ul as O,qs as P,Du as S,ju as T,vd as _,xf as a,Au as b,$ as c,gd as d,pd as f,wd as g,Sd as h,Df as i,$s as j,ll as k,dd as l,Cd as m,ep as n,wf as o,fd as p,vf as r,Tf as s,mp as t,Dd as u,xd as v,ku as w,Tu as x,bd as y};
31
+ `}})}var op=we(`/`)({}),sp=we(`/web3/`)({}),cp=we(`/profile/`)({head:()=>({meta:[{title:Pe(`profile.meta.title`)},{name:`description`,content:Pe(`profile.meta.desc`)}]})}),lp=we(`/ping/`)({head:()=>({meta:[{title:Pe(`ping.meta.title`)},{name:`description`,content:Pe(`ping.meta.desc`)}]})}),up=we(`/note/`)({validateSearch:e=>({cid:typeof e.cid==`string`?e.cid:void 0,mode:e.mode===`edit`?`edit`:void 0})}),dp=`modulepreload`,fp=function(e){return`/`+e},pp={},mp=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=fp(t,n),t in pp)return;pp[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:dp,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},hp=we(`/game/`)({component:hs(()=>mp(()=>import(`./game-s6irY8hS.js`),__vite__mapDeps([0,1,2])),`component`)}),gp=we(`/download/`)({head:()=>({meta:[{title:Pe(`download.meta.title`)},{name:`description`,content:Pe(`download.meta.desc`)}]})}),_p=we(`/chat/`)({}),vp=we(`/app/`)({}),yp=we(`/admin/`)({}),bp=we(`/game/zhajinhua/`)({}),xp=we(`/game/gandengyan/`)({}),Sp=we(`/cid/$cid/`)({head:()=>({meta:[{title:Pe(`cid.meta.title`)},{name:`description`,content:Pe(`cid.meta.desc`)}]})}),Cp=we(`/chat/join/`)({validateSearch:e=>({token:typeof e.token==`string`?e.token:void 0,pub:typeof e.pub==`string`?e.pub:void 0,fixture:typeof e.fixture==`string`?e.fixture:void 0})}),wp=op.update({id:`/`,path:`/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-BSY5_gby.js`).then(e=>e.Route),__vite__mapDeps([3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16]))),Tp=sp.update({id:`/web3/`,path:`/web3/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-BOMHingE.js`).then(e=>e.Route),__vite__mapDeps([17,1,18,4,2,5,7,19,8,9,20,21,22,23,13]))),Ep=cp.update({id:`/profile/`,path:`/profile/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-C4ipXKZ7.js`).then(e=>e.Route),__vite__mapDeps([24,1,4,2,5,7,8,9,20,21,22,23,25,26,27,28,14,15,16,29]))),Dp=lp.update({id:`/ping/`,path:`/ping/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-Ch4Y17pJ.js`).then(e=>e.Route),__vite__mapDeps([30,1,4,2,5,31,11,32,33,34,35,36,14,7,8,15,16]))),Op=up.update({id:`/note/`,path:`/note/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-D4zNn3D6.js`).then(e=>e.Route),__vite__mapDeps([37,1,18,4,2,5,7,19,38,39,12,40,41,26,34,42,43]))),kp=hp.update({id:`/game/`,path:`/game/`,getParentRoute:()=>np}),Ap=gp.update({id:`/download/`,path:`/download/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-bAp_Hgck.js`).then(e=>e.Route),__vite__mapDeps([44,1,4,2,5,31,8,29,7,15,45]))),jp=_p.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-DRY3xoQp.js`).then(e=>e.Route),__vite__mapDeps([46,1,18,4,2,5,7,6,47,8,39,48,25,32,11,40,41,34,42,49,43,16,50,51,45]))),Mp=vp.update({id:`/app/`,path:`/app/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-ur0joIFl.js`).then(e=>e.Route),__vite__mapDeps([52,1,18,4,2,5,7,38,22,8,39,48,25,32,40,34,42,28,49,43,45]))),Np=yp.update({id:`/admin/`,path:`/admin/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-7omTRykl.js`).then(e=>e.Route),__vite__mapDeps([53,1,4,2,5,21,8,39,10,54,26,27,42,36,29,7,15,45]))),Pp=bp.update({id:`/game/zhajinhua/`,path:`/game/zhajinhua/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-CvBIIYbm.js`).then(e=>e.Route),__vite__mapDeps([55,1,18,4,2,5,7,22,33,56,43,50,51,57]))),Fp=xp.update({id:`/game/gandengyan/`,path:`/game/gandengyan/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-Cz-OZwYL.js`).then(e=>e.Route),__vite__mapDeps([58,1,18,4,2,5,7,22,33,35,56,43,50,51,59]))),Ip=Sp.update({id:`/cid/$cid/`,path:`/cid/$cid/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-CPZbEnJZ.js`).then(e=>e.Route),__vite__mapDeps([60,1,4,2,5,8,9,39,10,54,49,29,7,15,45]))),Lp={IndexRoute:wp,AdminIndexRoute:Np,AppIndexRoute:Mp,ChatIndexRoute:jp,DownloadIndexRoute:Ap,GameIndexRoute:kp,NoteIndexRoute:Op,PingIndexRoute:Dp,ProfileIndexRoute:Ep,Web3IndexRoute:Tp,ChatJoinIndexRoute:Cp.update({id:`/chat/join/`,path:`/chat/join/`,getParentRoute:()=>np}).lazy(()=>mp(()=>import(`./index.lazy-_mEd0Q_u.js`).then(e=>e.Route),__vite__mapDeps([61,1,18,4,2,5,7,47,23,51]))),CidCidIndexRoute:Ip,GameGandengyanIndexRoute:Fp,GameZhajinhuaIndexRoute:Pp},Rp=np._addFileChildren(Lp);function zp(){return ks({routeTree:Rp,defaultPreload:`intent`,scrollRestoration:!0,trailingSlash:`always`})}async function Bp(){let e=await zp(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(Vo),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:``,serializationAdapters:t}),e.stores.matchesId.get().length||await Wo(e),e}var Vp=Bp;async function Hp(){let e=await Vp();return window.$_TSR?.h(),e}var Up;function Wp(){return Up||=Hp(),(0,B.jsx)(Ko,{promise:Up,children:e=>(0,B.jsx)(Ms,{router:e})})}var Gp=Ve();(0,z.startTransition)(()=>{(0,Gp.hydrateRoot)(document,(0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Wp,{})}))});export{Yc as A,Ou as C,pl as D,Eu as E,Gs as F,Ws as I,Ns as L,Zs as M,Js as N,ul as O,qs as P,Du as S,ju as T,vd as _,xf as a,Au as b,$ as c,gd as d,pd as f,wd as g,Sd as h,Df as i,$s as j,ll as k,dd as l,Cd as m,ep as n,wf as o,fd as p,vf as r,Tf as s,mp as t,Dd as u,xd as v,ku as w,Tu as x,bd as y};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{C as i,T as a}from"./ui-BpDGD3IR.js";import{a as o}from"./i18n-NjvOSuV6.js";import{t as s}from"./download-jEPn2njL.js";import{t as c}from"./file-text-DPA1riJ_.js";import{t as l}from"./hard-drive-Dar_AZEq.js";import{n as u,t as d}from"./triangle-alert-DGWc8ZHu.js";import{t as f}from"./save-BjrbPwhJ.js";import{t as ee}from"./shield-check-DzDuWO8r.js";import{t as p}from"./trash-2-V12tJ8lI.js";import{t as m}from"./wifi-Bgo8eHY0.js";import{F as h,M as g,_,c as v,f as y,g as te,l as b}from"./index-BZ-f0CZd.js";import{t as x}from"./dayjs.min-Dcc0B6Je.js";import{t as ne}from"./MarketingHeader-CrYsQsQ5.js";import{t as S}from"./format-CR8oUWq6.js";var re=i(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ie=i(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),C=i(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),w=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],ee=f.length,p=0;p<ee;p+=1){var m=f[p];m.d&&(c=o?n(t).diff(a,m.d,!0):a.diff(t,m.d,!0));var h=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,h<=m.r||!m.r){h<=1&&p>0&&(m=f[p-1]);var g=d[m.l];s&&(h=s(``+h)),l=typeof g==`string`?g.replace(`%d`,h):g(h,r,m.l,u);break}}if(r)return l;var _=u?d.future:d.past;return typeof _==`function`?_(l):_.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),T=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(x()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_cn=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-cn`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`周日_周一_周二_周三_周四_周五_周六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`周`:e+`日`},weekStart:1,yearStart:4,formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日Ah点mm分`,LLLL:`YYYY年M月D日ddddAh点mm分`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s内`,past:`%s前`,s:`几秒`,m:`1 分钟`,mm:`%d 分钟`,h:`1 小时`,hh:`%d 小时`,d:`1 天`,dd:`%d 天`,M:`1 个月`,MM:`%d 个月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),E=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(x()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_tw=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-tw`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`週日_週一_週二_週三_週四_週五_週六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`週`:e+`日`},formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日 HH:mm`,LLLL:`YYYY年M月D日dddd HH:mm`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s內`,past:`%s前`,s:`幾秒`,m:`1 分鐘`,mm:`%d 分鐘`,h:`1 小時`,hh:`%d 小時`,d:`1 天`,dd:`%d 天`,M:`1 個月`,MM:`%d 個月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),D=t(e(),1),O=t(x(),1),k=t(w(),1);T(),E();var A=r();O.default.extend(k.default);var ae=null;function oe(e,t){let n=Math.max(0,Number(e)||0),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return r>0?t(`admin.uptime.daysHours`,{days:r,hours:i}):i>0?t(`admin.uptime.hoursMinutes`,{hours:i,minutes:a}):t(`admin.uptime.minutes`,{minutes:a})}function j(e){return Number.isFinite(e)?String(Math.round(e/(1024*1024*1024)*100)/100):`0`}function M(e){let t=Number(e);return!Number.isFinite(t)||t<0?0:Math.round(t*1024*1024*1024)}function se(e){return Array.from(new Set(String(e||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean)))}function N(e,t=12,n=8){return e?e.length<=t+n+3?e:`${e.slice(0,t)}...${e.slice(-n)}`:`-`}function ce(e,t){switch(e.seedStatus){case`queued`:return t(`admin.seedStatus.queued`);case`joining`:return t(`admin.seedStatus.joining`);case`active`:return t(`admin.seedStatus.active`);case`paused`:return t(`admin.seedStatus.paused`);case`error`:return e.seedError?t(`admin.seedStatus.errorWithMessage`,{message:e.seedError}):t(`admin.seedStatus.error`);default:return e.joined?t(`admin.seedStatus.active`):t(`admin.seedStatus.notJoined`)}}function P(e){return{"zh-CN":`zh-cn`,"zh-TW":`zh-tw`,en:`en`}[e]}function le(e,t,n){if(!e)return t(`admin.time.never`);let r=(0,O.default)(e);if(!r.isValid())return t(`admin.time.never`);if(r.isAfter((0,O.default)()))return t(`admin.time.justNow`);let i=P(n);return r.locale(i).from((0,O.default)().locale(i))}var ue=[{labelKey:`admin.seedHelp.active.label`,tone:`active`,descKey:`admin.seedHelp.active.desc`},{labelKey:`admin.seedHelp.pending.label`,tone:`pending`,descKey:`admin.seedHelp.pending.desc`},{labelKey:`admin.seedHelp.paused.label`,tone:`muted`,descKey:`admin.seedHelp.paused.desc`},{labelKey:`admin.seedHelp.error.label`,tone:`error`,descKey:`admin.seedHelp.error.desc`}],de=[{value:`all`,labelKey:`admin.logFilter.all`},{value:`join`,labelKey:`admin.logFilter.join`},{value:`pull`,labelKey:`admin.logFilter.pull`},{value:`verify`,labelKey:`admin.logFilter.verify`},{value:`serve`,labelKey:`admin.logFilter.serve`},{value:`error`,labelKey:`admin.logFilter.error`}],F={join:[`join`,`joined`,`topic`],pull:[`pull`,`p2p`],verify:[`verify`,`verified`,`integrity`,`download:success`],serve:[`seed`,`seeding`,`holding`,`publish:success`,`topic:joined`],error:[`error`,`failed`,`fail`]};function I(e){let t=``;try{t=JSON.stringify(e.data||{})}catch{}return[e.level,e.event,e.message,t].map(e=>String(e||``).toLowerCase()).join(` `)}function fe(e,t){let n=String(t||`all`).trim().toLowerCase();if(!n||n===`all`)return!0;let r=I(e);return n===`error`?e.level===`error`||F.error.some(e=>r.includes(e)):(F[n]||[n]).some(e=>r.includes(e))}function L(){let{t:e,locale:t,formatNumber:n,formatTime:r}=o(),i=v(e=>e.hasBackend),a=v(e=>e.addToast),[x,w]=(0,D.useState)(ae),[T,E]=(0,D.useState)([]),[O,k]=(0,D.useState)(``),[P,F]=(0,D.useState)(!1),[I,L]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,pe]=(0,D.useState)(`all`),[V,me]=(0,D.useState)([]),[he,H]=(0,D.useState)(``),[U,W]=(0,D.useState)({dataPath:``,capacityGiB:`100`,maxFileSizeGiB:`10`,remoteInvites:``}),G=i===!0;function K(){return G?!0:(a(e(i===null?`admin.toast.backendChecking`:`admin.toast.backendDisconnected`),`warning`),!1)}let q=(0,D.useMemo)(()=>!x||x.capacity.configuredBytes<=0?0:Math.min(100,Math.round(x.capacity.usedBytes/x.capacity.configuredBytes*100)),[x]),ge=(0,D.useMemo)(()=>(x?.holdings||[]).slice(0,100),[x]),J=Math.max(0,(x?.holdings.length||0)-100),Y=_(),X=!!Y&&!Y.includes(`localhost`)&&!Y.includes(`127.0.0.1`),Z=async()=>{if(!G)return!1;try{let e=await b.get(`/api/node/status`).json(),t=await b.get(`/api/node/config`).json();return w(e),W({dataPath:t.dataPath||e.dataPath||``,capacityGiB:j(t.capacityBytes),maxFileSizeGiB:j(t.maxFileSizeBytes),remoteInvites:(t.remoteInvites||[]).join(`
1
+ import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{C as i,T as a}from"./ui-BpDGD3IR.js";import{a as o}from"./i18n-NjvOSuV6.js";import{t as s}from"./download-jEPn2njL.js";import{t as c}from"./file-text-DPA1riJ_.js";import{t as l}from"./hard-drive-Dar_AZEq.js";import{n as u,t as d}from"./triangle-alert-DGWc8ZHu.js";import{t as f}from"./save-BjrbPwhJ.js";import{t as ee}from"./shield-check-DzDuWO8r.js";import{t as p}from"./trash-2-V12tJ8lI.js";import{t as m}from"./wifi-Bgo8eHY0.js";import{F as h,M as g,_,c as v,f as y,g as te,l as b}from"./index-BI8oNSVC.js";import{t as x}from"./dayjs.min-Dcc0B6Je.js";import{t as ne}from"./MarketingHeader-ceWdRCpe.js";import{t as S}from"./format-CR8oUWq6.js";var re=i(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ie=i(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),C=i(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),w=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],ee=f.length,p=0;p<ee;p+=1){var m=f[p];m.d&&(c=o?n(t).diff(a,m.d,!0):a.diff(t,m.d,!0));var h=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,h<=m.r||!m.r){h<=1&&p>0&&(m=f[p-1]);var g=d[m.l];s&&(h=s(``+h)),l=typeof g==`string`?g.replace(`%d`,h):g(h,r,m.l,u);break}}if(r)return l;var _=u?d.future:d.past;return typeof _==`function`?_(l):_.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))})),T=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(x()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_cn=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-cn`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`周日_周一_周二_周三_周四_周五_周六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`周`:e+`日`},weekStart:1,yearStart:4,formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日Ah点mm分`,LLLL:`YYYY年M月D日ddddAh点mm分`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s内`,past:`%s前`,s:`几秒`,m:`1 分钟`,mm:`%d 分钟`,h:`1 小时`,hh:`%d 小时`,d:`1 天`,dd:`%d 天`,M:`1 个月`,MM:`%d 个月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),E=n(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r(x()):typeof define==`function`&&define.amd?define([`dayjs`],r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_locale_zh_tw=r(n.dayjs)})(e,(function(e){function t(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var n=t(e),r={name:`zh-tw`,weekdays:`星期日_星期一_星期二_星期三_星期四_星期五_星期六`.split(`_`),weekdaysShort:`週日_週一_週二_週三_週四_週五_週六`.split(`_`),weekdaysMin:`日_一_二_三_四_五_六`.split(`_`),months:`一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月`.split(`_`),monthsShort:`1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月`.split(`_`),ordinal:function(e,t){return t===`W`?e+`週`:e+`日`},formats:{LT:`HH:mm`,LTS:`HH:mm:ss`,L:`YYYY/MM/DD`,LL:`YYYY年M月D日`,LLL:`YYYY年M月D日 HH:mm`,LLLL:`YYYY年M月D日dddd HH:mm`,l:`YYYY/M/D`,ll:`YYYY年M月D日`,lll:`YYYY年M月D日 HH:mm`,llll:`YYYY年M月D日dddd HH:mm`},relativeTime:{future:`%s內`,past:`%s前`,s:`幾秒`,m:`1 分鐘`,mm:`%d 分鐘`,h:`1 小時`,hh:`%d 小時`,d:`1 天`,dd:`%d 天`,M:`1 個月`,MM:`%d 個月`,y:`1 年`,yy:`%d 年`},meridiem:function(e,t){var n=100*e+t;return n<600?`凌晨`:n<900?`早上`:n<1100?`上午`:n<1300?`中午`:n<1800?`下午`:`晚上`}};return n.default.locale(r,null,!0),r}))})),D=t(e(),1),O=t(x(),1),k=t(w(),1);T(),E();var A=r();O.default.extend(k.default);var ae=null;function oe(e,t){let n=Math.max(0,Number(e)||0),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return r>0?t(`admin.uptime.daysHours`,{days:r,hours:i}):i>0?t(`admin.uptime.hoursMinutes`,{hours:i,minutes:a}):t(`admin.uptime.minutes`,{minutes:a})}function j(e){return Number.isFinite(e)?String(Math.round(e/(1024*1024*1024)*100)/100):`0`}function M(e){let t=Number(e);return!Number.isFinite(t)||t<0?0:Math.round(t*1024*1024*1024)}function se(e){return Array.from(new Set(String(e||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean)))}function N(e,t=12,n=8){return e?e.length<=t+n+3?e:`${e.slice(0,t)}...${e.slice(-n)}`:`-`}function ce(e,t){switch(e.seedStatus){case`queued`:return t(`admin.seedStatus.queued`);case`joining`:return t(`admin.seedStatus.joining`);case`active`:return t(`admin.seedStatus.active`);case`paused`:return t(`admin.seedStatus.paused`);case`error`:return e.seedError?t(`admin.seedStatus.errorWithMessage`,{message:e.seedError}):t(`admin.seedStatus.error`);default:return e.joined?t(`admin.seedStatus.active`):t(`admin.seedStatus.notJoined`)}}function P(e){return{"zh-CN":`zh-cn`,"zh-TW":`zh-tw`,en:`en`}[e]}function le(e,t,n){if(!e)return t(`admin.time.never`);let r=(0,O.default)(e);if(!r.isValid())return t(`admin.time.never`);if(r.isAfter((0,O.default)()))return t(`admin.time.justNow`);let i=P(n);return r.locale(i).from((0,O.default)().locale(i))}var ue=[{labelKey:`admin.seedHelp.active.label`,tone:`active`,descKey:`admin.seedHelp.active.desc`},{labelKey:`admin.seedHelp.pending.label`,tone:`pending`,descKey:`admin.seedHelp.pending.desc`},{labelKey:`admin.seedHelp.paused.label`,tone:`muted`,descKey:`admin.seedHelp.paused.desc`},{labelKey:`admin.seedHelp.error.label`,tone:`error`,descKey:`admin.seedHelp.error.desc`}],de=[{value:`all`,labelKey:`admin.logFilter.all`},{value:`join`,labelKey:`admin.logFilter.join`},{value:`pull`,labelKey:`admin.logFilter.pull`},{value:`verify`,labelKey:`admin.logFilter.verify`},{value:`serve`,labelKey:`admin.logFilter.serve`},{value:`error`,labelKey:`admin.logFilter.error`}],F={join:[`join`,`joined`,`topic`],pull:[`pull`,`p2p`],verify:[`verify`,`verified`,`integrity`,`download:success`],serve:[`seed`,`seeding`,`holding`,`publish:success`,`topic:joined`],error:[`error`,`failed`,`fail`]};function I(e){let t=``;try{t=JSON.stringify(e.data||{})}catch{}return[e.level,e.event,e.message,t].map(e=>String(e||``).toLowerCase()).join(` `)}function fe(e,t){let n=String(t||`all`).trim().toLowerCase();if(!n||n===`all`)return!0;let r=I(e);return n===`error`?e.level===`error`||F.error.some(e=>r.includes(e)):(F[n]||[n]).some(e=>r.includes(e))}function L(){let{t:e,locale:t,formatNumber:n,formatTime:r}=o(),i=v(e=>e.hasBackend),a=v(e=>e.addToast),[x,w]=(0,D.useState)(ae),[T,E]=(0,D.useState)([]),[O,k]=(0,D.useState)(``),[P,F]=(0,D.useState)(!1),[I,L]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,pe]=(0,D.useState)(`all`),[V,me]=(0,D.useState)([]),[he,H]=(0,D.useState)(``),[U,W]=(0,D.useState)({dataPath:``,capacityGiB:`100`,maxFileSizeGiB:`10`,remoteInvites:``}),G=i===!0;function K(){return G?!0:(a(e(i===null?`admin.toast.backendChecking`:`admin.toast.backendDisconnected`),`warning`),!1)}let q=(0,D.useMemo)(()=>!x||x.capacity.configuredBytes<=0?0:Math.min(100,Math.round(x.capacity.usedBytes/x.capacity.configuredBytes*100)),[x]),ge=(0,D.useMemo)(()=>(x?.holdings||[]).slice(0,100),[x]),J=Math.max(0,(x?.holdings.length||0)-100),Y=_(),X=!!Y&&!Y.includes(`localhost`)&&!Y.includes(`127.0.0.1`),Z=async()=>{if(!G)return!1;try{let e=await b.get(`/api/node/status`).json(),t=await b.get(`/api/node/config`).json();return w(e),W({dataPath:t.dataPath||e.dataPath||``,capacityGiB:j(t.capacityBytes),maxFileSizeGiB:j(t.maxFileSizeBytes),remoteInvites:(t.remoteInvites||[]).join(`
2
2
  `)}),k(``),!0}catch(t){let n=await y(t,e(`admin.error.readStatus`));return k(n),a(n,`error`),!1}},_e=async()=>{K()&&await Z()&&a(e(`admin.toast.statusRefreshed`),`success`)},Q=async(e=B)=>{if(G)try{let t=new URLSearchParams({limit:`80`,filter:e});E((await b.get(`/api/node/logs?${t.toString()}`).json()).logs||[])}catch{}},$=async()=>{if(G)try{me((await b.get(`/api/admin/users`).json()).users||[])}catch{}},ve=async()=>{if(K()){F(!0);try{await b.post(`/api/node/config`,{json:{dataPath:U.dataPath,capacityBytes:M(U.capacityGiB),maxFileSizeBytes:M(U.maxFileSizeGiB),remoteInvites:se(U.remoteInvites)}}).json(),a(U.dataPath===(x?.dataPath||``)?e(`admin.toast.configSaved`):e(`admin.toast.configSavedRestart`),`success`),await Z(),await Q()}catch(t){let n=await y(t,e(`admin.error.saveConfig`));a(n,`error`),k(n)}finally{F(!1)}}},ye=async()=>{x?.nodeId&&(await navigator.clipboard.writeText(x.nodeId),a(e(`admin.toast.nodeIdCopied`),`success`))},be=async()=>{if(K()){L(!0);try{await b.delete(`/api/node/logs`).json(),E([]),a(e(`admin.toast.logsCleared`),`success`)}catch(t){let n=await y(t,e(`admin.error.clearLogs`));a(n,`error`),k(n)}finally{L(!1)}}},xe=async()=>{if(K()){z(!0);try{let t=await b.get(`/api/node/diagnostics`).json(),n=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`),o=new Date().toISOString().replace(/[:.]/g,`-`);i.href=r,i.download=`mostbox-diagnostics-${o}.json`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),a(e(`admin.toast.diagnosticsExported`),`success`)}catch(t){let n=await y(t,e(`admin.error.exportDiagnostics`));a(n,`error`),k(n)}finally{z(!1)}}},Se=async t=>{if(K()&&window.confirm(e(`admin.confirm.clearUserData`,{address:`${t.slice(0,6)}...${t.slice(-4)}`}))){H(t);try{await b.delete(`/api/admin/users/${t}/data`).json(),a(e(`admin.toast.userDataCleared`),`success`),await $(),await Z()}catch(t){let n=await y(t,e(`admin.error.clearUserData`));a(n,`error`),k(n)}finally{H(``)}}};return(0,D.useEffect)(()=>{if(!G||X)return;Z(),Q(),$();let e=null,t=!1;return(async()=>{if(e=new WebSocket(await te(`/ws`)),t){e.close();return}e.onmessage=e=>{try{let t=JSON.parse(e.data);t.event===`node:status`&&w(t.data),t.event===`node:log`&&fe(t.data,B)&&E(e=>[t.data,...e].slice(0,80)),t.event===`node:logs:cleared`&&E([]),(t.event===`publish:success`||t.event===`download:success`||t.event===`network:status`)&&Z()}catch{}}})(),()=>{t=!0,e?.close()}},[G,X,B]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{}),(0,A.jsxs)(`main`,{className:`admin-page`,children:[(0,A.jsxs)(`header`,{className:`admin-topbar`,children:[(0,A.jsx)(`div`,{className:`admin-title-group`,children:(0,A.jsx)(`h1`,{children:e(`admin.title`)})}),(0,A.jsxs)(`div`,{className:`admin-topbar-actions`,children:[(0,A.jsxs)(`span`,{className:`admin-status-pill ${x?.status===`online`?`online`:``}`,children:[(0,A.jsx)(re,{size:14}),x?.status===`online`?e(`admin.status.online`):e(`admin.status.waiting`)]}),(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:_e,children:[(0,A.jsx)(u,{size:16}),e(`admin.action.refresh`)]})]})]}),i===!1&&(0,A.jsxs)(`section`,{className:`admin-panel admin-error`,children:[(0,A.jsx)(g,{size:20}),(0,A.jsx)(`span`,{children:e(`admin.error.localDaemonDisconnected`)})]}),X&&(0,A.jsxs)(`section`,{className:`admin-panel admin-error`,children:[(0,A.jsx)(d,{size:18}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:e(`admin.remoteUnavailable.title`)}),(0,A.jsx)(`p`,{children:e(`admin.remoteUnavailable.desc`)})]})]}),!X&&O&&(0,A.jsxs)(`section`,{className:`admin-panel admin-error`,children:[(0,A.jsx)(c,{size:20}),(0,A.jsx)(`span`,{children:O})]}),!X&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`section`,{className:`admin-overview`,children:[(0,A.jsxs)(`div`,{className:`admin-metric`,children:[(0,A.jsx)(`div`,{className:`admin-metric-icon`,children:(0,A.jsx)(ee,{size:18})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.metric.nodeId`)}),(0,A.jsx)(`strong`,{translate:`no`,children:N(x?.nodeId||``)})]}),(0,A.jsx)(`button`,{className:`btn btn-icon admin-metric-action`,onClick:ye,"aria-label":e(`admin.action.copyNodeId`),children:(0,A.jsx)(ie,{size:15})})]}),(0,A.jsxs)(`div`,{className:`admin-metric`,children:[(0,A.jsx)(`div`,{className:`admin-metric-icon`,children:(0,A.jsx)(m,{size:18})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.metric.connections`)}),(0,A.jsx)(`strong`,{children:x?e(`admin.metric.peers`,{count:x.network.peers}):`-`})]})]}),(0,A.jsxs)(`div`,{className:`admin-metric`,children:[(0,A.jsx)(`div`,{className:`admin-metric-icon`,children:(0,A.jsx)(l,{size:18})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.metric.capacity`)}),(0,A.jsxs)(`strong`,{children:[q,`%`]})]})]}),(0,A.jsxs)(`div`,{className:`admin-metric`,children:[(0,A.jsx)(`div`,{className:`admin-metric-icon`,children:(0,A.jsx)(g,{size:18})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.metric.uptime`)}),(0,A.jsx)(`strong`,{children:x?oe(x.uptimeSeconds,e):`-`})]})]})]}),(0,A.jsxs)(`section`,{className:`admin-grid`,children:[(0,A.jsxs)(`div`,{className:`admin-panel admin-span-2`,children:[(0,A.jsxs)(`div`,{className:`admin-panel-header`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`h2`,{children:e(`admin.nodeStatus.title`)})}),(0,A.jsx)(h,{size:18})]}),(0,A.jsxs)(`div`,{className:`admin-status-grid`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.nodeStatus.version`)}),(0,A.jsx)(`strong`,{translate:`no`,children:x?.version||`-`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.nodeStatus.listen`)}),(0,A.jsx)(`strong`,{translate:`no`,children:x?`${x.host}:${x.port}`:`-`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`span`,{children:e(`admin.nodeStatus.dataPath`)}),(0,A.jsx)(`strong`,{translate:`no`,children:x?.dataPath||`-`})]})]}),(0,A.jsx)(`div`,{className:`admin-address-list`,children:(x?.listen.addresses||[]).map(e=>(0,A.jsxs)(`span`,{translate:`no`,children:[e.label,`: `,e.ip,`:`,x?.port]},`${e.type}-${e.ip}`))})]}),(0,A.jsxs)(`div`,{className:`admin-panel admin-span-2`,children:[(0,A.jsxs)(`div`,{className:`admin-panel-header`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`h2`,{children:e(`admin.userData.title`)})}),(0,A.jsx)(C,{size:18})]}),(0,A.jsxs)(`div`,{className:`admin-table`,children:[(0,A.jsxs)(`div`,{className:`admin-table-row admin-table-head`,children:[(0,A.jsx)(`span`,{children:e(`admin.userData.user`)}),(0,A.jsx)(`span`,{children:e(`admin.userData.files`)}),(0,A.jsx)(`span`,{children:e(`admin.userData.trash`)}),(0,A.jsx)(`span`,{children:e(`admin.userData.actions`)})]}),V.map(t=>(0,A.jsxs)(`div`,{className:`admin-table-row`,children:[(0,A.jsx)(`span`,{title:t.address,translate:`no`,children:N(t.address)}),(0,A.jsx)(`span`,{children:n(t.fileCount)}),(0,A.jsx)(`span`,{children:n(t.trashCount)}),(0,A.jsx)(`span`,{children:(0,A.jsxs)(`button`,{className:`btn btn-ghost`,onClick:()=>Se(t.address),disabled:he===t.address,children:[(0,A.jsx)(p,{size:16}),e(`admin.action.clear`)]})})]},t.address)),V.length===0&&(0,A.jsx)(`div`,{className:`admin-empty-row`,children:e(`admin.userData.empty`)})]})]}),(0,A.jsxs)(`div`,{className:`admin-panel admin-span-2`,children:[(0,A.jsxs)(`div`,{className:`admin-panel-header`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`h2`,{children:e(`admin.settings.title`)})}),(0,A.jsx)(C,{size:18})]}),(0,A.jsxs)(`div`,{className:`admin-settings-fields`,children:[(0,A.jsxs)(`label`,{className:`admin-field admin-field-wide`,children:[(0,A.jsx)(`span`,{children:e(`admin.settings.dataPath`)}),(0,A.jsx)(`input`,{className:`input`,value:U.dataPath,onChange:e=>W(t=>({...t,dataPath:e.target.value}))})]}),(0,A.jsxs)(`label`,{className:`admin-field`,children:[(0,A.jsx)(`span`,{children:e(`admin.settings.capacityGiB`)}),(0,A.jsx)(`input`,{className:`input`,type:`number`,min:`0`,step:`1`,value:U.capacityGiB,onChange:e=>W(t=>({...t,capacityGiB:e.target.value}))})]}),(0,A.jsxs)(`label`,{className:`admin-field`,children:[(0,A.jsx)(`span`,{children:e(`admin.settings.maxFileSizeGiB`)}),(0,A.jsx)(`input`,{className:`input`,type:`number`,min:`0`,step:`1`,value:U.maxFileSizeGiB,onChange:e=>W(t=>({...t,maxFileSizeGiB:e.target.value}))})]}),(0,A.jsxs)(`label`,{className:`admin-field admin-field-wide`,children:[(0,A.jsx)(`span`,{children:e(`admin.settings.remoteInvites`)}),(0,A.jsx)(`textarea`,{className:`input admin-textarea`,value:U.remoteInvites,placeholder:e(`admin.settings.remoteInvitesPlaceholder`),onChange:e=>W(t=>({...t,remoteInvites:e.target.value}))})]})]}),(0,A.jsx)(`p`,{className:`admin-field-hint`,children:e(`admin.settings.hint`)}),(0,A.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:ve,disabled:P,children:[(0,A.jsx)(f,{size:16}),e(`admin.action.saveConfig`)]})]}),(0,A.jsxs)(`div`,{className:`admin-panel admin-span-2`,children:[(0,A.jsxs)(`div`,{className:`admin-panel-header`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`h2`,{children:e(`admin.holdings.title`)})}),(0,A.jsx)(l,{size:18})]}),(0,A.jsxs)(`div`,{className:`admin-capacity-row`,children:[(0,A.jsx)(`progress`,{value:q,max:`100`}),(0,A.jsxs)(`span`,{children:[S(x?.capacity.usedBytes||0),` /`,` `,S(x?.capacity.configuredBytes||0)]})]}),(0,A.jsx)(`div`,{className:`admin-seed-help`,"aria-label":e(`admin.seedHelp.label`),children:ue.map(t=>(0,A.jsxs)(`div`,{className:`admin-seed-help-item`,children:[(0,A.jsx)(`span`,{className:`admin-seed-dot ${t.tone}`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`strong`,{children:e(t.labelKey)}),(0,A.jsx)(`span`,{children:e(t.descKey)})]})]},t.labelKey))}),J>0&&(0,A.jsx)(`p`,{className:`admin-table-note`,children:e(`admin.holdings.hiddenCount`,{count:n(J)})}),(0,A.jsxs)(`div`,{className:`admin-table`,children:[(0,A.jsxs)(`div`,{className:`admin-table-row admin-table-head admin-holdings-row`,children:[(0,A.jsx)(`span`,{children:e(`admin.holdings.file`)}),(0,A.jsx)(`span`,{children:`CID`}),(0,A.jsx)(`span`,{children:e(`admin.holdings.size`)}),(0,A.jsx)(`span`,{children:e(`admin.holdings.peers`)}),(0,A.jsx)(`span`,{children:e(`admin.holdings.topicJoined`)}),(0,A.jsx)(`span`,{children:e(`admin.holdings.lastServed`)}),(0,A.jsx)(`span`,{children:e(`admin.holdings.totalServed`)}),(0,A.jsx)(`span`,{children:e(`admin.holdings.status`)})]}),ge.map(r=>(0,A.jsxs)(`div`,{className:`admin-table-row admin-holdings-row`,children:[(0,A.jsx)(`span`,{translate:`no`,children:r.fileName||`-`}),(0,A.jsx)(`span`,{title:r.cid,translate:`no`,children:N(r.cid)}),(0,A.jsx)(`span`,{children:S(r.size)}),(0,A.jsx)(`span`,{children:n(r.peerCount??0)}),(0,A.jsx)(`span`,{className:`admin-seed-pill ${r.joined?`active`:``}`,children:r.joined?e(`admin.holdings.joinedYes`):e(`admin.holdings.joinedNo`)}),(0,A.jsx)(`span`,{title:r.lastServedAt||``,children:le(r.lastServedAt,e,t)}),(0,A.jsx)(`span`,{children:S(r.totalServedBytes||0)}),(0,A.jsx)(`span`,{className:`admin-seed-pill ${r.seedStatus===`error`?`error`:r.seedStatus===`active`||r.joined?`active`:``}`,children:ce(r,e)})]},r.cid)),(!x||x.holdings.length===0)&&(0,A.jsx)(`div`,{className:`admin-empty-row`,children:e(`admin.holdings.empty`)})]})]}),(0,A.jsxs)(`div`,{className:`admin-panel admin-span-2`,children:[(0,A.jsxs)(`div`,{className:`admin-panel-header`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`h2`,{children:e(`admin.logs.title`)})}),(0,A.jsxs)(`div`,{className:`admin-panel-actions`,children:[(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:xe,disabled:R,children:[(0,A.jsx)(s,{size:16}),e(`admin.action.exportDiagnostics`)]}),(0,A.jsxs)(`button`,{className:`btn btn-ghost`,onClick:be,disabled:I||T.length===0,children:[(0,A.jsx)(p,{size:16}),e(`admin.action.clearLogs`)]}),(0,A.jsx)(c,{size:18})]})]}),(0,A.jsx)(`div`,{className:`admin-log-filter`,"aria-label":e(`admin.logs.filterLabel`),children:de.map(t=>(0,A.jsx)(`button`,{type:`button`,className:B===t.value?`active`:``,onClick:()=>{pe(t.value),Q(t.value)},children:e(t.labelKey)},t.value))}),(0,A.jsxs)(`div`,{className:`admin-log-list`,children:[T.map(e=>(0,A.jsxs)(`div`,{className:`admin-log-row`,children:[(0,A.jsx)(`time`,{children:r(e.ts)}),(0,A.jsx)(`span`,{className:`admin-log-level ${e.level}`,translate:`no`,children:e.level}),(0,A.jsx)(`strong`,{translate:`no`,children:e.event}),(0,A.jsx)(`span`,{translate:`no`,children:e.message})]},e.id)),T.length===0&&(0,A.jsx)(`div`,{className:`admin-empty-row`,children:e(`admin.logs.empty`)})]})]})]})]})]})]})}var R=a(`/admin/`)({component:L});export{R as Route};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,T as i,_ as a,d as o,g as s,l as c,m as l,s as u,u as d,y as f}from"./ui-BpDGD3IR.js";import{a as p}from"./i18n-NjvOSuV6.js";import{n as m,r as h}from"./LanguageToggle-CSQtRZ3A.js";import{n as g,t as _}from"./lock-CLIE8cct.js";import{t as v}from"./download-jEPn2njL.js";import{t as y}from"./external-link-BFaoZeK0.js";import{a as b,i as x,n as S,r as C,t as w}from"./mp-B6kdA94c.js";import{t as T}from"./key-round-DNcpSuMw.js";import{n as ee,t as te}from"./SidebarHomeLink-BdsUM4Kt.js";import{t as ne}from"./wallet-T7ONZ3Kg.js";import{N as E,P as D,c as re,i as ie}from"./index-BZ-f0CZd.js";var O=r(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=r(`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=r(`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=r(`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=r(`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`}]]),k=t(e()),A=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function ue({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}=p();return(0,A.jsxs)(`div`,{className:`web3-box-account`,children:[(0,A.jsx)(`div`,{className:`web3-box-account-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:e}),(0,A.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,A.jsxs)(`div`,{className:`web3-box-login`,children:[(0,A.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,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,A.jsx)(T,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,A.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.address`)}),(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,A.jsx)(C,{text:a.address.toLowerCase()})]})]}),(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,A.jsx)(C,{text:a.publicKey})]})]}),(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,A.jsxs)(`div`,{className:`mono-row danger`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,A.jsx)(E,{size:14}):(0,A.jsx)(D,{size:14})})]})]})]}):null]})}function de(e,t){return Number.isFinite(e)?t(e):`-`}function fe({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:o,encryptLabel:s,decryptLabel:c,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:m,onDecrypt:h}){let{t:g,formatDateTime:v}=p(),y=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=a(r);return(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:e}),(0,A.jsx)(`p`,{children:t})]})}),(0,A.jsx)(`label`,{className:`web3-box-label`,htmlFor:y,children:g(`web3.box.plaintext`)}),(0,A.jsx)(`textarea`,{id:y,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,A.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:m,type:`button`,children:[(0,A.jsx)(_,{size:16}),s]}),(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,A.jsx)(T,{size:16}),c]})]}),o&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:o}),(0,A.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:g(`web3.box.ciphertext`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),b&&(0,A.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,A.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,A.jsx)(`span`,{children:g(`web3.box.timestamp`)}),(0,A.jsx)(`code`,{translate:`no`,children:de(b.timestampMs,v)})]}),(0,A.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,A.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,A.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function pe(e){let{t}=p();return(0,A.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,A.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,A.jsx)(ue,{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,A.jsx)(ue,{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,A.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,A.jsx)(fe,{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,A.jsx)(fe,{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,A.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,A.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,A.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,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,A.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,A.jsx)(`div`,{className:`web3-box-actions`,children:(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,A.jsx)(_,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,A.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,A.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,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,A.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,A.jsx)(`div`,{className:`web3-box-actions`,children:(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,A.jsx)(T,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,A.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,A.jsxs)(`div`,{className:n,children:[(0,A.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,A.jsx)(`p`,{children:t})]})}function M({label:e,pem:t,filename:n}){let{t:r}=p();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,A.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,A.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,A.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,A.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,A.jsx)(C,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,A.jsx)(v,{size:14}),r(`common.download`)]})]})]}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function me({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=p();if(!t||!n)return(0,A.jsx)(j,{icon:(0,A.jsx)(_,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,A.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,A.jsx)(M,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,A.jsx)(M,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var he=Object.defineProperty,N=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||={})P.call(t,n)&&I(e,n,t[n]);if(N)for(var n of N(t))F.call(t,n)&&I(e,n,t[n]);return e},R=(e,t)=>{var n={};for(var r in e)P.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&N)for(var r of N(e))t.indexOf(r)<0&&F.call(e,r)&&(n[r]=e[r]);return n},z;(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})(z||={}),(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||={})})(z||={}),(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||={})})(z||={});var B=z,ge={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},_e=128,V=`L`,H=`#FFFFFF`,U=`#000000`,W=!1,G=1,ve=4,ye=0,be=.1;function xe(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 K(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 Se(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*be),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 Ce(e,t){return t==null?e?ve:ye: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=k.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...B.QrSegment.makeSegments(t)),e),[]);return B.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=k.useMemo(()=>{let e=c.getModules(),t=Ce(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Se(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var we=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Te=k.forwardRef(function(e,t){let n=e,{value:r,size:i=_e,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,marginSize:d,imageSettings:f}=n,p=R(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=R(p,[`style`]),g=f?.src,_=k.useRef(null),v=k.useRef(null),y=k.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=k.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});k.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=K(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,we?t.fill(new Path2D(xe(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)}}),k.useEffect(()=>{x(!1)},[g]);let ee=L({height:i,width:i},m),te=null;return g!=null&&(te=k.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),k.createElement(k.Fragment,null,k.createElement(`canvas`,L({style:ee,height:i,width:i,ref:y,role:`img`},h)),te)});Te.displayName=`QRCodeCanvas`;var J=k.forwardRef(function(e,t){let n=e,{value:r,size:i=_e,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=R(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=K(g,v.excavation)),b=k.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=xe(y,h);return k.createElement(`svg`,L({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&k.createElement(`title`,null,d),k.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),k.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function Ee({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:m,onToggleDeriveAddress:h,onToggleDerivePrivateKey:_,onDerive:v}){let{t:y}=p(),b=e?.address||``;return!e||!b?(0,A.jsx)(j,{icon:(0,A.jsx)(ne,{size:36}),message:y(`web3.empty.walletTools`)}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,A.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,A.jsx)(oe,{size:14}),y(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,A.jsx)(O,{size:14}):(0,A.jsx)(g,{size:14})]}),s&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,A.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:b}),(0,A.jsx)(C,{text:b})]}),(0,A.jsx)(`div`,{className:`qr-wrap`,children:(0,A.jsx)(J,{value:b,size:200})})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,A.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,A.jsx)(T,{size:14}),y(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,A.jsx)(O,{size:14}):(0,A.jsx)(g,{size:14})]}),c&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,A.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,A.jsx)(C,{text:t})]}),(0,A.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,A.jsx)(se,{size:14}),y(`web3.warning.mnemonic`)]}),(0,A.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:y(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,A.jsx)(`div`,{className:`qr-wrap`,children:(0,A.jsx)(J,{value:t,size:260})})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`button`,{className:`btn btn-primary`,onClick:v,children:y(`web3.action.deriveAddresses`,{count:n})})}),(0,A.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,A.jsx)(se,{size:14}),y(`web3.warning.privateKey`)]}),r.length>0&&(0,A.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,A.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{onClick:m,className:`web3-derive-th`,children:y(`web3.label.account`)}),(0,A.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:y(`web3.label.address`)}),(0,A.jsx)(`th`,{onClick:_,className:`web3-derive-th danger`,children:y(`web3.label.privateKeyToggle`,{action:y(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,A.jsx)(`tbody`,{children:r.map(e=>(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`td`,{children:i?e.index+1:``}),(0,A.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,A.jsx)(`td`,{className:`danger`,children:(0,A.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,A.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,A.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,A.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,A.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,A.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function De(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Oe({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=p(),s=e?.address||``;return!e||!s?(0,A.jsx)(j,{icon:(0,A.jsx)(x,{size:36}),message:o(`web3.empty.identity`)}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,A.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,A.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,A.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,A.jsx)(C,{text:s.toLowerCase()}),(0,A.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,A.jsx)(y,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,A.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,A.jsx)(b,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,A.jsx)(C,{text:t.ed_public_key})]})}),(0,A.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,A.jsx)(T,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,A.jsx)(C,{text:t.public_key})]})}),(0,A.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,A.jsx)(ce,{size:18}),accent:!0,children:(0,A.jsxs)(`div`,{className:`mono-row danger`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:De(t.private_key)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,A.jsx)(E,{size:14}):(0,A.jsx)(D,{size:14})})]})}),(0,A.jsx)(Y,{title:`IPNS ID`,icon:(0,A.jsx)(ae,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,A.jsx)(C,{text:n})]})})]})]})}function ke({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=p();return(0,A.jsxs)(`div`,{className:`input-panel`,children:[(0,A.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,A.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,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]})]}),(0,A.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Ae=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,T as i,_ as a,d as o,g as s,l as c,m as l,s as u,u as d,y as f}from"./ui-BpDGD3IR.js";import{a as p}from"./i18n-NjvOSuV6.js";import{n as m,r as h}from"./LanguageToggle-CSQtRZ3A.js";import{n as g,t as _}from"./lock-CLIE8cct.js";import{t as v}from"./download-jEPn2njL.js";import{t as y}from"./external-link-BFaoZeK0.js";import{a as b,i as x,n as S,r as C,t as w}from"./mp-B6kdA94c.js";import{t as T}from"./key-round-DNcpSuMw.js";import{n as ee,t as te}from"./SidebarHomeLink-DXv0c9Ob.js";import{t as ne}from"./wallet-T7ONZ3Kg.js";import{N as E,P as D,c as re,i as ie}from"./index-BI8oNSVC.js";var O=r(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=r(`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=r(`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=r(`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=r(`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`}]]),k=t(e()),A=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function ue({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}=p();return(0,A.jsxs)(`div`,{className:`web3-box-account`,children:[(0,A.jsx)(`div`,{className:`web3-box-account-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:e}),(0,A.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,A.jsxs)(`div`,{className:`web3-box-login`,children:[(0,A.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,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,A.jsx)(T,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,A.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.address`)}),(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,A.jsx)(C,{text:a.address.toLowerCase()})]})]}),(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,A.jsx)(C,{text:a.publicKey})]})]}),(0,A.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,A.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,A.jsxs)(`div`,{className:`mono-row danger`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,A.jsx)(E,{size:14}):(0,A.jsx)(D,{size:14})})]})]})]}):null]})}function de(e,t){return Number.isFinite(e)?t(e):`-`}function fe({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:o,encryptLabel:s,decryptLabel:c,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:m,onDecrypt:h}){let{t:g,formatDateTime:v}=p(),y=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=a(r);return(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:e}),(0,A.jsx)(`p`,{children:t})]})}),(0,A.jsx)(`label`,{className:`web3-box-label`,htmlFor:y,children:g(`web3.box.plaintext`)}),(0,A.jsx)(`textarea`,{id:y,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,A.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:m,type:`button`,children:[(0,A.jsx)(_,{size:16}),s]}),(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,A.jsx)(T,{size:16}),c]})]}),o&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:o}),(0,A.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:g(`web3.box.ciphertext`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),b&&(0,A.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,A.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,A.jsx)(`span`,{children:g(`web3.box.timestamp`)}),(0,A.jsx)(`code`,{translate:`no`,children:de(b.timestampMs,v)})]}),(0,A.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,A.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,A.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function pe(e){let{t}=p();return(0,A.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,A.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,A.jsx)(ue,{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,A.jsx)(ue,{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,A.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,A.jsx)(fe,{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,A.jsx)(fe,{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,A.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,A.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,A.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,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,A.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,A.jsx)(`div`,{className:`web3-box-actions`,children:(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,A.jsx)(_,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,A.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,A.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,A.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,A.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,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]}),(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,A.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,A.jsx)(`div`,{className:`web3-box-actions`,children:(0,A.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,A.jsx)(T,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,A.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,A.jsxs)(`div`,{className:`web3-box-result`,children:[(0,A.jsx)(`label`,{className:`web3-box-result-header`,children:(0,A.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,A.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,A.jsxs)(`div`,{className:n,children:[(0,A.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,A.jsx)(`p`,{children:t})]})}function M({label:e,pem:t,filename:n}){let{t:r}=p();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,A.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,A.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,A.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,A.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,A.jsx)(C,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,A.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,A.jsx)(v,{size:14}),r(`common.download`)]})]})]}),(0,A.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function me({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=p();if(!t||!n)return(0,A.jsx)(j,{icon:(0,A.jsx)(_,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,A.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,A.jsx)(M,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,A.jsx)(M,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var he=Object.defineProperty,N=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t)=>{for(var n in t||={})P.call(t,n)&&I(e,n,t[n]);if(N)for(var n of N(t))F.call(t,n)&&I(e,n,t[n]);return e},R=(e,t)=>{var n={};for(var r in e)P.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&N)for(var r of N(e))t.indexOf(r)<0&&F.call(e,r)&&(n[r]=e[r]);return n},z;(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})(z||={}),(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||={})})(z||={}),(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||={})})(z||={});var B=z,ge={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},_e=128,V=`L`,H=`#FFFFFF`,U=`#000000`,W=!1,G=1,ve=4,ye=0,be=.1;function xe(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 K(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 Se(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*be),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 Ce(e,t){return t==null?e?ve:ye: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=k.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...B.QrSegment.makeSegments(t)),e),[]);return B.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=k.useMemo(()=>{let e=c.getModules(),t=Ce(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Se(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var we=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Te=k.forwardRef(function(e,t){let n=e,{value:r,size:i=_e,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,marginSize:d,imageSettings:f}=n,p=R(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=R(p,[`style`]),g=f?.src,_=k.useRef(null),v=k.useRef(null),y=k.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=k.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});k.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=K(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,we?t.fill(new Path2D(xe(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)}}),k.useEffect(()=>{x(!1)},[g]);let ee=L({height:i,width:i},m),te=null;return g!=null&&(te=k.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),k.createElement(k.Fragment,null,k.createElement(`canvas`,L({style:ee,height:i,width:i,ref:y,role:`img`},h)),te)});Te.displayName=`QRCodeCanvas`;var J=k.forwardRef(function(e,t){let n=e,{value:r,size:i=_e,level:a=V,bgColor:o=H,fgColor:s=U,includeMargin:c=W,minVersion:l=G,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=R(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=K(g,v.excavation)),b=k.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=xe(y,h);return k.createElement(`svg`,L({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&k.createElement(`title`,null,d),k.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),k.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function Ee({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:m,onToggleDeriveAddress:h,onToggleDerivePrivateKey:_,onDerive:v}){let{t:y}=p(),b=e?.address||``;return!e||!b?(0,A.jsx)(j,{icon:(0,A.jsx)(ne,{size:36}),message:y(`web3.empty.walletTools`)}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,A.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,A.jsx)(oe,{size:14}),y(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,A.jsx)(O,{size:14}):(0,A.jsx)(g,{size:14})]}),s&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,A.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:b}),(0,A.jsx)(C,{text:b})]}),(0,A.jsx)(`div`,{className:`qr-wrap`,children:(0,A.jsx)(J,{value:b,size:200})})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,A.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,A.jsx)(T,{size:14}),y(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,A.jsx)(O,{size:14}):(0,A.jsx)(g,{size:14})]}),c&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,A.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,A.jsx)(C,{text:t})]}),(0,A.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,A.jsx)(se,{size:14}),y(`web3.warning.mnemonic`)]}),(0,A.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:y(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,A.jsx)(`div`,{className:`qr-wrap`,children:(0,A.jsx)(J,{value:t,size:260})})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,A.jsx)(`div`,{children:(0,A.jsx)(`button`,{className:`btn btn-primary`,onClick:v,children:y(`web3.action.deriveAddresses`,{count:n})})}),(0,A.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,A.jsx)(se,{size:14}),y(`web3.warning.privateKey`)]}),r.length>0&&(0,A.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,A.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{onClick:m,className:`web3-derive-th`,children:y(`web3.label.account`)}),(0,A.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:y(`web3.label.address`)}),(0,A.jsx)(`th`,{onClick:_,className:`web3-derive-th danger`,children:y(`web3.label.privateKeyToggle`,{action:y(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,A.jsx)(`tbody`,{children:r.map(e=>(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`td`,{children:i?e.index+1:``}),(0,A.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,A.jsx)(`td`,{className:`danger`,children:(0,A.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,A.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,A.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,A.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,A.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,A.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function De(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Oe({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=p(),s=e?.address||``;return!e||!s?(0,A.jsx)(j,{icon:(0,A.jsx)(x,{size:36}),message:o(`web3.empty.identity`)}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,A.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,A.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,A.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,A.jsx)(C,{text:s.toLowerCase()}),(0,A.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,A.jsx)(y,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,A.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,A.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,A.jsx)(b,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,A.jsx)(C,{text:t.ed_public_key})]})}),(0,A.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,A.jsx)(T,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,A.jsx)(C,{text:t.public_key})]})}),(0,A.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,A.jsx)(ce,{size:18}),accent:!0,children:(0,A.jsxs)(`div`,{className:`mono-row danger`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:De(t.private_key)}),(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,A.jsx)(E,{size:14}):(0,A.jsx)(D,{size:14})})]})}),(0,A.jsx)(Y,{title:`IPNS ID`,icon:(0,A.jsx)(ae,{size:18}),children:(0,A.jsxs)(`div`,{className:`mono-row`,children:[(0,A.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,A.jsx)(C,{text:n})]})})]})]})}function ke({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=p();return(0,A.jsxs)(`div`,{className:`input-panel`,children:[(0,A.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,A.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,A.jsxs)(`div`,{className:`input-wrap`,children:[(0,A.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,A.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,A.jsx)(D,{size:16}):(0,A.jsx)(E,{size:16})})]})]}),(0,A.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Ae=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
2
2
  `)}\n-----END PRIVATE KEY-----`},je=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([3,33,0,...e]),r=t.length+n.length,i=new Uint8Array(2+r);i[0]=48,i[1]=r;let a=2;return i.set(t,a),a+=t.length,i.set(n,a),`-----BEGIN PUBLIC KEY-----\n${X(i).match(/.{1,64}/g)?.join(`
3
3
  `)}\n-----END PUBLIC KEY-----`},Me=[`wallet`,`pem`,`export`,`EA`];function Ne(){let e=window.location.hash.replace(`#`,``);return Me.includes(e)?e:`wallet`}function Pe(){let{t:e}=p(),t=re(e=>e.isDarkMode),n=re(e=>e.setIsDarkMode),r=re(e=>e.addToast),i=u(e=>e.setUserIdentity),[a,g]=(0,k.useState)(`wallet`),[v,y]=(0,k.useState)(``),[b,C]=(0,k.useState)(``),[E,D]=(0,k.useState)(!1),[O,ae]=(0,k.useState)(null),[oe,se]=(0,k.useState)(null),[ce,le]=(0,k.useState)(``),[ue,de]=(0,k.useState)(``),[fe,j]=(0,k.useState)(``),[M,he]=(0,k.useState)(``),[N,P]=(0,k.useState)([]),[F,I]=(0,k.useState)(0),[L,R]=(0,k.useState)(!0),[z,B]=(0,k.useState)(!0),[ge,_e]=(0,k.useState)(!1),[V,H]=(0,k.useState)(!1),[U,W]=(0,k.useState)(!1),[G,ve]=(0,k.useState)(!1),[ye,be]=(0,k.useState)(!1),[xe,K]=(0,k.useState)(!1),[Se,Ce]=(0,k.useState)(``),[q,we]=(0,k.useState)(``),[Te,J]=(0,k.useState)(!1),[Y,De]=(0,k.useState)(!1),[X,Me]=(0,k.useState)(null),[Pe,Fe]=(0,k.useState)(``),[Ie,Le]=(0,k.useState)(``),[Re,ze]=(0,k.useState)(!1),[Be,Ve]=(0,k.useState)(!1),[Z,He]=(0,k.useState)(null),[Ue,We]=(0,k.useState)(`Hello B. This is from A.`),[Ge,Ke]=(0,k.useState)(``),[qe,Je]=(0,k.useState)(``),[Ye,Xe]=(0,k.useState)(``),[Ze,Qe]=(0,k.useState)(`Hello A. This is from B.`),[$e,et]=(0,k.useState)(``),[tt,nt]=(0,k.useState)(``),[rt,it]=(0,k.useState)(``),[at,ot]=(0,k.useState)(``),[st,ct]=(0,k.useState)(``),[lt,ut]=(0,k.useState)(``),[dt,ft]=(0,k.useState)(``),[pt,Q]=(0,k.useState)(``),[mt,ht]=(0,k.useState)(!1),[gt,_t]=(0,k.useState)(``),[vt,yt]=(0,k.useState)(``),[bt,xt]=(0,k.useState)(``),[St,Ct]=(0,k.useState)(``),[wt,$]=(0,k.useState)(``),[Tt,Et]=(0,k.useState)(!1);(0,k.useEffect)(()=>{g(Ne());let e=()=>g(Ne());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let Dt=e=>{g(e),window.location.hash=e},Ot=(0,k.useCallback)(async()=>{if(!v.trim())return;K(!0),await new Promise(e=>setTimeout(e,0));let t=s(v.trim(),b),n=`${t.username}#${t.address.slice(-4).toUpperCase()}`;ae(t),i({...t,displayName:n}),r(e(`login.toast.signedIn`,{username:t.username}),`success`),he(l(t.danger));let a=c(t.danger);se(a),le(S(a.private_key,a.ed_public_key));let o=w(a.private_key,a.ed_public_key);de(Ae(o.secretKey)),j(je(o.publicKey)),P([]),I(0),H(!1),W(!1),ve(!1),be(!1),K(!1)},[r,b,i,e,v]);function kt(t,n,i){let a=t.trim();if(!a)return;let o=s(a,n),l=c(o.danger);i({username:o.username,address:o.address,publicKey:l.public_key,privateKey:l.private_key}),Je(``),Xe(``),nt(``),it(``),r(e(`web3.toast.accountGenerated`),`success`)}function At({senderAccount:t,recipientAccount:n,message:r,setCipherText:i,setDecryptedText:a,setError:s}){if(!t||!n){s(e(`web3.error.accountsRequired`));return}if(!r.trim()){s(e(`web3.error.messageRequired`));return}i(o(r,{senderPrivateKey:t.privateKey,recipientPublicKey:n.publicKey})),a(``),s(``)}function jt({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=d(r,{senderPublicKey:t.publicKey,recipientPrivateKey:n.privateKey});if(!o){a(e(`web3.error.decryptFailed`)),i(``);return}i(o),a(``)}function Mt(){if(!at.trim()){Q(e(`web3.error.senderPublicRequired`));return}if(!st.trim()){Q(e(`web3.error.recipientPrivateRequired`));return}if(!lt.trim()){Q(e(`web3.error.cipherRequired`));return}let t=d(lt,{senderPublicKey:at.trim(),recipientPrivateKey:st.trim()});if(!t){Q(e(`web3.error.decryptFailed`)),ft(``);return}ft(t),Q(``)}function Nt(){if(!gt.trim()){$(e(`web3.error.senderPrivateRequired`));return}if(!vt.trim()){$(e(`web3.error.recipientPublicRequired`));return}if(!bt.trim()){$(e(`web3.error.messageRequired`));return}Ct(o(bt,{senderPrivateKey:gt.trim(),recipientPublicKey:vt.trim()})),$(``)}let Pt=()=>{if(!M)return;let e=[];for(let t=F;t<F+10;t++){let n=`m/44'/60'/0'/0/${t}`,r=f.fromPhrase(M,void 0,n);e.push({index:t,address:r.address,privateKey:r.privateKey})}P(t=>[...t,...e]),I(e=>e+10)},Ft=ie(O?.address||void 0),It=a===`wallet`?`web3.view.wallet`:a===`pem`?`web3.view.pem`:a===`EA`?`web3.view.asymmetric`:`web3.view.export`,Lt=[{id:`wallet`,icon:(0,A.jsx)(x,{size:16}),labelKey:`web3.view.wallet`},{id:`pem`,icon:(0,A.jsx)(_,{size:16}),labelKey:`web3.view.pem`},{id:`export`,icon:(0,A.jsx)(ne,{size:16}),labelKey:`web3.view.export`},{id:`EA`,icon:(0,A.jsx)(T,{size:16}),labelKey:`web3.view.asymmetric`}],Rt=a!==`EA`;return(0,A.jsx)(ee,{sidebar:({closeSidebar:t})=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(te,{onNavigate:t}),(0,A.jsx)(`nav`,{className:`sidebar-nav`,children:Lt.map(n=>(0,A.jsxs)(`button`,{onClick:()=>{Dt(n.id),t()},className:`sidebar-nav-btn ${a===n.id?`active`:``}`,children:[n.icon,(0,A.jsx)(`span`,{children:e(n.labelKey)})]},n.id))})]}),headerTitle:(0,A.jsx)(`h2`,{className:`header-title`,children:e(It)}),headerRight:(0,A.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>n(!t),title:e(`common.theme.toggle`),children:t?(0,A.jsx)(m,{size:16}):(0,A.jsx)(h,{size:16})}),children:(0,A.jsx)(`div`,{className:`web3-page`,children:(0,A.jsxs)(`div`,{className:`web3-container ${a===`EA`?`wide`:``}`,children:[Rt&&(0,A.jsx)(ke,{username:v,password:b,showPassword:E,generating:xe,onUsernameChange:y,onPasswordChange:C,onTogglePassword:()=>D(!E),onGenerate:Ot}),a===`wallet`&&(0,A.jsx)(Oe,{walletResult:O,keys:oe,ipns:ce,avatarSrc:Ft,showPrivateKey:ye,onTogglePrivateKey:()=>be(!ye)}),a===`pem`&&(0,A.jsx)(me,{walletResult:O,publicPem:fe,privatePem:ue}),a===`export`&&(0,A.jsx)(Ee,{walletResult:O,mnemonicPhrase:M,deriveBatch:10,deriveList:N,deriveShowIndex:L,deriveShowAddress:z,deriveShowPrivateKey:ge,showAddressQr:V,showMnemonicReveal:U,showMnemonicQr:G,onToggleAddressQr:()=>H(!V),onToggleMnemonicReveal:()=>W(!U),onToggleMnemonicQr:()=>ve(!G),onToggleDeriveIndex:()=>R(!L),onToggleDeriveAddress:()=>B(!z),onToggleDerivePrivateKey:()=>_e(!ge),onDerive:Pt}),a===`EA`&&(0,A.jsx)(pe,{boxAUsername:Se,boxAPassword:q,boxAShowPassword:Te,boxAShowPrivateKey:Y,boxAAccount:X,boxBUsername:Pe,boxBPassword:Ie,boxBShowPassword:Re,boxBShowPrivateKey:Be,boxBAccount:Z,boxABMessage:Ue,boxABCipherText:Ge,boxABDecryptedText:qe,boxABError:Ye,boxBAMessage:Ze,boxBACipherText:$e,boxBADecryptedText:tt,boxBAError:rt,boxEncryptSenderPrivateKey:gt,boxEncryptRecipientPublicKey:vt,boxEncryptMessage:bt,boxEncryptCipherText:St,boxEncryptError:wt,boxEncryptShowPrivateKey:Tt,boxDecryptSenderPublicKey:at,boxDecryptRecipientPrivateKey:st,boxDecryptCipherText:lt,boxDecryptResult:dt,boxDecryptError:pt,boxDecryptShowPrivateKey:mt,onBoxAUsernameChange:Ce,onBoxAPasswordChange:we,onBoxAShowPasswordToggle:()=>J(!Te),onBoxAShowPrivateKeyToggle:()=>De(!Y),onGenerateBoxA:()=>kt(Se,q,Me),onBoxBUsernameChange:Fe,onBoxBPasswordChange:Le,onBoxBShowPasswordToggle:()=>ze(!Re),onBoxBShowPrivateKeyToggle:()=>Ve(!Be),onGenerateBoxB:()=>kt(Pe,Ie,He),onBoxABMessageChange:We,onBoxABCipherTextChange:Ke,onEncryptBoxAB:()=>At({senderAccount:X,recipientAccount:Z,message:Ue,setCipherText:Ke,setDecryptedText:Je,setError:Xe}),onDecryptBoxAB:()=>jt({senderAccount:X,recipientAccount:Z,cipherText:Ge,setDecryptedText:Je,setError:Xe}),onBoxBAMessageChange:Qe,onBoxBACipherTextChange:et,onEncryptBoxBA:()=>At({senderAccount:Z,recipientAccount:X,message:Ze,setCipherText:et,setDecryptedText:nt,setError:it}),onDecryptBoxBA:()=>jt({senderAccount:Z,recipientAccount:X,cipherText:$e,setDecryptedText:nt,setError:it}),onBoxEncryptSenderPrivateKeyChange:_t,onBoxEncryptRecipientPublicKeyChange:yt,onBoxEncryptMessageChange:xt,onBoxEncryptShowPrivateKeyToggle:()=>Et(!Tt),onEncryptOnly:Nt,onBoxDecryptSenderPublicKeyChange:ot,onBoxDecryptRecipientPrivateKeyChange:ct,onBoxDecryptCipherTextChange:ut,onBoxDecryptShowPrivateKeyToggle:()=>ht(!mt),onDecryptOnly:Mt})]})})})}var Fe=i(`/web3/`)({component:Pe});export{Fe as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,T as a,o}from"./ui-BpDGD3IR.js";import{a as s}from"./i18n-NjvOSuV6.js";import{t as c}from"./arrow-right-BU9c_SL4.js";import{i as l}from"./LanguageToggle-CSQtRZ3A.js";import{t as u}from"./download-jEPn2njL.js";import{t as d}from"./external-link-BFaoZeK0.js";import{t as f}from"./hard-drive-Dar_AZEq.js";import{t as p}from"./message-square-Dp09WY1I.js";import{t as m}from"./notebook-pen-C8TlK5sB.js";import{t as h}from"./wallet-T7ONZ3Kg.js";import{M as g,c as _}from"./index-BZ-f0CZd.js";import{t as v}from"./MarketingLayout-CQurMOSD.js";var y=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),b=r(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),x=r(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),S=t(e(),1),C=n(),w=[{id:`app`,titleKey:`portal.feature.app.title`,subtitleKey:`portal.feature.app.subtitle`,icon:(0,C.jsx)(b,{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)(p,{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)(m,{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)(x,{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)(h,{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`}]}];function T(){let e=_(e=>e.hasBackend),t=_(e=>e.openConnectModal),[n,r]=(0,S.useState)(`app`),{t:a}=s(),p=o(),m=w.find(e=>e.id===n)||w[0],h=a(m.titleKey),v=m.steps.filter(e=>!(p&&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:a(`common.brand`)}),(0,C.jsx)(`p`,{className:`portal-hero-subtitle`,children:a(`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:w.map(t=>{let o=n===t.id,s=t.requiresBackend,c=s?e===!0?`connected`:e===!1?`disconnected`:`checking`:`none`,l=a(t.titleKey);return(0,C.jsxs)(`button`,{className:`portal-card ${o?`active`:``}`,onClick:()=>r(t.id),children:[(0,C.jsx)(i,{to:t.path,className:`btn btn-icon portal-card-open-btn`,onClick:e=>e.stopPropagation(),title:a(`portal.openFeature`,{title:l}),children:(0,C.jsx)(y,{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:a(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`}),a(`common.status.checking`)]}),c===`connected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot connected`}),a(`common.status.connected`)]}),c===`disconnected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot disconnected`}),a(`common.status.needsConnection`)]})]}):(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ready`,children:[(0,C.jsx)(`span`,{className:`status-dot ready`}),a(`common.status.ready`)]})]},t.id)})}),(0,C.jsxs)(`div`,{className:`portal-node-actions`,"aria-label":a(`portal.nodeEntry`),children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(g,{size:16}),a(`portal.webConnectNode`)]}),(0,C.jsxs)(i,{to:`/admin/`,className:`btn btn-secondary`,children:[(0,C.jsx)(f,{size:16}),a(`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:a(m.heroKey)}),(0,C.jsx)(`p`,{children:a(m.descKey)})]}),(0,C.jsx)(`div`,{className:`portal-marketing-features`,children:m.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:a(e)})]},e))}),(0,C.jsx)(`div`,{className:`portal-marketing-steps`,children:v.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:a(e.titleKey)}),(0,C.jsx)(`p`,{children:a(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)(i,{to:e.link,children:[a(e.linkTextKey),` `,(0,C.jsx)(d,{size:12})]})})]})]},e.num))}),(0,C.jsxs)(`div`,{className:`portal-actions`,children:[(0,C.jsxs)(i,{to:m.path,className:`btn btn-primary`,children:[a(`portal.enterFeature`,{title:h}),(0,C.jsx)(c,{size:16})]}),m.requiresBackend&&e===!1&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(g,{size:16}),a(`portal.webConnectNode`)]}),!p&&(0,C.jsxs)(i,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(u,{size:16}),a(`nav.downloadClient`)]})]})]})]})})})]})}function E(){return(0,C.jsx)(v,{children:(0,C.jsx)(T,{})})}var D=a(`/`)({component:E});export{D as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,T as a,o}from"./ui-BpDGD3IR.js";import{a as s}from"./i18n-NjvOSuV6.js";import{t as c}from"./arrow-right-BU9c_SL4.js";import{i as l}from"./LanguageToggle-CSQtRZ3A.js";import{t as u}from"./download-jEPn2njL.js";import{t as d}from"./external-link-BFaoZeK0.js";import{t as f}from"./hard-drive-Dar_AZEq.js";import{t as p}from"./message-square-Dp09WY1I.js";import{t as m}from"./notebook-pen-C8TlK5sB.js";import{t as h}from"./wallet-T7ONZ3Kg.js";import{M as g,c as _}from"./index-BI8oNSVC.js";import{t as v}from"./MarketingLayout-Bun1d2wL.js";var y=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),b=r(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),x=r(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),S=t(e(),1),C=n(),w=[{id:`app`,titleKey:`portal.feature.app.title`,subtitleKey:`portal.feature.app.subtitle`,icon:(0,C.jsx)(b,{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)(p,{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)(m,{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)(x,{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)(h,{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`}]}];function T(){let e=_(e=>e.hasBackend),t=_(e=>e.openConnectModal),[n,r]=(0,S.useState)(`app`),{t:a}=s(),p=o(),m=w.find(e=>e.id===n)||w[0],h=a(m.titleKey),v=m.steps.filter(e=>!(p&&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:a(`common.brand`)}),(0,C.jsx)(`p`,{className:`portal-hero-subtitle`,children:a(`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:w.map(t=>{let o=n===t.id,s=t.requiresBackend,c=s?e===!0?`connected`:e===!1?`disconnected`:`checking`:`none`,l=a(t.titleKey);return(0,C.jsxs)(`button`,{className:`portal-card ${o?`active`:``}`,onClick:()=>r(t.id),children:[(0,C.jsx)(i,{to:t.path,className:`btn btn-icon portal-card-open-btn`,onClick:e=>e.stopPropagation(),title:a(`portal.openFeature`,{title:l}),children:(0,C.jsx)(y,{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:a(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`}),a(`common.status.checking`)]}),c===`connected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot connected`}),a(`common.status.connected`)]}),c===`disconnected`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`status-dot disconnected`}),a(`common.status.needsConnection`)]})]}):(0,C.jsxs)(`div`,{className:`ui-badge portal-card-status ready`,children:[(0,C.jsx)(`span`,{className:`status-dot ready`}),a(`common.status.ready`)]})]},t.id)})}),(0,C.jsxs)(`div`,{className:`portal-node-actions`,"aria-label":a(`portal.nodeEntry`),children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(g,{size:16}),a(`portal.webConnectNode`)]}),(0,C.jsxs)(i,{to:`/admin/`,className:`btn btn-secondary`,children:[(0,C.jsx)(f,{size:16}),a(`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:a(m.heroKey)}),(0,C.jsx)(`p`,{children:a(m.descKey)})]}),(0,C.jsx)(`div`,{className:`portal-marketing-features`,children:m.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:a(e)})]},e))}),(0,C.jsx)(`div`,{className:`portal-marketing-steps`,children:v.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:a(e.titleKey)}),(0,C.jsx)(`p`,{children:a(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)(i,{to:e.link,children:[a(e.linkTextKey),` `,(0,C.jsx)(d,{size:12})]})})]})]},e.num))}),(0,C.jsxs)(`div`,{className:`portal-actions`,children:[(0,C.jsxs)(i,{to:m.path,className:`btn btn-primary`,children:[a(`portal.enterFeature`,{title:h}),(0,C.jsx)(c,{size:16})]}),m.requiresBackend&&e===!1&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{onClick:t,className:`btn btn-secondary`,children:[(0,C.jsx)(g,{size:16}),a(`portal.webConnectNode`)]}),!p&&(0,C.jsxs)(i,{to:`/download/`,className:`btn btn-secondary`,children:[(0,C.jsx)(u,{size:16}),a(`nav.downloadClient`)]})]})]})]})})})]})}function E(){return(0,C.jsx)(v,{children:(0,C.jsx)(T,{})})}var D=a(`/`)({component:E});export{D as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,T as a,l as o,r as s,s as c}from"./ui-BpDGD3IR.js";import{a as l}from"./i18n-NjvOSuV6.js";import{i as u}from"./LanguageToggle-CSQtRZ3A.js";import{t as ee}from"./download-jEPn2njL.js";import{t as d}from"./external-link-BFaoZeK0.js";import{a as f,i as p,n as m,r as h}from"./mp-B6kdA94c.js";import{t as g}from"./key-round-DNcpSuMw.js";import{t as _}from"./loader-BXQtdens.js";import{t as v}from"./save-BjrbPwhJ.js";import{t as te}from"./shield-check-DzDuWO8r.js";import{t as ne}from"./upload-CoCptKya.js";import{a as y,c as b,f as x,i as S,l as C,n as w,o as T,r as E,s as D}from"./index-BZ-f0CZd.js";import{t as O}from"./MarketingHeader-CrYsQsQ5.js";import{t as k}from"./MarketingLayout-CQurMOSD.js";var re=r(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),ie=r(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),ae=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),oe=r(`wallet-cards`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2`,key:`4125el`}],[`path`,{d:`M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21`,key:`1dpki6`}]]),A=t(e(),1),j=n(),se=[{value:``,labelKey:`profile.avatar.address`},...E.map(e=>({value:y(e),labelKey:`profile.avatar.${e}`}))];function ce(e){if(T(e))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function M(){let{t:e}=l(),t=b(e=>e.addToast),n=b(e=>e.hasBackend),r=c(e=>e.identity),a=c(e=>e.openLoginModal),y=c(e=>e.setUserIdentity),T=c(e=>e.logoutUser),E=w(),[M,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(``),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(null),[H,U]=(0,A.useState)(!1),W=(0,j.jsx)(O,{});(0,A.useEffect)(()=>{if(!r){F(``),L(``),z(``);return}F(r.displayName||r.username),L(D(r.avatar)||r.avatar||``),z(``)},[r]);let G=(0,A.useMemo)(()=>r?o(r.danger):null,[r]),le=(0,A.useMemo)(()=>G?m(G.private_key,G.ed_public_key):``,[G]);if(!r)return(0,j.jsx)(k,{header:W,children:(0,j.jsx)(`section`,{className:`profile-page`,children:(0,j.jsx)(`div`,{className:`profile-container narrow`,children:(0,j.jsxs)(`div`,{className:`profile-empty glass`,children:[(0,j.jsx)(`div`,{className:`profile-empty-icon`,children:(0,j.jsx)(p,{size:34})}),(0,j.jsx)(`h1`,{children:e(`profile.signedOut.title`)}),(0,j.jsx)(`p`,{children:e(`profile.signedOut.desc`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:a,children:[(0,j.jsx)(p,{size:16}),e(`account.signIn`)]})]})})})});let ue=D(r.avatar)||r.avatar||``,de=S(r.address,r.avatar),K=r.address.toLowerCase(),fe=I.trim().length>0;async function q(r){if(n===!0)try{await C.put(`/api/user/profile`,{json:{displayName:r.displayName||r.username,avatar:r.avatar||``,updatedAt:r.profileUpdatedAt||Date.now()}}).json()}catch(n){t(await x(n,e(`profile.backup.error.profileSaveFailed`)),`error`)}}function J(n){if(!r)return;let i={...r,avatar:n||void 0,profileUpdatedAt:Date.now()};y(i),q(i),z(``),t(e(`profile.toast.avatarUpdated`),`success`)}function pe(){if(!r)return;let n=M.trim()||r.username,i={...r,displayName:n,profileUpdatedAt:Date.now()};y(i),q(i),F(n),t(e(`profile.toast.saved`),`success`)}function me(){let t=I.trim();if(!t){J(void 0);return}if(!ce(t)){z(e(`nav.avatarUrlInvalid`));return}J(t)}function he(){T(),U(!1)}function ge(){V({title:e(`profile.backup.confirm.backupTitle`),message:e(`profile.backup.confirm.backupMessage`),confirmText:e(`profile.backup.action.cloudBackup`),onConfirm:async()=>{V(null),await E.backupToCloud()}})}function _e(){V({title:e(`profile.backup.confirm.restoreTitle`),message:e(`profile.backup.confirm.restoreMessage`),confirmText:e(`profile.backup.action.cloudRestore`),onConfirm:async()=>{V(null),await E.restoreFromCloud({confirm:!1})}})}function Y(){return new Promise(t=>{let n=e=>{V(null),t(e)};V({title:e(`profile.backup.confirm.importTitle`),message:e(`profile.backup.confirm.restore`),confirmText:e(`profile.backup.action.importLocal`),onConfirm:()=>n(!0),onClose:()=>n(!1)})})}function ve(){E.importLocalBackup({requestConfirm:Y})}let X=E.action===`backup`,Z=E.action===`restore`,Q=E.action===`export`,$=E.action===`import`;return(0,j.jsxs)(k,{header:W,children:[(0,j.jsx)(`section`,{className:`profile-page`,children:(0,j.jsxs)(`div`,{className:`profile-container`,children:[(0,j.jsxs)(`section`,{className:`profile-panel profile-backup-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.backup`)}),(0,j.jsx)(`p`,{children:e(`profile.section.backup.desc`)})]})}),(0,j.jsxs)(`div`,{className:`profile-backup-actions`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${Q?`btn-loading`:``}`,onClick:E.exportLocalBackup,disabled:E.busy,children:[Q?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ee,{size:16}),e(Q?`profile.backup.status.exporting`:`profile.backup.action.exportLocal`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${$?`btn-loading`:``}`,onClick:ve,disabled:E.busy,children:[$?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ne,{size:16}),e($?`profile.backup.status.importing`:`profile.backup.action.importLocal`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary ${X?`btn-loading`:``}`,onClick:ge,disabled:E.busy,children:[X?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ie,{size:16}),e(X?`profile.backup.status.backingUp`:`profile.backup.action.cloudBackup`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${Z?`btn-loading`:``}`,onClick:_e,disabled:E.busy,children:[Z?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(re,{size:16}),e(Z?`profile.backup.status.restoring`:`profile.backup.action.cloudRestore`)]})]})]}),(0,j.jsxs)(`header`,{className:`profile-header`,children:[(0,j.jsx)(`img`,{className:`profile-avatar-large`,src:de,alt:``}),(0,j.jsxs)(`div`,{className:`profile-heading`,children:[(0,j.jsx)(`p`,{className:`profile-kicker`,children:e(`profile.kicker`)}),(0,j.jsx)(`h1`,{children:r.displayName||r.username}),(0,j.jsxs)(`div`,{className:`profile-address-line`,children:[(0,j.jsx)(`code`,{translate:`no`,children:K}),(0,j.jsx)(h,{text:K}),(0,j.jsxs)(`a`,{href:`https://debank.com/profile/${r.address}`,target:`_blank`,rel:`noopener noreferrer`,className:`btn btn-secondary btn-sm`,children:[(0,j.jsx)(d,{size:14}),e(`web3.action.view`)]})]})]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary profile-logout-btn`,onClick:()=>U(!0),children:[(0,j.jsx)(ae,{size:16}),e(`account.logout`)]})]}),(0,j.jsxs)(`div`,{className:`profile-grid`,children:[(0,j.jsxs)(`section`,{className:`profile-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.account`)}),(0,j.jsx)(`p`,{children:e(`profile.section.account.desc`)})]})}),(0,j.jsxs)(`label`,{className:`profile-field`,children:[(0,j.jsx)(`span`,{children:e(`profile.label.displayName`)}),(0,j.jsxs)(`div`,{className:`profile-field-row`,children:[(0,j.jsx)(`input`,{className:`input`,value:M,onChange:e=>F(e.target.value),placeholder:e(`nav.displayNamePlaceholder`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:pe,children:[(0,j.jsx)(v,{size:16}),e(`profile.action.save`)]})]})]}),(0,j.jsxs)(`div`,{className:`profile-facts`,children:[(0,j.jsx)(N,{label:e(`profile.label.username`),value:r.username}),(0,j.jsx)(N,{label:e(`web3.label.address`),value:r.address,copy:!0})]})]}),(0,j.jsxs)(`section`,{className:`profile-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.avatar`)}),(0,j.jsx)(`p`,{children:e(`profile.section.avatar.desc`)})]})}),(0,j.jsx)(`div`,{className:`profile-avatar-grid`,role:`list`,children:se.map(t=>{let n=ue===t.value;return(0,j.jsxs)(`button`,{type:`button`,className:[`profile-avatar-option`,n?`selected`:``].filter(Boolean).join(` `),onClick:()=>J(t.value),"aria-pressed":n,title:e(t.labelKey),children:[(0,j.jsx)(`img`,{src:S(r.address,t.value),alt:``,"aria-hidden":`true`}),(0,j.jsx)(`span`,{children:e(t.labelKey)}),n&&(0,j.jsx)(`span`,{className:`profile-avatar-check`,children:(0,j.jsx)(u,{size:14})})]},t.value||`address`)})}),(0,j.jsxs)(`div`,{className:`profile-avatar-url`,children:[(0,j.jsxs)(`label`,{className:`profile-field`,htmlFor:`profile-avatar-url`,children:[(0,j.jsx)(`span`,{children:e(`profile.label.customAvatar`)}),(0,j.jsxs)(`div`,{className:`profile-field-row`,children:[(0,j.jsx)(`input`,{id:`profile-avatar-url`,className:`input`,value:I,onChange:e=>{L(e.target.value),z(``)},placeholder:e(`nav.avatarUrlPlaceholder`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:me,disabled:!fe,children:[(0,j.jsx)(v,{size:16}),e(`profile.action.save`)]})]})]}),R&&(0,j.jsx)(`p`,{className:`profile-error`,children:R})]})]})]}),(0,j.jsxs)(`section`,{className:`profile-panel profile-identity-panel`,children:[(0,j.jsxs)(`div`,{className:`profile-panel-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.identity`)}),(0,j.jsx)(`p`,{children:e(`profile.section.identity.desc`)})]}),(0,j.jsxs)(i,{to:`/web3/`,hash:`wallet`,className:`btn btn-secondary`,children:[(0,j.jsx)(oe,{size:16}),e(`profile.action.openWallet`)]})]}),(0,j.jsxs)(`div`,{className:`profile-key-grid`,children:[G&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(P,{title:e(`web3.label.ed25519Public`),icon:(0,j.jsx)(f,{size:18}),value:G.ed_public_key}),(0,j.jsx)(P,{title:e(`web3.label.x25519Public`),icon:(0,j.jsx)(g,{size:18}),value:G.public_key})]}),(0,j.jsx)(P,{title:`IPNS ID`,icon:(0,j.jsx)(te,{size:18}),value:le||`-`})]})]})]})}),H&&(0,j.jsx)(s,{title:e(`account.logoutTitle`),message:e(`account.logoutConfirm`),confirmText:e(`account.logout`),danger:!0,onConfirm:he,onClose:()=>U(!1)}),B&&(0,j.jsx)(s,{title:B.title,message:B.message,confirmText:B.confirmText,danger:B.danger,onConfirm:B.onConfirm,onClose:B.onClose||(()=>V(null))})]})}function N({label:e,value:t,copy:n=!1}){return(0,j.jsxs)(`div`,{className:`profile-fact`,children:[(0,j.jsx)(`span`,{children:e}),(0,j.jsxs)(`div`,{className:`profile-fact-value`,children:[(0,j.jsx)(`code`,{translate:`no`,children:t}),n&&(0,j.jsx)(h,{text:t})]})]})}function P({title:e,icon:t,value:n}){return(0,j.jsxs)(`div`,{className:`profile-key-card`,children:[(0,j.jsxs)(`div`,{className:`profile-key-card-header`,children:[(0,j.jsx)(`span`,{className:`profile-key-card-icon`,children:t}),(0,j.jsx)(`span`,{children:e})]}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,j.jsx)(h,{text:n})]})]})}var F=a(`/profile/`)({component:M});export{F as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,T as a,l as o,r as s,s as c}from"./ui-BpDGD3IR.js";import{a as l}from"./i18n-NjvOSuV6.js";import{i as u}from"./LanguageToggle-CSQtRZ3A.js";import{t as ee}from"./download-jEPn2njL.js";import{t as d}from"./external-link-BFaoZeK0.js";import{a as f,i as p,n as m,r as h}from"./mp-B6kdA94c.js";import{t as g}from"./key-round-DNcpSuMw.js";import{t as _}from"./loader-BXQtdens.js";import{t as v}from"./save-BjrbPwhJ.js";import{t as te}from"./shield-check-DzDuWO8r.js";import{t as ne}from"./upload-CoCptKya.js";import{a as y,c as b,f as x,i as S,l as C,n as w,o as T,r as E,s as D}from"./index-BI8oNSVC.js";import{t as O}from"./MarketingHeader-ceWdRCpe.js";import{t as k}from"./MarketingLayout-Bun1d2wL.js";var re=r(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),ie=r(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),ae=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),oe=r(`wallet-cards`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2`,key:`4125el`}],[`path`,{d:`M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21`,key:`1dpki6`}]]),A=t(e(),1),j=n(),se=[{value:``,labelKey:`profile.avatar.address`},...E.map(e=>({value:y(e),labelKey:`profile.avatar.${e}`}))];function ce(e){if(T(e))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function M(){let{t:e}=l(),t=b(e=>e.addToast),n=b(e=>e.hasBackend),r=c(e=>e.identity),a=c(e=>e.openLoginModal),y=c(e=>e.setUserIdentity),T=c(e=>e.logoutUser),E=w(),[M,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(``),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(null),[H,U]=(0,A.useState)(!1),W=(0,j.jsx)(O,{});(0,A.useEffect)(()=>{if(!r){F(``),L(``),z(``);return}F(r.displayName||r.username),L(D(r.avatar)||r.avatar||``),z(``)},[r]);let G=(0,A.useMemo)(()=>r?o(r.danger):null,[r]),le=(0,A.useMemo)(()=>G?m(G.private_key,G.ed_public_key):``,[G]);if(!r)return(0,j.jsx)(k,{header:W,children:(0,j.jsx)(`section`,{className:`profile-page`,children:(0,j.jsx)(`div`,{className:`profile-container narrow`,children:(0,j.jsxs)(`div`,{className:`profile-empty glass`,children:[(0,j.jsx)(`div`,{className:`profile-empty-icon`,children:(0,j.jsx)(p,{size:34})}),(0,j.jsx)(`h1`,{children:e(`profile.signedOut.title`)}),(0,j.jsx)(`p`,{children:e(`profile.signedOut.desc`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:a,children:[(0,j.jsx)(p,{size:16}),e(`account.signIn`)]})]})})})});let ue=D(r.avatar)||r.avatar||``,de=S(r.address,r.avatar),K=r.address.toLowerCase(),fe=I.trim().length>0;async function q(r){if(n===!0)try{await C.put(`/api/user/profile`,{json:{displayName:r.displayName||r.username,avatar:r.avatar||``,updatedAt:r.profileUpdatedAt||Date.now()}}).json()}catch(n){t(await x(n,e(`profile.backup.error.profileSaveFailed`)),`error`)}}function J(n){if(!r)return;let i={...r,avatar:n||void 0,profileUpdatedAt:Date.now()};y(i),q(i),z(``),t(e(`profile.toast.avatarUpdated`),`success`)}function pe(){if(!r)return;let n=M.trim()||r.username,i={...r,displayName:n,profileUpdatedAt:Date.now()};y(i),q(i),F(n),t(e(`profile.toast.saved`),`success`)}function me(){let t=I.trim();if(!t){J(void 0);return}if(!ce(t)){z(e(`nav.avatarUrlInvalid`));return}J(t)}function he(){T(),U(!1)}function ge(){V({title:e(`profile.backup.confirm.backupTitle`),message:e(`profile.backup.confirm.backupMessage`),confirmText:e(`profile.backup.action.cloudBackup`),onConfirm:async()=>{V(null),await E.backupToCloud()}})}function _e(){V({title:e(`profile.backup.confirm.restoreTitle`),message:e(`profile.backup.confirm.restoreMessage`),confirmText:e(`profile.backup.action.cloudRestore`),onConfirm:async()=>{V(null),await E.restoreFromCloud({confirm:!1})}})}function Y(){return new Promise(t=>{let n=e=>{V(null),t(e)};V({title:e(`profile.backup.confirm.importTitle`),message:e(`profile.backup.confirm.restore`),confirmText:e(`profile.backup.action.importLocal`),onConfirm:()=>n(!0),onClose:()=>n(!1)})})}function ve(){E.importLocalBackup({requestConfirm:Y})}let X=E.action===`backup`,Z=E.action===`restore`,Q=E.action===`export`,$=E.action===`import`;return(0,j.jsxs)(k,{header:W,children:[(0,j.jsx)(`section`,{className:`profile-page`,children:(0,j.jsxs)(`div`,{className:`profile-container`,children:[(0,j.jsxs)(`section`,{className:`profile-panel profile-backup-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.backup`)}),(0,j.jsx)(`p`,{children:e(`profile.section.backup.desc`)})]})}),(0,j.jsxs)(`div`,{className:`profile-backup-actions`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${Q?`btn-loading`:``}`,onClick:E.exportLocalBackup,disabled:E.busy,children:[Q?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ee,{size:16}),e(Q?`profile.backup.status.exporting`:`profile.backup.action.exportLocal`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${$?`btn-loading`:``}`,onClick:ve,disabled:E.busy,children:[$?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ne,{size:16}),e($?`profile.backup.status.importing`:`profile.backup.action.importLocal`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary ${X?`btn-loading`:``}`,onClick:ge,disabled:E.busy,children:[X?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(ie,{size:16}),e(X?`profile.backup.status.backingUp`:`profile.backup.action.cloudBackup`)]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary ${Z?`btn-loading`:``}`,onClick:_e,disabled:E.busy,children:[Z?(0,j.jsx)(_,{size:16,className:`ui-spinner`}):(0,j.jsx)(re,{size:16}),e(Z?`profile.backup.status.restoring`:`profile.backup.action.cloudRestore`)]})]})]}),(0,j.jsxs)(`header`,{className:`profile-header`,children:[(0,j.jsx)(`img`,{className:`profile-avatar-large`,src:de,alt:``}),(0,j.jsxs)(`div`,{className:`profile-heading`,children:[(0,j.jsx)(`p`,{className:`profile-kicker`,children:e(`profile.kicker`)}),(0,j.jsx)(`h1`,{children:r.displayName||r.username}),(0,j.jsxs)(`div`,{className:`profile-address-line`,children:[(0,j.jsx)(`code`,{translate:`no`,children:K}),(0,j.jsx)(h,{text:K}),(0,j.jsxs)(`a`,{href:`https://debank.com/profile/${r.address}`,target:`_blank`,rel:`noopener noreferrer`,className:`btn btn-secondary btn-sm`,children:[(0,j.jsx)(d,{size:14}),e(`web3.action.view`)]})]})]}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary profile-logout-btn`,onClick:()=>U(!0),children:[(0,j.jsx)(ae,{size:16}),e(`account.logout`)]})]}),(0,j.jsxs)(`div`,{className:`profile-grid`,children:[(0,j.jsxs)(`section`,{className:`profile-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.account`)}),(0,j.jsx)(`p`,{children:e(`profile.section.account.desc`)})]})}),(0,j.jsxs)(`label`,{className:`profile-field`,children:[(0,j.jsx)(`span`,{children:e(`profile.label.displayName`)}),(0,j.jsxs)(`div`,{className:`profile-field-row`,children:[(0,j.jsx)(`input`,{className:`input`,value:M,onChange:e=>F(e.target.value),placeholder:e(`nav.displayNamePlaceholder`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:pe,children:[(0,j.jsx)(v,{size:16}),e(`profile.action.save`)]})]})]}),(0,j.jsxs)(`div`,{className:`profile-facts`,children:[(0,j.jsx)(N,{label:e(`profile.label.username`),value:r.username}),(0,j.jsx)(N,{label:e(`web3.label.address`),value:r.address,copy:!0})]})]}),(0,j.jsxs)(`section`,{className:`profile-panel`,children:[(0,j.jsx)(`div`,{className:`profile-panel-header`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.avatar`)}),(0,j.jsx)(`p`,{children:e(`profile.section.avatar.desc`)})]})}),(0,j.jsx)(`div`,{className:`profile-avatar-grid`,role:`list`,children:se.map(t=>{let n=ue===t.value;return(0,j.jsxs)(`button`,{type:`button`,className:[`profile-avatar-option`,n?`selected`:``].filter(Boolean).join(` `),onClick:()=>J(t.value),"aria-pressed":n,title:e(t.labelKey),children:[(0,j.jsx)(`img`,{src:S(r.address,t.value),alt:``,"aria-hidden":`true`}),(0,j.jsx)(`span`,{children:e(t.labelKey)}),n&&(0,j.jsx)(`span`,{className:`profile-avatar-check`,children:(0,j.jsx)(u,{size:14})})]},t.value||`address`)})}),(0,j.jsxs)(`div`,{className:`profile-avatar-url`,children:[(0,j.jsxs)(`label`,{className:`profile-field`,htmlFor:`profile-avatar-url`,children:[(0,j.jsx)(`span`,{children:e(`profile.label.customAvatar`)}),(0,j.jsxs)(`div`,{className:`profile-field-row`,children:[(0,j.jsx)(`input`,{id:`profile-avatar-url`,className:`input`,value:I,onChange:e=>{L(e.target.value),z(``)},placeholder:e(`nav.avatarUrlPlaceholder`)}),(0,j.jsxs)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:me,disabled:!fe,children:[(0,j.jsx)(v,{size:16}),e(`profile.action.save`)]})]})]}),R&&(0,j.jsx)(`p`,{className:`profile-error`,children:R})]})]})]}),(0,j.jsxs)(`section`,{className:`profile-panel profile-identity-panel`,children:[(0,j.jsxs)(`div`,{className:`profile-panel-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:e(`profile.section.identity`)}),(0,j.jsx)(`p`,{children:e(`profile.section.identity.desc`)})]}),(0,j.jsxs)(i,{to:`/web3/`,hash:`wallet`,className:`btn btn-secondary`,children:[(0,j.jsx)(oe,{size:16}),e(`profile.action.openWallet`)]})]}),(0,j.jsxs)(`div`,{className:`profile-key-grid`,children:[G&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(P,{title:e(`web3.label.ed25519Public`),icon:(0,j.jsx)(f,{size:18}),value:G.ed_public_key}),(0,j.jsx)(P,{title:e(`web3.label.x25519Public`),icon:(0,j.jsx)(g,{size:18}),value:G.public_key})]}),(0,j.jsx)(P,{title:`IPNS ID`,icon:(0,j.jsx)(te,{size:18}),value:le||`-`})]})]})]})}),H&&(0,j.jsx)(s,{title:e(`account.logoutTitle`),message:e(`account.logoutConfirm`),confirmText:e(`account.logout`),danger:!0,onConfirm:he,onClose:()=>U(!1)}),B&&(0,j.jsx)(s,{title:B.title,message:B.message,confirmText:B.confirmText,danger:B.danger,onConfirm:B.onConfirm,onClose:B.onClose||(()=>V(null))})]})}function N({label:e,value:t,copy:n=!1}){return(0,j.jsxs)(`div`,{className:`profile-fact`,children:[(0,j.jsx)(`span`,{children:e}),(0,j.jsxs)(`div`,{className:`profile-fact-value`,children:[(0,j.jsx)(`code`,{translate:`no`,children:t}),n&&(0,j.jsx)(h,{text:t})]})]})}function P({title:e,icon:t,value:n}){return(0,j.jsxs)(`div`,{className:`profile-key-card`,children:[(0,j.jsxs)(`div`,{className:`profile-key-card-header`,children:[(0,j.jsx)(`span`,{className:`profile-key-card-icon`,children:t}),(0,j.jsx)(`span`,{children:e})]}),(0,j.jsxs)(`div`,{className:`mono-row`,children:[(0,j.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,j.jsx)(h,{text:n})]})]})}var F=a(`/profile/`)({component:M});export{F as Route};
@@ -1 +1 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,O as a,T as o,s}from"./ui-BpDGD3IR.js";import{a as ee}from"./i18n-NjvOSuV6.js";import{t as c}from"./download-jEPn2njL.js";import{t as l}from"./external-link-BFaoZeK0.js";import{t as te}from"./file-text-DPA1riJ_.js";import{t as u}from"./hard-drive-Dar_AZEq.js";import{n as ne,t as d}from"./triangle-alert-DGWc8ZHu.js";import{F as f,L as p,c as m,f as re,g as ie}from"./index-BZ-f0CZd.js";import{t as ae}from"./MarketingHeader-CrYsQsQ5.js";import{t as h}from"./format-CR8oUWq6.js";import{i as g,n as _,r as oe,t as se}from"./downloadValidation-DbVOwdmC.js";var ce=r(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),v=r(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),y=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),b=r(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),x=t(e(),1),S=n(),C=1800;function w(e,t){return`most://${e}${t||``}`}function T(e,t){let n=e.trim().replace(/[\\/]+$/,``);return n?`${n}${n.includes(`\\`)?`\\`:`/`}downloads`:t}function E(e,t){let n=e[t];return typeof n==`string`?n:void 0}function D(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function le(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t,r=E(n,`event`),i=n.data;if(!r||!i||typeof i!=`object`)return null;let a=i;return{event:r,payload:{taskId:E(a,`taskId`),percent:D(a,`percent`),loaded:D(a,`loaded`),total:D(a,`total`),file:E(a,`file`),fileName:E(a,`fileName`),error:E(a,`error`)}}}function O(){let{t:e}=ee(),{cid:t}=a({from:`/cid/$cid/`}),n=p({select:e=>e.searchStr}),r=m(e=>e.hasBackend),o=m(e=>e.addToast),f=m(e=>e.openConnectModal),E=s(e=>e.identity),D=s(e=>e.openLoginModal),O=(0,x.useMemo)(()=>w(t,n),[t,n]),k=(0,x.useMemo)(()=>g(O),[O]),A=(0,x.useMemo)(()=>se(O,e),[O,e]),fe=k.fileName||t,[j,M]=(0,x.useState)({status:`idle`,message:``}),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)({status:`idle`,message:``}),[L,R]=(0,x.useState)(``),[z,B]=(0,x.useState)(0),[V,H]=(0,x.useState)(null),[U,W]=(0,x.useState)(null),[pe,G]=(0,x.useState)(``),[me,K]=(0,x.useState)(!1),q=(0,x.useRef)(0),J=(0,x.useRef)(null),Y=N?.fileName||fe,X=N?.size??U,Z=j.status===`available`||j.status===`already-local`,Q=F.status===`starting`||F.status===`downloading`,he=T(pe,e(`cid.saveToFallback`)),$=(0,x.useCallback)(async()=>{let t=q.current+1;if(q.current=t,R(``),B(0),H(null),W(null),I({status:`idle`,message:``}),A){P(null),M({status:`error`,message:A});return}if(r===null){P(null),M({status:`waiting-backend`,message:e(`cid.status.waitingBackend`)});return}if(r!==!0){P(null),M({status:`backend-missing`,message:e(`cid.status.backendMissing`)});return}if(!E){P(null),M({status:`login-required`,message:e(`cid.status.loginRequired`)});return}M({status:`checking`,message:e(`cid.status.checking`)}),P(null);try{let n=await _.checkDownload(O);if(q.current!==t)return;P(n),M({status:n.alreadyExists?`already-local`:`available`,message:n.alreadyExists?e(`cid.status.alreadyLocal`,{fileName:n.fileName}):e(`cid.status.available`,{fileName:n.fileName})})}catch(e){if(q.current!==t)return;M({status:`error`,message:await oe(e)}),P(null)}},[r,O,e,E,A]);(0,x.useEffect)(()=>{document.title=e(`cid.meta.title`)},[e]),(0,x.useEffect)(()=>{let e=()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},t=()=>{document.visibilityState===`hidden`&&(e(),K(!1))};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,t),()=>{e(),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,t)}},[]),(0,x.useEffect)(()=>{$()},[$]),(0,x.useEffect)(()=>{if(r!==!0)return;let e=!1;return _.getDataPath().then(t=>{e||G(t.dataPath)}).catch(()=>{e||G(``)}),()=>{e=!0}},[r]),(0,x.useEffect)(()=>{if(!L||!E)return;let t=null,n=!1;return(async()=>{if(t=new WebSocket(await ie(`/ws`)),n){t.close();return}t.onmessage=t=>{let n=le(t.data);!n||n.payload.taskId!==L||(n.event===`download:progress`&&(B(n.payload.percent||0),H(n.payload.loaded??null),W(n.payload.total??null)),n.event===`download:status`&&I({status:`downloading`,message:n.payload.file?e(`cid.status.downloadingFile`,{fileName:n.payload.file}):e(`cid.status.downloading`)}),n.event===`download:success`&&(B(100),I({status:`completed`,message:e(`cid.status.downloadComplete`,{fileName:n.payload.fileName||Y})}),o(e(`cid.toast.downloadComplete`),`success`)),n.event===`download:error`&&(I({status:`error`,message:n.payload.error||e(`cid.status.downloadFailed`,{error:``})}),o(e(`cid.toast.downloadFailed`,{error:n.payload.error||e(`cid.errorFallback`)}),`error`)),n.event===`download:cancelled`&&(I({status:`cancelled`,message:e(`cid.status.cancelled`)}),o(e(`cid.toast.cancelled`),`warning`)))}})(),()=>{n=!0,t?.close()}},[o,Y,e,L,E]);let ge=async()=>{if(!E){D();return}if(r!==!0){f();return}if(!(!Z||Q)){I({status:`starting`,message:e(`cid.status.startingDownload`)}),B(0);try{let t=await _.downloadFile(O);if(t.alreadyExists){I({status:`completed`,message:e(`cid.status.alreadyLocal`,{fileName:t.fileName||Y})}),o(e(`cid.toast.alreadyLocal`),`warning`);return}t.taskId&&(R(t.taskId),I({status:`downloading`,message:e(`cid.status.downloading`)}),o(e(`cid.toast.downloadStarted`),`info`))}catch(t){let n=await re(t,e(`cid.status.downloadFailed`,{error:e(`cid.errorFallback`)}));I({status:`error`,message:n}),o(n,`error`)}}},_e=()=>{K(!1),J.current!==null&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{J.current=null,document.visibilityState!==`hidden`&&K(!0)},C)},ve=async()=>{L&&await _.cancelDownload(L).catch(()=>{})},ye=ue(j.status,F.status);return(0,S.jsxs)(`div`,{className:`cid-layout`,children:[(0,S.jsx)(ae,{}),(0,S.jsx)(`main`,{className:`cid-page`,children:(0,S.jsxs)(`section`,{className:`cid-shell`,children:[(0,S.jsxs)(`div`,{className:`cid-heading`,children:[(0,S.jsx)(`span`,{className:`cid-kicker`,children:e(`cid.kicker`)}),(0,S.jsx)(`h1`,{children:e(`cid.title`)}),(0,S.jsx)(`p`,{children:e(`cid.subtitle`)})]}),(0,S.jsxs)(`div`,{className:`cid-panel`,children:[(0,S.jsxs)(`div`,{className:`cid-handoff`,"aria-label":e(`cid.handoff.title`),children:[(0,S.jsxs)(`div`,{className:`cid-handoff-copy`,children:[(0,S.jsx)(`p`,{className:`cid-handoff-title`,children:e(`cid.handoff.title`)}),(0,S.jsx)(`p`,{children:e(`cid.handoff.desc`)})]}),(0,S.jsxs)(`a`,{className:`btn btn-primary`,href:O,onClick:_e,children:[(0,S.jsx)(l,{size:16}),e(`cid.handoff.action`)]})]}),me&&(0,S.jsxs)(`div`,{className:`cid-handoff-fallback`,role:`status`,children:[(0,S.jsx)(d,{size:18}),(0,S.jsx)(`p`,{children:e(`cid.handoff.fallback`)}),(0,S.jsxs)(i,{to:`/download/`,className:`btn btn-secondary`,children:[(0,S.jsx)(c,{size:16}),e(`cid.handoff.downloadAction`)]})]}),(0,S.jsxs)(`div`,{className:`cid-status`,children:[(0,S.jsx)(`span`,{className:`cid-status-icon ${j.status}`,children:ye}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`cid-status-label`,children:de(j.status,e)}),(0,S.jsx)(`p`,{className:`cid-status-message`,children:j.message})]})]}),(0,S.jsxs)(`dl`,{className:`cid-details`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`dt`,{children:[(0,S.jsx)(te,{size:16}),e(`cid.fileNameLabel`)]}),(0,S.jsx)(`dd`,{children:Y})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{children:e(`cid.cidLabel`)}),(0,S.jsx)(`dd`,{className:`cid-mono`,children:t})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{children:e(`cid.sizeLabel`)}),(0,S.jsx)(`dd`,{children:X?h(X):e(`cid.unknownSize`)})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`dt`,{children:[(0,S.jsx)(u,{size:16}),e(`cid.saveToLabel`)]}),(0,S.jsx)(`dd`,{children:he})]})]}),F.status!==`idle`&&(0,S.jsxs)(`div`,{className:`cid-download-state ${F.status}`,children:[(0,S.jsx)(`p`,{children:F.message}),(F.status===`starting`||F.status===`downloading`)&&(0,S.jsxs)(`div`,{className:`cid-progress`,children:[(0,S.jsx)(`progress`,{className:`cid-progress-bar`,value:z,max:100}),(0,S.jsx)(`span`,{children:V!==null&&U!==null?`${h(V)} / ${h(U)}`:`${z}%`})]})]}),(0,S.jsxs)(`div`,{className:`cid-actions`,children:[j.status===`login-required`&&(0,S.jsxs)(`button`,{className:`btn btn-primary`,onClick:D,children:[(0,S.jsx)(y,{size:16}),e(`cid.loginAction`)]}),j.status===`backend-missing`&&(0,S.jsxs)(`button`,{className:`btn btn-primary`,onClick:f,children:[(0,S.jsx)(b,{size:16}),e(`cid.connectAction`)]}),(0,S.jsxs)(`button`,{className:`btn btn-primary`,disabled:!Z||Q,onClick:ge,children:[Q?(0,S.jsx)(v,{className:`cid-spin-icon`,size:16}):(0,S.jsx)(c,{size:16}),e(Q?`cid.downloadingAction`:`cid.startAction`)]}),L&&F.status===`downloading`&&(0,S.jsxs)(`button`,{className:`btn btn-secondary`,onClick:ve,children:[(0,S.jsx)(ce,{size:16}),e(`cid.cancelAction`)]}),(0,S.jsxs)(`button`,{className:`btn btn-secondary`,disabled:j.status===`checking`,onClick:$,children:[(0,S.jsx)(ne,{size:16}),e(`cid.retryAction`)]}),(0,S.jsx)(i,{to:`/app/`,className:`btn btn-secondary`,children:e(`cid.openAppAction`)})]})]})]})})]})}function ue(e,t){return t===`completed`?(0,S.jsx)(f,{size:28}):t===`error`||e===`error`?(0,S.jsx)(d,{size:28}):e===`checking`||e===`waiting-backend`||t===`starting`||t===`downloading`?(0,S.jsx)(v,{size:28}):e===`backend-missing`?(0,S.jsx)(b,{size:28}):e===`login-required`?(0,S.jsx)(y,{size:28}):(0,S.jsx)(f,{size:28})}function de(e,t){switch(e){case`checking`:return t(`cid.label.checking`);case`available`:return t(`cid.label.available`);case`already-local`:return t(`cid.label.alreadyLocal`);case`login-required`:return t(`cid.label.loginRequired`);case`backend-missing`:return t(`cid.label.backendMissing`);case`waiting-backend`:return t(`cid.label.waitingBackend`);case`error`:return t(`cid.label.error`);default:return t(`cid.label.idle`)}}var k=o(`/cid/$cid/`)({component:O});export{k as Route};
1
+ import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i,O as a,T as o,s}from"./ui-BpDGD3IR.js";import{a as ee}from"./i18n-NjvOSuV6.js";import{t as c}from"./download-jEPn2njL.js";import{t as l}from"./external-link-BFaoZeK0.js";import{t as te}from"./file-text-DPA1riJ_.js";import{t as u}from"./hard-drive-Dar_AZEq.js";import{n as ne,t as d}from"./triangle-alert-DGWc8ZHu.js";import{F as f,L as p,c as m,f as re,g as ie}from"./index-BI8oNSVC.js";import{t as ae}from"./MarketingHeader-ceWdRCpe.js";import{t as h}from"./format-CR8oUWq6.js";import{i as g,n as _,r as oe,t as se}from"./downloadValidation-Bzl7cci9.js";var ce=r(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),v=r(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),y=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),b=r(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),x=t(e(),1),S=n(),C=1800;function w(e,t){return`most://${e}${t||``}`}function T(e,t){let n=e.trim().replace(/[\\/]+$/,``);return n?`${n}${n.includes(`\\`)?`\\`:`/`}downloads`:t}function E(e,t){let n=e[t];return typeof n==`string`?n:void 0}function D(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function le(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t,r=E(n,`event`),i=n.data;if(!r||!i||typeof i!=`object`)return null;let a=i;return{event:r,payload:{taskId:E(a,`taskId`),percent:D(a,`percent`),loaded:D(a,`loaded`),total:D(a,`total`),file:E(a,`file`),fileName:E(a,`fileName`),error:E(a,`error`)}}}function O(){let{t:e}=ee(),{cid:t}=a({from:`/cid/$cid/`}),n=p({select:e=>e.searchStr}),r=m(e=>e.hasBackend),o=m(e=>e.addToast),f=m(e=>e.openConnectModal),E=s(e=>e.identity),D=s(e=>e.openLoginModal),O=(0,x.useMemo)(()=>w(t,n),[t,n]),k=(0,x.useMemo)(()=>g(O),[O]),A=(0,x.useMemo)(()=>se(O,e),[O,e]),fe=k.fileName||t,[j,M]=(0,x.useState)({status:`idle`,message:``}),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)({status:`idle`,message:``}),[L,R]=(0,x.useState)(``),[z,B]=(0,x.useState)(0),[V,H]=(0,x.useState)(null),[U,W]=(0,x.useState)(null),[pe,G]=(0,x.useState)(``),[me,K]=(0,x.useState)(!1),q=(0,x.useRef)(0),J=(0,x.useRef)(null),Y=N?.fileName||fe,X=N?.size??U,Z=j.status===`available`||j.status===`already-local`,Q=F.status===`starting`||F.status===`downloading`,he=T(pe,e(`cid.saveToFallback`)),$=(0,x.useCallback)(async()=>{let t=q.current+1;if(q.current=t,R(``),B(0),H(null),W(null),I({status:`idle`,message:``}),A){P(null),M({status:`error`,message:A});return}if(r===null){P(null),M({status:`waiting-backend`,message:e(`cid.status.waitingBackend`)});return}if(r!==!0){P(null),M({status:`backend-missing`,message:e(`cid.status.backendMissing`)});return}if(!E){P(null),M({status:`login-required`,message:e(`cid.status.loginRequired`)});return}M({status:`checking`,message:e(`cid.status.checking`)}),P(null);try{let n=await _.checkDownload(O);if(q.current!==t)return;P(n),M({status:n.alreadyExists?`already-local`:`available`,message:n.alreadyExists?e(`cid.status.alreadyLocal`,{fileName:n.fileName}):e(`cid.status.available`,{fileName:n.fileName})})}catch(e){if(q.current!==t)return;M({status:`error`,message:await oe(e)}),P(null)}},[r,O,e,E,A]);(0,x.useEffect)(()=>{document.title=e(`cid.meta.title`)},[e]),(0,x.useEffect)(()=>{let e=()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},t=()=>{document.visibilityState===`hidden`&&(e(),K(!1))};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,t),()=>{e(),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,t)}},[]),(0,x.useEffect)(()=>{$()},[$]),(0,x.useEffect)(()=>{if(r!==!0)return;let e=!1;return _.getDataPath().then(t=>{e||G(t.dataPath)}).catch(()=>{e||G(``)}),()=>{e=!0}},[r]),(0,x.useEffect)(()=>{if(!L||!E)return;let t=null,n=!1;return(async()=>{if(t=new WebSocket(await ie(`/ws`)),n){t.close();return}t.onmessage=t=>{let n=le(t.data);!n||n.payload.taskId!==L||(n.event===`download:progress`&&(B(n.payload.percent||0),H(n.payload.loaded??null),W(n.payload.total??null)),n.event===`download:status`&&I({status:`downloading`,message:n.payload.file?e(`cid.status.downloadingFile`,{fileName:n.payload.file}):e(`cid.status.downloading`)}),n.event===`download:success`&&(B(100),I({status:`completed`,message:e(`cid.status.downloadComplete`,{fileName:n.payload.fileName||Y})}),o(e(`cid.toast.downloadComplete`),`success`)),n.event===`download:error`&&(I({status:`error`,message:n.payload.error||e(`cid.status.downloadFailed`,{error:``})}),o(e(`cid.toast.downloadFailed`,{error:n.payload.error||e(`cid.errorFallback`)}),`error`)),n.event===`download:cancelled`&&(I({status:`cancelled`,message:e(`cid.status.cancelled`)}),o(e(`cid.toast.cancelled`),`warning`)))}})(),()=>{n=!0,t?.close()}},[o,Y,e,L,E]);let ge=async()=>{if(!E){D();return}if(r!==!0){f();return}if(!(!Z||Q)){I({status:`starting`,message:e(`cid.status.startingDownload`)}),B(0);try{let t=await _.downloadFile(O);if(t.alreadyExists){I({status:`completed`,message:e(`cid.status.alreadyLocal`,{fileName:t.fileName||Y})}),o(e(`cid.toast.alreadyLocal`),`warning`);return}t.taskId&&(R(t.taskId),I({status:`downloading`,message:e(`cid.status.downloading`)}),o(e(`cid.toast.downloadStarted`),`info`))}catch(t){let n=await re(t,e(`cid.status.downloadFailed`,{error:e(`cid.errorFallback`)}));I({status:`error`,message:n}),o(n,`error`)}}},_e=()=>{K(!1),J.current!==null&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{J.current=null,document.visibilityState!==`hidden`&&K(!0)},C)},ve=async()=>{L&&await _.cancelDownload(L).catch(()=>{})},ye=ue(j.status,F.status);return(0,S.jsxs)(`div`,{className:`cid-layout`,children:[(0,S.jsx)(ae,{}),(0,S.jsx)(`main`,{className:`cid-page`,children:(0,S.jsxs)(`section`,{className:`cid-shell`,children:[(0,S.jsxs)(`div`,{className:`cid-heading`,children:[(0,S.jsx)(`span`,{className:`cid-kicker`,children:e(`cid.kicker`)}),(0,S.jsx)(`h1`,{children:e(`cid.title`)}),(0,S.jsx)(`p`,{children:e(`cid.subtitle`)})]}),(0,S.jsxs)(`div`,{className:`cid-panel`,children:[(0,S.jsxs)(`div`,{className:`cid-handoff`,"aria-label":e(`cid.handoff.title`),children:[(0,S.jsxs)(`div`,{className:`cid-handoff-copy`,children:[(0,S.jsx)(`p`,{className:`cid-handoff-title`,children:e(`cid.handoff.title`)}),(0,S.jsx)(`p`,{children:e(`cid.handoff.desc`)})]}),(0,S.jsxs)(`a`,{className:`btn btn-primary`,href:O,onClick:_e,children:[(0,S.jsx)(l,{size:16}),e(`cid.handoff.action`)]})]}),me&&(0,S.jsxs)(`div`,{className:`cid-handoff-fallback`,role:`status`,children:[(0,S.jsx)(d,{size:18}),(0,S.jsx)(`p`,{children:e(`cid.handoff.fallback`)}),(0,S.jsxs)(i,{to:`/download/`,className:`btn btn-secondary`,children:[(0,S.jsx)(c,{size:16}),e(`cid.handoff.downloadAction`)]})]}),(0,S.jsxs)(`div`,{className:`cid-status`,children:[(0,S.jsx)(`span`,{className:`cid-status-icon ${j.status}`,children:ye}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`cid-status-label`,children:de(j.status,e)}),(0,S.jsx)(`p`,{className:`cid-status-message`,children:j.message})]})]}),(0,S.jsxs)(`dl`,{className:`cid-details`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`dt`,{children:[(0,S.jsx)(te,{size:16}),e(`cid.fileNameLabel`)]}),(0,S.jsx)(`dd`,{children:Y})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{children:e(`cid.cidLabel`)}),(0,S.jsx)(`dd`,{className:`cid-mono`,children:t})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{children:e(`cid.sizeLabel`)}),(0,S.jsx)(`dd`,{children:X?h(X):e(`cid.unknownSize`)})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`dt`,{children:[(0,S.jsx)(u,{size:16}),e(`cid.saveToLabel`)]}),(0,S.jsx)(`dd`,{children:he})]})]}),F.status!==`idle`&&(0,S.jsxs)(`div`,{className:`cid-download-state ${F.status}`,children:[(0,S.jsx)(`p`,{children:F.message}),(F.status===`starting`||F.status===`downloading`)&&(0,S.jsxs)(`div`,{className:`cid-progress`,children:[(0,S.jsx)(`progress`,{className:`cid-progress-bar`,value:z,max:100}),(0,S.jsx)(`span`,{children:V!==null&&U!==null?`${h(V)} / ${h(U)}`:`${z}%`})]})]}),(0,S.jsxs)(`div`,{className:`cid-actions`,children:[j.status===`login-required`&&(0,S.jsxs)(`button`,{className:`btn btn-primary`,onClick:D,children:[(0,S.jsx)(y,{size:16}),e(`cid.loginAction`)]}),j.status===`backend-missing`&&(0,S.jsxs)(`button`,{className:`btn btn-primary`,onClick:f,children:[(0,S.jsx)(b,{size:16}),e(`cid.connectAction`)]}),(0,S.jsxs)(`button`,{className:`btn btn-primary`,disabled:!Z||Q,onClick:ge,children:[Q?(0,S.jsx)(v,{className:`cid-spin-icon`,size:16}):(0,S.jsx)(c,{size:16}),e(Q?`cid.downloadingAction`:`cid.startAction`)]}),L&&F.status===`downloading`&&(0,S.jsxs)(`button`,{className:`btn btn-secondary`,onClick:ve,children:[(0,S.jsx)(ce,{size:16}),e(`cid.cancelAction`)]}),(0,S.jsxs)(`button`,{className:`btn btn-secondary`,disabled:j.status===`checking`,onClick:$,children:[(0,S.jsx)(ne,{size:16}),e(`cid.retryAction`)]}),(0,S.jsx)(i,{to:`/app/`,className:`btn btn-secondary`,children:e(`cid.openAppAction`)})]})]})]})})]})}function ue(e,t){return t===`completed`?(0,S.jsx)(f,{size:28}):t===`error`||e===`error`?(0,S.jsx)(d,{size:28}):e===`checking`||e===`waiting-backend`||t===`starting`||t===`downloading`?(0,S.jsx)(v,{size:28}):e===`backend-missing`?(0,S.jsx)(b,{size:28}):e===`login-required`?(0,S.jsx)(y,{size:28}):(0,S.jsx)(f,{size:28})}function de(e,t){switch(e){case`checking`:return t(`cid.label.checking`);case`available`:return t(`cid.label.available`);case`already-local`:return t(`cid.label.alreadyLocal`);case`login-required`:return t(`cid.label.loginRequired`);case`backend-missing`:return t(`cid.label.backendMissing`);case`waiting-backend`:return t(`cid.label.waitingBackend`);case`error`:return t(`cid.label.error`);default:return t(`cid.label.idle`)}}var k=o(`/cid/$cid/`)({component:O});export{k as Route};