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

2 lines
11 KiB
JavaScript

import{S as t,i as e,a as n,b as i,s as l,f as o,n as r,h as s,l as c,d as a,o as d,t as m,g as u,j as f,r as h,u as g,p,v as w,e as b,y as x,H as y}from"./index-ce8c147b.js";import{locales as v,getData as k}from"../../../../../../../../../js/libraries/serverTools.js";import{px2rem as H}from"../../../../../../../../../js/libraries/miscTools.js";function T(t,e,n){const i=t.slice();return i[30]=e[n],i[31]=e,i[32]=n,i}function j(t,e,n){const i=t.slice();return i[33]=e[n],i}function L(t,e,n){const i=t.slice();return i[33]=e[n],i}function I(t,e,n){const i=t.slice();return i[38]=e[n],i[39]=e,i[40]=n,i}function Y(t,e,n){const i=t.slice();return i[41]=e[n],i[42]=e,i[43]=n,i}function M(t){let e,n,l,r,d,f,h=t[38].name+"",p=t[38];const w=()=>t[17](n,p),b=()=>t[17](null,p);function x(){return t[18](t[38])}return{c(){e=o("div"),n=o("button"),l=m(h),r=u(),s(n,"class","level0 heading-button"),s(e,"class","heading-button-wrapper")},m(t,o){i(t,e,o),c(e,n),c(n,l),w(),c(e,r),d||(f=g(n,"click",x),d=!0)},p(e,n){p!==(t=e)[38]&&(b(),p=t[38],w())},d(t){t&&a(e),b(),d=!1,f()}}}function A(t){let e,n=t[38],l=[];for(let e=0;e<n.length;e+=1)l[e]=C(Y(t,n,e));return{c(){for(let t=0;t<l.length;t+=1)l[t].c();e=b()},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(3088&i[0]){let o;for(n=t[38],o=0;o<n.length;o+=1){const r=Y(t,n,o);l[o]?l[o].p(r,i):(l[o]=C(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){p(l,t),t&&a(e)}}}function C(t){let e,n,l,r,d,f,h=t[41].name+"",p=t[41];const w=()=>t[15](n,p),b=()=>t[15](null,p);function x(){return t[16](t[41])}return{c(){e=o("div"),n=o("button"),l=m(h),r=u(),s(n,"class","level1 heading-button"),s(e,"class","heading-button-wrapper")},m(t,o){i(t,e,o),c(e,n),c(n,l),w(),c(e,r),d||(f=g(n,"click",x),d=!0)},p(e,n){p!==(t=e)[41]&&(b(),p=t[41],w())},d(t){t&&a(e),b(),d=!1,f()}}}function z(t){let e;let n=function(t,e){return Array.isArray(t[38])?A:M}(t),l=n(t);return{c(){l.c(),e=b()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&a(e)}}}function E(t){let e;let n=function(t,e){return t[30],"ul"==Object.keys(t[30])[0]?N:(t[30],"ol"==Object.keys(t[30])[0]?B:(t[30],"h3"==t[30].type?R:(t[30],"h2"==t[30].type?V:"#"==t[30][0]?S:O)))}(t),l=n(t);return{c(){l.c(),e=b()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&a(e)}}}function O(t){let e,n,l,d=t[30]+"";return{c(){e=o("p"),n=new y(!1),l=u(),n.a=l,s(e,"class","margin-end")},m(t,o){i(t,e,o),n.m(d,e),c(e,l)},p:r,d(t){t&&a(e)}}}function S(t){let e,n=t[30].slice(2,t[30].length)+"";return{c(){e=o("h1")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&a(e)}}}function V(t){let e,n,l,r,d,m=t[30].line+"",f=t[30];const p=()=>t[22](n,f),w=()=>t[22](null,f);return{c(){e=o("button"),n=o("h2"),l=u(),s(n,"id",t[30].id),h(e,"display","block"),h(e,"width","100%")},m(o,s){i(o,e,s),c(e,n),n.innerHTML=m,p(),c(e,l),r||(d=g(e,"click",(function(){x(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),r=!0)},p(e,n){f!==(t=e)[30]&&(w(),f=t[30],p())},d(t){t&&a(e),w(),r=!1,d()}}}function R(t){let e,n,l,r,d,m=t[30].line+"",f=t[30];const p=()=>t[21](n,f),w=()=>t[21](null,f);return{c(){e=o("button"),n=o("h3"),l=u(),s(n,"id",t[30].id),h(e,"display","block"),h(e,"width","100%")},m(o,s){i(o,e,s),c(e,n),n.innerHTML=m,p(),c(e,l),r||(d=g(e,"click",(function(){x(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),r=!0)},p(e,n){f!==(t=e)[30]&&(w(),f=t[30],p())},d(t){t&&a(e),w(),r=!1,d()}}}function B(t){let e,n,l=t[30].ol,r=[];for(let e=0;e<l.length;e+=1)r[e]=_(j(t,l,e));return{c(){e=o("ol");for(let t=0;t<r.length;t+=1)r[t].c();n=u()},m(t,l){i(t,e,l);for(let t=0;t<r.length;t+=1)r[t].m(e,null);c(e,n)},p(t,i){if(512&i[0]){let o;for(l=t[30].ol,o=0;o<l.length;o+=1){const s=j(t,l,o);r[o]?r[o].p(s,i):(r[o]=_(s),r[o].c(),r[o].m(e,n))}for(;o<r.length;o+=1)r[o].d(1);r.length=l.length}},d(t){t&&a(e),p(r,t)}}}function N(t){let e,n,l=t[30].ul,r=[];for(let e=0;e<l.length;e+=1)r[e]=F(L(t,l,e));return{c(){e=o("ul");for(let t=0;t<r.length;t+=1)r[t].c();n=u()},m(t,l){i(t,e,l);for(let t=0;t<r.length;t+=1)r[t].m(e,null);c(e,n)},p(t,i){if(512&i[0]){let o;for(l=t[30].ul,o=0;o<l.length;o+=1){const s=L(t,l,o);r[o]?r[o].p(s,i):(r[o]=F(s),r[o].c(),r[o].m(e,n))}for(;o<r.length;o+=1)r[o].d(1);r.length=l.length}},d(t){t&&a(e),p(r,t)}}}function _(t){let e,n=t[33]+"";return{c(){e=o("li")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&a(e)}}}function F(t){let e,n,l=t[33]+"";return{c(){e=o("li"),n=m(l)},m(t,l){i(t,e,l),c(e,n)},p:r,d(t){t&&a(e)}}}function W(t){let e;let n=function(t,e){if(""!==t[30])return E}(t),l=n&&n(t);return{c(){l&&l.c(),e=b()},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&&a(e)}}}function q(t){let e,n,l,r,d,w,b,x,y,v,k,H=t[10],j=[];for(let e=0;e<H.length;e+=1)j[e]=z(I(t,H,e));let L=t[9],Y=[];for(let e=0;e<L.length;e+=1)Y[e]=W(T(t,L,e));return{c(){e=o("div"),n=o("button"),l=m("TABLE OF CONTENTS\r\n "),r=o("img"),w=u(),b=o("div");for(let t=0;t<j.length;t+=1)j[t].c();x=u(),y=o("div");for(let t=0;t<Y.length;t+=1)Y[t].c();f(r.src,d="../assets/arrow_down.svg")||s(r,"src","../assets/arrow_down.svg"),s(r,"alt","arrow down"),h(r,"transform","scaleY(-1)"),s(n,"id","toggle-content"),s(b,"class","module"),h(b,"display","initial"),s(e,"id","table-content"),s(y,"id","main")},m(o,s){i(o,e,s),c(e,n),c(n,l),c(n,r),t[12](r),t[13](n),c(e,w),c(e,b);for(let t=0;t<j.length;t+=1)j[t].m(b,null);t[19](b),t[20](e),i(o,x,s),i(o,y,s);for(let t=0;t<Y.length;t+=1)Y[t].m(y,null);t[23](y),v||(k=g(n,"click",t[14]),v=!0)},p(t,e){if(3088&e[0]){let n;for(H=t[10],n=0;n<H.length;n+=1){const i=I(t,H,n);j[n]?j[n].p(i,e):(j[n]=z(i),j[n].c(),j[n].m(b,null))}for(;n<j.length;n+=1)j[n].d(1);j.length=H.length}if(608&e[0]){let n;for(L=t[9],n=0;n<L.length;n+=1){const i=T(t,L,n);Y[n]?Y[n].p(i,e):(Y[n]=W(i),Y[n].c(),Y[n].m(y,null))}for(;n<Y.length;n+=1)Y[n].d(1);Y.length=L.length}},d(n){n&&a(e),t[12](null),t[13](null),p(j,n),t[19](null),t[20](null),n&&a(x),n&&a(y),p(Y,n),t[23](null),v=!1,k()}}}function D(t){let e,n,d=t[0],m=q(t);return{c(){e=o("div"),n=o("div"),m.c(),this.c=r,s(n,"id","text-container"),s(e,"id","container")},m(l,o){i(l,e,o),c(e,n),m.m(n,null),t[24](e)},p(t,e){1&e[0]&&l(d,d=t[0])?(m.d(1),m=q(t),m.c(),m.m(n,null)):m.p(t,e)},i:r,o:r,d(n){n&&a(e),m.d(n),t[24](null)}}}function G(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 J(t,e,n){let i,l,o,r,s,c,a,m,u=[],f=[],h={},g=[],p=0,b=0,x=location.href.split("/").filter((t=>Object.keys(v).includes(t)));m=0==x.length?"en":x[0];const y=["ul","ol"];function T(t){h[t].scrollIntoView({block:"start"},!0)}k("/locales/"+m+"/manifesto.txt",(function(t){let e,l=t.split(/\r?\n/),o=0;for(let t=0;t<l.length;t++){let n=l[t],i=y.map((t=>n.includes("<"+t+">"))).findIndex((t=>t));if(-1!=i){let e=y[i],o={};o[e]=[];let r="</"+e+">";for(;;){if(t+=1,n=l[t],n.includes(r)){u.push(o);break}o[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:o}),o+=1,u.push({type:"h3",id:i,line:t,index:o})}else if("##"==n.slice(0,2)){let t=n.slice(3,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");g.push({id:t.toLowerCase().trim().replaceAll(" ","-"),name:t,index:o}),o+=1,e=[],g.push(e),u.push({type:"h2",id:i,line:t,index:o})}else u.push(n)}n(0,i+=1)})),addEventListener("scroll",(t=>{if(window.innerWidth>1080){let t=H(window.scrollY),e=H(c.getBoundingClientRect().bottom+window.scrollY),i=H(s.getBoundingClientRect().bottom+window.scrollY);if(t>p&&t<5||t<p&&t<5)b=-Math.min(H(window.scrollY),5);else if(i>=e-1.5)b-=i-(e-1.5);else if(b>-5&&(b=-5),t<5&&0!=t){let t=H(s.offsetHeight-window.innerHeight);b=-Math.min(H(window.scrollY),5+t+2.5)}else if(t<p||0==b)b<-5?b+=p-t:b=-5;else if(s.offsetHeight>window.innerHeight){let e=H(s.offsetHeight)-H(window.innerHeight);b>-(e+8)?b+=p-t:b=-(e+8)}n(6,s.style.marginTop=b+"rem",s),p=H(window.scrollY)}else n(6,s.style.marginTop="0rem",s)})),d((()=>{let t=localStorage.getItem("manifesto-hide-content");null!=t&&null!=t&&"true"==t&&G(o,r)}));return[i,l,o,r,f,h,s,c,a,u,g,T,function(t){w[t?"unshift":"push"]((()=>{o=t,n(2,o)}))},function(t){w[t?"unshift":"push"]((()=>{l=t,n(1,l)}))},()=>G(o,r),function(t,e){w[t?"unshift":"push"]((()=>{f[e.index]=t,n(4,f)}))},t=>T(t.id),function(t,e){w[t?"unshift":"push"]((()=>{f[e.index]=t,n(4,f)}))},t=>T(t.id),function(t){w[t?"unshift":"push"]((()=>{r=t,n(3,r)}))},function(t){w[t?"unshift":"push"]((()=>{s=t,n(6,s)}))},function(t,e){w[t?"unshift":"push"]((()=>{h[e.id]=t,n(5,h)}))},function(t,e){w[t?"unshift":"push"]((()=>{h[e.id]=t,n(5,h)}))},function(t){w[t?"unshift":"push"]((()=>{a=t,n(8,a)}))},function(t){w[t?"unshift":"push"]((()=>{c=t,n(7,c)}))}]}class K 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},J,D,l,{},null,[-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("manifesto-component",K);export{K as default};