"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5736],{15736:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var s=n(67758),a=n(87083),l=n(99546),r=n(7552),i=n(67112),o=n(61282),c=n(65895),u=n(95805),f=n(69500);const m=(0,r.lazy)(()=>n.e(5930).then(n.bind(n,45930))),d=(0,r.lazy)(()=>n.e(457).then(n.bind(n,80457)));function g(e){const t=(0,s.c)(8),{model:n,feature:a}=e,{view:c}=n,[m,d]=(0,r.useState)(),[g,w]=(0,r.useState)();let y,b,S;if(t[0]!==a||t[1]!==c?(y=()=>{(async()=>{try{const e=await async function({view:e,feature:t}){const{assemblyManager:n}=(0,l.getSession)(e),s=t.get("CIGAR"),a=t.get("strand"),r=t.get("tags")?.SA||"",i=t.get("name"),o=(0,u.getClip)(s,1),c=await n.waitForAssembly(e.assemblyNames[0]);if(!c)throw new Error("assembly not found");const f=(0,u.featurizeSA)(r,t.id(),a,i,!0),m=t.toJSON();m.clipPos=o,m.strand=1,m.mate={refName:i,start:o,end:o+(0,u.getLengthSansClipping)(s)};const d=[m,...f];for(const[e,t]of d.entries())t.refName=c.getCanonicalRefName(t.refName)||t.refName,t.syntenyId=e,t.mate.syntenyId=e,t.mate.uniqueId=`${t.uniqueId}_mate`;return d.sort((e,t)=>e.clipPos-t.clipPos),d}({view:c,feature:new l.SimpleFeature(a)});d(e)}catch(e){const t=e;w(t),console.error(t)}})()},b=[a,c],t[0]=a,t[1]=c,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,r.useEffect)(y,b),t[4]!==g||t[5]!==n||t[6]!==m){const e=[];if(m)for(let t=0;t<m.length-1;t++)e.push([m[t],m[t+1]]);S=e.length?(0,f.jsxs)("div",{children:[(0,f.jsx)(o.A,{children:"Launch split view"}),g?(0,f.jsx)(i.ErrorMessage,{error:g}):null,(0,f.jsx)("ul",{children:e.map((e,t)=>{const[s,a]=e;return(0,f.jsxs)("li",{children:[s.refName,":",(0,l.toLocale)(1===s.strand?s.end:s.start)," ->"," ",a.refName,":",(0,l.toLocale)(1===a.strand?a.start:a.end)," ",(0,f.jsx)(h,{model:n,f1:s,f2:a})," ",(0,f.jsx)(p,{model:n,f1:s,f2:a})]},`${JSON.stringify(e)}-${t}`)})})]}):null,t[4]=g,t[5]=n,t[6]=m,t[7]=S}else S=t[7];return S}function h(e){const t=(0,s.c)(4),{model:n,f1:a,f2:r}=e;let i;return t[0]!==a||t[1]!==r||t[2]!==n?(i=(0,f.jsx)(c.A,{href:"#",onClick:e=>{e.preventDefault();const t=(0,l.getSession)(n);t.queueDialog(e=>[m,{handleClose:e,session:t,feature:new l.SimpleFeature({...a,mate:r}),view:n.view,assemblyName:n.view.displayedRegions[0].assemblyName}])},children:"(top/bottom)"}),t[0]=a,t[1]=r,t[2]=n,t[3]=i):i=t[3],i}function p(e){const t=(0,s.c)(4),{model:n,f1:a,f2:r}=e;let i;return t[0]!==a||t[1]!==r||t[2]!==n?(i=(0,f.jsx)(c.A,{href:"#",onClick:e=>{e.preventDefault();const t=(0,l.getSession)(n);t.queueDialog(e=>[d,{handleClose:e,session:t,feature:new l.SimpleFeature({...a,mate:r}),view:n.view,assemblyName:n.view.displayedRegions[0].assemblyName}])},children:"(single row)"}),t[0]=a,t[1]=r,t[2]=n,t[3]=i):i=t[3],i}var w=n(51762);function y(e){const t=(0,s.c)(8),{tag:n,model:a}=e;let l,r,i;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,f.jsx)(o.A,{children:"List of supplementary alignment locations"}),t[0]=l):l=t[0],t[1]!==a||t[2]!==n){let e;t[4]!==a?(e=(e,t)=>{const[n,s,l,r]=e.split(","),i=(0,u.getLengthOnRef)(r),o=Math.floor(i/5),m=+s,d=+s+i,g=m-o,h=d+o,p=`${n}:${Math.max(1,g)}-${h}`,y=`${n}:${m.toLocaleString("en-US")}-${d.toLocaleString("en-US")} (${l}) [${i}bp]`;return(0,f.jsx)("li",{children:(0,f.jsx)(c.A,{href:"#",onClick:async e=>{e.preventDefault(),(0,w.h)(p,a)},children:y})},`${p}-${t}`)},t[4]=a,t[5]=e):e=t[5],r=n.split(";").filter(b).map(e),t[1]=a,t[2]=n,t[3]=r}else r=t[3];return t[6]!==r?(i=(0,f.jsxs)("div",{children:[l,(0,f.jsx)("ul",{children:r})]}),t[6]=r,t[7]=i):i=t[7],i}function b(e){return!!e}function S(e){const t=(0,s.c)(13),{model:n,tag:r,feature:i}=e;let o,c,u,m;if(t[0]!==n){const e=(0,l.getSession)(n),{pluginManager:s}=(0,l.getEnv)(e);o=!1;try{o=!!s.getViewType("BreakpointSplitView")}catch(c){}t[0]=n,t[1]=o}else o=t[1];return t[2]!==n||t[3]!==r?(c=(0,f.jsx)(y,{model:n,tag:r}),t[2]=n,t[3]=r,t[4]=c):c=t[4],t[5]!==i||t[6]!==o||t[7]!==n?(u=o?(0,f.jsx)(g,{model:n,feature:i}):null,t[5]=i,t[6]=o,t[7]=n,t[8]=u):u=t[8],t[9]!==e||t[10]!==c||t[11]!==u?(m=(0,f.jsxs)(a.default,{...e,title:"Supplementary alignments",children:[c,u]}),t[9]=e,t[10]=c,t[11]=u,t[12]=m):m=t[12],m}}}]);
//# sourceMappingURL=5736.6c391009.chunk.js.map