pbw-explore/_app/immutable/chunks/TimelineHeatmap-ed0beb84.js

2 řádky
9.5 KiB
JavaScript

import{S as ue,i as ce,s as ge,k,a as V,l as E,m as I,c as $,h as p,n as v,b as H,H as b,f as O,g as re,t as C,d as ie,J as K,q,r as z,p as N,u as G,w as _e,x as me,y as ve,z as pe,K as P,L as W,M as be}from"./index-ca7dbb83.js";import{j as A}from"./singletons-3b2ed371.js";import{r as we,a as De,t as ye,c as U,f as T,b as F,I as ke}from"./Footer-158db6a7.js";var Ee=6e4;function X(e,t){we(2,arguments);var r=ye(t);return De(e,r*Ee)}A.disable_scroll_handling;const Ie=A.goto;A.invalidate;A.invalidateAll;A.preload_data;A.preload_code;A.before_navigate;A.after_navigate;function Y(e,t,r){const s=e.slice();return s[17]=t[r],s[19]=r,s}function Z(e,t,r){const s=e.slice();return s[20]=t[r],s}function x(e,t,r){const s=e.slice();return s[17]=t[r],s}function ee(e,t,r){const s=e.slice();return s[25]=t[r][0],s[26]=t[r][1],s}function te(e){let t,r,s=e[2].title+"",u,d,o,c,a,_=e[2].data.events.map(e[10]),i=[];for(let n=0;n<_.length;n+=1)i[n]=ne(ee(e,_,n));const g=n=>C(i[n],1,1,()=>{i[n]=null});return{c(){t=k("div"),r=k("div"),u=q(s),d=V(),o=k("div");for(let n=0;n<i.length;n+=1)i[n].c();this.h()},l(n){t=E(n,"DIV",{class:!0,style:!0});var l=I(t);r=E(l,"DIV",{class:!0});var f=I(r);u=z(f,s),f.forEach(p),d=$(l),o=E(l,"DIV",{class:!0});var h=I(o);for(let D=0;D<i.length;D+=1)i[D].l(h);h.forEach(p),l.forEach(p),this.h()},h(){v(r,"class","uppercase"),v(o,"class","text-xl mt-4"),v(t,"class",c="absolute top-[81px] w-[300px] border bg-white z-50 py-2 px-4 "+(e[2]?"hidden md:block":"hidden")),N(t,"left",e[2].event.layerX+"px")},m(n,l){H(n,t,l),b(t,r),b(r,u),b(t,d),b(t,o);for(let f=0;f<i.length;f+=1)i[f].m(o,null);a=!0},p(n,l){if((!a||l&4)&&s!==(s=n[2].title+"")&&G(u,s),l&260){_=n[2].data.events.map(n[10]);let f;for(f=0;f<_.length;f+=1){const h=ee(n,_,f);i[f]?(i[f].p(h,l),O(i[f],1)):(i[f]=ne(h),i[f].c(),O(i[f],1),i[f].m(o,null))}for(re(),f=_.length;f<i.length;f+=1)g(f);ie()}(!a||l&4&&c!==(c="absolute top-[81px] w-[300px] border bg-white z-50 py-2 px-4 "+(n[2]?"hidden md:block":"hidden")))&&v(t,"class",c),(!a||l&4)&&N(t,"left",n[2].event.layerX+"px")},i(n){if(!a){for(let l=0;l<_.length;l+=1)O(i[l]);a=!0}},o(n){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)C(i[l]);a=!1},d(n){n&&p(t),K(i,n)}}}function le(e){let t,r=e[25].segments[e[26]].title+"",s;return{c(){t=q("- "),s=q(r)},l(u){t=z(u,"- "),s=z(u,r)},m(u,d){H(u,t,d),H(u,s,d)},p(u,d){d&4&&r!==(r=u[25].segments[u[26]].title+"")&&G(s,r)},d(u){u&&p(t),u&&p(s)}}}function ne(e){let t,r,s,u,d,o=(e[25].shortname||e[25].name)+"",c,a,_,i;s=new ke({props:{item:e[25],width:"h-8"}});let g=e[25].segments[e[26]].title&&le(e);return{c(){t=k("div"),r=k("div"),_e(s.$$.fragment),u=V(),d=k("div"),c=q(o),a=V(),g&&g.c(),_=V(),this.h()},l(n){t=E(n,"DIV",{class:!0});var l=I(t);r=E(l,"DIV",{class:!0});var f=I(r);me(s.$$.fragment,f),f.forEach(p),u=$(l),d=E(l,"DIV",{class:!0});var h=I(d);c=z(h,o),a=$(h),g&&g.l(h),h.forEach(p),_=$(l),l.forEach(p),this.h()},h(){v(r,"class",""),v(d,"class",""),v(t,"class","flex gap-2 items-center mb-1")},m(n,l){H(n,t,l),b(t,r),ve(s,r,null),b(t,u),b(t,d),b(d,c),b(d,a),g&&g.m(d,null),b(t,_),i=!0},p(n,l){const f={};l&4&&(f.item=n[25]),s.$set(f),(!i||l&4)&&o!==(o=(n[25].shortname||n[25].name)+"")&&G(c,o),n[25].segments[n[26]].title?g?g.p(n,l):(g=le(n),g.c(),g.m(d,null)):g&&(g.d(1),g=null)},i(n){i||(O(s.$$.fragment,n),i=!0)},o(n){C(s.$$.fragment,n),i=!1},d(n){n&&p(t),pe(s),g&&g.d()}}}function se(e){let t,r,s,u=T(new Date(e[17]),"eee ")+"",d,o,c=T(new Date(e[17]),"d")+"",a,_,i;return{c(){t=k("div"),r=k("a"),s=k("span"),d=q(u),o=V(),a=q(c),_=V(),this.h()},l(g){t=E(g,"DIV",{class:!0,style:!0});var n=I(t);r=E(n,"A",{href:!0});var l=I(r);s=E(l,"SPAN",{class:!0});var f=I(s);d=z(f,u),f.forEach(p),o=$(l),a=z(l,c),l.forEach(p),_=$(n),n.forEach(p),this.h()},h(){v(s,"class","hidden md:inline-block"),v(r,"href","/23/day/"+T(new Date(e[17]),"yyyy-MM-dd")),v(t,"class",i="mb-1 uppercase "+(e[0]&&e[0]!==e[17]?"text-gray-400 text-lg":"text-pbw-red text-lg")),N(t,"width",1/(e[3].length/100)+"%")},m(g,n){H(g,t,n),b(t,r),b(r,s),b(s,d),b(r,o),b(r,a),b(t,_)},p(g,n){n&1&&i!==(i="mb-1 uppercase "+(g[0]&&g[0]!==g[17]?"text-gray-400 text-lg":"text-pbw-red text-lg"))&&v(t,"class",i)},d(g){g&&p(t)}}}function ae(e){let t,r,s,u,d;return{c(){t=k("div"),this.h()},l(o){t=E(o,"DIV",{id:!0,"data-events":!0,"data-score":!0,class:!0,style:!0});var c=I(t);c.forEach(p),this.h()},h(){v(t,"id",e[17]+"-"+e[20]),v(t,"data-events",r=e[1][[e[17],e[20]].join(";")].events),v(t,"data-score",s=e[1][[e[17],e[20]].join(";")].score),v(t,"class","md:hover:border md:hover:border-pbw-yellow flex-grow cursor-pointer"),N(t,"width",1/(e[4].length/50)+"%"),N(t,"background-color","rgba("+(!e[0]||e[0]===e[17]?"255, 22, 22":"115, 115, 115")+", "+e[1][[e[17],e[20]].join(";")].perc+"%)")},m(o,c){H(o,t,c),u||(d=[P(t,"click",function(){W(e[6](e[17],e[20],e[1][[e[17],e[20]].join(";")]))&&e[6](e[17],e[20],e[1][[e[17],e[20]].join(";")]).apply(this,arguments)}),P(t,"mouseenter",function(){W(e[5](e[17],e[20],e[1][[e[17],e[20]].join(";")]))&&e[5](e[17],e[20],e[1][[e[17],e[20]].join(";")]).apply(this,arguments)}),P(t,"mouseleave",e[7])],u=!0)},p(o,c){e=o,c&2&&r!==(r=e[1][[e[17],e[20]].join(";")].events)&&v(t,"data-events",r),c&2&&s!==(s=e[1][[e[17],e[20]].join(";")].score)&&v(t,"data-score",s),c&3&&N(t,"background-color","rgba("+(!e[0]||e[0]===e[17]?"255, 22, 22":"115, 115, 115")+", "+e[1][[e[17],e[20]].join(";")].perc+"%)")},d(o){o&&p(t),u=!1,be(d)}}}function oe(e){let t,r,s,u=e[4],d=[];for(let o=0;o<u.length;o+=1)d[o]=ae(Z(e,u,o));return{c(){t=k("div");for(let o=0;o<d.length;o+=1)d[o].c();r=V(),this.h()},l(o){t=E(o,"DIV",{class:!0,style:!0});var c=I(t);for(let a=0;a<d.length;a+=1)d[a].l(c);r=$(c),c.forEach(p),this.h()},h(){v(t,"class","h-10 flex flex-grow hover:bg-pbw-yellow/20"),v(t,"style",s="width: "+1/(e[3].length/100)+"%; "+(e[0]&&e[0]===e[17]?"border: 1px solid rgb(255, 22, 22);":e[0]?e[3].length-e[19]>1?"border-right: 1px solid silver;":"":"border-right: 1px solid rgb(255, 22, 22);"))},m(o,c){H(o,t,c);for(let a=0;a<d.length;a+=1)d[a].m(t,null);b(t,r)},p(o,c){if(c&251){u=o[4];let a;for(a=0;a<u.length;a+=1){const _=Z(o,u,a);d[a]?d[a].p(_,c):(d[a]=ae(_),d[a].c(),d[a].m(t,r))}for(;a<d.length;a+=1)d[a].d(1);d.length=u.length}c&1&&s!==(s="width: "+1/(o[3].length/100)+"%; "+(o[0]&&o[0]===o[17]?"border: 1px solid rgb(255, 22, 22);":o[0]?o[3].length-o[19]>1?"border-right: 1px solid silver;":"":"border-right: 1px solid rgb(255, 22, 22);"))&&v(t,"style",s)},d(o){o&&p(t),K(d,o)}}}function Me(e){let t,r,s,u,d,o,c,a=e[2]&&te(e),_=e[3],i=[];for(let l=0;l<_.length;l+=1)i[l]=se(x(e,_,l));let g=e[3],n=[];for(let l=0;l<g.length;l+=1)n[l]=oe(Y(e,g,l));return{c(){t=k("div"),a&&a.c(),r=V(),s=k("div");for(let l=0;l<i.length;l+=1)i[l].c();u=V(),d=k("div");for(let l=0;l<n.length;l+=1)n[l].c();this.h()},l(l){t=E(l,"DIV",{class:!0});var f=I(t);a&&a.l(f),r=$(f),s=E(f,"DIV",{class:!0});var h=I(s);for(let M=0;M<i.length;M+=1)i[M].l(h);h.forEach(p),u=$(f),d=E(f,"DIV",{class:!0});var D=I(d);for(let M=0;M<n.length;M+=1)n[M].l(D);D.forEach(p),f.forEach(p),this.h()},h(){v(s,"class","flex text-center text-gray-400 text-sm items-end h-10"),v(d,"class",o="w-full border "+(e[0]?"border-gray-300":"border-pbw-red")+" flex"),v(t,"class","w-full mb-10 relative")},m(l,f){H(l,t,f),a&&a.m(t,null),b(t,r),b(t,s);for(let h=0;h<i.length;h+=1)i[h].m(s,null);b(t,u),b(t,d);for(let h=0;h<n.length;h+=1)n[h].m(d,null);c=!0},p(l,[f]){if(l[2]?a?(a.p(l,f),f&4&&O(a,1)):(a=te(l),a.c(),O(a,1),a.m(t,r)):a&&(re(),C(a,1,1,()=>{a=null}),ie()),f&9){_=l[3];let h;for(h=0;h<_.length;h+=1){const D=x(l,_,h);i[h]?i[h].p(D,f):(i[h]=se(D),i[h].c(),i[h].m(s,null))}for(;h<i.length;h+=1)i[h].d(1);i.length=_.length}if(f&251){g=l[3];let h;for(h=0;h<g.length;h+=1){const D=Y(l,g,h);n[h]?n[h].p(D,f):(n[h]=oe(D),n[h].c(),n[h].m(d,null))}for(;h<n.length;h+=1)n[h].d(1);n.length=g.length}(!c||f&1&&o!==(o="w-full border "+(l[0]?"border-gray-300":"border-pbw-red")+" flex"))&&v(d,"class",o)},i(l){c||(O(a),c=!0)},o(l){C(a),c=!1},d(l){l&&p(t),a&&a.d(),K(i,l),K(n,l)}}}const B="2023-06-02",je="2023-06-11",J=60,Se="09:00-18:00";function Te(e,t,r){let{data:s}=t,{highlightDay:u=!1}=t;const d=s.bundle,o=[];let c=B;for(;U(new Date(c),new Date(je))<=0;)o.push(T(new Date(c),"yyyy-MM-dd")),c=F(new Date(c),1);const a=[];let _="00:00";for(F(new Date(B),1);!a.includes(_);)a.push(T(new Date(B+"T"+_),"HH:mm")),_=T(X(new Date(B+"T"+_),J),"HH:mm");const i={};for(const m of o)for(const w of a)i[[m,w].join(";")]={score:0,events:[]};function g(m,w,y,j){for(const S of o)for(const L of a){const Q=new Date(`${S}T${L}`),fe=new Date(X(Q,J));if(U(Q,m.end)<0&&U(fe,m.start)>0){const he=y?y>3e3?3e3:y<200?200:y:0,R=i[[S,L].join(";")];R.score+=he||0,R.events.push([w,j])}}}for(const m of d.events)for(let w=0;w<m.segments.length;w++){const y=m.segments[w],[j,S]=(y.times||Se).split("-"),L={start:new Date(`${y.date}T${j}`),end:new Date(`${S<=j?T(F(new Date(y.date),1),"yyyy-MM-dd"):y.date}T${S}`)};g(L,m.id,y.ecap||m.attendees,w)}const n=Math.max(...Object.keys(i).map(m=>i[m].score));for(const m of Object.keys(i)){const w=i[m];w.perc=w.score/(n/100)}let l=null;function f(m,w,y){const j=new Date(`${m}T${w}`),S=T(j,"EEEE MMMM d | HH:mm - ")+T(X(j,J),"HH:mm");return L=>{r(2,l={day:m,segment:w,data:y,event:L,title:S})}}function h(m,w,y){const j=new Date(`${m}T${w}`),S=X(j,J);Ie(`/${s.params.entry}/day/${m}?start=${j.toISOString()}&end=${S.toISOString()}`)}function D(){r(2,l=null)}function M(m){return d.events.find(w=>w.id===m)}const de=m=>[M(m[0]),m[1]];return e.$$set=m=>{"data"in m&&r(9,s=m.data),"highlightDay"in m&&r(0,u=m.highlightDay)},[u,i,l,o,a,f,h,D,M,s,de]}class Ae extends ue{constructor(t){super(),ce(this,t,Te,Me,ge,{data:9,highlightDay:0})}}export{Ae as T,Ie as g};