"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[311],{60311:(e,t,r)=>{r.d(t,{renderToSvg:()=>m});var a=r(7552),s=r(67112),n=r(99546),i=r(91063),l=r(42489),o=r(67758),d=r(51414),c=r(69500);function h(e){const t=(0,o.c)(6),{width:r,height:a,shift:s}=e,i=(0,d.A)(),l=r+2*s;let h,g;return t[0]!==i.palette.background.default?(h=(0,n.stripAlpha)(i.palette.background.default),t[0]=i.palette.background.default,t[1]=h):h=t[1],t[2]!==a||t[3]!==l||t[4]!==h?(g=(0,c.jsx)("rect",{width:l,height:a,fill:h}),t[2]=a,t[3]=l,t[4]=h,t[5]=g):g=t[5],g}var g=r(83803);async function m(e,t){await(0,l.when)(()=>e.initialized);const{themeName:r="default",Wrapper:o=({children:e})=>e}=t,d=(0,n.getSession)(e),m=d.allThemes?.()[r],{width:x,tracks:u,height:p}=e,f=await Promise.all(u.map(async e=>{const r=e.displays[0];return await(0,l.when)(()=>void 0===r.ready||r.ready),{track:e,result:await r.renderSvg({...t,theme:m})}})),{staticSlices:b,offsetRadians:w,centerXY:j}=e,k=(0,n.radToDeg)(w);return(0,n.renderToStaticMarkup)((0,c.jsx)(i.A,{theme:(0,s.createJBrowseTheme)(m),children:(0,c.jsx)(o,{children:(0,c.jsxs)("svg",{width:x,height:p,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,x+100,p].toString(),children:[(0,c.jsx)(h,{width:x,height:p,shift:50}),(0,c.jsxs)("g",{transform:`translate(${j}) rotate(${k})`,children:[b.map((t,r)=>(0,c.jsx)(g.A,{model:e,slice:t},r)),f.map(({result:e},t)=>(0,c.jsx)(a.Fragment,{children:e},t))]})]})})}))}},83803:(e,t,r)=>{r.d(t,{A:()=>x});var a=r(99546),s=r(80208),n=r(51414),i=r(68446),l=r(75785),o=r(69500);const d=(0,l.n9)()({rulerLabel:{fontSize:"0.8rem",fontWeight:500,lineHeight:1.6,letterSpacing:"0.0075em"}});function c(e,t,r,a){e.flipped&&([r,a]=[a,r]);const s=e.bpToXY(r,t),n=e.bpToXY(a,t);return["M",...s,"A",t,t,"0",Math.abs(a-r)/e.bpPerRadian>Math.PI?"1":"0","1",...n].join(" ")}const h=(0,i.observer)(function({model:e,slice:t,region:r}){const s=(0,n.A)(),{radiusPx:i}=e,l=i+1,{endRadians:d,startRadians:c}=t,h=(0,a.polarToCartesian)(l,c),m=(0,a.polarToCartesian)(l,d),x=(d-c)*l,u=d-c>Math.PI?"1":"0",p=(d+c)/2,f=`[${Number(r.regions.length).toLocaleString()}]`;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g,{text:f,view:e,maxWidthPx:x,radians:p,radiusPx:l,title:`${f} more regions`,color:s.palette.text.primary}),(0,o.jsx)("path",{d:["M",...h,"A",l,l,"0",u,"1",...m].join(" "),...(0,a.getStrokeProps)(s.palette.text.secondary),strokeWidth:2,strokeDasharray:"2,2",fill:"none"})]})}),g=(0,i.observer)(function({view:e,text:t,maxWidthPx:r,radians:s,radiusPx:n,title:i,color:l}){const{classes:c}=d(),h=(0,a.polarToCartesian)(n+5,s);return t?6.5*t.length<r?(0,o.jsxs)("text",{x:0,y:0,className:c.rulerLabel,textAnchor:"middle",dominantBaseline:"baseline",transform:`translate(${h}) rotate(${(0,a.radToDeg)(s)+90})`,...(0,a.getFillProps)(l),children:[t,(0,o.jsx)("title",{children:i||t})]}):r>4?(0,a.radToDeg)(s+e.offsetRadians-Math.PI/2)>=180?(0,o.jsxs)("text",{x:0,y:0,className:c.rulerLabel,textAnchor:"start",dominantBaseline:"middle",transform:`translate(${h}) rotate(${(0,a.radToDeg)(s)})`,fill:l,children:[t,(0,o.jsx)("title",{children:i||t})]}):(0,o.jsxs)("text",{x:0,y:0,className:c.rulerLabel,textAnchor:"end",dominantBaseline:"middle",transform:`translate(${h}) rotate(${(0,a.radToDeg)(s)+180})`,fill:l,children:[t,(0,o.jsx)("title",{children:i||t})]}):null:null}),m=(0,i.observer)(function({model:e,slice:t,region:r}){const i=(0,n.A)(),{radiusPx:l}=e,{endRadians:d,startRadians:h}=t,m=(d+h)/2,x=(d-h)*l,u=(0,a.getSession)(e).assemblyManager.get(r.assemblyName);let p=u?u.getRefNameColor(r.refName):void 0;if(p)try{p=(0,s.makeContrasting)(p,i.palette.background.paper)}catch(e){p=i.palette.text.primary}else p=i.palette.text.primary;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g,{text:r.refName,view:e,maxWidthPx:x,radians:m,radiusPx:l,color:p}),(0,o.jsx)("path",{d:c(t,l+1,r.start,r.end),stroke:p,strokeWidth:2,fill:"none"})]})}),x=(0,i.observer)(function({model:e,slice:t}){return t.region.elided?(0,o.jsx)(h,{model:e,region:t.region,slice:t},(0,a.assembleLocString)(t.region.regions[0])):(0,o.jsx)(m,{region:t.region,model:e,slice:t},(0,a.assembleLocString)(t.region))})}}]);
//# sourceMappingURL=311.928b70ff.chunk.js.map