(()=>{"use strict";var t={4033:()=>{let t,e,i;onmessage=function(l){void 0!==l.data.canvas&&(t=l.data.canvas,o()),void 0!==l.data.opts&&(e=l.data.opts,o()),void 0!==l.data.plotData&&(i=l.data.plotData,o())};const o=function(){let o=!1;return()=>{o||(o=!0,setTimeout((()=>{o=!1,async function(){if(!t)return;if(!e)return;const{margins:o,canvasWidth:n,canvasHeight:r,visibleStartTimeSec:a,visibleEndTimeSec:s,hoveredUnitId:d,selectedUnitIds:c,zoomInRequired:f,infoMessage:h}=e;t.width=n,t.height=r;const v=t.getContext("2d");if(!v)return;if(v.clearRect(0,0,n,r),h&&(v.fillStyle="red",v.textAlign="center",v.textBaseline="top",v.font="20px Arial",v.fillText(h,n/2,0),v.fillStyle="black"),f)return v.fillStyle="pink",v.textAlign="center",v.textBaseline="middle",v.font="20px Arial",void v.fillText("Zoom in (mouse-wheel) to view raster plot",n/2,r/2);if(!i)return v.fillStyle="gray",v.textAlign="center",v.textBaseline="middle",v.font="20px Arial",void v.fillText("Loading...",n/2,r/2);const g=i.plots.length,p=i.plots.map(((t,e)=>{return{y:(i=e,r-o.bottom-(i+.5-0)/(g-0)*(r-o.top-o.bottom)),x:t.spikeTimesSec.map((t=>(t=>o.left+(t-a)/(s-a)*(n-o.left-o.right))(t))),unitId:t.unitId,color:t.color,hovered:t.unitId===d,selected:c.includes(t.unitId)};var i}));l(v,p)}()}),10))}}(),l=(t,i)=>{if(!e)return;const{margins:o,canvasWidth:l,canvasHeight:n}=e,r=n/i.length;for(const e of[1,2,3])i.forEach((i=>{(1===e&&r>=10||2===e&&i.selected||3===e&&i.hovered)&&(t.fillStyle=1===e?i.color:2===e?"black":i.color,t.textAlign="right",t.textBaseline="middle",t.font=(e>1?"bold ":"")+"12px Arial",t.fillText(i.unitId+"",o.left-4,i.y),(3===e||2===e&&i.hovered)&&(t.textAlign="left",t.textBaseline="middle",t.font=(e>1?"bold ":"")+"12px Arial",t.fillText(i.unitId+"",l-o.right+4,i.y)))}));t.save(),t.beginPath(),t.rect(o.left,o.top,l-o.left-o.right,n-o.top-o.bottom),t.clip();for(const e of[1,2])i.forEach((i=>{2===e&&i.hovered&&(t.strokeStyle="yellow",t.lineWidth=3,t.beginPath(),t.moveTo(0,i.y),t.lineTo(l,i.y),t.stroke(),t.strokeStyle="gray",t.lineWidth=1,t.beginPath(),t.moveTo(0,i.y),t.lineTo(l,i.y),t.stroke()),1===e&&i.selected&&(t.strokeStyle="lightblue",t.lineWidth=3,t.beginPath(),t.moveTo(0,i.y),t.lineTo(l,i.y),t.stroke())}));i.forEach((e=>{t.strokeStyle=e.color||"black",t.lineWidth=Math.max(3,Math.min(20,r/2)),t.beginPath(),e.x.forEach((i=>{t.moveTo(i-2,e.y),t.lineTo(i+2,e.y)})),t.stroke()})),t.restore()}}},e={};function i(o){var l=e[o];if(void 0!==l)return l.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,i),n.exports}i.m=t,i.c=e,i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{i.S={};var t={},e={};i.I=(o,l)=>{l||(l=[]);var n=e[o];if(n||(n=e[o]={}),!(l.indexOf(n)>=0)){if(l.push(n),t[o])return t[o];i.o(i.S,o)||(i.S[o]={}),i.S[o];var r=[];return t[o]=r.length?Promise.all(r).then((()=>t[o]=1)):1}}})(),i(4033)})();