"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[311],{60311:(e,t,r)=>{r.d(t,{renderToSvg:()=>g});var a=r(7552),s=r(67112),i=r(99546),n=r(91063),l=r(42489),o=r(51414),d=r(69500);function c({width:e,height:t,shift:r}){const a=(0,o.A)();return(0,d.jsx)("rect",{width:e+2*r,height:t,fill:(0,i.stripAlpha)(a.palette.background.default)})}var h=r(83803);async function g(e,t){await(0,l.when)((()=>e.initialized));const{themeName:r="default",Wrapper:o=({children:e})=>e}=t,g=(0,i.getSession)(e),m=g.allThemes?.()[r],{width:x,tracks:p,height:u}=e,f=await Promise.all(p.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:w,offsetRadians:b,centerXY:j}=e,k=(0,i.radToDeg)(b);return(0,i.renderToStaticMarkup)((0,d.jsx)(n.A,{theme:(0,s.createJBrowseTheme)(m),children:(0,d.jsx)(o,{children:(0,d.jsxs)("svg",{width:x,height:u,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,x+100,u].toString(),children:[(0,d.jsx)(c,{width:x,height:u,shift:50}),(0,d.jsxs)("g",{transform:`translate(${j}) rotate(${k})`,children:[w.map(((t,r)=>(0,d.jsx)(h.A,{model:e,slice:t},r))),f.map((({result:e},t)=>(0,d.jsx)(a.Fragment,{children:e},t)))]})]})})}))}},83803:(e,t,r)=>{r.d(t,{A:()=>x});var a=r(99546),s=r(80208),i=r(51414),n=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),i=e.bpToXY(a,t);return["M",...s,"A",t,t,"0",Math.abs(a-r)/e.bpPerRadian>Math.PI?"1":"0","1",...i].join(" ")}const h=(0,n.observer)((function({model:e,slice:t,region:r}){const s=(0,i.A)(),{radiusPx:n}=e,l=n+1,{endRadians:d,startRadians:c}=t,h=(0,a.polarToCartesian)(l,c),m=(0,a.polarToCartesian)(l,d),x=(d-c)*l,p=d-c>Math.PI?"1":"0",u=(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:u,radiusPx:l,title:`${f} more regions`,color:s.palette.text.primary}),(0,o.jsx)("path",{d:["M",...h,"A",l,l,"0",p,"1",...m].join(" "),...(0,a.getStrokeProps)(s.palette.text.secondary),strokeWidth:2,strokeDasharray:"2,2",fill:"none"})]})})),g=(0,n.observer)((function({view:e,text:t,maxWidthPx:r,radians:s,radiusPx:i,title:n,color:l}){const{classes:c}=d(),h=(0,a.polarToCartesian)(i+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:n||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:n||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:n||t})]}):null:null})),m=(0,n.observer)((function({model:e,slice:t,region:r}){const n=(0,i.A)(),{radiusPx:l}=e,{endRadians:d,startRadians:h}=t,m=(d+h)/2,x=(d-h)*l,p=(0,a.getSession)(e).assemblyManager.get(r.assemblyName);let u=p?p.getRefNameColor(r.refName):void 0;if(u)try{u=(0,s.makeContrasting)(u,n.palette.background.paper)}catch(e){u=n.palette.text.primary}else u=n.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:u}),(0,o.jsx)("path",{d:c(t,l+1,r.start,r.end),stroke:u,strokeWidth:2,fill:"none"})]})})),x=(0,n.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.962c0394.chunk.js.map