"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5668],{95668:(t,e,a)=>{a.d(e,{renderToSvg:()=>x});var r=a(67112),s=a(99546),i=a(53179),l=a(91063),n=a(42489),c=a(67758),o=a(51414),h=a(69500);function d(t){const e=(0,c.c)(6),{width:a,height:r,shift:i}=t,l=(0,o.A)(),n=a+2*i;let d,f;return e[0]!==l.palette.background.default?(d=(0,s.stripAlpha)(l.palette.background.default),e[0]=l.palette.background.default,e[1]=d):d=e[1],e[2]!==r||e[3]!==n||e[4]!==d?(f=(0,h.jsx)("rect",{width:n,height:r,fill:d}),e[2]=r,e[3]=n,e[4]=d,e[5]=f):f=e[5],f}var f=a(91468),m=a(95727);async function x(t,e){const{textHeight:a=18,headerHeight:c=30,rulerHeight:o=30,fontSize:x=13,trackLabels:g="offset",Wrapper:u=({children:t})=>t,themeName:p="default"}=e,w=(0,s.getSession)(t),k=w.allThemes?.()[p],{width:j,views:b}=t,v=c+o,y=b.map(t=>(0,i.mJ)(t.tracks,a,g)+v),S=(0,s.sum)(y)+100,T=await Promise.all(b.map(async t=>({view:t,data:await Promise.all(t.tracks.map(async t=>{const a=t.displays[0];return await(0,n.when)(()=>void 0===a.ready||a.ready),{track:t,result:await a.renderSvg({...e,theme:k})}}))}))),z=function(t,e,a){return(0,s.max)(t.flatMap(t=>t.tracks.map(t=>(0,s.measureText)((0,f.getTrackName)(t.configuration,a),e))),0)}(b,x,w)+40,$="left"===g?z:0,H="offset"===g?a:0,L=b.map((t,e)=>function(t,e,a=0){const r={};let s=e;for(const i of t.tracks)r[i.configuration.trackId]=s+a,s+=i.displays[0].height+e;return r}(t,H,x+(e>0?y[e-1]:0)+v)),P=j+$,A=(0,r.createJBrowseTheme)(k);return(0,s.renderToStaticMarkup)((0,h.jsx)(l.A,{theme:A,children:(0,h.jsx)(u,{children:(0,h.jsxs)("svg",{width:j,height:S,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,P+100,S].toString(),children:[(0,h.jsx)(d,{width:P,height:S,shift:50}),b[0]?(0,h.jsxs)("g",{transform:`translate(50 ${x})`,children:[(0,h.jsxs)("g",{transform:`translate(${$})`,children:[(0,h.jsx)("text",{x:0,fontSize:x,fill:A.palette.text.primary,children:b[0].assemblyNames.join(", ")}),(0,h.jsx)(i.$m,{model:T[0].view,fontSize:x})]}),(0,h.jsx)("g",{transform:`translate(0 ${v})`,children:(0,h.jsx)(i.zh,{textHeight:a,trackLabels:g,fontSize:x,model:T[0].view,displayResults:T[0].data,trackLabelOffset:$})})]}):null,b[1]?(0,h.jsxs)("g",{transform:`translate(50 ${x+y[0]})`,children:[(0,h.jsxs)("g",{transform:`translate(${$})`,children:[(0,h.jsx)("text",{x:0,fontSize:x,fill:A.palette.text.primary,children:b[1].assemblyNames.join(", ")}),(0,h.jsx)(i.$m,{model:T[1].view,fontSize:x})]}),(0,h.jsx)("g",{transform:`translate(0 ${v})`,children:(0,h.jsx)(i.zh,{textHeight:a,trackLabels:g,fontSize:x,model:T[1].view,displayResults:T[1].data,trackLabelOffset:$})})]}):null,(0,h.jsx)("defs",{children:(0,h.jsx)("clipPath",{id:"clip-bsv",children:(0,h.jsx)("rect",{x:0,y:0,width:j,height:S})})}),(0,h.jsx)("g",{transform:`translate(${$+50})`,clipPath:"url(#clip-bsv)",children:t.matchedTracks.map(e=>(0,h.jsx)(m.A,{parentRef:{current:null},model:t,trackId:e.configuration.trackId,getTrackYPosOverride:(t,e)=>L[e][t]},e.configuration.trackId))})]})})}))}}}]);
//# sourceMappingURL=5668.42bdb400.chunk.js.map