"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[965],{40965:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var o=n(7552),a=n(92562),r=n(99546),s=n(91468),i=n(68446),c=n(33039),l=n.n(c),f=n(31409),m=n.n(f),u=n(5401),g=n(75785),d=n(68584),b=n(68984),p=n(49823);function C({config:e}){const[t,n]=(0,o.useState)(),[a,s]=(0,o.useState)(),i=(0,r.getSession)(e),{rpcManager:c}=i;(0,o.useEffect)((()=>{(async()=>{try{const t=(0,d.readConfObject)(e,"adapter"),n=await c.call(e.trackId,"CoreGetInfo",{adapterConfig:t});s(n)}catch(e){console.error(e),n(e)}})()}),[e,c]);const l="string"==typeof a?{header:`<pre>${a.replaceAll("<","&lt;").replaceAll(">","&gt;")}</pre>`}:a||{};return o.createElement(b.BaseCard,{title:"File info"},t?o.createElement(p.ErrorMessage,{error:t}):void 0===a?o.createElement(p.LoadingEllipses,{message:"Loading file data"}):o.createElement(b.Attributes,{attributes:l}))}var E=n(29499),h=n(36715);const A=(0,g.n9)()((e=>({container:{minWidth:800},refNames:{maxHeight:300,width:"100%",overflow:"auto",flexGrow:1,background:e.palette.background.default}}))),y=(0,i.observer)((function({config:e,onClose:t}){const[n,a]=(0,o.useState)(),[i,c]=(0,o.useState)(),[l,f]=(0,o.useState)(!1),{classes:g}=A(),b=(0,r.getSession)(e),{rpcManager:C}=b;(0,o.useEffect)((()=>{(async()=>{try{const t=await Promise.all([...new Set((0,s.getConfAssemblyNames)(e))].map((async t=>{const n=(0,d.readConfObject)(e,"adapter");return[t,await C.call(e.trackId,"CoreGetRefNames",{adapterConfig:n,regions:[{assemblyName:t}]})]})));c(Object.fromEntries(t))}catch(e){console.error(e),a(e)}})()}),[e,C]);const y=i?Object.entries(i):[],v=y.flatMap((([e,t])=>[`--- ${e} ---`,...t.slice(0,1e4),t.length>1e4?`\nToo many refNames to show in browser for ${e}, use "Copy ref names" button to copy to clipboard`:""])).filter((e=>!!e)).join("\n");return o.createElement(p.Dialog,{open:!0,title:"Reference sequence names used in track",onClose:t},o.createElement(E.A,{className:g.container},n?o.createElement(h.A,{color:"error"},`${n}`):void 0===i?o.createElement(p.LoadingEllipses,{message:"Loading refNames"}):o.createElement(o.Fragment,null,o.createElement(u.A,{variant:"contained",onClick:()=>{m()(y.flatMap((([e,t])=>[`--- ${e} ---`,...t])).filter((e=>!!e)).join("\n")),f(!0),setTimeout((()=>{f(!1)}),1e3)}},l?"Copied to clipboard!":"Copy ref names"),o.createElement("pre",{className:g.refNames},v))))})),v=(0,g.n9)()({content:{minWidth:800},button:{float:"right"}});function w(e,t){for(const n in e)n===t?delete e[n]:"object"==typeof e[n]&&w(e[n],t);return e}const N=(0,i.observer)((function({config:e}){const[t,n]=(0,o.useState)(!1),a=(0,d.readConfObject)(e),s=(0,r.getSession)(e),{classes:i}=v(),[c,f]=(0,o.useState)(!1),g=(0,d.getConf)(s,["formatAbout","hideUris"])||(0,d.readConfObject)(e,["formatAbout","hideUris"]),{pluginManager:p}=(0,r.getEnv)(s),E=p.evaluateExtensionPoint("Core-customizeAbout",{config:{...a,...(0,d.getConf)(s,["formatAbout","config"],{config:a}),...(0,d.readConfObject)(e,["formatAbout","config"],{config:a})}},{session:s,config:e}),h=p.evaluateExtensionPoint("Core-extraAboutPanel",null,{session:s,config:e});return o.createElement("div",{className:i.content},o.createElement(b.BaseCard,{title:"Configuration"},g?null:o.createElement("span",{className:i.button},o.createElement(u.A,{variant:"contained",color:"secondary",onClick:()=>{f(!0)}},"Show ref names"),o.createElement(u.A,{variant:"contained",onClick:()=>{const e=w(l()(a),"baseUri");m()(JSON.stringify(e,null,2)),n(!0),setTimeout((()=>{n(!1)}),1e3)}},t?"Copied to clipboard!":"Copy config")),o.createElement(b.Attributes,{attributes:E,omit:["displays","baseUri","refNames","formatAbout"],hideUris:g})),h?o.createElement(b.BaseCard,{title:h.name},o.createElement(h.Component,{config:e})):null,o.createElement(C,{config:e}),c?o.createElement(y,{config:e,onClose:()=>{f(!1)}}):null)}));function S({config:e,handleClose:t}){const n=(0,r.getSession)(e),i=(0,s.getTrackName)(e,n),{pluginManager:c}=(0,r.getEnv)(n),l=c.evaluateExtensionPoint("Core-replaceAbout",N,{session:n,config:e});return o.createElement(a.A,{open:!0,onClose:t,title:i,maxWidth:"xl"},o.createElement(l,{config:e}))}}}]);
//# sourceMappingURL=965.49bbd1fe.chunk.js.map