view x/static/js/3120.3940249f.chunk.js @ 133:cec274db51c0 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7d28252954cae9f8db5f8a85d8f29cb2865b504b-dirty
author fubar
date Fri, 18 Oct 2024 11:57:55 +0000
parents 49f3d3878413
children
line wrap: on
line source

"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[3120],{59773:(e,t,n)=>{n.d(t,{Ay:()=>m,Cx:()=>c,Nz:()=>u,lc:()=>d,rE:()=>l});var r=n(45103),o=n.n(r),s=n(12678),a=n(2862),i=n(99546);function l(e){return(void 0!==e.umdUrl||void 0!==e.url||void 0!==e.umdLoc)&&void 0!==e.name}function c(e){return void 0!==e.esmUrl||void 0!==e.esmLoc}function u(e){return void 0!==e.cjsUrl}function d(e){return l(e)?`UMD plugin ${e.name}`:c(e)?`ESM plugin ${e.esmUrl||e.esmLoc.uri}`:u(e)?`CJS plugin ${e.cjsUrl}`:"unknown plugin"}class m{definitions=[];constructor(e=[],t){this.fetchESM=t?.fetchESM,this.fetchCJS=t?.fetchCJS,this.definitions=JSON.parse(JSON.stringify(e))}async loadCJSPlugin(e,t){const n=new URL(e.cjsUrl,t);if("http:"!==n.protocol&&"https:"!==n.protocol)throw new Error(`Cannot load plugins using protocol "${n.protocol}"`);if(!this.fetchCJS)throw new Error("No fetchCJS callback provided");return this.fetchCJS(n.href)}async loadESMPlugin(e,t){const n="esmUrl"in e?new URL(e.esmUrl,t):new URL(e.esmLoc.uri,e.esmLoc.baseUri);if("http:"!==n.protocol&&"https:"!==n.protocol)throw new Error(`cannot load plugins using protocol "${n.protocol}"`);if(!this.fetchESM)throw new Error("No ESM fetcher installed");const r=await this.fetchESM(n.href);if(!r)throw new Error(`Could not load ESM plugin: ${n}`);return r}async loadUMDPlugin(e,t){const n="url"in e?new URL(e.url,t):"umdUrl"in e?new URL(e.umdUrl,t):new URL(e.umdLoc.uri,e.umdLoc.baseUri);if("http:"!==n.protocol&&"https:"!==n.protocol)throw new Error(`cannot load plugins using protocol "${n.protocol}"`);const r=e.name,a=`JBrowsePlugin${r}`;"undefined"==typeof jest?await async function(e){if(!Boolean("WorkerGlobalScope"in globalThis))return t=e,new Promise(((e,n)=>{o()(t,((t,r)=>{t?n(t):e(r.src)}))}));var t;if(!globalThis.importScripts)throw new Error("cannot figure out how to load external JS scripts in this environment");await globalThis.importScripts(e)}(n.href):globalThis[a]={default:s.A};const i=globalThis[a];if(!i)throw new Error(`Failed to load UMD bundle for ${r}, ${a} is undefined`);return i}async loadPlugin(e,t){let n;if(i.isElectron&&u(e))n=await this.loadCJSPlugin(e,t);else if(c(e))n=await this.loadESMPlugin(e,t);else{if(!l(e))throw!i.isElectron&&u(e)?new Error(`CommonJS plugin found, but not in a NodeJS environment: ${JSON.stringify(e)}`):new Error(`Could not determine plugin type: ${JSON.stringify(e)}`);n=await this.loadUMDPlugin(e,t)}if(!n.default)throw new Error(`${d(e)} does not have a default export, cannot load`);return n.default}installGlobalReExports(e){return e.JBrowseExports=Object.fromEntries(Object.entries(a.A).map((([e,t])=>[e,t]))),this}async load(e){return Promise.all(this.definitions.map((async t=>({plugin:await this.loadPlugin(t,e),definition:t}))))}}},68584:(e,t,n)=>{n.r(t),n.d(t,{ConfigurationReference:()=>r.A,ConfigurationSchema:()=>r.S,getConf:()=>o.FI,getTypeNamesFromExplicitlyTypedUnion:()=>o.JC,isBareConfigurationSchemaType:()=>o.C$,isConfigurationModel:()=>o.wo,isConfigurationSchemaType:()=>o.oG,isConfigurationSlotType:()=>o.Rg,readConfObject:()=>o.QZ});var r=n(42498),o=n(35254)},3496:(e,t,n)=>{n.d(t,{LS:()=>o,cK:()=>a,pZ:()=>i});var r=n(26257);function o(e={}){return`${(0,r.A)(e)}`}let s={};async function a(e,t,n){const r=o(n);if(!s[r]){const o=n?.type;if(!o)throw new Error(`could not determine adapter type from adapter config snapshot ${JSON.stringify(n)}`);const i=e.getAdapterType(o);if(!i)throw new Error(`unknown data adapter type ${o}`);const l=i.configSchema.create(n,{pluginManager:e}),c=a.bind(null,e,t),u=new(await i.getAdapterClass())(l,c,e);s[r]={dataAdapter:u,sessionIds:new Set([t])}}const i=s[r];return i.sessionIds.add(t),i}function i(e){let t=0;const n=Object.keys(e);if(1===n.length&&"sessionId"===n[0]){const{sessionId:n}=e;Object.entries(s).forEach((([e,r])=>{r.sessionIds.delete(n),0===r.sessionIds.size&&(t+=1,delete s[e])}))}else Object.values(s).forEach((t=>{const n=e.regions||(e.region?[e.region]:[]);for(const e of n)void 0!==e.refName&&t.dataAdapter.freeResources(e)}));return t}},24388:(e,t,n)=>{n.d(t,{SF:()=>l,bR:()=>s,bw:()=>a});let r=0;const o=new WeakMap;function s(e,t){let n=o.get(e);return n||(r+=1,o.set(e,r),n=r,e.addEventListener("abort",(()=>{const n=o.get(e);void 0!==n&&t("signalAbort",n)}))),{abortSignalId:n}}function a(e){return"object"==typeof e&&null!==e&&"abortSignalId"in e&&"number"==typeof e.abortSignalId}const i=new Map;function l({abortSignalId:e}){let t=i.get(e);return t||(t=new AbortController,i.set(e,t)),t.signal}},85206:(e,t,n)=>{n.d(t,{A:()=>A});var r=n(7552),o=n(29629),s=n(66765),a=n(81453),i=n(2051),l=n(24387),c=n(55851),u=n(8463),d=n(45266),m=n(63672),p=n(68850);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(null,arguments)}const g=r.createContext({parentPopupState:null,rootPopupState:null});function h({onClick:e,closeAfterItemClick:t,...n}){const{rootPopupState:s}=(0,r.useContext)(g);if(!s)throw new Error("must be used inside a CascadingMenu");return r.createElement(o.A,f({},n,{onClick:n=>{t&&s.close(),e?.(n)}}))}function y({title:e,Icon:t,inset:n,popupId:i,...l}){const{parentPopupState:c}=(0,r.useContext)(g),u=(0,d.T6)({popupId:i,variant:"popover",parentPopupState:c});return r.createElement(r.Fragment,null,r.createElement(o.A,f({},(0,d._k)(u),(0,d.oe)(u)),t?r.createElement(s.A,null,r.createElement(t,null)):null,r.createElement(a.A,{primary:e,inset:n}),r.createElement(p.A,null)),r.createElement(w,f({},l,{anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},popupState:u})))}function w({popupState:e,onMenuItemClick:t,menuItems:n,classes:o,...s}){const{rootPopupState:a}=(0,r.useContext)(g),i=(0,r.useMemo)((()=>({rootPopupState:a||e,parentPopupState:e})),[a,e]);return r.createElement(g.Provider,{value:i},r.createElement(m.A,f({},s,(0,d.NA)(e))))}function b({popupState:e,onMenuItemClick:t,menuItems:n,...o}){const{rootPopupState:s}=(0,r.useContext)(g),a=(0,r.useMemo)((()=>({rootPopupState:s||e,parentPopupState:e})),[s,e]);return r.createElement(g.Provider,{value:a},r.createElement(i.A,f({},o,(0,d.NA)(e))))}function v({item:e}){return"subMenu"in e?r.createElement(u.m,{type:"subMenu"}):"checkbox"===e.type||"radio"===e.type?r.createElement(u.m,{type:e.type,checked:e.checked,disabled:e.disabled}):null}function S({onMenuItemClick:e,closeAfterItemClick:t,menuItems:n,...o}){const i=n.some((e=>"icon"in e&&e.icon));return r.createElement(r.Fragment,null,n.sort(((e,t)=>(t.priority||0)-(e.priority||0))).map(((n,u)=>{return"subMenu"in n?r.createElement(y,{key:`subMenu-${n.label}-${u}`,popupId:`subMenu-${n.label}`,title:n.label,Icon:n.icon,inset:i&&!n.icon,onMenuItemClick:e,menuItems:n.subMenu},r.createElement(S,f({},o,{closeAfterItemClick:t,onMenuItemClick:e,menuItems:n.subMenu}))):"divider"===n.type?r.createElement(l.A,{key:`divider-${JSON.stringify(n)}-${u}`,component:"li"}):"subHeader"===n.type?r.createElement(c.A,{key:`subHeader-${n.label}-${u}`},n.label):r.createElement(h,{key:`${n.label}-${u}`,closeAfterItemClick:t,onClick:"onClick"in n?(d=n.onClick,t=>{e(t,d)}):void 0,disabled:Boolean(n.disabled)},n.icon?r.createElement(s.A,null,r.createElement(n.icon,null)):null," ",r.createElement(a.A,{primary:n.label,secondary:n.subLabel,inset:i&&!n.icon}),r.createElement("div",{style:{flexGrow:1,minWidth:10}}),r.createElement(v,{item:n}));var d})))}const A=function(e){const{closeAfterItemClick:t=!0,...n}=e;return r.createElement(b,n,r.createElement(S,f({},n,{closeAfterItemClick:t})))}},92562:(e,t,n)=>{n.d(t,{A:()=>v});var r=n(7552),o=n(48231),s=n(40985),a=n(2187),i=n(43163),l=n(61723),c=n(24387),u=n(20139),d=n(89022),m=n(68446),p=n(75785),f=n(82725),g=n(30157),h=n(38033),y=n(13476);const w=(0,p.n9)()((e=>({closeButton:{position:"absolute",right:e.spacing(1),top:e.spacing(1),color:e.palette.grey[500]}})));function b({error:e}){return r.createElement("div",{style:{width:800,margin:40}},r.createElement(h.A,{error:e}))}const v=(0,m.observer)((function(e){const{classes:t}=w(),{title:n,header:m,children:p,onClose:h}=e,v=(0,o.A)();return r.createElement(s.A,e,r.createElement(a.A,null,r.isValidElement(m)?m:r.createElement(i.A,null,r.createElement(y.A,{html:n||""}),h?r.createElement(l.A,{className:t.closeButton,onClick:()=>{h()}},r.createElement(g.A,null)):null),r.createElement(c.A,null),r.createElement(f.tH,{FallbackComponent:b},r.createElement(u.A,{theme:(0,d.A)(v,{components:{MuiInputBase:{styleOverrides:{input:{boxSizing:"content-box!important"}}}}})},p))))}))},88373:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(7552),o=n(48231),s=n(36715),a=n(98879),i=n(75785),l=n(40085);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}const u=(0,i.n9)()((e=>({input:{},inputBase:{},typography:{top:6,left:2,position:"absolute",whiteSpace:"nowrap",visibility:"hidden"},inputRoot:{padding:e.spacing(.5)},inputFocused:{borderStyle:"solid",borderWidth:2}}))),d=r.forwardRef((function(e,t){const{value:n,setValue:i,variant:d,...m}=e,[p,{width:f}]=(0,l.A)(),[g,h]=(0,r.useState)(),[y,w]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1);(0,r.useEffect)((()=>{b&&(y?.blur(),v(!1))}),[b,y]);const{classes:S}=u(e,{props:e}),A=(0,o.A)(),C=void 0===g?n:g;return r.createElement("div",c({},m,{ref:t}),r.createElement("div",{style:{position:"relative"}},r.createElement(s.A,{ref:p,component:"span",variant:d,className:S.typography},C)),r.createElement(a.Ay,{inputRef:e=>{w(e)},className:S.inputBase,inputProps:{style:{width:f,...d&&"inherit"!==d?A.typography[d]:{}}},classes:{input:S.input,root:S.inputRoot,focused:S.inputFocused},value:C,onChange:e=>{h(e.target.value)},onKeyDown:e=>{"Enter"===e.key?y?.blur():"Escape"===e.key&&(h(void 0),v(!0))},onBlur:()=>{i(g||n||""),h(void 0)}}))}))},38033:(e,t,n)=>{n.d(t,{A:()=>p});var r=n(7552),o=n(89003),s=n(61723),a=n(75785),i=n(21311),l=n(4902),c=n(71627);const u=(0,r.lazy)((()=>Promise.all([n.e(9245),n.e(4630)]).then(n.bind(n,74630)))),d=(0,a.n9)()((e=>({bg:{background:e.palette.divider,border:"1px solid black",margin:20},iconFloat:{float:"right",marginLeft:100}})));function m({error:e,onReset:t}){const{classes:n}=d(),[a,i]=(0,r.useState)(!1);return r.createElement("div",{className:n.iconFloat},"object"==typeof e&&e&&"stack"in e?r.createElement(o.A,{title:"Get stack trace"},r.createElement(s.A,{onClick:()=>{i(!0)},color:"primary"},r.createElement(c.A,null))):null,t?r.createElement(o.A,{title:"Retry"},r.createElement(s.A,{onClick:t,color:"primary"},r.createElement(l.A,null))):null,a?r.createElement(r.Suspense,{fallback:null},r.createElement(u,{error:e,onClose:()=>{i(!1)}})):null)}const p=function({error:e,onReset:t}){const{classes:n}=d(),o=`${e}`,s=o.indexOf("expected an instance of"),a=-1!==s?o.slice(0,s):o,l=function(e){let t="";const n=e.indexOf("is not assignable");if(-1!==n){const r=e.slice(0,n+17),o=/.*at path "(.*)" snapshot `(.*)` is not assignable/m.exec(r);o&&(e=`Failed to load element at ${o[1]}...Failed element had snapshot`,t=o[2]);const s=/.*snapshot `(.*)` is not assignable/.exec(r);s&&(e="Failed to load element...Failed element had snapshot",t=s[1])}return t}(o);return r.createElement(i.A,null,a.slice(0,1e4),r.createElement(m,{error:e,onReset:t}),l?r.createElement("pre",{className:n.bg},JSON.stringify(JSON.parse(l),null,2)):null)}},69941:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var r=n(7552),o=n(29499),s=n(99123),a=n(58507),i=n(5401),l=n(92562);function c({onClose:e,open:t,onFactoryReset:n}){function c(t){"reset"===t&&n(),e()}return r.createElement(l.A,{title:"Reset",onClose:()=>{c()},open:t},r.createElement(o.A,null,r.createElement(s.A,null,"Are you sure you want to reset? This will restore the default configuration.")),r.createElement(a.A,null,r.createElement(i.A,{onClick:()=>{c()},color:"primary"},"Cancel"),r.createElement(i.A,{onClick:()=>{c("reset")},color:"primary",variant:"contained"},"OK")))}},90542:(e,t,n)=>{n.d(t,{A8:()=>l,PM:()=>s,jT:()=>a,xU:()=>i});var r=n(2859),o=n(7552);function s(e){return o.createElement(r.A,e,o.createElement("path",{d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"}))}function a(e){return o.createElement(r.A,e,o.createElement("path",{d:"M19.31 18.9L22.39 22L21 23.39L17.88 20.32C17.19 20.75 16.37 21 15.5 21C13 21 11 19 11 16.5C11 14 13 12 15.5 12C18 12 20 14 20 16.5C20 17.38 19.75 18.21 19.31 18.9M15.5 19C16.88 19 18 17.88 18 16.5C18 15.12 16.88 14 15.5 14C14.12 14 13 15.12 13 16.5C13 17.88 14.12 19 15.5 19M21 4V6H3V4H21M3 16V14H9V16H3M3 11V9H21V11H18.97C17.96 10.37 16.77 10 15.5 10C14.23 10 13.04 10.37 12.03 11H3Z"}))}function i(e){return o.createElement(r.A,e,o.createElement("path",{d:"M21 19v-2H8v2h13m0-6v-2H8v2h13M8 7h13V5H8v2M4 5v2h2V5H4M3 5a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V5m1 6v2h2v-2H4m-1 0a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1v-2m1 6v2h2v-2H4m-1 0a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1v-2z"}))}function l(e){return o.createElement(r.A,e,o.createElement("path",{d:"M20 5V4c0-.55-.45-1-1-1h-2c-.55 0-1 .45-1 1v1h-1v4c0 .55.45 1 1 1h1v7c0 1.1-.9 2-2 2s-2-.9-2-2V7c0-2.21-1.79-4-4-4S5 4.79 5 7v7H4c-.55 0-1 .45-1 1v4h1v1c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-1h1v-4c0-.55-.45-1-1-1H7V7c0-1.1.9-2 2-2s2 .9 2 2v10c0 2.21 1.79 4 4 4s4-1.79 4-4v-7h1c.55 0 1-.45 1-1V5h-1z"}))}},34895:(e,t,n)=>{n.d(t,{P:()=>a,R:()=>s});var r=n(7552);function o(e){return"black"===e?{midnight:"#808080",forrest:"#666666",grape:"#4d4d4d",mandarin:"#333333",gray:"#1a1a1a"}:"white"===e?{midnight:"#ffffff",forrest:"#e6e6e6",grape:"#cccccc",mandarin:"#b3b3b3",gray:"#999999"}:{midnight:"#0d233f",forrest:"#135560",grape:"#721e63",mandarin:"#ffb11d",gray:"#dadada"}}function s({variant:e}){return r.createElement("svg",{viewBox:"0 0 175 175"},r.createElement(i,{variant:e}))}function a({variant:e}){return r.createElement("svg",{viewBox:"0 0 641 175"},r.createElement(l,{variant:e}),r.createElement(i,{variant:e}))}function i({variant:e}){const t=o(e);return r.createElement(r.Fragment,null,r.createElement("path",{style:{fill:t.midnight},d:"M120.5,57.5c.168,0,.333.012.5.013V40.506c-.167,0-.333-.006-.5-.006a98.325,98.325,0,0,0-77.4,37.565q-2.664,3.378-5.023,6.994l14.206,9.327Q54.043,91.709,56,89.179A81.363,81.363,0,0,1,120.5,57.5Z"}),r.createElement("path",{style:{fill:t.forrest},d:"M148.668,86.223c.308.133.6.283.908.42l6.746-15.618c-.153-.067-.3-.143-.454-.21a81.36,81.36,0,0,0-71.777,3.5q-2.8,1.544-5.469,3.309l9.249,14.054A63.93,63.93,0,0,1,148.668,86.223Z"}),r.createElement("path",{style:{fill:t.grape},d:"M170.894,109.37A63.929,63.929,0,0,0,113.4,88.861l2.336,15.474a48.456,48.456,0,0,1,44.322,15.42c.111.125.214.255.324.381l11.16-10C171.323,109.879,171.118,109.62,170.894,109.37Z"}),r.createElement("path",{style:{fill:t.mandarin},d:"M150.921,150.314c.04.163.07.326.107.489l16.509-4.058c-.039-.163-.067-.326-.107-.489A48.457,48.457,0,0,0,135.575,111.8l-5.515,15.591A32.466,32.466,0,0,1,150.921,150.314Z"}),r.createElement("path",{style:{fill:t.gray},d:"M134.1,138.129l-9.779,13.213a32.486,32.486,0,0,1,7.823,14.463l15.147.852c.012-.166.032-.331.041-.5A32.464,32.464,0,0,0,134.1,138.129Z"}))}function l({variant:e}){const t=o(e);return r.createElement("g",{"aria-label":"JBrowse",transform:"translate(213.084 144.241)",style:{fill:t.midnight}},r.createElement("path",{d:"m 26.355,-71.505 v 54.075 2.835 q 0,6.825 -0.42,10.185 -0.735,5.67 -2.835,9.135 -3.255,5.355 -8.505,8.4 -4.83,2.73 -11.55,3.57 L 1.47,11.76 Q 7.35,10.185 9.24,4.2 10.605,-0.105 10.605,-9.975 v -5.565 -55.965 q 1.785,0 4.62,0.315 2.835,0.21 3.255,0.21 1.785,0 2.94,-0.105 4.515,-0.42 4.935,-0.42 z"}),r.createElement("path",{d:"m 60.68836,-65.415 v 24.78 h 3.255 q 2.94,0 4.935,-0.525 2.1,-0.525 3.885,-2.1 2.31,-1.995 3.36,-4.83 1.155,-2.835 1.155,-6.09 0,-5.565 -2.94,-8.61 -2.94,-3.045 -8.295,-3.045 -2.52,0 -5.355,0.42 z m 0,30.87 V -6.09 h 5.25 q 4.725,0 8.505,-3.675 3.885,-3.78 3.885,-10.08 0,-8.19 -4.62,-11.655 -4.095,-3.045 -13.02,-3.045 z M 44.93836,0 v -71.505 h 27.09 q 9.135,0 14.385,3.255 6.51,3.99 6.51,12.6 0,7.035 -5.25,11.655 -4.62,4.095 -11.97,5.145 v 0.945 q 7.56,0.735 12.285,3.99 6.615,4.62 6.615,13.335 0,10.185 -7.98,15.75 -6.93,4.83 -17.43,4.83 z"}),r.createElement("path",{d:"M 109.44281,0.525 V -50.4 q 1.785,0.21 3.99,0.42 2.31,0.105 3.255,0.105 2.31,0 4.2,-0.21 1.89,-0.21 3.045,-0.315 v 13.02 q 1.89,-6.51 5.46,-9.87 4.41,-4.095 11.655,-4.095 -0.315,2.73 -0.42,6.825 -0.105,3.99 -0.105,7.455 l -0.945,0.84 q -0.945,-0.735 -2.415,-1.05 -1.47,-0.315 -2.94,-0.315 -3.57,0 -6.195,1.89 -2.52,1.785 -3.465,5.04 -0.42,1.155 -0.525,3.15 -0.105,1.89 -0.105,4.515 v 4.515 19.005 q -1.785,-0.21 -2.625,-0.21 -3.675,-0.315 -4.62,-0.315 -2.31,0 -4.2,0.21 -1.89,0.21 -3.045,0.315 z"}),r.createElement("path",{d:"m 173.77337,1.47 q -11.655,0 -18.585,-6.825 -6.93,-6.825 -6.93,-18.48 0,-12.6 6.72,-20.055 6.825,-7.455 18.9,-7.455 11.97,0 18.9,6.72 6.93,6.72 6.93,18.48 0,12.285 -6.72,19.74 -7.14,7.875 -19.215,7.875 z m 0.735,-48.09 q -5.88,0 -8.505,6.51 -2.205,5.565 -2.205,15.96 0,8.19 1.47,12.915 2.415,7.98 8.505,7.98 5.565,0 8.19,-7.875 2.205,-6.51 2.205,-16.695 0,-8.505 -2.1,-13.23 -2.52,-5.565 -7.56,-5.565 z"}),r.createElement("path",{d:"m 222.03563,-50.4 10.5,36.015 q 3.675,-11.235 5.67,-17.85 2.415,-8.085 5.04,-18.165 1.05,0.105 3.045,0.315 2.1,0.21 2.835,0.21 1.995,0 3.15,-0.105 1.26,-0.21 2.73,-0.42 l 10.71,36.015 q 5.88,-17.43 10.71,-36.015 l 4.2,0.315 4.095,-0.315 q -5.145,13.125 -9.135,24.57 -5.04,14.28 -8.505,26.355 -1.89,-0.21 -3.36,-0.42 -1.365,-0.105 -2.205,-0.105 -1.89,0 -3.36,0.21 -1.365,0.21 -2.31,0.315 l -10.605,-34.755 q -4.41,13.65 -6.72,21.105 -2.31,7.35 -4.095,13.65 -1.89,-0.21 -3.36,-0.42 -1.365,-0.105 -2.31,-0.105 -1.995,0 -3.465,0.21 -1.365,0.21 -2.31,0.315 -3.78,-12.81 -5.04,-17.01 -2.205,-7.245 -5.46,-17.01 -2.835,-8.4 -5.88,-16.905 1.575,0 4.305,0.315 2.73,0.21 3.36,0.21 1.47,0 4.305,-0.21 2.835,-0.315 3.465,-0.315 z"}),r.createElement("path",{d:"m 292.84172,-12.81 h 2.625 q 1.47,4.095 4.62,6.51 3.15,2.415 7.35,2.415 2.94,0 5.46,-1.785 2.625,-1.89 2.625,-4.62 0,-3.885 -6.195,-6.615 -10.395,-4.62 -11.655,-5.46 -6.405,-4.515 -6.405,-12.285 0,-7.77 5.25,-12.18 5.25,-4.515 12.81,-4.515 3.99,0 8.085,1.365 4.095,1.26 7.14,3.57 l -2.52,9.24 h -2.94 q -0.63,-3.57 -3.57,-6.195 -2.835,-2.625 -6.405,-2.625 -3.15,0 -5.46,1.575 -2.31,1.47 -2.31,4.515 0,3.885 6.405,6.51 10.185,4.095 11.865,5.25 6.405,4.41 6.405,12.81 0,7.455 -5.46,12.18 -5.355,4.62 -14.805,4.62 -8.19,0 -14.49,-4.305 z"}),r.createElement("path",{d:"m 349.61228,-29.925 h 15.54 q 0,-6.51 -1.05,-10.395 -1.68,-6.3 -5.88,-6.3 -5.04,0 -7.14,6.195 -1.47,4.305 -1.47,10.5 z m 30.03,5.04 h -30.03 q 0,9.135 3.045,13.86 3.57,5.67 11.55,5.67 3.255,0 6.405,-1.26 3.15,-1.26 5.88,-3.465 l 1.26,0.945 -2.31,5.88 q -6.72,4.725 -15.015,4.725 -12.915,0 -19.635,-7.245 -6.72,-7.245 -6.72,-20.37 0,-11.235 6.405,-18.165 6.51,-7.035 17.64,-7.035 11.655,0 16.905,7.56 4.62,6.615 4.62,18.9 z"}))}},8463:(e,t,n)=>{n.d(t,{A:()=>k,m:()=>A});var r=n(7552),o=n(6679),s=n(24387),a=n(55851),i=n(66765),l=n(29629),c=n(81453),u=n(4407),d=n(943),m=n(9555),p=n(75785),f=n(12756),g=n(49296),h=n(23224),y=n(69381),w=n(70996),b=n(99546);function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}const S=(0,p.n9)()({paper:{position:"fixed",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",top:0,left:0,outline:0},menuItemEndDecoration:{padding:0,margin:0,height:16}});function A(e){const{classes:t}=S(),{type:n}=e;let o,s,a;switch("checked"in e&&({checked:o,disabled:s}=e),n){case"subMenu":a=r.createElement(f.A,{color:"action"});break;case"checkbox":if(o){const e=s?"inherit":void 0;a=r.createElement(g.A,{color:e})}else a=r.createElement(h.A,{color:"action"});break;case"radio":if(o){const e=s?"inherit":void 0;a=r.createElement(y.A,{color:e})}else a=r.createElement(w.A,{color:"action"})}return r.createElement("div",{className:t.menuItemEndDecoration},a)}function C(e){return"divider"!==e.type&&"subHeader"!==e.type&&!e.disabled}const E=r.forwardRef((function(e,t){const[n,m]=(0,r.useState)(),[p,f]=(0,r.useState)(),[g,h]=(0,r.useState)(!1),[y,w]=(0,r.useState)(),[v,k]=(0,r.useState)(),T=(0,r.useRef)(null),{classes:M}=S(),{menuItems:P,onMenuItemClick:I,open:N,onClose:x,anchorEl:R,top:O=!1}=e;(0,r.useEffect)((()=>{N||(m(void 0),f(void 0))}),[N]),(0,r.useEffect)((()=>{const e=N&&Boolean(n);let t;return e&&!g?t=setTimeout((()=>{h(!0)}),300):!e&&g&&(t=setTimeout((()=>{h(!1)}),300)),()=>{clearTimeout(t)}}),[g,N,n]),(0,r.useEffect)((()=>{if(R){const e=R.getBoundingClientRect();v&&e.top===v.top&&e.left+e.width===v.left||k({top:e.top,left:e.left+e.width})}else v||k({})}),[v,R]);const $=P.some((e=>"icon"in e&&e.icon)),D={},L=r.createElement(r.Fragment,null,r.createElement(o.A,{autoFocusItem:N&&!g,dense:!0},P.sort(((e,t)=>(t.priority||0)-(e.priority||0))).map(((e,t)=>{if("divider"===e.type)return r.createElement(s.A,{key:`divider-${JSON.stringify(e)}-${t}`,component:"li"});if("subHeader"===e.type)return r.createElement(a.A,{key:`subHeader-${e.label}-${t}`},e.label);let n=null,o=null;if(e.icon){const t=e.icon;n=r.createElement(i.A,null,r.createElement(t,null))}"subMenu"in e?o=r.createElement(A,{type:"subMenu"}):"checkbox"!==e.type&&"radio"!==e.type||(o=r.createElement(A,{type:e.type,checked:e.checked,disabled:e.disabled}));const u="onClick"in e?(d=e.onClick,e=>{I(e,d)}):void 0;var d;return r.createElement(l.A,{key:e.id||String(e.label),style:D,selected:t===y,onClick:u,onMouseMove:n=>{n.currentTarget!==document.activeElement&&(n.currentTarget.focus(),w(t)),"subMenu"in e?p!==t&&(m(n.currentTarget),f(t)):(m(void 0),f(void 0))},onKeyDown:n=>{switch(n.key){case"ArrowLeft":case"Escape":x?.(n,"escapeKeyDown");break;case"ArrowUp":w(function(e,t){return(0,b.findLastIndex)(e.slice(0,t),C)}(P,t));break;case"ArrowDown":{const e=function(e,t){const n=e.slice(t+1).findIndex(C);return-1===n?n:t+1+n}(P,t);w(e);break}default:!("subMenu"in e)||"ArrowRight"!==n.key&&"Enter"!==n.key||(m(n.currentTarget),f(t),h(!0))}},disabled:Boolean(e.disabled)},n,r.createElement(c.A,{primary:e.label,secondary:e.subLabel,inset:$&&!e.icon}),o)}))),P.map(((e,t)=>{let o=null;return"subMenu"in e&&(o=r.createElement(E,{key:e.id||String(e.label),anchorEl:n,open:g&&p===t,onClose:()=>{h(!1),m(void 0)},onMenuItemClick:I,menuItems:e.subMenu})),o})));return O?L:r.createElement(u.A,{in:N,style:{transformOrigin:"0 0 0"},ref:t},r.createElement(d.A,{elevation:8,ref:T,className:M.paper,style:{...v}},L))})),k=function(e){const{open:t,onClose:n,menuItems:o,onMenuItemClick:s,...a}=e;return r.createElement(m.Ay,v({open:t,onClose:n,anchorOrigin:{vertical:"bottom",horizontal:"right",...a.anchorOrigin},transformOrigin:{vertical:"top",horizontal:"left",...a.transformOrigin}},a),r.createElement(E,{open:t,onClose:n,menuItems:o,onMenuItemClick:s,top:!0}))}},66684:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(7552);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(null,arguments)}const s=(0,n(75785).n9)()({horizontalHandle:{cursor:"row-resize",width:"100%"},verticalHandle:{cursor:"col-resize",height:"100%"},flexbox_verticalHandle:{cursor:"col-resize",alignSelf:"stretch"},flexbox_horizontalHandle:{cursor:"row-resize",alignSelf:"stretch"}}),a=function({onDrag:e,vertical:t=!1,flexbox:n=!1,className:a,onMouseDown:i,...l}){const[c,u]=(0,r.useState)(!1),d=(0,r.useRef)(0),m=(0,r.useRef)(0),{classes:p,cx:f}=s();let g;return(0,r.useEffect)((()=>{function n(n){n.preventDefault();const r=t?n.clientX:n.clientY,o=d.current-r,s=r-m.current;m.current=r,e(s,o)}function r(){u(!1)}return c?(window.addEventListener("mousemove",n,!0),window.addEventListener("mouseup",r,!0),()=>{window.removeEventListener("mousemove",n,!0),window.removeEventListener("mouseup",r,!0)}):()=>{}}),[c,e,t]),g=n?t?p.flexbox_verticalHandle:p.flexbox_horizontalHandle:t?p.verticalHandle:p.horizontalHandle,r.createElement("div",o({"data-resizer":"true",onMouseDown:e=>{e.preventDefault();const n=t?e.clientX:e.clientY;d.current=n,m.current=n,u(!0),i?.(e)},className:f(g,a)},l))}},87686:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(7552),o=n(68446),s=n(29499),a=n(36715),i=n(58507),l=n(5401),c=n(92562);const u=(0,o.observer)((function({model:e,handleClose:t}){return r.createElement(c.A,{maxWidth:"xl",open:!0,onClose:t,title:"Reference sequence"},r.createElement(s.A,null,r.createElement(a.A,null,"Are you sure you want to return to the import form? This will lose your current view")),r.createElement(i.A,null,r.createElement(l.A,{onClick:()=>{e.clearView(),t()},variant:"contained",color:"primary",autoFocus:!0},"OK"),r.createElement(l.A,{onClick:()=>{t()},color:"secondary",variant:"contained"},"Cancel")))}))},13476:(e,t,n)=>{n.d(t,{A:()=>d});var r=n(7552),o=n(10424),s=n.n(o),a=n(53778),i=n.n(a),l=n(99546);let c=!1;const u=new RegExp(["a","b","br","code","div","em","h1","h2","h3","h4","h5","h6","i","img","li","p","pre","span","small","strong","table","tbody","sup","sub","td","tfoot","th","thead","tr","u","ul"].map((e=>`<${e}\\b[^>]*>`)).join("|"),"i");function d({html:e,className:t}){const n=(0,l.linkify)(e),o=(a=n,u.test(a)?n:s()(n));var a;return c||(c=!0,i().addHook("afterSanitizeAttributes",(e=>{"A"===e.tagName&&(e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"))}))),r.createElement("span",{className:t,dangerouslySetInnerHTML:{__html:i().sanitize(o)}})}},49823:(e,t,n)=>{n.r(t),n.d(t,{AssemblySelector:()=>j,CascadingMenu:()=>z.A,Dialog:()=>W.A,EditableTypography:()=>U.A,ErrorMessage:()=>F.A,FactoryResetDialog:()=>V.default,FatalErrorDialog:()=>B.A,FileSelector:()=>oe,LoadingEllipses:()=>se.A,LogoFull:()=>M.P,Logomark:()=>M.R,Menu:()=>ae.A,MenuItemEndDecoration:()=>ae.m,PrerenderedCanvas:()=>le,ResizeHandle:()=>ue.A,ReturnToImportFormDialog:()=>ce.default,SanitizedHTML:()=>de.A,createJBrowseBaseTheme:()=>E,createJBrowseTheme:()=>k,defaultThemes:()=>A});var r=n(53954),o=n(46033),s=n(37231),a=n(8998),i=n(55194),l=n(89022),c=n(35068),u=n.n(c);const d=(0,l.A)(),m="#0D233F",p="#721E63",f=d.palette.augmentColor({color:{main:"#135560"}}),g=d.palette.augmentColor({color:{main:"#FFB11D"}}),h={A:d.palette.augmentColor({color:r.A}),C:d.palette.augmentColor({color:o.A}),G:d.palette.augmentColor({color:s.A}),T:d.palette.augmentColor({color:a.A})},y=[null,d.palette.augmentColor({color:{main:"#FF8080"}}),d.palette.augmentColor({color:{main:"#80FF80"}}),d.palette.augmentColor({color:{main:"#8080FF"}}),d.palette.augmentColor({color:{main:"#8080FF"}}),d.palette.augmentColor({color:{main:"#80FF80"}}),d.palette.augmentColor({color:{main:"#FF8080"}})],w=[null,d.palette.augmentColor({color:{main:"#8f8f8f"}}),d.palette.augmentColor({color:{main:"#adadad"}}),d.palette.augmentColor({color:{main:"#d8d8d8"}}),d.palette.augmentColor({color:{main:"#d8d8d8"}}),d.palette.augmentColor({color:{main:"#adadad"}}),d.palette.augmentColor({color:{main:"#8f8f8f"}})],b="#e22",v="#3e3";function S(){return{palette:{mode:void 0,primary:{main:m},secondary:{main:p},tertiary:f,quaternary:g,highlight:g,stopCodon:b,startCodon:v,bases:h,frames:w,framesCDS:y},components:{MuiLink:{styleOverrides:{root:({theme:e})=>({color:e.palette.tertiary.main})}}}}}const A={default:{...S(),name:"Default (from config)"},lightStock:{...S(),name:"Light (stock)"},lightMinimal:{name:"Light (minimal)",palette:{primary:{main:i.A[900]},secondary:{main:i.A[800]},tertiary:d.palette.augmentColor({color:{main:i.A[900]}}),quaternary:g,highlight:g,stopCodon:b,startCodon:v,bases:h,frames:w,framesCDS:y}},darkMinimal:{name:"Dark (minimal)",palette:{mode:"dark",primary:{main:i.A[700]},secondary:{main:i.A[800]},tertiary:d.palette.augmentColor({color:{main:i.A[900]}}),quaternary:g,highlight:g,stopCodon:b,startCodon:v,bases:h,frames:w,framesCDS:y}},darkStock:{name:"Dark (stock)",palette:{mode:"dark",primary:{main:m},secondary:{main:p},tertiary:f,quaternary:g,highlight:g,stopCodon:b,startCodon:v,bases:h,frames:w,framesCDS:y},components:{MuiAppBar:{defaultProps:{enableColorOnDark:!0},styleOverrides:{root:({theme:e})=>e.palette.primary.main}}}}};function C(e,t){return t}function E(e){const t={palette:e?.palette,typography:{fontSize:12},spacing:4,components:{MuiButton:{defaultProps:{size:"small"},styleOverrides:{root:({theme:e})=>"dark"===e.palette.mode?{color:e.palette.text.primary}:void 0}},MuiAccordion:{defaultProps:{disableGutters:!0,slotProps:{transition:{timeout:150,unmountOnExit:!0}}}},MuiFilledInput:{defaultProps:{margin:"dense"}},MuiFormControl:{defaultProps:{margin:"dense",size:"small"}},MuiFormHelperText:{defaultProps:{margin:"dense"}},MuiIconButton:{defaultProps:{size:"small"}},MuiInputBase:{defaultProps:{margin:"dense"}},MuiAutocomplete:{defaultProps:{size:"small"}},MuiInputLabel:{defaultProps:{margin:"dense"}},MuiToolbar:{defaultProps:{variant:"dense"}},MuiListItem:{defaultProps:{dense:!0}},MuiOutlinedInput:{defaultProps:{margin:"dense"}},MuiFab:{defaultProps:{size:"small"},styleOverrides:{secondary:{backgroundColor:e?.palette?.quaternary?.main}}},MuiTable:{defaultProps:{size:"small"}},MuiPopover:{defaultProps:{transitionDuration:0}},MuiMenu:{defaultProps:{transitionDuration:0}},MuiMenuItem:{defaultProps:{dense:!0}},MuiTextField:{defaultProps:{margin:"dense",variant:"standard"}},MuiLink:{styleOverrides:{root:({theme:e})=>({color:e.palette.text.secondary})}},MuiCheckbox:{styleOverrides:{root:({theme:e})=>"dark"===e.palette.mode?{color:e.palette.text.secondary,"&.Mui-checked":{color:e.palette.text.secondary}}:void 0}},MuiRadio:{styleOverrides:{root:({theme:e})=>"dark"===e.palette.mode?{color:e.palette.text.secondary,"&.Mui-checked":{color:e.palette.text.secondary}}:void 0}},MuiFormLabel:{styleOverrides:{root:({theme:e})=>"dark"===e.palette.mode?{color:e.palette.text.secondary,"&.Mui-focused":{color:e.palette.text.secondary}}:void 0}},MuiAccordionSummary:{styleOverrides:{root:{backgroundColor:e?.palette?.tertiary?.main},content:{color:e?.palette?.tertiary?.contrastText}}},MuiToggleButtonGroup:{defaultProps:{size:"small"}}}};return u()(t,e||{},{arrayMerge:C})}function k(e={},t=A,n="default"){return(0,l.A)(E("default"===n?u()(t.default,T(e),{arrayMerge:C}):function(e={}){return e=T(e),e.palette?.quaternary||(e=u()(e,{palette:{quaternary:d.palette.augmentColor({color:{main:"#aaa"}})}})),e.palette?.tertiary||(e=u()(e,{palette:{tertiary:d.palette.augmentColor({color:{main:"#aaa"}})}})),e}(t[n])))}function T(e={}){return e.palette?.tertiary&&(e=u()(e,{palette:{tertiary:d.palette.augmentColor("color"in e.palette.tertiary?e.palette.tertiary:{color:e.palette.tertiary})}})),e.palette?.quaternary&&(e=u()(e,{palette:{quaternary:d.palette.augmentColor("color"in e.palette.quaternary?e.palette.quaternary:{color:e.palette.quaternary})}})),e}var M=n(34895),P=n(7552),I=n(1343),N=n(29629),x=n(68446),R=n(75785),O=n(68584),$=n(99546);function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D.apply(null,arguments)}const L=(0,R.n9)()({importFormEntry:{minWidth:180}}),j=(0,x.observer)((function({session:e,onChange:t,selected:n,InputProps:r,TextFieldProps:o,localStorageKey:s,helperText:a="Select assembly to view"}){const{classes:i}=L(),{assemblyNames:l,assemblyManager:c}=e,u=new URLSearchParams(window.location.search).get("config"),[d,m]="undefined"==typeof jest&&s?(0,$.useLocalStorage)(`lastAssembly-${[window.location.host+window.location.pathname,u,s].join("-")}`,n):(0,P.useState)(n),p=l.includes(d||"")?d:n;(0,P.useEffect)((()=>{p&&p!==n&&t(p)}),[p,t,n]);const f=l.length?"":"No configured assemblies";return P.createElement(I.A,D({select:!0,label:"Assembly",variant:"outlined",helperText:f||a,value:p||"",inputProps:{"data-testid":"assembly-selector"},onChange:e=>{m(e.target.value)},error:!!f,InputProps:r,disabled:!!f,className:i.importFormEntry},o),l.map((e=>{const t=c.get(e),n=t?(0,O.getConf)(t,"displayName"):"";return P.createElement(N.A,{key:e,value:e},n||e)})))}));var z=n(85206),W=n(92562),U=n(88373),F=n(38033),V=n(69941),B=n(56174),q=n(89003),G=n(82620),_=n(17776),H=n(17125),J=n(43787),Q=n(2051),K=n(25467),Y=n(92516),Z=n(43550),X=n(14862),ee=n(32813);function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},te.apply(null,arguments)}function ne(e){const{title:t,children:n,...r}=e;return P.createElement(q.A,{title:t||""},P.createElement(G.A,r,n))}function re(e,t){return"string"==typeof e&&e.length>t?`${e.slice(0,Math.max(0,t))}…`:e}const oe=(0,x.observer)((function(e){const{location:t,name:n,description:r,rootModel:o,setLocation:s}=e,a=!t||(0,Y.C1)(t)?"url":"file",[i,l]=(0,P.useState)(t&&"internetAccountId"in t&&t.internetAccountId?t.internetAccountId:a),c=(0,Y.bV)(o)?o.internetAccounts.filter((e=>"HTTPBasicInternetAccount"!==e.type)):[],[u,d]=(0,$.useLocalStorage)("fileSelector-recentlyUsedInternetAccounts",[]),m=Object.fromEntries(c.map((e=>[e.internetAccountId,e]))),p=[...new Set(c.map((e=>e.internetAccountId)))].sort(((e,t)=>u.indexOf(e)-u.indexOf(t))),f=p.slice(0,2),g=p.slice(2),[h,y]=(0,P.useState)(null),w=m[i],b=(0,P.useCallback)((e=>{s({...e,...w&&(0,Y.C1)(e)?{internetAccountId:w.internetAccountId}:{}})}),[s,w]);(0,P.useEffect)((()=>{w&&(0,Y.C1)(t)&&t.internetAccountId!==w.internetAccountId&&b(t)}),[t,w,b]);let v=P.createElement(X.A,te({},e,{setLocation:b,label:w?.selectorLabel}));if("file"===i&&(v=P.createElement(Z.A,e)),w?.SelectorComponent){const{SelectorComponent:t}=w;v=P.createElement(t,te({},e,{setLocation:b}))}return P.createElement(P.Fragment,null,P.createElement(_.A,{display:"flex"},P.createElement(H.A,{shrink:!0},n)),P.createElement(_.A,{display:"flex",flexDirection:"row"},P.createElement(_.A,null,P.createElement(J.A,{value:i,exclusive:!0,onChange:(e,n)=>{d([...new Set([n,...u].filter($.notEmpty))]),n&&l(n),(0,Y.C1)(t)&&b(t)},"aria-label":"file, url, or account picker"},new URLSearchParams(window.location.search).get("adminKey")?null:P.createElement(G.A,{value:"file","aria-label":"local file"},"File"),P.createElement(G.A,{value:"url","aria-label":"url"},"URL"),f.map((e=>{const{internetAccountId:t,name:n,toggleContents:r}=m[e];return P.createElement(ne,{key:e,value:t,title:n},"string"==typeof r?re(r,5):r||re(n,5))})),g.length>0?P.createElement(G.A,{onClick:e=>{y(e.target)},selected:!1},"More",P.createElement(ee.A,null)):null),P.createElement(Q.A,{open:Boolean(h),anchorEl:h,onClose:()=>{y(null)},anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},g.map((e=>{const{internetAccountId:t,name:n}=m[e];return P.createElement(N.A,{key:e,value:t,onClick:()=>{d([...new Set([t,...u].filter($.notEmpty))]),l(t),y(null)}},n)}))))),v,P.createElement(K.A,null,r))}));var se=n(37565),ae=n(8463),ie=n(18010);const le=function(e){const{width:t,height:n,highResolutionScaling:r=1,style:o={},imageData:s,blockKey:a,showSoftClip:i}=e,[l,c]=(0,P.useState)(!1),u=(0,P.useRef)(null);return(0,P.useEffect)((()=>{if(!s)return;const e=u.current;if(!e)return;const t=e.getContext("2d");t&&((0,ie.pv)(s,t),c(!0))}),[s]),P.createElement("canvas",{"data-testid":["prerendered_canvas",i?"softclipped":"",a,l?"done":""].filter((e=>!!e)).join("_"),ref:u,width:t*r,height:n*r,style:{width:t,height:n,...o}})};var ce=n(87686),ue=n(66684),de=n(13476)},43334:(e,t,n)=>{n.d(t,{A:()=>r});class r extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)||(yield e)}for(const e of this.cache){const[t,n]=e;this._deleteIfExpired(t,n)||(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const r="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r})}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;this._deleteIfExpired(t,n)||(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)||(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[r,o]=n;this._deleteIfExpired(r,o)||(yield[r,o.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[r,o]=n;this.cache.has(r)||this._deleteIfExpired(r,o)||(yield[r,o.value])}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}},99546:(e,t,n)=>{n.r(t),n.d(t,{AuthNeededError:()=>l._u,ImageBitmapType:()=>h.bV,ReactRendering:()=>y.aE,RetryError:()=>l.J_,SimpleFeature:()=>w.A,TextSearchManager:()=>l.rz,abortBreakPoint:()=>c.Yo,assembleLocString:()=>N,assembleLocStringFast:()=>x,avg:()=>De,blobToDataURL:()=>b.y,bpSpanPx:()=>G,bpToPx:()=>j,bytesForRegions:()=>he,cartesianToPolar:()=>B,checkAbortSignal:()=>c.pB,clamp:()=>L,coarseStripHTML:()=>Te,compareLocStrings:()=>D,compareLocs:()=>$,complement:()=>oe,createCanvas:()=>h.Nw,createImageBitmap:()=>h.T9,dedupe:()=>g.Q,defaultCodonTable:()=>de,defaultStarts:()=>ce,defaultStops:()=>ue,degToRad:()=>F,doesIntersect2:()=>f.R6,drawImageOntoCanvasContext:()=>h.pv,featureSpanPx:()=>q,findLast:()=>J,findLastIndex:()=>H,findParentThat:()=>C,findParentThatIs:()=>k,gatherOverlaps:()=>We,generateCodonTable:()=>me,getBpDisplayStr:()=>we,getContainingDisplay:()=>I,getContainingTrack:()=>P,getContainingView:()=>M,getEnv:()=>Ie,getFillProps:()=>Ve,getFrame:()=>le,getLayoutId:()=>Ae,getSerializedSvg:()=>y.Jy,getSession:()=>T,getStr:()=>ke,getStrokeProps:()=>Fe,getTickDisplayStr:()=>ve,getUriLink:()=>Ee,getViewParams:()=>Se,groupBy:()=>Le,hashCode:()=>fe,intersection2:()=>f.ky,isAbortException:()=>c.Kp,isAbstractMenuManager:()=>l.Nh,isAppRootModel:()=>l.bV,isAuthNeededException:()=>l.ZL,isBlobLocation:()=>l.rF,isContainedWithin:()=>f.Xx,isDisplayModel:()=>l.Uy,isElectron:()=>te,isFeature:()=>w.l,isGzip:()=>qe,isLocalPathLocation:()=>l.EV,isRetryException:()=>l.yH,isRootModelWithInternetAccounts:()=>l.lL,isSelectionContainer:()=>l.mY,isSessionModel:()=>l.Y$,isSessionModelWithConfigEditing:()=>l.u3,isSessionModelWithConnectionEditing:()=>l.gx,isSessionModelWithConnections:()=>l.BY,isSessionModelWithWidgets:()=>l.lO,isSessionWithAddTracks:()=>l.QW,isSessionWithSessionPlugins:()=>l.zA,isSessionWithShareURL:()=>l.xv,isSupportedIndexingAdapter:()=>ye,isTrackModel:()=>l.xU,isTrackViewModel:()=>l.EO,isUriLocation:()=>l.C1,isViewContainer:()=>l.DW,isViewModel:()=>l.Tl,iterMap:()=>_,linkify:()=>Me,localStorageGetItem:()=>Ne,localStorageSetItem:()=>xe,makeAbortError:()=>c.zm,makeAbortableReaction:()=>Q,max:()=>Re,measureGridWidth:()=>Pe,measureText:()=>ie,mergeIntervals:()=>ze,min:()=>Oe,minmax:()=>Z,notEmpty:()=>je,objectHash:()=>ge,observeAbortSignal:()=>c.R1,parseLocString:()=>O,parseLocStringOneBased:()=>R,polarToCartesian:()=>V,rIC:()=>se,radToDeg:()=>U,renameRegionIfNeeded:()=>K,renameRegionsIfNeeded:()=>Y,renderToAbstractCanvas:()=>y.u1,renderToStaticMarkup:()=>Be,revcom:()=>ne,reverse:()=>re,shorten:()=>X,springAnimate:()=>E,stringify:()=>ee,stripAlpha:()=>Ue,sum:()=>$e,toLocale:()=>be,updateStatus:()=>pe,useDebounce:()=>v,useDebouncedCallback:()=>A,useLocalStorage:()=>Ce,useWidthSetter:()=>S,when:()=>p.z,whenPresent:()=>p.I});var r=n(7552),o=n(503),s=n.n(o),a=n(36422),i=n(42489),l=n(92516),c=n(20166),u=n(40085),d=n(87485),m=n(28485),p=n(1864),f=n(32595),g=n(3519),h=n(18010),y=n(98506),w=n(6434),b=n(31673);function v(e,t){const[n,o]=(0,r.useState)(e);return(0,r.useEffect)((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),n}function S(e,t){const[n,{width:o}]=(0,u.A)();return(0,r.useEffect)((()=>{o&&(0,a.isAlive)(e)&&requestAnimationFrame((()=>{e.setWidth(o-2*Number.parseInt(t,10))}))}),[t,e,o]),n}function A(e,t=400){const n=(0,r.useRef)(),o=(0,r.useRef)();return(0,r.useEffect)((()=>{o.current&&clearTimeout(o.current)}),[]),function(...r){n.current=r,o.current&&clearTimeout(o.current),o.current=setTimeout((()=>{n.current&&e(...n.current)}),t)}}function C(e,t){if(!(0,a.hasParent)(e))throw new Error("node does not have parent");let n=(0,a.getParent)(e);for(;n&&(0,a.isAlive)(n);){if(t(n))return n;if(!(0,a.hasParent)(n))break;n=(0,a.getParent)(n)}throw new Error("no matching node found")}function E(e,t,n,r=()=>{},o=0,s=400,a=20,i=!0){let l;function c(u){const d=Date.now();let m=u.lastPosition,p=u.lastTime||d,f=u.lastVelocity||0;d>p+64&&(p=d);const g=Math.floor(d-p);for(let e=0;e<g;++e)f+=(-s*(m-t)+-a*f)/1*1/1e3,m+=1*f/1e3;const h=Math.abs(f)<=o,y=0===s||Math.abs(t-m)<=o;i&&0!==s&&(e<t?m>t:m<t)||h&&y?(n(t),r()):(n(m),l=requestAnimationFrame((()=>{c({lastPosition:m,lastTime:d,lastVelocity:f})})))}return o||(o=Math.abs(t-e)/1e3),[()=>{c({lastPosition:e})},()=>{cancelAnimationFrame(l)}]}function k(e,t){return C(e,t)}function T(e){try{return k(e,l.Y$)}catch(e){throw new Error("no session model found!")}}function M(e){try{return k(e,l.Tl)}catch(e){throw new Error("no containing view found")}}function P(e){try{return k(e,l.xU)}catch(e){throw new Error("no containing track found")}}function I(e){try{return k(e,l.Uy)}catch(e){throw new Error("no containing display found")}}function N(e){return x(e,be)}function x(e,t=e=>e){const{assemblyName:n,refName:r,start:o,end:s,reversed:a}=e,i=n?`{${n}}`:"";let l,c;l=void 0!==o?`:${t(o+1)}`:void 0!==s?":1":"",c=void 0!==s?void 0!==o&&o+1===s?"":`..${t(s)}`:void 0!==o?"..":"";let u="";return a&&(u="[rev]"),`${i}${r}${l}${c}${u}`}function R(e,t){if(!e)throw new Error("no location string provided, could not parse");let n=!1;e.endsWith("[rev]")&&(n=!0,e=e.replace(/\[rev]$/,"")),e=e.replace(/\s/,"");const r=/({(.+)})?(.+)/.exec(e);if(!r)throw new Error(`invalid location string: "${e}"`);const[,,o,s]=r,a=o,i=s;if(!a&&i.startsWith("{}"))throw new Error(`no assembly name was provided in location "${i}"`);const l=i.lastIndexOf(":");if(-1===l){if(t(i,a))return{assemblyName:a,refName:i,reversed:n};throw new Error(`Unknown reference sequence "${i}"`)}const c=i.slice(0,l),u=i.slice(l+1);if(t(c,a)&&t(i,a))throw new Error(`ambiguous location string: "${e}"`);if(t(c,a)){if(!u)return{assemblyName:a,refName:c,reversed:n};{const t=/^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)(-?(\d+|\d{1,3}(,\d{3})*))$/.exec(u),r=/^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)?$/.exec(u);if(t){const[,e,,,,r]=t;if(void 0!==e&&void 0!==r)return{assemblyName:a,refName:c,start:+e.replaceAll(",",""),end:+r.replaceAll(",",""),reversed:n}}else{if(!r)throw new Error(`could not parse range "${u}" on location "${e}"`);{const[,e,,,t]=r;if(void 0!==e)return t?{assemblyName:a,refName:c,start:+e.replaceAll(",",""),reversed:n}:{assemblyName:a,refName:c,start:+e.replaceAll(",",""),end:+e.replaceAll(",",""),reversed:n}}}}}else if(t(i,a))return{assemblyName:a,refName:i,reversed:n};throw new Error(`unknown reference sequence name in location "${e}"`)}function O(e,t){const n=R(e,t);return"number"==typeof n.start&&(n.start-=1),n}function $(e,t){const n=e.assemblyName||t.assemblyName?(e.assemblyName||"").localeCompare(t.assemblyName||""):0;if(n)return n;const r=e.refName||t.refName?(e.refName||"").localeCompare(t.refName||""):0;if(r)return r;if(void 0!==e.start&&void 0!==t.start){const n=e.start-t.start;if(n)return n}if(void 0!==e.end&&void 0!==t.end){const n=e.end-t.end;if(n)return n}return 0}function D(e,t,n){return $(O(e,n),O(t,n))}function L(e,t,n){return e<t?t:e>n?n:e}function j(e,{reversed:t,end:n=0,start:r=0},o){return s=(t?n-e:e-r)/o,Math.round(10*s)/10;var s}const z=180/Math.PI,W=Math.PI/180;function U(e){return e*z%360}function F(e){return e*W%(2*Math.PI)}function V(e,t){return[e*Math.cos(t),e*Math.sin(t)]}function B(e,t){return[Math.sqrt(e*e+t*t),Math.atan(t/e)]}function q(e,t,n){return G(e.get("start"),e.get("end"),t,n)}function G(e,t,n,r){const o=j(e,n,r),s=j(t,n,r);return n.reversed?[s,o]:[o,s]}function _(e,t,n){const r=Array.from({length:n||0});let o=0;for(const n of e)r[o]=t(n),o+=1;return r}function H(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return n;return-1}function J(e,t){let n=e.length;for(;n--;)if(t(e[n],n,e))return e[n]}function Q(e,t,n,r,o,s,l){let u;function d(t){(0,c.Kp)(t)||((0,a.isAlive)(e)?l(t):console.error(t))}(0,a.addDisposer)(e,(0,i.reaction)((()=>{try{return t(e)}catch(e){return void d(e)}}),(async(t,r)=>{if(u&&!u.signal.aborted&&u.abort(),!(0,a.isAlive)(e))return;u=new AbortController;const i=u;o(i);try{const o=await n(t,i.signal,e,r);(0,c.pB)(i.signal),(0,a.isAlive)(e)&&s(o)}catch(e){i.signal.aborted||i.abort(),d(e)}}),r)),(0,a.addDisposer)(e,(()=>{u&&!u.signal.aborted&&u.abort()}))}function K(e,t){if((0,a.isStateTreeNode)(t)&&!(0,a.isAlive)(t))return t;if(e?.[t.refName]){const n=e[(t=(0,a.isStateTreeNode)(t)?{...(0,a.getSnapshot)(t)}:{...t}).refName];if(n)return{...t,refName:n,originalRefName:t.refName}}return t}async function Y(e,t){const{regions:n=[],adapterConfig:r}=t;if(!t.sessionId)throw new Error("sessionId is required");const o=n.map((e=>e.assemblyName)),s=Object.fromEntries(await Promise.all([...new Set(o)].map((async n=>[n,await e.getRefNameMapForAdapter(r,n,t)]))));return{...t,regions:n.map(((e,t)=>K(s[o[t]],e)))}}function Z(e,t){return[Math.min(e,t),Math.max(e,t)]}function X(e,t=70,n=30){return e.length>t?`${e.slice(0,n)}...${e.slice(-n)}`:e}function ee({refName:e,coord:t,assemblyName:n,oob:r},o){return[n&&o?`{${n}}`:"",e?`${X(e)}:${be(t)}${r?" (out of bounds)":""}`:""].join("")}const te=/electron/i.test("undefined"!=typeof navigator?navigator.userAgent:"");function ne(e){return re(oe(e))}function re(e){return e.split("").reverse().join("")}const oe=(()=>{const e=/[ACGT]/gi,t={S:"S",w:"w",T:"A",r:"y",a:"t",N:"N",K:"M",x:"x",d:"h",Y:"R",V:"B",y:"r",M:"K",h:"d",k:"m",C:"G",g:"c",t:"a",A:"T",n:"n",W:"W",X:"X",m:"k",v:"b",B:"V",s:"s",H:"D",c:"g",D:"H",b:"v",R:"Y",G:"C"};return n=>n.replaceAll(e,(e=>t[e]||""))})(),se="undefined"==typeof jest?"undefined"!=typeof window&&window.requestIdleCallback?window.requestIdleCallback:e=>setTimeout((()=>{e()}),1):e=>{e()},ae=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2796875,.2765625,.3546875,.5546875,.5546875,.8890625,.665625,.190625,.3328125,.3328125,.3890625,.5828125,.2765625,.3328125,.2765625,.3015625,.5546875,.5546875,.5546875,.5546875,.5546875,.5546875,.5546875,.5546875,.5546875,.5546875,.2765625,.2765625,.584375,.5828125,.584375,.5546875,1.0140625,.665625,.665625,.721875,.721875,.665625,.609375,.7765625,.721875,.2765625,.5,.665625,.5546875,.8328125,.721875,.7765625,.665625,.7765625,.721875,.665625,.609375,.721875,.665625,.94375,.665625,.665625,.609375,.2765625,.3546875,.2765625,.4765625,.5546875,.3328125,.5546875,.5546875,.5,.5546875,.5546875,.2765625,.5546875,.5546875,.221875,.240625,.5,.221875,.8328125,.5546875,.5546875,.5546875,.5546875,.3328125,.5,.2765625,.5546875,.5,.721875,.5,.5,.5,.3546875,.259375,.353125,.5890625];function ie(e,t=10){const n=String(e);let r=0;for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);r+=ae[t]??.5279276315789471}return r*t}function le(e,t,n,r){return 1===n?(e+r)%3+1:(t-r)%3*-1-1}const ce=["ATG"],ue=["TAA","TAG","TGA"],de={TCA:"S",TCC:"S",TCG:"S",TCT:"S",TTC:"F",TTT:"F",TTA:"L",TTG:"L",TAC:"Y",TAT:"Y",TAA:"*",TAG:"*",TGC:"C",TGT:"C",TGA:"*",TGG:"W",CTA:"L",CTC:"L",CTG:"L",CTT:"L",CCA:"P",CCC:"P",CCG:"P",CCT:"P",CAC:"H",CAT:"H",CAA:"Q",CAG:"Q",CGA:"R",CGC:"R",CGG:"R",CGT:"R",ATA:"I",ATC:"I",ATT:"I",ATG:"M",ACA:"T",ACC:"T",ACG:"T",ACT:"T",AAC:"N",AAT:"N",AAA:"K",AAG:"K",AGC:"S",AGT:"S",AGA:"R",AGG:"R",GTA:"V",GTC:"V",GTG:"V",GTT:"V",GCA:"A",GCC:"A",GCG:"A",GCT:"A",GAC:"D",GAT:"D",GAA:"E",GAG:"E",GGA:"G",GGC:"G",GGG:"G",GGT:"G"};function me(e){const t={};return Object.keys(e).forEach((n=>{const r=e[n],o=[];for(let e=0;e<3;e++){const t=n.charAt(e);o[e]=[],o[e][0]=t.toUpperCase(),o[e][1]=t.toLowerCase()}for(let e=0;e<2;e++){const n=o[0][e];for(let e=0;e<2;e++){const s=o[1][e];for(let e=0;e<2;e++){const a=o[2][e];t[n+s+a]=r}}}})),t}async function pe(e,t,n){t(e);const r=await n();return t(""),r}function fe(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}function ge(e){return`${fe(JSON.stringify(e))}`}async function he(e,t){return(await Promise.all(e.map((e=>t.blocksForRange(e.refName,e.start,e.end))))).flat().map((e=>({start:e.minv.blockPosition,end:e.maxv.blockPosition+65535}))).reduce(((e,t)=>e+t.end-t.start),0)}function ye(e=""){return["Gff3TabixAdapter","VcfTabixAdapter","Gff3Adapter","VcfAdapter"].includes(e)}function we(e){return Math.floor(e/1e6)>0?`${Number.parseFloat((e/1e6).toPrecision(3))}Mbp`:Math.floor(e/1e3)>0?`${Number.parseFloat((e/1e3).toPrecision(3))}Kbp`:`${be(Math.floor(e))}bp`}function be(e){return e.toLocaleString("en-US")}function ve(e,t){return Math.floor(t/1e3)>0?`${be(Number.parseFloat((e/1e6).toFixed(2)))}M`:be(Math.floor(e))}function Se(e,t){const{dynamicBlocks:n,staticBlocks:r,offsetPx:o}=M(e),s=n?.contentBlocks[0]||{},a=r?.contentBlocks[0]||{},i=r?.contentBlocks[1]||{};return{offsetPx:t?0:o-a.offsetPx,offsetPx1:t?0:o-i.offsetPx,start:s.start,end:s.end}}function Ae({sessionId:e,layoutId:t}){return`${e}-${t}`}function Ce(e,t){const[n,o]=(0,r.useState)((()=>{if("undefined"==typeof window)return t;try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return console.error(e),t}}));return[n,t=>{try{const r=t instanceof Function?t(n):t;o(r),"undefined"!=typeof window&&window.localStorage.setItem(e,JSON.stringify(r))}catch(e){console.error(e)}}]}function Ee(e){const{uri:t,baseUri:n=""}=e;let r;try{r=new URL(t,n).href}catch(e){r=t}return r}function ke(e){return s()(e)?(0,l.C1)(e)?Ee(e):JSON.stringify(e):String(e)}function Te(e){return e.replaceAll(/(<([^>]+)>)/gi,"")}function Me(e){return e.replaceAll(/(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[-A-Z0-9+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi,"$1<a href='$2' target=\"_blank\">$2</a>")}function Pe(e,t){const{padding:n=30,minWidth:r=80,fontSize:o=12,maxWidth:s=1e3,stripHTML:a=!1}=t||{};return Re(e.map((e=>ke(e))).map((e=>a?Te(e):e)).map((e=>ie(e,o))).map((e=>Math.min(Math.max(e+n,r),s))))}function Ie(e){return(0,a.getEnv)(e)}function Ne(e){return"undefined"!=typeof localStorage?localStorage.getItem(e):void 0}function xe(e,t){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}function Re(e,t=Number.NEGATIVE_INFINITY){let n=t;for(const t of e)n=t>n?t:n;return n}function Oe(e,t=Number.POSITIVE_INFINITY){let n=t;for(const t of e)n=t<n?t:n;return n}function $e(e){let t=0;for(const n of e)t+=n;return t}function De(e){return $e(e)/e.length}function Le(e,t){const n={};for(const r of e){const e=t(r);n[e]||(n[e]=[]),n[e].push(r)}return n}function je(e){return null!=e}function ze(e,t=5e3){if(e.length<=1)return e;const n=[];let r=null;e=e.sort(((e,t)=>e.start-t.start)),n.push(e[0]);for(let o=1;o<e.length;o++)r=n.at(-1),r.end+t<e[o].start-t?n.push(e[o]):r.end<e[o].end&&(r.end=Math.max(r.end,e[o].end),n.pop(),n.push(r));return n}function We(e,t=5e3){const n={};for(const t of e)n[t.refName]||(n[t.refName]=[]),n[t.refName].push(t);return Object.values(n).flatMap((e=>ze(e.sort(((e,t)=>e.start-t.start)),t)))}function Ue(e){return(0,d.M)(e).alpha(1).toHex()}function Fe(e){const t=(0,d.M)(e);return{strokeOpacity:t.alpha(),stroke:t.alpha(1).toHex()}}function Ve(e){const t=(0,d.M)(e);return{fillOpacity:t.alpha(),fill:t.alpha(1).toHex()}}function Be(e,t){const n=document.createElement("div");return(0,m.flushSync)((()=>{t?t(n).render(e):(0,m.render)(e,n)})),n.innerHTML.replaceAll(/\brgba\((.+?),[^,]+?\)/g,"rgb($1)")}function qe(e){return 31===e[0]&&139===e[1]&&8===e[2]}},91468:(e,t,n)=>{n.r(t),n.d(t,{UNKNOWN:()=>u,UNSUPPORTED:()=>d,generateUnknownTrackConf:()=>E,generateUnsupportedTrackConf:()=>C,getBlob:()=>p,getBlobMap:()=>f,getConfAssemblyNames:()=>i,getFileName:()=>v,getParentRenderProps:()=>c,getRpcSessionId:()=>l,getTrackAssemblyNames:()=>a,getTrackName:()=>k,guessAdapter:()=>S,guessTrackType:()=>A,makeIndex:()=>w,makeIndexType:()=>b,setBlobMap:()=>g,storeBlobLocation:()=>y});var r=n(36422),o=n(99546),s=n(68584);function a(e){return i(e.configuration)}function i(e){const t=(0,s.readConfObject)(e,"assemblyNames");if(!t){const t=(0,r.getParent)(e);if("sequence"in t)return[(0,s.readConfObject)(t,"name")];throw new Error("unknown assembly names")}return t}function l(e){let t;for(let n=e;!(0,r.isRoot)(n);n=(0,r.getParent)(n))"rpcSessionId"in n&&(t=n.rpcSessionId);if(!t)throw new Error("getRpcSessionId failed, no parent node in the state tree has an `rpcSessionId` attribute");return t}function c(e){for(let t=(0,r.getParent)(e);!(0,r.isRoot)(t);t=(0,r.getParent)(t))if("renderProps"in t)return t.renderProps();return{}}const u="UNKNOWN",d="UNSUPPORTED";let m={};function p(e){return m[e]}function f(){return m}function g(e){m=e}let h=0;function y(e){if("blob"in e){const t=`b${+Date.now()}-${h++}`;return m[t]=e.blob,{name:e.blob.name,blobId:t,locationType:"BlobLocation"}}return e}function w(e,t){return"uri"in e?{uri:e.uri+t,locationType:"UriLocation"}:"localPath"in e?{localPath:e.localPath+t,locationType:"LocalPathLocation"}:e}function b(e,t,n){return e?.toUpperCase().endsWith(t)?t:n}function v(e){const t="uri"in e?e.uri:void 0,n="localPath"in e?e.localPath:void 0,r="blobId"in e?e:void 0;return r?.name||t?.slice(t.lastIndexOf("/")+1)||n?.slice(n.replace(/\\/g,"/").lastIndexOf("/")+1)||""}function S(e,t,n,r){if(r){const{pluginManager:s}=(0,o.getEnv)(r),a=s.evaluateExtensionPoint("Core-guessAdapterForLocation",((e,t,n)=>{}))(e,t,n);if(a)return a}return{type:u}}function A(e,t){if(t){const n=(0,o.getSession)(t),r=(0,o.getEnv)(n).pluginManager.evaluateExtensionPoint("Core-guessTrackTypeForLocation",(e=>{}))(e);if(r)return r}return"FeatureTrack"}function C(e,t,n){const r={type:"FeatureTrack",name:`${e} (Unsupported)`,description:`Support not yet implemented for "${t}"`,category:n,trackId:""};return r.trackId=(0,o.objectHash)(r),r}function E(e,t,n){const r={type:"FeatureTrack",name:`${e} (Unknown)`,description:`Could not determine track type for "${t}"`,category:n,trackId:""};return r.trackId=(0,o.objectHash)(r),r}function k(e,t){const n=(0,s.readConfObject)(e,"name");if(!n&&"ReferenceSequenceTrack"===(0,s.readConfObject)(e,"type")){const n=t.assemblies.find((t=>t.sequence===e));return n?`Reference sequence (${(0,s.readConfObject)(n,"displayName")||(0,s.readConfObject)(n,"name")})`:"Reference sequence"}return n}},8832:(e,t,n)=>{n.r(t),n.d(t,{BlobLocation:()=>c,ElementId:()=>s,FileLocation:()=>m,LocalPathLocation:()=>l,NoAssemblyRegion:()=>a,Region:()=>i,UriLocation:()=>d,UriLocationRaw:()=>u});var r=n(36422),o=n(32761);const s=r.types.optional(r.types.identifier,(()=>(0,o.Ak)())),a=r.types.model("NoAssemblyRegion",{refName:r.types.string,start:r.types.number,end:r.types.number,reversed:r.types.optional(r.types.boolean,!1)}).actions((e=>({setRefName(t){e.refName=t}}))),i=r.types.compose("Region",a,r.types.model({assemblyName:r.types.string})),l=r.types.model("LocalPathLocation",{locationType:r.types.literal("LocalPathLocation"),localPath:r.types.string}),c=r.types.model("BlobLocation",{locationType:r.types.literal("BlobLocation"),name:r.types.string,blobId:r.types.string}),u=r.types.model("UriLocation",{locationType:r.types.literal("UriLocation"),uri:r.types.string,baseUri:r.types.maybe(r.types.string),internetAccountId:r.types.maybe(r.types.string),internetAccountPreAuthorization:r.types.maybe(r.types.model("InternetAccountPreAuthorization",{internetAccountType:r.types.string,authInfo:r.types.frozen()}))}),d=r.types.snapshotProcessor(u,{postProcessor:e=>{const{baseUri:t,...n}=e;return t?e:n}}),m=r.types.snapshotProcessor(r.types.union(l,d,c),{preProcessor(e){if(!e)return;const{locationType:t,...n}=e;if(!t){const{uri:e,localPath:t,blob:r}=n;let o="";return void 0!==e?o="UriLocation":void 0!==t?o="LocalPathLocation":void 0!==r&&(o="BlobLocation"),{...n,locationType:o}}return e}})},45858:(e,t,n)=>{n.d(t,{DH:()=>s,qk:()=>a});var r=n(36422),o=n(8832);function s(e){return r.types.model({id:o.ElementId,name:r.types.string,margin:0}).volatile((()=>({selection:void 0,hovered:void 0}))).views((e=>({get root(){return(0,r.getParent)(e)}}))).views((e=>({get jbrowse(){return e.root.jbrowse},get rpcManager(){return e.root.rpcManager},get configuration(){return this.jbrowse.configuration},get adminMode(){return e.root.adminMode},get textSearchManager(){return e.root.textSearchManager}}))).views((e=>({get assemblies(){return e.jbrowse.assemblies}}))).actions((e=>({setSelection(t){e.selection=t},clearSelection(){e.selection=void 0},setHovered(t){e.hovered=t}})))}function a(e){return"id"in e&&"name"in e&&"root"in e}},49204:(e,t,n)=>{n.d(t,{F:()=>a,M:()=>i});var r=n(68584),o=n(36422),s=n(45858);function a(e){return o.types.model({connectionInstances:o.types.array(e.pluggableMstType("connection","stateModel"))}).views((e=>({get connections(){const{jbrowse:t}=e;return t.connections}}))).actions((t=>({makeConnection(n,o={}){const s=n.type;if(!s)throw new Error("track configuration has no `type` listed");const a=(0,r.readConfObject)(n,"name");if(!e.getConnectionType(s))throw new Error(`unknown connection type ${s}`);const i=t.connectionInstances.push({...o,name:a,type:s,configuration:n});return t.connectionInstances[i-1]},prepareToBreakConnection(e){const n=t,o=[],s={},a=(0,r.readConfObject)(e,"name"),i=t.connectionInstances.find((e=>e.name===a));if(i){for(const e of i.tracks){const t=n.getReferring(e);n.removeReferring(t,e,o,s)}return[()=>{o.forEach((e=>{e()})),this.breakConnection(e)},s]}},breakConnection(e){const n=(0,r.readConfObject)(e,"name"),o=t.connectionInstances.find((e=>e.name===n));if(!o)throw new Error(`no connection found with name ${n}`);t.connectionInstances.remove(o)},deleteConnection(e){const{jbrowse:n}=t;return n.deleteConnectionConf(e)},addConnectionConf(e){const{jbrowse:n}=t;return n.addConnectionConf(e)},clearConnections(){t.connectionInstances.clear()}})))}function i(e){return(0,s.qk)(e)&&"connectionInstances"in e}},16574:(e,t,n)=>{n.d(t,{A:()=>d,m:()=>u});var r=n(7552),o=n(12678),s=n(9043),a=n(62367),i=n(69426),l=n(679),c=n(68384);const u=(0,r.lazy)((()=>n.e(8009).then(n.bind(n,18009))));class d extends o.A{name="DataManagementPlugin";exports={AssemblyManager:u};install(e){(0,s.A)(e),(0,a.A)(e),(0,c.Ay)(e),(0,i.A)(e),(0,l.A)(e)}configure(e){}}},87579:(e,t,n)=>{n.r(t),n.d(t,{Loader:()=>Ht,default:()=>Yt});var r=n(7552),o=n(68446),s=n(82725),a=n(430),i=n(83504),l=n(49823),c=(n(39975),n(25122)),u=n(36422),d=n(20139),m=n(16179),p=n(27281),f=n(75785),g=n(42418),h=n(9937),y=n(5401),w=n(61723),b=n(30157);const v=(0,o.observer)((function({session:e}){const{snackbarMessages:t}=e,n=t.at(-1),o=(t,n)=>{"clickaway"!==n&&e.popSnackbarMessage()};return n?r.createElement(g.A,{open:!0,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"center"}},r.createElement(h.A,{onClose:o,action:n.action?r.createElement(r.Fragment,null,r.createElement(y.A,{color:"inherit",onClick:e=>{n.action?.onClick(),o()}},n.action.name),r.createElement(w.A,{color:"inherit",onClick:o},r.createElement(b.A,null))):null,severity:n.level||"warning"},n.message)):null}));var S=n(17515),A=n(89003),C=n(72639),E=n(32813),k=n(8463);const T=(0,f.n9)()((e=>({buttonRoot:{"&:hover":{backgroundColor:(0,C.X4)(e.palette.primary.contrastText,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}}}))),M=(0,o.observer)((function({menuTitle:e,session:t,menuItems:n}){const[o,s]=(0,r.useState)(!1),a=(0,r.useRef)(null),{classes:i}=T();function l(){s(!1)}return r.createElement(r.Fragment,null,r.createElement(y.A,{ref:a,onClick:()=>{s(!o)},color:"inherit","data-testid":"dropDownMenuButton",classes:{root:i.buttonRoot}},e,r.createElement(E.A,null)),r.createElement(k.A,{anchorEl:a.current,anchorOrigin:{vertical:"bottom",horizontal:"left"},onMenuItemClick:(e,n)=>{n(t),l()},open:o,onClose:l,menuItems:n}))}));var P=n(88373),I=n(68584),N=n(34895);const x=(0,o.observer)((function({session:e}){const{configuration:t}=e,n=(0,I.readConfObject)(t,"logoPath");return n?.uri?r.createElement("img",{src:n.uri,alt:"Custom logo"}):r.createElement(N.P,{variant:"white"})})),R=(0,f.n9)()((e=>({grow:{flexGrow:1},inputBase:{color:e.palette.primary.contrastText},inputRoot:{"&:hover":{backgroundColor:e.palette.primary.light}},inputFocused:{borderColor:e.palette.secondary.main,backgroundColor:e.palette.primary.light}}))),O=(0,o.observer)((function({session:e,HeaderButtons:t=r.createElement("div",null)}){const{classes:n}=R(),{savedSessionNames:o,name:s,menus:a}=e;return r.createElement(S.A,null,a.map((t=>r.createElement(M,{key:t.label,menuTitle:t.label,menuItems:t.menuItems,session:e}))),r.createElement("div",{className:n.grow}),r.createElement(A.A,{title:"Rename Session",arrow:!0},r.createElement(P.A,{value:s,setValue:t=>{o?.includes(t)?e.notify(`Cannot rename session to "${t}", a saved session with that name already exists`,"warning"):e.renameCurrentSession(t)},variant:"body1",classes:{inputBase:n.inputBase,inputRoot:n.inputRoot,inputFocused:n.inputFocused}})),t,r.createElement("div",{className:n.grow}),r.createElement("div",{style:{width:150,maxHeight:48}},r.createElement(x,{session:e})))})),$=(0,o.observer)((function({session:e}){const{DialogComponent:t,DialogProps:n}=e;return t?r.createElement(r.Suspense,{fallback:null},r.createElement(t,n)):null}));var D=n(62859),L=n(67386);const j=(0,f.n9)()((e=>({left:{zIndex:1e4,position:"fixed",bottom:e.spacing(2),left:e.spacing(2)},right:{zIndex:1e4,position:"fixed",bottom:e.spacing(2),right:e.spacing(2)}}))),z=(0,o.observer)((function({session:e}){const{minimized:t,activeWidgets:n,drawerPosition:o}=e,{classes:s}=j();return n.size>0&&t?r.createElement(A.A,{title:"Open drawer widget"},r.createElement(D.A,{className:"right"===o?s.right:s.left,color:"primary","data-testid":"drawer-maximize",onClick:()=>{e.showWidgetDrawer()}},r.createElement(L.A,null))):null}));var W=n(943),U=n(36715),F=n(48171),V=n(98360),B=n(29629),q=n(99546);const G=(0,f.n9)()((e=>({selectPaper:{padding:e.spacing(4)},m2:{margin:2}}))),_=(0,o.observer)((({session:e})=>{const{classes:t}=G(),{pluginManager:n}=(0,q.getEnv)(e),o=n.getElementTypeRecord("view").all(),[s,a]=(0,r.useState)(o[0]?.name||"");return r.createElement(W.A,{className:t.selectPaper},r.createElement(U.A,null,"Select a view to launch"),r.createElement(F.A,{className:t.m2},r.createElement(V.A,{value:s,onChange:e=>{a(e.target.value)}},o.map((({displayName:e,name:t})=>r.createElement(B.A,{key:t,value:t},e))))),r.createElement(F.A,{className:t.m2},r.createElement(y.A,{onClick:()=>e.addView(s,{}),variant:"contained",color:"primary"},"Launch view")))}));var H=n(38033),J=n(37565),Q=n(48231),K=n(16217),Y=n(374),Z=n(51469),X=n(45266),ee=n(85206),te=n(922),ne=n(91388),re=n(42281),oe=n(66195),se=n(21430);function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ae.apply(null,arguments)}const ie=(0,o.observer)((function({model:e,IconButtonProps:t,IconProps:n}){const o=(0,q.getSession)(e),s=(0,X.T6)({popupId:"viewMenu",variant:"popover"});return r.createElement(r.Fragment,null,r.createElement(w.A,ae({},t,(0,X.cO)(s),{"data-testid":"view_menu_icon"}),r.createElement(te.A,ae({},n,{fontSize:"small"}))),r.createElement(ee.A,ae({},(0,X.dB)(s),{onMenuItemClick:(e,t)=>{t()},menuItems:[...o.views.length>1?[{label:"View order",type:"subMenu",subMenu:[{label:"Move view to top",icon:re.A,onClick:()=>{o.moveViewToTop(e.id)}},{label:"Move view up",icon:se.A,onClick:()=>{o.moveViewUp(e.id)}},{label:"Move view down",icon:oe.A,onClick:()=>{o.moveViewDown(e.id)}},{label:"Move view to bottom",icon:ne.A,onClick:()=>{o.moveViewToBottom(e.id)}}]}]:[],...e.menuItems()],popupState:s})))})),le=(0,f.n9)()((e=>({input:{paddingBottom:0,paddingTop:2},inputBase:{color:e.palette.secondary.contrastText},inputRoot:{"&:hover":{backgroundColor:e.palette.secondary.light}},inputFocused:{borderColor:e.palette.primary.main,backgroundColor:e.palette.secondary.light}}))),ce=(0,o.observer)((function({view:e}){const{classes:t}=le();return r.createElement(A.A,{title:"Rename view",arrow:!0},r.createElement(P.A,{value:e.displayName||`${e.assemblyNames?.join(",")||"Untitled view"}${e.minimized?" (minimized)":""}`,setValue:t=>{e.setDisplayName(t)},variant:"body2",classes:{input:t.input,inputBase:t.inputBase,inputRoot:t.inputRoot,inputFocused:t.inputFocused}}))})),ue=(0,f.n9)()((e=>({icon:{color:e.palette.secondary.contrastText},grow:{flexGrow:1},viewHeader:{display:"flex"},viewTitle:{display:"flex",alignItems:"center"}}))),de=(0,o.observer)((function({view:e,onClose:t,onMinimize:n}){const{classes:o}=ue();return r.createElement(r.Fragment,null,r.createElement(w.A,{"data-testid":"minimize_view",onClick:n},e.minimized?r.createElement(Y.A,{className:o.icon,fontSize:"small"}):r.createElement(K.A,{className:o.icon,fontSize:"small"})),r.createElement(w.A,{"data-testid":"close_view",onClick:t},r.createElement(b.A,{className:o.icon,fontSize:"small"})))})),me=(0,o.observer)((function({view:e,onClose:t,onMinimize:n}){const{classes:o}=ue(),s=(0,r.useRef)(null),a=(0,q.getSession)(e);return(0,r.useEffect)((()=>{"undefined"==typeof jest&&s.current?.scrollIntoView({block:"center"})}),[]),r.createElement("div",{ref:s,className:o.viewHeader},r.createElement(ie,{model:e,IconProps:{className:o.icon}}),r.createElement("div",{className:o.grow}),r.createElement("div",{className:o.viewTitle},a.focusedViewId===e.id?r.createElement(Z.A,{className:o.icon,fontSize:"small"}):null,r.createElement(ce,{view:e})),r.createElement("div",{className:o.grow}),r.createElement(de,{onClose:t,onMinimize:n,view:e}))})),pe=(0,f.n9)()((e=>({viewContainer:{overflow:"hidden",margin:e.spacing(.5),padding:`0 ${e.spacing(1)} ${e.spacing(1)}`},focusedView:{background:e.palette.secondary.main},unfocusedView:{background:e.palette.secondary.dark}}))),fe=(0,o.observer)((function({view:e,onClose:t,onMinimize:n,children:o}){const s=(0,Q.A)(),a=(0,q.useWidthSetter)(e,s.spacing(1)),{classes:i,cx:l}=pe(),c=(0,q.getSession)(e);return(0,r.useEffect)((()=>{function t(t){t.target instanceof Element&&a.current?.contains(t.target)&&c.setFocusedViewId(e.id)}return document.addEventListener("mousedown",t),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",t)}}),[a,c,e]),r.createElement(W.A,{ref:a,elevation:12,className:l(i.viewContainer,c.focusedViewId===e.id?i.focusedView:i.unfocusedView)},r.createElement(me,{view:e,onClose:t,onMinimize:n}),r.createElement(W.A,null,o))})),ge=(0,o.observer)((function({view:e,session:t}){const{pluginManager:n}=(0,q.getEnv)(t),o=n.getViewType(e.type);if(!o)throw new Error(`unknown view type ${e.type}`);const{ReactComponent:a}=o;return r.createElement(fe,{view:e,onClose:()=>{t.removeView(e)},onMinimize:()=>{e.setMinimized(!e.minimized)}},!e.minimized&&r.createElement(s.tH,{FallbackComponent:({error:e})=>r.createElement(H.A,{error:e})},r.createElement(r.Suspense,{fallback:r.createElement(J.A,{variant:"h6"})},r.createElement(a,{model:e,session:t}))))})),he=(0,f.n9)()({viewsContainer:{overflowY:"auto",gridRow:"components"}}),ye=(0,o.observer)((function(e){const{session:t}=e,{views:n}=t,{classes:o}=he();return r.createElement("div",{className:o.viewsContainer},n.length>0?n.map((e=>r.createElement(ge,{key:`view-${e.id}`,view:e,session:t}))):r.createElement(_,e),r.createElement("div",{style:{height:300}}))})),we=(0,r.lazy)((()=>n.e(8076).then(n.bind(n,88076)))),be=(0,f.n9)()((e=>({root:{display:"grid",height:"100vh",width:"100%",colorScheme:e.palette.mode},appContainer:{gridColumn:"main",display:"grid",gridTemplateRows:"[menubar] min-content [components] auto",height:"100vh"},appBar:{flexGrow:1,gridRow:"menubar"}}))),ve=(0,o.observer)((function(e){const{session:t}=e;return r.createElement(r.Suspense,{fallback:null},r.createElement(we,{session:t}))})),Se=(0,o.observer)((function(e){const{session:t}=e,{classes:n}=be(),{minimized:o,visibleWidget:s,drawerWidth:a,drawerPosition:i}=t,l=s&&!o,c=l?`[drawer] ${a}px`:void 0,u="right"===i?["[main] 1fr",c]:[c,"[main] 1fr"];return r.createElement("div",{className:n.root,style:{gridTemplateColumns:u.filter((e=>!!e)).join(" ")}},l&&"left"===i?r.createElement(ve,{session:t}):null,r.createElement($,{session:t}),r.createElement("div",{className:n.appContainer},r.createElement(p.A,{className:n.appBar,position:"static"},r.createElement(O,e)),r.createElement(ye,e)),r.createElement(z,{session:t}),l&&"right"===i?r.createElement(ve,{session:t}):null,r.createElement(v,{session:t}))})),Ae=u.types.model("TimeTraveller",{undoIdx:-1,targetPath:""}).volatile((()=>({history:[],notTrackingUndo:!1}))).views((e=>({get canUndo(){return e.undoIdx>0&&!e.notTrackingUndo},get canRedo(){return e.undoIdx<e.history.length-1&&!e.notTrackingUndo}}))).actions((e=>{let t,n,r=!1;return{stopTrackingUndo(){e.notTrackingUndo=!0},resumeTrackingUndo(){e.notTrackingUndo=!1},addUndoState(t){e.notTrackingUndo||(r?r=!1:(e.history.splice(e.undoIdx+1),e.history.push(t),e.history.length>20&&e.history.shift(),e.undoIdx=e.history.length-1))},beforeDestroy(){n()},initialize(){if(t=e.targetPath?(0,u.resolvePath)(e,e.targetPath):(0,u.getEnv)(e).targetStore,!t)throw new Error("Failed to find target store for TimeTraveller. Please provide `targetPath` property, or a `targetStore` in the environment");n=(0,u.onSnapshot)(t,function(e,t=300){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}((e=>{this.addUndoState(e)}),300)),0===e.history.length&&this.addUndoState((0,u.getSnapshot)(t))},undo(){e.undoIdx--,r=!0,t&&(0,u.applySnapshot)(t,e.history[e.undoIdx])},redo(){e.undoIdx++,r=!0,t&&(0,u.applySnapshot)(t,e.history[e.undoIdx])}}}));var Ce=n(42489);const Ee=(0,I.ConfigurationSchema)("BaseRpcDriver",{workerCount:{type:"number",description:"The number of workers to use. If 0 (the default) JBrowse will decide how many workers to use.",defaultValue:0}},{explicitlyTyped:!0}),ke=(0,I.ConfigurationSchema)("WebWorkerRpcDriver",{},{baseConfiguration:Ee,explicitlyTyped:!0}),Te=(0,I.ConfigurationSchema)("MainThreadRpcDriver",{},{baseConfiguration:Ee,explicitlyTyped:!0}),Me=(0,I.ConfigurationSchema)("RpcOptions",{defaultDriver:{type:"string",description:"the RPC driver to use for tracks and tasks that are not configured to use a specific RPC backend",defaultValue:"MainThreadRpcDriver"},drivers:u.types.optional(u.types.map(u.types.union(Te,ke)),{MainThreadRpcDriver:{type:"MainThreadRpcDriver"},WebWorkerRpcDriver:{type:"WebWorkerRpcDriver"}})},{actions:e=>({addDriverConfig(t,n){e.drivers.set(t,n)}})});var Pe=n(39154),Ie=n(76519),Ne=n(32761),xe=n(24388);function Re(e){return!("function"==typeof e||e instanceof Error)}class Oe{constructor(e){this.driver=e}async getWorker(){return this.workerP||(this.workerP=this.driver.makeWorker().then((e=>(async function(e,t,n){for(;;)await e.call("ping",[],{timeout:2*t,rpcDriverClassName:n}),await new Promise((e=>setTimeout(e,t)))}(e,this.driver.maxPingTime,this.driver.name).catch((t=>{console.error("worker did not respond, killing and generating new one"),console.error(t),e.destroy(),e.status="killed",e.error=t,this.workerP=void 0})),e))).catch((e=>{throw this.workerP=void 0,e}))),this.workerP}}class $e{lastWorkerAssignment=-1;workerAssignments=new Map;maxPingTime=3e4;workerCheckFrequency=5e3;constructor(e){this.config=e.config}filterArgs(e,t){if(Array.isArray(e))return e.filter((e=>Re(e))).map((e=>this.filterArgs(e,t)));if("object"==typeof e&&null!==e){if(e instanceof AbortSignal)return(0,xe.bR)(e,this.remoteAbort.bind(this,t));if((0,u.isStateTreeNode)(e)&&!(0,u.isAlive)(e))throw new Error("dead state tree node passed to RPC call");return e instanceof File?e:Object.fromEntries(Object.entries(e).filter((e=>Re(e[1]))).map((([e,n])=>[e,this.filterArgs(n,t)])))}return e}async remoteAbort(e,t,n){const r=await this.getWorker(e);await r.call(t,{signalId:n},{timeout:1e6,rpcDriverClassName:this.name})}createWorkerPool(){const e=function(){const e="undefined"!=typeof window,t=e&&"hardwareConcurrency"in window.navigator;return e&&t?window.navigator.hardwareConcurrency:1}(),t=(0,I.readConfObject)(this.config,"workerCount")||(0,q.clamp)(1,Math.max(1,e-1),5),n=[];for(let e=0;e<t;e++)n.push(new Oe(this));return n}getWorkerPool(){if(!this.workerPool){const e=this.createWorkerPool();return this.workerPool=e,e}return this.workerPool}async getWorker(e){const t=this.getWorkerPool();let n=this.workerAssignments.get(e);if(void 0===n){const r=(this.lastWorkerAssignment+1)%t.length;this.workerAssignments.set(e,r),this.lastWorkerAssignment=r,n=r}return t[n].getWorker()}async call(e,t,n,r,o={}){if(!t)throw new TypeError("sessionId is required");let s=!1;const a=await this.getWorker(t),i=e.evaluateExtensionPoint("Core-extendWorker",a),l=e.getRpcMethodType(n);if(!l)throw new Error(`unknown RPC method ${n}`);const c=await l.serializeArguments(r,this.name),u=this.filterArgs(c,t),d=i.call(n,u,{timeout:3e5,statusCallback:r.statusCallback,rpcDriverClassName:this.name,...o}).finally((()=>{s=!0}));let m;const p=new Promise(((e,t)=>{m=setInterval((()=>{"killed"===i.status?t(new Error(`operation timed out, worker process stopped responding, ${i.error}`)):s&&e(!0)}),this.workerCheckFrequency)})).finally((()=>{clearInterval(m)})),f=Promise.race([d,p]);return l.deserializeReturn(f,r,this.name)}}class De extends Ie.A.Client{destroy(){this.workers[0].terminate()}async call(e,t,n){const{statusCallback:r,rpcDriverClassName:o}=n,s=`message-${(0,Ne.Ak)()}`,a=e=>{r?.(e)};this.on(s,a);const i=await super.call(e,{...t,channel:s,rpcDriverClassName:o},n);return this.off(s,a),i}}class Le extends $e{name="WebWorkerRpcDriver";constructor(e,t){super(e),this.workerBootConfiguration=t,this.makeWorkerInstance=e.makeWorkerInstance}async makeWorker(){const e=this.makeWorkerInstance(),t=new De({workers:[e]});return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&console.log("console logging the webworker handle avoids the track going into an infinite loading state, this is a hacky workaround for safari",e),new Promise(((e,n)=>{const r=o=>{switch(o.data.message){case"ready":e(t),t.workers[0].removeEventListener("message",r);break;case"readyForConfig":t.workers[0].postMessage({message:"config",config:this.workerBootConfiguration});break;case"error":n((0,Pe.deserializeError)(o.data.error))}};t.workers[0].addEventListener("message",r)}))}}class je{destroy(){}async call(e,t,n={}){}}class ze extends $e{name="MainThreadRpcDriver";constructor(e){super(e),this.makeWorker=async()=>new je}async call(e,t,n,r){if(!t)throw new TypeError("sessionId is required");const o=e.getRpcMethodType(n);if(!o)throw new Error(`unknown RPC method ${n}`);const s=await o.serializeArguments(r,this.name),a=await o.execute(s,this.name);return o.deserializeReturn(a,r,this.name)}}class We{static configSchema=Me;constructor(e,t,n){this.pluginManager=e,this.mainConfiguration=t,this.backendConfigurations=n,this.driverObjects=new Map}getDriver(e){const t=this.driverObjects.get(e);if(t)return t;const n=this.mainConfiguration.drivers.get("WebWorkerRpcDriver");if("MainThreadRpcDriver"===e){const t=this.backendConfigurations.MainThreadRpcDriver;if(!t)throw new Error(`requested RPC driver "${e}" is missing config`);const r=new ze({...t,config:n});return this.driverObjects.set(e,r),r}if("WebWorkerRpcDriver"===e){const t=this.backendConfigurations.WebWorkerRpcDriver;if(!t)throw new Error(`requested RPC driver "${e}" is missing config`);const r=new Le({...t,config:n},{plugins:this.pluginManager.runtimePluginDefinitions,windowHref:window.location.href});return this.driverObjects.set(e,r),r}throw new Error(`requested RPC driver "${e}" is not installed`)}async getDriverForCall(e,t,n){const r=n.rpcDriverName||(0,I.readConfObject)(this.mainConfiguration,"defaultDriver");return this.getDriver(r)}async call(e,t,n,r={}){if(!e)throw new Error("sessionId is required");return(await this.getDriverForCall(e,t,n)).call(this.pluginManager,e,t,n,r)}}var Ue=n(37702);const Fe=(0,f.n9)()((e=>({shareDiv:{textAlign:"center",paddingLeft:"2px"},shareButton:{backgroundColor:(0,C.X4)(e.palette.primary.contrastText,e.palette.action.hoverOpacity),"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}))),Ve=(0,r.lazy)((()=>n.e(7663).then(n.bind(n,47663)))),Be=(0,o.observer)((function(e){const[t,n]=(0,r.useState)(!1),{session:o}=e,{classes:s}=Fe();return r.createElement("div",{className:s.shareDiv},r.createElement(y.A,{onClick:async()=>{n(!0)},size:"small",color:"inherit",startIcon:r.createElement(Ue.A,null),classes:{root:s.shareButton}},"Share"),t?r.createElement(r.Suspense,{fallback:null},r.createElement(Ve,{handleClose:()=>{n(!1)},session:o})):null)})),qe=(0,o.observer)((function({pluginManager:e}){const[t]=(0,a.useQueryParam)("adminKey",a.StringParam),[n]=(0,a.useQueryParam)("adminServer",a.StringParam),[o]=(0,a.useQueryParam)("config",a.StringParam),[,s]=(0,a.useQueryParam)("session",a.StringParam),{rootModel:i}=e,{error:l,jbrowse:c}=i||{},p=i?.session,f=p?.id;if((0,r.useEffect)((()=>{s(`local-${f}`,"replaceIn"),window.JBrowseRootModel=i,window.JBrowseSession=p}),[f,i,p,s]),(0,r.useEffect)((()=>{if(c&&t)return(0,u.onSnapshot)(c,(async e=>{try{const r=await fetch(n||"/updateConfig",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adminKey:t,configPath:o,config:e})});if(!r.ok){const e=await r.text();throw new Error(`HTTP ${r.status} (${e})`)}}catch(e){p?.notify(`Admin server error: ${e}`)}}))}),[c,p,t,n,o]),l)throw l;if(!i)throw new Error("No rootModel found");if(!p)throw new Error("No session found");return r.createElement(d.A,{theme:p.theme},r.createElement(m.Ay,null),r.createElement(Se,{session:p,HeaderButtons:r.createElement(Be,{session:p})}))}));var Ge=n(55252),_e=n(59773),He=n(99834),Je=n(17765),Qe=n(49409);const Ke=u.types.model({configPath:u.types.maybe(u.types.string),sessionQuery:u.types.maybe(u.types.string),password:u.types.maybe(u.types.string),adminKey:u.types.maybe(u.types.string),loc:u.types.maybe(u.types.string),sessionTracks:u.types.maybe(u.types.string),assembly:u.types.maybe(u.types.string),tracks:u.types.maybe(u.types.string),tracklist:u.types.maybe(u.types.boolean),highlight:u.types.maybe(u.types.string),nav:u.types.maybe(u.types.boolean),initialTimestamp:u.types.number}).volatile((()=>({sessionTriaged:void 0,configSnapshot:void 0,sessionSnapshot:void 0,sessionSpec:void 0,blankSession:!1,runtimePlugins:[],sessionPlugins:[],sessionError:void 0,configError:void 0,bc1:window.BroadcastChannel?new window.BroadcastChannel("jb_request_session"):void 0,bc2:window.BroadcastChannel?new window.BroadcastChannel("jb_respond_session"):void 0}))).views((e=>({get isSharedSession(){return!!e.sessionQuery?.startsWith("share-")},get isSpecSession(){return!!e.sessionQuery?.startsWith("spec-")},get isJb1StyleSession(){return!!e.loc},get isEncodedSession(){return!!e.sessionQuery?.startsWith("encoded-")},get isJsonSession(){return!!e.sessionQuery?.startsWith("json-")},get isLocalSession(){return!!e.sessionQuery?.startsWith("local-")},get ready(){return Boolean(this.isSessionLoaded&&!e.configError)},get error(){return e.configError||e.sessionError},get isSessionLoaded(){return Boolean(e.sessionError||e.sessionSnapshot||e.blankSession||e.sessionSpec)},get isConfigLoaded(){return Boolean(e.configError||e.configSnapshot)},get sessionTracksParsed(){return e.sessionTracks?JSON.parse(e.sessionTracks):[]}}))).actions((e=>({setSessionQuery(t){e.sessionQuery=t},setConfigError(t){e.configError=t},setSessionError(t){e.sessionError=t},setRuntimePlugins(t){e.runtimePlugins=t},setSessionPlugins(t){e.sessionPlugins=t},setConfigSnapshot(t){e.configSnapshot=t},setBlankSession(t){e.blankSession=t},setSessionTriaged(t){e.sessionTriaged=t},setSessionSnapshotSuccess(t){e.sessionSnapshot=t}}))).actions((e=>({async fetchPlugins(t){try{const n=new _e.Ay(t.plugins,{fetchESM:e=>import(e)});n.installGlobalReExports(window);const r=await n.load(window.location.href);e.setRuntimePlugins([...r])}catch(t){console.error(t),e.setConfigError(t)}},async fetchSessionPlugins(t){try{const n=new _e.Ay(t.sessionPlugins||[],{fetchESM:e=>import(e)});n.installGlobalReExports(window);const r=await n.load(window.location.href);e.setSessionPlugins([...r])}catch(t){console.error(t),e.setConfigError(t)}},async setSessionSnapshot(t,n){try{const{sessionPlugins:r=[]}=t;await(0,Qe.pS)(r)||n?(await this.fetchSessionPlugins(t),e.setSessionSnapshotSuccess(t)):e.setSessionTriaged({snap:t,origin:"session",reason:r})}catch(t){console.error(t),e.setConfigError(t)}},async fetchConfig(){let{configPath:t=window.__jbrowseConfigPath||"config.json"}=e;window.__jbrowseCacheBuster&&(t+=`?rand=${Math.random()}`);const n=await(0,He.openLocation)({uri:t,locationType:"UriLocation"}).readFile("utf8"),r=JSON.parse(n),o=new URL(t,window.location.href);if((0,Qe.XE)(r,o),o.hostname!==window.location.hostname){const t=r.plugins||[];if(!await(0,Qe.pS)(t))return void e.setSessionTriaged({snap:r,origin:"config",reason:t})}await this.fetchPlugins(r),e.setConfigSnapshot(r)},async fetchSessionStorageSession(){const t=sessionStorage.getItem("current"),n=e.sessionQuery.replace("local-","");if(t){const e=JSON.parse(t).session||{};if(n===e.id)return this.setSessionSnapshot(e)}if(e.bc1){e.bc1.postMessage(n);try{const t=await new Promise(((t,n)=>{e.bc2&&(e.bc2.onmessage=e=>{t(e.data)}),setTimeout((()=>{n(new Error("timeout"))}),1e3)}));await this.setSessionSnapshot({...t,id:(0,Ne.Ak)()})}catch(e){}}throw new Error("Local storage session not found")},async fetchSharedSession(){const t=await(0,Je.Z)(`${(0,Qe.Vr)(e.configSnapshot,"shareURL","https://share.jbrowse.org/api/v1/")}load`,e.sessionQuery||"",e.password||""),n=JSON.parse(await(0,Qe.LP)(t));await this.setSessionSnapshot({...n,id:(0,Ne.Ak)()})},async decodeEncodedUrlSession(){const t=JSON.parse(await(0,Qe.LP)(e.sessionQuery.replace("encoded-","")));await this.setSessionSnapshot({...t,id:(0,Ne.Ak)()})},decodeSessionSpec(){e.sessionQuery&&(e.sessionSpec=JSON.parse(e.sessionQuery.replace("spec-","")))},decodeJb1StyleSession(){const{loc:t,tracks:n,assembly:r,tracklist:o,nav:s,highlight:a,sessionTracksParsed:i}=e;t&&(e.sessionSpec={sessionTracks:i,views:[{type:"LinearGenomeView",tracks:n?.split(","),sessionTracks:i,loc:t,assembly:r,tracklist:o,nav:s,highlight:a?.split(" ")}]})},async decodeJsonUrlSession(){const t=JSON.parse(e.sessionQuery.replace("json-",""));await this.setSessionSnapshot({...t.session,id:(0,Ne.Ak)()})},async afterCreate(){try{const{configPath:t}=e,n=localStorage.getItem(`autosave-${t}`);n&&localStorage.setItem(`previousAutosave-${t}`,n)}catch(e){console.error("failed to create previousAutosave",e)}try{await this.fetchConfig()}catch(t){return console.error(t),void e.setConfigError(t)}(0,u.addDisposer)(e,(0,Ce.autorun)((async()=>{try{const{isLocalSession:t,isEncodedSession:n,isSpecSession:r,isSharedSession:o,isJsonSession:s,isJb1StyleSession:a,sessionQuery:i,configSnapshot:l}=e;if(!l)return;if(e.bc1&&(e.bc1.onmessage=t=>{const n=JSON.parse(sessionStorage.getItem("current")||"{}").session||{};n.id===t.data&&e.bc2&&e.bc2.postMessage(n)}),o)await this.fetchSharedSession();else if(r)this.decodeSessionSpec();else if(a)this.decodeJb1StyleSession();else if(n)await this.decodeEncodedUrlSession();else if(s)await this.decodeJsonUrlSession();else if(t)await this.fetchSessionStorageSession();else{if(i)throw new Error("unrecognized session format");e.setBlankSession(!0)}}catch(t){console.error(t),e.setSessionError(t)}})))}})));function Ye({error:e}){return/HTTP 404 fetching config.json/.exec(`${e}`)?r.createElement("div",null,r.createElement("h1",null,"It worked!"),r.createElement("p",{style:{margin:8,padding:8,background:"#9f9",border:"1px solid green"}},"JBrowse 2 is installed. Your next step is to add and configure an assembly. Follow our"," ",r.createElement("a",{href:"https://jbrowse.org/jb2/docs/quickstart_web/"},"quick start guide")," ","to continue or browse the sample data"," ",r.createElement("a",{href:"?config=test_data/volvox/config.json"},"here"),"."),null):r.createElement("div",null,r.createElement("h1",null,"JBrowse Error"),r.createElement(l.ErrorMessage,{error:e}))}var Ze=n(70129);var Xe=n(45465);var et=n(83059),tt=n(22168),nt=n(96757),rt=n(29078),ot=n(29417),st=n(91194),at=n(550),it=n(39548),lt=n(62424),ct=n(89024),ut=n(73299),dt=n(83105),mt=n(90542);function pt(){return new Worker(new URL(n.p+n.u(2047),n.b))}var ft=n(33039),gt=n.n(ft);window.getSnapshot=u.getSnapshot,window.resolveIdentifier=u.resolveIdentifier;var ht=n(47046),yt=n(43334),wt=n(3496);const bt=new RegExp("[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*"),vt=["rgb(153, 102, 0)","rgb(102, 102, 0)","rgb(153, 153, 30)","rgb(204, 0, 0)","rgb(255, 0, 0)","rgb(255, 0, 204)","rgb(165, 132, 132)","rgb(204, 122, 0)","rgb(178, 142, 0)","rgb(153, 153, 0)","rgb(122, 153, 0)","rgb(0, 165, 0)","rgb(53, 128, 0)","rgb(0, 0, 204)","rgb(96, 145, 242)","rgb(107, 142, 178)","rgb(0, 165, 165)","rgb(122, 153, 153)","rgb(153, 0, 204)","rgb(204, 51, 255)","rgb(173, 130, 216)","rgb(102, 102, 102)","rgb(145, 145, 145)","rgb(142, 142, 142)","rgb(142, 142, 107)","rgb(96, 163, 48)"];function St(e){if(!bt.test(e))throw new Error(`Encountered invalid refName: "${e}"`)}function At(e,t){const n=new ht.A({cache:new yt.A({maxSize:1e3}),async fill(e,t,n){const{adapterConf:r,self:o,options:s}=e;return async function(e,t,n,r){const{sessionId:o}=n;await(0,q.when)((()=>!(!e.regions||!e.refNameAliases)),{signal:r,name:"when assembly ready"});const s=await e.rpcManager.call(o||"assemblyRpc","CoreGetRefNames",{adapterConfig:t,signal:r,...n},{timeout:1e6}),{refNameAliases:a}=e;if(!a)throw new Error(`error loading assembly ${e.name}'s refNameAliases`);const i=Object.fromEntries(s.map((t=>(St(t),[e.getCanonicalRefName(t),t]))));return{forwardMap:i,reverseMap:Object.fromEntries(Object.entries(i).map((([e,t])=>[t,e])))}}(o,r,{...s,statusCallback:n},t)}});return u.types.model({configuration:u.types.safeReference(e)}).volatile((()=>({error:void 0,loadingP:void 0,volatileRegions:void 0,refNameAliases:void 0,lowerCaseRefNameAliases:void 0,cytobands:void 0}))).views((e=>({getConf:t=>e.configuration?(0,I.getConf)(e,t):void 0}))).views((e=>({get initialized(){return e.load(),!!e.refNameAliases},get name(){return e.getConf("name")||""},get regions(){return e.load(),e.volatileRegions},get aliases(){return e.getConf("aliases")||[]},get displayName(){return e.getConf("displayName")},hasName(e){return this.allAliases.includes(e)},get allAliases(){return[this.name,...this.aliases]},get allRefNames(){return e.refNameAliases?Object.keys(e.refNameAliases):void 0},get lowerCaseRefNames(){return e.lowerCaseRefNameAliases?Object.keys(e.lowerCaseRefNameAliases):void 0},get allRefNamesWithLowerCase(){return this.allRefNames&&this.lowerCaseRefNames?[...new Set([...this.allRefNames,...this.lowerCaseRefNames])]:void 0},get rpcManager(){return(0,u.getParent)(e,2).rpcManager},get refNameColors(){const t=e.getConf("refNameColors")||[];return 0===t.length?vt:t}}))).views((e=>({get refNames(){return e.regions?.map((e=>e.refName))}}))).views((e=>({getCanonicalRefName(t){if(!e.refNameAliases||!e.lowerCaseRefNameAliases)throw new Error("aliases not loaded, we expect them to be loaded before getCanonicalRefName can be called");return e.refNameAliases[t]||e.lowerCaseRefNameAliases[t]},getRefNameColor(t){if(!e.refNames)return;const n=e.refNames.indexOf(t);return-1===n?void 0:e.refNameColors[n%e.refNameColors.length]},isValidRefName(t){if(!e.refNameAliases)throw new Error("isValidRefName cannot be called yet, the assembly has not finished loading");return!!this.getCanonicalRefName(t)}}))).actions((e=>({setLoaded({regions:e,refNameAliases:t,lowerCaseRefNameAliases:n,cytobands:r}){this.setRegions(e),this.setRefNameAliases(t,n),this.setCytobands(r)},setError(t){e.error=t},setRegions(t){e.volatileRegions=t},setRefNameAliases(t,n){e.refNameAliases=t,e.lowerCaseRefNameAliases=n},setCytobands(t){e.cytobands=t},setLoadingP(t){e.loadingP=t},load(){return e.loadingP||(e.loadingP=this.loadPre().catch((e=>{this.setLoadingP(void 0),this.setError(e)}))),e.loadingP},async loadPre(){const n=e.configuration,r=n?.refNameAliases?.adapter,o=n?.cytobands?.adapter,s=n?.sequence.adapter,a=e.name,i=await async function({config:e,pluginManager:t,signal:n}){const r=t.getAdapterType(e.type);return new(await r.getAdapterClass())(e,void 0,t).getRegions({signal:n})}({config:s,pluginManager:t}),l=i.map((e=>(St(e.refName),{...e,assemblyName:a}))),c={},u=await async function({config:e,pluginManager:t,signal:n}){const r=t.getAdapterType(e.type);return new(await r.getAdapterClass())(e,void 0,t).getRefNameAliases({signal:n})}({config:r,pluginManager:t});for(const{refName:e,aliases:t,override:n}of u){for(const n of t)St(n),c[n]=e;n&&(c[e]=e)}for(const e of l)c[e.refName]||=e.refName;const d=Object.fromEntries(Object.entries(c).map((([e,t])=>[e.toLowerCase(),t])));this.setLoaded({refNameAliases:c,regions:l.map((e=>({...e,refName:c[e.refName]||e.refName}))),lowerCaseRefNameAliases:d,cytobands:await Ct({config:o,pluginManager:t})})}}))).views((e=>({getAdapterMapEntry(t,r){const{signal:o,statusCallback:s,...a}=r;if(!r.sessionId)throw new Error("sessionId is required");return n.get((0,wt.LS)(t),{adapterConf:t,self:e,options:a},void 0,s)},async getRefNameMapForAdapter(e,t){if(!t.sessionId)throw new Error("sessionId is required");return(await this.getAdapterMapEntry(e,t)).forwardMap},async getReverseRefNameMapForAdapter(e,t){return(await this.getAdapterMapEntry(e,t)).reverseMap}})))}async function Ct({config:e,pluginManager:t}){const n=t.getAdapterType(e.type);return new(await n.getAdapterClass())(e,void 0,t).getData()}var Et=n(81886),kt=n(16574);const Tt=(0,r.lazy)((()=>n.e(9675).then(n.bind(n,79675)))),Mt=(0,r.lazy)((()=>n.e(2928).then(n.bind(n,62928))));function Pt({pluginManager:e,sessionModelFactory:t,adminMode:n=!1}){const r=function(e){return(0,I.ConfigurationSchema)("BaseAssembly",{aliases:{type:"stringArray",defaultValue:[],description:"Other possible names for the assembly"},sequence:e.getTrackType("ReferenceSequenceTrack").configSchema,refNameColors:{type:"stringArray",defaultValue:[],description:"Define custom colors for each reference sequence. Will cycle through this list if there are not enough colors for every sequence."},refNameAliases:(0,I.ConfigurationSchema)("RefNameAliases",{adapter:e.pluggableConfigSchemaType("adapter")},{preProcessSnapshot:e=>e.adapter?e:{adapter:{type:"RefNameAliasAdapter"}}}),cytobands:(0,I.ConfigurationSchema)("Cytoband",{adapter:e.pluggableConfigSchemaType("adapter")},{preProcessSnapshot:e=>e.adapter?e:{adapter:{type:"CytobandAdapter"}}}),displayName:{type:"string",defaultValue:"",description:'A human readable display name for the assembly e.g. "Homo sapiens (hg38)" while the assembly name may just be "hg38"'}},{explicitIdentifier:"name"})}(e),o=function({pluginManager:e,assemblyConfigSchema:t}){return u.types.snapshotProcessor(function({pluginManager:e,assemblyConfigSchema:t}){return function({pluginManager:e,assemblyConfigSchema:t}){return u.types.model("JBrowseConfig",{configuration:(0,I.ConfigurationSchema)("Root",{rpc:We.configSchema,highResolutionScaling:{type:"number",defaultValue:2},formatDetails:(0,I.ConfigurationSchema)("FormatDetails",{feature:{type:"frozen",description:"adds extra fields to the feature details",defaultValue:{},contextVariable:["feature"]},subfeatures:{type:"frozen",description:"adds extra fields to the subfeatures of a feature",defaultValue:{},contextVariable:["feature"]},depth:{type:"number",defaultValue:2,description:"depth to iterate the formatDetails->subfeatures callback on subfeatures (used for example to only apply the callback to the first layer of subfeatures)"},maxDepth:{type:"number",defaultValue:1e4,description:"hide subfeatures greater than a certain depth"}}),formatAbout:(0,I.ConfigurationSchema)("FormatAbout",{config:{type:"frozen",description:"formats configuration object in about dialog",defaultValue:{},contextVariable:["config"]},hideUris:{type:"boolean",defaultValue:!1}}),shareURL:{type:"string",defaultValue:"https://share.jbrowse.org/api/v1/"},disableAnalytics:{type:"boolean",defaultValue:!1},hierarchical:(0,I.ConfigurationSchema)("hierarchical",{sort:(0,I.ConfigurationSchema)("hierarchicalSort",{trackNames:{type:"boolean",defaultValue:!1},categories:{type:"boolean",defaultValue:!1}}),defaultCollapsed:(0,I.ConfigurationSchema)("defaultCollapsed",{categoryNames:{type:"stringArray",defaultValue:[]},topLevelCategories:{type:"boolean",defaultValue:!1},subCategories:{type:"boolean",defaultValue:!1}})}),theme:{type:"frozen",defaultValue:{}},extraThemes:{type:"frozen",defaultValue:{}},logoPath:{type:"fileLocation",defaultValue:{uri:"",locationType:"UriLocation"}},...e.pluginConfigurationSchemas()}),plugins:u.types.array(u.types.frozen()),assemblies:u.types.array(t),tracks:u.types.array(e.pluggableConfigSchemaType("track")),internetAccounts:u.types.array(e.pluggableConfigSchemaType("internet account")),aggregateTextSearchAdapters:u.types.array(e.pluggableConfigSchemaType("text search adapter")),connections:u.types.array(e.pluggableConfigSchemaType("connection")),defaultSession:u.types.optional(u.types.frozen(),{name:"New Session"})})}({pluginManager:e,assemblyConfigSchema:t}).views((e=>({get assemblyNames(){return e.assemblies.map((e=>(0,I.readConfObject)(e,"name")))},get rpcManager(){return(0,u.getParent)(e).rpcManager}}))).actions((e=>({addAssemblyConf(t){const{name:n}=t;if(!n)throw new Error('Can\'t add assembly with no "name"');if(e.assemblyNames.includes(n))throw new Error(`Can't add assembly with name "${n}", an assembly with that name already exists`);const r=e.assemblies.push({...t,sequence:{type:"ReferenceSequenceTrack",trackId:`${n}-${Date.now()}`,...t.sequence}});return e.assemblies[r-1]},removeAssemblyConf(t){const n=e.assemblies.find((e=>e.name===t));n&&e.assemblies.remove(n)},addTrackConf(t){const{type:n}=t;if(!n)throw new Error(`unknown track type ${n}`);const r=e.tracks.push(t);return e.tracks[r-1]},addConnectionConf(t){const{type:n}=t;if(!n)throw new Error(`unknown connection type ${n}`);const r=e.connections.push(t);return e.connections[r-1]},deleteConnectionConf(t){const n=e.connections.find((e=>e.id===t.id));return e.connections.remove(n)},deleteTrackConf(t){const n=e.tracks.find((e=>e.trackId===t.trackId));return e.tracks.remove(n)},addPlugin(t){e.plugins.push(t),(0,u.getParent)(e).setPluginsUpdated(!0)},removePlugin(t){e.plugins=(0,u.cast)(e.plugins.filter((e=>e.url!==t.url||e.umdUrl!==t.umdUrl||e.cjsUrl!==t.cjsUrl||e.esmUrl!==t.esmUrl))),(0,u.getParent)(e).setPluginsUpdated(!0)},setDefaultSessionConf(t){const n=(0,u.getParent)(e).session.name===t.name?(0,u.getSnapshot)(t):(0,Ce.toJS)(t);if(!n.name)throw new Error(`unable to set default session to ${n.name}`);e.defaultSession=(0,u.cast)(n)},addInternetAccountConf(t){const{type:n}=t;if(!n)throw new Error(`unknown internetAccount type ${n}`);const r=e.internetAccounts.push(t);return e.internetAccounts[r-1]},deleteInternetAccountConf(t){const n=e.internetAccounts.find((e=>e.id===t.id));return e.internetAccounts.remove(n)}})))}({pluginManager:e,assemblyConfigSchema:t}),{postProcessor:e=>(0,Qe.K$)(gt()(e),"baseUri")})}({pluginManager:e,assemblyConfigSchema:r}),s=t({pluginManager:e,assemblyConfigSchema:r});return u.types.compose(function({pluginManager:e,jbrowseModelType:t,sessionModelType:n,assemblyConfigSchema:r}){return u.types.model("BaseRootModel",{jbrowse:t,session:u.types.maybe(n),sessionPath:u.types.optional(u.types.string,""),assemblyManager:u.types.optional((o=r,s=e,u.types.model({assemblies:u.types.array(At(o,s))}).views((e=>({get assemblyNameMap(){const t={};for(const n of e.assemblies)for(const e of n.allAliases)t[e]=n;return t}}))).views((e=>({get:t=>e.assemblyNameMap[t],get assemblyNamesList(){return this.assemblyList.map((e=>e.name))},get assemblyList(){const{jbrowse:{assemblies:t},session:{sessionAssemblies:n=[],temporaryAssemblies:r=[]}={}}=(0,u.getParent)(e);return[...t,...n,...r]},get rpcManager(){return(0,u.getParent)(e).rpcManager}}))).views((e=>({async waitForAssembly(t){if(!t)throw new Error("no assembly name supplied to waitForAssembly");let n=e.get(t);if(!n)try{await(0,q.when)((()=>Boolean(e.get(t))),{timeout:1e3}),n=e.get(t)}catch(e){}if(n){if(await n.load(),await(0,q.when)((()=>!(!n.regions||!n.refNameAliases)||!!n.error)),n.error)throw n.error;return n}},async getRefNameMapForAdapter(e,t,n){if(t){const r=await this.waitForAssembly(t);return r?.getRefNameMapForAdapter(e,n)}return{}},async getReverseRefNameMapForAdapter(e,t,n){if(t){const r=await this.waitForAssembly(t);return r?.getReverseRefNameMapForAdapter(e,n)}return{}},isValidRefName(t,n){const r=e.get(n);if(r)return r.isValidRefName(t);throw new Error(`Failed to look up refName ${t} on ${n} because assembly does not exist`)}}))).actions((e=>({afterAttach(){(0,u.addDisposer)(e,(0,Ce.reaction)((()=>e.assemblyList),(t=>{e.assemblies.forEach((e=>{e.configuration||this.removeAssembly(e)})),t.forEach((t=>{e.assemblies.some((e=>e.name===(0,I.readConfObject)(t,"name")))||this.addAssembly(t)}))}),{fireImmediately:!0,name:"assemblyManagerAfterAttach"}))},removeAssembly(t){e.assemblies.remove(t)},addAssembly(t){e.assemblies.push({configuration:t})},replaceAssembly(t,n){e.assemblies[t]=(0,u.cast)({configuration:n})}})))),{})}).volatile((t=>({rpcManager:new We(e,t.jbrowse.configuration.rpc,{MainThreadRpcDriver:{}}),adminMode:!1,error:void 0,textSearchManager:new et.A(e),pluginManager:e}))).actions((e=>({setError(t){e.error=t},setSession(t){e.session=(0,u.cast)(t)},setDefaultSession(){this.setSession(e.jbrowse.defaultSession)},setSessionPath(t){e.sessionPath=t},renameCurrentSession(t){if(e.session){const n=JSON.parse(JSON.stringify((0,u.getSnapshot)(e.session)));n.name=t,this.setSession(n)}}})));var o,s}({pluginManager:e,jbrowseModelType:o,sessionModelType:s,assemblyConfigSchema:r}),function(e){return u.types.model({internetAccounts:u.types.array(e.pluggableMstType("internet account","stateModel"))}).actions((t=>({initializeInternetAccount(n,r={}){if(!e.getInternetAccountType(n.type))throw new Error(`unknown internet account type ${n.type}`);const o=t.internetAccounts.push({...r,type:n.type,configuration:n});return t.internetAccounts[o-1]},createEphemeralInternetAccount(n,r,o){let s;try{s=new URL(o).origin}catch(e){}const a=n.split("-"),i={type:a[0],internetAccountId:n,name:a.slice(1).join("-"),description:"",domains:s?[s]:[]},l=e.getInternetAccountType(i.type).stateModel.create({...r,type:i.type,configuration:i});return t.internetAccounts.push(l),l},findAppropriateInternetAccount(e){const n=e.internetAccountId;if(n){const e=t.internetAccounts.find((e=>e.internetAccountId===n));if(e)return e}for(const n of t.internetAccounts)if(n.handlesLocation(e))return n;return n?this.createEphemeralInternetAccount(n,{},e.uri):null}}))).actions((e=>({afterCreate(){(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{const{jbrowse:t}=e;t.internetAccounts.forEach(e.initializeInternetAccount)})))}})))}(e),u.types.model({history:u.types.optional(Ae,{targetPath:"../session"})}).actions((e=>({afterCreate(){document.addEventListener("keydown",(t=>{e.history.canRedo&&((t.ctrlKey||t.metaKey)&&t.shiftKey&&"KeyZ"===t.code||t.ctrlKey&&!t.shiftKey&&"KeyY"===t.code)&&"INPUT"!==document.activeElement?.tagName.toUpperCase()&&e.history.redo(),e.history.canUndo&&(t.ctrlKey||t.metaKey)&&!t.shiftKey&&"KeyZ"===t.code&&"INPUT"!==document.activeElement?.tagName.toUpperCase()&&e.history.undo()})),(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{const{session:t}=e;t&&e.history.initialize()})))}}))),u.types.model({}).actions((e=>{const t=e;return{setMenus(e){t.menus=e},appendMenu:e=>t.menus.push({label:e,menuItems:[]}),insertMenu:(e,n)=>(t.menus.splice((n<0?t.menus.length:0)+n,0,{label:e,menuItems:[]}),t.menus.length),appendToMenu(e,n){const r=t.menus.find((t=>t.label===e));return r?r.menuItems.push(n):(t.menus.push({label:e,menuItems:[n]}),1)},insertInMenu(e,n,r){const o=t.menus.find((t=>t.label===e));if(!o)return t.menus.push({label:e,menuItems:[n]}),1;const s=r<0?o.menuItems.length+r:r;return o.menuItems.splice(s,0,n),o.menuItems.length},appendToSubMenu(e,n){let r=t.menus.find((t=>t.label===e[0]));if(!r){const n=this.appendMenu(e[0]);r=t.menus[n-1]}let{menuItems:o}=r;const s=[e[0]];return e.slice(1).forEach((e=>{s.push(e);let t=o.find((t=>"label"in t&&t.label===e));if(!t){const n=o.push({label:e,subMenu:[]});t=o[n-1]}if(!("subMenu"in t))throw new Error(`"${e}" in path "${s}" is not a subMenu`);o=t.subMenu})),o.push(n)},insertInSubMenu(e,n,r){let o=t.menus.find((t=>t.label===e[0]));if(!o){const n=this.appendMenu(e[0]);o=t.menus[n-1]}let{menuItems:s}=o;const a=[e[0]];return e.slice(1).forEach((e=>{a.push(e);let t=s.find((t=>"label"in t&&t.label===e));if(!t){const n=s.push({label:e,subMenu:[]});t=s[n-1]}if(!("subMenu"in t))throw new Error(`"${e}" in path "${a}" is not a subMenu`);s=t.subMenu})),s.splice(r,0,n),s.length}}}))).props({configPath:u.types.maybe(u.types.string)}).volatile((t=>({version:"2.15.4",hydrateFn:Et.c,createRootFn:Et.H,pluginsUpdated:!1,rpcManager:new We(e,t.jbrowse.configuration.rpc,{WebWorkerRpcDriver:{makeWorkerInstance:pt},MainThreadRpcDriver:{}}),savedSessionsVolatile:Ce.observable.map({}),textSearchManager:new et.A(e),error:void 0}))).views((e=>({get savedSessions(){return[...e.savedSessionsVolatile.values()]},localStorageId:t=>`localSaved-${t}-${e.configPath}`,get autosaveId(){return`autosave-${e.configPath}`},get previousAutosaveId(){return`previousAutosave-${e.configPath}`}}))).views((e=>({get savedSessionNames(){return e.savedSessions.map((e=>e.name))},get currentSessionId(){const e=new URL(window.location.href),t=new URLSearchParams(e.search);return t.get("session")?.split("local-")[1]}}))).actions((e=>({afterCreate(){for(const[t,n]of Object.entries(localStorage).filter((([e,t])=>e.startsWith("localSaved-"))).filter((([t])=>t.includes(e.configPath||"undefined"))))try{const{session:r}=JSON.parse(n);e.savedSessionsVolatile.set(t,r)}catch(e){console.error("bad session encountered",t,n)}(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{for(const[,t]of e.savedSessionsVolatile.entries())try{const n=e.localStorageId(t.name);localStorage.setItem(n,JSON.stringify({session:t}))}catch(e){"22"!==e.code&&"1024"!==e.code||alert('Local storage is full! Please use the "Open sessions" panel to remove old sessions')}}))),(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{if(!e.session)return;const t=(0,u.getSnapshot)(e.session),n=JSON.stringify;sessionStorage.setItem("current",n({session:t})),localStorage.setItem(`autosave-${e.configPath}`,n({session:{...t,name:`${t.name}-autosaved`}})),e.pluginsUpdated&&window.location.reload()}),{delay:400}))},setSession(t){const n=e.session;if(e.session=(0,u.cast)(t),e.session)try{(0,Qe.pK)(e.session,(0,u.getType)(e.session))}catch(t){throw e.session=n,t}},setPluginsUpdated(t){e.pluginsUpdated=t},setDefaultSession(){const{defaultSession:t}=e.jbrowse,n={...t,name:`${t.name} ${(new Date).toLocaleString()}`};this.setSession(n)},renameCurrentSession(t){if(e.session){const n=JSON.parse(JSON.stringify((0,u.getSnapshot)(e.session)));n.name=t,this.setSession(n)}},addSavedSession(t){const n=e.localStorageId(t.name);e.savedSessionsVolatile.set(n,t)},removeSavedSession(t){const n=e.localStorageId(t.name);localStorage.removeItem(n),e.savedSessionsVolatile.delete(n)},duplicateCurrentSession(){if(e.session){const t=JSON.parse(JSON.stringify((0,u.getSnapshot)(e.session)));let n=`${e.session.name} (copy)`;if(e.savedSessionNames.includes(n)){let t=2;do{n=`${e.session.name} (copy ${t})`,t+=1}while(e.savedSessionNames.includes(n))}t.name=n,this.setSession(t)}},activateSession(t){const n=e.localStorageId(t),r=localStorage.getItem(n);if(!r)throw new Error(`Can't activate session ${t}, it is not in the savedSessions`);this.setSession(JSON.parse(r).session)},saveSessionToLocalStorage(){if(e.session){const t=e.localStorageId(e.session.name);e.savedSessionsVolatile.set(t,(0,u.getSnapshot)(e.session))}},loadAutosaveSession(){const t=localStorage.getItem(e.previousAutosaveId),n=t?JSON.parse(t).session:{},{name:r}=n;n.name=`${r.replace("-autosaved","")}-restored`,this.setSession(n)},setError(t){e.error=t}}))).volatile((e=>({menus:[{label:"File",menuItems:[{label:"New session",icon:Y.A,onClick:t=>{const n=localStorage.getItem(e.autosaveId);n&&localStorage.setItem(e.previousAutosaveId,n),t.setDefaultSession()}},{label:"Import session…",icon:at.A,onClick:e=>{const t=e.addWidget("ImportSessionWidget","importSessionWidget");e.showWidget(t)}},{label:"Export session",icon:st.A,onClick:e=>{const t=new Blob([JSON.stringify({session:(0,u.getSnapshot)(e)},null,2)],{type:"text/plain;charset=utf-8"});(0,Xe.saveAs)(t,"session.json")}},{label:"Open session…",icon:ot.A,onClick:e=>{const t=e.addWidget("SessionManager","sessionManager");e.showWidget(t)}},{label:"Save session",icon:ct.A,onClick:t=>{e.saveSessionToLocalStorage(),t.notify(`Saved session "${t.name}"`,"success")}},{label:"Duplicate session",icon:rt.A,onClick:e=>{e.duplicateCurrentSession&&e.duplicateCurrentSession()}},{type:"divider"},{label:"Open track...",icon:lt.A,onClick:e=>{if(0===e.views.length)e.notify("Please open a view to add a track first");else if(e.views.length>0){const t=e.addWidget("AddTrackWidget","addTrackWidget",{view:e.views[0].id});e.showWidget(t),e.views.length>1&&e.notify("This will add a track to the first view. Note: if you want to open a track in a specific view open the track selector for that view and use the add track (plus icon) in the bottom right")}}},{label:"Open connection...",icon:mt.A8,onClick:e=>{e.showWidget(e.addWidget("AddConnectionWidget","addConnectionWidget"))}},{type:"divider"},{label:"Return to splash screen",icon:nt.A,onClick:()=>{e.setSession(void 0)}}]},...n?[{label:"Admin",menuItems:[{label:"Open assembly manager",onClick:()=>e.session.queueDialog((t=>[kt.m,{onClose:t,rootModel:e}]))},{label:"Set default session",onClick:()=>e.session.queueDialog((t=>[Tt,{rootModel:e,onClose:t}]))}]}]:[],{label:"Add",menuItems:[]},{label:"Tools",menuItems:[{label:"Undo",icon:ut.A,onClick:()=>{e.history.canUndo&&e.history.undo()}},{label:"Redo",icon:dt.A,onClick:()=>{e.history.canRedo&&e.history.redo()}},{type:"divider"},{label:"Plugin store",icon:it.A,onClick:()=>{e.session&&e.session.showWidget(e.session.addWidget("PluginStoreWidget","pluginStoreWidget"))}},{label:"Preferences",icon:tt.A,onClick:()=>{e.session&&e.session.queueDialog((t=>[Mt,{session:e.session,handleClose:t}]))}}]}],adminMode:n})))}function It(e){return u.types.model("ReferenceManagementSessionMixin",{}).views((e=>({getReferring(t){const n=[];return(0,u.walk)((0,u.getParent)(e),(e=>{if((0,u.isModelType)((0,u.getType)(e))){const r=(0,u.getMembers)(e);Object.entries(r.properties).forEach((([r,o])=>{(0,u.isReferenceType)(o)&&e[r]===t&&n.push({node:e,key:r})}))}})),n}}))).actions((e=>({removeReferring(t,n,r,o){t.forEach((({node:t})=>{let s=!1;try{const e="open track(s)",a=(0,q.getContainingView)(t);r.push((()=>{a.hideTrack(n.trackId)})),s=!0,o[e]||(o[e]=0),o[e]+=1}catch(e){}if((0,q.isSessionModelWithWidgets)(e)&&e.widgets.has(t.id)){const n="configuration editor widget(s)";(0,q.isSessionModelWithWidgets)(e)&&r.push((()=>{e.hideWidget(t)})),s=!0,o[n]||(o[n]=0),o[n]+=1}if(!s)throw new Error(`Error when closing this connection, the following node is still referring to a track configuration: ${JSON.stringify((0,u.getSnapshot)(t))}`)}))}})))}function Nt(e){const t=e.pluggableMstType("widget","stateModel");return u.types.model({drawerPosition:u.types.optional(u.types.string,(()=>(0,q.localStorageGetItem)("drawerPosition")||"right")),drawerWidth:u.types.optional(u.types.refinement(u.types.integer,(e=>e>=128)),384),widgets:u.types.map(t),activeWidgets:u.types.map(u.types.safeReference(t)),minimized:u.types.optional(u.types.boolean,!1)}).views((e=>({get visibleWidget(){if((0,u.isAlive)(e))return[...e.activeWidgets.values()][e.activeWidgets.size-1]}}))).actions((t=>({setDrawerPosition(e){t.drawerPosition=e,localStorage.setItem("drawerPosition",e)},updateDrawerWidth(e){if(e===t.drawerWidth)return t.drawerWidth;let n=e;return n<128&&(n=128),t.drawerWidth=n,n},resizeDrawer(e){"left"===t.drawerPosition&&(e*=-1);const n=t.drawerWidth;return n-this.updateDrawerWidth(n-e)},addWidget(n,r,o={},s){if(!e.getElementType("widget",n))throw new Error(`unknown widget type ${n}`);const a={...o,id:r,type:n,configuration:s||{type:n}};return t.widgets.set(r,a),t.widgets.get(r)},showWidget(e){t.activeWidgets.has(e.id)&&t.activeWidgets.delete(e.id),t.activeWidgets.set(e.id,e),t.minimized=!1},hasWidget:e=>t.activeWidgets.has(e.id),hideWidget(e){t.activeWidgets.delete(e.id)},minimizeWidgetDrawer(){t.minimized=!0},showWidgetDrawer(){t.minimized=!1},hideAllWidgets(){t.activeWidgets.clear()},editConfiguration(e){if(!(0,I.isConfigurationModel)(e))throw new Error("must pass a configuration model to editConfiguration");const t=this.addWidget("ConfigurationEditorWidget","configEditor",{target:e});this.showWidget(t)},afterAttach(){(0,u.addDisposer)(t,(0,Ce.autorun)((()=>{(0,q.localStorageSetItem)("drawerPosition",t.drawerPosition)})))}})))}var xt=n(45858);var Rt=n(71627);const Ot=(0,r.lazy)((()=>Promise.all([n.e(9245),n.e(4630)]).then(n.bind(n,74630))));var $t=n(25762),Dt=n(36993),Lt=n(49204);const jt=(0,r.lazy)((()=>Promise.all([n.e(8565),n.e(5676),n.e(3011),n.e(6157),n.e(6683),n.e(8984),n.e(965)]).then(n.bind(n,40965))));function zt({pluginManager:e,assemblyConfigSchema:t}){const n=u.types.compose("WebCoreSessionModel",u.types.compose("WebCoreSessionModelGroupA",It(),Nt(e),u.types.model("DialogQueueSessionMixin",{}).volatile((()=>({queueOfDialogs:[]}))).views((e=>({get DialogComponent(){return e.queueOfDialogs[0]?.[0]},get DialogProps(){return e.queueOfDialogs[0]?.[1]}}))).actions((e=>({removeActiveDialog(){e.queueOfDialogs=e.queueOfDialogs.slice(1)},queueDialog(t){const[n,r]=t((()=>{this.removeActiveDialog()}));e.queueOfDialogs=[...e.queueOfDialogs,[n,r]]}}))),u.types.model({}).volatile((()=>({sessionThemeName:(0,q.localStorageGetItem)("themeName")||"default"}))).views((e=>({allThemes(){const t=e,n=(0,I.getConf)(t.jbrowse,"extraThemes");return{...l.defaultThemes,...n}},get themeName(){const{sessionThemeName:t}=e;return this.allThemes()[t]?t:"default"},get theme(){const t=e,n=(0,I.getConf)(t.jbrowse,"theme"),r=this.allThemes();return(0,l.createJBrowseTheme)(n,r,this.themeName)}}))).actions((e=>({setThemeName(t){e.sessionThemeName=t},afterAttach(){(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{(0,q.localStorageSetItem)("themeName",e.themeName)})))}}))),function(e){return u.types.compose((0,xt.DH)(e),Nt(e)).props({views:u.types.array(e.pluggableMstType("view","stateModel"))}).actions((t=>({moveViewDown(e){const n=t.views.findIndex((t=>t.id===e));-1!==n&&n<t.views.length-1&&t.views.splice(n,2,t.views[n+1],t.views[n])},moveViewUp(e){const n=t.views.findIndex((t=>t.id===e));n>0&&t.views.splice(n-1,2,t.views[n],t.views[n-1])},moveViewToTop(e){const n=t.views.findIndex((t=>t.id===e));t.views=(0,u.cast)([t.views[n],...t.views.filter((t=>t.id!==e))])},moveViewToBottom(e){const n=t.views.findIndex((t=>t.id===e));t.views=(0,u.cast)([...t.views.filter((t=>t.id!==e)),t.views[n]])},addView(n,r={}){if(!e.getElementType("view",n))throw new Error(`unknown view type ${n}`);const o=t.views.push({...r,type:n});return t.views[o-1]},removeView(e){for(const[,n]of t.activeWidgets)n.view&&n.view.id===e.id&&t.hideWidget(n);t.views.remove(e)},addLinearGenomeViewOfAssembly(e,t={}){return this.addViewOfAssembly("LinearGenomeView",e,t)},addViewOfAssembly(e,n,r={}){const o=t.assemblies.find((e=>(0,I.readConfObject)(e,"name")===n));if(!o)throw new Error(`Could not add view of assembly "${n}", assembly name not found`);return this.addView(e,{...r,displayRegionsFromAssemblyName:(0,I.readConfObject)(o,"name")})},addViewFromAnotherView(e,t,n={}){const r={...n};return r.displayedRegions=(0,u.getSnapshot)(t.displayedRegions),this.addView(e,r)}})))}(e)),u.types.compose("WebCoreSessionModelGroupB",function(e){return function(e){return u.types.compose("TracksManagerSessionMixin",(0,xt.DH)(e),It()).views((e=>({get tracks(){return e.jbrowse.tracks}}))).actions((e=>({addTrackConf:t=>e.jbrowse.addTrackConf(t),deleteTrackConf(t){const n=[],r=e.getReferring(t);if(e.removeReferring(r,t,n,{}),n.forEach((e=>{e()})),e.adminMode)return e.jbrowse.deleteTrackConf(t)}})))}(e).named("SessionTracksManagerSessionMixin").props({sessionTracks:u.types.array(e.pluggableConfigSchemaType("track"))}).views((e=>({get tracks(){return[...e.sessionTracks,...e.jbrowse.tracks]}}))).actions((e=>{const{addTrackConf:t,deleteTrackConf:n}=e;return{addTrackConf(n){if(e.adminMode)return t(n);const{trackId:r,type:o}=n;if(!o)throw new Error(`unknown track type ${o}`);const s=e.sessionTracks.find((e=>e.trackId===r));if(s)return s;const a=e.sessionTracks.push(n);return e.sessionTracks[a-1]},deleteTrackConf(t){const r=n(t);if(r)return r;const{trackId:o}=t,s=e.sessionTracks.findIndex((e=>e.trackId===o));return-1!==s?e.sessionTracks.splice(s,1):void 0}}}))}(e),(o=t,u.types.model({sessionAssemblies:u.types.array(o)}).actions((e=>{const t=e;return{addSessionAssembly(e){const n=t.sessionAssemblies.find((t=>t.name===e.name));if(n)return console.warn(`Assembly ${e.name} already exists`),n;const r=t.sessionAssemblies.push(e);return t.sessionAssemblies[r-1]},removeSessionAssembly(e){const n=t.sessionAssemblies.find((t=>t.name===e));n&&t.sessionAssemblies.remove(n)}}}))),function(e,t=u.types.frozen()){return u.types.model({temporaryAssemblies:u.types.array(t)}).actions((e=>{const t=e;return{addTemporaryAssembly(e){const n=t.temporaryAssemblies.find((t=>t.name===e.name));if(n)return console.warn(`Assembly ${e.name} was already existing`),n;const r=t.temporaryAssemblies.push(e);return t.temporaryAssemblies[r-1]},removeTemporaryAssembly(e){const n=t.temporaryAssemblies.find((t=>t.name===e));n&&t.temporaryAssemblies.remove(n)}}}))}(0,t),function(e){return u.types.compose("SessionConnectionsManagement",(0,Lt.F)(e),u.types.model({sessionConnections:u.types.array(e.pluggableConfigSchemaType("connection"))})).actions((e=>{const t=e,n=t.deleteConnection,r=t.addConnectionConf;return{addConnectionConf(e){if(t.adminMode)return r(e);const{connectionId:n,type:o}=e;if(!o)throw new Error(`unknown connection type ${o}`);const s=t.sessionTracks.find((e=>e.connectionId===n));if(s)return s;const a=t.sessionConnections.push(e);return t.sessionConnections[a-1]},deleteConnection(e){let r;if(t.adminMode&&(r=n(e)),!r){const{connectionId:n}=e,r=t.sessionConnections.findIndex((e=>e.connectionId===n));if(-1===r)return;return t.sessionConnections.splice(r,1)}return r}}}))}(e),u.types.model({focusedViewId:u.types.maybe(u.types.string)}).actions((e=>({setFocusedViewId(t){e.focusedViewId=t}}))),u.types.model({}).volatile((()=>({snackbarMessages:Ce.observable.array()}))).views((e=>({get snackbarMessageSet(){return new Map(e.snackbarMessages.map((e=>[e.message,e])))}}))).actions((e=>({notify(e,t,n){this.pushSnackbarMessage(e,t,n),"info"!==t&&"success"!==t||setTimeout((()=>{this.removeSnackbarMessage(e)}),5e3)},notifyError(t,n,o){this.notify(t,"error",{name:r.createElement(Rt.A,null),onClick:()=>{e.queueDialog((e=>[Ot,{onClose:e,error:n,extra:o}]))}})},pushSnackbarMessage(t,n,r){!r&&e.snackbarMessageSet.has(t)||e.snackbarMessages.push({message:t,level:n,action:r})},popSnackbarMessage:()=>e.snackbarMessages.pop(),removeSnackbarMessage(t){const n=e.snackbarMessageSet.get(t);void 0!==n&&e.snackbarMessages.remove(n)}}))))).props({margin:0,sessionPlugins:u.types.array(u.types.frozen())}).volatile((()=>({sessionThemeName:(0,q.localStorageGetItem)("themeName")||"default",task:void 0}))).views((e=>({get tracks(){return[...e.sessionTracks,...e.jbrowse.tracks]},get root(){return(0,u.getParent)(e)},get assemblies(){return[...e.jbrowse.assemblies,...e.sessionAssemblies]},get connections(){return[...e.jbrowse.connections,...e.sessionConnections]}}))).actions((e=>({setName(t){e.name=t}}))).views((e=>({get assemblyNames(){return e.assemblies.map((e=>(0,I.readConfObject)(e,"name")))},get version(){return e.root.version},get shareURL(){return(0,I.getConf)(e.jbrowse,"shareURL")},get textSearchManager(){return e.root.textSearchManager},get assemblyManager(){return e.root.assemblyManager},get savedSessions(){return e.root.savedSessions},get previousAutosaveId(){return e.root.previousAutosaveId},get savedSessionNames(){return e.root.savedSessionNames},get history(){return e.root.history},get menus(){return e.root.menus},renderProps:()=>({theme:e.theme,highResolutionScaling:(0,I.getConf)(e,"highResolutionScaling")})}))).actions((e=>({addAssemblyConf(t){e.jbrowse.addAssemblyConf(t)},addSessionPlugin(t){if(e.sessionPlugins.some((e=>e.name===t.name)))throw new Error("session plugin cannot be installed twice");e.sessionPlugins.push(t),e.root.setPluginsUpdated(!0)},removeSessionPlugin(t){e.sessionPlugins=(0,u.cast)(e.sessionPlugins.filter((e=>e.url!==t.url||e.umdUrl!==t.umdUrl||e.cjsUrl!==t.cjsUrl||e.esmUrl!==t.esmUrl))),(0,u.getParent)(e).setPluginsUpdated(!0)},addSavedSession:t=>e.root.addSavedSession(t),removeSavedSession:t=>e.root.removeSavedSession(t),renameCurrentSession:t=>e.root.renameCurrentSession(t),duplicateCurrentSession:()=>e.root.duplicateCurrentSession(),activateSession:t=>e.root.activateSession(t),setDefaultSession:()=>e.root.setDefaultSession(),saveSessionToLocalStorage:()=>e.root.saveSessionToLocalStorage(),loadAutosaveSession:()=>e.root.loadAutosaveSession(),setSession:t=>e.root.setSession(t)}))).actions((e=>({editTrackConfiguration(t){const{adminMode:n,sessionTracks:r}=e;if(!n&&!r.includes(t))throw new Error("Can't edit the configuration of a non-session track");e.editConfiguration(t)}}))).views((e=>({getTrackActionMenuItems(t){const{adminMode:n,sessionTracks:r}=e,o=n||r.find((e=>e.trackId===t.trackId)),s="ReferenceSequenceTrack"===t.type;return[{label:"About track",priority:1002,onClick:()=>{e.queueDialog((e=>[jt,{config:t,handleClose:e}]))},icon:Dt.A},{label:"Settings",priority:1001,disabled:!o,onClick:()=>{e.editTrackConfiguration(t)},icon:tt.A},{label:"Delete track",priority:1e3,disabled:!o||s,onClick:()=>e.deleteTrackConf(t),icon:$t.A},{label:"Copy track",priority:999,disabled:s,onClick:()=>{const n=gt()((0,u.getSnapshot)(t)),r=Date.now();n.trackId+=`-${r}`,n.displays.forEach((e=>{e.displayId+=`-${r}`})),e.adminMode||(n.trackId+="-sessionTrack",n.category=void 0),n.name+=" (copy)",e.addTrackConf(n)},icon:rt.A}]}}))).actions((e=>({afterAttach(){(0,u.addDisposer)(e,(0,Ce.autorun)((()=>{(0,q.localStorageSetItem)("drawerPosition",e.drawerPosition),(0,q.localStorageSetItem)("themeName",e.themeName)})))}})));var o;const s=e.evaluateExtensionPoint("Core-extendSession",n);return u.types.snapshotProcessor(s,{preProcessor(e){const{connectionInstances:t,...n}=e||{};return Array.isArray(t)?e:n}})}function Wt({pluginManager:e,assemblyConfigSchema:t}){return zt({pluginManager:e,assemblyConfigSchema:t})}var Ut=n(63163);function Ft(e){const t=new Ze.A([...Ut.A.map((e=>({plugin:new e,metadata:{isCore:!0}}))),...e.runtimePlugins.map((({plugin:e,definition:t})=>({plugin:new e,definition:t,metadata:{url:t.url}}))),...e.sessionPlugins.map((({plugin:e,definition:t})=>({plugin:new e,definition:t,metadata:{url:t.url}})))]);t.createPluggableElements();const n=Pt({pluginManager:t,sessionModelFactory:Wt,adminMode:!!e.adminKey});if(!e.configSnapshot)return;const r=n.create({jbrowse:e.configSnapshot,configPath:e.configPath},{pluginManager:t});e.configSnapshot.configuration?.rpc?.defaultDriver||r.jbrowse.configuration.rpc.defaultDriver.set("WebWorkerRpcDriver");let o=()=>{};try{if(e.sessionError)throw e.sessionError;e.sessionSnapshot?r.setSession(e.sessionSnapshot):e.sessionSpec?o=function({views:e,sessionTracks:t=[]},n){return async()=>{const{rootModel:r}=n;if(!r)throw new Error("rootModel not initialized");try{r.setSession({name:`New session ${(new Date).toLocaleString()}`}),t.forEach((e=>r.session.addTrackConf(e))),await Promise.all(e.map((e=>n.evaluateAsyncExtensionPoint(`LaunchView-${e.type}`,{...e,session:r.session}))))}catch(e){console.error(e),r.session?.notify(`${e}`)}}}(e.sessionSpec,t):r.jbrowse.defaultSession?.views?.length&&r.setDefaultSession()}catch(t){r.setDefaultSession();const n=`${t}`.replace("[mobx-state-tree] ","").replace(/\(.+/,""),o=n.length>1e3?`${n.slice(0,1e3)}...see more in console`:n,s=o.startsWith("Error:")?o:`Error: ${o}`;r.session?.notifyError(`${s}. If you received this URL from another user, request that they send you a session generated with the "Share" button instead of copying and pasting their URL`,e.sessionError,e.sessionSnapshot),console.error(t)}return function(e,t,n){e&&!(0,I.readConfObject)(e.jbrowse.configuration,"disableAnalytics")&&(async function(e,t,n){try{const r="https://analytics.jbrowse.org/api/v1",o=e.jbrowse.tracks.filter((e=>((0,I.readConfObject)(e,"assemblyNames")||[]).length>1)).length,s=Object.keys(localStorage).filter((e=>e.includes("localSaved-"))).length,{jbrowse:a,session:i,version:l}=e,{tracks:c,assemblies:u,plugins:d}=a,m={ver:l,"plugins-count":d?.length||0,"plugin-names":d?.map((e=>e.name)).join(","),"assemblies-count":u.length,"tracks-count":c.length,"session-tracks-count":i?.sessionTracks.length||0,"open-views":i?.views.length||0,"synteny-tracks-count":o,"saved-sessions-count":s,"existing-session-param-type":n?.split("-")[0]||"none","scn-h":window.screen.height,"scn-w":window.screen.width,"win-h":window.innerHeight,"win-w":window.innerWidth,electron:q.isElectron,loadTime:(Date.now()-t)/1e3,jb2:!0};c.forEach((e=>{const t=`track-types-${e.type}`;m[t]=m[t]+1||1})),i?.sessionTracks.forEach((e=>{const t=`sessionTrack-types-${e.type}`;m[t]=m[t]+1||1}));const p=Object.keys(m).map((e=>`${e}=${m[e]}`)).join("&");await fetch(`${r}?${p}`)}catch(e){console.error("Failed to write analytics to AWS.",e)}}(e,t,n),async function(e,t){const n={"tracks-count":e.jbrowse.tracks.length,ver:e.version,electron:q.isElectron,loadTime:Date.now()-t,pluginNames:e.jbrowse.plugins?.map((e=>e.name))||""};let r="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){";r+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),",r+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)",r+="})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');",r+="ga('create', 'UA-7115575-5', 'auto', 'jbrowseTracker');";const o={};"tracks-count ver electron loadTime pluginNames".split(/\s+/).forEach(((e,t)=>{o[`dimension${t+1}`]=n[e]})),o.metric1=Math.round(n.loadTime),r+=`ga('jbrowseTracker.send', 'pageview',${JSON.stringify(o)});`;const s=document.createElement("script");s.innerHTML=r,document.getElementsByTagName("head")[0].append(s)}(e,t))}(r,e.initialTimestamp,e.sessionQuery),t.setRootModel(r),t.configure(),o(),t}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(null,arguments)}const Bt=(0,r.lazy)((()=>n.e(3116).then(n.bind(n,93116)))),qt=(0,r.lazy)((()=>n.e(7564).then(n.bind(n,7564)))),Gt=(0,r.lazy)((()=>Promise.all([n.e(6499),n.e(2189)]).then(n.bind(n,12189))));function _t(e){return null===e?void 0:e}function Ht({initialTimestamp:e=Date.now()}){const t=a.StringParam,[n]=(0,a.useQueryParam)("config",t),[o]=(0,a.useQueryParam)("session",t),[s]=(0,a.useQueryParam)("adminKey",t),[i,l]=(0,a.useQueryParam)("password",t),[c,u]=(0,a.useQueryParam)("loc",t),[d,m]=(0,a.useQueryParam)("sessionTracks",t),[p,f]=(0,a.useQueryParam)("assembly",t),[g,h]=(0,a.useQueryParam)("tracks",t),[y,w]=(0,a.useQueryParam)("highlight",t),[b,v]=(0,a.useQueryParam)("nav",t),[S,A]=(0,a.useQueryParam)("tracklist",t),C=Ke.create({configPath:_t(n),sessionQuery:_t(o),password:_t(i),adminKey:_t(s),loc:_t(c),assembly:_t(p),tracks:_t(g),sessionTracks:_t(d),tracklist:JSON.parse(_t(S)||"false"),highlight:_t(y),nav:JSON.parse(_t(b)||"true"),initialTimestamp:e});return(0,r.useEffect)((()=>{u(void 0,"replaceIn"),h(void 0,"replaceIn"),f(void 0,"replaceIn"),l(void 0,"replaceIn"),m(void 0,"replaceIn"),A(void 0,"replaceIn"),v(void 0,"replaceIn"),w(void 0,"replaceIn")}),[f,u,v,A,h,l,m,w]),r.createElement(Kt,{loader:C})}const Jt=(0,o.observer)((function({sessionTriaged:e,loader:t}){return r.createElement(r.Suspense,{fallback:null},"session"===e.origin?r.createElement(qt,{loader:t,handleClose:()=>{t.setSessionTriaged(void 0)}}):r.createElement(Bt,{loader:t,handleClose:()=>{t.setSessionTriaged(void 0)}}))})),Qt=(0,o.observer)((function({pluginManager:e}){const{rootModel:t}=e;return t?.session?r.createElement(qe,{pluginManager:e}):r.createElement(r.Suspense,{fallback:r.createElement(l.LoadingEllipses,null)},r.createElement(Gt,{rootModel:t,onFactoryReset:Ge.A}))})),Kt=(0,o.observer)((function({loader:e}){const{configError:t,ready:n,sessionTriaged:o}=e,[s,a]=(0,r.useState)(),[i,l]=(0,r.useState)();(0,r.useEffect)((()=>{let t;try{if(!n)return;t=Ft(e),a(t)}catch(e){console.error(e),l(e)}}),[e,n]);const u=t||i;return u?r.createElement(Ye,{error:u}):o?r.createElement(Jt,{loader:e,sessionTriaged:o}):s?r.createElement(Qt,{pluginManager:s}):r.createElement(c.A,null)})),Yt=function({initialTimestamp:e}){return r.createElement(s.tH,{FallbackComponent:e=>r.createElement(l.FatalErrorDialog,Vt({},e,{resetButtonText:"Reset Session",onFactoryReset:Ge.A}))},r.createElement(a.QueryParamProvider,{adapter:i.Q},r.createElement(Ht,{initialTimestamp:e})))}},55252:(e,t,n)=>{async function r(){window.location=window.location.pathname}n.d(t,{A:()=>r})},17765:(e,t,n)=>{n.d(t,{J:()=>i,Z:()=>l});var r=n(49409);const o=async(e,t)=>(await Promise.all([n.e(7753),n.e(9831),n.e(5156)]).then(n.t.bind(n,29831,23))).encrypt(e,t).toString(),s=async(e,t)=>{const r=await Promise.all([n.e(7753),n.e(9831),n.e(5156)]).then(n.t.bind(n,29831,23)),o=await Promise.all([n.e(7753),n.e(6235)]).then(n.t.bind(n,12598,23));return r.decrypt(e,t).toString(o)};function a(e){try{return JSON.parse(e).message}catch(t){return e}}async function i(e,t,n){const s=await(0,r.eW)(JSON.stringify(e)),i=window.btoa([...window.crypto.getRandomValues(new Uint8Array(10))].map((e=>String.fromCharCode(e))).join("")).replaceAll(/[+/]/g,"").slice(0,5);const l=await o(s,i),c=new FormData;c.append("session",l),c.append("dateShared",`${Date.now()}`),c.append("referer",n);const u=await fetch(`${t}share`,{method:"POST",mode:"cors",body:c});if(!u.ok){const e=await u.text();throw new Error(a(e))}return{json:await u.json(),encryptedSession:l,password:i}}async function l(e,t,n,r){const o=t.split("share-")[1],i=`${e}?sessionId=${encodeURIComponent(o)}`,l=await fetch(i,{signal:r});if(!l.ok){const e=await l.text();throw new Error(a(e))}const c=await l.json();return s(c.session,n)}},49409:(e,t,n)=>{n.d(t,{K$:()=>d,LP:()=>s,Vr:()=>c,XE:()=>l,eW:()=>a,pK:()=>i,pS:()=>u});var r=n(59773),o=n(36422);async function s(e){const t=function(e){let t=0;switch(e.length%4){case 3:t=1;break;case 2:t=2;break;case 0:t=0;break;default:throw new Error("base64 not a valid length")}return e+"=".repeat(t)}(e.replaceAll("-","+").replaceAll("_","/")),{toByteArray:r}=await Promise.resolve().then(n.t.bind(n,47130,19)),{inflate:o}=await n.e(7864).then(n.t.bind(n,57864,23)),s=o(r(t));return(new TextDecoder).decode(s)}async function a(e){const t=(new TextEncoder).encode(e),{deflate:r}=await n.e(7864).then(n.t.bind(n,57864,23)),{fromByteArray:o}=await Promise.resolve().then(n.t.bind(n,47130,19)),s=o(r(t)),a=s.indexOf("=");return a>0?s.slice(0,a).replaceAll("+","-").replaceAll("/","_"):s.replaceAll("+","-").replaceAll("/","_")}function i(e,t){if(void 0!==e)if((0,o.isArrayType)(t)){const t=e,n=(0,o.getChildType)(e);if((0,o.isReferenceType)(n))for(let e=0;e<t.length;)(0,o.isValidReference)((()=>t[e]))?e+=1:t.splice(e,1);t.forEach((e=>{i(e,n)}))}else if((0,o.isMapType)(t)){const t=e,n=(0,o.getChildType)(t);if((0,o.isReferenceType)(n))for(const e in t.keys())(0,o.isValidReference)((()=>t.get(e)))||t.delete(e);t.forEach((e=>{i(e,n)}))}else if((0,o.isModelType)(t)){const{properties:t}=(0,o.getPropertyMembers)(e);Object.entries(t).forEach((([t,n])=>{i(e[t],n)}))}}function l(e,t){if("object"==typeof e&&null!==e)for(const n of Object.keys(e))"object"==typeof e[n]&&null!==e[n]?l(e[n],t):"uri"===n&&(e.baseUri=t.href)}function c({configuration:e},t,n){return e?.[t]||n}async function u(e){if(0===e.length)return!0;const t=await async function(){const e=await fetch("https://jbrowse.org/plugin-store/plugins.json");if(!e.ok)throw new Error(`HTTP ${e.status} ${e.statusText} fetching plugins`);return e.json()}();return e.every((e=>(0,r.rE)(e)?t.plugins.some((t=>(0,r.rE)(e)&&("url"in t&&"url"in e&&e.url===t.url||"umdUrl"in t&&"umdUrl"in e&&e.umdUrl===t.umdUrl))):(0,r.Cx)(e)?t.plugins.some((t=>(0,r.Cx)(e)&&"esmUrl"in e&&e.esmUrl===t.esmUrl)):!!(0,r.Nz)(e)&&t.plugins.some((t=>(0,r.Nz)(e)&&e.cjsUrl===t.cjsUrl))))}function d(e,t){for(const n in e)n===t?delete e[n]:"object"==typeof e[n]&&d(e[n],t);return e}}}]);
//# sourceMappingURL=3120.3940249f.chunk.js.map