PageSourceSearch

https://snich.ai/assets/ViewerView-6f7d7b14.js

js snich.ai collected 2026-10-05 15:08:15 UTC 74,794 bytes, 27 lines download raw bytes

1import{j as s,r as h,R as Me}from"./vendor-react-72e4a099.js";import{c as N,B as S,u as V,f as xs,a as Se,d as E,E as ks,g as Zs,e as Ae,b as H,M as cs,C as Re}from"./Toast-43ee7788.js";import{b as K,T as Js}from"./Display-48adcc24.js";import{m as bs,u as G,p as Cs,q as $s,c as se,a as qs}from"./format-5039f022.js";import{S as Pe}from"./SoonView-a22eca1b.js";import{B as Te,V as Fe}from"./EntryChrome-3815c94b.js";import{d as F,c as ee}from"./StudioRealtime-3ad3f1c0.js";import{P as ne,a as Le,L as te,S as Ns,b as $e,c as qe,u as ze,V as Ie}from"./ViewerPoll-f209eb79.js";import{i as zs,s as ts,r as vs,w as js,p as ae,t as Oe,c as Ds,u as Be,C as Ve,d as _e,e as Ue,Q as De,R as Is,f as He,g as Ke,h as Qe,a as Ye,j as We,P as Ge,V as Xe,b as Ze}from"./ViewerQuestions-10e8edd1.js";import{f as ds,r as Q,e as Os,B as Je}from"./buildLifecycle-a44b0e05.js";import{L as Es}from"./log-out-e38723a8.js";import{E as ie}from"./eye-5711d0dd.js";import{p as re}from"./snichDenoiseRuntime-273d9ce6.js";import{H as Y}from"./ProgramGraphicsLayer-e1e0e604.js";import{U as sn}from"./user-plus-d862ebc6.js";import{C as ms}from"./check-083433f7.js";import{U as en}from"./users-a990a1e8.js";import{M as us}from"./mic-098d6d5b.js";import{M as hs}from"./mic-off-05523af3.js";import{V as oe}from"./video-a08888e9.js";import{V as ce}from"./video-off-a445220e.js";import{A as nn}from"./arrow-left-6a250fbc.js";import{R as gs}from"./radio-dc3b7f8c.js";import{C as ps}from"./clock-e6794ea5.js";import{C as Hs}from"./chevron-right-b4336544.js";import{S as tn}from"./sliders-horizontal-41aa44a5.js";import{H as an}from"./headphones-a3105568.js";import{c as rs}from"./createLucideIcon-581cd729.js";import{S as rn}from"./send-ef7332d3.js";import{C as es}from"./captions-4aebb0bb.js";import{X as le}from"./x-b9f3d093.js";import{S as de}from"./sparkles-e0558c3e.js";import{a as as,F as me,O as ue,R as he}from"./RoomFeaturesUi-d9f0cc70.js";import{j as on,C as cn}from"./Studio-12de6b79.js";import{k as or,V as cr}from"./Studio-12de6b79.js";import{P as ln}from"./plus-39793e81.js";import{T as dn}from"./thumbs-up-f55ea202.js";import{H as mn}from"./heart-469df115.js";import{S as un}from"./star-f57b9032.js";import{M as Ms}from"./minimize-f9a54b0a.js";import{M as Ss}from"./maximize-edcb58d4.js";import{C as fe}from"./chevron-down-888c3b30.js";import{Z as hn}from"./zap-a08e50de.js";import{V as As}from"./volume-x-8aea9e1c.js";import{V as xe}from"./volume-2-a1e941cc.js";import{u as Ks}from"./Controls-5a18fd37.js";import{e as fn,C as xn,i as vn}from"./embed-cb9596d8.js";import{L as Rs}from"./link-2-36909ef8.js";import{C as jn}from"./copy-34f4069e.js";import{M as pn}from"./mail-c07c6c62.js";import{p as wn}from"./publicApi-16230aa9.js";import{E as Qs}from"./external-link-63c5a0ce.js";import{G as bn}from"./LayoutEditorModal-5c2cbcf2.js";import{E as Nn}from"./ellipsis-bbf71637.js";import{S as gn}from"./share-2-50cd044b.js";import"./circle-check-63b159d4.js";import"./circle-alert-67975319.js";import"./EventPreview-a5c61118.js";import"./eventDuration-e09aabf0.js";/* empty css              */import"./LandingView-54e2e5c3.js";import"./calendar-days-6829c81b.js";import"./music-0f60f4f1.js";import"./pin-70ee9bd9.js";import"./timer-dd0230bd.js";import"./hourglass-26ebe251.js";import"./circle-x-d5c7be80.js";import"./arrow-down-5480e148.js";import"./lock-73755c1f.js";import"./message-square-off-bea6f74e.js";import"./chevron-up-f536cc4c.js";import"./user-2d8f405f.js";import"./index-d9998155.js";import"./guestAccess-28c96151.js";import"./chevron-left-39dc0897.js";import"./refresh-cw-98362cea.js";import"./globe-e09c7f1b.js";import"./mouse-pointer-2-a64daac3.js";import"./film-0ba9e353.js";import"./pause-2cb080c5.js";import"./play-3580deb4.js";import"./ellipsis-vertical-09d18e39.js";import"./slotWidgets-57ef49ea.js";import"./trash-2-7a739e24.js";import"./crown-fdf36aa5.js";import"./chromaKey-9ef66bf0.js";import"./deviceDetection-9fe14a8f.js";import"./roomAccess-6d61bdfc.js";import"./audioQuality-b8c9f17c.js";import"./Lobby-cd4ae718.js";import"./BackgroundModal-371a8f77.js";import"./mediaPrefs-a1582108.js";import"./image-aefc8036.js";import"./upload-34ad8b6a.js";import"./square-abcd1e2a.js";import"./smartphone-d9ded3c9.js";import"./arrow-right-eda8f931.js";import"./shield-check-111738a3.js";import"./layout-grid-63073c93.js";import"./minimize-2-7f4bb98d.js";import"./file-text-e7c68864.js";import"./file-play-96922e92.js";import"./pen-line-729408c9.js";import"./logo-snich-dialogue-bd9a9926.js";import"./circle-119050f3.js";import"./monitor-ac1ab9e6.js";import"./rotate-ccw-738260f2.js";import"./loader-circle-f10bdd75.js";import"./plug-1e9df63e.js";import"./triangle-alert-cdc85d96.js";import"./download-3e69fd6b.js";import"./pencil-c32e7d9a.js";import"./paperclip-3819f2af.js";import"./message-square-87bea34a.js";import"./sticky-note-012253c0.js";import"./mediaSettingsStore-1783edcc.js";import"./camera-8e9c5806.js";import"./MicCheckModal-3c0b1b56.js";import"./micDiagnostics-fa65b80f.js";import"./search-01fb0df0.js";import"./arrow-up-955249b3.js";import"./user-minus-edd1ae61.js";import"./repeat-a9c26444.js";import"./grip-vertical-b48ba28a.js";import"./languages-9836601a.js";import"./shield-b21f8aed.js";import"./WaitingRoom-fe3d8748.js";import"./EndedScreen-b2678b64.js";import"./list-13d531b4.js";import"./api-d8a57490.js";import"./layers-e08031b9.js";import"./type-c9e8ec6d.js";/**
2 * @license lucide-react v0.554.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const yn=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",ke
6y:"1slcih"}]],kn=rs("flame",yn);/**
7 * @license lucide-react v0.554.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Cn=[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]],En=rs("headphone-off",Cn);/**
12 * @license lucide-react v0.554.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Mn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],Sn=rs("laugh",Mn);/**
17 * @license lucide-react v0.554.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const An=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],Rn=rs("party-popper",An);/**
22 * @license lucide-react v0.554.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Pn=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Tn=rs("volume-1",Pn);function W(e){const n=Math.max(0,Math.floor(e));return`${bs(Math.floor(n/3600))}:${bs(Math.floor(n%3600/60))}:${bs(n%60)}`}function ws({startedAt:e,compact:n,className:i}){const t=G(1e3),a=e?Math.max(0,Math.floor((t-e)/1e3)):null;return s.jsxs("span",{className:N("sn-vw-live",n&&"is-compact",i),role:"status","aria-label":a!==null?`В эфире ${W(a)}`:"В эфире",children:[s.jsx("span",{className:"sn-live-dot","aria-hidden":"true"}),"В ЭФИРЕ",!n&&a!==null&&s.jsx("span",{className:"sn-mono",children:W(a)})]})}function Fn(e,n){return e.broadcast.isLive&&e.broadcast.startedAt?Math.max(0,Math.floor((n-e.broadcast.startedAt)/1e3)):null}function Ln({count:e,className:n}){return s.jsxs("span",{className:N("sn-vw-viewers",n),"aria-label":`${e} ${Cs(e,"зритель","зрителя","зрителей")}`,children:[s.jsx(ie,{className:"sn-i sn-i-16","aria-hidden":"true"}),s.jsx("span",{className:"sn-mono","aria-hidden":"true",children:$s(e)}),s.jsx("span",{"aria-hidden":"true",children:Cs(e,"зритель","зрителя","зрителей")})]})}function $n(e,n){return zs(e)?ds(Q.viewerHome()):n!=null&&n.slug?Os(n.slug):ds(Q.home())}function Ps(e,n){window.location.assign($n(e,n))}function qn(){return s.jsxs("span",{className:"sn-vw-logo","aria-hidden":"true",children:[s.jsx("img",{src:Je,alt:"",width:28,height:28}),s.jsxs("span",{children:["snich",s.jsx("i",{children:"."}),"ai"]})]})}function Bs({api:e,event:n,subtitle:i="Вы слушатель",viewers:t,right:a,className:r}){const o=zs(e),l=(n==null?void 0:n.title)||e.room.title;return s.jsxs("header",{className:N("sn-vw-head",r),children:[s.jsx("a",{className:"sn-vw-logo-link",href:ds(o?Q.viewerHome():Q.home()),target:"_blank",rel:"noopener noreferrer","aria-label":o?"snich.ai — в кабинет (в новой вкладке)":"snich.ai (в новой вкладке)",children:s.jsx(qn,{})}),s.jsx("span",{className:"sn-vw-vsep","aria-hidden":"true"}),s.jsx("span",{className:"sn-vw-head-title sn-ellipsis",title:l,children:l}),e.broadcast.isLive&&s.jsx(ws,{startedAt:e.broadcast.startedAt}),typeof t=="number"&&t>0&&s.jsx(Ln,{count:t,className:"sn-vw-hide-md"}),s.jsx("span",{className:"sn-st-grow"}),s.jsxs("span",{className:"sn-vw-me",children:[s.jsx(K,{name:e.me.name||"Гость",src:ts(e.me.avatarUrl),size:36}),s.jsxs("span",{className:"sn-vw-me-name",children:[s.jsx("b",{className:"sn-ellipsis",children:e.me.name||"Гость"}),s.jsx("span",{children:i})]})]}),a??s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sn-vw-vsep","aria-hidden":"true"}),s.jsx(S,{variant:"text",size:"sm",icon:s.jsx(Es,{className:"sn-i sn-i-16"}),onClick:()=>Ps(e,n),children:"Выйти"})]})]})}function zn(e){return e.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}
26\)\s*$/i,"").replace(/^(Default|По умолчанию)\s*-\s*/i,"").trim()}function ve(e,n,i){const[t,a]=h.useState(null),[r,o]=h.useState(null),[l,v]=h.useState(0),[c,d]=h.useState(""),u=h.useRef(null);return h.useEffect(()=>{if(!e)return;let m=!1;o(null);const w=()=>{var x;(x=u.current)==null||x.getTracks().forEach(j=>j.stop()),u.current=null,a(null)},f=i!=null&&i.getTracks().some(x=>x.readyState==="live")?i:null;return(async()=>{var x;if(f){const j=new MediaStream;return f.getTracks().forEach(g=>{if(g.readyState!=="live")return;const b=g.clone();b.enabled=!0,j.addTrack(b)}),j}if(!((x=navigator.mediaDevices)!=null&&x.getUserMedia))throw Object.assign(new Error("unsupported"),{name:"NotFoundError"});try{return await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:360}},audio:!0})}catch(j){if((j==null?void 0:j.name)==="NotAllowedError"||(j==null?void 0:j.name)==="SecurityError")throw j;return navigator.mediaDevices.getUserMedia({audio:!0})}})().then(x=>{var g,b;if(m){x.getTracks().forEach(y=>y.stop());return}u.current=x,a(x);const j=((g=x.getVideoTracks()[0])==null?void 0:g.label)||((b=x.getAudioTracks()[0])==null?void 0:b.label)||"";d(zn(j))}).catch(x=>{m||o((x==null?void 0:x.name)==="NotAllowedError"||(x==null?void 0:x.name)==="SecurityError"?"denied":(x==null?void 0:x.name)==="NotReadableError"?"busy":"missing")}),()=>{m=!0,w()}},[e,i?"source":"devices"]),h.useEffect(()=>{t==null||t.getAudioTracks().forEach(m=>{m.enabled=n.mic}),t==null||t.getVideoTracks().forEach(m=>{m.enabled=n.camera})},[t,n.mic,n.camera]),h.useEffect(()=>{const m=t==null?void 0:t.getAudioTracks()[0];if(!m||!n.mic){v(0);return}const w=window.AudioContext||window.webkitAudioContext;if(!w)return;let f=null,p=0;try{f=new w;const x=f.createMediaStreamSource(new MediaStream([m])),j=f.createAnalyser();
26j.fftSize=512,x.connect(j);const g=new Uint8Array(j.fftSize);let b=0;p=window.setInterval(()=>{j.getByteTimeDomainData(g);let y=0;for(let k=0;k<g.length;k++)y=Math.max(y,Math.abs(g[k]-128));const A=Math.min(1,y/64);b=Math.max(A,b*.8),v(Math.round(b*20)/20)},100)}catch{}return()=>{window.clearInterval(p),f==null||f.close().catch(()=>{})}},[t,n.mic]),{stream:t,level:l,error:r,deviceLabel:c,hasVideo:!!(t!=null&&t.getVideoTracks().length),hasAudio:!!(t!=null&&t.getAudioTracks().length)}}const je="sn-vw-stage-prefs",pe=e=>`sn-vw-stage-invite:${e}`,ys=200;function is(){return vs(je,{mic:!0,camera:!0})}function Ts(e){js(je,e)}function In(e){const n=vs(pe(e),{});return n.invitedByPeerId?n:null}function On(e,n){js(pe(e),{invitedByPeerId:n.invitedByPeerId,invitedByName:n.invitedByName,invitedByRole:n.invitedByRole,message:n.message,at:Date.now()})}function we(e){return e.error==="denied"?"Браузер не дал доступ к камере и микрофону — разрешите их в настройках сайта":e.error==="busy"?"Камера занята другой программой — закройте её и попробуйте снова":e.error==="missing"?"Не нашли камеру и микрофон — подключите их, чтобы выступить":null}function be({prefs:e,onChange:n,overlay:i}){return s.jsxs(s.Fragment,{children:[s.jsx(E,{label:e.mic?"Микрофон включён":"Микрофон выключен",variant:i?e.mic?"dark":"off":e.mic?"quiet":"off-light","aria-pressed":e.mic,onClick:()=>n({...e,mic:!e.mic}),children:e.mic?s.jsx(us,{className:"sn-i"}):s.jsx(hs,{className:"sn-i"})}),s.jsx(E,{label:e.camera?"Камера включена":"Камера выключена",variant:i?e.camera?"dark":"off":e.camera?"quiet":"off-light","aria-pressed":e.camera,onClick:()=>n({...e,camera:!e.camera}),children:e.camera?s.jsx(oe,{className:"sn-i"}):s.jsx(ce,{className:"sn-i"})})]})}function Ne({preview:e,prefs:n,name:i,big:t,children:a}){const r=we(e);return s.jsxs("div",{className:N("sn-vw-preview",t&&"is-big"),children:[e.hasVideo&&n.camera?s.jsx(ne,{stream:e.stream}):s.jsx("div",{className:"sn-vw-preview-off",children:r?s.jsx("span",{children:r}):s.jsx(K,{name:i,size:t?88:64})}),s.jsx(Le,{}),e.hasAudio&&s.jsxs("span",{className:"sn-vw-preview-level","aria-label":n.mic?e.level>.08?"Микрофон работает":"Микрофон включён":"Микрофон выключен",children:[n.mic?s.jsx(us,{className:"sn-i sn-i-14"}):s.jsx(hs,{className:"sn-i sn-i-14"}),s.jsx(te,{level:n.mic?e.level:0})]}),a]})}function Bn({open:e,onClose:n,api:i,onSent:t}){var x;const{invites:a}=F(),r=V(),[o,l]=h.useState(""),[v,c]=h.useState(!1),[d,u]=h.useState(is),m=ve(e,d,((x=i.me.participant)==null?void 0:x.stream)||null);h.useEffect(()=>{e&&u(is()),e&&re()},[e]);const w=j=>{u(j),Ts(j)},f=async()=>{if(v)return;c(!0);const j=await a.raiseHand(o.trim().slice(0,ys));if(c(!1),!j.ok){r.error(j.error||"Не удалось отправить заявку");return}t(),n(),l("")},p=we(m)?"нет доступа":m.stream?`${m.deviceLabel||"Устройства"} · работают`:"проверяем…";return s.jsxs(xs,{open:e,onClose:n,width:640,className:"sn-vw-hand-modal",icon:s.jsx(Y,{className:"sn-i sn-i-24"}),iconTone:"blue",title:"Попроситься на сцену",subtitle:"Выступите в эфире с вопросом или историей — модератор решит, когда вас позвать",footer:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"sn-st-grow"}),s.jsx(S,{variant:"quiet",onClick:n,children:"Отмена"}),s.jsx(S,{variant:"primary",icon:s.jsx(Y,{className:"sn-i sn-i-16"}),onClick:()=>void f(),loading:v,children:"Отправить заявку"})]}),children:[s.jsxs("div",{className:"sn-vw-hand",children:[s.jsxs("div",{className:"sn-vw-hand-media",children:[s.jsx(Ne,{preview:m,prefs:d,name:i.me.name}),s.jsxs("div",{className:"sn-vw-hand-devices",children:[s.jsx(be,{prefs:d,onChange:w}),s.jsxs("span",{children:[s.jsx("b",{children:"Камера и микрофон"}),s.jsx("small",{children:p})]})]})]}),s.jsxs("div",{className:"sn-vw-hand-topic",children:[s.jsx("label",{className:"sn-label",htmlFor:"sn-vw-hand-topic",children:"О чём хотите сказать?"}),s.jsx("textarea",{id:"sn-vw-hand-topic",className:"sn-input",rows:5,maxLength:ys,value:o,placeholder:"Например: хочу спросить про мобильное приложение",onChange:j=>l(j.target.value),"data-autofocus":!0}),s.jsxs("span",{className:"sn-vw-count",children:[s.jsx("span",{className:"sn-mono",children:o.length})," / ",ys]})]})]}),s.jsxs("div",{className:"sn-vw-infobox",children:[s.jsx(Se,{className:"sn-i sn-i-16"}),s.jsx("span",{children:"Модератор увидит заявку. Если пригласят — вы попадёте за кулисы и сможете проверить звук. Зрители увидят вас, только когда вас выведут на сцену."})]})]})}function Vn({onClose:e}){return h.useEffect(()=>{const n=window.setTimeout(e,9e3);return()=>window.clearTimeout(n)},[e]),s.jsxs("div",{className:"sn-vw-toastcard",role:"status",children:[s.jsx("span",{className:"sn-vw-toastcard-ico is-amber",children:s.jsx(Y,{className:"sn-i sn-i-20"})}),s.jsxs("div",{children:[s.jsx("b",{children:"Заявка у модератора — мы сообщим, когда вас пригласят"}),s.jsx("small",{children:"Пока можно смотреть эфир и писать в чат. Отменить заявку — кнопкой под плеером."})]}),s.jsx(E,{label:"Закрыть",size:"xs",onClick:e,children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]})}function _n({api:e,onAccepted:n,onDeclined:i}){var g;
26const{invites:t}=F(),a=V(),r=G(500),o=t.incoming,[l,v]=h.useState(is),[c,d]=h.useState(null),u=h.useRef(null),w=ve(!!o&&c!=="accept",l,((g=e.me.participant)==null?void 0:g.stream)||null);h.useEffect(()=>{o&&u.current!==o.id&&(u.current=o.id,v(is()),d(null),re())},[o]);const f=o!=null&&o.localExpiresAt?Math.max(0,Math.ceil((o.localExpiresAt-r)/1e3)):null,p=b=>{v(b),Ts(b)},x=async()=>{if(!o||c)return;d("accept"),Ts(l),On(e.room.id,o);const b=await t.accept();if(d(null),!b.ok){a.error(b.error||"Не удалось принять приглашение");return}n()},j=async()=>{if(!o||c)return;d("decline");const b=await t.decline();d(null),!b.ok&&b.code!=="expired"&&b.code!=="not_found"&&a.error(b.error||"Не удалось ответить"),i()};return s.jsx(xs,{open:!!o,onClose:()=>void j(),width:560,closeOnOverlay:!1,className:"sn-vw-invite",icon:o?s.jsxs("span",{className:"sn-vw-invite-av",children:[s.jsx(K,{name:o.invitedByName,size:48}),s.jsx("span",{className:"sn-vw-invite-badge",children:s.jsx(sn,{className:"sn-i sn-i-12"})})]}):void 0,title:"Вас приглашают на сцену",subtitle:o?s.jsxs(s.Fragment,{children:[s.jsx("b",{children:o.invitedByName})," · ",o.invitedByRole||"команда эфира"]}):void 0,children:o&&s.jsxs(s.Fragment,{children:[(o.message||o.topic)&&s.jsx("p",{className:"sn-vw-invite-msg",children:o.message||`Ваша тема: ${o.topic}`}),s.jsx(Ne,{preview:w,prefs:l,name:e.me.name,big:!0,children:s.jsx("div",{className:"sn-vw-preview-controls",children:s.jsx(be,{prefs:l,onChange:p,overlay:!0})})}),s.jsxs("div",{className:"sn-vw-infobox is-green",children:[s.jsx(ks,{className:"sn-i sn-i-16"}),s.jsxs("span",{children:[s.jsx("b",{children:"Вы попадёте за кулисы: вас ещё не увидят зрители."})," В эфир выводит модератор — вы узнаете об этом за 5 секунд."]})]}),s.jsxs("div",{className:"sn-vw-invite-actions",children:[s.jsx(S,{variant:"quiet",size:"lg",onClick:()=>void j(),loading:c==="decline",disabled:!!c,children:"Отказаться"}),s.jsx(S,{variant:"primary",size:"lg",icon:s.jsx(ms,{className:"sn-i sn-i-16"}),onClick:()=>void x(),loading:c==="accept",disabled:!!c,children:"Принять"})]}),f!==null&&s.jsxs("p",{className:"sn-vw-invite-timer",role:"timer","aria-label":`Приглашение действует ещё ${f} с`,children:["Приглашение действует ещё ",s.jsx("span",{className:"sn-mono",children:se(f)})]})]})})}function Un({onHandCleared:e}){const{invites:n}=F(),i=V(),t=h.useRef(new Set);h.useEffect(()=>{const r=n.incomingClosed;if(!r)return;const o=`closed:${r.id}:${r.status}`;t.current.has(o)||(t.current.add(o),i.show(r.status==="cancelled"?"Приглашение на сцену отменили":"Время приглашения истекло"),e())},[n.incomingClosed]),h.useEffect(()=>{const r=n.handLowered;if(!r)return;const o=`lowered:${r.at}`;t.current.has(o)||(t.current.add(o),i.show(`${r.byName} опустил(а) вашу руку`,{icon:s.jsx(Y,{className:"sn-i sn-i-16"})}),e())},[n.handLowered]);const a=n.returnedToAudience;return s.jsx(xs,{open:!!a,onClose:()=>n.dismissNotices(),width:440,icon:s.jsx(en,{className:"sn-i sn-i-24"}),iconTone:"gray",title:"Вы снова в зрителях",subtitle:`${(a==null?void 0:a.byName)||"Продюсер"} вернул(а) вас в зрители. Камера и микрофон выключены — спасибо за участие!`,footer:s.jsx(S,{variant:"primary",onClick:()=>n.dismissNotices(),children:"Понятно"}),children:s.jsx("p",{className:"sn-hint",style:{fontSize:14},children:"Можно продолжать смотреть эфир, писать в чат и снова попроситься на сцену."})})}const Dn=["co_host","streamer","owner","host"];function Hn(e){return[e.role,...e.meetingRoles||[]].map(i=>String(i||"").toLowerCase()).some(i=>Dn.includes(i))}function Kn(e,n){return h.useMemo(()=>{const i=Ds(e,n);if(i)return i;const t=[...e.chat].reverse().find(r=>r.visibility==="private"&&!r.isMine&&r.recipientPeerId===e.me.peerId),a=t?Ds(e,t.peerId):null;return a||e.participants.find(r=>!r.isLocal&&Hn(r))||null},[e.participants,e.chat,n,e.me.peerId])}function Qn({api:e,partner:n,inviterName:i}){const{chat:t}=F(),a=V(),[r,o]=h.useState(""),[l,v]=h.useState(!1),c=h.useMemo(()=>e.chat.filter(f=>f.visibility==="private"&&(f.isMine||f.recipientPeerId===e.me.peerId)),[e.chat,e.me.peerId]),{ref:d,onScroll:u}=Be(c.length),m=(n==null?void 0:n.name)||i,w=async()=>{const f=r.trim();if(!f||l)return;if(!n){a.show("Команда эфира сейчас не в сети — напишите чуть позже");return}v(!0);const p=await t.send(f.slice(0,500),{visibility:"private",recipientPeerId:n.peerId||n.id});if(v(!1),!p.ok){a.error(p.error||"Сообщение не отправилось");return}o("")};return s.jsxs("section",{className:"sn-vw-bs-chat","aria-labelledby":"sn-vw-bs-chat-title",children:[s.jsxs("div",{className:"sn-vw-bs-chat-head",children:[s.jsx("h2",{id:"sn-vw-bs-chat-title",children:"Чат с модератором"}),s.jsx("span",{className:"sn-st-grow"}),m&&s.jsxs("span",{className:N("sn-vw-online",!n&&"is-off"),children:[s.jsx("i",{"aria-hidden":"true"}),n?`${m} в сети`:`${m} не в сети`]})]}),s.jsx("div",{className:"sn-vw-bs-msgs sn-scroll",ref:d,onScroll:u,"aria-label":"Сообщения",tabIndex:0,children:c.length===0?s.jsx("p",{className:"sn-vw-empty",children:"Здесь можно договориться с модератором о выходе. Сообщения видят только вы и команда эфира."}):s.jsx("ul",{children:c.map(f=>s.jsx(Ve,{api:e,message:f,showPrivate:!1},f.id))})}),s.jsx("div",{className:"sn-vw-composer",children:s.jsxs("form",{className:"sn-vw-compose-row",onSubmit:f=>{f.preventDefault(),w()},children:[s.jsxs("div",{className:"sn-vw-input",children:[s.jsx("label",{className:"sn-sr",htmlFor:"sn-vw-bs-input",children:"Сообщение модератору"}),s.jsx("input",{id:"sn-vw-bs-input",className:"sn-input",type:"text",maxLength:500,placeholder:"Сообщение модератору",value:r,onChange:f=>o(f.target.value),autoComplete:"off"})]}),s.jsx("button",{type:"submit",className:"sn-ibtn sn-vw-send","aria-label":"Отправить",disabled:!r.trim()||l,children:s.jsx(rn,{className:"sn-i"})})]})})]})}function Yn({api:e,event:n}){var Vs,_s,Us;const{cues:i}=F(),t=V(),a=G(500),r=h.useRef(e);r.current=e;const o=e.room.id,l=h.useMemo(()=>
26In(o),[o]),v=Kn(e,(l==null?void 0:l.invitedByPeerId)||null),c=!!((Vs=e.me.participant)!=null&&Vs.isOnStage)||e.stageParticipants.some(M=>M.isLocal),d=e.stageAccess.canPublishMedia,[u,m]=h.useState("idle"),[w,f]=h.useState(!1),p=h.useRef(!1);h.useEffect(()=>{!d||p.current||(p.current=!0,m("starting"),r.current.startStageMedia().then(M=>{m(M?"ready":"failed"),M&&f(!0)}).catch(()=>m("failed")))},[d]);const x=((_s=e.me.participant)==null?void 0:_s.stream)||null,j=!!(x!=null&&x.getTracks().some(M=>M.readyState==="live"));h.useEffect(()=>{if(!w||!j)return;f(!1);const M=is(),U=r.current;M.mic===U.me.isMuted&&U.toggleMic(),M.camera===U.me.isCameraOff&&U.toggleCamera()},[w,j]);const g=`sn-vw-soundcheck:${o}`,[b,y]=h.useState(()=>vs(g,{}).ok===!0),A=e.me.participant?((Us=e.audioLevels[e.me.participant.id])==null?void 0:Us.level)??0:0,k=j&&!e.me.isMuted,C=h.useRef(0),L=h.useRef(Date.now()),[I,X]=h.useState(0);h.useEffect(()=>{const M=Date.now(),U=Math.min(500,M-L.current);L.current=M,!(!k||A<12)&&(X(M),C.current+=U,!b&&C.current>900&&(y(!0),js(g,{ok:!0}),i.setReady(!0)))},[A,k]);const Z=k&&a-I<2500,P=i.called,O=P?Math.ceil((P.deadline-a)/1e3):null,T=i.current,B=c?{title:"Вы в эфире",text:"Вас видят и слышат зрители. Когда закончите, модератор вернёт вас за кулисы.",tone:"live"}:P&&O!==null&&O>-5?{title:O>0?`Ваш выход через ${O} с`:"Выходите на сцену",text:`${P.byName} выводит вас в эфир — приготовьтесь.`,tone:"amber"}:T?{title:T.text,text:`Сигнал от ${T.fromName} · ${qs(T.at)}`,tone:"amber"}:{title:"Модератор выведет вас на сцену",text:(l==null?void 0:l.message)||"Проверьте звук и камеру. За 5 секунд до выхода начнётся отсчёт.",tone:"blue"},[$,os]=h.useState(!1),_=async()=>{if($)return;os(!0),i.setReady(!1);const M=await e.leaveStage();os(!1),M.ok||t.error(M.error||"Не получилось вернуться к просмотру")},q=ae(e,n,a),z=!e.playback.muted,J=(l==null?void 0:l.invitedByRole)||(v?Oe(v):null),R=(v==null?void 0:v.name)||(l==null?void 0:l.invitedByName)||null,ss=j&&!e.me.isCameraOff&&!!(x!=null&&x.getVideoTracks().length);return s.jsxs("div",{className:"sn-vw sn-vw-bs",children:[s.jsx(Bs,{api:e,event:n,subtitle:"Гость · за кулисами",right:s.jsxs(S,{variant:"quiet",size:"sm",icon:s.jsx(nn,{className:"sn-i sn-i-16"}),onClick:()=>void _(),loading:$,children:[s.jsx("span",{className:"sn-vw-hide-sm",children:"Вернуться к просмотру"}),s.jsx("span",{className:"sn-vw-only-sm",children:"К просмотру"})]})}),s.jsxs("div",{role:"status",className:N("sn-vw-bs-bar",c&&"is-live"),children:[c?s.jsx(gs,{className:"sn-i sn-i-16"}):s.jsx(ks,{className:"sn-i sn-i-16"}),s.jsx("b",{children:c?"Вы на сцене — вас видят зрители":"Вы за кулисами как гость — зрители вас пока не видят"}),s.jsx("span",{className:"sn-st-grow"}),R&&s.jsxs("span",{className:"sn-vw-bs-host",children:["Вас ведёт",s.jsx(K,{name:R,src:ts(v==null?void 0:v.avatarUrl),size:22}),s.jsxs("span",{children:[s.jsx("b",{children:R}),J?`, ${J}`:""]})]})]}),s.jsxs("div",{className:"sn-vw-bs-body",children:[s.jsxs("main",{className:"sn-vw-bs-main",children:[s.jsxs("section",{className:N("sn-vw-bs-next",`is-${B.tone}`),"aria-label":"Что дальше",children:[s.jsx("span",{className:"sn-vw-bs-next-ico",children:c?s.jsx(gs,{className:"sn-i sn-i-20"}):s.jsx(ps,{className:"sn-i sn-i-20"})}),s.jsxs("div",{className:"sn-vw-bs-next-text",children:[s.jsx("b",{children:B.title}),s.jsx("span",{children:B.text})]}),T&&!c&&!P&&s.jsx(S,{size:"sm",variant:"quiet",onClick:()=>void i.reply(T.id,"Понял(а)"),children:"Понятно"}),s.jsxs("ol",{className:"sn-vw-steps","aria-label":"Шаги",children:[s.jsx(Ns,{state:"done",children:"За кулисами"}),s.jsx("li",{"aria-hidden":"true",className:"sn-vw-step-sep",children:s.jsx(Hs,{className:"sn-i sn-i-14"})}),s.jsx(Ns,{state:b||c?"done":"current",children:"Звук проверен"}),s.jsx("li",{"aria-hidden":"true",className:"sn-vw-step-sep",children:s.jsx(Hs,{className:"sn-i sn-i-14"})}),s.jsx(Ns,{state:c?"current":"todo",children:"На сцене"})]})]}),s.jsxs("section",{className:"sn-vw-bs-cam","aria-label":"Ваша камера",children:[ss?s.jsx(ne,{stream:x}):s.jsx("div",{className:"sn-vw-bs-cam-off",children:u==="starting"||d&&!j&&u!=="failed"?s.jsxs("span",{className:"sn-vw-bs-cam-note",children:[s.jsx("span",{className:"sn-spinner","aria-hidden":"true"}),"Включаем камеру и микрофон…"]}):u==="failed"?s.jsx("span",{className:"sn-vw-bs-cam-note",children:"Не удалось включить камеру и микрофон. Разрешите доступ в браузере и откройте «Камера и звук»."}):d?s.jsx(K,{name:e.me.name||"Гость",src:ts(e.me.avatarUrl),size:96}):s.jsxs("span",{className:"sn-vw-bs-cam-note",children:[s.jsx("span",{className:"sn-spinner","aria-hidden":"true"}),"Подключаем вас к кулисам…"]})}),s.jsxs("span",{className:N("sn-vw-private",c&&"is-live"),children:[c?s.jsx(gs,{className:"sn-i sn-i-14"}):s.jsx(ks,{className:"sn-i sn-i-14"}),c?"Вас видят зрители":"Видят только вы и команда эфира"]}),s.jsxs("span",{className:"sn-vw-bs-namecard",children:[s.jsx("b",{children:e.me.name||"Гость"}),s.jsx("span",{children:"Гость эфира"})]}),!c&&s.jsx("span",{className:"sn-vw-bs-hint",children:"Так вас увидят зрители"})]}),s.jsxs("div",{className:"sn-vw-bs-controls",children:[s.jsx(E,{label:e.me.isMuted?"Микрофон выключен":"Микрофон включён",variant:e.me.isMuted?"off-light":"quiet","aria-pressed":!e.me.isMuted,disabled:!j,onClick:()=>e.toggleMic(),children:e.me.isMuted?s.jsx(hs,{className:"sn-i"}):s.jsx(us,{className:"sn-i"})}),s.jsx(E,{label:e.me.isCameraOff?"Камера выключена":"Камера включена",variant:e.me.isCameraOff?"off-light":"quiet","aria-pressed":!e.me.isCameraOff,disabled:!j,onClick:()=>e.toggleCamera(),children:e.me.isCameraOff?s.jsx(ce,{className:"sn-i"}):s.jsx(oe,{className:"sn-i"})}),s.jsxs("span",{className:N("sn-vw-bs-level",Z&&"is-good"),role:"status",children:[k?s.jsx(us,{className:"sn-i sn-i-16"}):s.jsx(hs,{className:"sn-i sn-i-16"}),s.jsx(te,{level:k?A/100:0}),s.jsx("span",{children:j?k?Z?"Микрофон слышно хорошо":"Скажите что-нибудь — проверим звук":"Микрофон выключен":"Микрофон ещё не включён"})]}),s.jsx("span",{className:"sn-st-grow"}),s.jsx(S,{variant:"quiet",icon:s.jsx(tn,{className:"sn-i sn-i-16"}),onClick:()=>e.openDeviceSettings(),disabled:!j,children:"Камера и звук"})]})]}),s.jsxs("aside",{className:"sn-vw-bs-aside","aria-label":"Эфир и чат с модератором",children:[s.jsxs("section",{className:"sn-vw-bs-program","aria-label":"Сейчас в эфире",children:[s.jsxs("div",{className:"sn-vw-bs-program-head",children:[s.jsx("span",{className:"sn-vw-eyebrow",children:e.broadcast.isLive?"Сейчас в эфире":"Эфир ещё не начался"}),s.jsx("span",{className:"sn-st-grow"}),e.broadcast.isLive&&s.jsx(ws,{startedAt:e.broadcast.startedAt})]}),s.jsx("div",{className:"sn-vw-bs-stage",children:e.renderProgramStage()}),s.jsxs("div",{className:"sn-vw-bs-program-foot",children:[s.jsx("span",{className:"sn-ellipsis",children:q.current?s.jsxs(s.Fragment,{children:[s.jsx("b",{children:q.current.title}),q.current.who?` · ${q.current.who}`:""]}):s.jsx("b",{children:(n==null?void 0:n.title)||e.room.title})}),s.jsx(E,{label:z?"Звук эфира включён":"Звук эфира выключен",size:"sm","aria-pressed":z,onClick:()=>e.setPlaybackMuted(z),children:z?s.jsx(an,{className:"sn-i"}):s.jsx(En,{className:"sn-i"})})]})]}),s.jsx(Qn,{api:e,partner:v,inviterName:(l==null?void 0:l.invitedByName)||null})]})]})]})}const Ys="sn-viewer-captions",Wn={lang:"off",showOriginal:!0,size:"md"},ge=[{value:"off",label:"Выкл",note:""},{value:"ru",label:"Русский",note:"оригинал"},{value:"en",label:"English",note:"перевод AI",ai:!0},{value:"zh",label:"中文",note:"перевод AI",ai:!0}];function Gn(){const[e,n]=h.useState(()=>{const t=_e(Ys,Wn);return{lang:ge.some(a=>a.value===t.lang)?t.lang:"off",showOriginal:t.showOriginal!==!1,size:["sm","md","lg"].includes(t.size)?t.size:"md"}});return[e,t=>n(a=>{const r={...a,...t};return Ue(Ys,r),r})]}function Xn(e,n){return(n.lang==="en"||n.lang==="zh")&&e.viewerTranslation===!1?{...n,lang:"ru"}:n}function ls({open:e,onClose:n,anchor:i,prefs:t,onChange:a,active:r,translationAllowed:o=!0,onAir:l=!1}){const v=o&&(t.lang==="en"||t.lang==="zh");return s.jsx(Zs,{open:e,onClose:n,anchor:i,placement:"top-end",width:300,className:"sn-vw-cc-pop",children:s.jsxs("div",{role:"dialog","aria-label":"Субтитры и перевод",className:"sn-vw-cc",children:[s.jsxs("div",{className:"sn-vw-cc-head",children:[s.jsx(es,{className:"sn-i sn-i-16"}),s.jsx("b",{children:"Субтитры и перевод"}),s.jsx("span",{className:"sn-st-grow"}),s.jsx(E,{label:"Закрыть",size:"xs",onClick:n,children:s.jsx(le,{className:"sn-i sn-i-16"})})]}),s.jsx("div",{role:"radiogroup","aria-label":"Язык субтитров",className:"sn-vw-cc-langs",children:ge.map(c=>{const d=!!c.ai&&!o;return s.jsxs("button",{type:"button",role:"radio","aria-checked":t.lang===c.value&&!d,disabled:d,className:N("sn-vw-cc-lang",t.lang===c.value&&!d&&"is-on"),onClick:()=>a({lang:c.value}),children:[s.jsx("span",{className:"sn-vw-cc-check",children:t.lang===c.value&&!d&&s.jsx(ms,{className:"sn-i sn-i-16"})}),s.jsx("span",{className:"sn-vw-cc-name",children:c.label}),c.note&&s.jsxs("span",{className:N("sn-vw-cc-note",c.ai&&"is-ai"),children:[c.ai&&s.jsx(de,{className:"sn-i sn-i-12"}),d?"выключен организатором":c.note]})]},c.value)})}),l&&s.jsxs("p",{className:"sn-vw-cc-wait",children:["Субтитры на русском уже идут в эфире — поверх картинки.",o?" Здесь можно выбрать перевод.":""]}),!r&&t.lang!=="off"&&s.jsx("p",{className:"sn-vw-cc-wait",children:"Ведущий пока не включил расшифровку — субтитры появятся сами, как только она начнётся."}),s.jsx("div",{className:"sn-vw-cc-sep"}),s.jsxs("div",{className:N("sn-vw-cc-row",!v&&"is-muted"),children:[s.jsx("span",{children:"Показывать оригинал"}),s.jsx(Ae,{checked:t.showOriginal&&v,onChange:c=>a({showOriginal:c}),label:"Показывать оригинал",disabled:!v})]}),s.jsxs("div",{className:"sn-vw-cc-size",children:[s.jsx("span",{children:"Размер текста"}),s.jsx("div",{className:"sn-seg",role:"group","aria-label":"Размер текста субтитров",children:[["sm","Мелкий"],["md","Средний"],["lg","Крупный"]].map(([c,d])=>s.jsx("button",{type:"button","aria-pressed":t.size===c,onClick:()=>a({size:c}),children:d},c))})]})]})})}function Zn(e,n){const[i,t]=h.useState({}),a=h.useRef(new Set),r=h.useRef(new Map),[o,l]=h.useState(0),v=h.useRef(e);v.current=e;const c=e.captions.active?e.captions.entries:[],d=n.lang==="en"||n.lang==="zh",u=
26Date.now();return c.forEach(m=>{const w=r.current.get(m.id);(!w||w.text!==m.text)&&r.current.set(m.id,{text:m.text,at:u})}),h.useEffect(()=>{if(n.lang==="off")return;const m=window.setInterval(()=>l(w=>w+1),1e3);return()=>window.clearInterval(m)},[n.lang]),h.useEffect(()=>{if(!d)return;const m=n.lang;c.filter(w=>w.isFinal).slice(-3).forEach(w=>{const f=`${m}:${w.id}:${w.text.length}`,p=i[w.id];p&&p.lang===m||a.current.has(f)||(a.current.add(f),v.current.translateText(w.text,m).then(x=>{a.current.delete(f),t(j=>({...j,[w.id]:{lang:m,text:x.text,ok:x.translated}}))}))})},[d,n.lang,c.map(m=>`${m.id}:${m.isFinal?1:0}`).join("|")]),h.useMemo(()=>{if(n.lang==="off"||!c.length)return{lines:[],failed:!1};const m=c.filter(p=>{var x;return Date.now()-(((x=r.current.get(p.id))==null?void 0:x.at)||0)<7e3}).slice(-2);let w=!1;return{lines:m.map(p=>{if(!d)return{id:p.id,text:p.text,original:null,pending:!p.isFinal};const x=i[p.id];return x&&x.lang===n.lang?(x.ok||(w=!0),{id:p.id,text:x.text,original:x.ok&&n.showOriginal?p.text:null,pending:!1}):{id:p.id,text:p.text,original:null,pending:!0}}),failed:w}},[c,i,n.lang,n.showOriginal,o])}function Jn({api:e,prefs:n}){const i=Xn(e,n),{lines:t,failed:a}=Zn(e,i);return!t.length||e.captionsOnAir&&i.lang==="ru"?null:s.jsxs("div",{className:N("sn-vw-captions",`is-${i.size}`),"aria-live":"polite","aria-label":"Субтитры",children:[t.map(r=>s.jsxs("div",{className:N("sn-vw-caption",r.pending&&"is-pending"),children:[r.original&&s.jsx("small",{children:r.original}),s.jsx("span",{children:r.text})]},r.id)),a&&s.jsx("em",{className:"sn-vw-caption-note",children:"Перевод сейчас недоступен — показываем оригинал"})]})}const st={like:dn,heart:mn,laugh:Sn,wow:de,clap:Rn,fire:kn,question:cn,thanks:un};function fs({reactionKey:e,className:n}){const i=st[e];return s.jsx(i,{className:N("sn-i",n)})}function et(e){const n=`sn-vw-reacted:${e}`,[i,t]=h.useState(()=>vs(n,{}));return{mine:i,add:r=>t(o=>{const l={...o,[r]:!0};return js(n,l),l})}}function nt(e){const{audience:n}=F(),i=V(),{mine:t,add:a}=et(e.room.id),r=h.useRef(0);return{send:async l=>{const v=Is.find(d=>d.key===l);if(!v)return;a(l);const c=await n.sendReaction(v.emoji);!c.ok&&Date.now()-r.current>4e3&&(r.current=Date.now(),i.show(c.error||"Реакция не отправилась"))},mine:t}}function tt({open:e,onClose:n,anchor:i,onPick:t,mine:a}){return s.jsx(Zs,{open:e,onClose:n,anchor:i,placement:"top-start",width:404,className:"sn-vw-palette-pop",children:s.jsxs("div",{role:"dialog","aria-label":"Реакции",className:"sn-vw-palette",children:[s.jsxs("div",{className:"sn-vw-palette-head",children:[s.jsx("b",{children:"Реакции"}),s.jsx("span",{children:"их видят все зрители и спикеры"})]}),s.jsx("div",{className:"sn-vw-palette-grid",children:Is.map(r=>s.jsxs("button",{type:"button","aria-pressed":!!a[r.key],className:N("sn-vw-palette-btn",`is-${r.key}`,a[r.key]&&"is-on"),onClick:()=>t(r.key),children:[s.jsx("span",{className:"sn-vw-rx-ico",children:s.jsx(fs,{reactionKey:r.key,className:"sn-i-20"})}),r.label]},r.key))})]})})}function Ws({api:e,phone:n}){const{audience:i}=F(),{send:t,mine:a}=nt(e),r=H();return as(e,"reactions")?s.jsx(me,{icon:s.jsx(on,{className:"sn-i sn-i-16"}),testId:"viewer-reactions-off",children:n?"Реакции выключены":ue.reactions}):s.jsxs("div",{role:"group","aria-label":"Реакции",className:N("sn-vw-rxbar",n&&"is-phone"),children:[De.map(o=>{const l=Is.find(u=>u.key===o),v=He(i.reactionTotals,l.emoji),c=!!a[o],d=`${l.label}${c?" — вы отреагировали":""}, ${v}`;return n?s.jsx("button",{type:"button",className:N("sn-ibtn sn-ibtn-quiet sn-vw-rx",`is-${o}`,c&&"is-on"),"aria-label":d,"aria-pressed":c,onClick:()=>void t(o),children:s.jsx(fs,{reactionKey:o})},o):s.jsxs("button",{type:"button",className:N("sn-btn sn-btn-quiet sn-vw-rx",`is-${o}`,c&&"is-on"),"aria-label":d,"aria-pressed":c,onClick:()=>void t(o),children:[s.jsx(fs,{reactionKey:o,className:"sn-i-20"}),s.jsx("span",{className:"sn-mono",children:$s(v)})]},o)}),!n&&s.jsxs(s.Fragment,{children:[s.jsx(E,{label:r.open?"Закрыть реакции":"Все реакции",variant:"quiet",className:N("sn-vw-rx-more",r.open&&"is-open"),onClick:r.toggle,"aria-expanded":r.open,"aria-haspopup":"dialog",children:r.open?s.jsx(le,{className:"sn-i"}):s.jsx(ln,{className:"sn-i"})}),s.jsx(tt,{open:r.open,onClose:r.close,anchor:r.anchor,onPick:o=>void t(o),mine:a})]})]})}function at({api:e}){const[n,i]=h.useState([]),t=h.useRef(null),a=h.useRef([]);return h.useEffect(()=>{const r=e.recentReactions;
26if(!t.current){t.current=new Set(r.map(c=>c.id));return}const o=t.current,l=r.filter(c=>!o.has(c.id));if(r.forEach(c=>o.add(c.id)),!l.length)return;const v=l.slice(-6).map(c=>{var d;return{id:`${c.id}-${Math.random().toString(36).slice(2,6)}`,key:((d=Ke(c.emoji))==null?void 0:d.key)||null,emoji:c.emoji,left:Math.round(Math.random()*44),drift:Math.round(Math.random()*30-15)}});i(c=>[...c,...v].slice(-12)),v.forEach(c=>{const d=window.setTimeout(()=>i(u=>u.filter(m=>m.id!==c.id)),2800);a.current.push(d)})},[e.recentReactions]),h.useEffect(()=>()=>a.current.forEach(r=>window.clearTimeout(r)),[]),s.jsx("div",{className:"sn-vw-floating","aria-hidden":"true",children:n.map(r=>s.jsx("span",{className:N("sn-vw-float",r.key&&`is-${r.key}`),style:{right:12+r.left,"--sn-vw-drift":`${r.drift}px`},children:r.key?s.jsx(fs,{reactionKey:r.key,className:"sn-i-20"}):s.jsx("span",{className:"sn-vw-float-emoji",children:r.emoji})},r.id))})}const ns={auto:"Авто",high:"Высокое",medium:"Среднее",low:"Низкое"};function Fs(e){const n=(i,t,a)=>({label:t,description:a,checked:e.playback.quality===i,onSelect:()=>e.setPlaybackQuality(i)});return[n("auto","Авто","по скорости интернета"),n("high","Высокое"),n("medium","Среднее"),n("low","Низкое","экономит трафик")]}function it(){const[e,n]=h.useState(!1);return h.useEffect(()=>{const t=()=>{document.fullscreenElement||n(!1)};return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),h.useEffect(()=>{if(!e)return;const t=a=>{a.key==="Escape"&&!document.querySelector(".sn-popover, .sn-overlay")&&n(!1)};return document.addEventListener("keydown",t),document.documentElement.classList.add("sn-vw-noscroll"),()=>{document.removeEventListener("keydown",t),document.documentElement.classList.remove("sn-vw-noscroll")}},[e]),{full:e,toggle:()=>{if(e){n(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>{});return}n(!0);const t=document.documentElement;typeof t.requestFullscreen=="function"&&document.fullscreenEnabled!==!1&&t.requestFullscreen().catch(()=>{})}}}function rt(){document.querySelectorAll("audio, video").forEach(e=>{e.paused&&e.srcObject&&e.play().catch(()=>{})})}function ot({poll:e,standings:n}){var o;const i=ee(l=>l.timerRemaining.get(e.id)),t=typeof i=="number"?i:((o=e.timer)==null?void 0:o.remainingSeconds)??null,a=(n==null?void 0:n.currentPollId)===e.id?n.questionIndex:null,r=(n==null?void 0:n.questionCount)||null;return s.jsxs("div",{className:"sn-vw-quizhint",role:"status",children:[s.jsx("span",{className:"sn-vw-quizhint-ico",children:s.jsx(hn,{className:"sn-i sn-i-16"})}),s.jsxs("b",{children:["Идёт викторина — ",s.jsx("span",{className:"sn-vw-hide-sm",children:"отвечайте справа"}),s.jsx("span",{className:"sn-vw-only-sm",children:"отвечайте ниже"})]}),s.jsx("span",{className:"sn-st-grow"}),s.jsxs("span",{className:"sn-vw-quizhint-meta",children:[a&&r?`Вопрос ${a} из ${r}`:"Вопрос",typeof t=="number"&&t>=0&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"sn-mono",children:`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`})]})]})]})}function ct({api:e,phone:n,captionPrefs:i,onCaptionPrefs:t,poll:a,standings:r}){const{full:o,toggle:l}=it(),v=H(),c=H(),{volume:d,muted:u}=e.playback,m=u||d===0,w=e.aspect==="9:16",f=a&&a.mode==="quiz"&&a.status==="live"?a:null,p=!n||o;h.useEffect(()=>{e.aspect!=="16:9"&&e.setAspect("16:9")},[e.aspect]);const x=()=>{m&&d===0?e.setPlaybackVolume(60):e.setPlaybackMuted(!m)};h.useEffect(()=>{const b=y=>{const A=y.target;if(y.defaultPrevented||y.ctrlKey||y.metaKey||y.altKey||A&&(A.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(A.tagName))||document.querySelector(".sn-overlay"))return;const k=y.key.toLowerCase();k==="m"||k==="ь"?x():(k==="f"||k==="а")&&l()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)});const j=m?s.jsx(As,{className:"sn-i"}):d<50?s.jsx(Tn,{className:"sn-i"}):s.jsx(xe,{className:"sn-i"}),g=i.lang!=="off";return s.jsxs("section",{className:N("sn-vw-player",n&&"is-phone",o&&"is-full"),"aria-label":"Плеер",children:[s.jsxs("div",{className:N("sn-vw-frame",f&&!n&&"has-hint"),children:[s.jsxs("div",{className:N("sn-vw-screen",w&&"is-vertical"),children:[e.renderProgramStage(),s.jsx(Jn,{api:e,prefs:i}),s.jsx(at,{api:e}),s.jsx(he,{api:e,compact:n}),n&&s.jsxs(s.Fragment,{children:[e.broadcast.isLive&&s.jsx(ws,{startedAt:e.broadcast.startedAt,compact:!0,className:"sn-vw-screen-live"}),s.jsxs("div",{className:"sn-vw-screen-tools",children:[s.jsx(E,{label:m?"Включить звук":"Выключить звук",variant:"dark",onClick:x,className:"sn-vw-screen-btn",children:j}),s.jsx(E,{label:o?"Выйти из полноэкранного режима":"Ð
26’о весь экран",variant:"dark",onClick:l,className:"sn-vw-screen-btn",children:o?s.jsx(Ms,{className:"sn-i"}):s.jsx(Ss,{className:"sn-i"})})]})]})]}),f&&!n&&s.jsx(ot,{poll:f,standings:r})]}),p&&s.jsxs("div",{className:"sn-vw-bar",children:[s.jsx(E,{label:m?"Включить звук":"Выключить звук",size:"sm",onClick:x,children:j}),s.jsx("input",{type:"range",className:"sn-vw-range",min:0,max:100,step:5,value:m?0:d,"aria-label":"Громкость","aria-valuetext":`${m?0:d}%`,style:{"--sn-vw-fill":`${m?0:d}%`},onChange:b=>e.setPlaybackVolume(Number(b.target.value))}),s.jsxs("button",{type:"button",className:N("sn-vw-livebtn",!e.broadcast.isLive&&"is-off"),onClick:rt,title:"Вернуться к прямому эфиру",children:[s.jsx("i",{"aria-hidden":"true"}),e.broadcast.isLive?"Прямой эфир":"Эфир не идёт"]}),s.jsx("span",{className:"sn-st-grow"}),s.jsx(E,{label:"Субтитры и перевод",size:"sm",variant:g||v.open?"active":"ghost",onClick:v.toggle,"aria-expanded":v.open,"aria-haspopup":"dialog",children:s.jsx(es,{className:"sn-i"})}),s.jsx("span",{className:"sn-vw-bar-sep","aria-hidden":"true"}),s.jsxs("button",{type:"button",className:"sn-btn sn-btn-sm sn-btn-text sn-vw-quality",onClick:c.toggle,"aria-expanded":c.open,"aria-haspopup":"menu","aria-label":`Качество видео: ${ns[e.playback.quality].toLowerCase()}`,children:[s.jsx("span",{className:"sn-vw-hide-sm",children:"Качество"}),s.jsx("b",{children:ns[e.playback.quality]}),s.jsx(fe,{className:"sn-i sn-i-16"})]}),s.jsx(E,{label:o?"Выйти из полноэкранного режима":"Во весь экран",size:"sm",onClick:l,children:o?s.jsx(Ms,{className:"sn-i"}):s.jsx(Ss,{className:"sn-i"})}),s.jsx(ls,{open:v.open,onClose:v.close,anchor:v.anchor,prefs:i,onChange:t,active:e.captions.active,translationAllowed:e.viewerTranslation,onAir:e.captionsOnAir}),s.jsx(cs,{open:c.open,onClose:c.close,anchor:c.anchor,items:Fs(e),placement:"top-end",width:250,header:s.jsx("div",{className:"sn-menu-label",children:"Качество видео"})})]})]})}const ye={L:0,M:1,Q:2,H:3},lt={L:1,M:0,Q:3,H:2},ke=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ce=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],dt=3,mt=3,Gs=40,ut=10;function Ee(e){let n=(16*e+128)*e+64;if(e>=2){const i=Math.floor(e/7)+2;n-=(25*i-10)*i-55,e>=7&&(n-=36)}return n}function ht(e,n){const i=ye[n];return Math.floor(Ee(e)/8)-ke[i][e]*Ce[i][e]}function Ls(e,n){let i=0;for(let t=7;t>=0;t--)i=i<<1^(i>>>7)*285,i^=(n>>>t&1)*e;return i&255}function ft(e){const n=new Array(e).fill(0);n[e-1]=1;let i=1;for(let t=0;t<e;t++){for(let a=0;a<n.length;a++)n[a]=Ls(n[a],i),a+1<n.length&&(n[a]^=n[a+1]);i=Ls(i,2)}return n}function xt(e,n){const i=n.map(()=>0);for(const t of e){const a=t^i.shift();i.push(0),n.forEach((r,o)=>{i[o]^=Ls(r,a)})}return i}function vt(e){return Array.from(new TextEncoder().encode(e))}function D(e,n,i){for(let t=n-1;t>=0;t--)i.push(e>>>t&1)}function jt(e,n,i){const t=ye[i],a=Ce[t][n],r=ke[t][n],o=Math.floor(Ee(n)/8),l=a-o%a,v=Math.floor(o/a),c=[],d=ft(r);for(let m=0,w=0;m<a;m++){const f=e.slice(w,w+v-r+(m<l?0:1));w+=f.length;const p=xt(f,d);m<l&&f.push(0),c.push(f.concat(p))}const u=[];for(let m=0;m<c[0].length;m++)c.forEach((w,f)=>{(m!==v-r||f>=l)&&u.push(w[m])});return u}function pt(e){if(e===1)return[];const n=Math.floor(e/7)+2,i=e===32?26:Math.ceil((e*4+4)/(n*2-2))*2,t=[6];for(let a=e*4+10;t.length<n;a-=i)t.splice(1,0,a);return t}function wt(e,n,i){switch(e){case 0:return(n+i)%2===0;case 1:return i%2===0;case 2:return n%3===0;case 3:return(n+i)%3===0;case 4:return(Math.floor(n/3)+Math.floor(i/2))%2===0;case 5:return n*i%2+n*i%3===0;case 6:return(n*i%2+n*i%3)%2===0;case 7:return((n+i)%2+n*i%3)%2===0;default:throw new Error("mask")}}function bt(e,n){const i=lt[e]<<3|n;let t=i;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;return(i<<10|t)^21522}class Nt{constructor(n,i){this.version=n,this.ecc=i,this.size=n*4+17,this.modules=Array.from({length:this.size},()=>new Array(this.size).fill(!1)),this.isFunction=Array.from({length:this.size},()=>new Array(this.size).fill(!1))}setFunction(n,i,t){this.modules[i][n]=t,this.isFunction[i][n]=!0}drawFunctionPatterns(){const{size:n}=this;for(let a=0;a<n;a++)this.setFunction(6,a,a%2===0),this.setFunction(a,6,a%2===0);this.drawFinder(3,3),this.drawFinder(n-4,3),this.drawFinder(3,n-4);const i=pt(this.version),t=i.length;for(let a=0;a<t;a++)for(let r=0;r<t;r++)a===0&&r===0||a===0&&r===t-1||a===t-1&&r===0||this.drawAlignment(i[a],i[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(n){const i=bt(this.ecc,n),t=r=>(i>>>r&1)!==0,{size:a}=this;for(let r=0;r<=5;r++)this.setFunction(8,r,t(r));this.setFunction(8,7,t(6)),this.setFunction(8,8,t(7)),this.setFunction(7,8,t(8));for(let r=9;r<15;r++)this.setFunction(14-r,8,t(r));for(let r=0;r<8;r++)this.setFunction(a-1-r,8,t(r));for(let r=8;r<15;r++)this.setFunction(8,a-15+r,t(r));this.setFunction(8,a-8,!0)}drawVersion(){if(this.version<7)return;let n=this.version;for(let t=0;t<12;t++)n=n<<1^(n>>>11)*7973;const i=this.version<<12|n;for(let t=0;t<18;t++){const a=(i>>>t&1)!==0,r=this.size-11+t%3,o=Math.floor(t/3);this.setFunction(r,o,a),this.setFunction(o,r,a)}}drawFinder(n,i){for(let t=-4;t<=4;t++)for(let a=-4;a<=4;a++){const r=Math.max(Math.abs(a),Math.abs(t)),o=n+a,l=i+t;o>=0&&o<this.size&&l>=0&&l<this.size&&this.setFunction(o,l,r!==2&&r!==4)}}drawAlignment(n,i){for(let t=-2;t<=2;t++)for(let a=-2;a<=2;a++)this.setFunction(n+a,i+t,Math.max(Math.abs(a),Math.abs(t))!==1)}drawCodewords(n){let i=0;const{size:t}=this;for(let a=t-1;a>=1;a-=2){a===6&&(a=5);for(let r=0;r<t;r++)for(let o=0;o<2;o++){const l=a-o,c=(a+1&2)===0?t-1-r:r;!this.isFunction[c][l]&&i<n.length*8&&(this.modules[c][l]=(n[i>>>3]>>>7-(i&7)&1)!==0,i++)}}}applyMask(n){for(let i=0;i<this.size;i++)for(let t=0;t<this.size;t++)!this.isFunction[i][t]&&wt(n,t,i)&&(this.modules[i][t]=!this.modules[i][t])}penalty(){const{size:n,modules:i}=this;let t=0;const a=d=>{const u=d[1],m=u>0&&d[2]===u&&d[3]===u*3&&d[4]===u&&d[5]===u;return(m&&d[0]>=u*4&&d[6]>=u?1:0)+(m&&d[6]>=u*4&&d[0]>=u?1:0)},r=(d,u)=>{u[0]===0&&(d+=n),u.pop(),u.unshift(d)},o=(d,u,m)=>(d&&(r(u,m),u=0),u+=n,r(u,m),a(m));for(let d=0;d<2;d++)for(let u=0;u<n;u++){let m=!1,w=0;const f=[0,0,0,0,0,0,0];for(let p=0;p<n;p++){const x=d===0?i[u][p]:i[p][u];x===m?(w++,w===5?t+=dt:w>5&&t++):(r(w,f),m||(t+=a(f)*Gs),m=x,w=1)}t+=o(m,w,f)*Gs}for(let d=0;d<n-1;d++)for(let u=0;u<n-1;u++){const m=i[d][u];m===i[d][u+1]&&m===i[d+1][u]&&m===i[d+1][u+1]&&(t+=mt)}let l=0;for(const d of i)for(const u of d)u&&l++;const v=n*n,c=Math.ceil(Math.abs(l*20-v*10)/v)-1;return t+=c*ut,t}}function gt(e,n="M"){const i=vt(e);let t=1,a=0;for(;;t++){if(t>40)throw new Error("Слишком длинный текст для QR-кода");if(a=ht(t,n)*8,4+(t<=9?8:16)+i.length*8<=a)break}const r=[];
26D(4,4,r),D(i.length,t<=9?8:16,r),i.forEach(d=>D(d,8,r)),D(0,Math.min(4,a-r.length),r),D(0,(8-r.length%8)%8,r);for(let d=236;r.length<a;d^=253)D(d,8,r);const o=new Array(r.length/8).fill(0);r.forEach((d,u)=>{o[u>>>3]|=d<<7-(u&7)});const l=new Nt(t,n);l.drawFunctionPatterns(),l.drawCodewords(jt(o,t,n));let v=0,c=1/0;for(let d=0;d<8;d++){l.applyMask(d),l.drawFormatBits(d);const u=l.penalty();u<c&&(v=d,c=u),l.applyMask(d)}return l.applyMask(v),l.drawFormatBits(v),{version:t,size:l.size,mask:v,modules:l.modules}}function yt(e,n=0){const i=[];return e.modules.forEach((t,a)=>{t.forEach((r,o)=>{r&&i.push(`M${o+n},${a+n}h1v1h-1z`)})}),i.join("")}function kt(e,n){return Os((e==null?void 0:e.slug)||n)}function Ct({text:e}){const n=h.useMemo(()=>{try{return gt(e,"M")}catch{return null}},[e]);if(!n)return null;const i=2,t=n.size+i*2;return s.jsxs("svg",{className:"sn-vw-qr",viewBox:`0 0 ${t} ${t}`,role:"img","aria-label":"QR-код ссылки на эфир",shapeRendering:"crispEdges",children:[s.jsx("rect",{width:t,height:t,fill:"#fff"}),s.jsx("path",{d:yt(n,i),fill:"#141619"})]})}function Et({open:e,onClose:n,event:i,roomId:t,title:a,liveSeconds:r,isLive:o}){const[l,v]=Ks(),[c,d]=Ks(),[u,m]=h.useState(!1),[w,f]=h.useState(null),p=kt(i,t),x=u?w:null,j=x!==null?`${p}/recording?t=${x}s`:p,g=j.replace(/^https?:\/\//,""),b=`${a}${o?" — смотрите эфир":""}`,y=`https://t.me/share/url?url=${encodeURIComponent(j)}&text=${encodeURIComponent(b)}`,A=`https://vk.com/share.php?url=${encodeURIComponent(j)}&title=${encodeURIComponent(a)}`,k=`mailto:?subject=${encodeURIComponent(a)}&body=${encodeURIComponent(`${b}
27${j}`)}`;return s.jsx(xs,{open:e,onClose:n,width:560,icon:s.jsx(Rs,{className:"sn-i sn-i-24"}),iconTone:"blue",title:"Поделиться эфиром",subtitle:`${a}${o?" · идёт сейчас":""}`,children:s.jsxs("div",{className:"sn-vw-share",children:[s.jsx("label",{className:"sn-label",htmlFor:"sn-vw-share-link",children:"Ссылка на эфир"}),s.jsxs("div",{className:"sn-vw-share-row",children:[s.jsx("input",{id:"sn-vw-share-link",className:"sn-input sn-mono",readOnly:!0,value:g,onFocus:C=>C.currentTarget.select()}),s.jsx(S,{variant:"primary",icon:v?s.jsx(ms,{className:"sn-i sn-i-16"}):s.jsx(jn,{className:"sn-i sn-i-16"}),onClick:()=>void l(j,"Ссылка скопирована"),children:v?"Скопировано":"Копировать"})]}),r!==null&&s.jsx(Re,{checked:u,onChange:C=>{m(C),f(C?Math.max(0,Math.floor(r)):null)},label:s.jsxs(s.Fragment,{children:["Со временем ",s.jsx("b",{className:"sn-mono",children:se(x??r)})," — откроется на этом моменте в записи"]}),className:"sn-vw-share-time",style:{marginTop:12}}),s.jsx("div",{className:"sn-vw-share-sep"}),s.jsxs("div",{className:"sn-vw-share-grid",children:[s.jsxs("figure",{className:"sn-vw-share-qr",children:[s.jsx("div",{className:"sn-vw-share-qrbox",children:s.jsx(Ct,{text:j})}),s.jsx("figcaption",{children:"Наведите камеру телефона"})]}),s.jsxs("div",{className:"sn-vw-share-send",children:[s.jsx("span",{className:"sn-label",children:"Отправить"}),s.jsxs("a",{className:"sn-btn sn-btn-quiet sn-vw-share-btn",href:y,target:"_blank",rel:"noopener noreferrer",children:[s.jsx("span",{className:"sn-vw-share-ico",children:"TG"}),s.jsxs("span",{children:[s.jsx("b",{children:"Telegram"}),s.jsx("small",{children:"в чат или канал"})]})]}),s.jsxs("a",{className:"sn-btn sn-btn-quiet sn-vw-share-btn",href:A,target:"_blank",rel:"noopener noreferrer",children:[s.jsx("span",{className:"sn-vw-share-ico",children:"VK"}),s.jsxs("span",{children:[s.jsx("b",{children:"VK"}),s.jsx("small",{children:"на стену или в сообщения"})]})]}),s.jsxs("a",{className:"sn-btn sn-btn-quiet sn-vw-share-btn",href:k,children:[s.jsx("span",{className:"sn-vw-share-ico",children:s.jsx(pn,{className:"sn-i sn-i-16"})}),s.jsxs("span",{children:[s.jsx("b",{children:"Email"}),s.jsx("small",{children:"письмо с приглашением"})]})]}),s.jsxs("button",{type:"button",className:"sn-btn sn-btn-quiet sn-vw-share-btn",onClick:()=>void c(fn(t,a),"Код плеера скопирован — вставьте его в HTML сайта"),"data-testid":"share-embed",children:[s.jsx("span",{className:"sn-vw-share-ico",children:d?s.jsx(ms,{className:"sn-i sn-i-16"}):s.jsx(xn,{className:"sn-i sn-i-16"})}),s.jsxs("span",{children:[s.jsx("b",{children:d?"Код скопирован":"На сайт"}),s.jsx("small",{children:"код плеера для вставки"})]})]})]})]})]})})}function Mt(e){const[n,i]=h.useState(null);return h.useEffect(()=>{if(!e)return;let t=!1,a=null;const r=()=>{a==null||a.abort(),a=new AbortController,wn.get(e,a.signal).then(l=>{!t&&l&&typeof l=="object"&&i(l)}).catch(()=>{})};r();const o=window.setInterval(r,5*6e4);return()=>{t=!0,a==null||a.abort(),window.clearInterval(o)}},[e]),n}function St({api:e,slug:n}){const i=G(1e3),[t,a]=h.useState(!1),[r,o]=h.useState(!1),{volume:l,muted:v}=e.playback,c=v||l===0||r,d=Os(n);h.useEffect(()=>{e.aspect!=="16:9"&&e.setAspect("16:9")},[e.aspect]),h.useEffect(()=>{if(!e.broadcast.isLive)return;const f=()=>{const x=[...document.querySelectorAll("audio, video")].filter(j=>j.srcObject);o(x.some(j=>j.paused&&j.tagName==="AUDIO"))},p=window.setInterval(f,1500);return f(),()=>window.clearInterval(p)},[e.broadcast.isLive]),h.useEffect(()=>{const f=()=>a(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",f),()=>document.removeEventListener("fullscreenchange",f)},[]);const u=()=>{document.querySelectorAll("audio, video").forEach(f=>{f.paused&&f.srcObject&&f.play().catch(()=>{})})},m=()=>{if(r){u(),o(!1),v&&e.setPlaybackMuted(!1),l===0&&e.setPlaybackVolume(80);return}c&&l===0?e.setPlaybackVolume(80):e.setPlaybackMuted(!c)},w=()=>{var f,p;document.fullscreenElement?document.exitFullscreen().catch(()=>{}):(p=(f=document.documentElement).requestFullscreen)==null||p.call(f).catch(()=>{})};if(!e.broadcast.isLive){const f=e.room.scheduledAt?new Date(e.room.scheduledAt).getTime():null,p=f?Math.max(0,Math.floor((f-i)/1e3)):0;return s.jsxs("div",{className:"sn sn-emb is-soon","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"soon","data-embed":"",children:[s.jsxs("div",{className:"sn-emb-poster",children:[s.jsxs("span",{className:"sn-emb-soon",children:["Скоро начнётся",f?s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"sn-mono",children:qs(f)})]}):null]}),s.jsx("h1",{className:"sn-emb-title",children:e.room.title}),s.jsx("p",{className:"sn-emb-timer",role:"timer",children:p>0?s.jsxs(s.Fragment,{children:["Эфир начнётся через ",s.jsx("b",{className:"sn-mono",children:W(p)})]}):"Ведущий вот-вот начнёт — плеер включится сам"})]}),s.jsxs("a",{className:"sn-emb-brand",href:d,target:"_blank",rel:"noopener noreferrer",children:["Открыть на SNICH ",s.jsx(Qs,{className:"sn-i sn-i-14","aria-hidden":"true"})]})]})}return s.jsxs("div",{className:N("sn sn-emb",t&&"is-full"),"data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"live","data-embed":"",children:[s.jsxs("div",{className:"sn-emb-screen",children:[e.renderProgramStage(),s.jsx(he,{api:e,compact:!0})]}),r&&s.jsxs("button",{type:"button",className:"sn-emb-unmute",onClick:m,children:[s.jsx(As,{className:"sn-i sn-i-20","aria-hidden":"true"}),"Включить звук"]}),s.jsx("div",{className:"sn-emb-top",children:s.jsx(ws,{startedAt:e.broadcast.startedAt,compact:!0})}),s.jsxs("div",{className:"sn-emb-bar",children:[s.jsx(E,{label:c?"Включить звук":"Выключить звук",variant:"dark",size:"sm",onClick:m,children:c?s.jsx(As,{className:"sn-i"}):s.jsx(xe,{className:"sn-i"})}),s.jsx("span",{className:"sn-emb-title-sm sn-ellipsis",children:e.room.title}),s.jsxs("a",{className:"sn-emb-brand is-inline",href:d,target:"_blank",rel:"noopener noreferrer",title:"Чат, вопросы и запись — на странице эфира",children:["SNICH ",s.jsx(Qs,{className:"sn-i sn-i-14","aria-hidden":"true"})]}),s.jsx(E,{label:t?"Выйти из полноэкранного режима":"Ð
27’о весь экран",variant:"dark",size:"sm",onClick:w,children:t?s.jsx(Ms,{className:"sn-i"}):s.jsx(Ss,{className:"sn-i"})})]})]})}const At={off:"Выкл",ru:"Русский",en:"English",zh:"中文"};function Xs({raised:e,onOpen:n,onCancel:i,phone:t,off:a}){return a&&!e?t?null:s.jsx(me,{icon:s.jsx(Y,{className:"sn-i sn-i-16"}),testId:"viewer-hand-off",children:ue.raiseHand}):e?s.jsxs("span",{className:N("sn-vw-handsent",t&&"is-phone"),role:"status",children:[s.jsx(ps,{className:"sn-i sn-i-16","aria-hidden":"true"}),s.jsx("span",{children:"Заявка отправлена"}),s.jsx("span",{"aria-hidden":"true",children:"·"}),s.jsx("button",{type:"button",onClick:i,children:"Отменить"})]}):s.jsx(S,{variant:"quiet",icon:s.jsx(Y,{className:"sn-i sn-i-20"}),onClick:n,className:N("sn-vw-handbtn",t&&"is-phone"),children:"Попроситься на сцену"})}function Rt(e,n){const{qna:i}=F(),t=ze(),a=ee(p=>p.myVotes),r=h.useMemo(()=>Ye(i.questions),[i.questions]),o=e.roomFeatures,l=o?o.chat||e.chat.some(p=>p.visibility==="public"):(n==null?void 0:n.features.chat)!==!1,v=(o?o.questions:(n==null?void 0:n.features.questions)!==!1)||r.length>0,c=[];l&&c.push("chat"),v&&c.push("questions"),t&&!as(e,"polls")&&c.push("poll");const[d,u]=h.useState(l?"chat":"questions"),m=c.includes(d)?d:c[0]||null,w=h.useRef(null);h.useEffect(()=>{if(!t||t.status!=="live"||w.current===t.id)return;const p=w.current===null&&a.has(t.id);w.current=t.id;const x=document.activeElement instanceof HTMLElement&&/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName);!p&&!x&&u("poll")},[t==null?void 0:t.id,t==null?void 0:t.status]);const f=!!t&&t.status==="live"&&!a.has(t.id);return{tabs:c,tab:m,setTab:u,poll:t,questionsCount:r.length,pollPending:f}}function Pt({tabs:e,tab:n,setTab:i,questionsCount:t,pollLabel:a,pollPending:r,phone:o}){return e.length<2?null:s.jsx("nav",{className:N("sn-vw-tabs",o&&"is-phone"),"aria-label":"Разделы",children:e.map(l=>s.jsxs("button",{type:"button",className:N("sn-vw-tab",n===l&&"is-on"),"aria-current":n===l?"page":void 0,onClick:()=>i(l),children:[l==="chat"&&"Чат",l==="questions"&&s.jsxs(s.Fragment,{children:["Вопросы",t>0&&s.jsx("span",{className:"sn-vw-tab-count sn-mono",children:t})]}),l==="poll"&&s.jsxs(s.Fragment,{children:[a,r&&s.jsx("i",{className:"sn-vw-tab-dot","aria-hidden":"true"}),r&&s.jsx("span",{className:"sn-sr",children:" идёт сейчас"})]})]},l))})}function Tt({api:e,tab:n,phone:i,poll:t,standings:a}){return n==="chat"?s.jsx(Xe,{api:e,phone:i}):n==="questions"?s.jsx(Ze,{api:e,phone:i}):n==="poll"?s.jsx(Ie,{api:e,poll:t,standings:a}):s.jsxs("div",{className:"sn-vw-empty",children:[s.jsx("b",{children:"Чат и вопросы в этом эфире выключены"}),s.jsx("span",{children:as(e,"reactions")?"Организатор оставил только просмотр":"Смотрите эфир — реакции по-прежнему работают"})]})}function Ft({api:e,event:n,now:i}){const t=ae(e,n,i),a=[];return t.host&&a.push(s.jsxs("span",{className:"sn-vw-byline-item",children:[s.jsx(K,{name:t.host.name,src:ts(t.host.avatarUrl),size:24}),s.jsx("span",{className:"sn-vw-faint",children:"Ведёт"}),s.jsx("b",{children:t.host.name})]},"host")),t.current&&a.push(s.jsxs("span",{className:"sn-vw-byline-item",children:[s.jsx(Js,{tone:"green",children:"Сейчас"}),s.jsxs("span",{className:"sn-ellipsis",children:[t.current.title,t.current.who&&s.jsxs("span",{className:"sn-vw-faint",children:[" · ",t.current.who]})]})]},"now")),t.next&&a.push(s.jsxs("span",{className:"sn-vw-byline-item",children:[s.jsx(ps,{className:"sn-i sn-i-16 sn-vw-faint","aria-hidden":"true"}),s.jsxs("span",{className:"sn-ellipsis",children:[t.next.startsAt?s.jsxs(s.Fragment,{children:["Далее в ",s.jsx("b",{className:"sn-mono",children:We(t.next.startsAt)})]}):"Далее",s.jsxs("span",{className:"sn-vw-faint",children:[" — ",t.next.title]})]})]},"next")),a.length?s.jsx("p",{className:"sn-vw-byline",children:a.map((r,o)=>s.jsxs(Me.Fragment,{children:[o===1&&t.host&&s.jsx("span",{className:"sn-vw-dot","aria-hidden":"true",children:"•"}),r]},o))}):null}function Lt({api:e,event:n,onShare:i}){const t=G(1e3),a=e.room.scheduledAt?new Date(e.room.scheduledAt).getTime():null,r=a?Math.max(0,Math.floor((a-t)/1e3)):0;return s.jsxs("div",{className:"sn sn-vw sn-vw-prelive","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"soon",children:[s.jsx(Bs,{api:e,event:n}),s.jsx("main",{className:"sn-vw-prelive-main",children:s.jsxs("div",{className:"sn-vw-prelive-card",children:[s.jsxs(Js,{tone:"amber",size:"lg",icon:s.jsx(ps,{className:"sn-i sn-i-14"}),children:["Скоро начнётся",a?s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"sn-mono",children:qs(a)})]}):null]}),s.jsx("h1",{children:e.room.title}),s.jsx("div",{role:"timer",className:"sn-vw-prelive-timer","aria-label":r>0?`Эфир начнётся через ${W(r)}`:"Ведущий вот-вот начнёт",children:r>0?s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Эфир начнётся через"}),s.jsx("b",{className:"sn-mono",children:W(r)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Ведущий вот-вот начнёт"}),s.jsx("span",{className:"sn-spinner","aria-hidden":"true"})]})}),s.jsx("p",{className:"sn-hint",children:"Страница обновится сама, как только начнётся эфир. Камера и микрофон не нужны."}),s.jsx(S,{variant:"quiet",icon:s.jsx(gn,{className:"sn-i sn-i-16"}),onClick:i,children:"Поделиться"})]})})]})}function ar({api:e}
27){const{invites:n}=F(),i=V(),t=Qe(Ge),a=Mt(e.room.id),r=G(1e3),[o,l]=Gn(),{tabs:v,tab:c,setTab:d,poll:u,questionsCount:m,pollPending:w}=Rt(e,a);$e(e,!!u);const f=qe(e,!!u&&u.mode==="quiz"),[p,x]=h.useState(!1),[j,g]=h.useState(!1),[b,y]=h.useState(!1),[A,k]=h.useState(!1),C=H(),L=H(),I=H(),X=h.useRef(null),[Z,P]=h.useState(null);h.useEffect(()=>{e.stageAccess.isStageGuest&&(x(!1),y(!1))},[e.stageAccess.isStageGuest]);const O=async()=>{const R=await n.lowerOwnHand();if(!R.ok){i.error(R.error||"Не удалось отменить заявку");return}x(!1),y(!1),i.show("Заявка отменена")},T=Fn(e,r),B=(a==null?void 0:a.title)||e.room.title,$=e.viewerCount,os=(u==null?void 0:u.mode)==="quiz"?"Викторина":"Опрос",_=s.jsxs(s.Fragment,{children:[s.jsx(Bn,{open:j,onClose:()=>g(!1),api:e,onSent:()=>{x(!0),y(!0)}}),s.jsx(_n,{api:e,onAccepted:()=>{x(!1),y(!1)},onDeclined:()=>x(!1)}),s.jsx(Un,{onHandCleared:()=>{x(!1),y(!1)}}),s.jsx(Et,{open:A,onClose:()=>k(!1),event:a,roomId:e.room.id,title:B,liveSeconds:T,isLive:e.broadcast.isLive}),b&&p&&s.jsx(Vn,{onClose:()=>y(!1)})]});if(vn()){const R=decodeURIComponent(window.location.pathname.split("/")[2]||"")||e.room.id;return s.jsx(St,{api:e,slug:R})}if(e.stageAccess.isStageGuest)return s.jsxs("div",{className:"sn","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"backstage",children:[s.jsx(Yn,{api:e,event:a}),_]});const q=s.jsx(Pt,{tabs:v,tab:c,setTab:d,questionsCount:m,pollLabel:os,pollPending:w,phone:t}),z=s.jsx(Tt,{api:e,tab:c,phone:t,poll:u,standings:f});if(!e.broadcast.isLive){const R=v.length?s.jsxs(s.Fragment,{children:[q,s.jsx("div",{className:"sn-vw-panel",children:z})]}):void 0,ss=s.jsxs(s.Fragment,{children:[s.jsx(E,{label:"Субтитры и перевод",size:"sm",variant:o.lang!=="off"||C.open?"active":"ghost",onClick:C.toggle,"aria-expanded":C.open,"aria-haspopup":"dialog",children:s.jsx(es,{className:"sn-i"})}),s.jsx("span",{className:"sn-vw-bar-sep","aria-hidden":"true"}),s.jsxs("button",{type:"button",className:"sn-btn sn-btn-sm sn-btn-text sn-vw-quality",onClick:L.toggle,"aria-expanded":L.open,"aria-haspopup":"menu","aria-label":`Качество видео: ${ns[e.playback.quality].toLowerCase()}`,children:[s.jsx("span",{className:"sn-vw-hide-sm",children:"Качество"}),s.jsx("b",{children:ns[e.playback.quality]}),s.jsx(fe,{className:"sn-i sn-i-16"})]}),s.jsx(ls,{open:C.open,onClose:C.close,anchor:C.anchor,prefs:o,onChange:l,active:e.captions.active,translationAllowed:e.viewerTranslation,onAir:e.captionsOnAir}),s.jsx(cs,{open:L.open,onClose:L.close,anchor:L.anchor,items:Fs(e),placement:"top-end",width:250,header:s.jsx("div",{className:"sn-menu-label",children:"Качество видео"})})]});return s.jsxs(s.Fragment,{children:[a?s.jsx("div",{className:"sn sn-vw-soon","data-sn-own-audio":"","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"soon",children:s.jsx(Pe,{event:a,now:r,logo:s.jsx(Te,{href:ds(zs(e)?Q.viewerHome():Q.home())}),viewer:s.jsxs(s.Fragment,{children:[s.jsx(Fe,{name:e.me.name||"Гость",avatarUrl:ts(e.me.avatarUrl),subtitle:"Вы слушатель"}),s.jsx(S,{variant:"text",size:"sm",icon:s.jsx(Es,{className:"sn-i sn-i-16"}),onClick:()=>Ps(e,a),className:"sn-vw-soon-exit",children:s.jsx("span",{className:"sn-vw-hide-sm",children:"Выйти"})})]}),onShare:()=>k(!0),checkHref:`/check?room=${encodeURIComponent(e.room.id)}`,aside:R,playerControls:ss})}):s.jsx(Lt,{api:e,event:a,onShare:()=>k(!0)}),s.jsx("div",{className:"sn",children:_})]})}const J=s.jsx(ct,{api:e,phone:t,captionPrefs:o,onCaptionPrefs:l,poll:u,standings:f});if(t){const R=[{label:"Субтитры и перевод",icon:s.jsx(es,{className:"sn-i sn-i-16"}),hint:At[o.lang],onSelect:()=>P("cc")},{label:"Качество видео",icon:s.jsx(bn,{className:"sn-i sn-i-16"}),hint:ns[e.playback.quality],onSelect:()=>P("quality")}
27,{type:"separator"},{label:"Выйти",icon:s.jsx(Es,{className:"sn-i sn-i-16"}),onSelect:()=>Ps(e,a)}];return s.jsxs("div",{className:"sn sn-vw is-phone","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"live",children:[J,s.jsxs("div",{className:"sn-vw-pinfo",children:[s.jsxs("div",{style:{minWidth:0,flex:1},children:[s.jsx("h1",{className:"sn-ellipsis",children:B}),s.jsxs("p",{className:"sn-vw-pmeta",children:[typeof $=="number"&&$>0&&s.jsxs(s.Fragment,{children:[s.jsx(ie,{className:"sn-i sn-i-14","aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("span",{className:"sn-mono",children:$s($)})," ",Cs($,"зритель","зрителя","зрителей")]}),s.jsx("span",{"aria-hidden":"true",children:"•"})]}),T!==null&&s.jsx("span",{className:"sn-mono",children:W(T)})]})]}),s.jsx(E,{label:"Поделиться",variant:"quiet",onClick:()=>k(!0),children:s.jsx(Rs,{className:"sn-i"})}),s.jsx(E,{ref:X,label:"Ещё",variant:"quiet",onClick:ss=>{P(null),I.toggle(ss)},"aria-expanded":I.open,"aria-haspopup":"menu",children:s.jsx(Nn,{className:"sn-i"})}),s.jsx(cs,{open:I.open,onClose:I.close,anchor:I.anchor,items:R,placement:"bottom-end",width:260}),s.jsx(ls,{open:Z==="cc",onClose:()=>P(null),anchor:X.current,prefs:o,onChange:l,active:e.captions.active,translationAllowed:e.viewerTranslation,onAir:e.captionsOnAir}),s.jsx(cs,{open:Z==="quality",onClose:()=>P(null),anchor:X.current,items:Fs(e),placement:"bottom-end",width:250,header:s.jsx("div",{className:"sn-menu-label",children:"Качество видео"})})]}),s.jsxs("div",{className:"sn-vw-pactions",children:[s.jsx(Ws,{api:e,phone:!0}),s.jsx(Xs,{raised:p,onOpen:()=>g(!0),onCancel:()=>void O(),phone:!0,off:as(e,"raiseHand")})]}),q,s.jsx("div",{className:"sn-vw-ppanel",children:z}),_]})}return s.jsxs("div",{className:"sn sn-vw","data-view":"viewer","data-studio-view":"viewer","data-viewer-state":"live",children:[s.jsx(Bs,{api:e,event:a,viewers:$}),s.jsxs("div",{className:"sn-vw-body",children:[s.jsxs("main",{className:"sn-vw-main sn-scroll",children:[J,s.jsxs("section",{className:"sn-vw-info","aria-label":"О трансляции",children:[s.jsx("h1",{children:B}),s.jsx(Ft,{api:e,event:a,now:r}),s.jsxs("div",{className:"sn-vw-actions",children:[s.jsx(Ws,{api:e}),s.jsx("span",{className:"sn-st-grow"}),s.jsx(S,{variant:"quiet",icon:s.jsx(es,{className:"sn-i sn-i-20"}),className:N("sn-vw-ccbtn",(C.open||o.lang!=="off")&&"is-on"),onClick:C.toggle,"aria-expanded":C.open,"aria-haspopup":"dialog",children:"Субтитры"}),s.jsx(S,{variant:"quiet",icon:s.jsx(Rs,{className:"sn-i sn-i-20"}),onClick:()=>k(!0),children:"Поделиться"}),s.jsx(Xs,{raised:p,onOpen:()=>g(!0),onCancel:()=>void O(),off:as(e,"raiseHand")}),s.jsx(ls,{open:C.open,onClose:C.close,anchor:C.anchor,prefs:o,onChange:l,active:e.captions.active,translationAllowed:e.viewerTranslation,onAir:e.captionsOnAir})]})]})]}),s.jsxs("aside",{className:"sn-vw-aside","aria-label":"Чат и интерактив",children:[q,s.jsx("div",{className:"sn-vw-panel",children:z})]})]}),_]})}export{or as VIEWER_VIEW_MOBILE,cr as VIEWER_VIEW_READY,ar as ViewerView};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.