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

2 lines
5.6 KiB
JavaScript
Raw Normal View History

2023-07-04 23:21:15 +07:00
import{S as t,i as n,a as e,b as i,s as o,e as s,n as r,d as a,c as l,o as m,f as c,t as u,g as p,h as d,j as g,l as h,m as f,q as b,p as v,r as x}from"./index-4348483d.js";import{w as q}from"./index-71440b21.js";import{loadLocaleContent as _}from"../../../../../../../../../js/libraries/serverTools.js";function y(t,n,e){const i=t.slice();return i[17]=n[e],i[19]=e,i}function z(t){let n,e,s,r,l,m,b,v,x=t[5].heading+"",q=t[0],_=C(t);return{c(){n=c("div"),e=c("div"),s=c("h1"),r=u(x),l=p(),m=c("img"),v=p(),_.c(),d(m,"id","compass-img"),g(m.src,b="/img/common/compass.svg")||d(m,"src","/img/common/compass.svg"),d(m,"alt","compass"),d(e,"id","text-container"),d(n,"id","container")},m(t,o){i(t,n,o),h(n,e),h(e,s),h(s,r),h(e,l),h(e,m),h(e,v),_.m(e,null)},p(t,n){32&n&&x!==(x=t[5].heading+"")&&f(r,x),1&n&&o(q,q=t[0])?(_.d(1),_=C(t),_.c(),_.m(e,null)):_.p(t,n)},d(t){t&&a(n),_.d(t)}}}function k(t){let n,e,o,s,r,l,m,g,v,x,q,_,y,z,k,w,j,C,S,B,M,O,D,E;return{c(){n=c("p"),n.textContent="You are compatible with ...",e=p(),o=c("ul"),s=c("li"),r=u("capitalism by "),l=c("span"),m=u(t[2]),g=u("%"),v=p(),x=c("li"),q=u("vanguardism by "),_=c("span"),y=u(t[3]),z=u("%"),k=p(),w=c("li"),j=u("libertarian socialism by "),C=c("span"),S=u(t[4]),B=u("%"),M=p(),O=c("button"),O.textContent="back",d(o,"class","results-list"),d(O,"class","quiz-buttons")},m(a,c){i(a,n,c),i(a,e,c),i(a,o,c),h(o,s),h(s,r),h(s,l),h(l,m),h(s,g),h(o,v),h(o,x),h(x,q),h(x,_),h(_,y),h(x,z),h(o,k),h(o,w),h(w,j),h(w,C),h(C,S),h(w,B),i(a,M,c),i(a,O,c),D||(E=b(O,"click",t[15]),D=!0)},p(t,n){4&n&&f(m,t[2]),8&n&&f(y,t[3]),16&n&&f(S,t[4])},d(t){t&&a(n),t&&a(e),t&&a(o),t&&a(M),t&&a(O),D=!1,E()}}}function w(t){let n,e,o,s,r,l,m,g,q,_=t[5].qs[t[0]].q+"",z=t[5].qs[t[0]].as,k=[];for(let n=0;n<z.length;n+=1)k[n]=j(y(t,z,n));return{c(){n=c("p"),e=u(_),o=p(),s=c("div");for(let t=0;t<k.length;t+=1)k[t].c();r=p(),l=c("button"),l.textContent="back",m=c("button"),m.textContent="next",d(s,"class","quiz-inputs"),d(l,"class","quiz-buttons"),d(m,"class","quiz-buttons")},m(a,c){i(a,n,c),h(n,e),i(a,o,c),i(a,s,c);for(let t=0;t<k.length;t+=1)k[t].m(s,null);i(a,r,c),i(a,l,c),i(a,m,c),g||(q=[b(l,"click",t[13]),b(m,"click",t[14])],g=!0)},p(t,n){if(33&n&&_!==(_=t[5].qs[t[0]].q+"")&&f(e,_),35&n){let e;for(z=t[5].qs[t[0]].as,e=0;e<z.length;e+=1){const i=y(t,z,e);k[e]?k[e].p(i,n):(k[e]=j(i),k[e].c(),k[e].m(s,null))}for(;e<k.length;e+=1)k[e].d(1);k.length=z.length}},d(t){t&&a(n),t&&a(o),t&&a(s),v(k,t),t&&a(r),t&&a(l),t&&a(m),g=!1,x(q)}}}function j(t){let n,e,o,s,r,l,m,g,v,q=t[17][0]+"";function _(){return t[12](t[17])}return{c(){n=c("div"),e=c("input"),s=p(),r=c("button"),l=u(q),m=p(),d(e,"type","radio"),d(e,"id","option"+t[19]),d(e,"name","options"),e.__value=o=t[17][1],e.value=e.__value,t[11][0].push(e),d(r,"class","input-label"),d(r,"for","option"+t[19]),d(n,"class","radio-container")},m(o,a){i(o,n,a),h(n,e),e.checked=e.__value===t[1][t[0]],h(n,s),h(n,r),h(r,l),h(n,m),g||(v=[b(e,"change",t[10]),b(r,"click",_)],g=!0)},p(n,i){t=n,33&i&&o!==(o=t[17][1])&&(e.__value=o,e.value=e.__value),3&i&&(e.checked=e.__value===t[1][t[0]]),33&i&&q!==(q=t[17][0]+"")&&f(l,q)},d(i){i&&a(n),t[11][0].splice(t[11][0].indexOf(e),1),g=!1,x(v)}}}function C(t){let n;function e(t,n){return t[0]!=t[5].qs.length?w:k}let o=e(t),r=o(t);return{c(){r.c(),n=s()},m(t,e){r.m(t,e),i(t,n,e)},p(t,i){o===(o=e(t))&&r?r.p(t,i):(r.d(1),r=o(t),r&&(r.c(),r.m(n.parentNode,n)))},d(t){r.d(t),t&&a(n)}}}function S(t){let n,e=0!=Object.keys(t[5]).length,o=e&&z(t);return{c(){o&&o.c(),n=s(),this.c=r},m(t,e){o&&o.m(t,e),i(t,n,e)},p(t,[i]){32&i&&(e=0!=Object.keys(t[5]).length),e?o?o.p(t,i):(o=z(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},i:r,o:r,d(t){o&&o.d(t),t&&a(n)}}}function B(t,n,e){let i,o,s=q({});l(t,s,(t=>e(5,i=t))),_(s,"compass-component",o);let r=0,a=[],c="",u="",p="";function d(t){null!=a[t]&&r<i.qs.length&&(r==i.qs.length-1&&(e(2,c=Math.round(100*a.map((t=>t.includes("C"))).filter(Boolean).length/a.length).toString()),e(3,u=Math.round(100*a.map((t=>t.includes("V"))).filter(Boolean).length/a.length).toString()),e(4,p=Math.round(100*a.map((t=>t.includes("