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

2 lines
7.3 KiB
JavaScript

import{S as e,i as o,a as t,b as n,s as i,e as a,n as r,d as l,c as s,o as c,f as d,g as m,t as h,h as p,j as g,l as u,q as f,m as b,p as v,r as k,w}from"./index-4348483d.js";import{w as y}from"./index-71440b21.js";import{loadLocaleContent as x,locales as j}from"../../../../../../../../../js/libraries/serverTools.js";function z(e,o,t){const n=e.slice();return n[14]=o[t][0],n[15]=o[t][1],n}function O(e){let o,t,i,a,r,s,c,w,y,x,O,H,L,M,N,S,E,R,U,q,I,X,A,B,C,D,F,G,J,K,P,Q,V,W,Y,Z,$,_,ee,oe,te,ne,ie,ae,re=e[3].orgName+"",le=e[3].manifesto+"",se=e[3].joinUs+"",ce=e[3].groups+"",de=e[3].communes+"",me=e[3].cooperatives+"",he=e[3].partners+"",pe=Object.entries(j),ge=[];for(let o=0;o<pe.length;o+=1)ge[o]=T(z(e,pe,o));return{c(){o=d("header"),t=d("input"),i=m(),a=d("label"),a.innerHTML='<span id="hamb-line"></span>',r=m(),s=d("a"),c=d("img"),y=m(),x=d("span"),O=h(re),H=m(),L=d("nav"),M=d("ul"),N=d("li"),S=d("a"),E=h(le),R=m(),U=d("li"),q=d("a"),I=h(se),X=m(),A=d("li"),B=d("a"),C=h(ce),D=m(),F=d("li"),G=d("a"),J=h(de),K=m(),P=d("li"),Q=d("a"),V=h(me),W=m(),Y=d("li"),Z=d("a"),$=h(he),_=m(),ee=d("li"),oe=d("button"),oe.innerHTML='<picture><source srcset="/img/common/globe.webp"/> \n <source srcset="/img/common/globe.png"/> \n <img id="locales-img" alt="globe"/></picture>',te=m(),ne=d("div");for(let e=0;e<ge.length;e+=1)ge[e].c();p(t,"type","checkbox"),p(t,"id","side-menu"),p(a,"id","hamb"),p(a,"for","side-menu"),g(c.src,w="/img/common/flag.png")||p(c,"src","/img/common/flag.png"),p(c,"id","navbar-logo"),p(c,"alt","logo"),p(x,"id","navbar-logo-text"),p(s,"id","logo-container"),p(s,"href","/"+e[6]+"/"),p(S,"href","/"+e[6]+"/manifesto"),p(q,"href","/"+e[6]+"/join-us"),p(B,"href","/"+e[6]+"/groups"),p(G,"href","/"+e[6]+"/communes"),p(Q,"href","/"+e[6]+"/cooperatives"),p(Z,"href","/"+e[6]+"/partners"),p(ee,"id","locales"),p(ne,"id","locales-dropdown"),p(M,"id","menu"),p(L,"id","nav"),p(o,"id","navbar")},m(l,d){n(l,o,d),u(o,t),e[10](t),u(o,i),u(o,a),u(o,r),u(o,s),u(s,c),u(s,y),u(s,x),u(x,O),u(o,H),u(o,L),u(L,M),u(M,N),u(N,S),u(S,E),u(M,R),u(M,U),u(U,q),u(q,I),u(M,X),u(M,A),u(A,B),u(B,C),u(M,D),u(M,F),u(F,G),u(G,J),u(M,K),u(M,P),u(P,Q),u(Q,V),u(M,W),u(M,Y),u(Y,Z),u(Z,$),u(M,_),u(M,ee),u(ee,oe),u(M,te),u(M,ne);for(let e=0;e<ge.length;e+=1)ge[e].m(ne,null);e[12](ne),e[13](o),ie||(ae=[f(t,"click",e[7]),f(oe,"click",e[8])],ie=!0)},p(e,o){if(8&o&&re!==(re=e[3].orgName+"")&&b(O,re),8&o&&le!==(le=e[3].manifesto+"")&&b(E,le),8&o&&se!==(se=e[3].joinUs+"")&&b(I,se),8&o&&ce!==(ce=e[3].groups+"")&&b(C,ce),8&o&&de!==(de=e[3].communes+"")&&b(J,de),8&o&&me!==(me=e[3].cooperatives+"")&&b(V,me),8&o&&he!==(he=e[3].partners+"")&&b($,he),512&o){let t;for(pe=Object.entries(j),t=0;t<pe.length;t+=1){const n=z(e,pe,t);ge[t]?ge[t].p(n,o):(ge[t]=T(n),ge[t].c(),ge[t].m(ne,null))}for(;t<ge.length;t+=1)ge[t].d(1);ge.length=pe.length}},d(t){t&&l(o),e[10](null),v(ge,t),e[12](null),e[13](null),ie=!1,k(ae)}}}function T(e){let o,t,i,a,r=e[15]+"";function s(){return e[11](e[14])}return{c(){o=d("button"),t=h(r)},m(e,r){n(e,o,r),u(o,t),i||(a=f(o,"click",s),i=!0)},p(o,t){e=o},d(e){e&&l(o),i=!1,a()}}}function H(e){let o,t=0!=Object.keys(e[3]).length,i=t&&O(e);return{c(){i&&i.c(),o=a(),this.c=r},m(e,t){i&&i.m(e,t),n(e,o,t)},p(e,[n]){8&n&&(t=0!=Object.keys(e[3]).length),t?i?i.p(e,n):(i=O(e),i.c(),i.m(o.parentNode,o)):i&&(i.d(1),i=null)},i:r,o:r,d(e){i&&i.d(e),e&&l(o)}}}function L(e,o,t){let n,i,a,r,l,d=y({});s(e,d,(e=>t(3,n=e)));let m=x(d,"navbar-component",l);function h(e){localStorage.setItem("locale",e);let o=location.href.split("/"),t=Object.keys(j);o=o.filter((e=>!t.includes(e)));let n=o.slice(0,o.length-1).join("/")+"/"+e+"/"+o[o.length-1];location.href=n}c((()=>{}));return[i,a,r,n,l,d,m,function(){i.checked?t(1,a.style.background="white",a):setTimeout((()=>{t(1,a.style.position="relative",a),t(1,a.style.background="",a),t(1,a.style.boxShadow="",a)}),510)},function(){"block"==r.style.display?t(2,r.style.display="none",r):t(2,r.style.display="block",r)},h,function(e){w[e?"unshift":"push"]((()=>{i=e,t(0,i)}))},e=>h(e),function(e){w[e?"unshift":"push"]((()=>{r=e,t(2,r)}))},function(e){w[e?"unshift":"push"]((()=>{a=e,t(1,a)}))}]}class M extends e{constructor(e){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';#navbar{position:relative;top:0;width:min(100%,116rem);z-index:1000000000;height:5.26rem}#navbar *{font-family:var(--sans-serif, sans-serif)}#logo-container{display:flex;position:absolute;margin-left:1rem;height:100%;max-height:5.26rem;color:black;z-index:1;flex-direction:row;flex-wrap:nowrap;align-items:center}#navbar-logo{height:3.5rem;width:3.5rem;object-fit:contain;border-radius:10rem}#navbar-logo-text{position:relative;width:auto;height:100%;line-height:400%;white-space:nowrap;text-align:center;font-size:1.4rem;color:#292222;font-family:var(--sans-serif, sans-serif);font-weight:400;padding-left:1.2rem}#nav{position:fixed;width:100%;height:100%;background-color:white;overflow:hidden;z-index:0}#menu a{display:block;padding:1.2rem;padding-top:1rem;padding-bottom:1rem;color:black;font-size:1.4rem}#menu a:hover{background-color:rgb(220, 220, 220)}#menu a:active{background-color:#f7aec0}#menu li{list-style-type:none}#nav{max-height:0}#hamb{position:absolute;cursor:pointer;right:0rem;padding:2.8rem 2rem;z-index:9999}#hamb-line{background:black;display:block;height:2px;position:relative;width:24px}#hamb-line::before,#hamb-line::after{background:black;content:'';display:block;height:100%;position:absolute;transition:all .2s ease-out;width:100%}#hamb-line::before{top:5px}#hamb-line::after{top:-5px}#side-menu{display:none}#side-menu:checked~nav{display:block;max-height:100%;padding-top:5.625rem}#side-menu:checked~#logo-container{position:fixed}#side-menu:checked~#hamb{position:fixed}#side-menu:checked~#logo-container{position:fixed}#side-menu:checked~#hamb #hamb-line{background:transparent}#side-menu:checked~#hamb #hamb-line::before{transform:rotate(-45deg);top:0}#side-menu:checked~#hamb #hamb-line::after{transform:rotate(45deg);top:0}#locales{position:relative}#locales button{width:100%;text-align:left;height:4rem}#locales button:hover{opacity:0.5}#locales-img{position:relative;top:0rem;height:2rem;margin-left:1.2rem}#locales-dropdown{position:absolute;display:none;top:5.6rem;right:1.8rem;border:#404040 solid 0.1rem;padding:1.4rem;background-color:white}#locales-dropdown button{display:block;font-family:var(--sans-serif,sans-serif);font-size:1.3rem;width:100%}#locales-dropdown button:hover{color:rgb(127, 127, 127)}#locales-dropdown>:first-child{padding-bottom:0.5rem}#locales-dropdown>:nth-child(2){padding-top:0.5rem}@media only screen and (min-width: 1500px){#navbar{position:relative;width:min(95%,116rem);left:50%;transform:translateX(-50%)}#nav{max-height:none;top:0;position:relative;float:right;width:fit-content;background-color:transparent;overflow:visible}#side-menu:checked~nav{padding-top:0}#menu li{float:left}#menu a:hover{background-color:transparent;color:rgb(127, 127, 127)}#menu a{padding:1.2rem;padding-top:1.9rem;padding-bottom:1.9rem}#hamb{display:none}#locales{position:relative;margin-right:1.8rem}#locales-img{top:0.9rem}#locales-dropdown{top:5,7rem}}</style>",o(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},L,H,i,{},null),e&&e.target&&n(e.target,this,e.anchor)}}customElements.define("navbar-component",M);export{M as default};