site-libsoc/Server/public/js/components/trade-unions-component.js

2 lines
6.6 KiB
JavaScript

import{S as t,i as n,a as o,b as e,s as r,e as a,n as c,d as i,c as m,o as s,h as l,t as p,j as u,k as d,w as f,x as g,l as h,y as b,p as j}from"./index-0d9f0c09.js";import{w as x}from"./index-1c123138.js";import{loadLocaleContent as y,getData as v}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as w,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import{addTradeUnionPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,n,o){const e=t.slice();return e[12]=n[o][0],e[3]=n[o][1],e}function O(t,n,o){const e=t.slice();return e[15]=n[o],e}function T(t){let n,o,r,a,c,m,s,x,y,v,w,k,z,O,T,U,C,D,E,S,_=t[1].tradeUnions+"",A=t[1].p1+"",F=t[1].subheading1+"",G=t[1]["map-prompt"]+"",H=Object.entries(t[0]),J=[];for(let n=0;n<H.length;n+=1)J[n]=R(N(t,H,n));return{c(){n=l("div"),o=l("div"),r=l("h1"),a=p(_),c=u(),m=l("img"),x=u(),y=l("p"),v=p(A),w=u(),k=l("h3"),z=p(F),O=u(),T=l("map-component"),C=u(),D=l("p"),E=p(G),S=u();for(let t=0;t<J.length;t+=1)J[t].c();d(m,"id","trade-unions-img"),f(m.src,s="/img/common/trade-unions.svg")||d(m,"src","/img/common/trade-unions.svg"),d(m,"alt","trade unions"),d(y,"class","description"),g(T,"id","map"),g(T,"callback",U=t[10]),d(D,"id","add-prompt"),d(o,"id","text-container"),d(n,"id","container")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(r,a),h(o,c),h(o,m),h(o,x),h(o,y),h(y,v),h(o,w),h(o,k),h(k,z),h(o,O),h(o,T),h(o,C),h(o,D),h(D,E),h(o,S);for(let t=0;t<J.length;t+=1)J[t].m(o,null)},p(t,n){if(2&n&&_!==(_=t[1].tradeUnions+"")&&b(a,_),2&n&&A!==(A=t[1].p1+"")&&b(v,A),2&n&&F!==(F=t[1].subheading1+"")&&b(z,F),2&n&&U!==(U=t[10])&&g(T,"callback",U),2&n&&G!==(G=t[1]["map-prompt"]+"")&&b(E,G),771&n){let e;for(H=Object.entries(t[0]),e=0;e<H.length;e+=1){const r=N(t,H,e);J[e]?J[e].p(r,n):(J[e]=R(r),J[e].c(),J[e].m(o,null))}for(;e<J.length;e+=1)J[e].d(1);J.length=H.length}},d(t){t&&i(n),j(J,t)}}}function U(t){let n,o,r,a,c,m=t[1].contact+"",s=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(m),a=p(": "),c=p(s)},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,a),h(n,c)},p(t,n){2&n&&m!==(m=t[1].contact+"")&&b(r,m),1&n&&s!==(s=t[15].contact+"")&&b(c,s)},d(t){t&&i(n)}}}function C(t){let n,o,r,a,c,m,s,u=t[1].contact+"",f=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(u),a=p(": "),c=l("a"),m=p(f),d(c,"href",s=t[15].contact),d(c,"target",";_blank;"),d(c,"rel","noreferrer")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,a),h(n,c),h(c,m)},p(t,n){2&n&&u!==(u=t[1].contact+"")&&b(r,u),1&n&&f!==(f=t[15].contact+"")&&b(m,f),1&n&&s!==(s=t[15].contact)&&d(c,"href",s)},d(t){t&&i(n)}}}function D(t){let n,o,r,a,c,m,s,u=t[1].contact+"",f=t[15].contact+"";return{c(){n=l("p"),o=l("b"),r=p(u),a=p(": "),c=l("a"),m=p(f),d(c,"href",s="mailto:"+t[15].contact),d(c,"target",";_blank;"),d(c,"rel","noreferrer")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(o,a),h(n,c),h(c,m)},p(t,n){2&n&&u!==(u=t[1].contact+"")&&b(r,u),1&n&&f!==(f=t[15].contact+"")&&b(m,f),1&n&&s!==(s="mailto:"+t[15].contact)&&d(c,"href",s)},d(t){t&&i(n)}}}function E(t){let n,o,r,a,c,m,s,f,g,j,x,y,v,w,k,z,N,O,T,E,R,S=t[1].name+"",_=t[15].name+"",A=t[1].location+"",F=t[9](t[15])+"",G=t[1].members+"",H=t[15].members+"";function J(t,n){return 1&n&&(E=null),1&n&&(R=null),null==E&&(E=!(!t[15].contact.includes("@")||1!=t[15].contact.trim().split(" ").length)),E?D:(null==R&&(R=!!t[15].contact.includes("http")),R?C:U)}let K=J(t,-1),L=K(t);return{c(){n=l("div"),o=l("p"),r=l("b"),a=p(S),c=p(": "),m=p(_),s=u(),f=l("p"),g=l("b"),j=p(A),x=p(": "),y=p(F),v=u(),w=l("p"),k=l("b"),z=p(G),N=p(": "),O=p(H),T=u(),L.c(),d(n,"class","location-info")},m(t,i){e(t,n,i),h(n,o),h(o,r),h(r,a),h(r,c),h(o,m),h(n,s),h(n,f),h(f,g),h(g,j),h(g,x),h(f,y),h(n,v),h(n,w),h(w,k),h(k,z),h(k,N),h(w,O),h(n,T),L.m(n,null)},p(t,o){2&o&&S!==(S=t[1].name+"")&&b(a,S),1&o&&_!==(_=t[15].name+"")&&b(m,_),2&o&&A!==(A=t[1].location+"")&&b(j,A),1&o&&F!==(F=t[9](t[15])+"")&&b(y,F),2&o&&G!==(G=t[1].members+"")&&b(z,G),1&o&&H!==(H=t[15].members+"")&&b(O,H),K===(K=J(t,o))&&L?L.p(t,o):(L.d(1),L=K(t),L&&(L.c(),L.m(n,null)))},d(t){t&&i(n),L.d()}}}function R(t){let n,o,r,a,c,m=t[8](t[12])+"",s=t[3],f=[];for(let n=0;n<s.length;n+=1)f[n]=E(O(t,s,n));return{c(){n=l("h4"),o=p(m),r=u(),a=l("div");for(let t=0;t<f.length;t+=1)f[t].c();c=u(),d(n,"class","country-name"),d(a,"class","country-block")},m(t,i){e(t,n,i),h(n,o),e(t,r,i),e(t,a,i);for(let t=0;t<f.length;t+=1)f[t].m(a,null);h(a,c)},p(t,n){if(1&n&&m!==(m=t[8](t[12])+"")&&b(o,m),515&n){let o;for(s=t[3],o=0;o<s.length;o+=1){const e=O(t,s,o);f[o]?f[o].p(e,n):(f[o]=E(e),f[o].c(),f[o].m(a,c))}for(;o<f.length;o+=1)f[o].d(1);f.length=s.length}},d(t){t&&i(n),t&&i(r),t&&i(a),j(f,t)}}}function S(t){let n,o=3==t[2]&&T(t);return{c(){o&&o.c(),n=a()},m(t,r){o&&o.m(t,r),e(t,n,r)},p(t,e){3==t[2]?o?o.p(t,e):(o=T(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&i(n)}}}function _(t){let n,o=t[2],m=S(t);return{c(){m.c(),n=a(),this.c=c},m(t,o){m.m(t,o),e(t,n,o)},p(t,[e]){4&e&&r(o,o=t[2])?(m.d(1),m=S(t),m.c(),m.m(n.parentNode,n)):m.p(t,e)},i:c,o:c,d(t){t&&i(n),m.d(t)}}}function A(t,n,o){let e,r,a=x(0);m(t,a,(t=>o(2,r=t)));let c,i,l=x({});m(t,l,(t=>o(1,e=t)));let p=y(l,"trade-unions-component",a);y(l,"countries",a);function u(t,n,o){let e=t([22,0],2);w(c,i,e,n,o,z,"violet",{enableCountryGrouping:!0})}v("/assets/trade-unions.json",(t=>{o(3,c=JSON.parse(t)),o(0,i={});for(let t of c){let n=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),n in i?i[n].push(t):o(0,i[n]=[t],i)}a.update((t=>t+1))})),s((()=>{}));return[i,e,r,c,a,l,p,u,function(t){return"en"==p?t:k(e,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(e,t))).join(", ")},t=>u(t,e,p)]}class F extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';.description{margin-bottom:1rem}#add-prompt{margin-bottom:2rem}#trade-unions-img{position:absolute;width:14rem;left:50%;transform:translate(-50%);z-index:0;opacity:0.2}#text-container>:nth-child(3){margin-top:8rem}.country-name{margin-bottom:0.5rem}.country-block{margin-bottom:2rem}.location-info{margin-bottom:0.75rem}.location-info p{margin-bottom:0}a{color:#DD1C1A}#map{--height:30rem;--width:100%;--margin-bottom:0.5rem}#text-container{position:relative;max-width:calc(100vw - 4rem);margin:auto}h1{margin-bottom:1rem;font-size:2.2rem;text-align:center}h3{margin-bottom:1rem}#container{margin:auto;max-width:800px;margin-top:1rem;margin-bottom:4rem}#container p{text-align:justify}</style>",n(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},A,_,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("trade-unions-component",F);export{F as default};