"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[5736],{15736:(e,t,n)=>{n.r(t),n.d(t,{default:()=>w});var a=n(7552),l=n(68984),r=n(99546),s=n(36715),i=n(87731),o=n(80544),u=n(51762);function c({tag:e,model:t}){return a.createElement("div",null,a.createElement(s.A,null,"List of supplementary alignment locations"),a.createElement("ul",null,e.split(";").filter((e=>!!e)).map(((e,n)=>{const[l,r,s,c]=e.split(","),m=(0,o.getLengthOnRef)(c),f=Math.floor(m/5),p=+r,g=+r+m,d=p-f,y=g+f,w=`${l}:${Math.max(1,d)}-${y}`,h=`${l}:${p.toLocaleString("en-US")}-${g.toLocaleString("en-US")} (${s}) [${m}bp]`;return a.createElement("li",{key:`${w}-${n}`},a.createElement(i.A,{href:"#",onClick:async e=>{e.preventDefault(),(0,u.h)(w,t)}},h))}))))}var m=n(49823),f=n(86576);const p=(0,a.lazy)((()=>n.e(5930).then(n.bind(n,45930)))),g=(0,a.lazy)((()=>n.e(457).then(n.bind(n,80457))));function d({model:e,feature:t,viewType:n}){const l=(0,r.getSession)(e),{view:u}=e,[c,d]=(0,a.useState)(),[y,w]=(0,a.useState)();(0,a.useEffect)((()=>{(async()=>{try{const e=await async function({view:e,feature:t}){const{assemblyManager:n}=(0,r.getSession)(e),a=t.get("CIGAR"),l=t.get("strand"),s=(0,f.bH)(t,"SA")||"",i=t.get("name"),u=(0,o.getClip)(a,1),c=await n.waitForAssembly(e.assemblyNames[0]);if(!c)throw new Error("assembly not found");const m=(0,o.featurizeSA)(s,t.id(),l,i,!0),p=t.toJSON();p.clipPos=u,p.strand=1,p.mate={refName:i,start:u,end:u+(0,o.getLengthSansClipping)(a)};const g=[p,...m];return g.forEach(((e,t)=>{e.refName=c.getCanonicalRefName(e.refName)||e.refName,e.syntenyId=t,e.mate.syntenyId=t,e.mate.uniqueId=`${e.uniqueId}_mate`})),g.sort(((e,t)=>e.clipPos-t.clipPos)),g}({view:u,feature:new r.SimpleFeature(t)});d(e)}catch(e){w(e),console.error(e)}})()}),[t,u]);const h=[];if(c)for(let e=0;e<c.length-1;e++)h.push([c[e],c[e+1]]);return h.length?a.createElement("div",null,a.createElement(s.A,null,"Launch split view"),y?a.createElement(m.ErrorMessage,{error:y}):null,a.createElement("ul",null,h.map(((t,s)=>{const[o,u]=t;return a.createElement("li",{key:`${JSON.stringify(t)}-${s}`},o.refName,":",(0,r.toLocale)(1===o.strand?o.end:o.start)," ->"," ",u.refName,":",(0,r.toLocale)(1===u.strand?u.start:u.end)," ",a.createElement(i.A,{href:"#",onClick:t=>{t.preventDefault(),l.queueDialog((t=>[p,{handleClose:t,model:e,feature:new r.SimpleFeature({...o,mate:u}),viewType:n,view:e.view,assemblyName:e.view.displayedRegions[0].assemblyName}]))}},"(top/bottom)")," ",a.createElement(i.A,{href:"#",onClick:t=>{t.preventDefault(),l.queueDialog((t=>[g,{handleClose:t,model:e,feature:new r.SimpleFeature({...o,mate:u}),viewType:n,view:e.view,assemblyName:e.view.displayedRegions[0].assemblyName}]))}},"(single row)"))})))):null}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},y.apply(null,arguments)}function w(e){const{model:t,tag:n,feature:s}=e,i=(0,r.getSession)(t),{pluginManager:o}=(0,r.getEnv)(i);let u;try{u=o.getViewType("BreakpointSplitView")}catch(e){}return a.createElement(l.BaseCard,y({},e,{title:"Supplementary alignments"}),a.createElement(c,{model:t,tag:n}),u?a.createElement(d,{viewType:u,model:t,feature:s}):null)}}}]);
//# sourceMappingURL=5736.48705208.chunk.js.map