"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630,6839],{46839:(e,r,t)=>{t.r(r),t.d(r,{default:()=>h});var n=t(74630),o=t(99546),s=t(98231),i=t(65468),a=t(37962),c=t(89870),l=t(68446),u=t(37205),d=t(69500);const h=(0,l.observer)((function({model:e}){return(0,d.jsx)(u.A,{message:`${e.error}`,severity:"error",action:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.A,{title:"Reload track",children:(0,d.jsx)(c.A,{"data-testid":"reload_button",onClick:()=>{e.reload()},children:(0,d.jsx)(s.A,{})})}),(0,d.jsx)(a.A,{title:"Show stack trace",children:(0,d.jsx)(c.A,{onClick:()=>{(0,o.getSession)(e).queueDialog((r=>[n.default,{onClose:r,error:e.error}]))},children:(0,d.jsx)(i.A,{})})})]})})}))},74630:(e,r,t)=>{t.r(r),t.d(r,{default:()=>A});var n=t(7552),o=t(65895),s=t(62266),i=t(61282),a=t(76218),c=t(30698),l=t(69092),u=t(31409),d=t.n(u),h=t(1631),w=t(75785),x=t(92562),p=t(37565),f=t(69500);function j({href:e,children:r}){return(0,f.jsx)(o.A,{target:"_blank",href:e,children:r})}async function b(e){const r=await fetch(e);if(!r.ok)throw new Error(`HTTP ${r.status} fetching ${e}: ${await r.text()}`);return r}const g={};async function m(e){if(void 0!==g[e])return g[e];const r=new URL(e).search,t=await async function(e){return(await b(e)).text()}(e);let n=new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(t)?.[1]||"";n=new URL(n,e).href+r;const o=await async function(e){return(await b(e)).json()}(n),s=new h.SourceMapConsumer(o);return g[e]=s,s}const k=1e4,$=(0,w.n9)()((e=>({pre:{background:(0,s.X4)(e.palette.error.main,.2),border:`1px solid ${e.palette.divider}`,overflow:"auto",margin:20,maxHeight:300}})));function y({text:e,extra:r}){const{classes:t}=$(),n=encodeURIComponent(`${["I got this error from JBrowse, here is the stack trace:\n","```",e,"```",r?`supporting data: ${JSON.stringify(r,null,2)}`:""].join("\n")}\n`),o=[e,r?`supporting data: ${JSON.stringify(r,null,2)}`:""].join("\n"),s="jbrowse2@berkeley.edu",a=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${n}`,c=`mailto:${s}?subject=JBrowse%202%20error&body=${n}`;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(i.A,{children:["Post a new issue at ",(0,f.jsx)(j,{href:a,children:"GitHub"})," or send an email to ",(0,f.jsx)(j,{href:c,children:s})," "]}),(0,f.jsx)("pre",{className:t.pre,children:o})]})}function A({error:e,onClose:r,extra:t}){const[o,s]=(0,n.useState)(),[i,u]=(0,n.useState)(),[h,w]=(0,n.useState)(!1),j=e?`${e}`:"",b=function(e,r){if(e.startsWith("Error:")){const t=`${r}`;return e.slice(t.length)}return e}(`${"object"==typeof e&&null!==e&&"stack"in e?e.stack:""}`,j);(0,n.useEffect)((()=>{(async()=>{try{const e=await async function(e){const r=e.split("\n"),t=[];for(const e of r){const r=new RegExp(/(.*)(https?:\/\/.*):(\d+):(\d+)/).exec(e);if(null===r){t.push(e);continue}const n=r[2],o=(await m(n)).originalPositionFor({line:Number.parseInt(r[3]),column:Number.parseInt(r[4])});o.source&&o.line&&o.column?t.push(`${o.source}:${o.line}:${o.column+1} (${r[1].trim()})`):t.push(e)}return t.join("\n")}(b);s(e)}catch(e){console.error(e),s(b),u(e)}})()}),[b]);const g=[i?"Error loading source map, showing raw stack trace below:":"",j.length>k?`${j.slice(0,k)}...`:j,o||"No stack trace available",window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].filter((e=>!!e)).join("\n");return(0,f.jsxs)(x.A,{open:!0,onClose:r,title:"Stack trace",maxWidth:"xl",children:[(0,f.jsx)(a.A,{children:void 0===o?(0,f.jsx)(p.A,{variant:"h6"}):(0,f.jsx)(y,{text:g,extra:t})}),(0,f.jsxs)(c.A,{children:[(0,f.jsx)(l.A,{variant:"contained",color:"secondary",onClick:()=>{d()(g),w(!0),setTimeout((()=>{w(!1)}),1e3)},children:h?"Copied!":"Copy stack trace to clipboard"}),(0,f.jsx)(l.A,{variant:"contained",color:"primary",onClick:r,children:"Close"})]})]})}}}]);
//# sourceMappingURL=6839.bca4a868.chunk.js.map