"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630],{74630:(e,n,t)=>{t.r(n),t.d(n,{default:()=>y});var r=t(7552),o=t(62266),s=t(61282),i=t(76218),a=t(30698),c=t(69092),l=t(31409),u=t.n(l),h=t(1631),w=t(75785),d=t(92562),p=t(58531),f=t(37565),x=t(69500);async function b(e){const n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status} fetching ${e}: ${await n.text()}`);return n}const j={};async function g(e){if(void 0!==j[e])return j[e];const n=new URL(e).search,t=await async function(e){return(await b(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 b(e)).json()}(r),s=new h.SourceMapConsumer(o);return j[e]=s,s}const m=1e4,$=(0,w.n9)()((e=>({pre:{background:(0,o.X4)(e.palette.error.main,.2),border:`1px solid ${e.palette.divider}`,overflow:"auto",margin:20,maxHeight:300}})));function k({text:e,extra:n}){const{classes:t}=$(),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"),i="jbrowse2@berkeley.edu",a=`https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${r}`,c=`mailto:${i}?subject=JBrowse%202%20error&body=${r}`;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(s.A,{children:["Post a new issue at"," ",(0,x.jsx)(p.A,{href:a,children:"GitHub"})," or send an email to ",(0,x.jsx)(p.A,{href:c,children:i})," "]}),(0,x.jsx)("pre",{className:t.pre,children:o})]})}function y({error:e,onClose:n,extra:t}){const[o,s]=(0,r.useState)(),[l,h]=(0,r.useState)(),[w,p]=(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 g(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),h(e)}})()}),[j]);const $=[l?"Error loading source map, showing raw stack trace below:":"",b.length>m?`${b.slice(0,m)}...`:b,o||"No stack trace available",window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].filter((e=>!!e)).join("\n");return(0,x.jsxs)(d.A,{open:!0,onClose:n,title:"Stack trace",maxWidth:"xl",children:[(0,x.jsx)(i.A,{children:void 0===o?(0,x.jsx)(f.A,{variant:"h6"}):(0,x.jsx)(k,{text:$,extra:t})}),(0,x.jsxs)(a.A,{children:[(0,x.jsx)(c.A,{variant:"contained",color:"secondary",onClick:()=>{u()($),p(!0),setTimeout((()=>{p(!1)}),1e3)},children:w?"Copied!":"Copy stack trace to clipboard"}),(0,x.jsx)(c.A,{variant:"contained",color:"primary",onClick:n,children:"Close"})]})]})}}}]);
//# sourceMappingURL=4630.339f9d9f.chunk.js.map