import{S as t,i as e,a as n,b as i,s,p as o,n as l,g as r,q as a,m as u,o as c,j as p,e as d,c as f,v as m,d as h,y as g,f as v,A as b,l as y,z as x,w,r as k,x as j}from"./index-db20528a.js";import{w as C}from"./index-720c0a59.js";import{getData as z,sendData as E}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/select-component.js";import"../../../../../../../../../js/components/switch-component.js";function T(t,e,n){const i=t.slice();return i[62]=e[n],i[64]=n,i}function q(t){let e,n,o,l,a,u,c,p,j,C,z,E,T,q,A,M,G,I,N,H,S,_,U,F,J,K,Q,B,D,P,V,W,X,Y,Z,$,tt,et,nt,it,st,ot,lt,rt,at,ut,ct,pt,dt,ft,mt,ht,gt=t[1],vt=L(t);return{c(){e=d("div"),n=d("h2"),n.textContent="Groups",o=f(),l=d("div"),a=d("h3"),a.textContent="My group",u=f(),c=d("span"),p=f(),j=d("section"),C=d("div"),z=d("div"),E=d("span"),E.textContent="Location:",T=f(),q=d("div"),A=d("button"),M=m(t[10]),G=f(),I=d("object"),N=f(),H=d("div"),S=d("div"),_=d("span"),_.textContent="Members:",U=f(),F=d("div"),J=d("div"),K=d("button"),K.textContent="save",Q=f(),B=d("input"),D=f(),P=d("button"),V=d("object"),W=f(),X=d("div"),Y=d("div"),Z=d("span"),Z.textContent="Contact:",$=f(),tt=d("div"),et=d("div"),nt=d("button"),nt.textContent="save",it=f(),st=d("input"),ot=f(),lt=d("button"),rt=d("object"),at=f(),ut=d("h3"),ut.textContent="Requests",ct=f(),pt=d("section"),vt.c(),dt=f(),ft=d("groups-add-component"),h(a,"class","group-heading"),h(c,"class","status"),h(I,"type","image/svg+xml"),h(I,"data","/img/profile/icons/pencil.svg"),h(I,"title","pencil-icon"),h(I,"class","pencil"),h(A,"class","change-field-button"),h(q,"class","change-field-div"),h(z,"class","change-field-line"),h(K,"class","save-button"),g(K,"display","none"),h(J,"class","save-button-wrapper"),h(B,"id","membersInput"),h(B,"class","text-input"),h(B,"type","text"),h(V,"type","image/svg+xml"),h(V,"data","/img/profile/icons/pencil.svg"),h(V,"title","pencil-icon"),h(V,"class","pencil"),h(P,"class","text-input-pencil-button"),h(F,"class","change-field-div input-pencil"),h(S,"class","change-field-line"),h(nt,"class","save-button"),g(nt,"display","none"),h(et,"class","save-button-wrapper"),h(st,"id","contactInput"),h(st,"class","text-input"),h(st,"type","text"),h(rt,"type","image/svg+xml"),h(rt,"data","/img/profile/icons/pencil.svg"),h(rt,"title","pencil-icon"),h(rt,"class","pencil"),h(lt,"class","text-input-pencil-button"),h(tt,"class","change-field-div input-pencil"),h(Y,"class","change-field-line"),h(j,"class","entries-section"),h(pt,"class","entries-section"),g(ft,"display","none")},m(s,r){i(s,e,r),v(e,n),v(e,o),v(e,l),v(l,a),v(l,u),v(l,c),t[27](c),v(e,p),v(e,j),v(j,C),v(C,z),v(z,E),v(z,T),v(z,q),v(q,A),v(A,M),v(A,G),v(A,I),t[28](A),v(j,N),v(j,H),v(H,S),v(S,_),v(S,U),v(S,F),v(F,J),v(J,K),t[29](K),v(F,Q),v(F,B),t[30](B),b(B,t[12]),v(F,D),v(F,P),v(P,V),t[33](V),t[34](P),t[36](F),v(j,W),v(j,X),v(X,Y),v(Y,Z),v(Y,$),v(Y,tt),v(tt,et),v(et,nt),t[37](nt),v(tt,it),v(tt,st),t[38](st),b(st,t[11]),v(tt,ot),v(tt,lt),v(lt,rt),t[41](rt),t[42](lt),t[43](tt),t[44](j),v(e,at),v(e,ut),v(e,ct),v(e,pt),vt.m(pt,null),t[47](pt),t[48](e),i(s,dt,r),i(s,ft,r),t[49](ft),mt||(ht=[y(A,"click",t[26]),y(K,"click",t[23]),y(B,"input",t[31]),y(B,"click",t[32]),y(P,"click",t[35]),y(nt,"click",O),y(st,"input",t[39]),y(st,"click",t[40]),y(lt,"click",(function(){x(R(t[7]))&&R(t[7]).apply(this,arguments)}))],mt=!0)},p(e,n){t=e,1024&n[0]&&w(M,t[10]),4096&n[0]&&B.value!==t[12]&&b(B,t[12]),2048&n[0]&&st.value!==t[11]&&b(st,t[11]),2&n[0]&&s(gt,gt=t[1])?(vt.d(1),vt=L(t),vt.c(),vt.m(pt,null)):vt.p(t,n)},d(n){n&&r(e),t[27](null),t[28](null),t[29](null),t[30](null),t[33](null),t[34](null),t[36](null),t[37](null),t[38](null),t[41](null),t[42](null),t[43](null),t[44](null),vt.d(n),t[47](null),t[48](null),n&&r(dt),n&&r(ft),t[49](null),mt=!1,k(ht)}}}function A(t){let e,n,s,o,l,a,u,c,p,b,x,w,j=t[62].email+"";function C(){return t[45](t[64],t[62])}function z(){return t[46](t[64],t[62])}return{c(){e=d("div"),n=d("div"),s=d("span"),o=m(j),l=f(),a=d("div"),u=d("button"),u.textContent="approve",c=f(),p=d("button"),p.textContent="reject",b=f(),h(u,"class","approve-button"),h(p,"class","approve-button"),g(p,"display","visible"),h(a,"class","request-button-wrapper"),h(n,"class","change-field-line")},m(t,r){i(t,e,r),v(e,n),v(n,s),v(s,o),v(n,l),v(n,a),v(a,u),v(a,c),v(a,p),v(e,b),x||(w=[y(u,"click",C),y(p,"click",z)],x=!0)},p(e,n){t=e},d(t){t&&r(e),x=!1,k(w)}}}function L(t){let e,n=t[20],s=[];for(let e=0;en(52,t)));let d=C(0);a(t,d,(t=>n(19,i=t)));let f,m,h,g,v,b,y,x,w,k,j,T,q,A,L,M,G,O=0,H=u("profile-component"),S=H.maps;function _(t){if(null!=t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>t)).join(", ")}return"Create or join group"}function U(){n(5,g.style.display="none",g)}function F(){n(8,y.style.display="none",y)}function J(t){null!=t&&n(17,M.innerHTML=_(t),M)}function K(){if(i==I&&[g,y,v,x].every((t=>null!=t&&null!=t)))if(document.addEventListener("click",(function(t){let e,n=this.activeElement.shadowRoot;null!=n&&(e=n.activeElement,n=e.shadowRoot,null!=n&&(e=n.activeElement)),e==h||e==g?F():e==b||e==y?U():(U(),F())})),H.updateUserGroup=J,n(10,w=_(o[0])),0==o.length)n(11,k=""),n(12,j="");else{let e=o[0];n(11,(t=e.contact,k=null==t?"https://discord.gg/Qk8KUk787z":t)),n(12,j=e.members);let i=e.status;null!=i&&(0==i?(n(18,G.innerHTML="(pending)",G),n(18,G.style.color="#FFC90E",G)):2==i&&(n(18,G.innerHTML="(rejected)",G),n(18,G.style.color="#c52a28",G)),n(13,T.style.display="none",T),n(14,q.style.display="none",q),n(16,L.style.cursor="default",L),n(15,A.style.cursor="default",A),n(4,h.readOnly=!0,h),n(7,b.readOnly=!0,b))}else{setTimeout((()=>K()),100)}var t}function Q(t,e){E("/xx/group-approve-request",{user_id:e}),l.splice(t,1),n(1,O+=1)}function B(t,e){E("/xx/group-reject-request",{user_id:e}),l.splice(t,1),n(1,O+=1)}function D(){n(3,m.style.display="block",m),n(2,f.style.display="none",f),null!=S.groupsAdd&&S.groupsAdd.invalidateSize()}z("/xx/get-user-groups",(function(t){o=JSON.parse(t),H.userGroups=o,d.update((t=>t+1))})),z("/xx/get-group-requests",(function(t){let e=JSON.parse(t);l.push(...e),d.update((t=>t+1))})),H.onLoadedGroups=K,H.launchGroupsAdd=D,H.closeGroupsAdd=function(){n(3,m.style.display="none",m),n(2,f.style.display="block",f)},c((()=>{K()}));return[s,O,f,m,h,g,v,b,y,x,w,k,j,T,q,A,L,M,G,i,l,r,d,function(){let t=emailInput.value;AuthTools.checkEmail(t,emailMsg)&&(t!=user.email&&AuthTools.changeUser("email",t,user),U())},Q,B,D,function(t){p[t?"unshift":"push"]((()=>{G=t,n(18,G)}))},function(t){p[t?"unshift":"push"]((()=>{M=t,n(17,M)}))},function(t){p[t?"unshift":"push"]((()=>{g=t,n(5,g)}))},function(t){p[t?"unshift":"push"]((()=>{h=t,n(4,h)}))},function(){j=this.value,n(12,j)},()=>N(g,h),function(t){p[t?"unshift":"push"]((()=>{T=t,n(13,T)}))},function(t){p[t?"unshift":"push"]((()=>{A=t,n(15,A)}))},()=>{R(h)},function(t){p[t?"unshift":"push"]((()=>{v=t,n(6,v)}))},function(t){p[t?"unshift":"push"]((()=>{y=t,n(8,y)}))},function(t){p[t?"unshift":"push"]((()=>{b=t,n(7,b)}))},function(){k=this.value,n(11,k)},()=>N(y,b),function(t){p[t?"unshift":"push"]((()=>{q=t,n(14,q)}))},function(t){p[t?"unshift":"push"]((()=>{L=t,n(16,L)}))},function(t){p[t?"unshift":"push"]((()=>{x=t,n(9,x)}))},function(t){p[t?"unshift":"push"]((()=>{s=t,n(0,s)}))},(t,e)=>Q(t,e.user_id),(t,e)=>B(t,e.user_id),function(t){p[t?"unshift":"push"]((()=>{s=t,n(0,s)}))},function(t){p[t?"unshift":"push"]((()=>{f=t,n(2,f)}))},function(t){p[t?"unshift":"push"]((()=>{m=t,n(3,m)}))}]}class S extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},H,G,s,{},null,[-1,-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("profile-groups",S);export{S as default};