most-box 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/electron/main.js +2 -2
- 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 +5 -5
- package/out/__next._head.txt +1 -1
- package/out/__next._index.txt +2 -2
- package/out/__next._tree.txt +3 -3
- package/out/_next/static/chunks/003jnm.v5tzw5.js +1 -0
- package/out/_next/static/chunks/00re8v.gbcywn.js +1 -0
- package/out/_next/static/chunks/012hi627qrdnn.js +1 -0
- package/out/_next/static/chunks/{11dalasm30arx.js → 02~o2nmo5pmy1.js} +1 -1
- package/out/_next/static/chunks/{0_-ccbcyh_o30.css → 07t.dhhokszz5.css} +1 -1
- package/out/_next/static/chunks/{0ibjp~7qzxfjv.js → 0ah8fihozo2_u.js} +3 -3
- package/out/_next/static/chunks/0gdluj423gso1.js +1 -0
- package/out/_next/static/chunks/0gmoiq06srjay.css +1 -0
- package/out/_next/static/chunks/{0_b839~4.q324.js → 0imkasy7kb67u.js} +1 -1
- package/out/_next/static/chunks/0jjc_b9q_ldi2.js +1 -0
- package/out/_next/static/chunks/0lqslm813wk_h.js +1 -0
- package/out/_next/static/chunks/{0ry.po.a~iu4p.js → 0q782fxxd0lx~.js} +1 -1
- package/out/_next/static/chunks/0tapzqc6hgvx-.js +1 -0
- package/out/_next/static/chunks/{0j9~17180dl8j.js → 0xsc7z5x8n7wg.js} +1 -1
- package/out/_next/static/chunks/{0_sna3wdypbzr.js → 0zm~gys2jwl0g.js} +1 -1
- package/out/_not-found/__next._full.txt +2 -2
- package/out/_not-found/__next._head.txt +1 -1
- package/out/_not-found/__next._index.txt +2 -2
- package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/out/_not-found/__next._not-found.txt +1 -1
- package/out/_not-found/__next._tree.txt +1 -1
- package/out/_not-found/index.html +2 -2
- package/out/_not-found/index.txt +2 -2
- package/out/app/__next._full.txt +3 -3
- package/out/app/__next._head.txt +1 -1
- package/out/app/__next._index.txt +2 -2
- package/out/app/__next._tree.txt +1 -1
- package/out/app/__next.app.__PAGE__.txt +2 -2
- package/out/app/__next.app.txt +1 -1
- package/out/app/index.html +2 -2
- package/out/app/index.txt +3 -3
- package/out/changelog/__next._full.txt +4 -4
- package/out/changelog/__next._head.txt +1 -1
- package/out/changelog/__next._index.txt +2 -2
- package/out/changelog/__next._tree.txt +2 -2
- package/out/changelog/__next.changelog.__PAGE__.txt +3 -3
- package/out/changelog/__next.changelog.txt +1 -1
- package/out/changelog/index.html +2 -2
- package/out/changelog/index.txt +4 -4
- package/out/chat/__next._full.txt +3 -3
- package/out/chat/__next._head.txt +1 -1
- package/out/chat/__next._index.txt +2 -2
- package/out/chat/__next._tree.txt +1 -1
- package/out/chat/__next.chat.__PAGE__.txt +2 -2
- package/out/chat/__next.chat.txt +1 -1
- package/out/chat/index.html +2 -2
- package/out/chat/index.txt +3 -3
- package/out/docs/__next._full.txt +4 -4
- package/out/docs/__next._head.txt +1 -1
- package/out/docs/__next._index.txt +2 -2
- package/out/docs/__next._tree.txt +2 -2
- package/out/docs/__next.docs.__PAGE__.txt +3 -3
- package/out/docs/__next.docs.txt +1 -1
- package/out/docs/getting-started/__next._full.txt +4 -4
- package/out/docs/getting-started/__next._head.txt +1 -1
- package/out/docs/getting-started/__next._index.txt +2 -2
- package/out/docs/getting-started/__next._tree.txt +2 -2
- package/out/docs/getting-started/__next.docs.getting-started.__PAGE__.txt +3 -3
- package/out/docs/getting-started/__next.docs.getting-started.txt +1 -1
- package/out/docs/getting-started/__next.docs.txt +1 -1
- package/out/docs/getting-started/index.html +2 -2
- package/out/docs/getting-started/index.txt +4 -4
- package/out/docs/index.html +2 -2
- package/out/docs/index.txt +4 -4
- package/out/download/__next._full.txt +4 -4
- package/out/download/__next._head.txt +1 -1
- package/out/download/__next._index.txt +2 -2
- package/out/download/__next._tree.txt +2 -2
- package/out/download/__next.download.__PAGE__.txt +3 -3
- package/out/download/__next.download.txt +1 -1
- package/out/download/index.html +2 -2
- package/out/download/index.txt +4 -4
- package/out/index.html +2 -2
- package/out/index.txt +5 -5
- package/out/ping/__next._full.txt +4 -4
- package/out/ping/__next._head.txt +1 -1
- package/out/ping/__next._index.txt +2 -2
- package/out/ping/__next._tree.txt +2 -2
- package/out/ping/__next.ping.__PAGE__.txt +3 -3
- package/out/ping/__next.ping.txt +1 -1
- package/out/ping/index.html +2 -2
- package/out/ping/index.txt +4 -4
- package/out/web3/__next._full.txt +3 -3
- package/out/web3/__next._head.txt +1 -1
- package/out/web3/__next._index.txt +2 -2
- package/out/web3/__next._tree.txt +1 -1
- package/out/web3/__next.web3.__PAGE__.txt +2 -2
- package/out/web3/__next.web3.txt +1 -1
- package/out/web3/ed25519/__next._full.txt +2 -2
- package/out/web3/ed25519/__next._head.txt +1 -1
- package/out/web3/ed25519/__next._index.txt +2 -2
- package/out/web3/ed25519/__next._tree.txt +1 -1
- package/out/web3/ed25519/__next.web3.ed25519.__PAGE__.txt +1 -1
- package/out/web3/ed25519/__next.web3.ed25519.txt +1 -1
- package/out/web3/ed25519/__next.web3.txt +1 -1
- package/out/web3/ed25519/index.html +1 -1
- package/out/web3/ed25519/index.txt +2 -2
- package/out/web3/index.html +2 -2
- package/out/web3/index.txt +3 -3
- package/out/web3/tools/__next._full.txt +2 -2
- package/out/web3/tools/__next._head.txt +1 -1
- package/out/web3/tools/__next._index.txt +2 -2
- package/out/web3/tools/__next._tree.txt +1 -1
- package/out/web3/tools/__next.web3.tools.__PAGE__.txt +1 -1
- package/out/web3/tools/__next.web3.tools.txt +1 -1
- package/out/web3/tools/__next.web3.txt +1 -1
- package/out/web3/tools/index.html +1 -1
- package/out/web3/tools/index.txt +2 -2
- package/package.json +1 -1
- package/server/index.js +38 -6
- package/server/src/index.js +3 -1
- package/server/src/utils/mp.js +1 -13
- package/out/_next/static/chunks/02ou_44kkb5dz.js +0 -1
- package/out/_next/static/chunks/02pr2b_eos3~h.js +0 -1
- package/out/_next/static/chunks/07lsjkarm1p9f.css +0 -1
- package/out/_next/static/chunks/0byj66sc-9o0g.js +0 -1
- package/out/_next/static/chunks/0du450zbk4kq_.js +0 -1
- package/out/_next/static/chunks/0imvn_arv36xt.css +0 -1
- package/out/_next/static/chunks/0ji.28mehrvdp.js +0 -1
- package/out/_next/static/chunks/0nct0fubs64d-.js +0 -1
- package/out/_next/static/chunks/0q7ck9f.90_i9.js +0 -1
- package/out/_next/static/chunks/0rr4gwjp9z~9a.js +0 -1
- package/out/lottery/__next._full.txt +0 -21
- package/out/lottery/__next._head.txt +0 -5
- package/out/lottery/__next._index.txt +0 -7
- package/out/lottery/__next._tree.txt +0 -3
- package/out/lottery/__next.lottery.__PAGE__.txt +0 -9
- package/out/lottery/__next.lottery.txt +0 -6
- package/out/lottery/index.html +0 -15
- package/out/lottery/index.txt +0 -21
- /package/out/_next/static/{alUUgRz4oMlw4EtULOYfV → sV38nXrv3xVVO6wvSdFlZ}/_buildManifest.js +0 -0
- /package/out/_next/static/{alUUgRz4oMlw4EtULOYfV → sV38nXrv3xVVO6wvSdFlZ}/_clientMiddlewareManifest.js +0 -0
- /package/out/_next/static/{alUUgRz4oMlw4EtULOYfV → sV38nXrv3xVVO6wvSdFlZ}/_ssgManifest.js +0 -0
package/server/index.js
CHANGED
|
@@ -251,7 +251,9 @@ export function createApp(engine, options = {}) {
|
|
|
251
251
|
if (client.readyState === 1) {
|
|
252
252
|
try {
|
|
253
253
|
client.send(payload)
|
|
254
|
-
} catch {
|
|
254
|
+
} catch (err) {
|
|
255
|
+
console.warn('[WS] Failed to send to client:', err.message)
|
|
256
|
+
}
|
|
255
257
|
}
|
|
256
258
|
})
|
|
257
259
|
}
|
|
@@ -265,7 +267,9 @@ export function createApp(engine, options = {}) {
|
|
|
265
267
|
if (ws.readyState === 1) {
|
|
266
268
|
try {
|
|
267
269
|
ws.send(payload)
|
|
268
|
-
} catch {
|
|
270
|
+
} catch (err) {
|
|
271
|
+
console.warn('[WS] Failed to send to channel subscriber:', err.message)
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
})
|
|
271
275
|
}
|
|
@@ -323,8 +327,12 @@ export function createApp(engine, options = {}) {
|
|
|
323
327
|
app.onError((err, c) => {
|
|
324
328
|
console.error('[API Error]', err)
|
|
325
329
|
try {
|
|
330
|
+
const errorLogPath = path.join(CONFIG_DIR, 'server-error.log')
|
|
331
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
332
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true })
|
|
333
|
+
}
|
|
326
334
|
fs.appendFileSync(
|
|
327
|
-
|
|
335
|
+
errorLogPath,
|
|
328
336
|
`[${new Date().toISOString()}] ${err.stack}\n`
|
|
329
337
|
)
|
|
330
338
|
} catch {}
|
|
@@ -641,7 +649,14 @@ export function createApp(engine, options = {}) {
|
|
|
641
649
|
if (!body.name || !body.name.trim()) {
|
|
642
650
|
return c.json({ error: 'name is required' }, 400)
|
|
643
651
|
}
|
|
644
|
-
const
|
|
652
|
+
const trimmed = body.name.trim()
|
|
653
|
+
if (trimmed.length > 100) {
|
|
654
|
+
return c.json({ error: 'Name too long (max 100 chars)' }, 400)
|
|
655
|
+
}
|
|
656
|
+
if (/[<>]/.test(trimmed)) {
|
|
657
|
+
return c.json({ error: 'Name contains invalid characters' }, 400)
|
|
658
|
+
}
|
|
659
|
+
const success = engine.setDisplayName(trimmed)
|
|
645
660
|
return c.json({ success, displayName: engine.getDisplayName() })
|
|
646
661
|
})
|
|
647
662
|
|
|
@@ -697,6 +712,12 @@ export function createApp(engine, options = {}) {
|
|
|
697
712
|
if (!body.author || !body.authorName) {
|
|
698
713
|
return c.json({ error: 'author and authorName are required' }, 400)
|
|
699
714
|
}
|
|
715
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(body.author)) {
|
|
716
|
+
return c.json({ error: 'Invalid author format' }, 400)
|
|
717
|
+
}
|
|
718
|
+
if (body.authorName.length > 50) {
|
|
719
|
+
return c.json({ error: 'authorName too long' }, 400)
|
|
720
|
+
}
|
|
700
721
|
try {
|
|
701
722
|
const message = await engine.sendMessage(
|
|
702
723
|
name,
|
|
@@ -740,7 +761,10 @@ export function createApp(engine, options = {}) {
|
|
|
740
761
|
const isLocalhost =
|
|
741
762
|
clientIp === 'localhost' ||
|
|
742
763
|
clientIp === '::1' ||
|
|
743
|
-
clientIp === '::ffff:localhost'
|
|
764
|
+
clientIp === '::ffff:localhost' ||
|
|
765
|
+
clientIp === '127.0.0.1' ||
|
|
766
|
+
clientIp === '::ffff:127.0.0.1' ||
|
|
767
|
+
clientIp.startsWith('::ffff:127.')
|
|
744
768
|
if (!isLocalhost) {
|
|
745
769
|
return c.json({ error: 'Forbidden' }, 403)
|
|
746
770
|
}
|
|
@@ -768,6 +792,12 @@ export function createApp(engine, options = {}) {
|
|
|
768
792
|
app.get('*', async c => {
|
|
769
793
|
const pathname = c.req.path
|
|
770
794
|
const filePath = path.join(publicDir, pathname)
|
|
795
|
+
const resolved = path.resolve(filePath)
|
|
796
|
+
const resolvedPublic = path.resolve(publicDir)
|
|
797
|
+
|
|
798
|
+
if (!resolved.startsWith(resolvedPublic + path.sep) && resolved !== resolvedPublic) {
|
|
799
|
+
return c.json({ error: 'Not found' }, 404)
|
|
800
|
+
}
|
|
771
801
|
|
|
772
802
|
if (fs.existsSync(filePath)) {
|
|
773
803
|
const stat = fs.statSync(filePath)
|
|
@@ -813,7 +843,9 @@ export async function main() {
|
|
|
813
843
|
for (const file of staleFiles) {
|
|
814
844
|
try {
|
|
815
845
|
fs.unlinkSync(path.join(UPLOAD_TMP_DIR, file))
|
|
816
|
-
} catch {
|
|
846
|
+
} catch (err) {
|
|
847
|
+
console.warn('[MostBox] Failed to clean upload temp file:', err.message)
|
|
848
|
+
}
|
|
817
849
|
}
|
|
818
850
|
console.log(
|
|
819
851
|
`[MostBox] Cleaned ${staleFiles.length} stale upload temp files`
|
package/server/src/index.js
CHANGED
|
@@ -299,7 +299,9 @@ export class MostBoxEngine extends EventEmitter {
|
|
|
299
299
|
for (const core of this.#channelCores.values()) {
|
|
300
300
|
try {
|
|
301
301
|
await core.close()
|
|
302
|
-
} catch {
|
|
302
|
+
} catch (err) {
|
|
303
|
+
console.warn('[MostBox] Failed to close channel core:', err.message)
|
|
304
|
+
}
|
|
303
305
|
}
|
|
304
306
|
this.#channelCores.clear()
|
|
305
307
|
this.#channelDiscoveries.clear()
|
package/server/src/utils/mp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getBytes
|
|
1
|
+
import { getBytes } from 'ethers'
|
|
2
2
|
import dayjs from 'dayjs'
|
|
3
3
|
import nacl from 'tweetnacl'
|
|
4
4
|
import { generateAvatar } from './avatar.js'
|
|
@@ -103,15 +103,3 @@ export const formatTime = time => {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export const avatar = generateAvatar
|
|
106
|
-
|
|
107
|
-
export { ZeroAddress }
|
|
108
|
-
|
|
109
|
-
const mp = {
|
|
110
|
-
avatar: generateAvatar,
|
|
111
|
-
formatTime,
|
|
112
|
-
getEdKeyPair,
|
|
113
|
-
getIPNS,
|
|
114
|
-
ZeroAddress,
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default mp
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95057,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={formatUrl:function(){return n},formatWithValidation:function(){return c},urlObjectKeys:function(){return l}};for(var o in s)Object.defineProperty(r,o,{enumerable:!0,get:s[o]});let a=e.r(90809)._(e.r(98183)),i=/https?|ftp|gopher|file/;function n(e){let{auth:t,hostname:r}=e,s=e.protocol||"",o=e.pathname||"",n=e.hash||"",l=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),l&&"object"==typeof l&&(l=String(a.urlQueryToSearchParams(l)));let u=e.search||l&&`?${l}`||"";return s&&!s.endsWith(":")&&(s+=":"),e.slashes||(!s||i.test(s))&&!1!==c?(c="//"+(c||""),o&&"/"!==o[0]&&(o="/"+o)):c||(c=""),n&&"#"!==n[0]&&(n="#"+n),u&&"?"!==u[0]&&(u="?"+u),o=o.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${s}${c}${o}${u}${n}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return n(e)}},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let s=e.r(71645);function o(e,t){let r=(0,s.useRef)(null),o=(0,s.useRef)(null);return(0,s.useCallback)(s=>{if(null===s){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=a(e,s)),t&&(o.current=a(t,s))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let s=e.r(18967),o=e.r(52817);function a(e){if(!(0,s.isAbsoluteUrl)(e))return!0;try{let t=(0,s.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return s}});let s=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={default:function(){return g},useLinkStatus:function(){return w}};for(var o in s)Object.defineProperty(r,o,{enumerable:!0,get:s[o]});let a=e.r(90809),i=e.r(43476),n=a._(e.r(71645)),l=e.r(95057),c=e.r(8372),u=e.r(18581),h=e.r(18967),d=e.r(5550);e.r(33525);let p=e.r(88540),f=e.r(91949),m=e.r(73668),y=e.r(9396);function g(t){var r,s;let o,a,g,[w,x]=(0,n.useOptimistic)(f.IDLE_LINK_STATUS),v=(0,n.useRef)(null),{href:k,as:R,children:j,prefetch:T=null,passHref:P,replace:S,shallow:q,scroll:E,onClick:C,onMouseEnter:N,onTouchStart:O,legacyBehavior:A=!1,onNavigate:M,transitionTypes:L,ref:B,unstable_dynamicOnHover:U,...D}=t;o=j,A&&("string"==typeof o||"number"==typeof o)&&(o=(0,i.jsx)("a",{children:o}));let z=n.default.useContext(c.AppRouterContext),H=!1!==T,_=!1!==T?null===(s=T)||"auto"===s?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,$="string"==typeof(r=R||k)?r:(0,l.formatUrl)(r);if(A){if(o?.$$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});a=n.default.Children.only(o)}let F=A?a&&"object"==typeof a&&a.ref:B,I=n.default.useCallback(e=>(null!==z&&(v.current=(0,f.mountLinkInstance)(e,$,z,_,H,x)),()=>{v.current&&((0,f.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,f.unmountPrefetchableInstance)(e)}),[H,$,z,_,x]),W={ref:(0,u.useMergedRef)(I,F),onClick(t){A||"function"!=typeof C||C(t),A&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(t),!z||t.defaultPrevented||function(t,r,s,o,a,i,l){if("u">typeof window){let c,{nodeName:u}=t.currentTarget;if("A"===u.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,m.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:h}=e.r(99781);n.default.startTransition(()=>{h(r,o?"replace":"push",!1===a?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,s.current,l)})}}(t,$,v,S,E,M,L)},onMouseEnter(e){A||"function"!=typeof N||N(e),A&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),z&&H&&(0,f.onNavigationIntent)(e.currentTarget,!0===U)},onTouchStart:function(e){A||"function"!=typeof O||O(e),A&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),z&&H&&(0,f.onNavigationIntent)(e.currentTarget,!0===U)}};return(0,h.isAbsoluteUrl)($)?W.href=$:A&&!P&&("a"!==a.type||"href"in a.props)||(W.href=(0,d.addBasePath)($)),g=A?n.default.cloneElement(a,W):(0,i.jsx)("a",{...D,...W,children:o}),(0,i.jsx)(b.Provider,{value:w,children:g})}e.r(84508);let b=(0,n.createContext)(f.IDLE_LINK_STATUS),w=()=>(0,n.useContext)(b);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},96661,e=>{"use strict";e.s(["mergeClasses",0,(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()])},71987,88973,e=>{"use strict";e.s(["default",0,{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}],71987),e.s(["hasA11yProp",0,e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1}],88973)},5014,e=>{"use strict";var t=e.i(71645),r=e.i(71987),s=e.i(88973),o=e.i(96661);let a=(0,t.createContext)({}),i=(0,t.forwardRef)(({color:e,size:i,strokeWidth:n,absoluteStrokeWidth:l,className:c="",children:u,iconNode:h,...d},p)=>{let{size:f=24,strokeWidth:m=2,absoluteStrokeWidth:y=!1,color:g="currentColor",className:b=""}=(0,t.useContext)(a)??{},w=l??y?24*Number(n??m)/Number(i??f):n??m;return(0,t.createElement)("svg",{ref:p,...r.default,width:i??f??r.default.width,height:i??f??r.default.height,stroke:e??g,strokeWidth:w,className:(0,o.mergeClasses)("lucide",b,c),...!u&&!(0,s.hasA11yProp)(d)&&{"aria-hidden":"true"},...d},[...h.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(u)?u:[u]])});e.s(["default",0,i],5014)},56420,e=>{"use strict";var t=e.i(71645),r=e.i(96661);let s=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var o=e.i(5014);e.s(["default",0,(e,a)=>{let i=(0,t.forwardRef)(({className:i,...n},l)=>(0,t.createElement)(o.default,{ref:l,iconNode:a,className:(0,r.mergeClasses)(`lucide-${s(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,i),...n}));return i.displayName=s(e),i}],56420)},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)},35965,96699,93583,e=>{"use strict";var t=e.i(56420);let r=(0,t.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,r],35965);let s=(0,t.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,s],96699);let o=(0,t.default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);e.s(["Menu",0,o],93583)},40983,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(22016),o=e.i(35965),a=e.i(96699),i=e.i(93583);function n({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)"})]})}let l=[{href:"/docs/getting-started/",label:"文档"},{href:"/ping/",label:"网络"},{href:"/changelog/",label:"更新日志"}];function c(){let[e,c]=(0,r.useState)(!1),[u,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=localStorage.getItem("theme"),t=window.matchMedia("(prefers-color-scheme: dark)").matches;("dark"===e||!e&&t)&&h(!0)},[]),(0,r.useEffect)(()=>{document.documentElement.setAttribute("data-theme",u?"dark":"light"),localStorage.setItem("theme",u?"dark":"light")},[u]),(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)(s.default,{href:"/",className:"mkt-nav-logo",children:[(0,t.jsx)(n,{}),"MOST PEOPLE"]}),(0,t.jsxs)("div",{className:`mkt-nav-links ${e?"open":""}`,children:[l.map(e=>(0,t.jsx)(s.default,{href:e.href,onClick:()=>c(!1),children:e.label},e.href)),(0,t.jsxs)("button",{className:"mkt-theme-toggle mkt-mobile-only",onClick:()=>{h(!u),c(!1)},"aria-label":"切换主题",children:[u?(0,t.jsx)(o.Sun,{size:16}):(0,t.jsx)(a.Moon,{size:16}),u?" 亮色模式":" 暗色模式"]})]}),(0,t.jsxs)("div",{className:"mkt-nav-cta",children:[(0,t.jsx)("button",{className:"mkt-theme-toggle mkt-desktop-only",onClick:()=>h(!u),"aria-label":"切换主题",children:u?(0,t.jsx)(o.Sun,{size:16}):(0,t.jsx)(a.Moon,{size:16})}),(0,t.jsx)(s.default,{href:"/app/",className:"mkt-btn-primary",children:"开始使用"}),(0,t.jsx)("button",{className:"mkt-nav-mobile-toggle",onClick:()=>c(!e),"aria-label":"菜单",children:(0,t.jsx)(i.Menu,{size:24})})]})]})})})}let u=[{href:"/",label:"关于"},{href:"/docs/getting-started/",label:"文档"},{href:"/changelog/",label:"更新日志"},{href:"https://github.com/most-people/most",label:"GitHub",external:!0}];function h(){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:u.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"]})]})})})}e.s(["MarketingLayout",0,function({children:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c,{}),e,(0,t.jsx)(h,{})]})}],40983)},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)},68590,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)},68877,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);e.s(["ArrowRight",0,t],68877)},26913,e=>{"use strict";class t extends Error{name="KyError";get isKyError(){return!0}}class r extends t{name="HTTPError";response;request;options;data;constructor(e,t,r){const s=e.status||0===e.status?e.status:"",o=e.statusText??"",a=`${s} ${o}`.trim(),i=a?`status code ${a}`:"an unknown error";super(`Request failed with ${i}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=r}}class s extends t{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}}class o extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}}class a extends t{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new o(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}class i extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}}class n extends t{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}}let l=(()=>{let e=!1,t=!1,r="function"==typeof globalThis.Request;if("function"==typeof globalThis.ReadableStream&&r)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(e){if(e instanceof Error&&"unsupported BodyInit type"===e.message)return!1;throw e}return e&&!t})(),c="function"==typeof globalThis.AbortController,u="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,h="function"==typeof globalThis.ReadableStream,d="function"==typeof globalThis.FormData,p=["get","post","put","patch","head","delete"],f={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},m=Symbol("stop");class y{options;constructor(e){this.options=e}}let g=e=>new y(e),b={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},w={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},x=new TextEncoder,v=(e,t,r)=>{let s,o=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),s){o+=s.byteLength;let e=0===t?0:o/t;e>=1&&(e=1-Number.EPSILON),r?.({percent:e,totalBytes:Math.max(t,o),transferredBytes:o},s)}s=e},flush(){s&&(o+=s.byteLength,r?.({percent:1,totalBytes:Math.max(t,o),transferredBytes:o},s))}}))},k=e=>null!==e&&"object"==typeof e,R=Symbol("replaceOption"),j=e=>k(e)&&!0===e[R]?{isReplace:!0,value:e.value}:{isReplace:!1,value:e},T=(...e)=>{for(let t of e)if((!k(t)||Array.isArray(t))&&void 0!==t)throw TypeError("The `options` argument must be an object");return M({},...e)},P=(e={},t={})=>{let r=new globalThis.Headers(e),s=t instanceof globalThis.Headers;for(let[e,o]of new globalThis.Headers(t).entries())s&&"undefined"===o||void 0===o?r.delete(e):r.set(e,o);return r},S=e=>{if(!k(e)||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},q=e=>{if(e instanceof URLSearchParams){let t=new URLSearchParams(e),r=e[O];return r&&(t[O]=new Set(r)),t}return e instanceof globalThis.Headers?new globalThis.Headers(e):Array.isArray(e)?[...e]:S(e)?{...e}:e},E=(e,t)=>S(e)&&S(t)?Object.fromEntries(Object.entries({...e,...t}).filter(e=>void 0!==e[1])):P(e,t);function C(e,t,r){return Object.hasOwn(t,r)&&void 0===t[r]?[]:M(e[r]??[],t[r]??[])}let N=(e={},t={})=>({init:C(e,t,"init"),beforeRequest:C(e,t,"beforeRequest"),beforeRetry:C(e,t,"beforeRetry"),beforeError:C(e,t,"beforeError"),afterResponse:C(e,t,"afterResponse")}),O=Symbol("deletedParameters"),A=(e,t)=>{let r=new URLSearchParams,s=new Set;for(let o of[e,t])if(void 0!==o)if(o instanceof URLSearchParams){for(let[e,t]of o.entries())r.append(e,t),s.delete(e);let e=o[O];if(e)for(let t of e)r.delete(t),s.add(t)}else if(Array.isArray(o))for(let e of o){if(!Array.isArray(e)||2!==e.length)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1])),s.delete(String(e[0]))}else if(k(o))for(let[e,t]of Object.entries(o))void 0===t?(r.delete(e),s.add(e)):(r.append(e,String(t)),s.delete(e));else for(let[e,t]of new URLSearchParams(o).entries())r.append(e,t),s.delete(e);return s.size>0&&(r[O]=s),r},M=(...e)=>{let t,r={},s={},o={},a=[];for(let i of e)if(Array.isArray(i))Array.isArray(r)||(r=[]),r=[...r,...i];else if(k(i)){for(let[e,s]of Object.entries(i)){if("signal"===e&&s instanceof globalThis.AbortSignal){a.push(s);continue}let o=j(s),{isReplace:i}=o;if(s=o.value,"context"===e){if(null!=s&&(!k(s)||Array.isArray(s)))throw TypeError("The `context` option must be an object");r={...r,context:null==s?{}:i?{...s}:{...r.context,...s}};continue}if("searchParams"===e){t=null==s?void 0:i||void 0===t?s:A(t,s);continue}k(s)&&!i&&e in r&&(s=M(r[e],s)),r={...r,[e]:s}}if(k(i.hooks)){let{value:e,isReplace:t}=j(i.hooks);o=t?N({},e):N(o,e),r.hooks=o}if(k(i.headers)){let{value:e,isReplace:t}=j(i.headers);s=t?q(e):E(s,e),r.headers=s}}return void 0!==t&&(r.searchParams=t),a.length>0&&(1===a.length?r.signal=a[0]:u?r.signal=AbortSignal.any(a):r.signal=a.at(-1)),r},L={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1};async function B(e,t,r,s){return new Promise((o,a)=>{let i=setTimeout(()=>{r&&r.abort(),a(new n(e))},s.timeout);s.fetch(e,t).then(o).catch(a).then(()=>{clearTimeout(i)})})}async function U(e,{signal:t}){return new Promise((r,s)=>{function o(){clearTimeout(a),s(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",o,{once:!0}));let a=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e)})}let D=Object.prototype.toString,z=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),H=(e,t)=>e instanceof t||e?.name===t.name,_=Symbol("timedOutResponseData"),$="The `schema` argument must follow the Standard Schema specification",F=Object.prototype.toString,I=e=>e instanceof globalThis.Request||"[object Request]"===F.call(e),W=e=>e instanceof globalThis.Response||"[object Response]"===F.call(e),J=async(e,t)=>{if("object"!=typeof t&&"function"!=typeof t||null===t)throw TypeError($);let r=t["~standard"];if("object"!=typeof r||null===r||"function"!=typeof r.validate)throw TypeError($);let s=await r.validate(e);if(s.issues)throw new i(s.issues);return s.value};class K{static create(e,t){var s,o;let i,n=t.hooks?.init??[],l=n.length>0?(i={...t,json:q(t.json),context:q(t.context),headers:q(t.headers),searchParams:Array.isArray(s=t.searchParams)?s.map(e=>[...e]):q(s)},void 0!==t.retry&&(i.retry="object"!=typeof(o=t.retry)?o:{...o,...o.methods&&{methods:[...o.methods]},...o.statusCodes&&{statusCodes:[...o.statusCodes]},...o.afterStatusCodes&&{afterStatusCodes:[...o.afterStatusCodes]}}),i):t;for(let e of n)e(l);let c=new K(e,l),u=async()=>{if("number"==typeof c.#e.timeout&&c.#e.timeout>0x7fffffff)throw RangeError("The `timeout` option cannot be greater than 2147483647");if("number"==typeof c.#e.totalTimeout&&c.#e.totalTimeout>0x7fffffff)throw RangeError("The `totalTimeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await c.#t(),t=e??await c.#r(async()=>c.#s()),s=void 0!==e||c.#o();for(;;){if(void 0===t)return t;if(W(t))try{t=await c.#a(t)}catch(r){if(!(r instanceof a))throw r;let e=await c.#i(r,async()=>c.#s());if(void 0===e)return e;t=e,s=c.#o();continue}let e=t;if(!e.ok&&"opaque"!==e.type&&("function"==typeof c.#e.throwHttpErrors?c.#e.throwHttpErrors(e.status):c.#e.throwHttpErrors)){let o=new r(e,c.#n(e),c.#l());if(o.data=await c.#c(e),s)throw o;let a=await c.#i(o,async()=>c.#s());if(void 0===a)return a;t=a,s=c.#o();continue}break}if(!W(t))return t;if(c.#u(t),c.#e.onDownloadProgress){if("function"!=typeof c.#e.onDownloadProgress)throw TypeError("The `onDownloadProgress` option must be a function");if(!h)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let e=t.clone();c.#h(t);var o=c.#e.onDownloadProgress;if(!e.body)return e;let r={status:e.status,statusText:e.statusText,headers:e.headers};if(204===e.status)return new Response(null,r);let s=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(v(e.body,s,o),r)}return t},d=(async()=>{try{return await u()}catch(t){if(!(t instanceof Error)||c.#d.has(t))throw t;let e=t;for(let t of c.#e.hooks.beforeError){let r=await t({request:c.request,options:c.#l(),error:e,retryCount:c.#p});r instanceof Error&&(e=r)}throw e}finally{let e=c.#f;c.#m(e?.body??void 0),c.request!==e&&c.#m(c.request.body??void 0)}})();for(let[e,t]of Object.entries(f))("bytes"!==e||"function"==typeof globalThis.Response?.prototype?.bytes)&&(d[e]=async r=>{c.request.headers.set("accept",c.request.headers.get("accept")||t);let s=await d;if("json"!==e)return s[e]();let o=await s.text();if(""===o)return void 0!==r?J(void 0,r):JSON.parse(o);let a=l.parseJson?await l.parseJson(o,{request:c.#n(s),response:s}):JSON.parse(o);return void 0===r?a:J(a,r)});return d}static #y(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#g;#p=0;#b;#e;#f;#w;#d=new WeakSet;#x;#v;#k=!1;#R=new WeakMap;constructor(e,t={}){if(this.#b=e,Object.hasOwn(t,"prefixUrl"))throw Error("The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl");if(this.#e={...t,headers:P(this.#b.headers,t.headers),hooks:N({},t.hooks),method:(e=>p.includes(e)?e.toUpperCase():e)(t.method??this.#b.method??"GET"),prefix:String(t.prefix||""),retry:((e={})=>{if("number"==typeof e)return{...L,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error("retry.statusCodes must be an array");let t=Object.fromEntries(Object.entries({...e,methods:e.methods?.map(e=>e.toLowerCase())}).filter(([,e])=>void 0!==e));return{...L,...t}})(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,totalTimeout:t.totalTimeout??!1,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},"string"!=typeof this.#b&&!(this.#b instanceof URL||this.#b instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if("string"==typeof this.#b){if(this.#e.prefix){const e=this.#e.prefix.replace(/\/+$/,""),t=this.#b.replace(/^\/+/,"");this.#b=`${e}/${t}`}if(this.#e.baseUrl){let e;try{e=new URL(this.#b)}catch{}e||(this.#b=new URL(this.#b,new Request(this.#e.baseUrl).url))}}c&&u&&(this.#w=this.#e.signal??this.#b.signal,this.#g=new globalThis.AbortController,this.#e.signal=this.#j()),l&&(this.#e.duplex="half"),void 0!==this.#e.json&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const r=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#b instanceof globalThis.Request&&(d&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!r&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#b,this.#e),(e=>void 0!==e&&(Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0||!!e[O]?.size:"object"==typeof e?Object.keys(e).length>0:"string"==typeof e?e.trim().length>0:!!e))(this.#e.searchParams)){const e=new URL(this.request.url),t=this.#e.searchParams?.[O];if(t)for(const r of t)e.searchParams.delete(r);if("string"==typeof this.#e.searchParams){const t=this.#e.searchParams.replace(/^\?/,"");""!==t&&(e.search=e.search?`${e.search}&${t}`:`?${t}`)}else for(const[t,r]of new URLSearchParams(K.#y(this.#e.searchParams)).entries())e.searchParams.append(t,r);if(this.#e.searchParams&&"object"==typeof this.#e.searchParams&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(const[t,r]of Object.entries(this.#e.searchParams))void 0===r&&e.searchParams.delete(t);this.request=new globalThis.Request(e,this.#e)}if(this.#e.onUploadProgress&&"function"!=typeof this.#e.onUploadProgress)throw TypeError("The `onUploadProgress` option must be a function");this.#v="number"==typeof this.#e.totalTimeout?this.#T():void 0}#P(){let e=this.#e.retry.delay(this.#p+1),t=e;return!0===this.#e.retry.jitter?t=Math.random()*e:"function"==typeof this.#e.retry.jitter&&(!Number.isFinite(t=this.#e.retry.jitter(e))||t<0)&&(t=e),Math.min(this.#e.retry.backoffLimit,t)}async #S(e){if(this.#p>=this.#e.retry.limit)throw e;let t=e instanceof Error?e:new o(e);if(t instanceof a)return t.customDelay??this.#P();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#e.retry.shouldRetry){let r=await this.#e.retry.shouldRetry({error:t,retryCount:this.#p+1});if(!1===r)throw e;if(!0===r)return this.#P()}if(H(e,n)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#P()}if(H(e,r)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);return(Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now()),Number.isFinite(e))?(e=Math.max(0,e),Math.min(this.#e.retry.maxRetryAfter,e)):Math.min(this.#e.retry.maxRetryAfter,this.#P())}if(413===e.response.status)throw e;return this.#P()}if(!H(e,s))throw e;return this.#P()}#u(e){let t=this.#n(e);return this.#e.parseJson&&(e.json=async()=>{let r=await e.text();return""===r?JSON.parse(r):this.#e.parseJson(r,{request:t,response:e})}),e}async #c(e){let t=await this.#q(e,this.#E());if(t===_)return void this.#C();if(!t)return;if(!this.#N(e.headers.get("content-type")??""))return t;let r=await this.#O(t,e,this.#E(),this.#n(e));return r===_?void this.#C():r}#E(){let e=!1===this.#e.timeout?1e4:this.#e.timeout,t=this.#A();if(void 0===t)return e;if(t<=0)throw new n(this.request);return Math.min(e,t)}#N(e){let t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async #q(e,t){let r,{body:s}=e;if(!s)try{return await e.text()}catch{return}try{r=s.getReader()}catch{return}let o=(e=>{let t=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(e),r=t?.[1]??t?.[2];if(r)try{return new TextDecoder(r)}catch{}return new TextDecoder})(e.headers.get("content-type")??""),a=[],i=0,n=(async()=>{try{for(;;){let{done:e,value:t}=await r.read();if(e)break;if((i+=t.byteLength)>0xa00000)return void r.cancel().catch(()=>void 0);a.push(o.decode(t,{stream:!0}))}}catch{return}return a.push(o.decode()),a.join("")})(),l=new Promise(e=>{let r=setTimeout(()=>{e(_)},t);n.finally(()=>{clearTimeout(r)})}),c=await Promise.race([n,l]);return c===_&&r.cancel().catch(()=>void 0),c}async #O(e,t,r,s){let o;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:s,response:t}):JSON.parse(e)),new Promise(e=>{o=setTimeout(()=>{e(_)},r)})])}catch{return}finally{clearTimeout(o)}}#m(e){e&&e.cancel().catch(()=>void 0)}#h(e){this.#m(e.body??void 0)}#j(){return this.#w?AbortSignal.any([this.#w,this.#g.signal]):this.#g.signal}#C(){let e=this.#A();if(void 0!==e&&e<=0)throw new n(this.request)}async #t(){for(let e of this.#e.hooks.beforeRequest){let t=await e({request:this.request,options:this.#l(),retryCount:0});if(I(t))this.#M(t);else if(W(t))return t}}async #a(e){let t=this.#n(e);for(let r of this.#e.hooks.afterResponse){let s,o=this.#L(e.clone(),t);this.#u(o);try{s=await r({request:this.request,options:this.#l(),response:o,retryCount:this.#p})}catch(t){throw o!==e&&this.#h(o),this.#h(e),t}if(s instanceof y)throw o!==e&&this.#h(o),this.#h(e),new a(s.options);let i=W(s)?this.#L(s,t):e;o!==e&&o!==i&&o.body!==i.body&&this.#h(o),e!==i&&e.body!==i.body&&this.#h(e),e=i}return e}async #r(e){try{return await e()}catch(t){return this.#i(t,e)}}async #i(e,t){this.#k=!1;let r=Math.min(await this.#S(e),0x7fffffff),s={signal:this.#w},o=this.#A();if(void 0!==o){if(o<=0)throw new n(this.request);if(r>=o)throw await U(o,s),new n(this.request)}if(await U(r,s),this.#C(),e instanceof a&&e.customRequest){let t=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#M(t)}for(let t of this.#e.hooks.beforeRetry){let r;try{r=await t({request:this.request,options:this.#l(),error:e,retryCount:this.#p+1})}catch(t){throw t instanceof Error&&t!==e&&this.#d.add(t),t}if(I(r)){this.#M(r);break}if(W(r))return this.#k=!0,this.#p++,r;if(r===m)return}return this.#C(),this.#p++,this.#r(t)}#o(){let e=this.#k;return this.#k=!1,e}async #s(){this.#g?.signal.aborted&&(this.#g=new globalThis.AbortController,this.#e.signal=this.#j(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=(e=>{let t={};for(let r in e)Object.hasOwn(e,r)&&(r in w||r in b||(t[r]=e[r]));return t})(this.#e),t=this.#e.retry.limit>0?this.request.clone():void 0,r=this.#B(this.request,this.#e.body??void 0);this.#f=r,t&&(this.request=t);try{let t=this.#A();if(void 0!==t&&t<=0)throw new n(this.request);let s=!1===this.#e.timeout?t:void 0===t?this.#e.timeout:Math.min(this.#e.timeout,t),o=void 0===s?await this.#e.fetch(r,e):await B(r,e,this.#g,{timeout:s,fetch:this.#e.fetch});return this.#L(o,r)}catch(e){if(function(e){if(!(e&&"[object Error]"===D.call(e)&&"TypeError"===e.name&&"string"==typeof e.message))return!1;let{message:t,stack:r}=e;return"Load failed"===t?void 0===r||"__sentry_captured__"in e:!!(t.startsWith("error sending request for url")||"Failed to fetch"===t||t.startsWith("Failed to fetch (")&&t.endsWith(")"))||z.has(t)}(e))throw new s(this.request,{cause:e});throw e}}#A(){if(void 0===this.#v)return;let e=this.#T()-this.#v;return Math.max(0,this.#e.totalTimeout-e)}#T(){return globalThis.performance?.now()??Date.now()}#l(){if(!this.#x){let{hooks:e,json:t,parseJson:r,stringifyJson:s,searchParams:o,timeout:a,totalTimeout:i,throwHttpErrors:n,fetch:l,...c}=this.#e;this.#x=Object.freeze(c)}return this.#x}#M(e){this.#x=void 0,this.request=e}#n(e){return this.#R.get(e)??this.request}#L(e,t){return this.#R.set(e,t),e}#B(e,t){return this.#e.onUploadProgress&&e.body&&l?((e,t,r)=>{if(!e.body)return e;let s=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,s]of e)t+=40,t+=x.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,t+="string"==typeof s?x.encode(s).byteLength:s.size;return t}return e instanceof Blob?e.size:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:"string"==typeof e?x.encode(e).byteLength:e instanceof URLSearchParams?x.encode(e.toString()).byteLength:0})(r??e.body);return new Request(e,{duplex:"half",body:v(e.body,s,t)})})(e,this.#e.onUploadProgress,t??this.#e.body??void 0):e}}let V=e=>{let t=(t,r)=>K.create(t,T(e,r));for(let r of p)t[r]=(t,s)=>K.create(t,T(e,s,{method:r}));return t.create=e=>V(T(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),V(T(e,t))),t.stop=m,t.retry=g,t},G=V(),X="mostbox_backend_url";function Z(){let e=localStorage.getItem(X)||"";return G.create({prefix:e})}let Q=Z();async function Y(){try{return(await fetch("/api/node-id",{method:"GET",signal:AbortSignal.timeout(2e3)})).ok}catch{return!1}}async function ee(){try{return(await fetch("http://localhost:1976/api/node-id",{method:"GET",signal:AbortSignal.timeout(2e3)})).ok}catch{return!1}}e.s(["api",()=>Q,"detectLocalhostBackend",0,ee,"detectSameOriginBackend",0,Y,"setBackendUrl",0,function(e){let t=(e||"").trim().replace(/\/+$/,"");t?localStorage.setItem(X,t):localStorage.removeItem(X),Q=Z()}],26913)},57657,e=>{"use strict";let t=(0,e.i(56420).default)("ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);e.s(["Ticket",0,t],57657)},70904,e=>{"use strict";let t=(0,e.i(56420).default)("wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);e.s(["Wallet",0,t],70904)},82022,e=>{"use strict";let t=(0,e.i(56420).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],82022)},31713,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(22016),o=e.i(56420);let a=(0,o.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var i=e.i(68590),n=e.i(70904),l=e.i(68877);let c=(0,o.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var u=e.i(89664),h=e.i(82022),d=e.i(57657),p=e.i(62368),f=e.i(26913);let m=[{id:"app",title:"MostBox",subtitle:"P2P 文件分享",icon:(0,t.jsx)(a,{size:28}),path:"/app/",requiresBackend:!0,hero:"P2P 文件分享,无需注册",desc:"基于 Hyperswarm 的去中心化文件传输,让文件分享回归点对点。不限速、不限量、不追踪。",features:["无需注册,打开浏览器即用","Hyperswarm P2P 直连传输","GB 级大文件流式处理","相同文件 = 相同 CID,链接永久有效","频道加密聊天,实时通讯","MIT 开源,数据完全自主掌控"],steps:[{num:"1",title:"下载桌面客户端",desc:"支持 Windows、macOS 和 Linux。",link:"/download",linkText:"前往下载页"},{num:"2",title:"安装并运行",desc:"安装后打开应用,即可使用。"},{num:"3",title:"开始分享",desc:"上传文件,复制链接,发给朋友即可。"}]},{id:"chat",title:"P2P 聊天",subtitle:"频道加密通讯",icon:(0,t.jsx)(i.MessageSquare,{size:28}),path:"/chat/",requiresBackend:!0,hero:"去中心化频道聊天",desc:"基于 Hypercore 的 P2P 加密即时通讯。创建频道,邀请朋友,端到端加密,无需服务器中转。",features:["P2P 加密频道消息","匿名 / 实名身份切换","消息通过 Hyperswarm 网络同步","离线消息自动同步","无需注册即可使用"],steps:[{num:"1",title:"下载桌面客户端",desc:"支持 Windows、macOS 和 Linux。",link:"/download",linkText:"前往下载页"},{num:"2",title:"创建频道",desc:"输入任意频道名即可加入或创建。"},{num:"3",title:"开始聊天",desc:"发送消息,P2P 网络自动同步给所有在线节点。"}]},{id:"web3",title:"Web3",subtitle:"账户工具箱",icon:(0,t.jsx)(n.Wallet,{size:28}),path:"/web3/",requiresBackend:!1,hero:"确定性密钥派生工具箱",desc:"纯前端运行的 Web3 账户工具。输入用户名和密码,即可生成 Ed25519 / x25519 密钥对、助记词、以太坊地址,支持 PEM 导出和地址派生。",features:["纯前端运行,无需后端","Ed25519 / x25519 密钥对生成","BIP-39 助记词派生","以太坊地址与私钥导出","PEM 格式密钥导出","二维码展示地址与助记词"],steps:[{num:"1",title:"输入用户名",desc:"用户名 + 密码(可选)作为种子。"},{num:"2",title:"查看密钥",desc:"即时生成 Ed25519、x25519 公钥与 IPNS ID。"},{num:"3",title:"导出使用",desc:"复制地址、导出 PEM、派生子地址。"}]},{id:"lottery",title:"彩票",subtitle:"去中心化彩票协议",icon:(0,t.jsx)(d.Ticket,{size:28}),path:"/lottery/",requiresBackend:!1,hero:"完全链上、可验证、公平的彩票协议",desc:"基于智能合约的去中心化彩票系统。固定票价 1 USDC,多奖项分级,开奖结果完全由链上随机数决定,无人可操控。",features:["固定票价 1 USDC,简单透明","多奖项分级:一等奖 50%、二等奖 10%、三等奖 5%、参与奖 35%","Chainlink VRF 提供可验证随机数","完全链上执行,无托管风险","所有结果公开可验证","部署在 Base 链,低 gas 成本"],steps:[{num:"1",title:"连接钱包",desc:"使用 MetaMask 或其他兼容钱包连接。"},{num:"2",title:"购买彩票",desc:"选择数量,确认购买,每张 1 USDC。"},{num:"3",title:"等待开奖",desc:"倒计时结束后自动开奖,奖金自动发放。"}]}];function y(){let[e,o]=(0,r.useState)("app"),[a,i]=(0,r.useState)(null),[n,d]=(0,r.useState)(!0);(0,r.useEffect)(()=>{!async function(){if(await (0,f.detectSameOriginBackend)()){(0,f.setBackendUrl)(""),i(!0),d(!1);return}if(await (0,f.detectLocalhostBackend)()){(0,f.setBackendUrl)("http://localhost:1976"),i(!0),d(!1);return}i(!1),d(!1)}()},[]);let y=m.find(t=>t.id===e)||m[0];return(0,t.jsxs)("div",{className:"portal-page",children:[(0,t.jsx)("section",{className:"portal-hero",children:(0,t.jsxs)("div",{className:"mkt-container",children:[(0,t.jsx)("h1",{className:"portal-hero-title",children:"MOST PEOPLE"}),(0,t.jsx)("p",{className:"portal-hero-subtitle",children:"去中心化 P2P 工具箱"})]})}),(0,t.jsx)("section",{className:"portal-cards-section",children:(0,t.jsx)("div",{className:"mkt-container",children:(0,t.jsx)("div",{className:"portal-cards",children:m.map(r=>{let i=e===r.id,l=r.requiresBackend,u=n?"checking":l?a?"connected":"disconnected":"none";return(0,t.jsxs)("button",{className:`portal-card ${i?"active":""}`,onClick:()=>o(r.id),children:[(0,t.jsx)(s.default,{href:r.path,className:"portal-card-open-btn",onClick:e=>e.stopPropagation(),title:`打开${r.title}`,children:(0,t.jsx)(c,{size:16})}),(0,t.jsx)("div",{className:"portal-card-icon",children:r.icon}),(0,t.jsx)("div",{className:"portal-card-title",children:r.title}),(0,t.jsx)("div",{className:"portal-card-subtitle",children:r.subtitle}),l&&(0,t.jsxs)("div",{className:`portal-card-status ${u}`,children:["checking"===u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"status-dot checking"}),"检测中"]}),"connected"===u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"status-dot connected"}),"已连接"]}),"disconnected"===u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"status-dot disconnected"}),"桌面端可用"]})]})]},r.id)})})})}),(0,t.jsx)("section",{className:"portal-marketing",children:(0,t.jsx)("div",{className:"mkt-container",children:(0,t.jsx)("div",{className:"portal-marketing-inner",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"portal-marketing-header",children:[(0,t.jsx)("h2",{children:y.hero}),(0,t.jsx)("p",{children:y.desc})]}),(0,t.jsx)("div",{className:"portal-marketing-features",children:y.features.map((e,r)=>(0,t.jsxs)("div",{className:"portal-feature-item",children:[(0,t.jsx)("span",{className:"portal-feature-icon",children:(0,t.jsx)(u.Check,{size:14,strokeWidth:3})}),(0,t.jsx)("span",{children:e})]},r))}),(0,t.jsx)("div",{className:"portal-marketing-steps",children:y.steps.map(e=>(0,t.jsxs)("div",{className:"portal-step",children:[(0,t.jsx)("span",{className:"portal-step-num",children:e.num}),(0,t.jsxs)("div",{className:"portal-step-content",children:[(0,t.jsx)("strong",{children:e.title}),(0,t.jsx)("p",{children:e.desc}),e.code&&(0,t.jsx)("code",{className:"portal-step-code",children:e.code}),e.link&&(0,t.jsx)("p",{className:"portal-step-link",children:(0,t.jsxs)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",children:[e.linkText," ",(0,t.jsx)(h.ExternalLink,{size:12})]})})]})]},e.num))}),(0,t.jsxs)("div",{className:"portal-actions",children:[(0,t.jsxs)(s.default,{href:y.path,className:"mkt-btn-primary",children:["进入 ",y.title,(0,t.jsx)(l.ArrowRight,{size:16})]}),y.requiresBackend&&!1===a&&(0,t.jsxs)(s.default,{href:"/download",className:"mkt-btn-secondary",children:[(0,t.jsx)(p.Download,{size:16}),"下载桌面客户端"]})]})]})})})})]})}var g=e.i(40983);e.s(["default",0,function(){return(0,t.jsx)(g.MarketingLayout,{children:(0,t.jsx)(y,{})})}],31713)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,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,96699,93583,e=>{"use strict";var t=e.i(56420);let s=(0,t.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,s],35965);let a=(0,t.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);let l=(0,t.default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);e.s(["Menu",0,l],93583)},59665,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(93583),l=e.i(5142);let i=(0,s.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:r,headerRight:n,children:d}){let[c,o]=(0,l.useDisclosure)(!1),[h,u]=(0,s.useState)(!1),m=function(e,{getInitialValueInEffect:t}={getInitialValueInEffect:!0}){let[a,l]=(0,s.useState)(t?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,s.useEffect)(()=>{try{if("matchMedia"in window){let t=window.matchMedia(e);l(t.matches);let s=e=>l(e.matches);return t.addEventListener("change",s),()=>{t.removeEventListener("change",s)}}}catch(e){return}},[e]),a||!1}("(max-width: 768px)");return(0,t.jsx)(i.Provider,{value:{closeSidebar:o.close},children:(0,t.jsxs)("div",{className:"app-layout",children:[(0,t.jsx)("div",{className:`sidebar-overlay ${c?"visible":""}`,onClick:()=>o.close()}),(0,t.jsx)("div",{className:`sidebar ${c?"open":""} ${h?"collapsed":""}`,children:e({closeSidebar:o.close})}),(0,t.jsxs)("div",{className:"main-content",children:[(0,t.jsxs)("header",{className:"app-header",children:[(0,t.jsxs)("div",{className:"header-left",children:[(0,t.jsx)("button",{onClick:()=>{m?o.toggle():u(!h)},className:"icon-btn sidebar-toggle-btn","aria-label":m?"打开菜单":h?"展开侧边栏":"收起侧边栏",children:(0,t.jsx)(a.Menu,{size:16})}),r]}),(0,t.jsx)("div",{className:"header-right",children:n})]}),d]})]})})}],59665)},57657,e=>{"use strict";let t=(0,e.i(56420).default)("ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);e.s(["Ticket",0,t],57657)},39913,e=>{"use strict";let t;var s=e.i(43476),a=e.i(71645),l=e.i(11241),i=e.i(35965),r=e.i(96699),n=e.i(59665),d=e.i(9817);let c=e=>{let t,s=new Set,a=(e,a)=>{let l="function"==typeof e?e(t):e;if(!Object.is(l,t)){let e=t;t=(null!=a?a:"object"!=typeof l||null===l)?l:Object.assign({},t,l),s.forEach(s=>s(t,e))}},l=()=>t,i={setState:a,getState:l,getInitialState:()=>r,subscribe:e=>(s.add(e),()=>s.delete(e))},r=t=e(a,l,i);return i},o=e=>{let t=e?c(e):c,s=e=>(function(e,t=e=>e){let s=a.default.useSyncExternalStore(e.subscribe,a.default.useCallback(()=>t(e.getState()),[e,t]),a.default.useCallback(()=>t(e.getInitialState()),[e,t]));return a.default.useDebugValue(s),s})(t,e);return Object.assign(s,t),s},h=(t=e=>({currentRound:43,status:"buying",endTime:new Date(Date.now()+72e5+18e5),totalTickets:1250,prizePool:1250,myTickets:[{id:"ticket-001",roundId:43,number:"123456",status:"pending"},{id:"ticket-002",roundId:43,number:"789012",status:"pending"},{id:"ticket-003",roundId:43,number:"345678",status:"pending"}],history:[{roundId:42,date:"2026-04-24T20:00:00Z",prizePool:1250,winners:[{tier:"一等奖",address:"0x1a2b...3c4d",amount:625},{tier:"二等奖",address:"0x5e6f...7g8h",amount:125},{tier:"三等奖",address:"0x9i0j...1k2l",amount:62.5},{tier:"参与奖",amount:.35,tickets:1247}]},{roundId:41,date:"2026-04-23T20:00:00Z",prizePool:980,winners:[{tier:"一等奖",address:"0x7q8r...9s0t",amount:490},{tier:"二等奖",address:"0x1u2v...3w4x",amount:98},{tier:"三等奖",address:"0x5y6z...7a8b",amount:49},{tier:"参与奖",amount:.35,tickets:977}]},{roundId:40,date:"2026-04-22T20:00:00Z",prizePool:1500,winners:[{tier:"一等奖",address:"0x3g4h...5i6j",amount:750},{tier:"二等奖",address:"0x7k8l...9m0n",amount:150},{tier:"三等奖",address:"0x1o2p...3q4r",amount:75},{tier:"参与奖",amount:.35,tickets:1497}]}],buyTickets:t=>e(e=>{let s=[];for(let a=0;a<t;a++)s.push({id:`ticket-${Date.now()}-${a}`,roundId:e.currentRound,number:Math.floor(1e5+9e5*Math.random()).toString(),status:"pending"});return{myTickets:[...e.myTickets,...s],totalTickets:e.totalTickets+t,prizePool:e.prizePool+t}})}))?o(t):o;function u(){let{currentRound:e,prizePool:t,totalTickets:l,endTime:i,status:r}=h(),[n,d]=(0,a.useState)({hours:0,minutes:0,seconds:0});return(0,a.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now(),t=Math.max(0,i.getTime()-e);d({hours:Math.floor(t/36e5),minutes:Math.floor(t%36e5/6e4),seconds:Math.floor(t%6e4/1e3)})},1e3);return()=>clearInterval(e)},[i]),(0,s.jsxs)("div",{className:"lottery-dashboard",children:[(0,s.jsxs)("div",{className:"lottery-stats-grid",children:[(0,s.jsxs)("div",{className:"lottery-stat-card",children:[(0,s.jsx)("div",{className:"lottery-stat-label",children:"当前轮次"}),(0,s.jsxs)("div",{className:"lottery-stat-value accent",children:["#",e]})]}),(0,s.jsxs)("div",{className:"lottery-stat-card",children:[(0,s.jsx)("div",{className:"lottery-stat-label",children:"奖池金额"}),(0,s.jsxs)("div",{className:"lottery-stat-value gold",children:[t," USDC"]})]}),(0,s.jsxs)("div",{className:"lottery-stat-card",children:[(0,s.jsx)("div",{className:"lottery-stat-label",children:"已售票数"}),(0,s.jsx)("div",{className:"lottery-stat-value",children:l})]}),(0,s.jsxs)("div",{className:"lottery-stat-card",children:[(0,s.jsx)("div",{className:"lottery-stat-label",children:"状态"}),(0,s.jsx)("div",{className:"lottery-stat-value accent",children:"buying"===r?"购票中":"drawing"===r?"开奖中":"已结束"})]})]}),(0,s.jsxs)("div",{className:"lottery-countdown",children:[(0,s.jsx)("div",{className:"lottery-countdown-label",children:"距离开奖还有"}),(0,s.jsxs)("div",{className:"lottery-countdown-timer",children:[(0,s.jsxs)("div",{className:"lottery-countdown-unit",children:[(0,s.jsx)("div",{className:"lottery-countdown-number",children:n.hours}),(0,s.jsx)("div",{className:"lottery-countdown-text",children:"小时"})]}),(0,s.jsxs)("div",{className:"lottery-countdown-unit",children:[(0,s.jsx)("div",{className:"lottery-countdown-number",children:n.minutes}),(0,s.jsx)("div",{className:"lottery-countdown-text",children:"分钟"})]}),(0,s.jsxs)("div",{className:"lottery-countdown-unit",children:[(0,s.jsx)("div",{className:"lottery-countdown-number",children:n.seconds}),(0,s.jsx)("div",{className:"lottery-countdown-text",children:"秒"})]})]})]})]})}function m(){let[e,t]=(0,a.useState)(1),{buyTickets:l,status:i}=h(),r="buying"!==i;return(0,s.jsxs)("div",{className:"lottery-buy-section",children:[(0,s.jsx)("div",{className:"lottery-buy-title",children:"购买彩票"}),(0,s.jsxs)("div",{className:"lottery-buy-controls",children:[(0,s.jsxs)("div",{className:"lottery-quantity-selector",children:[(0,s.jsx)("button",{className:"lottery-quantity-btn",onClick:()=>t(Math.max(1,e-1)),disabled:e<=1,children:"-"}),(0,s.jsx)("div",{className:"lottery-quantity-value",children:e}),(0,s.jsx)("button",{className:"lottery-quantity-btn",onClick:()=>t(Math.min(100,e+1)),disabled:e>=100,children:"+"})]}),(0,s.jsxs)("div",{className:"lottery-total",children:["总计: ",(0,s.jsxs)("span",{className:"lottery-total-amount",children:[+e," USDC"]})]}),(0,s.jsx)("button",{className:"lottery-buy-btn",onClick:()=>{l(e),t(1)},disabled:r,children:r?"购票已关闭":`购买 ${e} 张彩票`})]})]})}var y=e.i(57657);function x(){let{myTickets:e}=h();return 0===e.length?(0,s.jsxs)("div",{className:"lottery-empty-state",children:[(0,s.jsx)("div",{className:"lottery-empty-state-icon",children:(0,s.jsx)(y.Ticket,{size:48})}),(0,s.jsx)("p",{children:"还没有购买彩票"}),(0,s.jsx)("p",{className:"hint-text",children:"前往仪表盘购买你的第一张彩票吧!"})]}):(0,s.jsx)("div",{className:"lottery-tickets-grid",children:e.map(e=>(0,s.jsxs)("div",{className:`lottery-ticket-card ${"winner"===e.status?"winner":""}`,children:[(0,s.jsxs)("div",{className:"lottery-ticket-header",children:[(0,s.jsxs)("span",{className:"lottery-ticket-round",children:["第 ",e.roundId," 轮"]}),(0,s.jsxs)("span",{className:`lottery-ticket-status ${e.status}`,children:["pending"===e.status&&"待开奖","winner"===e.status&&`中奖 - ${e.prizeTier}`,"loser"===e.status&&"未中奖"]})]}),(0,s.jsx)("div",{className:"lottery-ticket-number",children:e.number}),(0,s.jsxs)("div",{className:"lottery-ticket-id",children:["ID: ",e.id]}),"winner"===e.status&&e.prizeAmount&&(0,s.jsxs)("div",{className:"lottery-stat-value gold",style:{marginTop:"8px",fontSize:"16px"},children:["+",e.prizeAmount," USDC"]})]},e.id))})}let j=[{icon:"🥇",name:"一等奖",percent:50,desc:"1 名独享"},{icon:"🥈",name:"二等奖",percent:10,desc:"1 名独享"},{icon:"🥉",name:"三等奖",percent:5,desc:"1 名独享"},{icon:"🎫",name:"参与奖",percent:35,desc:"未中奖者平分"}];function v(){return(0,s.jsxs)("div",{className:"lottery-prize-tier",children:[(0,s.jsx)("div",{className:"lottery-prize-title",children:"奖项分配"}),(0,s.jsx)("div",{className:"lottery-prize-list",children:j.map(e=>(0,s.jsxs)("div",{className:"lottery-prize-item",children:[(0,s.jsxs)("div",{className:"lottery-prize-left",children:[(0,s.jsx)("span",{className:"lottery-prize-icon",children:e.icon}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"lottery-prize-name",children:e.name}),(0,s.jsx)("span",{className:"lottery-prize-desc",children:e.desc})]})]}),(0,s.jsxs)("span",{className:"lottery-prize-percent",children:[e.percent,"%"]})]},e.name))})]})}function p(){let{history:e}=h();return 0===e.length?(0,s.jsx)("div",{className:"lottery-empty-state",children:(0,s.jsx)("p",{children:"暂无开奖记录"})}):(0,s.jsx)("div",{className:"lottery-history-list",children:e.map(e=>(0,s.jsxs)("div",{className:"lottery-history-item",children:[(0,s.jsxs)("div",{className:"lottery-history-header",children:[(0,s.jsxs)("span",{className:"lottery-history-round",children:["第 ",e.roundId," 轮"]}),(0,s.jsx)("span",{className:"lottery-history-date",children:new Date(e.date).toLocaleString("zh-CN")})]}),(0,s.jsxs)("div",{className:"lottery-history-pool",children:["奖池:"," ",(0,s.jsxs)("span",{className:"lottery-history-pool-amount",children:[e.prizePool," USDC"]})]}),(0,s.jsx)("div",{className:"lottery-history-winners",children:e.winners.map((e,t)=>(0,s.jsxs)("div",{className:"lottery-history-winner",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"lottery-winner-tier",children:e.tier}),(0,s.jsx)("div",{className:"lottery-winner-address",children:e.address})]}),(0,s.jsxs)("div",{className:"lottery-winner-amount",children:[`+${e.amount}`," USDC"]})]},t))})]},e.roundId))})}e.s(["default",0,function(){let{isDarkMode:e,setIsDarkMode:t}=(0,d.useApp)(),[c,o]=(0,a.useState)("dashboard"),h=[{id:"dashboard",label:"仪表盘"},{id:"tickets",label:"我的彩票"},{id:"history",label:"开奖历史"}];return(0,s.jsx)(n.default,{sidebar:({closeSidebar:e})=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"sidebar-header",children:(0,s.jsx)("button",{className:"back-btn",onClick:()=>window.location.href="/",title:"返回首页",children:(0,s.jsx)(l.ArrowLeft,{size:18})})}),(0,s.jsx)("nav",{className:"sidebar-nav",children:h.map(t=>(0,s.jsx)("button",{onClick:()=>{o(t.id),e()},className:`sidebar-nav-btn ${c===t.id?"active":""}`,children:(0,s.jsx)("span",{children:t.label})},t.id))})]}),headerTitle:(0,s.jsx)("h2",{className:"header-title",children:"去中心化彩票"}),headerRight:(0,s.jsx)("button",{className:"icon-btn",onClick:()=>t(!e),title:"切换主题",children:e?(0,s.jsx)(i.Sun,{size:16}):(0,s.jsx)(r.Moon,{size:16})}),children:(0,s.jsx)("div",{className:"lottery-page",children:(0,s.jsxs)("div",{className:"lottery-container",children:[(0,s.jsx)("div",{className:"lottery-tabs",children:h.map(e=>(0,s.jsx)("button",{onClick:()=>o(e.id),className:`lottery-tab ${c===e.id?"active":""}`,children:e.label},e.id))}),"dashboard"===c&&(0,s.jsxs)("div",{className:"lottery-tab-content",children:[(0,s.jsx)(u,{}),(0,s.jsx)(v,{}),(0,s.jsx)(m,{})]}),"tickets"===c&&(0,s.jsx)("div",{className:"lottery-tab-content",children:(0,s.jsx)(x,{})}),"history"===c&&(0,s.jsx)("div",{className:"lottery-tab-content",children:(0,s.jsx)(p,{})})]})})})}],39913)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.lottery-page{padding:var(--space-8) var(--space-4);flex-direction:column;flex:1;align-items:center;display:flex;overflow:auto}.lottery-container{width:100%;max-width:720px}.lottery-tabs{gap:var(--space-2);margin-bottom:var(--space-6);background:var(--glass-bg-subtle);border:1px solid var(--glass-border);border-radius:var(--radius-full);padding:var(--space-1);display:flex}.lottery-tab{padding:var(--space-2) var(--space-4);color:var(--text-secondary);border-radius:var(--radius-full);cursor:pointer;transition:all var(--transition-fast);background:0 0;border:none;flex:1;font-size:14px;font-weight:500}.lottery-tab:hover{color:var(--text-primary)}.lottery-tab.active{background:var(--accent);color:#fff}.lottery-tab-content{gap:var(--space-6);flex-direction:column;display:flex}.lottery-dashboard{gap:var(--space-4);flex-direction:column;display:flex}.lottery-stats-grid{gap:var(--space-4);grid-template-columns:repeat(2,1fr);display:grid}@media (max-width:640px){.lottery-stats-grid{grid-template-columns:1fr}}.lottery-stat-card{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-lg);padding:var(--space-5);box-shadow:var(--glass-shadow);text-align:center}.lottery-stat-label{color:var(--text-secondary);margin-bottom:var(--space-2);font-size:13px}.lottery-stat-value{color:var(--text-primary);font-size:24px;font-weight:700}.lottery-stat-value.accent{color:var(--accent)}.lottery-stat-value.gold{color:#f59e0b}.lottery-countdown{background:var(--glass-bg-heavy);-webkit-backdrop-filter:var(--blur-lg);backdrop-filter:var(--blur-lg);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-6);text-align:center;box-shadow:var(--glass-shadow-lg)}.lottery-countdown-label{color:var(--text-secondary);margin-bottom:var(--space-3);font-size:14px}.lottery-countdown-timer{justify-content:center;gap:var(--space-4);display:flex}.lottery-countdown-unit{flex-direction:column;align-items:center;display:flex}.lottery-countdown-number{color:var(--accent);font-size:32px;font-weight:700;font-family:var(--font-mono)}.lottery-countdown-text{color:var(--text-muted);margin-top:var(--space-1);font-size:12px}.lottery-prize-tier{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-6);box-shadow:var(--glass-shadow)}.lottery-prize-title{margin-bottom:var(--space-4);text-align:center;font-size:18px;font-weight:600}.lottery-prize-list{gap:var(--space-3);flex-direction:column;display:flex}.lottery-prize-item{padding:var(--space-3) var(--space-4);background:var(--glass-bg-subtle);border-radius:var(--radius-md);border:1px solid var(--glass-border);justify-content:space-between;align-items:center;display:flex}.lottery-prize-left{align-items:center;gap:var(--space-3);display:flex}.lottery-prize-icon{font-size:20px}.lottery-prize-name{color:var(--text-primary);font-size:14px;font-weight:500}.lottery-prize-desc{color:var(--text-muted);margin-top:2px;font-size:12px;display:block}.lottery-prize-percent{color:var(--accent);font-size:16px;font-weight:700;font-family:var(--font-mono)}.lottery-buy-section{background:var(--glass-bg-heavy);-webkit-backdrop-filter:var(--blur-lg);backdrop-filter:var(--blur-lg);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-6);box-shadow:var(--glass-shadow-lg)}.lottery-buy-title{margin-bottom:var(--space-4);text-align:center;font-size:18px;font-weight:600}.lottery-buy-controls{gap:var(--space-4);flex-direction:column;align-items:center;display:flex}.lottery-quantity-selector{align-items:center;gap:var(--space-4);display:flex}.lottery-quantity-btn{border:1px solid var(--glass-border);background:var(--glass-bg);border-radius:var(--radius-md);cursor:pointer;width:40px;height:40px;transition:all var(--transition-fast);color:var(--text-primary);justify-content:center;align-items:center;font-size:20px;display:flex}.lottery-quantity-btn:hover{background:var(--accent);color:#fff;border-color:var(--accent)}.lottery-quantity-btn:disabled{opacity:.4;cursor:not-allowed}.lottery-quantity-value{color:var(--text-primary);text-align:center;min-width:60px;font-size:28px;font-weight:700;font-family:var(--font-mono)}.lottery-total{color:var(--text-secondary);font-size:16px}.lottery-total-amount{color:var(--accent);font-weight:700;font-family:var(--font-mono)}.lottery-buy-btn{width:100%;max-width:280px;padding:var(--space-3) var(--space-6);background:var(--accent);color:#fff;border-radius:var(--radius-md);cursor:pointer;transition:all var(--transition-fast);border:none;font-size:16px;font-weight:600}.lottery-buy-btn:hover{box-shadow:var(--glass-shadow-lg);transform:translateY(-2px)}.lottery-buy-btn:disabled{opacity:.6;cursor:not-allowed;transform:none}.lottery-tickets-grid{gap:var(--space-4);grid-template-columns:repeat(auto-fill,minmax(200px,1fr));display:grid}@media (max-width:640px){.lottery-tickets-grid{grid-template-columns:1fr}}.lottery-ticket-card{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-lg);padding:var(--space-4);box-shadow:var(--glass-shadow);transition:transform var(--transition-fast);position:relative;overflow:hidden}.lottery-ticket-card:hover{transform:translateY(-2px)}.lottery-ticket-card.winner{background:linear-gradient(135deg, var(--glass-bg), #f59e0b1a);border-color:#f59e0b}.lottery-ticket-header{margin-bottom:var(--space-3);justify-content:space-between;align-items:center;display:flex}.lottery-ticket-round{color:var(--text-muted);font-size:12px}.lottery-ticket-status{border-radius:var(--radius-full);padding:2px 8px;font-size:11px;font-weight:500}.lottery-ticket-status.pending{color:#3b82f6;background:#3b82f626}.lottery-ticket-status.winner{color:#f59e0b;background:#f59e0b26}.lottery-ticket-status.loser{color:#6b7280;background:#6b728026}.lottery-ticket-number{color:var(--text-primary);font-size:18px;font-weight:700;font-family:var(--font-mono);text-align:center;padding:var(--space-3) 0;letter-spacing:2px}.lottery-ticket-id{color:var(--text-muted);font-size:11px;font-family:var(--font-mono);word-break:break-all;margin-top:var(--space-2)}.lottery-empty-state{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-10);text-align:center;color:var(--text-secondary)}.lottery-empty-state-icon{margin-bottom:var(--space-4);opacity:.5;font-size:48px}.lottery-history-list{gap:var(--space-4);flex-direction:column;display:flex}.lottery-history-item{background:var(--glass-bg);-webkit-backdrop-filter:var(--blur-md);backdrop-filter:var(--blur-md);border:1px solid var(--glass-border);border-radius:var(--radius-lg);padding:var(--space-5);box-shadow:var(--glass-shadow)}.lottery-history-header{margin-bottom:var(--space-3);justify-content:space-between;align-items:center;display:flex}.lottery-history-round{color:var(--text-primary);font-size:16px;font-weight:600}.lottery-history-date{color:var(--text-muted);font-size:13px}.lottery-history-pool{color:var(--text-secondary);margin-bottom:var(--space-3);font-size:14px}.lottery-history-pool-amount{color:var(--accent);font-weight:700;font-family:var(--font-mono)}.lottery-history-winners{gap:var(--space-2);flex-direction:column;display:flex}.lottery-history-winner{padding:var(--space-2) var(--space-3);background:var(--glass-bg-subtle);border-radius:var(--radius-md);justify-content:space-between;align-items:center;display:flex}.lottery-winner-tier{color:var(--text-primary);font-size:13px;font-weight:500}.lottery-winner-address{color:var(--text-muted);font-size:12px;font-family:var(--font-mono)}.lottery-winner-amount{color:var(--accent);font-size:14px;font-weight:600;font-family:var(--font-mono)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,35965,96699,93583,e=>{"use strict";var t=e.i(56420);let s=(0,t.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,s],35965);let r=(0,t.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,r],96699);let a=(0,t.default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);e.s(["Menu",0,a],93583)},59665,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(93583),a=e.i(5142);let o=(0,s.createContext)(null);e.s(["default",0,function({sidebar:e,headerTitle:i,headerRight:n,children:l}){let[c,d]=(0,a.useDisclosure)(!1),[h,u]=(0,s.useState)(!1),p=function(e,{getInitialValueInEffect:t}={getInitialValueInEffect:!0}){let[r,a]=(0,s.useState)(t?void 0:!!("u">typeof window&&"matchMedia"in window)&&window.matchMedia(e).matches);return(0,s.useEffect)(()=>{try{if("matchMedia"in window){let t=window.matchMedia(e);a(t.matches);let s=e=>a(e.matches);return t.addEventListener("change",s),()=>{t.removeEventListener("change",s)}}}catch(e){return}},[e]),r||!1}("(max-width: 768px)");return(0,t.jsx)(o.Provider,{value:{closeSidebar:d.close},children:(0,t.jsxs)("div",{className:"app-layout",children:[(0,t.jsx)("div",{className:`sidebar-overlay ${c?"visible":""}`,onClick:()=>d.close()}),(0,t.jsx)("div",{className:`sidebar ${c?"open":""} ${h?"collapsed":""}`,children:e({closeSidebar:d.close})}),(0,t.jsxs)("div",{className:"main-content",children:[(0,t.jsxs)("header",{className:"app-header",children:[(0,t.jsxs)("div",{className:"header-left",children:[(0,t.jsx)("button",{onClick:()=>{p?d.toggle():u(!h)},className:"icon-btn sidebar-toggle-btn","aria-label":p?"打开菜单":h?"展开侧边栏":"收起侧边栏",children:(0,t.jsx)(r.Menu,{size:16})}),i]}),(0,t.jsx)("div",{className:"header-right",children:n})]}),l]})]})})}],59665)},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)},68877,e=>{"use strict";let t=(0,e.i(56420).default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);e.s(["ArrowRight",0,t],68877)},26913,e=>{"use strict";class t extends Error{name="KyError";get isKyError(){return!0}}class s extends t{name="HTTPError";response;request;options;data;constructor(e,t,s){const r=e.status||0===e.status?e.status:"",a=e.statusText??"",o=`${r} ${a}`.trim(),i=o?`status code ${o}`:"an unknown error";super(`Request failed with ${i}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=s}}class r extends t{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}}class a extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}}class o extends t{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new a(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}class i extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}}class n extends t{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}}let l=(()=>{let e=!1,t=!1,s="function"==typeof globalThis.Request;if("function"==typeof globalThis.ReadableStream&&s)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(e){if(e instanceof Error&&"unsupported BodyInit type"===e.message)return!1;throw e}return e&&!t})(),c="function"==typeof globalThis.AbortController,d="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,h="function"==typeof globalThis.ReadableStream,u="function"==typeof globalThis.FormData,p=["get","post","put","patch","head","delete"],m={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},f=Symbol("stop");class y{options;constructor(e){this.options=e}}let g=e=>new y(e),b={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},w={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},x=new TextEncoder,j=(e,t,s)=>{let r,a=0;return e.pipeThrough(new TransformStream({transform(e,o){if(o.enqueue(e),r){a+=r.byteLength;let e=0===t?0:a/t;e>=1&&(e=1-Number.EPSILON),s?.({percent:e,totalBytes:Math.max(t,a),transferredBytes:a},r)}r=e},flush(){r&&(a+=r.byteLength,s?.({percent:1,totalBytes:Math.max(t,a),transferredBytes:a},r))}}))},v=e=>null!==e&&"object"==typeof e,k=Symbol("replaceOption"),N=e=>v(e)&&!0===e[k]?{isReplace:!0,value:e.value}:{isReplace:!1,value:e},R=(...e)=>{for(let t of e)if((!v(t)||Array.isArray(t))&&void 0!==t)throw TypeError("The `options` argument must be an object");return A({},...e)},T=(e={},t={})=>{let s=new globalThis.Headers(e),r=t instanceof globalThis.Headers;for(let[e,a]of new globalThis.Headers(t).entries())r&&"undefined"===a||void 0===a?s.delete(e):s.set(e,a);return s},C=e=>{if(!v(e)||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},S=e=>{if(e instanceof URLSearchParams){let t=new URLSearchParams(e),s=e[P];return s&&(t[P]=new Set(s)),t}return e instanceof globalThis.Headers?new globalThis.Headers(e):Array.isArray(e)?[...e]:C(e)?{...e}:e},q=(e,t)=>C(e)&&C(t)?Object.fromEntries(Object.entries({...e,...t}).filter(e=>void 0!==e[1])):T(e,t);function E(e,t,s){return Object.hasOwn(t,s)&&void 0===t[s]?[]:A(e[s]??[],t[s]??[])}let M=(e={},t={})=>({init:E(e,t,"init"),beforeRequest:E(e,t,"beforeRequest"),beforeRetry:E(e,t,"beforeRetry"),beforeError:E(e,t,"beforeError"),afterResponse:E(e,t,"afterResponse")}),P=Symbol("deletedParameters"),z=(e,t)=>{let s=new URLSearchParams,r=new Set;for(let a of[e,t])if(void 0!==a)if(a instanceof URLSearchParams){for(let[e,t]of a.entries())s.append(e,t),r.delete(e);let e=a[P];if(e)for(let t of e)s.delete(t),r.add(t)}else if(Array.isArray(a))for(let e of a){if(!Array.isArray(e)||2!==e.length)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");s.append(String(e[0]),String(e[1])),r.delete(String(e[0]))}else if(v(a))for(let[e,t]of Object.entries(a))void 0===t?(s.delete(e),r.add(e)):(s.append(e,String(t)),r.delete(e));else for(let[e,t]of new URLSearchParams(a).entries())s.append(e,t),r.delete(e);return r.size>0&&(s[P]=r),s},A=(...e)=>{let t,s={},r={},a={},o=[];for(let i of e)if(Array.isArray(i))Array.isArray(s)||(s=[]),s=[...s,...i];else if(v(i)){for(let[e,r]of Object.entries(i)){if("signal"===e&&r instanceof globalThis.AbortSignal){o.push(r);continue}let a=N(r),{isReplace:i}=a;if(r=a.value,"context"===e){if(null!=r&&(!v(r)||Array.isArray(r)))throw TypeError("The `context` option must be an object");s={...s,context:null==r?{}:i?{...r}:{...s.context,...r}};continue}if("searchParams"===e){t=null==r?void 0:i||void 0===t?r:z(t,r);continue}v(r)&&!i&&e in s&&(r=A(s[e],r)),s={...s,[e]:r}}if(v(i.hooks)){let{value:e,isReplace:t}=N(i.hooks);a=t?M({},e):M(a,e),s.hooks=a}if(v(i.headers)){let{value:e,isReplace:t}=N(i.headers);r=t?S(e):q(r,e),s.headers=r}}return void 0!==t&&(s.searchParams=t),o.length>0&&(1===o.length?s.signal=o[0]:d?s.signal=AbortSignal.any(o):s.signal=o.at(-1)),s},L={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1};async function $(e,t,s,r){return new Promise((a,o)=>{let i=setTimeout(()=>{s&&s.abort(),o(new n(e))},r.timeout);r.fetch(e,t).then(a).catch(o).then(()=>{clearTimeout(i)})})}async function D(e,{signal:t}){return new Promise((s,r)=>{function a(){clearTimeout(o),r(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",a,{once:!0}));let o=setTimeout(()=>{t?.removeEventListener("abort",a),s()},e)})}let O=Object.prototype.toString,F=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),U=(e,t)=>e instanceof t||e?.name===t.name,B=Symbol("timedOutResponseData"),H="The `schema` argument must follow the Standard Schema specification",I=Object.prototype.toString,J=e=>e instanceof globalThis.Request||"[object Request]"===I.call(e),V=e=>e instanceof globalThis.Response||"[object Response]"===I.call(e),W=async(e,t)=>{if("object"!=typeof t&&"function"!=typeof t||null===t)throw TypeError(H);let s=t["~standard"];if("object"!=typeof s||null===s||"function"!=typeof s.validate)throw TypeError(H);let r=await s.validate(e);if(r.issues)throw new i(r.issues);return r.value};class X{static create(e,t){var r,a;let i,n=t.hooks?.init??[],l=n.length>0?(i={...t,json:S(t.json),context:S(t.context),headers:S(t.headers),searchParams:Array.isArray(r=t.searchParams)?r.map(e=>[...e]):S(r)},void 0!==t.retry&&(i.retry="object"!=typeof(a=t.retry)?a:{...a,...a.methods&&{methods:[...a.methods]},...a.statusCodes&&{statusCodes:[...a.statusCodes]},...a.afterStatusCodes&&{afterStatusCodes:[...a.afterStatusCodes]}}),i):t;for(let e of n)e(l);let c=new X(e,l),d=async()=>{if("number"==typeof c.#e.timeout&&c.#e.timeout>0x7fffffff)throw RangeError("The `timeout` option cannot be greater than 2147483647");if("number"==typeof c.#e.totalTimeout&&c.#e.totalTimeout>0x7fffffff)throw RangeError("The `totalTimeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await c.#t(),t=e??await c.#s(async()=>c.#r()),r=void 0!==e||c.#a();for(;;){if(void 0===t)return t;if(V(t))try{t=await c.#o(t)}catch(s){if(!(s instanceof o))throw s;let e=await c.#i(s,async()=>c.#r());if(void 0===e)return e;t=e,r=c.#a();continue}let e=t;if(!e.ok&&"opaque"!==e.type&&("function"==typeof c.#e.throwHttpErrors?c.#e.throwHttpErrors(e.status):c.#e.throwHttpErrors)){let a=new s(e,c.#n(e),c.#l());if(a.data=await c.#c(e),r)throw a;let o=await c.#i(a,async()=>c.#r());if(void 0===o)return o;t=o,r=c.#a();continue}break}if(!V(t))return t;if(c.#d(t),c.#e.onDownloadProgress){if("function"!=typeof c.#e.onDownloadProgress)throw TypeError("The `onDownloadProgress` option must be a function");if(!h)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let e=t.clone();c.#h(t);var a=c.#e.onDownloadProgress;if(!e.body)return e;let s={status:e.status,statusText:e.statusText,headers:e.headers};if(204===e.status)return new Response(null,s);let r=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(j(e.body,r,a),s)}return t},u=(async()=>{try{return await d()}catch(t){if(!(t instanceof Error)||c.#u.has(t))throw t;let e=t;for(let t of c.#e.hooks.beforeError){let s=await t({request:c.request,options:c.#l(),error:e,retryCount:c.#p});s instanceof Error&&(e=s)}throw e}finally{let e=c.#m;c.#f(e?.body??void 0),c.request!==e&&c.#f(c.request.body??void 0)}})();for(let[e,t]of Object.entries(m))("bytes"!==e||"function"==typeof globalThis.Response?.prototype?.bytes)&&(u[e]=async s=>{c.request.headers.set("accept",c.request.headers.get("accept")||t);let r=await u;if("json"!==e)return r[e]();let a=await r.text();if(""===a)return void 0!==s?W(void 0,s):JSON.parse(a);let o=l.parseJson?await l.parseJson(a,{request:c.#n(r),response:r}):JSON.parse(a);return void 0===s?o:W(o,s)});return u}static #y(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#g;#p=0;#b;#e;#m;#w;#u=new WeakSet;#x;#j;#v=!1;#k=new WeakMap;constructor(e,t={}){if(this.#b=e,Object.hasOwn(t,"prefixUrl"))throw Error("The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl");if(this.#e={...t,headers:T(this.#b.headers,t.headers),hooks:M({},t.hooks),method:(e=>p.includes(e)?e.toUpperCase():e)(t.method??this.#b.method??"GET"),prefix:String(t.prefix||""),retry:((e={})=>{if("number"==typeof e)return{...L,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error("retry.statusCodes must be an array");let t=Object.fromEntries(Object.entries({...e,methods:e.methods?.map(e=>e.toLowerCase())}).filter(([,e])=>void 0!==e));return{...L,...t}})(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,totalTimeout:t.totalTimeout??!1,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},"string"!=typeof this.#b&&!(this.#b instanceof URL||this.#b instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if("string"==typeof this.#b){if(this.#e.prefix){const e=this.#e.prefix.replace(/\/+$/,""),t=this.#b.replace(/^\/+/,"");this.#b=`${e}/${t}`}if(this.#e.baseUrl){let e;try{e=new URL(this.#b)}catch{}e||(this.#b=new URL(this.#b,new Request(this.#e.baseUrl).url))}}c&&d&&(this.#w=this.#e.signal??this.#b.signal,this.#g=new globalThis.AbortController,this.#e.signal=this.#N()),l&&(this.#e.duplex="half"),void 0!==this.#e.json&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const s=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#b instanceof globalThis.Request&&(u&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!s&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#b,this.#e),(e=>void 0!==e&&(Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0||!!e[P]?.size:"object"==typeof e?Object.keys(e).length>0:"string"==typeof e?e.trim().length>0:!!e))(this.#e.searchParams)){const e=new URL(this.request.url),t=this.#e.searchParams?.[P];if(t)for(const s of t)e.searchParams.delete(s);if("string"==typeof this.#e.searchParams){const t=this.#e.searchParams.replace(/^\?/,"");""!==t&&(e.search=e.search?`${e.search}&${t}`:`?${t}`)}else for(const[t,s]of new URLSearchParams(X.#y(this.#e.searchParams)).entries())e.searchParams.append(t,s);if(this.#e.searchParams&&"object"==typeof this.#e.searchParams&&!Array.isArray(this.#e.searchParams)&&!(this.#e.searchParams instanceof URLSearchParams))for(const[t,s]of Object.entries(this.#e.searchParams))void 0===s&&e.searchParams.delete(t);this.request=new globalThis.Request(e,this.#e)}if(this.#e.onUploadProgress&&"function"!=typeof this.#e.onUploadProgress)throw TypeError("The `onUploadProgress` option must be a function");this.#j="number"==typeof this.#e.totalTimeout?this.#R():void 0}#T(){let e=this.#e.retry.delay(this.#p+1),t=e;return!0===this.#e.retry.jitter?t=Math.random()*e:"function"==typeof this.#e.retry.jitter&&(!Number.isFinite(t=this.#e.retry.jitter(e))||t<0)&&(t=e),Math.min(this.#e.retry.backoffLimit,t)}async #C(e){if(this.#p>=this.#e.retry.limit)throw e;let t=e instanceof Error?e:new a(e);if(t instanceof o)return t.customDelay??this.#T();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#e.retry.shouldRetry){let s=await this.#e.retry.shouldRetry({error:t,retryCount:this.#p+1});if(!1===s)throw e;if(!0===s)return this.#T()}if(U(e,n)){if(!this.#e.retry.retryOnTimeout)throw e;return this.#T()}if(U(e,s)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);return(Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now()),Number.isFinite(e))?(e=Math.max(0,e),Math.min(this.#e.retry.maxRetryAfter,e)):Math.min(this.#e.retry.maxRetryAfter,this.#T())}if(413===e.response.status)throw e;return this.#T()}if(!U(e,r))throw e;return this.#T()}#d(e){let t=this.#n(e);return this.#e.parseJson&&(e.json=async()=>{let s=await e.text();return""===s?JSON.parse(s):this.#e.parseJson(s,{request:t,response:e})}),e}async #c(e){let t=await this.#S(e,this.#q());if(t===B)return void this.#E();if(!t)return;if(!this.#M(e.headers.get("content-type")??""))return t;let s=await this.#P(t,e,this.#q(),this.#n(e));return s===B?void this.#E():s}#q(){let e=!1===this.#e.timeout?1e4:this.#e.timeout,t=this.#z();if(void 0===t)return e;if(t<=0)throw new n(this.request);return Math.min(e,t)}#M(e){let t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async #S(e,t){let s,{body:r}=e;if(!r)try{return await e.text()}catch{return}try{s=r.getReader()}catch{return}let a=(e=>{let t=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(e),s=t?.[1]??t?.[2];if(s)try{return new TextDecoder(s)}catch{}return new TextDecoder})(e.headers.get("content-type")??""),o=[],i=0,n=(async()=>{try{for(;;){let{done:e,value:t}=await s.read();if(e)break;if((i+=t.byteLength)>0xa00000)return void s.cancel().catch(()=>void 0);o.push(a.decode(t,{stream:!0}))}}catch{return}return o.push(a.decode()),o.join("")})(),l=new Promise(e=>{let s=setTimeout(()=>{e(B)},t);n.finally(()=>{clearTimeout(s)})}),c=await Promise.race([n,l]);return c===B&&s.cancel().catch(()=>void 0),c}async #P(e,t,s,r){let a;try{return await Promise.race([Promise.resolve().then(()=>this.#e.parseJson?this.#e.parseJson(e,{request:r,response:t}):JSON.parse(e)),new Promise(e=>{a=setTimeout(()=>{e(B)},s)})])}catch{return}finally{clearTimeout(a)}}#f(e){e&&e.cancel().catch(()=>void 0)}#h(e){this.#f(e.body??void 0)}#N(){return this.#w?AbortSignal.any([this.#w,this.#g.signal]):this.#g.signal}#E(){let e=this.#z();if(void 0!==e&&e<=0)throw new n(this.request)}async #t(){for(let e of this.#e.hooks.beforeRequest){let t=await e({request:this.request,options:this.#l(),retryCount:0});if(J(t))this.#A(t);else if(V(t))return t}}async #o(e){let t=this.#n(e);for(let s of this.#e.hooks.afterResponse){let r,a=this.#L(e.clone(),t);this.#d(a);try{r=await s({request:this.request,options:this.#l(),response:a,retryCount:this.#p})}catch(t){throw a!==e&&this.#h(a),this.#h(e),t}if(r instanceof y)throw a!==e&&this.#h(a),this.#h(e),new o(r.options);let i=V(r)?this.#L(r,t):e;a!==e&&a!==i&&a.body!==i.body&&this.#h(a),e!==i&&e.body!==i.body&&this.#h(e),e=i}return e}async #s(e){try{return await e()}catch(t){return this.#i(t,e)}}async #i(e,t){this.#v=!1;let s=Math.min(await this.#C(e),0x7fffffff),r={signal:this.#w},a=this.#z();if(void 0!==a){if(a<=0)throw new n(this.request);if(s>=a)throw await D(a,r),new n(this.request)}if(await D(s,r),this.#E(),e instanceof o&&e.customRequest){let t=new globalThis.Request(e.customRequest,this.#e.signal?{signal:this.#e.signal}:void 0);this.#A(t)}for(let t of this.#e.hooks.beforeRetry){let s;try{s=await t({request:this.request,options:this.#l(),error:e,retryCount:this.#p+1})}catch(t){throw t instanceof Error&&t!==e&&this.#u.add(t),t}if(J(s)){this.#A(s);break}if(V(s))return this.#v=!0,this.#p++,s;if(s===f)return}return this.#E(),this.#p++,this.#s(t)}#a(){let e=this.#v;return this.#v=!1,e}async #r(){this.#g?.signal.aborted&&(this.#g=new globalThis.AbortController,this.#e.signal=this.#N(),this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));let e=(e=>{let t={};for(let s in e)Object.hasOwn(e,s)&&(s in w||s in b||(t[s]=e[s]));return t})(this.#e),t=this.#e.retry.limit>0?this.request.clone():void 0,s=this.#$(this.request,this.#e.body??void 0);this.#m=s,t&&(this.request=t);try{let t=this.#z();if(void 0!==t&&t<=0)throw new n(this.request);let r=!1===this.#e.timeout?t:void 0===t?this.#e.timeout:Math.min(this.#e.timeout,t),a=void 0===r?await this.#e.fetch(s,e):await $(s,e,this.#g,{timeout:r,fetch:this.#e.fetch});return this.#L(a,s)}catch(e){if(function(e){if(!(e&&"[object Error]"===O.call(e)&&"TypeError"===e.name&&"string"==typeof e.message))return!1;let{message:t,stack:s}=e;return"Load failed"===t?void 0===s||"__sentry_captured__"in e:!!(t.startsWith("error sending request for url")||"Failed to fetch"===t||t.startsWith("Failed to fetch (")&&t.endsWith(")"))||F.has(t)}(e))throw new r(this.request,{cause:e});throw e}}#z(){if(void 0===this.#j)return;let e=this.#R()-this.#j;return Math.max(0,this.#e.totalTimeout-e)}#R(){return globalThis.performance?.now()??Date.now()}#l(){if(!this.#x){let{hooks:e,json:t,parseJson:s,stringifyJson:r,searchParams:a,timeout:o,totalTimeout:i,throwHttpErrors:n,fetch:l,...c}=this.#e;this.#x=Object.freeze(c)}return this.#x}#A(e){this.#x=void 0,this.request=e}#n(e){return this.#k.get(e)??this.request}#L(e,t){return this.#k.set(e,t),e}#$(e,t){return this.#e.onUploadProgress&&e.body&&l?((e,t,s)=>{if(!e.body)return e;let r=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[s,r]of e)t+=40,t+=x.encode(`Content-Disposition: form-data; name="${s}"`).byteLength,t+="string"==typeof r?x.encode(r).byteLength:r.size;return t}return e instanceof Blob?e.size:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:"string"==typeof e?x.encode(e).byteLength:e instanceof URLSearchParams?x.encode(e.toString()).byteLength:0})(s??e.body);return new Request(e,{duplex:"half",body:j(e.body,r,t)})})(e,this.#e.onUploadProgress,t??this.#e.body??void 0):e}}let _=e=>{let t=(t,s)=>X.create(t,R(e,s));for(let s of p)t[s]=(t,r)=>X.create(t,R(e,r,{method:s}));return t.create=e=>_(R(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),_(R(e,t))),t.stop=f,t.retry=g,t},K=_(),G="mostbox_backend_url";function Z(){let e=localStorage.getItem(G)||"";return K.create({prefix:e})}let Q=Z();async function Y(){try{return(await fetch("/api/node-id",{method:"GET",signal:AbortSignal.timeout(2e3)})).ok}catch{return!1}}async function ee(){try{return(await fetch("http://localhost:1976/api/node-id",{method:"GET",signal:AbortSignal.timeout(2e3)})).ok}catch{return!1}}e.s(["api",()=>Q,"detectLocalhostBackend",0,ee,"detectSameOriginBackend",0,Y,"setBackendUrl",0,function(e){let t=(e||"").trim().replace(/\/+$/,"");t?localStorage.setItem(G,t):localStorage.removeItem(G),Q=Z()}],26913)},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)},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)},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)},27627,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(56420);let a=(0,r.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"}]]);var o=e.i(35965),i=e.i(96699);let n=(0,r.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"}]]),l=(0,r.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"}]]),c=(0,r.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"}]]),d=(0,r.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"}]]);var h=e.i(51921);let u=(0,r.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),p=(0,r.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"}]]);var m=e.i(63676),f=e.i(89664),y=e.i(8734),g=e.i(62368);let b=(0,r.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"}]]),w=(0,r.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,r.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"}]]),j=(0,r.default)("hard-drive",[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]);var v=e.i(66595);let k=(0,r.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"}]]),N=(0,r.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"}]]),R=(0,r.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"}]]);var T=e.i(68877),C=e.i(59665);e.i(4121);var S=e.i(57667),q=e.i(88361),E=e.i(47910),M=e.i(26913),P=e.i(9817),z=e.i(5142),A=e.i(22016);let L={listPublishedFiles:()=>M.api.get("/api/files").json(),listTrashFiles:()=>M.api.get("/api/trash").json(),deletePublishedFile:e=>M.api.delete(`/api/files/${e}`).json(),restoreTrashFile:e=>M.api.post(`/api/trash/${e}/restore`).json(),permanentDeleteTrashFile:e=>M.api.delete(`/api/trash/${e}`).json(),emptyTrash:()=>M.api.delete("/api/trash").json(),toggleStar:e=>M.api.post(`/api/files/${e}/star`).json(),getStorageStats:()=>M.api.get("/api/storage").json(),getConfig:()=>M.api.get("/api/config").json(),getDataPath:()=>M.api.get("/api/config/data-path").json(),getNetworkAddresses:()=>M.api.get("/api/network").json(),saveConfig:e=>M.api.post("/api/config",{json:e}).json(),async publishFile(e,t){let s=new FormData;s.append("file",e,t||e.name);let r=await M.api.post("/api/publish",{body:s});if(!r.ok)throw Error((await r.json().catch(()=>({error:r.statusText}))).error||"Request failed");return r.json()},downloadFile:e=>M.api.post("/api/download",{json:{link:e}}).json(),cancelDownload:e=>M.api.post("/api/download/cancel",{json:{taskId:e}}).json(),getFileDownloadUrl:e=>`/api/files/${e}/download`,moveFile:(e,t)=>M.api.post("/api/move",{json:{cid:e,newFileName:t}}).json(),renameFolder:(e,t)=>M.api.post("/api/folder/rename",{json:{oldPath:e,newPath:t}}).json()},$=[{cid:"mock1",fileName:"示例文档.pdf",size:2048576,createdAt:"2024-01-15",starred:!1},{cid:"mock2",fileName:"项目截图.png",size:1536e3,createdAt:"2024-01-20",starred:!0},{cid:"mock3",fileName:"会议录音.mp3",size:512e4,createdAt:"2024-02-01",starred:!1},{cid:"mock4",fileName:"演示视频.mp4",size:0x3200000,createdAt:"2024-02-10",starred:!1},{cid:"mock5",fileName:"代码备份.zip",size:0xa00000,createdAt:"2024-02-15",starred:!1},{cid:"mock6",fileName:"设计稿/首页设计.fig",size:8388608,createdAt:"2024-02-20",starred:!0},{cid:"mock7",fileName:"设计稿/图标集.svg",size:512e3,createdAt:"2024-02-22",starred:!1}],D={total:0x1900000000,used:0x1e0000000,free:0x1720000000,fileCount:42,trashCount:3};function O(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 F(e){let t=e.lastIndexOf("/");return -1===t?{folder:"",name:e}:{folder:e.substring(0,t),name:e.substring(t+1)}}function U(e){let t=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"}function B(e){return e?[{path:"",name:"全部内容"},...e.split("/").filter(Boolean).map((e,t,s)=>({path:s.slice(0,t+1).join("/"),name:e}))]:[]}let H=(e,t)=>async()=>{try{e(await t())}catch(e){console.info(e)}};function I({file:e,isSelected:s,isDarkMode:r,onSelect:a,onPreview:o}){let i=U(e.fileName);return(0,t.jsxs)("div",{"data-id":e.cid,onClick:()=>a(e.cid),onDoubleClick:()=>o(e),className:`card ${s?"selected":""}`,children:[(0,t.jsxs)("div",{className:`card-icon ${e.starred?"starred":"file"}`,children:["image"===i&&(0,t.jsx)(n,{size:24,color:"#fff"}),"video"===i&&(0,t.jsx)(d,{size:24,color:"#fff"}),"audio"===i&&(0,t.jsx)(h.Music,{size:24,color:"#fff"}),"file"===i&&(0,t.jsx)(p,{size:24,color:"#fff"})]}),(0,t.jsx)("p",{className:"card-name",children:F(e.fileName).name})]})}function J({folder:e,isDarkMode:s,onClick:r}){return(0,t.jsxs)("div",{onClick:r,className:"card",children:[(0,t.jsx)("div",{className:"card-icon folder",children:(0,t.jsx)(c,{size:28,color:"#fff"})}),(0,t.jsx)("p",{className:"card-name",children:e.name})]})}function V({items:e,allFolders:r,currentPath:a,onMove:o,onClose:i}){let[n,l]=(0,s.useState)(""),[d,h]=(0,s.useState)(a),u=B(n);return(0,t.jsx)(S.ModalOverlay,{onClose:i,children:(0,t.jsxs)("div",{className:"move-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"modal-header",children:[(0,t.jsx)("h3",{children:"移动到"}),(0,t.jsx)("button",{onClick:i,className:"modal-close-btn",children:(0,t.jsx)(m.X,{size:18})})]}),(0,t.jsxs)("p",{className:"move-modal-desc",children:["已选 ",e.length," 个项目"]}),(0,t.jsx)("div",{className:"move-new-folder",children:(0,t.jsx)("input",{type:"text",value:d,onChange:e=>h(e.target.value),placeholder:"输入路径创建嵌套文件夹"})}),(0,t.jsx)("p",{className:"move-modal-hint",children:"如 图片/壁纸"}),(0,t.jsx)("div",{className:"move-breadcrumb",children:u.map((e,r)=>(0,t.jsxs)(s.default.Fragment,{children:[r>0&&(0,t.jsx)("span",{className:"breadcrumb-separator",children:"/"}),(0,t.jsx)("button",{onClick:()=>{l(e.path),h(e.path)},className:`move-breadcrumb-btn ${n===e.path&&!d?"active":""}`,children:e.name},e.path)]},e.path))}),(0,t.jsxs)("div",{className:"move-folder-list",children:[0===r.filter(e=>{if(""===n)return!e.path.includes("/");let t=n+"/";return!!e.path.startsWith(t)&&!e.path.substring(t.length).includes("/")}).length&&(0,t.jsx)("p",{className:"move-modal-empty",children:"该目录下没有子文件夹"}),r.filter(e=>{if(""===n)return!e.path.includes("/");let t=n+"/";return!!e.path.startsWith(t)&&!e.path.substring(t.length).includes("/")}).map(e=>(0,t.jsxs)("button",{onClick:()=>l(e.path),className:`move-folder-item ${n===e.path&&!d?"selected":""}`,children:[(0,t.jsx)(c,{size:16}),(0,t.jsx)("span",{children:e.name})]},e.path))]}),(0,t.jsxs)("div",{className:"modal-actions",children:[(0,t.jsx)("button",{onClick:i,className:"btn secondary",children:"取消"}),(0,t.jsx)("button",{onClick:()=>{o(n||d.trim())},className:"btn primary",children:"移动"})]})]})})}e.s(["default",0,function(){let e,r,n,{isDarkMode:c,setIsDarkMode:d,addToast:M,openSettings:W}=(0,P.useApp)(),[X,_]=(0,s.useState)([]),[K,G]=(0,s.useState)([]),[Z,Q]=(0,s.useState)(null),[Y,ee]=(0,s.useState)("all"),[et,es]=(0,s.useState)(!1),[er,ea]=(0,s.useState)([]),[eo,ei]=(0,s.useState)(null),[en,el]=(0,s.useState)(null),[ec,ed]=(0,z.useDisclosure)(!1),[eh,eu]=(0,s.useState)(""),[ep,em]=(0,s.useState)([]),[ef,ey]=(0,z.useDisclosure)(!1),[eg,eb]=(0,s.useState)(""),{copy:ew,copied:ex}=function(e={}){let t=e.timeout??2e3,[r,a]=(0,s.useState)(null),[o,i]=(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(()=>{a(null),window.clearTimeout(n.current),n.current=window.setTimeout(()=>i(!1),t),i(!0)}).catch(e=>a(e)):a(Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{i(!1),a(null),window.clearTimeout(n.current)},error:r,copied:o}}({timeout:2e3}),[ej,ev]=(0,s.useState)(0),[ek,eN]=(0,s.useState)({total:0,used:0,free:0}),[eR,eT]=(0,z.useDisclosure)(!1),[eC,eS]=(0,s.useState)(null),[eq,eE]=(0,s.useState)(null),[eM,eP]=(0,s.useState)(!1),[ez,eA]=(0,s.useState)(null),[eL,e$]=(0,s.useState)(""),[eD,eO]=(0,s.useState)(!1),[eF,eU]=(0,s.useState)(!1),[eB,eH]=(0,s.useState)(!1),eI=(0,s.useRef)(null);(0,s.useRef)(null),(0,s.useEffect)(()=>{eo&&("image"===eo.subtype||"video"===eo.subtype)&&(eU(!0),eH(!1)),eo&&"text"===eo.subtype&&(e$(""),e5(eo.cid))},[eo?.cid]),(0,s.useEffect)(()=>{let e=eI.current;if(!e)return;let t=()=>eU(!1),s=()=>eU(!1);return eo?.subtype==="image"?e.complete?eU(!1):(e.addEventListener("load",t),e.addEventListener("error",s)):eo?.subtype==="video"&&(e.addEventListener("canplay",t),e.addEventListener("error",s)),()=>{e.removeEventListener("load",t),e.removeEventListener("error",s),e.removeEventListener("canplay",t)}},[eo]);let eJ=Z||"",eV=(e=new Set,X.forEach(t=>{let{folder:s}=F(t.fileName),r=s.split("/").filter(Boolean),a="";for(let t of r)a+=(a?"/":"")+t,e.add(a)}),[...e].sort()),{folders:eW,files:eX}={folders:(r=eJ?eJ+"/":"",eV.filter(e=>{let t=e.toLowerCase().startsWith(r.toLowerCase()),s=e.substring(r.length);return t&&!s.includes("/")}).map(e=>({name:e.substring(r.length),path:e}))),files:X.filter(e=>F(e.fileName).folder===eJ)},e_=eg?X.filter(e=>F(e.fileName).name.toLowerCase().includes(eg.toLowerCase())):eX,eK=H(_,()=>L.listPublishedFiles().then(e=>e||[]).catch(()=>$)),eG=H(G,()=>L.listTrashFiles().then(e=>e||[]).catch(()=>[])),eZ=H(eN,()=>L.getStorageStats().catch(()=>D)),eQ=e=>{ea(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},eY=async e=>{try{await L.restoreTrashFile(e),M("已恢复","success"),eK(),eG(),eZ()}catch{M("恢复失败","error")}},e0=async()=>{eS({title:"清空回收站",message:"确定要清空回收站吗?此操作不可恢复!",confirmText:"清空",danger:!0,onConfirm:async()=>{eS(null);try{await L.emptyTrash(),M("回收站已清空","success"),eG(),eZ()}catch{M("清空失败","error")}}})},e1=async e=>{try{let t=await L.toggleStar(e);_(s=>s.map(s=>s.cid===e?{...s,starred:t.starred}:s)),M(t.starred?"已收藏":"已取消收藏","success")}catch{M("操作失败","error")}},e2=async()=>{let e="trash"===Y;eS({title:e?"永久删除":"批量删除",message:e?`确定要永久删除选中的 ${er.length} 个项目吗?此操作不可恢复!`:`确定要删除选中的 ${er.length} 个项目吗?`,confirmText:e?"永久删除":"删除",danger:!0,onConfirm:async()=>{eS(null);try{for(let t of er)e?await L.permanentDeleteTrashFile(t):t.startsWith("__")||await L.deletePublishedFile(t);ea([]),M(e?"已永久删除":"已删除","success"),eK(),eG(),eZ()}catch{M("删除失败","error")}}})},e4=async e=>{try{for(let t of er){let s=X.find(e=>e.cid===t);if(!s)continue;let{name:r}=F(s.fileName),a=e?`${e}/${r}`:r;s.fileName!==a&&await L.moveFile(t,a)}ea([]),eT.close(),M("已移动","success"),eK()}catch{M("移动失败","error")}},e6=e=>{let t=!!e.path,s=t?e.name:F(e.fileName).name;eE({title:t?"重命名文件夹":"重命名文件",placeholder:"请输入新名称",defaultValue:s,confirmText:"重命名",onConfirm:async r=>{if(r!==s){eP(!0);try{if(t){let t=e.path.lastIndexOf("/"),s=-1!==t?e.path.substring(0,t):"",a=s?`${s}/${r}`:r;await L.renameFolder(e.path,a),M("已重命名","success"),eK(),ts(a)}else{let{folder:t}=F(e.fileName),s=t?`${t}/${r}`:r;await L.moveFile(e.cid,s),M("已重命名","success"),eK()}eE(null)}catch{M("重命名失败","error")}finally{eP(!1)}}}})},e3=async e=>{let t=eJ?eJ+"/":"",s=[];for(let r of Array.from(e)){let e=t+r.name;if(X.some(t=>t.fileName===e)){M(`${r.name} 已存在`,"warning");continue}let a=`upload_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,o={id:a,fileName:r.name,progress:0,type:"upload",status:"uploading"};s.push(o),em(e=>[...e,o]),s.length>0&&ey.open();try{(await L.publishFile(r,e)).alreadyExists?(em(e=>e.map(e=>e.id===a?{...e,status:"completed"}:e)),M(`${r.name} 已存在`,"warning")):(em(e=>e.map(e=>e.id===a?{...e,progress:100,status:"completed"}:e)),M(`${r.name} 上传成功`,"success"))}catch(e){em(e=>e.map(e=>e.id===a?{...e,status:"error"}:e)),M(`上传失败: ${r.name}`,"error")}}setTimeout(()=>{em(e=>e.filter(e=>"completed"!==e.status&&"error"!==e.status&&"cancelled"!==e.status))},3e3),eK(),eZ()},e5=async e=>{eO(!0);try{let t=await fetch(`/api/files/${e}/download`,{headers:{Range:"bytes=0-9999"}});if(!t.ok)throw Error("加载失败");let s=await t.text();e$(s||"(文件为空)")}catch{e$("加载失败")}eO(!1)},[e8,e7]=(0,s.useState)(!1),e9=async()=>{if(!eh.trim()||!eh.startsWith("most://"))return void M("链接格式应为 most://<cid>","warning");if(!e8){e7(!0);try{let e=await L.downloadFile(eh);if(eu(""),ed.close(),e.alreadyExists)M(`${e.fileName} 已存在`,"warning");else{let t={id:e.taskId,fileName:"下载文件",progress:0,type:"download",status:"downloading"};em(e=>[...e,t]),ey.open(),M("下载已开始","info")}}catch(e){M("下载失败","error")}finally{e7(!1)}}},te=async e=>{if("download"===e.type&&"downloading"===e.status)try{await L.cancelDownload(e.id)}catch(e){M("取消失败","error")}},tt=async e=>{try{let t=await fetch(L.getFileDownloadUrl(e.cid));if(!t.ok)throw Error("获取文件失败");let s=await t.blob(),r=window.showSaveFilePicker;if(r){let t=await r({suggestedName:e.fileName}),a=await t.createWritable();await a.write(s),await a.close(),M("文件已保存","success")}else{let t=URL.createObjectURL(s),r=document.createElement("a");r.href=t,r.download=e.fileName,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t),M("文件已下载","success")}}catch(e){"AbortError"!==e.name&&M("保存失败: "+e.message,"error")}},ts=e=>{Q(e||null),ea([])};(0,s.useEffect)(()=>{location.protocol;let e=new WebSocket(`${"https:"===location.protocol?"wss:":"ws:"}//${location.host}/ws`);return e.onmessage=e=>{try{let{event:t,data:s}=JSON.parse(e.data);if("publish:success"===t||"download:success"===t){eK(),eZ();let e=s.taskId||s.fileName;em(t=>t.map(t=>t.id===e||t.fileName===s.fileName?{...t,progress:100,status:"completed"}:t)),"download:success"===t&&(s.alreadyExists?M(`${s.fileName} 已存在`,"warning"):M(`${s.fileName} 下载完成`,"success"),setTimeout(()=>{em(t=>t.filter(t=>t.id!==e||"completed"!==t.status))},3e3))}"publish:progress"===t&&em(e=>e.map(e=>{if(s.file&&e.fileName===s.file&&"upload"===e.type){let t=50;return"calculating-cid"===s.stage?t=25:"uploading"===s.stage?t=75:"complete"===s.stage&&(t=100),{...e,progress:t}}return e})),"download:progress"===t&&em(e=>e.map(e=>e.id===s.taskId?{...e,progress:s.percent||0,loaded:s.loaded,total:s.total}:e)),"download:error"===t&&(em(e=>e.map(e=>e.id===s.taskId?{...e,status:"error"}:e)),M(`下载失败: ${s.error}`,"error")),"network:status"===t&&ev(s.peers||0),"download:status"===t&&em(e=>e.map(e=>e.id===s.taskId?{...e,fileName:s.file||e.fileName}:e)),"download:cancelled"===t&&(em(e=>e.map(e=>e.id===s.taskId?{...e,status:"cancelled"}:e)),M("下载已取消","warning"))}catch{}},()=>e.close()},[]),(0,s.useEffect)(()=>{eK(),eG(),eZ(),L.getStorageStats().then(e=>eN(e)).catch(()=>eN(D))},[]);let tr="all"===Y?e_:"starred"===Y?X.filter(e=>e.starred&&F(e.fileName).name.toLowerCase().includes(eg.toLowerCase())):K.filter(e=>F(e.fileName).name.toLowerCase().includes(eg.toLowerCase())),ta="starred"===Y?[]:eW.filter(e=>e.name.toLowerCase().includes(eg.toLowerCase())),to=B(eJ);return(0,t.jsxs)(C.default,{sidebar:({closeSidebar:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"sidebar-header",onClick:()=>window.location.href="/",style:{cursor:"pointer"},children:(0,t.jsx)("h1",{children:"MOST PEOPLE"})}),(0,t.jsx)("nav",{className:"sidebar-nav",children:[{id:"all",icon:(0,t.jsx)(x,{size:18}),label:"全部内容"},{id:"starred",icon:(0,t.jsx)(w,{size:18}),label:"收藏"},{id:"trash",icon:(0,t.jsx)(l,{size:18}),label:"回收站"}].map(s=>(0,t.jsxs)("button",{onClick:()=>{ee(s.id),Q(null),ea([]),eb(""),e()},className:`sidebar-nav-btn ${Y===s.id?"active":""}`,children:[s.icon,(0,t.jsx)("span",{children:s.label})]},s.id))}),(0,t.jsxs)("div",{className:"sidebar-footer",children:[(0,t.jsxs)("div",{className:"sidebar-footer-label",children:[(0,t.jsx)(j,{size:14}),(0,t.jsx)("span",{children:"存储空间"})]}),(0,t.jsx)("div",{className:"storage-bar",children:(0,t.jsx)("div",{className:"storage-bar-fill",style:{width:`${ek.total>0?ek.used/ek.total*100:0}%`}})}),(0,t.jsxs)("div",{className:"storage-info",children:[(0,t.jsx)("span",{children:O(ek.used)}),(0,t.jsx)("span",{children:ek.total>0?O(ek.total):"-"})]})]})]}),headerTitle:(0,t.jsx)("h2",{className:"header-title",children:"all"===Y?"全部内容":"starred"===Y?"收藏":"回收站"}),headerRight:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"search-box",children:[(0,t.jsx)(v.Search,{size:14}),(0,t.jsx)("input",{type:"text",value:eg,onChange:e=>eb(e.target.value),placeholder:"搜索..."}),eg&&(0,t.jsx)("button",{onClick:()=>eb(""),children:(0,t.jsx)(m.X,{size:12})})]}),"trash"===Y&&K.length>0&&(0,t.jsx)("button",{onClick:e0,className:"btn small btn-empty-trash",children:"清空回收站"}),(0,t.jsxs)("button",{onClick:()=>ey.open(),className:"icon-btn",children:[(0,t.jsx)(b,{size:16}),ep.length>0&&(0,t.jsx)("span",{className:"icon-btn-badge",children:ep.length})]}),(0,t.jsx)("button",{onClick:()=>d(!c),className:"icon-btn theme-toggle",children:c?(0,t.jsx)(o.Sun,{size:16}):(0,t.jsx)(i.Moon,{size:16})}),(0,t.jsx)("button",{onClick:()=>W(),className:"icon-btn",children:(0,t.jsx)(k,{size:16})})]}),children:[(0,t.jsxs)("div",{className:"download-banner",children:[(0,t.jsx)("span",{children:"Web 端仅用于界面展示,下载桌面客户端获得完整功能"}),(0,t.jsxs)(A.default,{href:"/download",className:"download-banner-btn",children:[(0,t.jsx)(g.Download,{size:14}),"下载客户端",(0,t.jsx)(T.ArrowRight,{size:12})]})]}),"all"===Y&&(0,t.jsxs)("div",{className:"action-grid",children:[(0,t.jsxs)("div",{className:`action-card upload ${et?"drag-over":""}`,onDragOver:e=>{e.preventDefault(),es(!0)},onDragLeave:()=>es(!1),onDrop:e=>{e.preventDefault(),es(!1),e3(e.dataTransfer.files)},children:[(0,t.jsx)("input",{type:"file",multiple:!0,onChange:e=>e3(e.target.files),className:"action-card-input"}),(0,t.jsx)(a,{size:20,className:"action-grid-icon"}),(0,t.jsx)("p",{children:"上传文件"})]}),(0,t.jsxs)("div",{className:"action-card action-card-download",onClick:()=>ed.open(),children:[(0,t.jsx)(g.Download,{size:20,className:"action-grid-icon"}),(0,t.jsx)("p",{children:"下载文件"})]})]}),"all"===Y&&(0,t.jsx)("div",{className:"breadcrumb",children:eJ?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>ts(""),children:"全部内容"}),to.slice(1).map((e,r)=>(0,t.jsxs)(s.default.Fragment,{children:[(0,t.jsx)(u,{size:12}),(0,t.jsx)("button",{onClick:()=>ts(e.path),className:r===to.length-2?"current":"",children:e.name}),r===to.length-2&&(0,t.jsx)("button",{onClick:()=>e6(e),className:"breadcrumb-edit-btn",children:(0,t.jsx)(N,{size:12})})]},e.path))]}):null}),(0,t.jsxs)("div",{className:"content-grid",children:["trash"===Y&&(0===tr.length?(0,t.jsx)("div",{className:"empty-state",children:eg?"未找到相关文件":"回收站是空的"}):(0,t.jsx)("div",{className:"file-grid",children:tr.map(e=>{var s;return(0,t.jsxs)("div",{onClick:()=>ea(t=>t.includes(e.cid)?t.filter(t=>t!==e.cid):[...t,e.cid]),onDoubleClick:()=>eY(e.cid),className:`card ${er.includes(e.cid)?"selected":""}`,children:[(0,t.jsx)("div",{className:"card-icon trash",children:(0,t.jsx)(p,{size:24,color:"#fff"})}),(0,t.jsx)("p",{className:"card-name",children:F(e.fileName).name}),(0,t.jsxs)("p",{className:"card-date",children:["删除于 ",(s=e.deletedAt)?new Date(s).toLocaleDateString("zh-CN"):""]})]},e.cid)})})),"trash"!==Y&&(0===tr.length&&0===ta.length?(0,t.jsx)("div",{className:"empty-state",children:eg?"未找到相关文件":"starred"===Y?"暂无的收藏":"暂无文件"}):(0,t.jsxs)("div",{className:"file-grid",children:[ta.map(e=>(0,t.jsx)(J,{folder:e,isDarkMode:c,onClick:()=>ts(e.path)},e.path)),tr.map(e=>(0,t.jsx)(I,{file:e,isSelected:er.includes(e.cid),isDarkMode:c,onSelect:eQ,onPreview:e=>ei({...e,subtype:U(e.fileName)})},e.cid))]}))]}),eC&&(0,t.jsx)(q.ConfirmModal,{title:eC.title,message:eC.message,confirmText:eC.confirmText,danger:eC.danger,closeOnOverlayClick:eC.danger,onConfirm:eC.onConfirm,onClose:()=>eS(null)}),eq&&(0,t.jsx)(E.InputModal,{title:eq.title,placeholder:eq.placeholder,defaultValue:eq.defaultValue,confirmText:eq.confirmText,isLoading:eM,onConfirm:eq.onConfirm,onClose:()=>eE(null)}),eR&&(0,t.jsx)(V,{items:er.map(e=>X.find(t=>t.cid===e)).filter(Boolean),allFolders:eV.map(e=>({path:e,name:e.split("/").pop()})),currentPath:eJ,onMove:e4,onClose:()=>eT.close()}),en&&(0,t.jsx)(S.ModalOverlay,{onClose:()=>el(null),children:(0,t.jsxs)("div",{className:"share-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"modal-header",children:[(0,t.jsx)("h3",{children:"分享链接"}),(0,t.jsx)("button",{onClick:()=>el(null),className:"modal-close-btn",children:(0,t.jsx)(m.X,{size:18})})]}),(0,t.jsxs)("div",{className:"share-link-box",children:[(0,t.jsxs)("div",{className:"share-link-text",children:["most://",en.cid,"?filename=",en.fileName]}),(0,t.jsx)("button",{onClick:()=>{ew(`most://${en.cid}?filename=${en.fileName}`)},className:`share-copy-btn ${ex?"copied":""}`,children:ex?(0,t.jsx)(f.Check,{size:18}):(0,t.jsx)(y.Copy,{size:18})})]})]})}),ec&&(0,t.jsx)(S.ModalOverlay,{onClose:()=>ed.close(),children:(0,t.jsxs)("div",{className:"download-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"modal-header",children:[(0,t.jsx)("h3",{children:"下载文件"}),(0,t.jsx)("button",{onClick:()=>ed.close(),className:"modal-close-btn",children:(0,t.jsx)(m.X,{size:18})})]}),(0,t.jsx)("input",{type:"text",value:eh,onChange:e=>eu(e.target.value),placeholder:"most://...",onKeyDown:e=>"Enter"===e.key&&e9(),className:"download-input"}),(0,t.jsx)("button",{onClick:e9,disabled:!eh.trim()||e8,className:"download-btn",children:e8?"下载中...":"开始下载"})]})}),eo&&(0,t.jsxs)("div",{className:"preview-overlay",onClick:()=>{ei(null),e$(""),eU(!1)},children:[(0,t.jsx)("button",{className:"preview-close",children:(0,t.jsx)(m.X,{size:20})}),(0,t.jsxs)("div",{onClick:e=>e.stopPropagation(),children:["image"===eo.subtype&&(0,t.jsx)("div",{className:"preview-media-wrapper",children:(0,t.jsx)("img",{ref:eI,src:L.getFileDownloadUrl(eo.cid),alt:""})}),"video"===eo.subtype&&(0,t.jsx)("div",{className:"preview-media-wrapper",children:(0,t.jsx)("video",{ref:eI,src:L.getFileDownloadUrl(eo.cid),controls:!0})}),"audio"===eo.subtype&&(0,t.jsxs)("div",{className:"preview-audio",children:[(0,t.jsx)("div",{className:"preview-audio-icon",children:(0,t.jsx)(h.Music,{size:36,color:"var(--accent)"})}),(0,t.jsx)("p",{className:"preview-audio-filename",children:eo.fileName}),(0,t.jsx)("audio",{className:"preview-audio-player",src:L.getFileDownloadUrl(eo.cid),controls:!0})]}),"file"===eo.subtype&&(0,t.jsxs)("div",{className:"preview-unsupported",children:[(0,t.jsx)(p,{size:48,className:"preview-file-icon"}),(0,t.jsx)("p",{children:eo.fileName}),(0,t.jsx)("p",{className:"preview-unsupported-hint",children:"无法预览"})]}),"text"===eo.subtype&&(0,t.jsxs)("div",{className:"preview-text-container",children:[(0,t.jsx)("div",{className:"preview-text-header",children:(0,t.jsx)("span",{children:eo.fileName})}),eD?(0,t.jsxs)("div",{className:"preview-text-loading",children:[(0,t.jsx)(R,{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:eL||"(文件为空)"})]})]})]}),er.length>0&&(0,t.jsxs)("div",{className:"batch-bar",children:[(0,t.jsxs)("span",{className:"batch-info",children:["已选 ",er.length," 项"]}),(0,t.jsx)("button",{onClick:()=>ea([]),className:"batch-dismiss",children:(0,t.jsx)(m.X,{size:16})}),(0,t.jsx)("div",{className:"batch-divider"}),"trash"===Y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:async()=>{await Promise.all(er.map(e=>L.restoreTrashFile(e))),ea([]),M("已恢复","success"),eK(),eG(),eZ()},className:"btn small",children:"恢复"}),(0,t.jsx)("button",{onClick:e2,className:"btn small danger",children:"永久删除"})]}):(0,t.jsxs)(t.Fragment,{children:[1===er.length&&(n=X.find(e=>e.cid===er[0]))&&"file"!==U(n.fileName)&&(0,t.jsx)("button",{onClick:()=>{let e=X.find(e=>e.cid===er[0]);if(e){let t=U(e.fileName);ei({...e,subtype:t}),e$(""),"text"===t&&e5(e.cid)}},className:"btn small",children:"预览"}),(0,t.jsx)("button",{onClick:()=>{let e=er.some(e=>{let t=X.find(t=>t.cid===e);return t&&!t.starred});er.forEach(t=>{let s=X.find(e=>e.cid===t);s&&(e?!s.starred:s.starred)&&e1(t)})},className:"btn small btn-star",children:"收藏"}),1===er.length&&(0,t.jsx)("button",{onClick:()=>{let e=X.find(e=>e.cid===er[0]);e&&e6(e)},className:"btn small",children:"重命名"}),(0,t.jsx)("button",{onClick:()=>eT.open(),className:"btn small btn-move",children:"移动"}),(0,t.jsx)("button",{onClick:e2,className:"btn small danger",children:"删除"}),1===er.length&&(0,t.jsx)("button",{onClick:()=>el(X.find(e=>e.cid===er[0])),className:"btn small",children:"分享"}),1===er.length&&(0,t.jsx)("button",{onClick:()=>{let e=X.find(e=>e.cid===er[0]);e&&tt(e)},className:"btn small",children:"另存为"})]})]}),ef&&(0,t.jsx)(S.ModalOverlay,{onClose:()=>ey.close(),closeOnOverlayClick:!0,children:(0,t.jsxs)("div",{className:"transfer-modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"modal-header",children:[(0,t.jsx)("h3",{children:"传输"}),(0,t.jsx)("button",{onClick:()=>ey.close(),className:"modal-close-btn",children:(0,t.jsx)(m.X,{size:18})})]}),0===ep.length?(0,t.jsx)("div",{className:"empty-transfer",children:"暂无传输"}):ep.map(e=>(0,t.jsxs)("div",{className:"transfer-item",children:[(0,t.jsxs)("div",{className:"transfer-item-header",children:["upload"===e.type?(0,t.jsx)(a,{size:14}):(0,t.jsx)(g.Download,{size:14}),(0,t.jsx)("span",{className:"transfer-item-name",children:e.fileName}),"downloading"===e.status&&"download"===e.type&&(0,t.jsx)("button",{onClick:()=>te(e),className:"transfer-item-cancel",children:(0,t.jsx)(m.X,{size:14})})]}),(0,t.jsxs)("div",{className:"transfer-progress-row",children:[(0,t.jsx)("div",{className:"transfer-progress-bar",children:(0,t.jsx)("div",{className:`transfer-progress-fill ${"download"===e.type?"download":""} ${"error"===e.status?"error":""} ${"cancelled"===e.status?"cancelled":""}`,style:{width:`${e.progress}%`}})}),(0,t.jsx)("span",{className:"transfer-progress-text",children:"completed"===e.status?"完成":"error"===e.status?"失败":"cancelled"===e.status?"已取消":e.loaded&&e.total?`${O(e.loaded)}/${O(e.total)}`:`${e.progress}%`})]})]},e.id))]})})]})}],27627)}]);
|