site-libsoc/Server/public/js/components/cooperatives-component.js

2 lines
7.7 KiB
JavaScript

import{S as t,i as e,a as o,b as n,s as r,q as i,n as s,g as a,t as c,o as m,e as l,w as p,c as g,d,u,v as f,f as h,x as b,y as w}from"./index-5b685137.js";import{w as x}from"./index-8744cf8a.js";import{loadLocaleContent as v,getData as j}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as k,translate as y}from"../../../../../../../../../js/libraries/mapTools.js";import{addCoopPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,e,o){const n=t.slice();return n[12]=e[o][0],n[3]=e[o][1],n}function O(t,e,o){const n=t.slice();return n[15]=e[o],n}function T(t){let e,o,r,i,s,c,m,x,v,j,k,y,z,O,T,C,E,R,S,_,q=t[1].cooperatives+"",A=t[1].p1+"",F=t[1].subheading1+"",G=t[1]["map-prompt"]+"",H=Object.entries(t[0]),J=[];for(let e=0;e<H.length;e+=1)J[e]=D(N(t,H,e));return{c(){e=l("div"),o=l("div"),r=l("h1"),i=p(q),s=g(),c=l("img"),x=g(),v=l("p"),j=p(A),k=g(),y=l("h3"),z=p(F),O=g(),T=l("map-component"),E=g(),R=l("p"),S=p(G),_=g();for(let t=0;t<J.length;t+=1)J[t].c();d(c,"id","coops-img"),u(c.src,m="/img/common/coops.svg")||d(c,"src","/img/common/coops.svg"),d(c,"alt","coops"),d(v,"class","description"),f(T,"id","map"),f(T,"callback",C=t[10]),d(R,"id","add-prompt"),d(o,"id","text-container"),d(e,"id","container")},m(t,a){n(t,e,a),h(e,o),h(o,r),h(r,i),h(o,s),h(o,c),h(o,x),h(o,v),h(v,j),h(o,k),h(o,y),h(y,z),h(o,O),h(o,T),h(o,E),h(o,R),h(R,S),h(o,_);for(let t=0;t<J.length;t+=1)J[t].m(o,null)},p(t,e){if(2&e&&q!==(q=t[1].cooperatives+"")&&b(i,q),2&e&&A!==(A=t[1].p1+"")&&b(j,A),2&e&&F!==(F=t[1].subheading1+"")&&b(z,F),2&e&&C!==(C=t[10])&&f(T,"callback",C),2&e&&G!==(G=t[1]["map-prompt"]+"")&&b(S,G),771&e){let n;for(H=Object.entries(t[0]),n=0;n<H.length;n+=1){const r=N(t,H,n);J[n]?J[n].p(r,e):(J[n]=D(r),J[n].c(),J[n].m(o,null))}for(;n<J.length;n+=1)J[n].d(1);J.length=H.length}},d(t){t&&a(e),w(J,t)}}}function C(t){let e,o,r,i,s,c,m,u,f,w,x,v,j,k,y,z,N,O,T,C,D,E,R,S,_,q,A,F,G,H,J,K,L,M,Q,U,B,I,P,V,W,X,Y,Z,$,tt,et,ot,nt,rt,it,st,at,ct,mt,lt,pt,gt,dt,ut,ft,ht,bt,wt,xt,vt=console.log(t[15])+"",jt=t[1].name+"",kt=t[15].name+"",yt=t[1].location+"",zt=t[9](t[15])+"",Nt=t[1].market+"",Ot=t[15].market+"",Tt=t[1].workers+"",Ct=t[15].workers+"",Dt=t[1].status+"",Et=t[15].status+"",Rt=t[1].website+"",St=t[15].website+"",_t=t[1].contact+"",qt=t[15].contact+"",At=t[1].description+"",Ft=t[15].description+"";return{c(){e=p(vt),o=g(),r=l("div"),i=l("div"),s=l("div"),c=l("p"),m=l("b"),u=p(jt),f=p(": "),w=p(kt),x=g(),v=l("p"),j=l("b"),k=p(yt),y=p(": "),z=p(zt),N=g(),O=l("p"),T=l("b"),C=p(Nt),D=p(": "),E=p(Ot),R=g(),S=l("p"),_=l("b"),q=p(Tt),A=p(": "),F=p(Ct),G=g(),H=l("p"),J=l("b"),K=p(Dt),L=p(": "),M=p(Et),Q=g(),U=l("p"),B=l("b"),I=p(Rt),P=p(": "),V=l("a"),W=p(St),Y=g(),Z=l("p"),$=l("b"),tt=p(_t),et=p(": "),ot=l("a"),nt=p(qt),it=g(),st=l("picture"),at=l("source"),mt=g(),lt=l("source"),gt=g(),dt=l("img"),ut=g(),ft=l("p"),ht=l("b"),bt=p(At),wt=p(": "),xt=p(Ft),d(V,"href",X=t[15].website),d(V,"target","_blank"),d(V,"rel","noreferrer"),d(ot,"href",rt=t[15].contact),d(ot,"target",";_blank;"),d(ot,"rel","noreferrer"),d(at,"srcset",ct="/img/coops/"+t[15].logo+".webp"),d(lt,"srcset",pt="/img/coops/"+t[15].logo+".png"),d(dt,"class","coop-logo"),d(dt,"alt","logo"),d(i,"class","img-general-info"),d(r,"class","location-info")},m(t,a){n(t,e,a),n(t,o,a),n(t,r,a),h(r,i),h(i,s),h(s,c),h(c,m),h(m,u),h(m,f),h(c,w),h(s,x),h(s,v),h(v,j),h(j,k),h(j,y),h(v,z),h(s,N),h(s,O),h(O,T),h(T,C),h(T,D),h(O,E),h(s,R),h(s,S),h(S,_),h(_,q),h(_,A),h(S,F),h(s,G),h(s,H),h(H,J),h(J,K),h(J,L),h(H,M),h(s,Q),h(s,U),h(U,B),h(B,I),h(B,P),h(U,V),h(V,W),h(s,Y),h(s,Z),h(Z,$),h($,tt),h($,et),h(Z,ot),h(ot,nt),h(i,it),h(i,st),h(st,at),h(st,mt),h(st,lt),h(st,gt),h(st,dt),h(r,ut),h(r,ft),h(ft,ht),h(ht,bt),h(ht,wt),h(ft,xt)},p(t,o){1&o&&vt!==(vt=console.log(t[15])+"")&&b(e,vt),2&o&&jt!==(jt=t[1].name+"")&&b(u,jt),1&o&&kt!==(kt=t[15].name+"")&&b(w,kt),2&o&&yt!==(yt=t[1].location+"")&&b(k,yt),1&o&&zt!==(zt=t[9](t[15])+"")&&b(z,zt),2&o&&Nt!==(Nt=t[1].market+"")&&b(C,Nt),1&o&&Ot!==(Ot=t[15].market+"")&&b(E,Ot),2&o&&Tt!==(Tt=t[1].workers+"")&&b(q,Tt),1&o&&Ct!==(Ct=t[15].workers+"")&&b(F,Ct),2&o&&Dt!==(Dt=t[1].status+"")&&b(K,Dt),1&o&&Et!==(Et=t[15].status+"")&&b(M,Et),2&o&&Rt!==(Rt=t[1].website+"")&&b(I,Rt),1&o&&St!==(St=t[15].website+"")&&b(W,St),1&o&&X!==(X=t[15].website)&&d(V,"href",X),2&o&&_t!==(_t=t[1].contact+"")&&b(tt,_t),1&o&&qt!==(qt=t[15].contact+"")&&b(nt,qt),1&o&&rt!==(rt=t[15].contact)&&d(ot,"href",rt),1&o&&ct!==(ct="/img/coops/"+t[15].logo+".webp")&&d(at,"srcset",ct),1&o&&pt!==(pt="/img/coops/"+t[15].logo+".png")&&d(lt,"srcset",pt),2&o&&At!==(At=t[1].description+"")&&b(bt,At),1&o&&Ft!==(Ft=t[15].description+"")&&b(xt,Ft)},d(t){t&&a(e),t&&a(o),t&&a(r)}}}function D(t){let e,o,r,i,s,c=t[8](t[12])+"",m=t[3],u=[];for(let e=0;e<m.length;e+=1)u[e]=C(O(t,m,e));return{c(){e=l("h4"),o=p(c),r=g(),i=l("div");for(let t=0;t<u.length;t+=1)u[t].c();s=g(),d(e,"class","country-name"),d(i,"class","country-block")},m(t,a){n(t,e,a),h(e,o),n(t,r,a),n(t,i,a);for(let t=0;t<u.length;t+=1)u[t].m(i,null);h(i,s)},p(t,e){if(1&e&&c!==(c=t[8](t[12])+"")&&b(o,c),515&e){let o;for(m=t[3],o=0;o<m.length;o+=1){const n=O(t,m,o);u[o]?u[o].p(n,e):(u[o]=C(n),u[o].c(),u[o].m(i,s))}for(;o<u.length;o+=1)u[o].d(1);u.length=m.length}},d(t){t&&a(e),t&&a(r),t&&a(i),w(u,t)}}}function E(t){let e,o=3==t[2]&&T(t);return{c(){o&&o.c(),e=i()},m(t,r){o&&o.m(t,r),n(t,e,r)},p(t,n){3==t[2]?o?o.p(t,n):(o=T(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&a(e)}}}function R(t){let e,o=t[2],c=E(t);return{c(){c.c(),e=i(),this.c=s},m(t,o){c.m(t,o),n(t,e,o)},p(t,[n]){4&n&&r(o,o=t[2])?(c.d(1),c=E(t),c.c(),c.m(e.parentNode,e)):c.p(t,n)},i:s,o:s,d(t){t&&a(e),c.d(t)}}}function S(t,e,o){let n,r,i=x(0);c(t,i,(t=>o(2,r=t)));let s,a,l=x({});c(t,l,(t=>o(1,n=t)));let p=v(l,"cooperatives-component",i);v(l,"countries",i);function g(t,e,o){let n=t([22,0],2);k(s,a,n,e,o,z,"blue",{enableCountryGrouping:!0})}j("/assets/cooperatives.json",(t=>{o(3,s=JSON.parse(t)),o(0,a={});for(let t of s){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in a?a[e].push(t):o(0,a[e]=[t],a)}i.update((t=>t+1))})),m((()=>{}));return[a,n,r,s,i,l,p,g,function(t){return"en"==p?t:y(n,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:y(n,t))).join(", ")},t=>g(t,n,p)]}class _ extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';.description{margin-bottom:1rem}#add-prompt{margin-bottom:2rem}#coops-img{position:absolute;width:10.5rem;left:50%;transform:translate(-50%);z-index:0;opacity:0.2}#text-container>:nth-child(3){margin-top:8rem}.img-general-info{display:flex;align-content:center;width:100%;justify-content:space-between;gap:3rem;align-items:center}.img-general-info>:first-child{flex:none}.coop-logo{position:relative;right:0;max-height:6rem;max-width:100%}.country-name{margin-bottom:1rem}.country-block{margin-bottom:2rem}.location-info{position:relative;margin-bottom:2rem}.location-info p{margin-bottom:0}a{color:#DD1C1A}#map{--height:30rem;--width:100%;--margin-bottom:0.5rem}#text-container{max-width:calc(100vw - 4rem);margin:auto}h1{margin-bottom:1rem;font-size:2.2rem;text-align:center}h3{margin-top:1rem;margin-bottom:1rem}#container{margin:auto;max-width:800px;margin-top:1rem;margin-bottom:4rem}#container p{text-align:justify}@media only screen and (max-width: 600px){.img-general-info{display:flex;flex-direction:column-reverse;align-content:left;width:100%;gap:1rem;align-items:left;margin-bottom:0rem}.img-general-info>:nth-child(2){width:max-content}.img-general-info>:nth-child(1){width:100%}}</style>",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},S,R,r,{},null),t&&t.target&&n(t.target,this,t.anchor)}}customElements.define("cooperatives-component",_);export{_ as default};