view x/static/js/3425.be85a6ad.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/3425.be85a6ad.chunk.js","mappings":"sWA4BA,MAAMA,GAAYC,EAAAA,EAAAA,KAAAA,EAAaC,IAAS,CACtCC,WAAY,CACVC,MAAOF,EAAMG,QAAQC,SAASC,cAAgB,QAEhDC,SAAU,CACRA,SAAU,SA2Ld,GAhI8BC,EAAAA,EAAAA,WAAS,UAAU,QAC/CC,EAAO,MACPC,IAKA,MAAM,QAAEC,GAAYZ,KACba,EAAUC,IAAeC,EAAAA,EAAAA,aACzBC,EAAOC,IAAYF,EAAAA,EAAAA,aACnBG,EAAWC,IAAgBJ,EAAAA,EAAAA,UAAS,IACrCK,GAAUC,EAAAA,EAAAA,YAAWV,IACrB,cAAEW,GAAkBF,GACnBG,EAAaC,IAAkBT,EAAAA,EAAAA,UAASO,EAAc,KACtDG,EAAUC,IAAeX,EAAAA,EAAAA,UAE9B,sBAEF,OACEY,EAAAA,cAACC,EAAAA,OAAM,CAACC,MAAI,EAACnB,QAASA,EAASoB,SAAS,KAAKC,MAAM,oBACjDJ,EAAAA,cAACK,EAAAA,EAAa,CAACC,UAAWrB,EAAQJ,UAChCmB,EAAAA,cAACO,EAAAA,EAAS,CACRT,SAAuB,uBAAbA,EACVU,SAAUA,KACRT,EAAY,qBAAqB,GAGnCC,EAAAA,cAACS,EAAAA,EAAgB,CACfjC,WAAYwB,EAAAA,cAACU,EAAAA,EAAc,CAACJ,UAAWrB,EAAQT,cAE/CwB,EAAAA,cAACW,EAAAA,EAAU,CACTC,MAAO,CAAEC,QAAS,OAAQC,WAAY,SAAUC,IAAK,QACtD,2BAIHf,EAAAA,cAACgB,EAAAA,EAAgB,KACfhB,EAAAA,cAACW,EAAAA,E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BA,MAAOK,EACPxG,KAAM,yBAEF,SACJ6I,EAAQ,UACRhK,EAAS,WACT9B,EAAU,sBACV+L,EAAqB,QACrBrI,KACGiG,GACDP,GACE,SACJzF,GAAW,EAAK,eAChB0H,EAAc,SACd/J,EAAQ,OACR0K,GACE,aAAiBC,EAAAC,GASftC,EAAa,IACdR,EACH9H,WACAqC,WACA0H,kBAEI5K,EAzHkBmJ,KACxB,MAAM,QACJnJ,EAAO,SACPa,EAAQ,SACRqC,EAAQ,eACR0H,GACEzB,EACEuC,EAAQ,CACZ7C,KAAM,CAAC,OAAQhI,GAAY,WAAYqC,GAAY,YAAa0H,GAAkB,WAClFT,aAAc,CAAC,gBACfW,QAAS,CAAC,UAAWjK,GAAY,YAAa+J,GAAkB,kBAChEM,kBAAmB,CAAC,oBAAqBrK,GAAY,aAEvD,OAAO,EAAA8K,EAAA,GAAeD,EAAOpC,EAAiCtJ,EAAQ,EA4GtDoJ,CAAkBD,GAClC,OAAoB,UAAMM,EAAsB,CAC9CmC,aAAa,EACbC,eAAe,EACf3I,SAAUA,EACV4I,UAAW,MACX,gBAAiBjL,EACjBQ,WAAW,EAAA0K,EAAA,GAAK/L,EAAQ6I,KAAMxH,GAC9BiK,uBAAuB,EAAAS,EAAA,GAAK/L,EAAQmK,aAAcmB,GAClDrI,QAvBmB+I,IACfT,GACFA,EAAOS,GAEL/I,GACFA,EAAQ+I,EACV,EAkBA/C,IAAKA,EACLE,WAAYA,KACTD,EACHmC,SAAU,EAAc,SAAKR,EAAyB,CACpDxJ,UAAWrB,EAAQ8K,QACnB3B,WAAYA,EACZkC,SAAUA,IACR9L,IAA2B,SAAK0L,EAAmC,CACrE5J,UAAWrB,EAAQkL,kBACnB/B,WAAYA,EACZkC,SAAU9L,MAGhB,G","sources":["../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/sessionSharing.ts","../../../node_modules/@mui/icons-material/esm/ExpandMore.js","../../../node_modules/@mui/material/AccordionDetails/AccordionDetails.js","../../../node_modules/@mui/material/AccordionDetails/accordionDetailsClasses.js","../../../node_modules/@mui/material/AccordionSummary/accordionSummaryClasses.js","../../../node_modules/@mui/material/AccordionSummary/AccordionSummary.js"],"sourcesContent":["import React, { useState } from 'react'\nimport { observer } from 'mobx-react'\nimport { getSession } from '@jbrowse/core/util'\nimport { FileLocation, isSessionWithShareURL } from '@jbrowse/core/util/types'\nimport { ErrorMessage, FileSelector } from '@jbrowse/core/ui'\nimport {\n  Accordion,\n  AccordionSummary,\n  AccordionDetails,\n  Button,\n  DialogContent,\n  DialogActions,\n  TextField,\n  Typography,\n} from '@mui/material'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { Dialog, AssemblySelector } from '@jbrowse/core/ui'\nimport { makeStyles } from 'tss-react/mui'\n\n// icons\nimport ImportIcon from '@mui/icons-material/Publish'\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore'\n\n// locals\nimport { GridBookmarkModel } from '../../model'\nimport { fromUrlSafeB64 } from '../../utils'\nimport { readSessionFromDynamo } from '../../sessionSharing'\n\nconst useStyles = makeStyles()(theme => ({\n  expandIcon: {\n    color: theme.palette.tertiary.contrastText || '#fff',\n  },\n  minWidth: {\n    minWidth: 500,\n  },\n}))\n\nasync function getBookmarksFromShareLink(shareLink: string, shareURL?: string) {\n  const defaultURL = 'https://share.jbrowse.org/api/v1/'\n  const urlParams = new URL(shareLink)\n  const sessionQueryParam = urlParams.searchParams.get('bookmarks')\n  const password = urlParams.searchParams.get('password')\n  const decryptedSession = await readSessionFromDynamo(\n    `${shareURL ?? defaultURL}load`,\n    sessionQueryParam || '',\n    password || '',\n  )\n\n  const sharedSession = JSON.parse(await fromUrlSafeB64(decryptedSession))\n  return sharedSession.sharedBookmarks\n}\n\nfunction guessFileType(header: string) {\n  return header.startsWith('chrom') && header.includes('assembly_name')\n    ? 'TSV'\n    : 'BED'\n}\n\nasync function getBookmarksFromTSVFile(lines: string[]) {\n  if (lines[0]!.startsWith('chrom')) {\n    lines = lines.slice(1)\n  }\n\n  return lines\n    .filter(f => !f.startsWith('#'))\n    .map(line => {\n      const [refName, start, end, label, assemblyName] = line.split('\\t')\n      return {\n        assemblyName: assemblyName!,\n        refName: refName!,\n        start: +start!,\n        end: +end!,\n        label: label === '.' ? undefined : label,\n      }\n    })\n}\n\nasync function getBookmarksFromBEDFile(lines: string[], selectedAsm: string) {\n  return lines\n    .filter(f => !f.startsWith('#'))\n    .map(line => {\n      const [refName, start, end, label] = line.split('\\t')\n      return {\n        assemblyName: selectedAsm,\n        refName: refName!,\n        start: +start!,\n        end: +end!,\n        label: label === '.' ? undefined : label,\n      }\n    })\n}\n\nconst ImportBookmarksDialog = observer(function ({\n  onClose,\n  model,\n}: {\n  onClose: () => void\n  model: GridBookmarkModel\n}) {\n  const { classes } = useStyles()\n  const [location, setLocation] = useState<FileLocation>()\n  const [error, setError] = useState<unknown>()\n  const [shareLink, setShareLink] = useState('')\n  const session = getSession(model)\n  const { assemblyNames } = session\n  const [selectedAsm, setSelectedAsm] = useState(assemblyNames[0]!)\n  const [expanded, setExpanded] = useState<\n    'shareLinkAccordion' | 'fileAccordion'\n  >('shareLinkAccordion')\n\n  return (\n    <Dialog open onClose={onClose} maxWidth=\"xl\" title=\"Import bookmarks\">\n      <DialogContent className={classes.minWidth}>\n        <Accordion\n          expanded={expanded === 'shareLinkAccordion'}\n          onChange={() => {\n            setExpanded('shareLinkAccordion')\n          }}\n        >\n          <AccordionSummary\n            expandIcon={<ExpandMoreIcon className={classes.expandIcon} />}\n          >\n            <Typography\n              style={{ display: 'flex', alignItems: 'center', gap: '5px' }}\n            >\n              Import from share link\n            </Typography>\n          </AccordionSummary>\n          <AccordionDetails>\n            <Typography>\n              Paste a bookmark share link generated by the 'Share' button from\n              the bookmarks widget\n            </Typography>\n            <TextField\n              label=\"Enter Share URL\"\n              variant=\"outlined\"\n              fullWidth\n              value={shareLink}\n              onChange={e => {\n                setShareLink(e.target.value)\n              }}\n            />\n          </AccordionDetails>\n        </Accordion>\n        <Accordion\n          expanded={expanded === 'fileAccordion'}\n          onChange={() => {\n            setExpanded('fileAccordion')\n          }}\n        >\n          <AccordionSummary\n            expandIcon={<ExpandMoreIcon className={classes.expandIcon} />}\n          >\n            <Typography>Import from file</Typography>\n          </AccordionSummary>\n          <AccordionDetails>\n            <FileSelector\n              location={location}\n              setLocation={setLocation}\n              name=\"File\"\n              description={`Choose a BED or TSV format file to import. Required TSV column headers are \"chrom, start, end, label, assembly_name\".`}\n            />\n            <AssemblySelector\n              onChange={val => {\n                setSelectedAsm(val)\n              }}\n              helperText={'Select the assembly for BED file.'}\n              session={session}\n              selected={selectedAsm}\n            />\n          </AccordionDetails>\n        </Accordion>\n        {error ? <ErrorMessage error={error} /> : null}\n      </DialogContent>\n      <DialogActions>\n        <Button variant=\"contained\" color=\"secondary\" onClick={onClose}>\n          Cancel\n        </Button>\n        <Button\n          data-testid=\"dialogImport\"\n          variant=\"contained\"\n          color=\"primary\"\n          disabled={!location && !shareLink}\n          startIcon={<ImportIcon />}\n          onClick={async () => {\n            try {\n              if (expanded === 'fileAccordion' && location) {\n                const data = await openLocation(location).readFile('utf8')\n                const lines = data.split(/\\n|\\r\\n|\\r/).filter(f => !!f.trim())\n                const fileType = guessFileType(lines[0]!)\n                if (fileType === 'BED') {\n                  model.importBookmarks(\n                    await getBookmarksFromBEDFile(lines, selectedAsm),\n                  )\n                } else {\n                  // TSV\n                  model.importBookmarks(await getBookmarksFromTSVFile(lines))\n                }\n              } else if (\n                expanded === 'shareLinkAccordion' &&\n                shareLink &&\n                isSessionWithShareURL(session)\n              ) {\n                model.importBookmarks(\n                  await getBookmarksFromShareLink(shareLink, session.shareURL),\n                )\n              }\n              onClose()\n            } catch (e) {\n              console.error(e)\n              setError(e)\n            }\n          }}\n        >\n          Import\n        </Button>\n      </DialogActions>\n    </Dialog>\n  )\n})\nexport default ImportBookmarksDialog\n","// duplicated from products/jbrowse-web/src/sessionSharing.ts ; could possibly be moved into a higher directory and shared between the two\nimport { toUrlSafeB64 } from './utils'\n\n// from https://stackoverflow.com/questions/1349404/\nfunction generateUID(length: number) {\n  return window\n    .btoa(\n      [...window.crypto.getRandomValues(new Uint8Array(length * 2))]\n        .map(b => String.fromCharCode(b))\n        .join(''),\n    )\n    .replaceAll(/[+/]/g, '')\n    .slice(0, length)\n}\n\nconst encrypt = async (text: string, password: string) => {\n  const AES = await import('crypto-js/aes')\n  return AES.encrypt(text, password).toString()\n}\n\nconst decrypt = async (text: string, password: string) => {\n  const AES = await import('crypto-js/aes')\n  const Utf8 = await import('crypto-js/enc-utf8')\n  const bytes = AES.decrypt(text, password)\n  return bytes.toString(Utf8)\n}\n\nfunction getErrorMsg(err: string) {\n  try {\n    const obj = JSON.parse(err)\n    return obj.message\n  } catch (e) {\n    return err\n  }\n}\n// writes the encrypted session, current datetime, and referer to DynamoDB\nexport async function shareSessionToDynamo(\n  session: unknown,\n  url: string,\n  referer: string,\n) {\n  const sess = await toUrlSafeB64(JSON.stringify(session))\n  const password = generateUID(5)\n  const encryptedSession = await encrypt(sess, password)\n\n  const data = new FormData()\n  data.append('session', encryptedSession)\n  data.append('dateShared', `${Date.now()}`)\n  data.append('referer', referer)\n\n  const response = await fetch(`${url}share`, {\n    method: 'POST',\n    mode: 'cors',\n    body: data,\n  })\n\n  if (!response.ok) {\n    const err = await response.text()\n    throw new Error(getErrorMsg(err))\n  }\n  const json = await response.json()\n  return {\n    json,\n    encryptedSession,\n    password,\n  }\n}\n\nexport async function readSessionFromDynamo(\n  baseUrl: string,\n  sessionQueryParam: string,\n  password: string,\n  signal?: AbortSignal,\n) {\n  const sessionId = sessionQueryParam.split('share-')[1]!\n  const url = `${baseUrl}?sessionId=${encodeURIComponent(sessionId)}`\n  const response = await fetch(url, {\n    signal,\n  })\n\n  if (!response.ok) {\n    const err = await response.text()\n    throw new Error(getErrorMsg(err))\n  }\n\n  const json = await response.json()\n  return decrypt(json.session, password)\n}\n","\"use client\";\n\nimport createSvgIcon from './utils/createSvgIcon';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n  d: \"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z\"\n}), 'ExpandMore');","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { getAccordionDetailsUtilityClass } from \"./accordionDetailsClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n  const {\n    classes\n  } = ownerState;\n  const slots = {\n    root: ['root']\n  };\n  return composeClasses(slots, getAccordionDetailsUtilityClass, classes);\n};\nconst AccordionDetailsRoot = styled('div', {\n  name: 'MuiAccordionDetails',\n  slot: 'Root',\n  overridesResolver: (props, styles) => styles.root\n})(memoTheme(({\n  theme\n}) => ({\n  padding: theme.spacing(1, 2, 2)\n})));\nconst AccordionDetails = /*#__PURE__*/React.forwardRef(function AccordionDetails(inProps, ref) {\n  const props = useDefaultProps({\n    props: inProps,\n    name: 'MuiAccordionDetails'\n  });\n  const {\n    className,\n    ...other\n  } = props;\n  const ownerState = props;\n  const classes = useUtilityClasses(ownerState);\n  return /*#__PURE__*/_jsx(AccordionDetailsRoot, {\n    className: clsx(classes.root, className),\n    ref: ref,\n    ownerState: ownerState,\n    ...other\n  });\n});\nprocess.env.NODE_ENV !== \"production\" ? AccordionDetails.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * The content of the component.\n   */\n  children: PropTypes.node,\n  /**\n   * Override or extend the styles applied to the component.\n   */\n  classes: PropTypes.object,\n  /**\n   * @ignore\n   */\n  className: PropTypes.string,\n  /**\n   * The system prop that allows defining system overrides as well as additional CSS styles.\n   */\n  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default AccordionDetails;","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getAccordionDetailsUtilityClass(slot) {\n  return generateUtilityClass('MuiAccordionDetails', slot);\n}\nconst accordionDetailsClasses = generateUtilityClasses('MuiAccordionDetails', ['root']);\nexport default accordionDetailsClasses;","import generateUtilityClasses from '@mui/utils/generateUtilityClasses';\nimport generateUtilityClass from '@mui/utils/generateUtilityClass';\nexport function getAccordionSummaryUtilityClass(slot) {\n  return generateUtilityClass('MuiAccordionSummary', slot);\n}\nconst accordionSummaryClasses = generateUtilityClasses('MuiAccordionSummary', ['root', 'expanded', 'focusVisible', 'disabled', 'gutters', 'contentGutters', 'content', 'expandIconWrapper']);\nexport default accordionSummaryClasses;","'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport memoTheme from \"../utils/memoTheme.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport ButtonBase from \"../ButtonBase/index.js\";\nimport AccordionContext from \"../Accordion/AccordionContext.js\";\nimport accordionSummaryClasses, { getAccordionSummaryUtilityClass } from \"./accordionSummaryClasses.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n  const {\n    classes,\n    expanded,\n    disabled,\n    disableGutters\n  } = ownerState;\n  const slots = {\n    root: ['root', expanded && 'expanded', disabled && 'disabled', !disableGutters && 'gutters'],\n    focusVisible: ['focusVisible'],\n    content: ['content', expanded && 'expanded', !disableGutters && 'contentGutters'],\n    expandIconWrapper: ['expandIconWrapper', expanded && 'expanded']\n  };\n  return composeClasses(slots, getAccordionSummaryUtilityClass, classes);\n};\nconst AccordionSummaryRoot = styled(ButtonBase, {\n  name: 'MuiAccordionSummary',\n  slot: 'Root',\n  overridesResolver: (props, styles) => styles.root\n})(memoTheme(({\n  theme\n}) => {\n  const transition = {\n    duration: theme.transitions.duration.shortest\n  };\n  return {\n    display: 'flex',\n    minHeight: 48,\n    padding: theme.spacing(0, 2),\n    transition: theme.transitions.create(['min-height', 'background-color'], transition),\n    [`&.${accordionSummaryClasses.focusVisible}`]: {\n      backgroundColor: (theme.vars || theme).palette.action.focus\n    },\n    [`&.${accordionSummaryClasses.disabled}`]: {\n      opacity: (theme.vars || theme).palette.action.disabledOpacity\n    },\n    [`&:hover:not(.${accordionSummaryClasses.disabled})`]: {\n      cursor: 'pointer'\n    },\n    variants: [{\n      props: props => !props.disableGutters,\n      style: {\n        [`&.${accordionSummaryClasses.expanded}`]: {\n          minHeight: 64\n        }\n      }\n    }]\n  };\n}));\nconst AccordionSummaryContent = styled('div', {\n  name: 'MuiAccordionSummary',\n  slot: 'Content',\n  overridesResolver: (props, styles) => styles.content\n})(memoTheme(({\n  theme\n}) => ({\n  display: 'flex',\n  flexGrow: 1,\n  margin: '12px 0',\n  variants: [{\n    props: props => !props.disableGutters,\n    style: {\n      transition: theme.transitions.create(['margin'], {\n        duration: theme.transitions.duration.shortest\n      }),\n      [`&.${accordionSummaryClasses.expanded}`]: {\n        margin: '20px 0'\n      }\n    }\n  }]\n})));\nconst AccordionSummaryExpandIconWrapper = styled('div', {\n  name: 'MuiAccordionSummary',\n  slot: 'ExpandIconWrapper',\n  overridesResolver: (props, styles) => styles.expandIconWrapper\n})(memoTheme(({\n  theme\n}) => ({\n  display: 'flex',\n  color: (theme.vars || theme).palette.action.active,\n  transform: 'rotate(0deg)',\n  transition: theme.transitions.create('transform', {\n    duration: theme.transitions.duration.shortest\n  }),\n  [`&.${accordionSummaryClasses.expanded}`]: {\n    transform: 'rotate(180deg)'\n  }\n})));\nconst AccordionSummary = /*#__PURE__*/React.forwardRef(function AccordionSummary(inProps, ref) {\n  const props = useDefaultProps({\n    props: inProps,\n    name: 'MuiAccordionSummary'\n  });\n  const {\n    children,\n    className,\n    expandIcon,\n    focusVisibleClassName,\n    onClick,\n    ...other\n  } = props;\n  const {\n    disabled = false,\n    disableGutters,\n    expanded,\n    toggle\n  } = React.useContext(AccordionContext);\n  const handleChange = event => {\n    if (toggle) {\n      toggle(event);\n    }\n    if (onClick) {\n      onClick(event);\n    }\n  };\n  const ownerState = {\n    ...props,\n    expanded,\n    disabled,\n    disableGutters\n  };\n  const classes = useUtilityClasses(ownerState);\n  return /*#__PURE__*/_jsxs(AccordionSummaryRoot, {\n    focusRipple: false,\n    disableRipple: true,\n    disabled: disabled,\n    component: \"div\",\n    \"aria-expanded\": expanded,\n    className: clsx(classes.root, className),\n    focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),\n    onClick: handleChange,\n    ref: ref,\n    ownerState: ownerState,\n    ...other,\n    children: [/*#__PURE__*/_jsx(AccordionSummaryContent, {\n      className: classes.content,\n      ownerState: ownerState,\n      children: children\n    }), expandIcon && /*#__PURE__*/_jsx(AccordionSummaryExpandIconWrapper, {\n      className: classes.expandIconWrapper,\n      ownerState: ownerState,\n      children: expandIcon\n    })]\n  });\n});\nprocess.env.NODE_ENV !== \"production\" ? AccordionSummary.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * The content of the component.\n   */\n  children: PropTypes.node,\n  /**\n   * Override or extend the styles applied to the component.\n   */\n  classes: PropTypes.object,\n  /**\n   * @ignore\n   */\n  className: PropTypes.string,\n  /**\n   * The icon to display as the expand indicator.\n   */\n  expandIcon: PropTypes.node,\n  /**\n   * This prop can help identify which element has keyboard focus.\n   * The class name will be applied when the element gains the focus through keyboard interaction.\n   * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).\n   * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).\n   * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components\n   * if needed.\n   */\n  focusVisibleClassName: PropTypes.string,\n  /**\n   * @ignore\n   */\n  onClick: PropTypes.func,\n  /**\n   * The system prop that allows defining system overrides as well as additional CSS styles.\n   */\n  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\nexport default AccordionSummary;"],"names":["useStyles","makeStyles","theme","expandIcon","color","palette","tertiary","contrastText","minWidth","observer","onClose","model","classes","location","setLocation","useState","error","setError","shareLink","setShareLink","session","getSession","assemblyNames","selectedAsm","setSelectedAsm","expanded","setExpanded","React","Dialog","open","maxWidth","title","DialogContent","className","Accordion","onChange","AccordionSummary","ExpandMoreIcon","Typography","style","display","alignItems","gap","AccordionDetails","TextField","label","variant","fullWidth","value","e","target","FileSelector","name","description","AssemblySelector","val","helperText","selected","ErrorMessage","DialogActions","Button","onClick","disabled","startIcon","ImportIcon","async","lines","openLocation","readFile","split","filter","f","trim","header","startsWith","includes","importBookmarks","map","line","refName","start","end","assemblyName","undefined","getBookmarksFromBEDFile","slice","getBookmarksFromTSVFile","isSessionWithShareURL","shareURL","urlParams","URL","sessionQueryParam","searchParams","get","password","decryptedSession","readSessionFromDynamo","JSON","parse","fromUrlSafeB64","sharedBookmarks","getBookmarksFromShareLink","console","encrypt","text","toString","decrypt","AES","Utf8","getErrorMsg","err","message","shareSessionToDynamo","url","referer","sess","toUrlSafeB64","stringify","window","btoa","crypto","getRandomValues","Uint8Array","length","b","String","fromCharCode","join","replaceAll","encryptedSession","data","FormData","append","Date","now","response","fetch","method","mode","body","ok","Error","json","baseUrl","signal","sessionId","encodeURIComponent","d","AccordionDetailsRoot","slot","overridesResolver","props","styles","root","padding","spacing","inProps","ref","other","ownerState","useUtilityClasses","getAccordionDetailsUtilityClass","getAccordionSummaryUtilityClass","generateUtilityClass","generateUtilityClasses","AccordionSummaryRoot","styled","ButtonBase","memoTheme","transition","duration","transitions","shortest","minHeight","create","focusVisible","backgroundColor","vars","action","focus","opacity","disabledOpacity","cursor","variants","disableGutters","AccordionSummaryContent","content","flexGrow","margin","AccordionSummaryExpandIconWrapper","expandIconWrapper","active","transform","children","focusVisibleClassName","toggle","AccordionContext","A","slots","composeClasses","focusRipple","disableRipple","component","clsx","event"],"sourceRoot":""}