1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
import{C as e,G as t,J as n,L as r,N as i,O as a,S as o,U as s,V as c,_ as l,a as u,b as d,c as f,h as p,j as m,k as h,l as g,m as _,n as v,o as y,q as b,r as x,s as S,x as C,z as w}from"./ui-BEZm0Fjb.js";import{t as T}from"./arrow-right-CYxcOjf4.js";import{n as E,t as D}from"./video-1nOl5FpE.js";import{t as O}from"./monitor-play-Br3jNYD4.js";import{t as k}from"./radio-tower-CN-xjSIh.js";import{t as A}from"./server-DmfY9b1N.js";import{t as j}from"./shield-check-DH7IfQwC.js";import{r as M,t as N}from"./index-BjOqv38F.js";var P=[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]],F=e=>r(_,t(e,{iconNode:P,name:`hash`})),I=a(`<div class="mt-6 flex flex-col items-center gap-3 border border-dashed border-line px-6 py-14 text-center"><div><p class=font-medium></p><p class="mt-1 text-sm text-muted-foreground">`),L=a(`<div class="flex items-center gap-2.5"><span class="size-2 bg-success pulse"></span><span class="mono-label text-muted-foreground">live-sfu / fan-out console`),R=a(`<h1 class="display mt-6 text-[clamp(3.4rem,9vw,7.75rem)] will-change-transform"data-parallax=10><span class=block>一路推流,</span><span class=block><span class=text-acid-lime>多端扇出</span><span class="mono-label ml-3 align-top text-acid-lime sm:ml-5">/ fan-out`),z=a(`<p class="mt-6 max-w-xl text-base leading-relaxed text-muted-foreground sm:text-lg">Cloudflare Realtime 与 SRS 双 SFU 分发,浏览器经服务端反代直连,凭证不出服务端。`),B=a(`<div class="mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 border-t border-line/70 pt-3"><span class="mono-label flex items-center gap-1.5 text-muted-foreground">role <span class=text-acid-cyan></span></span><span class="mono-label text-muted-foreground">publish · <span></span></span><span class="mono-label text-muted-foreground">chat · <span>`),V=a(`<div class="relative max-w-3xl border border-line bg-card/60 p-3 backdrop-blur-sm will-change-transform sm:p-4"data-parallax=6><div class="flex flex-col gap-2 sm:flex-row"><div class="flex h-11 flex-1 items-center gap-2.5 border border-line bg-background/70 px-3 transition-colors focus-within:border-ring"><input class="field-mono h-full w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground/50"placeholder="房间名,如 demo"aria-label=房间名>`),H=a(`<div class="grid max-w-3xl grid-cols-3 divide-x divide-line/80 border border-line bg-card/40 will-change-transform"data-parallax=4><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary"></p><p class="mono-label mt-1.5 text-muted-foreground">sfu backends</p></div><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary"></p><p class="mono-label mt-1.5 text-muted-foreground">online rooms</p></div><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary">4</p><p class="mono-label mt-1.5 text-muted-foreground">protocols`),U=a(`<div class="flex items-end justify-between gap-4 border-b border-line pb-4"><div><p class="mono-label text-muted-foreground">online rooms</p><h2 class="display mt-1.5 text-3xl sm:text-4xl">在线房间`),W=a(`<div class=mt-2>`),G=a(`<div class="relative border border-line bg-card/50 p-4 sm:p-5"><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-2"><h2 class=font-semibold>Signal Stack</h2></div></div><div class="mt-4 space-y-2.5"></div><div class="mt-4 border-t border-line/70 pt-4"><p class="micro-label text-muted-foreground">distribution protocols</p><div class="mt-2.5 flex flex-wrap gap-1.5"></div></div><div class="mt-4 flex items-start gap-2.5 border border-line/70 bg-background/40 p-3"><p class="text-xs leading-relaxed text-muted-foreground">凭据由服务端代理注入,浏览器不持有 SFU 密钥。`),K=a(`<div class=relative><section class="relative overflow-hidden"><div class=spotlight aria-hidden=true></div><div class="ghost-text display pointer-events-none absolute -top-8 right-0 hidden text-[24vw] leading-none will-change-transform xl:block"data-parallax=-40 aria-hidden=true>SFU</div><div class="relative mx-auto max-w-[1400px] px-4 pt-14 pb-12 sm:px-6 sm:pt-20"></div></section><section class="mx-auto grid max-w-[1400px] gap-10 px-4 py-14 sm:px-6 lg:grid-cols-[minmax(0,1fr)_360px]"><div class=min-w-0></div><aside class=min-w-0>`),q=a(`<div class="group -mx-3 grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 border-b border-line/80 py-4 transition-colors hover:bg-accent/40 sm:mx-0 sm:-mx-4 sm:grid-cols-[3rem_auto_minmax(0,1fr)_auto] sm:gap-4 sm:px-4"><span class="hidden font-mono text-xs text-muted-foreground/70 sm:block"></span><div class=min-w-0><p class="display truncate text-xl transition-colors sm:text-2xl dark:group-hover:text-primary"></p><p class="mono-label mt-1 text-muted-foreground"> targets · </p></div><div class="col-span-2 flex gap-2 sm:col-span-1">`),J=a(`<p class="text-sm text-muted-foreground">正在读取后端配置…`),Y=a(`<div><div class="flex min-w-0 items-center gap-3"><span class="flex size-9 shrink-0 items-center justify-center border border-line bg-background text-foreground/80"></span><div class=min-w-0><p class="truncate text-sm font-medium"></p><p class="micro-label mt-0.5 text-muted-foreground"></p></div></div><div class="flex shrink-0 items-center gap-2.5">`),X=[`WHIP`,`WHEP`,`HLS`,`FLV`];function Z(e){return e===`BACKEND_KIND_CLOUDFLARE`?E:A}function Q(e){return e.targets?.length??0}function $(e){return(()=>{var t=I(),n=t.firstChild,a=n.firstChild,s=a.nextSibling;return o(t,r(O,{class:`size-6 text-muted-foreground/60`}),n),o(a,()=>e.authed?`暂无在线房间`:`房间列表需登录`),o(s,()=>e.authed?`创建一个房间后,分发拓扑会出现在这里。`:`登录后可查看与管理房间分发拓扑。`),o(t,r(i,{get when(){return!e.authed},get children(){return r(M,{to:`/login`,class:`btn btn-outline btn-sm mt-1`,children:`去登录`})}}),null),t})()}var ee=()=>{let t=N(),[a,_]=s([]),[C,E]=s([]),[O,A]=s(`demo`),M;n(()=>{l.getConfig().then(e=>_(e.backends||[])).catch(()=>{});let e=M;if(e&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let t=Array.from(e.querySelectorAll(`[data-parallax]`)),n=0,r=0,i=0,a=0,o=0,s=t=>{let i=e.getBoundingClientRect();n=(t.clientX-i.left)/i.width-.5,r=(t.clientY-i.top)/i.height-.5,e.style.setProperty(`--mx`,`${t.clientX-i.left}px`),e.style.setProperty(`--my`,`${t.clientY-i.top}px`)},c=()=>{n=0,r=0},l=()=>{i+=(n-i)*.08,a+=(r-a)*.08;for(let e of t){let t=Number(e.dataset.parallax||0);e.style.transform=`translate3d(${(i*t).toFixed(2)}px, ${(a*t).toFixed(2)}px, 0)`}o=requestAnimationFrame(l)};e.addEventListener(`mousemove`,s),e.addEventListener(`mouseleave`,c),o=requestAnimationFrame(l),b(()=>{e.removeEventListener(`mousemove`,s),e.removeEventListener(`mouseleave`,c),cancelAnimationFrame(o)})}}),w(()=>{p.check()&&p.isAuthed()&&l.listRooms().then(e=>E(e.rooms||[])).catch(()=>{})});let P=e=>t({to:e,search:{room:O()}});return(()=>{var n=K(),s=n.firstChild,l=s.firstChild.nextSibling.nextSibling,_=s.nextSibling,b=_.firstChild,w=b.nextSibling;return h(e=>M=e,s),o(l,r(g,{get children(){return L()}}),null),o(l,r(g,{delay:1,get children(){return R()}}),null),o(l,r(g,{delay:2,get children(){return z()}}),null),o(l,r(g,{delay:3,class:`mt-10`,get children(){var e=V(),t=e.firstChild,n=t.firstChild,a=n.firstChild;return o(e,r(u,{}),t),o(n,r(F,{class:`size-4 shrink-0 text-muted-foreground`}),a),a.$$keydown=e=>{e.key===`Enter`&&P(`/room`)},a.$$input=e=>A(e.currentTarget.value),o(t,r(x,{class:`h-11 sm:w-auto`,onClick:()=>P(`/room`),get children(){return[`进入房间`,r(T,{class:`size-4`})]}}),null),o(t,r(x,{variant:`outline`,class:`h-11`,onClick:()=>P(`/publish`),get children(){return[r(D,{class:`size-4`}),`开始直播`]}}),null),o(e,r(i,{get when(){return p.isAuthed()},get children(){var e=B(),t=e.firstChild,n=t.firstChild.nextSibling,r=t.nextSibling,i=r.firstChild.nextSibling,a=r.nextSibling.firstChild.nextSibling;return o(n,()=>p.role()),o(i,()=>p.can(`room:publish`)?`ON`:`OFF`),o(a,()=>p.can(`room:chat`)?`ON`:`OFF`),c(e=>{var t=p.can(`room:publish`)?`text-success`:`opacity-50`,n=p.can(`room:chat`)?`text-success`:`opacity-50`;return t!==e.e&&d(i,e.e=t),n!==e.t&&d(a,e.t=n),e},{e:void 0,t:void 0}),e}}),null),c(()=>a.value=O()),e}}),null),o(l,r(g,{delay:4,class:`mt-12`,get children(){var t=H(),n=t.firstChild,r=n.firstChild,i=n.nextSibling.firstChild;return o(r,()=>a().length||`–`),o(i,(()=>{var t=e(()=>!!p.isAuthed());return()=>t()?C().length:`–`})()),t}}),null),o(n,r(S,{items:[`WHIP → SFU`,`SRS FAN-OUT`,`WHEP / HLS / FLV`,`CLOUDFLARE REALTIME`,`WEBRTC LOW-LATENCY`,`一路推流 · 多端扇出`,`FAN-OUT CONSOLE`]}),_),o(b,r(g,{get children(){var e=U();return e.firstChild,o(e,r(x,{variant:`ghost`,size:`sm`,class:`hidden sm:inline-flex`,onClick:()=>t({to:`/rooms`}),get children(){return[`全部`,r(T,{class:`size-3.5`})]}}),null),e}}),null),o(b,r(i,{get when(){return C().length>0},get fallback(){return r($,{get authed(){return p.isAuthed()}})},get children(){var e=W();return o(e,r(m,{get each(){return C()},children:(e,n)=>r(g,{get delay(){return Math.min(n()+1,5)},get children(){var i=q(),a=i.firstChild,s=a.nextSibling,c=s.firstChild,l=c.nextSibling,u=l.firstChild,d=s.nextSibling;return o(a,()=>String(n()+1).padStart(2,`0`)),o(i,r(y,{get active(){return Q(e)>0}}),s),o(c,()=>e.name),o(l,()=>Q(e),u),o(l,()=>Q(e)>0?`live`:`idle`,null),o(d,r(x,{size:`sm`,variant:`outline`,class:`flex-1 sm:flex-none`,onClick:()=>t({to:`/room`,search:{room:e.name}}),children:`进入`}),null),o(d,r(x,{size:`sm`,class:`flex-1 sm:flex-none`,onClick:()=>t({to:`/publish`,search:{room:e.name}}),children:`直播`}),null),i}})})),e}}),null),o(w,r(g,{get children(){var t=G(),n=t.firstChild,s=n.firstChild,l=s.firstChild,p=n.nextSibling,h=p.nextSibling,g=h.firstChild.nextSibling,_=h.nextSibling,y=_.firstChild;return o(t,r(u,{}),n),o(s,r(k,{class:`size-4 text-acid-lime`}),l),o(n,r(v,{variant:`muted`,get children(){return[e(()=>a().length),` 路`]}}),null),o(p,r(i,{get when(){return a().length>0},get fallback(){return J()},get children(){return r(m,{get each(){return a()},children:e=>{let t=Z(e.kind);return(()=>{var n=Y(),i=n.firstChild,a=i.firstChild,s=a.nextSibling.firstChild,l=s.nextSibling,u=i.nextSibling;return o(a,r(t,{class:`size-4`})),o(s,()=>e.name),o(l,()=>e.primary?`primary sfu`:`standby`),o(u,r(f,{get active(){return e.configured}}),null),o(u,r(v,{get variant(){return e.configured?`success`:`muted`},get children(){return e.configured?`在线`:`未配置`}}),null),c(()=>d(n,`flex items-center justify-between gap-3 border p-3 transition-colors ${e.configured?`border-line bg-background/50`:`border-line/60 bg-background/20 opacity-70`}`)),n})()}})}})),o(g,r(m,{each:X,children:e=>r(v,{variant:`outline`,class:`font-mono`,children:e})})),o(_,r(j,{class:`mt-px size-4 shrink-0 text-success`}),y),t}})),n})()};C([`input`,`keydown`]);export{ee as Home}; |