2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{S as t,i as e,a as n,b as i,s,q as o,n as l,g as r,t as a,m as c,o as u,j as p,e as d,c as f,w as m,d as h,z as g,f as v,A as b,l as y,p as x,x as w,r as k,y as j}from"./index-5b685137.js";import{w as C}from"./index-8744cf8a.js";import{getData as z,sendData as q}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/select-component.js";import"../../../../../../../../../js/components/switch-component.js";function E(t,e,n){const i=t.slice();return i[64]=e[n],i[66]=n,i}function L(t){let e,n,o,l,a,c,u,p,j,C,z,q,E,L,G,T,A,I,N,R,H,S,_,F,J,U,K,Q,B,D,P,V,W,X,Y,Z,$,tt,et,nt,it,st,ot,lt,rt,at,ct,ut,pt,dt,ft,mt,ht=t[1],gt=M(t);return{c(){e=d("div"),n=d("h2"),n.textContent="Groups",o=f(),l=d("div"),a=d("h3"),a.textContent="My group",c=f(),u=d("span"),p=f(),j=d("section"),C=d("div"),z=d("div"),q=d("span"),q.textContent="Location:",E=f(),L=d("div"),G=d("button"),T=m(t[10]),A=f(),I=d("object"),N=f(),R=d("div"),H=d("div"),S=d("span"),S.textContent="Members:",_=f(),F=d("div"),J=d("div"),U=d("button"),U.textContent="save",K=f(),Q=d("input"),B=f(),D=d("button"),P=d("object"),V=f(),W=d("div"),X=d("div"),Y=d("span"),Y.textContent="Contact:",Z=f(),$=d("div"),tt=d("div"),et=d("button"),et.textContent="save",nt=f(),it=d("input"),st=f(),ot=d("button"),lt=d("object"),rt=f(),at=d("h3"),at.textContent="Requests",ct=f(),ut=d("section"),gt.c(),pt=f(),dt=d("groups-add-component"),h(a,"class","group-heading"),h(u,"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(G,"class","change-field-button"),h(L,"class","change-field-div"),h(z,"class","change-field-line"),h(U,"class","save-button"),g(U,"display","none"),h(J,"class","save-button-wrapper"),h(Q,"id","membersInput"),h(Q,"class","text-input"),h(Q,"type","text"),h(P,"type","image/svg+xml"),h(P,"data","/img/profile/icons/pencil.svg"),h(P,"title","pencil-icon"),h(P,"class","pencil"),h(D,"class","text-input-pencil-button"),h(F,"class","change-field-div input-pencil"),h(H,"class","change-field-line"),h(et,"class","save-button"),g(et,"display","none"),h(tt,"class","save-button-wrapper"),h(it,"id","contactInput"),h(it,"class","text-input"),h(it,"type","text"),h(lt,"type","image/svg+xml"),h(lt,"data","/img/profile/icons/pencil.svg"),h(lt,"title","pencil-icon"),h(lt,"class","pencil"),h(ot,"class","text-input-pencil-button"),h($,"class","change-field-div input-pencil"),h(X,"class","change-field-line"),h(j,"class","entries-section"),h(ut,"class","entries-section"),g(dt,"display","none")},m(s,r){i(s,e,r),v(e,n),v(e,o),v(e,l),v(l,a),v(l,c),v(l,u),t[28](u),v(e,p),v(e,j),v(j,C),v(C,z),v(z,q),v(z,E),v(z,L),v(L,G),v(G,T),v(G,A),v(G,I),t[29](G),v(j,N),v(j,R),v(R,H),v(H,S),v(H,_),v(H,F),v(F,J),v(J,U),t[30](U),v(F,K),v(F,Q),t[31](Q),b(Q,t[12]),v(F,B),v(F,D),v(D,P),t[34](P),t[35](D),t[37](F),v(j,V),v(j,W),v(W,X),v(X,Y),v(X,Z),v(X,$),v($,tt),v(tt,et),t[38](et),v($,nt),v($,it),t[39](it),b(it,t[11]),v($,st),v($,ot),v(ot,lt),t[42](lt),t[43](ot),t[44]($),t[45](j),v(e,rt),v(e,at),v(e,ct),v(e,ut),gt.m(ut,null),t[48](ut),t[49](e),i(s,pt,r),i(s,dt,r),t[50](dt),ft||(mt=[y(G,"click",t[27]),y(U,"click",t[23]),y(Q,"input",t[32]),y(Q,"click",t[33]),y(D,"click",t[36]),y(et,"click",t[24]),y(it,"input",t[40]),y(it,"click",t[41]),y(ot,"click",(function(){x(O(t[7]))&&O(t[7]).apply(this,arguments)}))],ft=!0)},p(e,n){t=e,1024&n[0]&&w(T,t[10]),4096&n[0]&&Q.value!==t[12]&&b(Q,t[12]),2048&n[0]&&it.value!==t[11]&&b(it,t[11]),2&n[0]&&s(ht,ht=t[1])?(gt.d(1),gt=M(t),gt.c(),gt.m(ut,null)):gt.p(t,n)},d(n){n&&r(e),t[28](null),t[29](null),t[30](null),t[31](null),t[34](null),t[35](null),t[37](null),t[38](null),t[39](null),t[42](null),t[43](null),t[44](null),t[45](null),gt.d(n),t[48](null),t[49](null),n&&r(pt),n&&r(dt),t[50](null),ft=!1,k(mt)}}}function G(t){let e,n,s,o,l,a,c,u,p,b,x,w,j=t[64].email+"";function C(){return t[46](t[66],t[64])}function z(){return t[47](t[66],t[64])}return{c(){e=d("div"),n=d("div"),s=d("span"),o=m(j),l=f(),a=d("div"),c=d("button"),c.textContent="approve",u=f(),p=d("button"),p.textContent="reject",b=f(),h(c,"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,c),v(a,u),v(a,p),v(e,b),x||(w=[y(c,"click",C),y(p,"click",z)],x=!0)},p(e,n){t=e},d(t){t&&r(e),x=!1,k(w)}}}function M(t){let e,n=t[20],s=[];for(let e=0;e<n.length;e+=1)s[e]=G(E(t,n,e));return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=o()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);i(t,e,n)},p(t,i){if(101711872&i[0]){let o;for(n=t[20],o=0;o<n.length;o+=1){const l=E(t,n,o);s[o]?s[o].p(l,i):(s[o]=G(l),s[o].c(),s[o].m(e.parentNode,e))}for(;o<s.length;o+=1)s[o].d(1);s.length=n.length}},d(t){j(s,t),t&&r(e)}}}function T(t){let e,n=t[19]==I&&L(t);return{c(){n&&n.c(),e=o()},m(t,s){n&&n.m(t,s),i(t,e,s)},p(t,i){t[19]==I?n?n.p(t,i):(n=L(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&r(e)}}}function A(t){let e,n=t[19],a=T(t);return{c(){a.c(),e=o(),this.c=l},m(t,n){a.m(t,n),i(t,e,n)},p(t,i){524288&i[0]&&s(n,n=t[19])?(a.d(1),a=T(t),a.c(),a.m(e.parentNode,e)):a.p(t,i)},i:l,o:l,d(t){t&&r(e),a.d(t)}}}let I=2;function N(t,e){e.readOnly||(t.style.display="initial")}function O(t){t.focus(),t.click()}function R(t,e,n){let i,s,o=[],l=[],r=C({});a(t,r,(t=>n(54,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,E,L,G,M,T,A,R=0,H={contact:null,members:null},S=c("profile-component"),_=S.maps;function F(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 J(){n(5,g.style.display="none",g),n(12,j=H.members)}function U(){n(8,y.style.display="none",y),n(11,k=H.contact)}function K(t){null!=t&&n(17,T.innerHTML=F(t),T)}function Q(){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?U():e==b||e==y?J():(J(),U())})),S.updateUserGroup=K,n(10,w=F(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)),H.contact=k,n(12,j=e.members),H.members=j;let i=e.status;null!=i&&(0==i?(n(18,A.innerHTML="(pending)",A),n(18,A.style.color="#FFC90E",A)):2==i&&(n(18,A.innerHTML="(rejected)",A),n(18,A.style.color="#c52a28",A)),n(13,E.style.display="none",E),n(14,L.style.display="none",L),n(16,M.style.cursor="default",M),n(15,G.style.cursor="default",G),n(4,h.readOnly=!0,h),n(7,b.readOnly=!0,b))}else{setTimeout((()=>Q()),100)}var t}function B(t,e){q("/xx/group-approve-request",{user_id:e}),l.splice(t,1),n(1,R+=1)}function D(t,e){q("/xx/group-reject-request",{user_id:e}),l.splice(t,1),n(1,R+=1)}function P(){n(3,m.style.display="block",m),n(2,f.style.display="none",f),null!=_.groupsAdd&&_.groupsAdd.invalidateSize()}z("/xx/get-user-groups",(function(t){o=JSON.parse(t),S.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))})),S.onLoadedGroups=Q,S.launchGroupsAdd=P,S.closeGroupsAdd=function(){n(3,m.style.display="none",m),n(2,f.style.display="block",f)},u((()=>{Q()}));return[s,R,f,m,h,g,v,b,y,x,w,k,j,E,L,G,M,T,A,i,l,r,d,function(){let t=parseInt(h.value);q("/xx/group-change",{members:t}),H.members=t,n(5,g.style.display="none",g)},function(){let t=b.value;q("/xx/group-change",{contact:t}),H.contact=t,n(8,y.style.display="none",y)},B,D,P,function(t){p[t?"unshift":"push"]((()=>{A=t,n(18,A)}))},function(t){p[t?"unshift":"push"]((()=>{T=t,n(17,T)}))},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"]((()=>{E=t,n(13,E)}))},function(t){p[t?"unshift":"push"]((()=>{G=t,n(15,G)}))},()=>{O(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"]((()=>{L=t,n(14,L)}))},function(t){p[t?"unshift":"push"]((()=>{M=t,n(16,M)}))},function(t){p[t?"unshift":"push"]((()=>{x=t,n(9,x)}))},function(t){p[t?"unshift":"push"]((()=>{s=t,n(0,s)}))},(t,e)=>B(t,e.user_id),(t,e)=>D(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 H extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';.request-button-wrapper{display:flex;gap:1rem}.approve-button{height:2.7rem;padding:0rem 1rem;font-family:var(--sans-serif,sans-serif);font-size:1.15rem;color:white;background-color:var(--red);border-color:var(--red);border-radius:0.5rem;margin-top:-0.5rem}.group-heading{display:inline-block}.status{display:inline-block;font-size:1.15rem;font-family:var(--sans-serif,sans-serif);margin-left:0.5rem}input{font-family:var(--sans-serif,sans-serif)\n }.text-input-pencil-button{display:inline-block;position:relative;height:2.7rem;width:2rem}.text-input-pencil-button object{top:0rem}.pencil{pointer-events:none;position:absolute;width:1.5rem;right:0.0rem}.change-field-div input.text-input{position:relative;width:20.475rem;direction:rtl;border:0;outline:none;height:2.7rem;font-style:var(--sans-serif,sans-serif);background:transparent;margin-top:-0.5rem}#membersInput{width:5rem}#contactInput{max-width:18rem}.save-button{position:absolute;right:0;top:-0.4rem;margin-right:0.6rem;height:2.7rem;width:5rem;font-family:var(--sans-serif,sans-serif);font-size:1.15rem;color:white;background-color:var(--red);border-color:var(--red);border-radius:0.5rem}.save-button-wrapper{display:inline-block;position:relative;height:2rem}h2{text-align:center;margin-bottom:0.5rem}.entries-section{margin-bottom:1rem}.entries-section>div{height:3.5rem;padding-bottom:0.75rem;padding-top:0.75rem;border-bottom:0.14rem solid;border-color:#cdcdcd}.entries-section>div:last-child{padding-bottom:0.75rem;padding-top:0.75rem;border-bottom:0}.change-field-line{display:flex;justify-content:space-between}.change-field-div{width:max-content;position:relative;display:flex}.change-field-button{position:relative;cursor:pointer;height:2.7rem;font-size:1.15rem;font-family:var(--sans-serif,sans-serif);font-weight:500;text-align:right;padding-right:1.9rem;margin-top:-0.55rem;background-color:transparent;width:100%}h3{margin-bottom:0.5rem}span{font-family:var(--sans-serif,sans-serif);font-size:1.15rem}</style>",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},R,A,s,{},null,[-1,-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("profile-groups",H);export{H as default};
|