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