view x/static/js/4630.f0bdb9f0.chunk.js.map @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

{"version":3,"file":"static/js/4630.f0bdb9f0.chunk.js","mappings":"qSAkBA,SAASA,GAAM,KACbC,EAAI,SACJC,IAKA,OACEC,EAAAA,cAACC,EAAAA,EAAI,CAACC,OAAO,SAASJ,KAAMA,GACzBC,EAGP,CAEAI,eAAeC,EAAQC,GACrB,MAAMC,QAAYC,MAAMF,GACxB,IAAKC,EAAIE,GACP,MAAM,IAAIC,MAAM,QAAQH,EAAII,mBAAmBL,YAAcC,EAAIK,UAEnE,OAAOL,CACT,CAcA,MAAMM,EAAgD,CAAC,EACvDT,eAAeU,EAAoBR,GACjC,QAAwBS,IAApBF,EAAWP,GACb,OAAOO,EAAWP,GAEpB,MAAMU,EAAW,IAAIC,IAAIX,GAAKY,OACxBC,QAbRf,eAA2BE,GAEzB,aADkBD,EAAQC,IACfM,MACb,CAUqCQ,CAAYd,GAE/C,IAAIe,EACF,IAAIC,OAAO,+BAA+BC,KAAKJ,KAAwB,IACvE,GACFE,EAAS,IAAIJ,IAAII,EAAQf,GAAKP,KAAOiB,EAErC,MAAMQ,QAzBRpB,eAA2BE,GAEzB,aADkBD,EAAQC,IACfmB,MACb,CAsBqBC,CAAYL,GACzBM,EAAM,IAAIC,EAAAA,kBAAkBJ,GAElC,OADAX,EAAWP,GAAOqB,EACXA,CACT,CAwCA,MAAME,EAAc,IAcdC,GAAYC,EAAAA,EAAAA,KAAAA,EAAaC,IAAS,CACtCC,IAAK,CACHC,YAAYC,EAAAA,EAAAA,IAAMH,EAAMI,QAAQC,MAAMC,KAAM,IAC5CC,OAAQ,aAAaP,EAAMI,QAAQI,UACnCC,SAAU,OACVC,OAAQ,GACRC,UAAW,SAIf,SAASC,GAAS,KA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iCAEzBhE,EAAAA,cAACyG,EAAAA,EAAM,CAACF,QAAQ,YAAYG,MAAM,UAAUC,QAASjD,GAAS,UAMtE,C","sources":["../../../packages/core/ui/ErrorMessageStackTraceDialog.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport {\n  Button,\n  DialogActions,\n  DialogContent,\n  Link,\n  Typography,\n  alpha,\n} from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\n\nimport { SourceMapConsumer } from 'source-map-js'\nimport copy from 'copy-to-clipboard'\n\n// locals\nimport Dialog from './Dialog'\nimport LoadingEllipses from './LoadingEllipses'\n\nfunction Link2({\n  href,\n  children,\n}: {\n  href: string\n  children: React.ReactNode\n}) {\n  return (\n    <Link target=\"_blank\" href={href}>\n      {children}\n    </Link>\n  )\n}\n\nasync function myfetch(uri: string) {\n  const res = await fetch(uri)\n  if (!res.ok) {\n    throw new Error(`HTTP ${res.status} fetching ${uri}: ${await res.text()}`)\n  }\n  return res\n}\n\nasync function myfetchjson(uri: string) {\n  const res = await myfetch(uri)\n  return res.json()\n}\n\nasync function myfetchtext(uri: string) {\n  const res = await myfetch(uri)\n  return res.text()\n}\n\n// produce a source-map resolved stack trace\n// reference code https://stackoverflow.com/a/77158517/2129219\nconst sourceMaps: Record<string, SourceMapConsumer> = {}\nasync function getSourceMapFromUri(uri: string) {\n  if (sourceMaps[uri] !== undefined) {\n    return sourceMaps[uri]\n  }\n  const uriQuery = new URL(uri).search\n  const currentScriptContent = await myfetchtext(uri)\n\n  let mapUri =\n    new RegExp(/\\/\\/# sourceMappingURL=(.*)/).exec(currentScriptContent)?.[1] ||\n    ''\n  mapUri = new URL(mapUri, uri).href + uriQuery\n\n  const data = await myfetchjson(mapUri)\n  const map = new SourceMapConsumer(data)\n  sourceMaps[uri] = map\n  return map\n}\n\nasync function mapStackTrace(stack: string) {\n  const stackLines = stack.split('\\n')\n  const mappedStack = []\n\n  for (const line of stackLines) {\n    const match = new RegExp(/(.*)(https?:\\/\\/.*):(\\d+):(\\d+)/).exec(line)\n    if (match === null) {\n      mappedStack.push(line)\n      continue\n    }\n\n    const uri = match[2]!\n    const consumer = await getSourceMapFromUri(uri)\n\n    const originalPosition = consumer.originalPositionFor({\n      line: Number.parseInt(match[3]!),\n      column: Number.parseInt(match[4]!),\n    })\n\n    if (\n      !originalPosition.source ||\n      !originalPosition.line ||\n      !originalPosition.column\n    ) {\n      mappedStack.push(line)\n      continue\n    }\n\n    mappedStack.push(\n      `${originalPosition.source}:${originalPosition.line}:${\n        originalPosition.column + 1\n      } (${match[1]!.trim()})`,\n    )\n  }\n\n  return mappedStack.join('\\n')\n}\n\nconst MAX_ERR_LEN = 10_000\n\n// Chrome has the error message in the stacktrace, firefox doesn't\nfunction stripMessage(trace: string, error: unknown) {\n  if (trace.startsWith('Error:')) {\n    // remove the error message, which can be very long due to mobx-state-tree\n    // stuff, to get just the stack trace\n    const err = `${error}`\n    return trace.slice(err.length)\n  } else {\n    return trace\n  }\n}\n\nconst useStyles = makeStyles()(theme => ({\n  pre: {\n    background: alpha(theme.palette.error.main, 0.2),\n    border: `1px solid ${theme.palette.divider}`,\n    overflow: 'auto',\n    margin: 20,\n    maxHeight: 300,\n  },\n}))\n\nfunction Contents({ text, extra }: { text: string; extra?: unknown }) {\n  const { classes } = useStyles()\n  const err = encodeURIComponent(\n    `${[\n      'I got this error from JBrowse, here is the stack trace:\\n',\n      '```',\n      text,\n      '```',\n      extra ? `supporting data: ${JSON.stringify(extra, null, 2)}` : '',\n    ].join('\\n')}\\n`,\n  )\n\n  const err2 = [\n    text,\n    extra ? `supporting data: ${JSON.stringify(extra, null, 2)}` : '',\n  ].join('\\n')\n\n  const email = 'jbrowse2@berkeley.edu'\n  const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}`\n  const emailLink = `mailto:${email}?subject=JBrowse%202%20error&body=${err}`\n\n  return (\n    <>\n      <Typography>\n        Post a new issue at <Link2 href={githubLink}>GitHub</Link2> or send an\n        email to <Link2 href={emailLink}>{email}</Link2>{' '}\n      </Typography>\n      <pre className={classes.pre}>{err2}</pre>\n    </>\n  )\n}\n\nexport default function ErrorMessageStackTraceDialog({\n  error,\n  onClose,\n  extra,\n}: {\n  onClose: () => void\n  error: unknown\n  extra?: unknown\n}) {\n  const [mappedStackTrace, setMappedStackTrace] = useState<string>()\n  const [secondaryError, setSecondaryError] = useState<unknown>()\n  const [clicked, setClicked] = useState(false)\n  const stackTracePreProcessed = `${typeof error === 'object' && error !== null && 'stack' in error ? error.stack : ''}`\n  const errorText = error ? `${error}` : ''\n  const stackTrace = stripMessage(stackTracePreProcessed, errorText)\n\n  useEffect(() => {\n    // eslint-disable-next-line @typescript-eslint/no-floating-promises\n    ;(async () => {\n      try {\n        const res = await mapStackTrace(stackTrace)\n        setMappedStackTrace(res)\n      } catch (e) {\n        console.error(e)\n        setMappedStackTrace(stackTrace)\n        setSecondaryError(e)\n      }\n    })()\n  }, [stackTrace])\n\n  const errorBoxText = [\n    secondaryError\n      ? 'Error loading source map, showing raw stack trace below:'\n      : '',\n    errorText.length > MAX_ERR_LEN\n      ? `${errorText.slice(0, MAX_ERR_LEN)}...`\n      : errorText,\n    mappedStackTrace || 'No stack trace available',\n    // @ts-expect-error add version info at bottom if we are in jbrowse-web\n    window.JBrowseSession ? `JBrowse ${window.JBrowseSession.version}` : '',\n  ]\n    .filter(f => !!f)\n    .join('\\n')\n\n  return (\n    <Dialog open onClose={onClose} title=\"Stack trace\" maxWidth=\"xl\">\n      <DialogContent>\n        {mappedStackTrace === undefined ? (\n          <LoadingEllipses variant=\"h6\" />\n        ) : (\n          <Contents text={errorBoxText} extra={extra} />\n        )}\n      </DialogContent>\n      <DialogActions>\n        <Button\n          variant=\"contained\"\n          color=\"secondary\"\n          onClick={() => {\n            copy(errorBoxText)\n            setClicked(true)\n            setTimeout(() => {\n              setClicked(false)\n            }, 1000)\n          }}\n        >\n          {clicked ? 'Copied!' : 'Copy stack trace to clipboard'}\n        </Button>\n        <Button variant=\"contained\" color=\"primary\" onClick={onClose}>\n          Close\n        </Button>\n      </DialogActions>\n    </Dialog>\n  )\n}\n"],"names":["Link2","href","children","React","Link","target","async","myfetch","uri","res","fetch","ok","Error","status","text","sourceMaps","getSourceMapFromUri","undefined","uriQuery","URL","search","currentScriptContent","myfetchtext","mapUri","RegExp","exec","data","json","myfetchjson","map","SourceMapConsumer","MAX_ERR_LEN","useStyles","makeStyles","theme","pre","background","alpha","palette","error","main","border","divider","overflow","margin","maxHeight","Contents","extra","classes","err","encodeURIComponent","JSON","stringify","join","err2","email","githubLink","emailLink","Typography","className","ErrorMessageStackTraceDialog","onClose","mappedStackTrace","setMappedStackTrace","useState","secondaryError","setSecondaryError","clicked","setClicked","errorText","stackTrace","trace","startsWith","slice","length","stripMessage","stack","useEffect","stackLines","split","mappedStack","line","match","push","originalPosition","originalPositionFor","Number","parseInt","column","source","trim","mapStackTrace","e","console","errorBoxText","window","JBrowseSession","version","filter","f","Dialog","open","title","maxWidth","DialogContent","LoadingEllipses","variant","DialogActions","Button","color","onClick","copy","setTimeout"],"sourceRoot":""}