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

2 lines
11 KiB
JavaScript

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