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