"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[2367],{21016:(e,t,n)=>{n.d(t,{K:()=>s});var l=n(87485),o=n(46879);function s(e,t,n,s,f,c,i,a=!0,r="",u,h=1){const g=function(e,t,n=!0){const o=e.length;let s=0,f=0,c=0,i=0;for(const n of e)n===t?s++:"0"===n?i++:"."===n?f++:c++;if(i===o)return n?"#ccc":void 0;{let e;if(s&&(e=(0,l.M)(`hsl(200,50%,${80-s/o*50}%)`)),c){const t=`hsla(0,100%,20%,${c/o})`;e=e?e.mix(t):(0,l.M)(t)}if(f){const t=`hsl(50,50%,50%,${f/o})`;e=e?e.mix(t):(0,l.M)(t)}return e?.toHex()||"black"}}(e,i,a);return g&&(t.fillStyle=1!==h?(0,l.M)(g).alpha(h).toHex():g,"inversion"===r?1===u?(t.beginPath(),t.moveTo(n-o.f2,s-o.f2),t.lineTo(n-o.f2,s+c+o.f2),t.lineTo(n+f+o.f2,s+c/2),t.closePath(),t.fill()):(t.beginPath(),t.moveTo(n+f+o.f2,s-o.f2),t.lineTo(n+f+o.f2,s+c+o.f2),t.lineTo(n-o.f2,s+c/2),t.closePath(),t.fill()):t.fillRect(n-o.f2,s-o.f2,f+o.f2,c+o.f2)),g}},22367:(e,t,n)=>{n.d(t,{makeImageData:()=>a});var l=n(99546),o=n(37347),s=n(46879),f=n(21016),c=n(40171),i=n(85497);async function a({ctx:e,canvasWidth:t,canvasHeight:n,renderArgs:a}){const{renderingMode:r,minorAlleleFrequencyFilter:u,sources:h,features:g,stopToken:d,lengthCutoffFilter:p}=a,{statusCallback:b=()=>{}}=a,k=n/h.length;(0,o.SW)(d);const m=(0,i.Cg)({stopToken:d,features:g.values(),minorAlleleFrequencyFilter:u,lengthCutoffFilter:p});(0,o.SW)(d);const v=[],T=m.length,S=t/T;return await(0,l.updateStatus)("Drawing variant matrix",b,(()=>{(0,l.forEachWithStopTokenCheck)(m,d,(({feature:l,mostFrequentAlt:o},i)=>{const a=[],u=l.get("FORMAT")?.includes("PS");if(u){const u=l.get("samples"),g=i/m.length*t,d=h.length;for(let t=0;t<d;t++){const l=t/d*n,{name:i,HP:p}=h[t],b=u[i];if(b){const t=b.GT?.[0];if(t){a.push(t);const n=t.includes("|");if("phased"===r)if(n){const n=b.PS?.[0],o=t.split("|");(0,c.E)(o,e,g,l,S,k,p,n)}else e.fillStyle="black",e.fillRect(g-s.f2,l-s.f2,S+s.f2,k+s.f2);else{const n=t.split(/[/|]/);(0,f.K)(n,e,g,l,S,k,o)}}}}}else{const u=l.get("genotypes"),g=i/m.length*t,d=h.length;for(let t=0;t<d;t++){const l=t/d*n,{name:i,HP:p}=h[t],b=u[i];if(b){a.push(b);const t=b.includes("|");if("phased"===r)if(t){const t=b.split("|");(0,c.E)(t,e,g,l,S,k,p)}else e.fillStyle="black",e.fillRect(g-s.f2,l-s.f2,S+s.f2,k+s.f2);else{const t=b.split(/[/|]/);(0,f.K)(t,e,g,l,S,k,o)}}}}v.push(a)}))})),{mafs:m,arr:v}}},40171:(e,t,n)=>{n.d(t,{E:()=>c});var l=n(40898),o=n(87485),s=n(46879),f=n(42268);function c(e,t,n,c,i,a,r,u,h=!0,g=1){const d=void 0!==u?function(e,t,n,l=!0){return+e[t]?(0,f.qH)(+n)||"black":l?"#ccc":void 0}(e,r,u,h):function(e,t,n=!0){const o=+e[t];return o?l.set1[o-1]||"black":n?"#ccc":void 0}(e,r,h);return d&&(t.fillStyle=1!==g?(0,o.M)(d).alpha(g).toHex():d,t.fillRect(n-s.f2,c-s.f2,i+s.f2,a+s.f2)),d}},42268:(e,t,n)=>{function l(e){let t=0;for(let n=0;n<e.length;n++)t+=e.charCodeAt(n);return o(10*t)}function o(e){return`hsl(${e%255}, 50%, 50%)`}n.d(t,{XL:()=>l,qH:()=>o})},46879:(e,t,n)=>{n.d(t,{f2:()=>l});const l=.3}}]);
//# sourceMappingURL=2367.391bc7ad.chunk.js.map