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