4042.9cd323fea9e52532.js
17.8 KB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4042],{18870:(e,t,n)=>{"use strict";n.d(t,{z:()=>r});var u=n(25771),l=n(51529);function r(e){let{percent:t,className:n,barClassName:r,gradient:i=!1,gradientClassName:a,role:o="progressbar","aria-valuenow":s,"aria-valuemin":c=0,"aria-valuemax":d=100,...f}=e,v=Number.isNaN(t)?0:Math.min(100,Math.max(0,t));return(0,u.jsx)("div",{role:o,"aria-valuenow":null!=s?s:Math.round(v),"aria-valuemin":c,"aria-valuemax":d,className:(0,l.cn)("h-1.5 w-full overflow-hidden rounded-full bg-white/10",n),...f,children:(0,u.jsx)("div",{className:(0,l.cn)("h-full max-w-full rounded-full transition-[width] duration-300 ease-out",i?(0,l.cn)("bg-gradient",a):"bg-white",r),style:{width:"".concat(v,"%")}})})}},28133:(e,t,n)=>{"use strict";n.d(t,{$:()=>i});var u=n(25771);n(87163);var l=n(57425);let r={body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M12 9v4m0 4h.01m5.916 4H6.074c-2.282 0-3.728-2.446-2.629-4.446l6.803-12.368c.76-1.381 2.745-1.381 3.505 0l6.802 12.368c1.1 2-.347 4.446-2.629 4.446Z"/>',viewBox:{left:0,top:0,width:24,height:24},left:0,top:0,width:24,height:24},i=e=>{let{className:t="",...n}=e;return(0,u.jsx)("div",{className:t,style:{height:"1em",aspectRatio:1},children:(0,u.jsx)(l.In,{...n,icon:r,height:"1em"})})}},30008:(e,t,n)=>{"use strict";n.d(t,{Z:()=>B});var u=n(25771),l=n(87163),r=n(11353),i=n(95482),a=n(654),o=n(65983),s=n.n(o),c=n(60191),d=n(11373);let f=e=>(0,d.bE)("/live/room/message",e,{skipAuthCheck:!0}),v=(0,l.createContext)(null);function m(){let e=(0,l.useContext)(v);if(null==e)throw Error("useOptionsContext must be used within AgoraClientProvider");return e}function h(e){let{children:t,liveInfo:n=null}=e,[r,i]=(0,l.useState)(()=>null!=n?n:null);(0,l.useEffect)(()=>{null!=n&&i(n)},[null==n?void 0:n.db_session_id]);let a=(0,l.useMemo)(()=>({liveInfo:r}),[r]);return(0,u.jsx)(v.Provider,{value:a,children:t})}let p=(0,l.createContext)(null);function g(){let e=(0,l.useContext)(p);if(null==e)throw Error("useEventsContext must be used within AgoraClientProvider");return e}function x(e){let{children:t}=e,n=(0,r.iw)(),{liveInfo:i}=m(),{on:o,off:s}=function(e,t){let[n]=(0,l.useState)(()=>new Map),u=(0,l.useRef)(t);u.current=t;let r=(0,l.useRef)(new Map);return(0,l.useEffect)(()=>{let t=(e,t,n)=>{let l=u.current;if(null!=l&&Number(e.uid)!==Number(l))return};return e.on("user-published",t),()=>{e.off("user-published",t),n.clear()}},[e]),(0,l.useEffect)(()=>{let t=r.current,l=(e,l)=>{let r=u.current;if(null!=r&&Number(e)===Number(r))try{var i;let u=new TextDecoder().decode(l),r=JSON.parse(u),{event:o,data:s,msg_id:c}=r;if(!function(e,t){if(null==t||""===t)return!0;let n=String(t);if(e.has(n))return!1;for(e.set(n,!0);e.size>5e3;){let t=e.keys().next().value;if(void 0===t)break;e.delete(t)}return!0}(t,c))return;(0,a.fH)("event on receive stream",e,r),null==(i=n.get(o))||i.forEach(e=>e(s))}catch(e){(0,a.fH)("parse res error",e)}};return e.on("stream-message",l),()=>{e.off("stream-message",l),t.clear()}},[e]),{on:(0,l.useCallback)((e,t)=>{var u;n.has(e)||n.set(e,new Set),null==(u=n.get(e))||u.add(t)},[n]),off:(0,l.useCallback)((e,t)=>{var u;null==(u=n.get(e))||u.delete(t)},[n])}}(n,null==i?void 0:i.server_uid),c=(0,l.useCallback)(async(e,t)=>{let n=(null==i?void 0:i.db_session_id)||0;return"chat"===e||"prompt"===e?f({type:e,content:t,session_id:n,agora_uid:null==i?void 0:i.agora_uid}):f({type:e,session_id:n,agora_uid:null==i?void 0:i.agora_uid,payload:t})},[null==i?void 0:i.db_session_id,null==i?void 0:i.agora_uid]),d=(0,l.useMemo)(()=>({on:o,off:s,send:c}),[o,s,c]);return(0,u.jsx)(p.Provider,{value:d,children:t})}function b(e){let{children:t}=e;return(0,u.jsx)(x,{children:t})}let w=(0,l.createContext)(null);function y(e){return(null==e?void 0:e.is_interrupted)?"block":"connecting"}function C(e){var t;let{children:n,initialData:i={}}=e,{on:a,off:o}=g(),{liveInfo:d}=m(),f=(0,l.useId)(),v=(0,l.useRef)(new Set),[h,p]=(0,l.useState)(null!=(t=null==d?void 0:d.online_count)?t:null),[x,b]=(0,l.useState)(()=>y(d)),[C,_]=(0,l.useState)(""),[S,k]=(0,l.useState)([]),A=(0,r.iw)();!function(e,t,n,u){let r=(0,l.useRef)(e);r.current=e;let i=(0,l.useRef)(t);i.current=t;let[a,o]=(0,l.useState)(!1),s=(0,l.useCallback)(async()=>{var e;let t=null==(e=r.current)?void 0:e.db_session_id;if(null!=t)try{let e=await (0,c.M4)(),u=(Array.isArray(e)?e:[]).find(e=>e.db_session_id===t);if(!u)return void n(e=>"end"===e?e:"end");u.is_interrupted&&n(e=>"end"===e?e:"block")}catch(e){}},[n]);(0,l.useEffect)(()=>{let e;if(!("connecting"===t||"playing"===t&&a||"block"===t))return;let n="block"===t?6e4:2e4,u=setTimeout(()=>{s(),e=setInterval(()=>{s()},n)},n);return()=>{clearTimeout(u),void 0!==e&&clearInterval(e)}},[t,a,s]);let d=(0,l.useCallback)((t,n)=>{"video"===n&&t.uid===(null==e?void 0:e.server_uid)&&o(!1)},[null==e?void 0:e.server_uid]),f=(0,l.useCallback)((t,n)=>{if("video"===n&&t.uid===(null==e?void 0:e.server_uid)){let e=i.current;"end"!==e&&"error"!==e&&"block"!==e&&o(!0)}},[null==e?void 0:e.server_uid]);(0,l.useEffect)(()=>(u.on("user-published",d),u.on("user-unpublished",f),()=>{u.off("user-published",d),u.off("user-unpublished",f)}),[u,d,f])}(d,x,b,A),(0,l.useEffect)(()=>{let e=null==d?void 0:d.started_at;if(null==e||""===String(e).trim())return void _("");let t=s()(e);if(!t.isValid())return void _("");if("end"===x)return;let n=()=>{let e=Math.max(0,s()().utc().diff(t.utc()));_(s()(0).add(e,"millisecond").toISOString())};n();let u=window.setInterval(n,1e3);return()=>window.clearInterval(u)},[null==d?void 0:d.started_at,x]);let E=(0,l.useCallback)(e=>{k(t=>t.filter(t=>t.id!==e.id)),v.current.forEach(t=>{t(e)})},[]),I=(0,l.useCallback)(e=>(v.current.add(e),()=>{v.current.delete(e)}),[]);(0,l.useEffect)(()=>{b(y(d))},[null==d?void 0:d.db_session_id,null==d?void 0:d.is_interrupted]),(0,l.useEffect)(()=>{"end"===x&&k([])},[x]),(0,l.useEffect)(()=>{let e=e=>{p(e.nums)};return a("user-num-change",e),()=>o("user-num-change",e)},[a,o]),(0,l.useEffect)(()=>{let e=e=>{let t="string"==typeof e.prompt?e.prompt.trim():"";if(!t)return;let n=null==e.prompt_id?"":String(e.prompt_id).trim();if(!n)return;let u=Date.now(),l="".concat(f,"-").concat(u,"-").concat(Math.random().toString(36).slice(2,9));k(r=>{var i;return[...r,{id:l,prompt_id:n,timestamp:u,prompt:t,avatar:"string"==typeof e.avatar?e.avatar:"",name:"string"==typeof e.name&&e.name.trim()?e.name:String(null!=(i=e.nickname)?i:""),uid:e.uid}]})};return a("prompt-send",e),()=>o("prompt-send",e)},[a,o,f]),(0,l.useEffect)(()=>{let e=e=>b("block"),t=e=>b("playing"),n=e=>b("end"),u=e=>b("error"),l=(e,t)=>{"video"===t&&e.uid===(null==d?void 0:d.server_uid)&&b(e=>"block"!==e?"playing":e)},r=(e,t)=>{"video"===t&&(e.uid,null==d||d.server_uid)};return A.on("user-published",l),A.on("user-unpublished",r),a("session_block",e),a("session_resume",t),a("end",n),a("session_error",u),()=>{o("session_block",e),o("session_resume",t),o("end",n),o("session_error",u),A.off("user-published",l),A.off("user-unpublished",r)}},[a,o,A,null==d?void 0:d.server_uid]);let q=(0,l.useMemo)(()=>({userNumber:h,sessionState:x,liveUtcFormatted:C,danmakuItems:S,completeDanmakuScroll:E,subscribeDanmakuScrollComplete:I}),[h,x,C,S,E,I]);return(0,u.jsx)(w.Provider,{value:q,children:n})}var _=n(49855),S=n(25781);let k={active:null,queue:[],queuePosition:-1,queueItem:null,cancelQueue:async()=>{}};function A(e,t,n){var u;if(null==t||!e.length)return{queuePosition:-1,queueItem:null};let l=e.findIndex(e=>Number(e.uid)===Number(t));if(-1===l)return{queuePosition:-1,queueItem:null};let r=null!=(u=e[l])?u:null;return null!=r&&r.queueId===n?{queuePosition:-1,queueItem:null}:{queuePosition:l,queueItem:r}}function E(e){return e===_.fW.dress}function I(e){var t,n,u,l,r,i;return E(null==e||null==(t=e.extra)?void 0:t.extraType)?{active:null!=(r=null==e||null==(n=e.extra)?void 0:n.nowActive)?r:null,queue:null!=(i=null==e||null==(l=e.extra)||null==(u=l.queue)?void 0:u.items)?i:[]}:k}let q=(0,l.createContext)(null);function R(e){var t,n;let{children:r}=e,{on:i,off:a,send:o}=g(),{liveInfo:s}=m(),{userInfo:c}=(0,S.kH)(),d=E(null==s||null==(t=s.extra)?void 0:t.extraType),[f,v]=(0,l.useState)(()=>I(s).active),[h,p]=(0,l.useState)(()=>I(s).queue),[x,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=I(s);v(e.active),p(e.queue),b(null)},[null==s?void 0:s.db_session_id,null==s||null==(n=s.extra)?void 0:n.extraType]),(0,l.useEffect)(()=>{if(!d)return;let e=e=>{v(e),p(t=>t.filter(t=>t.queueId!==e.queueId&&t.timestamp>=e.timestamp))},t=e=>{p(t=>t.filter(t=>t.queueId!==e.queueId))},n=e=>{p(t=>[...t,e])},u=e=>{p(t=>t.filter(t=>t.queueId!==e.queueId)),b(t=>t===e.queueId?null:t)};return i("outfit_activated",e),i("generation_failed",t),i("outfit_queued",n),i("outfit_cancelled",u),()=>{a("outfit_activated",e),a("generation_failed",t),a("outfit_queued",n),a("outfit_cancelled",u)}},[d,i,a]);let w=(0,l.useCallback)(async()=>{let{queueItem:e}=A(h,null==c?void 0:c.accountId,x);if(null==e)return;let{queueId:t}=e;await o("cancel_outfit",{queueId:t}),b(t)},[x,h,o,null==c?void 0:c.accountId]),y=(0,l.useMemo)(()=>d?{active:f,queue:h,...A(h,null==c?void 0:c.accountId,x),cancelQueue:w}:k,[d,f,w,x,h,null==c?void 0:c.accountId]);return(0,u.jsx)(q.Provider,{value:y,children:r})}function j(e){let{children:t}=e;return(0,u.jsx)(R,{children:t})}let T=e=>e.slice(-200),N=(0,l.createContext)(null);function M(e){let{children:t}=e,{on:n,off:r}=g(),{liveInfo:i}=m(),[a,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{let e=Number(null==i?void 0:i.db_session_id);if(!e)return;let t=!1;return(async()=>{try{let n=await (e=>{let{session_id:t,limit:n}=e;return(0,d.Jt)("/live/room/".concat(t,"/chat-history"),{params:{limit:n},skipAuthCheck:!0})})({session_id:e,limit:100});if(t)return;o(T(n.items))}catch(e){}})(),()=>{t=!0}},[null==i?void 0:i.db_session_id]),(0,l.useEffect)(()=>{let e=e=>{o(t=>T([...t,e]))};return n("chat-send",e),()=>r("chat-send",e)},[n,r]);let s=(0,l.useMemo)(()=>({messages:a}),[a]);return(0,u.jsx)(N.Provider,{value:s,children:t})}function P(e){let{children:t}=e;return(0,u.jsx)(M,{children:t})}let F=e=>{let{joinPromiseRef:t}=e,n=(0,r.iw)(),u=(0,l.useRef)(!1),{on:a,off:o}=B.useEvents();return(0,l.useEffect)(()=>{let e=()=>{u.current||(u.current=!0,(0,i.z)(n,t.current))};return a("end",e),()=>{o("end",e),e()}},[n,t,o,a]),null},B=Object.assign(function(e){let{children:t,joinOptions:n,ready:i=!0,liveInfo:o,initialData:s}=e,c=(0,l.useMemo)(()=>{r.Ay.enableLogUpload(),r.Ay.setLogLevel((0,a.Nw)());let e=r.Ay.createClient({mode:"live",codec:"h264"});return e.setClientRole("audience"),e},[]),d=(0,l.useRef)(!1),f=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(i&&!d.current){d.current=!0;let e=c.join(n.appid,n.channel,n.token,n.uid).catch(()=>{d.current=!1}).finally(()=>{f.current===e&&(f.current=null)});f.current=e}},[i,c,n]),(0,u.jsx)(r.jI,{client:c,children:(0,u.jsx)(h,{liveInfo:o,children:(0,u.jsx)(b,{children:(0,u.jsx)(j,{children:(0,u.jsx)(C,{initialData:s,children:(0,u.jsxs)(P,{children:[(0,u.jsx)(F,{joinPromiseRef:f}),t]})})})})})})},{useOptions:m,useData:function(){let e=(0,l.useContext)(w);if(null==e)throw Error("useDataContext must be used within AgoraClientProvider");return e},useEvents:g,useMessages:function(){let e=(0,l.useContext)(N);if(null==e)throw Error("useMessagesContext must be used within AgoraClientProvider");return e},useDress:function(){let e=(0,l.useContext)(q);if(null==e)throw Error("useDressContext must be used within AgoraClientProvider");return e}})},50167:(e,t,n)=>{"use strict";n.d(t,{R:()=>i});var u=n(25771);n(87163);var l=n(57425);let r={body:'<g fill="none"><circle cx="12" cy="12" r="9" stroke="#fff" stroke-width="1.5"/><path stroke="#fff" stroke-linecap="round" stroke-width="1.5" d="M9.3 16.5a4.5 4.5 0 012.7-.9c1.004 0 1.935.333 2.7.9"/><ellipse cx="14.7" cy="10.65" fill="#fff" rx=".9" ry="1.35"/><ellipse cx="9.3" cy="10.65" fill="#fff" rx=".9" ry="1.35"/></g>',viewBox:{left:0,top:0,width:24,height:24},left:0,top:0,width:24,height:24},i=e=>{let{className:t="",...n}=e;return(0,u.jsx)("div",{className:t,style:{height:"1em",aspectRatio:1},children:(0,u.jsx)(l.In,{...n,icon:r,height:"1em"})})}},62902:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var u=n(25771),l=n(87163),r=n(78842),i=n(9946),a=n(23007),o=n(33047);n(98701);let s=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255]:[1,1,1]},c=e=>{let{timeSpeed:t=.25,colorBalance:n=0,warpStrength:c=1,warpFrequency:d=5,warpSpeed:f=2,warpAmplitude:v=50,blendAngle:m=0,blendSoftness:h=.05,rotationAmount:p=500,noiseScale:g=2,grainAmount:x=.1,grainScale:b=2,grainAnimated:w=!1,contrast:y=1.5,gamma:C=1,saturation:_=1,centerX:S=0,centerY:k=0,zoom:A=.9,color1:E="#FF9FFC",color2:I="#5227FF",color3:q="#B19EEF",className:R=""}=e,j=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!j.current)return;let e=new r.A({webgl:2,alpha:!0,antialias:!1,dpr:Math.min(window.devicePixelRatio||1,2)}),u=e.gl,l=u.canvas;l.style.width="100%",l.style.height="100%",l.style.display="block";let R=j.current;R.appendChild(l);let T=new i.l(u),N=new a.B(u,{vertex:"#version 300 es\nin vec2 position;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}\n",fragment:"#version 300 es\nprecision highp float;\nuniform vec2 iResolution;\nuniform float iTime;\nuniform float uTimeSpeed;\nuniform float uColorBalance;\nuniform float uWarpStrength;\nuniform float uWarpFrequency;\nuniform float uWarpSpeed;\nuniform float uWarpAmplitude;\nuniform float uBlendAngle;\nuniform float uBlendSoftness;\nuniform float uRotationAmount;\nuniform float uNoiseScale;\nuniform float uGrainAmount;\nuniform float uGrainScale;\nuniform float uGrainAnimated;\nuniform float uContrast;\nuniform float uGamma;\nuniform float uSaturation;\nuniform vec2 uCenterOffset;\nuniform float uZoom;\nuniform vec3 uColor1;\nuniform vec3 uColor2;\nuniform vec3 uColor3;\nout vec4 fragColor;\n#define S(a,b,t) smoothstep(a,b,t)\nmat2 Rot(float a){float s=sin(a),c=cos(a);return mat2(c,-s,s,c);} \nvec2 hash(vec2 p){p=vec2(dot(p,vec2(2127.1,81.17)),dot(p,vec2(1269.5,283.37)));return fract(sin(p)*43758.5453);} \nfloat noise(vec2 p){vec2 i=floor(p),f=fract(p),u=f*f*(3.0-2.0*f);float n=mix(mix(dot(-1.0+2.0*hash(i+vec2(0.0,0.0)),f-vec2(0.0,0.0)),dot(-1.0+2.0*hash(i+vec2(1.0,0.0)),f-vec2(1.0,0.0)),u.x),mix(dot(-1.0+2.0*hash(i+vec2(0.0,1.0)),f-vec2(0.0,1.0)),dot(-1.0+2.0*hash(i+vec2(1.0,1.0)),f-vec2(1.0,1.0)),u.x),u.y);return 0.5+0.5*n;}\nvoid mainImage(out vec4 o, vec2 C){\n float t=iTime*uTimeSpeed;\n vec2 uv=C/iResolution.xy;\n float ratio=iResolution.x/iResolution.y;\n vec2 tuv=uv-0.5+uCenterOffset;\n tuv/=max(uZoom,0.001);\n\n float degree=noise(vec2(t*0.1,tuv.x*tuv.y)*uNoiseScale);\n tuv.y*=1.0/ratio;\n tuv*=Rot(radians((degree-0.5)*uRotationAmount+180.0));\n tuv.y*=ratio;\n\n float frequency=uWarpFrequency;\n float ws=max(uWarpStrength,0.001);\n float amplitude=uWarpAmplitude/ws;\n float warpTime=t*uWarpSpeed;\n tuv.x+=sin(tuv.y*frequency+warpTime)/amplitude;\n tuv.y+=sin(tuv.x*(frequency*1.5)+warpTime)/(amplitude*0.5);\n\n vec3 colLav=uColor1;\n vec3 colOrg=uColor2;\n vec3 colDark=uColor3;\n float b=uColorBalance;\n float s=max(uBlendSoftness,0.0);\n mat2 blendRot=Rot(radians(uBlendAngle));\n float blendX=(tuv*blendRot).x;\n float edge0=-0.3-b-s;\n float edge1=0.2-b+s;\n float v0=0.5-b+s;\n float v1=-0.3-b-s;\n vec3 layer1=mix(colDark,colOrg,S(edge0,edge1,blendX));\n vec3 layer2=mix(colOrg,colLav,S(edge0,edge1,blendX));\n vec3 col=mix(layer1,layer2,S(v0,v1,tuv.y));\n\n vec2 grainUv=uv*max(uGrainScale,0.001);\n if(uGrainAnimated>0.5){grainUv+=vec2(iTime*0.05);} \n float grain=fract(sin(dot(grainUv,vec2(12.9898,78.233)))*43758.5453);\n col+=(grain-0.5)*uGrainAmount;\n\n col=(col-0.5)*uContrast+0.5;\n float luma=dot(col,vec3(0.2126,0.7152,0.0722));\n col=mix(vec3(luma),col,uSaturation);\n col=pow(max(col,0.0),vec3(1.0/max(uGamma,0.001)));\n col=clamp(col,0.0,1.0);\n\n o=vec4(col,1.0);\n}\nvoid main(){\n vec4 o=vec4(0.0);\n mainImage(o,gl_FragCoord.xy);\n fragColor=o;\n}\n",uniforms:{iTime:{value:0},iResolution:{value:new Float32Array([1,1])},uTimeSpeed:{value:t},uColorBalance:{value:n},uWarpStrength:{value:c},uWarpFrequency:{value:d},uWarpSpeed:{value:f},uWarpAmplitude:{value:v},uBlendAngle:{value:m},uBlendSoftness:{value:h},uRotationAmount:{value:p},uNoiseScale:{value:g},uGrainAmount:{value:x},uGrainScale:{value:b},uGrainAnimated:{value:+!!w},uContrast:{value:y},uGamma:{value:C},uSaturation:{value:_},uCenterOffset:{value:new Float32Array([S,k])},uZoom:{value:A},uColor1:{value:new Float32Array(s(E))},uColor2:{value:new Float32Array(s(I))},uColor3:{value:new Float32Array(s(q))}}}),M=new o.e(u,{geometry:T,program:N}),P=()=>{let t=R.getBoundingClientRect(),n=Math.max(1,Math.floor(t.width)),l=Math.max(1,Math.floor(t.height));e.setSize(n,l);let r=N.uniforms.iResolution.value;r[0]=u.drawingBufferWidth,r[1]=u.drawingBufferHeight},F=new ResizeObserver(P);F.observe(R),P();let B=0,W=performance.now(),D=t=>{N.uniforms.iTime.value=(t-W)*.001,e.render({scene:M}),B=requestAnimationFrame(D)};return B=requestAnimationFrame(D),()=>{cancelAnimationFrame(B),F.disconnect();try{R.removeChild(l)}catch(e){}}},[t,n,c,d,f,v,m,h,p,g,x,b,w,y,C,_,S,k,A,E,I,q]),(0,u.jsx)("div",{ref:j,className:"grainient-container ".concat(R).trim()})}},95482:(e,t,n)=>{"use strict";n.d(t,{z:()=>r});let u=e=>{if(null==e?void 0:e.isPlaying)try{e.stop()}catch(e){}},l=e=>{u(e);try{e.close()}catch(e){}};async function r(e,t){if(t)try{await t}catch(e){}let n=e.localTracks.slice();if(n.length)try{await e.unpublish(n)}catch(e){}n.forEach(l);let r=e.localDataChannels.slice();r.length&&await Promise.all(r.map(t=>e.unpublish(t).catch(()=>void 0)));let i=e.remoteUsers.slice(),a=[],o=[];if(i.forEach(t=>{var n;u(t.audioTrack),u(t.videoTrack),t.audioTrack&&a.push({user:t,mediaType:"audio"}),t.videoTrack&&a.push({user:t,mediaType:"video"}),null==(n=t.dataChannels)||n.forEach(n=>{o.push(e.unsubscribe(t,"datachannel",n.id).catch(()=>void 0))})}),a.length)try{await e.massUnsubscribe(a)}catch(e){}o.length&&await Promise.all(o);try{"DISCONNECTED"!==e.connectionState&&await e.leave()}catch(e){}e.removeAllListeners()}},98701:()=>{}}]);