PageSourceSearch

https://hoshino-supika.com/assets/LiveScreenRoute-BYdAhXX1.js

js hoshino-supika.com collected 2026-10-06 20:13:51 UTC 87,069 bytes, 1 lines download raw bytes

1import{j as p,r}from"./vendor-react-CYOoHjOf.js";import{aa as $t,ab as Gt,ck as ie,i as Z,a as A,dE as F,hM as Se,cs as Yt,cP as J,ct as Pe,a1 as pe,cl as Je,i6 as Ze,i7 as Kt,t as De,c1 as O,i8 as lt,i9 as et,hN as Xt,ci as ds,ia as zt,ib as Jt,ic as Ne,id as hs,ie as Zt,cm as Be,ig as en,ih as tn,ii as nn,ij as sn,ik as ut,dS as rn,dT as on,il as dt,im as an,bh as Ve,hZ as Ee,c$ as Ie,hV as cn,io as be,ip as ln,iq as he,hO as tt,ir as ce,is as un,it as dn,di as fs,iu as nt,iv as hn,iw as ps,cy as ms,dU as fn,dV as pn,ix as st,iy as mn,iz as gn,iA as yn,iB as vn,iC as fe,iD as it,iE as En,iF as Tn,iG as Sn,iH as Cn,iI as ke,iJ as Tt,iK as Le,iL as rt,cJ as wn,iM as _n,b1 as ot,cN as An,hP as gs,v as bt,cW as Te,h as ys,hS as vs,iN as Es,hQ as Ts,hR as Ss,hT as Cs,ad as ws,h_ as _s,i2 as As,dg as xt,iO as Rs,iP as bs,dh as Ft,df as ks,cD as Ps}from"./index-NXCSpy0w.js";import{a as Is,q as Ls,r as Ds,s as Ns,t as Os,b as xs,c as Rn,d as Fs,e as Us,S as Vs,P as Bs,C as Ms,E as Ws,D as qs,f as Hs,V as Qs,g as js,h as $s,u as Gs,i as Ys,j as Ks,k as Xs,l as zs,m as Js,n as gt,o as Zs,p as ei}from"./useVideoPlayerTheaterMode-CXdPHN_Z.js";import{p as ht,i as ft,e as $e,r as we,a as Me,b as Re,d as Ge,N as ti,Y as bn,c as ni,o as Ut,s as Ye,f as Vt}from"./vendor-player-BtQHyDif.js";import{j as se}from"./vendor-redux-BXotTMQH.js";import{O as kn}from"./OpgDetailPage-DxDfUVeJ.js";import{a4 as kt,c as Pn,d as si,N as qe,a5 as In,L as Pt,$ as ii,B as Ln,a6 as ri,V as at,s as Dn,t as Nn,w as On,x as xn,z as Fn,D as Un,H as Vn,I as Bn,_ as oi,i as ai,h as ci,l as li,E as ui,v as di,y as hi,G as fi,F as pi}from"./VideoDescription-Wb6JO055.js";import{aH as Mn,aI as Wn,aX as qn,b8 as mi}from"./vendor-mui-A_M4pNO3.js";import{N as Hn}from"./NotFoundPage-BLHUzByv.js";import{S as Qn}from"./HTMLContentsDisplay-BJfEUeJb.js";import{u as gi}from"./useCheckSiteChPlus-CNRu1Wck.js";import{u as jn}from"./usePutLastAccessContents-C1fqCmqV.js";import{d as $n}from"./index-Daw7e3xZ.js";import"./vendor-lodash-Cp5T_Ztg.js";import"./vendor-axios-BLlBCaos.js";import"./vendor-auth-DXBuXNeD.js";import"./vendor-motion-CwbUqb9k.js";import"./CommentReportDialog-CuLZnCDP.js";import"./Twitter-DC-VjNX0.js";import"./copy-clipboard-BDVZ9-in.js";import"./FormikTextField-wLZ9yJXR.js";import"./CustomBottomSheetDialog-DUE4nJPO.js";import"./CustomMuiChip-L0C1e7hp.js";import"./time.helper-BtM-HQXt.js";import"./useCheckTagVideoFreePeriods-BMUkKEV9.js";import"./audio.helpers-Ddwb7324.js";import"./icon-performance-plan-DzgpeXs8.js";import"./video.constants-J-tbtlUE.js";import"./constants-B7vMyeIK.js";import"./currency-XkooOLiu.js";import"./vendor-hls-DoT4zlwA.js";const Bt="NetworkError",ct={container:`${Bt}-container`,networkError:`${Bt}-networkError`},yi=Mn("div")(({theme:n})=>({[`&.${ct.container}`]:{position:"relative",paddingBottom:"56.25%",backgroundColor:n.palette.common.black},[`& .${ct.networkError}`]:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:n.palette.common.white,textAlign:"center",[n.breakpoints.down("lg")]:{width:"80%","& p":{whiteSpace:"initial"}}}})),Gn=()=>p.jsx(yi,{className:ct.container,children:p.jsx("div",{className:ct.networkError,children:p.jsx(Wn,{variant:"body1",color:"inherit",noWrap:!0,children:"ネットワークが不安定です。ページをリロードしてください。"})})}),vi=({thumbnailUrl:n})=>p.jsx($t,{src:n,block:!0,aspectRatio:Gt.SIXTEEN_TO_NINE}),Yn=r.memo(vi),Ei=({videoPage:n,setAllowInitPlayerStatus:e,handleReloadPlayer:t})=>{const{contentCode:s}=r.useContext(ie),i=Z(),o=A(v=>v.videoPage.sessionConfigLive),c=A(v=>v.videoPage.sessionConfigDvr),a=A(v=>v.videoPage.liveType),l=A(v=>v.videoPage.videoPage?.video?.allowDvrFlg),f=r.useRef(0),d=r.useRef(!1),u=o?.expires||c?.expires,m=u?new Date(u).getTime():0,S=a===F.CURRENT||n?.isFinishedAndAllowConvertToVod,g=r.useCallback(()=>{const v=new Date().getTime();o&&v>m&&S&&t()},[m,t,S,o]),y=r.useCallback(v=>{i(Se({contentCode:s,type:v})).then(se).then(()=>{e("ALLOWED")}).catch(E=>{e(Yt(E))})},[s,i,e]);r.useEffect(()=>{const v=n?.isFinishedAndAllowConvertToVod??!1,E=!(l&&v);a===F.FINISHED&&E&&e("ALLOWED")},[l,a,e,n?.isFinishedAndAllowConvertToVod]),r.useEffect(()=>{!S||!n||d.current||(d.current=!0,n.isFinishedAndAllowConvertToVod?y(J.DVR):y(J.LIVE))},[s,i,y,S,n]),r.useEffect(()=>(f.current&&window.clearInterval(f.current),S&&(f.current=window.setInterval(()=>{g()},Pe.OTHER)),()=>{f.current&&window.clearInterval(f.current)}),[S,g,i])},Ti=(n,e)=>{if(e){const t=n.filter(s=>s.elapsedEndedTime>e);return t.length?t.map(s=>({inPos:s.elapsedStartedTime<e?0:s.elapsedStartedTime-e,outPos:s.elapsedEndedTime-e})):[]}return n.length?n.map(t=>({inPos:t.elapsedStartedTime,outPos:t.elapsedEndedTime})):[]},Si=(n,e)=>(n.length?!n[n.length-1].endAt:e)?[kt.ALL_USERS_ACCESS]:[],Ci=(n,e)=>n.length?n.map(t=>({inPos:pe(t.startedAt).getTime()/1e3,outPos:t.endAt?pe(t.endAt).getTime()/1e3:void 0})):e?[kt.ALL_USERS_ACCESS]:[],wi=(n,e)=>
1{const{videoDeliveryTarget:t,videoFreePeriods:s,startWithFreePartFlg:i,isFinishedAndAllowConvertToVod:o}=n;return{freeRanges:r.useMemo(()=>typeof e!="number"?[]:t.id===Je.ALL_USERS?[kt.ALL_USERS_ACCESS]:o?Ti(s,e):n.video&&!n.video.allowDvrFlg?Si(s,i):Ci(s,i),[t.id,o,n.video,s,i,e])}},_i=n=>{const e=Z(),t=ht(),s=r.useCallback((c,a)=>{const l=Ze();l&&e(Kt({contentCode:n,fanclubMemberId:l,data:{videoQuestionnaire:{id:c},videoQuestionnaireOption:{id:a}}})).then(se).catch(f=>De({error:f,dispatch:e}))},[n,e]);return{handleSurveyAnswer:r.useCallback((c,a,l)=>{const{currentAnswerIndex:f,isDvrMode:d}=O.getState().videoPage,u=Ze();f!==null&&f!==-1||d||!u||(e(lt(l)),s(c,a))},[e,s]),handleLiveStreamModeChange:(c,a)=>{const l=c?J.LIVE:J.DVR;e(et(!c)),e(Se({contentCode:n,type:l,needUpdate:!1})).then(se).then(f=>{t(ft.UpdateStreamUrl,{streamUrl:a(f),sourceType:l})})}}},Ai=(n,e,t,s,i,o)=>{const c=qn(),{liveType:a,isFinishedWhenReceivingEventWS:l}=A(m=>m.videoPage),f=r.useMemo(()=>pe(n.liveStartedAt).getTime(),[n.liveStartedAt]),d=()=>{window.location.reload()};return{playerProps:r.useMemo(()=>{if(!n)return null;const m=Xt(n.thumbnailUrl),S={userData:{type:e},freeRanges:t,surveys:s,liveStartTime:n.isFinishedAndAllowConvertToVod?void 0:f,posterUrl:m,coverImageUrl:m,finishLiveBannerUrl:m||ds,setting:{canShowComment:n.commentSetting.isShowCommentsInPlayer},themeMode:c.palette.mode};if(n.isFinishedAndAllowConvertToVod&&o){const v={mediaType:$e.VOD,streamUrl:o};return{...S,...v}}const g=n.video?.playerParameters?.liveSyncDurationCount;if(n.video?.allowDvrFlg&&i){const v={mediaType:$e.DVR,streamUrls:{dvr:o,live:i},hlsConfig:{liveSyncDurationCount:g}};return{...S,...v}}const y={mediaType:$e.LIVE,streamUrl:i,hlsConfig:{liveSyncDurationCount:g}};return a===F.FINISHED&&(y.liveStartTime=void 0),l&&n.allowConvertToVod&&(S.onReloadAfterLiveEnd=d),{...S,...y}},[t,s,l,f,a,o,i,c.palette.mode,e,n])}},Ri=n=>{const e=A(c=>c.videoPage.sessionConfigLive),t=A(c=>c.videoPage.sessionConfigDvr),s=r.useCallback(c=>!c||!n.videoStream?.authenticatedUrl?"":`${n.videoStream?.authenticatedUrl.replace("{session_id}",`${c}`)}`,[n.videoStream?.authenticatedUrl]),{streamUrlLive:i,streamUrlDvr:o}=r.useMemo(()=>({streamUrlLive:s(e?.id),streamUrlDvr:s(t?.id)}),[s,t?.id,e?.id]);return{getStreamUrl:s,streamUrlLive:i,streamUrlDvr:o}},bi=(n,e)=>{const{contentCode:t,fanclubMemberId:s}=r.useContext(ie),i=Z(),o=ht(),c=A(l=>l.videoPage.liveType),a=r.useMemo(()=>{if(typeof e!="number")return[];const l=e*1e3,f=n.isFinishedAndAllowConvertToVod?n.videoQuestionnaires.filter(u=>l?u.elapsedShowTime>=l:u.elapsedShowTime):n.videoQuestionnaires,d=u=>{if(u)return(u-l)/1e3};return f.reduce((u,m)=>(u.push({id:m.id,inPos:d(m.elapsedShowTime),resultPos:d(m.elapsedDeadlineTime),outPos:d(m.elapsedHideResultTime),content:m.question,choices:m.videoQuestionnaireOptions?.map(S=>({id:S.id,text:S.text,percent:zt(S.videoQuestionnaireResult?.percentage)}))?.sort((S,g)=>S.id-g.id)}),u),[])},[e,n.isFinishedAndAllowConvertToVod,n.videoQuestionnaires]);return r.useEffect(()=>{t&&s&&c===F.CURRENT&&(o(we.Set,{surveys:[]}),i(Jt({contentCode:t,fanclubMemberId:s})).then(se).then(l=>{const f=new Map(l.map(u=>[u.videoQuestionnaire.id,u])),d=a.map(u=>{const m=f.get(u.id);return m?{...u,selectedIndex:u.choices.findIndex(S=>S.id===m.videoQuestionnaireOption.id)}:u});o(we.Set,{surveys:d})}).catch(()=>{o(we.Set,{surveys:a})}))},[t,i,o,s,c]),r.useEffect(()=>{if(a.length<=0||e===void 0)return;const l=a[a.length-1];i(Ne({question:l.content,videoQuestionnaireId:l.id,videoQuestionnaireOptions:l.choices.map(({id:f,text:d})=>({id:f,text:d})),inPos:(l.inPos||0)-e,isVoting:!l.resultPos}))},[i,e,a]),{surveys:a}},Kn=()=>{r.useEffect(()=>{try{if(typeof navigator>"u"||!("mediaSession"in navigator))return;navigator.mediaSession.setPositionState({duration:0}),navigator.mediaSession.setActionHandler("seekto",()=>{}),navigator.mediaSession.setActionHandler("seekbackward",()=>{}),navigator.mediaSession.setActionHandler("seekforward",()=>{})}catch(n){console.error(n)}return()=>{try{typeof navigator<"u"&&"mediaSession"in navigator&&navigator.mediaSession.setPositionState({})}catch(n){console.error(n)}}},[])},ki=({userData:n,videoPage:e,setIsOpenBillingPlansDialog:t})=>{const{contentCode:s}=r.useContext(ie),i=Z(),{mediaInstance:o}=Me();Is(),Kn();const c=A(E=>E.videoPage.isFreePartOpen),a=Ls(e),{getStreamUrl:l,streamUrlLive:f,streamUrlDvr:d}=Ri(e),{freeRanges:u}=wi(e,a),{surveys:m}=bi(e,a),{handleGetVideoComments:S}=Pn(e),{playerProps:g}=Ai(e,n,u,m,f,d),{handleLiveStreamModeChange:y,handleSurveyAnswer:v}=_i(s);return si(g?.mediaType===$e.VOD?qe.VOD:qe.LIVE,o?.videoElement),Re(Ge.LiveStreamModeChange,({isLive:E})=>{y(E,l);const U=In();U&&(U.customData.streamType=E?qe.LIVE:qe.DVR)},[l]),Re(Ge.PlayerStateChange,({playerState:E})=>{E===ti.READY&&i(hs(!0))}),Re(we.Answer,({currentSurvey:E,selectedIndex:U})=>{v(E.id,E.choices[U].id,U)}),Re(ft.ClickPlanBanner,()=>{bn(),t(!0)}),Re(Ge.Seeked,()=>{if(!o)return;const E=o.getCurrentTime();E===void 0||!e.isFinishedAndAllowConvertToVod&&Math.floor(E)===Math.floor(o.getDuration())||S({startTime:E+a,needClearComments:!0,resetOldestStatus:!0,needGetAdminComments:!0,isLive:!0})},[o,S,e.isFinishedAndAllowConvertToVod]),r.useEffect(()=>{const L=Zt(()=>!!o?.getCurrentTime(),()=>{i(nn(!0))},tn,sn);return()=>{L&&clearTimeout(L)}},[i,o]),r.useEffect(()=>{const E=n===Be.FREE,U=!(e.videoDeliveryTarget.id===Je.ALL_USERS||c&&E||!E);i(en(U))},[i,c,n,e.videoDeliveryTarget.id]),r.useEffect(()=>{e.isFinishedAndAllowConvertToVod&&i(et(!0))},[i,e.isFinishedAndAllowConvertToVod]),r.useEffect(()=>{e.isFinishedAndAllowConvertToVod&&S({needGetAdminComments:!0,isLive:!0,startTime:a,resetOldestStatus:!0})},[S,a,e.isFinishedAndAllowConvertToVod]),g?p.jsx("div",{className:ii,children:p.jsx(ni,{...g})}):p.jsx(Pt,{})},Pi=r.memo(ki),Ii=({...n})=>{const[e,t]=r.useState("PENDING");return Ei({...n,setAllowInitPlayerStatus:t}),e==="PENDING"?null:e==="NOT_ALLOWED"?p.jsx(Ln,{thumbnailUrl:n.videoPage.thumbnailUrl}):p.jsx(Pi,{...n})},Li=r.memo(Ii),Di=({...n})=>{const e=A(s=>s.videoPage.countConnectWsFail);return A(s=>s.videoPage.liveType)===F.SCHEDULED?p.jsx(Yn,{thumbnailUrl:n.videoPage.thumbnailUrl}):e===ut?p.jsx(Gn,{}):p.jsx(Li,{...n})},Ni=r.memo(Di),Oi=n=>{const{fanclubMemberId:e,contentCode:t}=r.useContext(ie),{mediaInstance:s}=Me(),i=Z(),o=A(d=>!!d.videoPage.audienceToken),c=A(d=>d.videoPage.logEvents),a=A(d=>d.videoPage.videoPage),l=r.useRef(0),f=r.useCallback((d,u)=>{n&&o&&c?.length&&i(rn({Data:{fanclubMemberId:e||0,contentCode:t,currentTime:Math.floor(d),memberType:e?n:Be.GUEST,videoType:u,category:on.LIVE_LOG,data:c},PartitionKey:new Date().getMilliseconds().toString()})).finally(()=>{i(dt(null))})},[t,i,e,o,c,n]);r.useEffect(()=>(l.current&&window.clearInterval(l.current),s&&(l.current=window.setInterval(()=>{a?.videoType&&f(s.getCurrentTime(),a.videoType)},Pe.OTHER)),()=>{l.current&&window.clearInterval(l.current)}),[f,s,a?.videoType])},ge=Object.create(null);ge.open="0";ge.close="1";ge.ping="2";ge.pong="3";ge.message="4";ge.upgrade="5";ge.noop="6";
vendor: 6,012 bytes, line 1
1const Ke=Object.create(null);Object.keys(ge).forEach(n=>{Ke[ge[n]]=n});const St={type:"error",data:"parser error"},Xn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",zn=typeof ArrayBuffer=="function",Jn=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,It=({type:n,data:e},t,s)=>Xn&&e instanceof Blob?t?s(e):Mt(e,s):zn&&(e instanceof ArrayBuffer||Jn(e))?t?s(e):Mt(new Blob([e]),s):s(ge[n]+(e||"")),Mt=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function Wt(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let yt;function xi(n,e){if(Xn&&n.data instanceof Blob)return n.data.arrayBuffer().then(Wt).then(e);if(zn&&(n.data instanceof ArrayBuffer||Jn(n.data)))return e(Wt(n.data));It(n,!1,t=>{yt||(yt=new TextEncoder),e(yt.encode(t))})}const qt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<qt.length;n++)Fe[qt.charCodeAt(n)]=n;const Fi=n=>{let e=n.length*.75,t=n.length,s,i=0,o,c,a,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const f=new ArrayBuffer(e),d=new Uint8Array(f);for(s=0;s<t;s+=4)o=Fe[n.charCodeAt(s)],c=Fe[n.charCodeAt(s+1)],a=Fe[n.charCodeAt(s+2)],l=Fe[n.charCodeAt(s+3)],d[i++]=o<<2|c>>4,d[i++]=(c&15)<<4|a>>2,d[i++]=(a&3)<<6|l&63;return f},Ui=typeof ArrayBuffer=="function",Lt=(n,e)=>{if(typeof n!="string")return{type:"message",data:Zn(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Vi(n.substring(1),e)}:Ke[t]?n.length>1?{type:Ke[t],data:n.substring(1)}:{type:Ke[t]}:St},Vi=(n,e)=>{if(Ui){const t=Fi(n);return Zn(t,e)}else return{base64:!0,data:n}},Zn=(n,e)=>e==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,es="�",Bi=(n,e)=>{const t=n.length,s=new Array(t);let i=0;n.forEach((o,c)=>{It(o,!1,a=>{s[c]=a,++i===t&&e(s.join(es))})})},Mi=(n,e)=>{const t=n.split(es),s=[];for(let i=0;i<t.length;i++){const o=Lt(t[i],e);if(s.push(o),o.type==="error")break}return s};function Wi(){return new TransformStream({transform(n,e){xi(n,t=>{const s=t.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,s)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let vt;function He(n){return n.reduce((e,t)=>e+t.length,0)}function Qe(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)t[i]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function qi(n,e){vt||(vt=new TextDecoder);const t=[];let s=0,i=-1,o=!1;return new TransformStream({transform(c,a){for(t.push(c);;){if(s===0){if(He(t)<1)break;const l=Qe(t,1);o=(l[0]&128)===128,i=l[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(He(t)<2)break;const l=Qe(t,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),s=3}else if(s===2){if(He(t)<8)break;const l=Qe(t,8),f=new DataView(l.buffer,l.byteOffset,l.length),d=f.getUint32(0);if(d>Math.pow(2,21)-1){a.enqueue(St);break}i=d*Math.pow(2,32)+f.getUint32(4),s=3}else{if(He(t)<i)break;const l=Qe(t,i);a.enqueue(Lt(o?l:vt.decode(l),e)),s=0}if(i===0||i>n){a.enqueue(St);break}}}})}const ts=4;function $(n){if(n)return Hi(n)}function Hi(n){for(var e in $.prototype)n[e]=$.prototype[e];return n}$.prototype.on=$.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};$.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+n],this};$.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};$.prototype.hasListeners=function(n){return!!this.listeners(n).length};const pt=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),le=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qi="arraybuffer";function ns(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const ji=le.setTimeout,$i=le.clearTimeout;function mt(n,e){e.useNativeTimers?(n.setTimeoutFn=ji.bind(le),n.clearTimeoutFn=$i.bind(le)):(n.setTimeoutFn=le.setTimeout.bind(le),n.clearTimeoutFn=le.clearTimeout.bind(le))}const Gi=1.33;function Yi(n){return typeof n=="string"?Ki(n):Math.ceil((n.byteLength||n.size)*Gi)}function Ki(n){let e=0,t=0;for(let s=0,i=n.length;s<i;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function ss(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Xi(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function zi(n){let e={},t=n.split("&");for(let s=0,i=t.length;s<i;s++){let o=t[s].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}
vendor: 5,546 bytes, line 1
1class Ji extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Dt extends ${constructor(e){super(),this.writable=!1,mt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new Ji(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Lt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Xi(e);return t.length?"?"+t:""}}class Zi extends Dt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Mi(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Bi(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=ss()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let is=!1;try{is=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const er=is;function tr(){}class nr extends Zi{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class me extends ${constructor(e,t,s){super(),this.createRequest=e,mt(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=ns(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=me.requestsCount++,me.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=tr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete me.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}me.requestsCount=0;me.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ht);else if(typeof addEventListener=="function"){const n="onpagehide"in le?"pagehide":"unload";addEventListener(n,Ht,!1)}}function Ht(){for(let n in me.requests)me.requests.hasOwnProperty(n)&&me.requests[n].abort()}const sr=(function(){const n=rs({xdomain:!1});return n&&n.responseType!==null})();class ir extends nr{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=sr&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new me(rs,this.uri(),e)}}function rs(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||er))return new XMLHttpRequest}catch{}
vendor: 28,161 bytes, line 1
1if(!e)try{return new le[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const os=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class rr extends Dt{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=os?{}:ns(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;It(s,this.supportsBinary,o=>{try{this.doWrite(s,o)}catch{}i&&pt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ss()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Et=le.WebSocket||le.MozWebSocket;class or extends rr{createSocket(e,t,s){return os?new Et(e,t,s):t?new Et(e,t):new Et(e)}doWrite(e,t){this.ws.send(t)}}class ar extends Dt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=qi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Wi();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{s.read().then(({done:a,value:l})=>{a||(this.onPacket(l),o())}).catch(a=>{})};o();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&pt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const cr={websocket:or,webtransport:ar,polling:ir},lr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ur=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ct(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let i=lr.exec(n||""),o={},c=14;for(;c--;)o[ur[c]]=i[c]||"";return t!=-1&&s!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=dr(o,o.path),o.queryKey=hr(o,o.query),o}function dr(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function hr(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,o){i&&(t[i]=o)}),t}const wt=typeof addEventListener=="function"&&typeof removeEventListener=="function",Xe=[];wt&&addEventListener("offline",()=>{Xe.forEach(n=>n())},!1);class Ae extends ${constructor(e,t){if(super(),this.binaryType=Qi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=Ct(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=Ct(t.host).host);mt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zi(this.opts.query)),wt&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Xe.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ts,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ae.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Ae.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(t+=Yi(i)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,pt(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,i){if(typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const o={type:e,data:t,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Ae.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),wt&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Xe.indexOf(this._offlineEventListener);s!==-1&&Xe.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Ae.protocol=ts;class fr extends Ae{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;Ae.priorWebsocketSuccess=!1;const i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!s)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ae.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=t.name,this.emitReserved("upgradeError",m)}}))};function o(){s||(s=!0,d(),t.close(),t=null)}const c=u=>{const m=new Error("probe error: "+u);m.transport=t.name,o(),this.emitReserved("upgradeError",m)};function a(){c("transport closed")}function l(){c("socket closed")}function f(u){t&&u.name!==t.name&&o()}const d=()=>{t.removeListener("open",i),t.removeListener("error",c),t.removeListener("close",a),this.off("close",l),this.off("upgrading",f)};t.once("open",i),t.once("error",c),t.once("close",a),this.once("close",l),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let pr=class extends fr{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>cr[i]).filter(i=>!!i)),super(e,s)}};function mr(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=Ct(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const o=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+o+":"+s.port+e,s.href=s.protocol+"://"+o+(t&&t.port===s.port?"":":"+s.port),s}const gr=typeof ArrayBuffer=="function",yr=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,as=Object.prototype.toString,vr=typeof Blob=="function"||typeof Blob<"u"&&as.call(Blob)==="[object BlobConstructor]",Er=typeof File=="function"||typeof File<"u"&&as.call(File)==="[object FileConstructor]";function Nt(n){return gr&&(n instanceof ArrayBuffer||yr(n))||vr&&n instanceof Blob||Er&&n instanceof File}function ze(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(ze(n[t]))return!0;return!1}if(Nt(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return ze(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&ze(n[t]))return!0;return!1}function Tr(n){const e=[],t=n.data,s=n;return s.data=_t(t,e),s.attachments=e.length,{packet:s,buffers:e}}function _t(n,e){if(!n)return n;if(Nt(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=_t(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=_t(n[s],e));return t}return n}function Sr(n,e){return n.data=At(n.data,e),delete n.attachments,n}function At(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=At(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=At(n[t],e));return n}const Cr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var I;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(I||(I={}));class wr{constructor(e){this.replacer=e}encode(e){return(e.type===I.EVENT||e.type===I.ACK)&&ze(e)?this.encodeAsBinary({type:e.type===I.EVENT?I.BINARY_EVENT:I.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===I.BINARY_EVENT||e.type===I.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Tr(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}}class Ot extends ${constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===I.BINARY_EVENT;s||t.type===I.BINARY_ACK?(t.type=s?I.EVENT:I.ACK,this.reconstructor=new _r(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Nt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(I[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===I.BINARY_EVENT||s.type===I.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const c=e.substring(o,t);if(c!=Number(c)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(c)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(o,t)}else s.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const o=t+1;for(;++t;){const c=e.charAt(t);if(c==null||Number(c)!=c){--t;break}if(t===e.length)break}s.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(Ot.isPayloadValid(s.type,o))s.data=o;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case I.CONNECT:return Qt(t);case I.DISCONNECT:return t===void 0;case I.CONNECT_ERROR:return typeof t=="string"||Qt(t);case I.EVENT:case I.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Cr.indexOf(t[0])===-1);case I.ACK:case I.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class _r{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Sr(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Qt(n){return Object.prototype.toString.call(n)==="[object Object]"}const Ar=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ot,Encoder:wr,get PacketType(){return I}},Symbol.toStringTag,{value:"Module"}));function ue(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Rr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class cs extends ${constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ue(e,"open",this.onopen.bind(this)),ue(e,"packet",this.onpacket.bind(this)),ue(e,"error",this.onerror.bind(this)),ue(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,o;if(Rr.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const c={type:I.EVENT,data:t};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const d=this.ids++,u=t.pop();this._registerAckCallback(d,u),c.id=d}const a=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,l=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,t){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},i),c=(...a)=>{this.io.clearTimeoutFn(o),t.apply(this,a)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...t){return new Promise((s,i)=>{const o=(c,a)=>c?i(c):s(a);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...o)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:I.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case I.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case I.EVENT:case I.BINARY_EVENT:this.onevent(e);break;case I.ACK:case I.BINARY_ACK:this.onack(e);break;case I.DISCONNECT:this.ondisconnect();break;case I.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...i){s||(s=!0,t.packet({type:I.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:I.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function Oe(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Oe.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};Oe.prototype.reset=function(){this.attempts=0};Oe.prototype.setMin=function(n){this.ms=n};Oe.prototype.setMax=function(n){this.max=n};Oe.prototype.setJitter=function(n){this.jitter=n};class Rt extends ${constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,mt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Oe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Ar;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new pr(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=ue(t,"open",function(){s.onopen(),e&&e()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},c=ue(t,"error",o);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ue(e,"ping",this.onping.bind(this)),ue(e,"data",this.ondata.bind(this)),ue(e,"error",this.onerror.bind(this)),ue(e,"close",this.onclose.bind(this)),ue(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){pt(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new cs(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;
1s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const xe={};function Ue(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=mr(n,e.path||"/socket.io"),s=t.source,i=t.id,o=t.path,c=xe[i]&&o in xe[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let l;return a?l=new Rt(s,e):(xe[i]||(xe[i]=new Rt(s,e)),l=xe[i]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Ue,{Manager:Rt,Socket:cs,io:Ue,connect:Ue});const br=()=>{const n=ht(),e=Z(),{mediaInstance:t}=Me(),{contentCode:s}=r.useContext(ie),i=r.useRef(t),o=r.useRef(0),c=r.useRef(!1),a=r.useCallback(()=>{o.current&&window.clearTimeout(o.current);const f=an(nt.MAX_SECOND,nt.MIN_SECOND);o.current=window.setTimeout(()=>{e(Ve(s))},f)},[s,e]),l=r.useCallback(f=>{const d=Ee(f),u=d.payload.type,m=i.current?.getDuration()||0,S=()=>{const y=typeof d.endTimeInSeconds=="number"?d.endTimeInSeconds-1:null,v=Ds({...d,endTimeInSeconds:y},{vpos:m,priority:!0});n(Ye.CloseAdmin,{closedAt:m}),n(Ye.AddAdmin,{adminComments:v})},g=y=>{e(dt({logEvent:hn.FREE_PERIOD,logType:y,playbackTime:Math.floor(m),executionTime:new Date().toISOString()}))};if(d.type===Ie.QUESTIONAIRE){const y=O.getState().videoPage.videoPage?.liveStartedAt,v=cn(d.createdAt,y);switch(u){case be.POST_QUESTIONS:{const E=d.payload,U=E.videoQuestionnaireOptions.sort((L,M)=>L.id-M.id);n(we.Add,{survey:{id:E.videoQuestionnaireId,inPos:v,content:E.question,choices:U}}),e(Ne({question:E.question,videoQuestionnaireId:E.videoQuestionnaireId,videoQuestionnaireOptions:U,inPos:v,isVoting:!0}));break}case be.RESULT:{e(lt(ri.UNSELECTED_CHOICE_INDEX));const{currentQuestionnaire:E}=O.getState().videoPage,U=d.payload;n(we.Close,void 0),n(we.Add,{survey:{id:U.videoQuestionnaireId,inPos:E?.inPos,resultPos:v,content:U.videoQuestionnaireQuestion||E?.question||"",choices:E?.videoQuestionnaireOptions.map(L=>{const M=U.videoQuestionnaireResults.find(j=>j.id===L.id);return M?{...L,percent:ln(M.percentage)}:{...L,percent:0}})||[]}});break}case be.HIDE_RESULT:{e(Ne(null)),n(we.Close,void 0);break}}}if(d.type===Ie.ANNOUCEMENT)switch(d.message&&S(),u){case he.START:{a();break}case he.FINISH:case he.FORCE_STOP:{const y=i.current?.getDuration()||0;!c.current&&i.current?.getIsOnLiveEdge()&&(c.current=!0,In()?.sendEnd()),n(ft.FinishLive,{isFinishLiveWithBanner:!O.getState().videoPage.videoPage?.allowConvertToVod}),e(un(!0)),e(dn(F.FINISHED)),y>fs&&O.getState().videoPage.videoPage?.allowConvertToVod&&window.location.reload();break}case he.START_FREE_RANGE:{e(tt(!0)),g(ce.RECEIVE_START_FREE_WS),g(ce.BEFORE_START_FREE_PLAYER),n(Ut.Add,{freeRange:{inPos:pe(d.payload.startedAt).getTime()/1e3}}),g(ce.AFTER_START_FREE_PLAYER);break}case he.END_FREE_RANGE:{const{liveType:y}=O.getState().videoPage;if(y===F.FINISHED)return;e(tt(!1)),g(ce.RECEIVE_END_FREE_WS),g(ce.BEFORE_END_FREE_PLAYER),n(Ut.Close,void 0),g(ce.AFTER_END_FREE_PLAYER);break}}if(d.type===Ie.DISMISS){const y=d.payload.operatorBroadcastId;n(Ye.CloseAdmin,{id:y,closedAt:m})}},[e,n,a]);return r.useEffect(()=>{i.current=t},[t]),r.useEffect(()=>{c.current=!1},[s]),r.useEffect(()=>()=>{o.current&&window.clearTimeout(o.current)},[]),{onBroadcastReceived:l}},kr=()=>{const{token:n}=r.useContext(ie).commentInformation,e=ps(n),t=ht(),s=Z(),{mediaInstance:i}=Me(),o=r.useRef(i),c=r.useCallback(a=>{const l=Ee(a),f=O.getState().siteNgUser.entities,d=O.getState().memberNgUser.entities,u=l.senderId===e,m=l.priority,S=Ns(l.createdAt),g=l.senderId in d,y=l.senderId in f,v=l.playbackTime>(o.current?.getDuration()||0)+ms;if(u||s(fn(!0)),y||m||v)return;const E=Os(l);E.vpos=S,E.hideOnPlayer=g,u||(s(pn(1)),t(Ye.Add,{comments:E}))},[s,t,e]);return r.useEffect(()=>{o.current=i},[i]),{onChatMessageReceived:c}},Pr=({handleReloadPlayer:n,handleReconnectWs:e,isReconnectWs:t,setIsReconnectWs:s})=>{const{mediaInstance:i}
1=Me(),{commentInformation:{token:o,groupId:c}}=r.useContext(ie),a=Z(),l=A(P=>P.videoPage.isJoinedGroupMember),f=A(P=>P.videoPage.liveType),d=r.useMemo(()=>f===F.CURRENT?!!i:f!==F.FINISHED,[f,i]),u=r.useRef(null),m=r.useRef(null),S=r.useRef(0),g=r.useRef(!1),y=r.useRef(0),v=r.useRef(0),E=r.useRef(0),U=r.useRef(0),[L,M]=r.useState(!1),[j,ee]=r.useState(!1),{onChatMessageReceived:te}=kr(),{onBroadcastReceived:K}=br(),Y=r.useCallback(()=>{M(!0)},[]),X=r.useCallback(()=>{M(!1),a(st(mn))},[a]),R=r.useCallback(()=>{window.clearTimeout(E.current),window.clearTimeout(U.current),window.clearTimeout(v.current),window.clearInterval(y.current)},[]),ne=r.useCallback(()=>{E.current=window.setTimeout(()=>{Y()},gn)},[Y]),b=r.useCallback(()=>{const P=O.getState().videoPage.attemptRetryWsV2;if(P>yn){R(),window.location.reload();return}U.current=window.setTimeout(()=>{ne(),s(!0),M(!1)},vn(P))},[R,s,ne]),V=r.useCallback(P=>{if(fe()?!g.current:P!=="io client disconnect"){if(fe()){const k=O.getState().videoPage.attemptRetryWsV2;a(st(k+1)),b();return}if(O.getState().videoPage.liveType===F.CURRENT){n();return}e()}g.current=!1},[a,e,n,b]),z=r.useCallback(P=>{y.current=window.setInterval(()=>{P?.send(it.PING),v.current=window.setTimeout(()=>{clearInterval(y.current),V()},En)},Tn)},[V]),Q=r.useCallback(async()=>{const P=Sn();if(!P||!o)return;if(fe()){const k=await a(Cn({token:o})).unwrap();if(!k)return;m.current&&(m.current.close(),g.current=!0);const B=new WebSocket(`${P}/websocket/${c}?ws_token=${k}`);let de=!1;B.onopen=()=>{O.getState().videoPage.attemptRetryWsV2&&n(),de=!0,m.current=B,g.current=!1,X(),R(),z(B)},B.onmessage=oe=>{if(oe.data===it.PONG){window.clearTimeout(v.current);return}const W=JSON.parse(oe.data),{event:w,data:T}=W;if(w===ke.AUTH){de=!0,m.current=B;return}if(de&&(w===ke.CHAT_MESSAGE_RECEIVED&&te(T),w===ke.BROADCAST_RECEIVED&&K(T),w===ke.CHAT_GROUP_UPDATED)){const q=Ee(T);a(Tt(q.messageCount))}},B.onclose=()=>{!m.current&&!g.current&&V(),m.current&&(m.current=null)};return}u.current&&u.current.disconnect();const G=Ue(P,{transports:["websocket"],query:{groupId:c},reconnection:!0,upgrade:!1,timeout:6e4,auth:{token:`Bearer ${o}`}});G.on("authenticated",()=>{G.on(Le.CHAT_MESSAGE_RECEIVED,te),G.on(Le.CHAT_GROUP_UPDATED,k=>{const B=Ee(k);a(Tt(B.messageCount))}),G.on("connect",()=>{const{countConnectWsFail:k}=O.getState().videoPage;k&&n()}),G.on("connect_error",()=>{S.current&&window.clearTimeout(S.current);const{countConnectWsFail:k}=O.getState().videoPage;k>=ut||(S.current=window.setTimeout(()=>{a(rt(k+1)),Q()},wn.RECONNECT_WS))}),G.on("disconnect",V),G.on(Le.BROADCAST_RECEIVED,k=>{K(k)}),u.current=G})},[R,a,c,n,z,K,te,V,X,o]);r.useEffect(()=>{!j&&c&&d&&o&&l&&(Q(),ee(!0))},[c,o,d,j,Q,l]),r.useEffect(()=>{t&&c&&d&&o&&(Q(),s(!1),a(rt(0)),g.current=!1)},[a,c,Q,d,t,s,o]),r.useEffect(()=>{L&&(g.current=!1,V())},[L,V]),r.useEffect(()=>()=>{R(),g.current=!0,u.current&&u.current.disconnect(),m.current&&m.current.close()},[R]),r.useEffect(()=>{f===F.FINISHED&&u.current&&(fe()&&m.current?(R(),m.current.close(),g.current=!0):u.current&&u.current.disconnect())},[R,f])},Ir=()=>{const{contentCode:n}=r.useContext(ie),e=Z(),t=A(b=>b.videoPage.videoPage),s=A(b=>b.videoPage.liveType),i=A(b=>b.videoPage.fanclubBillingPlans),o=A(b=>b.videoPage.videoCustomTargets),c=A(b=>b.app.fanclubSiteInfo?.platformId),a=r.useRef(null),l=r.useRef(!1),[f,d]=r.useState(!1),[u,m]=r.useState(!0),[S,g]=r.useState(!0),[y,v]=r.useState(!1),[E,U]=r.useState(!1),[L,M]=r.useState(!1),j=gi(),ee=r.useCallback(()=>{e(Ve(n)).then(se).then(()=>{M(!0)})},[n,e]),te=r.useCallback(()=>{e(Ve(n)).then(se).then(b=>{if(b.video&&b.video.allowDvrFlg){Promise.all([e(Se({contentCode:n,type:J.DVR})),e(Se({contentCode:n,type:J.LIVE}))]).then(V=>V.forEach(z=>se(z))).catch(V=>De({dispatch:e,error:V})).finally(()=>{fe()||M(!0)});return}e(Se({contentCode:n,type:J.LIVE})).then(se).catch(V=>De({dispatch:e,error:V})).finally(()=>{fe()||M(!0)})})},[n,e]),K=r.useCallback((b,V)=>{if(l.current||b!==F.CURRENT||!V?.video?.allowDvrFlg||!V?.liveStartedAt)return;const z=pe(V.liveStartedAt);$n(new Date,z)>=_n&&(e(ot({message:at.OVER_FOUR_HOUR,autoHideDuration:5e3})),l.current=!0)},[e]);r.useEffect(()=>{e(An())},[e]),jn(),Dn({isLiveScreen:!0,setIsNotExistFansite:U,setIsLoadingVideoPage:m,setIsLoadingUserBillingAndRentalPlans:g});
1const Y=Nn(t),{userData:X,isShowBillingAndRentalsDialog:R,videoCustomTargetsFilter:ne}=xs({videoPage:t,isLoading:u||Y,handleReloadPlayer:te,setIsLoadingUserBillingAndRentalPlans:g});return Pr({handleReloadPlayer:te,handleReconnectWs:ee,isReconnectWs:L,setIsReconnectWs:M}),On(),xn(),Rn({userData:X,isShowBillingAndRentalsDialog:R,setIsOpenBillingPlansDialog:v}),Fs({isLoading:u||Y,isLiveScreen:!0}),Oi(X),Fn(),Us(),Un(!0),r.useEffect(()=>{E||!t||t.isFinishedAndAllowConvertToVod&&e(ot({message:at.BEFORE_ARCHIVE,autoHideDuration:1e4}))},[e,E,t]),r.useEffect(()=>{E||!t||K(s,t)},[E,s,K,t]),r.useEffect(()=>{s===F.FINISHED&&d(!1)},[s]),r.useEffect(()=>()=>{e(gs())},[e]),Re(ft.ScreenModeChange,({screenMode:b})=>{switch(b){case Vt.FULLSCREEN:{d(!1);break}case Vt.THEATER:{bn(),d(!0);break}default:{d(!1);break}}}),Re(Ge.LiveStreamModeChange,({isLive:b})=>{t&&(b||(l.current=!1,K(s,t)))},[t,K]),u||S?p.jsx(bt,{isFullScreen:!0,zIndex:2e3}):!t||E?p.jsx(Hn,{}):p.jsxs(p.Fragment,{children:[t&&p.jsxs(p.Fragment,{children:[p.jsx(Qn,{}),p.jsx(kn,{image:t.thumbnailUrl,title:t.title,description:t.description,platformId:c}),p.jsxs(Vs,{id:Te.PAGE_WRAPPER,pb:t.paddingBottomContainer,"data-is-theater":f,children:[p.jsx(Bs,{id:Te.PLAYER_WRAPPER,ref:a,"data-is-theater":f,"data-is-chplus":j,children:X&&p.jsx(Ni,{userData:X,videoPage:t,handleReloadPlayer:te,setIsOpenBillingPlansDialog:v})}),p.jsx(Ms,{"data-is-theater":f,children:t.videoCommentSetting.allowCommentFlg?p.jsx(Ws,{isLiveScreen:!0,videoPage:t,isShowBillingAndRentalsDialog:R,setIsOpenBillingPlansDialog:v,getVideoPlayerHeight:()=>a.current?a.current.scrollHeight:0}):p.jsx(qs,{videoPage:t,isShowBillingAndRentalsDialog:R,setIsOpenBillingPlansDialog:v})}),p.jsx(Hs,{"data-is-theater":f,children:p.jsx(Qs,{isLiveScreen:!0,videoPage:t,isShowBillingAndRentalsDialog:R,setIsOpenBillingPlansDialog:v,liveType:s})})]})]}),i&&p.jsx(Vn,{isOpen:y,onClose:()=>v(!1),fanclubBillingPlans:i}),o&&p.jsx(Bn,{isOpen:y,videoCustomTargets:ne,closedAt:t?.closedAt,onClose:()=>v(!1)})]})},Lr=n=>{const{contentCode:e,fanclubMemberId:t,videoPlayerHelper:s}=r.useContext(ie),i=Z(),o=A(d=>d.videoPage.liveType),c=r.useRef(0),a=r.useRef(0),l=r.useCallback(()=>{const d=document.querySelector(".nfcp-survey");if(!(!s||!d||n!==Be.FREE)&&Array.isArray(s.videoPlayer.playerRef.current.state?.freeRange)){const u=s.getCurrentPlaybackTime(),S=(s.videoPlayer.playerRef.current.state?.freeRange).find(g=>g.inPos<=u&&(!g.outPos||g.outPos>=u));d.style.opacity=S?"1":"0"}},[n,s]),f=r.useCallback(()=>{const d=document.querySelectorAll(".nfcp-survey-select-item"),{currentAnswerIndex:u}=O.getState().videoPage;d.length&&u!==null&&u!==-1&&d[u].click()},[]);r.useEffect(()=>{e&&t&&o===F.CURRENT&&i(Jt({contentCode:e,fanclubMemberId:t}))},[e,i,t,o]),r.useEffect(()=>(c.current&&window.clearInterval(c.current),o===F.CURRENT&&(c.current=window.setInterval(()=>{l()},Pe.HIDE_QUESTIONAIRE)),()=>{c.current&&window.clearInterval(c.current)}),[l,o]),r.useEffect(()=>(a.current&&window.clearInterval(a.current),o===F.CURRENT&&(a.current=window.setInterval(()=>{f()},Pe.CHECK_USER_ANSWER)),()=>{a.current&&window.clearInterval(a.current)}),[f,o])},Dr=({userData:n,videoPage:e,setIsTheaterMode:t,setIsFullScreenMode:s,setIsOpenBillingPlansDialog:i,setIsReloadPlayer:o,showSnackbarDvrPlaybackTimeMaximum:c})=>{const{videoPlayerHelper:a,setVideoPlayerHelper:l,contentCode:f}=r.useContext(ie),d=qn(),u=Z(),m=ys(),S=ci(),g=ai(),y=A(h=>h.videoPage.sessionConfigLive),v=A(h=>h.videoPage.sessionConfigDvr),E=A(h=>h.videoPage.isFreePartOpen),U=A(h=>h.videoPage.liveType===F.CURRENT),L=A(h=>h.videoPage.adminComments),M=r.useRef(0),[j,ee]=r.useState(0),[te,K]=r.useState(!1),[Y,X]=r.useState(null),R=oi(e),{handleGetVideoComments:ne}=Pn(e);js(n),$s(),Kn(),Gs(),Lr(n);const b=r.useMemo(()=>{const h=R*1e3;return(e.isFinishedAndAllowConvertToVod?e.videoQuestionnaires.filter(C=>h?C.elapsedShowTime>=h:C.elapsedShowTime):e.videoQuestionnaires.filter(C=>!C.elapsedHideResultTime&&C.elapsedShowTime)).map(C=>({id:C.id,inPos:(C.elapsedShowTime-h)/1e3,resultPos:C.elapsedDeadlineTime?(C.elapsedDeadlineTime-h)/1e3:void 0,outPos:C.elapsedHideResultTime?(C.elapsedHideResultTime-h)/1e3:void 0,content:C.question,choices:C.videoQuestionnaireOptions?.map(x=>({id:x.id,text:x.text,percent:zt(x.videoQuestionnaireResult?.percentage)}))?.sort((x,H)=>x.id-H.id)}))},[R,e.isFinishedAndAllowConvertToVod,e.videoQuestionnaires]),V=r.useMemo(()=>
1{const{videoDeliveryTarget:h,videoFreePeriods:_,startWithFreePartFlg:C}=e;if(h.id!==Je.ALL_USERS){if(e.isFinishedAndAllowConvertToVod){if(R){const H=_.filter(re=>re.elapsedEndedTime>R);return H.length?H.map(re=>({inPos:re.elapsedStartedTime<R?0:re.elapsedStartedTime-R,outPos:re.elapsedEndedTime-R})):!1}return _.length?_.map(H=>({inPos:H.elapsedStartedTime,outPos:H.elapsedEndedTime})):!1}if(e.video&&!e.video.allowDvrFlg)return _.length?!_[_.length-1].endAt:C;const x=new Date().getTime()/1e3;return _.length?_.map(H=>({inPos:pe(H.startedAt).getTime()/1e3,outPos:H.endAt?pe(H.endAt).getTime()/1e3:void 0})):[{inPos:x,outPos:C?void 0:x+1}]}return!0},[e,R]),z=r.useMemo(()=>L?R?L.filter(_=>!_.outPos||_.outPos>R).map(_=>({..._,vpos:_.vpos<R?0:_.vpos-R,outPos:_.outPos?_.outPos-R:void 0})):L:null,[L,R]),{streamUrlLive:Q,streamUrlDvr:P}=r.useMemo(()=>({streamUrlLive:y&&`${e.videoStream?.authenticatedUrl.replace("{session_id}",`${y.id}`)}`,streamUrlDvr:v&&`${e.videoStream?.authenticatedUrl.replace("{session_id}",`${v.id}`)}`}),[v,y,e.videoStream?.authenticatedUrl]),G=r.useMemo(()=>e.isFinishedAndAllowConvertToVod?!P:e.video&&e.video.allowDvrFlg?!Q||!P:!Q,[P,Q,e.isFinishedAndAllowConvertToVod,e.video]),k=r.useCallback(()=>{if(G)return null;const{liveStartedAt:h}=e,_=Xt(e.thumbnailUrl);return{domId:Te.PLAYER,liveStartTime:e.isFinishedAndAllowConvertToVod?void 0:pe(h).getTime()/1e3,streamUrls:e.video&&e.video.allowDvrFlg&&!e.isFinishedAndAllowConvertToVod?[Q,P]:[e.isFinishedAndAllowConvertToVod?P:Q],posterUrl:_,coverImageUrl:_,freeRange:V,surveys:b,userData:{type:n},enableComment:e.commentSetting.isShowCommentsInPlayer,adminComments:z,enableSpeedChange:S,displayPlanInfo:g}},[z,S,g,V,G,P,Q,b,n,e]),B=r.useCallback(()=>{const h=k();return h?e.isFinishedAndAllowConvertToVod?new window.NfcOndemandPlayer(h):e.video&&e.video.allowDvrFlg?new window.NfcDvrPlayer(h):new window.NfcLivePlayer(h):null},[k,e.isFinishedAndAllowConvertToVod,e.video]),de=r.useCallback(h=>{a?.videoPlayer&&a.videoPlayer.setSetting(h)},[a?.videoPlayer]),oe=r.useCallback((h,_)=>{const C=Ze();C&&u(Kt({contentCode:f,fanclubMemberId:C,data:{videoQuestionnaire:{id:h},videoQuestionnaireOption:{id:_}}})).then(se).catch(x=>De({error:x,dispatch:u}))},[f,u]),W=r.useCallback(()=>{const h=document.querySelector(".nfcp-tohead-button");h&&h.click()},[]),w=r.useCallback(()=>{const h=document.querySelector(".nfcp-setting-panel .nfcp-setting-title");h&&h.click()},[]),T=r.useCallback((h,_)=>{const{isFirstInitPlayer:C}=O.getState().comment,{liveType:x}=O.getState().videoPage;(!C&&e.isFinishedAndAllowConvertToVod||x===F.CURRENT&&!_.isLive())&&ne({needClearComments:!0,startTime:h.data.startTime+R,needGetAdminComments:!0,isLive:!0}),C&&e.isFinishedAndAllowConvertToVod&&W(),u(vs(!1))},[W,R,u,ne,e.isFinishedAndAllowConvertToVod]),q=r.useCallback(h=>{const _=h.data.mode===J.DVR,{liveType:C,videoPage:x}=O.getState().videoPage;if(_){u(et(!0)),x&&c(C,x);return}window.location.reload()},[u,c]),ae=r.useCallback((h,_)=>{const{currentAnswerIndex:C,isDvrMode:x,currentQuestionnaire:H}=O.getState().videoPage,re=Ze();if(C!==null&&C!==-1||x||!re)return;if(u(lt(h)),H){const N=H.videoQuestionnaireOptions[h];oe(H.videoQuestionnaireId,N.id);return}const ye=Es(_,e);if(ye&&re){const N=ye.videoQuestionnaireOptions[h];oe(ye.id,N.id)}},[u,oe,e]);return r.useEffect(()=>{a?.videoPlayer||G||!L&&e.isFinishedAndAllowConvertToVod||(M.current&&window.clearInterval(M.current),M.current=window.setInterval(()=>{if(ee(N=>N+1),e.isFinishedAndAllowConvertToVod&&!window.NfcOndemandPlayer||!e.isFinishedAndAllowConvertToVod&&e.video&&(e.video.allowDvrFlg&&!window.NfcDvrPlayer||!e.video.allowDvrFlg&&!window.NfcLivePlayer))return;const h=B();if(!h)return;const _=N=>{const D=document.getElementById(Te.PAGE_WRAPPER);D&&d.breakpoints.up("md")&&D.scrollTo({top:0,behavior:"smooth"}),h.isPlaying()||h.play(),h.setCurrentTime(N)},C=()=>Math.floor(h.getCurrentTime());X(h.getSetting());const x=()=>h.playerRef.current.state?.videoQualityList,H=()=>{h&&(h.playerRef.current.state.videoQualityList=Cs(x()))};h.addEventListener("ready",()=>{H()}),h.addEventListener("changeSetting",N=>{X({...N.data,videoQualityList:x().map(D=>D.label)}),w()}),h.addEventListener("clickSetting",()=>{X(N=>N?{...N,videoQualityList:x().map(D=>D.label)}:null),K(N=>!N)}),h.addEventListener("enterTheaterMode",()=>{t(!0)}),h.addEventListener("exitTheaterMode",()=>{t(!1)}),h.addEventListener("clickPlanBanner",()=>{h.exitFullscreen(),i(!0)}),h.addEventListener("enterFullscreen",()=>{s(!0),Ts(Te.PLAYER_WRAPPER)}),h.addEventListener("exitFullscreen",()=>{s(!1),Ss(Te.PLAYER_WRAPPER)}),h.addEventListener("changeStreamMode",q),h.addEventListener("seekEnd",N=>{T(N,h)}),h.addEventListener("clickPlanInfo",()=>{m.push("/go_to_NFC_MP_430")}),h.addEventListener("selectedSurvey",N=>{ae(N.data.selectedIndex,C())}),l({videoPlayer:h,setCurrentPlaybackTime:_,getCurrentPlaybackTime:C}),Zt(()=>{let N=C(),D;return N?D=!0:(N=C(),D=!1),D}
1,()=>{u(nn(!0))},tn,sn),o(!1)},1e3))},[w,B,G,ae,s,i,o,t,l,d.breakpoints,e.isFinishedAndAllowConvertToVod,e.video,a?.videoPlayer,T,q,L,u,m]),r.useEffect(()=>(a?.videoPlayer&&M.current&&window.clearInterval(M.current),()=>{M.current&&window.clearInterval(M.current),a?.videoPlayer?.exitFullscreen()}),[a?.videoPlayer]),r.useEffect(()=>{e.isFinishedAndAllowConvertToVod&&u(et(!0))},[u,e.isFinishedAndAllowConvertToVod]),r.useEffect(()=>{const h=n===Be.FREE,_=!(e.videoDeliveryTarget.id===Je.ALL_USERS||E&&h||!h);u(en(_))},[u,E,n,e.videoDeliveryTarget.id]),r.useEffect(()=>{if(b.length){const h=b[b.length-1];u(Ne({question:h.content,videoQuestionnaireId:h.id,videoQuestionnaireOptions:h.choices.map(({id:_,text:C})=>({id:_,text:C})),inPos:h.inPos,isVoting:!h.resultPos}))}},[u,b]),r.useEffect(()=>{e.isFinishedAndAllowConvertToVod&&ne({needGetAdminComments:!0,isLive:!0,startTime:R})},[R,ne,e.isFinishedAndAllowConvertToVod]),p.jsxs(p.Fragment,{children:[p.jsx(Pt,{isCheckVideoPlayer:!0}),p.jsxs("div",{children:[p.jsx("div",{id:Te.PLAYER}),p.jsx(Ys,{isOpenSettingDialog:te,setIsOpenSettingDialog:K,videoSetting:Y,updateVideoPlayerSetting:de,videoPlayer:a?.videoPlayer,isLiveStream:U})]},j)]})},Nr=r.memo(Dr),Or=({videoPage:n,handleReloadPlayer:e,setAllowInitPlayerStatus:t})=>{const{contentCode:s}=r.useContext(ie),i=Z(),o=A(y=>y.videoPage.sessionConfigLive),c=A(y=>y.videoPage.sessionConfigDvr),a=A(y=>y.videoPage.liveType),l=r.useRef(0),f=r.useRef(!1),d=o?.expires||c?.expires,u=d?new Date(d).getTime():0,m=a===F.CURRENT||n?.isFinishedAndAllowConvertToVod,S=r.useCallback(()=>{const y=new Date().getTime();o&&y>u&&m&&e()},[u,e,m,o]),g=r.useCallback(y=>{i(Se({contentCode:s,type:y})).then(se).then(()=>{t("ALLOWED")}).catch(v=>{t(Yt(v))})},[s,i,t]);r.useEffect(()=>{!m||!n||f.current||(f.current=!0,n.isFinishedAndAllowConvertToVod?g(J.DVR):n.video&&n.video.allowDvrFlg?(g(J.DVR),g(J.LIVE)):g(J.LIVE))},[s,i,g,m,t,n]),r.useEffect(()=>(l.current&&window.clearInterval(l.current),m&&(l.current=window.setInterval(()=>{S()},Pe.OTHER)),()=>{l.current&&window.clearInterval(l.current)}),[m,S,i])},xr=({userData:n,videoPage:e,setIsTheaterMode:t,setIsFullScreenMode:s,setIsOpenBillingPlansDialog:i,setIsReloadPlayer:o,showSnackbarDvrPlaybackTimeMaximum:c,handleReloadPlayer:a})=>{const[l,f]=r.useState("PENDING");return Or({videoPage:e,handleReloadPlayer:a,setAllowInitPlayerStatus:f}),l==="PENDING"?null:l==="NOT_ALLOWED"?p.jsx(Ln,{thumbnailUrl:e.thumbnailUrl}):p.jsx(Nr,{userData:n,videoPage:e,setIsTheaterMode:t,setIsFullScreenMode:s,setIsOpenBillingPlansDialog:i,setIsReloadPlayer:o,showSnackbarDvrPlaybackTimeMaximum:c})},ls=r.memo(xr),Fr=({isReloadPlayer:n,userData:e,videoPage:t,setIsTheaterMode:s,setIsFullScreenMode:i,setIsOpenBillingPlansDialog:o,setIsReloadPlayer:c,showSnackbarDvrPlaybackTimeMaximum:a,handleReloadPlayer:l})=>{const f=A(d=>d.videoPage.countConnectWsFail);return n?p.jsx(Pt,{}):f===ut?p.jsx(Gn,{}):p.jsx(ls,{userData:e,videoPage:t,setIsTheaterMode:s,setIsFullScreenMode:i,setIsOpenBillingPlansDialog:o,setIsReloadPlayer:c,showSnackbarDvrPlaybackTimeMaximum:a,handleReloadPlayer:l})},Ur=r.memo(Fr),je="FinishedLiveWithBanner",_e={container:`${je}-container`,absoluteCenter:`${je}-absoluteCenter`,textAfterLive:`${je}-textAfterLive`,reloadBtn:`${je}-reloadBtn`},Vr=Mn("div")(({theme:n})=>({[`&.${_e.container}`]:{position:"relative"},[`& .${_e.absoluteCenter}`]:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},[`& .${_e.textAfterLive}`]:{padding:n.spacing(1,6),textAlign:"center",background:"rgba(28, 28, 30, 0.7);",borderRadius:4,color:n.palette.white},[`& .${_e.reloadBtn}`]:{color:n.palette.white}})),Br=({thumbnailUrl:n,hasReloadButton:e})=>{const t=()=>{window.location.reload()};return p.jsxs(Vr,{className:_e.container,children:[p.jsx($t,{src:n,aspectRatio:Gt.SIXTEEN_TO_NINE,block:!0}),p.jsx("div",{className:_e.absoluteCenter,children:e?p.jsx(mi,{className:_e.reloadBtn,onClick:t,size:"large",children:p.jsx(ws,{iconKey:"ReplayIcon",fontSize:"large"})}):p.jsx(Wn,{variant:"body1",color:"inherit",noWrap:!0,className:_e.textAfterLive,children:"この放送は終了しました"})})]})},jt=r.memo(Br),Mr=({isShowBillingAndRentalsDialog:n,userData:e,videoPage:t,setIsTheaterMode:s,setIsFullScreenMode:i,setIsOpenBillingPlansDialog:o,setIsReloadPlayer:c,showSnackbarDvrPlaybackTimeMaximum:a,handleReloadPlayer:l})=>{const f=A(u=>u.videoPage.isFinishedWhenReceivingEventWS),d=li({videoPage:t,isShowBillingAndRentalsDialog:n});return f&&t.allowConvertToVod?p.jsx(jt,{hasReloadButton:!0,thumbnailUrl:t.thumbnailUrl}):t.isFinishedAndAllowConvertToVod?d?p.jsx(ui,{thumbnailUrl:t.thumbnailUrl,setIsOpenBillingPlansDialog:o}):p.jsx(ls,{userData:e,videoPage:t,setIsTheaterMode:s,setIsFullScreenMode:i,setIsOpenBillingPlansDialog:o,setIsReloadPlayer:c,showSnackbarDvrPlaybackTimeMaximum:a,handleReloadPlayer:l}):p.jsx(jt,{thumbnailUrl:t.thumbnailUrl})},Wr=r.memo(Mr),qr=n=>{const{videoPlayerHelper:e,fanclubMemberId:t,contentCode:s}=r.useContext(ie),i=Z(),o=A(d=>!!d.videoPage.audienceToken),c=A(d=>d.videoPage.logEvents),a=A(d=>d.videoPage.videoPage),l=r.useRef(0),f=r.useCallback((d,u)=>{n&&o&&c?.length&&i(rn({Data:{fanclubMemberId:t||0,contentCode:s,currentTime:Math.floor(d),memberType:t?n:Be.GUEST,videoType:u,category:on.LIVE_LOG,data:c},PartitionKey:new Date().getMilliseconds().toString()})).finally(()=>{i(dt(null))})},[s,i,t,o,c,n]);r.useEffect(()=>(l.current&&window.clearInterval(l.current),l.current=window.setInterval(()=>{e&&a?.videoType&&f(e.getCurrentPlaybackTime(),a.videoType)},Pe.OTHER),()=>{l.current&&window.clearInterval(l.current)}),[f,a?.videoType,e])},Hr=({handleReloadPlayer:n,handleReconnectWs:e,isReconnectWs:t,setIsReconnectWs:s})=>{const{videoPlayerHelper:i,commentInformation:{token:o,groupId:c}}=r.useContext(ie),a=Z(),l=A(W=>W.videoPage.isJoinedGroupMember),f=A(W=>W.videoPage.liveType),d=r.useMemo(()=>f===F.CURRENT?!!i:f!==F.FINISHED,[f,i]),u=r.useRef(null),m=r.useRef(null),S=r.useRef(0),g=r.useRef(0),y=r.useRef([]),v=r.useRef([]),E=r.useRef([]),U=r.useRef(0),L=r.useRef(!1),M=r.useRef(0),j=r.useRef(0),ee=r.useRef(0),te=r.useRef(0),[K,Y]=r.useState(!1),[X,R]=r.useState(!1),ne=r.useCallback(()=>
1{if(!o)return"";const{userId:W}=Ee(_s(o));return W},[o]),b=r.useCallback(W=>{const w=Ee({...W,isLive:!0}),T=ne(),q=O.getState().siteNgUser.entities,ae=O.getState().memberNgUser.entities,h=O.getState().videoPage,_=w.senderId===T,C=h.liveType===F.CURRENT;if(_||a(fn(!0)),h.isDvrMode&&C||w.priority)return;const x=w.senderId in ae,H=w.senderId in q;if(E.current.find(ye=>ye.id===w.id)||E.current.push(w),!x&&!H&&C){if(y.current.find(ve=>ve.no===w.id))return;const N=new Date(w.createdAt),D=N.getTime()/1e3+As;_?v.current.push({id:w.id,date:N,vpos:D,content:w.message}):y.current.push({no:w.id,date:N.toString(),vpos:D,content:w.message})}},[a,ne]),V=r.useCallback((W,w)=>{const T=Ee(W),q=T.payload.type,ae=Math.floor(w?.getCurrentPlaybackTime()||0),{videoPage:h,isDvrMode:_,currentQuestionnaire:C,currentAdminCommentLive:x}=O.getState().videoPage,H=(D=!1)=>{const ve=an(nt.MAX_SECOND,nt.MIN_SECOND);if(D){setTimeout(()=>{window.location.reload()},ve);return}a(un(!0)),a(dn(F.FINISHED))},re=D=>{!D.dismiss&&w&&(xt(w.videoPlayer),w.videoPlayer.addAdminComment({no:Ft.ID,vpos:Ft.VPOS,date:D.unixTime,content:D.link?`<a style="text-decoration:none;" href=${D.link} target="_blank">${D.message}</a>`:D.message,outPos:D.autoHide?D.unixTime+D.autoHide-1:void 0}))},ye=()=>{const D=new Date(T.createdAt).getTime()/1e3,ve={id:T.id,isOpen:!0,message:T.message,link:T.payload?.link,autoHide:T.endTimeInSeconds,unixTime:D};if(!_){re(ve),a(ks(ve));const Ce=new Date(T.createdAt).toString();a(Ps({comment:{priority:!0,playbackTime:ae,message:T.message,senderId:T.senderId,id:T.id,sentAt:Ce,createdAt:Ce,groupId:T.groupId,nickname:"運営"},liveStartedAt:h?.liveStartedAt}))}},N=D=>{a(dt({logEvent:hn.FREE_PERIOD,logType:D,playbackTime:Math.floor(ae),executionTime:new Date().toISOString()}))};if(T.type===Ie.QUESTIONAIRE){const D=cn(T.createdAt,h?.liveStartedAt),ve=T.payload.type===be.POST_QUESTIONS?T.payload.videoQuestionnaireOptions.sort((Ce,We)=>Ce.id-We.id):[];switch(q){case be.POST_QUESTIONS:w?.videoPlayer.addSurvey({id:T.payload.videoQuestionnaireId,inPos:D,content:T.payload.question,choices:ve}),a(Ne({question:T.payload.question,videoQuestionnaireId:T.payload.videoQuestionnaireId,videoQuestionnaireOptions:ve,inPos:D,isVoting:!0}));break;case be.RESULT:a(lt(-1)),w?.videoPlayer.closeSurvey(),w?.videoPlayer.addSurvey({id:T.payload.videoQuestionnaireId,inPos:C?.inPos,resultPos:D,content:T.payload.videoQuestionnaireQuestion||C?.question,choices:C?.videoQuestionnaireOptions.map(Ce=>{const We=T.payload.videoQuestionnaireResults.find(us=>us.id===Ce.id);return We?{...Ce,percent:ln(We.percentage)}:{...Ce,percent:0}})});break;case be.HIDE_RESULT:a(Ne(null)),w?.videoPlayer.closeSurvey(),x.message&&re(x);break}}if(T.type===Ie.ANNOUCEMENT)switch(T.message&&ye(),q){case he.START:H(!0);break;case he.FINISH:case he.FORCE_STOP:H();break;case he.START_FREE_RANGE:a(tt(!0)),N(ce.RECEIVE_START_FREE_WS),N(ce.BEFORE_START_FREE_PLAYER),w?.videoPlayer.addFreeRange({inPos:pe(T.payload.startedAt).getTime()/1e3}),N(ce.AFTER_START_FREE_PLAYER);break;case he.END_FREE_RANGE:a(tt(!1)),N(ce.RECEIVE_END_FREE_WS),N(ce.BEFORE_END_FREE_PLAYER),w?.videoPlayer.closeFreeRange(),N(ce.AFTER_END_FREE_PLAYER);break}if(T.type===Ie.DISMISS){if(_)return;w?.videoPlayer&&xt(w.videoPlayer),a(Rs())}},[a]),z=r.useCallback(()=>{Y(!0)},[]),Q=r.useCallback(()=>{Y(!1),a(st(mn))},[a]),P=r.useCallback(()=>{window.clearTimeout(ee.current),window.clearTimeout(te.current),window.clearTimeout(j.current),window.clearInterval(M.current)},[]),G=r.useCallback(()=>{ee.current=window.setTimeout(()=>{z()},gn)},[z]),k=r.useCallback(()=>{const W=O.getState().videoPage.attemptRetryWsV2;if(W>yn){P(),window.location.reload();return}te.current=window.setTimeout(()=>{G(),s(!0),Y(!1)},vn(W))},[P,s,G]),B=r.useCallback(W=>{if(fe()?!L.current:W!=="io client disconnect"){if(fe()){const T=O.getState().videoPage.attemptRetryWsV2;a(st(T+1)),k();return}if(O.getState().videoPage.liveType===F.CURRENT){n();return}e()}L.current=!1},[a,e,n,k]),de=r.useCallback(W=>{M.current=window.setInterval(()=>{W?.send(it.PING),j.current=window.setTimeout(()=>{clearInterval(M.current),B()},En)},Tn)},[B]),oe=r.useCallback(async W=>{const w=Sn();if(w)if(fe()&&o){const T=await a(Cn({token:o})).unwrap();if(!T)return;m.current&&(m.current.close(),L.current=!0);const q=new WebSocket(`${w}/websocket/${c}?ws_token=${T}`);let ae=!1;q.onopen=()=>{O.getState().videoPage.attemptRetryWsV2&&n(),ae=!0,m.current=q,L.current=!1,Q(),P(),de(q)},q.onmessage=h=>{if(h.data===it.PONG){window.clearTimeout(j.current);return}const _=JSON.parse(h.data),{event:C,data:x}=_;if(ae&&(C===ke.CHAT_MESSAGE_RECEIVED&&b(x),C===ke.BROADCAST_RECEIVED&&V(x,W),C===ke.CHAT_GROUP_UPDATED)){const H=Ee(x);U.current=H.messageCount}},q.onclose=()=>{!m.current&&!L.current&&B(),m.current&&(m.current=null)}}else{u.current&&u.current.disconnect();const T=Ue(w,{transports:["websocket"],query:{groupId:c},reconnection:!0,upgrade:!1,timeout:6e4,auth:{token:`Bearer ${o}`}});T.on("authenticated",()=>{T.on(Le.CHAT_MESSAGE_RECEIVED,b),T.on(Le.CHAT_GROUP_UPDATED,q=>{const ae=Ee(q);U.current=ae.messageCount}),T.on("connect",()=>{const{countConnectWsFail:q}=O.getState().videoPage;q&&n()}),T.on("connect_error",()=>{S.current&&window.clearTimeout(S.current);const{countConnectWsFail:q}=O.getState().videoPage;q>=ut||(S.current=window.setTimeout(()=>{a(rt(q+1)),oe(i)},wn.RECONNECT_WS))}),T.on("disconnect",B),T.on(Le.BROADCAST_RECEIVED,q=>{V(q,W)}),u.current=T})}},[a,c,n,V,b,B,o,i,P,Q,de]);r.useEffect(()=>{!X&&c&&d&&o&&l&&(oe(i),R(!0))},[c,i,o,d,X,oe,l]),r.useEffect(()=>{t&&c&&d&&o&&(oe(i),s(!1),a(rt(0)),L.current=!1)},[a,c,oe,d,t,s,o,i]),r.useEffect(()=>{K&&(L.current=!1,B())},[K,B]),r.useEffect(()=>()=>{P(),L.current=!0,u.current&&u.current.disconnect(),m.current&&m.current.close()},[P]),r.useEffect(()=>(g.current&&window.clearInterval(g.current),g.current=window.setInterval(()=>{if(i?.videoPlayer){y.current.length&&(i.videoPlayer.addComments(y.current),a(pn(y.current.length))),y.current=[];const w=v.current.filter(T=>!(T.id in O.getState().comment.entities));
1w.length&&w.forEach(T=>{i.videoPlayer.addPostedComment(T)}),v.current=[]}const W=E.current.filter(w=>!(w.id in O.getState().comment.entities));W.length&&(a(bs({comments:W,liveStartedAt:O.getState().videoPage.videoPage?.liveStartedAt})),a(Tt({numberOfComments:U.current,commentsLength:W.length}))),E.current=[],U.current=0},Pe.COMMENT),()=>{g.current&&window.clearInterval(g.current)}),[i?.videoPlayer,a]),r.useEffect(()=>{f===F.FINISHED&&u.current&&(fe()&&m.current?(P(),m.current.close(),L.current=!0):u.current&&u.current.disconnect())},[P,f])},Qr=()=>{const{setVideoPlayerHelper:n,contentCode:e}=r.useContext(ie),t=Z(),s=A(k=>k.videoPage.videoPage),i=A(k=>k.videoPage.liveType),o=A(k=>k.videoPage.fanclubBillingPlans),c=A(k=>k.videoPage.videoCustomTargets),a=A(k=>k.videoPage.isFinishedWhenReceivingEventWS&&k.videoPage.isDvrMode),l=A(k=>k.app.fanclubSiteInfo?.platformId),f=r.useRef(null),d=r.useRef(null),u=r.useRef(null),[m,S]=r.useState(!1),[g,y]=r.useState(!1),[v,E]=r.useState(!0),[U,L]=r.useState(!0),[M,j]=r.useState(!1),[ee,te]=r.useState(!1),[K,Y]=r.useState(!1),[X,R]=r.useState(!1),ne=r.useCallback(()=>{t(Ve(e)).then(se).then(()=>{R(!0)})},[e,t]),b=r.useCallback(()=>{Y(!0),n(null),t(Ve(e)).then(se).then(k=>{if(k.video&&k.video.allowDvrFlg){Promise.all([t(Se({contentCode:e,type:J.DVR})),t(Se({contentCode:e,type:J.LIVE}))]).then(B=>B.forEach(de=>se(de))).catch(B=>De({dispatch:t,error:B})).finally(()=>{Y(!1),R(!0)});return}t(Se({contentCode:e,type:J.LIVE})).then(se).catch(B=>De({dispatch:t,error:B})).finally(()=>{Y(!1),R(!0)})})},[e,t,n]),V=r.useCallback((k,B)=>{k===F.CURRENT&&B.video&&B.video.allowDvrFlg&&$n(new Date,pe(B.liveStartedAt))>=_n&&t(ot({message:at.OVER_FOUR_HOUR,autoHideDuration:5e3}))},[t]);r.useEffect(()=>{t(An())},[t]),Ks({videoPage:s,isLiveScreen:!0}),jn(),Dn({isLiveScreen:!0,setIsNotExistFansite:te,setIsLoadingVideoPage:E,setIsLoadingUserBillingAndRentalPlans:L});const z=Nn(s),{userData:Q,isShowBillingAndRentalsDialog:P,videoCustomTargetsFilter:G}=di({videoPage:s,isLoading:v||z,handleReloadPlayer:b,setIsLoadingUserBillingAndRentalPlans:L});return Hr({handleReloadPlayer:b,handleReconnectWs:ne,isReconnectWs:X,setIsReconnectWs:R}),On(),xn(),Rn({userData:Q,isShowBillingAndRentalsDialog:P,setIsOpenBillingPlansDialog:j}),hi({isLoading:v||z,isLiveScreen:!0}),qr(Q),Fn(),Un(!0),Xs({isTheaterMode:m,containerRef:f,videoPlayerWrapperRef:u}),zs({isFullScreenMode:g,isLoading:v,videoPageWrapperRef:d,videoPlayerWrapperRef:u}),r.useEffect(()=>{ee||!s||s.isFinishedAndAllowConvertToVod&&t(ot({message:at.BEFORE_ARCHIVE,autoHideDuration:1e4}))},[t,ee,s]),r.useEffect(()=>{ee||!s||V(i,s)},[ee,i,V,s]),r.useEffect(()=>{i===F.FINISHED&&(y(!1),S(!1))},[i]),v||U?p.jsx(bt,{isFullScreen:!0,zIndex:2e3}):!s||ee?p.jsx(Hn,{}):p.jsxs(p.Fragment,{children:[s&&p.jsxs(p.Fragment,{children:[p.jsx(Qn,{}),p.jsx(kn,{image:s.thumbnailUrl,title:s.title,description:s.description,platformId:l}),p.jsxs(Js,{ref:f,className:gt.container,pb:s.paddingBottomContainer,children:[p.jsxs("div",{id:Te.PAGE_WRAPPER,ref:d,className:gt.videoPageWrapper,children:[p.jsxs("div",{id:Te.PLAYER_WRAPPER,ref:u,className:gt.videoPlayerWrapper,children:[i===F.SCHEDULED&&p.jsx(Yn,{thumbnailUrl:s.thumbnailUrl}),Q&&p.jsxs(p.Fragment,{children:[(i===F.CURRENT||a)&&p.jsx(Ur,{isReloadPlayer:K,userData:Q,videoPage:s,setIsTheaterMode:S,setIsFullScreenMode:y,setIsOpenBillingPlansDialog:j,setIsReloadPlayer:Y,showSnackbarDvrPlaybackTimeMaximum:V,handleReloadPlayer:b}),i===F.FINISHED&&!a&&p.jsx(Wr,{userData:Q,videoPage:s,setIsTheaterMode:S,setIsFullScreenMode:y,setIsOpenBillingPlansDialog:j,setIsReloadPlayer:Y,isShowBillingAndRentalsDialog:P,showSnackbarDvrPlaybackTimeMaximum:V,handleReloadPlayer:b})]})]}),p.jsx(fi,{isLiveScreen:!0,videoPage:s,isShowBillingAndRentalsDialog:P,setIsOpenBillingPlansDialog:j,liveType:i})]}),s.videoCommentSetting.allowCommentFlg?p.jsx(Zs,{isLiveScreen:!0,videoPage:s,isShowBillingAndRentalsDialog:P,setIsOpenBillingPlansDialog:j,getVideoPlayerHeight:()=>u.current?u.current.scrollHeight:0}):p.jsx(pi,{isLiveScreen:!0,videoPage:s,isShowBillingAndRentalsDialog:P,setIsOpenBillingPlansDialog:j})]})]}),o&&p.jsx(Vn,{isOpen:M,onClose:()=>j(!1),fanclubBillingPlans:o}),c&&p.jsx(Bn,{isOpen:M,videoCustomTargets:G,closedAt:s?.closedAt,onClose:()=>j(!1)})]})},jr=r.memo(Qr),$r=()=>{const{isLoading:n,isUseNewPlayer:e}=ei();return n?p.jsx(bt,{isFullScreen:!0,zIndex:2e3}):e?p.jsx(Ir,{}):p.jsx(jr,{})},Ro=r.memo($r);export{Ro as default};

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.