"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[4630,6839],{46839:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var r=n(74630),o=n(99546),s=n(98231),i=n(65468),c=n(37962),a=n(89870),l=n(68446),u=n(37205),d=n(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)(c.A,{title:"Reload track",children:(0,d.jsx)(a.A,{"data-testid":"reload_button",onClick:()=>{e.reload()},children:(0,d.jsx)(s.A,{})})}),(0,d.jsx)(c.A,{title:"Show stack trace",children:(0,d.jsx)(a.A,{onClick:()=>{(0,o.getSession)(e).queueDialog(t=>[r.default,{onClose:t,error:e.error}])},children:(0,d.jsx)(i.A,{})})})]})})})},74630:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});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),d=n.n(u),h=n(1631),w=n(75785),p=n(92562),x=n(58531),f=n(37565),j=n(69500);async function b(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 b(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 b(e)).json()}(r),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(e){const t=(0,r.c)(16),{text:n,extra:o}=e,{classes:s}=$(),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"),d=`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 w,p,f,b,g;return t[3]!==d?(w=(0,j.jsx)(x.A,{href:d,children:"GitHub"}),t[3]=d,t[4]=w):w=t[4],t[5]!==h?(p=(0,j.jsx)(x.A,{href:h,children:"jbrowse2@berkeley.edu"}),t[5]=h,t[6]=p):p=t[6],t[7]!==w||t[8]!==p?(f=(0,j.jsxs)(i.A,{children:["Post a new issue at"," ",w," or send an email to ",p," "]}),t[7]=w,t[8]=p,t[9]=f):f=t[9],t[10]!==s.pre||t[11]!==u?(b=(0,j.jsx)("pre",{className:s.pre,children:u}),t[10]=s.pre,t[11]=u,t[12]=b):b=t[12],t[13]!==f||t[14]!==b?(g=(0,j.jsxs)(j.Fragment,{children:[f,b]}),t[13]=f,t[14]=b,t[15]=g):g=t[15],g}function A(e){const t=(0,r.c)(28),{error:n,onClose:s,extra:i}=e,[u,h]=(0,o.useState)(),[w,x]=(0,o.useState)(),[b,g]=(0,o.useState)(!1),$=`${"object"==typeof n&&null!==n&&"stack"in n?n.stack:""}`,A=n?`${n}`:"";let v;t[0]!==A||t[1]!==$?(v=function(e,t){if(e.startsWith("Error:")){const n=`${t}`;return e.slice(n.length)}return e}($,A),t[0]=A,t[1]=$,t[2]=v):v=t[2];const S=v;let J,R;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),x(t)}})()},R=[S],t[3]=S,t[4]=J,t[5]=R):(J=t[4],R=t[5]),(0,o.useEffect)(J,R);const B=w?"Error loading source map, showing raw stack trace below:":"",E=A.length>k?`${A.slice(0,k)}...`:A,N=u||"No stack trace available";let T;t[6]!==B||t[7]!==E||t[8]!==N?(T=[B,E,N,window.JBrowseSession?`JBrowse ${window.JBrowseSession.version}`:""].filter(C),t[6]=B,t[7]=E,t[8]=N,t[9]=T):T=t[9];const _=T.join("\n");let I,U;t[10]!==_||t[11]!==i||t[12]!==u?(I=(0,j.jsx)(c.A,{children:void 0===u?(0,j.jsx)(f.A,{variant:"h6"}):(0,j.jsx)(y,{text:_,extra:i})}),t[10]=_,t[11]=i,t[12]=u,t[13]=I):I=t[13],t[14]!==_?(U=()=>{d()(_),g(!0),setTimeout(()=>{g(!1)},1e3)},t[14]=_,t[15]=U):U=t[15];const F=b?"Copied!":"Copy stack trace to clipboard";let H,L,M,O;return t[16]!==F||t[17]!==U?(H=(0,j.jsx)(a.A,{variant:"contained",color:"secondary",onClick:U,children:F}),t[16]=F,t[17]=U,t[18]=H):H=t[18],t[19]!==s?(L=(0,j.jsx)(a.A,{variant:"contained",color:"primary",onClick:s,children:"Close"}),t[19]=s,t[20]=L):L=t[20],t[21]!==H||t[22]!==L?(M=(0,j.jsxs)(l.A,{children:[H,L]}),t[21]=H,t[22]=L,t[23]=M):M=t[23],t[24]!==s||t[25]!==M||t[26]!==I?(O=(0,j.jsxs)(p.A,{open:!0,onClose:s,title:"Stack trace",maxWidth:"xl",children:[I,M]}),t[24]=s,t[25]=M,t[26]=I,t[27]=O):O=t[27],O}function C(e){return!!e}}}]);
//# sourceMappingURL=6839.2e7d169d.chunk.js.map