"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630],{74630:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var o=n(7552),r=n(29499),a=n(36715),s=n(87731),c=n(58507),l=n(5401),i=n(1631),u=n(31409),w=n.n(u),m=n(92562),h=n(37565);const b={};async function p(e){if(null!=b[e])return b[e];const t=new URL(e).search,n=await(await fetch(e)).text();let o=new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(n)?.[1]||"";o=new URL(o,e).href+t;const r=await(await fetch(o)).json();return b[e]=r,r}const d=1e4;function g({error:e,onClose:t}){const[n,u]=(0,o.useState)(),[b,g]=(0,o.useState)(),[f,k]=(0,o.useState)(!1),E=`${e}`,y=function(e,t){if(e.startsWith("Error:")){const n=`${t}`;return e.slice(n.length)}return e}(`${e.stack}`,E);(0,o.useEffect)((()=>{(async()=>{try{const e=await async function(e){const t=e.split("\n"),n=[];for(const e of t){const t=new RegExp(/(.*)(http:\/\/.*):(\d+):(\d+)/).exec(e);if(null===t){n.push(e);continue}const o=t[2],r=new i.SourceMapConsumer(await p(o)).originalPositionFor({line:parseInt(t[3]),column:parseInt(t[4])});null!==r.source&&null!==r.line&&null!==r.column?n.push(`${r.source}:${r.line}:${r.column+1}`):n.push(e)}return n.join("\n")}(y);u(e)}catch(e){console.error(e),u(y),g(e)}})()}),[y]);const C=[b?"Error loading source map, showing raw stack trace below:":"",E.length>d?E.slice(0,d)+"...":E,n||"No stack trace available",window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].join("\n"),v=encodeURIComponent("I got this error from JBrowse, here is the stack trace:\n\n```\n"+C+"\n```\n"),j=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${v}`,x=`mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${v}`;return o.createElement(m.A,{open:!0,onClose:t,title:"Stack trace",maxWidth:"xl"},o.createElement(r.A,null,void 0===n?o.createElement(h.A,{variant:"h6"}):o.createElement(o.Fragment,null,o.createElement(a.A,null,"Post a new issue at"," ",o.createElement(s.A,{href:j,target:"_blank"},"GitHub")," ","or send an email to"," ",o.createElement(s.A,{href:x,target:"_blank"},"jbrowse2dev@gmail.com")," "),o.createElement("pre",{style:{background:"lightgrey",border:"1px solid black",overflow:"auto",margin:20,maxHeight:300}},C))),o.createElement(c.A,null,o.createElement(l.A,{variant:"contained",color:"secondary",onClick:()=>{w()(C),k(!0),setTimeout((()=>k(!1)),1e3)}},f?"Copied!":"Copy stack trace to clipboard"),o.createElement(l.A,{variant:"contained",color:"primary",onClick:t},"Close")))}}}]);
//# sourceMappingURL=4630.26cb95e9.chunk.js.map