most-box 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404/index.html +2 -2
- package/out/404.html +2 -2
- package/out/__next.__PAGE__.txt +4 -4
- package/out/__next._full.txt +13 -13
- package/out/__next._head.txt +3 -3
- package/out/__next._index.txt +7 -7
- package/out/__next._tree.txt +2 -2
- package/out/_next/static/chunks/00t5ddkkjek9v.js +1 -0
- package/out/_next/static/chunks/0hodisxqbtmye.js +1 -0
- package/out/_next/static/chunks/0jinrmgt26crz.js +1 -0
- package/out/_next/static/chunks/0mslhkdi-msxv.js +1 -0
- package/out/_next/static/chunks/1x76jmdus29em.js +1 -0
- package/out/_next/static/chunks/22vt64m0krmev.js +1 -0
- package/out/_next/static/chunks/266xuv6ts5889.js +5 -0
- package/out/_next/static/chunks/{0nwdp-n94owg0.css → 2jnstwjg45vfp.css} +1 -1
- package/out/_next/static/chunks/2o-0n-9r5u1oh.js +1 -0
- package/out/_next/static/chunks/2pkm-6u9yq_cq.js +1 -0
- package/out/_next/static/chunks/31zdi2pl6em6-.css +1 -0
- package/out/_next/static/chunks/393isf5crmqic.js +1 -0
- package/out/_next/static/chunks/3ej6im7cbakx3.js +1 -0
- package/out/_next/static/chunks/{0s7i7nfr9j3b1.js → 3m7_o1ihz8ay_.js} +1 -1
- package/out/_next/static/chunks/3qm2vbylm324o.css +1 -0
- package/out/_next/static/chunks/{43l72x-2z3zxb.js → 3uxltn4677hjy.js} +1 -1
- package/out/_next/static/chunks/3w2qk10_udrd9.js +1 -0
- package/out/_next/static/chunks/3xl0fq2d3dle6.js +1 -0
- package/out/_next/static/chunks/{418_591yp64lx.css → 440es_b4nw-7c.css} +2 -2
- package/out/_next/static/chunks/{turbopack-026p0g9v9_pva.js → turbopack-3vvza9m6839dy.js} +1 -1
- package/out/_not-found/__next._full.txt +12 -12
- package/out/_not-found/__next._head.txt +3 -3
- package/out/_not-found/__next._index.txt +7 -7
- package/out/_not-found/__next._not-found.__PAGE__.txt +4 -4
- package/out/_not-found/__next._not-found.txt +3 -3
- package/out/_not-found/__next._tree.txt +2 -2
- package/out/_not-found/index.html +2 -2
- package/out/_not-found/index.txt +12 -12
- package/out/admin/__next._full.txt +13 -13
- package/out/admin/__next._head.txt +3 -3
- package/out/admin/__next._index.txt +7 -7
- package/out/admin/__next._tree.txt +2 -2
- package/out/admin/__next.admin.__PAGE__.txt +4 -4
- package/out/admin/__next.admin.txt +3 -3
- package/out/admin/index.html +2 -2
- package/out/admin/index.txt +13 -13
- package/out/app/__next._full.txt +13 -13
- package/out/app/__next._head.txt +3 -3
- package/out/app/__next._index.txt +7 -7
- package/out/app/__next._tree.txt +2 -2
- package/out/app/__next.app.__PAGE__.txt +4 -4
- package/out/app/__next.app.txt +3 -3
- package/out/app/index.html +2 -2
- package/out/app/index.txt +13 -13
- package/out/chat/__next._full.txt +14 -14
- package/out/chat/__next._head.txt +3 -3
- package/out/chat/__next._index.txt +7 -7
- package/out/chat/__next._tree.txt +3 -3
- package/out/chat/__next.chat.__PAGE__.txt +4 -4
- package/out/chat/__next.chat.txt +4 -4
- package/out/chat/index.html +2 -2
- package/out/chat/index.txt +14 -14
- package/out/chat/join/__next._full.txt +14 -14
- package/out/chat/join/__next._head.txt +3 -3
- package/out/chat/join/__next._index.txt +7 -7
- package/out/chat/join/__next._tree.txt +3 -3
- package/out/chat/join/__next.chat.join.__PAGE__.txt +4 -4
- package/out/chat/join/__next.chat.join.txt +3 -3
- package/out/chat/join/__next.chat.txt +4 -4
- package/out/chat/join/index.html +2 -2
- package/out/chat/join/index.txt +14 -14
- package/out/demo/__next._full.txt +15 -14
- package/out/demo/__next._head.txt +3 -3
- package/out/demo/__next._index.txt +7 -7
- package/out/demo/__next._tree.txt +4 -3
- package/out/demo/__next.demo.__PAGE__.txt +6 -5
- package/out/demo/__next.demo.txt +3 -3
- package/out/demo/index.html +3 -3
- package/out/demo/index.txt +15 -14
- package/out/download/__next._full.txt +36 -34
- package/out/download/__next._head.txt +3 -3
- package/out/download/__next._index.txt +7 -7
- package/out/download/__next._tree.txt +2 -2
- package/out/download/__next.download.__PAGE__.txt +5 -5
- package/out/download/__next.download.txt +3 -3
- package/out/download/index.html +2 -2
- package/out/download/index.txt +36 -34
- package/out/game/__next._full.txt +11 -11
- package/out/game/__next._head.txt +3 -3
- package/out/game/__next._index.txt +7 -7
- package/out/game/__next._tree.txt +2 -2
- package/out/game/__next.game.__PAGE__.txt +2 -2
- package/out/game/__next.game.txt +3 -3
- package/out/game/gandengyan/__next._full.txt +13 -13
- package/out/game/gandengyan/__next._head.txt +3 -3
- package/out/game/gandengyan/__next._index.txt +7 -7
- package/out/game/gandengyan/__next._tree.txt +2 -2
- package/out/game/gandengyan/__next.game.gandengyan.__PAGE__.txt +4 -4
- package/out/game/gandengyan/__next.game.gandengyan.txt +3 -3
- package/out/game/gandengyan/__next.game.txt +3 -3
- package/out/game/gandengyan/index.html +2 -2
- package/out/game/gandengyan/index.txt +13 -13
- package/out/game/index.html +1 -1
- package/out/game/index.txt +11 -11
- package/out/game/zhajinhua/__next._full.txt +13 -13
- package/out/game/zhajinhua/__next._head.txt +3 -3
- package/out/game/zhajinhua/__next._index.txt +7 -7
- package/out/game/zhajinhua/__next._tree.txt +2 -2
- package/out/game/zhajinhua/__next.game.txt +3 -3
- package/out/game/zhajinhua/__next.game.zhajinhua.__PAGE__.txt +4 -4
- package/out/game/zhajinhua/__next.game.zhajinhua.txt +3 -3
- package/out/game/zhajinhua/index.html +2 -2
- package/out/game/zhajinhua/index.txt +13 -13
- package/out/index.html +2 -2
- package/out/index.txt +13 -13
- package/out/note/__next._full.txt +13 -13
- package/out/note/__next._head.txt +3 -3
- package/out/note/__next._index.txt +7 -7
- package/out/note/__next._tree.txt +2 -2
- package/out/note/__next.note.__PAGE__.txt +4 -4
- package/out/note/__next.note.txt +3 -3
- package/out/note/index.html +2 -2
- package/out/note/index.txt +13 -13
- package/out/ping/__next._full.txt +13 -13
- package/out/ping/__next._head.txt +3 -3
- package/out/ping/__next._index.txt +7 -7
- package/out/ping/__next._tree.txt +2 -2
- package/out/ping/__next.ping.__PAGE__.txt +4 -4
- package/out/ping/__next.ping.txt +3 -3
- package/out/ping/index.html +2 -2
- package/out/ping/index.txt +13 -13
- package/out/web3/__next._full.txt +14 -14
- package/out/web3/__next._head.txt +3 -3
- package/out/web3/__next._index.txt +7 -7
- package/out/web3/__next._tree.txt +3 -3
- package/out/web3/__next.web3.__PAGE__.txt +4 -4
- package/out/web3/__next.web3.txt +4 -4
- package/out/web3/ed25519/__next._full.txt +12 -12
- package/out/web3/ed25519/__next._head.txt +3 -3
- package/out/web3/ed25519/__next._index.txt +7 -7
- package/out/web3/ed25519/__next._tree.txt +3 -3
- package/out/web3/ed25519/__next.web3.ed25519.__PAGE__.txt +2 -2
- package/out/web3/ed25519/__next.web3.ed25519.txt +3 -3
- package/out/web3/ed25519/__next.web3.txt +4 -4
- package/out/web3/ed25519/index.html +1 -1
- package/out/web3/ed25519/index.txt +12 -12
- package/out/web3/index.html +2 -2
- package/out/web3/index.txt +14 -14
- package/out/web3/tools/__next._full.txt +12 -12
- package/out/web3/tools/__next._head.txt +3 -3
- package/out/web3/tools/__next._index.txt +7 -7
- package/out/web3/tools/__next._tree.txt +3 -3
- package/out/web3/tools/__next.web3.tools.__PAGE__.txt +2 -2
- package/out/web3/tools/__next.web3.tools.txt +3 -3
- package/out/web3/tools/__next.web3.txt +4 -4
- package/out/web3/tools/index.html +1 -1
- package/out/web3/tools/index.txt +12 -12
- package/package.json +1 -1
- package/server/src/http/app.js +66 -1
- package/server/src/http/nodeStatus.js +18 -0
- package/server/src/index.js +659 -164
- package/out/_next/static/chunks/0-c8h4u1i2f78.js +0 -1
- package/out/_next/static/chunks/02j6ojja7vzp8.js +0 -1
- package/out/_next/static/chunks/06im3as4nwfil.js +0 -1
- package/out/_next/static/chunks/0sq_0pwxnhby2.js +0 -1
- package/out/_next/static/chunks/1ei8b9nw-ea8p.css +0 -1
- package/out/_next/static/chunks/22h69_zwmttt4.js +0 -1
- package/out/_next/static/chunks/23zlmarf-go2x.js +0 -1
- package/out/_next/static/chunks/24k_4-y4ym0df.js +0 -1
- package/out/_next/static/chunks/2693fczty5yr8.js +0 -1
- package/out/_next/static/chunks/2_i1b78h0yiu_.js +0 -1
- package/out/_next/static/chunks/2fmkcw8ui5xp3.js +0 -5
- package/out/_next/static/chunks/2nbju8t9-ux58.css +0 -1
- package/out/_next/static/chunks/3fea100s764m-.js +0 -1
- package/out/_next/static/chunks/3mccxoa60ley8.js +0 -1
- /package/out/_next/static/{eXddCOt9eyz0j78b1m4Ex → TXy93SnAZQ7OQ-aVUkmHa}/_buildManifest.js +0 -0
- /package/out/_next/static/{eXddCOt9eyz0j78b1m4Ex → TXy93SnAZQ7OQ-aVUkmHa}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{eXddCOt9eyz0j78b1m4Ex → TXy93SnAZQ7OQ-aVUkmHa}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95057,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={formatUrl:function(){return o},formatWithValidation:function(){return u},urlObjectKeys:function(){return i}};for(var a in r)Object.defineProperty(n,a,{enumerable:!0,get:r[a]});let l=e.r(90809)._(e.r(98183)),s=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:n}=e,r=e.protocol||"",a=e.pathname||"",o=e.hash||"",i=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:n&&(u=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(u+=":"+e.port)),i&&"object"==typeof i&&(i=String(l.urlQueryToSearchParams(i)));let c=e.search||i&&`?${i}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||s.test(r))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),o&&"#"!==o[0]&&(o="#"+o),c&&"?"!==c[0]&&(c="?"+c),a=a.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${r}${u}${a}${c}${o}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return o(e)}},18581,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return a}});let r=e.r(71645);function a(e,t){let n=(0,r.useRef)(null),a=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(n.current=l(e,r)),t&&(a.current=l(t,r))},[e,t])}function l(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},73668,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return l}});let r=e.r(18967),a=e.r(52817);function l(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,a.hasBasePath)(n.pathname)}catch(e){return!1}}},84508,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},22016,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return g},useLinkStatus:function(){return v}};for(var a in r)Object.defineProperty(n,a,{enumerable:!0,get:r[a]});let l=e.r(90809),s=e.r(18050),o=l._(e.r(71645)),i=e.r(95057),u=e.r(8372),c=e.r(18581),d=e.r(18967),f=e.r(5550);e.r(33525);let p=e.r(88540),h=e.r(91949),m=e.r(73668),y=e.r(9396);function g(t){var n,r;let a,l,g,[v,C]=(0,o.useOptimistic)(h.IDLE_LINK_STATUS),j=(0,o.useRef)(null),{href:k,as:S,children:x,prefetch:w=null,passHref:M,replace:R,shallow:N,scroll:$,onClick:A,onMouseEnter:E,onTouchStart:O,legacyBehavior:P=!1,onNavigate:T,transitionTypes:U,ref:_,unstable_dynamicOnHover:L,...I}=t;a=x,P&&("string"==typeof a||"number"==typeof a)&&(a=(0,s.jsx)("a",{children:a}));let z=o.default.useContext(u.AppRouterContext),D=!1!==w,K=!1!==w?null===(r=w)||"auto"===r?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,B="string"==typeof(n=S||k)?n:(0,i.formatUrl)(n);if(P){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});l=o.default.Children.only(a)}let F=P?l&&"object"==typeof l&&l.ref:_,G=o.default.useCallback(e=>(null!==z&&(j.current=(0,h.mountLinkInstance)(e,B,z,K,D,C)),()=>{j.current&&((0,h.unmountLinkForCurrentNavigation)(j.current),j.current=null),(0,h.unmountPrefetchableInstance)(e)}),[D,B,z,K,C]),V={ref:(0,c.useMergedRef)(G,F),onClick(t){P||"function"!=typeof A||A(t),P&&l.props&&"function"==typeof l.props.onClick&&l.props.onClick(t),!z||t.defaultPrevented||function(t,n,r,a,l,s,i){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,m.isLocalURL)(n)){a&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(99781);o.default.startTransition(()=>{d(n,a?"replace":"push",!1===l?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,r.current,i)})}}(t,B,j,R,$,T,U)},onMouseEnter(e){P||"function"!=typeof E||E(e),P&&l.props&&"function"==typeof l.props.onMouseEnter&&l.props.onMouseEnter(e),z&&D&&(0,h.onNavigationIntent)(e.currentTarget,!0===L)},onTouchStart:function(e){P||"function"!=typeof O||O(e),P&&l.props&&"function"==typeof l.props.onTouchStart&&l.props.onTouchStart(e),z&&D&&(0,h.onNavigationIntent)(e.currentTarget,!0===L)}};return(0,d.isAbsoluteUrl)(B)?V.href=B:P&&!M&&("a"!==l.type||"href"in l.props)||(V.href=(0,f.addBasePath)(B)),g=P?o.default.cloneElement(l,V):(0,s.jsx)("a",{...I,...V,children:a}),(0,s.jsx)(b.Provider,{value:v,children:g})}e.r(84508);let b=(0,o.createContext)(h.IDLE_LINK_STATUS),v=()=>(0,o.useContext)(b);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},8734,e=>{"use strict";let t=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],8734)},11241,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],11241)},96699,e=>{"use strict";let t=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,t],96699)},35965,e=>{"use strict";let t=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,t],35965)},59665,5142,e=>{"use strict";var t=e.i(18050),n=e.i(71645);let r=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function a(e=!1,t={}){let[r,l]=(0,n.useState)(e),s=(0,n.useCallback)(()=>{l(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),o=(0,n.useCallback)(()=>{l(e=>e?(t.onClose?.(),!1):e)},[t.onClose]);return[r,{open:s,close:o,toggle:(0,n.useCallback)(()=>{r?o():s()},[o,s,r]),set:l}]}e.s(["useDisclosure",0,a],5142);let l=(0,n.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:s,headerRight:o,sidebarToggleReplacement:i,defaultHide:u=!1,children:c}){let[d,f]=a(!1),[p,h]=(0,n.useState)(u),m=(0,n.useRef)(u),y=function(e,{getInitialValueInEffect:t}={getInitialValueInEffect:!0}){let[r,a]=(0,n.useState)(t?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,n.useEffect)(()=>{try{if("matchMedia"in window){let t=window.matchMedia(e);a(t.matches);let n=e=>a(e.matches);return t.addEventListener("change",n),()=>{t.removeEventListener("change",n)}}}catch(e){return}},[e]),r||!1}("(max-width: 768px)"),g=(0,n.useCallback)((e={})=>{f.close(),e.collapse&&h(!0)},[f]);(0,n.useEffect)(()=>{u!==m.current&&(u?g({collapse:!0}):h(!1),m.current=u)},[u,g]);let b=()=>{y?f.open():h(!1)};return(0,t.jsx)(l.Provider,{value:{closeSidebar:g,openSidebar:b,isSidebarVisible:y?d:!p},children:(0,t.jsxs)("div",{className:"app-layout",children:[(0,t.jsx)("div",{className:`sidebar-overlay ${d?"visible":""}`,onClick:()=>g()}),(0,t.jsx)("div",{className:`sidebar ${d?"open":""} ${p?"collapsed":""}`,children:e({closeSidebar:g,openSidebar:b})}),(0,t.jsxs)("div",{className:"main-content",children:[(0,t.jsxs)("header",{className:"app-header",children:[(0,t.jsxs)("div",{className:"header-left",children:[i??(0,t.jsx)("button",{onClick:()=>{y?f.toggle():h(!p)},className:"btn btn-icon sidebar-toggle-btn","aria-label":y?"打开菜单":p?"展开侧边栏":"收起侧边栏",children:(0,t.jsx)(r,{size:16})}),s]}),(0,t.jsx)("div",{className:"header-right",children:o})]}),c]})]})})},"useAppShell",0,function(){let e=(0,n.useContext)(l);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},27648,e=>{"use strict";var t=e.i(18050),n=e.i(93957),r=e.i(71192);e.s(["default",0,function({className:e=""}){let a=(0,r.useUserStore)(e=>e.identity),l=(0,r.useUserStore)(e=>e.openLoginModal),s=(0,r.useUserStore)(e=>e.logoutUser);return(0,t.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,t.jsxs)("div",{className:"user-info",children:[(0,t.jsx)("img",{className:"user-avatar-img",src:(0,n.generateAvatar)(a?.address,a?.avatar),alt:"avatar"}),(0,t.jsx)("span",{className:"user-name",title:a?.address,children:a?.displayName||"未登录"})]}),a?(0,t.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:s,children:"退出"}):(0,t.jsx)("button",{className:"btn btn-primary login-btn",onClick:l,children:"登录"})]})}])},87884,e=>{"use strict";var t=e.i(26913);e.s(["channelApi",0,{getChannels(e={}){let n=new URLSearchParams;e.type&&n.set("type",e.type),e.excludeType&&n.set("excludeType",e.excludeType);let r=n.toString();return t.api.get(r?`/api/channels?${r}`:"/api/channels").json()},createChannel:(e,n="personal",r={})=>t.api.post("/api/channels",{json:{name:e,type:n,...r}}).json(),leaveChannel:e=>t.api.delete(`/api/channels/${encodeURIComponent(e)}`).json(),getChannelMessages:(e,n=100,r=0)=>t.api.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${n}&offset=${r}`).json(),sendChannelMessage:({channelName:e,content:n,author:r,authorName:a,avatar:l,attachment:s})=>t.api.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:s?{content:n,author:r,authorName:a,avatar:l,attachment:s}:{content:n,author:r,authorName:a,avatar:l}}).json(),getChannelMembers:e=>t.api.get(`/api/channels/${encodeURIComponent(e)}/members`).json(),getChannelPeers:e=>t.api.get(`/api/channels/${encodeURIComponent(e)}/peers`).json(),setChannelRemark:(e,n)=>t.api.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:n}}).json(),getFileDownloadUrl:e=>(0,t.getApiUrl)(`/api/files/${e}/download`)}])},23952,e=>{"use strict";var t=e.i(71645),n=e.i(87884),r=e.i(26913);function a(e){return String(e.id||`${e.author||""}-${e.timestamp||""}-${e.content||""}`)}e.s(["useChannelMessages",0,function({isReady:e,enabled:l=!0,channelName:s="",peerId:o="",waitForPeerId:i=!1,limit:u=100,reconnectBaseDelay:c=2500,acceptMessage:d,getMessageKey:f=a,onSyncError:p,onSocketEvent:h}){let[m,y]=(0,t.useState)([]),[g,b]=(0,t.useState)(!1),v=(0,t.useRef)(null),C=(0,t.useRef)(s),j=(0,t.useRef)(null),k=(0,t.useRef)(0),S=(0,t.useRef)(d),x=(0,t.useRef)(f),w=(0,t.useRef)(h),M=(0,t.useRef)(p),R=(0,t.useRef)(o);(0,t.useEffect)(()=>{S.current=d},[d]),(0,t.useEffect)(()=>{x.current=f},[f]),(0,t.useEffect)(()=>{w.current=h},[h]),(0,t.useEffect)(()=>{M.current=p},[p]);let N=(0,t.useCallback)(e=>{let t=S.current;return t?e.filter(t):e},[]),$=(0,t.useCallback)((e,t,n=!0)=>{let r=[...e];for(let e of N(t)){let t=x.current(e);if(n){let n=r.findIndex(t=>t.pending&&t.author?.toLowerCase()===e.author?.toLowerCase()&&t.content===e.content);if(-1!==n){r[n]={...e,id:e.id||t};continue}}r.some(e=>x.current(e)===t)||r.push({...e,id:e.id||t})}return r},[N]),A=(0,t.useCallback)((e,t)=>{v.current?.readyState===WebSocket.OPEN&&v.current.send(JSON.stringify({event:e,data:t}))},[]),E=(0,t.useCallback)(e=>{e&&A("channel:subscribe",{channel:e})},[A]),O=(0,t.useCallback)(e=>{e&&A("channel:unsubscribe",{channel:e})},[A]),P=(0,t.useCallback)(async(t=C.current,r={})=>{if(!t||!e)return[];try{let e=N(await n.channelApi.getChannelMessages(t,u));return y(t=>r.replace?e:$(t,e,!1)),e}catch(e){return r.replace&&y([]),await M.current?.(e),[]}},[N,e,u,$]);(0,t.useEffect)(()=>{R.current=o,o&&(A("register",{peerId:o}),i&&C.current&&(E(C.current),P(C.current,{replace:!0})))},[o,E,P,i,A]);let T=(0,t.useCallback)(()=>{y([])},[]),U=(0,t.useCallback)(async({channelName:e=C.current,content:t,author:r,authorName:a,avatar:l,attachment:s,optimisticId:o})=>{let i=t.trim();if(!e||!i)return null;let u={id:o||`${r}-${Date.now()}-${Math.random().toString(36).slice(2)}`,author:r,authorName:a,content:i,timestamp:Date.now(),pending:!0,attachment:s};y(e=>[...e,u]);try{let t=await n.channelApi.sendChannelMessage({channelName:e,content:i,author:r,authorName:a,avatar:l,attachment:s});return y(e=>e.map(e=>e.id===u.id?{...t.message,id:t.message.id||x.current(t.message)}:e)),t.message}catch(e){throw y(e=>e.filter(e=>e.id!==u.id)),e}},[]);return(0,t.useEffect)(()=>{let t=C.current;if(C.current=s,t&&t!==s&&O(t),s&&e&&l)return P(s,{replace:!0}),(!i||R.current)&&E(s),()=>O(s)},[s,l,e,E,P,O,i]),(0,t.useEffect)(()=>{if(!e||!l)return void b(!1);let t=!1;async function n(){let e=new WebSocket(await (0,r.getAuthenticatedWebSocketUrl)("/ws"));t?e.close():(e.onopen=()=>{b(!0),k.current=0,R.current&&e.send(JSON.stringify({event:"register",data:{peerId:R.current}})),C.current&&(!i||R.current)&&(E(C.current),P(C.current,{replace:!0}))},e.onmessage=e=>{try{let t=JSON.parse(e.data);w.current?.(t.event,t.data),"channel:message"===t.event&&t.data?.channel===C.current&&t.data?.message&&y(e=>$(e,[t.data.message]))}catch{}},e.onclose=()=>{if(b(!1),t)return;let e=k.current;if(e>=20)return;let r=Math.min(c*Math.pow(2,e),3e4);k.current=e+1,j.current=setTimeout(n,r)},e.onerror=()=>e.close(),v.current=e)}return k.current=0,n(),()=>{t=!0,j.current&&clearTimeout(j.current),v.current?.close(),v.current=null}},[l,e,$,c,E,P,i]),{clearMessages:T,connected:g,messages:m,sendMessage:U,setMessages:y,syncMessages:P}}])},21357,e=>{"use strict";let t=(0,e.i(56420).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,t],21357)},53881,53751,99591,34471,e=>{"use strict";var t=e.i(18050),n=e.i(22016),r=e.i(11241),a=e.i(56420);let l=(0,a.default)("spade",[["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5",key:"1aw2pz"}]]);e.s(["Spade",0,l],53751);let s=(0,a.default)("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);var o=e.i(27648);let i=[{id:"gandengyan",label:"干瞪眼",href:"/game/gandengyan/",icon:(0,t.jsx)(s,{size:16})},{id:"zhajinhua",label:"炸金花",href:"/game/zhajinhua/",icon:(0,t.jsx)(l,{size:16})}];e.s(["default",0,function({activeGame:e,closeSidebar:a}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.default,{href:"/",className:"sidebar-header sidebar-header-link",children:[(0,t.jsx)(r.ArrowLeft,{size:18}),(0,t.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,t.jsx)("nav",{className:"sidebar-nav",children:i.map(r=>(0,t.jsxs)(n.default,{href:r.href,className:`sidebar-nav-btn ${e===r.id?"active":""}`,onClick:a,children:[r.icon,(0,t.jsx)("span",{children:r.label})]},r.id))}),(0,t.jsx)(o.default,{})]})}],53881);var u=e.i(71645);let c="game",d="mostbox.game.event",f=["gandengyan","zhajinhua"],p="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function h(e){let t=String(e||"").trim().toLowerCase();return f.includes(t)?t:""}function m(e){return String(e||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,8)}function y(e){return/^[A-Z0-9]{4,8}$/.test(String(e||""))}function g(){let e="";for(let t=0;t<6;t++)e+=p[function(e){if(globalThis.crypto?.getRandomValues){let t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]%e}return Math.floor(Math.random()*e)}(p.length)];return e}function b(e,t){let n=h(e),r=m(t);return n&&y(r)?`game-${n}-${r.toLowerCase()}`:""}function v({gameId:e,roomCode:t,event:n,payload:r}){var a;let l=h(e);return{kind:d,version:1,gameId:l,roomCode:m(t),event:String(n||""),eventId:(a=l||"game",`${a}_${Date.now()}_${function(){let e=new Uint8Array(4);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}()}`),payload:r||{}}}function C(e,t={}){try{let n=JSON.parse(String(e||""));if(!n||n.kind!==d||1!==n.version||"string"!=typeof n.event||"string"!=typeof n.eventId)return null;let r=h(n.gameId),a=m(n.roomCode);if(!r||!y(a)||t.gameId&&r!==h(t.gameId)||t.roomCode&&a!==m(t.roomCode))return null;return{...n,gameId:r,roomCode:a,payload:n.payload&&"object"==typeof n.payload?n.payload:{}}}catch{return null}}function j(e,t){var n;if(!e||"object"!=typeof e)return null;let r=k(e.address||t);if(!r||k(t)!==r)return null;let a=String(e.name||"").trim().slice(0,50)||((n=r)?`${n.slice(0,6)}...${n.slice(-4)}`:"");return{address:r,name:a,publicKey:String(e.publicKey||"").trim(),joinedAt:Number(e.joinedAt||Date.now())}}function k(e){let t=String(e||"").trim();return/^0x[a-fA-F0-9]{40}$/.test(t)?t.toLowerCase():""}function S(e,t,n){let r=t.get(n.address);r?Object.assign(r,n):(e.push(n),t.set(n.address,n))}function x(e){return[...e].sort((e,t)=>Number(e.timestamp||0)-Number(t.timestamp||0))}e.s(["GAME_CHANNEL_TYPE",0,c,"createGameEvent",0,v,"createGameRoomCode",0,g,"deriveGameRoomLobby",0,function(e=[],t={}){let n=[],r=new Map,a="";for(let l of x(e)){let e=C(l.content,t);if(e){if("room:create"===e.event){let t=j(e.payload?.player,l.author);if(!t)continue;a||(a=t.address),S(n,r,t);continue}if("player:join"===e.event){let t=j(e.payload?.player,l.author);t&&S(n,r,t);continue}if("player:leave"===e.event){let t=k(e.payload?.player?.address||l.author);if(t){let e=n.findIndex(e=>e.address===t);-1!==e&&(n.splice(e,1),r.delete(t))}}}}return{gameId:h(t.gameId),roomCode:m(t.roomCode),hostAddress:a,players:n}},"gameRoomCodeToChannelName",0,b,"getLatestGameState",0,function(e=[],t={}){let n=null;for(let r of x(e)){let e=C(r.content,t);if(!e||"room:state"!==e.event)continue;let a=Number(e.payload?.seq||0);(!n||a>=Number(n.payload?.seq||0))&&(n=e)}return n},"normalizeGameRoomCode",0,m,"parseGameEvent",0,C],99591);var w=e.i(87884),M=e.i(23952),R=e.i(26913),N=e.i(3593),$=e.i(71192);async function A(e,t,n,r,a,l){let s=v({gameId:n,roomCode:r,event:a,payload:l});await w.channelApi.sendChannelMessage({channelName:e,content:JSON.stringify(s),author:t.address,authorName:E(t)})}function E(e){return e.displayName||e.username}e.s(["useGameRoom",0,function({gameId:e,onError:t,getPlayerPayload:n}){let r=(0,N.useAppStore)(e=>e.hasBackend),a=(0,N.useAppStore)(e=>e.checkBackend),l=(0,N.useAppStore)(e=>e.openConnectModal),s=(0,$.useUserStore)(e=>e.identity),o=(0,$.useUserStore)(e=>e.openLoginModal),[i,d]=(0,u.useState)(""),[f,p]=(0,u.useState)(""),[h,y]=(0,u.useState)(!1),j=!0===r,k=(0,u.useCallback)(async(e,n)=>{let r=await (0,R.getApiErrorMessage)(e,n);t&&t(r)},[t]),S=(0,u.useCallback)(t=>!!C(t.content,{gameId:e,roomCode:i}),[e,i]),x=(0,u.useCallback)(t=>{let n=C(t.content,{gameId:e,roomCode:i});return n?`${t.author}-${n.eventId}`:`${t.author}-${t.timestamp}-${t.content}`},[e,i]),{clearMessages:O,connected:P,messages:T,sendMessage:U,syncMessages:_}=(0,M.useChannelMessages)({isReady:j,enabled:!!s,channelName:f,limit:500,acceptMessage:S,getMessageKey:x,onSyncError:e=>k(e,"无法读取房间记录")}),L=(0,u.useMemo)(()=>T.map(t=>({message:t,event:C(t.content,{gameId:e,roomCode:i})})).filter(e=>e.event),[e,T,i]),I=(0,u.useCallback)(()=>s?!!j||(l(),!1):(o(),!1),[j,l,o,s]);(0,u.useEffect)(()=>{null===r&&a()},[a,r]);let z=(0,u.useCallback)(async(r,a=!1)=>{if(!I()||!s)return!1;let l=a?g():m(r),o=b(e,l);if(!o)return t&&t("请输入 4-8 位房间码"),!1;y(!0);try{var i;return await w.channelApi.createChannel(o,c),await A(o,s,e,l,a?"room:create":"player:join",{player:n?n(s):{address:(i=s).address,name:E(i),publicKey:"",joinedAt:Date.now()}}),d(l),p(o),O(),!0}catch(e){return await k(e,a?"创建房间失败":"进入房间失败"),!1}finally{y(!1)}},[I,e,n,t,k,O,s]),D=(0,u.useCallback)(()=>z("",!0),[z]),K=(0,u.useCallback)(e=>z(e),[z]),B=(0,u.useCallback)(async(t,n={})=>{if(!I()||!s||!f||!i)return!1;let r=v({gameId:e,roomCode:i,event:t,payload:n}),a=JSON.stringify(r);try{return await U({channelName:f,content:a,author:s.address,authorName:E(s),optimisticId:`${s.address}-${r.eventId}`}),!0}catch(e){return await k(e,"发送房间事件失败"),!1}},[f,I,e,k,i,U,s]);return{channelName:f,connected:P,createRoom:D,ensureReady:I,isBackendReady:j,joinRoom:K,joining:h,messages:T,roomCode:i,roomEvents:L,sendRoomEvent:B,setRoomCode:d,syncMessages:_,userIdentity:s}}],34471)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,89664,e=>{"use strict";let t=(0,e.i(56420).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],89664)},11241,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],11241)},35965,e=>{"use strict";let t=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,t],35965)},96699,e=>{"use strict";let t=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,t],96699)},59665,5142,e=>{"use strict";var t=e.i(18050),n=e.i(71645);let i=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function a(e=!1,t={}){let[i,s]=(0,n.useState)(e),r=(0,n.useCallback)(()=>{s(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),l=(0,n.useCallback)(()=>{s(e=>e?(t.onClose?.(),!1):e)},[t.onClose]);return[i,{open:r,close:l,toggle:(0,n.useCallback)(()=>{i?l():r()},[l,r,i]),set:s}]}e.s(["useDisclosure",0,a],5142);let s=(0,n.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:r,headerRight:l,sidebarToggleReplacement:c,defaultHide:d=!1,children:o}){let[h,u]=a(!1),[p,m]=(0,n.useState)(d),j=(0,n.useRef)(d),f=function(e,{getInitialValueInEffect:t}={getInitialValueInEffect:!0}){let[i,a]=(0,n.useState)(t?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,n.useEffect)(()=>{try{if("matchMedia"in window){let t=window.matchMedia(e);a(t.matches);let n=e=>a(e.matches);return t.addEventListener("change",n),()=>{t.removeEventListener("change",n)}}}catch(e){return}},[e]),i||!1}("(max-width: 768px)"),y=(0,n.useCallback)((e={})=>{u.close(),e.collapse&&m(!0)},[u]);(0,n.useEffect)(()=>{d!==j.current&&(d?y({collapse:!0}):m(!1),j.current=d)},[d,y]);let x=()=>{f?u.open():m(!1)};return(0,t.jsx)(s.Provider,{value:{closeSidebar:y,openSidebar:x,isSidebarVisible:f?h:!p},children:(0,t.jsxs)("div",{className:"app-layout",children:[(0,t.jsx)("div",{className:`sidebar-overlay ${h?"visible":""}`,onClick:()=>y()}),(0,t.jsx)("div",{className:`sidebar ${h?"open":""} ${p?"collapsed":""}`,children:e({closeSidebar:y,openSidebar:x})}),(0,t.jsxs)("div",{className:"main-content",children:[(0,t.jsxs)("header",{className:"app-header",children:[(0,t.jsxs)("div",{className:"header-left",children:[c??(0,t.jsx)("button",{onClick:()=>{f?u.toggle():m(!p)},className:"btn btn-icon sidebar-toggle-btn","aria-label":f?"打开菜单":p?"展开侧边栏":"收起侧边栏",children:(0,t.jsx)(i,{size:16})}),r]}),(0,t.jsx)("div",{className:"header-right",children:l})]}),o]})]})})},"useAppShell",0,function(){let e=(0,n.useContext)(s);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},87884,e=>{"use strict";var t=e.i(26913);e.s(["channelApi",0,{getChannels(e={}){let n=new URLSearchParams;e.type&&n.set("type",e.type),e.excludeType&&n.set("excludeType",e.excludeType);let i=n.toString();return t.api.get(i?`/api/channels?${i}`:"/api/channels").json()},createChannel:(e,n="personal",i={})=>t.api.post("/api/channels",{json:{name:e,type:n,...i}}).json(),leaveChannel:e=>t.api.delete(`/api/channels/${encodeURIComponent(e)}`).json(),getChannelMessages:(e,n=100,i=0)=>t.api.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${n}&offset=${i}`).json(),sendChannelMessage:({channelName:e,content:n,author:i,authorName:a,avatar:s,attachment:r})=>t.api.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:r?{content:n,author:i,authorName:a,avatar:s,attachment:r}:{content:n,author:i,authorName:a,avatar:s}}).json(),getChannelMembers:e=>t.api.get(`/api/channels/${encodeURIComponent(e)}/members`).json(),getChannelPeers:e=>t.api.get(`/api/channels/${encodeURIComponent(e)}/peers`).json(),setChannelRemark:(e,n)=>t.api.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:n}}).json(),getFileDownloadUrl:e=>(0,t.getApiUrl)(`/api/files/${e}/download`)}])},99847,e=>{"use strict";let t=(0,e.i(56420).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],99847)},58925,e=>{"use strict";let t=(0,e.i(56420).default)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);e.s(["KeyRound",0,t],58925)},90165,e=>{"use strict";var t=e.i(47167),n=e.i(18050),i=e.i(71645),a=e.i(18566),s=e.i(58925),r=e.i(89664),l=e.i(99847),c=e.i(35965),d=e.i(96699),o=e.i(11241),h=e.i(59665),u=e.i(3593),p=e.i(71192),m=e.i(11470),j=e.i(26913),f=e.i(87884);let y=[{name:"node_url",required:!1,description:"Web 端未连接后端时,用于连接远程节点。"},{name:"node_invite",required:!1,description:"配合 node_url 作为远程节点邀请码。"},{name:"uid",required:!0,description:"作为用户名,密码为空,用于生成账户并自动登录。"},{name:"identity",required:!1,description:"邀请身份类型;user 为普通用户视图。"},{name:"avatar",required:!1,description:"覆盖默认头像。"},{name:"name",required:!1,description:"覆盖默认昵称。"},{name:"locale",required:!1,description:"预留给多语言切换,当前暂不执行。"},{name:"channels[].id",required:!0,description:"频道 ID,用于自动加入频道。"},{name:"channels[].name",required:!1,description:"频道备注,不作为频道 ID。"}],x=t.default.env.NEXT_PUBLIC_CHAT_JOIN_API_BASE||"https://api.most.box";function v(e){try{return JSON.parse(e)}catch{return null}}function k(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function b(e){return"string"==typeof e?e.trim():""}function g(){let e=(0,a.useSearchParams)(),t=(0,u.useAppStore)(e=>e.isDarkMode),g=(0,u.useAppStore)(e=>e.setIsDarkMode),C=(0,u.useAppStore)(e=>e.hasBackend),N=(0,p.useUserStore)(e=>e.setUserIdentity),[w,S]=(0,i.useState)(""),[A,M]=(0,i.useState)(""),[_,R]=(0,i.useState)(!0),[$,I]=(0,i.useState)(""),E=(0,i.useRef)("");return(0,i.useEffect)(()=>{let t=e.get("token"),n=e.get("pub");if(!t){M("缺少 token 参数"),R(!1);return}if(!n){M("缺少 pub 参数"),R(!1);return}if(null===C)return void I("正在检测后端连接...");let i=`${t}:${n}`;async function a(e){var t;if(e.node_url){if(I("正在连接远程节点..."),!(await (0,j.checkBackendConnectionTarget)({url:e.node_url,invite:e.node_invite||""})).ok)throw Error("远程节点连接失败");(0,j.configureBackend)({url:e.node_url,invite:e.node_invite||""}),u.useAppStore.setState({hasBackend:!0})}else if(!C)throw Error("未连接后端,邀请中也没有 node_url");I("正在登录邀请账号...");let n=(0,m.createLoginIdentity)(e.uid,"");for(let t of(N({...n,identity:e.identity,displayName:e.name||n.displayName,avatar:e.avatar}),I("正在加入频道..."),e.channels)){await f.channelApi.createChannel(t.id,"public",{displayName:e.name||n.displayName,avatar:e.avatar});let i=String(t.name||"").trim().slice(0,50);i&&await f.channelApi.setChannelRemark(t.id,i)}let i=e.channels[0];I("加入成功,正在打开频道..."),window.location.href=(t=i.id,`/chat?channel=${encodeURIComponent(t)}`)}async function s(){try{I("正在解密邀请...");let e=await fetch(`${x}/api/chat.join.decrypt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,pub:n})}),i=await e.text(),s=v(i);if(e.ok){S(null===s?i:JSON.stringify(s,null,2));let e=function(e){let t,n="string"!=typeof e?e:v(e);if(!k(n))return null;let i=b(n.uid),a=(Array.isArray(n.channels)?n.channels:[]).filter(k).map(e=>({id:b(e.id),name:b(e.name)||void 0})).filter(e=>e.id);return i&&0!==a.length?{node_url:b(n.node_url)||void 0,node_invite:b(n.node_invite)||void 0,locale:b(n.locale)||void 0,uid:i,identity:(t=b(n.identity),"user"===t||"service"===t||"service_ai"===t?t:void 0),avatar:b(n.avatar)||void 0,name:b(n.name)||void 0,channels:a}:null}(s);if(!e)return void M("邀请内容缺少 uid 或 channels[].id");await a(e)}else M(function(e,t){if(t&&"object"==typeof t&&"error"in t){let e=t.error;if("string"==typeof e)return e}return e||"解密失败"}(i,s))}catch(e){M(`请求出错: ${e instanceof Error?e.message:String(e)}`)}finally{R(!1)}}E.current!==i&&(E.current=i,s())},[C,e,N]),(0,n.jsx)(h.default,{sidebar:()=>(0,n.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>window.location.href="/chat",children:[(0,n.jsx)(o.ArrowLeft,{size:18}),(0,n.jsx)("h1",{children:"MOST PEOPLE"})]}),headerTitle:(0,n.jsx)("h2",{className:"header-title",children:"加入频道"}),headerRight:(0,n.jsx)("button",{className:"btn btn-icon",onClick:()=>g(!t),title:"切换主题",children:t?(0,n.jsx)(c.Sun,{size:16}):(0,n.jsx)(d.Moon,{size:16})}),children:(0,n.jsx)("div",{className:"chat-join-container",children:(0,n.jsxs)("div",{className:"chat-join-panel",children:[_?(0,n.jsxs)("div",{className:"chat-join-loading",children:[(0,n.jsx)(s.KeyRound,{size:32}),(0,n.jsx)("p",{children:$||"正在解密..."})]}):A?(0,n.jsxs)("div",{className:"chat-join-error",children:[(0,n.jsx)(l.AlertCircle,{size:32}),(0,n.jsx)("p",{children:A}),$&&(0,n.jsx)("p",{className:"chat-join-status",children:$}),w&&(0,n.jsx)("pre",{className:"chat-join-result",children:w})]}):(0,n.jsxs)("div",{className:"chat-join-success",children:[(0,n.jsx)(r.Check,{size:32}),(0,n.jsx)("p",{children:$||"解密成功"}),(0,n.jsx)("pre",{className:"chat-join-result",children:w})]}),(0,n.jsxs)("section",{className:"chat-join-spec","aria-labelledby":"chat-join-spec-title",children:[(0,n.jsxs)("div",{className:"chat-join-helper-title",children:[(0,n.jsx)(s.KeyRound,{size:18}),(0,n.jsx)("h3",{id:"chat-join-spec-title",children:"支持字段"})]}),(0,n.jsx)("div",{className:"chat-join-field-list",children:y.map(e=>(0,n.jsxs)("div",{className:"chat-join-field",children:[(0,n.jsxs)("div",{className:"chat-join-field-meta",children:[(0,n.jsx)("code",{className:"chat-join-field-name",children:e.name}),(0,n.jsx)("span",{children:e.required?"必填":"可选"})]}),(0,n.jsx)("p",{children:e.description})]},e.name))})]}),(0,n.jsxs)("section",{className:"chat-join-helper","aria-labelledby":"ea-test-title",children:[(0,n.jsxs)("div",{className:"chat-join-helper-title",children:[(0,n.jsx)(s.KeyRound,{size:18}),(0,n.jsx)("h3",{id:"ea-test-title",children:"测试公钥"})]}),(0,n.jsx)("code",{className:"ui-code-box chat-join-public-key",children:"0x955fe80bdb8312165471fcacd6a8f83df88a770dda6f38657ca4e62ec28d5b54"}),(0,n.jsx)("a",{className:"btn",href:"/web3/#EA",target:"_blank",children:"前往 Web3 工具箱"})]})]})})})}e.s(["default",0,function(){return(0,n.jsx)(i.Suspense,{children:(0,n.jsx)(g,{})})}],90165)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68590,58501,e=>{"use strict";let a=(0,e.i(56420).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,a],68590);var t=e.i(18050);e.s(["LogoIcon",0,function({size:e=24}){return(0,t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.4"}),(0,t.jsx)("rect",{x:"14",y:"2",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.7"}),(0,t.jsx)("rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.7"}),(0,t.jsx)("rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",fill:"var(--accent)"})]})}],58501)},30274,e=>{"use strict";let a=(0,e.i(56420).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",0,a],30274)},87884,e=>{"use strict";var a=e.i(26913);e.s(["channelApi",0,{getChannels(e={}){let t=new URLSearchParams;e.type&&t.set("type",e.type),e.excludeType&&t.set("excludeType",e.excludeType);let s=t.toString();return a.api.get(s?`/api/channels?${s}`:"/api/channels").json()},createChannel:(e,t="personal",s={})=>a.api.post("/api/channels",{json:{name:e,type:t,...s}}).json(),leaveChannel:e=>a.api.delete(`/api/channels/${encodeURIComponent(e)}`).json(),getChannelMessages:(e,t=100,s=0)=>a.api.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${t}&offset=${s}`).json(),sendChannelMessage:({channelName:e,content:t,author:s,authorName:i,avatar:n,attachment:r})=>a.api.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:r?{content:t,author:s,authorName:i,avatar:n,attachment:r}:{content:t,author:s,authorName:i,avatar:n}}).json(),getChannelMembers:e=>a.api.get(`/api/channels/${encodeURIComponent(e)}/members`).json(),getChannelPeers:e=>a.api.get(`/api/channels/${encodeURIComponent(e)}/peers`).json(),setChannelRemark:(e,t)=>a.api.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:t}}).json(),getFileDownloadUrl:e=>(0,a.getApiUrl)(`/api/files/${e}/download`)}])},23952,e=>{"use strict";var a=e.i(71645),t=e.i(87884),s=e.i(26913);function i(e){return String(e.id||`${e.author||""}-${e.timestamp||""}-${e.content||""}`)}e.s(["useChannelMessages",0,function({isReady:e,enabled:n=!0,channelName:r="",peerId:l="",waitForPeerId:c=!1,limit:d=100,reconnectBaseDelay:o=2500,acceptMessage:u,getMessageKey:h=i,onSyncError:m,onSocketEvent:p}){let[f,x]=(0,a.useState)([]),[y,g]=(0,a.useState)(!1),v=(0,a.useRef)(null),j=(0,a.useRef)(r),b=(0,a.useRef)(null),k=(0,a.useRef)(0),w=(0,a.useRef)(u),N=(0,a.useRef)(h),C=(0,a.useRef)(p),S=(0,a.useRef)(m),M=(0,a.useRef)(l);(0,a.useEffect)(()=>{w.current=u},[u]),(0,a.useEffect)(()=>{N.current=h},[h]),(0,a.useEffect)(()=>{C.current=p},[p]),(0,a.useEffect)(()=>{S.current=m},[m]);let I=(0,a.useCallback)(e=>{let a=w.current;return a?e.filter(a):e},[]),z=(0,a.useCallback)((e,a,t=!0)=>{let s=[...e];for(let e of I(a)){let a=N.current(e);if(t){let t=s.findIndex(a=>a.pending&&a.author?.toLowerCase()===e.author?.toLowerCase()&&a.content===e.content);if(-1!==t){s[t]={...e,id:e.id||a};continue}}s.some(e=>N.current(e)===a)||s.push({...e,id:e.id||a})}return s},[I]),A=(0,a.useCallback)((e,a)=>{v.current?.readyState===WebSocket.OPEN&&v.current.send(JSON.stringify({event:e,data:a}))},[]),E=(0,a.useCallback)(e=>{e&&A("channel:subscribe",{channel:e})},[A]),R=(0,a.useCallback)(e=>{e&&A("channel:unsubscribe",{channel:e})},[A]),$=(0,a.useCallback)(async(a=j.current,s={})=>{if(!a||!e)return[];try{let e=I(await t.channelApi.getChannelMessages(a,d));return x(a=>s.replace?e:z(a,e,!1)),e}catch(e){return s.replace&&x([]),await S.current?.(e),[]}},[I,e,d,z]);(0,a.useEffect)(()=>{M.current=l,l&&(A("register",{peerId:l}),c&&j.current&&(E(j.current),$(j.current,{replace:!0})))},[l,E,$,c,A]);let L=(0,a.useCallback)(()=>{x([])},[]),D=(0,a.useCallback)(async({channelName:e=j.current,content:a,author:s,authorName:i,avatar:n,attachment:r,optimisticId:l})=>{let c=a.trim();if(!e||!c)return null;let d={id:l||`${s}-${Date.now()}-${Math.random().toString(36).slice(2)}`,author:s,authorName:i,content:c,timestamp:Date.now(),pending:!0,attachment:r};x(e=>[...e,d]);try{let a=await t.channelApi.sendChannelMessage({channelName:e,content:c,author:s,authorName:i,avatar:n,attachment:r});return x(e=>e.map(e=>e.id===d.id?{...a.message,id:a.message.id||N.current(a.message)}:e)),a.message}catch(e){throw x(e=>e.filter(e=>e.id!==d.id)),e}},[]);return(0,a.useEffect)(()=>{let a=j.current;if(j.current=r,a&&a!==r&&R(a),r&&e&&n)return $(r,{replace:!0}),(!c||M.current)&&E(r),()=>R(r)},[r,n,e,E,$,R,c]),(0,a.useEffect)(()=>{if(!e||!n)return void g(!1);let a=!1;async function t(){let e=new WebSocket(await (0,s.getAuthenticatedWebSocketUrl)("/ws"));a?e.close():(e.onopen=()=>{g(!0),k.current=0,M.current&&e.send(JSON.stringify({event:"register",data:{peerId:M.current}})),j.current&&(!c||M.current)&&(E(j.current),$(j.current,{replace:!0}))},e.onmessage=e=>{try{let a=JSON.parse(e.data);C.current?.(a.event,a.data),"channel:message"===a.event&&a.data?.channel===j.current&&a.data?.message&&x(e=>z(e,[a.data.message]))}catch{}},e.onclose=()=>{if(g(!1),a)return;let e=k.current;if(e>=20)return;let s=Math.min(o*Math.pow(2,e),3e4);k.current=e+1,b.current=setTimeout(t,s)},e.onerror=()=>e.close(),v.current=e)}return k.current=0,t(),()=>{a=!0,b.current&&clearTimeout(b.current),v.current?.close(),v.current=null}},[n,e,z,o,E,$,c]),{clearMessages:L,connected:y,messages:f,sendMessage:D,setMessages:x,syncMessages:$}}])},62368,e=>{"use strict";let a=(0,e.i(56420).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,a],62368)},66595,e=>{"use strict";let a=(0,e.i(56420).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,a],66595)},51921,e=>{"use strict";let a=(0,e.i(56420).default)("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);e.s(["Music",0,a],51921)},15170,e=>{"use strict";let a=(0,e.i(56420).default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);e.s(["Image",0,a],15170)},80796,e=>{"use strict";let a=(0,e.i(56420).default)("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);e.s(["Film",0,a],80796)},12796,e=>{"use strict";let a=(0,e.i(56420).default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);e.s(["Loader",0,a],12796)},6933,e=>{"use strict";e.s(["getFileSubtype",0,function(e){let a=String(e||"").split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","heic","heif"].includes(a)?"image":["mp4","webm","mov","avi","mkv","flv","wmv","m4v","mpeg","3gp"].includes(a)?"video":["mp3","wav","ogg","flac","aac","m4a","wma","opus"].includes(a)?"audio":["txt","md","js","ts","jsx","tsx","css","scss","less","json","xml","html","htm","yaml","yml","toml","ini","cfg","conf","log","sh","bash","py","rb","go","rs","java","c","cpp","h","hpp","cs","php","sql","graphql","env","gitignore","dockerfile","readme"].includes(a)?"text":"file"}])},26091,e=>{"use strict";let a=(0,e.i(56420).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,a],26091)},77071,e=>{"use strict";let a=(0,e.i(56420).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,a],77071)},99847,e=>{"use strict";let a=(0,e.i(56420).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,a],99847)},77685,e=>{"use strict";var a=e.i(18050),t=e.i(99847),s=e.i(62368),i=e.i(72382),n=e.i(26091),r=e.i(80796),l=e.i(15170),c=e.i(12796),d=e.i(51921);function o(e){let a=String(e||"").split("/");return a[a.length-1]||e}e.s(["ChatAttachmentCard",0,function({attachment:e,status:u="idle",pending:h=!1,onOpen:m}){var p,f;let x="checking"===u,y=["ui-file-action","chat-attachment-action","error"===u?"error":"","available"===u?"available":""].filter(Boolean).join(" "),g=((p=e.size)&&!(p<=0)?p<1024?`${p} B`:p<1048576?`${(p/1024).toFixed(1)} KB`:p<0x40000000?`${(p/1048576).toFixed(1)} MB`:`${(p/0x40000000).toFixed(2)} GB`:"")||"MostBox 文件";return(0,a.jsxs)("button",{type:"button",className:"ui-file-card chat-attachment-card",onClick:()=>m?.(e),disabled:h||x,title:e.link,children:[(0,a.jsx)("span",{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:x?(0,a.jsx)(c.Loader,{size:20,className:"ui-spinner chat-attachment-spinner"}):"image"===(f=e.kind)?(0,a.jsx)(l.Image,{size:20}):"video"===f?(0,a.jsx)(r.Film,{size:20}):"audio"===f?(0,a.jsx)(d.Music,{size:20}):(0,a.jsx)(n.FileText,{size:20})}),(0,a.jsxs)("span",{className:"ui-file-info chat-attachment-info",children:[(0,a.jsx)("span",{className:"ui-file-name chat-attachment-name",children:o(e.fileName)}),(0,a.jsx)("span",{className:"ui-file-meta chat-attachment-meta",children:h?"发送中...":g})]}),(0,a.jsx)("span",{className:y,children:x?"检测中":"available"===u?(0,a.jsx)(i.Eye,{size:16}):"error"===u?(0,a.jsx)(t.AlertCircle,{size:17}):(0,a.jsx)(s.Download,{size:16})})]})},"getAttachmentBaseFileName",0,o])},11241,e=>{"use strict";let a=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,a],11241)},35965,e=>{"use strict";let a=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,a],35965)},96699,e=>{"use strict";let a=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,a],96699)},59665,5142,e=>{"use strict";var a=e.i(18050),t=e.i(71645);let s=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function i(e=!1,a={}){let[s,n]=(0,t.useState)(e),r=(0,t.useCallback)(()=>{n(e=>e||(a.onOpen?.(),!0))},[a.onOpen]),l=(0,t.useCallback)(()=>{n(e=>e?(a.onClose?.(),!1):e)},[a.onClose]);return[s,{open:r,close:l,toggle:(0,t.useCallback)(()=>{s?l():r()},[l,r,s]),set:n}]}e.s(["useDisclosure",0,i],5142);let n=(0,t.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:r,headerRight:l,sidebarToggleReplacement:c,defaultHide:d=!1,children:o}){let[u,h]=i(!1),[m,p]=(0,t.useState)(d),f=(0,t.useRef)(d),x=function(e,{getInitialValueInEffect:a}={getInitialValueInEffect:!0}){let[s,i]=(0,t.useState)(a?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,t.useEffect)(()=>{try{if("matchMedia"in window){let a=window.matchMedia(e);i(a.matches);let t=e=>i(e.matches);return a.addEventListener("change",t),()=>{a.removeEventListener("change",t)}}}catch(e){return}},[e]),s||!1}("(max-width: 768px)"),y=(0,t.useCallback)((e={})=>{h.close(),e.collapse&&p(!0)},[h]);(0,t.useEffect)(()=>{d!==f.current&&(d?y({collapse:!0}):p(!1),f.current=d)},[d,y]);let g=()=>{x?h.open():p(!1)};return(0,a.jsx)(n.Provider,{value:{closeSidebar:y,openSidebar:g,isSidebarVisible:x?u:!m},children:(0,a.jsxs)("div",{className:"app-layout",children:[(0,a.jsx)("div",{className:`sidebar-overlay ${u?"visible":""}`,onClick:()=>y()}),(0,a.jsx)("div",{className:`sidebar ${u?"open":""} ${m?"collapsed":""}`,children:e({closeSidebar:y,openSidebar:g})}),(0,a.jsxs)("div",{className:"main-content",children:[(0,a.jsxs)("header",{className:"app-header",children:[(0,a.jsxs)("div",{className:"header-left",children:[c??(0,a.jsx)("button",{onClick:()=>{x?h.toggle():p(!m)},className:"btn btn-icon sidebar-toggle-btn","aria-label":x?"打开菜单":m?"展开侧边栏":"收起侧边栏",children:(0,a.jsx)(s,{size:16})}),r]}),(0,a.jsx)("div",{className:"header-right",children:l})]}),o]})]})})},"useAppShell",0,function(){let e=(0,t.useContext)(n);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},27648,e=>{"use strict";var a=e.i(18050),t=e.i(93957),s=e.i(71192);e.s(["default",0,function({className:e=""}){let i=(0,s.useUserStore)(e=>e.identity),n=(0,s.useUserStore)(e=>e.openLoginModal),r=(0,s.useUserStore)(e=>e.logoutUser);return(0,a.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,a.jsxs)("div",{className:"user-info",children:[(0,a.jsx)("img",{className:"user-avatar-img",src:(0,t.generateAvatar)(i?.address,i?.avatar),alt:"avatar"}),(0,a.jsx)("span",{className:"user-name",title:i?.address,children:i?.displayName||"未登录"})]}),i?(0,a.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:r,children:"退出"}):(0,a.jsx)("button",{className:"btn btn-primary login-btn",onClick:n,children:"登录"})]})}])},39626,e=>{"use strict";var a=e.i(18050);let t=(0,e.i(56420).default)("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);var s=e.i(59665);e.s(["default",0,function({label:e="打开侧边栏",className:i="",variant:n="primary"}){let{isSidebarVisible:r,openSidebar:l}=(0,s.useAppShell)();return r?null:(0,a.jsxs)("button",{type:"button",className:`btn ${"primary"===n?"btn-primary":""} sidebar-open-hint ${i}`.trim(),onClick:l,children:[(0,a.jsx)(t,{size:16}),e]})}],39626)},79490,11028,27668,e=>{"use strict";let a=(0,e.i(56420).default)("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);e.s(["Edit2",0,a],79490);var t=e.i(18050),s=e.i(71645),i=e.i(26091),n=e.i(12796),r=e.i(51921),l=e.i(63676),c=e.i(26913);e.s(["default",0,function({item:e,isBackendReady:a,getFileDownloadUrl:d,onClose:o}){let[u,h]=(0,s.useState)(""),[m,p]=(0,s.useState)(!1),[f,x]=(0,s.useState)(""),[y,g]=(0,s.useState)("");return(0,s.useEffect)(()=>{if("text"!==e.subtype)return;let t=!1;return(h(""),g(""),a)?(p(!0),(async()=>{try{let a=await fetch(d(e.cid),{headers:{...await (0,c.getApiRequestHeaders)("GET",`/api/files/${e.cid}/download`),Range:"bytes=0-9999"}});if(!a.ok)throw Error("加载失败");let s=await a.text();t||h(s||"(文件为空)")}catch{t||h("加载失败")}finally{t||p(!1)}})(),()=>{t=!0}):void h("加载失败")},[d,a,e.cid,e.subtype]),(0,s.useEffect)(()=>{var t;if("image"!==(t=e.subtype)&&"video"!==t&&"audio"!==t)return void x("");if(x(""),g(""),!a)return void g("加载失败");let s="",i=!1;return(async()=>{try{let a=await fetch(d(e.cid),{headers:await (0,c.getApiRequestHeaders)("GET",`/api/files/${e.cid}/download`)});if(!a.ok)throw Error("加载失败");let t=URL.createObjectURL(await a.blob());s=t,i||x(t)}catch{i||g("加载失败")}})(),()=>{i=!0,s&&URL.revokeObjectURL(s)}},[d,a,e.cid,e.subtype]),(0,t.jsxs)("div",{className:"preview-overlay",onClick:o,children:[(0,t.jsx)("button",{type:"button",className:"preview-close",onClick:o,"aria-label":"关闭预览",children:(0,t.jsx)(l.X,{size:20})}),(0,t.jsxs)("div",{onClick:e=>e.stopPropagation(),children:["image"===e.subtype&&(0,t.jsx)("div",{className:"preview-media-wrapper",children:f?(0,t.jsx)("img",{src:f,alt:e.fileName}):y?(0,t.jsxs)("div",{className:"preview-unsupported",children:[(0,t.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,t.jsx)("p",{children:e.fileName}),(0,t.jsx)("p",{className:"preview-unsupported-hint",children:y})]}):(0,t.jsx)("div",{className:"preview-loading",children:(0,t.jsx)("div",{className:"preview-loading-spinner"})})}),"video"===e.subtype&&(0,t.jsx)("div",{className:"preview-media-wrapper",children:f?(0,t.jsx)("video",{src:f,controls:!0}):y?(0,t.jsxs)("div",{className:"preview-unsupported",children:[(0,t.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,t.jsx)("p",{children:e.fileName}),(0,t.jsx)("p",{className:"preview-unsupported-hint",children:y})]}):(0,t.jsx)("div",{className:"preview-loading",children:(0,t.jsx)("div",{className:"preview-loading-spinner"})})}),"audio"===e.subtype&&(0,t.jsxs)("div",{className:"preview-audio",children:[(0,t.jsx)("div",{className:"preview-audio-icon",children:(0,t.jsx)(r.Music,{size:36,color:"var(--accent)"})}),(0,t.jsx)("p",{className:"preview-audio-filename",children:e.fileName}),f?(0,t.jsx)("audio",{className:"preview-audio-player",src:f,controls:!0}):(0,t.jsx)("div",{className:"preview-text-loading",children:y?(0,t.jsx)("p",{children:y}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Loader,{size:24,className:"preview-text-spinner"}),(0,t.jsx)("p",{children:"正在加载音频预览..."})]})})]}),"file"===e.subtype&&(0,t.jsxs)("div",{className:"preview-unsupported",children:[(0,t.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,t.jsx)("p",{children:e.fileName}),(0,t.jsx)("p",{className:"preview-unsupported-hint",children:"无法预览"})]}),"text"===e.subtype&&(0,t.jsxs)("div",{className:"preview-text-container",children:[(0,t.jsx)("div",{className:"preview-text-header",children:(0,t.jsx)("span",{children:e.fileName})}),m?(0,t.jsxs)("div",{className:"preview-text-loading",children:[(0,t.jsx)(n.Loader,{size:24,className:"preview-text-spinner"}),(0,t.jsx)("p",{children:"正在加载文本预览..."}),(0,t.jsx)("p",{className:"preview-text-loading-hint",children:"如果是初次预览,可能需要等待 P2P 网络同步"})]}):(0,t.jsx)("pre",{className:"preview-text",children:u||"(文件为空)"})]})]})]})}],11028);var d=e.i(64621);let o="链接格式不正确,请粘贴完整的 most://<cid>?filename=... 分享链接。",u="暂时没有发现在线种子。请确认分享者或其他下载者仍在线做种,稍后再检测。",h={"Link must be a valid most:// URL":"链接无法解析,请粘贴完整的 most://<cid>?filename=... 分享链接。","Link must use most:// protocol":"链接协议不正确,应以 most:// 开头。","Link path is not supported":"链接里不应包含路径,请使用 most://<cid>?filename=... 格式。","Invalid CID format":"CID 无效,请确认 most:// 后面的内容没有缺失或被截断。","Invalid CID format: CID v1 required":"CID 格式不符合 MostBox 要求,请确认分享链接完整。","CID digest must be 32 bytes":"CID 格式不符合 MostBox 要求,请确认分享链接完整。","filename is required":"链接缺少 filename 参数,请复制完整分享链接后再检测。"};e.s(["getDownloadCheckErrorMessageFromPayload",0,function(e={},a=""){if("TimeoutError"===a)return"检测等待超时,暂时没有等到在线种子响应。请确认分享者或其他下载者仍在线做种,稍后再检测。";if(!e.status)return"无法连接本地节点,请确认 MostBox 后端正在运行后再检测。";if(404===e.status)return"当前后端还没有检测接口,请重启 MostBox 后端后再试。";switch(e.code){case"VALIDATION_ERROR":return o;case"CONFLICT":return e.error?`${e.error},请先处理同名文件后再下载。`:"下载目录已有同名文件,请先重命名或移走后再检测。";case"PEER_NOT_FOUND":return u;case"PERMISSION_ERROR":return e.error?`下载目录不可写:${e.error}`:"下载目录不可写,请检查目录权限后再检测。";case"ENGINE_NOT_INITIALIZED":return"本地节点还没有启动完成,请稍等几秒后重新检测。"}return 503===e.status?u:e.status>=500?"本地节点检测时出错,请稍后重试或查看节点日志。":e.error?`检测未通过:${e.error}`:"检测未通过,请确认链接完整、发布者在线且本机网络正常。"},"getDownloadLinkValidationMessage",0,function(e=""){let a=String(e||"").trim();if(!a)return"请先粘贴 most:// 分享链接。";let t=function(e){let a;if(!e||"string"!=typeof e)return{cid:"",error:"Link must be a non-empty string"};try{a=new URL(e)}catch{return{cid:"",error:"Link must be a valid most:// URL"}}if("most:"!==a.protocol)return{cid:"",error:"Link must use most:// protocol"};if(a.pathname&&"/"!==a.pathname)return{cid:"",error:"Link path is not supported"};let t=a.hostname,s=a.searchParams.get("filename"),i=[...a.searchParams.keys()].find(e=>"filename"!==e),n=function(e){let a;if(!e||"string"!=typeof e)return{valid:!1,error:"CID must be a non-empty string"};try{a=d.CID.parse(e)}catch{return{valid:!1,error:"Invalid CID format"}}return 1!==a.version?{valid:!1,error:"Invalid CID format: CID v1 required"}:32!==a.multihash.digest.length?{valid:!1,error:"CID digest must be 32 bytes"}:{valid:!0}}(t);return n.valid?s&&s.trim()?i?{cid:"",error:`Unsupported query parameter: ${i}`}:{cid:t,fileName:s}:{cid:"",error:"filename is required"}:{cid:"",error:n.error}}(a);if(!t.error)return t.fileName?.trim()?null:h["filename is required"];if(t.error.startsWith("Unsupported query parameter: ")){let e=t.error.slice(29);return`链接包含暂不支持的参数 ${e},请只保留 filename。`}return h[t.error]||o}],27668)},41222,e=>{"use strict";var a=e.i(18050),t=e.i(71645),s=e.i(68590),i=e.i(30274),n=e.i(77071),r=e.i(35965),l=e.i(96699),c=e.i(63676),d=e.i(11241),o=e.i(79490),u=e.i(56420);let h=(0,u.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),m=(0,u.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),p=(0,u.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var f=e.i(15170),x=e.i(80796),y=e.i(12796);let g=(0,u.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var v=e.i(66595),j=e.i(59665),b=e.i(77685),k=e.i(11028);e.i(4121);var w=e.i(47910),N=e.i(88361),C=e.i(57667),S=e.i(39626),M=e.i(58501),I=e.i(26913),z=e.i(27668),A=e.i(93957),E=e.i(3593),R=e.i(71192),$=e.i(5142),L=e.i(23952),D=e.i(27648),F=e.i(87884),U=e.i(6933);let T=/^[a-zA-Z0-9_-]+$/,P={async publishFile(e,a){let t=new FormData;t.append("file",e,a);let s=await I.api.post("/api/publish",{body:t});if(!s.ok)throw Error((await s.json().catch(()=>({error:s.statusText}))).error||"Request failed");return s.json()},downloadFile:e=>I.api.post("/api/download",{json:{link:e}}).json(),checkDownload:e=>I.api.post("/api/download/check",{json:{link:e,timeout:1e4},timeout:12e3}).json(),getFileDownloadUrl:e=>(0,I.getApiUrl)(`/api/files/${e}/download`)};async function q(e){let a=await (0,I.getApiErrorPayload)(e),t=e&&"object"==typeof e&&"name"in e?String(e.name):"";return(0,z.getDownloadCheckErrorMessageFromPayload)(a,t)}e.s(["default",0,function(){let e=(0,E.useAppStore)(e=>e.isDarkMode),u=(0,E.useAppStore)(e=>e.setIsDarkMode),O=(0,E.useAppStore)(e=>e.hasBackend),B=(0,E.useAppStore)(e=>e.addToast),K=(0,E.useAppStore)(e=>e.openConnectModal),V=(0,R.useUserStore)(e=>e.identity),H=(0,R.useUserStore)(e=>e.openLoginModal),[W,_]=(0,t.useState)([]),[G,X]=(0,t.useState)(null),[J,Z]=(0,t.useState)(""),[Q,Y]=(0,t.useState)(""),[ee,ea]=(0,t.useState)(""),[et,es]=(0,$.useDisclosure)(!1),[ei,en]=(0,t.useState)(""),[er,el]=(0,t.useState)(!1),[ec,ed]=(0,t.useState)(!1),[eo,eu]=(0,$.useDisclosure)(!1),[eh,em]=(0,t.useState)(null),[ep,ef]=(0,t.useState)(!1),[ex,ey]=(0,t.useState)(""),[eg,ev]=(0,t.useState)(null),[ej,eb]=(0,t.useState)(!1),[ek,ew]=(0,t.useState)({}),[eN,eC]=(0,t.useState)(null),[eS,eM]=(0,t.useState)([]),[eI,ez]=(0,t.useState)(!1),[eA,eE]=(0,t.useState)(!1),eR=V?.identity==="user",e$=(0,t.useRef)(null),eL=(0,t.useRef)(null),eD=(0,t.useRef)(null),eF=(0,t.useRef)(null),eU=(0,t.useRef)(new Map),eT=(0,t.useRef)(new Set),eP=!0===O,eq=(0,t.useCallback)(async(e,a)=>{B(await (0,I.getApiErrorMessage)(e,a),"error")},[B]),eO=(0,t.useCallback)(()=>({displayName:V?.displayName||V?.username||"",avatar:V?.avatar}),[V?.avatar,V?.displayName,V?.username]),eB=(0,t.useCallback)(async(e=G?.name)=>{if(!e||!eP||!V)return void eM([]);ez(!0);try{eM(await F.channelApi.getChannelMembers(e))}catch(e){eM([]),await eq(e,"无法读取频道成员")}finally{ez(!1)}},[G?.name,eP,eq,V]),{clearMessages:eK,messages:eV,sendMessage:eH,syncMessages:eW}=(0,L.useChannelMessages)({isReady:eP,enabled:!!V,channelName:G?.name||"",peerId:ei,waitForPeerId:!0,onSyncError:e=>eq(e,"无法读取频道消息"),onSocketEvent:function(e,a){switch(e){case"channel:peer:online":case"channel:peer:offline":G&&F.channelApi.getChannelPeers(G.name).catch(e=>{console.warn("[Chat] Failed to fetch peers on event:",e.message)});break;case"channel:joined":case"channel:left":eJ(),eB();break;case"download:success":{let e=eU.current.get(a.taskId);e&&(eU.current.delete(a.taskId),eT.current.delete(e.cid),ew(a=>({...a,[e.cid]:{status:"available"}})),B(`${a.fileName||(0,b.getAttachmentBaseFileName)(e.fileName)} 下载完成`,"success"),eZ(e,a.fileName||e.fileName));break}case"download:error":case"download:cancelled":{let t=eU.current.get(a.taskId);t&&(eU.current.delete(a.taskId),eT.current.delete(t.cid),ew(s=>({...s,[t.cid]:{status:"error",message:"download:cancelled"===e?"附件下载已取消":a.error||"附件下载失败"}})),B("download:cancelled"===e?"附件下载已取消":a.error||"附件下载失败","error"))}}}});function e_(){return!!eP||(K(),!1)}function eG(){return!!V||(H(),!1)}function eX(e){return e.length<3?"频道名至少 3 个字符":e.length>30?"频道名最多 30 个字符":T.test(e)?"":"频道名只能包含字母、数字、下划线和连字符"}async function eJ(){if(eP)try{let e=await F.channelApi.getChannels({excludeType:"game"});_(e)}catch(e){_([]),await eq(e,"无法读取频道列表")}}function eZ(e,a=e.fileName){let t=(0,U.getFileSubtype)(a);ev({cid:e.cid,fileName:a,subtype:"file"===t?e.kind:t})}async function eQ(e){let a=(0,z.getDownloadLinkValidationMessage)(e.link);if(a)return ew(t=>({...t,[e.cid]:{status:"error",message:a}})),!1;try{ew(a=>({...a,[e.cid]:{status:"checking"}}));let a=await P.checkDownload(e.link);return ew(t=>({...t,[e.cid]:{status:"available",message:a.alreadyExists?"本机已有":"可预览"}})),!0}catch(t){let a=await q(t);return ew(t=>({...t,[e.cid]:{status:"error",message:a}})),!1}}async function eY(e){eC(null),await eQ(e)&&await e0(e)}async function e0(e){if(!eT.current.has(e.cid)){eT.current.add(e.cid),ew(a=>({...a,[e.cid]:{status:"available"}}));try{let a=await P.downloadFile(e.link);if(a.alreadyExists||a.fileName){eT.current.delete(e.cid),ew(a=>({...a,[e.cid]:{status:"available"}})),eZ({...e,fileName:a.fileName||e.fileName},a.fileName||e.fileName);return}a.taskId&&(eU.current.set(a.taskId,e),B("开始下载附件","success"))}catch(t){let a=await q(t);eT.current.delete(e.cid),ew(t=>({...t,[e.cid]:{status:"error",message:a}}))}}}async function e1(e){!eG()||e_()&&(X(e),Z(e.name),window.history.pushState({},"",`?channel=${encodeURIComponent(e.name)}`))}async function e2(e,a){if((a&&a.stopPropagation(),eG()&&e_())&&!ec){ed(!0);try{if(await F.channelApi.leaveChannel(e),G?.name===e){X(null),Z(""),eK();let e=new URL(window.location.href);e.searchParams.delete("channel"),window.history.pushState({},"",e.pathname)}eJ(),eu.close(),em(null)}catch(e){await eq(e,"退出频道失败")}finally{ed(!1)}}}async function e4(e){let a=e.trim();if(!a||er)return;let t=eX(a);if(t)return void B(t,"error");if(eG()&&e_()){el(!0);try{let e=await F.channelApi.createChannel(a,"public",eO()),t=W.find(e=>e.name===a),s={...t,name:e.name||a,type:e.type||t?.type||"public",createdAt:e.createdAt||t?.createdAt,coreKey:e.coreKey||e.key||t?.coreKey,remark:t?.remark};_(e=>e.some(e=>e.name===a)?e.map(e=>e.name===a?{...e,...s}:e):[...e,s]),es.close(),await e1(s),eB(a),eJ()}catch(e){await eq(e,"加入频道失败")}finally{el(!1)}}}async function e6(e,a){if(!e.trim()||!G||!eG()||!e_())return!1;let t=e.trim();try{return await eH({channelName:G.name,content:t,author:V.address,authorName:V.displayName||V.username,avatar:V.avatar,attachment:a}),eB(G.name),!0}catch(e){return await eq(e,"发送失败"),!1}}async function e3(){if(!ee.trim())return;let e=ee.trim();ea(""),await e6(e)}async function e8(e){if(e&&0!==e.length&&G&&eG()&&e_()&&!ej){eb(!0);try{for(let s of Array.from(e)){var a,t;let e=(a=G.name,t=s.name,`chat-file/${a}/${t}`),i=await P.publishFile(s,e),n=i.fileName||e,r=i.link||`most://${i.cid}?filename=${encodeURIComponent(n)}`,l={kind:s.type.startsWith("image/")?"image":s.type.startsWith("video/")?"video":s.type.startsWith("audio/")?"audio":s.type.startsWith("text/")?"text":(0,U.getFileSubtype)(n),cid:i.cid,fileName:n,link:r,mimeType:s.type||void 0,size:s.size};await e6(r,l)&&B(`${(0,b.getAttachmentBaseFileName)(n)} 已发布`,"success")}}catch(e){await eq(e,"附件发送失败")}finally{eb(!1)}}}async function e5(e){if(!eG()||!e_())return;let a=ek[e.cid];if(a?.status!=="checking"){if(a?.status==="error")return void eC(e);if(a?.status!=="available"){await eQ(e)&&await e0(e);return}await e0(e)}}async function e9(){if(G&&eG()&&e_())try{let e=await F.channelApi.setChannelRemark(G.name,ex);_(a=>a.map(a=>a.name===G.name?{...a,remark:e.remark}:a)),X(a=>a?{...a,remark:e.remark}:null)}catch(e){await eq(e,"设置备注失败")}}function e7(e,a){let t=String(e||"").trim();return t?eA?/#[a-fA-F0-9]{4}$/.test(String(t||"").trim())?t:a?`${t}#${a.slice(-4).toUpperCase()}`:t:t.replace(/#[a-fA-F0-9]{4}$/,""):a?`${a.slice(0,6)}...${a.slice(-4)}`:"Unknown"}(0,t.useEffect)(()=>{let e=()=>{Z(new URLSearchParams(window.location.search).get("channel")||"")};return e(),window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]),(0,t.useEffect)(()=>{V&&Z(new URLSearchParams(window.location.search).get("channel")||"")},[V?.address]),(0,t.useEffect)(()=>{e$.current?.scrollIntoView({behavior:"smooth"})},[eV]),(0,t.useEffect)(()=>{eP?I.api.get("/api/node-id").json().then(e=>en(e.id)).catch(e=>{console.warn("[Chat] Failed to fetch node ID:",e.message),eq(e,"无法读取节点 ID")}):en("")},[eP,eq]),(0,t.useEffect)(()=>{eP&&V&&eJ()},[O,eP,V?.address]),(0,t.useEffect)(()=>{G&&eP&&(eW(G.name,{replace:!0}),F.channelApi.getChannelPeers(G.name).catch(()=>{}),eB(G.name))},[G,O,eP,eB,eW]),(0,t.useEffect)(()=>{ep&&G&&eB(G.name)},[G,eB,ep]),(0,t.useEffect)(()=>{if(J&&W.length>0){let e=W.find(e=>e.name===J);e&&(!G||G.name!==e.name)?e1(e):e&&G&&G.name===e.name&&(G.createdAt!==e.createdAt||G.coreKey!==e.coreKey||G.remark!==e.remark||G.type!==e.type)&&X(e)}},[W,G,J]),(0,t.useEffect)(()=>{V||(_([]),X(null),Z(""),eK(),ea(""),en(""),ef(!1),ev(null),eM([]),ew({}),eT.current.clear(),eU.current.clear())},[eK,V?.address]);let ae=eR&&!!J&&!G,aa=G?(0,a.jsx)("h2",{className:"header-title",children:G.remark||G.name}):(0,a.jsx)("h2",{className:"header-title",children:"聊天"}),at=Q.trim().toLowerCase(),as=at?W.filter(e=>[e.remark||e.name,e.name].some(e=>e.toLowerCase().includes(at))):W;return(0,a.jsxs)(j.default,{defaultHide:eR,sidebar:({closeSidebar:e})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>window.location.href="/",children:[(0,a.jsx)(d.ArrowLeft,{size:18}),(0,a.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,a.jsx)("div",{className:"chat-channel-search",children:(0,a.jsxs)("div",{className:"ui-input-control",children:[(0,a.jsx)(v.Search,{className:"ui-input-icon",size:15}),(0,a.jsx)("input",{type:"search",className:"input input-compact",placeholder:"搜索频道",value:Q,onChange:e=>Y(e.target.value),"aria-label":"搜索频道"})]})}),(0,a.jsx)("nav",{className:"sidebar-nav",children:0===W.length?(0,a.jsx)("div",{className:"sidebar-empty-state",children:(0,a.jsx)("p",{children:"暂无频道"})}):0===as.length?(0,a.jsx)("div",{className:"sidebar-empty-state",children:(0,a.jsx)("p",{children:"未找到频道"})}):as.map(t=>(0,a.jsxs)("div",{className:`sidebar-nav-btn ${G?.name===t.name?"active":""}`,onClick:()=>{e1(t),e()},role:"button",tabIndex:0,onKeyDown:a=>{"Enter"===a.key&&(e1(t),e())},children:[(0,a.jsx)(s.MessageSquare,{size:16}),(0,a.jsx)("span",{children:t.remark||t.name}),(0,a.jsx)("button",{className:"leave-channel-btn",onClick:e=>{e.stopPropagation(),em(t),eu.open()},title:"退出频道",children:(0,a.jsx)(c.X,{size:14})})]},t.name))}),(0,a.jsxs)("button",{className:"ui-action-dashed create-channel-btn",onClick:()=>{eG()&&e_()&&es.open()},children:[(0,a.jsx)(n.Plus,{size:16}),"加入频道"]}),(0,a.jsx)(D.default,{})]}),headerTitle:aa,sidebarToggleReplacement:eR?(0,a.jsx)("span",{className:"sidebar-toggle-static-logo","aria-hidden":"true",children:(0,a.jsx)(M.LogoIcon,{size:18})}):void 0,headerRight:(0,a.jsxs)("div",{className:"header-right-actions",children:[(0,a.jsx)("button",{className:"btn btn-icon",onClick:()=>u(!e),title:"切换主题",children:e?(0,a.jsx)(r.Sun,{size:16}):(0,a.jsx)(l.Moon,{size:16})}),G&&(0,a.jsx)("button",{className:"btn btn-icon",onClick:()=>ef(!0),title:"频道设置",children:(0,a.jsx)(p,{size:16})})]}),children:[G?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"chat-messages",children:[0===eV.length?(0,a.jsxs)("div",{className:"ui-empty-state chat-messages-empty",children:[(0,a.jsx)("div",{className:"ui-empty-icon empty-icon",children:(0,a.jsx)(s.MessageSquare,{size:28})}),(0,a.jsx)("p",{children:"暂无消息,开始聊天吧!"})]}):eV.map(e=>(0,a.jsxs)("div",{className:`chat-message ${e.author===V?.address?"self":"other"} ${e.pending?"pending":""}`,children:[(0,a.jsx)("img",{className:"msg-avatar",src:(0,A.generateAvatar)(e.author,e.author===V?.address?V.avatar:void 0),alt:"avatar"}),(0,a.jsxs)("div",{className:"msg-content",children:[(0,a.jsx)("span",{className:"message-author",children:e7(e.authorName,e.author)}),function(e){if(!e.attachment)return(0,a.jsx)("div",{className:"message-bubble",children:e.content});let t=e.attachment,s=ek[t.cid],i=s?.status;return(0,a.jsx)("div",{className:"message-bubble has-attachment",children:(0,a.jsx)(b.ChatAttachmentCard,{attachment:t,status:i,pending:e.pending,onOpen:e5})})}(e),(0,a.jsx)("span",{className:"message-time",children:new Date(e.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]})]},e.id||`${e.author}-${e.timestamp}`)),(0,a.jsx)("div",{ref:e$})]}),(0,a.jsxs)("div",{className:"chat-input-area",children:[(0,a.jsx)("input",{ref:eL,type:"file",accept:"image/*",className:"chat-file-input",onChange:e=>{e8(e.target.files),e.currentTarget.value=""}}),(0,a.jsx)("input",{ref:eD,type:"file",accept:"video/*",className:"chat-file-input",onChange:e=>{e8(e.target.files),e.currentTarget.value=""}}),(0,a.jsx)("input",{ref:eF,type:"file",className:"chat-file-input",onChange:e=>{e8(e.target.files),e.currentTarget.value=""}}),(0,a.jsx)("button",{type:"button",className:"btn btn-circle chat-tool-btn",onClick:()=>eL.current?.click(),disabled:!V||ej,title:"发送图片",children:(0,a.jsx)(f.Image,{size:18})}),(0,a.jsx)("button",{type:"button",className:"btn btn-circle chat-tool-btn",onClick:()=>eD.current?.click(),disabled:!V||ej,title:"发送视频",children:(0,a.jsx)(x.Film,{size:18})}),(0,a.jsx)("button",{type:"button",className:"btn btn-circle chat-tool-btn",onClick:()=>eF.current?.click(),disabled:!V||ej,title:"发送文件",children:ej?(0,a.jsx)(y.Loader,{size:18,className:"ui-spinner chat-attachment-spinner"}):(0,a.jsx)(g,{size:18})}),(0,a.jsx)("input",{type:"text",className:"input input-pill",placeholder:V?"输入消息...":"请先登录后发言",value:ee,disabled:!V,onChange:e=>ea(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ee.trim()&&e3()}}),(0,a.jsx)("button",{className:"btn btn-circle btn-primary send-btn",onClick:e3,disabled:!V||!ee.trim(),children:(0,a.jsx)(i.Send,{size:18})})]})]}):ae?(0,a.jsxs)("div",{className:"ui-empty-state chat-welcome",children:[(0,a.jsx)("div",{className:"ui-empty-icon ui-empty-icon-lg welcome-icon",children:(0,a.jsx)(y.Loader,{size:36,className:"ui-spinner"})}),(0,a.jsx)("h2",{className:"ui-empty-title",children:"正在打开频道"}),(0,a.jsx)("p",{className:"ui-empty-desc",children:"正在恢复聊天内容..."})]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"ui-empty-state chat-welcome",children:[(0,a.jsx)("div",{className:"ui-empty-icon ui-empty-icon-lg welcome-icon",children:(0,a.jsx)(s.MessageSquare,{size:36})}),(0,a.jsx)("h2",{className:"ui-empty-title",children:"选择频道"}),(0,a.jsx)("p",{className:"ui-empty-desc",children:"从左侧边栏选择一个频道开始聊天,或创建一个新频道"}),(0,a.jsx)(S.default,{label:"打开频道列表"})]})}),et&&(0,a.jsx)(w.InputModal,{title:"加入频道",placeholder:"频道ID:3-20 位字母、数字、_ 或 -",confirmText:"加入",validate:eX,onConfirm:e4,onClose:()=>es.close(),isLoading:er,loadingText:"加入中..."}),eo&&eh&&(0,a.jsx)(N.ConfirmModal,{title:"退出频道",message:`确定要退出频道 "${eh.name}" 吗?`,confirmText:ec?"退出中...":"退出",onConfirm:()=>e2(eh.name,void 0),onClose:()=>{eu.close(),em(null)},danger:!0}),eN&&(0,a.jsx)(C.ModalOverlay,{onClose:()=>eC(null),children:(0,a.jsxs)("div",{className:"confirm-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("h3",{children:"暂时没有在线种子"}),(0,a.jsx)("button",{type:"button",className:"btn btn-icon",onClick:()=>eC(null),"aria-label":"关闭",children:(0,a.jsx)(c.X,{size:18})})]}),(0,a.jsx)("p",{children:ek[eN.cid]?.message||"暂时没有发现在线种子。请确认分享者或其他下载者仍在线做种。"}),(0,a.jsxs)("div",{className:"modal-actions",children:[(0,a.jsx)("button",{type:"button",className:"btn btn-secondary",onClick:()=>eC(null),children:"取消"}),(0,a.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>eY(eN),disabled:ek[eN.cid]?.status==="checking",children:ek[eN.cid]?.status==="checking"?"检测中...":"再次检测"})]})]})}),eg&&(0,a.jsx)(k.default,{item:eg,isBackendReady:eP,getFileDownloadUrl:P.getFileDownloadUrl,onClose:()=>ev(null)}),ep&&G&&(0,a.jsx)("div",{className:"channel-detail-overlay",onClick:()=>ef(!1),children:(0,a.jsxs)("div",{className:"channel-detail-drawer",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"channel-detail-header",children:[(0,a.jsx)("h3",{children:"频道详情"}),(0,a.jsx)("button",{className:"btn btn-icon",onClick:()=>ef(!1),children:(0,a.jsx)(c.X,{size:18})})]}),(0,a.jsxs)("div",{className:"channel-detail-body",children:[(0,a.jsxs)("div",{className:"channel-detail-section channel-members-section",children:[(0,a.jsx)("div",{className:"channel-detail-label",children:(0,a.jsxs)("span",{children:["群成员 (",eS.length,")"]})}),eI&&0===eS.length?(0,a.jsx)("div",{className:"ui-empty-inline channel-members-empty",children:"正在读取成员..."}):0===eS.length?(0,a.jsx)("div",{className:"ui-empty-inline channel-members-empty",children:"暂无成员"}):(0,a.jsx)("div",{className:"channel-members-grid",children:eS.map(e=>(0,a.jsxs)("div",{className:"channel-member",children:[(0,a.jsx)("img",{className:"channel-member-avatar",src:(0,A.generateAvatar)(e.address,e.avatar),alt:"avatar"}),(0,a.jsx)("span",{className:"channel-member-name",children:e7(e.displayName,e.address)})]},e.address))})]}),!eR&&(0,a.jsx)("div",{className:"channel-detail-section",children:(0,a.jsxs)("label",{className:"setting-switch",children:[(0,a.jsx)("span",{children:"显示 #地址后四位"}),(0,a.jsx)("input",{type:"checkbox",checked:eA,onChange:e=>eE(e.target.checked)})]})}),!eR&&(0,a.jsxs)("div",{className:"channel-detail-section",children:[(0,a.jsxs)("div",{className:"channel-detail-label",children:[(0,a.jsx)(m,{size:14}),(0,a.jsx)("span",{children:"频道 ID"})]}),(0,a.jsx)("div",{className:"ui-meta-box channel-detail-value channel-detail-mono",children:G.name})]}),(0,a.jsxs)("div",{className:"channel-detail-section",children:[(0,a.jsxs)("div",{className:"channel-detail-label",children:[(0,a.jsx)(o.Edit2,{size:14}),(0,a.jsx)("span",{children:"备注名称"})]}),(0,a.jsx)("input",{type:"text",className:"input input-compact",placeholder:"输入备注名称",value:ex,onChange:e=>ey(e.target.value),onFocus:()=>ey(G.remark||""),onBlur:()=>e9(),onKeyDown:e=>{"Enter"===e.key&&e.currentTarget.blur()},maxLength:50})]}),(0,a.jsxs)("div",{className:"channel-detail-section",children:[(0,a.jsxs)("div",{className:"channel-detail-label",children:[(0,a.jsx)(h,{size:14}),(0,a.jsx)("span",{children:"创建时间"})]}),(0,a.jsx)("div",{className:"ui-meta-box channel-detail-value",children:G.createdAt?new Date(G.createdAt).toLocaleDateString("zh-CN"):"-"})]})]}),!eR&&(0,a.jsx)("div",{className:"channel-detail-footer",children:(0,a.jsx)("button",{className:"btn btn-danger btn-block",onClick:()=>{ef(!1),em(G),eu.open()},children:"退出频道"})})]})})]})}],41222)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95057,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var a={formatUrl:function(){return r},formatWithValidation:function(){return o},urlObjectKeys:function(){return c}};for(var i in a)Object.defineProperty(s,i,{enumerable:!0,get:a[i]});let n=e.r(90809)._(e.r(98183)),l=/https?|ftp|gopher|file/;function r(e){let{auth:t,hostname:s}=e,a=e.protocol||"",i=e.pathname||"",r=e.hash||"",c=e.query||"",o=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?o=t+e.host:s&&(o=t+(~s.indexOf(":")?`[${s}]`:s),e.port&&(o+=":"+e.port)),c&&"object"==typeof c&&(c=String(n.urlQueryToSearchParams(c)));let d=e.search||c&&`?${c}`||"";return a&&!a.endsWith(":")&&(a+=":"),e.slashes||(!a||l.test(a))&&!1!==o?(o="//"+(o||""),i&&"/"!==i[0]&&(i="/"+i)):o||(o=""),r&&"#"!==r[0]&&(r="#"+r),d&&"?"!==d[0]&&(d="?"+d),i=i.replace(/[?#]/g,encodeURIComponent),d=d.replace("#","%23"),`${a}${o}${i}${d}${r}`}let c=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function o(e){return r(e)}},18581,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"useMergedRef",{enumerable:!0,get:function(){return i}});let a=e.r(71645);function i(e,t){let s=(0,a.useRef)(null),i=(0,a.useRef)(null);return(0,a.useCallback)(a=>{if(null===a){let e=s.current;e&&(s.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(s.current=n(e,a)),t&&(i.current=n(t,a))},[e,t])}function n(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let s=e(t);return"function"==typeof s?s:()=>e(null)}}("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},73668,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"isLocalURL",{enumerable:!0,get:function(){return n}});let a=e.r(18967),i=e.r(52817);function n(e){if(!(0,a.isAbsoluteUrl)(e))return!0;try{let t=(0,a.getLocationOrigin)(),s=new URL(e,t);return s.origin===t&&(0,i.hasBasePath)(s.pathname)}catch(e){return!1}}},84508,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"errorOnce",{enumerable:!0,get:function(){return a}});let a=e=>{}},22016,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var a={default:function(){return f},useLinkStatus:function(){return b}};for(var i in a)Object.defineProperty(s,i,{enumerable:!0,get:a[i]});let n=e.r(90809),l=e.r(18050),r=n._(e.r(71645)),c=e.r(95057),o=e.r(8372),d=e.r(18581),h=e.r(18967),u=e.r(5550);e.r(33525);let m=e.r(88540),p=e.r(91949),x=e.r(73668),j=e.r(9396);function f(t){var s,a;let i,n,f,[b,v]=(0,r.useOptimistic)(p.IDLE_LINK_STATUS),N=(0,r.useRef)(null),{href:k,as:g,children:C,prefetch:M=null,passHref:w,replace:z,shallow:S,scroll:P,onClick:L,onMouseEnter:O,onTouchStart:F,legacyBehavior:T=!1,onNavigate:E,transitionTypes:A,ref:I,unstable_dynamicOnHover:B,...D}=t;i=C,T&&("string"==typeof i||"number"==typeof i)&&(i=(0,l.jsx)("a",{children:i}));let _=r.default.useContext(o.AppRouterContext),$=!1!==M,U=!1!==M?null===(a=M)||"auto"===a?j.FetchStrategy.PPR:j.FetchStrategy.Full:j.FetchStrategy.PPR,R="string"==typeof(s=g||k)?s:(0,c.formatUrl)(s);if(T){if(i?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});n=r.default.Children.only(i)}let q=T?n&&"object"==typeof n&&n.ref:I,K=r.default.useCallback(e=>(null!==_&&(N.current=(0,p.mountLinkInstance)(e,R,_,U,$,v)),()=>{N.current&&((0,p.unmountLinkForCurrentNavigation)(N.current),N.current=null),(0,p.unmountPrefetchableInstance)(e)}),[$,R,_,U,v]),H={ref:(0,d.useMergedRef)(K,q),onClick(t){T||"function"!=typeof L||L(t),T&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(t),!_||t.defaultPrevented||function(t,s,a,i,n,l,c){if("u">typeof window){let o,{nodeName:d}=t.currentTarget;if("A"===d.toUpperCase()&&((o=t.currentTarget.getAttribute("target"))&&"_self"!==o||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,x.isLocalURL)(s)){i&&(t.preventDefault(),location.replace(s));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:h}=e.r(99781);r.default.startTransition(()=>{h(s,i?"replace":"push",!1===n?m.ScrollBehavior.NoScroll:m.ScrollBehavior.Default,a.current,c)})}}(t,R,N,z,P,E,A)},onMouseEnter(e){T||"function"!=typeof O||O(e),T&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),_&&$&&(0,p.onNavigationIntent)(e.currentTarget,!0===B)},onTouchStart:function(e){T||"function"!=typeof F||F(e),T&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),_&&$&&(0,p.onNavigationIntent)(e.currentTarget,!0===B)}};return(0,h.isAbsoluteUrl)(R)?H.href=R:T&&!w&&("a"!==n.type||"href"in n.props)||(H.href=(0,u.addBasePath)(R)),f=T?r.default.cloneElement(n,H):(0,l.jsx)("a",{...D,...H,children:i}),(0,l.jsx)(y.Provider,{value:b,children:f})}e.r(84508);let y=(0,r.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,r.useContext)(y);("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},89664,e=>{"use strict";let t=(0,e.i(56420).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],89664)},31214,e=>{"use strict";let t=(0,e.i(56420).default)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);e.s(["Cloud",0,t],31214)},11241,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],11241)},96699,e=>{"use strict";let t=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,t],96699)},35965,e=>{"use strict";let t=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,t],35965)},27648,e=>{"use strict";var t=e.i(18050),s=e.i(93957),a=e.i(71192);e.s(["default",0,function({className:e=""}){let i=(0,a.useUserStore)(e=>e.identity),n=(0,a.useUserStore)(e=>e.openLoginModal),l=(0,a.useUserStore)(e=>e.logoutUser);return(0,t.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,t.jsxs)("div",{className:"user-info",children:[(0,t.jsx)("img",{className:"user-avatar-img",src:(0,s.generateAvatar)(i?.address,i?.avatar),alt:"avatar"}),(0,t.jsx)("span",{className:"user-name",title:i?.address,children:i?.displayName||"未登录"})]}),i?(0,t.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:l,children:"退出"}):(0,t.jsx)("button",{className:"btn btn-primary login-btn",onClick:n,children:"登录"})]})}])},8734,e=>{"use strict";let t=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],8734)},66627,e=>{"use strict";let t=(0,e.i(56420).default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);e.s(["Wifi",0,t],66627)},68590,58501,e=>{"use strict";let t=(0,e.i(56420).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,t],68590);var s=e.i(18050);e.s(["LogoIcon",0,function({size:e=24}){return(0,s.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.4"}),(0,s.jsx)("rect",{x:"14",y:"2",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.7"}),(0,s.jsx)("rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",fill:"var(--accent)",opacity:"0.7"}),(0,s.jsx)("rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",fill:"var(--accent)"})]})}],58501)},56691,e=>{"use strict";var t=e.i(18050),s=e.i(22016);let a=[{href:"/",label:"关于"},{href:"/ping/",label:"网络"},{href:"https://github.com/most-people/most",label:"GitHub",external:!0}];e.s(["Footer",0,function(){return(0,t.jsx)("footer",{className:"mkt-footer",children:(0,t.jsx)("div",{className:"mkt-container",children:(0,t.jsxs)("div",{className:"mkt-footer-inner",children:[(0,t.jsx)("div",{className:"mkt-footer-links",children:a.map(e=>(0,t.jsx)(s.default,{href:e.href,...e.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:e.label},e.href))}),(0,t.jsxs)("span",{className:"mkt-footer-copy",children:["© ",new Date().getFullYear()," MOST PEOPLE · MIT License"]})]})})})}])},42724,e=>{"use strict";var t=e.i(18050),s=e.i(71645),a=e.i(22016),i=e.i(62368),n=e.i(96699),l=e.i(35965),r=e.i(58501);e.s(["Nav",0,function(){let[e,c]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=localStorage.getItem("theme"),t=window.matchMedia("(prefers-color-scheme: dark)").matches;("dark"===e||!e&&t)&&c(!0)},[]),(0,s.useEffect)(()=>{document.documentElement.setAttribute("data-theme",e?"dark":"light"),localStorage.setItem("theme",e?"dark":"light")},[e]),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("nav",{className:"mkt-nav",children:(0,t.jsxs)("div",{className:"mkt-nav-inner",children:[(0,t.jsxs)(a.default,{href:"/",className:"mkt-nav-logo",children:[(0,t.jsx)(r.LogoIcon,{}),"MOST PEOPLE"]}),(0,t.jsxs)("div",{className:"mkt-nav-cta",children:[(0,t.jsx)("button",{className:"mkt-theme-toggle",onClick:()=>c(!e),"aria-label":"切换主题",children:e?(0,t.jsx)(l.Sun,{size:16}):(0,t.jsx)(n.Moon,{size:16})}),(0,t.jsxs)(a.default,{href:"/download/",className:"btn btn-primary mkt-nav-preview",children:[(0,t.jsx)(i.Download,{size:16}),"下载客户端"]}),(0,t.jsx)(a.default,{href:"/app/",className:"btn btn-secondary",children:"打开 Web"})]})]})})})}])},58072,e=>{"use strict";let t=(0,e.i(56420).default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["Code",0,t],58072)},16327,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,t],16327)},16306,23165,24851,64830,16546,e=>{"use strict";let t=(0,e.i(56420).default)("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"}]]);e.s(["ShieldAlert",0,t],16306);var s=e.i(18050),a=e.i(71645),i=e.i(89664),n=e.i(8734);function l({text:e,label:t,copiedLabel:r="已复制",className:c="btn btn-icon",iconSize:o=14}){let[d,h]=(0,a.useState)(!1);async function u(){try{await navigator.clipboard.writeText(e),h(!0),setTimeout(()=>h(!1),1500)}catch{}}return(0,s.jsxs)("button",{type:"button",className:c,onClick:u,title:d?r:t||"复制",children:[d?(0,s.jsx)(i.Check,{size:o}):(0,s.jsx)(n.Copy,{size:o}),t?d?r:t:null]})}e.s(["CopyButton",0,l],23165),e.s(["EmptyState",0,function({icon:e,message:t,className:a="empty-state glass"}){return(0,s.jsxs)("div",{className:a,children:[(0,s.jsx)("div",{className:"empty-state-icon",children:e}),(0,s.jsx)("p",{children:t})]})}],24851),e.s(["KeyCard",0,function({title:e,icon:t,children:a,accent:i=!1}){return(0,s.jsxs)("div",{className:`web3-key-card ${i?"accent":""}`,children:[(0,s.jsxs)("div",{className:"web3-key-card-header",children:[(0,s.jsx)("span",{className:"web3-key-card-icon",children:t}),(0,s.jsx)("span",{className:"web3-key-card-title",children:e})]}),(0,s.jsx)("div",{className:"web3-key-card-body",children:a})]})}],64830);var r=e.i(62368);e.s(["PemBlock",0,function({label:e,pem:t,filename:a}){return(0,s.jsxs)("div",{className:"web3-pem-block",children:[(0,s.jsxs)("div",{className:"web3-pem-header",children:[(0,s.jsx)("span",{className:"web3-pem-label",children:e}),(0,s.jsxs)("div",{className:"web3-pem-actions",children:[(0,s.jsx)(l,{text:t,label:"复制",className:"btn btn-sm",iconSize:14}),(0,s.jsxs)("button",{type:"button",className:"btn btn-sm btn-primary",onClick:function(){let e=new Blob([t],{type:"text/plain"}),s=URL.createObjectURL(e),i=document.createElement("a");i.href=s,i.download=a,i.click(),URL.revokeObjectURL(s)},title:"下载",children:[(0,s.jsx)(r.Download,{size:14}),"下载"]})]})]}),(0,s.jsx)("textarea",{className:"textarea mono",value:t,readOnly:!0,rows:6})]})}],16546)},62368,e=>{"use strict";let t=(0,e.i(56420).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,t],62368)},66595,e=>{"use strict";let t=(0,e.i(56420).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,t],66595)},51921,e=>{"use strict";let t=(0,e.i(56420).default)("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);e.s(["Music",0,t],51921)},80796,e=>{"use strict";let t=(0,e.i(56420).default)("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);e.s(["Film",0,t],80796)},15170,e=>{"use strict";let t=(0,e.i(56420).default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);e.s(["Image",0,t],15170)},12796,e=>{"use strict";let t=(0,e.i(56420).default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);e.s(["Loader",0,t],12796)},6933,e=>{"use strict";e.s(["getFileSubtype",0,function(e){let t=String(e||"").split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","heic","heif"].includes(t)?"image":["mp4","webm","mov","avi","mkv","flv","wmv","m4v","mpeg","3gp"].includes(t)?"video":["mp3","wav","ogg","flac","aac","m4a","wma","opus"].includes(t)?"audio":["txt","md","js","ts","jsx","tsx","css","scss","less","json","xml","html","htm","yaml","yml","toml","ini","cfg","conf","log","sh","bash","py","rb","go","rs","java","c","cpp","h","hpp","cs","php","sql","graphql","env","gitignore","dockerfile","readme"].includes(t)?"text":"file"}])},26091,e=>{"use strict";let t=(0,e.i(56420).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,t],26091)},77071,e=>{"use strict";let t=(0,e.i(56420).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],77071)},99847,e=>{"use strict";let t=(0,e.i(56420).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],99847)},77685,e=>{"use strict";var t=e.i(18050),s=e.i(99847),a=e.i(62368),i=e.i(72382),n=e.i(26091),l=e.i(80796),r=e.i(15170),c=e.i(12796),o=e.i(51921);function d(e){let t=String(e||"").split("/");return t[t.length-1]||e}e.s(["ChatAttachmentCard",0,function({attachment:e,status:h="idle",pending:u=!1,onOpen:m}){var p,x;let j="checking"===h,f=["ui-file-action","chat-attachment-action","error"===h?"error":"","available"===h?"available":""].filter(Boolean).join(" "),y=((p=e.size)&&!(p<=0)?p<1024?`${p} B`:p<1048576?`${(p/1024).toFixed(1)} KB`:p<0x40000000?`${(p/1048576).toFixed(1)} MB`:`${(p/0x40000000).toFixed(2)} GB`:"")||"MostBox 文件";return(0,t.jsxs)("button",{type:"button",className:"ui-file-card chat-attachment-card",onClick:()=>m?.(e),disabled:u||j,title:e.link,children:[(0,t.jsx)("span",{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:j?(0,t.jsx)(c.Loader,{size:20,className:"ui-spinner chat-attachment-spinner"}):"image"===(x=e.kind)?(0,t.jsx)(r.Image,{size:20}):"video"===x?(0,t.jsx)(l.Film,{size:20}):"audio"===x?(0,t.jsx)(o.Music,{size:20}):(0,t.jsx)(n.FileText,{size:20})}),(0,t.jsxs)("span",{className:"ui-file-info chat-attachment-info",children:[(0,t.jsx)("span",{className:"ui-file-name chat-attachment-name",children:d(e.fileName)}),(0,t.jsx)("span",{className:"ui-file-meta chat-attachment-meta",children:u?"发送中...":y})]}),(0,t.jsx)("span",{className:f,children:j?"检测中":"available"===h?(0,t.jsx)(i.Eye,{size:16}):"error"===h?(0,t.jsx)(s.AlertCircle,{size:17}):(0,t.jsx)(a.Download,{size:16})})]})},"getAttachmentBaseFileName",0,d])},26067,e=>{"use strict";let t=(0,e.i(56420).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,t],26067)},25981,67927,e=>{"use strict";var t=e.i(56420);let s=(0,t.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,s],25981);let a=(0,t.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,a],67927)},10818,61507,40616,e=>{"use strict";let t=(0,e.i(56420).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,t],10818);var s=e.i(18050),a=e.i(26091),i=e.i(80796),n=e.i(26067),l=e.i(15170),r=e.i(51921),c=e.i(6933);function o(e){let t=e.lastIndexOf("/");return -1===t?{folder:"",name:e}:{folder:e.substring(0,t),name:e.substring(t+1)}}e.s(["FileCard",0,function({file:e,isSelected:t,onSelect:n,onPreview:d}){let h=(0,c.getFileSubtype)(e.fileName),u=(0,s.jsx)(a.FileText,{size:24,color:"#fff"});return"image"===h?u=(0,s.jsx)(l.Image,{size:24,color:"#fff"}):"video"===h?u=(0,s.jsx)(i.Film,{size:24,color:"#fff"}):"audio"===h&&(u=(0,s.jsx)(r.Music,{size:24,color:"#fff"})),(0,s.jsxs)("div",{"data-id":e.cid,onClick:()=>n(e.cid),onDoubleClick:()=>d(e),className:`card ${t?"selected":""}`,children:[(0,s.jsx)("div",{className:`card-icon ${e.starred?"starred":"file"}`,children:u}),(0,s.jsx)("p",{className:"card-name",children:o(e.fileName).name})]})},"FolderCard",0,function({folder:e,onClick:t}){return(0,s.jsxs)("div",{onClick:t,className:"card",children:[(0,s.jsx)("div",{className:"card-icon folder",children:(0,s.jsx)(n.Folder,{size:28,color:"#fff"})}),(0,s.jsx)("p",{className:"card-name",children:e.name})]})},"parseAppFileName",0,o],61507);var d=e.i(71645),h=e.i(63676);e.i(4121);var u=e.i(57667);e.s(["MoveModal",0,function({items:e,allFolders:t,currentPath:a,onMove:i,onClose:l}){let[r,c]=(0,d.useState)(""),[o,m]=(0,d.useState)(a),p=r?[{path:"",name:"全部内容"},...r.split("/").filter(Boolean).map((e,t,s)=>({path:s.slice(0,t+1).join("/"),name:e}))]:[],x=t.filter(e=>{if(""===r)return!e.path.includes("/");let t=r+"/";return!!e.path.startsWith(t)&&!e.path.substring(t.length).includes("/")});return(0,s.jsx)(u.ModalOverlay,{onClose:l,children:(0,s.jsxs)("div",{className:"move-modal",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"modal-header",children:[(0,s.jsx)("h3",{children:"移动到"}),(0,s.jsx)("button",{type:"button",onClick:l,className:"btn btn-icon",children:(0,s.jsx)(h.X,{size:18})})]}),(0,s.jsxs)("p",{className:"move-modal-desc",children:["已选 ",e.length," 个项目"]}),(0,s.jsx)("div",{className:"move-new-folder",children:(0,s.jsx)("input",{type:"text",className:"input",value:o,onChange:e=>m(e.target.value),placeholder:"输入路径创建嵌套文件夹"})}),(0,s.jsx)("p",{className:"move-modal-hint",children:"如 图片/壁纸"}),(0,s.jsx)("div",{className:"move-breadcrumb",children:p.map((e,t)=>(0,s.jsxs)(d.default.Fragment,{children:[t>0&&(0,s.jsx)("span",{className:"breadcrumb-separator",children:"/"}),(0,s.jsx)("button",{type:"button",onClick:()=>{c(e.path),m(e.path)},className:`move-breadcrumb-btn ${r===e.path&&!o?"active":""}`,children:e.name})]},e.path))}),(0,s.jsxs)("div",{className:"move-folder-list",children:[0===x.length&&(0,s.jsx)("p",{className:"move-modal-empty",children:"该目录下没有子文件夹"}),x.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>c(e.path),className:`move-folder-item ${r===e.path&&!o?"selected":""}`,children:[(0,s.jsx)(n.Folder,{size:16}),(0,s.jsx)("span",{children:e.name})]},e.path))]}),(0,s.jsxs)("div",{className:"modal-actions",children:[(0,s.jsx)("button",{type:"button",onClick:l,className:"btn btn-secondary",children:"取消"}),(0,s.jsx)("button",{type:"button",onClick:function(){i(r||o.trim())},className:"btn btn-primary",children:"移动"})]})]})})}],40616)},53138,51757,e=>{"use strict";var t=e.i(56420);let s=(0,t.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["AlertTriangle",0,s],53138);let a=(0,t.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["CheckCircle2",0,a],51757)},32391,60923,86512,e=>{"use strict";var t=e.i(18050),s=e.i(71645),a=e.i(53138),i=e.i(51757),n=e.i(31214),l=e.i(62368);let r=(0,e.i(56420).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var c=e.i(25981),o=e.i(71192);e.s(["NoteMoreMenu",0,function({sync:e}){let d=(0,s.useRef)(null),[h,u]=(0,s.useState)(!1),m=(0,o.useUserStore)(e=>e.wallet),p=null!==e.action;async function x(e){u(!1),await e()}return(0,s.useEffect)(()=>{if(h)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){d.current?.contains(e.target)||u(!1)}},[h]),(0,t.jsxs)("div",{className:"note-more",ref:d,children:[(0,t.jsx)("button",{className:"btn btn-icon note-more-trigger",onClick:()=>u(e=>!e),title:"更多","aria-label":"更多",children:(0,t.jsx)(r,{size:16})}),h&&(0,t.jsxs)("div",{className:"note-more-menu",children:[(0,t.jsxs)("div",{className:`ui-notice note-sync-status ${e.hasConflict?"warning conflict":""}`,children:[(0,t.jsx)("span",{className:`ui-icon-tile note-sync-status-icon ${e.hasConflict?"warning":""}`,children:e.hasConflict?(0,t.jsx)(a.AlertTriangle,{size:16}):"synced"===e.status?(0,t.jsx)(i.CheckCircle2,{size:16}):(0,t.jsx)(n.Cloud,{size:16})}),(0,t.jsxs)("span",{children:[(0,t.jsx)("strong",{children:"云同步"}),(0,t.jsx)("small",{children:e.statusLabel})]})]}),(0,t.jsxs)("button",{className:"note-more-item",onClick:()=>x(e.exportLocalBackup),disabled:!m||p,children:[(0,t.jsx)(c.Upload,{size:16}),"本地导出"]}),(0,t.jsxs)("button",{className:"note-more-item",onClick:()=>x(e.importLocalBackup),disabled:!m||p,children:[(0,t.jsx)(l.Download,{size:16}),"本地导入"]})]})]})}],32391);var d=e.i(16327),h=e.i(67927),u=e.i(26067),m=e.i(63676);e.i(4121);var p=e.i(57667),x=e.i(3789);e.s(["NoteMoveModal",0,function({target:e,directories:a,onMove:i,onClose:n}){let l=(0,x.normalizeNotePath)(e.path||""),r="directory"===e.type?(0,x.normalizeNotePath)(e.path?`${e.path}/${e.name}`:e.name):(0,x.getNoteFullPath)(e),c=a.filter(t=>"directory"!==e.type||t.path!==r&&!t.path.startsWith(`${r}/`)),[o,j]=(0,s.useState)(l),[f,y]=(0,s.useState)(""),[b,v]=(0,s.useState)(new Set),N=(0,x.normalizeNotePath)(f),k=f.trim()?N:o,g=(0,x.normalizeNotePath)(k)===l,C=new Map;for(let e of c){let t=C.get(e.parentPath)||[];t.push(e),C.set(e.parentPath,t)}let M=c.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split("/").filter(Boolean);return t.every((e,s)=>b.has(t.slice(0,s+1).join("/")))}),w=[{label:"全部笔记",path:""},...o.split("/").filter(Boolean).map((e,t,s)=>({label:e,path:s.slice(0,t+1).join("/")}))];function z(e){j((0,x.normalizeNotePath)(e)),y("")}return(0,t.jsx)(p.ModalOverlay,{onClose:n,children:(0,t.jsxs)("div",{className:"note-move-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"modal-header",children:[(0,t.jsx)("h3",{children:"移动笔记"}),(0,t.jsx)("button",{className:"btn btn-icon",onClick:n,children:(0,t.jsx)(m.X,{size:18})})]}),(0,t.jsxs)("div",{className:"note-move-target",children:[(0,t.jsx)("span",{children:"正在移动"}),(0,t.jsx)("strong",{children:e.name})]}),(0,t.jsx)("div",{className:"note-move-path",children:w.map((e,a)=>(0,t.jsxs)(s.default.Fragment,{children:[a>0&&(0,t.jsx)("span",{children:"/"}),(0,t.jsx)("button",{type:"button",onClick:()=>z(e.path),children:e.label})]},e.path||"root"))}),(0,t.jsxs)("div",{className:"note-move-folder-list",children:[(0,t.jsxs)("button",{type:"button",className:`note-move-folder-item ${""===o?"selected":""}`,onClick:()=>z(""),children:[(0,t.jsx)("span",{className:"note-move-folder-spacer"}),(0,t.jsx)(u.Folder,{className:"note-move-folder-icon",size:16}),(0,t.jsx)("span",{children:"全部笔记"})]}),0===c.length?(0,t.jsx)("p",{className:"note-move-empty",children:"还没有可选文件夹"}):M.map(e=>{let s=C.has(e.path),a=b.has(e.path);return(0,t.jsxs)("button",{type:"button",className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${o===e.path?"selected":""}`,onClick:()=>{var t;z(t=e.path),C.has(t)&&v(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},children:[s?a?(0,t.jsx)(d.ChevronDown,{className:"note-move-expander",size:14}):(0,t.jsx)(h.ChevronRight,{className:"note-move-expander",size:14}):(0,t.jsx)("span",{className:"note-move-folder-spacer"}),(0,t.jsx)(u.Folder,{className:"note-move-folder-icon",size:16}),(0,t.jsx)("span",{children:e.name}),e.parentPath&&(0,t.jsx)("small",{children:e.parentPath})]},e.path)})]}),(0,t.jsx)("input",{className:"input input-compact",value:f,onChange:e=>y(e.target.value),placeholder:"或输入新目录路径,如 文章/摘录"}),(0,t.jsxs)("div",{className:"note-move-destination",children:["目标位置:",k||"全部笔记"]}),(0,t.jsxs)("div",{className:"modal-actions",children:[(0,t.jsx)("button",{className:"btn btn-secondary",onClick:n,children:"取消"}),(0,t.jsx)("button",{className:"btn btn-primary",onClick:function(){g||i(k)},disabled:g,children:"移动"})]})]})})}],60923);var j=e.i(11241),f=e.i(27648);e.s(["NoteSidebar",0,function({children:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>{window.location.href="/"},children:[(0,t.jsx)(j.ArrowLeft,{size:18}),(0,t.jsx)("h1",{children:"MOST PEOPLE"})]}),e,(0,t.jsx)(f.default,{})]})}],86512)},38999,e=>{"use strict";var t=e.i(18050),s=e.i(71645),a=e.i(53138),i=e.i(11241),n=e.i(56420);let l=(0,n.default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);var r=e.i(51757),c=e.i(31214),o=e.i(58072),d=e.i(72382),h=e.i(26091),u=e.i(26067),m=e.i(10818);let p=(0,n.default)("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"}]]);var x=e.i(68590),j=e.i(96699);let f=(0,n.default)("mouse-pointer-click",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]),y=(0,n.default)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);var b=e.i(77071),v=e.i(66595),N=e.i(41220),k=e.i(16306);let g=(0,n.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var C=e.i(35965);let M=(0,n.default)("type",[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]);var w=e.i(66627),z=e.i(3593),S=e.i(71192),P=e.i(23165),L=e.i(77685),O=e.i(19767),F=e.i(24851),T=e.i(56691),E=e.i(61507),A=e.i(58501),I=e.i(64830),B=e.i(40616),D=e.i(42724),_=e.i(32391),$=e.i(60923),U=e.i(86512),R=e.i(16546);e.i(4121);var q=e.i(88361),K=e.i(47910),H=e.i(57667),V=e.i(80809),W=e.i(79952);let G={name:"产品计划.md",cid:"bafy-demo-note",path:"产品/计划",content:"# MostBox Demo",size:2048,type:"file",created_at:17645472e5,updated_at:17645472e5},X=[{path:"产品",name:"产品",parentPath:"",depth:0},{path:"产品/计划",name:"计划",parentPath:"产品",depth:1},{path:"产品/摘录",name:"摘录",parentPath:"产品",depth:1},{path:"灵感",name:"灵感",parentPath:"",depth:0}];function Y({id:e,icon:s,eyebrow:a,title:i,description:n,children:l}){return(0,t.jsxs)("section",{className:"demo-section",id:e,children:[(0,t.jsxs)("div",{className:"demo-section-heading",children:[(0,t.jsx)("div",{className:"demo-section-icon",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"demo-eyebrow",children:a}),(0,t.jsx)("h2",{children:i}),(0,t.jsx)("p",{children:n})]})]}),l]})}function Z({title:e,children:s,className:a=""}){let i=a?`demo-surface ${a}`:"demo-surface";return(0,t.jsxs)("article",{className:i,children:[(0,t.jsx)("h3",{children:e}),s]})}e.s(["default",0,function(){let[e,n]=(0,s.useState)("r2"),[J,Q]=(0,s.useState)(!1),[ee,et]=(0,s.useState)(!1),[es,ea]=(0,s.useState)(!1),[ei,en]=(0,s.useState)(!1),[el,er]=(0,s.useState)(!1),[ec,eo]=(0,s.useState)([]),ed=(0,z.useAppStore)(e=>e.isDarkMode),eh=(0,z.useAppStore)(e=>e.setIsDarkMode),eu=(0,z.useAppStore)(e=>e.openConnectModal),em=(0,S.useUserStore)(e=>e.openLoginModal);function ep(e,t){eo(s=>[...s.slice(-4),{id:Date.now(),type:e,message:t}])}return(0,t.jsxs)("main",{className:"demo-page",children:[(0,t.jsxs)("header",{className:"demo-topbar",children:[(0,t.jsxs)("a",{className:"mkt-nav-logo",href:"/",children:[(0,t.jsx)(i.ArrowLeft,{size:18}),(0,t.jsx)("span",{children:"MOST PEOPLE"})]}),(0,t.jsx)("button",{type:"button",className:"mkt-theme-toggle",onClick:()=>eh(!ed),"aria-label":"切换主题",title:"切换主题",children:ed?(0,t.jsx)(C.Sun,{size:16}):(0,t.jsx)(j.Moon,{size:16})})]}),(0,t.jsx)("section",{className:"demo-hero",children:(0,t.jsxs)("div",{className:"demo-hero-copy",children:[(0,t.jsx)("p",{className:"demo-eyebrow",children:"Shared Component Library"}),(0,t.jsx)("h1",{children:"共享组件检查页"}),(0,t.jsx)("p",{children:"把基础样式、全局 UI 片段和已迁入 components 的共享组件按用途集中展示, 方便以后改 UI 时直接从这里检查联动效果。"})]})}),(0,t.jsx)(Y,{id:"foundation",icon:(0,t.jsx)(y,{size:18}),eyebrow:"Foundation",title:"基础样式",description:"全局按钮、输入框、开关、分段控件和状态反馈。",children:(0,t.jsxs)("div",{className:"demo-grid demo-grid-two",children:[(0,t.jsx)(Z,{title:"默认按钮",children:(0,t.jsxs)("div",{className:"demo-control-row",children:[(0,t.jsxs)("button",{className:"btn btn-primary",children:[(0,t.jsx)(r.CheckCircle2,{size:16}),"Primary"]}),(0,t.jsxs)("button",{className:"btn btn-secondary",children:[(0,t.jsx)(m.Info,{size:16}),"Secondary"]}),(0,t.jsxs)("button",{className:"btn btn-ghost",children:[(0,t.jsx)(g,{size:16}),"Ghost"]}),(0,t.jsxs)("button",{className:"btn btn-danger",children:[(0,t.jsx)(k.ShieldAlert,{size:16}),"Danger"]}),(0,t.jsx)("button",{className:"btn btn-primary",disabled:!0,children:"Disabled"}),(0,t.jsxs)("button",{type:"button",className:"ui-action-dashed",children:[(0,t.jsx)(b.Plus,{size:16}),"Dashed"]})]})}),(0,t.jsx)(Z,{title:"小号按钮",children:(0,t.jsxs)("div",{className:"demo-control-row",children:[(0,t.jsxs)("button",{className:"btn btn-sm btn-primary",children:[(0,t.jsx)(r.CheckCircle2,{size:14}),"Primary"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-secondary",children:[(0,t.jsx)(m.Info,{size:14}),"Secondary"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-ghost",children:[(0,t.jsx)(g,{size:14}),"Ghost"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-danger",children:[(0,t.jsx)(k.ShieldAlert,{size:14}),"Danger"]}),(0,t.jsx)("button",{className:"btn btn-sm btn-icon","aria-label":"小号图标按钮",children:(0,t.jsx)(l,{size:14})}),(0,t.jsx)("button",{className:"btn btn-sm btn-primary",disabled:!0,children:"Disabled"}),(0,t.jsxs)("button",{type:"button",className:"ui-action-dashed ui-action-dashed-sm",children:[(0,t.jsx)(b.Plus,{size:14}),"Dashed"]})]})}),(0,t.jsx)(Z,{title:"输入控件",children:(0,t.jsxs)("div",{className:"demo-input-grid",children:[(0,t.jsx)("input",{className:"input",value:"标准输入框",readOnly:!0}),(0,t.jsx)("input",{className:"input input-compact",value:"紧凑输入框",readOnly:!0}),(0,t.jsx)("input",{className:"input input-pill",value:"胶囊输入框",readOnly:!0}),(0,t.jsx)("textarea",{className:"textarea",value:"多行输入框",rows:3,readOnly:!0}),(0,t.jsxs)("div",{className:"ui-input-control",children:[(0,t.jsx)(v.Search,{className:"ui-input-icon",size:15}),(0,t.jsx)("input",{className:"input input-compact",placeholder:"带图标搜索",readOnly:!0})]})]})}),(0,t.jsx)(Z,{title:"开关、分段与徽标",children:(0,t.jsxs)("div",{className:"demo-stack",children:[(0,t.jsxs)("label",{className:"setting-switch",children:[(0,t.jsx)("span",{children:"显示 #地址后四位"}),(0,t.jsx)("input",{type:"checkbox",defaultChecked:!0})]}),(0,t.jsxs)("label",{className:"setting-switch",children:[(0,t.jsx)("span",{children:"自动同步"}),(0,t.jsx)("input",{type:"checkbox"})]}),(0,t.jsxs)("div",{className:"ui-segmented-control download-source-tabs demo-download-source-tabs",role:"tablist","aria-label":"下载来源",children:[(0,t.jsxs)("button",{type:"button",className:"r2"===e?"ui-segmented-option download-source-tab is-active":"ui-segmented-option download-source-tab",role:"tab","aria-selected":"r2"===e,onClick:()=>n("r2"),children:[(0,t.jsx)(c.Cloud,{size:15}),"R2"]}),(0,t.jsxs)("button",{type:"button",className:"github"===e?"ui-segmented-option download-source-tab is-active":"ui-segmented-option download-source-tab",role:"tab","aria-selected":"github"===e,onClick:()=>n("github"),children:[(0,t.jsx)(o.Code,{size:15}),"GitHub"]})]}),(0,t.jsxs)("div",{className:"demo-control-row",children:[(0,t.jsxs)("span",{className:"ui-badge success",children:[(0,t.jsx)("span",{className:"status-dot success"}),"已连接"]}),(0,t.jsxs)("span",{className:"ui-badge warning",children:[(0,t.jsx)("span",{className:"status-dot warning"}),"检测中"]}),(0,t.jsxs)("span",{className:"ui-badge danger",children:[(0,t.jsx)("span",{className:"status-dot danger"}),"不可用"]}),(0,t.jsxs)("span",{className:"ui-badge info",children:[(0,t.jsx)("span",{className:"status-dot info"}),"已就绪"]})]})]})})]})}),(0,t.jsx)(Y,{id:"brand",icon:(0,t.jsx)(M,{size:18}),eyebrow:"Brand",title:"品牌与导航",description:"Logo、营销导航和页脚放在独立预览面板里,避免和 demo 容器互相挤压。",children:(0,t.jsxs)("div",{className:"demo-grid demo-brand-grid",children:[(0,t.jsx)(Z,{title:"LogoIcon",children:(0,t.jsxs)("div",{className:"demo-logo-row",children:[(0,t.jsx)(A.LogoIcon,{size:24}),(0,t.jsx)(A.LogoIcon,{size:36}),(0,t.jsx)(A.LogoIcon,{size:52})]})}),(0,t.jsx)(Z,{title:"Nav",className:"demo-nav-preview",children:(0,t.jsx)(D.Nav,{})}),(0,t.jsx)(Z,{title:"Footer",className:"demo-footer-preview",children:(0,t.jsx)(T.Footer,{})})]})}),(0,t.jsx)(Y,{id:"feedback",icon:(0,t.jsx)(f,{size:18}),eyebrow:"Feedback",title:"弹窗与反馈",description:"弹窗、Toast、连接和登录入口都使用按钮触发,页面加载时不主动打开。",children:(0,t.jsx)(Z,{title:"触发式组件",children:(0,t.jsxs)("div",{className:"demo-control-row",children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>Q(!0),children:[(0,t.jsx)(d.Eye,{size:16}),"ModalOverlay"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>et(!0),children:[(0,t.jsx)(k.ShieldAlert,{size:16}),"ConfirmModal"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>ea(!0),children:[(0,t.jsx)(M,{size:16}),"InputModal"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:()=>ep("info","这是一条本地 demo toast"),children:[(0,t.jsx)(l,{size:16}),"Toast"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:eu,children:[(0,t.jsx)(N.Server,{size:16}),"ConnectModal"]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary",onClick:em,children:[(0,t.jsx)(p,{size:16}),"UserLoginModal"]})]})})}),(0,t.jsx)(Y,{id:"patterns",icon:(0,t.jsx)(g,{size:18}),eyebrow:"Patterns",title:"全局样式片段",description:"页面里反复复用的全局 class 和组合形态。",children:(0,t.jsxs)("div",{className:"demo-grid demo-grid-two",children:[(0,t.jsx)(Z,{title:"文件行",children:(0,t.jsxs)("div",{className:"demo-stack",children:[(0,t.jsx)(L.ChatAttachmentCard,{attachment:{kind:"text",cid:"bafy-demo-text",fileName:"demo-preview.txt",link:"most://bafy-demo-text?filename=demo-preview.txt",size:12697},status:"available"}),(0,t.jsx)(L.ChatAttachmentCard,{attachment:{kind:"video",cid:"bafy-demo-video",fileName:"movie-sample.mp4",link:"most://bafy-demo-video?filename=movie-sample.mp4",size:0},status:"checking"})]})}),(0,t.jsx)(Z,{title:"空状态",children:(0,t.jsxs)("div",{className:"ui-empty-state demo-empty-preview",children:[(0,t.jsx)("div",{className:"ui-empty-icon",children:(0,t.jsx)(x.MessageSquare,{size:28})}),(0,t.jsx)("h4",{className:"ui-empty-title",children:"暂无消息"}),(0,t.jsx)("p",{className:"ui-empty-desc",children:"开始聊天或选择一个频道。"})]})}),(0,t.jsx)(Z,{title:"列表与元信息",children:(0,t.jsxs)("div",{className:"demo-stack",children:[(0,t.jsx)("article",{className:"ui-list-item active",children:(0,t.jsxs)("button",{type:"button",className:"ui-list-item-main",children:[(0,t.jsx)("span",{className:"ui-list-icon",children:(0,t.jsx)(h.FileText,{size:18})}),(0,t.jsxs)("span",{className:"ui-list-copy",children:[(0,t.jsx)("span",{className:"ui-list-title",children:"产品计划.md"}),(0,t.jsx)("span",{className:"ui-list-desc",children:"CID、下载和做种说明"})]}),(0,t.jsx)("span",{className:"ui-list-meta",children:"今天"})]})}),(0,t.jsx)("article",{className:"ui-list-item",children:(0,t.jsxs)("button",{type:"button",className:"ui-list-item-main",children:[(0,t.jsx)("span",{className:"ui-list-icon warning",children:(0,t.jsx)(u.Folder,{size:18})}),(0,t.jsxs)("span",{className:"ui-list-copy",children:[(0,t.jsx)("span",{className:"ui-list-title",children:"归档"}),(0,t.jsx)("span",{className:"ui-list-desc",children:"文件夹"})]}),(0,t.jsx)("span",{className:"ui-list-meta",children:"12 篇"})]})}),(0,t.jsx)("div",{className:"ui-meta-box",children:"频道 ID:general"}),(0,t.jsx)("div",{className:"ui-empty-inline",children:"暂无成员"})]})}),(0,t.jsx)(Z,{title:"通知、标签与代码",children:(0,t.jsxs)("div",{className:"demo-stack",children:[(0,t.jsxs)("p",{className:"ui-notice success",children:[(0,t.jsx)(r.CheckCircle2,{size:14}),"同步完成,所有内容已更新。"]}),(0,t.jsxs)("p",{className:"ui-notice warning",children:[(0,t.jsx)(a.AlertTriangle,{size:14}),"节点正在检测中,请稍候。"]}),(0,t.jsxs)("ul",{className:"ui-chip-list demo-chip-preview",children:[(0,t.jsx)("li",{className:"ui-chip",children:"MostBox"}),(0,t.jsx)("li",{className:"ui-chip",children:"P2P"}),(0,t.jsx)("li",{className:"ui-chip",children:"CID"}),(0,t.jsx)("li",{className:"ui-chip",children:"Hyperdrive"})]}),(0,t.jsx)("code",{className:"ui-code-box",children:"most://bafy-demo-cid?filename=demo.txt"}),(0,t.jsxs)("div",{className:"ui-peer-info demo-peer-info",children:[(0,t.jsx)("span",{className:"peer-dot"}),(0,t.jsx)("span",{className:"peer-id",children:"12D3KooW...demo"}),(0,t.jsx)(w.Wifi,{size:14})]})]})})]})}),(0,t.jsx)(Y,{id:"shared",icon:(0,t.jsx)(h.FileText,{size:18}),eyebrow:"Shared Components",title:"共享组件",description:"已迁入 components 的页面组件,只展示外观和轻交互。",children:(0,t.jsxs)("div",{className:"demo-grid demo-grid-two",children:[(0,t.jsx)(Z,{title:"Web3 小组件",children:(0,t.jsxs)("div",{className:"demo-stack",children:[(0,t.jsx)(I.KeyCard,{title:"Ed25519 公钥",icon:(0,t.jsx)(k.ShieldAlert,{size:18}),children:(0,t.jsxs)("div",{className:"mono-row",children:[(0,t.jsx)("code",{className:"mono",children:"ed25519-demo-public-key"}),(0,t.jsx)(P.CopyButton,{text:"ed25519-demo-public-key"})]})}),(0,t.jsx)(F.EmptyState,{icon:(0,t.jsx)(p,{size:32}),message:"请输入用户名和密码以查看身份信息"})]})}),(0,t.jsx)(Z,{title:"PEM 与复制",className:"demo-pem-preview",children:(0,t.jsx)(R.PemBlock,{label:"demo.pub",filename:"demo.pub",pem:"-----BEGIN PUBLIC KEY-----\nMOSTBOXDEMO\n-----END PUBLIC KEY-----"})}),(0,t.jsxs)(Z,{title:"文件管理卡片",children:[(0,t.jsxs)("div",{className:"demo-app-card-grid",children:[(0,t.jsx)(E.FolderCard,{folder:{name:"图片",path:"图片"},onClick:()=>ep("info","FolderCard demo")}),(0,t.jsx)(E.FileCard,{file:{cid:"bafy-demo-file",fileName:"图片/demo.png",starred:!0},isSelected:!0,onSelect:()=>ep("info","FileCard select"),onPreview:()=>ep("info","FileCard preview")})]}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary demo-move-trigger",onClick:()=>en(!0),children:[(0,t.jsx)(u.Folder,{size:16}),"MoveModal"]})]}),(0,t.jsx)(Z,{title:"笔记组件",children:(0,t.jsxs)("div",{className:"demo-note-shell",children:[(0,t.jsxs)("div",{className:"demo-note-header",children:[(0,t.jsx)("span",{children:"笔记"}),(0,t.jsx)(_.NoteMoreMenu,{sync:{action:null,status:"synced",statusLabel:"已同步",hasConflict:!1,uploadNow:async()=>!0,restoreFromCloud:async()=>!0,exportLocalBackup:()=>ep("info","本地导出"),importLocalBackup:()=>ep("info","本地导入")}})]}),(0,t.jsx)("div",{className:"sidebar demo-note-sidebar",children:(0,t.jsx)(U.NoteSidebar,{children:(0,t.jsx)("div",{className:"sidebar-empty-state",children:(0,t.jsx)("p",{children:"NoteSidebar 已迁入 components"})})})}),(0,t.jsxs)("button",{type:"button",className:"btn btn-secondary demo-move-trigger",onClick:()=>er(!0),children:[(0,t.jsx)(u.Folder,{size:16}),"NoteMoveModal"]})]})})]})}),ec.map((e,s)=>(0,t.jsx)(V.Toast,{message:e.message,type:e.type,index:s,onDone:()=>{var t;return t=e.id,void eo(e=>e.filter(e=>e.id!==t))}},e.id)),J&&(0,t.jsx)(H.ModalOverlay,{onClose:()=>Q(!1),children:(0,t.jsxs)("div",{className:"demo-basic-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("h3",{children:"ModalOverlay"}),(0,t.jsx)("p",{children:"这是基础容器示例,用来检查玻璃背景、居中和关闭行为。"}),(0,t.jsx)("button",{type:"button",className:"btn btn-primary",onClick:()=>Q(!1),children:"关闭"})]})}),ee&&(0,t.jsx)(q.ConfirmModal,{title:"确认弹窗示例",message:"用于检查标题、正文、按钮和危险态之外的默认确认状态。",confirmText:"确认",onConfirm:()=>{et(!1),ep("success","ConfirmModal 已确认")},onClose:()=>et(!1)}),es&&(0,t.jsx)(K.InputModal,{title:"输入弹窗示例",placeholder:"输入任意文本",confirmText:"保存",defaultValue:"MostBox",onConfirm:e=>{ea(!1),ep("success",`InputModal: ${e}`)},onClose:()=>ea(!1),validate:e=>e.length<2?"至少输入 2 个字符":""}),ei&&(0,t.jsx)(B.MoveModal,{items:[{cid:"bafy-demo-file"}],allFolders:[{name:"图片",path:"图片"},{name:"壁纸",path:"图片/壁纸"},{name:"文档",path:"文档"}],currentPath:"图片",onMove:e=>{en(!1),ep("success",`MoveModal: ${e||"根目录"}`)},onClose:()=>en(!1)}),el&&(0,t.jsx)($.NoteMoveModal,{target:G,directories:X,onMove:e=>{er(!1),ep("success",`NoteMoveModal: ${e||"全部笔记"}`)},onClose:()=>er(!1)}),(0,t.jsx)(O.default,{}),(0,t.jsx)(W.default,{})]})}],38999)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[data-theme=dark]{--chat-bg-secondary:#1c1c1e99;--chat-bg-tertiary:#2c2c2e66;--chat-border:#ffffff14}.chat-messages{background:0 0;flex-direction:column;flex:1;gap:16px;padding:20px 24px;display:flex;overflow-y:auto}.chat-messages-empty{flex:1}.chat-messages-empty p{font-size:14px}.chat-message{align-items:flex-start;gap:10px;max-width:70%;animation:.25s fadeIn;display:flex}.chat-message.self{flex-direction:row-reverse;align-self:flex-end}.chat-message.self .msg-content{align-items:flex-end}.chat-message.self .message-bubble{background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, var(--info)));color:#fff;border:1px solid #ffffff1a;border-radius:18px 4px 18px 18px;box-shadow:0 4px 16px #5e6ad240}.chat-message.self .message-author{color:var(--accent)}.chat-message.self .message-time{color:var(--text-muted)}.chat-message.other{align-self:flex-start}.chat-message.other .msg-content{align-items:flex-start}.chat-message.other .message-bubble{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow), var(--glass-shadow-inset);border-radius:4px 18px 18px}.chat-message .msg-avatar{flex-shrink:0}.chat-message .msg-content{flex-direction:column;gap:4px;max-width:100%;display:flex}.chat-message .message-author{color:var(--text-muted);font-size:11px;font-weight:500}.chat-message .message-bubble{word-break:break-word;padding:10px 14px;font-size:14px;line-height:1.5}.chat-message .message-bubble.has-attachment{box-shadow:none;color:var(--text-primary);background:0 0;border:none;padding:0}.chat-message .message-time{color:var(--text-muted);opacity:.7;font-size:10px}.chat-message.pending .message-bubble{opacity:.6}.chat-input-area{border-top:1px solid var(--glass-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-xl);gap:12px;padding:16px 24px;display:flex}.chat-input-area .chat-file-input{display:none}.chat-input-area .chat-tool-btn{color:var(--text-secondary);flex-shrink:0}.chat-input-area .chat-tool-btn:hover:not(:disabled){color:var(--accent);border-color:var(--accent);transform:scale(1.05)}.chat-input-area .input-pill{flex:1;min-width:0}.chat-input-area .send-btn{flex-shrink:0}.chat-input-area .send-btn:hover:not(:disabled){transform:scale(1.05)}.chat-welcome{background:0 0;flex:1;padding:40px}.chat-welcome .welcome-icon{margin-bottom:20px}.chat-welcome h2{margin-bottom:8px}.chat-channel-search{padding:10px 8px 0}.create-channel-btn{margin:8px}.leave-channel-btn{opacity:0;color:var(--text-muted);cursor:pointer;border-radius:var(--radius-sm);transition:all var(--transition-fast);background:0 0;border:none;justify-content:center;align-items:center;margin-left:auto;padding:4px;display:flex}.sidebar-nav-btn:hover .leave-channel-btn{opacity:1}.leave-channel-btn:hover{color:var(--danger);background:#ff3b301a}.chat-sidebar-overlay{display:none}@media (max-width:768px){.chat-sidebar{z-index:50;transition:left var(--transition);position:fixed;top:0;bottom:0;left:-240px}.chat-sidebar.open{left:0}.chat-sidebar-overlay{z-index:40;opacity:0;pointer-events:none;transition:opacity var(--transition);background:#0006;display:block;position:fixed;inset:0}.chat-sidebar-overlay.visible{opacity:1;pointer-events:auto}.chat-messages{padding:16px}.chat-message{max-width:85%}.chat-input-area{padding:12px 16px}.sidebar-nav-btn .leave-channel-btn{opacity:1}}.channel-detail-overlay{z-index:100;background:#0000004d;justify-content:flex-end;animation:.2s fadeIn;display:flex;position:fixed;inset:0}.channel-detail-drawer{background:var(--glass-bg-heavy);width:320px;max-width:90vw;height:100%;-webkit-backdrop-filter:var(--blur-2xl);border-left:1px solid var(--glass-border);flex-direction:column;animation:.25s slideInRight;display:flex}@keyframes slideInRight{0%{transform:translate(100%)}to{transform:translate(0)}}.channel-detail-header{border-bottom:1px solid var(--glass-border);justify-content:space-between;align-items:center;padding:20px;display:flex}.channel-detail-header h3{margin:0;font-size:16px;font-weight:600}.channel-detail-body{flex-direction:column;flex:1;gap:20px;padding:20px;display:flex;overflow-y:auto}.channel-detail-section{flex-direction:column;gap:8px;display:flex}.channel-detail-label{color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;align-items:center;gap:6px;font-size:12px;font-weight:500;display:flex}.channel-members-section{gap:12px}.channel-members-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px 8px;display:grid}.channel-member{flex-direction:column;align-items:center;gap:6px;min-width:0;display:flex}.channel-member-avatar{border-radius:var(--radius-md);object-fit:cover;background:var(--glass-bg-subtle);border:1px solid var(--glass-border);width:48px;height:48px}.channel-member-name{width:100%;min-width:0;color:var(--text-secondary);text-align:center;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.3;overflow:hidden}.channel-detail-mono{font-family:var(--font-mono);word-break:break-all;font-size:13px}.channel-detail-footer{border-top:1px solid var(--glass-border);padding:20px}.header-right-actions{align-items:center;gap:4px;display:flex}.chat-join-container{flex:1;justify-content:center;align-items:flex-start;min-height:0;padding:24px;display:flex;overflow-y:auto}.chat-join-panel{flex-direction:column;gap:16px;width:100%;max-width:560px;display:flex}.chat-join-helper{border-radius:var(--radius-lg);background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);flex-direction:column;gap:14px;padding:24px;display:flex}.chat-join-helper-title{color:var(--accent);align-items:center;gap:8px;display:flex}.chat-join-helper-title h3{color:var(--text-primary);margin:0;font-size:16px;font-weight:600}.chat-join-spec{border-radius:var(--radius-lg);background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);flex-direction:column;gap:14px;padding:24px;display:flex}.chat-join-field-list{flex-direction:column;gap:10px;display:flex}.chat-join-field{border-radius:var(--radius-md);background:var(--glass-bg-subtle);border:1px solid var(--glass-border);flex-direction:column;gap:6px;padding:12px;display:flex}.chat-join-field p{color:var(--text-secondary);margin:0;font-size:13px;line-height:1.5}.chat-join-field-meta{color:var(--text-muted);flex-wrap:wrap;align-items:center;gap:8px;font-size:12px;display:flex}.chat-join-field-name{color:var(--text-primary);font-family:var(--font-mono);overflow-wrap:anywhere;font-size:13px}.chat-join-loading,.chat-join-error,.chat-join-success{border-radius:var(--radius-lg);background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);text-align:center;flex-direction:column;align-items:center;gap:16px;width:100%;padding:48px;display:flex}:is(.chat-join-loading,.chat-join-error,.chat-join-success) p{color:var(--text-secondary);margin:0;font-size:16px}.chat-join-loading{color:var(--accent)}.chat-join-error{color:var(--danger)}.chat-join-success{color:var(--success)}.chat-join-status{color:var(--text-muted);font-size:13px}.chat-join-result{border-radius:var(--radius-md);background:var(--glass-bg-subtle);border:1px solid var(--glass-border);font-family:var(--font-mono);color:var(--text-primary);white-space:pre-wrap;word-break:break-all;text-align:left;width:100%;max-height:240px;margin-top:16px;padding:16px;font-size:13px;overflow-y:auto}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,89664,e=>{"use strict";let a=(0,e.i(56420).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,a],89664)},8734,e=>{"use strict";let a=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,a],8734)},26091,e=>{"use strict";let a=(0,e.i(56420).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,a],26091)},73474,e=>{"use strict";let a=(0,e.i(56420).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,a],73474)},62368,e=>{"use strict";let a=(0,e.i(56420).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,a],62368)},66595,e=>{"use strict";let a=(0,e.i(56420).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,a],66595)},51921,e=>{"use strict";let a=(0,e.i(56420).default)("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);e.s(["Music",0,a],51921)},12796,e=>{"use strict";let a=(0,e.i(56420).default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);e.s(["Loader",0,a],12796)},80796,e=>{"use strict";let a=(0,e.i(56420).default)("film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);e.s(["Film",0,a],80796)},15170,e=>{"use strict";let a=(0,e.i(56420).default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);e.s(["Image",0,a],15170)},6933,e=>{"use strict";e.s(["getFileSubtype",0,function(e){let a=String(e||"").split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","heic","heif"].includes(a)?"image":["mp4","webm","mov","avi","mkv","flv","wmv","m4v","mpeg","3gp"].includes(a)?"video":["mp3","wav","ogg","flac","aac","m4a","wma","opus"].includes(a)?"audio":["txt","md","js","ts","jsx","tsx","css","scss","less","json","xml","html","htm","yaml","yml","toml","ini","cfg","conf","log","sh","bash","py","rb","go","rs","java","c","cpp","h","hpp","cs","php","sql","graphql","env","gitignore","dockerfile","readme"].includes(a)?"text":"file"}])},25981,67927,e=>{"use strict";var a=e.i(56420);let s=(0,a.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,s],25981);let t=(0,a.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],67927)},26067,e=>{"use strict";let a=(0,e.i(56420).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,a],26067)},10818,61507,40616,e=>{"use strict";let a=(0,e.i(56420).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,a],10818);var s=e.i(18050),t=e.i(26091),i=e.i(80796),r=e.i(26067),l=e.i(15170),n=e.i(51921),o=e.i(6933);function c(e){let a=e.lastIndexOf("/");return -1===a?{folder:"",name:e}:{folder:e.substring(0,a),name:e.substring(a+1)}}e.s(["FileCard",0,function({file:e,isSelected:a,onSelect:r,onPreview:d}){let u=(0,o.getFileSubtype)(e.fileName),m=(0,s.jsx)(t.FileText,{size:24,color:"#fff"});return"image"===u?m=(0,s.jsx)(l.Image,{size:24,color:"#fff"}):"video"===u?m=(0,s.jsx)(i.Film,{size:24,color:"#fff"}):"audio"===u&&(m=(0,s.jsx)(n.Music,{size:24,color:"#fff"})),(0,s.jsxs)("div",{"data-id":e.cid,onClick:()=>r(e.cid),onDoubleClick:()=>d(e),className:`card ${a?"selected":""}`,children:[(0,s.jsx)("div",{className:`card-icon ${e.starred?"starred":"file"}`,children:m}),(0,s.jsx)("p",{className:"card-name",children:c(e.fileName).name})]})},"FolderCard",0,function({folder:e,onClick:a}){return(0,s.jsxs)("div",{onClick:a,className:"card",children:[(0,s.jsx)("div",{className:"card-icon folder",children:(0,s.jsx)(r.Folder,{size:28,color:"#fff"})}),(0,s.jsx)("p",{className:"card-name",children:e.name})]})},"parseAppFileName",0,c],61507);var d=e.i(71645),u=e.i(63676);e.i(4121);var m=e.i(57667);e.s(["MoveModal",0,function({items:e,allFolders:a,currentPath:t,onMove:i,onClose:l}){let[n,o]=(0,d.useState)(""),[c,p]=(0,d.useState)(t),h=n?[{path:"",name:"全部内容"},...n.split("/").filter(Boolean).map((e,a,s)=>({path:s.slice(0,a+1).join("/"),name:e}))]:[],f=a.filter(e=>{if(""===n)return!e.path.includes("/");let a=n+"/";return!!e.path.startsWith(a)&&!e.path.substring(a.length).includes("/")});return(0,s.jsx)(m.ModalOverlay,{onClose:l,children:(0,s.jsxs)("div",{className:"move-modal",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"modal-header",children:[(0,s.jsx)("h3",{children:"移动到"}),(0,s.jsx)("button",{type:"button",onClick:l,className:"btn btn-icon",children:(0,s.jsx)(u.X,{size:18})})]}),(0,s.jsxs)("p",{className:"move-modal-desc",children:["已选 ",e.length," 个项目"]}),(0,s.jsx)("div",{className:"move-new-folder",children:(0,s.jsx)("input",{type:"text",className:"input",value:c,onChange:e=>p(e.target.value),placeholder:"输入路径创建嵌套文件夹"})}),(0,s.jsx)("p",{className:"move-modal-hint",children:"如 图片/壁纸"}),(0,s.jsx)("div",{className:"move-breadcrumb",children:h.map((e,a)=>(0,s.jsxs)(d.default.Fragment,{children:[a>0&&(0,s.jsx)("span",{className:"breadcrumb-separator",children:"/"}),(0,s.jsx)("button",{type:"button",onClick:()=>{o(e.path),p(e.path)},className:`move-breadcrumb-btn ${n===e.path&&!c?"active":""}`,children:e.name})]},e.path))}),(0,s.jsxs)("div",{className:"move-folder-list",children:[0===f.length&&(0,s.jsx)("p",{className:"move-modal-empty",children:"该目录下没有子文件夹"}),f.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>o(e.path),className:`move-folder-item ${n===e.path&&!c?"selected":""}`,children:[(0,s.jsx)(r.Folder,{size:16}),(0,s.jsx)("span",{children:e.name})]},e.path))]}),(0,s.jsxs)("div",{className:"modal-actions",children:[(0,s.jsx)("button",{type:"button",onClick:l,className:"btn btn-secondary",children:"取消"}),(0,s.jsx)("button",{type:"button",onClick:function(){i(n||c.trim())},className:"btn btn-primary",children:"移动"})]})]})})}],40616)},11241,e=>{"use strict";let a=(0,e.i(56420).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,a],11241)},35965,e=>{"use strict";let a=(0,e.i(56420).default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,a],35965)},96699,e=>{"use strict";let a=(0,e.i(56420).default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,a],96699)},59665,5142,e=>{"use strict";var a=e.i(18050),s=e.i(71645);let t=(0,e.i(56420).default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function i(e=!1,a={}){let[t,r]=(0,s.useState)(e),l=(0,s.useCallback)(()=>{r(e=>e||(a.onOpen?.(),!0))},[a.onOpen]),n=(0,s.useCallback)(()=>{r(e=>e?(a.onClose?.(),!1):e)},[a.onClose]);return[t,{open:l,close:n,toggle:(0,s.useCallback)(()=>{t?n():l()},[n,l,t]),set:r}]}e.s(["useDisclosure",0,i],5142);let r=(0,s.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:l,headerRight:n,sidebarToggleReplacement:o,defaultHide:c=!1,children:d}){let[u,m]=i(!1),[p,h]=(0,s.useState)(c),f=(0,s.useRef)(c),x=function(e,{getInitialValueInEffect:a}={getInitialValueInEffect:!0}){let[t,i]=(0,s.useState)(a?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,s.useEffect)(()=>{try{if("matchMedia"in window){let a=window.matchMedia(e);i(a.matches);let s=e=>i(e.matches);return a.addEventListener("change",s),()=>{a.removeEventListener("change",s)}}}catch(e){return}},[e]),t||!1}("(max-width: 768px)"),j=(0,s.useCallback)((e={})=>{m.close(),e.collapse&&h(!0)},[m]);(0,s.useEffect)(()=>{c!==f.current&&(c?j({collapse:!0}):h(!1),f.current=c)},[c,j]);let g=()=>{x?m.open():h(!1)};return(0,a.jsx)(r.Provider,{value:{closeSidebar:j,openSidebar:g,isSidebarVisible:x?u:!p},children:(0,a.jsxs)("div",{className:"app-layout",children:[(0,a.jsx)("div",{className:`sidebar-overlay ${u?"visible":""}`,onClick:()=>j()}),(0,a.jsx)("div",{className:`sidebar ${u?"open":""} ${p?"collapsed":""}`,children:e({closeSidebar:j,openSidebar:g})}),(0,a.jsxs)("div",{className:"main-content",children:[(0,a.jsxs)("header",{className:"app-header",children:[(0,a.jsxs)("div",{className:"header-left",children:[o??(0,a.jsx)("button",{onClick:()=>{x?m.toggle():h(!p)},className:"btn btn-icon sidebar-toggle-btn","aria-label":x?"打开菜单":p?"展开侧边栏":"收起侧边栏",children:(0,a.jsx)(t,{size:16})}),l]}),(0,a.jsx)("div",{className:"header-right",children:n})]}),d]})]})})},"useAppShell",0,function(){let e=(0,s.useContext)(r);if(!e)throw Error("useAppShell must be used within AppShell");return e}],59665)},27648,e=>{"use strict";var a=e.i(18050),s=e.i(93957),t=e.i(71192);e.s(["default",0,function({className:e=""}){let i=(0,t.useUserStore)(e=>e.identity),r=(0,t.useUserStore)(e=>e.openLoginModal),l=(0,t.useUserStore)(e=>e.logoutUser);return(0,a.jsxs)("div",{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,a.jsxs)("div",{className:"user-info",children:[(0,a.jsx)("img",{className:"user-avatar-img",src:(0,s.generateAvatar)(i?.address,i?.avatar),alt:"avatar"}),(0,a.jsx)("span",{className:"user-name",title:i?.address,children:i?.displayName||"未登录"})]}),i?(0,a.jsx)("button",{className:"btn btn-ghost logout-btn",onClick:l,children:"退出"}):(0,a.jsx)("button",{className:"btn btn-primary login-btn",onClick:r,children:"登录"})]})}])},39626,e=>{"use strict";var a=e.i(18050);let s=(0,e.i(56420).default)("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);var t=e.i(59665);e.s(["default",0,function({label:e="打开侧边栏",className:i="",variant:r="primary"}){let{isSidebarVisible:l,openSidebar:n}=(0,t.useAppShell)();return l?null:(0,a.jsxs)("button",{type:"button",className:`btn ${"primary"===r?"btn-primary":""} sidebar-open-hint ${i}`.trim(),onClick:n,children:[(0,a.jsx)(s,{size:16}),e]})}],39626)},79490,11028,27668,e=>{"use strict";let a=(0,e.i(56420).default)("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);e.s(["Edit2",0,a],79490);var s=e.i(18050),t=e.i(71645),i=e.i(26091),r=e.i(12796),l=e.i(51921),n=e.i(63676),o=e.i(26913);e.s(["default",0,function({item:e,isBackendReady:a,getFileDownloadUrl:c,onClose:d}){let[u,m]=(0,t.useState)(""),[p,h]=(0,t.useState)(!1),[f,x]=(0,t.useState)(""),[j,g]=(0,t.useState)("");return(0,t.useEffect)(()=>{if("text"!==e.subtype)return;let s=!1;return(m(""),g(""),a)?(h(!0),(async()=>{try{let a=await fetch(c(e.cid),{headers:{...await (0,o.getApiRequestHeaders)("GET",`/api/files/${e.cid}/download`),Range:"bytes=0-9999"}});if(!a.ok)throw Error("加载失败");let t=await a.text();s||m(t||"(文件为空)")}catch{s||m("加载失败")}finally{s||h(!1)}})(),()=>{s=!0}):void m("加载失败")},[c,a,e.cid,e.subtype]),(0,t.useEffect)(()=>{var s;if("image"!==(s=e.subtype)&&"video"!==s&&"audio"!==s)return void x("");if(x(""),g(""),!a)return void g("加载失败");let t="",i=!1;return(async()=>{try{let a=await fetch(c(e.cid),{headers:await (0,o.getApiRequestHeaders)("GET",`/api/files/${e.cid}/download`)});if(!a.ok)throw Error("加载失败");let s=URL.createObjectURL(await a.blob());t=s,i||x(s)}catch{i||g("加载失败")}})(),()=>{i=!0,t&&URL.revokeObjectURL(t)}},[c,a,e.cid,e.subtype]),(0,s.jsxs)("div",{className:"preview-overlay",onClick:d,children:[(0,s.jsx)("button",{type:"button",className:"preview-close",onClick:d,"aria-label":"关闭预览",children:(0,s.jsx)(n.X,{size:20})}),(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),children:["image"===e.subtype&&(0,s.jsx)("div",{className:"preview-media-wrapper",children:f?(0,s.jsx)("img",{src:f,alt:e.fileName}):j?(0,s.jsxs)("div",{className:"preview-unsupported",children:[(0,s.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,s.jsx)("p",{children:e.fileName}),(0,s.jsx)("p",{className:"preview-unsupported-hint",children:j})]}):(0,s.jsx)("div",{className:"preview-loading",children:(0,s.jsx)("div",{className:"preview-loading-spinner"})})}),"video"===e.subtype&&(0,s.jsx)("div",{className:"preview-media-wrapper",children:f?(0,s.jsx)("video",{src:f,controls:!0}):j?(0,s.jsxs)("div",{className:"preview-unsupported",children:[(0,s.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,s.jsx)("p",{children:e.fileName}),(0,s.jsx)("p",{className:"preview-unsupported-hint",children:j})]}):(0,s.jsx)("div",{className:"preview-loading",children:(0,s.jsx)("div",{className:"preview-loading-spinner"})})}),"audio"===e.subtype&&(0,s.jsxs)("div",{className:"preview-audio",children:[(0,s.jsx)("div",{className:"preview-audio-icon",children:(0,s.jsx)(l.Music,{size:36,color:"var(--accent)"})}),(0,s.jsx)("p",{className:"preview-audio-filename",children:e.fileName}),f?(0,s.jsx)("audio",{className:"preview-audio-player",src:f,controls:!0}):(0,s.jsx)("div",{className:"preview-text-loading",children:j?(0,s.jsx)("p",{children:j}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Loader,{size:24,className:"preview-text-spinner"}),(0,s.jsx)("p",{children:"正在加载音频预览..."})]})})]}),"file"===e.subtype&&(0,s.jsxs)("div",{className:"preview-unsupported",children:[(0,s.jsx)(i.FileText,{size:48,className:"preview-file-icon"}),(0,s.jsx)("p",{children:e.fileName}),(0,s.jsx)("p",{className:"preview-unsupported-hint",children:"无法预览"})]}),"text"===e.subtype&&(0,s.jsxs)("div",{className:"preview-text-container",children:[(0,s.jsx)("div",{className:"preview-text-header",children:(0,s.jsx)("span",{children:e.fileName})}),p?(0,s.jsxs)("div",{className:"preview-text-loading",children:[(0,s.jsx)(r.Loader,{size:24,className:"preview-text-spinner"}),(0,s.jsx)("p",{children:"正在加载文本预览..."}),(0,s.jsx)("p",{className:"preview-text-loading-hint",children:"如果是初次预览,可能需要等待 P2P 网络同步"})]}):(0,s.jsx)("pre",{className:"preview-text",children:u||"(文件为空)"})]})]})]})}],11028);var c=e.i(64621);let d="链接格式不正确,请粘贴完整的 most://<cid>?filename=... 分享链接。",u="暂时没有发现在线种子。请确认分享者或其他下载者仍在线做种,稍后再检测。",m={"Link must be a valid most:// URL":"链接无法解析,请粘贴完整的 most://<cid>?filename=... 分享链接。","Link must use most:// protocol":"链接协议不正确,应以 most:// 开头。","Link path is not supported":"链接里不应包含路径,请使用 most://<cid>?filename=... 格式。","Invalid CID format":"CID 无效,请确认 most:// 后面的内容没有缺失或被截断。","Invalid CID format: CID v1 required":"CID 格式不符合 MostBox 要求,请确认分享链接完整。","CID digest must be 32 bytes":"CID 格式不符合 MostBox 要求,请确认分享链接完整。","filename is required":"链接缺少 filename 参数,请复制完整分享链接后再检测。"};e.s(["getDownloadCheckErrorMessageFromPayload",0,function(e={},a=""){if("TimeoutError"===a)return"检测等待超时,暂时没有等到在线种子响应。请确认分享者或其他下载者仍在线做种,稍后再检测。";if(!e.status)return"无法连接本地节点,请确认 MostBox 后端正在运行后再检测。";if(404===e.status)return"当前后端还没有检测接口,请重启 MostBox 后端后再试。";switch(e.code){case"VALIDATION_ERROR":return d;case"CONFLICT":return e.error?`${e.error},请先处理同名文件后再下载。`:"下载目录已有同名文件,请先重命名或移走后再检测。";case"PEER_NOT_FOUND":return u;case"PERMISSION_ERROR":return e.error?`下载目录不可写:${e.error}`:"下载目录不可写,请检查目录权限后再检测。";case"ENGINE_NOT_INITIALIZED":return"本地节点还没有启动完成,请稍等几秒后重新检测。"}return 503===e.status?u:e.status>=500?"本地节点检测时出错,请稍后重试或查看节点日志。":e.error?`检测未通过:${e.error}`:"检测未通过,请确认链接完整、发布者在线且本机网络正常。"},"getDownloadLinkValidationMessage",0,function(e=""){let a=String(e||"").trim();if(!a)return"请先粘贴 most:// 分享链接。";let s=function(e){let a;if(!e||"string"!=typeof e)return{cid:"",error:"Link must be a non-empty string"};try{a=new URL(e)}catch{return{cid:"",error:"Link must be a valid most:// URL"}}if("most:"!==a.protocol)return{cid:"",error:"Link must use most:// protocol"};if(a.pathname&&"/"!==a.pathname)return{cid:"",error:"Link path is not supported"};let s=a.hostname,t=a.searchParams.get("filename"),i=[...a.searchParams.keys()].find(e=>"filename"!==e),r=function(e){let a;if(!e||"string"!=typeof e)return{valid:!1,error:"CID must be a non-empty string"};try{a=c.CID.parse(e)}catch{return{valid:!1,error:"Invalid CID format"}}return 1!==a.version?{valid:!1,error:"Invalid CID format: CID v1 required"}:32!==a.multihash.digest.length?{valid:!1,error:"CID digest must be 32 bytes"}:{valid:!0}}(s);return r.valid?t&&t.trim()?i?{cid:"",error:`Unsupported query parameter: ${i}`}:{cid:s,fileName:t}:{cid:"",error:"filename is required"}:{cid:"",error:r.error}}(a);if(!s.error)return s.fileName?.trim()?null:m["filename is required"];if(s.error.startsWith("Unsupported query parameter: ")){let e=s.error.slice(29);return`链接包含暂不支持的参数 ${e},请只保留 filename。`}return m[s.error]||d}],27668)},27627,e=>{"use strict";var a=e.i(18050),s=e.i(71645),t=e.i(25981),i=e.i(35965),r=e.i(96699),l=e.i(73474),n=e.i(67927),o=e.i(26091),c=e.i(63676),d=e.i(89664),u=e.i(8734),m=e.i(62368),p=e.i(56420);let h=(0,p.default)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),f=(0,p.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),x=(0,p.default)("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]);var j=e.i(66595),g=e.i(79490),v=e.i(12796),b=e.i(11241),y=e.i(10818),w=e.i(59665),N=e.i(61507),k=e.i(39626),C=e.i(27648),M=e.i(11028),S=e.i(40616);e.i(4121);var F=e.i(57667),$=e.i(88361),z=e.i(47910),E=e.i(26913),L=e.i(27668),D=e.i(3593),T=e.i(71192),I=e.i(5142),A=e.i(6933);async function R(e){let a=await (0,E.getApiErrorPayload)(e),s=e&&"object"==typeof e&&"name"in e?String(e.name):"";return(0,L.getDownloadCheckErrorMessageFromPayload)(a,s)}let U={listPublishedFiles:()=>E.api.get("/api/files").json(),listTrashFiles:()=>E.api.get("/api/trash").json(),deletePublishedFile:e=>E.api.delete(`/api/files/${e}`).json(),restoreTrashFile:e=>E.api.post(`/api/trash/${e}/restore`).json(),permanentDeleteTrashFile:e=>E.api.delete(`/api/trash/${e}`).json(),emptyTrash:()=>E.api.delete("/api/trash").json(),toggleStar:e=>E.api.post(`/api/files/${e}/star`).json(),getConfig:()=>E.api.get("/api/config").json(),getDataPath:()=>E.api.get("/api/config/data-path").json(),getNetworkAddresses:()=>E.api.get("/api/network").json(),saveConfig:e=>E.api.post("/api/config",{json:e}).json(),async publishFile(e,a){let s=new FormData;s.append("file",e,a||e.name);let t=await E.api.post("/api/publish",{body:s});if(!t.ok)throw Error((await t.json().catch(()=>({error:t.statusText}))).error||"Request failed");return t.json()},checkDownload:e=>E.api.post("/api/download/check",{json:{link:e},timeout:15e3}).json(),downloadFile:e=>E.api.post("/api/download",{json:{link:e}}).json(),cancelDownload:e=>E.api.post("/api/download/cancel",{json:{taskId:e}}).json(),getFileDownloadUrl:e=>(0,E.getApiUrl)(`/api/files/${e}/download`),moveFile:(e,a)=>E.api.post("/api/move",{json:{cid:e,newFileName:a}}).json(),renameFolder:(e,a)=>E.api.post("/api/folder/rename",{json:{oldPath:e,newPath:a}}).json()};function P(e){return!e||e<=0?"0 B":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<0x40000000?`${(e/1048576).toFixed(1)} MB`:`${(e/0x40000000).toFixed(2)} GB`}function O(e){return(0,N.parseAppFileName)(e)}e.s(["default",0,function(){let e,p,q,V=(0,D.useAppStore)(e=>e.isDarkMode),B=(0,D.useAppStore)(e=>e.setIsDarkMode),H=(0,D.useAppStore)(e=>e.addToast),_=(0,D.useAppStore)(e=>e.hasBackend),W=(0,D.useAppStore)(e=>e.openConnectModal),X=(0,T.useUserStore)(e=>e.identity),G=(0,T.useUserStore)(e=>e.openLoginModal),[K,Z]=(0,s.useState)([]),[J,Q]=(0,s.useState)([]),[Y,ee]=(0,s.useState)(null),[ea,es]=(0,s.useState)("all"),[et,ei]=(0,s.useState)(!1),[er,el]=(0,s.useState)([]),[en,eo]=(0,s.useState)(null),[ec,ed]=(0,s.useState)(null),[eu,em]=(0,I.useDisclosure)(!1),[ep,eh]=(0,s.useState)(""),[ef,ex]=(0,s.useState)(null),[ej,eg]=(0,s.useState)(!1),[ev,eb]=(0,s.useState)([]),[ey,ew]=(0,I.useDisclosure)(!1),[eN,ek]=(0,s.useState)(""),{copy:eC,copied:eM}=function(e={}){let a=e.timeout??2e3,[t,i]=(0,s.useState)(null),[r,l]=(0,s.useState)(!1),n=(0,s.useRef)(null);return(0,s.useEffect)(()=>()=>{window.clearTimeout(n.current)},[]),{copy:e=>{"clipboard"in navigator?navigator.clipboard.writeText(e).then(()=>{i(null),window.clearTimeout(n.current),n.current=window.setTimeout(()=>l(!1),a),l(!0)}).catch(e=>i(e)):i(Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{l(!1),i(null),window.clearTimeout(n.current)},error:t,copied:r}}({timeout:2e3}),[eS,eF]=(0,I.useDisclosure)(!1),[e$,ez]=(0,s.useState)(null),[eE,eL]=(0,s.useState)(null),[eD,eT]=(0,s.useState)(!1),eI=!0===_,eA=Y||"",eR=(e=new Set,K.forEach(a=>{let{folder:s}=O(a.fileName),t=s.split("/").filter(Boolean),i="";for(let a of t)i+=(i?"/":"")+a,e.add(i)}),[...e].sort()),{folders:eU,files:eP}={folders:(p=eA?eA+"/":"",eR.filter(e=>{let a=e.toLowerCase().startsWith(p.toLowerCase()),s=e.substring(p.length);return a&&!s.includes("/")}).map(e=>({name:e.substring(p.length),path:e}))),files:K.filter(e=>O(e.fileName).folder===eA)};function eO(){return!!eI||(W(),!1)}function eq(){return!!X||(G(),!1)}let eV=eN?K.filter(e=>O(e.fileName).name.toLowerCase().includes(eN.toLowerCase())):eP,eB=async()=>{if(!eI||!X)return void Z([]);try{let e=await U.listPublishedFiles();Z(e||[])}catch{Z([])}},eH=async()=>{if(!eI||!X)return void Q([]);try{let e=await U.listTrashFiles();Q(e||[])}catch{Q([])}},e_=e=>{el(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},eW=async e=>{if(eq()&&eO())try{await U.restoreTrashFile(e),H("已恢复","success"),eB(),eH()}catch(e){H(await (0,E.getApiErrorMessage)(e,"恢复失败"),"error")}},eX=async()=>{!eq()||eO()&&ez({title:"清空回收站",message:"确定要清空回收站吗?此操作不可恢复!",confirmText:"清空",danger:!0,onConfirm:async()=>{ez(null);try{await U.emptyTrash(),H("回收站已清空","success"),eH()}catch(e){H(await (0,E.getApiErrorMessage)(e,"清空失败"),"error")}}})},eG=async e=>{if(eq()&&eO())try{let a=await U.toggleStar(e);Z(s=>s.map(s=>s.cid===e?{...s,starred:a.starred}:s)),H(a.starred?"已收藏":"已取消收藏","success")}catch(e){H(await (0,E.getApiErrorMessage)(e,"操作失败"),"error")}},eK=async()=>{if(!eq()||!eO())return;let e="trash"===ea;ez({title:e?"永久删除":"批量删除",message:e?`确定要永久删除选中的 ${er.length} 个项目吗?此操作不可恢复!`:`确定要删除选中的 ${er.length} 个项目吗?`,confirmText:e?"永久删除":"删除",danger:!0,onConfirm:async()=>{ez(null);try{for(let a of er)e?await U.permanentDeleteTrashFile(a):a.startsWith("__")||await U.deletePublishedFile(a);el([]),H(e?"已永久删除":"已删除","success"),eB(),eH()}catch(e){H(await (0,E.getApiErrorMessage)(e,"删除失败"),"error")}}})},eZ=async e=>{if(eq()&&eO())try{for(let a of er){let s=K.find(e=>e.cid===a);if(!s)continue;let{name:t}=O(s.fileName),i=e?`${e}/${t}`:t;s.fileName!==i&&await U.moveFile(a,i)}el([]),eF.close(),H("已移动","success"),eB()}catch(e){H(await (0,E.getApiErrorMessage)(e,"移动失败"),"error")}},eJ=e=>{let a=!!e.path,s=a?e.name:O(e.fileName).name;eL({title:a?"重命名文件夹":"重命名文件",placeholder:"请输入新名称",defaultValue:s,confirmText:"重命名",onConfirm:async t=>{if(t!==s&&eq()&&eO()){eT(!0);try{if(a){let a=e.path.lastIndexOf("/"),s=-1!==a?e.path.substring(0,a):"",i=s?`${s}/${t}`:t;await U.renameFolder(e.path,i),H("已重命名","success"),eB(),e7(i)}else{let{folder:a}=O(e.fileName),s=a?`${a}/${t}`:t;await U.moveFile(e.cid,s),H("已重命名","success"),eB()}eL(null)}catch(e){H(await (0,E.getApiErrorMessage)(e,"重命名失败"),"error")}finally{eT(!1)}}}})},eQ=async e=>{if(!X){G(),H("请先登录后发布文件","warning");return}if(!eO())return;let a=eA?eA+"/":"",s=[];for(let t of Array.from(e)){let e=a+t.name;if(K.some(a=>a.fileName===e)){H(`${t.name} 已存在`,"warning");continue}let i=`upload_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,r={id:i,fileName:t.name,progress:0,type:"upload",status:"uploading"};s.push(r),eb(e=>[...e,r]),s.length>0&&ew.open();try{(await U.publishFile(t,e)).alreadyExists?(eb(e=>e.map(e=>e.id===i?{...e,status:"completed"}:e)),H(`${t.name} 已存在`,"warning")):(eb(e=>e.map(e=>e.id===i?{...e,progress:100,status:"completed"}:e)),H(`${t.name} 已添加到本地`,"success"))}catch(e){eb(e=>e.map(e=>e.id===i?{...e,status:"error"}:e)),H(await (0,E.getApiErrorMessage)(e,`发布失败: ${t.name}`),"error")}}setTimeout(()=>{eb(e=>e.filter(e=>"completed"!==e.status&&"error"!==e.status&&"cancelled"!==e.status))},3e3),eB()},[eY,e0]=(0,s.useState)(!1),e1=ep.trim(),e2=ef?.status==="success"&&ef.link===e1,e6=()=>{em.close(),ex(null)},e4=async()=>{let e=(0,L.getDownloadLinkValidationMessage)(e1);if(e){ex({status:"error",link:e1,message:e}),H(e,"warning");return}if(!ej&&!eY&&eq()&&eO()){eg(!0),ex(null);try{let e=await U.checkDownload(e1),a=e.alreadyExists?`${e.fileName} 已在本机`:`${e.fileName} 可下载`;ex({status:"success",link:e1,message:a}),H(e.alreadyExists?`${e.fileName} 已存在`:"检测通过",e.alreadyExists?"warning":"success")}catch(a){let e=await R(a);ex({status:"error",link:e1,message:e}),H(e,"error")}finally{eg(!1)}}},e5=async()=>{if(!X){G(),H("请先登录后下载文件","warning");return}if(!eO())return;let e=(0,L.getDownloadLinkValidationMessage)(e1);if(e)return void H(e,"warning");if(!e2)return void H("请先检测链接可用性","warning");if(!eY){e0(!0);try{let e=await U.downloadFile(e1);if(eh(""),ex(null),e6(),e.alreadyExists)H(`${e.fileName} 已存在`,"warning");else{let a={id:e.taskId,fileName:"下载文件",progress:0,type:"download",status:"downloading"};eb(e=>[...e,a]),ew.open(),H("下载已开始","info")}}catch(e){H(await (0,E.getApiErrorMessage)(e,"下载失败"),"error")}finally{e0(!1)}}},e9=async e=>{if(eq()&&eO()&&"download"===e.type&&"downloading"===e.status){eb(a=>a.map(a=>a.id===e.id?{...a,status:"cancelling"}:a));try{await U.cancelDownload(e.id)}catch(a){eb(a=>a.map(a=>a.id===e.id?{...a,status:"downloading"}:a)),H(await (0,E.getApiErrorMessage)(a,"取消失败"),"error")}}},e3=async e=>{if(eq()&&eO())try{let a=await fetch(U.getFileDownloadUrl(e.cid),{headers:await (0,E.getApiRequestHeaders)("GET",`/api/files/${e.cid}/download`)});if(!a.ok)throw Error("获取文件失败");let s=await a.blob(),t=window.showSaveFilePicker;if(t){let a=await t({suggestedName:e.fileName}),i=await a.createWritable();await i.write(s),await i.close(),H("文件已保存","success")}else{let a=URL.createObjectURL(s),t=document.createElement("a");t.href=a,t.download=e.fileName,document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(a),H("文件已下载","success")}}catch(e){"AbortError"!==e.name&&H("保存失败: "+e.message,"error")}},e7=e=>{ee(e||null),el([])};(0,s.useEffect)(()=>{if(!0!==_)return;let e=null,a=!1;return(async()=>{if(e=new WebSocket(await (0,E.getAuthenticatedWebSocketUrl)("/ws")),a)return e.close();e.onmessage=e=>{try{let{event:a,data:s}=JSON.parse(e.data);if("publish:success"===a||"download:success"===a){eB();let e=s.taskId||s.fileName;eb(a=>a.map(a=>a.id===e||a.fileName===s.fileName?{...a,progress:100,status:"completed"}:a)),"download:success"===a&&(s.alreadyExists?H(`${s.fileName} 已存在`,"warning"):H(`${s.fileName} 下载完成`,"success"),setTimeout(()=>{eb(a=>a.filter(a=>a.id!==e||"completed"!==a.status))},3e3))}"publish:progress"===a&&eb(e=>e.map(e=>{if(s.file&&e.fileName===s.file&&"upload"===e.type){let a=50;return"calculating-cid"===s.stage?a=25:"uploading"===s.stage?a=75:"complete"===s.stage&&(a=100),{...e,progress:a}}return e})),"download:progress"===a&&eb(e=>e.map(e=>e.id===s.taskId?{...e,progress:s.percent||0,loaded:s.loaded,total:s.total}:e)),"download:error"===a&&(eb(e=>e.map(e=>e.id===s.taskId?{...e,status:"error"}:e)),H(`下载失败: ${s.error}`,"error")),"download:status"===a&&eb(e=>e.map(e=>e.id===s.taskId?{...e,fileName:s.file||e.fileName}:e)),"download:cancelled"===a&&(eb(e=>e.map(e=>e.id===s.taskId?{...e,status:"cancelled"}:e)),H("下载已取消","warning"))}catch(e){console.warn("[App WS] Failed to parse message:",e.message)}}})(),()=>{a=!0,e?.close()}},[_,X?.address]),(0,s.useEffect)(()=>{if(!0===_&&X){eB(),eH();return}!1===_&&(Z([]),Q([]))},[_,X?.address]),(0,s.useEffect)(()=>{X||(el([]),eo(null),ed(null),eh(""),ex(null),eb([]),ek(""),ee(null),es("all"))},[X?.address]);let e8="all"===ea?eV:"starred"===ea?K.filter(e=>e.starred&&O(e.fileName).name.toLowerCase().includes(eN.toLowerCase())):J.filter(e=>O(e.fileName).name.toLowerCase().includes(eN.toLowerCase())),ae="starred"===ea?[]:eU.filter(e=>e.name.toLowerCase().includes(eN.toLowerCase())),aa=eA?[{path:"",name:"全部内容"},...eA.split("/").filter(Boolean).map((e,a,s)=>({path:s.slice(0,a+1).join("/"),name:e}))]:[];return(0,a.jsxs)(w.default,{sidebar:({closeSidebar:e})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"sidebar-header sidebar-header-link",onClick:()=>window.location.href="/",children:[(0,a.jsx)(b.ArrowLeft,{size:18}),(0,a.jsx)("h1",{children:"MOST PEOPLE"})]}),(0,a.jsx)("nav",{className:"sidebar-nav",children:[{id:"all",icon:(0,a.jsx)(x,{size:18}),label:"本地"},{id:"starred",icon:(0,a.jsx)(f,{size:18}),label:"收藏"},{id:"trash",icon:(0,a.jsx)(l.Trash2,{size:18}),label:"回收站"}].map(s=>(0,a.jsxs)("button",{onClick:()=>{es(s.id),ee(null),el([]),ek(""),e()},className:`sidebar-nav-btn ${ea===s.id?"active":""}`,children:[s.icon,(0,a.jsx)("span",{children:s.label})]},s.id))}),(0,a.jsx)(C.default,{})]}),headerTitle:(0,a.jsx)("h2",{className:"header-title",children:"all"===ea?"本地":"starred"===ea?"收藏":"回收站"}),headerRight:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"search-box",children:[(0,a.jsx)(j.Search,{size:14}),(0,a.jsx)("input",{type:"text",value:eN,onChange:e=>ek(e.target.value),placeholder:"搜索..."}),eN&&(0,a.jsx)("button",{onClick:()=>ek(""),children:(0,a.jsx)(c.X,{size:12})})]}),"trash"===ea&&J.length>0&&(0,a.jsx)("button",{onClick:eX,className:"btn btn-sm btn-empty-trash",children:"清空回收站"}),(0,a.jsx)("button",{onClick:()=>ew.open(),className:"btn btn-icon",children:(0,a.jsx)(h,{size:16})}),(0,a.jsx)("button",{onClick:()=>B(!V),className:"btn btn-icon",children:V?(0,a.jsx)(i.Sun,{size:16}):(0,a.jsx)(r.Moon,{size:16})})]}),children:["all"===ea&&(0,a.jsxs)("div",{className:"action-grid",children:[(0,a.jsxs)("div",{className:`action-card upload ${et?"drag-over":""}`,onDragOver:e=>{e.preventDefault(),ei(!0)},onDragLeave:()=>ei(!1),onDrop:e=>{e.preventDefault(),ei(!1),eq()&&eO()&&eQ(e.dataTransfer.files)},children:[(0,a.jsx)("input",{type:"file",multiple:!0,onClick:e=>{eq()&&eO()||e.preventDefault()},onChange:e=>eQ(e.target.files),className:"action-card-input"}),(0,a.jsx)(t.Upload,{size:20,className:"action-grid-icon"}),(0,a.jsx)("p",{children:"发布文件"})]}),(0,a.jsxs)("div",{className:"action-card action-card-download",onClick:()=>{eq()&&eO()&&em.open()},children:[(0,a.jsx)(m.Download,{size:20,className:"action-grid-icon"}),(0,a.jsx)("p",{children:"下载文件"})]})]}),"all"===ea&&(0,a.jsx)("div",{className:"breadcrumb",children:eA?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>e7(""),children:"全部内容"}),aa.slice(1).map((e,t)=>(0,a.jsxs)(s.default.Fragment,{children:[(0,a.jsx)(n.ChevronRight,{size:12}),(0,a.jsx)("button",{onClick:()=>e7(e.path),className:t===aa.length-2?"current":"",children:e.name}),t===aa.length-2&&(0,a.jsx)("button",{onClick:()=>eJ(e),className:"breadcrumb-edit-btn",children:(0,a.jsx)(g.Edit2,{size:12})})]},e.path))]}):null}),(0,a.jsxs)("div",{className:"content-grid",children:["trash"===ea&&(0===e8.length?(0,a.jsxs)("div",{className:"empty-state app-empty-state",children:[(0,a.jsx)("p",{children:eN?"未找到相关文件":"回收站是空的"}),(0,a.jsx)(k.default,{label:"打开文件导航"})]}):(0,a.jsx)("div",{className:"file-grid",children:e8.map(e=>{var s;return(0,a.jsxs)("div",{onClick:()=>el(a=>a.includes(e.cid)?a.filter(a=>a!==e.cid):[...a,e.cid]),onDoubleClick:()=>eW(e.cid),className:`card ${er.includes(e.cid)?"selected":""}`,children:[(0,a.jsx)("div",{className:"card-icon trash",children:(0,a.jsx)(o.FileText,{size:24,color:"#fff"})}),(0,a.jsx)("p",{className:"card-name",children:O(e.fileName).name}),(0,a.jsxs)("p",{className:"card-date",children:["删除于 ",(s=e.deletedAt)?new Date(s).toLocaleDateString("zh-CN"):""]})]},e.cid)})})),"trash"!==ea&&(0===e8.length&&0===ae.length?(0,a.jsxs)("div",{className:"empty-state app-empty-state",children:[(0,a.jsx)("p",{children:eN?"未找到相关文件":"starred"===ea?"暂无的收藏":"暂无本地文件"}),(0,a.jsx)(k.default,{label:"打开文件导航"})]}):(0,a.jsxs)("div",{className:"file-grid",children:[ae.map(e=>(0,a.jsx)(N.FolderCard,{folder:e,onClick:()=>e7(e.path)},e.path)),e8.map(e=>(0,a.jsx)(N.FileCard,{file:e,isSelected:er.includes(e.cid),onSelect:e_,onPreview:e=>eo({...e,subtype:(0,A.getFileSubtype)(e.fileName)})},e.cid))]}))]}),e$&&(0,a.jsx)($.ConfirmModal,{title:e$.title,message:e$.message,confirmText:e$.confirmText,danger:e$.danger,onConfirm:e$.onConfirm,onClose:()=>ez(null)}),eE&&(0,a.jsx)(z.InputModal,{title:eE.title,placeholder:eE.placeholder,defaultValue:eE.defaultValue,confirmText:eE.confirmText,isLoading:eD,onConfirm:eE.onConfirm,onClose:()=>eL(null)}),eS&&(0,a.jsx)(S.MoveModal,{items:er.map(e=>K.find(a=>a.cid===e)).filter(Boolean),allFolders:eR.map(e=>({path:e,name:e.split("/").pop()})),currentPath:eA,onMove:eZ,onClose:()=>eF.close()}),ec&&(0,a.jsx)(F.ModalOverlay,{onClose:()=>ed(null),children:(0,a.jsxs)("div",{className:"share-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("h3",{children:"分享链接"}),(0,a.jsx)("button",{onClick:()=>ed(null),className:"btn btn-icon",children:(0,a.jsx)(c.X,{size:18})})]}),(0,a.jsxs)("div",{className:"share-link-box",children:[(0,a.jsx)("div",{className:"share-link-text",children:`most://${ec.cid}?filename=${encodeURIComponent(ec.fileName)}`}),(0,a.jsx)("button",{onClick:()=>{eC(`most://${ec.cid}?filename=${encodeURIComponent(ec.fileName)}`)},className:`btn btn-circle btn-primary ${eM?"copied":""}`,children:eM?(0,a.jsx)(d.Check,{size:18}):(0,a.jsx)(u.Copy,{size:18})})]}),(0,a.jsx)("div",{className:"share-storage-note",children:(0,a.jsx)("span",{children:"本机在线时可下载;下载者完成后会默认继续做种。"})})]})}),eu&&(0,a.jsx)(F.ModalOverlay,{onClose:e6,children:(0,a.jsxs)("div",{className:"download-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("h3",{children:"下载文件"}),(0,a.jsx)("button",{onClick:e6,className:"btn btn-icon",children:(0,a.jsx)(c.X,{size:18})})]}),(0,a.jsxs)("div",{className:"download-link-row",children:[(0,a.jsx)("input",{type:"text",className:"input",value:ep,onChange:e=>{eh(e.target.value),ex(null)},placeholder:"输入 most:// 链接"}),(0,a.jsxs)("button",{type:"button",onClick:e4,disabled:!e1||ej||eY,className:"btn btn-secondary download-check-btn",children:[ej?(0,a.jsx)(v.Loader,{size:14,className:"spin"}):e2?(0,a.jsx)(d.Check,{size:14}):(0,a.jsx)(j.Search,{size:14}),ej?"检测中...":e2?"已通过":"检测"]})]}),ef&&(0,a.jsxs)("div",{className:`download-check-status ${ef.status}`,children:["success"===ef.status?(0,a.jsx)(d.Check,{size:14}):(0,a.jsx)(y.Info,{size:14}),(0,a.jsx)("span",{children:ef.message})]}),(0,a.jsxs)("button",{onClick:e5,disabled:!e2||eY||ej,className:"btn btn-info btn-full",children:[eY?(0,a.jsx)(v.Loader,{size:14,className:"spin"}):(0,a.jsx)(m.Download,{size:14}),eY?"下载中...":"开始下载"]})]})}),en&&(0,a.jsx)(M.default,{item:en,isBackendReady:eI,getFileDownloadUrl:U.getFileDownloadUrl,onClose:()=>eo(null)}),er.length>0&&(0,a.jsxs)("div",{className:"batch-bar",children:[(0,a.jsxs)("span",{className:"batch-info",children:["已选 ",er.length," 项"]}),(0,a.jsx)("button",{onClick:()=>el([]),className:"batch-dismiss",children:(0,a.jsx)(c.X,{size:16})}),(0,a.jsx)("div",{className:"batch-divider"}),"trash"===ea?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:async()=>{!eq()||eO()&&(await Promise.all(er.map(e=>U.restoreTrashFile(e))),el([]),H("已恢复","success"),eB(),eH())},className:"btn btn-sm",children:"恢复"}),(0,a.jsx)("button",{onClick:eK,className:"btn btn-sm btn-danger",children:"永久删除"})]}):(0,a.jsxs)(a.Fragment,{children:[1===er.length&&(q=K.find(e=>e.cid===er[0]))&&"file"!==(0,A.getFileSubtype)(q.fileName)&&(0,a.jsx)("button",{onClick:()=>{let e=K.find(e=>e.cid===er[0]);if(e){let a=(0,A.getFileSubtype)(e.fileName);eo({...e,subtype:a})}},className:"btn btn-sm",children:"预览"}),(0,a.jsx)("button",{onClick:()=>{let e=er.some(e=>{let a=K.find(a=>a.cid===e);return a&&!a.starred});er.forEach(a=>{let s=K.find(e=>e.cid===a);s&&(e?!s.starred:s.starred)&&eG(a)})},className:"btn btn-sm btn-star",children:"收藏"}),1===er.length&&(0,a.jsx)("button",{onClick:()=>{let e=K.find(e=>e.cid===er[0]);e&&eJ(e)},className:"btn btn-sm",children:"重命名"}),(0,a.jsx)("button",{onClick:()=>eF.open(),className:"btn btn-sm btn-move",children:"移动"}),(0,a.jsx)("button",{onClick:eK,className:"btn btn-sm btn-danger",children:"删除"}),1===er.length&&(0,a.jsx)("button",{onClick:()=>ed(K.find(e=>e.cid===er[0])),className:"btn btn-sm",children:"分享"}),1===er.length&&(0,a.jsx)("button",{onClick:()=>{let e=K.find(e=>e.cid===er[0]);e&&e3(e)},className:"btn btn-sm",children:"另存为"})]})]}),ey&&(0,a.jsx)(F.ModalOverlay,{onClose:()=>ew.close(),children:(0,a.jsxs)("div",{className:"transfer-modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("h3",{children:"传输"}),(0,a.jsx)("button",{onClick:()=>ew.close(),className:"btn btn-icon",children:(0,a.jsx)(c.X,{size:18})})]}),0===ev.length?(0,a.jsx)("div",{className:"empty-transfer",children:"暂无传输"}):ev.map(e=>(0,a.jsxs)("div",{className:"transfer-item",children:[(0,a.jsxs)("div",{className:"transfer-item-header",children:["upload"===e.type?(0,a.jsx)(t.Upload,{size:14}):(0,a.jsx)(m.Download,{size:14}),(0,a.jsx)("span",{className:"transfer-item-name",children:e.fileName}),"downloading"===e.status&&"download"===e.type&&(0,a.jsx)("button",{onClick:()=>e9(e),className:"transfer-item-cancel",children:(0,a.jsx)(c.X,{size:14})})]}),(0,a.jsxs)("div",{className:"transfer-progress-row",children:[(0,a.jsx)("progress",{className:`transfer-progress-meter ${"download"===e.type?"download":""} ${"error"===e.status?"error":""} ${"cancelled"===e.status?"cancelled":""}`,value:Math.max(0,Math.min(100,e.progress)),max:100,"aria-label":`${e.fileName} 传输进度`}),(0,a.jsx)("span",{className:"transfer-progress-text",children:"completed"===e.status?"完成":"error"===e.status?"失败":"cancelled"===e.status?"已取消":"cancelling"===e.status?"取消中":e.loaded&&e.total?`${P(e.loaded)}/${P(e.total)}`:`${e.progress}%`})]})]},e.id))]})})]})}],27627)}]);
|