1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
import{C as e,J as t,L as n,N as r,O as i,S as a,U as o,V as s,a as c,b as l,c as u,g as d,i as f,j as p,k as m,n as h,o as g,p as _,q as v,r as y,s as b,x,z as S}from"./ui-BjxGELcM.js";import{t as C}from"./arrow-right-CxQiebL9.js";import{t as w}from"./cloud-CIOLOOjB.js";import{t as T}from"./hash-Dadu1FEQ.js";import{t as E}from"./monitor-play-Be-GlwMy.js";import{t as D}from"./radio-tower-Dfdb9MI0.js";import{t as O}from"./server-nMqD8oSq.js";import{t as k}from"./shield-check-CU6M0J1d.js";import{t as A}from"./video-02fL9iqS.js";import{i as j,o as M}from"./index-BsK239Bd.js";var N=i(`<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">`),P=i(`<div class="flex items-center gap-2.5"><span class="size-2 bg-success pulse"></span><span class="mono-label text-muted-foreground">SyncLive / 对标 SyncTV · fan-out`),F=i(`<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`),I=i(`<p class="mt-6 max-w-xl text-base leading-relaxed text-muted-foreground sm:text-lg">Cloudflare Realtime 与 SRS 双 SFU 分发,浏览器经服务端反代直连,凭证不出服务端。`),L=i(`<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>`),R=i(`<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=输入房间名 aria-label=房间名>`),z=i(`<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`),B=i(`<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">在线房间`),V=i(`<div class=mt-2>`),H=i(`<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 密钥。`),U=i(`<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>`),W=i(`<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">`),G=i(`<p class="text-sm text-muted-foreground">正在读取后端配置…`),K=i(`<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">`),q=[`WHIP`,`WHEP`,`HLS`,`FLV`];function J(e){return e===`BACKEND_KIND_CLOUDFLARE`?w:O}function Y(e){return e.targets?.length??0}function X(e){return(()=>{var t=N(),i=t.firstChild,o=i.firstChild,s=o.nextSibling;return a(t,n(E,{class:`size-6 text-muted-foreground/60`}),i),a(o,()=>e.authed?`暂无在线房间`:`房间列表需登录`),a(s,()=>e.authed?`创建一个房间后,分发拓扑会出现在这里。`:`登录后可查看与管理房间分发拓扑。`),a(t,n(r,{get when(){return!e.authed},get children(){return n(M,{to:`/login`,class:`btn btn-outline btn-sm mt-1`,children:`去登录`})}}),null),t})()}var Z=()=>{let i=j(),[x,w]=o([]),[E,O]=o([]),[M,N]=o(``),Z;t(()=>{d.getConfig().then(e=>w(e.backends||[])).catch(()=>{});let e=Z;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),v(()=>{e.removeEventListener(`mousemove`,s),e.removeEventListener(`mouseleave`,c),cancelAnimationFrame(o)})}}),S(()=>{_.check()&&_.isAuthed()&&d.listRooms().then(e=>O(e.rooms||[])).catch(()=>{})});let Q=e=>i({to:e,search:{room:M()}});return(()=>{var t=U(),o=t.firstChild,d=o.firstChild.nextSibling.nextSibling,v=o.nextSibling,S=v.firstChild,w=S.nextSibling;return m(e=>Z=e,o),a(d,n(u,{get children(){return P()}}),null),a(d,n(u,{delay:1,get children(){return F()}}),null),a(d,n(u,{delay:2,get children(){return I()}}),null),a(d,n(u,{delay:3,class:`mt-10`,get children(){var e=R(),t=e.firstChild,i=t.firstChild,o=i.firstChild;return a(e,n(f,{}),t),a(i,n(T,{class:`size-4 shrink-0 text-muted-foreground`}),o),o.$$keydown=e=>{e.key===`Enter`&&Q(`/room`)},o.$$input=e=>N(e.currentTarget.value),a(t,n(y,{class:`h-11 sm:w-auto`,onClick:()=>Q(`/room`),get children(){return[`进入房间`,n(C,{class:`size-4`})]}}),null),a(t,n(y,{variant:`outline`,class:`h-11`,onClick:()=>Q(`/publish`),get children(){return[n(A,{class:`size-4`}),`开始直播`]}}),null),a(e,n(r,{get when(){return _.isAuthed()},get children(){var e=L(),t=e.firstChild,n=t.firstChild.nextSibling,r=t.nextSibling,i=r.firstChild.nextSibling,o=r.nextSibling.firstChild.nextSibling;return a(n,()=>_.role()),a(i,()=>_.can(`room:publish`)?`ON`:`OFF`),a(o,()=>_.can(`room:chat`)?`ON`:`OFF`),s(e=>{var t=_.can(`room:publish`)?`text-success`:`opacity-50`,n=_.can(`room:chat`)?`text-success`:`opacity-50`;return t!==e.e&&l(i,e.e=t),n!==e.t&&l(o,e.t=n),e},{e:void 0,t:void 0}),e}}),null),s(()=>o.value=M()),e}}),null),a(d,n(u,{delay:4,class:`mt-12`,get children(){var t=z(),n=t.firstChild,r=n.firstChild,i=n.nextSibling.firstChild;return a(r,()=>x().length||`–`),a(i,(()=>{var t=e(()=>!!_.isAuthed());return()=>t()?E().length:`–`})()),t}}),null),a(t,n(g,{items:[`WHIP → SFU`,`SRS FAN-OUT`,`WHEP / HLS / FLV`,`CLOUDFLARE REALTIME`,`WEBRTC LOW-LATENCY`,`一路推流 · 多端扇出`,`FAN-OUT CONSOLE`]}),v),a(S,n(u,{get children(){var e=B();return e.firstChild,a(e,n(y,{variant:`ghost`,size:`sm`,class:`hidden sm:inline-flex`,onClick:()=>i({to:`/rooms`}),get children(){return[`全部`,n(C,{class:`size-3.5`})]}}),null),e}}),null),a(S,n(r,{get when(){return E().length>0},get fallback(){return n(X,{get authed(){return _.isAuthed()}})},get children(){var e=V();return a(e,n(p,{get each(){return E()},children:(e,t)=>n(u,{get delay(){return Math.min(t()+1,5)},get children(){var r=W(),o=r.firstChild,s=o.nextSibling,l=s.firstChild,u=l.nextSibling,d=u.firstChild,f=s.nextSibling;return a(o,()=>String(t()+1).padStart(2,`0`)),a(r,n(c,{get active(){return Y(e)>0}}),s),a(l,()=>e.name),a(u,()=>Y(e),d),a(u,()=>Y(e)>0?`live`:`idle`,null),a(f,n(y,{size:`sm`,variant:`outline`,class:`flex-1 sm:flex-none`,onClick:()=>i({to:`/room`,search:{room:e.name}}),children:`进入`}),null),a(f,n(y,{size:`sm`,class:`flex-1 sm:flex-none`,onClick:()=>i({to:`/publish`,search:{room:e.name}}),children:`直播`}),null),r}})})),e}}),null),a(w,n(u,{get children(){var t=H(),i=t.firstChild,o=i.firstChild,c=o.firstChild,u=i.nextSibling,d=u.nextSibling,m=d.firstChild.nextSibling,g=d.nextSibling,_=g.firstChild;return a(t,n(f,{}),i),a(o,n(D,{class:`size-4 text-acid-lime`}),c),a(i,n(h,{variant:`muted`,get children(){return[e(()=>x().length),` 路`]}}),null),a(u,n(r,{get when(){return x().length>0},get fallback(){return G()},get children(){return n(p,{get each(){return x()},children:e=>{let t=J(e.kind);return(()=>{var r=K(),i=r.firstChild,o=i.firstChild,c=o.nextSibling.firstChild,u=c.nextSibling,d=i.nextSibling;return a(o,n(t,{class:`size-4`})),a(c,()=>e.name),a(u,()=>e.primary?`primary sfu`:`standby`),a(d,n(b,{get active(){return e.configured}}),null),a(d,n(h,{get variant(){return e.configured?`success`:`muted`},get children(){return e.configured?`在线`:`未配置`}}),null),s(()=>l(r,`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`}`)),r})()}})}})),a(m,n(p,{each:q,children:e=>n(h,{variant:`outline`,class:`font-mono`,children:e})})),a(g,n(k,{class:`mt-px size-4 shrink-0 text-success`}),_),t}})),t})()};x([`input`,`keydown`]);export{Z as Home}; |