"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[311],{83803:(e,t,a)=>{a.d(t,{A:()=>h});var r=a(7552),n=a(68446),l=a(99546),i=a(80208),s=a(48231);const o=(0,a(75785).n9)()({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.A)(),{radiusPx:i}=e,o=i+1,{endRadians:c,startRadians:m}=t,g=(0,l.polarToCartesian)(o,m),h=(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",...g,"A",o,o,"0",p,"1",...h].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})),g=(0,n.observer)((function({model:e,slice:t,region:a}){const n=(0,s.A)(),{radiusPx:o}=e,{endRadians:m,startRadians:g}=t,h=(m+g)/2,u=(m-g)*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:h,radiusPx:o,color:p}),r.createElement("path",{d:c(t,o+1,a.start,a.end),stroke:p,strokeWidth:2,fill:"none"}))})),h=(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(g,{key:(0,l.assembleLocString)(t.region),region:t.region,model:e,slice:t})}))},60311:(e,t,a)=>{a.d(t,{renderToSvg:()=>g});var r=a(7552),n=a(48407),l=a(42489),i=a(99546),s=a(48735),o=a(36422),c=a(48231);function m({width:e,height:t,shift:a}){const n=(0,c.A)();return r.createElement("rect",{width:e+2*a,height:t,fill:(0,i.stripAlpha)(n.palette.background.default)})}var d=a(83803);async function g(e,t){await(0,l.when)((()=>e.initialized));const{themeName:a="default",Wrapper:c=(({children:e})=>r.createElement(r.Fragment,null,e))}=t,g=(0,i.getSession)(e),h=g.allThemes?.()[a],{createRootFn:u}=(0,o.getRoot)(e),{width:p,tracks:f,height:x}=e,w=await Promise.all(f.map((async e=>{const a=e.displays[0];return await(0,l.when)((()=>void 0===a.ready||a.ready)),{track:e,result:await a.renderSvg({...t,theme:h})}}))),{staticSlices:b,offsetRadians:y,centerXY:E}=e,k=(0,i.radToDeg)(y);return(0,i.renderToStaticMarkup)(r.createElement(n.A,{theme:(0,s.createJBrowseTheme)(h)},r.createElement(c,null,r.createElement("svg",{width:p,height:x,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,p+100,x].toString()},r.createElement(m,{width:p,height:x,shift:50}),r.createElement("g",{transform:`translate(${E}) rotate(${k})`},b.map(((t,a)=>r.createElement(d.A,{key:a,model:e,slice:t}))),w.map((({result:e},t)=>r.createElement(r.Fragment,{key:t},e))))))),u)}}}]);
//# sourceMappingURL=311.9c289f42.chunk.js.map