PageSourceSearch

https://www.glitch.fun/static/js/18557.a416cd10.chunk.js

js glitch.fun collected 2026-09-24 10:39:25 UTC 108,846 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[18557,33178,38166,43991,49171,49298,49875,50182,96583],{16519:function(e,n,t){t.r(n),n.default={}},18557:function(e,n,t){t.r(n);var r=t(64467),a=t(79321),i=t(24765),o=t(91212),s=t(10467),c=t(89379),u=t(5544),l=t(60436),d=t(88094),v=t(62152),h=t(59037),f=t(49171),m=t(49875),p=t(38166),g=t(96583),b=t(49298),w=t(33178),y=t(15678),k=function(e){var n=e.label,t=e.businessTitle,r=void 0===t?"":t,a=e.company,i=void 0===a?"":a,o=e.mediaStream,s=e.muted,c=void 0!==s&&s,u=e.sourceType,l=void 0===u?"camera":u,v=(0,d.useRef)(null);return(0,d.useEffect)((function(){v.current&&(v.current.srcObject=o||null)}),[o]),(0,y.jsxs)("div",{className:"festival-virtual-video is-".concat((0,m.isPresentationSource)({sourceType:l})?"screen":"camera"),"data-source-type":l,"aria-label":"".concat(n," video"),children:[(0,y.jsx)("video",{ref:v,autoPlay:!0,playsInline:!0,muted:c}),(0,y.jsxs)("span",{className:"festival-stage-lower-third",title:n,children:[(0,y.jsx)("strong",{children:n}),(r||i)&&(0,y.jsx)("small",{children:[r,i].filter(Boolean).join(" \xb7 ")})]})]})},x=function(e,n){var t;return(null===e||void 0===e||null===(t=e.getTracks)||void 0===t?void 0:t.call(e).filter((function(e){return(!n||e.kind===n)&&"ended"!==e.readyState})))||[]},S=function(e,n){var t;return n[null===(t=x(e,"video").slice(-1)[0])||void 0===t?void 0:t.id]||null},A=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=new Map(x(e).map((function(e){return[e.kind,e]})));return n.forEach((function(e){var n=null===e||void 0===e?void 0:e.mediaStreamTrack;n&&"ended"!==n.readyState&&t.set(n.kind,n)}
1)),new MediaStream((0,l.A)(t.values()))},T=function(e){var n=new Set((arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).map((function(e){var n;return null===e||void 0===e||null===(n=e.mediaStreamTrack)||void 0===n?void 0:n.id})).filter(Boolean));return new MediaStream(x(e).filter((function(e){return!n.has(e.id)})))},j=function(e,n){if(!n)return!1;var t=String(n).replace(/-/g,"").slice(0,32);return(0,m.sourceDetails)(e).ownerId===n||(null===e||void 0===e?void 0:e.userId)==="invite-".concat(t)||(null===e||void 0===e?void 0:e.userId)==="screen-".concat(t)},M=function(e){return"video:".concat(e)},C=function(e){return"audio:".concat(e)},E=function(e,n){return"lower-third:".concat(e,":").concat(n)},_={high:{label:"High clarity (1080p \xb7 8.5 Mbps)",maxBitrate:8500},balanced:{label:"Balanced (4.5 Mbps)",maxBitrate:4500},compatible:{label:"Data saver (2.5 Mbps)",maxBitrate:2500}},N={maxVideoBitrateKbps:2500,maxFramerate:30,simulcast:{enabled:!1}},I=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"camera",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return x(n).map((function(n){if("video"===n.kind)try{n.contentHint="screen"===t?"detail":"motion"}catch(i){}var a=new e.LocalStageStream(n,"screen"===t&&"video"===n.kind?N:void 0);return"audio"===n.kind&&r.audio&&a.setMuted(!0),"video"===n.kind&&r.video&&a.setMuted(!0),a}))},R=function(e,n,t){return new Promise((function(r,a){var i=window.setTimeout((function(){return a(new Error(t))}),n);Promise.resolve(e).then((function(e){window.clearTimeout(i),r(e)}),(function(e){window.clearTimeout(i),a(e)}))}))},B=function(e,n,t){var r=e.indexOf(n),a=r+t;if(r<0||a<0||a>=e.length)return e;var i=(0,l.A)(e),o=[i[a],i[r]];return i[r]=o[0],i[a]=o[1],i},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(null===e||void 0===e?void 0:e.status)||"ready",t=(null===e||void 0===e?void 0:e.recording_status)||(null===e||void 0===e?void 0:e.broadcast_state)||"pending";return{status:n,recording_status:t,is_live:"boolean"===typeof(null===e||void 0===e?void 0:e.is_live)?e.is_live:"recording"===t,is_broadcasting:"boolean"===typeof(null===e||void 0===e?void 0:e.is_broadcasting)?e.is_broadcasting:"live"===n||["starting","recording"].includes(t),stream_state_known:null===e||void 0===e?void 0:e.stream_state_known,broadcast_stopped:null===e||void 0===e?void 0:e.broadcast_stopped}};n.default=function(e){var n,N,O,L=e.connection,D=e.displayName,V=e.initialBroadcastStatus,q=e.onBroadcastStart,H=e.onBroadcastStop,U=e.browserBroadcastStartProvider,z=e.browserBroadcastHeartbeatProvider,F=e.browserBroadcastStopProvider,G=e.broadcastStatusProvider,K=e.chatTokenProvider,W=e.chatModerationProvider,Y=e.chatMessageProvider,Q=e.chatHistoryProvider,$=e.chatDeleteProvider,J=e.screenShareTokenProvider,Z=e.playbackTokenProvider,X=(0,d.useState)("viewer"===L.mode?"Waiting for the audience feed\u2026":"Preparing the studio\u2026"),ee=(0,u.A)(X,2),ne=ee[0],te=ee[1],re=(0,d.useState)((function(){return P(V||{status:L.broadcast_state,recording_status:L.broadcast_state})})),ae=(0,u.A)(re,2),ie=ae[0],oe=ae[1],se=(0,d.useState)(""),ce=(0,u.A)(se,2),ue=ce[0],le=ce[1],de=(0,d.useState)(null),ve=(0,u.A)(de,2),he=ve[0],fe=ve[1],me=(0,d.useState)({}),pe=(0,u.A)(me,2),ge=pe[0],be=pe[1],we=(0,d.useState)(!1),ye=(0,u.A)(we,2),ke=ye[0],xe=ye[1],Se=(0,d.useState)(!1),Ae=(0,u.A)(Se,2),Te=Ae[0],je=Ae[1],Me=(0,d.useState)(""),Ce=(0,u.A)(Me,2),Ee=Ce[0],_e=Ce[1],Ne=(0,d.useState)(null),Ie=(0,u.A)(Ne,2),Re=Ie[0],Be=Ie[1],Pe=(0,d.useState)(!1),Oe=(0,u.A)(Pe,2),Le=Oe[0],De=Oe[1],Ve=(0,d.useState)(!1),qe=(0,u.A)(Ve,2),He=qe[0],Ue=qe[1],ze=(0,d.useState)("screen"),Fe=(0,u.A)(ze,2),Ge=Fe[0],Ke=Fe[1],We=(0,d.useState)("high"),Ye=(0,u.A)(We,2),Qe=Ye[0],$e=Ye[1],Je=(0,d.useState)(""),Ze=(0,u.A)(Je,2),Xe=Ze[0],en=Ze[1],nn=(0,d.useState)([]),tn=(0,u.A)(nn,2),rn=tn[0],an=tn[1],on=(0,d.useState)([]),sn=(0,u.A)(on,2),cn=sn[0],un=sn[1],ln=(0,d.useState)(!1),dn=(0,u.A)(ln,2),vn=dn[0],hn=dn[1],fn=(0,d.useState)(0),mn=(0,u.A)(fn,2),pn=mn[0],gn=mn[1],bn=(0,d.useState)(!1),wn=(0,u.A)(bn,2),yn=wn[0],kn=wn[1],xn=(0,d.useState)("connected"),Sn=(0,u.A)(xn,2),An=Sn[0],Tn=Sn[1],jn=(0,d.useState)(!1),Mn=(0,u.A)(jn,2),Cn=Mn[0],En=Mn[1],_n=(0,d.useState)(!1),Nn=(0,u.A)(_n,2),In=Nn[0],Rn=Nn[1],Bn=(0,d.useState)(!1),Pn=(0,u.A)(Bn,2),On=Pn[0],Ln=Pn[1],Dn=(0,d.useState)(!1),Vn=(0,u.A)(Dn,2),qn=Vn[0],Hn=Vn[1],Un=(0,d.useState)(!1),zn=(0,u.A)(Un,2),Fn=zn[0],Gn=zn[1],Kn=(0,d.useState)([]),Wn=(0,u.A)(Kn,2),Yn=Wn[0],Qn=Wn[1],$n=(0,d.useState)([]),Jn=(0,u.A)($n,2),Zn=Jn[0],Xn=Jn[1],et=(0,d.useState)(""),nt=(0,u.A)(et,2),tt=nt[0],rt=nt[1],at=(0,d.useState)(""),it=(0,u.A)(at,2),ot=it[0],st=it[1],ct=(0,d.useState)(""),ut=(0,u.A)(ct,2),lt=ut[0],dt=ut[1],vt=(0,d.useState)({}),ht=(0,u.A)(vt,2),ft=ht[0],mt=ht[1],pt=(0,d.useRef)(null),gt=(0,d.useRef)(null),bt=(0,d.useRef)(L.screen_share_participant_id||null),wt=(0,d.useRef)([]),yt=(0,d.useRef)([]),kt=(0,d.useRef)(null),xt=(0,d.useRef)(null),St=(0,d.useRef)(0),At=(0,d.useRef)(null),Tt=(0,d.useRef)(null),jt=(0,d.useRef)(z);jt.current=z;var Mt=(0,d.useRef)(0),Ct=(0,d.useRef)(!1),Et=(0,d.useRef)(null),_t=(0,d.useRef)(new Map),Nt=(0,d.useRef)(new Set),It=(0,d.useRef)(0),Rt=(0,d.useRef)(Promise.resolve()),Bt=(0,d.useRef)(Promise.resolve()),Pt=(0,d.useRef)(null),Ot=(0,d.useRef)(!1),Lt=(0,d.useRef)(0),Dt=(0,d.useRef)(!1),Vt=(0,d.useRef)(null),qt=(0,d.useRef)(null),Ht=(0,d.useRef)(!1),Ut=(0,d.useRef)(null),zt=(0,d.useRef)(null),Ft=(0,d.useRef)(new Map),Gt=(0,d.useRef)(!1),Kt=(0,d.useRef)(!1),Wt=(0,d.useRef)(""),Yt=(0,d.useRef)(""),Qt=(0,d.useRef)(""),$t=_t.current,Jt=(0,d.useRef)({version:0,suppressPollingUntil:0}),Zt="undefined"===typeof navigator?null:navigator.mediaDevices,Xt=["organizer","producer"].includes(L.role),er="host"===L.mode&&["organizer","producer","presenter"].includes(L.role)&&!1!==L.can_connect_obs,nr=yn?(0,c.A)((0,c.A)({},ie),{},{status:"live",recording_status:ie.is_live?"recording":"starting",is_broadcasting:!0}):ie,tr=yn&&"connected"!==An?{label:"RECONNECTING",className:"is-starting"}:function(e){return"starting"===e.recording_status?{label:"STARTING",className:"is-starting"}:e.is_live?{label:"LIVE",className:"is-live"}
1:"ended"===e.status?{label:"ENDED",className:"is-ended"}:"processing"===e.recording_status?{label:"OFF AIR \xb7 RECORDING PROCESSING",className:"is-processing"}:{label:"OFF AIR",className:"is-off-air"}}(nr),rr=!(!1===nr.broadcast_stopped&&!1===nr.stream_state_known)&&(["ended","cancelled"].includes(nr.status)||!0===nr.broadcast_stopped||"ready"===nr.status&&!nr.is_broadcasting&&!1!==nr.stream_state_known),ar=nr.is_live||In&&!rr;(0,d.useEffect)((function(){ie.is_live?Rn(!0):rr&&Rn(!1)}),[ie.is_live,rr]);var ir=L.lower_third||{},or=(0,d.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1200,t=window.setTimeout((function(){Ft.current.delete(t),e()}),n);Ft.current.set(t,e)}),[]),sr=(0,d.useMemo)((function(){return[].concat((0,l.A)(he?[{id:"local-camera",ownerId:L.invite_id||"local",sourceType:"camera",displayName:D,businessTitle:ir.business_title||"",company:ir.company||"",role:L.role,mediaStream:he,aspectRatio:S(he,ft)}]:[]),(0,l.A)(Re?[{id:"local-screen",ownerId:L.invite_id||"local",sourceType:"screen",displayName:"".concat(D," \u2014 screen share"),businessTitle:ir.business_title||"",company:ir.company||"",role:L.role,mediaStream:Re,aspectRatio:S(Re,ft)}]:[]),(0,l.A)(Object.entries(ge).map((function(e){var n=(0,u.A)(e,2),t=n[0],r=n[1];return(0,c.A)((0,c.A)({id:t},r),{},{aspectRatio:S(r.mediaStream,ft)})}))))}),[L.invite_id,L.role,D,ir.business_title,ir.company,he,ge,Re,ft]),cr=(0,d.useMemo)((function(){return rn.flatMap((function(e){return sr.filter((function(n){return(0,m.sourceIdentity)(n)===e})).map((function(e){return e.id}))}))}),[sr,rn]),ur=(0,d.useMemo)((function(){return sr.filter((function(e){return cn.includes((0,m.sourceIdentity)(e))})).map((function(e){return e.id}))}),[cn,sr]),lr=null===(n=sr.find((function(e){return(0,m.sourceIdentity)(e)===Xe})))||void 0===n?void 0:n.id,dr=(0,d.useMemo)((function(){return(0,m.buildProgramLayout)({sources:sr,order:cr,hiddenIds:ur,mode:Ge,featuredId:lr})}),[lr,ur,Ge,sr,cr]),vr="grid"===Ge?lr:null===(N=dr[0])||void 0===N?void 0:N.source.id,hr=(0,d.useRef)(dr);hr.current=dr;var fr=(0,d.useCallback)((function(e){var n,t,r,a;Ut.current&&zt.current&&(null===(r=(a=Ut.current).removeEventListener)||void 0===r||r.call(a,"configurationchange",zt.current));if(Ut.current=e||null,zt.current=null,!e)return Ht.current=!1,Ln(!1),void Hn(!1);var i=null===(n=e.getCapabilities)||void 0===n?void 0:n.call(e).backgroundBlur,o=Array.isArray(i)&&i.includes(!0)&&i.includes(!1);if(Ht.current=o,Ln(o||(0,w.canUseSoftwareBackgroundBlur)()),Hn(o&&Boolean(null===(t=e.getSettings)||void 0===t?void 0:t.call(e).backgroundBlur)),o){var s,c=function(){var n;return Hn(Boolean(null===(n=e.getSettings)||void 0===n?void 0:n.call(e).backgroundBlur))};zt.current=c,null===(s=e.addEventListener)||void 0===s||s.call(e,"configurationchange",c)}}),[]),mr=(0,d.useCallback)((0,s.A)((0,o.A)().m((function e(){var n,t,r,a,i,s,c,u,l,d,v,h,f,m;return(0,o.A)().w((function(e){for(;;)switch(e.n){case 0:if(null!==Zt&&void 0!==Zt&&Zt.enumerateDevices){e.n=1;break}return e.a(2,{audio:[],video:[]});case 1:return e.n=2,Zt.enumerateDevices();case 2:return c=e.v,u=c.filter((function(e){return"audioinput"===e.kind&&e.deviceId})),l=c.filter((function(e){return"videoinput"===e.kind&&e.deviceId})),Qn(u),Xn(l),d=Vt.current,v=(null===d||void 0===d||null===(n=d.getAudioTracks)||void 0===n||null===(n=n.call(d)[0])||void 0===n||null===(t=n.getSettings)||void 0===t?void 0:t.call(n).deviceId)||"",h=(null===d||void 0===d||null===(r=d.getVideoTracks)||void 0===r||null===(r=r.call(d)[0])||void 0===r||null===(a=r.getSettings)||void 0===a?void 0:a.call(r).deviceId)||"",f=u.some((function(e){return e.deviceId===Wt.current}))?Wt.current:u.some((function(e){return e.deviceId===v}))?v:(null===(i=u[0])||void 0===i?void 0:i.deviceId)||"",m=l.some((function(e){return e.deviceId===Yt.current}))?Yt.current:l.some((function(e){return e.deviceId===h}))?h:(null===(s=l[0])||void 0===s?void 0:s.deviceId)||"",Wt.current=f,Yt.current=m,rt(f),st(m),e.a(2,{audio:u,video:l})}}),e)}))),[Zt]),pr=(0,d.useCallback)(function(){var e=(0,s.A)((0,o.A)().m((function e(n,r){var a,i,s,c,u,d,v,h,f,m,p,g,b,w,y,k,x,S,A,T,j,M,C,E,_,N,I,R=arguments;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(c=R.length>2&&void 0!==R[2]&&R[2],r&&null!==Zt&&void 0!==Zt&&Zt.getUserMedia&&!lt){e.n=1;break}return e.a(2);case 1:if(u=Vt.current){e.n=2;break}return e.a(2);case 2:if((null===(v=(d="audio"===n)?null===(a=u.getAudioTracks)||void 0===a?void 0:a.call(u)[0]:null===(i=u.getVideoTracks)||void 0===i?void 0:i.call(u)[0])||void 0===v||null===(s=v.getSettings)||void 0===s?void 0:s.call(v).deviceId)!==r){e.n=3;break}return e.a(2);case 3:return dt(n),le(""),e.p=4,e.n=5,Zt.getUserMedia(d?{audio:{deviceId:{exact:r},echoCancellation:!0,noiseSuppression:!0},video:!1}:{audio:!1,video:{deviceId:{exact:r},width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30,max:30}}});case 5:if(h=e.v,y=d?null===(f=(m=h).getAudioTracks)||void 0===f?void 0:f.call(m)[0]:null===(p=(g=h).getVideoTracks)||void 0===p?void 0:p.call(g)[0]){e.n=6;break}throw new Error("The selected ".concat(d?"microphone":"camera"," did not provide a usable track."));case 6:return y.enabled=d?!Gt.current:!Kt.current,k=u.getTracks().filter((function(e){return e.kind!==n&&"ended"!==e.readyState})),x=new MediaStream([].concat((0,l.A)(k),[y])),S=x,A=null,d&&qt.current?S=new MediaStream([].concat((0,l.A)((null===he||void 0===he||null===(T=he.getVideoTracks)||void 0===T?void 0:T.call(he))||[]),[y])):d||(A=qt.current,qt.current=null,fr(y)),e.n=7,t.e(89390).then(t.t.bind(t,89390,23));case 7:return j=e.v,M=S.getTracks().filter((function(e){return"ended"!==e.readyState})).map((function(e){var n=new j.LocalStageStream(e);return"audio"===e.kind&&Gt.current&&n.setMuted(!0),"video"===e.kind&&Kt.current&&n.setMuted(!0),n})),Vt.current=x,wt.current=M,fe(S),d?(Wt.current=r,rt(r)):(Yt.current=r,st(r),Hn(!1)),null===(b=pt.current)||void 0===b||null===(w=b.refreshStrategy)||void 0===w||w.call(b),d?null===v||void 0===v||v.stop():(null===(C=A)||void 0===C||null===(E=C.retire)||void 0===E||E.call(C),or((function(){var e;null===(e=A)||void 0===e||e.stop(),null===v||void 0===v||v.stop()}))),te("".concat(d?"Microphone":"Camera"," changed").concat(!d&&qn?"; background blur was turned off for the new camera":"",".")),e.n=8,mr();case 8:e.n=10;break;case 9:e.p=9,I=e.v,null===(_=h)||void 0===_||null===(N=_.getTracks)||void 0===N||N.call(_).forEach((function(e){return e.stop()})),le((null===I||void 0===I?void 0:I.message)||"Could not switch the ".concat(d?"microphone":"camera",". The current device is still active.")),c&&te("The active ".concat(d?"microphone":"camera"," disconnected. Choose another available device."));case 10:return e.p=10,dt(""),e.f(10);case 11:return e.a(2)}}),e,null,[[4,9,10,11]])})));return function(n,t){return e.apply(this,arguments)}}(),[qn,fr,or,lt,he,Zt,mr]);(0,d.useEffect)((function(){if(G){var e=!1,n=!1,t=function(){var t=(0,s.A)((0,o.A)().m((function t(){var r,a,i,s;return(0,o.A)().w((function(t){for(;;)switch(t.p=t.n){case 0:if(!(n||"undefined"!==typeof document&&"hidden"===document.visibilityState)){t.n=1;break}return t.a(2);case 1:return n=!0,r=Jt.current.version,t.p=2,t.n=3,G();case 3:a=t.v,i=Jt.current,!e&&a&&r===i.version&&Date.now()>=i.suppressPollingUntil&&(s=P(a),oe(s)),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,n=!1,t.f(5);case 6:return t.a(2)}}),t,null,[[2,4,5,6]])})));return function(){return t.apply(this,arguments)}}();t();var r=window.setInterval(t,5e3);return function(){e=!0,window.clearInterval(r)}}}),[G]),(0,d.useEffect)((function(){var e=sr.map(m.sourceIdentity);an((function(n){var t=e.filter((function(e){return!n.includes(e)}));return t.length?[].concat((0,l.A)(n),(0,l.A)(new Set(t))):n}))}),[sr]),(0,d.useEffect)((function(){if("host"===L.mode){var e=sr.flatMap((function(e){var n,t;return(null===(n=e.mediaStream)||void 0===n||null===(t=n.getTracks)||void 0===t?void 0:t.call(n))||[]})),n=function(){var n=e.map((function(e){var n,t=(null===(n=e.getSettings)||void 0===n?void 0:n.call(e))||{};return"".concat(e.id,":").concat(e.readyState,":").concat(t.width||0,"x").concat(t.height||0,":").concat(t.aspectRatio||0)})).sort().join("|");n!==Qt.current&&(Qt.current=n,mt(Object.fromEntries(e.map((function(e){var n,t=(null===(n=e.getSettings)||void 0===n?void 0:n.call(e))||{},r=Number(t.width),a=Number(t.height),i=r>0&&a>0?r/a:Number(t.aspectRatio);return[e.id,Number.isFinite(i)&&i>0?i:16/9]})))))};e.forEach((function(e){var t,r;null===(t=e.addEventListener)||void 0===t||t.call(e,"configurationchange",n),null===(r=e.addEventListener)||void 0===r||r.call(e,"ended",n)})),n();var t=window.setInterval(n,2e3);return function(){window.clearInterval(t),e.forEach((function(e){var t,r;null===(t=e.removeEventListener)||void 0===t||t.call(e,"configurationchange",n),null===(r=e.removeEventListener)||void 0===r||r.call(e,"ended",n)}))}}}),[L.mode,sr]),(0,d.useEffect)((function(){if(Xt&&"host"===L.mode){var e=!1,n=Nt.current,r=window.setInterval((function(){$t.forEach((function(e){var n,t;null===(n=e.video)||void 0===n||n.sync(),null===(t=e.audio)||void 0===t||t.sync()}))}),200);hn(!1);var a=function(){var n=(0,s.A)((0,o.A)().m((function n(){var r,a,i,s,u;return(0,o.A)().w((function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,t.e(89390).then(t.t.bind(t,89390,23));case 1:if(a=n.v,!e&&Et.current){n.n=2;break}return n.a(2);case 2:if("function"===typeof(i=a.create||(null===(r=a.default)||void 0===r?void 0:r.create))){n.n=3;break}throw new Error("The Amazon IVS browser mixer is unavailable.");case 3:if((s=i({streamConfig:(0,c.A)((0,c.A)({},a.STANDARD_LANDSCAPE),{},{maxResolution:{width:m.PROGRAM_WIDTH,height:m.PROGRAM_HEIGHT},maxBitrate:_[Qe].maxBitrate,maxFramerate:30}),networkReconnectConfig:{reconnect:!0,timeout:12e4}})).attachPreview(Et.current),s.on(a.BroadcastClientEvents.ERROR,(function(n){e||le((null===n||void 0===n?void 0:n.message)||"The audience program mixer encountered an error.")})),s.on(a.BroadcastClientEvents.CONNECTION_STATE_CHANGE,(function(n){var t;e||null===(t=Tt.current)||void 0===t||t.connectionChanged(n)})),s.on(a.BroadcastClientEvents.ACTIVE_STATE_CHANGE,(function(n){var t;e||null===(t=Tt.current)||void 0===t||t.activeChanged(n)})),!e){n.n=4;break}return s.delete(),n.a(2);case 4:At.current=s,Tt.current=(0,g.createProgramRecovery)({client:s,verifyControl:function(){var e;return null===(e=jt.current)||void 0===e?void 0:e.call(jt)},onState:function(n){e||Tn(n)},onControlLost:function(){e||(Lt.current+=1,window.clearInterval(Pt.current),Pt.current=null,Dt.current=!1,kn(!1),le("Production control ended or moved to another producer. Automatic reconnection was stopped."))}}),gn((function(e){return e+1})),hn(!0),n.n=6;break;case 5:n.p=5,u=n.v,e||le((null===u||void 0===u?void 0:u.message)||"The browser program mixer could not be prepared.");case 6:return n.a(2)}}),n,null,[[0,5]])})));return function(){return n.apply(this,arguments)}}();return Bt.current=a(),function(){var t;
1e=!0,Mt.current+=1,null===(t=Tt.current)||void 0===t||t.dispose(),Tt.current=null,window.clearInterval(r),It.current+=1,Lt.current+=1,Ot.current=!1,window.clearInterval(Pt.current),Pt.current=null;try{var a;null===(a=At.current)||void 0===a||a.stopBroadcast()}catch(ue){}try{var i;null===(i=At.current)||void 0===i||i.delete()}catch(ue){}At.current=null,$t.forEach((function(e){var n,t;null===(n=e.video)||void 0===n||n.dispose(),null===(t=e.audio)||void 0===t||t.dispose()})),$t.clear(),n.clear(),Rt.current=Promise.resolve()}}}),[Xt,L.mode,$t,Qe]);var gr=(0,d.useCallback)((0,s.A)((0,o.A)().m((function e(){var n,t,r,c,l,d,v,h,f,g,b,w,y,k,S,A,T,j,_,N,I,R,B,P,O,L,D,V,q,H,U,z,F,G,K,W,Y,Q,$,J,Z,X=arguments;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(n=X.length>0&&void 0!==X[0]?X[0]:At.current,(t=function(){return n&&At.current===n})()){e.n=1;break}return e.a(2);case 1:r=function(e,t,r){var a=e[t];if(a){e[t]=null;try{"video"===t?n.removeVideoInputDevice(M(r)):n.removeAudioInputDevice(C(r))}finally{a.dispose()}}},c=function(){var e=(0,s.A)((0,o.A)().m((function e(a,i,s,c,u,l){var d,v;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(d=(0,p.createProgramMedia)(c,l),a[i]=d,e.p=1,"video"!==i){e.n=3;break}return e.n=2,n.addVideoInputDevice(d.stream,M(s),u);case 2:e.n=4;break;case 3:return e.n=4,n.addAudioInputDevice(d.stream,C(s));case 4:if(!t()){e.n=5;break}return e.a(2);case 5:e.n=8;break;case 6:e.p=6,v=e.v;try{r(a,i,s)}catch(o){}if(!t()){e.n=7;break}throw v;case 7:return e.a(2);case 8:try{r(a,i,s)}catch(o){}case 9:return e.a(2)}}),e,null,[[1,6]])})));return function(n,t,r,a,i,o){return e.apply(this,arguments)}}(),l=new Map(sr.map((function(e){return[e.id,e]}))),d=new Map(dr.map((function(e){return[e.source.id,e.composition]}))),v=new Set(sr.map((function(e){return e.id}))),h=(0,i.A)($t.entries());try{for(h.s();!(f=h.n()).done;)g=(0,u.A)(f.value,2),b=g[0],w=g[1],v.has(b)||(r(w,"video",b),r(w,"audio",b),$t.delete(b))}catch(ne){h.e(ne)}finally{h.f()}y=It.current+1,It.current=y,k=(0,i.A)(Nt.current);try{for(k.s();!(S=k.n()).done;)A=S.value,n.removeImage(A)}catch(ne){k.e(ne)}finally{k.f()}Nt.current.clear(),T=new Set,j=(0,i.A)(l.entries()),e.p=2,j.s();case 3:if((_=j.n()).done){e.n=12;break}if(P=(0,u.A)(_.value,2),O=P[0],L=P[1],ee=L.mediaStream,D=x(ee,"video").map((function(e){return e.id})).sort().join(":"),V=x(L.mediaStream,"audio").filter((function(e){return!T.has(e.id)})),q=d.get(O),H=$t.get(O)||{},$t.set(O,H),U=Boolean(q&&D),z=V.map((function(e){return e.id})).sort().join(":"),V.forEach((function(e){return T.add(e.id)})),H.videoSignature===D&&Boolean(H.video)===U){e.n=6;break}if(r(H,"video",O),!U){e.n=4;break}return e.n=4,c(H,"video",O,x(L.mediaStream,"video").slice(-1),q,null===(F=L.mutedKinds)||void 0===F?void 0:F.video);case 4:if(t()){e.n=5;break}return e.a(2);case 5:H.videoSignature=D,e.n=7;break;case 6:U&&n.updateVideoDeviceComposition(M(O),q);case 7:if(G=Boolean(z),H.audioSignature===z&&Boolean(H.audio)===G){e.n=10;break}if(r(H,"audio",O),!G){e.n=8;break}return e.n=8,c(H,"audio",O,V,void 0,null===(K=L.mutedKinds)||void 0===K?void 0:K.audio);case 8:if(t()){e.n=9;break}return e.a(2);case 9:H.audioSignature=z;case 10:null===(N=H.video)||void 0===N||N.setMuted(Boolean(null===(I=L.mutedKinds)||void 0===I?void 0:I.video)),null===(R=H.audio)||void 0===R||R.setMuted(Boolean(null===(B=L.mutedKinds)||void 0===B?void 0:B.audio));case 11:e.n=3;break;case 12:e.n=14;break;case 13:e.p=13,J=e.v,j.e(J);case 14:return e.p=14,j.f(),e.f(14);case 15:W=[],Y=(0,i.A)(dr),e.p=16,$=(0,o.A)().m((function e(){var r,a,i;return(0,o.A)().w((function(e){for(;;)switch(e.n){case 0:if(r=Q.value,a=(0,m.createProgramLowerThird)(r)){e.n=1;break}return e.a(2,1);case 1:i=E(y,r.source.id),W.push(Promise.resolve(n.addImageSource(a.canvas,i,a.composition)).then((function(){t()&&It.current===y?Nt.current.add(i):n.removeImage(i)})).catch((function(e){t()&&le((null===e||void 0===e?void 0:e.message)||"A panelist lower third could not be added. Video and audio remain available.")})));case 2:return e.a(2)}}),e)})),Y.s();case 17:if((Q=Y.n()).done){e.n=20;break}return e.d((0,a.A)($()),18);case 18:if(!e.v){e.n=19;break}return e.a(3,19);case 19:e.n=17;break;case 20:e.n=22;break;case 21:e.p=21,Z=e.v,Y.e(Z);case 22:return e.p=22,Y.f(),e.f(22);case 23:return e.n=24,Promise.all(W);case 24:return e.a(2)}var ee}),e,null,[[16,21,22,23],[2,13,14,15]])}))),[$t,dr,sr]);if((0,d.useEffect)((function(){if(vn){var e=At.current;Rt.current=Rt.current.then((function(){return gr(e)})).catch((function(n){At.current===e&&le((null===n||void 0===n?void 0:n.message)||"The audience layout could not be updated.")}))}}),[pn,vn,gr]),(0,d.useEffect)((function(){if("host"===L.mode){var e,n=!1,a=Ft.current;bt.current=L.screen_share_participant_id||null;var i=function(){var a=(0,s.A)((0,o.A)().m((function a(){var i,s,u,d,v,h,f,p,g,b,w,y,k;return(0,o.A)().w((function(a){for(;;)switch(a.p=a.n){case 0:if(a.p=0,"producer"===L.role){a.n=14;break}if(null!==Zt&&void 0!==Zt&&Zt.getUserMedia){a.n=1;break}throw new Error("Camera and microphone access is unavailable in this browser.");case 1:return u={echoCancellation:!0,noiseSuppression:!0},d={width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30,max:30}},a.p=2,a.n=3,Zt.getUserMedia({audio:u,video:d});case 3:e=a.v,a.n=14;break;case 4:if(a.p=4,y=a.v,!["NotAllowedError","SecurityError"].includes(null===y||void 0===y?void 0:y.name)){a.n=5;break}throw y;case 5:return v=[],a.p=6,a.n=7,Zt.getUserMedia({audio:u,video:!1});case 7:h=a.v,v.push.apply(v,(0,l.A)(h.getAudioTracks())),a.n=9;break;case 8:a.p=8,a.v;case 9:return a.p=9,a.n=10,Zt.getUserMedia({audio:!1,video:d});case 10:f=a.v,v.push.apply(v,(0,l.A)(f.getVideoTracks())),a.n=12;break;case 11:a.p=11,a.v;case 12:if(v.length){a.n=13;break}throw y;case 13:e=new MediaStream(v);case 14:if(!n){a.n=15;break}
1return null===(p=e)||void 0===p||p.getTracks().forEach((function(e){return e.stop()})),a.a(2);case 15:return Vt.current=e||null,fe(e||null),fr(null===(i=e)||void 0===i||null===(s=i.getVideoTracks)||void 0===s?void 0:s.call(i)[0]),mr().catch((function(){})),a.n=16,t.e(89390).then(t.t.bind(t,89390,23));case 16:return g=a.v,wt.current=e?I(g,e,"camera"):[],b={stageStreamsToPublish:function(){return wt.current},shouldPublishParticipant:function(){return wt.current.length>0},shouldSubscribeToParticipant:function(){return g.SubscribeType.AUDIO_VIDEO},subscribeConfiguration:function(){return{simulcast:{initialLayerPreference:g.InitialLayerPreference.HIGHEST_QUALITY}}}},w=new g.Stage(L.stage_token,b),pt.current=w,w.on(g.StageEvents.STAGE_CONNECTION_STATE_CHANGED,(function(e){var n=e===g.StageConnectionState.CONNECTED;Ue(n),te(n?"producer"===L.role?"Producer console connected. The audience feed starts only when you or an organizer puts it on air.":"Connected to the host studio. You are not on the audience feed until an organizer or producer starts the broadcast.":"Studio ".concat(e,"\u2026"))})),w.on(g.StageEvents.STAGE_PARTICIPANT_STREAMS_ADDED,(function(e,n){
1null!==e&&void 0!==e&&e.isLocal||(null===e||void 0===e?void 0:e.id)===L.participant_id||(null===e||void 0===e?void 0:e.id)===bt.current||j(e,L.invite_id)||be((function(t){var a=t[e.id];return(0,c.A)((0,c.A)({},t),{},(0,r.A)({},e.id,(0,c.A)((0,c.A)({},(0,m.sourceDetails)(e)),{},{mediaStream:A(null===a||void 0===a?void 0:a.mediaStream,n),mutedKinds:(0,c.A)((0,c.A)({},null===a||void 0===a?void 0:a.mutedKinds),Object.fromEntries(n.filter((function(e){return null===e||void 0===e?void 0:e.mediaStreamTrack})).map((function(e){return[e.mediaStreamTrack.kind,Boolean(e.isMuted)]}))))})))}))})),w.on(g.StageEvents.STAGE_PARTICIPANT_STREAMS_REMOVED,(function(e,n){be((function(t){var r=(0,c.A)({},t),a=r[e.id];if(!a)return t;var i=T(a.mediaStream,n);return i.getTracks().length?r[e.id]=(0,c.A)((0,c.A)({},a),{},{mediaStream:i}):delete r[e.id],r}))})),w.on(g.StageEvents.STAGE_PARTICIPANT_LEFT,(function(e){be((function(n){var t=(0,c.A)({},n);return delete t[e.id],t}))})),w.on(g.StageEvents.STAGE_PARTICIPANT_METADATA_CHANGED,(function(e){be((function(n){return n[e.id]?(0,c.A)((0,c.A)({},n),{},(0,r.A)({},e.id,(0,c.A)((0,c.A)({},n[e.id]),(0,m.sourceDetails)(e)))):n}))})),w.on(g.StageEvents.STAGE_STREAM_MUTE_CHANGED,(function(e,n){var t=null===n||void 0===n?void 0:n.mediaStreamTrack;t&&be((function(a){var i=a[e.id];return null!==i&&void 0!==i&&i.mediaStream.getTracks().some((function(e){return e.id===t.id}))?(0,c.A)((0,c.A)({},a),{},(0,r.A)({},e.id,(0,c.A)((0,c.A)({},i),{},{mutedKinds:(0,c.A)((0,c.A)({},i.mutedKinds),{},(0,r.A)({},t.kind,Boolean(n.isMuted)))}))):a}))})),w.on(g.StageEvents.ERROR,(function(e){return le((null===e||void 0===e?void 0:e.message)||"The host studio encountered an error.")})),a.n=17,w.join();case 17:a.n=19;break;case 18:a.p=18,k=a.v,n||(le((null===k||void 0===k?void 0:k.message)||"Could not join the Amazon IVS host studio."),te("Studio unavailable"));case 19:return a.a(2)}}),a,null,[[9,11],[6,8],[2,4],[0,18]])})));return function(){return a.apply(this,arguments)}}();return i(),function(){var e,t,r,i,o,s,c;(n=!0,null===(e=pt.current)||void 0===e||e.leave(),null===(t=gt.current)||void 0===t||t.leave(),window.clearTimeout(xt.current),xt.current=null,null===(r=Vt.current)||void 0===r||r.getTracks().forEach((function(e){return e.stop()})),null===(i=kt.current)||void 0===i||i.getTracks().forEach((function(e){return e.stop()})),null===(o=qt.current)||void 0===o||o.stop(),qt.current=null,a.forEach((function(e,n){window.clearTimeout(n),e()})),a.clear(),Vt.current=null,Ht.current=!1,Ut.current&&zt.current)&&(null===(s=(c=Ut.current).removeEventListener)||void 0===s||s.call(c,"configurationchange",zt.current));Ut.current=null,zt.current=null,wt.current=[],yt.current=[]}}}),[fr,L.invite_id,L.mode,L.participant_id,L.role,L.screen_share_participant_id,L.stage_token,Zt,mr]),(0,d.useEffect)((function(){if("host"===L.mode&&"producer"!==L.role&&null!==Zt&&void 0!==Zt&&Zt.addEventListener){var e=function(){var e=(0,s.A)((0,o.A)().m((function e(){var n,t,r,a;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,n=Wt.current,t=Yt.current,e.n=1,mr();case 1:if(r=e.v,!n||r.audio.some((function(e){return e.deviceId===n}))){e.n=4;break}if(!r.audio[0]){e.n=3;break}return e.n=2,pr("audio",r.audio[0].deviceId,!0);case 2:e.n=4;break;case 3:te("The active microphone disconnected and no replacement microphone is available.");case 4:if(!t||r.video.some((function(e){return e.deviceId===t}))){e.n=7;break}if(!r.video[0]){e.n=6;break}return e.n=5,pr("video",r.video[0].deviceId,!0);case 5:e.n=7;break;case 6:te("The active camera disconnected and no replacement camera is available.");case 7:e.n=9;break;case 8:e.p=8,a=e.v,le((null===a||void 0===a?void 0:a.message)||"Available cameras and microphones could not be refreshed.");case 9:return e.a(2)}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return Zt.addEventListener("devicechange",e),function(){var n;return null===(n=Zt.removeEventListener)||void 0===n?void 0:n.call(Zt,"devicechange",e)}}}),[L.mode,L.role,Zt,mr,pr]),"viewer"===L.mode){var br,wr=function(e){return"cancelled"===e.status?["This live session was cancelled.","Check the session page for updates from the organizer."]:!1===e.stream_state_known&&!1===e.broadcast_stopped?["Checking the live broadcast.","The stream\u2019s availability could not be confirmed yet. Keep this page open while we check again."]:!0===e.broadcast_stopped||"ended"===e.status||!e.is_broadcasting&&["ready","processing"].includes(e.recording_status)?["The live broadcast has finished.","Replay availability depends on recording processing and organizer publication. Check the session page for its current replay status. If the host restarts the stream, this page will reconnect automatically."]:[e.is_broadcasting?"The broadcast is starting.":"The broadcast is not live yet.","Keep this page open. The video player will appear automatically when the audience feed 
1is actually available."]}(nr),yr=(0,u.A)(wr,2),kr=yr[0],xr=yr[1];return(0,y.jsxs)("div",{className:"festival-ivs-event-layout",children:[(0,y.jsxs)("div",{className:"festival-virtual-card is-wide",children:[(0,y.jsxs)("div",{className:"festival-broadcast-heading",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{className:"festival-kicker",children:"Amazon IVS large broadcast"}),(0,y.jsx)("h1",{children:"Live festival stream"})]}),(0,y.jsx)("span",{className:"festival-broadcast-state ".concat(tr.className),"aria-label":"Broadcast status: ".concat(tr.label),children:tr.label})]}),ar?(0,y.jsx)(h.default,{playbackUrl:L.playback_url,playbackTokenProvider:Z,broadcastStatusProvider:G,title:"Live festival broadcast"}):(0,y.jsxs)("div",{className:"festival-broadcast-off-air",children:[(0,y.jsx)("strong",{children:kr}),(0,y.jsx)("span",{children:xr})]}),nr.is_broadcasting&&!nr.is_live&&(0,y.jsx)("p",{className:"festival-broadcast-warming",children:"The audience feed is starting. The player will appear automatically when IVS confirms that video is available."}),(0,y.jsx)("p",{children:"This private viewing session is tied to your personal Glitch invitation and uses a single-use playback token."})]}),(0,y.jsx)(v.default,{initialToken:L.chat,tokenProvider:K,moderationProvider:W,currentRole:L.role,messageProvider:Y,historyProvider:Q,deleteProvider:$},(null===(br=L.chat)||void 0===br?void 0:br.room_id)||L.session_id)]})}var Sr=function(e){e&&oe(P(e))},Ar=function(){Jt.current={version:Jt.current.version+1,suppressPollingUntil:Date.now()+6500}},Tr=function(){Jt.current.suppressPollingUntil=Date.now()},jr=function(){Jt.current.suppressPollingUntil=Date.now()+6500},Mr=function(){var e=(0,s.A)((0,o.A)().m((function e(n){var t,r,a,i,s,c,u;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(z&&n===Lt.current&&!Ot.current&&Dt.current){e.n=1;break}return e.a(2);case 1:return Ot.current=!0,e.p=2,e.n=3,z();case 3:(t=e.v)&&n===Lt.current&&Dt.current&&(Sr(t),null===(r=Tt.current)||void 0===r||r.observeStatus(t),t.is_live&&te("Audience broadcast is live. Keep this studio open while you are on air.")),e.n=6;break;case 4:if(e.p=4,u=e.v,n===Lt.current&&Dt.current){e.n=5;break}return e.a(2);case 5:if([401,403,404,409,410,422].includes(Number((null===u||void 0===u||null===(a=u.response)||void 0===a?void 0:a.status)||0))){null===(s=Tt.current)||void 0===s||s.deactivate(),Lt.current+=1,window.clearInterval(Pt.current),Pt.current=null;try{null===(c=At.current)||void 0===c||c.stopBroadcast()}catch(ue){}Dt.current=!1,kn(!1)}le((null===u||void 0===u||null===(i=u.response)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.message)||(null===u||void 0===u?void 0:u.message)||"Production control could not be renewed. Another producer may be able to take over shortly.");case 6:return e.p=6,n===Lt.current&&(Ot.current=!1),e.f(6);case 7:return e.a(2)}}),e,null,[[2,4,6,7]])})));return function(n){return e.apply(this,arguments)}}(),Cr=function(){if(window.clearInterval(Pt.current),z){var e=Lt.current+1;Lt.current=e,Ot.current=!1,Mr(e),Pt.current=window.setInterval((function(){return Mr(e)}),15e3)}},Er=function(){var e=(0,s.A)((0,o.A)().m((function e(){var n,t,r,a,i,s,c,u,l,d,v,h,f,m,p,g,b,w,y,k,S=arguments;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(t=S.length>0&&void 0!==S[0]&&S[0],Xt&&!Ee&&!Ct.current){e.n=1;break}return e.a(2);case 1:if(null===(n=Tt.current)||void 0===n||!n.isBusy()){e.n=2;break}return le("A production reconnection is still finishing. Wait for it to settle before starting another connection."),e.a(2);case 2:if(!t||!nr.is_broadcasting||window.confirm("Take over the audience broadcast from the current or interrupted producer?")){e.n=3;break}return e.a(2);case 3:if(He){e.n=4;break}return le("Wait for the host studio to finish connecting before starting the audience broadcast."),e.a(2);case 4:if(Ar(),r=++Mt.current,Ct.current=!0,a=!1,s=function(){return r===Mt.current},_e("starting"),le(""),En(!1),e.p=5,!U){e.n=19;break}return te("Preparing the audience program\u2026"),e.n=6,R(Bt.current,1e4,"The audience program mixer took too long to prepare. Reload this page and try again.");
1case 6:if(s()){e.n=7;break}return e.a(2);case 7:if(At.current){e.n=8;break}throw new Error("The audience program mixer is unavailable. Reload this page and try again.");case 8:if(i=At.current,!(d=null===(c=(u=At.current).getAudioContext)||void 0===c?void 0:c.call(u))||"running"===d.state){e.n=9;break}return e.n=9,d.resume();case 9:if(hr.current.some((function(e){return x(e.source.mediaStream,"video").length>0}))){e.n=10;break}throw new Error("Show at least one connected camera or screen source before starting the audience broadcast.");case 10:return v=Rt.current.then(gr),Rt.current=v.catch((function(){})),e.n=11,R(v,1e4,"The audience program sources took too long to prepare. Check the camera and screen-share connections, then try again.");case 11:if(s()){e.n=12;break}return e.a(2);case 12:return e.n=13,U(t);case 13:if(h=e.v,a=!0,s()){e.n=14;break}return e.a(2);case 14:if(null!==(f=null===h||void 0===h?void 0:h.credentials)&&void 0!==f&&f.stream_key&&null!==f&&void 0!==f&&f.ingest_endpoint){e.n=15;break}throw new Error("The audience broadcast credentials were not returned.");case 15:return e.n=16,i.startBroadcast(f.stream_key,f.ingest_endpoint);case 16:if(m=e.v,s()){e.n=17;break}try{i.stopBroadcast()}catch(o){}return e.a(2);case 17:if(!(m instanceof Error)){e.n=18;break}throw m;case 18:null===(l=Tt.current)||void 0===l||l.activate(f),Dt.current=!0,kn(!0),Cr(),Sr(h),e.n=21;break;case 19:return y=Sr,e.n=20,null===q||void 0===q?void 0:q();case 20:y(e.v);case 21:jr(),te("Audience broadcast is starting. Keep the studio open while the feed comes on air."),e.n=26;break;case 22:if(e.p=22,k=e.v,s()){e.n=23;break}return e.a(2);case 23:if(Tr(),!U||!a){e.n=25;break}null===(b=Tt.current)||void 0===b||b.deactivate();try{null===(w=At.current)||void 0===w||w.stopBroadcast()}catch(ue){}if(!F){e.n=24;break}return e.n=24,Promise.resolve(F()).catch((function(){}));case 24:Dt.current=!1,kn(!1);case 25:En(409===(null===k||void 0===k||null===(p=k.response)||void 0===p?void 0:p.status)),le((null===k||void 0===k||null===(g=k.response)||void 0===g||null===(g=g.data)||void 0===g?void 0:g.message)||(null===k||void 0===k?void 0:k.message)||"The audience broadcast could not be started.");case 26:return e.p=26,Ct.current=!1,s()&&_e(""),e.f(26);case 27:return e.a(2)}}),e,null,[[5,22,26,27]])})));return function(){return e.apply(this,arguments)}}(),_r=function(){var e=(0,s.A)((0,o.A)().m((function e(){var n,t,r,a,i,s;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(Xt&&!Ee&&window.confirm("Stop the audience broadcast and finalize the recording? Presenters will remain connected to the studio.")){e.n=1;break}return e.a(2);case 1:if(Ar(),Mt.current+=1,null===(n=Tt.current)||void 0===n||n.deactivate(),_e("stopping"),le(""),e.p=2,window.clearInterval(Pt.current),Pt.current=null,Lt.current+=1,Ot.current=!1,!F){e.n=4;break}if(Dt.current)try{null===(t=At.current)||void 0===t||t.stopBroadcast()}catch(ue){}return Dt.current=!1,kn(!1),a=Sr,e.n=3,F();case 3:a(e.v),e.n=6;break;case 4:return i=Sr,e.n=5,null===H||void 0===H?void 0:H();case 5:i(e.v);
1case 6:jr(),te("Audience feed is off air. Amazon IVS normally finalizes the recording within 2\u20135 minutes; presenters remain connected to the studio."),e.n=8;break;case 7:e.p=7,s=e.v,Tr(),le((null===s||void 0===s||null===(r=s.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||(null===s||void 0===s?void 0:s.message)||"The audience broadcast could not be stopped.");case 8:return e.p=8,_e(""),e.f(8);case 9:return e.a(2)}}),e,null,[[2,7,8,9]])})));return function(){return e.apply(this,arguments)}}(),Nr=function(e,n,t){var r,a;(null===he||void 0===he||he.getTracks().filter((function(n){return n.kind===e})).forEach((function(e){e.enabled=n})),"video"===e&&Vt.current!==he)&&(null===(r=Vt.current)||void 0===r||null===(a=r.getVideoTracks)||void 0===a||a.call(r).forEach((function(e){e.enabled=n})));wt.current.filter((function(n){return n.mediaStreamTrack.kind===e})).forEach((function(e){return e.setMuted(!n)})),"audio"===e&&(Gt.current=!n),"video"===e&&(Kt.current=!n),$t.forEach((function(n){var t;return null===(t=n[e])||void 0===t?void 0:t.sync()})),t(!n)},Ir=function(){var e=(0,s.A)((0,o.A)().m((function e(n){var r,a,i,s,c,u,l=arguments;return(0,o.A)().w((function(e){for(;;)switch(e.n){case 0:if(s=l.length>1&&void 0!==l[1]?l[1]:"",qt.current===n){e.n=1;break}return e.a(2);case 1:if(null!==(c=Vt.current)&&void 0!==c&&null!==(r=c.getVideoTracks)&&void 0!==r&&r.call(c).some((function(e){return"ended"!==e.readyState}))){e.n=2;break}throw new Error("The original camera track is no longer available. Choose the camera again to recover video.");case 2:return e.n=3,t.e(89390).then(t.t.bind(t,89390,23));case 3:u=e.v,qt.current=null,wt.current=I(u,c,"camera",{audio:Gt.current,video:Kt.current}),fe(c),null===(a=pt.current)||void 0===a||null===(i=a.refreshStrategy)||void 0===i||i.call(a),Hn(!1),te(s?"Camera video recovered without background blur.":"Camera background blur is off."),s&&le(s),or((function(){var e;return null===(e=n.stop)||void 0===e?void 0:e.call(n)}));case 4:return e.a(2)}}),e)})));return function(n){return e.apply(this,arguments)}}(),Rr=function(){var e=(0,s.A)((0,o.A)().m((function e(){var n,r,a,i,s,c,u,l,d,v;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(r=Vt.current,(a=null===r||void 0===r||null===(n=r.getVideoTracks)||void 0===n?void 0:n.call(r)[0])&&!Fn){e.n=1;break}return e.a(2);case 1:if(Gn(!0),le(""),e.p=2,!Ht.current){e.n=4;break}return e.n=3,a.applyConstraints({backgroundBlur:!qn});case 3:s=Boolean(null===(i=a.getSettings)||void 0===i?void 0:i.call(a).backgroundBlur),Hn(s),te(s?"Camera background blur is on.":"Camera background blur is off."),e.n=10;break;case 4:if(!qt.current){e.n=6;break}return e.n=5,Ir(qt.current);case 5:e.n=10;break;case 6:return te("Loading secure on-device background blur\u2026"),e.n=7,(0,w.createSoftwareBackgroundBlur)(r,{onError:function(e){qt.current===l&&Ir(l,e||"Background blur stopped processing. Camera video remains available without blur.").catch((function(e){return le((null===e||void 0===e?void 0:e.message)||"Camera video could not recover after background blur stopped.")}))}});case 7:if(l=e.v,Vt.current===r&&"ended"!==a.readyState){e.n=8;break}throw l.stop(),new Error("The camera changed while background blur was loading. Try again with the active camera.");case 8:return qt.current=l,e.n=9,t.e(89390).then(t.t.bind(t,89390,23));case 9:d=e.v,wt.current=I(d,l.stream,"camera",{audio:Gt.current,video:Kt.current}),fe(l.stream),null===(c=pt.current)||void 0===c||null===(u=c.refreshStrategy)||void 0===u||u.call(c),Hn(!0),te("Camera background blur is on.");case 10:e.n=12;break;case 11:e.p=11,v=e.v,le((null===v||void 0===v?void 0:v.message)||"This camera could not change its background blur setting.");case 12:return e.p=12,Gn(!1),e.f(12);case 13:return e.a(2)}}),e,null,[[2,11,12,13]])})));return function(){return e.apply(this,arguments)}}(),Br=function(){var e,n;St.current+=1,window.clearTimeout(xt.current),xt.current=null,null===(e=gt.current)||void 0===e||e.leave(),gt.current=null,bt.current=null,null===(n=kt.current)||void 0===n||n.getTracks().forEac
1h((function(e){return e.stop()})),kt.current=null,yt.current=[],Be(null),De(!1),te(He?"Screen share stopped. You remain connected to the host studio.":"Screen share stopped.")},Pr=function(){var e=(0,s.A)((0,o.A)().m((function e(n,r){var a,i,s,c,u,l,d,v,h,f,m,p,g,b,w=arguments;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(i=w.length>2&&void 0!==w[2]?w[2]:0,r===St.current&&"ended"!==(null===(a=n.getVideoTracks()[0])||void 0===a?void 0:a.readyState)){e.n=1;break}return e.a(2);case 1:return De(!0),e.p=2,e.n=3,J();case 3:if(s=e.v,r===St.current){e.n=4;break}return e.a(2);case 4:return bt.current=s.participant_id||null,e.n=5,t.e(89390).then(t.t.bind(t,89390,23));case 5:return c=e.v,yt.current=I(c,n,"screen"),u=new c.Stage(s.token,{stageStreamsToPublish:function(){return yt.current},shouldPublishParticipant:function(){return yt.current.length>0},shouldSubscribeToParticipant:function(){return c.SubscribeType.NONE}}),l=!1,d=function(){var e;if(gt.current===u&&r===St.current&&"ended"!==(null===(e=n.getVideoTracks()[0])||void 0===e?void 0:e.readyState)&&!xt.current){var t=Math.min(1e4,1e3*Math.pow(2,Math.min(i,3)));xt.current=window.setTimeout((function(){xt.current=null;var e=gt.current;gt.current=null,null===e||void 0===e||e.leave(),Pr(n,r,i+1)}),t),te("Screen share reconnecting in ".concat(Math.ceil(t/1e3)," seconds\u2026"))}},v=gt.current,gt.current=null,null===v||void 0===v||v.leave(),gt.current=u,u.on(c.StageEvents.STAGE_CONNECTION_STATE_CHANGED,(function(e){r===St.current&&(e===c.StageConnectionState.CONNECTED?(l=!0,De(!1),te("Screen share is live in the studio and remains active until you stop sharing.")):l&&[c.StageConnectionState.DISCONNECTED,c.StageConnectionState.ERRORED].includes(e)&&d())})),u.on(c.StageEvents.STAGE_PARTICIPANT_PUBLISH_STATE_CHANGED,(function(e,n){
1null!==e&&void 0!==e&&e.isLocal&&n===c.StageParticipantPublishState.ERRORED&&d()})),u.on(c.StageEvents.ERROR,(function(e){le((null===e||void 0===e?void 0:e.message)||"Screen sharing encountered an error. Reconnecting\u2026"),d()})),e.n=6,u.join();case 6:e.n=9;break;case 7:if(e.p=7,b=e.v,r===St.current){e.n=8;break}return e.a(2);case 8:m=Number((null===b||void 0===b||null===(h=b.response)||void 0===h?void 0:h.status)||0),p=[401,403,410,422].includes(m),"ended"===(null===(f=n.getVideoTracks()[0])||void 0===f?void 0:f.readyState)||p?(De(!1),le((null===b||void 0===b?void 0:b.message)||"Could not keep the screen share connected. Stop sharing and try again.")):(g=Math.min(1e4,1e3*Math.pow(2,Math.min(i,3))),xt.current=window.setTimeout((function(){xt.current=null,Pr(n,r,i+1)}),g),te("Screen share reconnecting in ".concat(Math.ceil(g/1e3)," seconds\u2026")));case 9:return e.a(2)}}),e,null,[[2,7]])})));return function(n,t){return e.apply(this,arguments)}}(),Or=function(){var e=(0,s.A)((0,o.A)().m((function e(){var n,t,r,a;return(0,o.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(null!==Zt&&void 0!==Zt&&Zt.getDisplayMedia&&!Le){e.n=1;break}return e.a(2);case 1:return De(!0),le(""),e.p=2,e.n=3,Zt.getDisplayMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:20,max:30}},audio:!0});case 3:if((t=e.v).getVideoTracks().length){e.n=4;break}throw new Error("The selected screen did not provide a video track.");case 4:return r=St.current+1,St.current=r,kt.current=t,Be(t),null===(n=t.getVideoTracks()[0])||void 0===n||n.addEventListener("ended",Br,{once:!0}),en((0,m.sourceIdentity)({sourceType:"screen",ownerId:L.invite_id||"local"})),Ke("screen"),e.n=5,Pr(t,r);case 5:e.n=7;break;case 6:e.p=6,a=e.v,Br(),"NotAllowedError"!==(null===a||void 0===a?void 0:a.name)&&le((null===a||void 0===a?void 0:a.message)||"Could not start screen sharing.");case 7:return e.a(2)}}),e,null,[[2,6]])})));return function(){return e.apply(this,arguments)}}(),Lr=(0,y.jsxs)("div",{className:"festival-virtual-room festival-ivs-studio",children:[(0,y.jsxs)("header",{children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{className:"festival-kicker",children:"producer"===L.role?"Amazon IVS producer console":"Amazon IVS host studio"}),(0,y.jsx)("h1",{children:"Large broadcast"}),(0,y.jsx)("p",{className:"mb-0 text-light",children:ne})]}),(0,y.jsxs)("div",{className:"festival-broadcast-header-state",children:[(0,y.jsx)("span",{className:"festival-broadcast-state ".concat(tr.className),"aria-label":"Broadcast status: ".concat(tr.label),children:tr.label}),(0,y.jsx)("span",{className:"festival-virtual-role",children:L.role})]})]}),ue&&(0,y.jsx)("div",{className:"alert alert-warning mt-3",children:ue}),yn&&"connected"!==An&&(0,y.jsxs)("div",{className:"alert alert-warning mt-3",role:"status",children:["offline"===An?"Your network is offline. Keep this studio open; reconnection will resume when the network returns.":"exhausted"===An?"Automatic reconnection paused after three attempts. Check your upload connection, then retry. Cameras and chat remain connected.":"stalled"===An?"The browser reconnect attempt is not responding. Stop the broadcast and reload this studio before restarting; your camera sources have not been removed.":"The audience connection was interrupted. Glitch is verifying production control and reconnecting this browser. Keep the studio open.","exhausted"===An&&(0,y.jsx)("button",{type:"button",onClick:function(){var e;return null===(e=Tt.current)||void 0===e?void 0:e.retry()},children:"Retry audience connection"})]}),(0,y.jsx)(f.default,{ingest:L.external_ingest,canConnectObs:er}),Xt&&(0,y.jsxs)("section",{className:"festival-ivs-director","aria-label":"Audience layout director",children:[(0,y.jsxs)("div",{className:"festival-ivs-director-heading",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("span",{className:"festival-kicker",children:"Program director"}),(0,y.jsx)("h2",{children:"Audience layout"}),(0,y.jsx)("p",{children:"Choose the main source, arrange panelists, and preview exactly what viewers receive. Multiple screen shares stay available as separate sources; only the selected one is featured."})]}),(0,y.jsxs)("div",{className:"festival-ivs-director-settings",children:[(0,y.jsxs)("label",{children:["Layout",(0,y.jsxs)("select",{value:Ge,onChange:function(e){return n=e.target.value,Ke(n),void en("");var n},children:[(0,y.jsx)("option",{value:"screen",children:"Screen + panelists"}),(0,y.jsx)("option",{value:"spotlight",children:"Speaker + panelists"}),(0,y.jsx)("option",{value:"grid",children:"Equal grid"})]})]}),(0,y.jsxs)("label",{children:["Output quality",(0,y.jsx)("select",{"aria-label":"Output quality",value:Qe,disabled:yn||nr.is_broadcasting,onChange:function(e){return $e(e.target.value)},children:Object.entries(_).map((function(e){var n=(0,u.A)(e,2),t=n[0],r=n[1];return(0,y.jsx)("option",{value:t,children:r.label},t)}))})]})]})]}),(0,y.jsx)("canvas",{ref:Et,className:"festival-ivs-program-preview",width:m.PROGRAM_WIDTH,height:m.PROGRAM_HEIGHT,"aria-label":"Audience program preview"}),(0,y.jsx)("p",{className:"festival-ivs-program-state ".concat(vn?"is-ready":""),role:"status",children:vn?"".concat(dr.length," source").concat(1===dr.length?"":"s"," in the audience preview. Layout changes are applied immediately."):"Preparing the audience program mixer\u2026"}),(0,y.jsx)("div",{className:"festival-ivs-source-list",children:sr.length?sr.map((function(e){var n=ur.includes(e.id),t=cr.indexOf(e.id),r=(0,b.sourceVideoQuality)(e);return(0,y.jsxs)("div",{role:"group","aria-label":"".concat(e.displayName," source controls"),className:"festival-ivs-source ".concat(vr===e.id?"is-featured":""," ").concat(n?"is-hidden":""),children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("strong",{children:e.displayName}),(0,y.jsx)("small",{children:"obs"===e.sourceType?"OBS / encoder":"screen"===e.sourceType?"Screen share":[e.businessTitle,e.company].filter(
1Boolean).join(" \xb7 ")||e.role}),r&&(0,y.jsxs)("small",{"aria-label":"".concat(e.displayName," source resolution"),children:["Source ",r.width," \xd7 ",r.height,r.low?" \u2014 low resolution; check the capture or sender connection":""]})]}),(0,y.jsxs)("div",{className:"festival-ivs-source-actions",children:[(0,y.jsx)("button",{type:"button",disabled:n,onClick:function(){return en((0,m.sourceIdentity)(e))},children:"Make main"}),(0,y.jsx)("button",{type:"button","aria-label":"Move ".concat(e.displayName," earlier"),disabled:t<=0,onClick:function(){return an((function(n){return B(n.filter((function(e){return sr.some((function(n){return(0,m.sourceIdentity)(n)===e}))})),(0,m.sourceIdentity)(e),-1)}))},children:"\u2191"}),(0,y.jsx)("button",{type:"button","aria-label":"Move ".concat(e.displayName," later"),disabled:t<0||t>=cr.length-1,onClick:function(){return an((function(n){return B(n.filter((function(e){return sr.some((function(n){return(0,m.sourceIdentity)(n)===e}))})),(0,m.sourceIdentity)(e),1)}))},children:"\u2193"}),(0,y.jsx)("button",{type:"button",onClick:function(){return un((function(n){return n.includes((0,m.sourceIdentity)(e))?n.filter((function(n){return n!==(0,m.sourceIdentity)(e)})):[].concat((0,l.A)(n),[(0,m.sourceIdentity)(e)])}))},children:n?"Show video":"Hide video"})]})]},e.id)})):(0,y.jsx)("p",{className:"festival-chat-empty",children:"Waiting for a camera or screen source. The broadcast cannot start with an empty program."})})]}),(0,y.jsxs)("div",{className:"festival-ivs-green-room-heading",children:[(0,y.jsx)("span",{className:"festival-kicker",children:"Green room sources"}),(0,y.jsx)("h2",{children:"Presenter cameras and screens"})]}),(0,y.jsxs)("div",{className:"festival-virtual-stage",children:[he?(0,y.jsx)(k,{label:"".concat(D," (you)"),businessTitle:ir.business_title,company:ir.company,mediaStream:he,muted:!0,sourceType:"camera"}):(0,y.jsxs)("div",{className:"festival-virtual-empty",children:[(0,y.jsx)("strong",{children:"producer"===L.role?"Producer control view":"Local preview"}),(0,y.jsx)("span",{children:"producer"===L.role?"Your camera and microphone are not published. You can monitor presenters and control the audience feed.":"Waiting for camera and microphone permission\u2026"})]}),Re&&(0,y.jsx)(k,{label:"".concat(D," \u2014 screen share"),mediaStream:Re,muted:!0,sourceType:"screen"}),Object.entries(ge).map((function(e){var n=(0,u.A)(e,2),t=n[0],r=n[1];return(0,y.jsx)(k,{label:r.displayName,businessTitle:r.businessTitle,company:r.company,mediaStream:r.mediaStream,sourceType:r.sourceType},t)}))]}),"producer"!==L.role&&(Yn.length>0||Zn.length>0)&&(0,y.jsxs)("div",{className:"festival-virtual-device-control
1s","aria-label":"Camera and microphone settings",children:[Yn.length>0&&(0,y.jsxs)("label",{htmlFor:"festival-microphone-device",children:["Microphone",(0,y.jsx)("select",{id:"festival-microphone-device",value:tt,disabled:Boolean(lt),onChange:function(e){return pr("audio",e.target.value)},children:Yn.map((function(e,n){return(0,y.jsx)("option",{value:e.deviceId,children:e.label||"Microphone ".concat(n+1)},e.deviceId)}))})]}),Zn.length>0&&(0,y.jsxs)("label",{htmlFor:"festival-camera-device",children:["Camera",(0,y.jsx)("select",{id:"festival-camera-device",value:ot,disabled:Boolean(lt),onChange:function(e){return pr("video",e.target.value)},children:Zn.map((function(e,n){return(0,y.jsx)("option",{value:e.deviceId,children:e.label||"Camera ".concat(n+1)},e.deviceId)}))})]}),lt&&(0,y.jsxs)("span",{role:"status",children:["Switching ","audio"===lt?"microphone":"camera","\u2026"]})]}),(0,y.jsxs)("div",{className:"festival-virtual-controls",children:[he&&(0,y.jsx)("button",{type:"button",onClick:function(){return Nr("audio",ke,xe)},children:ke?"Unmute microphone":"Mute microphone"}),he&&(0,y.jsx)("button",{type:"button",onClick:function(){return Nr("video",Te,je)},children:Te?"Turn camera on":"Turn camera off"}),he&&On&&(0,y.jsx)("button",{type:"button",disabled:Fn,onClick:Rr,children:Fn?"Updating background\u2026":qn?"Turn background blur off":"Blur background"}),(0,y.jsx)("button",{type:"button",disabled:Le&&!Re,onClick:Re?Br:Or,children:Re?"Stop sharing":Le?"Starting share\u2026":"Share screen"}),Xt&&!nr.is_broadcasting&&["pending","failed","processing","ready"].includes(nr.recording_status)&&"ended"!==nr.status&&(0,y.jsx)("button",{type:"button",className:"is-start",disabled:Boolean(Ee),onClick:function(){return Er(!1)},children:"starting"===Ee?"Starting broadcast\u2026":["processing","ready"].includes(nr.recording_status)?"Restart broadcast":"Start broadcast"}),Xt&&nr.is_broadcasting&&!yn&&(0,y.jsx)("button",{type:"button",className:"is-warning",disabled:Boolean(Ee),onClick:function(){return Er(!0)},children:"starting"===Ee?"Taking over production\u2026":"Resume / take over production"}),Xt&&Cn&&!nr.is_broadcasting&&(0,y.jsx)("button",{type:"button",className:"is-warning",disabled:Boolean(Ee),onClick:function(){return Er(!0)},children:"Take over production"}),Xt&&nr.is_broadcasting&&(0,y.jsx)("button",{type:"button",className:"is-danger",disabled:Boolean(Ee),onClick:_r,children:"stopping"===Ee?"Stopping broadcast\u2026":"Stop broadcast"}),!Xt&&(0,y.jsx)("span",{className:"festival-broadcast-control-note",children:"An organizer or producer controls when the audience feed starts and stops."}),(0,y.jsx)("span",{className:"festival-virtual-recording ".concat(nr.is_broadcasting?"is-recording":""),children:nr.is_broadcasting?"Recording automatically":"Recording begins with broadcast"})]}),(0,y.jsxs)("section",{className:"festival-ivs-audience-preview","aria-label":"Audience broadcast test",children:[(0,y.jsx)("h2",{children:"Audience broadcast test"}),ar?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("p",{children:"This muted player uses the same composed feed as an attendee and refreshes its private viewing token on every attempt."}),(0,y.jsx)(h.default,{playbackUrl:L.playback_url,playbackTokenProvider:Z,broadcastStatusProvider:G,muted:!0,title:"Audience broadcast test video"})]}):(0,y.jsxs)("div",{className:"festival-broadcast-off-air",children:[(0,y.jsx)("strong",{children:nr.is_broadcasting?"Waiting for the audience feed to become playable.":"Audience feed is off air."}),(0,y.jsx)("span",{children:nr.is_broadcasting?"The test player will appear automatically when IVS confirms that video is available.":"Presenters can prepare here without being shown to viewers. Start or restart the broadcast to run an audience test."})]})]}),(0,y.jsx)("p",{className:"festival-ivs-quality-note",children:"Program output: 1920 \xd7 1080, up to 30 fps. For the clearest code and slides, share the screen from the browser directing the program. Remote IVS Stage feeds retain their provider resolution limit; 1080p output cannot restore detail missing from a lower-resolution source."})]});return(0,y.jsxs)("div",{className:"festival-ivs-event-layout",children:[Lr,(0,y.jsx)(v.default,{initialToken:L.chat,tokenProvider:K,moderationProvider:W,currentRole:L.role,messageProvider:Y,historyProvi
1der:Q,deleteProvider:$},(null===(O=L.chat)||void 0===O?void 0:O.room_id)||L.session_id)]})}},62152:function(e,n,t){t.r(n);var r=t(89379),a=t(60436),i=t(91212),o=t(10467),s=t(5544),c=t(88094),u=t(26351),l=t(50182),d=t(51023),v=t(76121),h=t(16976),f=t(43991),m=(t(16519),t(15678)),p=function(e){var n;return(null===(n=e.sender)||void 0===n||null===(n=n.attributes)||void 0===n?void 0:n.displayName)||"Festival attendee"},g=function(e){var n;return(null===e||void 0===e||null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message)||(null===e||void 0===e?void 0:e.errorMessage)||(null===e||void 0===e?void 0:e.message)||"The chat request could not be completed."},b="Organizer question",w=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Object.fromEntries(e.filter((function(e){return(null===e||void 0===e?void 0:e.user_id)&&["muted","blocked"].includes(e.state)})).map((function(e){return[e.user_id,e]})))},y=function(e){return e?"muted"===e.state&&e.muted_until&&new Date(e.muted_until).getTime()<=Date.now()?null:e:null};n.default=function(e){var n=e.initialToken,t=e.tokenProvider,k=e.moderationProvider,x=e.currentRole,S=void 0===x?"attendee":x,A=e.messageProvider,T=e.historyProvider,j=e.deleteProvider,M=e.readOnly,C=void 0!==M&&M,E=(0,c.useRef)(null),_=(0,c.useRef)(new Set),N=(0,c.useRef)(null),I=(0,c.useRef)([]),R=(0,c.useRef)(new Set),B=(0,c.useRef)(new Map),P=(0,c.useRef)(!1),O=(0,c.useRef)(!0),L=(0,c.useRef)(null),D=(0,c.useRef)(n),V=(0,c.useRef)((null===n||void 0===n?void 0:n.user_id)||""),q=(0,c.useState)("connecting"),H=(0,s.A)(q,2),U=H[0],z=H[1],F=(0,c.useState)([]),G=(0,s.A)(F,2),K=G[0],W=G[1],Y=(0,c.useState)(""),Q=(0,s.A)(Y,2),$=Q[0],J=Q[1],Z=(0,c.useState)("comment"),X=(0,s.A)(Z,2),ee=X[0],ne=X[1],te=(0,c.useState)("all"),re=(0,s.A)(te,2),ae=re[0],ie=re[1],oe=(0,c.useState)(null),se=(0,s.A)(oe,2),ce=se[0],ue=se[1],le=(0,c.useState)(!1),de=(0,s.A)(le,2),ve=de[0],he=de[1],fe=(0,c.useState)(""),me=(0,s.A)(fe,2),pe=me[0],ge=me[1],be=(0,c.useState)(""),we=(0,s.A)(be,2),ye=we[0],ke=we[1],xe=(0,c.useState)({canSend:!1!==(null===n||void 0===n?void 0:n.can_send),state:(null===n||void 0===n?void 0:n.moderation_state)||"active",mutedUntil:(null===n||void 0===n?void 0:n.muted_until)||null}),Se=(0,s.A)(xe,2),Ae=Se[0],Te=Se[1],je=(0,c.useState)((function(){return w(null===n||void 0===n?void 0:n.moderated_users)})),Me=(0,s.A)(je,2),Ce=Me[0],Ee=Me[1],_e=["organizer","producer"].includes(S)&&(null===n||void 0===n?void 0:n.can_moderate),Ne=Number((null===n||void 0===n?void 0:n.maximum_message_length)||500);I.current=K;var Ie=(0,c.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(arguments.length>3&&void 0!==arguments[3]&&arguments[3])return W([]),void ue(null);t&&N.current&&(L.current={height:N.current.scrollHeight,top:N.current.scrollTop}),W((function(t){return(0,f.mergeChatMessages)(t,e,n,R.current)}))}),[]),Re=(0,c.useCallback)((function(){return I.current.filter((function(e){return e.persistent})).map((function(e){return e.id}))}),[]),Be=(0,f.default)(T,Ie,Re),Pe=Be.refresh,Oe=A?(0,h.chatPlainText)($):$.trim(),Le=A?(0,h.hasChatText)($):Boolean(Oe),De=(0,c.useCallback)((function(e){e&&!_.current.has(e.id)&&(_.current.add(e.id),_.current.size>2e3&&_.current.delete(_.current.values().next().value),R.current.has(e.id)||Ie([e]))}),[Ie]),Ve=(0,c.useCallback)((function(e){e&&(e.user_id&&(V.current=e.user_id),Te({canSend:!1!==e.can_send,state:e.moderation_state||"active",mutedUntil:e.muted_until||null}),Array.isArray(e.moderated_users)&&Ee(w(e.moderated_users)),Array.isArray(e.gameplay_messages)&&e.gameplay_messages.slice(-100).forEach((function(e){return De((0,l.gameplayDialogueMessage)(e))})))}),[De]);(0,c.useEffect)((function(){if(!C){var e=!1;Ve(D.current);var r=function(){var n=(0,o.A)((0,i.A)().m((function n(){var r,a,o;return(0,i.A)().w((function(n){for(;;)switch(n.n){case 0:if(null===(r=D.current)||void 0===r||!r.token){n.n=1;break}o=r,n.n=3;break;case 1:return n.n=2,t();case 2:o=n.v;case 3:return a=o,null!==r&&void 0!==r&&r.token&&(D.current=null),e||Ve(a),n.a(2,{token:a.token,tokenExpirationTime:a.token_expiration_time,sessionExpirationTime:a.session_expiration_time})}}),n)})));return function(){return n.apply(this,arguments)}}(),s=new u.C0({regionOrUrl:(null===n||void 0===n?void 0:n.region)||"us-east-1",tokenProvider:r,maxReconnectAttempts:5});s.logLevel="error",E.current=s;var c=[s.addListener("connecting",(function(){return!e&&z("connecting")})),s.addListener("connect",(function(){e||(z("connected"),ke(""),Pe())})),s.addListener("disconnect",(function(n){e||(z("disconnected"),"clientDisconnect"!==n&&ke("Chat disconnected. Reconnect to refresh your access."))})),s.addListener("message",(function(n){e||W((function(e){return[].concat((0,a.A)(e.f
1ilter((function(e){return e.id!==n.id})).slice(-499)),[n])}))})),s.addListener("event",(function(n){e||("glitch:chat-history-changed"!==(null===n||void 0===n?void 0:n.eventName)?De(function(e){var n=null===e||void 0===e?void 0:e.attributes;return"glitch:organizer-question"!==(null===e||void 0===e?void 0:e.eventName)||"string"!==typeof e.id||!/^[a-zA-Z0-9]{12}$/.test(e.id)||!n||"object"!==typeof n||Array.isArray(n)||"string"!==typeof n.questionId||!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n.questionId)||"string"!==typeof n.body||!n.body.trim()||Array.from(n.body).length>500||n.attribution!==b||n.displayName!==b||"organizer"!==n.role?null:{id:"organizer-question:".concat(n.questionId.toLowerCase()),organizerQuestionId:n.questionId.toLowerCase(),content:"".concat(b,": ").concat(n.body),sendTime:e.sendTime,sender:{userId:"organizer-question",attributes:{displayName:b,role:"organizer"}},attributes:{kind:"question"}}}(n)||(0,l.gameplayDialogueMessage)(n)):Pe())})),s.addListener("messageDelete",(function(n){e||Ie([],[n.messageId])})),s.addListener("userDisconnect",(function(n){if(!e){var t=n.userId&&n.userId===V.current;t&&(z("disconnected"),ke("A host changed your chat permissions. Reconnect to continue with the updated access.")),W((function(e){return[].concat((0,a.A)(e.slice(-499)),[{id:n.id||"moderation-".concat(Date.now()),content:t?"Your chat permissions were changed by a host.":"A participant\u2019s chat permissions were changed by a host.",sendTime:n.sendTime,sender:{userId:"system",attributes:{displayName:"Moderation",role:"system"}},attributes:{kind:"system"}}])}))}}))];return s.connect(),function(){e=!0,c.forEach((function(e){return e()})),s.disconnect(),E.current=null}}z("history")}),[Ve,De,null===n||void 0===n?void 0:n.region,t,C,Pe,Ie]),(0,c.useEffect)((function(){if("muted"===Ae.state&&Ae.mutedUntil){var e,n,t=new Date(Ae.mutedUntil).getTime()-Date.now();if(t<=0)return Te({canSend:!1,state:"refreshing",mutedUntil:null}),null===(e=E.current)||void 0===e||e.disconnect(),void(null===(n=E.current)||void 0===n||n.connect());var r=window.setTimeout((function(){var e,n;Te({canSend:!1,state:"refreshing",mutedUntil:null}),null===(e=E.current)||void 0===e||e.disconnect(),null===(n=E.current)||void 0===n||n.connect()}),Math.min(t+250,2147483647));return function(){return window.clearTimeout(r)}}}),[Ae.mutedUntil,Ae.state]),(0,c.useEffect)((function(){N.current&&(L.current?(N.current.scrollTop=L.current.top+N.current.scrollHeight-L.current.height,L.current=null):O.current&&(N.current.scrollTop=N.current.scrollHeight))}),[K]);var qe=(0,c.useMemo)((function(){return new Set(K.filter((function(e){var n,t;return"answer"===(null===(n=e.attributes)||void 0===n?void 0:n.kind)&&(null===(t=e.attributes)||void 0===t?void 0:t.replyTo)})).map((function(e){return e.attributes.replyTo})))}),[K]),He="questions"===ae?K.filter((function(e){var n,t;return"question"===(null===(n=e.attributes)||void 0===n?void 0:n.kind)||"answer"===(null===(t=e.attributes)||void 0===t?void 0:t.kind)})):K,Ue=Object.values(Ce).filter(y),ze=!C&&!Be.expired&&Ae.canSend&&"active"===Ae.state,Fe=function(){var e=(0,o.A)((0,i.A)().m((function e(n){var t,r,a,o,s,c,l,v,m;return(0,i.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(n.preventDefault(),t=Oe,!(!Le||Array.from(t).length>Ne||A&&$.length>8e3||!A&&"connected"!==U||P.current||ve)&&ze){e.n=1;break}return e.a(2);case 1:if(P.current=!0,he(!0),ke(""),e.p=2,r=ce?{kind:"answer",replyTo:ce.id}:{kind:ee},!A){e.n=5;break}return o=(0,h.sanitizeChatHtml)($),s=JSON.stringify([o,r.kind,r.replyTo||null]),B.current.has(s)||B.current.set(s,(0,d.A)()),e.n=3,A({body:o,format:"html",kind:r.kind,reply_to:r.replyTo||null,idempotency_key:B.current.get(s)});case 3:if(c=e.v,(0,f.isSavedChatMessage)(null===c||void 0===c?void 0:c.data)){e.n=4;break}throw new Error("Message save confirmation was invalid.");case 4:Ie([c.data]),"unconfirmed"===(null===(a=c.meta)||void 0===a?void 0:a.live_delivery)&&ke("Message saved. Live updates are delayed; it will appear when chat synchronizes."),Be.refresh(),e.n=6;break;case 5:return e.n=6,E.current.sendMessage(new u.vE(t,r));case 6:J(""),ue(null),ne("comment"),e.n=8;break;case 7:e.p=7,m=e.v,v=Number(null===m||void 0===m||null===(l=m.response)||void 0===l?void 0:l.status),ke(A&&(!v||v>=500)?"Saving could not be confirmed. Your draft is kept; retrying this same message will not create a duplicate.":g(m));case 8:return e.p=8,P.current=!1,he(!1),e.f(8);case 9:return e.a(2)}}),e,null,[[2,7,8,9]])})));return function(n){return e.apply(this,arguments)}}(),Ge=function(){var e=(0,o.A)((0,i.A)().m((function e(n){var t;return(0,i.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(_e){e.n=1;break}return e.a(2);case 1:if(e.p=1,!n.id.startsWith("chat:")||!j){e.n=3;break}return e.n=2,j(n.id.slice(5));case 2:Ie([],[n.id]),(null===ce||void 0===ce?void 0:ce.id)===n.id&&ue(null),e.n=4;break;case 3:if(!E.current){e.n=4;break}return e.n=4,E.current.deleteMessage(new u.oE(n.id,"Removed by festival host"));case 4:e.n=6;break;case 5:e.p=5,t=e.v,ke(g(t));case 6:return e.a(2)}}),e,null,[[1,5]])})));return function(n){return e.apply(this,arguments)}}(),Ke=function(){var e=(0,o.A)((0,i.A)().m((function e(n,t){var a,o,s;return(0,i.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(_e&&k&&null!==n&&void 0!==n&&n.userId&&n.userId!==V.current){e.n=1;break}return e.a(2);case 1:if(a=n.displayName||"this attendee",!["block","unblock"].includes(t)||window.confirm("".concat("block"===t?"Block":"Unblock"," ").concat(a," in this event chat?"))){e.n=2;break}return e.a(2);case 2:return ge("".concat(n.userId,":").concat(t)),ke(""),e.p=3,e.n=4,k((0,r.A)({target_user_id:n.userId,action:t},"mute"===t?{duration_minutes:15}:{}));case 4:o=e.v,Ee((function(e){var t=(0,r.A)({},e);return"active"===(null===o||void 0===o?void 0:o.state)?delete t[n.userId]:t[n.userId]=(0,r.A)((0,r.A)({},o),{},{display_name:(null===o||void 0===o?void 0:o.display_name)||a}),t})),e.n=6;break;case 5:e.p=5,s=e.v,ke(g(s));case 6:return e.p=6,ge(""),e.f(6);case 7:return e.a(2)}}),e,null,[[3,5,6,7]])})));return function(n,t){return e.apply(this,arguments)}}(),We=function(e){var n=y(Ce[e.userId]),t=pe.startsWith("".concat(e.userId,":"));return"blocked"===(null===n||void 0===n?void 0:n.state)?(0,m.jsx)("button",{type:"button",disabled:t,onClick:function(){return Ke(e,"unblock")}
1,children:t?"Updating\u2026":"Unblock"}):"muted"===(null===n||void 0===n?void 0:n.state)?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{type:"button",disabled:t,onClick:function(){return Ke(e,"unmute")},children:t?"Updating\u2026":"Unmute"}),(0,m.jsx)("button",{type:"button",disabled:t,onClick:function(){return Ke(e,"block")},children:"Block"})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{type:"button",disabled:t,onClick:function(){return Ke(e,"mute")},children:t?"Updating\u2026":"Mute 15 min"}),(0,m.jsx)("button",{type:"button",disabled:t,onClick:function(){return Ke(e,"block")},children:"Block"})]})},Ye="blocked"===Ae.state?"A host has blocked this account from sending messages in this event chat. You can continue watching the event.":"muted"===Ae.state?"A host muted this account until ".concat(new Date(Ae.mutedUntil).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),". You can continue watching the event."):"refreshing"===Ae.state?"Refreshing your chat permissions\u2026":"";return(0,m.jsxs)("aside",{className:"festival-ivs-chat","aria-label":"Festival live chat",children:[(0,m.jsxs)("header",{children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("span",{className:"festival-kicker",children:"Live conversation"}),(0,m.jsx)("h2",{children:"Chat & questions"})]}),(0,m.jsx)("span",{className:"festival-chat-state is-".concat(U),children:U})]}),(0,m.jsxs)("div",{className:"festival-chat-tabs",role:"tablist",children:[(0,m.jsx)("button",{type:"button",className:"all"===ae?"is-active":"",onClick:function(){return ie("all")},children:"All messages"}),(0,m.jsx)("button",{type:"button",className:"questions"===ae?"is-active":"",onClick:function(){return ie("questions")},children:"Questions"})]}),_e&&Ue.length>0&&(0,m.jsxs)("section",{className:"festival-chat-moderated","aria-label":"Muted and blocked attendees",children:[(0,m.jsx)("strong",{children:"Muted or blocked"}),Ue.map((function(e){return(0,m.jsxs)("div",{children:[(0,m.jsxs)("span",{children:[e.display_name||"Attendee"," \xb7 ",e.state]}),We({userId:e.user_id,displayName:e.display_name})]},e.user_id)}))]}),T&&(0,m.jsxs)("div",{className:"festival-chat-history-status",children:[Be.loading&&(0,m.jsx)("small",{role:"status",children:"Loading earlier chat\u2026"}),Be.next&&K.length<500&&(0,m.jsx)("button",{type:"button",disabled:Be.olderLoading,onClick:Be.earlier,children:Be.olderLoading?"Loading\u2026":"Load earlier messages"}),K.length>=500&&(0,m.jsx)("small",{children:"Showing up to 500 messages. Older messages remain saved."}),Be.error&&(0,m.jsxs)("div",{role:"alert",children:[Be.error," ",(0,m.jsx)("button",{type:"button",onClick:Be.refresh,children:"Retry history"})]})]}),(0,m.jsxs)("div",{className:"festival-chat-messages",ref:N,"aria-live":"polite",onScroll:function(){var e=N.current;e&&(O.current=e.scrollHeight-e.scrollTop-e.clientHeight<64)},children:[!He.length&&(0,m.jsx)("p",{className:"festival-chat-empty",children:"No messages yet. Start the conversation or ask the hosts a question."}),He.map((function(e){var n,t,r=(null===(n=e.attributes)||void 0===n?void 0:n.kind)||"comment",a=function(e){var n;return(null===(n=e.sender)||void 0===n||null===(n=n.attributes)||void 0===n?void 0:n.role)||"attendee"}(e),i="question"===r&&qe.has(e.id),o={userId:null===(t=e.sender)||void 0===t?void 0:t.userId,displayName:p(e)};return(0,m.jsxs)("article",{className:"festival-chat-message is-".concat(r),children:[(0,m.jsxs)("div",{className:"festival-chat-message-heading",children:[(0,m.jsx)("strong",{children:o.displayName}),(0,m.jsx)("span",{children:a}),"question"===r&&(0,m.jsx)("span",{className:i?"is-answered":"is-question",children:i?"Answered":"Question"})]}),"answer"===r&&(0,m.jsx)("small",{children:"Host answer"}),(0,m.jsx)(h.FestivalChatContent,{message:e}),(0,m.jsxs)("div",{className:"festival-chat-actions",children:[_e&&!C&&"question"===r&&(!A||/^(chat|gameplay|organizer-question):/.test(e.id))&&(0,m.jsx)("button",{type:"button",onClick:function(){ue(e),ne("comment")},children:"Answer"}),_e&&"system"!==a&&!e.organizerQuestionId&&!e.gameplayMessageId&&(0,m.jsx)("button",{type:"button",onClick:function(){return Ge(e)},children:"Delete"}),_e&&"attendee"===a&&!e.gameplayMessageId&&o.userId!==V.current&&We(o)]})]},e.id)}))]}),ce&&(0,m.jsxs)("div",{className:"festival-chat-replying",children:[(0,m.jsxs)("span",{children:["Answering ",p(ce),": \u201c",ce.content,"\u201d"]}),(0,m.jsx)("button",{type:"button",onClick:function(){return ue(null)},children:"Cancel"})]}),!C&&(0,m.jsxs)("form",{onSubmit:Fe,className:"festival-chat-compose",children:[Ye&&(0,m.jsx)("div",{className:"festival-chat-restr
1iction is-".concat(Ae.state),role:"status",children:Ye}),!ce&&(0,m.jsxs)("div",{className:"festival-chat-compose-mode",children:[(0,m.jsx)("button",{type:"button",disabled:!ze,className:"comment"===ee?"is-active":"",onClick:function(){return ne("comment")},children:"Comment"}),(0,m.jsx)("button",{type:"button",disabled:!ze,className:"question"===ee?"is-active":"",onClick:function(){return ne("question")},children:"Ask a question"})]}),A?(0,m.jsx)(v.default,{disabled:!ze||ve,label:ce?"Host answer":"question"===ee?"Your question":"Your comment",value:$,onChange:J,placeholder:"Join the conversation\u2026"}):(0,m.jsx)("textarea",{disabled:!ze,"aria-label":ce?"Host answer":"question"===ee?"Your question":"Your comment",maxLength:Ne,value:$,onChange:function(e){return J(e.target.value)},placeholder:ze?ce?"Write an answer\u2026":"question"===ee?"What would you like the hosts to answer?":"Join the conversation\u2026":"Chat sending is unavailable for this account."}),(0,m.jsxs)("div",{className:"festival-chat-compose-footer",children:[(0,m.jsxs)("small",{children:[Array.from(Oe).length,"/",Ne]}),(0,m.jsx)("button",{type:"submit",disabled:!A&&"connected"!==U||ve||!ze||!Le||Array.from(Oe).length>Ne||A&&$.length>8e3,children:ve?"Sending\u2026":ce?"Send answer":"question"===ee?"Ask question":"Send comment"})]})]}),"disconnected"===U&&(0,m.jsx)("button",{type:"button",className:"festival-chat-reconnect",onClick:function(){var e;return null===(e=E.current)||void 0===e?void 0:e.connect()},children:"Reconnect chat"}),ye&&(0,m.jsx)("div",{className:"festival-chat-error",role:"alert",children:ye}),(0,m.jsx)("small",{className:"festival-chat-logged",children:T?"Messages sent with this chat are saved for session participants. Hosts can remove messages.":"Messages and moderation events are logged for the event record."})]})}},49171:function(e,n,t){t.r(n);var r=t(91212),a=t(10467),i=t(5544),o=t(88094),s=t(15678);n.default=function(e){var n=e.ingest,t=e.canConnectObs,c=void 0!==t&&t,u=(0,o.useState)(""),l=(0,i.A)(u,2),d=l[0],v=l[1],h=(0,o.useState)(!1),f=(0,i.A)(h,2),m=f[0],p=f[1],g=c&&(null===n||void 0===n?void 0:n.server)&&(null===n||void 0===n?void 0:n.stream_key);(0,o.useEffect)((function(){p(!1),v("")}),[c,null===n||void 0===n?void 0:n.stream_key]);var b=function(){var e=(0,a.A)((0,r.A)().m((function e(n,t){var a;return(0,r.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null!==(a=navigator.clipboard)&&void 0!==a&&a.writeText){e.n=1;break}throw new Error("Clipboard unavailable");case 1:return e.n=2,navigator.clipboard.writeText(n);case 2:v("".concat(t," copied. Paste it into OBS Settings \u2192 Stream.")),e.n=4;break;case 3:e.p=3,e.v,v("Could not copy ".concat(t.toLowerCase(),". Select the field, copy it manually, and paste it into OBS."));case 4:return e.a(2)}}),e,null,[[0,3]])})));return function(n,t){return e.apply(this,arguments)}}();return(0,s.jsxs)("details",{className:"festival-ivs-obs",children:[(0,s.jsx)("summary",{children:"Connect OBS or a hardware encoder"}),(0,s.jsx)("p",{children:"OBS is optional. Use it to send a game, demo, or slides while your camera stays on this page. For a simple presentation, the Share screen button is enough."}),(0,s.jsxs)("ol",{className:"festival-ivs-obs-steps",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Keep your camera and voice in this studio."}),(0,s.jsx)("p",{children:"Leave this page open with your camera and microphone on, and wear headphones. In OBS, capture only the game or presentation window. Do not capture this studio page or its audio. Mute Mic/Aux in OBS if you are speaking through this page, so your voice is not sent twice. Your webcam only needs to be open in the browser."})]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Connect OBS to this session."}),(0,s.jsx)("p",{children:"Open OBS \u2192 Settings \u2192 Stream. Set Service to Custom. Paste the RTMPS server into Server and the stream key into Stream Key. Use Start Streaming, not Start Virtual Camera."}),g?(0,s.jsxs)("form",{className:"festival-ivs-obs-credentials","aria-label":"Private OBS connection",autoComplete:"off",onSubmit:function(e){return e.preventDefault()},children:[(0,s.jsx)("p",{children:"Hosts and invited panelists can use these connection details. They publish the OBS source only; an organizer or producer still controls the audience broadcast."}),(0,s.jsxs)("label",{children:["RTMPS server",(0,s.jsx)("input",{readOnly:!0,autoComplete:"username",value:n.server,onFocus:function(e){return e.target.select()}})]}),(0,s.jsx)("button",{type:"button",onClick:function(){return b(n.server,"Server")},children:"Copy server"}),(0,s.jsxs)("label",{children:["Stream key",(0,s.jsx)("input",{readOnly:!0,t
1ype:m?"text":"password",autoComplete:"off",value:n.stream_key,onFocus:function(e){return e.target.select()}})]}),(0,s.jsx)("button",{type:"button",onClick:function(){return b(n.stream_key,"Stream key")},children:"Copy stream key"}),(0,s.jsx)("button",{type:"button","aria-pressed":m,onClick:function(){return p((function(e){return!e}))},children:m?"Hide stream key":"Show stream key"}),(0,s.jsx)("p",{role:"status",children:d})]}):(0,s.jsx)("p",{className:"festival-ivs-obs-callout",children:c?"OBS connection details are not available yet. Refresh this join page after the organizer has prepared OBS for the session. If they are still missing, ask the organizer to check the session\u2019s ingest configuration.":"OBS connection access is available to hosts and invited panelists only. Ask the organizer to check your invitation if you should have panelist access."}),(0,s.jsx)("p",{children:"Keep the key private and out of screen captures or chat. Coordinate with the host: only one encoder should use this session\u2019s key at a time."})]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Apply these OBS settings."}),(0,s.jsx)("p",{children:"In Settings \u2192 Output, choose Advanced output mode. Enter the values below, then select Apply. Menu names can vary slightly by OBS version and encoder."}),(0,s.jsxs)("table",{className:"festival-ivs-obs-settings",children:[(0,s.jsx)("caption",{children:"OBS settings for this festival session"}),(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",children:"Setting"}),(0,s.jsx)("th",{scope:"col",children:"Value"})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Video \u2192 Output (Scaled) Resolution"}),(0,s.jsx)("td",{children:"1280 \xd7 720 (720p maximum)"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Video \u2192 Common FPS Values"}),(0,s.jsx)("td",{children:"30"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Output \u2192 Streaming \u2192 Video Encoder"}),(0,s.jsx)("td",{children:"H.264 with Baseline profile; use x264 if your hardware encoder cannot provide Baseline"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Rate Control / Bitrate"}),(0,s.jsx)("td",{children:"CBR / 6000 Kbps (6 Mbps). Lower to 4500 or 2500 Kbps if your upload cannot sustain it. Never exceed 8500 Kbps."})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Keyframe Interval"}),(0,s.jsx)("td",{children:"2 seconds"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Profile / B-frames"}),(0,s.jsx)("td",{children:"Baseline / 0"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Audio encoder / bitrate"}),(0,s.jsx)("td",{children:"AAC-LC / 160 Kbps or lower, on the streaming audio track"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"row",children:"Audio \u2192 Sample Rate / Channels"}),(0,s.jsx)("td",{children:"48 kHz / Stereo"})]})]})]}),(0,s.jsxs)("p",{children:["For x264: CPU Usage Preset = veryfast, Tune = zerolatency, and x264 Options = ",(0,s.jsx)("code",{children:"sliced-threads=0"}),". If you already have options there, ask the host to check them rather than replacing them blindly."]})]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Test with the host before going on air."}),(0,s.jsx)("p",{children:"Ask the host to confirm the audience is off air, then click Start Streaming in OBS. Wait for \u201cOBS production source\u201d to appear in this studio. The host should choose Screen + panelists and use Make main on OBS, then confirm the OBS picture, all intended cameras, and each audio source in the audience preview."}),(0,s.jsx)("p",{className:"festival-ivs-obs-callout",children:"If the audience broadcast is already live, starting OBS may put your picture on air immediately. The host controls the public broadcast; stopping OBS only stops your OBS source. Stop Streaming in OBS when the host says your session is finished."}),(0,s.jsx)("p",{children:"The OBS input is limited to 720p. The browser composes it with the cameras into a 1920 \xd7 1080 audience output; this does not turn the OBS source into native 1080p."}),(0,s.jsx)("p",{children:"Can OBS send 1080p? Yes, but this session\u2019s Amazon IVS Stage input cannot accept it. A direct-to-channel 1080p stream uses a different c
1onnection and bypasses this studio\u2019s camera composition. Keep this OBS output at 720p to retain the host and panelist cameras; the host can select High clarity (1080p) for the composed audience output."})]})]}),(0,s.jsxs)("details",{children:[(0,s.jsx)("summary",{children:"Troubleshooting: no picture, blurry video, or echo"}),(0,s.jsxs)("ul",{children:[(0,s.jsx)("li",{children:"No picture: check OBS says it is streaming, verify the session\u2019s server/key with the host, and make sure no other encoder is using the same key."}),(0,s.jsx)("li",{children:"Picture missing from the audience preview: ask the host to use Show video, then Make main on the OBS source."}),(0,s.jsx)("li",{children:"Blurry or stuttering: check OBS\u2019s dropped-frame counter and network connection; lower the bitrate if needed, keep output at 720p, and make small slide text larger. Do not switch output quality during the public broadcast."}),(0,s.jsx)("li",{children:"Echo or doubled voice: use headphones, mute your duplicate microphone in OBS, and exclude studio/browser audio from OBS capture."}),(0,s.jsx)("li",{children:"Reconnecting: keep the same server/key, let OBS reconnect, and ask the host to confirm the source and cameras before continuing. A deliberately hidden source stays hidden until Show video is selected."})]})]})]})}},76121:function(e,n,t){t.r(n),t.d(n,{default:function(){return u}});var r=t(5544),a=t(88094),i=t(16976),o=(t(45037),t(15678)),s={toolbar:[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],["link","clean"]]},c=["bold","italic","underline","list","link"];function u(e){var n=e.value,u=e.onChange,l=e.disabled,d=e.label,v=e.placeholder,h=(0,a.useState)(null),f=(0,r.A)(h,2),m=f[0],p=f[1],g=(0,a.useState)(!1),b=(0,r.A)(g,2),w=b[0],y=b[1],k=(0,a.useRef)(null);return(0,a.useEffect)((function(){var e=!0;return Promise.all([t.e(37334),t.e(95981)]).then(t.bind(t,95981)).then((function(n){e&&p((function(){return n.default}))})).catch((function(){e&&y(!0)})),function(){e=!1}}),[]),(0,a.useEffect)((function(){var e,n,t=null===(e=k.current)||void 0===e||null===(n=e.getEditor)||void 0===n?void 0:n.call(e).root;t&&(t.setAttribute("role","textbox"),t.setAttribute("aria-label",d),t.setAttribute("aria-multiline","true"),t.setAttribute("aria-disabled",String(Boolean(l))))}),[m,d,l]),m?(0,o.jsx)("div",{className:"festival-chat-editor",children:(0,o.jsx)(m,{ref:k,theme:"snow",value:n,onChange:u,readOnly:l,placeholder:v,modules:s,formats:c,useSemanticHTML:!0})}):(0,o.jsxs)("div",{children:[(0,o.jsx)("textarea",{"aria-label":d,disabled:l,value:(0,i.chatPlainText)(n),placeholder:v,onChange:function(e){var n=e.target.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>");u("<p>".concat(n,"</p>"))}}),(0,o.jsx)("small",{role:"status",children:w?"Formatting could not load. Plain text is still available.":"Loading formatting\u2026"})]})}},49875:function(e,n,t){t.r(n),t.d(n,{MAX_PROGRAM_SOURCES:function(){return s},PROGRAM_HEIGHT:function(){return o},PROGRAM_WIDTH:function(){return i},buildProgramLayout:function(){return v},createProgramLowerThird:function(){return m},drawProgramLowerThirds:function(){return f},isPresentationSource:function(){return u},sourceDetails:function(){return p},sourceIdentity:function(){return l}});var r=t(60436),a=t(89379),i=1920,o=1080,s=12,c=function(e,n,t){return Math.max(n,Math.min(t,e))},u=function(e){return["screen","obs"].includes(null===e||void 0===e?void 0:e.sourceType)},l=function(e){return"".concat(e.sourceType,":").concat(e.ownerId||e.id)},d=function(e,n){var t=n.x,r=n.y,a=n.width,i=n.height,o=Math.max(1,Math.floor(Number(a)||1)),s=Math.max(1,Math.floor(Number(i)||1)),u=function(e){var n,t,r,a=Number(null===e||void 0===e?void 0:e.aspectRatio);if(Number.isFinite(a)&&a>0)return c(a,.2,5);var i=null===e||void 0===e||null===(n=e.mediaStream)||void 0===n||null===(t=n.getVideoTracks)||void 0===t?void 0:t.call(n).find((function(e){return"ended"!==e.readyState})),o=(null===i||void 0===i||null===(r=i.getSettings)||void 0===r?void 0:r.call(i))||{},s=Number(o.width),u=Number(o.height),l=Number(o.aspectRatio);return s>0&&u>0?c(s/u,.2,5):Number.isFinite(l)&&l>0?c(l,.2,5):16/9}(e),l=o,d=s;return u>o/s?d=Math.max(1,Math.round(o/u)):l=Math.max(1,Math.round(s*u)),{x:Math.max(0,Math.floor(Number(t)||0)+Math.floor((o-l)/2)),y:Math.max(0,Math.floor(Number(r)||0)+Math.floor((s-d)/2)),width:l,height:d}},v=function(e){var n=e.sources,t=void 0===n?[]:n,c=e.order,l=void 0===c?[]:c,v=e.hiddenIds,h=void 0===v?[]:v,f=e.mode,m=void 0===f?"screen":f,p=e.featuredId,g=void 0===p?null:p,b=e.width,w=void 0===b?i:b,y=e.height,k=void 0===y?o:y,x=new Set(h),S=new Map(t.filter((function(e){return null===e||void 0===e?void 0:e.id})).map((function(e){return[e.id,e]}))),A=[].concat((0,r.A)(l.map((function(e){return S.get(e)}
1)).filter(Boolean)),(0,r.A)(t.filter((function(e){return!l.includes(e.id)})))).filter((function(e){var n,t;return!x.has(e.id)&&(null===(n=e.mediaStream)||void 0===n||null===(t=n.getVideoTracks)||void 0===t?void 0:t.call(n).some((function(e){return"ended"!==e.readyState})))}));if(!A.length)return[];var T=A.find((function(e){return"obs"===e.sourceType}))||A.find(u),j=A.some((function(e){return e.id===g}))?g:"screen"===m&&T?T.id:A[0].id,M=A.find((function(e){return e.id===j})),C="grid"===m?A.slice(0,s):M?[M].concat((0,r.A)(A.filter((function(e){return e.id!==M.id})))).slice(0,s):A.slice(0,s);return"grid"===m?function(e,n,t){var r=Math.max(1,e.length),i=1===r?1:r<=4?2:3,o=Math.ceil(r/i),s=Math.floor((n-12*(i-1))/i),c=Math.floor((t-12*(o-1))/o);return e.map((function(e,n){return{source:e,composition:(0,a.A)({index:n+1},d(e,{x:n%i*(s+12),y:Math.floor(n/i)*(c+12),width:s,height:c}))}}))}(C,w,k):function(e,n,t,r){var i=e.find((function(e){return e.id===n}))||e[0];if(!i)return[];var o=e.filter((function(e){return e.id!==i.id})),s=[{source:i,composition:(0,a.A)({index:1},d(i,{x:0,y:0,width:t,height:r}))}];if(!o.length)return s;var c=Math.min(3,o.length),u=Math.ceil(o.length/c),l=r-36-10*(c-1),v=t-36-10*(u-1),h=Math.min(280,Math.floor(v/Math.max(u,1))),f=Math.max(144,16*Math.floor(h/16)),m=Math.max(81,Math.min(Math.round(9*f/16),Math.floor(l/Math.max(c,1))));return o.forEach((function(e,n){return s.push({source:e,composition:(0,a.A)({index:n+2},d(e,{x:t-18-(Math.floor(n/c)+1)*f-10*Math.floor(n/c),y:r-18-(n%c+1)*m-n%c*10,width:f,height:m}))})})),s}(C,j,w,k)},h=function(e,n,t,r,a,i){var o=c(i,0,Math.min(r,a)/2);e.beginPath(),"function"===typeof e.roundRect?e.roundRect(n,t,r,a,o):(e.moveTo(n+o,t),e.lineTo(n+r-o,t),e.quadraticCurveTo(n+r,t,n+r,t+o),e.lineTo(n+r,t+a-o),e.quadraticCurveTo(n+r,t+a,n+r-o,t+a),e.lineTo(n+o,t+a),e.quadraticCurveTo(n,t+a,n,t+a-o),e.lineTo(n,t+o),e.quadraticCurveTo(n,t,n+o,t)),e.fill()},f=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o;if(e){e.width=t,e.height=r;var a=e.getContext("2d");a&&(a.clearRect(0,0,t,r),n.filter((function(e){var n=e.source;return!u(n)})).forEach((function(e){var n=e.source,t=e.composition,r=String(n.displayName||"Panelist").trim(),i=t.width>=150&&t.height>=70?[n.businessTitle,n.company].filter(Boolean).join(" \xb7 "):"",o=c(Math.min(t.width/640,t.height/360),.3,1),s=Math.max(4,Math.round(14*o)),u=Math.max(8,Math.round(24*o)),l=Math.max(7,Math.round(15*o));a.font="700 ".concat(u,"px Arial, sans-serif");var d=a.measureText(r).width;a.font="500 ".concat(l,"px Arial, sans-serif");var v=i?a.measureText(i).width:0,f=Math.max(2,Math.round(8*o)),m=Math.max(1,Math.min(Math.max(1,t.width-2*f),Math.max(d,v)+2*s)),p=Math.max(1,Math.min(Math.max(1,t.height-2*f),i?Math.round(72*o):Math.round(48*o))),g=Math.max(t.x,t.x+t.width-m-f),b=Math.max(t.y,t.y+t.height-p-f);a.fillStyle="rgba(5, 8, 18, .82)",h(a,g,b,m,p,Math.round(10*o)),a.textBaseline="top",a.fillStyle="#ffffff",a.font="700 ".concat(u,"px Arial, sans-serif"),a.fillText(r,g+s,b+Math.round(9*o),m-2*s),i&&(a.fillStyle="#b9b2ff",a.font="500 ".concat(l,"px Arial, sans-serif"),a.fillText(i,g+s,b+Math.round(40*o),m-2*s))})))}},m=function(e){var n=e.source,t=e.composition;if(!n||u(n)||"undefined"===typeof document)return null;var r=String(n.displayName||"Panelist").trim(),a=t.width>=150&&t.height>=70?[n.businessTitle,n.company].filter(Boolean).join(" \xb7 "):"",i=c(Math.min(t.width/640,t.height/360),.3,1),o=Math.max(4,Math.round(14*i)),s=Math.max(8,Math.round(24*i)),l=Math.max(7,Math.round(15*i)),d=Math.max(2,Math.round(8*i)),v=document.createElement("canvas"),f=v.getContext("2d");if(!f)return null;f.font="700 ".concat(s,"px Arial, sans-serif");var m=f.measureText(r).width;f.font="500 ".concat(l,"px Arial, sans-serif");var p=a?f.measureText(a).width:0;return v.width=Math.max(1,Math.ceil(Math.min(Math.max(1,t.width-2*d),Math.max(m,p)+2*o))),v.height=Math.max(1,Math.min(Math.max(1,t.height-2*d),Math.round((a?72:48)*i))),f.fillStyle="rgba(5, 8, 18, .86)",h(f,0,0,v.width,v.height,Math.round(10*i)),f.textBaseline="top",f.fillStyle="#ffffff",f.font="700 ".concat(s,"px Arial, sans-serif"),f.fillText(r,o,Math.round(9*i),v.
1width-2*o),a&&(f.fillStyle="#b9b2ff",f.font="500 ".concat(l,"px Arial, sans-serif"),f.fillText(a,o,Math.round(40*i),v.width-2*o)),{canvas:v,composition:{index:100+t.index,x:Math.max(t.x,t.x+t.width-v.width-d),y:Math.max(t.y,t.y+t.height-v.height-d),width:v.width,height:v.height}}},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.attributes||{},t="obs"===n.sourceType||String(e.userId||"").startsWith("obs-");return{displayName:n.displayName||e.userId||"Panelist",businessTitle:n.businessTitle||"",company:n.company||"",sourceType:t?"obs":"screen"===n.sourceType||"true"===n["screen-share"]?"screen":"camera",ownerId:n.inviteId||e.userId||e.id,role:n.role||"presenter"}}},38166:function(e,n,t){t.r(n),t.d(n,{createProgramMedia:function(){return r}});var r=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=[],r=!1,a=function(){r||t.forEach((function(e){var t=e.original;e.clone.enabled=!n&&t.enabled&&!t.muted&&"ended"!==t.readyState}))},i=function(){r||(r=!0,t.forEach((function(e){var n=e.original,t=e.clone;["mute","unmute","ended"].forEach((function(e){var t;return null===(t=n.removeEventListener)||void 0===t?void 0:t.call(n,e,a)})),t.stop()})))};try{return e.forEach((function(e){var n=e.clone();t.push({original:e,clone:n}),["mute","unmute","ended"].forEach((function(n){var t;return null===(t=e.addEventListener)||void 0===t?void 0:t.call(e,n,a)}))})),a(),{stream:new MediaStream(t.map((function(e){return e.clone}))),sync:a,dispose:i,setMuted:function(e){n=e,a()}}}catch(o){throw i(),o}}},96583:function(e,n,t){t.r(n),t.d(n,{createProgramRecovery:function(){return c}});var r=t(91212),a=t(10467),i=new Set([401,403,404,409,410,422]),o=new Set(["connected","completed"]),s=new Set(["failed","closed","disconnected"]),c=function(e){var n=e.client,t=e.verifyControl,c=e.onState,u=e.onControlLost,l=null,d=0,v=!1,h=null,f=!1,m=0,p=null,g=null,b=!1,w="connected",y=!1,k="idle",x=function(e){k=e,c(e,m)},S=function(){window.clearTimeout(h),h=null},A=function(){return y||b||s.has(w)},T=function(){d+=1,l=null,S(),p=null,g=null,k="idle"},j=function(){T();try{n.stopBroadcast()}catch(e){}u()},M=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3;!l||v||h||f||"exhausted"===k||(h=window.setTimeout((function(){h=null,E()}),e))},C=function(){!l||v||f||(A()?(g=null,null===p&&(p=Date.now()),"exhausted"!==k&&x(!1===navigator.onLine?"offline":"reconnecting"),M()):(p=null,S(),null===g&&(g=Date.now()),Date.now()-g>=6e4&&(m=0),x("connected")))},E=function(){var e=(0,a.A)((0,r.A)().m((function e(){var a,s,c,u,h,g,k,S,T,C,E,_,N,I;return(0,r.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(l&&!v&&!f&&A()){e.n=1;break}return e.a(2);case 1:if(!1!==navigator.onLine){e.n=2;break}return x("offline"),M(),e.a(2);case 2:if(!(Date.now()-p<3e4)){e.n=3;break}return M(),e.a(2);case 3:if(!(m>=3)){e.n=4;break}return x("exhausted"),e.a(2);case 4:return a=d,s=function(){return!v&&l&&a===d},f=!0,h=!1,e.p=5,e.n=6,Promise.race([t(),new Promise((function(e,n){c=window.setTimeout((function(){return n(new Error("Control check timed out"))}),12e3)}))]);case 6:if(S=e.v,window.clearTimeout(c),s()){e.n=7;break}return e.a(2);case 7:if(!1!==(null===S||void 0===S?void 0:S.is_broadcasting)){e.n=8;break}return j(),e.a(2);case 8:if(S&&!0===S.is_broadcasting&&!1!==S.stream_state_known){e.n=9;break}return x("verifying"),e.a(2);case 9:if(!S.is_live||!o.has(w)||y){e.n=10;break}return b=!1,p=null,x("connected"),e.a(2);case 10:if(T=l.stream_key,C=l.ingest_endpoint,m+=1,x("restarting"),u=window.setTimeout((function(){if(s()){h=!0;try{n.stopBroadcast()}catch(e){}x("stalled")}}),3e4),n.stopBroadcast(),"suspended"!==(null===(E=null===(g=n.getAudioContext)||void 0===g?void 0:g.call(n))||void 0===E?void 0:E.state)){e.n=11;break}return e.n=11,E.resume();case 11:if(s()){e.n=12;break}return e.a(2);case 12:if(!h){e.n=13;break}throw new Error("Audio resumption timed out");case 13:return e.n=14,n.startBroadcast(T,C);case 14:if(_=e.v,window.clearTimeout(u),s()){e.n=15;break}try{n.stopBroadcast()}catch(r){}return e.a(2);case 15:if(!h){e.n=16;break}try{n.stopBroadcast()}catch(r){}throw new Error("Publisher reconnection timed out");case 16:if(!(_ instanceof Error)){e.n=17;break}throw _;case 17:w=(null===(k=n.getConnectionState)||void 0===k?void 0:k.call(n))||"connected",y=!1,b=!1,p=null,x("connected"),e.n=21;break;case 18:if(e.p=18,I=e.v,s()){e.n=19;break}return e.a(2);case 19:if(!i.has(Number(null===I||void 0===I||null===(N=I.response)||void 0===N?void 0:N.status))){e.n=20;break}return j(),e.a(2);case 20:x(m>=3?"exhausted":"verifying");case 21:return e.p=21,window.clearTimeout(c),window.clearTimeout(u),f=!1,s()&&A()&&M(1e4),e.f(21);case 22:return e.a(2)}}),e,null,[[5,18,21,22]])})));return function(){return e.apply(this,arguments)}}
1(),_=function(){l&&A()&&(S(),M(0))};return window.addEventListener("online",_),document.addEventListener("visibilitychange",_),{activate:function(e){var t;T(),l=e,m=0,b=!1,y=!1,w=(null===(t=n.getConnectionState)||void 0===t?void 0:t.call(n))||"connected",x("connected"),C()},deactivate:T,connectionChanged:function(e){w=e,C()},activeChanged:function(e){y=!e,C()},observeStatus:function(e){l&&e&&(!1!==e.is_broadcasting?(!1!==e.stream_state_known&&"boolean"===typeof e.is_live&&(b=!e.is_live),C()):j())},retry:function(){l&&!f&&(m=0,k="reconnecting",p=Date.now()-3e4,M(0))},isBusy:function(){return f},dispose:function(){T(),v=!0,window.removeEventListener("online",_),document.removeEventListener("visibilitychange",_)}}}},49298:function(e,n,t){t.r(n),t.d(n,{sourceVideoQuality:function(){return r}});var r=function(e){var n,t,r,a=null===e||void 0===e||null===(n=e.mediaStream)||void 0===n||null===(t=n.getVideoTracks)||void 0===t?void 0:t.call(n).find((function(e){return"ended"!==e.readyState})),i=(null===a||void 0===a||null===(r=a.getSettings)||void 0===r?void 0:r.call(a))||{},o=Number(i.width),s=Number(i.height);return!Number.isFinite(o)||!Number.isFinite(s)||o<=0||s<=0?null:{width:Math.round(o),height:Math.round(s),low:Math.min(o,s)<480}}},33178:function(e,n,t){t.r(n),t.d(n,{canUseSoftwareBackgroundBlur:function(){return s},createSoftwareBackgroundBlur:function(){return c}});var r=t(91212),a=t(60436),i=t(10467),o=function(e){return new Promise((function(n,t){if(e.readyState>=2&&e.videoWidth&&e.videoHeight)n();else{var r=window.setTimeout((function(){a(),t(new Error("The camera did not become ready for background blur."))}),5e3),a=function(){window.clearTimeout(r),e.removeEventListener("loadeddata",i),e.removeEventListener("error",o)},i=function(){a(),n()},o=function(){a(),t(new Error("The camera could not be read for background blur."))};e.addEventListener("loadeddata",i,{once:!0}),e.addEventListener("error",o,{once:!0})}}))},s=function(){return"undefined"!==typeof document&&"undefined"!==typeof window&&"function"===typeof window.requestAnimationFrame&&"function"===typeof window.Worker&&"function"===typeof window.OffscreenCanvas&&"function"===typeof window.createImageBitmap&&"undefined"!==typeof HTMLCanvasElement&&"function"===typeof HTMLCanvasElement.prototype.captureStream},c=function(){var e=(0,i.A)((0,r.A)().m((function e(n){var i,c,u,l,d,v,h,f,m,p,g,b,w,y,k,x,S,A,T,j,M,C,E,_,N,I,R,B,P,O,L,D,V,q,H,U,z,F,G,K,W,Y,Q,$,J,Z,X,ee,ne,te=arguments;return(0,r.A)().w((function(e){for(;;)switch(e.n){case 0:if(l=(te.length>1&&void 0!==te[1]?te[1]:{}).onError,(d=null===n||void 0===n||null===(i=n.getVideoTracks)||void 0===i?void 0:i.call(n)[0])&&s()){e.n=1;break}throw new Error("Software background blur is unavailable in this browser.");case 1:return(v=document.createElement("video")).autoplay=!0,v.muted=!0,v.playsInline=!0,v.srcObject=new MediaStream([d]),e.n=2,v.play();case 2:return e.n=3,o(v);case 3:if(h=(null===(c=d.getSettings)||void 0===c?void 0:c.call(d))||{},f=v.videoWidth||h.width||1280,m=v.videoHeight||h.height||720,p=Math.min(1,1280/f,720/m),g=Math.max(1,Math.round(f*p)),b=Math.max(1,Math.round(m*p)),w=document.createElement("canvas"),y=document.createElement("canvas"),k=document.createElement("canvas"),x=document.createElement("canvas"),[w,y,k].forEach((function(e){e.width=g,e.height=b})),S=Math.min(1,320/g,180/b),x.width=Math.max(1,Math.round(g*S)),x.height=Math.max(1,Math.round(b*S)),A=w.getContext("2d"),T=y.getContext("2d"),j=k.getContext("2d"),M=x.getContext("2d"),A&&T&&j&&M){e.n=4;break}throw new Error("The browser could not create the background blur canvas.");case 4:return C=Math.min(30,Math.max(15,Number(h.frameRate)||24)),E=Math.max(14,Math.round(.025*Math.min(g,b))),e.n=5,t.e(7116).then(t.bind(t,7116));case 5:return _=e.v,N=_.createCameraBackgroundBlurWorker,I=N(),R=null,B=null,P=null,O=!1,L=!1,D=!1,V=!0,q=!1,H=!0,U=!1,z=-1/0,F=Date.now(),G=null,e.n=6,new Promise((function(e,n){var t=window.setTimeout((function(){return n(new Error("Background blur took too long to initialize."))}),15e3),r=function(e){window.clearTimeout(t),n(e instanceof Error?e:new Error((null===e||void 0===e?void 0:e.message)||"Backgroun
1d blur could not initialize."))};I.onerror=r,I.onmessage=function(n){var a=n.data;"ready"===(null===a||void 0===a?void 0:a.type)?(window.clearTimeout(t),e()):"error"===(null===a||void 0===a?void 0:a.type)&&r(new Error(a.message))},I.postMessage({type:"initialize",wasmUrl:"https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm",modelUrl:"https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter/float16/1/selfie_segmenter.tflite"})})).catch((function(e){throw I.terminate(),v.pause(),v.srcObject=null,e}));case 6:if(K=function(e){O||("function"===typeof v.requestVideoFrameCallback?B=v.requestVideoFrameCallback(e):R=window.requestAnimationFrame(e))},W=function(){A.clearRect(0,0,g,b),A.drawImage(v,0,0,g,b)},Y=function(){j.save(),j.clearRect(0,0,g,b),j.filter="blur(".concat(E,"px)"),j.drawImage(v,2*-E,2*-E,g+4*E,b+4*E),j.restore()},Q=function(e){var n,t;H&&(H=!1,L=!1,D=!1,q=!1,window.clearTimeout(P),P=null,null===(n=G)||void 0===n||null===(t=n.close)||void 0===t||t.call(n),G=null,I.terminate(),null===l||void 0===l||l(e||"Background blur stopped processing. Camera video remains available without blur."))}
1,I.onerror=function(){return Q("Background blur stopped processing. Camera video remains available without blur.")},I.onmessage=function(e){var n,t,r=e.data;if("error"!==(null===r||void 0===r?void 0:r.type)){if("result"===(null===r||void 0===r?void 0:r.type)){var a,i;if(window.clearTimeout(P),P=null,L=!1,U=!0,O||!V||!r.maskBitmap)return null===(a=r.maskBitmap)||void 0===a||null===(i=a.close)||void 0===i||i.call(a),void(q=!1);null===(n=G)||void 0===n||null===(t=n.close)||void 0===t||t.call(n),G=r.maskBitmap,q=!0,Y()}}else Q(r.message)},$=function(){T.clearRect(0,0,g,b),T.drawImage(v,0,0,g,b),V&&q&&H?(T.save(),T.globalCompositeOperation="destination-in",T.drawImage(G,0,0,g,b),T.restore(),A.clearRect(0,0,g,b),A.drawImage(k,0,0),A.drawImage(y,0,0)):W()},J=function(e){if(!O)if("ended"!==d.readyState){try{$(),F=Date.now(),V&&H&&!L&&!D&&e-z>=125&&(D=!0,z=e,M.clearRect(0,0,x.width,x.height),M.drawImage(v,0,0,x.width,x.height),window.createImageBitmap(x).then((function(n){var t;(D=!1,!O&&V&&H)?(L=!0,P=window.setTimeout((function(){Q("Backgroun
1d blur became unresponsive. Camera video has recovered without blur.")}),U?2500:15e3),I.postMessage({type:"segment",bitmap:n,timestamp:e},[n])):null===(t=n.close)||void 0===t||t.call(n)})).catch((function(){return Q("Background blur could not read the camera frame. Camera video remains available without blur.")})))}catch(n){Q((null===n||void 0===n?void 0:n.message)||"Background blur stopped rendering. Camera video is being restored.")}K(J)}else Q("The camera ended while background blur was active. Camera video is being restored.")},Z=w.captureStream(C),X=Z.getVideoTracks()[0]){e.n=7;break}throw I.terminate(),new Error("The browser could not publish the blurred camera output.");case 7:return X.contentHint="motion",W(),K(J),ee=window.setInterval((function(){O||!V||!d.enabled||"undefined"!==typeof document&&"hidden"===document.visibilityState||Date.now()-F>4e3&&Q("Background blur stopped producing video. Camera video is being restored without blur.")}),1e3),ne=new MediaStream([X].concat((0,a.A)((null===(u=n.getAudioTracks)||void 0===u?void 0:u.call(n))||[]))),e.a(2,{stream:ne,setEnabled:function(e){var n,t;(V=Boolean(e))||(q=!1,null===(n=G)||void 0===n||null===(t=n.close)||void 0===t||t.call(n),G=null,W());return V&&H},retire:function(){var e,n;V=!1,q=!1,null===(e=G)||void 0===e||null===(n=e.close)||void 0===n||n.call(e),G=null,W()},stop:function(){var e,n,t;if(!O){O=!0,null!==R&&window.cancelAnimationFrame(R),null!==B&&(null===(e=v.cancelVideoFrameCallback)||void 0===e||e.call(v,B)),window.clearInterval(ee),window.clearTimeout(P),null===(n=G)||void 0===n||null===(t=n.close)||void 0===t||t.call(n);try{I.postMessage({type:"dispose"})}catch(r){}I.terminate(),Z.getVideoTracks().forEach((function(e){return e.stop()})),v.pause(),v.srcObject=null}}})}}),e)})));return function(n){return e.apply(this,arguments)}}()},50182:function(e,n,t){t.r(n),t.d(n,{gameplayDialogueMessage:function(){return a}});var r=function(e){return"string"===typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)};function a(e){var n=null===e||void 0===e?void 0:e.attributes;return"glitch:gameplay-dialogue"!==(null===e||void 0===e?void 0:e.eventName)||"string"!==typeof e.id||!/^[a-zA-Z0-9]{12}$/.test(e.id)||!n||"object"!==typeof n||Array.isArray(n)||!r(n.messageId)||!r(n.characterId)||"string"!==typeof n.displayName||!n.displayName.trim()||Array.from(n.displayName).length>80||"string"!==typeof n.body||!n.body.trim()||Array.from(n.body).length>500||!["comment","question"].includes(n.kind)?null:{id:"gameplay:".concat(n.messageId.toLowerCase()),gameplayMessageId:n.messageId.toLowerCase(),content:n.body,sendTime:e.sendTime,sender:{userId:"gameplay:".concat(n.characterId.toLowerCase()),attributes:{displayName:n.displayName,role:"attendee"}},attributes:{kind:n.kind}}}},43991:function(e,n,t){t.r(n),t.d(n,{default:function(){return l},isSavedChatMessage:function(){return c},mergeChatMessages:function(){return u}});var r=t(91212),a=t(89379),i=t(10467),o=t(5544),s=t(88094),c=function(e){var n;return Boolean(e&&"string"===typeof e.id&&/^(chat|gameplay|organizer-question):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e.id)&&"string"===typeof e.sendTime&&Number.isFinite(Date.parse(e.sendTime))&&"string"===typeof e.content&&e.content.length<=12e3&&e.sender&&"string"===typeof e.sender.userId&&"string"===typeof(null===(n=e.sender.attributes)||void 0===n?void 0:n.displayName))};function u(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set;t.forEach((function(e){return r.add(e)})),n.filter((function(e){return null===e||void 0===e?void 0:e.deleted})).forEach((function(e){return r.add(e.id)}));var a=new Map(e.map((function(e){return[e.id,e]})));return n.forEach((function(e){null!==e&&void 0!==e&&e.id&&!r.has(e.id)&&a.set(e.id,e)})),r.forEach((function(e){return a.delete(e)})),Array.from(a.values()).sort((function(e,n){return(Date.parse(e.sendTime)||0)-(Date.parse(n.sendTime)||0)||e.id.localeCompare(n.id)})).slice(-500)}
1function l(e,n,t){var u=(0,s.useState)({loading:Boolean(e),error:"",next:null}),l=(0,o.A)(u,2),d=l[0],v=l[1],h=(0,s.useRef)((function(){})),f=(0,s.useRef)(null),m=(0,s.useRef)(t);m.current=t,(0,s.useEffect)((function(){if(e){var t,o,s=!0,u=!1,l=!1,d=!1,p=!1;f.current=null,v({loading:!0,error:"",next:null});var g=function(){var h=(0,i.A)((0,r.A)().m((function i(){var h,b,w,y,k,x,S=arguments;return(0,r.A)().w((function(r){for(;;)switch(r.p=r.n){case 0:if(h=S.length>0&&void 0!==S[0]&&S[0],s&&!d){r.n=1;break}return r.a(2);case 1:if(!u){r.n=2;break}return l=!0,r.a(2);case 2:return u=!0,clearTimeout(o),t=new AbortController,h&&v((function(e){return(0,a.A)((0,a.A)({},e),{},{olderLoading:!0})})),r.p=3,r.n=4,e((0,a.A)({limit:100,known_ids:m.current().slice(-500)},h&&f.current?{before:f.current}:{}),t.signal);case 4:if(b=r.v,s){r.n=5;break}return r.a(2);case 5:if(Array.isArray(null===b||void 0===b?void 0:b.data)&&b.meta&&Array.isArray(b.deleted_ids)&&!b.data.some((function(e){return!c(e)}))){r.n=6;break}throw new Error("Invalid chat history response.");case 6:n(b.data.map((function(e){return(0,a.A)((0,a.A)({},e),{},{persistent:!0})})),b.deleted_ids,h),h&&(p=!0),(h||null===f.current||!f.current&&!p)&&(f.current=b.meta.next_cursor||""),v({loading:!1,olderLoading:!1,error:"",next:f.current}),r.n=9;break;case 7:if(r.p=7,x=r.v,s&&!t.signal.aborted){r.n=8;break}return r.a(2);case 8:(d=[401,403,404,410].includes(Number(null===x||void 0===x||null===(w=x.response)||void 0===w?void 0:w.status)))&&n([],[],!1,!0),v((function(e){return(0,a.A)((0,a.A)({},e),{},{loading:!1,olderLoading:!1,expired:d,error:d?"Chat access expired. Reopen your personal session link.":"Chat history could not refresh. Your existing messages have been kept."})}));case 9:return r.p=9,u=!1,s&&!d&&(y=l?500:5e3,l=!1,k=function(){"hidden"===document.visibilityState?o=setTimeout(k,5e3):g()},o=setTimeout(k,y)),r.f(9);case 10:return r.a(2)}}),i,null,[[3,7,9,10]])})));return function(){return h.apply(this,arguments)}}(),b=function(){return g()},w=function(){"hidden"!==document.visibilityState&&g()};return h.current=g,g(),window.addEventListener("focus",b),document.addEventListener("visibilitychange",w),function(){var e;s=!1,null===(e=t)||void 0===e||e.abort(),clearTimeout(o),window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",w)}}}),[e,n]);var p=(0,s.useCallback)((function(){return h.current()}),[]),g=(0,s.useCallback)((function(){return h.current(!0)}),[]);return(0,a.A)((0,a.A)({},d),{},{refresh:p,earlier:g})}}}]);

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.