jbrowse-plugin-msaview 3.9.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +1 -1
  2. package/dist/AddHighlightModel/index.js +1 -1
  3. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.d.ts +2 -8
  4. package/dist/BgzipFastaMsaAdapter/configSchema.d.ts +10 -3
  5. package/dist/LaunchMsaView/cleanProteinSequence.test.js +36 -2
  6. package/dist/LaunchMsaView/components/BlastQuery/BlastAutomaticPanel.js +8 -10
  7. package/dist/LaunchMsaView/components/BlastQuery/BlastManualPanel.js +9 -11
  8. package/dist/LaunchMsaView/components/BlastQuery/CachedBlastResults.js +3 -1
  9. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +14 -16
  10. package/dist/LaunchMsaView/components/OrthologQuery/OrthologPanel.js +16 -18
  11. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +17 -19
  12. package/dist/LaunchMsaView/components/launchConnectedView.d.ts +2 -2
  13. package/dist/LaunchMsaView/components/launchConnectedView.js +4 -8
  14. package/dist/LaunchMsaView/components/useFeatureSequence.js +3 -6
  15. package/dist/LaunchMsaView/index.js +2 -1
  16. package/dist/LaunchMsaView/launchTarget.test.js +1 -1
  17. package/dist/LaunchMsaViewExtensionPoint/index.js +3 -3
  18. package/dist/LaunchMsaViewExtensionPoint/index.test.js +24 -21
  19. package/dist/MsaViewPanel/index.js +3 -3
  20. package/dist/MsaViewPanel/isMsaView.d.ts +4 -0
  21. package/dist/MsaViewPanel/isMsaView.js +3 -0
  22. package/dist/MsaViewPanel/model.d.ts +638 -212
  23. package/dist/MsaViewPanel/model.js +0 -3
  24. package/dist/MsaViewPanel/resolveConnectedTranscript.js +7 -13
  25. package/dist/MsaViewPanel/resolveConnectedTranscript.test.js +2 -2
  26. package/dist/MsaViewPanel/transcriptMap.js +27 -8
  27. package/dist/MsaViewPanel/transcriptMap.test.js +19 -0
  28. package/dist/chunks/AboutDialog-WT6GXMXU.js +2 -0
  29. package/dist/chunks/AboutDialog-WT6GXMXU.js.map +7 -0
  30. package/dist/chunks/AnnotationFileDialog-34R7LFHB.js +2 -0
  31. package/dist/chunks/AnnotationFileDialog-34R7LFHB.js.map +7 -0
  32. package/dist/chunks/BgzipFastaMsaAdapter-ZMUARSUQ.js +4 -0
  33. package/dist/chunks/BgzipFastaMsaAdapter-ZMUARSUQ.js.map +7 -0
  34. package/dist/chunks/ExportSVGDialog-NMVUHFGY.js +2 -0
  35. package/dist/chunks/ExportSVGDialog-NMVUHFGY.js.map +7 -0
  36. package/dist/chunks/FeatureDialog-XNHIA5PS.js +2 -0
  37. package/dist/chunks/FeatureDialog-XNHIA5PS.js.map +7 -0
  38. package/dist/chunks/HelpDialog-DF4Y536X.js +2 -0
  39. package/dist/chunks/HelpDialog-DF4Y536X.js.map +7 -0
  40. package/dist/chunks/LaunchMsaViewDialog-54LBEZHK.js +5 -0
  41. package/dist/chunks/LaunchMsaViewDialog-54LBEZHK.js.map +7 -0
  42. package/dist/chunks/MetadataDialog-2WT6EX4M.js +2 -0
  43. package/dist/chunks/MetadataDialog-2WT6EX4M.js.map +7 -0
  44. package/dist/chunks/MsaViewPanel-YYP4CYYO.js +2 -0
  45. package/dist/chunks/MsaViewPanel-YYP4CYYO.js.map +7 -0
  46. package/dist/chunks/TrackInfoDialog-TYCMLUKG.js +2 -0
  47. package/dist/chunks/TrackInfoDialog-TYCMLUKG.js.map +7 -0
  48. package/dist/chunks/TreeNodeInfoDialog-BFF6JRCO.js +2 -0
  49. package/dist/chunks/TreeNodeInfoDialog-BFF6JRCO.js.map +7 -0
  50. package/dist/chunks/chunk-2IWD4OO4.js +2 -0
  51. package/dist/chunks/chunk-2IWD4OO4.js.map +7 -0
  52. package/dist/chunks/chunk-5ORPTTMR.js +2 -0
  53. package/dist/chunks/chunk-5ORPTTMR.js.map +7 -0
  54. package/dist/chunks/chunk-6YFCSBEE.js +2 -0
  55. package/dist/chunks/chunk-6YFCSBEE.js.map +7 -0
  56. package/dist/chunks/chunk-73KAPCJ2.js +2 -0
  57. package/dist/chunks/chunk-73KAPCJ2.js.map +7 -0
  58. package/dist/chunks/chunk-BX4Z274Q.js +2 -0
  59. package/dist/chunks/chunk-BX4Z274Q.js.map +7 -0
  60. package/dist/chunks/chunk-CVLB4VFP.js +2 -0
  61. package/dist/chunks/chunk-CVLB4VFP.js.map +7 -0
  62. package/dist/chunks/chunk-DNFD5II2.js +2 -0
  63. package/dist/chunks/chunk-DNFD5II2.js.map +7 -0
  64. package/dist/chunks/chunk-ENTWPX2K.js +6 -0
  65. package/dist/chunks/chunk-ENTWPX2K.js.map +7 -0
  66. package/dist/chunks/chunk-EO7URJUB.js +2 -0
  67. package/dist/chunks/chunk-EO7URJUB.js.map +7 -0
  68. package/dist/chunks/chunk-FCNT6B47.js +2 -0
  69. package/dist/chunks/chunk-FCNT6B47.js.map +7 -0
  70. package/dist/chunks/chunk-FCWXYIFC.js +2 -0
  71. package/dist/chunks/chunk-FCWXYIFC.js.map +7 -0
  72. package/dist/chunks/chunk-FY3BTKY4.js +2 -0
  73. package/dist/chunks/chunk-FY3BTKY4.js.map +7 -0
  74. package/dist/chunks/chunk-IBBQUV2I.js +2 -0
  75. package/dist/chunks/chunk-IBBQUV2I.js.map +7 -0
  76. package/dist/chunks/chunk-J6KYLXRD.js +2 -0
  77. package/dist/chunks/chunk-J6KYLXRD.js.map +7 -0
  78. package/dist/chunks/chunk-MBI4TMKR.js +2 -0
  79. package/dist/chunks/chunk-MBI4TMKR.js.map +7 -0
  80. package/dist/chunks/chunk-NSASZ5FM.js +2 -0
  81. package/dist/chunks/chunk-NSASZ5FM.js.map +7 -0
  82. package/dist/chunks/chunk-O7JNDIKD.js +2 -0
  83. package/dist/chunks/chunk-O7JNDIKD.js.map +7 -0
  84. package/dist/chunks/chunk-P77DPK6B.js +2 -0
  85. package/dist/chunks/chunk-P77DPK6B.js.map +7 -0
  86. package/dist/chunks/chunk-PJZ3XTMG.js +6 -0
  87. package/dist/chunks/chunk-PJZ3XTMG.js.map +7 -0
  88. package/dist/chunks/chunk-QAC6JSDZ.js +5 -0
  89. package/dist/chunks/chunk-QAC6JSDZ.js.map +7 -0
  90. package/dist/chunks/chunk-QMLPITS4.js +18 -0
  91. package/dist/chunks/chunk-QMLPITS4.js.map +7 -0
  92. package/dist/chunks/chunk-RKVHQK52.js +3 -0
  93. package/dist/chunks/chunk-RKVHQK52.js.map +7 -0
  94. package/dist/chunks/chunk-RTKNCGDF.js +8 -0
  95. package/dist/chunks/chunk-RTKNCGDF.js.map +7 -0
  96. package/dist/chunks/chunk-TITP6LCV.js +2 -0
  97. package/dist/chunks/chunk-TITP6LCV.js.map +7 -0
  98. package/dist/chunks/chunk-YUKJI2AH.js +2 -0
  99. package/dist/chunks/chunk-YUKJI2AH.js.map +7 -0
  100. package/dist/chunks/chunk-ZTQYZDWK.js +2 -0
  101. package/dist/chunks/chunk-ZTQYZDWK.js.map +7 -0
  102. package/dist/chunks/dist-2T65ZS4E.js +2 -0
  103. package/dist/chunks/dist-2T65ZS4E.js.map +7 -0
  104. package/dist/chunks/dist-UX5CKLQJ.js +2 -0
  105. package/dist/chunks/dist-UX5CKLQJ.js.map +7 -0
  106. package/dist/chunks/model-KEZXRCK6.js +12 -0
  107. package/dist/chunks/model-KEZXRCK6.js.map +7 -0
  108. package/dist/chunks/renderToSvg-B7RCHRO3.js +2 -0
  109. package/dist/chunks/renderToSvg-B7RCHRO3.js.map +7 -0
  110. package/dist/config.json +1 -1
  111. package/dist/index.d.ts +11 -8
  112. package/dist/index.js +4 -1
  113. package/dist/jbrowse-plugin-msaview.esm.js +3 -0
  114. package/dist/jbrowse-plugin-msaview.esm.js.map +7 -0
  115. package/dist/utils/launchMsaView.d.ts +1 -1
  116. package/dist/utils/launchMsaView.js +5 -2
  117. package/dist/utils/workspaces.test.js +5 -5
  118. package/dist/version.d.ts +1 -1
  119. package/dist/version.js +1 -1
  120. package/package.json +19 -20
  121. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +1 -1
  122. package/src/AddHighlightModel/index.tsx +1 -1
  123. package/src/LaunchMsaView/cleanProteinSequence.test.ts +37 -2
  124. package/src/LaunchMsaView/components/BlastQuery/BlastAutomaticPanel.tsx +3 -3
  125. package/src/LaunchMsaView/components/BlastQuery/BlastManualPanel.tsx +3 -3
  126. package/src/LaunchMsaView/components/BlastQuery/CachedBlastResults.tsx +3 -1
  127. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +3 -3
  128. package/src/LaunchMsaView/components/OrthologQuery/OrthologPanel.tsx +3 -3
  129. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +3 -3
  130. package/src/LaunchMsaView/components/launchConnectedView.ts +5 -8
  131. package/src/LaunchMsaView/components/useFeatureSequence.ts +3 -6
  132. package/src/LaunchMsaView/index.ts +6 -1
  133. package/src/LaunchMsaView/launchTarget.test.ts +1 -1
  134. package/src/LaunchMsaView/launchTarget.ts +2 -3
  135. package/src/LaunchMsaViewExtensionPoint/index.test.ts +26 -21
  136. package/src/LaunchMsaViewExtensionPoint/index.ts +3 -4
  137. package/src/MsaViewPanel/index.ts +3 -4
  138. package/src/MsaViewPanel/isMsaView.ts +7 -0
  139. package/src/MsaViewPanel/model.ts +0 -6
  140. package/src/MsaViewPanel/resolveConnectedTranscript.test.ts +2 -2
  141. package/src/MsaViewPanel/resolveConnectedTranscript.ts +7 -17
  142. package/src/MsaViewPanel/transcriptMap.test.ts +23 -0
  143. package/src/MsaViewPanel/transcriptMap.ts +36 -9
  144. package/src/index.ts +4 -1
  145. package/src/utils/launchMsaView.ts +5 -2
  146. package/src/utils/useFetch.ts +1 -1
  147. package/src/utils/workspaces.test.ts +5 -5
  148. package/src/version.ts +1 -1
  149. package/dist/LaunchMsaView/components/calculateProteinSequence.d.ts +0 -21
  150. package/dist/LaunchMsaView/components/calculateProteinSequence.js +0 -71
  151. package/dist/LaunchMsaView/components/types.d.ts +0 -6
  152. package/dist/LaunchMsaView/components/types.js +0 -1
  153. package/dist/jbrowse-plugin-msaview.umd.production.min.js +0 -143
  154. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +0 -7
  155. package/src/LaunchMsaView/components/calculateProteinSequence.ts +0 -113
  156. package/src/LaunchMsaView/components/types.ts +0 -8
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/.pnpm/react-msaview@8.4.1_35cd7d1fa06820f3dff395dec9803110/node_modules/react-msaview/src/components/tree/dialogs/TreeNodeInfoDialog.tsx"],
4
+ "sourcesContent": ["import React from 'react'\n\nimport { Dialog } from '@jbrowse/core/ui'\nimport { DialogContent, Typography } from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport MetadataTable from '../../MetadataTable.tsx'\nimport SequenceTextArea from '../../SequenceTextArea.tsx'\n\nimport type { MsaViewModel } from '../../../model.ts'\n\nconst TreeNodeInfoDialog = observer(function ({\n info,\n model,\n nodeName,\n onClose,\n}: {\n info: Record<string, unknown>\n model: MsaViewModel\n nodeName: string\n onClose: () => void\n}) {\n const { rows } = model\n const metadata = model.rowDataOf(nodeName)\n const res = rows.find(f => f[0] === nodeName)\n return (\n <Dialog\n onClose={() => {\n onClose()\n }}\n open\n title=\"Tree node info\"\n maxWidth=\"xl\"\n >\n <DialogContent>\n <Typography variant=\"h6\">Attributes</Typography>\n <MetadataTable record={{ nodeName, ...info }} />\n <Typography variant=\"h6\">Sequence</Typography>\n {res ? (\n <SequenceTextArea str={[res]} />\n ) : (\n <Typography>Sequence not found</Typography>\n )}\n {metadata ? (\n <>\n <Typography variant=\"h6\">Extra metadata</Typography>\n <MetadataTable record={metadata} />\n </>\n ) : null}\n </DialogContent>\n </Dialog>\n )\n})\n\nexport default TreeNodeInfoDialog\n"],
5
+ "mappings": "sbAAA,IAAAA,EAAkB,SAElBC,EAAuB,SACvBC,EAA0C,SAC1CC,EAAyB,SAOzB,IAAMC,KAAqB,YAAS,SAAU,CAC5C,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,QAAAC,CAAO,EAMR,CACC,GAAM,CAAE,KAAAC,CAAI,EAAKH,EACXI,EAAWJ,EAAM,UAAUC,CAAQ,EACnCI,EAAMF,EAAK,KAAKG,GAAKA,EAAE,CAAC,IAAML,CAAQ,EAC5C,OACE,EAAAM,QAAA,cAAC,SAAM,CACL,QAAS,IAAK,CACZL,EAAO,CACT,EACA,KAAI,GACJ,MAAM,iBACN,SAAS,IAAI,EAEb,EAAAK,QAAA,cAAC,gBAAa,KACZ,EAAAA,QAAA,cAAC,aAAU,CAAC,QAAQ,IAAI,EAAA,YAAA,EACxB,EAAAA,QAAA,cAACC,EAAa,CAAC,OAAQ,CAAE,SAAAP,EAAU,GAAGF,CAAI,CAAE,CAAA,EAC5C,EAAAQ,QAAA,cAAC,aAAU,CAAC,QAAQ,IAAI,EAAA,UAAA,EACvBF,EACC,EAAAE,QAAA,cAACE,EAAgB,CAAC,IAAK,CAACJ,CAAG,CAAC,CAAA,EAE5B,EAAAE,QAAA,cAAC,aAAU,KAAA,oBAAA,EAEZH,EACC,EAAAG,QAAA,cAAA,EAAAA,QAAA,SAAA,KACE,EAAAA,QAAA,cAAC,aAAU,CAAC,QAAQ,IAAI,EAAA,gBAAA,EACxB,EAAAA,QAAA,cAACC,EAAa,CAAC,OAAQJ,CAAQ,CAAA,CAAI,EAEnC,IAAI,CACM,CAGtB,CAAC,EAEDM,EAAeZ",
6
+ "names": ["import_react", "import_ui", "import_material", "import_mobx_react", "TreeNodeInfoDialog", "info", "model", "nodeName", "onClose", "rows", "metadata", "res", "f", "React", "MetadataTable", "SequenceTextArea", "TreeNodeInfoDialog_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-FY3BTKY4.js";var e=r((s,o)=>{o.exports=JBrowseExports["@jbrowse/core/configuration"]});export{e as a};
2
+ //# sourceMappingURL=chunk-2IWD4OO4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@jbrowse/core/configuration"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/configuration\"];"],
5
+ "mappings": "wCAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,6BAA6B",
6
+ "names": ["require_configuration", "__commonJSMin", "exports", "module"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-FY3BTKY4.js";var i=a((p,c)=>{c.exports=JBrowseExports["@jbrowse/core/util/tss-react"]});function n(t){let o=navigator.clipboard;if(o?.writeText){o.writeText(t).catch(r=>{console.error("Failed to copy to clipboard:",r)});return}let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.append(e),e.select(),document.execCommand("copy"),e.remove()}export{i as a,n as b};
2
+ //# sourceMappingURL=chunk-5ORPTTMR.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@jbrowse/core/util/tss-react", "../../node_modules/.pnpm/react-msaview@8.4.1_35cd7d1fa06820f3dff395dec9803110/node_modules/react-msaview/src/vendor/copyToClipboard.ts"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/util/tss-react\"];", "export default function copy(text: string) {\n const clip = navigator.clipboard as Clipboard | undefined\n if (clip?.writeText) {\n clip.writeText(text).catch((e: unknown) => {\n console.error('Failed to copy to clipboard:', e)\n })\n return\n }\n const textarea = document.createElement('textarea')\n textarea.value = text\n textarea.style.position = 'fixed'\n textarea.style.opacity = '0'\n document.body.append(textarea)\n textarea.select()\n document.execCommand('copy')\n textarea.remove()\n}\n"],
5
+ "mappings": "mCAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,8BAA8B,ICAhD,SAAPC,EAAsBC,EAAY,CACvC,IAAMC,EAAO,UAAU,UACvB,GAAIA,GAAM,UAAW,CACnBA,EAAK,UAAUD,CAAI,EAAE,MAAOE,GAAc,CACxC,QAAQ,MAAM,+BAAgCA,CAAC,CACjD,CAAC,EACD,MACF,CACA,IAAMC,EAAW,SAAS,cAAc,UAAU,EAClDA,EAAS,MAAQH,EACjBG,EAAS,MAAM,SAAW,QAC1BA,EAAS,MAAM,QAAU,IACzB,SAAS,KAAK,OAAOA,CAAQ,EAC7BA,EAAS,OAAM,EACf,SAAS,YAAY,MAAM,EAC3BA,EAAS,OAAM,CACjB",
6
+ "names": ["require_tss_react", "__commonJSMin", "exports", "module", "copy", "text", "clip", "e", "textarea"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{c as o,d as l}from"./chunk-IBBQUV2I.js";import{a as c}from"./chunk-BX4Z274Q.js";import{a}from"./chunk-J6KYLXRD.js";import{b as r}from"./chunk-FY3BTKY4.js";var e=r(a());var t=r(l(),1),n=(0,o.createSvgIcon)((0,t.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"OpenInNew");var i=r(c());function s(m){let{children:p,...f}=m;return e.default.createElement(i.Link,{...f,target:"_blank",rel:"noreferrer"},p," ",e.default.createElement(n,{fontSize:"small"}))}export{s as a};
2
+ //# sourceMappingURL=chunk-6YFCSBEE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/ExternalLink.tsx", "../../node_modules/.pnpm/@mui+icons-material@9.4.0_@mui+material@9.4.0_@emotion+react@11.14.0_@types+react@19.3._3766ec55733e6b150ee672ad270cc236/node_modules/@mui/icons-material/OpenInNew.mjs"],
4
+ "sourcesContent": ["import React from 'react'\n\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew'\nimport { Link } from '@mui/material'\n\nimport type { LinkProps } from '@mui/material'\n\nexport default function ExternalLink(props: LinkProps) {\n const { children, ...rest } = props\n return (\n <Link {...rest} target=\"_blank\" rel=\"noreferrer\">\n {children} <OpenInNewIcon fontSize=\"small\" />\n </Link>\n )\n}\n", "\"use client\";\n\nimport createSvgIcon from \"./utils/createSvgIcon.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default createSvgIcon(/*#__PURE__*/_jsx(\"path\", {\n d: \"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z\"\n}), 'OpenInNew');"],
5
+ "mappings": "kKAAA,IAAAA,EAAkB,OCGlB,IAAAC,EAA4B,SACrBC,KAAQ,oBAA2B,EAAAC,KAAK,OAAQ,CACrD,EAAG,+HACL,CAAC,EAAG,WAAW,EDHf,IAAAC,EAAqB,OAIN,SAARC,EAA8BC,EAAkB,CACrD,GAAM,CAAE,SAAAC,EAAU,GAAGC,CAAK,EAAIF,EAC9B,OACE,EAAAG,QAAA,cAAC,QAAM,GAAGD,EAAM,OAAO,SAAS,IAAI,cACjCD,EAAS,IAAC,EAAAE,QAAA,cAACC,EAAA,CAAc,SAAS,QAAQ,CAC7C,CAEJ",
6
+ "names": ["import_react", "import_jsx_runtime", "OpenInNew_default", "_jsx", "import_material", "ExternalLink", "props", "children", "rest", "React", "OpenInNew_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ function p(n,o){if(o.children)for(let e=o.children.length-1;e>=0;e--)n.push(o.children[e])}function x(n){let o=[];return u(n,e=>{o.push(e)}),o}function u(n,o){let e=[n];for(;e.length>0;){let t=e.pop();o(t),p(e,t)}}function k(n){let o=[];return u(n,e=>{e.children||o.push(e)}),o}function d(n,o){let e=[],t=[n];for(;t.length>0;){let i=t.pop();if(e.push(i),i.children)for(let s of i.children)t.push(s)}for(let i=e.length-1;i>=0;i--)o(e[i])}function m(n){d(n,o=>{let e=0;if(o.children)for(let t of o.children)t.height+1>e&&(e=t.height+1);o.height=e})}function b(n,o){let e={data:n,children:null,parent:null,depth:0,height:0},t=[e];for(;t.length>0;){let i=t.pop(),s=o(i.data);if(s?.length){i.children=s.map(r=>({data:r,children:null,parent:i,depth:i.depth+1,height:0}));for(let r of i.children)t.push(r)}}return m(e),e}function w(n,o){return d(n,e=>{let t=o(e.data);if(e.children)for(let i of e.children)t+=i.value;e.value=t}),n}function E(n,o){let e=[n];for(;e.length>0;){let t=e.pop();if(t.children){t.children.sort(o);for(let i of t.children)e.push(i)}}return n}function N(n,o){let e=[n];for(;e.length>0;){let t=e.pop();if(o(t))return t;p(e,t)}}var v=/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;function q(n){let o=[],e="",t="",i=!1;function s(){let r=i?t:e.trim();(r!==""||i)&&o.push({text:r,delim:!1,quoted:i}),e="",t="",i=!1}for(let r=0;r<n.length;r++){let c=n[r];if(c==="'")for(i=!0,r++;r<n.length;r++)if(n[r]!=="'")t+=n[r];else if(n[r+1]==="'")t+="'",r++;else break;else if(c==="[")for(let l=1;r<n.length-1&&l>0;)r++,n[r]==="["?l++:n[r]==="]"&&l--;else c==="("||c===")"||c===","||c===":"||c===";"?(s(),o.push({text:c,delim:!0,quoted:!1})):e+=c}return s(),o}function g(n,o={}){let e=[],t=q(n),{postParenNumeric:i="auto"}=o,s=i==="length"||i==="auto"&&!t.some(c=>c.delim&&c.text===":"),r={};for(let c=0;c<t.length;c++){let l=t[c],f={};if(l.delim){switch(l.text){case"(":r.children=[f],e.push(r),r=f;break;case",":e.at(-1)?.children?.push(f),r=f;break;case")":r=e.pop();break;default:break}continue}let a=c>0?t[c-1]:void 0,h=a?.delim?a.text:void 0;h===":"?r.length=Number.parseFloat(l.text):h===")"?s&&!l.quoted&&v.test(l.text)?r.length=Number.parseFloat(l.text):r.name=l.text:(h==="("||h===","||h===void 0)&&(r.name=l.text)}return r}export{g as a,x as b,u as c,k as d,b as e,w as f,E as g,N as h};
2
+ //# sourceMappingURL=chunk-73KAPCJ2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/.pnpm/@gmod+newick@1.0.3/node_modules/@gmod/newick/src/hierarchy.ts", "../../node_modules/.pnpm/@gmod+newick@1.0.3/node_modules/@gmod/newick/src/newick.ts"],
4
+ "sourcesContent": ["/**\n * The d3-hierarchy traversals a tree viewer actually needs, without the\n * dependency.\n *\n * Every traversal here is iterative (an explicit stack, or a reversed pre-order\n * walk) rather than recursive. That is the whole point of the file: a\n * phylogenetic tree or a single-linkage dendrogram can be a caterpillar, whose\n * depth equals its leaf count, and the recursive form throws\n * `RangeError: Maximum call stack size exceeded` somewhere around 5000 tips.\n */\n\nexport interface HierarchyNode<T> {\n data: T\n children: HierarchyNode<T>[] | null\n parent: HierarchyNode<T> | null\n depth: number\n height: number\n /** set by `sum`, and otherwise absent */\n value?: number\n}\n\nexport interface HierarchyLink<N> {\n source: N\n target: N\n}\n\n/**\n * What a traversal needs of a node, and the whole of it.\n *\n * The traversals are generic over the *node* type rather than over its data \u2014\n * `N extends TreeLike<N>` \u2014 so a caller that extends HierarchyNode with its own\n * layout fields gets its own type back instead of the base one, and a shape\n * that is not a HierarchyNode at all still walks.\n */\nexport interface TreeLike<N> {\n children: N[] | null\n}\n\n/** A node `sum` can write to. */\ninterface Summable<N> extends TreeLike<N> {\n data: unknown\n value?: number\n}\n\nfunction pushChildren<N extends TreeLike<N>>(stack: N[], node: N) {\n if (node.children) {\n for (let i = node.children.length - 1; i >= 0; i--) {\n stack.push(node.children[i]!)\n }\n }\n}\n\n/**\n * Pre-order: every parent precedes all of its descendants. Iterating the result\n * in reverse therefore yields a valid post-order (children before parents),\n * which the accumulation helpers rely on.\n */\nexport function descendants<N extends TreeLike<N>>(node: N): N[] {\n const result: N[] = []\n forEachDescendant(node, n => {\n result.push(n)\n })\n return result\n}\n\nexport function forEachDescendant<N extends TreeLike<N>>(\n node: N,\n cb: (n: N) => void,\n) {\n const stack = [node]\n while (stack.length > 0) {\n const n = stack.pop()!\n cb(n)\n pushChildren(stack, n)\n }\n}\n\nexport function leaves<N extends TreeLike<N>>(node: N): N[] {\n const result: N[] = []\n forEachDescendant(node, n => {\n if (!n.children) {\n result.push(n)\n }\n })\n return result\n}\n\n/**\n * Every parent->child edge, depth-first and left to right, so a link's whole\n * subtree is visited before its next sibling.\n *\n * The parent travels on the stack rather than being read back off the node, so\n * this works for a node type that carries no `parent` pointer.\n */\nexport function forEachLink<N extends TreeLike<N>>(\n node: N,\n cb: (source: N, target: N) => void,\n) {\n const stack: { source: N | null; target: N }[] = [\n { source: null, target: node },\n ]\n while (stack.length > 0) {\n const { source, target } = stack.pop()!\n if (source) {\n cb(source, target)\n }\n if (target.children) {\n for (let i = target.children.length - 1; i >= 0; i--) {\n stack.push({ source: target, target: target.children[i]! })\n }\n }\n }\n}\n\nexport function links<N extends TreeLike<N>>(node: N): HierarchyLink<N>[] {\n const result: HierarchyLink<N>[] = []\n forEachLink(node, (source, target) => {\n result.push({ source, target })\n })\n return result\n}\n\n/**\n * Post-order: a node's children, left to right, then the node.\n *\n * Not `descendants().reverse()`, which also puts children before parents but\n * walks siblings right to left. Reversing a pre-order that pushes children\n * left-to-right (so the rightmost pops first) gives the real thing.\n */\nexport function eachAfter<N extends TreeLike<N>>(node: N, cb: (n: N) => void) {\n const order: N[] = []\n const stack = [node]\n while (stack.length > 0) {\n const n = stack.pop()!\n order.push(n)\n if (n.children) {\n for (const child of n.children) {\n stack.push(child)\n }\n }\n }\n for (let i = order.length - 1; i >= 0; i--) {\n cb(order[i]!)\n }\n}\n\nfunction computeHeight<T>(node: HierarchyNode<T>) {\n eachAfter(node, n => {\n let h = 0\n if (n.children) {\n for (const child of n.children) {\n if (child.height + 1 > h) {\n h = child.height + 1\n }\n }\n }\n n.height = h\n })\n}\n\n/** Wrap plain data in hierarchy nodes, filling in depth, height and parent. */\nexport function hierarchy<T>(\n data: T,\n childrenAccessor: (d: T) => T[] | undefined | null,\n): HierarchyNode<T> {\n const root: HierarchyNode<T> = {\n data,\n children: null,\n parent: null,\n depth: 0,\n height: 0,\n }\n const stack = [root]\n while (stack.length > 0) {\n const node = stack.pop()!\n const kids = childrenAccessor(node.data)\n if (kids?.length) {\n node.children = kids.map(d => ({\n data: d,\n children: null,\n parent: node,\n depth: node.depth + 1,\n height: 0,\n }))\n for (const child of node.children) {\n stack.push(child)\n }\n }\n }\n computeHeight(root)\n return root\n}\n\n/**\n * Accumulate a value up the tree, each node summing its children's.\n *\n * One type parameter, with the datum reached through `N['data']`: a second one\n * for the datum cannot be inferred from the arguments, so callers would have to\n * write both out or get `unknown` in the callback.\n */\nexport function sum<N extends Summable<N>>(\n node: N,\n valueFn: (d: N['data']) => number,\n): N {\n eachAfter(node, n => {\n let s = valueFn(n.data)\n if (n.children) {\n for (const child of n.children) {\n s += child.value!\n }\n }\n n.value = s\n })\n return node\n}\n\n/** Sort every node's children in place. */\nexport function sort<N extends TreeLike<N>>(\n node: N,\n compareFn: (a: N, b: N) => number,\n): N {\n const stack = [node]\n while (stack.length > 0) {\n const n = stack.pop()!\n if (n.children) {\n n.children.sort(compareFn)\n for (const child of n.children) {\n stack.push(child)\n }\n }\n }\n return node\n}\n\n/** First node matching the predicate, in pre-order. */\nexport function find<N extends TreeLike<N>>(\n node: N,\n predicate: (n: N) => boolean,\n): N | undefined {\n const stack = [node]\n while (stack.length > 0) {\n const n = stack.pop()!\n if (predicate(n)) {\n return n\n }\n pushChildren(stack, n)\n }\n return undefined\n}\n", "/**\n * Newick format parser.\n *\n * Originally based on Jason Davies' 2010 implementation (MIT). Rewritten around\n * a hand-rolled scanner so that single-quoted labels are read as labels rather\n * than as grammar.\n *\n * Supported forms:\n *\n * (A:0.1,B:0.2)F \u2014 name and `:` branch length (standard phylo Newick)\n * (A:0.1,B:0.2)F:0.5 \u2014 internal node name + branch length to parent\n * (A,B)Foo \u2014 non-numeric post-paren stored as `name`\n * (A,B)1.5 \u2014 numeric post-paren; see `postParenNumeric` below\n * ('A (x)','B,y')1.5 \u2014 single-quoted labels, `''` for a literal quote\n * (A:0.1[&&NHX:S=human]) \u2014 bracketed comments (NHX, BEAST), dropped\n *\n * The quoted form is not decoration: a leaf name is an arbitrary string out of\n * somebody's data file, and one holding a `(` or a `,` is grammar rather than a\n * label unless it is quoted. A comma inside an unquoted label splits one leaf\n * into two and hands every row below it its neighbour's name, so the tree comes\n * back the wrong shape rather than merely mislabelled.\n */\n\nexport interface NewickNode {\n name?: string\n length?: number\n children?: NewickNode[]\n}\n\n/**\n * How to read a bare number sitting after a `)`.\n *\n * The Newick grammar puts the internal node's *label* there, so `95` in\n * `((A,B)95,(C,D)80);` is a bootstrap support value. `@gmod/hclust` reuses the\n * same slot for a cluster's absolute merge height (`(A,B)1.5`) and never emits a\n * `:`, so for that dialect the number is a length. Nothing in the string\n * distinguishes the two, which is why this is a parameter and not a guess.\n *\n * 'name' \u2014 always a name. Standard Newick.\n * 'length' \u2014 always a length. `@gmod/hclust` output.\n * 'auto' \u2014 length only when the tree contains no `:` branch length at all,\n * which is the shape hclust writes. The default, since reading a\n * real phylogeny's support values as lengths would sum 0-100 into\n * the branch distances and flatten the real ones.\n *\n * A *quoted* post-paren token is always a name under every setting: quoting is\n * the writer saying \"this is a label\", and it is the only way to name a node\n * something that looks like a number.\n */\nexport type PostParenNumeric = 'name' | 'length' | 'auto'\n\nexport interface ParseNewickOptions {\n postParenNumeric?: PostParenNumeric\n}\n\nconst NUMERIC_TOKEN = /^-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?$/\n\ninterface Token {\n text: string\n // a bare grammar character, as opposed to label text that happens to equal one\n delim: boolean\n // arrived single-quoted, so it is a label whatever it looks like\n quoted: boolean\n}\n\n/**\n * Split into grammar characters and labels.\n *\n * A scanner rather than a regex split on the grammar characters, because a\n * split cannot know it is inside a quoted label and so tears the label apart on\n * the very characters quoting exists to protect.\n *\n * Whitespace is consumed around the delimiters and not inside labels: phased\n * haplotype rows are named `NA18536 HP0`, and stripping globally welds them\n * shut. Inside quotes it is kept verbatim.\n */\nfunction tokenize(s: string): Token[] {\n const out: Token[] = []\n // text since the last delimiter, kept apart from the quoted run so a quoted\n // label can own the token: whitespace written around the quotes is layout in\n // a hand-formatted .nh file, not part of the name\n let bare = ''\n let quotedText = ''\n let quoted = false\n function flush() {\n const text = quoted ? quotedText : bare.trim()\n // an empty run between two delimiters is not a label; an explicitly quoted\n // '' is one, so it survives\n if (text !== '' || quoted) {\n out.push({ text, delim: false, quoted })\n }\n bare = ''\n quotedText = ''\n quoted = false\n }\n for (let i = 0; i < s.length; i++) {\n const c = s[i]!\n if (c === \"'\") {\n quoted = true\n for (i++; i < s.length; i++) {\n if (s[i] !== \"'\") {\n quotedText += s[i]!\n } else if (s[i + 1] === \"'\") {\n // '' is an escaped literal quote, not the end of the label\n quotedText += \"'\"\n i++\n } else {\n break\n }\n }\n } else if (c === '[') {\n // a bracketed comment, which is where NHX (`[&&NHX:S=human]`) and BEAST\n // (`[&rate=1.0]`) hang their per-node metadata. Dropping it is what keeps\n // the `:` inside NHX from being read as a branch length, and the metadata\n // itself out of the leaf's name. Nesting is counted rather than assumed\n // away, so a comment holding a `[` does not end early\n for (let depth = 1; i < s.length - 1 && depth > 0;) {\n i++\n if (s[i] === '[') {\n depth++\n } else if (s[i] === ']') {\n depth--\n }\n }\n } else if (c === '(' || c === ')' || c === ',' || c === ':' || c === ';') {\n flush()\n out.push({ text: c, delim: true, quoted: false })\n } else {\n bare += c\n }\n }\n flush()\n return out\n}\n\nexport default function parseNewick(\n s: string,\n options: ParseNewickOptions = {},\n): NewickNode {\n const ancestors: NewickNode[] = []\n const tokens = tokenize(s)\n\n // asked of the delimiters rather than of the raw string: a leaf legitimately\n // named for a region (chr1:1-100) carries a colon of its own, and testing the\n // string flips a whole hclust tree into the phylo reading over it\n const { postParenNumeric = 'auto' } = options\n const numericIsLength =\n postParenNumeric === 'length' ||\n (postParenNumeric === 'auto' &&\n !tokens.some(t => t.delim && t.text === ':'))\n\n let tree: NewickNode = {}\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]!\n const subtree: NewickNode = {}\n if (token.delim) {\n switch (token.text) {\n case '(':\n tree.children = [subtree]\n ancestors.push(tree)\n tree = subtree\n break\n case ',':\n ancestors.at(-1)?.children?.push(subtree)\n tree = subtree\n break\n case ')':\n tree = ancestors.pop()!\n break\n default:\n // ':' and ';' are consumed by the label that follows them\n break\n }\n continue\n }\n const prev = i > 0 ? tokens[i - 1] : undefined\n const prevDelim = prev?.delim ? prev.text : undefined\n if (prevDelim === ':') {\n tree.length = Number.parseFloat(token.text)\n } else if (prevDelim === ')') {\n // the regex rather than a String(n) round-trip, so `1.50` and `1e-3` still\n // read as numbers\n if (numericIsLength && !token.quoted && NUMERIC_TOKEN.test(token.text)) {\n tree.length = Number.parseFloat(token.text)\n } else {\n tree.name = token.text\n }\n } else if (\n prevDelim === '(' ||\n prevDelim === ',' ||\n // nothing before it at all: the whole tree is one bare node (`A;`), which\n // is what a single-row input serializes to. Without this the name is\n // dropped, and a root leaf with no name matches no row.\n prevDelim === undefined\n ) {\n tree.name = token.text\n }\n }\n return tree\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["pushChildren", "stack", "node", "i", "descendants", "result", "forEachDescendant", "n", "cb", "leaves", "eachAfter", "node", "cb", "order", "stack", "n", "child", "computeHeight", "h", "hierarchy", "data", "childrenAccessor", "root", "kids", "d", "sum", "valueFn", "s", "sort", "compareFn", "find", "predicate", "pushChildren", "NUMERIC_TOKEN", "tokenize", "s", "out", "bare", "quotedText", "quoted", "flush", "text", "i", "depth", "parseNewick", "options", "ancestors", "tokens", "postParenNumeric", "numericIsLength", "t", "tree", "token", "subtree", "prev", "prevDelim"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./chunk-FY3BTKY4.js";var o=e((s,r)=>{r.exports=JBrowseExports["@mui/material"]});export{o as a};
2
+ //# sourceMappingURL=chunk-BX4Z274Q.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@mui/material"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@mui/material\"];"],
5
+ "mappings": "wCAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,eAAe",
6
+ "names": ["require_material", "__commonJSMin", "exports", "module"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-FY3BTKY4.js";var e=r((s,o)=>{o.exports=JBrowseExports["mobx-react"]});export{e as a};
2
+ //# sourceMappingURL=chunk-CVLB4VFP.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:mobx-react"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"mobx-react\"];"],
5
+ "mappings": "wCAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,YAAY",
6
+ "names": ["require_mobx_react", "__commonJSMin", "exports", "module"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-FY3BTKY4.js";var e=r((s,o)=>{o.exports=JBrowseExports["@jbrowse/core/ui"]});export{e as a};
2
+ //# sourceMappingURL=chunk-DNFD5II2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["global-externals:@jbrowse/core/ui"],
4
+ "sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/ui\"];"],
5
+ "mappings": "wCAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,kBAAkB",
6
+ "names": ["require_ui", "__commonJSMin", "exports", "module"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import{a as d}from"./chunk-P77DPK6B.js";import{a as b}from"./chunk-O7JNDIKD.js";import{d as S}from"./chunk-RTKNCGDF.js";import{a as x}from"./chunk-ZTQYZDWK.js";import{a as y}from"./chunk-5ORPTTMR.js";import{a as g}from"./chunk-BX4Z274Q.js";import{a as w}from"./chunk-J6KYLXRD.js";import{b as s}from"./chunk-FY3BTKY4.js";var l=s(w(),1),E=s(y(),1),a=s(g(),1),j=(0,E.makeStyles)()({key:{fontWeight:"bold",verticalAlign:"top"},value:{whiteSpace:"pre-wrap",wordBreak:"break-word"}});function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function B(e){return k(e)&&Object.keys(e).length===0}function A({record:e}){let{classes:o}=j();return l.default.createElement(a.Table,{size:"small"},l.default.createElement(a.TableBody,null,Object.entries(e).filter(([,t])=>t!=null&&!B(t)).map(([t,r])=>l.default.createElement(a.TableRow,{key:t},l.default.createElement(a.TableCell,{component:"th",className:o.key},t),l.default.createElement(a.TableCell,{className:o.value},k(r)?l.default.createElement(A,{record:r}):Array.isArray(r)?r.join(`
2
+ `):String(r))))))}var n=s(w(),1),C=s(y(),1),f=s(g(),1);var F=(0,C.makeStyles)()(e=>({textAreaFont:{fontFamily:"Courier New",wordWrap:"break-word"},dialogContent:{background:e.palette.action.selected,margin:4}})),N=100,$=2e5;function T([e,o],t){return`>${e}
3
+ ${t?o:S(o)}`}function G(e){return!/[^.-]/.test(e)}function O(e,o){let t=[],r=0;for(let c of e){if(t.length>=N||r>=$)break;let i=T(c,o);t.push(i),r+=i.length+1}return{text:t.join(`
4
+ `),hidden:e.length-t.length}}function W({str:e}){let{classes:o}=F(),[t,r]=(0,n.useState)(!1),[c,i]=(0,n.useState)(!1),m=c?e:e.filter(([,p])=>t?!!p:!G(p)),{text:R,hidden:u}=O(m,t),h=()=>m.map(p=>T(p,t)).join(`
5
+ `);return n.default.createElement(n.default.Fragment,null,n.default.createElement(x,{text:h}),n.default.createElement(f.Button,{onClick:()=>{b(new Blob([h()],{type:"text/plain"}),"sequences.fasta")}},"Download"),n.default.createElement(d,{label:"Show gaps",checked:t,onChange:()=>{r(!t)}}),n.default.createElement(d,{label:"Show empty",checked:c,onChange:()=>{i(!c)}}),n.default.createElement(f.TextField,{variant:"outlined",multiline:!0,className:o.dialogContent,minRows:5,maxRows:10,fullWidth:!0,value:R,helperText:u>0?`Showing ${m.length-u} of ${m.length.toLocaleString()} sequences. ${u.toLocaleString()} more are in the copy and the download.`:void 0,slotProps:{input:{readOnly:!0,className:o.textAreaFont}}}))}export{B as a,A as b,W as c};
6
+ //# sourceMappingURL=chunk-ENTWPX2K.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/.pnpm/react-msaview@8.4.1_35cd7d1fa06820f3dff395dec9803110/node_modules/react-msaview/src/components/MetadataTable.tsx", "../../node_modules/.pnpm/react-msaview@8.4.1_35cd7d1fa06820f3dff395dec9803110/node_modules/react-msaview/src/components/SequenceTextArea.tsx"],
4
+ "sourcesContent": ["import React from 'react'\n\nimport { makeStyles } from '@jbrowse/core/util/tss-react'\nimport { Table, TableBody, TableCell, TableRow } from '@mui/material'\n\nconst useStyles = makeStyles()({\n key: {\n fontWeight: 'bold',\n verticalAlign: 'top',\n },\n value: {\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n },\n})\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function isEmpty(value: unknown) {\n return isRecord(value) && Object.keys(value).length === 0\n}\n\nexport default function MetadataTable({\n record,\n}: {\n record: Record<string, unknown>\n}) {\n const { classes } = useStyles()\n return (\n <Table size=\"small\">\n <TableBody>\n {Object.entries(record)\n .filter(([, value]) => value != null && !isEmpty(value))\n .map(([key, value]) => (\n <TableRow key={key}>\n <TableCell component=\"th\" className={classes.key}>\n {key}\n </TableCell>\n <TableCell className={classes.value}>\n {isRecord(value) ? (\n <MetadataTable record={value} />\n ) : Array.isArray(value) ? (\n value.join('\\n')\n ) : (\n String(value)\n )}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n )\n}\n", "import React, { useState } from 'react'\n\nimport { makeStyles } from '@jbrowse/core/util/tss-react'\nimport { Button, TextField } from '@mui/material'\nimport { getUngappedSequence } from 'msa-parsers'\n\nimport { saveAs } from '../vendor/fileSaver.ts'\nimport Checkbox2 from './Checkbox2.tsx'\nimport CopyButton from './CopyButton.tsx'\n\nconst useStyles = makeStyles()(theme => ({\n textAreaFont: {\n fontFamily: 'Courier New',\n wordWrap: 'break-word',\n },\n dialogContent: {\n background: theme.palette.action.selected,\n margin: 4,\n },\n}))\n\nexport const maxShownRecords = 100\nexport const maxShownChars = 200_000\n\nfunction fastaRecord([name, seq]: [string, string], showGaps: boolean) {\n return `>${name}\\n${showGaps ? seq : getUngappedSequence(seq)}`\n}\n\nfunction isAllGaps(seq: string) {\n return !/[^.-]/.test(seq)\n}\n\n/**\n * The first records of `rows` as FASTA, up to `maxShownRecords` records or\n * `maxShownChars` characters, whichever comes first. A textarea holding every\n * row of a large alignment freezes the page.\n */\nexport function fastaPreview(rows: [string, string][], showGaps: boolean) {\n const shown: string[] = []\n let chars = 0\n for (const row of rows) {\n if (shown.length >= maxShownRecords || chars >= maxShownChars) {\n break\n }\n const record = fastaRecord(row, showGaps)\n shown.push(record)\n chars += record.length + 1\n }\n return { text: shown.join('\\n'), hidden: rows.length - shown.length }\n}\n\nexport default function SequenceTextArea({ str }: { str: [string, string][] }) {\n const { classes } = useStyles()\n const [showGaps, setShowGaps] = useState(false)\n const [showEmpty, setShowEmpty] = useState(false)\n\n const rows = showEmpty\n ? str\n : str.filter(([, seq]) => (showGaps ? !!seq : !isAllGaps(seq)))\n const { text, hidden } = fastaPreview(rows, showGaps)\n const fullText = () => rows.map(row => fastaRecord(row, showGaps)).join('\\n')\n return (\n <>\n <CopyButton text={fullText} />\n <Button\n onClick={() => {\n saveAs(\n new Blob([fullText()], { type: 'text/plain' }),\n 'sequences.fasta',\n )\n }}\n >\n Download\n </Button>\n <Checkbox2\n label=\"Show gaps\"\n checked={showGaps}\n onChange={() => {\n setShowGaps(!showGaps)\n }}\n />\n <Checkbox2\n label=\"Show empty\"\n checked={showEmpty}\n onChange={() => {\n setShowEmpty(!showEmpty)\n }}\n />\n <TextField\n variant=\"outlined\"\n multiline\n className={classes.dialogContent}\n minRows={5}\n maxRows={10}\n fullWidth\n value={text}\n helperText={\n hidden > 0\n ? `Showing ${rows.length - hidden} of ${rows.length.toLocaleString()} sequences. ${hidden.toLocaleString()} more are in the copy and the download.`\n : undefined\n }\n slotProps={{\n input: {\n readOnly: true,\n className: classes.textAreaFont,\n },\n }}\n />\n </>\n )\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["import_react", "import_tss_react", "import_material", "useStyles", "isRecord", "value", "isEmpty", "MetadataTable", "record", "classes", "React", "key", "import_react", "import_tss_react", "import_material", "useStyles", "theme", "maxShownRecords", "maxShownChars", "fastaRecord", "name", "seq", "showGaps", "getUngappedSequence", "isAllGaps", "fastaPreview", "rows", "shown", "chars", "row", "record", "SequenceTextArea", "str", "classes", "setShowGaps", "showEmpty", "setShowEmpty", "text", "hidden", "fullText", "React", "CopyButton", "saveAs", "Checkbox2"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var l=["stack","splitRight","newTab"],a="splitRight",i="msaView-launchPlacement";function n(e,t){return t in e&&typeof e[t]=="function"}var r=!1;function w(e){return n(e,"setUseWorkspaces")&&n(e,"setPendingMove")}function p(e){let t=n(e,"setUseWorkspaces"),s=n(e,"setPendingMove");return t!==s&&!r&&(r=!0,console.warn(`jbrowse-plugin-msaview: this session supports workspaces but not ${s?"setUseWorkspaces":"setPendingMove"}, so the MSA view was stacked instead of tiled. Expected on releases through v4.3.0, which place views through @jbrowse/app-core instead; on a newer host it means the session API moved and the plugin needs updating to match.`)),t&&s}function c(e,t,s){s==="stack"||!p(e)||(e.setPendingMove({type:s,viewId:t}),e.setUseWorkspaces(!0))}function u(e){return l.includes(e)}function M(){try{let e=globalThis.localStorage.getItem(i);return u(e)?e:a}catch(e){return console.error(e),a}}function d(e){try{globalThis.localStorage.setItem(i,e)}catch(t){console.error(t)}}async function P(e,{placement:t="stack",...s}){let o=await e.launchView("MsaView",{type:"MsaView",...s});return c(e,o.id,t),o}export{w as a,M as b,d as c,P as d};
2
+ //# sourceMappingURL=chunk-EO7URJUB.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/workspaces.ts", "../../src/utils/launchMsaView.ts"],
4
+ "sourcesContent": ["import type { AbstractSessionModel } from '@jbrowse/core/util'\n\n/**\n * Where a launched MSA view lands. Every launch names one of these and stops\n * there, so a host that arranges views differently is one function to teach.\n *\n * stack append below whatever is on screen\n * splitRight its own cell to the right, beside the view it is connected to\n * newTab its own tab in the current cell\n */\nexport type MsaViewPlacement = 'stack' | 'splitRight' | 'newTab'\n\nconst PLACEMENTS: MsaViewPlacement[] = ['stack', 'splitRight', 'newTab']\n\n/**\n * What the dialog does unasked. Side-by-side, because a launch from a gene\n * feature sets `connectedViewId`: the pair shares a hover and a highlight, and\n * reads as a split. A session spec defaults to `stack` instead.\n */\nexport const DEFAULT_LAUNCH_PLACEMENT: MsaViewPlacement = 'splitRight'\n\nexport const LAUNCH_PLACEMENT_KEY = 'msaView-launchPlacement'\n\n/**\n * The session actions that place a view in a tiled workspace. Only jbrowse-web\n * and desktop have them, so feature-detect rather than import.\n */\ninterface SessionWithWorkspaces {\n setUseWorkspaces: (useWorkspaces: boolean) => void\n setPendingMove: (move: {\n type: 'newTab' | 'splitRight'\n viewId: string\n }) => void\n}\n\nfunction hasAction(session: AbstractSessionModel, name: string) {\n return (\n name in session &&\n typeof (session as unknown as Record<string, unknown>)[name] === 'function'\n )\n}\n\n// Warned at most once. This is a property of the host, so the answer is the\n// same on every launch and a dialog the user reopens should not stack up noise.\nlet warnedPartial = false\n\nexport function resetWorkspacesWarning() {\n warnedPartial = false\n}\n\n/**\n * Whether this host can honor anything other than `stack`. Silent: the dialog\n * asks on every render, and only a launch is worth warning about.\n */\nexport function sessionSupportsPlacement(session: AbstractSessionModel) {\n return (\n hasAction(session, 'setUseWorkspaces') &&\n hasAction(session, 'setPendingMove')\n )\n}\n\nfunction isSessionWithWorkspaces(\n session: AbstractSessionModel,\n): session is AbstractSessionModel & SessionWithWorkspaces {\n const canEnable = hasAction(session, 'setUseWorkspaces')\n const canPlace = hasAction(session, 'setPendingMove')\n\n // Missing BOTH is an embedded session: it has no workspaces, there is nothing\n // to ask for, and silence is the right answer.\n //\n // Missing ONE is a host that has workspaces but places views some other way,\n // and silence there is how the same feature broke in jbrowse-plugin-protein3d\n // \u2014 jbrowse-web folded `setPendingMove` into its layout `init`, the guard went\n // false, and the plugin simply stopped asking: no error, no missing feature,\n // two views quietly stacking, nobody noticed for weeks. Feature detection\n // cannot ask a host to announce a change, but it can tell \"not supported here\"\n // from \"supported, and gone\".\n //\n // Two very different hosts produce this one shape and nothing on the session\n // tells them apart, so the message carries both rather than a guess:\n //\n // - releases through v4.3.0, where placement is `setPendingMoveToSplitRight`,\n // a module function in @jbrowse/app-core rather than a session action.\n // Nothing is wrong and nothing needs fixing\n // - a newer host that moved the action out from under us, which is the\n // regression this warning exists to catch\n //\n // Do not quiet the first case by sniffing the version. The alarm is only worth\n // having if it fires on a shape it cannot explain, and these two are identical.\n if (canEnable !== canPlace && !warnedPartial) {\n warnedPartial = true\n console.warn(\n `jbrowse-plugin-msaview: this session supports workspaces but not ` +\n `${canPlace ? 'setUseWorkspaces' : 'setPendingMove'}, so the MSA view ` +\n `was stacked instead of tiled. Expected on releases through v4.3.0, ` +\n `which place views through @jbrowse/app-core instead; on a newer host ` +\n `it means the session API moved and the plugin needs updating to match.`,\n )\n }\n return canEnable && canPlace\n}\n\n/**\n * Put a freshly added view where the launch said to. `stack` is a placement\n * rather than the absence of one, so no caller has to ask what host it is on.\n */\nexport function placeMsaView(\n session: AbstractSessionModel,\n viewId: string,\n placement: MsaViewPlacement,\n) {\n if (placement === 'stack' || !isSessionWithWorkspaces(session)) {\n return\n }\n session.setPendingMove({ type: placement, viewId })\n // Session-scoped: turning workspaces on for this session leaves the user's\n // own default alone, which is what `setUseWorkspaces` (as against\n // `setUseWorkspacesPreference`) is for.\n session.setUseWorkspaces(true)\n}\n\nfunction isPlacement(value: unknown): value is MsaViewPlacement {\n return PLACEMENTS.includes(value as MsaViewPlacement)\n}\n\n/**\n * The dialog's own remembered choice \u2014 not the host's preferences system, which\n * records whether the user likes workspaces and does not exist everywhere.\n */\nexport function readLaunchPlacement(): MsaViewPlacement {\n try {\n const stored = globalThis.localStorage.getItem(LAUNCH_PLACEMENT_KEY)\n return isPlacement(stored) ? stored : DEFAULT_LAUNCH_PLACEMENT\n } catch (error) {\n console.error(error)\n return DEFAULT_LAUNCH_PLACEMENT\n }\n}\n\nexport function writeLaunchPlacement(placement: MsaViewPlacement) {\n try {\n globalThis.localStorage.setItem(LAUNCH_PLACEMENT_KEY, placement)\n } catch (error) {\n console.error(error)\n }\n}\n", "import { placeMsaView } from './workspaces'\n\nimport type { MsaViewPlacement } from './workspaces'\nimport type { AbstractSessionModel } from '@jbrowse/core/util'\n\n/**\n * A launch, stated: what the view is, and where it goes. Everything but\n * `placement` is a react-msaview or plugin-model snapshot property, passed\n * through untouched so this never becomes a list that has to grow.\n */\nexport interface MsaViewLaunchSpec extends Record<string, unknown> {\n /** default `stack`, the only thing an embedded session can do */\n placement?: MsaViewPlacement\n}\n\n/**\n * The one place a launch adds an MSA view -- the dialog's four tabs, the Add\n * menu, and the `LaunchView-MsaView` extension point a session spec arrives on\n * all come through here. Each of them used to run its own `addView` and none\n * placed the result, which is how a launch from a gene feature landed stacked\n * under the very genome view it was connected to.\n */\nexport async function launchMsaView(\n session: AbstractSessionModel,\n { placement = 'stack', ...snapshot }: MsaViewLaunchSpec,\n) {\n const view = await session.launchView('MsaView', {\n type: 'MsaView',\n ...snapshot,\n })\n placeMsaView(session, view.id, placement)\n return view\n}\n"],
5
+ "mappings": "AAYA,IAAMA,EAAiC,CAAC,QAAS,aAAc,QAAQ,EAO1DC,EAA6C,aAE7CC,EAAuB,0BAcpC,SAASC,EAAUC,EAA+BC,EAAc,CAC9D,OACEA,KAAQD,GACR,OAAQA,EAA+CC,CAAI,GAAM,UAErE,CAIA,IAAIC,EAAgB,GAUb,SAASC,EAAyBC,EAA+B,CACtE,OACEC,EAAUD,EAAS,kBAAkB,GACrCC,EAAUD,EAAS,gBAAgB,CAEvC,CAEA,SAASE,EACPF,EACyD,CACzD,IAAMG,EAAYF,EAAUD,EAAS,kBAAkB,EACjDI,EAAWH,EAAUD,EAAS,gBAAgB,EAwBpD,OAAIG,IAAcC,GAAY,CAACC,IAC7BA,EAAgB,GAChB,QAAQ,KACN,oEACKD,EAAW,mBAAqB,gBAAgB,kOAIvD,GAEKD,GAAaC,CACtB,CAMO,SAASE,EACdN,EACAO,EACAC,EACA,CACIA,IAAc,SAAW,CAACN,EAAwBF,CAAO,IAG7DA,EAAQ,eAAe,CAAE,KAAMQ,EAAW,OAAAD,CAAO,CAAC,EAIlDP,EAAQ,iBAAiB,EAAI,EAC/B,CAEA,SAASS,EAAYC,EAA2C,CAC9D,OAAOC,EAAW,SAASD,CAAyB,CACtD,CAMO,SAASE,GAAwC,CACtD,GAAI,CACF,IAAMC,EAAS,WAAW,aAAa,QAAQC,CAAoB,EACnE,OAAOL,EAAYI,CAAM,EAAIA,EAASE,CACxC,OAASC,EAAO,CACd,eAAQ,MAAMA,CAAK,EACZD,CACT,CACF,CAEO,SAASE,EAAqBT,EAA6B,CAChE,GAAI,CACF,WAAW,aAAa,QAAQM,EAAsBN,CAAS,CACjE,OAASQ,EAAO,CACd,QAAQ,MAAMA,CAAK,CACrB,CACF,CC3HA,eAAsBE,EACpBC,EACA,CAAE,UAAAC,EAAY,QAAS,GAAGC,CAAS,EACnC,CACA,IAAMC,EAAO,MAAMH,EAAQ,WAAW,UAAW,CAC/C,KAAM,UACN,GAAGE,CACL,CAAC,EACD,OAAAE,EAAaJ,EAASG,EAAK,GAAIF,CAAS,EACjCE,CACT",
6
+ "names": ["PLACEMENTS", "DEFAULT_LAUNCH_PLACEMENT", "LAUNCH_PLACEMENT_KEY", "hasAction", "session", "name", "warnedPartial", "sessionSupportsPlacement", "session", "hasAction", "isSessionWithWorkspaces", "canEnable", "canPlace", "warnedPartial", "placeMsaView", "viewId", "placement", "isPlacement", "value", "PLACEMENTS", "readLaunchPlacement", "stored", "LAUNCH_PLACEMENT_KEY", "DEFAULT_LAUNCH_PLACEMENT", "error", "writeLaunchPlacement", "launchMsaView", "session", "placement", "snapshot", "view", "placeMsaView"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{b as te,d as Pe,e as St}from"./chunk-73KAPCJ2.js";import{a as _n}from"./chunk-BX4Z274Q.js";import{a as le}from"./chunk-J6KYLXRD.js";import{a as $e,b as N}from"./chunk-FY3BTKY4.js";var Tt=$e((lr,kt)=>{kt.exports=JBrowseExports.mobx});var En=$e((Gi,Hn)=>{Hn.exports=JBrowseExports["react-dom"]});var Fn=$e((Xi,An)=>{An.exports=JBrowseExports["react-dom/client"]});var S=N(le(),1),In=N(Tt(),1);function De({model:e,offsetY:t,blockSizeY:o}){let{rowHeight:n}=e;return{yStart:Math.max(0,Math.floor((t-n)/n)),yEnd:Math.max(0,Math.ceil((t+o+n)/n))}}function $({model:e,offsetY:t,blockSizeY:o}){let{yStart:n,yEnd:r}=De({model:e,offsetY:t,blockSizeY:o});return e.leaves.slice(n,r)}var X=N(le(),1);var ce=N(le(),1),Ct=N(_n(),1);var ne=N(le(),1);function Mt(e,t){let o=(0,ne.useRef)(!1),[n,r]=(0,ne.useState)();return(0,ne.useEffect)(()=>{if(n!==void 0){let s=function(c){o.current||(o.current=!0,requestAnimationFrame(()=>{let u=e==="x"?c.clientX:c.clientY;t(u-a,i),o.current=!1}))},l=function(){r(void 0)},{client:a,startScroll:i}=n;return document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l)}}},[e,t,n]),{dragging:n!==void 0,startDrag:(a,i)=>{r({client:e==="x"?a.clientX:a.clientY,startScroll:i})}}}var we="rgba(66,119,127,0.3)",xe=4,Gn={thumb:{fill:()=>we,fillHovered:()=>"rgba(66,119,127,0.6)",cursor:()=>"pointer",position:"absolute",zIndex:100},resizer:{fill:e=>e.palette.mode==="dark"?e.palette.grey[800]:"rgba(200,200,200)",fillHovered:e=>e.palette.mode==="dark"?e.palette.grey[600]:"rgba(150,150,150)",cursor:e=>e==="x"?"ew-resize":"ns-resize",position:"relative"}};function Xn({axis:e,variant:t,getStart:o,onDrag:n,style:r}){let a=(0,Ct.useTheme)(),[i,s]=(0,ce.useState)(!1),{startDrag:l}=Mt(e,n),{fill:c,fillHovered:u,cursor:h,position:d,zIndex:f}=Gn[t];return ce.default.createElement("div",{...t==="resizer"&&{role:"separator","aria-orientation":e==="x"?"vertical":"horizontal"},onMouseEnter:()=>{s(!0)},onMouseLeave:()=>{s(!1)},onMouseDown:g=>{l(g,o())},style:{position:d,zIndex:f,cursor:h(e),background:i?u(a):c(a),...r}},t==="resizer"?ce.default.createElement("div",{style:{position:"absolute",zIndex:101,...e==="x"?{top:0,bottom:0,left:-xe,right:-xe}:{left:0,right:0,top:-xe,bottom:-xe}}}):null)}function ye(e){let{dynamicColorSchemeName:t}=e;if(t==="clustalx_protein_dynamic"){let{colClustalX:n}=e;return(r,a)=>n[r][a]}if(t==="percent_identity_dynamic"){let{colConsensus:n}=e;return(r,a)=>{let i=n[r];return a===i.letter?i.color:void 0}}let{colorScheme:o}=e;return(n,r)=>o[r]}function Rt(e){let{dynamicColorSchemeName:t}=e;return t==="clustalx_protein_dynamic"?e.colClustalX:t==="percent_identity_dynamic"?e.colConsensus:e.colorScheme}var oe=512,Un=64,Vn=2e3,jn=4096,fe=new Uint8Array(new Uint32Array([1]).buffer)[0]===1;function Ft(e,t,o,n){return fe?(n<<24|o<<16|t<<8|e)>>>0:(e<<24|t<<16|o<<8|n)>>>0}var Z,ve=new Map;function qn(e){let t=ve.get(e);if(t!==void 0)return t;Z===void 0&&(Z=_e(1,1)?.ctx??null);let o=0;if(Z){Z.clearRect(0,0,1,1),Z.fillStyle=e,Z.fillRect(0,0,1,1);let[n=0,r=0,a=0,i=0]=Z.getImageData(0,0,1,1).data;o=Ft(n,r,a,i)}return ve.size>=jn&&ve.clear(),ve.set(e,o),o}function zt(e,t){let{columns:o,relativeTo:n,colorAt:r,bg:a,hover:i}=e,s=t(a),l=t(i),c=n?o.get(n):void 0;return(u,h,d)=>{if(c&&u!==n&&d===c[h])return l;let f=r(h,d);return f===void 0?s:t(f)}}function Ne({spec:e,col0:t,row0:o,width:n,height:r,colStep:a=1,rowStep:i=1,colSpan:s=1,rowSpan:l=1,toPixel:c=qn,out:u=new Uint32Array(n*r)}){if(s>1||l>1)return Zn({spec:e,col0:t,row0:o,width:n,height:r,colSpan:s,rowSpan:l,toPixel:c,out:u}),u;let{rowNames:h,columns:d}=e,f=zt(e,c);for(let g=0;g<r;g++){let b=h[o+g*i];if(b===void 0)break;let p=d.get(b);if(!p)continue;let x=g*n;for(let m=0;m<n;m++){let y=t+m*a,w=p[y];if(w===void 0)break;u[x+m]=f(b,y,w)}}return u}function Zn({spec:e,col0:t,row0:o,width:n,height:r,colSpan:a,rowSpan:i,toPixel:s,out:l}){let{rowNames:c,columns:u}=e,h=zt(e,s),d=a*i,f=fe?0:24,g=fe?8:16,b=fe?16:8,p=fe?24:0,x=[],m=[];for(let y=0;y<r;y++){x.length=0,m.length=0;for(let v=0;v<i;v++){let k=c[o+y*i+v],T=k===void 0?void 0:u.get(k);k!==void 0&&T&&(x.push(k),m.push(T))}let w=y*n;for(let v=0;v<n;v++){let k=0,T=0,R=0,M=0;for(let C=0;C<m.length;C++){let W=m[C],F=x[C];for(let Q=0;Q<a;Q++){let z=t+v*a+Q,O=W[z];if(O===void 0)break;let I=h(F,z,O),B=I>>>p&255;k+=(I>>>f&255)*B,T+=(I>>>g&255)*B,R+=(I>>>b&255)*B,M+=B}}l[w+v]=M===0?0:Ft(Math.round(k/M),Math.round(T/M),Math.round(R/M),Math.round(M/d))}}}function Jn(e){let t=e;return!!t&&typeof t.createImageData=="function"&&typeof t.putImageData=="function"&&typeof t.getImageData=="function"&&typeof t.clearRect=="function"&&typeof t.fillRect=="function"}function _e(e,t){let o=typeof OffscreenCanvas<"u"?new OffscreenCanvas(e,t):typeof document<"u"?Object.assign(document.createElement("canvas"),{width:e,height:t}):void 0,n=o?.getContext("2d",{willReadFrequently:!0});return Jn(n)?{canvas:o,ctx:n}:void 0}function Ge(e,t,o){let n=_e(e,t);if(!n)return;let r=n.ctx.createImageData(e,t);return o(new Uint32Array(r.data.buffer)),n.ctx.putImageData(r,0,0),n.canvas}var Lt;function Bt(){return Lt??=!!_e(1,1),Lt}var Ht=new WeakMap;function Kn(e,t){return[e.columns,e.leaves,e.colorSchemeName,e.customColorScheme,Rt(e),e.relativeTo,t.palette.action.hover,t.palette.background.default]}function Xe(e,t){let o=Kn(e,t),n=Ht.get(e);if(n&&o.every((a,i)=>a===n.keys[i]))return n;let r={keys:o,spec:{rowNames:e.leaves.map(a=>a.data.name),columns:e.columns,relativeTo:e.relativeTo,colorAt:ye(e),bg:t.palette.background.default,hover:t.palette.action.hover},numColumns:e.numColumns,numRows:e.numRows,tiles:new Map};return Ht.set(e,r),r}function Et(e){return e>=1?1:2**Math.ceil(Math.log2(1/e))}function Qn({cache:e,tileRow:t,tileCol:o,colSpan:n,rowSpan:r}){let a=`${n}_${r}_${t}_${o}`,i=e.tiles.get(a);if(i)return e.tiles.delete(a),e.tiles.set(a,i),i;let s=o*oe*n,l=t*oe*r,c=Math.min(oe,Math.ceil((e.numColumns-s)/n)),u=Math.min(oe,Math.ceil((e.numRows-l)/r));if(c<=0||u<=0)return;let h=Ge(c,u,d=>{Ne({spec:e.spec,col0:s,row0:l,width:c,height:u,colSpan:n,rowSpan:r,out:d})});if(h){e.tiles.set(a,h);for(let d of e.tiles.keys()){if(e.tiles.size<=Un)break;e.tiles.delete(d)}return h}}function gr({ctx:e,model:t,theme:o,offsetX:n,offsetY:r}){let{colWidth:a,rowHeight:i,blockSize:s,highResScaleFactor:l}=t,c=Xe(t,o),u=Et(a*l),h=Et(i*l);e.resetTransform(),e.scale(l,l),e.translate(-n,-r),e.imageSmoothingEnabled=!1;let d=a*u,f=i*h,g=oe*d,b=oe*f,p=Math.max(0,Math.floor(n/g)),x=Math.floor((n+s)/g),m=Math.max(0,Math.floor(r/b)),y=Math.floor((r+s)/b);for(let w=m;w<=y;w++)for(let v=p;v<=x;v++){let k=Qn({cache:c,tileRow:w,tileCol:v,colSpan:u,rowSpan:h});k&&e.drawImage(k,0,0,k.width,k.height,v*g,w*b,k.width*d,k.height*f)}e.resetTransform(),e.imageSmoothingEnabled=!0}function Ue(e){if(e)try{if("toDataURL"in e&&typeof e.toDataURL=="function")return e.toDataURL("image/png");if(typeof document>"u")return;let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let o=t.getContext("2d");return typeof o?.drawImage!="function"?void 0:(o.drawImage(e,0,0),t.toDataURL("image/png"))}catch{return}}var Yn=64e6,At=16384;function Wt({model:e,theme:t,col0:o,row0:n,numCols:r,numRows:a}){if(r<=0||a<=0||typeof document>"u")return;let i=Xe(e,t),s=1,l=1;for(;Math.ceil(r/s)>At;)s*=2;for(;Math.ceil(a/l)>At;)l*=2;for(;Math.ceil(r/s)*Math.ceil(a/l)>Yn;)r/s>=a/l?s*=2:l*=2;let c=Math.ceil(r/s),u=Math.ceil(a/l);return Ue(Ge(c,u,h=>{Ne({spec:i.spec,col0:o,row0:n,width:c,height:u,colSpan:s,rowSpan:l,out:h})}))}function Ot({model:e,theme:t,height:o}){let n=Xe(e,t),{numColumns:r,numRows:a}=n;if(!(r<=0||a<=0)){if(n.thumbnail?.height!==o){let i=Math.max(1,Math.ceil(r/Vn)),s=Math.max(1,Math.ceil(a/o)),l=Math.ceil(r/i),c=Math.ceil(a/s);n.thumbnail={height:o,canvas:Ge(l,c,u=>{Ne({spec:n.spec,col0:0,row0:0,width:l,height:c,colStep:i,rowStep:s,out:u})})}}return n.thumbnail.canvas}}function It(e){let{scrollX:t,minimapHeight:o,totalWidth:n,msaCanvasWidth:r}=e,a=n>0?r/n:0,i=-t*a,s=Math.min(r,Math.max(r*a,20)),l=o-12,c=`${i+s},0 ${i},0 0,${l} ${r},${l}`;return{unit:a,s:i,w:s,polygonHeight:l,polygonPoints:c}}function Ve({model:e,theme:t}){let{msaCanvasWidth:o}=e,{s:n,w:r,polygonPoints:a}=It(e),i=Ue(Ot({model:e,theme:t,height:12}));return X.default.createElement(X.default.Fragment,null,i?X.default.createElement("image",{href:i,x:0,y:0,width:o,height:12,preserveAspectRatio:"none"}):null,X.default.createElement("rect",{x:0,y:0,width:o,height:12,stroke:t.palette.text.secondary,fill:"none"}),X.default.createElement("rect",{x:Math.max(0,n),y:0,width:r,height:12,fill:we,stroke:t.palette.text.secondary}),X.default.createElement("g",{transform:`translate(0 ${12})`},X.default.createElement("polygon",{fill:we,points:a})))}function Se(e){let t=e.length>1;return e.flatMap(o=>[...t?[{key:o.id,label:o.title}]:[],...o.entries.map(n=>({key:`${o.id}:${n.id}`,label:n.label,color:n.color,hint:n.id}))])}var kr=new Set(["exon","CDS","five_prime_UTR","three_prime_UTR","UTR","intron"]),Tr=["#9fb6d4","#d4dcea"],Mr=!0,Cr=!1,Rr=["both","horizontal","vertical"],Lr="both",Hr=8,Er=5,$t=9,Ar=16,Fr=.2,zr=1,Br=80,Wr=!0,Or="maeditor",Ir=!0,$r=!0,Pr=!1,Dr=400,Nr=300,_r=!0,Gr=["branchLength","input","ladderize","ladderizeReverse"],Xr="branchLength",Ur=!0,Vr=!0,jr=!1,qr=!1,Zr=120,Jr=500,Kr=.25,Qr="#fff3c4",Yr=.6,ea=5e4,Pt=56,je=22,ta=200,eo=1e3,na=eo+1;for(Vt={grad:.9,turn:360,rad:360/(2*Math.PI)},P=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},H=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=Math.pow(10,t)),Math.round(o*e)/o+0},A=function(e,t,o){return t===void 0&&(t=0),o===void 0&&(o=1),e>o?o:e>t?e:t},et=function(e){return(e=isFinite(e)?e%360:0)<0?e+360:e},Me=function(e,t){return t===void 0&&(t=0),H(e,t)%360},Je=function(e){return{r:A(e.r,0,255),g:A(e.g,0,255),b:A(e.b,0,255),a:A(e.a)}},Te=function(e){return{r:H(e.r),g:H(e.g),b:H(e.b),a:H(e.a,3)}},jt=/^#([0-9a-f]{3,8})$/i,J=function(e,t){var o=e.charCodeAt(t);return(15&o)+9*(o>>6)},de=function(e,t){return J(e,t)<<4|J(e,t+1)},Ke=[],he=0;he<256;he++)Ke.push((he<16?"0":"")+he.toString(16));var Vt,P,H,A,et,Me,Je,Te,jt,J,de,Ke,he,ke=function(e){return Ke[A(e,0,255)]},qt=function(e){var t=e.r,o=e.g,n=e.b,r=e.a,a=Math.max(t,o,n),i=a-Math.min(t,o,n),s=i?a===t?(o-n)/i:a===o?2+(n-t)/i:4+(t-o)/i:0;return{h:60*(s<0?s+6:s),s:a?i/a*100:0,v:a/255*100,a:r}},Zt=function(e){var t=e.h,o=e.s,n=e.v,r=e.a;t=t/360*6,o/=100,n/=100;var a=Math.floor(t),i=n*(1-o),s=n*(1-(t-a)*o),l=n*(1-(1-t+a)*o),c=a%6;return{r:255*[n,s,i,i,l,n][c],g:255*[l,n,n,s,i,i][c],b:255*[i,i,l,n,n,s][c],a:r}},Dt=function(e){return{h:et(e.h),s:A(e.s,0,100),l:A(e.l,0,100),a:A(e.a)}},Nt=function(e){return{h:Me(e.h),s:H(e.s),l:H(e.l),a:H(e.a,3)}},_t=function(e){return Zt((o=(t=e).s,{h:t.h,s:(o*=((n=t.l)<50?n:100-n)/100)>0?2*o/(n+o)*100:0,v:n+o,a:t.a}));var t,o,n},re=function(e){return{h:(t=qt(e)).h,s:(r=(200-(o=t.s))*(n=t.v)/100)>0&&r<200?o*n/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,o,n,r},to=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,no=/^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,oo=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,ro=/^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i,Qe={string:[[function(e){if(!jt.test(e))return null;var t=e.length;return t<=5?{r:17*J(e,1),g:17*J(e,2),b:17*J(e,3),a:t===5?H(17*J(e,4)/255,2):1}:t===7||t===9?{r:de(e,1),g:de(e,3),b:de(e,5),a:t===9?H(de(e,7)/255,2):1}:null},"hex"],[function(e){var t=oo.exec(e)||ro.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Je({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=to.exec(e)||no.exec(e);if(!t)return null;var o,n,r=Dt({h:(o=t[1],n=t[2],n===void 0&&(n="deg"),Number(o)*(Vt[n]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return _t(r)},"hsl"]],object:[[function(e){var t=e.r,o=e.g,n=e.b,r=e.a,a=r===void 0?1:r;return P(t)&&P(o)&&P(n)?Je({r:Number(t),g:Number(o),b:Number(n),a:Number(a)}):null},"rgb"],[function(e){var t=e.h,o=e.s,n=e.l,r=e.a,a=r===void 0?1:r;if(!P(t)||!P(o)||!P(n))return null;var i=Dt({h:Number(t),s:Number(o),l:Number(n),a:Number(a)});return _t(i)},"hsl"],[function(e){var t=e.h,o=e.s,n=e.v,r=e.a,a=r===void 0?1:r;if(!P(t)||!P(o)||!P(n))return null;var i=(function(s){return{h:et(s.h),s:A(s.s,0,100),v:A(s.v,0,100),a:A(s.a)}})({h:Number(t),s:Number(o),v:Number(n),a:Number(a)});return Zt(i)},"hsv"]]},Gt=function(e,t){for(var o=0;o<t.length;o++){var n=t[o][0](e);if(n)return[n,t[o][1]]}return[null,void 0]},ao=function(e){return typeof e=="string"?Gt(e.trim(),Qe.string):typeof e=="object"&&e!==null?Gt(e,Qe.object):[null,void 0]};var qe=function(e,t){var o=re(e);return{h:o.h,s:A(o.s+100*t,0,100),l:o.l,a:o.a}},Ze=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Xt=function(e,t){var o=re(e);return{h:o.h,s:o.s,l:A(o.l+100*t,0,100),a:o.a}},Ye=(function(){function e(t){this.parsed=ao(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return H(Ze(this.rgba),2)},e.prototype.isDark=function(){return Ze(this.rgba)<.5},e.prototype.isLight=function(){return Ze(this.rgba)>=.5},e.prototype.toHex=function(){return t=Te(this.rgba),o=t.r,n=t.g,r=t.b,i=(a=t.a)<1?ke(H(255*a)):"","#"+ke(o)+ke(n)+ke(r)+i;var t,o,n,r,a,i},e.prototype.toRgb=function(){return Te(this.rgba)},e.prototype.toRgbString=function(){return t=Te(this.rgba),o=t.r,n=t.g,r=t.b,(a=t.a)<1?"rgba("+o+", "+n+", "+r+", "+a+")":"rgb("+o+", "+n+", "+r+")";var t,o,n,r,a},e.prototype.toHsl=function(){return Nt(re(this.rgba))},e.prototype.toHslString=function(){return t=Nt(re(this.rgba)),o=t.h,n=t.s,r=t.l,(a=t.a)<1?"hsla("+o+", "+n+"%, "+r+"%, "+a+")":"hsl("+o+", "+n+"%, "+r+"%)";var t,o,n,r,a},e.prototype.toHsv=function(){return t=qt(this.rgba),{h:Me(t.h),s:H(t.s),v:H(t.v),a:H(t.a,3)};var t},e.prototype.invert=function(){return L({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),L(qe(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),L(qe(this.rgba,-t))},e.prototype.grayscale=function(){return L(qe(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),L(Xt(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),L(Xt(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(re(this.rgba).h+t)},e.prototype.alpha=function(t){return typeof t=="number"?L({r:(o=this.rgba).r,g:o.g,b:o.b,a:t}):H(this.rgba.a,3);var o},e.prototype.hue=function(t){var o=re(this.rgba);return typeof t=="number"?L({h:t,s:o.s,l:o.l,a:o.a}):Me(o.h)},e.prototype.isEqual=function(t){return this.toHex()===L(t).toHex()},e})(),L=function(e){return e instanceof Ye?e:new Ye(e)},Ut=[],Jt=function(e){e.forEach(function(t){Ut.indexOf(t)<0&&(t(Ye,Qe),Ut.push(t))})};var tt=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},nt=function(e){return .2126*tt(e.r)+.7152*tt(e.g)+.0722*tt(e.b)},Kt=function(e){e.prototype.luminance=function(){return t=nt(this.rgba),(o=2)===void 0&&(o=0),n===void 0&&(n=Math.pow(10,o)),Math.round(n*t)/n+0;var t,o,n},e.prototype.contrast=function(t){t===void 0&&(t="#FFF");var o,n,r,a,i,s,l,c=t instanceof e?t:new e(t);return a=this.rgba,i=c.toRgb(),s=nt(a),l=nt(i),o=s>l?(s+.05)/(l+.05):(l+.05)/(s+.05),(n=2)===void 0&&(n=0),r===void 0&&(r=Math.pow(10,n)),Math.floor(r*o)/r+0},e.prototype.isReadable=function(t,o){return t===void 0&&(t="#FFF"),o===void 0&&(o={}),this.contrast(t)>=(s=(i=(n=o).size)===void 0?"normal":i,(a=(r=n.level)===void 0?"AA":r)==="AAA"&&s==="normal"?7:a==="AA"&&s==="large"?3:4.5);var n,r,a,i,s}};var Qt=function(e,t){var o={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var r in o)n[o[r]]=r;var a={};e.prototype.toName=function(i){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var s,l,c=n[this.toHex()];if(c)return c;if(i?.closest){var u=this.toRgb(),h=1/0,d="black";if(!a.length)for(var f in o)a[f]=new e(o[f]).toRgb();for(var g in o){var b=(s=u,l=a[g],Math.pow(s.r-l.r,2)+Math.pow(s.g-l.g,2)+Math.pow(s.b-l.b,2));b<h&&(h=b,d=g)}return d}},t.string.push([function(i){var s=i.toLowerCase(),l=s==="transparent"?"#0000":o[s];return l?new e(l).toRgb():null},"name"])};Jt([Qt,Kt]);var Yt=new Map;function tn(e,t){let o=`${e}|${t}`,n=Yt.get(o);if(n!==void 0)return n;let r=L(e);if(!r.isReadable(t)){let i=L(t).luminance()<.5;for(let s=0;s<40&&!r.isReadable(t);s++)r=i?r.lighten(.05):r.darken(.05)}let a=r.toHex();return Yt.set(o,a),a}function fa(e,t){let o=L(e);return o.alpha()===1?o.alpha(t).toRgbString():e}function nn(e){return L(e).darken(.1).toHex()}function ua(e,t){return Object.fromEntries(Object.entries(e).map(t))}var en=new WeakMap;function U(e){let t=en.get(e);t||(t=new Map,en.set(e,t));let o=e.palette.text.primary;return n=>{if(!n)return o;let r=t.get(n);if(r!==void 0)return r;let a=e.palette.getContrastText(L(n).toHex());return t.set(n,a),a}}function ha(e,t){if(e.length===0)return t;let o=new Set(e);return t.filter((n,r)=>!o.has(r))}function da(e,t){if(e.length===0)return t;let o=[],n=0;for(let r of e)r>n&&o.push(t.slice(n,r)),n=r+1;return n<t.length&&o.push(t.slice(n)),o.join("")}function pa(e,t){let o=[],n=e.length,r=0,a=0,i=-1,s=[];for(let l=0;l<t.length;l++)a<n&&e[a]===l?(t.charCodeAt(l)-45>>>0<=1||(i===r?s.push(t[l]):(s.length>0&&o.push({pos:i,letters:s.join("")}),i=r,s=[t[l]])),a++):r++;return s.length>0&&o.push({pos:i,letters:s.join("")}),o}function ga(e){return e.end-e.start}function Ce(e,t){let o=[];for(let n of e){let r=t.get(n.data.name);r&&r.length>0&&o.push({y:n.x,bands:r})}return o}function Re({ctx:e,rows:t,layout:o,xOf:n,colors:r,labelOf:a,labelDrawn:i,contrastText:s,xMin:l,xMax:c}){let u=[];for(let{y:h,bands:d}of t){let f=o.height(d[0].laneCount),g=o.headLength(f),b=o.headRise?.(f)??0,p=a!==void 0&&f>=$t;u.length=0;for(let x of d){let[m,y]=n(x),w=y-m;if(y<l||m>c)continue;let v=o.top(h,x.lane,f),{fill:k,stroke:T}=r.get(x.annotation);e.fillStyle=k,e.strokeStyle=T;let{strand:R}=x.annotation,M=R===void 0?0:Math.min(g,w);R===void 0?(e.fillRect(m,v,w,f),e.strokeRect(m,v,w,f)):io({ctx:e,x:m,t:v,w,h:f,head:M,rise:b,strand:R}),p&&u.push({band:x,xStart:m,w,t:v,head:M,fill:k})}if(u.length>0){e.font=`${Math.min(f-2,11)}px sans-serif`,e.textAlign="center",e.textBaseline="middle";for(let{band:x,xStart:m,w:y,t:w,head:v,fill:k}of u){let T=a(x);T!==void 0&&e.measureText(T).width+2<=y-v/2&&(i?.(x),e.fillStyle=s(k),e.fillText(T,m+y/2,w+f/2))}}}}function io({ctx:e,x:t,t:o,w:n,h:r,head:a,rise:i,strand:s}){let l=s>0?t+n:t,c=s>0?t:t+n,u=s>0?l-a:l+a,h=o+r,d=o-i,f=(d+h)/2;e.beginPath(),a>=n?(e.moveTo(c,d),e.lineTo(l,f),e.lineTo(c,h)):(e.moveTo(c,o),e.lineTo(u,o),i>0&&e.lineTo(u,d),e.lineTo(l,f),e.lineTo(u,h),e.lineTo(c,h)),e.closePath(),e.fill(),e.stroke()}function on({model:e,theme:t,offsetX:o,offsetY:n,ctx:r,highResScaleFactorOverride:a,blockSizeXOverride:i,blockSizeYOverride:s}){let{blockSize:l,rowHeight:c,highResScaleFactor:u,actuallyShowDomains:h,subFeatureRows:d,colWidth:f,featureColors:g,featureLabels:b,segmentLabels:p,showMsaLetters:x,domainUnderline:m,domainBands:y}=e;if(!h)return;let w=a??u,v=i??l,k=s??l;r.resetTransform(),r.scale(w,w),r.translate(-o,c/2-n);let T=m?Math.min(3,c):c,M=!b&&!x&&!d?new Set:void 0;Re({ctx:r,rows:Ce($({model:e,offsetY:n,blockSizeY:k}),y),layout:{height:C=>d?Math.min(4,c/C):T,top:(C,W,F)=>C-c+(d?W*F:m?c-F:0),headLength:C=>m?c/2:C,headRise:C=>m?Math.max(0,c*.4-C):0},xOf:C=>[C.startCol*f,C.endCol*f],colors:g,labelOf:C=>b?.get(C.annotation)??(M&&!M.has(C.annotation.accession)?p.get(C.annotation.accession):void 0),labelDrawn:C=>M?.add(C.annotation.accession),contrastText:U(t),xMin:o,xMax:o+v})}function E(e,t,o=!1){e.font=e.font.replace(/(?:bold )?[\d.]+px/,`${o?"bold ":""}${t}px`)}var Le="rgba(0,128,255,0.3)",Ma="rgba(255,165,0,0.2)",Ca="rgba(255,165,0,0.15)",Ra="rgba(0,0,0,0.15)",La="rgba(128,128,0,0.2)",rn="rgba(25,118,210,0.22)",an="rgba(25,118,210,0.95)";var sn="rgba(255,140,0,0.28)",ln="rgba(210,90,0,0.95)",rt="rgba(255,140,0,0.18)",ot=11,He=3,at=ot+He*2;function it({ctx:e,theme:t,label:o,x:n,y:r,spanWidth:a,bounds:i,placed:s}){E(e,ot),e.textAlign="start";let l=e.measureText(o).width+He*2,c=at,u=l<=a?n:n+a+2;i&&(u=Math.max(i.min,Math.min(u,i.max-l)));let h=r;if(s){let d=f=>f.left<u+l&&f.right>u&&f.top<h+c&&f.bottom>h;for(;s.some(d);)h+=c;s.push({left:u,right:u+l,top:h,bottom:h+c})}e.fillStyle=t.palette.background.paper,e.fillRect(u,h,l,c),e.fillStyle=t.palette.text.primary,e.fillText(o,u+He,h+He+ot-2)}function co({ctx:e,model:t,theme:o,offsetX:n,offsetY:r,width:a,height:i}){let{resolvedClades:s,resolvedHighlights:l,rowTints:c,colWidth:u,rowHeight:h}=t,d=[];e.lineWidth=2;let f=Math.max(0,Math.floor(r/h)),g=Math.ceil((r+i)/h),b=p=>{e.fillRect(0,p*h-r,a,h)};for(let{rows:p,color:x,mark:m}of s)m==="highlight"&&p[1]>=f&&p[0]<=g&&(e.fillStyle=x,e.fillRect(0,p[0]*h-r,a,(p[1]-p[0]+1)*h));if(c)for(let p=f;p<=Math.min(g,c.length-1);p++){let x=c[p];x&&(e.fillStyle=x,b(p))}for(let{rowIndices:p,color:x}of l){e.fillStyle=x??rt;for(let m of p)m>=f&&m<=g&&b(m)}for(let{startCol:p,endCol:x,label:m,color:y}of l){if(p===void 0||x===void 0)continue;let w=p*u-n,v=(x-p+1)*u;e.fillStyle=y??sn,e.fillRect(w,0,v,i),e.strokeStyle=y??ln,e.strokeRect(w,0,v,i),m&&it({ctx:e,theme:o,label:m,x:w,y:0,spanWidth:v,bounds:{min:0,max:a},placed:d})}}function fo({ctx:e,model:t,offsetX:o,offsetY:n,height:r}){let{resolvedSelection:a,colWidth:i,rowHeight:s}=t;if(!a)return;let{startCol:l,endCol:c,rowRuns:u}=a,h=l*i-o,d=(c-l+1)*i;e.lineWidth=1;for(let[f,g]of u){let b=f*s-n,p=(g-f+1)*s;b<r&&b+p>0&&(e.fillStyle=rn,e.fillRect(h,b,d,p),e.strokeStyle=an,e.strokeRect(h,b,d,p))}}function cn({ctx:e,model:t,theme:o,offsetX:n,offsetY:r,width:a,height:i}){let{colWidth:s,rowHeight:l,referenceRowIndex:c,highlightedColumnRuns:u}=t;c!==void 0&&(e.fillStyle=Le,e.fillRect(0,c*l-r,a,l)),e.lineWidth=2;for(let{start:h,end:d}of u){let f=h*s-n,g=(d-h+1)*s;e.fillStyle=sn,e.fillRect(f,0,g,i),e.strokeStyle=ln,e.strokeRect(f,0,g,i)}co({ctx:e,model:t,theme:o,offsetX:n,offsetY:r,width:a,height:i}),fo({ctx:e,model:t,offsetX:n,offsetY:r,height:i})}function fn(e){let t=0,o=[];return n=>{if(!e)return;for(;t<e.length&&e[t].startCol<=n;)o.push(e[t]),t++;o.some(a=>a.endCol<=n)&&(o=o.filter(a=>a.endCol>n));let r;for(let a of o)(!r||a.stackIndex>r.stackIndex)&&(r=a);return r}}function D({offsetX:e,blockWidth:t,colWidth:o}){return{xStart:Math.max(0,Math.floor(e/o)),xEnd:Math.max(0,Math.ceil((e+t)/o))}}function hn({model:e,offsetX:t,offsetY:o,ctx:n,theme:r,highResScaleFactorOverride:a,blockSizeXOverride:i,blockSizeYOverride:s,rasterTiles:l}){let{colWidth:c,blockSize:u,rowHeight:h,fontSize:d,highResScaleFactor:f,actuallyShowDomains:g,bgColor:b}=e,p=a??f,x=i??u,m=s??u;n.resetTransform(),n.scale(p,p),n.translate(-t,h/2-o),n.textAlign="center",n.textBaseline="alphabetic",E(n,d,!b);let{xStart:y,xEnd:w}=D({offsetX:t,blockWidth:x,colWidth:c}),v=$({model:e,offsetY:o,blockSizeY:m}),{relativeTo:k,columns:T}=e,R=k?T.get(k)?.slice(y,w):null;uo({model:e,ctx:n,theme:r,xStart:y,xEnd:w,visibleLeaves:v,referenceSeq:R,drawTiles:!g,rasterTiles:l}),ho({model:e,ctx:n,xStart:y,xEnd:w,visibleLeaves:v}),n.resetTransform()}function uo({model:e,ctx:t,theme:o,visibleLeaves:n,xStart:r,xEnd:a,referenceSeq:i,drawTiles:s,rasterTiles:l}){let{bgColor:c,columns:u,colWidth:h,rowHeight:d,fontSize:f,relativeTo:g,showMsaLetters:b,subFeatureRows:p,domainUnderline:x,domainBandsByStart:m,featureColors:y}=e,w=s&&c,v=w&&!l;if(v||b){let k=ye(e),T=U(o),R=r*h,M=h/2,C=d/2-f/4,W=!s&&!p&&!x;for(let F=0,Q=n.length;F<Q;F++){let z=n[F],{name:O}=z.data,I=z.x,B=u.get(O)?.slice(r,a);if(B){let Y=I-d,se=I-C,me=fn(W?m.get(O):void 0);for(let ee=0,Nn=B.length;ee<Nn;ee++){let wt=r+ee,Oe=B[ee],yt=ee*h+R,Ie=i&&O!==g&&Oe===i[ee],be=k(wt,Oe);if(v&&(t.fillStyle=Ie?o.palette.action.hover:be||o.palette.background.default,t.fillRect(yt,Y,h,d)),b){let vt=me(wt);t.fillStyle=vt?T(y.get(vt.annotation)?.fill):Ie?o.palette.text.primary:w?T(be):c||!be?o.palette.text.primary:tn(be,o.palette.background.default),t.fillText(Ie?".":Oe,yt+M,se)}}}}}}function ho({model:e,ctx:t,visibleLeaves:o,xStart:n,xEnd:r}){let{bgColor:a,hideGapsEffective:i}=e;i&&(t.lineWidth=1,t.strokeStyle="#f0f",un({visibleLeaves:o,xStart:n,ctx:t,model:e,xEnd:r,offset:0}),t.strokeStyle=a?"#fff":"#000",un({visibleLeaves:o,xStart:n,ctx:t,model:e,xEnd:r,offset:-1}))}function un({model:e,ctx:t,visibleLeaves:o,xStart:n,xEnd:r,offset:a}){let{colWidth:s,rowHeight:l,insertionPositions:c}=e;for(let u of o){let{name:h}=u.data,d=c.get(h);if(d){let f=u.x;for(let{pos:g}of d)if(g>=n&&g<r){let b=g*s,p=f-l,x=f;t.beginPath(),t.moveTo(b+a,p+a);let m=p,y=!0;for(;m<x;){let w=Math.min(m+2,x),v=y?b+1:b-1;t.lineTo(v+a,w+a),m=w,y=!y}t.stroke()}}}}function dn(e){return e>Pt}var st=2;function pn({ctx:e,model:t,theme:o,panel:n,x:r,offsetY:a,blockSizeYOverride:i,highResScaleFactorOverride:s}){let{rowHeight:l,blockSize:c,highResScaleFactor:u}=t,h=i??c,d=s??u;e.resetTransform(),e.scale(d,d),e.translate(r,l/2-a),Re({ctx:e,rows:Ce($({model:t,offsetY:a,blockSizeY:h}),n.spans),layout:{height:f=>Math.max(1,l/f-st),top:(f,g,b)=>f-l+g*(b+st)+st/2,headLength:f=>f},xOf:f=>[f.xStart,f.xEnd],colors:n.colors,labelOf:f=>n.labels?.get(f.annotation),contrastText:U(o),xMin:0,xMax:n.width})}function gn({ctx:e,model:t,panel:o,x:n,offsetY:r,blockSizeYOverride:a,highResScaleFactorOverride:i}){let{rowHeight:s,blockSize:l,highResScaleFactor:c}=t,u=a??l;e.resetTransform();let h=i??c;e.scale(h,h),e.translate(n,-r);for(let d of $({model:t,offsetY:r,blockSizeY:u})){let f=o.colors.get(d.data.name);f&&(e.fillStyle=f,e.fillRect(0,d.x-s/2,o.width,s))}}function po({panel:e,...t}){e.kind==="features"?pn({panel:e,...t}):gn({panel:e,...t})}function mn({model:e,...t}){for(let o of e.resolvedRowPanels)po({model:e,panel:o,x:o.offsetX,...t})}var ae=new Uint8Array(128).fill(30);for(let e=65;e<=90;e++)ae[e]=e-65+1;for(let e=97;e<=122;e++)ae[e]=e-97+1;ae[45]=27;ae[46]=28;ae[42]=29;var K=Array.from({length:32},(e,t)=>t>=1&&t<=26?String.fromCharCode(65+t-1):"");K[27]="-";K[28]=".";K[29]="*";K[30]="?";function Ee(e){return e<128?ae[e]:30}function bn(e){return e===27||e===28}var lt=class{numColumns;counts;totals;slotTotals=new Uint32Array(32);constructor(t){this.numColumns=t,this.counts=new Uint32Array(t*32),this.totals=new Uint32Array(t)}addRow(t){let{counts:o,totals:n,slotTotals:r,numColumns:a}=this,i=Math.min(t.length,a);for(let s=0;s<i;s++){let l=Ee(t.charCodeAt(s));o[s*32+l]++,n[s]++,r[l]++}for(let s=i;s<a;s++)o[s*32+27]++,n[s]++;r[27]+=a-i}add(t,o){let n=Ee(o.charCodeAt(0));this.counts[t*32+n]++,this.totals[t]++,this.slotTotals[n]++}total(t){return this.totals[t]??0}count(t,o){return this.counts[t*32+Ee(o.charCodeAt(0))]??0}gapCount(t){let o=t*32;return(this.counts[o+27]??0)+(this.counts[o+28]??0)}forEachResidue(t,o){let{counts:n}=this,r=t*32;for(let a=1;a<32;a++){let i=n[r+a];i>0&&!bn(a)&&o(a,i)}}entropy(t){let o=this.total(t)-this.gapCount(t);if(o===0)return 0;let n=0;return this.forEachResidue(t,(r,a)=>{let i=a/o;n-=i*Math.log2(i)}),n}residueEntries(t){let o=[];return this.forEachResidue(t,(n,r)=>{o.push([K[n],r])}),o}get lettersPresent(){let t=new Set;for(let o=1;o<32;o++)this.slotTotals[o]>0&&!bn(o)&&t.add(K[o]);return t}};function xn(e){return K[e]}function Ya(e){return Ee(e.charCodeAt(0))}var ei=32;function ti(e,t=e.reduce((o,n)=>Math.max(o,n.length),0)){let o=new lt(t);for(let n of e)o.addRow(n);return o}function ri(e){return Math.log2(e==="amino"?20:4)}function wn(e,t,o){let n=e.total(t),r=n-e.gapCount(t);if(r===0)return[];let a=Math.max(0,o-e.entropy(t))*(r/n);if(a===0)return[];let i=[];return e.forEachResidue(t,(s,l)=>{i.push({letter:xn(s),bits:l/r*a})}),i.sort((s,l)=>s.bits-l.bits||s.letter.localeCompare(l.letter)),i}function go({ctx:e,values:t,color:o,colWidth:n,trackHeight:r,offsetX:a,blockSize:i}){let{xStart:s,xEnd:l}=D({offsetX:a,blockWidth:i,colWidth:n});e.fillStyle=o;for(let c=s;c<l&&c<t.length;c++){let h=t[c]*r,d=c*n;e.fillRect(d,r-h,n,h)}}function mo(e,t){let o=e.columnTrackContent.get(t)?.values;return o||(t==="property-conservation"?e.propertyConservation:e.conservation)}function bo({ctx:e,arcs:t,color:o,colWidth:n,trackHeight:r,offsetX:a,blockSize:i}){if(!t?.length)return;let{xStart:s,xEnd:l}=D({offsetX:a,blockWidth:i,colWidth:n}),c=1;for(let h of t)c=Math.max(c,h.end-h.start);let u=r-1;e.lineWidth=1;for(let h of t){if(h.end<s||h.start>l)continue;let d=(h.start+.5)*n,f=(h.end+.5)*n,g=u*Math.sqrt((h.end-h.start)/c);e.strokeStyle=h.color??o,e.beginPath(),e.moveTo(d,r),e.quadraticCurveTo((d+f)/2,r-2*g,f,r),e.stroke()}}function xo({ctx:e,data:t,colorScheme:o,contrastText:n,bgColor:r,drawLetters:a,colWidth:i,rowHeight:s,offsetX:l,blockSize:c}){let{xStart:u,xEnd:h}=D({offsetX:l,blockWidth:c,colWidth:i}),d=t?.slice(u,h);for(let f=0;d&&f<d.length;f++){let g=d[f],b=g.toUpperCase(),p=r?o[b]:void 0,x=(u+f)*i;p&&(e.fillStyle=p,e.fillRect(x,0,i,s)),a&&(e.fillStyle=n(p),e.fillText(g,x+i/2,s/2))}}function wo(e,t=55){let o=1,n=[1,2,5];for(let r=0;o*e<t;r++)o=n[r%3]*10**Math.floor(r/3);return o}function yo(e,t,o){let n=wo(o),r=n>1&&e<=0&&t>0?[0]:[],a=Math.max(1,Math.ceil((e+1)/n))*n;for(let i=a;i<=t;i+=n)r.push(i-1);return r}var vo=10,yn=4;function So({ctx:e,numColumns:t,label:o,textColor:n,colWidth:r,trackHeight:a,offsetX:i,blockSize:s}){let{xStart:l,xEnd:c}=D({offsetX:i,blockWidth:s,colWidth:r}),u=Math.min(c,t);E(e,vo),e.textAlign="center",e.textBaseline="alphabetic",e.fillStyle=n,e.strokeStyle=n,e.lineWidth=1;for(let h of yo(l,u,r)){let d=o(h);if(d===void 0)continue;let f=(h+.5)*r;e.fillText(d,f,a-yn-2),e.beginPath(),e.moveTo(f,a-yn),e.lineTo(f,a),e.stroke()}}var ko=.72,To=3;function Mo({ctx:e,colStats:t,colorScheme:o,maxBits:n,textColor:r,colWidth:a,trackHeight:i,offsetX:s,blockSize:l}){let{xStart:c,xEnd:u}=D({offsetX:s,blockWidth:l,colWidth:a}),h=Math.min(u,t.numColumns),d=i;E(e,d),e.textAlign="left",e.textBaseline="alphabetic";let f=d*ko;for(let g=c;g<h;g++){let b=wn(t,g,n);if(b.length===0)continue;let p=g*a,x=i;for(let{letter:m,bits:y}of b){let w=y/n*i;if(w<To){x-=w;continue}let v=e.measureText(m).width;if(v===0){x-=w;continue}e.fillStyle=o[m]??r,e.save(),e.translate(p,x),e.scale(a/v,w/f),e.fillText(m,0,0),e.restore(),x-=w}}}function Co({model:e,ctx:t,track:o,offsetX:n,offsetY:r=0,theme:a,blockSizeXOverride:i,highResScaleFactorOverride:s}){let{blockSize:l,colWidth:c,highResScaleFactor:u}=e,{id:h,kind:d,height:f,barColor:g,arcColor:b,arcs:p,customColorScheme:x,data:m}=o.model,y=i??l,w=s??u,v=a.palette.text.primary;switch(t.resetTransform(),t.scale(w,w),t.translate(-n,r),d){case"bar":{go({ctx:t,values:mo(e,h),color:g??"gray",colWidth:c,trackHeight:f,offsetX:n,blockSize:y});break}case"arc":{bo({ctx:t,arcs:p,color:b??a.palette.text.primary,colWidth:c,trackHeight:f,offsetX:n,blockSize:y});break}case"logo":{Mo({ctx:t,colStats:e.colStats,colorScheme:e.colorScheme,maxBits:e.alphabetMaxBits,textColor:v,colWidth:c,trackHeight:f,offsetX:n,blockSize:y});break}case"ruler":{let{relativeTo:k,numColumns:T}=e;So({ctx:t,numColumns:T,label:k?R=>{let M=e.visibleColToSeqPosOneBased(k,R);return M===void 0?void 0:`${M}`}:R=>`${R+1}`,textColor:v,colWidth:c,trackHeight:f,offsetX:n,blockSize:y});break}case"text":{let{bgColor:k,fontSize:T,rowHeight:R,showMsaLetters:M}=e;t.textAlign="center",t.textBaseline="middle",E(t,T),xo({ctx:t,data:m,colorScheme:x??e.colorScheme,contrastText:U(a),bgColor:k,drawLetters:M,colWidth:c,rowHeight:R,offsetX:n,blockSize:y});break}}t.resetTransform()}function vn({model:e,ctx:t,offsetX:o,theme:n,blockSizeXOverride:r,highResScaleFactorOverride:a}){let i=0;for(let s of e.turnedOnTracks)Co({model:e,ctx:t,track:s,offsetX:o,offsetY:i,theme:n,blockSizeXOverride:r,highResScaleFactorOverride:a}),i+=s.model.height}var pe=N(le(),1);function ct({bar:e,marginLeft:t,y:o,color:n}){return pe.default.createElement(pe.default.Fragment,null,pe.default.createElement("text",{x:t,y:o-9,fontSize:10,fill:n},e.label),pe.default.createElement("path",{d:`M${t} ${o-7} v6 h${e.px} v-6`,fill:"none",stroke:n}))}var ft;function Ro(){return ft===void 0&&(ft=typeof document>"u"?null:document.createElement("canvas").getContext("2d")),ft}var Lo=.6;function Ae(e,t){let o=Ro();return o?(E(o,t),o.measureText(e).width):e.length*t*Lo}var Fe=3,V=4,Ho=140;function ut(e){return e.mark==="bracket"||e.mark==="highlight"&&!!e.label}function ht(e,t){return(e.rows[1]-e.rows[0]+1)*t}function dt(e,t,o){return ht(e,t)>=o}function pt(e){return e.mark==="bracket"?V+Fe+V:V}function gi({clades:e,rowHeight:t,fontSize:o}){let n=0;for(let r of e){if(!ut(r))continue;let a=r.label?dt(r,t,o)?Ae(r.label,o):o:0;n=Math.max(n,pt(r)+a+V)}return Math.min(Ho,Math.ceil(n))}function Ti(e,t){return St(e,t)}function Mi(e,t,o){let n=Pe(e),r=n.length,a=t/r;for(let c=0;c<r;c++)n[c].x=(c+.5)*a;let i=te(e);for(let c=i.length-1;c>=0;c--){let u=i[c];if(u.children){let h=0,d=1/0,f=-1/0;for(let g of u.children)h+=g.x,d=Math.min(d,g.xMin),f=Math.max(f,g.xMax);u.x=h/u.children.length,u.xMin=d,u.xMax=f}else u.xMin=u.x,u.xMax=u.x}let s=e.height,l=[{node:e,depth:0}];for(;l.length>0;){let{node:c,depth:u}=l.pop();if(c.y=s===0?o:u/s*o,c.children)for(let h of c.children)l.push({node:h,depth:u+1})}}var gt=class{parent;frame;data;depth;height;value;children;depthToLeaf=0;row=0;rowMin=0;rowMax=0;depthFraction=0;branchLength=0;collapsedBranchLength;constructor(t,o,n){this.parent=o,this.frame=n,this.data=t.data,this.depth=t.depth,this.height=t.height,this.value=t.value,this.children=t.children?[]:null}get pxPerBranchLength(){let{scale:t,rootToTipLength:o}=this.frame;return o?t.treeWidth/o:0}get x(){return this.row*this.frame.scale.rowHeight}get xMin(){return this.rowMin*this.frame.scale.rowHeight}get xMax(){return this.rowMax*this.frame.scale.rowHeight}get y(){return this.depthFraction*this.frame.scale.treeWidth}get len(){return this.branchLength*this.pxPerBranchLength}get collapsedTipXFar(){return this.collapsedBranchLength===void 0?void 0:this.collapsedBranchLength*this.pxPerBranchLength}};function Ci(e,t){let o={scale:t,rootToTipLength:0},n=[],r=[],a=e.height,i=[{source:e,parent:null}];for(;i.length>0;){let{source:s,parent:l}=i.pop(),c=new gt(s,l,o);if(n.push(c),c.depthFraction=a===0?1:(s.depth-e.depth)/a,l&&(l.children.push(c),c.branchLength=l.branchLength+Math.max(s.data.length||0,0),o.rootToTipLength=Math.max(o.rootToTipLength,c.branchLength)),s._children&&(c.collapsedBranchLength=c.branchLength+Eo(s)),s.children)for(let u=s.children.length-1;u>=0;u--)i.push({source:s.children[u],parent:c});else c.row=r.length+.5,c.depthToLeaf=s.depthToLeaf??0,r.push(c)}for(let s=n.length-1;s>=0;s--){let l=n[s];if(l.children){let c=0,u=1/0,h=-1/0,d=0;for(let f of l.children)c+=f.row,u=Math.min(u,f.rowMin),h=Math.max(h,f.rowMax),d=Math.max(d,1+f.depthToLeaf);l.row=c/l.children.length,l.rowMin=u,l.rowMax=h,l.depthToLeaf=d}else l.rowMin=l.row,l.rowMax=l.row}return{root:n[0],leaves:r,rootToTipLength:o.rootToTipLength}}function Ri(e){e.children&&(mt(e),e._children=e.children,e.children=null)}function Eo(e){let t=e._children??e.children,o=0;if(t){let n=t.map(r=>({node:r,acc:Math.max(r.data.length??0,0)}));for(;n.length>0;){let{node:r,acc:a}=n.pop(),i=r.children??r._children;if(i?.length)for(let s of i)n.push({node:s,acc:a+Math.max(s.data.length??0,0)});else o=Math.max(o,a)}}return o}function mt(e){if(e.depthToLeaf===void 0){let t=te(e);for(let o=t.length-1;o>=0;o--){let n=t[o];if(n.depthToLeaf===void 0){let r=0;if(n.children)for(let a of n.children)r=Math.max(r,1+a.depthToLeaf);n.depthToLeaf=r}}}return e.depthToLeaf}function Li(e){let t=te(e),o=new Map;for(let n=t.length-1;n>=0;n--){let r=t[n],a=0;if(r.children)for(let i of r.children)a=Math.max(a,o.get(i));o.set(r,Math.max(r.data.length||0,0)+a)}return o.get(e)}function Hi(e,t,o){let n=[{node:e,y0:t}];for(;n.length>0;){let{node:r,y0:a}=n.pop(),i=a+Math.max(r.data.length||0,0);if(r.len=i*o,r.children)for(let s of r.children)n.push({node:s,y0:i})}}function Ao(e){let t=new Map;for(let o of Pe(e)){let{name:n}=o.data;t.set(n,t.has(n)?void 0:o)}return t}function Ei(e,t,o=Ao(e)){let n;for(let r of t){let a=o.get(r);if(!a)return;if(!n){n=a;continue}for(;n.depth>a.depth;)n=n.parent;for(;a.depth>n.depth;)a=a.parent;for(;n!==a;)n=n.parent,a=a.parent}return n}function Sn(e,t,o){let n=e;for(;;){let r=n.children?.find(a=>a.xMin<=t&&a.xMax>=o);if(!r)return n;n=r}}var _=2.5,bt=_*2;function j(e){return Math.max(e.rowHeight,at)}function ie(e,t,o,n){return e>t-n&&e<t+o+n}function ze(e,t,o,n,r){let a=t-n,i=t+o+n,s=[e];for(;s.length>0;){let l=s.pop();if(!(l.xMax<a||l.xMin>i)&&(r(l),l.children))for(let c of l.children)s.push(c)}}function kn(e,t){let{id:o,name:n}=e.data,r=n===o?t:n;return e.value===void 0?r:`${r} (${e.value} tips)`}function G(e,t,o,n){if(t)return e.len;if(n===0)return 0;let r=mt(e);return(n-r)/n*o}function Fo({offsetY:e,ctx:t,model:o,theme:n,tipX:r,maxDepthToLeaf:a,blockSizeYOverride:i}){let{hierarchy:s,showBranchLenEffective:l,blockSize:c,branchColors:u}=o,h=i??c,d=n.palette.text.primary;t.strokeStyle=d,ze(s,e,h,j(o),f=>{let g=f.x,b=G(f,l,r,a);if(!(b===void 0||!f.children))for(let p of f.children){let x=p.x,m=G(p,l,r,a);if(m===void 0)continue;let y=Math.min(g,x),w=Math.max(g,x);e+h>=y&&w>=e&&(u&&(t.strokeStyle=u.get(p.data.id)??d),t.beginPath(),t.moveTo(b,g),t.lineTo(b,x),t.lineTo(m,x),t.stroke())}}),t.strokeStyle=d}function zo({ctx:e,clickMap:t,offsetY:o,model:n,theme:r,tipX:a,maxDepthToLeaf:i,blockSizeYOverride:s,collapsedSet:l}){let{hierarchy:c,showBranchLenEffective:u,blockSize:h,rowHeight:d,fontSize:f,marginLeft:g,branchColors:b}=n;if(l.size===0)return;let p=s??h,x=Math.max(2,d*.42);ze(c,o,p,j(n),m=>{let{id:y}=m.data;if(l.has(y)){let w=G(m,u,a,i),v=m.x,k=ie(v,o,p,j(n)),T=u?m.collapsedTipXFar??a:a;if(w!==void 0&&k&&T>w){e.beginPath(),e.moveTo(w,v),e.lineTo(T,v-x),e.lineTo(T,v+x),e.closePath(),e.fillStyle=b?.get(y)??r.palette.action.disabled,e.fill(),e.strokeStyle=r.palette.text.primary,e.stroke();let R=m.value;R!==void 0&&d>=8&&(e.fillStyle=r.palette.text.primary,e.textAlign="left",e.fillText(`${R}`,T+3,v+f/4)),t?.insert({minX:w+g,maxX:T+g,minY:v-x,maxY:v+x,branch:!0,id:y,name:kn(m,"Collapsed clade")})}}})}function Bo({ctx:e,theme:t,clickMap:o,offsetY:n,model:r,tipX:a,maxDepthToLeaf:i,blockSizeYOverride:s,collapsedSet:l,draw:c}){let{hierarchy:u,showBranchLenEffective:h,blockSize:d,marginLeft:f}=r,g=s??d;ze(u,n,g,j(r),b=>{let p=G(b,h,a,i);if(p===void 0)return;let{data:x}=b,m=b.x,{id:y}=x;if(b.height>=1&&ie(m,n,g,j(r))){let w=l.has(y);c&&(e.strokeStyle=t.palette.text.primary,e.fillStyle=w?t.palette.text.primary:t.palette.background.default,e.beginPath(),e.arc(p,m,_,0,2*Math.PI),e.fill(),e.stroke()),w||o?.insert({minX:p-_+f,maxX:p-_+bt+f,minY:m-_,maxY:m-_+bt,branch:!0,id:y,name:kn(b,"Clade")})}})}function Wo({ctx:e,theme:t,offsetY:o,model:n,tipX:r,maxDepthToLeaf:a,blockSizeYOverride:i}){let{hierarchy:s,showBranchLenEffective:l,blockSize:c,fontSize:u}=n,h=i??c,d=j(n);E(e,Math.max(6,u-3)),e.fillStyle=t.palette.text.primary,e.textAlign="right",ze(s,o,h,d,f=>{let{id:g,name:b}=f.data;if(f.height<1||b===g)return;let p=G(f,l,r,a),x=f.x;p!==void 0&&ie(x,o,h,d)&&e.fillText(b,p-_-1,x-_-1)}),e.textAlign="start",E(e,u)}function Oo({theme:e,model:t,offsetY:o,ctx:n,clickMap:r,tipX:a,maxDepthToLeaf:i,blockSizeYOverride:s,collapsedSet:l}){let{fontSize:c,showBranchLenEffective:u,tipLabelColors:h,blockSize:d,labelsAlignRight:f,drawTree:g,treeAreaWidthMinusMargin:b,marginLeft:p,noTree:x,labelWidthMap:m,labelWidthScale:y}=t,w=s??d,v=$({model:t,offsetY:o,blockSizeY:w}),k=j(t),T=n.measureText("M").width;f?(n.textAlign="right",n.setLineDash([1,3]),n.strokeStyle=e.palette.text.primary):n.textAlign="start";for(let R of v){let{data:{name:M,id:C}}=R,W=R.x,F=t.rowDataOf(M)?.genome||M;if(!(l.has(C)&&M===C)&&ie(W,o,w,k)){let z=W+c/4,O=0;x||(O=G(R,u,a,i)??0);let I=m.get(M),B=I===void 0?n.measureText(F).width:I*y;if(n.fillStyle=h?.get(M)??e.palette.text.primary,f){let se=b-2;g&&!x&&(n.beginPath(),n.moveTo(O+_+2,W),n.lineTo(se-2-B,W),n.stroke()),n.fillText(F,se,z);let me=se+p;r?.insert({minX:me-B,maxX:me,minY:z-T,maxY:z,name:M,id:C})}else{let Y=x?2:O+bt;n.fillText(F,Y,z),r?.insert({minX:Y+p,maxX:Y+B+p,minY:z-T,maxY:z,name:M,id:C})}}}n.setLineDash([])}function Io(e){let t=1/0;for(let o of e)o<t&&(t=o);return t}function $o({ctx:e,model:t,offsetY:o,tipX:n,maxDepthToLeaf:r,blockSizeYOverride:a}){let{resolvedClades:i,hierarchy:s,showBranchLenEffective:l,rowHeight:c,treeAreaWidth:u,marginLeft:h,blockSize:d}=t,f=a??d,g=u-h;for(let{rows:b,color:p,mark:x}of i){if(x!=="highlight")continue;let m=b[0]*c,y=(b[1]+1)*c;if(y<o||m>o+f)continue;let w=Sn(s,m+c/2,y-c/2),v=G(w,l,n,r)??0;e.fillStyle=p,e.fillRect(v,m,g-v,y-m)}}function Po({ctx:e,model:t,theme:o,offsetY:n,blockSizeYOverride:r}){let{resolvedClades:a,cladeGutterWidth:i,rowHeight:s,treeAreaWidth:l,marginLeft:c,blockSize:u}=t;if(i===0)return;let h=r??u,d=l-c-i+V+Fe/2;e.lineWidth=Fe;for(let{rows:f,mark:g,markColor:b}of a){let p=f[0]*s+1,x=(f[1]+1)*s-1;g!=="bracket"||x<n||p>n+h||(e.strokeStyle=b??o.palette.text.primary,e.beginPath(),e.moveTo(d,p),e.lineTo(d,x),e.stroke())}e.lineWidth=1,e.strokeStyle=o.palette.text.primary}function Do({ctx:e,model:t,theme:o,offsetY:n,blockSizeYOverride:r}){let{resolvedHighlights:a,rowTints:i,referenceRowIndex:s,rowHeight:l,treeAreaWidth:c,marginLeft:u,blockSize:h}=t,d=r??h,f=j(t),g=[],b=p=>{e.fillRect(-u,p*l,c,l)};if(i){let p=Math.max(0,Math.floor((n-f)/l)),x=Math.min(i.length-1,Math.ceil((n+d+f)/l));for(let m=p;m<=x;m++){let y=i[m];y&&(e.fillStyle=y,b(m))}}s!==void 0&&(e.fillStyle=Le,b(s));for(let{rowIndices:p,label:x,color:m}of a){e.fillStyle=m??rt;for(let w of p)ie(w*l+l/2,n,d,f)&&b(w);let y=Io(p);x&&p.length&&ie(y*l,n,d,f)&&it({ctx:e,theme:o,label:x,x:-u+2,y:y*l,spanWidth:c,bounds:{min:-u,max:c-u},placed:g})}}function Tn({model:e,clickMap:t,ctx:o,offsetY:n,theme:r,highResScaleFactorOverride:a,blockSizeYOverride:i}){t?.clear();let{noTree:s,drawTree:l,drawNodeBubbles:c,drawNodeLabels:u,highResScaleFactor:h,fontSize:d,showTreeText:f,marginLeft:g,rowHeight:b}=e;o.resetTransform();let p=a??h;o.scale(p,p),o.translate(g,-n),E(o,d);let{maxBranchLength:x,maxDepthToLeaf:m,showBranchLenEffective:y,treeWidth:w}=e,v=y?x:w,k=new Set(e.collapsed);$o({ctx:o,model:e,offsetY:n,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i}),Do({ctx:o,model:e,theme:r,offsetY:n,blockSizeYOverride:i}),E(o,d),!s&&l&&(Fo({ctx:o,offsetY:n,model:e,theme:r,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i}),zo({ctx:o,clickMap:t,offsetY:n,model:e,theme:r,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i,collapsedSet:k}),Bo({ctx:o,theme:r,offsetY:n,clickMap:t,model:e,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i,collapsedSet:k,draw:c}),u&&Wo({ctx:o,theme:r,offsetY:n,model:e,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i})),f&&Oo({ctx:o,offsetY:n,model:e,clickMap:t,theme:r,tipX:v,maxDepthToLeaf:m,blockSizeYOverride:i,collapsedSet:k}),Po({ctx:o,model:e,theme:r,offsetY:n,blockSizeYOverride:i}),t?.finish()}var Be=1;function Cn(e,t){let o=t-Be*2;return n=>Be+n/e*o}function Rn({model:e,ctx:t,theme:o,width:n,height:r}){let a=e.treeOverviewLayout;if(!a)return;let{root:i,numTips:s,maxDepthToLeaf:l,showBranchLen:c}=a,u=n-Be*2,h=Cn(s,r),d=f=>Be+(G(f,c,1,l)??0)*u;for(let{rows:f,color:g}of e.treeOverviewClades)t.fillStyle=g,t.fillRect(0,h(f[0]),n,h(f[1]+1)-h(f[0]));t.strokeStyle=o.palette.text.primary,t.beginPath();for(let f of te(i)){if(!f.children)continue;let g=d(f),b=h(f.x);for(let p of f.children){let x=d(p),m=h(p.x);Math.abs(x-g)<1&&Math.abs(m-b)<1||(t.moveTo(g,b),t.lineTo(g,m),t.lineTo(x,m))}}t.stroke()}function No({model:e,ctx:t,color:o,rows:n,width:r,height:a}){let i=e.treeOverviewLayout;if(!i)return;let s=Cn(i.numTips,a),l=s(n[0]);t.strokeStyle=o,t.strokeRect(.5,l,r-1,Math.max(2,s(n[1]+1)-l))}function Ln(e){Rn(e);let t=e.model.treeOverviewFocusRows;t&&No({...e,rows:t,color:e.theme.palette.text.primary})}var Mn=new WeakMap;function _o({model:e,theme:t,width:o,height:n,scale:r}){return[e.data.tree,e.data.msa,e.currentAlignment,e.collapsed.join(","),JSON.stringify(e.clades),e.showBranchLen,o,n,r,t.palette.text.primary]}function Go(e,t){let o=typeof OffscreenCanvas<"u"?new OffscreenCanvas(e,t):typeof document<"u"?Object.assign(document.createElement("canvas"),{width:e,height:t}):void 0,n=o?.getContext("2d");return n&&typeof n.stroke=="function"?{canvas:o,ctx:n}:void 0}function Ni({model:e,theme:t,width:o,height:n,scale:r}){let a=_o({model:e,theme:t,width:o,height:n,scale:r}),i=Mn.get(e);if(i&&a.every((c,u)=>c===i.keys[u]))return i.canvas;let s=Go(Math.max(1,Math.round(o*r)),Math.max(1,Math.round(n*r)));s&&(s.ctx.scale(r,r),Rn({model:e,ctx:s.ctx,theme:t,width:o,height:n}));let l={keys:a,canvas:s?.canvas};return Mn.set(e,l),l.canvas}var zn=N(En(),1),Bn=N(Fn(),1);function Wn(e){let t=document.createElement("div"),o=(0,Bn.createRoot)(t),n;try{(0,zn.flushSync)(()=>{o.render(e)}),n=t.innerHTML}finally{o.unmount()}return n}var Xo=/<[a-zA-Z][^>]*>/g,Uo=/\b(fill|stroke|stop-color)="([^"]+)"/g;function On(e){return e.replaceAll(Xo,t=>t.replaceAll(Uo,(o,n,r)=>{if(!/^(rgba|hsl)/i.test(r))return o;let a=L(r);if(!a.isValid())return o;let i=a.alpha(),s=a.alpha(1).toHex();return i===1||t.includes(`${n}-opacity=`)?`${n}="${s}"`:`${n}="${s}" ${n}-opacity="${i}"`}))}var q=8,$n=16,We=12,Vo=12,Pn=7,jo=.6,qo=360,xt=q+We+6;function Zo(e){let t=e.reduce((n,r)=>Math.max(n,r.label.length),0),o=xt+q+t*Pn;return Math.min(qo,Math.max(120,o))}function Dn(e){return q*2+e.length*$n}function Jo(e,t){let{scrollX:o,scrollY:n,totalWidth:r,totalHeight:a,treeAreaWidth:i,rowPanelsWidth:s,rowPanelsHeaderHeight:l,totalTrackAreaHeight:c,minimapHeight:u,msaAreaHeight:h,msaCanvasWidth:d,showHorizontalScrollbar:f,treeOverviewHeight:g,treeScaleBar:b}=e,p=t.includeTracks?c:0,x=t.exportType==="viewport"&&!!t.includeMinimap&&f,m=Se(e.legends),y=m.length>0?Zo(m):0,w=Math.max(x?u:0,l,g+(b?je:0)),v=i+s;return t.exportType==="entire"?{width:r+v,msaAreaWidth:r,height:a+p+w,contentHeight:a,trackHeight:p,topHeight:w,offsetX:0,offsetY:0,includeMinimap:x,legendWidth:y}:{width:d+v,msaAreaWidth:d,height:h+w+p,contentHeight:h,trackHeight:p,topHeight:w,offsetX:-o,offsetY:-n,includeMinimap:x,legendWidth:y}}async function hs(e,t){if(await(0,In.when)(()=>e.dataInitialized||!!e.error),e.error)throw e.error;let{Context:o}=await import("./dist-UX5CKLQJ.js"),n=new Map,r=Wn(S.default.createElement(Ko,{model:e,theme:t.theme,Context:o,layout:Jo(e,t),layers:n}));return On(r.replaceAll(/<g data-layer="([^"]+)"><\/g>/g,(a,i)=>{let s=n.get(i);return s?`<g id="${i}">${s.getSvg().innerHTML}</g>`:a}))}function Ko({model:e,theme:t,Context:o,layout:n,layers:r}){let{width:a,trackHeight:i,includeMinimap:s,legendWidth:l,topHeight:c}=n,{treeAreaWidth:u,rowPanelsWidth:h}=e,d=a+l,f=c,g=l>0?Math.max(n.height,f+Dn(Se(e.legends))):n.height,b={Context:o,model:e,theme:t,layout:n,layers:r},p=S.default.createElement(S.default.Fragment,null,i>0?S.default.createElement(ir,{...b}):null,S.default.createElement("g",{transform:i>0?`translate(0 ${i})`:void 0},S.default.createElement(rr,{...b})));return S.default.createElement("svg",{width:d,height:g,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:`0 0 ${d} ${g}`},S.default.createElement("rect",{width:"100%",height:"100%",fill:t.palette.background.default}),c>0?S.default.createElement(S.default.Fragment,null,s?S.default.createElement("g",{id:"minimap-panel",transform:`translate(${u+h} 0)`},S.default.createElement(Ve,{model:e,theme:t})):null,S.default.createElement(er,{model:e,theme:t,bandHeight:c}),e.showTreeOverview?S.default.createElement(Qo,{model:e,theme:t,Context:o,layers:r}):null,S.default.createElement(Yo,{model:e,theme:t}),S.default.createElement("g",{transform:`translate(0 ${c})`},p)):p,l>0?S.default.createElement("g",{id:"legend-panel",transform:`translate(${a} ${f})`},S.default.createElement(or,{model:e,theme:t,width:l})):null)}function Qo({model:e,theme:t,Context:o,layers:n}){let{treeAreaWidth:r,overviewHeight:a,id:i}=e,s=new o(r,a);return Ln({model:e,ctx:s,theme:t,width:r,height:a}),S.default.createElement(ge,{panelId:"tree-overview",clipId:`tree-overview-${i}`,width:r,height:a,ctx:s,layers:n})}function Yo({model:e,theme:t}){let{marginLeft:o,treeScaleBar:n,treeOverviewHeight:r}=e;return n?S.default.createElement("g",{id:"tree-scalebar"},S.default.createElement(ct,{bar:n,marginLeft:o,y:r+je,color:t.palette.text.primary})):null}function er({model:e,theme:t,bandHeight:o}){let{resolvedRowPanels:n,treeAreaWidth:r,fontSize:a}=e,i=o-4;return n.length===0?null:S.default.createElement("g",{id:"rowpanel-headers"},n.map(s=>{let l=dn(s.width),c=l?a:Math.min(a,s.width),u=r+s.offsetX+s.width/2,h=l?u:u+c/3,d=l?s.width:i-q,f=Math.floor(d/(c*jo));return c<5?null:S.default.createElement("text",{key:s.id,x:h,y:i,...l?{textAnchor:"middle"}:{transform:`rotate(-90 ${h} ${i})`},fontSize:c,fill:t.palette.text.primary},s.header.length>f?`${s.header.slice(0,Math.max(1,f-1))}\u2026`:s.header)}))}function tr(e,t,o){let n=Ae(e,o);if(n<=t)return e;let r=Math.floor(e.length*t/n);return`${e.slice(0,Math.max(1,r-1))}\u2026`}function nr({model:e,theme:t,offsetY:o}){let{resolvedClades:n,cladeGutterWidth:r,rowHeight:a,treeAreaWidth:i,fontSize:s}=e;if(r===0)return null;let l=i-r;return S.default.createElement("g",{id:"clade-labels"},n.map((c,u)=>{let{label:h,markColor:d,rows:f}=c;if(!h||!ut(c))return null;let g=l+pt(c),b=f[0]*a-o,p=ht(c,a),x=dt(c,a,s),m=x?i-g-V:p,y=x?g:g+s,w=x?b+p/2+s/3:b+p;return S.default.createElement("text",{key:`${f[0]}-${f[1]}-${u}`,x:y,y:w,transform:x?void 0:`rotate(-90 ${y} ${w})`,fontSize:s,fill:d??t.palette.text.primary},tr(h,m,s))}))}function or({model:e,theme:t,width:o}){let n=Se(e.legends),r=Dn(n),a=Math.floor((o-xt-q)/Pn);return S.default.createElement("g",null,S.default.createElement("rect",{x:0,y:0,width:o-4,height:r,fill:t.palette.background.paper,stroke:t.palette.divider,rx:2}),n.map((i,s)=>{let l=q+s*$n;return S.default.createElement("g",{key:i.key},i.color?S.default.createElement("rect",{x:q,y:l,width:We,height:We,fill:i.color,stroke:nn(i.color)}):null,S.default.createElement("text",{x:i.color?xt:q,y:l+We-1,fontSize:Vo,fontWeight:i.color?void 0:"bold",fill:t.palette.text.primary},i.label.length>a?`${i.label.slice(0,Math.max(1,a-1))}\u2026`:i.label))}))}function rr({model:e,theme:t,layout:o,Context:n,layers:r}){let{contentHeight:a,offsetX:i,offsetY:s,msaAreaWidth:l}=o,{treeAreaWidth:c,rowPanelsWidth:u,id:h}=e,d=new n(c,a);Tn({model:e,theme:t,ctx:d,offsetY:s,blockSizeYOverride:a,highResScaleFactorOverride:1});let f=u?new n(u,a):void 0;f&&mn({model:e,theme:t,ctx:f,offsetY:s,blockSizeYOverride:a,highResScaleFactorOverride:1});let g=ar({model:e,theme:t,layout:o}),b=new n(l,a);return on({model:e,theme:t,ctx:b,offsetX:i,offsetY:s,blockSizeXOverride:l,blockSizeYOverride:a,highResScaleFactorOverride:1}),hn({model:e,theme:t,ctx:b,offsetX:i,offsetY:s,blockSizeXOverride:l,blockSizeYOverride:a,highResScaleFactorOverride:1,rasterTiles:!!g}),b.resetTransform(),cn({ctx:b,model:e,theme:t,offsetX:i,offsetY:s,width:l,height:a}),S.default.createElement(S.default.Fragment,null,S.default.createElement(ge,{panelId:"tree-panel",clipId:`tree-${h}`,width:c,height:a,ctx:d,layers:r}),S.default.createElement(nr,{model:e,theme:t,offsetY:s}),f?S.default.createElement(ge,{panelId:"rowpanels-panel",clipId:`rowpanels-${h}`,width:u,height:a,transform:`translate(${c} 0)`,ctx:f,layers:r}):null,S.default.createElement(ge,{panelId:"msa-panel",clipId:`msa-${h}`,width:l,height:a,transform:`translate(${c+u} 0)`,ctx:b,layers:r,underlay:g}))}function ar({model:e,theme:t,layout:o}){let{contentHeight:n,offsetX:r,offsetY:a,msaAreaWidth:i}=o,{colWidth:s,rowHeight:l,actuallyShowDomains:c,bgColor:u}=e;if(c||!u||!Bt())return;let{xStart:h,xEnd:d}=D({offsetX:r,blockWidth:i,colWidth:s}),{yStart:f,yEnd:g}=De({model:e,offsetY:a,blockSizeY:n}),b=Math.min(d,e.numColumns)-h,p=Math.min(g,e.numRows)-f,x=Wt({model:e,theme:t,col0:h,row0:f,numCols:b,numRows:p});return x?S.default.createElement("image",{href:x,x:h*s-r,y:f*l-a,width:b*s,height:p*l,imageRendering:"pixelated",preserveAspectRatio:"none"}):void 0}function ir({model:e,theme:t,layout:o,Context:n,layers:r}){let{trackHeight:a,offsetX:i,msaAreaWidth:s}=o,{treeAreaWidth:l,rowPanelsWidth:c,id:u}=e,h=new n(s,a);return vn({model:e,ctx:h,theme:t,offsetX:i,blockSizeXOverride:s,highResScaleFactorOverride:1}),S.default.createElement(S.default.Fragment,null,S.default.createElement(sr,{model:e,theme:t}),S.default.createElement("g",{transform:`translate(${l+c} 0)`},S.default.createElement(ge,{panelId:"tracks-panel",clipId:`tracks-${u}`,width:s,height:a,ctx:h,layers:r})))}function sr({model:e,theme:t}){let{turnedOnTracks:o,treeAreaWidth:n,fontSize:r,drawLabels:a}=e;if(!a)return null;let i=o.map((s,l)=>{let{id:c,name:u,height:h}=s.model,d=Math.min(h,r),f=o.slice(0,l).reduce((g,b)=>g+b.model.height,0);return{id:c,name:u,size:d,baseline:f+h/2+d/3}});return S.default.createElement(S.default.Fragment,null,i.map(({id:s,name:l,size:c,baseline:u})=>c<5?null:S.default.createElement("text",{key:s,x:n-4,y:u,fontSize:c,textAnchor:"end",fill:t.palette.text.primary},l)))}function ge({panelId:e,clipId:t,width:o,height:n,transform:r,ctx:a,layers:i,underlay:s}){return i.set(e,a),S.default.createElement(S.default.Fragment,null,S.default.createElement("defs",null,S.default.createElement("clipPath",{id:t},S.default.createElement("rect",{x:0,y:0,width:o,height:n}))),S.default.createElement("g",{clipPath:`url(#${t})`,transform:r},s,S.default.createElement("g",{"data-layer":e})))}export{Tt as a,we as b,Xn as c,Bt as d,gr as e,Ot as f,It as g,Se as h,kr as i,Tr as j,Mr as k,Cr as l,Rr as m,Lr as n,Hr as o,Er as p,Ar as q,Fr as r,zr as s,Br as t,Wr as u,Or as v,Ir as w,$r as x,Pr as y,Dr as z,Nr as A,_r as B,Gr as C,Xr as D,Ur as E,Vr as F,jr as G,qr as H,Zr as I,Jr as J,Kr as K,Qr as L,Yr as M,ea as N,Pt as O,je as P,ta as Q,eo as R,na as S,L as T,Jt as U,Qt as V,fa as W,nn as X,ua as Y,ha as Z,da as _,pa as $,ga as aa,on as ba,Ma as ca,Ca as da,Ra as ea,La as fa,rn as ga,cn as ha,D as ia,hn as ja,dn as ka,po as la,xn as ma,Ya as na,ei as oa,ti as pa,ri as qa,wn as ra,mo as sa,Co as ta,ct as ua,Ae as va,V as wa,ut as xa,ht as ya,dt as za,pt as Aa,gi as Ba,Ti as Ca,Mi as Da,Ci as Ea,Ri as Fa,mt as Ga,Li as Ha,Hi as Ia,Ao as Ja,Ei as Ka,Sn as La,Tn as Ma,Rn as Na,No as Oa,Ni as Pa,Fn as Qa,hs as Ra};
2
+ //# sourceMappingURL=chunk-FCNT6B47.js.map