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

2 lines
12 KiB
JavaScript

import{S as t,i as e,a as n,b as i,s as l,q as o,n as r,g as s,t as c,o as a,j as d,e as m,d as u,f,w as h,c as p,u as g,z as w,l as b,x,y,p as v,H as k}from"./index-6e99513e.js";import{w as H}from"./index-3db98739.js";import{loadLocaleContent as j,getData as I}from"../../../../../../../../../js/libraries/serverTools.js";import{px2rem as L}from"../../../../../../../../../js/libraries/miscTools.js";function T(t,e,n){const i=t.slice();return i[33]=e[n],i[34]=e,i[35]=n,i}function Y(t,e,n){const i=t.slice();return i[36]=e[n],i}function C(t,e,n){const i=t.slice();return i[36]=e[n],i}function M(t,e,n){const i=t.slice();return i[41]=e[n],i[42]=e,i[43]=n,i}function z(t,e,n){const i=t.slice();return i[44]=e[n],i[45]=e,i[46]=n,i}function A(t){let e,n,o=t[0],r=K(t);return{c(){e=m("div"),n=m("div"),r.c(),u(n,"id","text-container"),u(e,"id","container")},m(l,o){i(l,e,o),f(e,n),r.m(n,null),t[28](e)},p(t,e){1&e[0]&&l(o,o=t[0])?(r.d(1),r=K(t),r.c(),r.m(n,null)):r.p(t,e)},d(n){n&&s(e),r.d(n),t[28](null)}}}function V(t){let e,n,l,o,r,c,a=t[41].name+"",d=t[41];const g=()=>t[21](n,d),w=()=>t[21](null,d);function x(){return t[22](t[41])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level0 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[41]&&(w(),d=t[41],g())},d(t){t&&s(e),w(),r=!1,c()}}}function O(t){let e,n=t[41],l=[];for(let e=0;e<n.length;e+=1)l[e]=R(z(t,n,e));return{c(){for(let t=0;t<l.length;t+=1)l[t].c();e=o()},m(t,n){for(let e=0;e<l.length;e+=1)l[e].m(t,n);i(t,e,n)},p(t,i){if(36880&i[0]){let o;for(n=t[41],o=0;o<n.length;o+=1){const r=z(t,n,o);l[o]?l[o].p(r,i):(l[o]=R(r),l[o].c(),l[o].m(e.parentNode,e))}for(;o<l.length;o+=1)l[o].d(1);l.length=n.length}},d(t){y(l,t),t&&s(e)}}}function R(t){let e,n,l,o,r,c,a=t[44].name+"",d=t[44];const g=()=>t[19](n,d),w=()=>t[19](null,d);function x(){return t[20](t[44])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level1 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[44]&&(w(),d=t[44],g())},d(t){t&&s(e),w(),r=!1,c()}}}function S(t){let e;let n=function(t,e){return Array.isArray(t[41])?O:V}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function E(t){let e;let n=function(t,e){return t[33],"ul"==Object.keys(t[33])[0]?D:(t[33],"ol"==Object.keys(t[33])[0]?W:(t[33],"h3"==t[33].type?q:(t[33],"h2"==t[33].type?_:"#"==t[33][0]?B:N)))}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function N(t){let e,n,l,o=t[33]+"";return{c(){e=m("p"),n=new k(!1),l=p(),n.a=l,u(e,"class","margin-end")},m(t,r){i(t,e,r),n.m(o,e),f(e,l)},p:r,d(t){t&&s(e)}}}function B(t){let e,n=t[33].slice(2,t[33].length)+"";return{c(){e=m("h1")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&s(e)}}}function _(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[26](n,a),h=()=>t[26](null,a);return{c(){e=m("button"),n=m("h2"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function q(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[25](n,a),h=()=>t[25](null,a);return{c(){e=m("button"),n=m("h3"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function W(t){let e,n,l=t[33].ol,o=[];for(let e=0;e<l.length;e+=1)o[e]=F(Y(t,l,e));return{c(){e=m("ol");for(let t=0;t<o.length;t+=1)o[t].c();n=p()},m(t,l){i(t,e,l);for(let t=0;t<o.length;t+=1)o[t].m(e,null);f(e,n)},p(t,i){if(2048&i[0]){let r;for(l=t[33].ol,r=0;r<l.length;r+=1){const s=Y(t,l,r);o[r]?o[r].p(s,i):(o[r]=F(s),o[r].c(),o[r].m(e,n))}for(;r<o.length;r+=1)o[r].d(1);o.length=l.length}},d(t){t&&s(e),y(o,t)}}}function D(t){let e,n,l=t[33].ul,o=[];for(let e=0;e<l.length;e+=1)o[e]=G(C(t,l,e));return{c(){e=m("ul");for(let t=0;t<o.length;t+=1)o[t].c();n=p()},m(t,l){i(t,e,l);for(let t=0;t<o.length;t+=1)o[t].m(e,null);f(e,n)},p(t,i){if(2048&i[0]){let r;for(l=t[33].ul,r=0;r<l.length;r+=1){const s=C(t,l,r);o[r]?o[r].p(s,i):(o[r]=G(s),o[r].c(),o[r].m(e,n))}for(;r<o.length;r+=1)o[r].d(1);o.length=l.length}},d(t){t&&s(e),y(o,t)}}}function F(t){let e,n=t[36]+"";return{c(){e=m("li")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&s(e)}}}function G(t){let e,n,l=t[36]+"";return{c(){e=m("li"),n=h(l)},m(t,l){i(t,e,l),f(e,n)},p:r,d(t){t&&s(e)}}}function J(t){let e;let n=function(t,e){if(""!==t[33])return E}(t),l=n&&n(t);return{c(){l&&l.c(),e=o()},m(t,n){l&&l.m(t,n),i(t,e,n)},p(t,e){l&&l.p(t,e)},d(t){l&&l.d(t),t&&s(e)}}}function K(t){let e,n,l,o,r,c,a,d,v,k,H,j,I=t[10].tableOfContents+"",L=t[12],Y=[];for(let e=0;e<L.length;e+=1)Y[e]=S(M(t,L,e));let C=t[11],z=[];for(let e=0;e<C.length;e+=1)z[e]=J(T(t,C,e));return{c(){e=m("div"),n=m("button"),l=h(I),o=p(),r=m("img"),a=p(),d=m("div");for(let t=0;t<Y.length;t+=1)Y[t].c();v=p(),k=m("div");for(let t=0;t<z.length;t+=1)z[t].c();g(r.src,c="../assets/arrow_down.svg")||u(r,"src","../assets/arrow_down.svg"),u(r,"alt","arrow down"),w(r,"transform","scaleY(-1)"),u(n,"id","toggle-content"),u(d,"class","module"),w(d,"display","initial"),u(e,"id","table-content"),u(k,"id","main")},m(s,c){i(s,e,c),f(e,n),f(n,l),f(n,o),f(n,r),t[16](r),t[17](n),f(e,a),f(e,d);for(let t=0;t<Y.length;t+=1)Y[t].m(d,null);t[23](d),t[24](e),i(s,v,c),i(s,k,c);for(let t=0;t<z.length;t+=1)z[t].m(k,null);t[27](k),H||(j=b(n,"click",t[18]),H=!0)},p(t,e){if(1024&e[0]&&I!==(I=t[10].tableOfContents+"")&&x(l,I),36880&e[0]){let n;for(L=t[12],n=0;n<L.length;n+=1){const i=M(t,L,n);Y[n]?Y[n].p(i,e):(Y[n]=S(i),Y[n].c(),Y[n].m(d,null))}for(;n<Y.length;n+=1)Y[n].d(1);Y.length=L.length}if(2144&e[0]){let n;for(C=t[11],n=0;n<C.length;n+=1){const i=T(t,C,n);z[n]?z[n].p(i,e):(z[n]=J(i),z[n].c(),z[n].m(k,null))}for(;n<z.length;n+=1)z[n].d(1);z.length=C.length}},d(n){n&&s(e),t[16](null),t[17](null),y(Y,n),t[23](null),t[24](null),n&&s(v),n&&s(k),y(z,n),t[27](null),H=!1,j()}}}function P(t){let e,n=2==t[9]&&A(t);return{c(){n&&n.c(),e=o()},m(t,l){n&&n.m(t,l),i(t,e,l)},p(t,i){2==t[9]?n?n.p(t,i):(n=A(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function Q(t){let e,n=t[9],c=P(t);return{c(){c.c(),e=o(),this.c=r},m(t,n){c.m(t,n),i(t,e,n)},p(t,i){512&i[0]&&l(n,n=t[9])?(c.d(1),c=P(t),c.c(),c.m(e.parentNode,e)):c.p(t,i)},i:r,o:r,d(t){t&&s(e),c.d(t)}}}function U(t,e){"none"==e.style.display||""==e.style.display?(e.style.display="initial",t.style.transform="scaleY(-1)",localStorage.setItem("manifesto-hide-content","false")):(e.style.display="none",t.style.transform="",localStorage.setItem("manifesto-hide-content","true"))}function X(t,e,n){let i,l,o,r,s,m,u,f,h,p=[],g=[],w={},b=[],x=0,y=0,v=H(0);c(t,v,(t=>n(9,i=t)));let k=H({});c(t,k,(t=>n(10,l=t))),j(k,"countries",v);let T=j(k,"manifesto-component",v);const Y=["ul","ol"];function C(t){w[t].scrollIntoView({block:"start"},!0)}I("/locales/"+T+"/manifesto.txt",(function(t){let e,i=t.split(/\r?\n/),l=0;for(let t=0;t<i.length;t++){let n=i[t],o=Y.map((t=>n.includes("<"+t+">"))).findIndex((t=>t));if(-1!=o){let e=Y[o],l={};l[e]=[];let r="</"+e+">";for(;;){if(t+=1,n=i[t],n.includes(r)){p.push(l);break}l[e].push(n)}}else if("###"==n.slice(0,3)){let t=n.slice(4,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");e.push({id:i,name:t,index:l}),l+=1,p.push({type:"h3",id:i,line:t,index:l})}else if("##"==n.slice(0,2)){let t=n.slice(3,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");b.push({id:t.toLowerCase().trim().replaceAll(" ","-"),name:t,index:l}),l+=1,e=[],b.push(e),p.push({type:"h2",id:i,line:t,index:l})}else p.push(n)}n(0,o+=1)})),addEventListener("scroll",(t=>{if(window.innerWidth>1080){let t=L(window.scrollY),e=L(f.getBoundingClientRect().bottom+window.scrollY),i=L(u.getBoundingClientRect().bottom+window.scrollY);if(t>x&&t<5||t<x&&t<5)y=-Math.min(L(window.scrollY),5);else if(i>=e-1.5)y-=i-(e-1.5);else if(y>-5&&(y=-5),t<5&&0!=t){let t=L(u.offsetHeight-window.innerHeight);y=-Math.min(L(window.scrollY),5+t+2.5)}else if(t<x||0==y)y<-5?y+=x-t:y=-5;else if(u.offsetHeight>window.innerHeight){let e=L(u.offsetHeight)-L(window.innerHeight);y>-(e+8)?y+=x-t:y=-(e+8)}n(6,u.style.marginTop=y+"rem",u),x=L(window.scrollY)}else n(6,u.style.marginTop="0rem",u)})),a((()=>{let t=localStorage.getItem("manifesto-hide-content");null!=t&&null!=t&&"true"==t&&U(s,m)}));return[o,r,s,m,g,w,u,f,h,i,l,p,b,v,k,C,function(t){d[t?"unshift":"push"]((()=>{s=t,n(2,s)}))},function(t){d[t?"unshift":"push"]((()=>{r=t,n(1,r)}))},()=>U(s,m),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t){d[t?"unshift":"push"]((()=>{m=t,n(3,m)}))},function(t){d[t?"unshift":"push"]((()=>{u=t,n(6,u)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t){d[t?"unshift":"push"]((()=>{h=t,n(8,h)}))},function(t){d[t?"unshift":"push"]((()=>{f=t,n(7,f)}))}]}class Z extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';#main b{color:#d50400}#table-content{position:fixed;display:flex;flex-direction:column;border:#cdcdcd 0.1rem solid;border-radius:1rem;padding:2rem;padding-top:1rem;padding-right:0.8rem;padding-bottom:1.5rem;margin-bottom:2rem;width:20rem;height:max-content}#toggle-content{position:relative;width:100%;font-size:1.2rem;font-family:var(--sans-serif,sans-serif);text-align:left;padding-bottom:1rem;font-weight:bold;padding-top:0.3rem}#toggle-content img{position:absolute;top:0.3rem;right:0.8rem;width:1.5rem}.module{position:relative;display:inline-block;width:100%;height:max-content;padding-right:1.2rem}.heading-button-wrapper{position:relative}.heading-button{color:black;height:auto;width:100%;padding-top:0.25rem;padding-bottom:0.35rem;text-align:left;font-family:var(--sans-serif,sans-serif);font-size:1.2rem}.level0{position:relative;padding-left:0.5rem;z-index:1}.level1{position:relative;padding-left:1.5rem;z-index:1;margin-left:1rem;width:calc(100% - 1rem);border-left:#cdcdcd 0.1rem solid}.heading-button:hover{background-color:hsla(344, 73%, 57%, 0.12)}.heading-button:active{background-color:hsla(344, 73%, 57%, 0.5)}h1{margin-bottom:1rem;font-size:2rem;text-align:center}h2{margin-bottom:1rem;text-align:center}h3{margin-bottom:1rem}#text-container{position:relative;display:grid;grid-template-columns:20rem 700px 20rem;grid-gap:2rem;max-width:calc(100vw - 4rem);margin:auto}#container{display:flex;align-content:center;margin:auto;max-width:min(1800px,100vw);margin-top:1rem;margin-bottom:4rem}#main{grid-column:2}#main>p{margin-bottom:1rem}#container p{text-align:justify}@media only screen and (max-width: 1210px){#text-container{position:relative;display:grid;grid-template-columns:auto;grid-gap:2rem;max-width:calc(1800px,100vw - 4rem);margin:auto}#toggle-content img{right:0}#table-content{position:relative;border:#a9a9a9 0.1rem solid;border-radius:1rem;padding:2rem;padding-bottom:1.5rem;margin-bottom:2rem;height:max-content;width:100%}.module{padding-right:0}#main{grid-column:1}#container{max-width:min(700px,100vw)}}</style>",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},X,Q,l,{},null,[-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("manifesto-component",Z);export{Z as default};