import{S as z,i as G,s as T,w as g,a as F,e as $,x as b,c as H,y as k,b as h,f,t as m,d as V,z as P,h as p,H as y,o as X,g as Z,I as Y,k as I,q as N,l as R,m as S,r as M,n as E,G as d,B as L}from"../../chunks/index-fecbaf1e.js";import{A as J,c as K,P as U,s as C,M as O,C as B,F as D,S as Q,L as W,t as j,R as x,a as ee}from"../../chunks/About-16010975.js";function q(l){let e,o;return e=new W({props:{client:l[1],$$slots:{default:[re]},$$scope:{ctx:l}}}),{c(){g(e.$$.fragment)},l(t){b(e.$$.fragment,t)},m(t,n){k(e,t,n),o=!0},p(t,n){const s={};n&2&&(s.client=t[1]),n&260&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){o||(f(e.$$.fragment,t),o=!0)},o(t){m(e.$$.fragment,t),o=!1},d(t){P(e,t)}}}function te(l){let e,o,t,n,s,r;return{c(){e=I("div"),o=I("h1"),t=N("No room selected"),n=F(),s=I("p"),r=N("Please select a room in the URL"),this.h()},l(i){e=R(i,"DIV",{class:!0});var a=S(e);o=R(a,"H1",{class:!0});var c=S(o);t=M(c,"No room selected"),c.forEach(p),n=H(a),s=R(a,"P",{class:!0});var u=S(s);r=M(u,"Please select a room in the URL"),u.forEach(p),a.forEach(p),this.h()},h(){E(o,"class","text-2xl font-bold"),E(s,"class","text-gray-500"),E(e,"class","flex flex-col items-center justify-center h-full")},m(i,a){h(i,e,a),d(e,o),d(o,t),d(e,n),d(e,s),d(s,r)},p:L,i:L,o:L,d(i){i&&p(e)}}}function oe(l){let e,o;return e=new x({props:{id:l[2],initialPresence:l[4],$$slots:{default:[se]},$$scope:{ctx:l}}}),{c(){g(e.$$.fragment)},l(t){b(e.$$.fragment,t)},m(t,n){k(e,t,n),o=!0},p(t,n){const s={};n&4&&(s.id=t[2]),n&256&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){o||(f(e.$$.fragment,t),o=!0)},o(t){m(e.$$.fragment,t),o=!1},d(t){P(e,t)}}}function se(l){let e,o;return e=new ee({}),{c(){g(e.$$.fragment)},l(t){b(e.$$.fragment,t)},m(t,n){k(e,t,n),o=!0},i(t){o||(f(e.$$.fragment,t),o=!0)},o(t){m(e.$$.fragment,t),o=!1},d(t){P(e,t)}}}function re(l){let e,o,t,n;const s=[oe,te],r=[];function i(a,c){return a[2]?0:1}return e=i(l),o=r[e]=s[e](l),{c(){o.c(),t=$()},l(a){o.l(a),t=$()},m(a,c){r[e].m(a,c),h(a,t,c),n=!0},p(a,c){let u=e;e=i(a),e===u?r[e].p(a,c):(Z(),m(r[u],1,1,()=>{r[u]=null}),V(),o=r[e],o?o.p(a,c):(o=r[e]=s[e](a),o.c()),f(o,1),o.m(t.parentNode,t))},i(a){n||(f(o),n=!0)},o(a){m(o),n=!1},d(a){r[e].d(a),a&&p(t)}}}function ne(l){let e,o,t,n;e=new J({props:{classList:l[3]||l[0]?"flex":"hidden",loading:l[0]}}),e.$on("click",l[6]);let s=!l[0]&&q(l);return{c(){g(e.$$.fragment),o=F(),s&&s.c(),t=$()},l(r){b(e.$$.fragment,r),o=H(r),s&&s.l(r),t=$()},m(r,i){k(e,r,i),h(r,o,i),s&&s.m(r,i),h(r,t,i),n=!0},p(r,[i]){const a={};i&9&&(a.classList=r[3]||r[0]?"flex":"hidden"),i&1&&(a.loading=r[0]),e.$set(a),r[0]?s&&(Z(),m(s,1,1,()=>{s=null}),V()):s?(s.p(r,i),i&1&&f(s,1)):(s=q(r),s.c(),f(s,1),s.m(t.parentNode,t))},i(r){n||(f(e.$$.fragment,r),f(s),n=!0)},o(r){m(e.$$.fragment,r),m(s),n=!1},d(r){P(e,r),r&&p(o),s&&s.d(r),r&&p(t)}}}function ae(l,e,o){let t,n,s;y(l,C,_=>o(5,n=_)),y(l,j,_=>o(3,s=_));let r=!0,i;X(()=>{o(1,i=K({authEndpoint:U+"/auth"})),a()});async function a(){o(0,r=!0);const _=new URLSearchParams(window.location.search).get("roomid"),v=await(await fetch(U+"/rooms")).json();if(_)v.find(w=>w.room_id===_)&&C.set(_);else{const A=v.find(w=>w.users_countY(j,s=!1,s);return l.$$.update=()=>{l.$$.dirty&32&&o(2,t=n)},[r,i,t,s,c,n,u]}class fe extends z{constructor(e){super(),G(this,e,ae,ne,T,{})}}export{fe as default};