pbw-explore/_app/immutable/chunks/TimelineHeatmap-52c81460.js

2 řádky
8.4 KiB
JavaScript

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