"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4223],{97202:(e,t,a)=>{a.d(t,{Z:()=>g});var r=a(66204),n=a(80846),l=a(90872),i=a(71472),s=a(92368);const o=(0,a(38684).ZL)()({rulerLabel:{fontSize:"0.8rem",fontWeight:500,lineHeight:1.6,letterSpacing:"0.0075em"}});function c(e,t,a,r){e.flipped&&([a,r]=[r,a]);const n=e.bpToXY(a,t),l=e.bpToXY(r,t);return["M",...n,"A",t,t,"0",Math.abs(r-a)/e.bpPerRadian>Math.PI?"1":"0","1",...l].join(" ")}const m=(0,n.observer)((function({model:e,slice:t,region:a}){const n=(0,s.Z)(),{radiusPx:i}=e,o=i+1,{endRadians:c,startRadians:m}=t,h=(0,l.polarToCartesian)(o,m),g=(0,l.polarToCartesian)(o,c),u=(c-m)*o,p=c-m>Math.PI?"1":"0",f=(c+m)/2,x=`[${Number(a.regions.length).toLocaleString()}]`;return r.createElement(r.Fragment,null,r.createElement(d,{text:x,view:e,maxWidthPx:u,radians:f,radiusPx:o,title:`${x} more regions`,color:n.palette.text.primary}),r.createElement("path",{d:["M",...h,"A",o,o,"0",p,"1",...g].join(" "),stroke:n.palette.text.secondary,strokeWidth:2,strokeDasharray:"2,2",fill:"none"}))})),d=(0,n.observer)((function({view:e,text:t,maxWidthPx:a,radians:n,radiusPx:i,title:s,color:c}){const{classes:m}=o(),d=(0,l.polarToCartesian)(i+5,n);return t?6.5*t.length<a?r.createElement("text",{x:0,y:0,className:m.rulerLabel,textAnchor:"middle",dominantBaseline:"baseline",transform:`translate(${d}) rotate(${(0,l.radToDeg)(n)+90})`,style:{fill:c}},t,r.createElement("title",null,s||t)):a>4?(0,l.radToDeg)(n+e.offsetRadians-Math.PI/2)>=180?r.createElement("text",{x:0,y:0,className:m.rulerLabel,textAnchor:"start",dominantBaseline:"middle",transform:`translate(${d}) rotate(${(0,l.radToDeg)(n)})`,style:{fill:c}},t,r.createElement("title",null,s||t)):r.createElement("text",{x:0,y:0,className:m.rulerLabel,textAnchor:"end",dominantBaseline:"middle",transform:`translate(${d}) rotate(${(0,l.radToDeg)(n)+180})`,style:{fill:c}},t,r.createElement("title",null,s||t)):null:null})),h=(0,n.observer)((function({model:e,slice:t,region:a}){const n=(0,s.Z)(),{radiusPx:o}=e,{endRadians:m,startRadians:h}=t,g=(m+h)/2,u=(m-h)*o;let p;const f=(0,l.getSession)(e).assemblyManager.get(a.assemblyName);if(f&&(p=f.getRefNameColor(a.refName)),p)try{p=(0,i.makeContrasting)(p,n.palette.background.paper)}catch(e){p=n.palette.text.primary}else p=n.palette.text.primary;return r.createElement(r.Fragment,null,r.createElement(d,{text:a.refName,view:e,maxWidthPx:u,radians:g,radiusPx:o,color:p}),r.createElement("path",{d:c(t,o+1,a.start,a.end),stroke:p,strokeWidth:2,fill:"none"}))})),g=(0,n.observer)((function({model:e,slice:t}){return t.region.elided?r.createElement(m,{key:(0,l.assembleLocString)(t.region.regions[0]),model:e,region:t.region,slice:t}):r.createElement(h,{key:(0,l.assembleLocString)(t.region),region:t.region,model:e,slice:t})}))},64223:(e,t,a)=>{a.d(t,{renderToSvg:()=>h});var r=a(66204),n=a(34599),l=a(9721),i=a(99247),s=a(90872),o=a(35421),c=a(92368);function m({width:e,height:t,shift:a}){const n=(0,c.Z)();return r.createElement("rect",{width:e+2*a,height:t,fill:(0,s.stripAlpha)(n.palette.background.default)})}var d=a(97202);async function h(e,t){await(0,i.when)((()=>e.initialized));const{themeName:a="default",Wrapper:c=(({children:e})=>r.createElement(r.Fragment,null,e))}=t,h=(0,s.getSession)(e),g=h.allThemes?.()[a],{width:u,tracks:p,height:f}=e,x=await Promise.all(p.map((async e=>{const a=e.displays[0];return await(0,i.when)((()=>void 0===a.ready||a.ready)),{track:e,result:await a.renderSvg({...t,theme:g})}}))),{staticSlices:w,offsetRadians:b,centerXY:y}=e,E=(0,s.radToDeg)(b);return(0,l.uS)(r.createElement(n.Z,{theme:(0,o.createJBrowseTheme)(g)},r.createElement(c,null,r.createElement("svg",{width:u,height:f,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,u+100,f].toString()},r.createElement(m,{width:u,height:f,shift:50}),r.createElement("g",{transform:`translate(${y}) rotate(${E})`},w.map(((t,a)=>r.createElement(d.Z,{key:a,model:e,slice:t}))),x.map((({result:e},t)=>r.createElement(r.Fragment,{key:t},e))))))))}}}]);
//# sourceMappingURL=4223.4f6b83bf.chunk.js.map