comparison x/static/js/6837.a706c464.chunk.js @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
comparison
equal deleted inserted replaced
124:137e08517410 125:49f3d3878413
1 (globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[6837],{9342:(e,t,r)=>{"use strict";r.d(t,{Q:()=>a,n:()=>m});var n=r(68584);const a=(0,n.ConfigurationSchema)("BaseFeatureWidget",{});var o=r(36422),i=r(42489),s=r(33039),l=r.n(s),c=r(99546),d=r(8832);function u(e,t){return+((0,c.localStorageGetItem)(e)??t)}function p(e,t,r,n=0,a={}){t<=n||e.subfeatures?.map((e=>{p(e,t,r,n+1,a),r(e)}))}function m(e){return o.types.model("BaseFeatureWidget",{id:d.ElementId,type:o.types.literal("BaseFeatureWidget"),featureData:o.types.frozen(),formattedFields:o.types.frozen(),unformattedFeatureData:o.types.frozen(),view:o.types.safeReference(e.pluggableMstType("view","stateModel")),track:o.types.safeReference(e.pluggableMstType("track","stateModel")),trackId:o.types.maybe(o.types.string),trackType:o.types.maybe(o.types.string),maxDepth:o.types.maybe(o.types.number),sequenceFeatureDetails:o.types.optional(o.types.model("SequenceFeatureDetails").volatile((()=>({showCoordinatesSetting:(0,c.localStorageGetItem)("sequenceFeatureDetails-showCoordinatesSetting")||"none",intronBp:u("sequenceFeatureDetails-intronBp",10),upDownBp:u("sequenceFeatureDetails-upDownBp",100),upperCaseCDS:Boolean(JSON.parse((0,c.localStorageGetItem)("sequenceFeatureDetails-upperCaseCDS")||"true")),charactersPerRow:100,feature:void 0,mode:""}))).actions((e=>({setFeature(t){e.feature=t},setUpDownBp(t){e.upDownBp=t},setIntronBp(t){e.intronBp=t},setUpperCaseCDS(t){e.upperCaseCDS=t},setShowCoordinates(t){e.showCoordinatesSetting=t},setMode(t){e.mode=t}}))).views((e=>({get showCoordinates(){return"none"!==e.showCoordinatesSetting},get showGenomicCoordsOption(){return"gene"===e.mode||"gene_updownstream"===e.mode||"genomic"===e.mode||"genomic_sequence_updownstream"===e.mode},get hasCDS(){return e.feature?.subfeatures?.some((e=>"CDS"===e.type))},get hasExon(){return e.feature?.subfeatures?.some((e=>"exon"===e.type))},get hasExonOrCDS(){return this.hasExon||this.hasCDS}}))).actions((e=>({afterAttach(){(0,o.addDisposer)(e,(0,i.autorun)((()=>{(0,c.localStorageSetItem)("sequenceFeatureDetails-upDownBp",JSON.stringify(e.upDownBp)),(0,c.localStorageSetItem)("sequenceFeatureDetails-intronBp",JSON.stringify(e.intronBp)),(0,c.localStorageSetItem)("sequenceFeatureDetails-upperCaseCDS",JSON.stringify(e.upperCaseCDS)),(0,c.localStorageSetItem)("sequenceFeatureDetails-showCoordinatesSetting",e.showCoordinatesSetting)}))),(0,o.addDisposer)(e,(0,i.autorun)((()=>{e.setMode(e.hasCDS?"cds":e.hasExon?"cdna":"genomic")})))}}))),{})}).volatile((()=>({error:void 0}))).actions((e=>({setFeatureData(t){e.unformattedFeatureData=t},clearFeatureData(){e.featureData=void 0},setFormattedData(t){e.featureData=t},setExtra(t,r,n){e.trackId=r,e.trackType=t,e.maxDepth=n},setError(t){e.error=t}}))).actions((e=>({afterCreate(){(0,o.addDisposer)(e,(0,i.autorun)((()=>{try{const{unformattedFeatureData:t,track:r}=e,a=(0,c.getSession)(e);if(r&&e.setExtra(r.type,r.configuration.trackId,(0,n.getConf)(r,["formatDetails","maxDepth"])),t){const o=l()(t),i=(e,t)=>({...(0,n.getConf)(a,["formatDetails",e],{feature:t}),...(0,n.getConf)(r,["formatDetails",e],{feature:t})});r&&(o.__jbrowsefmt=i("feature",o),p(o,(0,n.getConf)(r,["formatDetails","depth"]),(e=>{e.__jbrowsefmt=i("subfeatures",e)}))),e.setFormattedData(o)}}catch(t){console.error(t),e.setError(t)}})))}}))).preProcessSnapshot((e=>{const{featureData:t,finalizedFeatureData:r,...n}=e;return{unformattedFeatureData:t,featureData:r,...n}})).postProcessSnapshot((e=>{const{unformattedFeatureData:t,featureData:r,...n}=e;return{finalizedFeatureData:JSON.parse(JSON.stringify(r,((e,t)=>void 0===t?null:t))),...n}}))}},12678:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{install(e){}configure(e){}}},70129:(e,t,r)=>{"use strict";r.d(t,{A:()=>W});var n={};r.r(n),r.d(n,{CoreFreeResources:()=>L,CoreGetFeatureDensityStats:()=>D,CoreGetFeatureDetails:()=>x,CoreGetFeatures:()=>I,CoreGetFileInfo:()=>P,CoreGetMetadata:()=>A,CoreGetRefNames:()=>k,CoreRender:()=>F});var a=r(36422),o=r(97666),i=r(47369),s=r(58273),l=r(56328),c=r(63589),d=r(67736),u=r(91612),p=r(2406),m=r(92070),g=r(8024),h=r(32767),f=r(68584),y=r(2862),b=r(7552),w=r(9342),v=r(12678),C=r(3496),S=r(46377);class k extends p.A{name="CoreGetRefNames";async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{sessionId:a,adapterConfig:o}=n,{dataAdapter:i}=await(0,C.cK)(r,a,o);return(0,S.isFeatureAdapter)(i)?i.getRefNames(n):[]}}var T=r(99546);class x extends p.A{name="CoreGetFeatureDetails";async serializeArguments(e,t){const{rootModel:r}=this.pluginManager,n=r.session.assemblyManager,a=await(0,T.renameRegionsIfNeeded)(n,e),o=await super.serializeArguments(a,t);if("MainThreadRpcDriver"===t)return o;const{rendererType:i}=e;return this.pluginManager.getRendererType(i).serializeArgsInClient(o)}async execute(e,t){let r=e;"MainThreadRpcDriver"!==t&&(r=await this.deserializeArguments(e,t));const{rendererType:n,featureId:a}=r,o=this.pluginManager.getRendererType(n);return{feature:o.sessions[(0,T.getLayoutId)(e)]?.cachedLayout.layout.getDataByID(a)?.toJSON()}}}class A extends p.A{name="CoreGetMetadata";async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{sessionId:a,adapterConfig:o}=n,{dataAdapter:i}=await(0,C.cK)(r,a,o);return(0,S.isFeatureAdapter)(i)?i.getMetadata(n):null}}class P extends p.A{name="CoreGetInfo";async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{sessionId:a,adapterConfig:o}=n,{dataAdapter:i}=await(0,C.cK)(r,a,o);return(0,S.isFeatureAdapter)(i)?i.getHeader(n):null}}var M=r(82088),E=r(44728),R=r(6434);class I extends p.A{name="CoreGetFeatures";async deserializeReturn(e,t,r){return(await super.deserializeReturn(e,t,r)).map((e=>new R.A(e)))}async serializeArguments(e,t){const{rootModel:r}=this.pluginManager,n=r.session.assemblyManager,a=await(0,T.renameRegionsIfNeeded)(n,e);return super.serializeArguments(a,t)}async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{signal:a,sessionId:o,adapterConfig:i,regions:s,opts:l}=n,{dataAdapter:c}=await(0,C.cK)(r,o,i);if(!(0,S.isFeatureAdapter)(c))throw new Error("Adapter does not support retrieving features");const d=c.getFeaturesInMultipleRegions(s,{...l,signal:a});return(await(0,E._)(d.pipe((0,M.$)()))).map((e=>e.toJSON()))}}function N(e,t){if(!t.ReactComponent)throw new Error(`renderer ${e} has no ReactComponent, it may not be completely implemented yet`);return t}class F extends p.A{name="CoreRender";async serializeArguments(e,t){const{rootModel:r}=this.pluginManager,n=r.session.assemblyManager,a=await(0,T.renameRegionsIfNeeded)(n,e),o=await super.serializeArguments(a,t);if("MainThreadRpcDriver"===t)return o;const{rendererType:i}=e;return N(i,this.pluginManager.getRendererType(i)).serializeArgsInClient(o)}async execute(e,t){let r=e;"MainThreadRpcDriver"!==t&&(r=await this.deserializeArguments(e,t));const{sessionId:n,rendererType:a,signal:o}=r;if(!n)throw new Error("must pass a unique session id");(0,T.checkAbortSignal)(o);const i=N(a,this.pluginManager.getRendererType(a)),s="MainThreadRpcDriver"===t?await i.render(r):await i.renderInWorker(r);return(0,T.checkAbortSignal)(o),s}async deserializeReturn(e,t,r){const n=await super.deserializeReturn(e,t,r);if("MainThreadRpcDriver"===r)return n;const{rendererType:a}=t;return N(a,this.pluginManager.getRendererType(a)).deserializeResultsInClient(n,t)}}class L extends p.A{name="CoreFreeResources";async execute(e){let t=0;return t+=(0,C.pZ)(e),this.pluginManager.getRendererTypes().forEach((e=>{const r=e.freeResources();r&&(t+=r)})),t}async serializeArguments(e,t){return e}}class D extends p.A{name="CoreGetFeatureDensityStats";async serializeArguments(e,t){const{rootModel:r}=this.pluginManager,n=r.session.assemblyManager,a=await(0,T.renameRegionsIfNeeded)(n,{...e,filters:e.filters?.toJSON().filters});return super.serializeArguments(a,t)}async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{adapterConfig:a,sessionId:o,regions:i}=n,{dataAdapter:s}=await(0,C.cK)(r,o,a);if(!(0,S.isFeatureAdapter)(s))throw new Error("Adapter does not support retrieving features");return s.getMultiRegionFeatureDensityStats(i,n)}}var B=r(58921);const V=(0,f.ConfigurationSchema)("CytobandAdapter",{cytobandLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/cytoband.txt.gz"}}},{explicitlyTyped:!0});class z extends v.A{name="CorePlugin";install(e){Object.values(n).forEach((t=>{e.addRpcMethod((()=>new t(e)))})),function(e){e.addAdapterType((()=>new B.AdapterType({name:"CytobandAdapter",configSchema:V,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4284)]).then(r.bind(r,94284)).then((e=>e.default))})))}(e),e.addWidgetType((()=>new d.A({name:"BaseFeatureWidget",heading:"Feature details",configSchema:w.Q,stateModel:(0,w.n)(e),ReactComponent:(0,b.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(8984),r.e(8341)]).then(r.bind(r,68984))))})))}}var O=r(53085);class H{phaseCallbacks=new Map;phaseOrder=[];constructor(...e){this.phaseOrder=e}add(e,t){if(!this.phaseOrder.includes(e))throw new Error(`unknown phase ${e}`);let r=this.phaseCallbacks.get(e);r||(r=[],this.phaseCallbacks.set(e,r)),r.push(t)}run(){this.phaseOrder.forEach((e=>{this.phaseCallbacks.get(e)?.forEach((e=>e()))}))}}class j{registeredTypes={};constructor(e,t){this.typeName=e,this.baseClass=t}add(e,t){this.registeredTypes[e]=t}has(e){return e in this.registeredTypes}get(e){if(!this.has(e))throw new Error(`${this.typeName} '${e}' not found, perhaps its plugin is not loaded or its plugin has not added it.`);return this.registeredTypes[e]}all(){return Object.values(this.registeredTypes)}}class W{plugins=[];jexl=(0,O.A)();pluginMetadata={};runtimePluginDefinitions=[];elementCreationSchedule=new H("renderer","adapter","text search adapter","display","track","connection","view","widget","rpc method","internet account","add track workflow");rendererTypes=new j("RendererType",o.default);adapterTypes=new j("AdapterType",i.A);textSearchAdapterTypes=new j("TextSearchAdapterType",g.A);trackTypes=new j("TrackType",s.A);displayTypes=new j("DisplayType",l.A);connectionTypes=new j("ConnectionType",u.A);viewTypes=new j("ViewType",c.A);widgetTypes=new j("WidgetType",d.A);rpcMethods=new j("RpcMethodType",p.A);addTrackWidgets=new j("AddTrackWorkflow",h.A);internetAccountTypes=new j("InternetAccountType",m.A);configured=!1;extensionPoints=new Map;constructor(e=[]){this.addPlugin({plugin:new z,metadata:{isCore:!0}}),e.forEach((e=>{this.addPlugin(e)}))}pluginConfigurationSchemas(){const e={};return this.plugins.forEach((t=>{t.configurationSchema&&(e[t.name]=t.configurationSchema)})),e}addPlugin(e){if(this.configured)throw new Error("JBrowse already configured, cannot add plugins");const[t,r={}]="install"in e&&"configure"in e?[e,{}]:[e.plugin,e.metadata];if(this.plugins.includes(t))throw new Error("plugin already installed");return this.pluginMetadata[t.name]=r,"definition"in e&&this.runtimePluginDefinitions.push(e.definition),t.install(this),this.plugins.push(t),this}getPlugin(e){return this.plugins.find((t=>t.name===e))}hasPlugin(e){return void 0!==this.getPlugin(e)}createPluggableElements(){return this.elementCreationSchedule&&(this.elementCreationSchedule.run(),this.elementCreationSchedule=void 0),this}setRootModel(e){this.rootModel=e}configure(){if(this.configured)throw new Error("already configured");return this.plugins.forEach((e=>{e.configure(this)})),this.configured=!0,this}getElementTypeRecord(e){switch(e){case"adapter":return this.adapterTypes;case"text search adapter":return this.textSearchAdapterTypes;case"connection":return this.connectionTypes;case"widget":return this.widgetTypes;case"renderer":return this.rendererTypes;case"display":return this.displayTypes;case"track":return this.trackTypes;case"view":return this.viewTypes;case"rpc method":return this.rpcMethods;case"internet account":return this.internetAccountTypes;case"add track workflow":return this.addTrackWidgets;default:throw new Error(`invalid element type '${e}'`)}}addElementType(e,t){if("function"!=typeof t)throw new Error("must provide a callback function that returns the new type object");const r=this.getElementTypeRecord(e);return this.elementCreationSchedule?.add(e,(()=>{const n=t(this);if(!n.name)throw new Error(`cannot add a ${e} with no name`);if(r.has(n.name))throw new Error(`${e} ${n.name} already registered, cannot register it again`);r.add(n.name,this.evaluateExtensionPoint("Core-extendPluggableElement",n))})),this}getElementType(e,t){return this.getElementTypeRecord(e).get(t)}getElementTypesInGroup(e){return this.getElementTypeRecord(e).all()}getTrackElements(){return this.getElementTypesInGroup("track")}getConnectionElements(){return this.getElementTypesInGroup("connection")}getAddTrackWorkflowElements(){return this.getElementTypesInGroup("add track workflow")}getRpcElements(){return this.getElementTypesInGroup("rpc method")}getDisplayElements(){return this.getElementTypesInGroup("display")}getAdapterElements(){return this.getElementTypesInGroup("adapter")}pluggableMstType(e,t,r=a.types.maybe(a.types.null)){const n=this.getElementTypeRecord(e).all().map((e=>e[t])).filter((e=>(0,a.isType)(e)&&(0,a.isModelType)(e)));return 0===n.length&&"undefined"==typeof jest?(console.warn(`No pluggable types found matching ('${e}','${t}')`),r):a.types.union(...n)}pluggableConfigSchemaType(e,t="configSchema"){const r=this.getElementTypeRecord(e).all().map((e=>e[t])).filter((e=>(0,f.isBareConfigurationSchemaType)(e)));return 0===r.length&&r.push((0,f.ConfigurationSchema)("Null",{})),a.types.union(...r)}jbrequireCache=new Map;lib=y.A;load=e=>(this.jbrequireCache.has(e)||this.jbrequireCache.set(e,e(this)),this.jbrequireCache.get(e));jbrequire=e=>{if("string"==typeof e){const t=this.lib[e];if(!t)throw new TypeError(`No jbrequire re-export defined for package '${e}'. If this package must be shared between plugins, add it to ReExports.js. If it does not need to be shared, just import it normally.`);return t}if("function"==typeof e)return this.load(e);if(e.default)return this.jbrequire(e.default);throw new TypeError("lib passed to jbrequire must be either a string or a function")};getRendererType(e){return this.rendererTypes.get(e)}getRendererTypes(){return this.rendererTypes.all()}getAdapterType(e){return this.adapterTypes.get(e)}getTextSearchAdapterType(e){return this.textSearchAdapterTypes.get(e)}getTrackType(e){return this.trackTypes.get(e)}getDisplayType(e){return this.displayTypes.get(e)}getViewType(e){return this.viewTypes.get(e)}getAddTrackWorkflow(e){return this.addTrackWidgets.get(e)}getWidgetType(e){return this.widgetTypes.get(e)}getConnectionType(e){return this.connectionTypes.get(e)}getRpcMethodType(e){return this.rpcMethods.get(e)}getInternetAccountType(e){return this.internetAccountTypes.get(e)}addRendererType(e){return this.addElementType("renderer",e)}addAdapterType(e){return this.addElementType("adapter",e)}addTextSearchAdapterType(e){return this.addElementType("text search adapter",e)}addTrackType(e){return this.addElementType("track",(()=>{const t=e(this);return this.getElementTypesInGroup("display").forEach((e=>{e.trackType!==t.name||t.displayTypes.includes(e)||t.addDisplayType(e)})),t}))}addDisplayType(e){return this.addElementType("display",e)}addViewType(e){return this.addElementType("view",(()=>{const t=e(this);return this.getElementTypesInGroup("display").forEach((e=>{e.viewType!==t.name&&e.viewType!==t.extendedName||t.displayTypes.includes(e)||t.addDisplayType(e)})),t}))}addWidgetType(e){return this.addElementType("widget",e)}addConnectionType(e){return this.addElementType("connection",e)}addRpcMethod(e){return this.addElementType("rpc method",e)}addInternetAccountType(e){return this.addElementType("internet account",e)}addAddTrackWorkflowType(e){return this.addElementType("add track workflow",e)}addToExtensionPoint(e,t){let r=this.extensionPoints.get(e);r||(r=[],this.extensionPoints.set(e,r)),r.push(t)}evaluateExtensionPoint(e,t,r){const n=this.extensionPoints.get(e);let a=t;if(n)for(const e of n)try{a=e(a,r)}catch(e){console.error(e)}return a}async evaluateAsyncExtensionPoint(e,t,r){const n=this.extensionPoints.get(e);let a=t;if(n)for(const e of n)try{a=await e(a,r)}catch(e){console.error(e)}return a}}},2862:(e,t,r)=>{"use strict";r.d(t,{A:()=>le});var n=r(7552),a=r(69500),o=r.t(a,2),i=r(28485),s=r.t(i,2),l=r(42489),c=r(36422),d=r(68446),u=r(75785),p=r(72639),m=r(48231),g=r(46322),h=r(78301),f=r(76404),y=r(3274),b=r(64565),w=r(46377),v=r(97884),C=r(58921),S=r(63589),k=r(47369),T=r(56328),x=r(58273),A=r(67736),P=r(1622),M=r(198),E=r(94318),R=r(98111),I=r(92880),N=r(97666),F=r(68584),L=r(12678),D=r(49823),B=r(99546),V=r(80208),z=r(88217),O=r(91468),H=r(99834),j=r(23550),W=r(66885),G=r(8832);const $=["mobx","mobx-state-tree","react","react/jsx-runtime","react-dom","mobx-react","@mui/x-data-grid","@mui/material/utils","@material-ui/core/utils","tss-react/mui","@material-ui/core","@mui/material","@mui/material/styles","@material-ui/core/styles","@material-ui/core/Accordion","@material-ui/core/AccordionActions","@material-ui/core/AccordionDetails","@material-ui/core/Alert","@material-ui/core/AlertTitle","@material-ui/core/Autocomplete","@material-ui/core/Avatar","@material-ui/core/AvatarGroup","@material-ui/core/Backdrop","@material-ui/core/Badge","@material-ui/core/Box","@material-ui/core/Breadcrumbs","@material-ui/core/Button","@material-ui/core/ButtonGroup","@material-ui/core/Card","@material-ui/core/CardActions","@material-ui/core/CardActionArea","@material-ui/core/CardContent","@material-ui/core/CardHeader","@material-ui/core/CardMedia","@material-ui/core/CircularProgress","@material-ui/core/Collapse","@material-ui/core/ClickAwayListener","@material-ui/core/Chip","@material-ui/core/Checkbox","@material-ui/core/Container","@material-ui/core/Dialog","@material-ui/core/DialogActions","@material-ui/core/DialogTitle","@material-ui/core/DialogContent","@material-ui/core/DialogContentText","@material-ui/core/Divider","@material-ui/core/Drawer","@material-ui/core/Fab","@material-ui/core/Fade","@material-ui/core/FilledInput","@material-ui/core/FormLabel","@material-ui/core/FormControl","@material-ui/core/FormControlLabel","@material-ui/core/FormHelperText","@material-ui/core/FormGroup","@material-ui/core/Grid","@material-ui/core/Grow","@material-ui/core/Icon","@material-ui/core/IconButton","@material-ui/core/Input","@material-ui/core/InputBase","@material-ui/core/InputLabel","@material-ui/core/InputAdornment","@material-ui/core/Link","@material-ui/core/LinearProgress","@material-ui/core/List","@material-ui/core/ListItem","@material-ui/core/ListItemAvatar","@material-ui/core/ListItemSecondaryAction","@material-ui/core/ListItemIcon","@material-ui/core/ListSubheader","@material-ui/core/ListItemText","@material-ui/core/Menu","@material-ui/core/MenuItem","@material-ui/core/MenuList","@material-ui/core/Modal","@material-ui/core/NativeSelect","@material-ui/core/OutlinedInput","@material-ui/core/Pagination","@material-ui/core/PaginationItem","@material-ui/core/Paper","@material-ui/core/Popover","@material-ui/core/Popper","@material-ui/core/Portal","@material-ui/core/Radio","@material-ui/core/RadioGroup","@material-ui/core/Rating","@material-ui/core/ScopedCssBaseline","@material-ui/core/Select","@material-ui/core/Skeleton","@material-ui/core/Slider","@material-ui/core/Snackbar","@material-ui/core/SnackbarContent","@material-ui/core/SpeedDial","@material-ui/core/SpeedDialAction","@material-ui/core/SpeedDialIcon","@material-ui/core/Stack","@material-ui/core/Step","@material-ui/core/StepButton","@material-ui/core/StepConnector","@material-ui/core/StepLabel","@material-ui/core/StepIcon","@material-ui/core/Stepper","@material-ui/core/SvgIcon","@material-ui/core/Switch","@material-ui/core/Tab","@material-ui/core/Table","@material-ui/core/TableBody","@material-ui/core/TableCell","@material-ui/core/TableContainer","@material-ui/core/TableFooter","@material-ui/core/TableHead","@material-ui/core/TablePagination","@material-ui/core/TableRow","@material-ui/core/TableSortLabel","@material-ui/core/Tabs","@material-ui/core/TextField","@material-ui/core/TextareaAutosize","@material-ui/core/ToggleButton","@material-ui/core/ToggleButtonGroup","@material-ui/core/Toolbar","@material-ui/core/Tooltip","@material-ui/core/Typography","@mui/material/Accordion","@mui/material/AccordionActions","@mui/material/AccordionDetails","@mui/material/Alert","@mui/material/AlertTitle","@mui/material/Autocomplete","@mui/material/Avatar","@mui/material/AvatarGroup","@mui/material/Backdrop","@mui/material/Badge","@mui/material/Box","@mui/material/Breadcrumbs","@mui/material/Button","@mui/material/ButtonGroup","@mui/material/Card","@mui/material/CardActions","@mui/material/CardActionArea","@mui/material/CardContent","@mui/material/CardHeader","@mui/material/CardMedia","@mui/material/CircularProgress","@mui/material/Collapse","@mui/material/ClickAwayListener","@mui/material/Chip","@mui/material/Checkbox","@mui/material/Container","@mui/material/Dialog","@mui/material/DialogActions","@mui/material/DialogTitle","@mui/material/DialogContent","@mui/material/DialogContentText","@mui/material/Divider","@mui/material/Drawer","@mui/material/Fab","@mui/material/Fade","@mui/material/FilledInput","@mui/material/FormLabel","@mui/material/FormControl","@mui/material/FormControlLabel","@mui/material/FormHelperText","@mui/material/FormGroup","@mui/material/Grid","@mui/material/Grow","@mui/material/Icon","@mui/material/IconButton","@mui/material/Input","@mui/material/InputBase","@mui/material/InputLabel","@mui/material/InputAdornment","@mui/material/Link","@mui/material/LinearProgress","@mui/material/List","@mui/material/ListItem","@mui/material/ListItemAvatar","@mui/material/ListItemSecondaryAction","@mui/material/ListItemIcon","@mui/material/ListSubheader","@mui/material/ListItemText","@mui/material/Menu","@mui/material/MenuItem","@mui/material/MenuList","@mui/material/Modal","@mui/material/NativeSelect","@mui/material/OutlinedInput","@mui/material/Pagination","@mui/material/PaginationItem","@mui/material/Paper","@mui/material/Popover","@mui/material/Popper","@mui/material/Portal","@mui/material/Radio","@mui/material/RadioGroup","@mui/material/Rating","@mui/material/ScopedCssBaseline","@mui/material/Select","@mui/material/Skeleton","@mui/material/Slider","@mui/material/Snackbar","@mui/material/SnackbarContent","@mui/material/SpeedDial","@mui/material/SpeedDialAction","@mui/material/SpeedDialIcon","@mui/material/Stack","@mui/material/Step","@mui/material/StepButton","@mui/material/StepConnector","@mui/material/StepLabel","@mui/material/StepIcon","@mui/material/Stepper","@mui/material/SvgIcon","@mui/material/Switch","@mui/material/Tab","@mui/material/Table","@mui/material/TableBody","@mui/material/TableCell","@mui/material/TableContainer","@mui/material/TableFooter","@mui/material/TableHead","@mui/material/TablePagination","@mui/material/TableRow","@mui/material/TableSortLabel","@mui/material/Tabs","@mui/material/TextField","@mui/material/TextareaAutosize","@mui/material/ToggleButton","@mui/material/ToggleButtonGroup","@mui/material/Toolbar","@mui/material/Tooltip","@mui/material/Typography","@material-ui/lab/ToggleButton","@material-ui/lab/ToggleButtonGroup","@material-ui/lab/Autocomplete","@material-ui/lab/Alert","@material-ui/lab","@jbrowse/core/Plugin","@jbrowse/core/pluggableElementTypes","@jbrowse/core/pluggableElementTypes/ViewType","@jbrowse/core/pluggableElementTypes/AdapterType","@jbrowse/core/pluggableElementTypes/DisplayType","@jbrowse/core/pluggableElementTypes/TrackType","@jbrowse/core/pluggableElementTypes/WidgetType","@jbrowse/core/pluggableElementTypes/models","@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType","@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType","@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType","@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType","@jbrowse/core/pluggableElementTypes/renderers/RendererType","@jbrowse/core/configuration","@jbrowse/core/util/types/mst","@jbrowse/core/ui","@jbrowse/core/util","@jbrowse/core/util/color","@jbrowse/core/util/layouts","@jbrowse/core/util/tracks","@jbrowse/core/util/Base1DViewModel","@jbrowse/core/util/io","@jbrowse/core/util/mst-reflection","@jbrowse/core/util/rxjs","@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail","@jbrowse/core/data_adapters/BaseAdapter"];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},q.apply(null,arguments)}const _={Accordion:(0,n.lazy)((()=>Promise.all([r.e(3011),r.e(7909)]).then(r.bind(r,7909)))),AccordionActions:(0,n.lazy)((()=>r.e(7309).then(r.bind(r,67309)))),AccordionDetails:(0,n.lazy)((()=>r.e(5101).then(r.bind(r,75101)))),Alert:(0,n.lazy)((()=>r.e(2197).then(r.bind(r,22197)))),AlertTitle:(0,n.lazy)((()=>r.e(7418).then(r.bind(r,27418)))),Autocomplete:(0,n.lazy)((()=>r.e(9329).then(r.bind(r,79329)))),Avatar:(0,n.lazy)((()=>r.e(2872).then(r.bind(r,42872)))),AvatarGroup:(0,n.lazy)((()=>r.e(4902).then(r.bind(r,34902)))),Backdrop:(0,n.lazy)((()=>r.e(1999).then(r.bind(r,11999)))),Badge:(0,n.lazy)((()=>r.e(3940).then(r.bind(r,13940)))),Box:(0,n.lazy)((()=>r.e(8114).then(r.bind(r,48114)))),Breadcrumbs:(0,n.lazy)((()=>r.e(366).then(r.bind(r,40366)))),Button:(0,n.lazy)((()=>r.e(4861).then(r.bind(r,54861)))),ButtonGroup:(0,n.lazy)((()=>r.e(7579).then(r.bind(r,17579)))),Card:(0,n.lazy)((()=>r.e(439).then(r.bind(r,50439)))),CardActions:(0,n.lazy)((()=>r.e(2306).then(r.bind(r,32306)))),CardActionArea:(0,n.lazy)((()=>r.e(8483).then(r.bind(r,38483)))),CardContent:(0,n.lazy)((()=>r.e(596).then(r.bind(r,596)))),CardHeader:(0,n.lazy)((()=>r.e(1598).then(r.bind(r,31598)))),CardMedia:(0,n.lazy)((()=>r.e(2141).then(r.bind(r,12141)))),CircularProgress:(0,n.lazy)((()=>r.e(7203).then(r.bind(r,97203)))),Collapse:(0,n.lazy)((()=>r.e(8678).then(r.bind(r,78678)))),ClickAwayListener:(0,n.lazy)((()=>r.e(2777).then(r.bind(r,42777)))),Chip:(0,n.lazy)((()=>r.e(2583).then(r.bind(r,2583)))),Checkbox:(0,n.lazy)((()=>r.e(7812).then(r.bind(r,7812)))),Container:(0,n.lazy)((()=>r.e(1157).then(r.bind(r,61157)))),Dialog:(0,n.lazy)((()=>r.e(1029).then(r.bind(r,41029)))),DialogActions:(0,n.lazy)((()=>r.e(8052).then(r.bind(r,68052)))),DialogTitle:(0,n.lazy)((()=>r.e(2729).then(r.bind(r,82729)))),DialogContent:(0,n.lazy)((()=>r.e(8582).then(r.bind(r,18582)))),DialogContentText:(0,n.lazy)((()=>r.e(2321).then(r.bind(r,42321)))),Divider:(0,n.lazy)((()=>r.e(4414).then(r.bind(r,64414)))),Drawer:(0,n.lazy)((()=>r.e(5608).then(r.bind(r,15608)))),Fab:(0,n.lazy)((()=>r.e(7974).then(r.bind(r,97974)))),Fade:(0,n.lazy)((()=>r.e(4659).then(r.bind(r,24659)))),FilledInput:(0,n.lazy)((()=>r.e(9943).then(r.bind(r,29943)))),FormLabel:(0,n.lazy)((()=>r.e(6423).then(r.bind(r,86423)))),FormControl:(0,n.lazy)((()=>r.e(2775).then(r.bind(r,25156)))),FormControlLabel:(0,n.lazy)((()=>r.e(2398).then(r.bind(r,22398)))),FormHelperText:(0,n.lazy)((()=>r.e(120).then(r.bind(r,70120)))),FormGroup:(0,n.lazy)((()=>r.e(6342).then(r.bind(r,76342)))),Grid:(0,n.lazy)((()=>r.e(6397).then(r.bind(r,6397)))),Grow:(0,n.lazy)((()=>r.e(1354).then(r.bind(r,91354)))),Icon:(0,n.lazy)((()=>r.e(12).then(r.bind(r,60012)))),IconButton:(0,n.lazy)((()=>r.e(3368).then(r.bind(r,83368)))),Input:(0,n.lazy)((()=>r.e(4395).then(r.bind(r,44395)))),InputBase:(0,n.lazy)((()=>r.e(6526).then(r.bind(r,86526)))),InputLabel:(0,n.lazy)((()=>r.e(6323).then(r.bind(r,66323)))),InputAdornment:(0,n.lazy)((()=>r.e(3003).then(r.bind(r,3003)))),Link:(0,n.lazy)((()=>r.e(4629).then(r.bind(r,94629)))),LinearProgress:(0,n.lazy)((()=>r.e(5763).then(r.bind(r,45763)))),List:(0,n.lazy)((()=>r.e(7773).then(r.bind(r,87773)))),ListItem:(0,n.lazy)((()=>r.e(266).then(r.bind(r,266)))),ListItemAvatar:(0,n.lazy)((()=>r.e(1345).then(r.bind(r,61345)))),ListItemSecondaryAction:(0,n.lazy)((()=>r.e(7374).then(r.bind(r,97374)))),ListItemIcon:(0,n.lazy)((()=>r.e(5327).then(r.bind(r,65327)))),ListSubheader:(0,n.lazy)((()=>r.e(8216).then(r.bind(r,68216)))),ListItemText:(0,n.lazy)((()=>r.e(1757).then(r.bind(r,61757)))),Menu:(0,n.lazy)((()=>r.e(26).then(r.bind(r,70026)))),MenuItem:(0,n.lazy)((()=>r.e(2493).then(r.bind(r,32493)))),MenuList:(0,n.lazy)((()=>r.e(1310).then(r.bind(r,81310)))),Modal:(0,n.lazy)((()=>r.e(8150).then(r.bind(r,98150)))),NativeSelect:(0,n.lazy)((()=>r.e(4947).then(r.bind(r,34947)))),OutlinedInput:(0,n.lazy)((()=>r.e(6149).then(r.bind(r,56149)))),Pagination:(0,n.lazy)((()=>r.e(1516).then(r.bind(r,51516)))),PaginationItem:(0,n.lazy)((()=>r.e(3266).then(r.bind(r,83266)))),Paper:(0,n.lazy)((()=>r.e(3029).then(r.bind(r,93029)))),Popover:(0,n.lazy)((()=>r.e(1978).then(r.bind(r,1978)))),Popper:(0,n.lazy)((()=>r.e(6799).then(r.bind(r,6799)))),Portal:(0,n.lazy)((()=>r.e(7067).then(r.bind(r,37067)))),Radio:(0,n.lazy)((()=>r.e(9384).then(r.bind(r,79384)))),RadioGroup:(0,n.lazy)((()=>r.e(5951).then(r.bind(r,25951)))),Rating:(0,n.lazy)((()=>r.e(2885).then(r.bind(r,92885)))),ScopedCssBaseline:(0,n.lazy)((()=>r.e(4615).then(r.bind(r,54615)))),Select:(0,n.lazy)((()=>r.e(6785).then(r.bind(r,36785)))),Skeleton:(0,n.lazy)((()=>r.e(518).then(r.bind(r,50518)))),Slider:(0,n.lazy)((()=>r.e(1824).then(r.bind(r,91824)))),Snackbar:(0,n.lazy)((()=>Promise.all([r.e(2418),r.e(5090)]).then(r.bind(r,5090)))),SnackbarContent:(0,n.lazy)((()=>r.e(8187).then(r.bind(r,58187)))),SpeedDial:(0,n.lazy)((()=>r.e(9292).then(r.bind(r,99292)))),SpeedDialAction:(0,n.lazy)((()=>r.e(7407).then(r.bind(r,67407)))),SpeedDialIcon:(0,n.lazy)((()=>r.e(9458).then(r.bind(r,9458)))),Stack:(0,n.lazy)((()=>r.e(1260).then(r.bind(r,11260)))),Step:(0,n.lazy)((()=>r.e(7991).then(r.bind(r,47991)))),StepButton:(0,n.lazy)((()=>r.e(2062).then(r.bind(r,12062)))),StepConnector:(0,n.lazy)((()=>r.e(6658).then(r.bind(r,76658)))),StepLabel:(0,n.lazy)((()=>r.e(6703).then(r.bind(r,26703)))),StepIcon:(0,n.lazy)((()=>r.e(2246).then(r.bind(r,32246)))),Stepper:(0,n.lazy)((()=>r.e(6054).then(r.bind(r,36054)))),SvgIcon:(0,n.lazy)((()=>r.e(3728).then(r.bind(r,13728)))),Switch:(0,n.lazy)((()=>r.e(7117).then(r.bind(r,67117)))),Tab:(0,n.lazy)((()=>r.e(8165).then(r.bind(r,28165)))),Table:(0,n.lazy)((()=>r.e(8535).then(r.bind(r,78535)))),TableBody:(0,n.lazy)((()=>r.e(3103).then(r.bind(r,3103)))),TableCell:(0,n.lazy)((()=>r.e(4435).then(r.bind(r,74435)))),TableContainer:(0,n.lazy)((()=>r.e(3274).then(r.bind(r,93274)))),TableFooter:(0,n.lazy)((()=>r.e(9824).then(r.bind(r,39824)))),TableHead:(0,n.lazy)((()=>r.e(9657).then(r.bind(r,79657)))),TablePagination:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(8105)]).then(r.bind(r,74379)))),TableRow:(0,n.lazy)((()=>r.e(561).then(r.bind(r,70561)))),TableSortLabel:(0,n.lazy)((()=>r.e(3862).then(r.bind(r,93862)))),Tabs:(0,n.lazy)((()=>r.e(1110).then(r.bind(r,91110)))),TextField:(0,n.lazy)((()=>r.e(9690).then(r.bind(r,49690)))),TextareaAutosize:(0,n.lazy)((()=>r.e(9037).then(r.bind(r,29037)))),ToggleButton:(0,n.lazy)((()=>r.e(2861).then(r.bind(r,82861)))),ToggleButtonGroup:(0,n.lazy)((()=>r.e(1012).then(r.bind(r,21012)))),Toolbar:(0,n.lazy)((()=>r.e(3012).then(r.bind(r,83012)))),Tooltip:(0,n.lazy)((()=>r.e(1996).then(r.bind(r,1996)))),Typography:(0,n.lazy)((()=>r.e(7584).then(r.bind(r,47584))))},U=Object.fromEntries(Object.entries(_).map((([e,t])=>{const r=n.forwardRef(((e,r)=>n.createElement(n.Suspense,{fallback:null},n.createElement(t,q({},e,{ref:r})))));return r.displayName=e,[e,r]}))),J=Object.fromEntries(Object.entries(U).map((([e,t])=>[`@material-ui/core/${e}`,t]))),X=Object.fromEntries(Object.entries(U).map((([e,t])=>[`@mui/material/${e}`,t]))),Y=(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(5484),r.e(8984),r.e(5511)]).then(r.bind(r,55511)))),K=(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(7865),r.e(8984),r.e(2212)]).then(r.bind(r,12212)))),Q=(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(722),r.e(8984),r.e(1637)]).then(r.bind(r,1637)))),Z={DataGrid:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.DataGrid}))))),GridActionsCellItem:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridActionsCellItem}))))),GridAddIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridAddIcon}))))),GridArrowDownwardIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridArrowDownwardIcon}))))),GridArrowUpwardIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridArrowUpwardIcon}))))),GridCellCheckboxForwardRef:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridCellCheckboxForwardRef}))))),GridCellCheckboxRenderer:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridCellCheckboxRenderer}))))),GridCheckCircleIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridCheckCircleIcon}))))),GridCheckIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridCheckIcon}))))),GridCloseIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridCloseIcon}))))),GridColumnHeaderSeparator:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridColumnHeaderSeparator}))))),GridColumnHeaderSortIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridColumnHeaderSortIcon}))))),GridColumnIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridColumnIcon}))))),GridColumnMenu:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridColumnMenu}))))),GridColumnMenuContainer:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridColumnMenuContainer}))))),GridDragIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridDragIcon}))))),GridExpandMoreIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridExpandMoreIcon}))))),GridFilterAltIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFilterAltIcon}))))),GridFilterForm:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFilterForm}))))),GridFilterListIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFilterListIcon}))))),GridFilterPanel:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFilterPanel}))))),GridFooter:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFooter}))))),GridFooterContainer:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridFooterContainer}))))),GridHeader:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridHeader}))))),GridHeaderCheckbox:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridHeaderCheckbox}))))),GridKeyboardArrowRight:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridKeyboardArrowRight}))))),GridLoadIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridLoadIcon}))))),GridLoadingOverlay:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridLoadingOverlay}))))),GridMenuIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridMenuIcon}))))),GridMoreVertIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridMoreVertIcon}))))),GridNoRowsOverlay:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridNoRowsOverlay}))))),GridOverlay:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridOverlay}))))),GridPagination:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridPagination}))))),GridPanel:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridPanel}))))),GridPanelWrapper:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridPanelWrapper}))))),GridRemoveIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridRemoveIcon}))))),GridRoot:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridRoot}))))),GridRowCount:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridRowCount}))))),GridSaveAltIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridSaveAltIcon}))))),GridSearchIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridSearchIcon}))))),GridSelectedRowCount:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridSelectedRowCount}))))),GridSeparatorIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridSeparatorIcon}))))),GridTableRowsIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridTableRowsIcon}))))),GridToolbar:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbar}))))),GridToolbarColumnsButton:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarColumnsButton}))))),GridToolbarContainer:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarContainer}))))),GridToolbarDensitySelector:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarDensitySelector}))))),GridToolbarExport:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarExport}))))),GridToolbarExportContainer:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarExportContainer}))))),GridToolbarFilterButton:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridToolbarFilterButton}))))),GridTripleDotsVerticalIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridTripleDotsVerticalIcon}))))),GridViewHeadlineIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridViewHeadlineIcon}))))),GridViewStreamIcon:(0,n.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(6157),r.e(5595)]).then(r.bind(r,19387)).then((e=>({default:e.GridViewStreamIcon})))))},ee=Object.fromEntries(Object.entries(Z).map((([e,t])=>{const r=n.forwardRef(((e,r)=>n.createElement(n.Suspense,{fallback:null},n.createElement(t,q({},e,{ref:r})))));return r.displayName=e,[e,r]}))),te=n.forwardRef(((e,t)=>n.createElement(n.Suspense,{fallback:null},n.createElement(Y,q({},e,{ref:t})))));te.displayName="Attributes";const re=n.forwardRef(((e,t)=>n.createElement(n.Suspense,{fallback:null},n.createElement(K,q({},e,{ref:t})))));re.displayName="FeatureDetails";const ne=n.forwardRef(((e,t)=>n.createElement(n.Suspense,{fallback:null},n.createElement(Q,q({},e,{ref:t})))));ne.displayName="BaseCard";const ae={mobx:l,"mobx-state-tree":c,react:n,"react/jsx-runtime":o,"react-dom":s,"mobx-react":d,"@mui/x-data-grid":{useGridApiContext:f.h,useGridApiRef:y.b,useGridRootProps:b.A,...ee},"@mui/material/utils":h,"@material-ui/core/utils":h,"tss-react/mui":{makeStyles:u.n9},"@material-ui/core":{...U,useTheme:m.A,alpha:p.X4,makeStyles:e=>{const t=(0,u.n9)()(e);return()=>t().classes}},"@mui/material":{...U,alpha:p.X4,useTheme:m.A},"@mui/material/styles":{MUIStyles:g,makeStyles:e=>{const t=(0,u.n9)()(e);return()=>t().classes}},"@material-ui/core/styles":{MUIStyles:g,makeStyles:e=>{const t=(0,u.n9)()(e);return()=>t().classes}},...J,...X,"@material-ui/lab/ToggleButton":_.ToggleButton,"@material-ui/lab/ToggleButtonGroup":_.ToggleButtonGroup,"@material-ui/lab/Autocomplete":_.Autocomplete,"@material-ui/lab/Alert":_.Alert,"@material-ui/lab":{Alert:_.Alert,Autocomplete:_.Autocomplete,ToggleButton:_.ToggleButton,ToggleButtonGroup:_.ToggleButtonGroup},"@jbrowse/core/Plugin":L.A,"@jbrowse/core/pluggableElementTypes":C,"@jbrowse/core/pluggableElementTypes/ViewType":S.A,"@jbrowse/core/pluggableElementTypes/AdapterType":k.A,"@jbrowse/core/pluggableElementTypes/DisplayType":T.A,"@jbrowse/core/pluggableElementTypes/TrackType":x.A,"@jbrowse/core/pluggableElementTypes/WidgetType":A.A,"@jbrowse/core/pluggableElementTypes/models":P,"@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType":M,"@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType":E.A,"@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType":R,"@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType":I,"@jbrowse/core/pluggableElementTypes/renderers/RendererType":N,"@jbrowse/core/configuration":F,"@jbrowse/core/util/types/mst":G,"@jbrowse/core/ui":D,"@jbrowse/core/util":B,"@jbrowse/core/util/color":V,"@jbrowse/core/util/layouts":z,"@jbrowse/core/util/tracks":O,"@jbrowse/core/util/Base1DViewModel":v.A,"@jbrowse/core/util/io":H,"@jbrowse/core/util/mst-reflection":j,"@jbrowse/core/util/rxjs":W,"@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail":{Attributes:te,FeatureDetails:re,BaseCard:ne},"@jbrowse/core/data_adapters/BaseAdapter":w},oe=Object.keys(ae),ie=oe.filter((e=>!$.includes(e)));if(ie.length>0)throw new Error(`The following modules are in the modules libs, but not the re-exports list: ${ie.join(", ")}`);const se=$.filter((e=>!oe.includes(e)));if(se.length)throw new Error(`The following modules are in the re-exports list, but not the modules libs: ${se.join(", ")}`);const le=ae},8656:(e,t,r)=>{"use strict";r.d(t,{A:()=>n,S:()=>a});class n{constructor(e){this.label=e.label,this.locString=e.locString,this.renderingComponent=e.renderingComponent,this.displayString=e.displayString,this.matchedAttribute=e.matchedAttribute,this.matchedObject=e.matchedObject,this.textSearchAdapter=e.textSearchAdapter,this.relevance=e.relevance,this.trackId=e.trackId,this.score=e.score||1,this.results=e.results||[]}getLabel(){return this.label}getDisplayString(){return this.displayString||this.label}getRenderingComponent(){return this.renderingComponent}getTrackId(){return this.trackId}getScore(){return this.score}updateScore(e){return this.score=e,this.score}getId(){return`${this.getLabel()}-${this.getLocation()}-${this.getTrackId()}`}hasLocation(){return!!this.locString}getLocation(){return this.locString}getComboResults(){return this.results}}class a extends n{constructor(e){super(e),this.refName=e.refName??""}getLocation(){return this.refName}}},83059:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(43334),a=r(68584);class o{adapterCache=new n.A({maxSize:15});constructor(e){this.pluginManager=e}loadTextSearchAdapters(e){return Promise.all(this.relevantAdapters(e).map((async e=>{const t=(0,a.readConfObject)(e,"textSearchAdapterId"),r=this.adapterCache.get(t);if(r)return r;{const r=this.pluginManager.getTextSearchAdapterType(e.type),n=new(await r.getAdapterClass())(e,void 0,this.pluginManager);return this.adapterCache.set(t,n),n}})))}relevantAdapters(e){const t=this.pluginManager.rootModel,{aggregateTextSearchAdapters:r}=t?.jbrowse,{tracks:n}=t?.session,{assemblyName:a}=e;return[...this.getAdaptersWithAssembly(a,r),...this.getTrackAdaptersWithAssembly(a,n)]}getAdaptersWithAssembly(e,t){return t.filter((t=>(0,a.readConfObject)(t,"assemblyNames")?.includes(e)))}getTrackAdaptersWithAssembly(e,t){return t.filter((t=>(0,a.readConfObject)(t,["textSearching","textSearchAdapter","assemblyNames"])?.includes(e))).map((e=>e.textSearching.textSearchAdapter))}async search(e,t,r){const n=await this.loadTextSearchAdapters(t),a=await Promise.all(n.map((t=>t.searchIndex(e))));return this.sortResults(a.flat(),r)}sortResults(e,t){return t(e.sort(((e,t)=>-t.getLabel().localeCompare(e.getLabel())))).sort(((e,t)=>e.getScore()-t.getScore()))}}},42498:(e,t,r)=>{"use strict";r.d(t,{A:()=>f,S:()=>h});var n=r(36422),a=r(8832),o=r(43283),i=r(99546);const s={stringArray:n.types.array(n.types.string),stringArrayMap:n.types.map(n.types.array(n.types.string)),numberMap:n.types.map(n.types.number),boolean:n.types.boolean,color:n.types.refinement("Color",n.types.string,(function(){return!0})),integer:n.types.integer,number:n.types.number,string:n.types.string,text:n.types.string,fileLocation:a.FileLocation,frozen:n.types.frozen()},l={stringArray:[],stringArrayMap:{},numberMap:{},boolean:!0,color:"black",integer:1,number:1,string:"",text:"",fileLocation:{uri:"/path/to/resource.txt",locationType:"UriLocation"},frozen:{}},c=e=>({views:{get valueJSON(){return e.value}}}),d=e=>({views:{get valueJSON(){return JSON.stringify(e.value)}}}),u={fileLocation:d,number:c,integer:c,boolean:c,frozen:d,stringArray:e=>({views:{get valueJSON(){return JSON.stringify(e.value)}},actions:{add(t){e.value.push(t)},removeAtIndex(t){e.value.splice(t,1)},setAtIndex(t,r){e.value[t]=r}}}),stringArrayMap:e=>({views:{get valueJSON(){return JSON.stringify(e.value)}},actions:{add(t,r){e.value.set(t,r)},remove(t){e.value.delete(t)},addToKey(t,r){const n=e.value.get(t);if(!n)throw new Error(`${t} not found`);n.push(r)},removeAtKeyIndex(t,r){const n=e.value.get(t);if(!n)throw new Error(`${t} not found`);n.splice(r,1)},setAtKeyIndex(t,r,n){const a=e.value.get(t);if(!a)throw new Error(`${t} not found`);a[r]=n}}}),numberMap:e=>({views:{get valueJSON(){return JSON.stringify(e.value)}},actions:{add(t,r){e.value.set(t,r)},remove(t){e.value.delete(t)}}})},p=n.types.refinement("JexlString",n.types.string,(e=>e.startsWith("jexl:")));var m=r(35254);function g(e){return Array.isArray(e)&&0===e.length}function h(e,t,r){const{schemaDefinition:c,options:d}=function(e,t,r={}){if("string"!=typeof e)throw new Error("first arg must be string name of the model that this config schema goes with");let n=t,a=r;return r.baseConfiguration?.jbrowseSchemaDefinition&&(n={...r.baseConfiguration.jbrowseSchemaDefinition,...n},a={...r.baseConfiguration.jbrowseSchemaOptions,...r},a.baseConfiguration=void 0),{schemaDefinition:n,options:a}}(e,t,r),h=function(e,t,r){const c={};let d;if(r.explicitlyTyped&&(c.type=n.types.optional(n.types.literal(e),e)),r.explicitIdentifier&&r.implicitIdentifier)throw new Error(`Cannot have both explicit and implicit identifiers in ${e}`);r.explicitIdentifier?"string"==typeof r.explicitIdentifier?(c[r.explicitIdentifier]=n.types.identifier,d=r.explicitIdentifier):(c.id=n.types.identifier,d="id"):r.implicitIdentifier&&("string"==typeof r.implicitIdentifier?(c[r.implicitIdentifier]=a.ElementId,d=r.implicitIdentifier):(c.id=a.ElementId,d="id"));const h={isJBrowseConfigurationSchema:!0,jbrowseSchema:{modelName:e,definition:t,options:r}};Object.entries(t).forEach((([t,r])=>{if((0,n.isType)(r)&&(0,n.isLateType)(r)||(0,m.oG)(r))c[t]=r;else if("string"==typeof r||"number"==typeof r)h[t]=r;else{if("object"!=typeof r)throw new Error(`invalid configuration schema definition, "${t}" must be either a valid configuration slot definition, a constant, or a nested configuration schema`);if(!r.type)throw new Error(`no type set for config slot ${e}.${t}`);try{c[t]=function(e,{description:t="",model:r,type:a,defaultValue:c,contextVariable:d=[]}){if(!a)throw new Error("type name required");if(r||(r=s[a]),!r)throw new Error(`no builtin config slot type "${a}", and no 'model' param provided`);if(void 0===c)throw new Error("no 'defaultValue' provided");const m=`${e.charAt(0).toUpperCase()}${e.slice(1)}ConfigSlot`;let g=n.types.model(m,{name:n.types.literal(e),description:n.types.literal(t),type:n.types.literal(a),value:n.types.optional(n.types.union(p,r),c)}).volatile((()=>({contextVariable:d}))).views((e=>({get isCallback(){return String(e.value).startsWith("jexl:")}}))).views((e=>({get expr(){if(e.isCallback){const{pluginManager:t}=(0,i.getEnv)(e);return t||"undefined"!=typeof jest||console.warn("no pluginManager detected on config env (if you dynamically instantiate a config, for example in renderProps for your display model, check that you add the env argument)"),(0,o.A)(String(e.value),t?.jexl)}return{evalSync:()=>e.value}},get valueJSON(){var t;if(!e.isCallback)return t=e.value,t?.toJSON?t.toJSON():`"${t}"`}}))).preProcessSnapshot((r=>"object"==typeof r&&r.name===e?r:{name:e,description:t,type:a,value:r})).postProcessSnapshot((e=>"object"==typeof e.value?JSON.stringify(e.value)!==JSON.stringify(c)?e.value:void 0:e.value!==c?e.value:void 0)).actions((e=>({set(t){e.value=t},reset(){e.value=c},convertToCallback(){e.isCallback||(e.value=`jexl:${e.valueJSON||"''"}`)},convertToValue(){if(e.isCallback){try{const t=e.expr.evalSync();if(void 0!==t)return void(e.value=t)}catch(e){}if(e.value=c,!(a in l))throw new Error(`no fallbackDefault defined for type ${a}`);e.value=l[a]}}})));u[a]&&(g=g.extend(u[a]));const h=n.types.optional(g,{name:e,type:a,description:t,value:c});return Object.defineProperty(h,"isJBrowseConfigurationSlot",{value:!0}),h}(t,r)}catch(r){throw new Error(`invalid config slot definition for ${e}.${t}: ${r}`)}}}));let f=n.types.model(`${e}ConfigurationSchema`,c).actions((e=>({setSubschema(t,r){if(!(0,m.oG)(c[t]))throw new Error(`${t} is not a subschema, cannot replace`);const a=(0,n.isStateTreeNode)(r)?r:c[t].create(r);return e[t]=a,a}})));Object.keys(h).length&&(f=f.volatile((()=>h))),r.actions&&(f=f.actions(r.actions)),r.views&&(f=f.views(r.views)),r.extend&&(f=f.extend(r.extend));const y=d?{[d]:"placeholderId"}:{},b=r.explicitlyTyped?{type:e,...y}:y,w=(0,n.getSnapshot)(f.create(b));return f=f.postProcessSnapshot((e=>{const t={};let r=!0;for(const[a,o]of Object.entries(e))r&&("object"==typeof w[a]&&"object"==typeof o?JSON.stringify(w[a])!==JSON.stringify(o)&&(r=!1):w[a]!==o&&(r=!1)),void 0!==o&&void 0===h[a]&&("object"!=typeof(n=o)||Array.isArray(n)||null===n||0!==Object.keys(n).length)&&!g(o)&&(t[a]=o);var n;return r?{}:t})),r.preProcessSnapshot&&(f=f.preProcessSnapshot(r.preProcessSnapshot)),n.types.optional(f,b)}(e,c,d);return h.isJBrowseConfigurationSchema=!0,h.jbrowseSchemaDefinition=c,h.jbrowseSchemaOptions=d,h}function f(e){return n.types.union(n.types.reference(e),e)}},35254:(e,t,r)=>{"use strict";r.d(t,{C$:()=>l,FI:()=>i,JC:()=>s,QZ:()=>o,Rg:()=>u,oG:()=>c,wo:()=>d});var n=r(36422),a=r(23550);function o(e,t,r={}){if(!t)return JSON.parse(JSON.stringify((0,n.getSnapshot)(e)));if("string"==typeof t){let a=e[t];if(!a&&(0,n.isStateTreeNode)(e)&&(0,n.isMapType)((0,n.getType)(e))&&(a=e.get(t)),!a)return;const o=a.expr?a.expr.evalSync(r):a;return(0,n.isStateTreeNode)(o)?JSON.parse(JSON.stringify((0,n.getSnapshot)(o))):o}if(Array.isArray(t)){const a=t[0];if(t.length>1){const i=t.slice(1);let s=e[a];return!s&&(0,n.isStateTreeNode)(e)&&(0,n.isMapType)((0,n.getType)(e))&&(s=e.get(a)),s?o(s,i,r):void 0}return o(e,a,r)}throw new TypeError("slotPath must be a string or array")}function i(e,t,r){const{configuration:n}=e;if(d(n))return o(n,t,r);throw new TypeError("cannot getConf on this model, it has no configuration")}function s(e){if((0,n.isType)(e)&&(e=(0,a.resolveLateType)(e),(0,n.isUnionType)(e))){const t=[];return(0,a.getUnionSubTypes)(e).forEach((e=>{let r=s(e=(0,a.resolveLateType)(e));if(r.length||(r=[(0,a.getDefaultValue)(e).type]),!r[0])throw new Error(`invalid config schema type ${e}`);t.push(...r)})),t}return[]}function l(e){if((0,n.isType)(e)){if((0,n.isModelType)(e)&&("isJBrowseConfigurationSchema"in e||e.name.includes("ConfigurationSchema")))return!0;if((0,n.isLateType)(e))return!0}return!1}function c(e){return!!(0,n.isType)(e)&&(!!l(e)||((0,n.isUnionType)(e)?(0,a.getUnionSubTypes)(e).every((e=>c(e)||"undefined"===e.name)):!(!(0,n.isOptionalType)(e)||!c((0,a.getSubType)(e)))||!(!(0,n.isArrayType)(e)||!c((0,a.getSubType)(e)))||!(!(0,n.isMapType)(e)||!c((0,a.getSubType)(e)))))}function d(e){return(0,n.isStateTreeNode)(e)&&c((0,n.getType)(e))}function u(e){return"object"==typeof e&&null!==e&&"isJBrowseConfigurationSlot"in e}},46377:(e,t,r)=>{"use strict";function n(e){return"getRegions"in e&&"getFeatures"in e}function a(e){return"getRegions"in e}function o(e){return"getFeatures"in e}function i(e){return"getRefNameAliases"in e}function s(e){return"searchIndex"in e}r.r(t),r.d(t,{BaseAdapter:()=>p,BaseFeatureDataAdapter:()=>w,BaseSequenceAdapter:()=>v,isFeatureAdapter:()=>o,isRefNameAliasAdapter:()=>i,isRegionsAdapter:()=>a,isSequenceAdapter:()=>n,isTextSearchAdapter:()=>s});var l=r(36422),c=r(68584),d=r(26257);const u=(0,c.ConfigurationSchema)("empty",{});class p{static capabilities=[];constructor(e=u.create(),t,r){if(this.config=e,this.getSubAdapter=t,this.pluginManager=r,"undefined"==typeof jest){const t=(0,l.isStateTreeNode)(e)?(0,l.getSnapshot)(e):e;this.id=`${(0,d.A)(t)}`}else this.id="test"}getConf(e){return(0,c.readConfObject)(this.config,e)}}var m=r(62718),g=r(44728),h=r(82088),f=r(66885),y=r(99546),b=r(37957);class w extends p{async getHeader(e){return null}async getMetadata(e){return null}getFeaturesInRegion(e,t={}){return(0,f.ObservableCreate)((async r=>{const n=await this.hasDataForRefName(e.refName,t);(0,y.checkAbortSignal)(t.signal),n?this.getFeatures(e,t).subscribe(r):r.complete()}))}getFeaturesInMultipleRegions(e,t={}){return(0,m.h)(...e.map((e=>this.getFeaturesInRegion(e,t))))}async hasDataForRefName(e,t={}){return(await this.getRefNames(t)).includes(e)}async getRegionQuantitativeStats(e,t){const r=this.getFeatures(e,t);return(0,b.qn)(e,r)}async getMultiRegionQuantitativeStats(e=[],t){if(!e.length)return(0,b.Yv)();const r=await Promise.all(e.map((e=>this.getRegionQuantitativeStats(e,t)))),n=(0,y.max)(r.map((e=>e.scoreMax))),a=(0,y.min)(r.map((e=>e.scoreMin))),o=(0,y.sum)(r.map((e=>e.scoreSum))),i=(0,y.sum)(r.map((e=>e.scoreSumSquares))),s=(0,y.sum)(r.map((e=>e.featureCount))),l=(0,y.sum)(r.map((e=>e.basesCovered)));return(0,b.WD)({scoreMin:a,scoreMax:n,featureCount:s,basesCovered:l,scoreSumSquares:i,scoreSum:o})}getRegionFeatureDensityStats(e,t){let r=+Date.now();const n=async(r,n)=>{const{start:o,end:i}=e,s=.75*o+.25*i,l=await(0,g._)(this.getFeatures({...e,start:Math.max(0,Math.round(s-r/2)),end:Math.min(Math.round(s+r/2),i)},t).pipe((0,h.$)()));return a(r,{featureDensity:l.length/r},l.length,n)},a=async(t,a,o,i)=>{const s=e.end-e.start;if(o>=70||2*t>s)return a;if(i<=5e3){const e=+Date.now();return i+=e-r,r=e,n(2*t,i)}return console.warn("Stats estimation reached timeout, or didn't get enough features"),{featureDensity:Number.POSITIVE_INFINITY}};return n(1e3,0)}async getMultiRegionFeatureDensityStats(e,t){if(!e.length)throw new Error("No regions supplied");return this.getRegionFeatureDensityStats(e[0],t)}}class v extends w{async getMultiRegionFeatureDensityStats(){return{featureDensity:0}}}},47369:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.getAdapterClass="AdapterClass"in e?async()=>e.AdapterClass:e.getAdapterClass,this.configSchema=e.configSchema,this.adapterCapabilities=e.adapterCapabilities||[],this.adapterMetadata=e.adapterMetadata}}},32767:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.ReactComponent=e.ReactComponent,this.stateModel=e.stateModel}}},91612:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.stateModel=e.stateModel,this.configSchema=e.configSchema,this.description=e.description,this.url=e.url,this.configEditorComponent=e.configEditorComponent}}},56328:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.stateModel=e.stateModel,this.subDisplay=e.subDisplay,this.configSchema=e.configSchema,this.ReactComponent=e.ReactComponent,this.trackType=e.trackType,this.viewType=e.viewType}}},92070:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.stateModel=e.stateModel,this.configSchema=e.configSchema}}},35470:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{constructor(e){this.name=e.name||"UNKNOWN",this.maybeDisplayName=e.displayName}get displayName(){return this.maybeDisplayName||this.name}}},2406:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});const n=e=>"object"==typeof e&&null!==e,a=e=>n(e)&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Date)&&!(globalThis.Blob&&e instanceof globalThis.Blob);function o(e,t,r=new WeakSet){if(r.has(e))return;r.add(e);const i=e=>{e.forEach((e=>{t(e),n(e)&&o(e,t,r)}))};Array.isArray(e)&&i(e);for(const n of Object.values(e))t(n),a(n)&&(Array.isArray(n)?i(n):o(n,t,r))}var i=r(35470),s=r(91468),l=r(92516),c=r(24388);class d extends i.A{constructor(e){super({}),this.pluginManager=e}async serializeArguments(e,t){const r=(0,s.getBlobMap)();return await this.augmentLocationObjects(e,t),{...e,blobMap:r}}async serializeNewAuthArguments(e,t){const r=this.pluginManager.rootModel;if(!(0,l.bV)(r)||e.internetAccountPreAuthorization)return e;const n=r.findAppropriateInternetAccount(e);return n&&"MainThreadRpcDriver"!==t&&(e.internetAccountPreAuthorization=await n.getPreAuthorizationInformation(e)),e}async deserializeArguments(e,t){e.blobMap&&(0,s.setBlobMap)(e.blobMap);const{signal:r}=e;return{...e,signal:(0,c.bw)(r)?(0,c.SF)(r):void 0}}async serializeReturn(e,t,r){return e}async deserializeReturn(e,t,r){let n;try{n=await e}catch(e){if((0,l.ZL)(e)){const t=this.pluginManager.rootModel?.createEphemeralInternetAccount(`HTTPBasicInternetAccount-${new URL(e.url).origin}`,{},e.url);throw new l.J_("Retrying with created internet account",t.internetAccountId)}throw e}return n}async augmentLocationObjects(e,t){const r=[];o(e,(e=>{(0,l.C1)(e)&&r.push(e)}));for(const e of r)await this.serializeNewAuthArguments(e,t);return e}}},8024:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.description=e.description,this.configSchema=e.configSchema,this.getAdapterClass="getAdapterClass"in e?e.getAdapterClass:async()=>e.AdapterClass}}},58273:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{displayTypes=[];constructor(e){super(e),this.stateModel=e.stateModel,this.configSchema=e.configSchema}addDisplayType(e){this.displayTypes.push(e)}}},63589:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{displayTypes=[];constructor(e){super(e),this.ReactComponent=e.ReactComponent,this.stateModel=e.stateModel,this.extendedName=e.extendedName}addDisplayType(e){this.displayTypes.push(e)}}},67736:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(35470);class a extends n.A{constructor(e){super(e),this.heading=e.heading,this.HeadingComponent=e.HeadingComponent,this.configSchema=e.configSchema,this.stateModel=e.stateModel,this.ReactComponent=e.ReactComponent}}},58921:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AdapterType:()=>u.A,AddTrackWorkflowType:()=>w.A,BaseConnectionModelFactory:()=>d.BaseConnectionModelFactory,BaseDisplay:()=>d.BaseDisplay,BaseInternetAccountConfig:()=>d.BaseInternetAccountConfig,BaseViewModel:()=>d.BaseViewModel,BoxRendererType:()=>n.default,CircularChordRendererType:()=>o.A,ComparativeServerSideRendererType:()=>a.A,ConnectionType:()=>p.A,DisplayType:()=>f.A,FeatureRendererType:()=>s.default,InternetAccount:()=>d.InternetAccount,InternetAccountType:()=>y.A,RendererType:()=>i.default,RpcMethodType:()=>b.A,ServerSideRenderedContent:()=>l.A,ServerSideRendererType:()=>c.default,TextSearchAdapterType:()=>v.A,TrackType:()=>m.A,ViewType:()=>h.A,WidgetType:()=>g.A,baseConnectionConfig:()=>d.baseConnectionConfig,createBaseTrackConfig:()=>d.createBaseTrackConfig,createBaseTrackModel:()=>d.createBaseTrackModel});var n=r(98111),a=r(57027),o=r(94318),i=r(97666),s=r(92880),l=r(25889),c=r(198),d=r(1622),u=r(47369),p=r(91612),m=r(58273),g=r(67736),h=r(63589),f=r(56328),y=r(92070),b=r(2406),w=r(32767),v=r(8024)},7772:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(36422),a=r(8832);const o=n.types.model("BaseView",{id:a.ElementId,displayName:n.types.maybe(n.types.string),minimized:!1}).volatile((()=>({width:800}))).views((()=>({menuItems:()=>[]}))).actions((e=>({setDisplayName(t){e.displayName=t},setWidth(t){e.width=t},setMinimized(t){e.minimized=t}}))),i=o;o.props({displayedRegions:n.types.array(a.Region)})},1622:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BaseConnectionModelFactory:()=>i,BaseDisplay:()=>u,BaseInternetAccountConfig:()=>m,BaseViewModel:()=>s.A,InternetAccount:()=>h,baseConnectionConfig:()=>a,createBaseTrackConfig:()=>w,createBaseTrackModel:()=>b});var n=r(68584);const a=(0,n.ConfigurationSchema)("BaseConnection",{name:{type:"string",defaultValue:"nameOfConnection",description:"a unique name for this connection"},assemblyNames:{type:"stringArray",defaultValue:[],description:"optional list of names of assemblies in this connection"}},{explicitlyTyped:!0,explicitIdentifier:"connectionId"});var o=r(36422);const i=function(e){return o.types.model("Connection",{name:o.types.identifier,tracks:o.types.array(e.pluggableConfigSchemaType("track")),configuration:(0,n.ConfigurationReference)(a)}).actions((()=>({connect(e){}}))).actions((e=>({afterAttach(){0===e.tracks.length&&e.connect(e.configuration)},addTrackConf(t){const r=e.tracks.push(t);return e.tracks[r-1]},addTrackConfs(t){e.tracks.push(...t)},setTrackConfs(t){e.tracks=(0,o.cast)(t)},clear(){}})))};var s=r(7772),l=r(91468),c=r(99546),d=r(8832);const u=o.types.model("BaseDisplay",{id:d.ElementId,type:o.types.string,rpcDriverName:o.types.maybe(o.types.string)}).volatile((()=>({rendererTypeName:"",error:void 0,message:void 0}))).views((e=>({get RenderingComponent(){const{pluginManager:t}=(0,c.getEnv)(e);return t.getDisplayType(e.type).ReactComponent},get DisplayBlurb(){return null},get adapterConfig(){return(0,n.getConf)(this.parentTrack,"adapter")},get parentTrack(){let t=(0,o.getParent)(e);for(;!t.configuration||!(0,n.getConf)(t,"trackId");){if((0,o.isRoot)(t))throw new Error(`No parent track found for ${e.type} ${e.id}`);t=(0,o.getParent)(t)}return t},renderProps:()=>({...(0,l.getParentRenderProps)(e),notReady:(0,c.getContainingView)(e).minimized,rpcDriverName:e.rpcDriverName,displayModel:e}),get rendererType(){const{pluginManager:t}=(0,c.getEnv)(e);return t.getRendererType(e.rendererTypeName)},get DisplayMessageComponent(){},trackMenuItems:()=>[],get viewMenuActions(){return[]},regionCannotBeRendered:()=>null}))).actions((e=>({setMessage(t){e.message=t},setError(t){e.error=t},setRpcDriverName(t){e.rpcDriverName=t},reload(){}})));var p=r(99834);const m=(0,n.ConfigurationSchema)("InternetAccount",{name:{description:"descriptive name of the internet account",type:"string",defaultValue:""},description:{description:"a description of the internet account",type:"string",defaultValue:""},authHeader:{description:"request header for credentials",type:"string",defaultValue:"Authorization"},tokenType:{description:"a custom name for a token to include in the header",type:"string",defaultValue:""},domains:{description:"array of valid domains the url can contain to use this account",type:"stringArray",defaultValue:[]}},{explicitIdentifier:"internetAccountId",explicitlyTyped:!0}),g="undefined"==typeof sessionStorage,h=o.types.model("InternetAccount",{id:d.ElementId,type:o.types.string,configuration:(0,n.ConfigurationReference)(m)}).views((e=>({get name(){return(0,n.getConf)(e,"name")},get description(){return(0,n.getConf)(e,"description")},get internetAccountId(){return(0,n.getConf)(e,"internetAccountId")},get authHeader(){return(0,n.getConf)(e,"authHeader")},get tokenType(){return(0,n.getConf)(e,"tokenType")},get domains(){return(0,n.getConf)(e,"domains")},get toggleContents(){return null},get SelectorComponent(){},get selectorLabel(){}}))).views((e=>({handlesLocation:t=>e.domains.some((e=>t.uri.includes(e))),get tokenKey(){return`${e.internetAccountId}-token`}}))).actions((e=>({getTokenFromUser(e,t){throw new Error("getTokenFromUser must be implemented by extending model")},storeToken(t){sessionStorage.setItem(e.tokenKey,t)},removeToken(){sessionStorage.removeItem(e.tokenKey)},retrieveToken:()=>sessionStorage.getItem(e.tokenKey),validateToken:async(e,t)=>e}))).actions((e=>{let t;return{async getToken(r){if(t)return t;let n=r?.internetAccountPreAuthorization?.authInfo?.token;if(n)return t=Promise.resolve(n),t;if(g)throw new Error("Did not get internet account pre-authorization info in worker");return n=e.retrieveToken(),n?(t=Promise.resolve(n),t):(t=new Promise(((t,r)=>{e.getTokenFromUser((r=>{e.storeToken(r),t(r)}),(t=>{e.removeToken(),r(t)}))})),t)}}})).actions((e=>({addAuthHeaderToInit:(t,r)=>({...t,headers:new Headers({...t?.headers,...r?{[e.authHeader]:e.tokenType?`${e.tokenType} ${r}`:r}:{}})}),async getPreAuthorizationInformation(t){const r=await e.getToken(t);let a;try{a=await e.validateToken(r,t)}catch(t){throw e.removeToken(),t}return{internetAccountType:e.type,authInfo:{token:a,configuration:(0,n.getConf)(e)}}}}))).actions((e=>({getFetcher:t=>async(r,n)=>{const a=await e.getToken(t),o=e.addAuthHeaderToInit(n,a);return fetch(r,o)}}))).actions((e=>({openLocation:t=>new p.RemoteFileWithRangeCache(t.uri,{fetch:e.getFetcher(t)})})));var f=r(42489),y=r(92516);function b(e,t,r){return o.types.model(t,{id:d.ElementId,type:o.types.literal(t),configuration:(0,n.ConfigurationReference)(r),minimized:!1,displays:o.types.array(e.pluggableMstType("display","stateModel"))}).views((t=>({get rpcSessionId(){return t.configuration.trackId},get name(){return(0,n.getConf)(t,"name")},get textSearchAdapter(){return(0,n.getConf)(t,"textSearchAdapter")},get adapterType(){const r=(0,n.getConf)(t,"adapter");if(!r)throw new Error(`no adapter configuration provided for ${t.type}`);const a=e.getAdapterType(r.type);if(!a)throw new Error(`unknown adapter type ${r.type}`);return a},get viewMenuActions(){return t.displays.flatMap((e=>e.viewMenuActions))},get canConfigure(){const e=(0,c.getSession)(t),{sessionTracks:r,adminMode:n}=e;return(0,y.u3)(e)&&(n||r?.find((e=>e.trackId===t.configuration.trackId)))}}))).actions((t=>({setMinimized(e){t.minimized=e},showDisplay(r,n={}){const a=e.pluggableConfigSchemaType("display"),i=(0,o.resolveIdentifier)(a,(0,o.getRoot)(t),r),s=e.getDisplayType(i.type);if(!s)throw new Error(`unknown display type ${i.type}`);const l=s.stateModel.create({...n,type:i.type,configuration:i});t.displays.push(l)},hideDisplay(r){const n=e.pluggableConfigSchemaType("display"),a=(0,o.resolveIdentifier)(n,(0,o.getRoot)(t),r),i=t.displays.filter((e=>e.configuration===a));return(0,f.transaction)((()=>{i.forEach((e=>t.displays.remove(e)))})),i.length},replaceDisplay(r,n,a={}){const i=t.displays.findIndex((e=>e.configuration.displayId===r));if(-1===i)throw new Error(`could not find display id ${r} to replace`);const s=e.pluggableConfigSchemaType("display"),l=(0,o.resolveIdentifier)(s,(0,o.getRoot)(t),n);if(!e.getDisplayType(l.type))throw new Error(`unknown display type ${l.type}`);t.displays.splice(i,1,{...a,type:l.type,configuration:l})}}))).views((t=>({trackMenuItems(){const r=t.displays.flatMap((e=>e.trackMenuItems())),n=t.displays[0].configuration.displayId,a=function(e){const{pluginManager:t}=(0,c.getEnv)(e),r=(0,c.getContainingView)(e),n=t.getViewType(r.type),a=new Set(n.displayTypes.map((e=>e.name)));return e.configuration.displays.filter((e=>a.has(e.type)))}(t);return[...r,...a.length>1?[{type:"subMenu",label:"Display types",priority:-1e3,subMenu:a.map((r=>({type:"radio",label:e.getDisplayType(r.type).displayName,checked:r.displayId===n,onClick:()=>{t.replaceDisplay(n,r.displayId)}})))}]:[]]}})))}function w(e){return(0,n.ConfigurationSchema)("BaseTrack",{name:{description:"descriptive name of the track",type:"string",defaultValue:"Track"},assemblyNames:{description:"name of the assembly (or assemblies) track belongs to",type:"stringArray",defaultValue:["assemblyName"]},description:{description:"a description of the track",type:"string",defaultValue:""},category:{description:"the category and sub-categories of a track",type:"stringArray",defaultValue:[]},metadata:{type:"frozen",description:"anything to add about this track",defaultValue:{}},adapter:e.pluggableConfigSchemaType("adapter"),textSearching:(0,n.ConfigurationSchema)("textSearching",{indexingAttributes:{type:"stringArray",description:"list of which feature attributes to index for text searching",defaultValue:["Name","ID"]},indexingFeatureTypesToExclude:{type:"stringArray",description:"list of feature types to exclude in text search index",defaultValue:["CDS","exon"]},textSearchAdapter:e.pluggableConfigSchemaType("text search adapter")}),displays:o.types.array(e.pluggableConfigSchemaType("display")),formatDetails:(0,n.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 of subfeatures to iterate the formatter on formatDetails.subfeatures (e.g. you may not want to format the exon/cds subfeatures, so limited to 2"},maxDepth:{type:"number",defaultValue:99999,description:"Maximum depth to render subfeatures"}}),formatAbout:(0,n.ConfigurationSchema)("FormatAbout",{config:{type:"frozen",description:"formats configuration object in about dialog",defaultValue:{},contextVariable:["config"]},hideUris:{type:"boolean",defaultValue:!1}})},{preProcessSnapshot:t=>{const r=e.evaluateExtensionPoint("Core-preProcessTrackConfig",JSON.parse(JSON.stringify(t))),{displays:n=[]}=r;if("placeholderId"!==r.trackId){const t=new Set(n.map((e=>e.type)));e.getTrackType(r.type).displayTypes.forEach((e=>{t.has(e.name)||n.push({displayId:`${r.trackId}-${e.name}`,type:e.name})}))}return{...r,displays:n}},explicitIdentifier:"trackId",explicitlyTyped:!0,actions:e=>({addDisplayConf(t){const{type:r}=t;if(!r)throw new Error(`unknown display type ${r}`);const n=e.displays.find((e=>e?.displayId===t.displayId));if(n)return n;const a=e.displays.push(t);return e.displays[a-1]}})})}},98111:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LayoutSession:()=>u,default:()=>p});var n=r(41365),a=r.n(n),o=r(85012),i=r(2265),s=r(75762),l=r(92880),c=r(99546),d=r(68584);class u{constructor(e){this.config=e.config,this.bpPerPx=e.bpPerPx,this.filters=e.filters,this.update(e)}update(e){Object.assign(this,e)}makeLayout(){return new i.A(o.A,{maxHeight:(0,d.readConfObject)(this.config,"maxHeight"),displayMode:(0,d.readConfObject)(this.config,"displayMode"),pitchX:this.bpPerPx,pitchY:(0,d.readConfObject)(this.config,"noSpacing")?1:3})}cachedLayoutIsValid(e){return e.layout.subLayoutConstructorArgs.pitchX===this.bpPerPx&&a()((0,d.readConfObject)(this.config),e.config)&&a()(this.filters,e.filters)}get layout(){return this.cachedLayout&&this.cachedLayoutIsValid(this.cachedLayout)||(this.cachedLayout={layout:this.makeLayout(),config:(0,d.readConfObject)(this.config),filters:this.filters}),this.cachedLayout.layout}}class p extends l.default{sessions={};getWorkerSession(e){const t=(0,c.getLayoutId)(e);this.sessions[t]||(this.sessions[t]=this.createSession(e));const r=this.sessions[t];return r.update(e),r}getExpandedRegion(e,t){const{bpPerPx:r,config:n}=t,a=(0,d.readConfObject)(n,"maxFeatureGlyphExpansion")||0,o=Math.round(a*r);return{...e,start:Math.floor(Math.max(e.start-o,0)),end:Math.ceil(e.end+o)}}createSession(e){return new u(e)}async freeResourcesInClient(e,t){const{regions:r}=t,n=(0,c.getLayoutId)(t),a=this.sessions[n];if(a){const e=r[0];a.layout.discardRange(e.refName,e.start,e.end)}return await super.freeResourcesInClient(e,t)}deserializeLayoutInClient(e){return new s.A(e)}deserializeResultsInClient(e,t){const r=this.deserializeLayoutInClient(e.layout);return super.deserializeResultsInClient({...e,layout:r},t)}createLayoutInWorker(e){const{regions:t}=e;return this.getWorkerSession(e).layout.getSublayout(t[0].refName)}serializeResultsInWorker(e,t){const r=super.serializeResultsInWorker(e,t),n=t.regions[0];return r.layout=e.layout.serializeRegion(this.getExpandedRegion(n,t)),r.features=r.features.filter((e=>Boolean(r.layout.rectangles[e.uniqueId]))),r.maxHeightReached=r.layout.maxHeightReached,r}async render(e){const t=e.layout||this.createLayoutInWorker(e);return{...await super.render({...e,layout:t}),layout:t}}}},94318:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var n=r(7552),a=r(99546),o=r(92880),i=r(68446),s=r(20139),l=r(49823),c=r(36422),d=r(28485);const u=(0,i.observer)((function(e){const{html:t,theme:r,RenderingComponent:o,...i}=e,d=(0,n.useRef)(null),u=(0,n.useRef)(),p=(0,c.getRoot)(e.displayModel).hydrateFn;return(0,n.useEffect)((()=>{const e=(0,a.rIC)((()=>{if(!d.current)return;const e=(0,l.createJBrowseTheme)(r);u.current=u.current??p(d.current,n.createElement(s.A,{theme:e},n.createElement(o,i)))}));return()=>{void 0!==e&&clearTimeout(e);const t=u.current;u.current=void 0,setTimeout((()=>{t?.unmount()}))}}),[o,p,r,i]),n.createElement("g",{ref:d,dangerouslySetInnerHTML:{__html:t}})})),p=(0,i.observer)((function(e){const{html:t,RenderingComponent:r}=e,o=(0,n.useRef)(null);return(0,n.useEffect)((()=>{const i=o.current;return i&&t&&(i.innerHTML&&(0,d.unmountComponentAtNode)(i),i.style.outline="none",i.innerHTML=t,(0,a.rIC)((()=>{(0,d.hydrate)(n.createElement(r,e),i)}))),()=>{i&&(0,d.unmountComponentAtNode)(i)}}),[t,r,e]),n.createElement("g",{ref:o})})),m=(0,i.observer)((function(e){return(0,c.getRoot)(e.displayModel).hydrateFn?n.createElement(u,e):n.createElement(p,e)}));function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(null,arguments)}class h extends o.default{supportsSVG=!0;deserializeResultsInClient(e,t){const r=new Map(e.features.map((e=>a.SimpleFeature.fromJSON(e))).map((e=>[e.id(),e])));return t.exportSVG?{...e,features:r,blockKey:"circularChord",html:this.supportsSVG?e.html:'<text y="12" fill="black">SVG export not supported for this track</text>'}:{...e,features:r,blockKey:"circularChord",reactElement:n.createElement(m,g({},t,e,{features:r,RenderingComponent:this.ReactComponent}))}}}},57027:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(27570),a=r(82088),o=r(198),i=r(3496),s=r(99546),l=r(44728);class c extends o.default{async renameRegionsIfNeeded(e){return e}serializeArgsInClient(e){const t={...e,displayModel:void 0};return super.serializeArgsInClient(t)}deserializeResultsInClient(e,t){return{...super.deserializeResultsInClient(e,t),blockKey:t.blockKey}}async renderInClient(e,t){const r=await e.call(t.sessionId,"ComparativeRender",t);return"canvasRecordedData"in r&&(r.html=await(0,s.getSerializedSvg)(r),r.reactElement=void 0),r}featurePassesFilters(e,t){return!e.filters||e.filters.passes(t,e)}async getFeatures(e){const t=this.pluginManager,{regions:r,sessionId:o,adapterConfig:c}=e,{dataAdapter:d}=await(0,i.cK)(t,o,c),u=r.map((e=>{const t={...e};return t.start&&(t.start=Math.floor(t.start)),t.end&&(t.end=Math.floor(t.end)),t})),p=await(0,l._)(d.getFeaturesInMultipleRegions(u,e).pipe((0,n.p)((t=>this.featurePassesFilters(e,t))),(0,a.$)()));return(0,s.dedupe)(p,(e=>e.id()))}}},92880:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>p});var n=r(82088),a=r(33039),o=r.n(a),i=r(44728),s=r(99546),l=r(6434),c=r(3496),d=r(198),u=r(46377);class p extends d.default{serializeArgsInClient(e){const{regions:t}=e,r={...e,displayModel:void 0,regions:o()(t)};return super.serializeArgsInClient(r)}deserializeResultsInClient(e,t){const r=new Map(e.features.map((e=>l.A.fromJSON(e))).map((e=>[e.id(),e])));return{...super.deserializeResultsInClient({...e,features:r},t),blockKey:t.blockKey,features:r}}serializeResultsInWorker(e,t){const r=super.serializeResultsInWorker(e,t),{features:n}=e;return{...r,features:(0,s.iterMap)(n.values(),(e=>e.toJSON()),n.size)}}getExpandedRegion(e,t){return e}async getFeatures(e){const t=this.pluginManager,{signal:r,regions:a,sessionId:o,adapterConfig:l}=e,{dataAdapter:d}=await(0,c.cK)(t,o,l);if(!(0,u.isFeatureAdapter)(d))throw new Error("Adapter does not support retrieving features");const p=a.map((e=>{const t={...e};return t.start&&(t.start=Math.floor(t.start)),t.end&&(t.end=Math.ceil(t.end)),t})),m=p[0],g=1===p.length?d.getFeatures(this.getExpandedRegion(m,e),e):d.getFeaturesInMultipleRegions(p,e),h=await(0,i._)(g.pipe((0,n.$)()));return(0,s.checkAbortSignal)(r),new Map(h.filter((t=>this.featurePassesFilters(e,t))).map((e=>[e.id(),e])))}featurePassesFilters(e,t){return!e.filters||e.filters.passes(t,e)}async render(e){const t=e.features||await this.getFeatures(e);return{...await super.render({...e,features:t}),features:t}}}},97666:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o});var n=r(7552),a=r(35470);class o extends a.A{supportsSVG=!0;constructor(e){super(e),this.ReactComponent=e.ReactComponent,this.configSchema=e.configSchema,this.pluginManager=e.pluginManager}async render(e){return{reactElement:n.createElement(this.ReactComponent,e,null)}}freeResources(){return 0}}},25889:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(7552),a=r(20139),o=r(49823),i=r(68446),s=r(36422),l=r(28485),c=r(99546);const d=(0,i.observer)((function({theme:e,html:t,RenderingComponent:r,...i}){const l=(0,n.useRef)(null),d=(0,n.useRef)(),{hydrateFn:u}=(0,s.getRoot)(i.displayModel);return(0,n.useEffect)((()=>{const t=(0,c.rIC)((()=>{if(!l.current)return;const t=(0,o.createJBrowseTheme)(e);d.current=d.current??u(l.current,n.createElement(a.A,{theme:t},n.createElement(r,i)))}));return()=>{void 0!==t&&clearTimeout(t);const e=d.current;d.current=void 0,setTimeout((()=>{e?.unmount()}))}}),[e,i,u,r]),n.createElement("div",{"data-testid":"hydrationContainer",ref:l,dangerouslySetInnerHTML:{__html:t}})})),u=(0,i.observer)((function({theme:e,html:t,RenderingComponent:r,...i}){const s=(0,n.useRef)(null),d=(0,o.createJBrowseTheme)(e);return(0,n.useEffect)((()=>{const e=s.current;return e&&((0,l.unmountComponentAtNode)(e),e.innerHTML=t,(0,c.rIC)((()=>{(0,l.hydrate)(n.createElement(a.A,{theme:d},n.createElement(r,i)),e)}))),()=>{e&&(0,l.unmountComponentAtNode)(e)}}),[t,d,i,r]),n.createElement("div",{ref:s})})),p=(0,i.observer)((function(e){return(0,s.getRoot)(e.displayModel).hydrateFn?n.createElement(d,e):n.createElement(u,e)}))},198:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m});var n=r(7552),a=r(20139),o=r(48180),i=r(36422),s=r(99546),l=r(93100),c=r(49823),d=r(97666),u=r(25889);function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.apply(null,arguments)}class m extends d.default{serializeArgsInClient(e){return{...e,config:(0,i.isStateTreeNode)(e.config)?(0,i.getSnapshot)(e.config):e.config,filters:e.filters?.toJSON().filters}}deserializeResultsInClient(e,t){return t.exportSVG?{...e,html:this.supportsSVG?e.html:'<text y="12" fill="black">SVG export not supported for this track</text>'}:{...e,reactElement:n.createElement(u.A,p({},t,e,{RenderingComponent:this.ReactComponent}))}}deserializeArgsInWorker(e){const t={...e};return t.config=this.configSchema.create(e.config||{},{pluginManager:this.pluginManager}),t.filters=e.filters?new l.A({filters:e.filters}):void 0,t}serializeResultsInWorker(e,t){const r=(0,o.F0)(n.createElement(a.A,{theme:(0,c.createJBrowseTheme)(t.theme)},e.reactElement));return e.reactElement=void 0,{...e,html:r}}async renderInClient(e,t){const r=await e.call(t.sessionId,"CoreRender",t);return"canvasRecordedData"in r&&(r.html=await(0,s.getSerializedSvg)(r),r.reactElement=void 0),r}async renderInWorker(e){const{signal:t,statusCallback:r=()=>{}}=e,n=this.deserializeArgsInWorker(e),a=await(0,s.updateStatus)("Rendering plot",r,(()=>this.render(n)));return(0,s.checkAbortSignal)(t),(0,s.updateStatus)("Serializing results",r,(()=>this.serializeResultsInWorker(a,n)))}async freeResourcesInClient(e,t){const r=this.serializeArgsInClient(t);return this.freeResources()+await e.call(t.sessionId,"CoreFreeResources",r)}}},93100:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(43283);class a{constructor({filters:e=[]}){this.filterChain=e.map((e=>e.trim())).filter((e=>!!e)).map((e=>{if("string"==typeof e)return{expr:(0,n.A)(e),string:e};throw new Error(`invalid inputFilter string "${e}"`)}))}passes(...e){for(const t of this.filterChain)if(!t.expr.evalSync({feature:e[0]}))return!1;return!0}toJSON(){return{filters:this.filterChain.map((e=>e.string))}}static fromJSON(e){return new a(e)}}},9236:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var n=r(7552),a=r(75785),o=r(72639),i=r(48231),s=r(26993),l=r(77089);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c.apply(null,arguments)}const d=(0,a.n9)()((e=>({tooltip:{position:"absolute",pointerEvents:"none",backgroundColor:(0,o.X4)(e.palette.grey[700],.9),borderRadius:e.shape.borderRadius,color:e.palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(12),lineHeight:Math.round(14e4)/1e5+"em",maxWidth:300,wordWrap:"break-word"}})));function u({clientPoint:e,children:t,placement:r="right"}){const a=(0,i.A)(),o=a.components?.MuiPopper,{classes:u}=d(),{refs:p,floatingStyles:m,context:g}=(0,l.we)({placement:r,strategy:"fixed"}),h=(0,l.ju)(g,e),{getFloatingProps:f}=(0,l.bv)([h]);return n.createElement(s.A,{container:o?.defaultProps?.container},n.createElement("div",c({className:u.tooltip,ref:p.setFloating,style:{...m,zIndex:1e5,visibility:"translate(0px, 0px)"===m.transform?"hidden":void 0,pointerEvents:"none"}},f()),t))}},23758:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(7552),a=r(85206),o=r(61723),i=r(68446),s=r(45266);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(null,arguments)}const c=(0,i.observer)((function({children:e,menuItems:t,closeAfterItemClick:r=!0,stopPropagation:i,setOpen:c,onClick:d,...u}){const p=(0,s.T6)({popupId:"viewMenu",variant:"popover"}),{onClick:m,onTouchStart:g,...h}=(0,s.cO)(p),{isOpen:f}=p;return(0,n.useEffect)((()=>{c?.(f)}),[f,c]),n.createElement(n.Fragment,null,n.createElement(o.A,l({onClick:e=>{i&&e.stopPropagation(),m(e),d?.()},onTouchStart:e=>{i&&e.stopPropagation(),g(e),d?.()}},h,u,{disabled:0===t.length}),e),n.createElement(a.A,l({},(0,s.dB)(p),{onMenuItemClick:(e,t)=>{t()},menuItems:t,closeAfterItemClick:r,popupState:p})))}))},56174:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(7552),a=r(5401),o=r(40985),i=r(43163),s=r(29499),l=r(58507),c=r(69941),d=r(38033);const u=({onFactoryReset:e,resetButtonText:t})=>{const[r,o]=(0,n.useState)(!1);return n.createElement(n.Fragment,null,n.createElement(a.A,{"data-testid":"fatal-error",color:"primary",variant:"contained",onClick:()=>{o(!0)}},t),n.createElement(c.default,{onClose:()=>{o(!1)},open:r,onFactoryReset:e}))};function p({componentStack:e,error:t="No error message provided",onFactoryReset:r,resetButtonText:c="Factory Reset"}){return n.createElement(o.A,{maxWidth:"xl",open:!0},n.createElement(i.A,null,"Fatal error"),n.createElement(s.A,null,n.createElement(d.A,{error:t}),n.createElement("pre",null,e)),n.createElement(l.A,null,n.createElement(a.A,{color:"secondary",variant:"contained",onClick:()=>{window.location.reload()}},"Refresh"),n.createElement(u,{onFactoryReset:r,resetButtonText:c})))}},43550:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(7552),a=r(17776),o=r(48171),i=r(5401),s=r(36715),l=r(75785),c=r(99546),d=r(91468);function u(e){return"blobId"in e}const p=(0,l.n9)()((e=>({filename:{marginLeft:e.spacing(1)}}))),m=function({location:e,setLocation:t}){const{classes:r}=p(),l=e&&(u(e)&&e.name||"localPath"in e&&e.localPath),m=e&&u(e)&&!(0,d.getBlob)(e.blobId);return n.createElement(a.A,{display:"flex",flexDirection:"row",alignItems:"center"},n.createElement(a.A,null,n.createElement(o.A,{fullWidth:!0},n.createElement(i.A,{variant:"outlined",component:"label"},"Choose File",n.createElement("input",{type:"file",hidden:!0,onChange:({target:e})=>{const r=e.files?.[0];if(r)if(c.isElectron){const{webUtils:e}=window.require("electron");t({localPath:e.getPathForFile(r),locationType:"LocalPathLocation"})}else t((0,d.storeBlobLocation)({blob:r}))}})))),n.createElement(a.A,null,n.createElement(s.A,{component:"span",className:r.filename,color:l?"initial":"textSecondary"},l||"No file chosen"),m?n.createElement(s.A,{color:"error"},"(need to reload)"):null))}},14862:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(7552),a=r(1343),o=r(68446),i=r(92516);const s=(0,o.observer)((function({location:e,setLocation:t,label:r}){return n.createElement(a.A,{fullWidth:!0,variant:"outlined",inputProps:{"data-testid":"urlInput"},defaultValue:e&&(0,i.C1)(e)?e.uri:"",label:r||"Enter URL",onChange:e=>{t({uri:e.target.value.trim(),locationType:"UriLocation"})}})}))},37565:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(7552),a=r(36715),o=r(75785),i=r(73329);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(null,arguments)}const l=(0,o.n9)()({dots:{"&::after":{display:"inline-block",content:'""',width:"1em",textAlign:"left",animation:`${i.i7`
2 0% {
3 content: '';
4 }
5 25% {
6 content: '.';
7 }
8 50% {
9 content: '..';
10 }
11 75% {
12 content: '...';
13 }
14 `} 1.2s infinite ease-in-out`}}});function c({message:e,variant:t="body2",...r}){const{classes:o}=l();return n.createElement(a.A,s({className:o.dots},r,{variant:t}),e||"Loading")}},21311:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(7552);const a=(0,r(75785).n9)()((e=>({bg:{padding:4,margin:4,overflow:"auto",maxHeight:200,background:"dark"===e.palette.mode?"#833":"#f88",border:`1px solid ${e.palette.divider}`}})));function o({children:e}){const{classes:t}=a();return n.createElement("div",{className:t.bg},e)}},40898:(e,t,r)=>{"use strict";r.r(t),r.d(t,{category10:()=>n,dark2:()=>a,ggplot2Colors3:()=>u,ggplot2Colors4:()=>d,ggplot2Colors5:()=>c,ggplot2Colors6:()=>l,set1:()=>o,set2:()=>i,tableau10:()=>s});const n=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],a=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],o=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],i=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],s=["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],l=["#F8766D","#B79F00","#00BA38","#00BFC4","#619CFF","#F564E3"],c=["#F8766D","#A3A500","#00BF7D","#00B0F6","#E76BF3"],d=["#F8766D","#7CAE00","#00BFC4","#C77CFF"],u=["#F8766D","#00BA38","#619CFF"]},95095:(e,t,r)=>{"use strict";function n(e,t,r){if(!t||!r)return;const{width:n,interRegionPaddingWidth:a,displayedRegions:o,bpPerPx:i,minimumBlockWidth:s}=e,l=function(e,t,r){let n=0;const{displayedRegions:a}=e;if(t.index===r.index)n+=r.offset-t.offset;else{const e=a[t.index];if(n+=e.end-e.start-t.offset,r.index-t.index>=2)for(let e=t.index+1;e<r.index;e++){const t=a[e];n+=t.end-t.start}n+=r.offset}return n}(e,t,r);let c=0;for(let e=t.index;e<r.index;e++){const t=o[e];(t.end-t.start)/i>s&&c++}const d=l/(n-a*c),u=e.zoomTo(d);let p=0;d<u&&(p=(u-d)*e.width/2);let m=-p;for(let r=0;r<e.displayedRegions.length;r+=1){const n=e.displayedRegions[r];if(t.index===r){m+=t.offset;break}m+=n.end-n.start}e.scrollTo(Math.round(m/e.bpPerPx))}function a(e,t){return Math.floor(e.reversed?e.end-t:e.start+t)+1}function o(e,t){let r=0;const{bpPerPx:n,offsetPx:o,displayedRegions:i,interRegionPaddingWidth:s,staticBlocks:l}=e,c=l.contentBlocks,d=(o+t)*n;if(d<0){const e=i[0];return{...e,oob:!0,coord:a(e,d),offset:d,index:0}}const u=s*n;let p=0;for(let e=0;e<i.length;e++){const t=i[e],n=t.end-t.start,o=d-r;if(n+r>d&&r<=d)return{...t,oob:!1,offset:o,coord:a(t,o),index:e};c[p]?.regionNumber===e?(r+=n+u,p++):r+=n}if(d>=r&&i.length>0){const e=i.at(-1),t=d-r+(e.end-e.start);return{...e,oob:!0,offset:t,coord:a(e,t),index:i.length-1}}return{coord:0,index:0,refName:"",oob:!0,assemblyName:"",offset:0,start:0,end:0,reversed:!1}}function i({refName:e,coord:t,regionNumber:r,self:n}){let a=0;const{interRegionPaddingWidth:o,bpPerPx:i,displayedRegions:s,staticBlocks:l}=n,c=l.contentBlocks,d=o*i;let u=0,p=0;for(;p<s.length;p++){const n=s[p],o=n.end-n.start;if(e===n.refName&&t>=n.start&&t<=n.end&&(!r||r===p)){a+=n.reversed?n.end-t:t-n.start;break}c[u]?.regionNumber===p?(a+=o+d,u++):a+=o}if(s[p])return{index:p,offsetPx:Math.round(a/i)}}r.d(t,{Ii:()=>o,eB:()=>i,tw:()=>n})},97884:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(36422),a=r(99546),o=r(8832),i=r(93707),s=r(88530),l=r(95095);const c=n.types.model("Base1DView",{id:o.ElementId,displayedRegions:n.types.optional(n.types.frozen(),[]),bpPerPx:0,offsetPx:0,interRegionPaddingWidth:n.types.optional(n.types.number,0),minimumBlockWidth:n.types.optional(n.types.number,0)}).volatile((()=>({features:void 0,volatileWidth:0}))).actions((e=>({setDisplayedRegions(t){e.displayedRegions=(0,n.cast)(t)},setBpPerPx(t){e.bpPerPx=t},setVolatileWidth(t){e.volatileWidth=t}}))).views((e=>({get width(){return e.volatileWidth},get assemblyNames(){return[...new Set(e.displayedRegions.map((e=>e.assemblyName)))]},get displayedRegionsTotalPx(){return this.totalBp/e.bpPerPx},get maxOffset(){return this.displayedRegionsTotalPx-10},get minOffset(){return 30-this.width},get totalBp(){return(0,a.sum)(e.displayedRegions.map((e=>e.end-e.start)))}}))).views((e=>({get dynamicBlocks(){return(0,i.A)(e)},get staticBlocks(){return(0,s.A)(e)},get currBp(){return(0,a.sum)(this.dynamicBlocks.map((e=>e.end-e.start)))}}))).views((e=>({pxToBp:t=>(0,l.Ii)(e,t),bpToPx:({refName:t,coord:r,regionNumber:n})=>(0,l.eB)({refName:t,coord:r,regionNumber:n,self:e})?.offsetPx}))).actions((e=>({setFeatures(t){e.features=t},showAllRegions(){e.bpPerPx=e.totalBp/e.width,e.offsetPx=0},zoomOut(){this.zoomTo(2*e.bpPerPx)},zoomIn(){this.zoomTo(e.bpPerPx/2)},zoomTo(t,r=e.width/2){const n=(0,a.clamp)(t,"minBpPerPx"in e?e.minBpPerPx:0,"maxBpPerPx"in e?e.maxBpPerPx:Number.POSITIVE_INFINITY),o=e.bpPerPx;return Math.abs(o-n)<1e-6?o:(e.bpPerPx=n,e.offsetPx=(0,a.clamp)(Math.round((e.offsetPx+r)*o/n-r),e.minOffset,e.maxOffset),e.bpPerPx)},scrollTo(t){const r=(0,a.clamp)(t,e.minOffset,e.maxOffset);return e.offsetPx=r,r},centerAt(t,r,n){if(!r)return;const a=e.bpToPx({refName:r,coord:t,regionNumber:n});a&&this.scrollTo(Math.round(a-e.width/2))},scroll(t){const r=e.offsetPx,n=(0,a.clamp)(e.offsetPx+t,e.minOffset,e.maxOffset);return e.offsetPx=n,n-r}}))).actions((e=>({moveTo(t,r){(0,l.tw)(e,t,r)}})))},20166:(e,t,r)=>{"use strict";r.d(t,{Kp:()=>d,R1:()=>c,Yo:()=>s,pB:()=>i,zm:()=>l});var n=r(89592),a=r(3862);class o extends Error{}function i(e){if(e){if(!(e instanceof AbortSignal))throw new TypeError("must pass an AbortSignal");if(e.aborted)throw l()}}async function s(e){await new Promise((e=>setTimeout(e,1))),i(e)}function l(){if("undefined"!=typeof DOMException)return new DOMException("aborted","AbortError");const e=new o("aborted");return e.code="ERR_ABORTED",e}function c(e){return e?(0,a.R)(e,"abort"):new n.c}function d(e){return e instanceof Error&&("AbortError"===e.name||"ERR_ABORTED"===e.code||!!/\b(aborted|aborterror)\b/i.test(e.message))}},31673:(e,t,r)=>{"use strict";function n(e){const t=new FileReader;return new Promise(((r,n)=>{t.onload=e=>{e.target?r(e.target.result):n(new Error("unknown result reading blob from canvas"))},t.readAsDataURL(e)}))}r.d(t,{y:()=>n})},76530:(e,t,r)=>{"use strict";r.d(t,{$G:()=>i,Db:()=>s,fK:()=>l,mh:()=>a});var n=r(99546);class a{constructor(e=[]){this.blocks=e}push(e){if("ElidedBlock"===e.type&&this.blocks.length>0){const t=this.blocks.at(-1);if("ElidedBlock"===t?.type)return void t.push(e)}this.blocks.push(e)}getBlocks(){return this.blocks}getRegions(){return this.blocks.map((e=>e.toRegion()))}map(e,t){return this.blocks.map(e,t)}forEach(e,t){this.blocks.forEach(e,t)}get length(){return this.blocks.length}get totalWidthPx(){return this.blocks.length>0?(0,n.sum)(this.blocks.map((e=>e.widthPx))):0}get totalWidthPxWithoutBorders(){return this.blocks.length>0?(0,n.sum)(this.blocks.filter((e=>"boundary"!==e.variant)).map((e=>e.widthPx))):0}get offsetPx(){return this.blocks.length>0?this.blocks[0].offsetPx:0}get contentBlocks(){return this.blocks.filter((e=>"ContentBlock"===e.type))}get totalBp(){return(0,n.sum)(this.contentBlocks.map((e=>e.end-e.start)))}}class o{type="BaseBlock";widthPx=0;constructor(e){Object.assign(this,e),this.assemblyName=e.assemblyName,this.refName=e.refName,this.start=e.start,this.end=e.end,this.key=e.key,this.offsetPx=e.offsetPx}toRegion(){return{refName:this.refName,start:this.start,end:this.end,assemblyName:this.assemblyName,reversed:this.reversed}}}class i extends o{type="ContentBlock"}class s extends o{type="ElidedBlock";elidedBlockCount=0;constructor(e){super(e),this.widthPx=e.widthPx}push(e){this.elidedBlockCount+=1,this.refName="",this.start=0,this.end=0,this.widthPx+=e.widthPx}}class l extends o{type="InterRegionPaddingBlock"}},93707:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(36422),a=r(32595),o=r(99546),i=r(76530);function s(e,t=!0,r=!0){const{offsetPx:s,displayedRegions:l,bpPerPx:c,width:d,minimumBlockWidth:u,interRegionPaddingWidth:p}=e;if(!d)throw new Error("view has no width, cannot calculate displayed blocks");const m=new i.mh;let g=0;const h=s,f=h+d;for(let e=0;e<l.length;e++){const y=l[e],{assemblyName:b,refName:w,start:v,end:C,reversed:S}=y,k=g+(C-v)/c,T=(C-v)/c,x=(0,n.isStateTreeNode)(y)?(0,n.getSnapshot)(y):y,[A,P]=(0,a.ky)(h,f,g,k);if(void 0!==A&&void 0!==P){let n,a,h,f,y;S?(n=Math.max(v,C-(P-g)*c),a=C-(A-g)*c,h=a===C,f=n===v,y=g+(C-a)/c):(n=(A-g)*c+v,a=Math.min(C,(P-g)*c+v),h=n===v,f=a===C,y=g+(n-v)/c);const k={assemblyName:b,refName:w,start:n,end:a,reversed:S,offsetPx:y,parentRegion:x,regionNumber:e,widthPx:(a-n)/c,isLeftEndOfDisplayedRegion:h,isRightEndOfDisplayedRegion:f,key:""};k.key=`${(0,o.assembleLocStringFast)(k)}-${e}${S?"-reversed":""}`,t&&0===m.length&&h&&m.push(new i.fK({key:`${k.key}-beforeFirstRegion`,widthPx:-s,offsetPx:k.offsetPx+s,variant:"boundary"})),r&&T<u?m.push(new i.Db(k)):m.push(new i.$G(k)),t&&(T>=u&&k.isRightEndOfDisplayedRegion&&e<l.length-1&&(m.push(new i.fK({key:`${k.key}-rightpad`,widthPx:p,offsetPx:k.offsetPx+k.widthPx})),g+=p),e===l.length-1&&k.isRightEndOfDisplayedRegion&&(y=k.offsetPx+k.widthPx,m.push(new i.fK({key:`${k.key}-afterLastRegion`,widthPx:d-y+s,offsetPx:y,variant:"boundary"}))))}g+=(C-v)/c}return m}},88530:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(36422),a=r(99546),o=r(76530);function i(e,t=!0,r=!0,i=0,s=800){const{offsetPx:l,displayedRegions:c,bpPerPx:d,minimumBlockWidth:u,interRegionPaddingWidth:p,width:m}=e,g=l*d,h=(l+m)*d,f=s,y=Math.ceil(f*d);let b=0;const w=new o.mh;for(let e=0;e<c.length;e++){const l=c[e],{assemblyName:m,refName:f,start:v,end:C,reversed:S}=l,k=Math.ceil((C-v)/y),T=(0,n.isStateTreeNode)(l)?(0,n.getSnapshot)(l):l;let x=Math.floor((h-b)/y)+i;x>=k&&(x=k-1);let A=Math.floor((g-b)/y)-i;A<0&&(A=0);const P=(C-v)/d;for(let n=A;n<=x;n+=1){let i,l,g,h;S?(i=Math.max(v,C-(n+1)*y),l=C-n*y,g=l===C,h=i===v):(i=v+n*y,l=Math.min(C,v+(n+1)*y),g=i===v,h=l===C);const k={assemblyName:m,refName:f,start:i,end:l,reversed:S,offsetPx:(b+n*y)/d,parentRegion:T,regionNumber:e,widthPx:(l-i)/d,isLeftEndOfDisplayedRegion:g,isRightEndOfDisplayedRegion:h,key:""};k.key=`${(0,a.assembleLocStringFast)(k)}-${e}${S?"-reversed":""}`,t&&0===e&&0===n&&w.push(new o.fK({key:`${k.key}-beforeFirstRegion`,widthPx:s,offsetPx:k.offsetPx-s,variant:"boundary"})),r&&P<u?w.push(new o.Db(k)):w.push(new o.$G(k)),t&&(P>=u&&k.isRightEndOfDisplayedRegion&&e<c.length-1&&(b+=p*d,w.push(new o.fK({key:`${k.key}-rightpad`,widthPx:p,offsetPx:k.offsetPx+k.widthPx}))),e===c.length-1&&k.isRightEndOfDisplayedRegion&&(b+=p*d,w.push(new o.fK({key:`${k.key}-afterLastRegion`,widthPx:s,offsetPx:k.offsetPx+k.widthPx,variant:"boundary"}))))}b+=C-v}return w}},80208:(e,t,r)=>{"use strict";r.r(t),r.d(t,{contrastingTextColor:()=>s,emphasize:()=>c,isNamedColor:()=>i,makeContrasting:()=>d,namedColorToHex:()=>o});var n=r(72639);const a={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",green:"#008000",greenyellow:"#ADFF2F",grey:"#808080",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};function o(e){return a[e]}function i(e){return!!a[e]}function s(e){return l(e)>.5?"black":"white"}function l(e){const t=o(e);return(0,n.J1)(t||e)}function c(e,t=.15){const r=o(e);return(0,n.tL)(r||e,t)}function d(e,t="white",r=3){let a=o(e)||e;const i=o(t)||t,s=l(i);let c=(0,n.eM)(a,i);const d=a;let u=.05;for(;c<r;)a=s>.5?(0,n.e$)(d,u):(0,n.a)(d,u),u+=.05,c=(0,n.eM)(a,i);return a}},87485:(e,t,r)=>{"use strict";r.d(t,{M:()=>n.Mj});var n=r(76958),a=r(8145),o=r(81687);(0,n.X$)([a.A,o.A])},3519:(e,t,r)=>{"use strict";function n(e,t=JSON.stringify){const r=[],n=new Set;for(const a of e){const e=t(a);n.has(e)||(r.push(a),n.add(e))}return r}r.d(t,{Q:()=>n})},26257:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(99546);function a(e,t=""){const r=Object.keys(e);for(const n of r){if(t.length>5e3)break;t+="object"==typeof e[n]&&e[n]?a(e[n],t):`${n}-${e[n]};`}return(0,n.hashCode)(t)}},99834:(e,t,r)=>{"use strict";r.r(t),r.d(t,{RemoteFileWithRangeCache:()=>d,getFetcher:()=>f,openLocation:()=>h,resolveUriLocation:()=>g});var n=r(45834),a=r(70777),o=r.n(a),i=r(18196),s=r(35451);const l={},c=new i.j({fetch:function(e,t,r,n={}){const a=l[e];if(!a)throw new Error(`fetch not registered for ${e}`);return a(e,t,r,n)},size:524288e3,chunkSize:131072,maxFetchSize:104857600,minimumTTL:864e5});class d extends n.Tx{async fetch(e,t){const r=String(e);l[r]||(l[r]=this.fetchBinaryRange.bind(this));const n=new Headers(t?.headers).get("range");if(n){const r=/bytes=(\d+)-(\d+)/.exec(n);if(r){const[,n,a]=r,o=Number.parseInt(n,10),i=Number.parseInt(a,10)-o,{buffer:s,headers:l}=await c.getRange(e,o,i+1,{signal:t?.signal});return new Response(s,{status:206,headers:l})}}return super.fetch(e,t)}async fetchBinaryRange(e,t,r,n={}){const a=new Date,o=await super.fetch(e,{...n,headers:{...n.headers,range:`bytes=${t}-${r}`}}),i=new Date;if(!o.ok){const n=`HTTP ${o.status} fetching ${e} bytes ${t}-${r}`,a=" (should be 206 for range requests)";throw new Error(`${n}${200===o.status?a:""}`)}const l={};for(const[e,t]of o.headers.entries())l[e]=t;const c=await o.arrayBuffer();return{headers:l,requestDate:a,responseDate:i,buffer:s.hp.from(c)}}}var u=r(92516),p=r(91468),m=r(99546);function g(e){return e.baseUri?{...e,uri:new URL(e.uri,e.baseUri).href}:e}function h(e,t){if(function(e){return"localPath"in e}(e)){if(!e.localPath)throw new Error("No local path provided");if(o()||m.isElectron)return new n.EY(e.localPath);throw new Error("can't use local files in the browser")}if(function(e){return"blobId"in e}(e)){const t=(0,p.getBlob)(e.blobId);if(!t)throw new Error(`file ("${e.name}") was opened locally from a previous session. To restore it, go to track settings and reopen the file`);return new n.Ki(t)}if((0,u.C1)(e)){if(!e.uri)throw new Error("No URI provided");const r=g(e);if(t){const n=y(e,t);if(n)return n.openLocation(r)}return new d(r.uri,{fetch:b})}throw new Error("invalid fileLocation")}function f(e,t){if(!(0,u.C1)(e))throw new Error(`Not a valid UriLocation: ${JSON.stringify(e)}`);if(t){const r=y(e,t);if(r)return r.getFetcher(e)}return b}function y(e,t){const{rootModel:r}=t;if(r&&(0,u.lL)(r))return r.findAppropriateInternetAccount(e);if(e.internetAccountPreAuthorization){if(!e.internetAccountPreAuthorization.authInfo.token)throw new Error("Failed to obtain token from internet account. Try reloading the page");return t.getInternetAccountType(e.internetAccountPreAuthorization.internetAccountType).stateModel.create({type:e.internetAccountPreAuthorization.internetAccountType,configuration:e.internetAccountPreAuthorization.authInfo.configuration})}}async function b(e,t){const r=await fetch(e,t);if(401===r.status&&r.headers.get("WWW-Authenticate")?.includes("Basic"))throw new u._u("Accessing HTTPBasic resource without authentication",e.toString());return r}},53085:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(26400),a=r.n(n);function o(){const e=new(a().Jexl);return e.addFunction("get",((e,t)=>e.get(t))),e.addFunction("parent",(e=>e.parent())),e.addFunction("id",(e=>e.id())),e.addFunction("cast",(e=>e)),e.addFunction("log",(e=>(console.log(e),e))),e.addFunction("max",Math.max),e.addFunction("min",Math.min),e.addFunction("sqrt",Math.sqrt),e.addFunction("ceil",Math.ceil),e.addFunction("floor",Math.floor),e.addFunction("round",Math.round),e.addFunction("abs",Math.abs),e.addFunction("log10",Math.log10),e.addFunction("parseInt",Number.parseInt),e.addFunction("parseFloat",Number.parseFloat),e.addFunction("split",((e,t)=>e.split(t))),e.addFunction("charAt",((e,t)=>e.charAt(t))),e.addFunction("charCodeAt",((e,t)=>e.charCodeAt(t))),e.addFunction("codePointAt",((e,t)=>e.codePointAt(t))),e.addFunction("startsWith",((e,t,r)=>e.startsWith(t,r))),e.addFunction("endsWith",((e,t,r)=>e.endsWith(t,r))),e.addFunction("padEnd",((e,t,r)=>e.padEnd(t,r))),e.addFunction("padStart",((e,t,r)=>e.padStart(t,r))),e.addFunction("repeat",((e,t)=>e.repeat(t))),e.addFunction("replace",((e,t,r)=>e.replace(t,r))),e.addFunction("replaceAll",((e,t,r)=>e.replaceAll(t,r))),e.addFunction("slice",((e,t,r)=>e.slice(t,r))),e.addFunction("startsWith",((e,t,r)=>e.startsWith(t,r))),e.addFunction("substring",((e,t,r)=>e.substring(t,r))),e.addFunction("toLowerCase",(e=>e.toLowerCase())),e.addFunction("toUpperCase",(e=>e.toUpperCase())),e.addFunction("jsonParse",(e=>JSON.parse(e))),e.addFunction("trim",(e=>e.trim())),e.addFunction("trimEnd",(e=>e.trimEnd())),e.addFunction("trimStart",(e=>e.trimStart())),e.addFunction("getTag",((e,t)=>{const r=e.get("tags");return r?r[t]:e.get(t)})),e.addBinaryOp("&",15,((e,t)=>e&t)),e}},43283:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(53085);const a={};function o(e,t){const r=`nosig|${e}`;if(!a[r]){if(!e.startsWith("jexl:"))throw new Error("string does not appear to be in jexl format");const o=e.split("jexl:")[1],i=t?t.compile(o):(0,n.A)().compile(o);a[r]=i}return a[r]}},85012:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});const n=1e4;function a(e,t,r,n){return t>=r&&n>=e}class o{padding=1;widthLimit=1e6;setAllFilled(e){this.allFilled=e}getItemAt(e){return this.allFilled?this.allFilled:void 0===this.rowState?.min||e<this.rowState.min||e>=this.rowState.max?void 0:this.rowState.bits[e-this.rowState.offset]}isRangeClear(e,t){if(this.allFilled)return!1;if(void 0===this.rowState||t<=this.rowState.min||e>=this.rowState.max)return!0;const{min:r,max:n,offset:a,bits:o}=this.rowState,i=Math.min(n,t)-a;let s=!0;for(let t=Math.max(r,e)-a;t<i&&s;t++)s=void 0===o[t];return s}initialize(e,t){const r=t-e;return{offset:e-r,min:e,max:t,bits:Array.from({length:3*r})}}addRect(e,t){const r=e.l,n=e.r+this.padding;this.rowState||(this.rowState=this.initialize(r,n));let a=r-this.rowState.offset,o=n-this.rowState.offset;const i=this.rowState.bits.length;if(o>=this.rowState.bits.length){const e=o+1;this.rowState.bits.length+e>this.widthLimit?(console.warn("Layout width limit exceeded, discarding old layout. Please be more careful about discarding unused blocks."),this.rowState=this.initialize(r,n)):e>0&&(this.rowState.bits=[...this.rowState.bits,...Array.from({length:e})])}if(r<this.rowState.offset){const e=Math.min(i-a,this.rowState.offset);this.rowState.bits.length+e>this.widthLimit?(console.warn("Layout width limit exceeded, discarding old layout. Please be more careful about discarding unused blocks."),this.rowState=this.initialize(r,n)):(this.rowState.bits=[...Array.from({length:e}),...this.rowState.bits],this.rowState.offset-=e)}o=n-this.rowState.offset,a=r-this.rowState.offset;const s=o-a;s>2e4&&console.warn(`Layout X pitch set too low, feature spans ${s} bits in a single row.`,e,t);for(let e=a;e<o;e+=1)this.rowState.bits[e]=t;r<this.rowState.min&&(this.rowState.min=r),n>this.rowState.max&&(this.rowState.max=n)}discardRange(e,t){if(this.allFilled)return;if(!this.rowState)return;if(t<=this.rowState.min||e>=this.rowState.max)return;if(e<=this.rowState.min&&t>=this.rowState.max)return void(this.rowState=void 0);if(t>this.rowState.min&&e<=this.rowState.min&&(this.rowState.min=t),e<this.rowState.max&&t>=this.rowState.max&&(this.rowState.max=e),this.rowState.offset<this.rowState.min-n&&this.rowState.bits.length>this.rowState.max+n-this.rowState.offset){const e=this.rowState.min-this.rowState.offset,t=this.rowState.bits.length-1-(this.rowState.max-this.rowState.offset);this.rowState.bits=this.rowState.bits.slice(e,this.rowState.bits.length-t),this.rowState.offset+=e}else if(this.rowState.offset<this.rowState.min-n){const e=this.rowState.min-Math.floor(5e3)-this.rowState.offset;this.rowState.bits.splice(0,e),this.rowState.offset+=e}else if(this.rowState.bits.length>this.rowState.max-this.rowState.offset+n){const e=this.rowState.max-this.rowState.offset+1+Math.floor(5e3);this.rowState.bits.length=e}const r=Math.max(this.rowState.min,e)-this.rowState.offset,a=Math.min(t,this.rowState.max)-this.rowState.offset;for(let e=r;e>=0&&e<a;e+=1)this.rowState.bits[e]=void 0}}class i{constructor({pitchX:e=10,pitchY:t=10,maxHeight:r=1e4,hardRowLimit:n=1e4,displayMode:a="normal"}={}){this.pitchX=e,this.pitchY=t,this.hardRowLimit=n,this.maxHeightReached=!1,this.displayMode=a,"compact"===this.displayMode&&(this.pitchY=Math.round(this.pitchY/4)||1,this.pitchX=Math.round(this.pitchX/4)||1),this.bitmap=[],this.rectangles=new Map,this.maxHeight=Math.ceil(r/this.pitchY),this.pTotalHeight=0}addRect(e,t,r,n,a){const o=this.rectangles.get(e);if(o)return null===o.top?null:(this.addRectToBitmap(o),o.top*this.pitchY);const i=Math.floor(t/this.pitchX),s=Math.floor(r/this.pitchX),l=Math.ceil(n/this.pitchY),c={id:e,l:i,r:s,top:null,h:l,originalHeight:n,data:a},d=this.maxHeight-l;let u=0;if("collapse"!==this.displayMode){for(;u<=d&&this.collides(c,u);u+=1);if(u>d)return c.top=null,this.rectangles.set(e,c),this.maxHeightReached=!0,null}return c.top=u,this.addRectToBitmap(c),this.rectangles.set(e,c),this.pTotalHeight=Math.max(this.pTotalHeight||0,u+l),u*this.pitchY}collides(e,t){const{bitmap:r}=this,n=t+e.h;for(let a=t;a<n;a+=1){const t=r[a];if(void 0!==t&&!t.isRangeClear(e.l,e.r))return!0}return!1}autovivifyRow(e,t){let r=e[t];if(!r){if(t>this.hardRowLimit)throw new Error(`layout hard limit (${this.hardRowLimit*this.pitchY}px) exceeded, aborting layout`);r=new o,e[t]=r}return r}addRectToBitmap(e){if(null===e.top)return;const t=e.id,r=e.top+e.h;if(e.r-e.l>2e4)for(let n=e.top;n<r;n+=1)this.autovivifyRow(this.bitmap,n).setAllFilled(t);else for(let n=e.top;n<r;n+=1)this.autovivifyRow(this.bitmap,n).addRect(e,t)}discardRange(e,t){const r=Math.floor(e/this.pitchX),n=Math.floor(t/this.pitchX),{bitmap:a}=this;for(const e of a)e.discardRange(r,n)}hasSeen(e){return this.rectangles.has(e)}getByCoord(e,t){const r=Math.floor(t/this.pitchY),n=this.bitmap[r];if(!n)return;const a=Math.floor(e/this.pitchX);return n.getItemAt(a)}getByID(e){const t=this.rectangles.get(e);if(t){const e=t.top*this.pitchY;return[t.l*this.pitchX,e,t.r*this.pitchX,e+t.originalHeight]}}getDataByID(e){return this.rectangles.get(e)?.data}cleanup(){}getTotalHeight(){return this.pTotalHeight*this.pitchY}get totalHeight(){return this.getTotalHeight()}getRectangles(){return new Map([...this.rectangles.entries()].map((([e,t])=>{const{l:r,r:n,originalHeight:a,top:o}=t,i=(o||0)*this.pitchY,s=i+a;return[e,[r*this.pitchX,i,n*this.pitchX,s]]})))}serializeRegion(e){const t={};let r=!1;for(const[n,o]of this.rectangles.entries()){const{l:i,r:s,originalHeight:l,top:c}=o;if(null===o.top)r=!0;else{const r=(c||0)*this.pitchY,o=r+l,d=i*this.pitchX,u=s*this.pitchX;a(e.start,e.end,d-this.pitchX,u+this.pitchX)&&(t[n]=[d,r,u,o])}}return{rectangles:t,containsNoTransferables:!0,totalHeight:this.getTotalHeight(),maxHeightReached:r}}toJSON(){return{rectangles:Object.fromEntries(this.getRectangles()),containsNoTransferables:!0,totalHeight:this.getTotalHeight(),maxHeightReached:this.maxHeightReached}}}},2265:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{subLayouts=new Map;constructor(e,t={}){this.SubLayoutClass=e,this.subLayoutConstructorArgs=t}getDataByID(e){for(const t of this.subLayouts.values()){const r=t.getDataByID(e);if(r)return r}}getSublayout(e){let t=this.subLayouts.get(e);return void 0===t?(t=new this.SubLayoutClass(this.subLayoutConstructorArgs),this.subLayouts.set(e,t),t):t}addRect(e,t,r,n,a,o={}){return this.getSublayout(e).addRect(t,r,n,a,o)}discardRange(e,t,r){return this.subLayouts.get(e)?.discardRange(t,r)}toJSON(){const e={};for(const[t,r]of this.subLayouts.entries())e[t]=r.toJSON();return e}}},75762:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(22593),a=r.n(n);class o{constructor({rectangles:e,totalHeight:t,maxHeightReached:r}){this.rectangles=new Map(Object.entries(e)),this.totalHeight=t,this.maxHeightReached=r,this.rbush=new(a());for(const[t,r]of Object.entries(e))this.rbush.insert({minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],name:t})}addRect(e){const t=this.rectangles.get(e);if(!t)throw new Error(`id ${e} not found in precomputed feature layout`);return t[1]}getRectangles(){return this.rectangles}getTotalHeight(){return this.totalHeight}collides(e,t){throw new Error("Method not implemented.")}getByCoord(e,t){const r={minX:e,minY:t,maxX:e+1,maxY:t+1};return this.rbush.collides(r)?this.rbush.search(r)[0].name:void 0}getByID(e){return this.rectangles.get(e)}addRectToBitmap(e,t){throw new Error("Method not implemented.")}discardRange(e,t){throw new Error("Method not implemented.")}serializeRegion(e){throw new Error("Method not implemented.")}toJSON(){return{rectangles:Object.fromEntries(this.rectangles),totalHeight:this.totalHeight,maxHeightReached:!1,containsNoTransferables:!0}}}},88217:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GranularRectLayout:()=>n.A,MultiLayout:()=>a.A,PrecomputedLayout:()=>o.A,PrecomputedMultiLayout:()=>s,SceneGraph:()=>l});var n=r(85012),a=r(2265),o=r(75762);class i{constructor(){throw new Error("invalid layout name")}}class s extends a.A{constructor(e){super(i),Object.entries(e).forEach((([e,t])=>{this.subLayouts.set(e,new o.A(t))}))}}class l{constructor(e,t,r,n,a,o){this.name=e,this.left=t,this.top=r,this.width=n,this.height=a,this.data=o,this.children=new Map,this.absoluteCache={dirty:!0}}addChild(e,t,r,n,a,o){const i=e instanceof l?e:new l(e,t,r,n,a,o);if(!(i instanceof l))throw new TypeError("argument to addChild must be an array or a SceneGraph");if(this.children.has(i.name))throw new Error(`child named "${i.name}" already exists`);i.parent=this;const{left:s,right:c,top:d,bottom:u}=i.absolute;return void 0!==s&&void 0!==c&&void 0!==d&&void 0!==u&&(this.expand(s,c,d,u),this.children.set(i.name,i)),i}getSubRecord(e){return this.children.get(e)}expand(e,t,r,n){const{left:a,right:o,top:i,bottom:s}=this.absolute;if(void 0!==a&&e<a){const t=a-e;this.width+=t,this.left-=t}if(void 0!==o&&t>o&&(this.width+=t-o),void 0!==i&&r<i){const e=i-r;this.height+=e,this.top-=e}void 0!==s&&n>s&&(this.height+=n-s),this.parent&&this.parent.expand(e,t,r,n),this.absoluteCache.dirty=!0}get bottom(){return this.top+this.height}get right(){return this.left+this.width}walkParents(e){this.parent&&(e(this.parent),this.parent.walkParents(e))}walkChildren(e){for(const t of this.children.values())e(t),t.walkChildren(e)}get absolute(){if(this.absoluteCache.dirty){let e=0,t=0;this.walkParents((r=>{e+=r.left,t+=r.top})),this.absoluteCache={dirty:!1,left:this.left+e,right:this.right+e,top:this.top+t,bottom:this.bottom+t,width:this.width,height:this.height}}return this.absoluteCache}move(e,t){this.left+=e,this.top+=t,this.absoluteCache.dirty=!0,this.walkChildren((e=>{e.absoluteCache.dirty=!0}));const{left:r,right:n,top:a,bottom:o}=this.absolute;void 0!==r&&void 0!==n&&void 0!==a&&void 0!==o&&this.expand(r,n,a,o)}}},23550:(e,t,r)=>{"use strict";r.r(t),r.d(t,{getDefaultValue:()=>s,getEnumerationValues:()=>l,getPropertyType:()=>i,getSubType:()=>a,getUnionSubTypes:()=>o,resolveLateType:()=>c});var n=r(36422);function a(e){let t;if((0,n.isOptionalType)(e))t=e._subtype||e.type;else{if(!(0,n.isArrayType)(e)&&!(0,n.isMapType)(e)){if("function"==typeof e.getSubType)return e.getSubType();throw new TypeError("unsupported mst type")}t=e._subtype||e._subType||e.subType}if(!t)throw new Error("failed to get subtype");return t}function o(e){if(!(0,n.isUnionType)(e))throw new TypeError("not an MST union type");const t=e._types||e.types||a(e)._types||a(e).types;if(!t)throw new Error("failed to extract subtypes from mst union");return t}function i(e,t){return e.properties[t]}function s(e){if(!(0,n.isOptionalType)(e))throw new TypeError("type must be an optional type");return e._defaultValue||e.defaultValue}function l(e){return o(e).map((e=>e.value))}function c(e){return(0,n.isUnionType)(e)||(0,n.isArrayType)(e)||!(0,n.isLateType)(e)?e:e.getSubType()}},32761:(e,t,r)=>{"use strict";r.d(t,{Ak:()=>n});const n=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"")},18010:(e,t,r)=>{"use strict";r.d(t,{Nw:()=>i,T9:()=>s,bV:()=>l,pv:()=>c});var n=r(70777),a=r.n(n),o=r(13862);let i,s,l;function c(e,t){e.serializedCommands?new o.CanvasSequence(e.serializedCommands).execute(t):t.drawImage(e,0,0)}const d="function"==typeof OffscreenCanvas,u=a();d?(i=(e,t)=>new OffscreenCanvas(e,t),s=window.createImageBitmap||self.createImageBitmap,l=window.ImageBitmap||self.ImageBitmap):u?(i=(...e)=>nodeCreateCanvas(...e),s=async e=>{const t=e.toDataURL(),r=new nodeImage;return new Promise(((e,n)=>{r.onload=()=>{e(r)},r.onerror=n,r.src=t}))}):(i=(e,t)=>{const r=new o.CanvasSequence;return{width:e,height:t,getContext:()=>r}},s=async e=>{const t=e.getContext("2d");return{height:e.height,width:e.width,serializedCommands:t.toJSON(),containsNoTransferables:!0}},l=String)},98506:(e,t,r)=>{"use strict";r.d(t,{Jy:()=>l,aE:()=>c,u1:()=>s});var n=r(7552),a=r(13862),o=r(18010),i=r(31673);async function s(e,t,r,s){const{exportSVG:l,highResolutionScaling:c=1}=r;if(l){if(l.rasterizeLayers){const r=l.scale||c,a=(0,o.Nw)(Math.ceil(e*r),t*r),d=a.getContext("2d");if(!d)throw new Error("2d canvas rendering not supported on this platform");return d.scale(r,r),{...await s(d),reactElement:n.createElement("image",{width:e,height:t,xlinkHref:"convertToBlob"in a?await(0,i.y)(await a.convertToBlob({type:"image/png"})):a.toDataURL("image/png")})}}{const e=new a.CanvasSequence;return{...await s(e),canvasRecordedData:e.toJSON()}}}{const r=c,n=(0,o.Nw)(Math.ceil(e*r),t*r),a=n.getContext("2d");if(!a)throw new Error("2d canvas rendering not supported on this platform");return a.scale(r,r),{...await s(a),imageData:await(0,o.T9)(n)}}}async function l(e){const{width:t,height:n,canvasRecordedData:o}=e,i=new((await r.e(3109).then(r.t.bind(r,63109,23))).default)(t,n);return new a.CanvasSequence(o).execute(i),i.getSvg().innerHTML}function c({rendering:e}){return n.isValidElement(e.reactElement)?e.reactElement:n.createElement("g",{dangerouslySetInnerHTML:{__html:e.html||""}})}},32595:(e,t,r)=>{"use strict";function n(e,t,r,n){return t>r&&e<n&&n-r&&t-e?e>r?t<n?[e,t]:[e,n]:t<n?[r,t]:[r,n]:[]}function a(e,t,r,n){return t>r&&e<n}function o(e,t,r,n){return r<=e&&n>=t}r.d(t,{R6:()=>a,Xx:()=>o,ky:()=>n})},66885:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ObservableCreate:()=>i});var n=r(89592),a=r(85419),o=r(99546);function i(e,t){return new n.c((t=>{try{const r=e(t);r?.catch&&r.catch((e=>{t.error(e)}))}catch(e){t.error(e)}})).pipe((0,a.Q)((0,o.observeAbortSignal)(t)))}},6434:(e,t,r)=>{"use strict";function n(e){return"object"==typeof e&&null!==e&&"function"==typeof e.get&&"function"==typeof e.id}function a(e){return"uniqueId"in e&&"object"!=typeof e.data}r.d(t,{A:()=>o,l:()=>n});class o{constructor(e){a(e)?this.data=e:(this.data=e.data,this.parentHandle=e.parent);const t=a(e)?e.uniqueId:e.id;if(null==t)throw new Error("SimpleFeature requires a unique `id` or `data.uniqueId` attribute");if(this.uniqueId=String(t),!(this.data.aliases||this.data.end-this.data.start>=0))throw new Error(`invalid feature data, end less than start. end: ${this.data.end} start: ${this.data.start}`);this.data.subfeatures&&(this.subfeatures=this.data.subfeatures?.map(((e,r)=>"function"!=typeof e.get?new o({id:e.uniqueId||`${t}-${r}`,data:{strand:this.data.strand,...e},parent:this}):e)))}get(e){return"subfeatures"===e?this.subfeatures:"parent"===e?this.parent():this.data[e]}set(e,t){this.data[e]=t}tags(){return Object.keys(this.data)}id(){return this.uniqueId}parent(){return this.parentHandle}children(){return this.get("subfeatures")}toJSON(){const e={...this.data,uniqueId:this.id()},t=this.parent();t&&(e.parentId=t.id());const r=this.children();return r&&(e.subfeatures=r.map((e=>e.toJSON()))),e}static fromJSON(e){return new o({...e})}}},37957:(e,t,r)=>{"use strict";r.d(t,{WD:()=>i,Yv:()=>l,qn:()=>s});var n=r(44728),a=r(69652);function o(e,t,r,n=!1){if(0===r)return 0;let a;return n?a=t/r-e*e/(r*r):(a=t-e*e/r,r>1&&(a/=r-1)),a<0?0:Math.sqrt(a)}function i(e){return{...e,scoreMean:(e.scoreSum||0)/(e.featureCount||e.basesCovered||1),scoreStdDev:o(e.scoreSum,e.scoreSumSquares,e.featureCount||e.basesCovered),featureDensity:(e.featureCount||1)/e.basesCovered}}async function s(e,t){const{start:r,end:o}=e,s={scoreMin:Number.MAX_VALUE,scoreMax:Number.MIN_VALUE,scoreSum:0,scoreSumSquares:0,featureCount:0};let l=!1;const{scoreMin:c,scoreMax:d,scoreSum:u,scoreSumSquares:p,featureCount:m}=await(0,n._)(t.pipe((0,a.T)(((e,t)=>{const r=t.get("score"),n=t.get("summary"),{scoreMax:a,scoreMin:o}=e;return e.scoreMax=Math.max(a,n?t.get("maxScore"):r),e.scoreMin=Math.min(o,n?t.get("minScore"):r),e.scoreSum+=r,e.scoreSumSquares+=r*r,e.featureCount+=1,l=!0,e}),s)));return l?i({scoreMax:d,scoreMin:c,scoreSum:u,scoreSumSquares:p,featureCount:m,basesCovered:o-r+1}):{scoreMin:0,scoreMax:0,scoreMean:0,scoreStdDev:0,scoreSum:0,scoreSumSquares:0,featureCount:0,featureDensity:0,basesCovered:0}}function l(){return{scoreMin:0,scoreMax:0,scoreMean:0,scoreStdDev:0,scoreSum:0,scoreSumSquares:0,featureCount:0,featureDensity:0,basesCovered:0}}},92516:(e,t,r)=>{"use strict";r.d(t,{BY:()=>u,C1:()=>S,DW:()=>o,EO:()=>b,EV:()=>k,J_:()=>A,Nh:()=>C,QW:()=>l,Tl:()=>h,Uy:()=>y,Y$:()=>i,ZL:()=>P,_u:()=>x,bV:()=>w,gx:()=>p,lL:()=>v,lO:()=>d,mY:()=>g,rF:()=>T,rz:()=>a.A,u3:()=>s,xU:()=>f,xv:()=>c,yH:()=>M,zA:()=>m});var n=r(36422),a=r(83059);function o(e){return(0,n.isStateTreeNode)(e)&&"removeView"in e&&"addView"in e&&"views"in e}function i(e){return"object"==typeof e&&null!==e&&"rpcManager"in e&&"configuration"in e}function s(e){return i(e)&&"editConfiguration"in e}function l(e){return i(e)&&"addTrackConf"in e&&!e.disableAddTracks}function c(e){return i(e)&&"shareURL"in e&&!!e.shareURL}function d(e){return i(e)&&"widgets"in e}function u(e){return i(e)&&"makeConnection"in e}function p(e){return i(e)&&"addConnectionConf"in e}function m(e){return i(e)&&"sessionPlugins"in e}function g(e){return"object"==typeof e&&null!==e&&"selection"in e&&"setSelection"in e}function h(e){return"object"==typeof e&&null!==e&&"width"in e&&"setWidth"in e}function f(e){return"object"==typeof e&&null!==e&&"configuration"in e&&e.configuration.trackId}function y(e){return"object"==typeof e&&null!==e&&"configuration"in e&&e.configuration.displayId}function b(e){return"object"==typeof e&&null!==e&&"showTrack"in e&&"hideTrack"in e}function w(e){return"object"==typeof e&&null!==e&&"findAppropriateInternetAccount"in e}function v(e){return"object"==typeof e&&null!==e&&"internetAccounts"in e&&"findAppropriateInternetAccount"in e}function C(e){return"object"==typeof e&&null!==e&&"appendMenu"in e&&"appendToSubMenu"in e}function S(e){return"object"==typeof e&&null!==e&&"uri"in e&&!!e.uri}function k(e){return"object"==typeof e&&null!==e&&"localPath"in e&&!!e.localPath}function T(e){return"object"==typeof e&&null!==e&&"blobId"in e&&!!e.blobId}class x extends Error{constructor(e,t){super(e),this.message=e,this.url=t,this.name="AuthNeededError",Object.setPrototypeOf(this,x.prototype)}}class A extends Error{constructor(e,t){super(e),this.message=e,this.internetAccountId=t,this.name="RetryError"}}function P(e){return e instanceof Error&&("AuthNeededError"===e.name||void 0!==e.url)}function M(e){return"RetryError"===e.name||void 0!==e.internetAccountId}},40085:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(7552);function a(){const e=(0,n.useRef)(null),[t,r]=(0,n.useState)({width:void 0,height:void 0});return(0,n.useEffect)((()=>{if(!e.current)return;const t="undefined"!=typeof window&&"ResizeObserver"in window?window.ResizeObserver:void 0;if(!t)return;const n=new t((e=>{r({width:e[0].contentRect.width,height:e[0].contentRect.height})}));return n.observe(e.current),()=>{n.disconnect()}}),[]),[e,t]}},1864:(e,t,r)=>{"use strict";r.d(t,{I:()=>i,z:()=>o});var n=r(42489),a=r(20166);function o(e,{timeout:t,signal:r,name:o}={}){return new Promise(((i,s)=>{let l=!1;const c=(0,n.when)(e);let d,u=()=>{};t&&(d=setTimeout((()=>{l||(l=!0,c.cancel(),s(new Error(`timed out waiting for ${o||"whenPresent"}`)))}),t),u=()=>{d&&clearTimeout(d)}),r&&r.addEventListener("abort",(()=>{l||(l=!0,c.cancel(),u(),s((0,a.zm)()))})),c.then((()=>{l||(l=!0,u(),i(!0))})).catch((e=>{l||(l=!0,u(),s(e))}))}))}async function i(e,t={}){return await o((()=>null!=e()),t),e()}},80544:(e,t,r)=>{"use strict";r.r(t),r.d(t,{cigarToMismatches:()=>u,featurizeSA:()=>A,getClip:()=>T,getLength:()=>S,getLengthOnRef:()=>C,getLengthSansClipping:()=>k,getMethBins:()=>f,getMismatches:()=>m,getModificationPositions:()=>y,getModificationProbabilities:()=>h,getModificationTypes:()=>b,getNextRefPos:()=>g,getOrientedCigar:()=>w,getOrientedMismatches:()=>v,getTag:()=>x,mdToMismatches:()=>p,parseCigar:()=>d});var n=r(99546),a=r(86576);const o=new RegExp(/(\d+|\^[a-z]+|[a-z])/gi),i=new RegExp(/([A-Z])([-+])([^,.?]+)([.?])?/),s=new RegExp(/([MIDNSHPX=])/),l=new RegExp(/(\d+)[SH]$/),c=new RegExp(/^(\d+)([SH])/);function d(e=""){return e.split(s).slice(0,-1)}function u(e,t,r,n){let a=0,o=0;const i=[],s=r&&t;for(let l=0;l<e.length;l+=2){const c=+e[l],d=e[l+1];if("M"===d||"="===d||"E"===d){if(s)for(let e=0;e<c;e++)t[o+e].toUpperCase()!==r[a+e].toUpperCase()&&i.push({start:a+e,type:"mismatch",base:t[o+e],altbase:r[a+e],length:1});o+=c}if("I"===d)i.push({start:a,type:"insertion",base:`${c}`,length:0}),o+=c;else if("D"===d)i.push({start:a,type:"deletion",base:"*",length:c});else if("N"===d)i.push({start:a,type:"skip",base:"N",length:c});else if("X"===d){const e=t?.slice(o,o+c)||[],r=n?.subarray(o,o+c)||[];for(let t=0;t<c;t++)i.push({start:a+t,type:"mismatch",base:e[t],qual:r[t],length:1});o+=c}else"H"===d?i.push({start:a,type:"hardclip",base:`H${c}`,cliplen:c,length:1}):"S"===d&&(i.push({start:a,type:"softclip",base:`S${c}`,cliplen:c,length:1}),o+=c);"I"!==d&&"S"!==d&&"H"!==d&&(a+=c)}return i}function p(e,t,r,n,a){let i={start:0,base:"",length:0,type:"mismatch"},s=0,l=0,c=0,d=0;const u=[],p=r.filter((e=>"skip"===e.type));function m(e){let r=l,n=c;for(let a=s;a<t.length&&n<=e;a+=2,s=a){const e=+t[a],o=t[a+1];"S"===o||"I"===o?r+=e:"D"===o||"P"===o||"N"===o?n+=e:"H"!==o&&(r+=e,n+=e)}return l=r,c=n,r-(n-e)}const g=e.match(o)||[];for(const e of g){const t=+e;if(Number.isNaN(t))if(e.startsWith("^"))i.start+=e.length-1;else for(let t=0;t<e.length;t+=1){for(i.length=1;d<p.length;){const e=p[d];if(!(i.start>=e.start))break;i.start+=e.length,d++}const t=m(i.start);i.base=n[t]||"X",i.qual=a?.[t],i.altbase=e,u.push(i),i={start:i.start+i.length,length:0,base:"",type:"mismatch"}}else i.start+=t}return u}function m(e,t,r,n,a){let o=[];const i=d(e);return e&&(o=o.concat(u(i,r,n,a))),t&&r&&(o=o.concat(p(t,i,o,r,a))),o}function*g(e,t){let r=0,n=0,a=0;for(let o=0;o<e.length&&a<t.length;o+=2){const i=+e[o],s=e[o+1];if("S"===s||"I"===s){for(let e=0;e<i&&a<t.length;e++)t[a]===r+e&&a++;r+=i}else if("D"===s||"N"===s)n+=i;else if("M"===s||"X"===s||"="===s){for(let e=0;e<i&&a<t.length;e++)t[a]===r+e&&(yield n+e,a++);r+=i,n+=i}}}function h(e){const t=(0,a.c$)(e,"ML","Ml")||[];return t?("string"==typeof t?t.split(",").map((e=>+e)):t).map((e=>e/255)):(0,a.c$)(e,"MP","Mp")?.split("").map((e=>e.charCodeAt(0)-33)).map((e=>Math.min(1,e/50)))}function f(e){const t=e.get("start"),r=e.get("end"),n=e.get("strand"),o=r-t,i=(0,a.c$)(e,"MM","Mm")||"",s=new Array(o),l=new Array(o),c=e.get("seq");if(c){const t=d(e.get("CIGAR")),r=h(e),a=y(i,c,n);let u=0;for(const{type:e,positions:n}of a)if("m"===e)for(const e of g(t,n)){const t=r?.[u]||0;u++,e>=0&&e<o&&(s[e]=1,l[e]=t)}}return{methBins:s,methProbs:l}}function y(e,t,r){const a=-1===r?(0,n.revcom)(t):t,o=e.split(";").filter((e=>!!e)),s=[];for(const e of o){const[t,...n]=e.split(","),o=i.exec(t);if(!o)throw new Error("bad format for MM tag");const[,l,c,d]=o,u=d.split(/(\d+|.)/).filter((e=>!!e));"-"===c&&(console.warn("unsupported negative strand modifications"),s.push({type:"unsupported",positions:[]}));for(const e of u){let t=0;const o=[];for(const e of n){let n=+e;do{"N"!==l&&l!==a[t]||n--,t++}while(n>=0&&t<a.length);const i=t-1;o.push(-1===r?a.length-1-i:i)}-1===r&&o.sort(((e,t)=>e-t)),s.push({type:e,positions:o})}}return s}function b(e){return e.split(";").filter((e=>!!e)).flatMap((t=>{const r=t.split(",")[0],n=i.exec(r);if(!n)throw new Error(`bad format for MM tag: ${e}`);return n[3].split(/(\d+|.)/).filter((e=>!!e))}))}function w(e,t){if(e){const e=[];for(let r=0;r<t.length;r+=2){const n=t[r];let a=t[r+1];"D"===a?a="I":"I"===a&&(a="D"),e.push(n,a)}return e}return t}function v(e,t){const r=d(t);return u(e?w(e,r):r)}function C(e){const t=d(e);let r=0;for(let e=0;e<t.length;e+=2){const n=+t[e],a=t[e+1];"H"!==a&&"S"!==a&&"I"!==a&&(r+=n)}return r}function S(e){const t=d(e);let r=0;for(let e=0;e<t.length;e+=2){const n=+t[e],a=t[e+1];"D"!==a&&"N"!==a&&(r+=n)}return r}function k(e){const t=d(e);let r=0;for(let e=0;e<t.length;e+=2){const n=+t[e],a=t[e+1];"H"!==a&&"S"!==a&&"D"!==a&&"N"!==a&&(r+=n)}return r}function T(e,t){return-1===t?+(l.exec(e)||[])[1]||0:+(c.exec(e)||[])[1]||0}function x(e,t){const r=e.get("tags");return r?r[t]:e.get(t)}function A(e,t,r,n,a){return e?.split(";").filter((e=>!!e)).map(((e,o)=>{const i=e.split(","),s=i[0],l=i[1],c=i[2],d=i[3],u=C(d),p=S(d),m=k(d),g="-"===c?-1:1,h=T(d,(a?r:1)*g),f=+l-1;return{refName:s,start:f,end:f+u,seqLength:p,clipPos:h,CIGAR:d,strand:(a?r:1)*g,uniqueId:`${t}_SA${o}`,mate:{start:h,end:h+m,refName:n}}}))||[]}},82727:(e,t,r)=>{"use strict";r.d(t,{aF:()=>we,N5:()=>Ge,Ay:()=>Xe,ww:()=>xe});var n=r(12678),a=r(47369),o=r(68584);const i=(0,o.ConfigurationSchema)("CramAdapter",{fetchSizeLimit:{type:"number",description:"size in bytes over which to display a warning to the user that too much data will be fetched",defaultValue:3e6},cramLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.cram",locationType:"UriLocation"}},craiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.cram.crai",locationType:"UriLocation"}},sequenceAdapter:{type:"frozen",description:"sequence data adapter",defaultValue:null}},{explicitlyTyped:!0});function s(e){e.addAdapterType((()=>new a.A({name:"CramAdapter",displayName:"CRAM adapter",configSchema:i,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(5099),r.e(6391)]).then(r.bind(r,78369)).then((e=>e.default))})))}var l=r(36422);const c=(0,o.ConfigurationSchema)("BamAdapter",{bamLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bam",locationType:"UriLocation"}},index:(0,o.ConfigurationSchema)("BamIndex",{indexType:{model:l.types.enumeration("IndexType",["BAI","CSI"]),type:"stringEnum",defaultValue:"BAI"},location:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bam.bai",locationType:"UriLocation"}}}),fetchSizeLimit:{type:"number",description:"size to fetch in bytes over which to display a warning to the user that too much data will be fetched",defaultValue:5e6},sequenceAdapter:{type:"frozen",description:"sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags",defaultValue:null}},{explicitlyTyped:!0});function d(e){e.addAdapterType((()=>new a.A({name:"BamAdapter",displayName:"BAM adapter",configSchema:c,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4133),r.e(4770)]).then(r.bind(r,94770)).then((e=>e.default))})))}const u=(0,o.ConfigurationSchema)("HtsgetBamAdapter",{htsgetBase:{type:"string",description:"the base URL to fetch from",defaultValue:""},htsgetTrackId:{type:"string",description:"the trackId, which is appended to the base URL",defaultValue:""},sequenceAdapter:{type:"frozen",description:"sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags",defaultValue:null}},{explicitlyTyped:!0});function p(e){e.addAdapterType((()=>new a.A({name:"HtsgetBamAdapter",displayName:"Htsget BAM adapter",adapterMetadata:{hiddenFromGUI:!0},configSchema:u,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4133),r.e(6823)]).then(r.bind(r,6823)).then((e=>e.default))})))}const m=(0,o.ConfigurationSchema)("SNPCoverageAdapter",{subadapter:{type:"frozen",defaultValue:null}},{explicitlyTyped:!0});function g(e){e.addAdapterType((()=>new a.A({name:"SNPCoverageAdapter",displayName:"SNPCoverage adapter",adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>r.e(5461).then(r.bind(r,75461)).then((e=>e.default)),configSchema:m})))}const h=(0,o.ConfigurationSchema)("SNPCoverageRenderer",{clipColor:{type:"color",description:"the color of the clipping marker",defaultValue:"red"},indicatorThreshold:{type:"number",description:"the proportion of reads containing a insertion/clip indicator",defaultValue:.4},drawArcs:{type:"boolean",description:"Draw sashimi-style arcs for intron features",defaultValue:!0},drawInterbaseCounts:{type:"boolean",description:'draw count "upsidedown histogram" of the interbase events that don\'t contribute to the coverage count so are not drawn in the normal histogram',defaultValue:!0},drawIndicators:{type:"boolean",description:"draw a triangular indicator where an event has been detected",defaultValue:!0},color:{type:"color",description:"Background color for the SNPCoverage renderer",defaultValue:"#d3d3d3"}},{explicitlyTyped:!0});var f=r(49823),y=r(99546),b=r(17970);class w extends b.er{async draw(e,t){const{features:r,regions:n,bpPerPx:a,displayCrossHatches:i,modificationTagMap:s={},scaleOpts:l,height:c,theme:d,config:u,ticks:p}=t,m=(0,f.createJBrowseTheme)(d),g=n[0],h=(g.end-g.start)/a,w=b.Oy,v=c-2*w,C={...l,range:[0,v]},S=(0,b.X_)(C),k=(0,b.X_)({...C,range:[0,v/2],scaleType:"linear"}),T=(0,b.$z)(l.scaleType),x=(0,b.$z)("linear"),A=(0,o.readConfObject)(u,"indicatorThreshold"),P=(0,o.readConfObject)(u,"drawInterbaseCounts"),M=(0,o.readConfObject)(u,"drawArcs"),E=(0,o.readConfObject)(u,"drawIndicators"),R=e=>v-(S(e)||0)+w,I=e=>R(T)-R(e),N=e=>v-(k(e)||0)+w,F=e=>N(x)-N(e),{bases:L}=m.palette,D={A:L.A.main,C:L.C.main,G:L.G.main,T:L.T.main,insertion:"purple",softclip:"blue",hardclip:"red",total:(0,o.readConfObject)(u,"color"),meth:"red",unmeth:"blue"},B=[...r.values()],V=B.filter((e=>"skip"!==e.get("type"))),z=B.filter((e=>"skip"===e.get("type")));e.fillStyle=D.total;for(const t of V){const[r,n]=(0,y.featureSpanPx)(t,g,a),o=n-r+.6,i=t.get("score");e.fillRect(r,R(i),o,I(i))}let O=0;const H=g.reversed?1/a:0;for(const t of V){const[r,n]=(0,y.featureSpanPx)(t,g,a),o=t.get("score"),i=t.get("snpinfo"),l=Math.max(n-r,1),c=i.total,d=Object.keys(i.cov).sort();let u=0;for(const t of d){const{total:n}=i.cov[t];e.fillStyle=D[t]||s[t.replace("mod_","")]||"black";const a=I(o),c=R(o)+a;e.fillRect(Math.round(r),c-(n+u)/o*a,l,n/o*a),u+=n}const p=Object.keys(i.noncov),m=4.5;if(P){let t=0;for(const n of p){const{total:a}=i.noncov[n],o=.6;e.fillStyle=D[n],e.fillRect(r-o+H,m+F(t),2*o,F(a)),t+=a}}if(E){let t=0,n=0,a="";for(const e of p){const{total:r}=i.noncov[e];t+=r,r>n&&(n=r,a=e)}const o=Math.max(c,O);if(t>o*A&&o>7){e.fillStyle=D[a],e.beginPath();const t=r+H;e.moveTo(t-3.5,0),e.lineTo(t+3.5,0),e.lineTo(t,m),e.fill()}}O=c}if(M)for(const t of z){const[r,n]=(0,y.bpSpanPx)(t.get("start"),t.get("end"),g,a);e.beginPath();const o=t.get("strand"),i=t.get("xs"),s="rgba(255,200,200,0.7)",l="rgba(200,200,255,0.7)",c="rgba(200,200,200,0.7)";e.strokeStyle="+"===i?s:"-"===i?l:1===o?s:-1===o?l:c,e.lineWidth=Math.log(t.get("score")+1),e.moveTo(r,v-2*w),e.bezierCurveTo(r,0,n,0,n,v-2*w),e.stroke()}i&&(e.lineWidth=1,e.strokeStyle="rgba(140,140,140,0.8)",p.values.forEach((t=>{e.beginPath(),e.moveTo(0,Math.round(R(t))),e.lineTo(h,Math.round(R(t))),e.stroke()})))}}function v(e){e.addRendererType((()=>new w({name:"SNPCoverageRenderer",ReactComponent:b.Ep,configSchema:h,pluginManager:e})))}var C=r(98111),S=r(3496),k=r(41365),T=r.n(k);class x extends C.LayoutSession{showSoftClip=!1;constructor(e){super(e),this.config=e.config}cachedLayoutIsValid(e){return super.cachedLayoutIsValid(e)&&this.showSoftClip===e.showSoftClip&&T()(this.sortedBy,e.sortedBy)&&T()(this.filterBy,e.filterBy)}get layout(){return this.cachedLayout&&this.cachedLayoutIsValid(this.cachedLayout)||(this.cachedLayout={layout:this.makeLayout(),config:(0,o.readConfObject)(this.config),filters:this.filters,filterBy:this.filterBy,sortedBy:this.sortedBy,showSoftClip:this.showSoftClip}),this.cachedLayout.layout}}var A=r(86576);class P extends C.default{supportsSVG=!0;async fetchSequence(e){const{sessionId:t,regions:r,adapterConfig:n}=e,{sequenceAdapter:a}=n;if(!a)return;const o=this.pluginManager,{dataAdapter:i}=await(0,S.cK)(o,t,a),s=r[0];return(0,A.Iw)(s,i)}getExpandedRegion(e,t){const{config:r,showSoftClip:n}=t,{start:a,end:i}=e,s=(0,o.readConfObject)(r,"maxClippingSize"),l=n?Math.round(s):0;return{...e,start:Math.floor(Math.max(a-l,0)),end:Math.ceil(i+l)}}async render(e){const t=await this.getFeatures(e),n=this.createLayoutInWorker(e),{regions:a,bpPerPx:i}=e,s=a[0],l=function(e){const{layout:t,features:r,sortedBy:n,config:a,bpPerPx:i,showSoftClip:s,regions:l}=e,c=l[0],d=n?.type&&c.start===n.pos?((e,t)=>{const r=Array.from(e.values()),n=[],a=[],{pos:o,type:i}=t;r.forEach((e=>{const t=e,r=t.get("start"),i=t.get("end");(0,y.doesIntersect2)(o-1,o,r,i)?n.push(e):a.push(e)}));const s=!!r.length&&r[0].get("tags");switch(i){case"Start location":n.sort(((e,t)=>e.get("start")-t.get("start")));break;case"tag":{const e=t.tag,r=(e,t)=>s?e.get("tags")[t]:e.get(t);n[0]&&"string"==typeof r(n[0],e)?n.sort(((t,n)=>r(n,e).localeCompare(r(t,e)))):n.sort(((t,n)=>(r(n,e)||0)-(r(t,e)||0)));break}case"Base pair":{const e=[];n.forEach((t=>{t.get("mismatches").forEach((r=>{const n=t.get("start")+r.start+1,a="insertion"===r.type||"softclip"===r.type?0:r.length;o>=n&&o<n+a&&e.push([t.id(),r])}))}));const t=new Map(e);n.sort(((e,r)=>{const n=t.get(e.id()),a=t.get(r.id()),o=a?.base.toUpperCase(),i=n?.base.toUpperCase();return o===i&&"*"===o?n.length-a.length:(o?o.charCodeAt(0):0)-(i?i.charCodeAt(0):0)}));break}case"Read strand":n.sort(((e,t)=>e.get("strand")<=t.get("strand")?1:-1))}return new Map([...n,...a].map((e=>[e.id(),e])))})(r,n):r,u=(0,o.readConfObject)(a,"height"),p=(0,o.readConfObject)(a,"displayMode");return(0,y.iterMap)(d.values(),(e=>function({feature:e,layout:t,bpPerPx:r,region:n,showSoftClip:a,heightPx:o,displayMode:i}){let s=0,l=0;if(a){const t=e.get("mismatches");if(e.get("seq"))for(const{type:e,start:r,cliplen:n=0}of t)"softclip"===e&&(0===r?s=n:l=n)}const[c,d]=(0,y.bpSpanPx)(e.get("start")-s,e.get("end")+l,n,r);if("compact"===i&&(o/=3),e.get("refName")!==n.refName)throw new Error(`feature ${e.id()} is not on the current region's reference sequence ${n.refName}`);const u=t.addRect(e.id(),e.get("start")-s,e.get("end")+l,o,e);return null===u?null:{feature:e,leftPx:c,rightPx:d,topPx:"collapse"===i?0:u,heightPx:o}}({feature:e,layout:t,bpPerPx:i,region:c,showSoftClip:s,heightPx:u,displayMode:p})),d.size)}({...e,features:t,layout:n}),c=t.size&&(0,A.k_)(e.colorBy?.type)?await this.fetchSequence(e):void 0,d=(s.end-s.start)/i,u=Math.max(n.getTotalHeight(),1),{makeImageData:p}=await r.e(4060).then(r.bind(r,24060)),m=await(0,y.renderToAbstractCanvas)(d,u,e,(r=>{p({ctx:r,layoutRecords:l.filter(y.notEmpty),canvasWidth:d,renderArgs:{...e,layout:n,features:t,regionSequence:c}})}));return{...await super.render({...e,...m,features:t,layout:n,height:u,width:d}),...m,features:new Map,layout:n,height:u,width:d,maxHeightReached:n.maxHeightReached}}createSession(e){return new x(e)}}const M=(0,o.ConfigurationSchema)("PileupRenderer",{color:{type:"color",description:"the color of each feature in a pileup alignment",defaultValue:"#f0f",contextVariable:["feature"]},orientationType:{type:"stringEnum",model:l.types.enumeration("orientationType",["fr","rf","ff"]),defaultValue:"fr",description:'read sequencer orientation. fr is normal "reads pointing at each other ---\x3e <--- while some other sequencers can use other options'},displayMode:{type:"stringEnum",model:l.types.enumeration("displayMode",["normal","compact","collapse"]),description:"Alternative display modes",defaultValue:"normal"},minSubfeatureWidth:{type:"number",description:"the minimum width in px for a pileup mismatch feature. use for increasing/decreasing mismatch marker widths when zoomed out, e.g. 0 or 1",defaultValue:1},maxHeight:{type:"integer",description:"the maximum height to be used in a pileup rendering",defaultValue:1200},maxClippingSize:{type:"integer",description:"the max clip size to be used in a pileup rendering",defaultValue:1e4},height:{type:"number",description:"the height of each feature in a pileup alignment",defaultValue:7,contextVariable:["feature"]},noSpacing:{type:"boolean",description:"remove spacing between features",defaultValue:!1},largeInsertionIndicatorScale:{type:"number",description:"scale at which to draw the large insertion indicators (bp/pixel)",defaultValue:10},mismatchAlpha:{type:"boolean",defaultValue:!1,description:"Fade low quality mismatches"}},{explicitlyTyped:!0});var E=r(7552),R=r(68446);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},I.apply(null,arguments)}const N=(0,R.observer)((function(e){const{onMouseMove:t,blockKey:r,displayModel:n,width:a,height:o,regions:i,bpPerPx:s,sortedBy:l,colorBy:c,filterBy:d}=e,{selectedFeatureId:u,featureIdUnderMouse:p,contextMenuFeature:m}=n||{},[g,h]=(0,E.useState)(!1);(0,E.useEffect)((()=>{h(!0)}),[]);const b=i[0],w=(0,E.useRef)(null),[v,C]=(0,E.useState)(!1),[S,k]=(0,E.useState)(!1),T=u?n?.getFeatureByID(r,u):void 0,x=p||m?.id(),A=x?n?.getFeatureByID(r,x):void 0;function P(e,t=2){const[r,n,a,o]=e,[i,l]=(0,y.bpSpanPx)(r,a,b,s);return{left:i-t,top:Math.round(n)-t,width:l-i,height:Math.round(o-n)}}const M=T?P(T):void 0,R=A?P(A,0):void 0;function N(t,r){const n=e[`onFeature${t}`],a=e[`on${t}`];n&&p?n(r,p):a&&a(r,p)}const F=Math.ceil(a);return E.createElement("div",{ref:w,"data-testid":["pileup-overlay",l?.type,c?.type,c?.tag,d?.tagFilter?.tag].filter((e=>!!e)).join("-"),style:{position:"relative",width:F,height:o},onMouseDown:e=>{!function(e){C(!0),k(!1),N("MouseDown",e)}(e)},onMouseEnter:e=>{!function(e){N("MouseEnter",e)}(e)},onMouseOut:e=>{!function(e){N("MouseOut",e),N("MouseLeave",e)}(e)},onMouseOver:e=>{!function(e){N("MouseOver",e)}(e)},onMouseUp:e=>{!function(e){C(!1),N("MouseUp",e)}(e)},onMouseLeave:e=>{!function(e){N("MouseOut",e),N("MouseLeave",e)}(e)},onMouseMove:e=>{!function(e){if(!w.current)return;v&&k(!0);const o=w.current.getBoundingClientRect(),i=e.clientX-o.left,l=e.clientY-o.top,c=b.reversed?a-i:i,d=b.start+s*c;t?.(e,n?.getFeatureOverlapping(r,d,l))}(e)},onClick:e=>{!function(e){S||N("Click",e)}(e)},onContextMenu:e=>{!function(e){N("ContextMenu",e)}(e)},onFocus:()=>{},onBlur:()=>{}},E.createElement(f.PrerenderedCanvas,I({},e,{style:{position:"absolute",left:0,top:0}})),g&&R?E.createElement("div",{style:{position:"absolute",backgroundColor:"#0003",pointerEvents:"none",...R}}):null,g&&M?E.createElement("div",{style:{position:"absolute",border:"2px solid #00b8ff",boxSizing:"content-box",pointerEvents:"none",...M}}):null)}));function F(e){e.addRendererType((()=>new P({name:"PileupRenderer",displayName:"Pileup renderer",ReactComponent:N,configSchema:M,pluginManager:e})))}var L=r(56328),D=r(20529),B=r(42489),V=r(1622);function z(e){return e.getDisplayElements().filter((e=>"LinearAlignmentsDisplay"===e.subDisplay?.type)).filter((e=>e.subDisplay?.lowerPanel))}function O(e,t){return T()(e?(0,l.getSnapshot)(e):void 0,t?(0,l.getSnapshot)(t):void 0)}function H(e){const{PileupDisplay:t,SNPCoverageDisplay:r}=e;return t||(0,l.isAlive)(t)||r||(0,l.isAlive)(r)}const j=function(e,t){return l.types.compose("LinearAlignmentsDisplay",V.BaseDisplay,function(e,t){return l.types.model({PileupDisplay:l.types.maybe(l.types.union(...z(e).map((e=>e.stateModel)))),SNPCoverageDisplay:l.types.maybe(e.getDisplayType("LinearSNPCoverageDisplay").stateModel),snpCovHeight:45,type:l.types.literal("LinearAlignmentsDisplay"),configuration:(0,o.ConfigurationReference)(t),heightPreConfig:l.types.maybe(l.types.number),userFeatureScreenDensity:l.types.maybe(l.types.number),lowerPanelType:"LinearPileupDisplay"})}(e,t)).volatile((()=>({scrollTop:0}))).actions((e=>({setScrollTop(t){e.scrollTop=t},setSNPCoverageHeight(t){e.snpCovHeight=t}}))).views((e=>({get height(){return e.heightPreConfig??(0,o.getConf)(e,"height")},get featureIdUnderMouse(){return e.PileupDisplay.featureIdUnderMouse||e.SNPCoverageDisplay.featureIdUnderMouse}}))).views((e=>({get pileupConf(){return{...(0,o.getConf)(e,"pileupDisplay"),type:e.lowerPanelType,displayId:`${e.configuration.displayId}_${e.lowerPanelType}_xyz`}},getFeatureByID:(t,r)=>e.PileupDisplay.getFeatureByID(t,r),searchFeatureByID:t=>e.PileupDisplay.searchFeatureByID?.(t),get features(){return e.PileupDisplay.features},get DisplayBlurb(){return e.PileupDisplay?.DisplayBlurb},get sortedBy(){return e.PileupDisplay.sortedBy},get coverageConf(){return{...(0,o.getConf)(e,"snpCoverageDisplay"),displayId:`${e.configuration.displayId}_snpcoverage_xyz`}}}))).actions((e=>({setSNPCoverageDisplay(t){e.SNPCoverageDisplay={type:"LinearSNPCoverageDisplay",configuration:t,height:e.snpCovHeight}},setFeatureDensityStatsLimit(t){e.PileupDisplay.setFeatureDensityStatsLimit(t),e.SNPCoverageDisplay.setFeatureDensityStatsLimit(t)},setPileupDisplay(t){e.PileupDisplay={type:t.type||"LinearPileupDisplay",configuration:t}},setHeight:t=>(e.heightPreConfig=Math.max(t,20),e.heightPreConfig),setFilterBy(t){e.PileupDisplay.setFilterBy(t),e.SNPCoverageDisplay.setFilterBy(t)},setLowerPanelType(t){e.lowerPanelType=t},resizeHeight(t){const r=e.height;return this.setHeight(e.height+t)-r}}))).actions((e=>({afterAttach(){(0,l.addDisposer)(e,(0,B.autorun)((()=>{const{SNPCoverageDisplay:t,PileupDisplay:r,coverageConf:n,pileupConf:a}=e;t?T()(n,(0,l.getSnapshot)(t.configuration))||(t.setHeight(e.snpCovHeight),t.setConfig(e.coverageConf)):e.setSNPCoverageDisplay(n),r&&e.lowerPanelType===r.type?T()(a,(0,l.getSnapshot)(r.configuration))||r.setConfig(e.pileupConf):e.setPileupDisplay(a),function(e){const{PileupDisplay:t,SNPCoverageDisplay:r}=e;H(e)&&t.colorBy&&(O(t.colorBy,r.colorBy)||r.setColorBy((0,l.getSnapshot)(t.colorBy)))}(e),function(e){const{PileupDisplay:t,SNPCoverageDisplay:r}=e;H(e)&&t.filterBy&&(O(t.filterBy,r.filterBy)||r.setFilterBy((0,l.getSnapshot)(t.filterBy)))}(e)}))),(0,l.addDisposer)(e,(0,B.autorun)((()=>{e.setSNPCoverageHeight(e.SNPCoverageDisplay.height)}))),(0,l.addDisposer)(e,(0,B.autorun)((()=>{e.PileupDisplay.setHeight(e.height-e.SNPCoverageDisplay.height)})))},async renderSvg(t){const r=e.height-e.SNPCoverageDisplay.height;return await(0,B.when)((()=>!e.PileupDisplay.renderProps().notReady&&!e.SNPCoverageDisplay.renderProps().notReady)),E.createElement(E.Fragment,null,E.createElement("g",null,await e.SNPCoverageDisplay.renderSvg(t)),E.createElement("g",{transform:`translate(0 ${e.SNPCoverageDisplay.height})`},await e.PileupDisplay.renderSvg({...t,overrideHeight:r})))}}))).views((t=>{const{trackMenuItems:r}=t;return{trackMenuItems(){if(!t.PileupDisplay)return[];const n=z(e).map((e=>({type:"radio",label:e.displayName,checked:e.name===t.PileupDisplay.type,onClick:()=>{t.setLowerPanelType(e.name)}})));return[...r(),{type:"subMenu",label:"Pileup settings",subMenu:t.PileupDisplay.trackMenuItems()},{type:"subMenu",label:"SNPCoverage settings",subMenu:t.SNPCoverageDisplay.trackMenuItems()},{type:"subMenu",label:"Replace lower panel with...",subMenu:n}]}}})).preProcessSnapshot((e=>{if(!e)return e;const{height:t,...r}=e;return{heightPreConfig:t,...r}}))},W=(0,r(75785).n9)()({resizeHandle:{height:5,position:"absolute",zIndex:2}}),G=(0,R.observer)((function({model:e}){const{PileupDisplay:t,SNPCoverageDisplay:r}=e,{classes:n}=W();if(!r)return null;const a=r.height??100;return E.createElement("div",{"data-testid":`display-${(0,o.getConf)(e,"displayId")}`,style:{position:"relative"}},E.createElement("div",{"data-testid":"Blockset-snpcoverage"},E.createElement(r.RenderingComponent,{model:r})),E.createElement(f.ResizeHandle,{onDrag:e=>(r.setHeight(r.height+e),e),className:n.resizeHandle,style:{top:a-4}}),E.createElement("div",{"data-testid":"Blockset-pileup",style:{position:"absolute",top:a}},E.createElement(t.RenderingComponent,{model:t})))})),$=G;function q(e){e.addDisplayType((()=>{const t=(r=e,(0,o.ConfigurationSchema)("LinearAlignmentsDisplay",{pileupDisplay:r.getDisplayType("LinearPileupDisplay").configSchema,snpCoverageDisplay:r.getDisplayType("LinearSNPCoverageDisplay").configSchema,height:{type:"number",defaultValue:250}},{baseConfiguration:D.Ki,explicitlyTyped:!0}));var r;return new L.A({name:"LinearAlignmentsDisplay",displayName:"Alignments display (combination)",configSchema:t,stateModel:j(e,t),trackType:"AlignmentsTrack",viewType:"LinearGenomeView",ReactComponent:$})}))}var _=r(93100),U=r(20561);const J=(0,E.lazy)((()=>r.e(489).then(r.bind(r,80489)))),X=new Map([["snpcoverage","SNPCoverageRenderer"]]),Y=function(e,t){return l.types.compose("LinearSNPCoverageDisplay",(0,b._i)(e,t),l.types.model({type:l.types.literal("LinearSNPCoverageDisplay"),drawInterbaseCounts:l.types.maybe(l.types.boolean),drawIndicators:l.types.maybe(l.types.boolean),drawArcs:l.types.maybe(l.types.boolean),filterBy:l.types.optional(U.O2,{}),colorBy:l.types.maybe(l.types.model({type:l.types.string,tag:l.types.maybe(l.types.string)})),jexlFilters:l.types.optional(l.types.array(l.types.string),[])})).volatile((()=>({modificationTagMap:B.observable.map({}),modificationsReady:!1}))).actions((e=>({setConfig(t){e.configuration=t},setFilterBy(t){e.filterBy=(0,l.cast)(t)},setColorBy(t){e.colorBy=(0,l.cast)(t)},setJexlFilters(t){e.jexlFilters=(0,l.cast)(t)},updateModificationColorMap(t){t.forEach((t=>{e.modificationTagMap.has(t)||e.modificationTagMap.set(t,A.N2[t]||(0,A.XL)())}))}}))).views((e=>{const{renderProps:t}=e;return{get rendererConfig(){const t=(0,o.getConf)(e,["renderers",e.rendererTypeName])||{};return e.rendererType.configSchema.create({...t,drawInterbaseCounts:e.drawInterbaseCounts??t.drawInterbaseCounts,drawIndicators:e.drawIndicators??t.drawIndicators,drawArcs:e.drawArcs??t.drawArcs},(0,l.getEnv)(e))},get drawArcsSetting(){return e.drawArcs??(0,o.readConfObject)(this.rendererConfig,"drawArcs")},get drawInterbaseCountsSetting(){return e.drawInterbaseCounts??(0,o.readConfObject)(this.rendererConfig,"drawInterbaseCounts")},get drawIndicatorsSetting(){return e.drawIndicators??(0,o.readConfObject)(this.rendererConfig,"drawIndicators")},get autorunReady(){return(0,y.getContainingView)(e).initialized&&e.featureDensityStatsReady&&!e.regionTooLarge&&!e.error},get renderReady(){return!t().notReady&&e.modificationsReady},get ready(){return this.renderReady},renderProps(){const r=t(),{colorBy:n,filterBy:a,modificationTagMap:o}=e;return{...r,notReady:!this.ready,filters:e.filters,modificationTagMap:Object.fromEntries(o.toJSON()),colorBy:n?(0,l.getSnapshot)(n):void 0,filterBy:(0,l.getSnapshot)(a)}}}})).actions((e=>({setModificationsReady(t){e.modificationsReady=t},toggleDrawIndicators(){e.drawIndicators=!e.drawIndicatorsSetting},toggleDrawInterbaseCounts(){e.drawInterbaseCounts=!e.drawInterbaseCountsSetting},toggleDrawArcs(){e.drawArcs=!e.drawArcsSetting}}))).actions((e=>({afterAttach(){(0,A.vi)(e,(async()=>{if(e.setModificationsReady(!1),!e.autorunReady)return;const t=(0,y.getContainingView)(e),{staticBlocks:r}=t,{colorBy:n}=e;if("modifications"===n?.type){const t=(0,o.getConf)(e.parentTrack,"adapter"),n=await(0,U.Y8)({self:e,adapterConfig:t,blocks:r});(0,l.isAlive)(e)&&(e.updateModificationColorMap(n),e.setModificationsReady(!0))}else e.setModificationsReady(!0)}),{delay:1e3})}}))).views((e=>{const{trackMenuItems:t}=e;return{get TooltipComponent(){return J},get adapterConfig(){return{type:"SNPCoverageAdapter",subadapter:(0,o.getConf)(e.parentTrack,"adapter")}},get rendererTypeName(){return X.get("snpcoverage")},get needsScalebar(){return!0},contextMenuItems:()=>[],trackMenuItems:()=>[...t(),{label:"Draw insertion/clipping indicators",type:"checkbox",checked:e.drawIndicatorsSetting,onClick:()=>{e.toggleDrawIndicators()}},{label:"Draw insertion/clipping counts",type:"checkbox",checked:e.drawInterbaseCountsSetting,onClick:()=>{e.toggleDrawInterbaseCounts()}},{label:"Draw arcs",type:"checkbox",checked:e.drawArcsSetting,onClick:()=>{e.toggleDrawArcs()}}],get filters(){return new _.A({filters:e.jexlFilters})}}}))};function K(e){e.addDisplayType((()=>{const t=function(e){return(0,o.ConfigurationSchema)("LinearSNPCoverageDisplay",{autoscale:{type:"stringEnum",defaultValue:"local",model:l.types.enumeration("Autoscale type",["local"]),description:"performs local autoscaling (no other options for SNP Coverage available)"},minScore:{type:"number",defaultValue:Number.MIN_VALUE,description:"minimum value for the y-scale"},maxScore:{type:"number",description:"maximum value for the y-scale",defaultValue:Number.MAX_VALUE},scaleType:{type:"stringEnum",model:l.types.enumeration("Scale type",["linear","log"]),description:"The type of scale to use",defaultValue:"linear"},inverted:{type:"boolean",description:"draw upside down",defaultValue:!1},multiTicks:{type:"boolean",description:"Display multiple values for the ticks",defaultValue:!1},renderers:(0,o.ConfigurationSchema)("RenderersConfiguration",{SNPCoverageRenderer:e.getRendererType("SNPCoverageRenderer").configSchema})},{baseConfiguration:D.Ki,explicitlyTyped:!0})}(e);return new L.A({name:"LinearSNPCoverageDisplay",displayName:"SNPCoverage display",configSchema:t,stateModel:Y(e,t),trackType:"AlignmentsTrack",viewType:"LinearGenomeView",ReactComponent:b.r})}))}var Q=r(58921),Z=r(53794),ee=r(28669);const te=(0,E.lazy)((()=>r.e(2989).then(r.bind(r,12989)))),re=function(e){return l.types.compose("LinearReadArcsDisplay",Q.BaseDisplay,(0,D._e)(),(0,D.e6)(),l.types.model({type:l.types.literal("LinearReadArcsDisplay"),configuration:(0,o.ConfigurationReference)(e),filterBy:l.types.optional(U.O2,{}),lineWidth:l.types.maybe(l.types.number),jitter:l.types.maybe(l.types.number),colorBy:l.types.maybe(l.types.model({type:l.types.string,tag:l.types.maybe(l.types.string),extra:l.types.frozen()})),drawInter:!0,drawLongRange:!0})).volatile((()=>({loading:!1,chainData:void 0,lastDrawnOffsetPx:void 0,lastDrawnBpPerPx:0,ref:null}))).actions((e=>({setLastDrawnOffsetPx(t){e.lastDrawnOffsetPx=t},setLastDrawnBpPerPx(t){e.lastDrawnBpPerPx=t},setLoading(t){e.loading=t},reload(){e.error=void 0},setRef(t){e.ref=t},setColorScheme(t){e.colorBy=(0,l.cast)(t)},setChainData(t){e.chainData=t},setDrawInter(t){e.drawInter=t},setDrawLongRange(t){e.drawLongRange=t},setFilterBy(t){e.filterBy=(0,l.cast)(t)},setLineWidth(t){e.lineWidth=t},setJitter(t){e.jitter=t}}))).views((e=>({get drawn(){return void 0!==e.lastDrawnOffsetPx},get lineWidthSetting(){return e.lineWidth??(0,o.getConf)(e,"lineWidth")},get jitterVal(){return e.jitter??(0,o.getConf)(e,"jitter")}}))).views((e=>{const{trackMenuItems:t,renderProps:r}=e;return{renderProps:()=>({...r(),notReady:!e.chainData}),trackMenuItems:()=>[...t(),{label:"Filter by",icon:ee.A,onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[te,{model:e,handleClose:t}]))}},{label:"Line width",subMenu:[{label:"Thin",onClick:()=>{e.setLineWidth(1)}},{label:"Bold",onClick:()=>{e.setLineWidth(2)}},{label:"Extra bold",onClick:()=>{e.setLineWidth(5)}}]},{label:"Jitter x-positions",subMenu:[{type:"checkbox",checked:0===e.jitterVal,label:"None",onClick:()=>{e.setJitter(0)}},{type:"checkbox",checked:2===e.jitterVal,label:"Small",onClick:()=>{e.setJitter(2)}},{type:"checkbox",checked:10===e.jitterVal,label:"Large",onClick:()=>{e.setJitter(10)}}]},{label:"Draw inter-region vertical lines",type:"checkbox",checked:e.drawInter,onClick:()=>{e.setDrawInter(!e.drawInter)}},{label:"Draw long range connections",type:"checkbox",checked:e.drawLongRange,onClick:()=>{e.setDrawLongRange(!e.drawLongRange)}},{label:"Color scheme",icon:Z.A,subMenu:[{label:"Insert size ± 3σ and orientation",onClick:()=>{e.setColorScheme({type:"insertSizeAndOrientation"})}},{label:"Insert size ± 3σ",onClick:()=>{e.setColorScheme({type:"insertSize"})}},{label:"Orientation",onClick:()=>{e.setColorScheme({type:"orientation"})}},{label:"Insert size gradient",onClick:()=>{e.setColorScheme({type:"gradient"})}}]}]}})).views((e=>({async renderSvg(t){const{renderSvg:n}=await r.e(9028).then(r.bind(r,59028)),{drawFeats:a}=await r.e(3304).then(r.bind(r,63304));return n(e,t,a)}}))).actions((e=>({afterAttach(){(async()=>{try{const{doAfterAttach:t}=await r.e(9070).then(r.bind(r,9070)),{drawFeats:n}=await r.e(3304).then(r.bind(r,63304));t(e,n)}catch(t){console.error(t),e.setError(t)}})()}})))};function ne(e){e.addDisplayType((()=>{const t=function(e){return(0,o.ConfigurationSchema)("LinearReadArcsDisplay",{maxFeatureScreenDensity:{type:"number",description:"maximum features per pixel that is displayed in the view",defaultValue:5},lineWidth:{type:"number",description:"set arc line width",defaultValue:1},jitter:{type:"number",description:"jitters the x position so e.g. if many reads map to exact same x position, jittering makes it easy to see that there are many of them",defaultValue:0},colorScheme:{type:"stringEnum",model:l.types.enumeration("colorScheme",["strand","normal","insertSize","insertSizeAndOrientation","mappingQuality","tag"]),description:"color scheme to use",defaultValue:"normal"}},{baseConfiguration:(0,D.lw)(e),explicitlyTyped:!0})}(e);return new L.A({name:"LinearReadArcsDisplay",displayName:"Arc display",configSchema:t,stateModel:re(t),trackType:"AlignmentsTrack",viewType:"LinearGenomeView",subDisplay:{type:"LinearAlignmentsDisplay",lowerPanel:!0},ReactComponent:(0,E.lazy)((()=>r.e(2424).then(r.bind(r,52424))))})}))}const ae=(0,E.lazy)((()=>r.e(2989).then(r.bind(r,12989)))),oe=function(e){return l.types.compose("LinearReadCloudDisplay",Q.BaseDisplay,(0,D._e)(),(0,D.e6)(),l.types.model({type:l.types.literal("LinearReadCloudDisplay"),configuration:(0,o.ConfigurationReference)(e),filterBy:l.types.optional(U.O2,{}),colorBy:l.types.maybe(l.types.model({type:l.types.string,tag:l.types.maybe(l.types.string),extra:l.types.frozen()})),drawSingletons:!0})).volatile((()=>({loading:!1,chainData:void 0,lastDrawnOffsetPx:void 0,lastDrawnBpPerPx:0,ref:null}))).actions((e=>({setDrawSingletons(t){e.drawSingletons=t},setLastDrawnOffsetPx(t){e.lastDrawnOffsetPx=t},setLastDrawnBpPerPx(t){e.lastDrawnBpPerPx=t},setLoading(t){e.loading=t},reload(){e.error=void 0},setRef(t){e.ref=t},setColorScheme(t){e.colorBy=(0,l.cast)(t)},setChainData(t){e.chainData=t},setFilterBy(t){e.filterBy=(0,l.cast)(t)}}))).views((e=>({get drawn(){return void 0!==e.lastDrawnOffsetPx}}))).views((e=>{const{trackMenuItems:t,renderProps:n}=e;return{renderProps:()=>({...n(),notReady:!e.chainData}),trackMenuItems:()=>[...t(),{label:"Draw singletons",type:"checkbox",checked:e.drawSingletons,onClick:()=>{e.setDrawSingletons(!e.drawSingletons)}},{label:"Filter by",icon:ee.A,onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[ae,{model:e,handleClose:t}]))}},{label:"Color scheme",icon:Z.A,subMenu:[{label:"Insert size ± 3σ and orientation",onClick:()=>{e.setColorScheme({type:"insertSizeAndOrientation"})}},{label:"Insert size ± 3σ",onClick:()=>{e.setColorScheme({type:"insertSize"})}},{label:"Orientation",onClick:()=>{e.setColorScheme({type:"orientation"})}},{label:"Insert size gradient",onClick:()=>{e.setColorScheme({type:"gradient"})}}]}],async renderSvg(t){const{renderSvg:n}=await r.e(9028).then(r.bind(r,59028)),{drawFeats:a}=await r.e(6946).then(r.bind(r,26946));return n(e,t,a)}}})).actions((e=>({afterAttach(){(async()=>{try{const{doAfterAttach:t}=await r.e(9070).then(r.bind(r,9070)),{drawFeats:n}=await r.e(6946).then(r.bind(r,26946));t(e,n)}catch(t){console.error(t),e.setError(t)}})()}})))};function ie(e){e.addDisplayType((()=>{const t=function(e){return(0,o.ConfigurationSchema)("LinearReadCloudDisplay",{maxFeatureScreenDensity:{type:"number",description:"maximum features per pixel that is displayed in the view",defaultValue:5},featureHeight:{type:"number",defaultValue:7},colorScheme:{type:"stringEnum",model:l.types.enumeration("colorScheme",["strand","normal","insertSize","insertSizeAndOrientation","mappingQuality","tag"]),description:"color scheme to use",defaultValue:"normal"}},{baseConfiguration:(0,D.lw)(e),explicitlyTyped:!0})}(e);return new L.A({name:"LinearReadCloudDisplay",displayName:"Read cloud display",configSchema:t,stateModel:oe(t),trackType:"AlignmentsTrack",viewType:"LinearGenomeView",subDisplay:{type:"LinearAlignmentsDisplay",lowerPanel:!0},ReactComponent:(0,E.lazy)((()=>r.e(8408).then(r.bind(r,26027))))})}))}var se=r(58273);function le(e){e.addTrackType((()=>{const t=(r=e,(0,o.ConfigurationSchema)("AlignmentsTrack",{},{baseConfiguration:(0,Q.createBaseTrackConfig)(r)}));var r;const n=new se.A({name:"AlignmentsTrack",displayName:"Alignments track",configSchema:t,stateModel:(0,V.createBaseTrackModel)(e,"AlignmentsTrack",t)}),a=e.getDisplayType("LinearAlignmentsDisplay");return n.addDisplayType(a),n}))}var ce=r(67736);const de=(0,o.ConfigurationSchema)("AlignmentsFeatureWidget",{});var ue=r(9342);function pe(e){const t=(0,ue.n)(e);return l.types.compose(t,l.types.model("AlignmentsFeatureWidget",{type:l.types.literal("AlignmentsFeatureWidget")}))}function me(e){e.addWidgetType((()=>new ce.A({name:"AlignmentsFeatureWidget",heading:"Feature details",configSchema:de,stateModel:pe(e),ReactComponent:(0,E.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(246),r.e(8984),r.e(5132)]).then(r.bind(r,55132))))})))}var ge=r(82088),he=r(44728),fe=r(2406);class ye extends fe.A{async serializeArguments(e,t){const{rootModel:r}=this.pluginManager,n=r?.session?.assemblyManager;if(!n)throw new Error("no assembly manager available");const a=await(0,y.renameRegionsIfNeeded)(n,e);return super.serializeArguments(a,t)}}class be extends ye{name="PileupGetReducedFeatures";async execute(e,t){const r=await this.deserializeArguments(e,t),{adapterConfig:n,sessionId:a,regions:o}=r,i=(await(0,S.cK)(this.pluginManager,a,n)).dataAdapter,s=await(0,he._)(i.getFeaturesInMultipleRegions(o,r).pipe((0,ge.$)())),l=(0,y.dedupe)(s.map((e=>({id:e.id(),refName:e.get("refName"),name:e.get("name"),start:e.get("start"),strand:e.get("strand"),end:e.get("end"),flags:e.get("flags"),tlen:e.get("template_length"),pair_orientation:e.get("pair_orientation"),next_ref:e.get("next_ref"),next_pos:e.get("next_pos"),clipPos:e.get("clipPos"),SA:(0,A.bH)(e,"SA")}))),(e=>e.id)),c=l.filter((e=>2&e.flags&&!(256&e.flags)&&!(2048&e.flags))),d=c.length?function(e){const t=e.map((e=>Math.abs(e.tlen))),r=t.reduce(((e,t)=>e+t),0),n=t.map((e=>e*e)).reduce(((e,t)=>e+t),0),a=t.length,o=r/a,i=Math.sqrt((a*n-r*r)/(a*a));return{upper:o+4*i,lower:o-3*i,avg:o,sd:i}}(c):void 0,u=(0,y.groupBy)(l,(e=>e.name));return{chains:Object.values(u),stats:d,hasPaired:!!d,containsNoTransferables:!0}}}var we=r(80544);class ve extends ye{name="PileupGetVisibleModifications";async execute(e,t){const{adapterConfig:r,sessionId:n,regions:a}=await this.deserializeArguments(e,t),o=(await(0,S.cK)(this.pluginManager,n,r)).dataAdapter,i=await(0,he._)(o.getFeaturesInMultipleRegions(a).pipe((0,ge.$)())),s=new Set;return i.forEach((e=>{(0,we.getModificationTypes)((0,A.c$)(e,"MM","Mm")||"").forEach((e=>s.add(e)))})),[...s]}}class Ce extends ye{name="PileupGetGlobalValueForTag";async execute(e,t){const{adapterConfig:r,sessionId:n,regions:a,tag:o}=await this.deserializeArguments(e,t),i=(await(0,S.cK)(this.pluginManager,n,r)).dataAdapter.getFeaturesInMultipleRegions(a),s=await(0,he._)(i.pipe((0,ge.$)()));return[...new Set(s.map((e=>(0,A.bH)(e,o))).filter((e=>void 0!==e)).map((e=>`${e}`)))]}}function Se(e){e.addRpcMethod((()=>new Ce(e))),e.addRpcMethod((()=>new ve(e))),e.addRpcMethod((()=>new be(e)))}var ke=r(91468);function Te(e){e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="CramAdapter",o=(0,ke.getFileName)(t),i={type:a,cramLocation:t,craiLocation:r||(0,ke.makeIndex)(t,".crai")};return/\.cram$/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BamAdapter",o=(0,ke.getFileName)(t),i=r&&(0,ke.getFileName)(r),s={type:a,bamLocation:t,index:{location:r||(0,ke.makeIndex)(t,".bai"),indexType:(0,ke.makeIndexType)(i,"CSI","BAI")}};return/\.bam$/i.test(o)&&!n||n===a?s:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"BamAdapter"===t||"CramAdapter"===t?"AlignmentsTrack":e(t)))}const xe=function(e){return(0,o.ConfigurationSchema)("LinearPileupDisplay",{defaultRendering:{type:"stringEnum",model:l.types.enumeration("Rendering",["pileup"]),defaultValue:"pileup"},renderers:(0,o.ConfigurationSchema)("RenderersConfiguration",{PileupRenderer:e.getRendererType("PileupRenderer").configSchema}),maxFeatureScreenDensity:{type:"number",description:"maximum features per pixel that is displayed in the view",defaultValue:5},colorScheme:{type:"stringEnum",model:l.types.enumeration("colorScheme",["strand","normal","insertSize","insertSizeAndOrientation","mappingQuality","tag"]),description:"color scheme to use",defaultValue:"normal"}},{baseConfiguration:(0,D.lw)(e),explicitlyTyped:!0})};var Ae=r(1633),Pe=r(91049),Me=r(11008),Ee=r(39794),Re=r(31409),Ie=r.n(Re),Ne=r(90542),Fe=r(63670),Le=r(36715);const De=(0,R.observer)((function({model:e}){const{sortedBy:t}=e;return t?E.createElement("div",{"data-testid":`blurb-${t}`},E.createElement(Le.A,{color:"secondary",variant:"caption"},`Sorted by ${t.tag??t.type} at ${t.refName}:${t.pos}`)):null})),Be=De;var Ve=r(36917);const ze=(0,E.lazy)((()=>r.e(2989).then(r.bind(r,12989)))),Oe=(0,E.lazy)((()=>r.e(6043).then(r.bind(r,8424)))),He=(0,E.lazy)((()=>r.e(5369).then(r.bind(r,55369)))),je=(0,E.lazy)((()=>r.e(9589).then(r.bind(r,49589)))),We=new Map([["pileup","PileupRenderer"],["svg","SvgFeatureRenderer"]]);function Ge(e){return l.types.compose(D.Lr,l.types.model({configuration:(0,o.ConfigurationReference)(e),featureHeight:l.types.maybe(l.types.number),noSpacing:l.types.maybe(l.types.boolean),fadeLikelihood:l.types.maybe(l.types.boolean),trackMaxHeight:l.types.maybe(l.types.number),colorBy:Ve.Qg,filterBy:l.types.optional(U.O2,{}),jexlFilters:l.types.optional(l.types.array(l.types.string),[])})).volatile((()=>({colorTagMap:B.observable.map({}),featureUnderMouseVolatile:void 0,tagsReady:!1}))).views((e=>({get autorunReady(){return(0,y.getContainingView)(e).initialized&&e.featureDensityStatsReady&&!e.regionTooLarge}}))).actions((e=>({setTagsReady(t){e.tagsReady=t},setMaxHeight(t){e.trackMaxHeight=t},setFeatureHeight(t){e.featureHeight=t},setNoSpacing(t){e.noSpacing=t},setColorScheme(t){e.colorTagMap=B.observable.map({}),e.colorBy=(0,l.cast)(t),t.tag&&(e.tagsReady=!1)},updateColorTagMap(t){const r=["#BBCCEE","pink","#CCDDAA","#EEEEBB","#FFCCCC","lightblue","lightgreen","tan","#CCEEFF","lightsalmon"];t.forEach((t=>{if(!e.colorTagMap.has(t)){const n=[...e.colorTagMap.keys()].length;e.colorTagMap.set(t,r[n])}}))},setFeatureUnderMouse(t){e.featureUnderMouseVolatile=t},selectFeature(t){const r=(0,y.getSession)(e);if((0,y.isSessionModelWithWidgets)(r)){const n=r.addWidget("AlignmentsFeatureWidget","alignmentFeature",{featureData:t.toJSON(),view:(0,y.getContainingView)(e),track:(0,y.getContainingTrack)(e)});r.showWidget(n)}r.setSelection(t)},copyFeatureToClipboard(t){const{uniqueId:r,...n}=t.toJSON(),a=(0,y.getSession)(e);Ie()(JSON.stringify(n,null,4)),a.notify("Copied to clipboard","success")},setConfig(t){e.configuration=t},setFilterBy(t){e.filterBy=(0,l.cast)(t)},setJexlFilters(t){e.jexlFilters=(0,l.cast)(t)}}))).views((e=>({get rendererConfig(){const{featureHeight:t,noSpacing:r,trackMaxHeight:n,rendererTypeName:a}=e,i=(0,o.getConf)(e,["renderers",a])||{};return e.rendererType.configSchema.create({...i,...void 0!==t?{height:t}:{},...void 0!==r?{noSpacing:r}:{},...void 0!==n?{maxHeight:n}:{}},(0,y.getEnv)(e))}}))).views((e=>({get maxHeight(){return(0,o.readConfObject)(e.rendererConfig,"maxHeight")},get featureHeightSetting(){return(0,o.readConfObject)(e.rendererConfig,"height")},get featureUnderMouse(){return e.featureUnderMouseVolatile},renderReady:()=>e.tagsReady,get filters(){return new _.A({filters:e.jexlFilters})}}))).views((e=>{const{trackMenuItems:t,renderProps:r}=e;return{get rendererTypeName(){const t=(0,o.getConf)(e,"defaultRendering"),r=We.get(t);if(!r)throw new Error(`unknown alignments view name ${t}`);return r},contextMenuItems(){const t=e.contextMenuFeature;return t?[{label:"Open feature details",icon:Fe.A,onClick:()=>{e.clearFeatureSelection(),e.selectFeature(t)}},{label:"Copy info to clipboard",icon:Ne.PM,onClick:()=>{e.copyFeatureToClipboard(t)}}]:[]},get DisplayBlurb(){return Be},renderPropsPre(){const{colorTagMap:t,colorBy:n,filterBy:a,rpcDriverName:o}=e,i=r();return{...i,notReady:i.notReady||!e.renderReady(),rpcDriverName:o,displayModel:e,colorBy:n?(0,l.getSnapshot)(n):void 0,filterBy:JSON.parse(JSON.stringify(a)),filters:e.filters,colorTagMap:Object.fromEntries(t.toJSON()),config:e.rendererConfig,async onFeatureClick(t,r){const n=(0,y.getSession)(e),{rpcManager:a}=n;try{const t=r||e.featureIdUnderMouse;if(t){const r=(0,ke.getRpcSessionId)(e),{feature:n}=await a.call(r,"CoreGetFeatureDetails",{featureId:t,sessionId:r,layoutId:(0,y.getContainingView)(e).id,rendererType:"PileupRenderer"});n&&e.selectFeature(new y.SimpleFeature(n))}else e.clearFeatureSelection()}catch(e){console.error(e),n.notify(`${e}`)}},onClick(){e.clearFeatureSelection()},async onFeatureContextMenu(t,r){const n=(0,y.getSession)(e),{rpcManager:a}=n;try{const t=r||e.featureIdUnderMouse;if(t){const r=(0,ke.getRpcSessionId)(e),{feature:n}=await a.call(r,"CoreGetFeatureDetails",{featureId:t,sessionId:r,layoutId:(0,y.getContainingView)(e).id,rendererType:"PileupRenderer"});n&&e.setContextMenuFeature(new y.SimpleFeature(n))}else e.clearFeatureSelection()}catch(e){console.error(e),n.notify(`${e}`)}}}},colorSchemeSubMenuItems:()=>[{label:"Normal",onClick:()=>{e.setColorScheme({type:"normal"})}},{label:"Mapping quality",onClick:()=>{e.setColorScheme({type:"mappingQuality"})}},{label:"Strand",onClick:()=>{e.setColorScheme({type:"strand"})}},{label:"Per-base quality",onClick:()=>{e.setColorScheme({type:"perBaseQuality"})}},{label:"Per-base lettering",onClick:()=>{e.setColorScheme({type:"perBaseLettering"})}},{label:"First-of-pair strand",onClick:()=>{e.setColorScheme({type:"stranded"})}},{label:"Color by tag...",onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[Oe,{model:e,handleClose:t}]))}}],trackMenuItems:()=>[...t(),{label:"Set feature height...",priority:1,subMenu:[{label:"Normal",onClick:()=>{e.setFeatureHeight(7),e.setNoSpacing(!1)}},{label:"Compact",onClick:()=>{e.setFeatureHeight(2),e.setNoSpacing(!0)}},{label:"Manually set height",onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[He,{model:e,handleClose:t}]))}}]},{label:"Set max height...",priority:-1,onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[je,{model:e,handleClose:t}]))}},{label:"Filter by...",icon:ee.A,onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[ze,{model:e,handleClose:t}]))}}]}})).views((e=>({renderProps:()=>e.renderPropsPre()}))).actions((e=>({afterAttach(){(0,A.vi)(e,(async()=>{const t=(0,y.getContainingView)(e);if(!e.autorunReady)return;const{colorBy:r,tagsReady:n}=e,{staticBlocks:a}=t;if(r?.tag&&!n){const t=await(0,U.s_)({self:e,tag:r.tag,blocks:a});e.updateColorTagMap(t)}e.setTagsReady(!0)}),{delay:1e3}),(0,l.addDisposer)(e,(0,B.autorun)((async()=>{const t=(0,y.getSession)(e);try{const r=e.featureIdUnderMouse;if(e.featureUnderMouse?.id()!==r)if(r){const n=(0,ke.getRpcSessionId)(e),a=(0,y.getContainingView)(e),{feature:o}=await t.rpcManager.call(n,"CoreGetFeatureDetails",{featureId:r,sessionId:n,layoutId:a.id,rendererType:"PileupRenderer"});o&&e.featureIdUnderMouse===o.uniqueId&&e.setFeatureUnderMouse(new y.SimpleFeature(o))}else e.setFeatureUnderMouse(void 0)}catch(e){console.error(e),t.notifyError(`${e}`,e)}})))}})))}const $e=(0,E.lazy)((()=>r.e(2697).then(r.bind(r,32697)))),qe=(0,E.lazy)((()=>r.e(4806).then(r.bind(r,74806)))),_e=(0,E.lazy)((()=>r.e(1696).then(r.bind(r,1696)))),Ue=function(e){return l.types.compose("LinearPileupDisplay",Ge(e),l.types.model({type:l.types.literal("LinearPileupDisplay"),configuration:(0,o.ConfigurationReference)(e),showSoftClipping:!1,mismatchAlpha:l.types.maybe(l.types.boolean),sortedBy:l.types.maybe(l.types.model({type:l.types.string,pos:l.types.number,tag:l.types.maybe(l.types.string),refName:l.types.string,assemblyName:l.types.string}))})).volatile((()=>({sortReady:!1,currSortBpPerPx:0,modificationTagMap:B.observable.map({}),modificationsReady:!1}))).actions((e=>({setCurrSortBpPerPx(t){e.currSortBpPerPx=t},updateModificationColorMap(t){t.forEach((t=>{e.modificationTagMap.has(t)||e.modificationTagMap.set(t,A.N2[t]||(0,A.XL)())}))},setModificationsReady(t){e.modificationsReady=t},setSortReady(t){e.sortReady=t},clearSelected(){e.sortedBy=void 0},toggleSoftClipping(){e.showSoftClipping=!e.showSoftClipping},toggleMismatchAlpha(){e.mismatchAlpha=!e.mismatchAlpha},setSortedBy(t,r){const{centerLineInfo:n}=(0,y.getContainingView)(e);if(!n)return;const{refName:a,assemblyName:o,offset:i}=n,s=Math.round(i)+1;s<0||!a||(e.sortReady=!1,e.sortedBy={type:t,pos:s,refName:a,assemblyName:o,tag:r})},setFeatureHeight(t){e.sortReady=!1,e.featureHeight=t}}))).actions((e=>{const t=e.reload;return{reload(){e.clearSelected(),t()}}})).views((e=>({get rendererConfig(){const{featureHeight:t,noSpacing:r,trackMaxHeight:n,mismatchAlpha:a,rendererTypeName:i}=e,s=(0,o.getConf)(e,["renderers",i])||{};return e.rendererType.configSchema.create({...s,...void 0!==t?{height:t}:{},...void 0!==r?{noSpacing:r}:{},...void 0!==a?{mismatchAlpha:a}:{},...void 0!==n?{maxHeight:n}:{}},(0,y.getEnv)(e))}}))).views((e=>{const{renderReady:t}=e;return{get mismatchAlphaSetting(){return(0,o.readConfObject)(e.rendererConfig,"mismatchAlpha")},renderReady(){const r=(0,y.getContainingView)(e);return e.modificationsReady&&e.currSortBpPerPx===r.bpPerPx&&t()}}})).views((e=>{const{trackMenuItems:t,renderPropsPre:r,renderProps:n,colorSchemeSubMenuItems:a}=e;return{renderPropsPre(){const{sortedBy:t,showSoftClipping:n,modificationTagMap:a}=e;return{...r(),showSoftClip:n,sortedBy:t,modificationTagMap:Object.fromEntries(a.toJSON())}},renderProps(){const{sortReady:t}=e,r=n();return{...r,notReady:r.notReady||!t}},trackMenuItems:()=>[...t(),{label:"Sort by...",icon:Pe.A,disabled:e.showSoftClipping,subMenu:[...["Start location","Read strand","Base pair"].map((t=>({label:t,onClick:()=>{e.setSortedBy(t)}}))),{label:"Sort by tag...",onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[$e,{model:e,handleClose:t}]))}},{label:"Clear sort",onClick:()=>{e.clearSelected()}}]},{label:"Color by...",icon:Ee.A,subMenu:[{label:"Pair orientation",onClick:()=>{e.setColorScheme({type:"pairOrientation"})}},{label:"Modifications or methylation",onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[_e,{model:e,handleClose:t}]))}},{label:"Insert size",onClick:()=>{e.setColorScheme({type:"insertSize"})}},...a()]},{label:"Group by...",icon:Me.A,onClick:()=>{(0,y.getSession)(e).queueDialog((t=>[qe,{model:e,handleClose:t}]))}},{label:"Show soft clipping",icon:Ae.A,type:"checkbox",checked:e.showSoftClipping,onClick:()=>{e.toggleSoftClipping(),e.showSoftClipping&&e.clearSelected()}},{label:"Fade mismatches by quality",type:"checkbox",checked:e.mismatchAlphaSetting,onClick:()=>{e.toggleMismatchAlpha()}}]}})).actions((e=>({afterAttach(){(0,A.vi)(e,(async()=>{const t=(0,y.getContainingView)(e);e.autorunReady&&e.setCurrSortBpPerPx(t.bpPerPx)}),{delay:1e3}),(0,A.vi)(e,(async()=>{const{rpcManager:t}=(0,y.getSession)(e),r=(0,y.getContainingView)(e);if(!e.autorunReady)return;const{sortedBy:n,adapterConfig:a,rendererType:o,sortReady:i}=e,{bpPerPx:s}=r;if(n&&(!i||e.currSortBpPerPx===r.bpPerPx)){const{pos:i,refName:s,assemblyName:l}=n;await e.rendererType.renderInClient(t,{assemblyName:l,regions:[{start:i,end:i+1,refName:s,assemblyName:l}],adapterConfig:a,rendererType:o.name,sessionId:(0,ke.getRpcSessionId)(e),layoutId:r.id,timeout:1e6,...e.renderPropsPre()})}e.setCurrSortBpPerPx(s),e.setSortReady(!0)}),{delay:1e3}),(0,A.vi)(e,(async()=>{if(!e.autorunReady)return;const{parentTrack:t,colorBy:r}=e,{staticBlocks:n}=(0,y.getContainingView)(e);if("modifications"===r?.type){const r=(0,o.getConf)(t,["adapter"]),a=await(0,U.Y8)({self:e,adapterConfig:r,blocks:n});e.updateModificationColorMap(a)}e.setModificationsReady(!0)}))}})))};function Je(e){e.addDisplayType((()=>{const t=xe(e);return new L.A({name:"LinearPileupDisplay",displayName:"Pileup display",configSchema:t,stateModel:Ue(t),subDisplay:{type:"LinearAlignmentsDisplay",lowerPanel:!0},trackType:"AlignmentsTrack",viewType:"LinearGenomeView",ReactComponent:D.GQ})}))}class Xe extends n.A{name="AlignmentsPlugin";install(e){[d,s,Je,K,le,g,p,F,Se,v,ne,ie,q,me,Te].map((t=>{t(e)}))}}},36917:(e,t,r)=>{"use strict";r.d(t,{DW:()=>u,L9:()=>s,Qg:()=>p,pf:()=>o,sY:()=>c,w7:()=>i});var n=r(36422),a=r(86576);const o={color_fwd_strand_not_proper:"#ECC8C8",color_rev_strand_not_proper:"#BEBED8",color_fwd_strand:"#EC8B8B",color_rev_strand:"#8F8FD8",color_fwd_missing_mate:"#D11919",color_rev_missing_mate:"#1919D1",color_fwd_diff_chr:"#000",color_rev_diff_chr:"#969696",color_pair_lr:"#c8c8c8",color_pair_rr:"navy",color_pair_rl:"teal",color_pair_ll:"green",color_nostrand:"#c8c8c8",color_interchrom:"purple",color_longinsert:"red",color_shortinsert:"pink",color_unknown:"grey"},i={color_fwd_strand_not_proper:"#CA6767",color_rev_strand_not_proper:"#7272AA",color_fwd_strand:"#DC2A2A",color_rev_strand:"#4141BA",color_fwd_missing_mate:"#921111",color_rev_missing_mate:"#111192",color_fwd_diff_chr:"#000000",color_rev_diff_chr:"#696969",color_pair_lr:"#8C8C8C",color_pair_rr:"#00005A",color_pair_rl:"#005A5A",color_pair_ll:"#005A00",color_nostrand:"#8C8C8C",color_interchrom:"#5A005A",color_longinsert:"#B30000",color_shortinsert:"#FF3A5C",color_unknown:"grey"};function s(e,t,r){const n=e.refName===t.refName,a=Math.abs(e.tlen||0);return n&&a>(r?.upper||0)?[o.color_longinsert,i.color_longinsert]:n&&a<(r?.lower||0)?[o.color_shortinsert,i.color_shortinsert]:n?void 0:[o.color_interchrom,i.color_interchrom]}const l=[o.color_unknown,o.color_unknown];function c(e,t,r){return d(e)||s(e,t,r)||l}function d(e){const t=a.il.fr[e.pair_orientation||""],r=a.rr[t];return"LR"===t?void 0:[o[r],i[r]]}function u(e){return d(e)||l}const p=n.types.maybe(n.types.model({type:n.types.string,tag:n.types.maybe(n.types.string),extra:n.types.frozen()}))},20561:(e,t,r)=>{"use strict";r.d(t,{O2:()=>l,Y8:()=>s,s_:()=>i});var n=r(36422),a=r(99546),o=r(91468);async function i({self:e,tag:t,blocks:r,opts:n}){const{rpcManager:i}=(0,a.getSession)(e),{adapterConfig:s}=e,l=(0,o.getRpcSessionId)(e);return await i.call((0,o.getRpcSessionId)(e),"PileupGetGlobalValueForTag",{adapterConfig:s,tag:t,sessionId:l,regions:r.contentBlocks,...n})}async function s({self:e,adapterConfig:t,blocks:r,opts:n}){const{rpcManager:i}=(0,a.getSession)(e),s=(0,o.getRpcSessionId)(e);return await i.call(s,"PileupGetVisibleModifications",{adapterConfig:t,sessionId:s,regions:r.contentBlocks,...n})}const l=n.types.model({flagInclude:n.types.optional(n.types.number,0),flagExclude:n.types.optional(n.types.number,1540),readName:n.types.maybe(n.types.string),tagFilter:n.types.maybe(n.types.model({tag:n.types.string,value:n.types.maybe(n.types.string)}))})},86576:(e,t,r)=>{"use strict";r.d(t,{Iw:()=>u,N2:()=>m,XL:()=>h,bH:()=>s,c$:()=>l,il:()=>c,k_:()=>p,rr:()=>d,vi:()=>g});var n=r(82088),a=r(44728),o=r(36422),i=r(42489);function s(e,t){const r=e.get("tags");return void 0!==r?r[t]:e.get(t)}function l(e,t,r){return s(e,t)??s(e,r)}const c={fr:{F1R2:"LR",F2R1:"LR",F1F2:"LL",F2F1:"LL",R1R2:"RR",R2R1:"RR",R1F2:"RL",R2F1:"RL"},rf:{R1F2:"LR",R2F1:"LR",R1R2:"LL",R2R1:"LL",F1F2:"RR",F2F1:"RR",F1R2:"RL",F2R1:"RL"},ff:{F2F1:"LR",R1R2:"LR",F2R1:"LL",R1F2:"LL",R2F1:"RR",F1R2:"RR",R2R1:"RL",F1F2:"RL"}},d={LR:"color_pair_lr",LL:"color_pair_ll",RR:"color_pair_rr",RL:"color_pair_rl"};async function u(e,t){const{start:r,end:o,originalRefName:i,refName:s}=e,l=await(0,a._)(t.getFeatures({...e,refName:i||s,end:o+1,start:Math.max(0,r-1)}).pipe((0,n.$)()));return l[0]?.get("seq")}function p(e){return"methylation"===e}const m={m:"rgb(255,0,0)",h:"rgb(11, 132, 165)",o:"rgb(111, 78, 129)",f:"rgb(246, 200, 95)",c:"rgb(157, 216, 102)",g:"rgb(255, 160, 86)",e:"rgb(141, 221, 208)",b:"rgb(202, 71, 47)"};function g(e,t,r){(0,o.addDisposer)(e,(0,i.autorun)((async()=>{try{await t()}catch(t){(0,o.isAlive)(e)&&e.setError(t)}}),r))}function h(){return`hsl(${200*Math.random()}, 50%, 50%)`}},49473:(e,t,r)=>{"use strict";r.d(t,{E6:()=>d,Ec:()=>c,Tp:()=>l,eW:()=>s,y$:()=>u});var n=r(7552),a=r(99546);const[,o,,i]=[0,1,2,3];function s(e,t,r,n){return n?n(t,r):e[r].trackRefs[t]?.getBoundingClientRect().top||0}function l(e,t,r){return(e.bpToPx({refName:t,coord:r})?.offsetPx||0)-e.offsetPx}function c(e,t,r,n,l,c){const d=n[t].displays[0],u=d.height;let p=0;const{SNPCoverageDisplay:m}=d;m&&(p=m.height);const g=c?0:d.scrollTop;return(0,a.clamp)(l[o]-g+((h=l)[i]-h[o])/2+p,0,u)+s(r,e,t,c)+d.scrollTop;var h}const d=e=>{const[,t]=(0,n.useState)();(0,n.useEffect)((()=>{t(e)}),[e])};function u(e,t=[],r=[],...n){const a=new Set(r.map((t=>e(t)))),o=t.filter((t=>a.has(e(t))));return 0===n.length?o:u(e,o,...n)}},14349:(e,t,r)=>{"use strict";r.d(t,{DO:()=>E,dg:()=>V,kO:()=>B,Ay:()=>z});var n=r(99546),a=r(12678),o=r(7552),i=r(63589),s=r(36422),l=r(8832),c=r(42489),d=r(45465),u=r(68584),p=r(1622),m=r(90542),g=r(29417),h=r(64502);function f(e,t,r,n,a){const o=Math.abs(e-r);if(o>n)return;o===n&&a.push([t,e]);const i=Math.sqrt(n*n-o*o);a.push([t-i,e],[t+i,e])}function y(e,t,r,n,a){const o=Math.abs(e-t);if(o>n)return;o===n&&a.push([e,r]);const i=Math.sqrt(n*n-o*o);a.push([e,r-i],[e,r+i])}function b(e,t){const r=Math.sqrt(e*e+t*t);if(0===r)return[0,0];const n=function(e,t){let r=(Math.atan(t/e)+2*Math.PI)%(2*Math.PI);return e<0&&(t<=0?r+=Math.PI:r-=Math.PI),r}(e,t);return[r,n]}const w=2*Math.PI;class v{constructor(e,t,r,a){this.region=t,this.offsetRadians=r,this.radianWidth=a;const{bpPerRadian:o}=e;this.key="regions"in t?JSON.stringify(t.regions):(0,n.assembleLocString)(t),this.bpPerRadian=o,this.flipped=!1,this.startRadians=r,this.endRadians=t.widthBp/this.bpPerRadian+r,Object.freeze(this)}bpToXY(e,t){let r;r=this.region.elided?this.region.widthBp/2:this.flipped?this.region.end-e:e-this.region.start;const a=r/this.bpPerRadian+this.offsetRadians;return(0,n.polarToCartesian)(t,a)}toJSON(){return Object.fromEntries(Object.entries(this))}}const C=(0,o.lazy)((()=>r.e(5243).then(r.bind(r,15243)))),S=function(e){return s.types.compose("CircularView",p.BaseViewModel,s.types.model({type:s.types.literal("CircularView"),offsetRadians:-Math.PI/2,bpPerPx:200,tracks:s.types.array(e.pluggableMstType("track","stateModel")),hideVerticalResizeHandle:!1,hideTrackSelectorButton:!1,lockedFitToWindow:!0,disableImportForm:!1,height:s.types.optional(s.types.refinement("trackHeight",s.types.number,(e=>e>=40)),400),displayedRegions:s.types.array(l.Region),scrollX:0,scrollY:0,minimumRadiusPx:25,spacingPx:10,paddingPx:80,lockedPaddingPx:100,minVisibleWidth:6,minimumBlockWidth:20,trackSelectorType:"hierarchical"})).volatile((()=>({volatileWidth:void 0,error:void 0}))).views((e=>({get width(){if(void 0===e.volatileWidth)throw new Error("wait for view to be initialized first before accessing width");return e.volatileWidth},get visibleSection(){const{scrollX:t,scrollY:r,width:n,height:a}=e;return function(e,t,r){let[n,a,o,i]=e;const[s,l]=t;if(n-=s,a-=s,o-=l,i-=l,n<0&&a>0&&o<0&&i>0){const e=[[n,o],[a,o],[n,i],[a,i]];let t=Number.NEGATIVE_INFINITY;for(const[r,n]of e){const e=Math.sqrt(r*r+n*n);e>t&&(t=e)}return{rho:[0,Math.min(r,t)],theta:[0,2*Math.PI]}}const c=[[n,o],[a,o],[n,i],[a,i]];y(n,0,0,r,c),y(a,0,0,r,c),f(o,0,0,r,c),f(i,0,0,r,c),-n<r&&c.push([n,0]),a<r&&c.push([a,0]),-o<r&&c.push([0,o]),i<r&&c.push([0,i]);const d=n>=0?-1:1;let u=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;for(const[e,t]of c)if(e>=n&&e<=a&&t>=o&&t<=i){const[n,a]=b(e*d,t*d);n<=r+.001&&(a<m&&n>1e-4&&(m=a),a>g&&n>1e-4&&(g=a),n<u&&(u=n),n>p&&(p=n))}return-1===d&&(m+=Math.PI,g+=Math.PI),m>2*Math.PI&&g>2*Math.PI&&(m-=2*Math.PI,g-=2*Math.PI),{rho:[u,Math.min(r,p)],theta:[m,g]}}([t,t+n,r,r+a],this.centerXY,this.radiusPx)},get circumferencePx(){let t=0;for(const e of this.elidedRegions)t+=e.widthBp;return t/e.bpPerPx+e.spacingPx*this.elidedRegions.length},get radiusPx(){return this.circumferencePx/(2*Math.PI)},get bpPerRadian(){return e.bpPerPx*this.radiusPx},get pxPerRadian(){return this.radiusPx},get centerXY(){return[this.radiusPx+e.paddingPx,this.radiusPx+e.paddingPx]},get totalBp(){let t=0;for(const r of e.displayedRegions)t+=r.end-r.start;return t},get maximumRadiusPx(){return e.lockedFitToWindow?Math.min(e.width,e.height)/2-e.lockedPaddingPx:1e6},get maxBpPerPx(){const t=2*Math.PI*e.minimumRadiusPx;return this.totalBp/t},get minBpPerPx(){const e=2*Math.PI*this.maximumRadiusPx;return(0,n.clamp)(this.totalBp/e,1e-10,this.maxBpPerPx)},get atMaxBpPerPx(){return e.bpPerPx>=this.maxBpPerPx},get atMinBpPerPx(){return e.bpPerPx<=this.minBpPerPx},get tooSmallToLock(){return this.minBpPerPx<=1e-10},get figureDimensions(){return[2*this.radiusPx+2*e.paddingPx,2*this.radiusPx+2*e.paddingPx]},get figureWidth(){return this.figureDimensions[0]},get figureHeight(){return this.figureDimensions[1]},get elidedRegions(){const t=[];e.displayedRegions.forEach((r=>{const n=r.end-r.start;if(n/e.bpPerPx<e.minVisibleWidth){const e=t.at(-1);e?.elided?(e.regions.push({...r}),e.widthBp+=n):t.push({elided:!0,widthBp:n,regions:[{...r}]})}else t.push({...r,widthBp:n,elided:!1})}));for(let e=0;e<t.length;e+=1){const r=t[e];r.elided&&1===r.regions.length&&(t[e]={...r,...r.regions[0],elided:!1})}return t},get assemblyNames(){const t=[];return e.displayedRegions.forEach((e=>{t.includes(e.assemblyName)||t.push(e.assemblyName)})),t},get initialized(){const{assemblyManager:t}=(0,n.getSession)(e);return void 0!==e.volatileWidth&&this.assemblyNames.every((e=>t.get(e)?.initialized))}}))).views((e=>({get staticSlices(){return function(e){const t=[];let r=0;const{bpPerRadian:n,spacingPx:a,pxPerRadian:o}=e;for(const i of e.elidedRegions){const s=i.widthBp/n+a/o;t.push(new v(e,i,r,s)),r+=s}return t}(e)}}))).views((e=>({get visibleStaticSlices(){return e.staticSlices.filter((t=>function(e,t){const{theta:[r,n]}=e.visibleSection;return a=t.offsetRadians+e.offsetRadians,i=r,s=n-r,!((o=t.radianWidth)<=0||s<=0)&&(o+1e-4>=w||s+1e-4>=w||(a=(a%w+w)%w+w)<(i=(i%w+w)%w+w)+s&&a+o>i||a<(i-=w)+s&&a+o>i||a<(i+=w+w)+s&&a+o>i);var a,o,i,s}(e,t)))}}))).actions((t=>({setWidth:e=>(t.volatileWidth=Math.max(e,100),t.volatileWidth),setHeight:e=>(t.height=Math.max(e,40),t.height),resizeHeight(e){const r=t.height,n=this.setHeight(t.height+e);return this.setModelViewWhenAdjust(!t.tooSmallToLock),n-r},resizeWidth(e){const r=t.width,n=this.setWidth(t.width+e);return this.setModelViewWhenAdjust(!t.tooSmallToLock),n-r},rotateClockwiseButton(){this.rotateClockwise(Math.PI/6)},rotateCounterClockwiseButton(){this.rotateCounterClockwise(Math.PI/6)},rotateClockwise(e=.17){t.offsetRadians+=e},rotateCounterClockwise(e=.17){t.offsetRadians-=e},zoomInButton(){this.setBpPerPx(t.bpPerPx/1.4)},zoomOutButton(){this.setBpPerPx(1.4*t.bpPerPx)},setBpPerPx(e){t.bpPerPx=(0,n.clamp)(e,t.minBpPerPx,t.maxBpPerPx)},setModelViewWhenAdjust(e){t.lockedFitToWindow&&e&&this.setBpPerPx(t.minBpPerPx)},setDisplayedRegions(e){const r=0===t.displayedRegions.length;t.displayedRegions=(0,s.cast)(e),r?this.setBpPerPx(t.minBpPerPx):this.setBpPerPx(t.bpPerPx)},activateTrackSelector(){if("hierarchical"===t.trackSelectorType){const e=(0,n.getSession)(t);if((0,n.isSessionModelWithWidgets)(e)){const r=e.addWidget("HierarchicalTrackSelectorWidget","hierarchicalTrackSelector",{view:t});return e.showWidget(r),r}}throw new Error(`invalid track selector type ${t.trackSelectorType}`)},toggleTrack(e){return!this.hideTrack(e)&&(this.showTrack(e),!0)},setError(e){t.error=e},showTrack(r,n={}){const a=e.pluggableConfigSchemaType("track"),o=(0,s.resolveIdentifier)(a,(0,s.getRoot)(t),r),i=e.getTrackType(o.type);if(!i)throw new Error(`unknown track type ${o.type}`);const l=e.getViewType(t.type),c=new Set(l.displayTypes.map((e=>e.name))),d=o.displays.find((e=>c.has(e.type))),u=i.stateModel.create({...n,type:o.type,configuration:o,displays:[{type:d.type,configuration:d}]});t.tracks.push(u)},addTrackConf(r,n={}){const{type:a}=r,o=(0,u.readConfObject)(r,"name"),i=e.getTrackType(a);if(!i)throw new Error(`unknown track type ${a}`);const s=e.getViewType(t.type),l=new Set(s.displayTypes.map((e=>e.name))),c=r.displays.find((e=>l.has(e.type)));t.tracks.push(i.stateModel.create({...n,name:o,type:a,configuration:r,displays:[{type:c.type,configuration:c}]}))},hideTrack(r){const n=e.pluggableConfigSchemaType("track"),a=(0,s.resolveIdentifier)(n,(0,s.getRoot)(t),r),o=t.tracks.filter((e=>e.configuration===a));return(0,c.transaction)((()=>{o.forEach((e=>t.tracks.remove(e)))})),o.length},toggleFitToWindowLock(){return t.lockedFitToWindow=!t.lockedFitToWindow,this.setModelViewWhenAdjust(t.atMinBpPerPx),t.lockedFitToWindow},async exportSvg(e={}){const{renderToSvg:n}=await r.e(311).then(r.bind(r,60311)),a=await n(t,e),o=new Blob([a],{type:"image/svg+xml"});(0,d.saveAs)(o,e.filename||"image.svg")}}))).views((e=>({menuItems:()=>[{label:"Return to import form",onClick:()=>{e.setDisplayedRegions([])},icon:g.A},{label:"Export SVG",icon:h.A,onClick:()=>{(0,n.getSession)(e).queueDialog((t=>[C,{model:e,handleClose:t}]))}},{label:"Open track selector",onClick:e.activateTrackSelector,icon:m.xU}]})))};var k=r(98450),T=r(68446);const x=(0,r(75785).n9)()((e=>{const{primary:t,secondary:r,tertiary:n,quaternary:a}=e.palette;return{path:{strokeDasharray:187,strokeDashoffset:50,animation:"$dash 1.4s ease-in-out infinite, $colors 5.6s ease-in-out infinite"},"@keyframes colors":{"0%":{stroke:t.light},"25%":{stroke:r.light},"50%":{stroke:n.light},"75%":{stroke:a.light},"100%":{stroke:t.light}},"@keyframes dash":{"0%":{strokeDashoffset:2},"50%":{strokeDashoffset:.5,transform:"rotate(135deg)"},"100%":{strokeDashoffset:2,transform:"rotate(720deg)"}}}})),A=(0,T.observer)((function({model:{renderProps:{radius:e}}}){const{classes:t}=x(),[r,n]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=setTimeout((()=>{n(!0)}),400);return()=>{clearTimeout(e)}})),r?o.createElement("g",null,o.createElement("defs",null,o.createElement("pattern",{id:"diagonalHatch",width:"10",height:"10",patternTransform:"rotate(45 0 0)",patternUnits:"userSpaceOnUse"},o.createElement("line",{x1:"0",y1:"0",x2:"0",y2:"10",style:{stroke:"rgba(255,255,255,0.5)",strokeWidth:10}}))),o.createElement("circle",{cx:"0",cy:"0",r:e,fill:"#f1f1f1"}),o.createElement("circle",{cx:"0",cy:"0",r:e,fill:"url(#diagonalHatch)"}),o.createElement("text",{x:"0",y:"0",transform:"rotate(90 0 0)",dominantBaseline:"middle",textAnchor:"middle"},"Loading…"),o.createElement("circle",{className:t.path,fill:"none",strokeWidth:"4",strokeLinecap:"round",cx:"0",cy:"0",r:"60"})):null})),P=(0,T.observer)((function({model:e}){const{renderProps:{radius:t},error:r}=e;return o.createElement("g",null,o.createElement("defs",null,o.createElement("pattern",{id:"diagonalHatch",width:"10",height:"10",patternTransform:"rotate(45 0 0)",patternUnits:"userSpaceOnUse"},o.createElement("line",{x1:"0",y1:"0",x2:"0",y2:"10",style:{stroke:"rgba(255,0,0,0.5)",strokeWidth:10}}))),o.createElement("circle",{cx:"0",cy:"0",r:t,fill:"#ffb4b4"}),o.createElement("circle",{cx:"0",cy:"0",r:t,fill:"url(#diagonalHatch)"}),o.createElement("text",{x:"0",y:"0",transform:"rotate(90 0 0)",dominantBaseline:"middle",textAnchor:"middle"},String(r)))})),M=P,E=(0,T.observer)((function({display:e}){return e.error?o.createElement(M,{model:e}):e.filled?e.reactElement:o.createElement(A,{model:e})}));var R=r(33039),I=r.n(R),N=r(94318),F=r(91468);function L(e){const t=(0,n.getContainingView)(e),{rendererType:r}=e,{rpcManager:a}=(0,n.getSession)(t);return{rendererType:r,rpcManager:a,renderProps:e.renderProps(),renderArgs:{assemblyName:t.displayedRegions[0].assemblyName,adapterConfig:I()(e.adapterConfig),rendererType:r.name,regions:I()(t.displayedRegions),blockDefinitions:e.blockDefinitions,sessionId:(0,F.getRpcSessionId)(e),timeout:1e6}}}async function D(e,t,r){if(!e)throw new Error("cannot render with no props");const{rendererType:n,rpcManager:a,cannotBeRenderedReason:o,renderArgs:i,renderProps:s,exportSVG:l}=e;if(o)return{message:o};if(!s.radius||!i.regions?.length)return{message:"Skipping render"};if(!r.isCompatibleWithRenderer(n))throw new Error(`renderer ${n.name} is not compatible with this display type`);const{html:c,...d}=await n.renderInClient(a,{...i,...s,exportSVG:l});return{html:c,data:d,reactElement:d.reactElement,renderingComponent:n.ReactComponent}}const B=(0,u.ConfigurationSchema)("BaseChordDisplay",{onChordClick:{type:"boolean",description:"callback that should be run when a chord in the track is clicked",defaultValue:!1,contextVariable:["feature","track","pluginManager"]}},{explicitIdentifier:"displayId"}),V=s.types.compose("BaseChordDisplay",p.BaseDisplay,s.types.model({bezierRadiusRatio:.1,assemblyName:s.types.maybe(s.types.string),configuration:(0,u.ConfigurationReference)(B)})).volatile((()=>({filled:!1,reactElement:void 0,data:void 0,html:void 0,message:"",renderingComponent:void 0,refNameMap:void 0}))).actions((e=>{const{pluginManager:t}=(0,n.getEnv)(e),r=e;return{onChordClick(n){(0,u.getConf)(e,"onChordClick",{feature:n,track:r,pluginManager:t})}}})).views((e=>({get blockDefinitions(){const t=(0,n.getContainingView)(e).staticSlices;if(!e.refNameMap)return t;const r=I()(t);return r.forEach((t=>{(t.region.elided?t.region.regions:[t.region]).forEach((t=>{const r=e.refNameMap?.[t.refName];r&&t.refName!==r&&(t.refName=r)}))})),r},renderProps(){const t=(0,n.getContainingView)(e);return{...(0,F.getParentRenderProps)(e),rpcDriverName:e.rpcDriverName,bezierRadius:t.radiusPx*e.bezierRadiusRatio,radius:t.radiusPx,blockDefinitions:this.blockDefinitions,onChordClick:e.onChordClick}},get rendererType(){return(0,n.getEnv)(e).pluginManager.getRendererType(e.rendererTypeName)},isCompatibleWithRenderer:e=>!!(e instanceof N.A),get selectedFeatureId(){if(!(0,s.isAlive)(e))return;const t=(0,n.getSession)(e),{selection:r}=t;return(0,n.isFeature)(r)?r.id():void 0}}))).actions((e=>({renderStarted(){e.filled=!1,e.message="",e.reactElement=void 0,e.data=void 0,e.html=void 0,e.error=void 0,e.renderingComponent=void 0},renderSuccess({message:t,data:r,reactElement:n,html:a,renderingComponent:o}){t?(e.filled=!1,e.message=t,e.reactElement=void 0,e.data=void 0,e.html=void 0,e.error=void 0,e.renderingComponent=void 0):(e.filled=!0,e.message="",e.reactElement=n,e.data=r,e.html=a,e.error=void 0,e.renderingComponent=o)},renderError(t){console.error(t),e.filled=!1,e.message="",e.reactElement=void 0,e.html=void 0,e.data=void 0,e.error=t,e.renderingComponent=void 0},setRefNameMap(t){e.refNameMap=t}}))).actions((e=>({afterAttach(){(0,n.makeAbortableReaction)(e,L,D,{name:`${e.type} ${e.id} rendering`,fireImmediately:!0},e.renderStarted,e.renderSuccess,e.renderError),(0,n.makeAbortableReaction)(e,(()=>({assemblyNames:(0,F.getTrackAssemblyNames)(e.parentTrack),adapter:(0,u.getConf)((0,s.getParent)(e,2),"adapter"),assemblyManager:(0,n.getSession)(e).assemblyManager})),(async({assemblyNames:t,adapter:r,assemblyManager:n},a)=>n.getRefNameMapForAdapter(r,t[0],{signal:a,sessionId:(0,F.getRpcSessionId)(e)})),{name:`${e.type} ${e.id} getting refNames`,fireImmediately:!0},(()=>{}),(t=>{e.setRefNameMap(t)}),(t=>{console.error(t),e.setError(t)}))}}))).views((e=>({async renderSvg(t){const r=L(e),a=await D({...r,exportSVG:t,theme:t.theme||r.renderProps.theme},0,e);return o.createElement(n.ReactRendering,{rendering:a})}})));class z extends a.A{name="CircularViewPlugin";install(e){!function(e){e.addViewType((()=>new i.A({ReactComponent:(0,o.lazy)((()=>r.e(6205).then(r.bind(r,66205)))),stateModel:S(e),name:"CircularView",displayName:"Circular view"})))}(e),function(e){e.addToExtensionPoint("LaunchView-CircularView",(async({session:e,assembly:t,tracks:r=[]})=>{const{assemblyManager:n}=e,a=e.addView("CircularView",{});if(await(0,c.when)((()=>a.initialized)),!t)throw new Error("No assembly provided when launching circular genome view");const o=await n.waitForAssembly(t);if(!o)throw new Error(`Assembly "${t}" not found when launching circular genome view`);a.setDisplayedRegions(o.regions||[]),r.forEach((e=>{a.showTrack(e)}))}))}(e)}configure(e){(0,n.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToSubMenu(["Add"],{label:"Circular view",icon:k.A,onClick:e=>{e.addView("CircularView",{})}})}}},64248:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(7552),a=r(17125),o=r(1343),i=r(75785),s=r(68446);const l='Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace',c=(0,i.n9)()((e=>({error:{color:"red",fontSize:"0.8em"},callbackEditor:{fontFamily:l,fontSize:"12px",background:e.palette.background.default,width:800,marginTop:"16px",border:"1px solid rgba(0,0,0,0.42)"},callbackContainer:{width:"100%",overflowX:"auto"},textAreaFont:{fontFamily:l}}))),d=(0,s.observer)((function({slot:e}){const{classes:t}=c(),[r,i]=(0,n.useState)(JSON.stringify(e.value,null,2)),[s,l]=(0,n.useState)();return(0,n.useEffect)((()=>{try{l(void 0),e.set(JSON.parse(r))}catch(e){console.error({e}),l(e)}}),[r,e]),n.createElement(n.Fragment,null,s?n.createElement("p",{className:t.error},`${s}`):null,n.createElement("div",{className:t.callbackContainer},n.createElement(a.A,{shrink:!0,htmlFor:"json-editor"},e.name),n.createElement(o.A,{id:"json-editor",className:t.callbackEditor,value:r,helperText:e.description,multiline:!0,onChange:e=>{i(e.target.value)},style:{background:s?"#fdd":void 0},InputProps:{classes:{input:t.textAreaFont}}})))}))},59099:(e,t,r)=>{"use strict";r.d(t,{SS:()=>b,Ay:()=>w});var n=r(7552),a=r(12678),o=r(58921),i=r(68584);const s=(0,i.ConfigurationSchema)("FromConfigAdapter",{features:{type:"frozen",defaultValue:[]}},{explicitlyTyped:!0,implicitIdentifier:"adapterId"}),l=(0,i.ConfigurationSchema)("FromConfigRegionsAdapter",{features:{type:"frozen",defaultValue:[]}},{explicitlyTyped:!0,implicitIdentifier:"adapterId"}),c=(0,i.ConfigurationSchema)("FromConfigSequenceAdapter",{features:{type:"frozen",defaultValue:[]}},{explicitlyTyped:!0,implicitIdentifier:"adapterId"}),d=(0,i.ConfigurationSchema)("RefNameAliasAdapter",{location:{type:"fileLocation",defaultValue:{uri:"/path/to/my/aliases.txt",locationType:"UriLocation"}},refNameColumn:{type:"number",defaultValue:0}},{explicitlyTyped:!0});var u=r(36422),p=r(8832);function m(e){return u.types.model("ConfigurationEditorWidget",{id:p.ElementId,type:u.types.literal("ConfigurationEditorWidget"),target:u.types.safeReference(e.pluggableConfigSchemaType("track"))}).actions((e=>({setTarget(t){e.target=t}})))}const g=(0,r(68446).observer)((function({model:e}){if(e?.target){if(e.target.type)return`${e.target.type} settings`;if((0,u.isStateTreeNode)(e.target)){const t=(0,u.getType)(e.target);if(t.name)return`${t.name.replace("ConfigurationSchema","")} settings`}}return n.createElement(n.Fragment,null,"Settings")})),h=(0,i.ConfigurationSchema)("ConfigurationEditorWidget",{}),f=(0,n.lazy)((()=>Promise.all([r.e(3011),r.e(3162),r.e(1537),r.e(6395),r.e(3614)]).then(r.bind(r,13614)))),y=(0,i.ConfigurationSchema)("NcbiSequenceReportAliasAdapter",{location:{type:"fileLocation",defaultValue:{uri:"/path/to/my/sequence_report.tsv",locationType:"UriLocation"}},useUcscNameOverride:{type:"boolean",defaultValue:!0,description:"forces usage of the UCSC names over the NCBI style names from a FASTA"}},{explicitlyTyped:!0});r(64248);const b=(0,n.lazy)((()=>Promise.all([r.e(3011),r.e(3162),r.e(1537),r.e(6395),r.e(3614)]).then(r.bind(r,13614))));class w extends a.A{name="ConfigurationPlugin";install(e){!function(e){e.addAdapterType((()=>new o.AdapterType({name:"FromConfigAdapter",configSchema:s,getAdapterClass:()=>r.e(6833).then(r.bind(r,86833)).then((e=>e.default)),adapterMetadata:{hiddenFromGUI:!0}})))}(e),function(e){e.addAdapterType((()=>new o.AdapterType({name:"FromConfigRegionsAdapter",configSchema:l,getAdapterClass:()=>r.e(491).then(r.bind(r,80491)).then((e=>e.default)),adapterMetadata:{hiddenFromGUI:!0}})))}(e),function(e){e.addAdapterType((()=>new o.AdapterType({name:"FromConfigSequenceAdapter",configSchema:c,getAdapterClass:()=>r.e(7013).then(r.bind(r,97013)).then((e=>e.default)),adapterMetadata:{hiddenFromGUI:!0}})))}(e),function(e){e.addAdapterType((()=>new o.AdapterType({name:"RefNameAliasAdapter",configSchema:d,getAdapterClass:()=>r.e(2249).then(r.bind(r,92249)).then((e=>e.default)),adapterMetadata:{hiddenFromGUI:!0}})))}(e),function(e){e.addWidgetType((()=>new o.WidgetType({name:"ConfigurationEditorWidget",HeadingComponent:g,configSchema:h,stateModel:m(e),ReactComponent:f})))}(e),function(e){e.addAdapterType((()=>new o.AdapterType({name:"NcbiSequenceReportAliasAdapter",configSchema:y,getAdapterClass:()=>r.e(3175).then(r.bind(r,43175)).then((e=>e.default)),adapterMetadata:{hiddenFromGUI:!0}})))}(e)}}},69426:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(68584),a=r(58921),o=r(7552),i=r(36422),s=r(8832);const l=i.types.model("AddConnectionModel",{id:s.ElementId,type:i.types.literal("AddConnectionWidget")}),c=(0,n.ConfigurationSchema)("AddConnectionWidget",{});function d(e){e.addWidgetType((()=>new a.WidgetType({name:"AddConnectionWidget",heading:"Add a connection",configSchema:c,stateModel:l,ReactComponent:(0,o.lazy)((()=>Promise.all([r.e(5189),r.e(4456)]).then(r.bind(r,44456))))})))}},62367:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(68584),a=r(58921),o=r(7552),i=r(36422),s=r(8832),l=r(91468);function c(e=""){try{return new URL(e),!0}catch(t){return e.startsWith("/")}}function d(e){return i.types.model("AddTrackModel",{id:s.ElementId,type:i.types.literal("AddTrackWidget"),view:i.types.safeReference(e.pluggableMstType("view","stateModel"))}).volatile((()=>({trackSource:"fromFile",trackData:void 0,indexTrackData:void 0,altAssemblyName:"",altTrackName:"",altTrackType:"",adapterHint:"",textIndexTrack:!0,textIndexingConf:void 0}))).actions((e=>({setAdapterHint(t){e.adapterHint=t},setTrackSource(t){e.trackSource=t},setTextIndexingConf(t){e.textIndexingConf=t},setTextIndexTrack(t){e.textIndexTrack=t},setTrackData(t){e.trackData=t},setIndexTrackData(t){e.indexTrackData=t},setAssembly(t){e.altAssemblyName=t},setTrackName(t){e.altTrackName=t},setTrackType(t){e.altTrackType=t},clearData(){e.trackSource="",e.altTrackName="",e.altTrackType="",e.altAssemblyName="",e.adapterHint="",e.indexTrackData=void 0,e.trackData=void 0,e.textIndexingConf=void 0,e.textIndexTrack=!0}}))).views((e=>({get trackAdapter(){const{trackData:t,indexTrackData:r,adapterHint:n}=e;return t?(0,l.guessAdapter)(t,r,n,e):void 0},get trackName(){return e.altTrackName||(e.trackData?(0,l.getFileName)(e.trackData):"")},get isFtp(){const{trackData:t,indexTrackData:r}=e;return!(!r?.uri?.startsWith("ftp://")&&!t?.uri?.startsWith("ftp://"))},get isRelativeTrackUrl(){const t=e.trackData?.uri;return!!t&&!c(t)},get isRelativeIndexUrl(){const t=e.indexTrackData?.uri;return!!t&&!c(t)},get isRelativeUrl(){return this.isRelativeIndexUrl||this.isRelativeTrackUrl},get trackHttp(){return e.trackData?.uri?.startsWith("http://")},get indexHttp(){return e.indexTrackData?.uri?.startsWith("http://")},get wrongProtocol(){return"https:"===window.location.protocol&&(this.trackHttp||this.indexHttp)},get unsupported(){return this.trackAdapter?.type===l.UNSUPPORTED},get assembly(){return e.altAssemblyName||e.view.assemblyNames?.[0]},get trackType(){return e.altTrackType||(this.trackAdapter?(0,l.guessTrackType)(this.trackAdapter.type,e):"")}}))).views((e=>({get warningMessage(){return e.isFtp?"Warning: JBrowse cannot access files using the ftp protocol":e.isRelativeUrl?"Warning: one or more of your files do not provide the protocol e.g.\n https://, please provide an absolute URL unless you are sure a\n relative URL is intended.":e.wrongProtocol?"Warning: You entered a http:// resources but we cannot access HTTP\n resources from JBrowse when it is running on https. Please use an\n https URL for your track, or access the JBrowse app from the http\n protocol":""}})))}const u=(0,n.ConfigurationSchema)("AddTrackWidget",{});function p(e){e.addWidgetType((()=>new a.WidgetType({name:"AddTrackWidget",heading:"Add a track",configSchema:u,stateModel:d(e),ReactComponent:(0,o.lazy)((()=>Promise.all([r.e(5189),r.e(9106),r.e(8704)]).then(r.bind(r,58704))))})))}},6842:(e,t,r)=>{"use strict";function n(e,t){return`${(e.startsWith("metadata.")?t.metadata?.[e.replace("metadata.","")]:t[e])||""}`}r.d(t,{a:()=>n})},68384:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>E});var n=r(36422),a=r(42489),o=r(68584),i=r(99546),s=r(8832),l=r(91468);function c(e=[],t=[]){if(e[0]===t[0])return!0;{const r=new Set(e);return t.some((e=>r.has(e)))}}function d(e,t,r){const n=(0,o.readConfObject)(t,"category")||[],a=e.toLowerCase();return(0,l.getTrackName)(t,r).toLowerCase().includes(a)||!!n.filter((e=>e.toLowerCase().includes(a))).length}function u(e,t,r=0){let n=!1;for(const a of e)a.children.length?u(a.children,t,r+1)&&r>0&&t.push(a.id):n=!0;return n}function p(e,t){for(const r of e)r.children.length&&t.push(r.id)}function m(e,t){const{assemblyManager:r}=(0,i.getSession)(t),{pluginManager:n}=(0,i.getEnv)(t),{view:a}=t;if(!a)return[];const s=t.assemblyNames.map((e=>r.get(e))).filter(i.notEmpty);return e.filter((e=>{const t=(0,o.readConfObject)(e,"assemblyNames"),n=t?.map((e=>r.get(e))).filter(i.notEmpty);return a.trackSelectorAnyOverlap?c(n,s):function(e=[],t=[]){const r=new Set(e);return t.every((e=>r.has(e)))}(n,s)})).filter((e=>{const{displayTypes:t}=n.getViewType(a.type);return c(t.map((e=>e.name)),e.displays.map((e=>e.type)))}))}function g({model:e,trackConfs:t,extra:r,noCategories:n,menuItems:a}){const s={children:[]},{collapsed:c,filterText:u,activeSortTrackNames:p,activeSortCategories:m,view:g}=e;if(!g)return[];const h=(0,i.getSession)(e),f=g.tracks,y=t.filter((e=>d(u,e,h)));for(const e of function(e,t,r){const n=e.map((e=>[e,(0,o.readConfObject)(e,"name"),(0,o.readConfObject)(e,"category")?.[0]||"",(0,o.readConfObject)(e,"category")?.[1]||"",(0,o.readConfObject)(e,"category")?.[2]||""]));return t&&n.sort(((e,t)=>e[1].localeCompare(t[1]))),r&&n.sort(((e,t)=>e[2]!==t[2]?e[2].localeCompare(t[2]):e[3]!==t[3]?e[3].localeCompare(t[3]):e[4]!==t[4]?e[4].localeCompare(t[4]):0)),n.map((e=>e[0]))}(y,p,m)){const t=[...(0,o.readConfObject)(e,"category")||[]];e.trackId.endsWith("sessionTrack")&&t.unshift(" Session tracks");let i=s;if(!n)for(let e=0;e<t.length;e++){const n=t[e],o=i.children.find((e=>e.name===n)),s=[r,t.slice(0,e+1).join(",")].filter((e=>!!e)).join("-");if(o)i=o;else{const e={children:[],name:n,id:s,isOpenByDefault:!c.get(s),menuItems:a,type:"category"};i.children.push(e),i=e}}const d=i.children.findIndex((e=>e.children.length)),u=-1===d?i.children.length:d;i.children.splice(u,0,{id:[r,e.trackId].filter((e=>!!e)).join(","),trackId:e.trackId,name:(0,l.getTrackName)(e,h),conf:e,checked:f.some((t=>t.configuration===e)),children:[],type:"track"})}return s.children}function h(e,t,r){return e.filter((e=>t.map((t=>r(t,e))).filter((e=>!!e)).length>5))}var f=r(6842);const y=["category","adapter","description"];function b(){return"undefined"!=typeof window?[window.location.pathname,new URLSearchParams(window.location.search).get("config")].filter((e=>!!e)).join("-"):"empty"}function w(e){return["recentlyUsedTracks",b(),e.join(",")].filter((e=>!!e)).join("-")}function v(){return`favoriteTracks-${b()}}`}function C(e,t){return["collapsedCategories",b(),e.join(","),t].join("-")}function S(e,t){const r=(0,i.localStorageGetItem)(e);return null!=r&&r?JSON.parse(r):t}function k(e,t){null!=t&&(0,i.localStorageSetItem)(e,JSON.stringify(t))}const T=10;function x(e){return n.types.model("HierarchicalTrackSelectorWidget",{id:s.ElementId,type:n.types.literal("HierarchicalTrackSelectorWidget"),view:n.types.safeReference(e.pluggableMstType("view","stateModel")),faceted:n.types.optional(n.types.model("FacetedModel",{filterText:n.types.optional(n.types.string,""),showSparse:n.types.optional(n.types.boolean,(()=>JSON.parse((0,i.localStorageGetItem)("facet-showSparse")||"false"))),showFilters:n.types.optional(n.types.boolean,(()=>JSON.parse((0,i.localStorageGetItem)("facet-showFilters")||"true"))),showOptions:n.types.optional(n.types.boolean,(()=>JSON.parse((0,i.localStorageGetItem)("facet-showTableOptions")||"false"))),panelWidth:n.types.optional(n.types.number,(()=>JSON.parse((0,i.localStorageGetItem)("facet-panelWidth")||"400")))}).volatile((()=>({visible:{},useShoppingCart:!1,filters:a.observable.map()}))).actions((e=>({setFilter(t,r){e.filters.set(t,r)},setPanelWidth:t=>(e.panelWidth=t,e.panelWidth),setUseShoppingCart(t){e.useShoppingCart=t},setFilterText(t){e.filterText=t},setShowSparse(t){e.showSparse=t},setShowOptions(t){e.showOptions=t},setShowFilters(t){e.showFilters=t}}))).views((e=>({get allTrackConfigurations(){return(0,n.getParent)(e).allTrackConfigurations}}))).views((e=>({get rows(){const t=(0,i.getSession)(e),{allTrackConfigurations:r,filterText:n}=e;return r.filter((e=>d(n,e,t))).map((e=>({id:e.trackId,conf:e,name:(0,l.getTrackName)(e,t),category:(0,o.readConfObject)(e,"category")?.join(", "),adapter:(0,o.readConfObject)(e,"adapter")?.type,description:(0,o.readConfObject)(e,"description"),metadata:(0,o.readConfObject)(e,"metadata")})))}}))).views((e=>({get filteredNonMetadataKeys(){return e.showSparse?y:h(y,e.rows,((e,t)=>e[t]))},get metadataKeys(){return[...new Set(e.rows.flatMap((e=>{return t=e.metadata,Object.entries(t).map((([e,t])=>"string"==typeof t?e:"")).filter((e=>!!e));var t})))]},get filteredMetadataKeys(){return e.showSparse?this.metadataKeys:h(this.metadataKeys,e.rows,((e,t)=>e.metadata[t]))},get fields(){return["name",...this.filteredNonMetadataKeys,...this.filteredMetadataKeys.map((e=>`metadata.${e}`))]},get filteredRows(){const t=[...e.filters.entries()].filter((e=>e[1].length>0)).map((([e,t])=>[e,new Set(t)]));return e.rows.filter((e=>t.every((([t,r])=>r.has((0,f.a)(t,e))))))}}))).actions((e=>({setVisible(t){e.visible=t},afterAttach(){(0,n.addDisposer)(e,(0,a.autorun)((()=>{this.setVisible(Object.fromEntries(e.fields.map((e=>[e,!0]))))})))}}))),{})}).volatile((()=>({favorites:S(v(),[]),recentlyUsed:[],selection:[],sortTrackNames:S("sortTrackNames",void 0),sortCategories:S("sortCategories",void 0),collapsed:a.observable.map(),filterText:"",recentlyUsedCounter:0,favoritesCounter:0}))).views((e=>({get shownTrackIds(){return new Set(e.view?.tracks?.map((e=>e.configuration.trackId)))},get selectionSet(){return new Set(e.selection)},get favoritesSet(){return new Set(e.favorites)},get recentlyUsedSet(){return new Set(e.recentlyUsed)},get assemblyNames(){return e.view?.assemblyNames||[]}}))).actions((e=>({setSortTrackNames(t){e.sortTrackNames=t},setSortCategories(t){e.sortCategories=t},setSelection(t){e.selection=t},addToSelection(t){e.selection=(0,i.dedupe)([...e.selection,...t],(e=>e.trackId))},removeFromSelection(t){const r=new Set(t);e.selection=e.selection.filter((e=>!r.has(e)))},clearSelection(){e.selection=[]},addToFavorites(t){e.favoritesCounter+=1,e.favorites=[...e.favorites,t]},removeFromFavorites(t){e.favorites=e.favorites.filter((e=>e!==t))},clearFavorites(){e.favorites=[]},setRecentlyUsedCounter(t){e.recentlyUsedCounter=t},setRecentlyUsed(t){e.recentlyUsed=t},setFavorites(t){e.favorites=t},setFavoritesCounter(t){e.favoritesCounter=t},addToRecentlyUsed(t){e.recentlyUsed.includes(t)||(e.recentlyUsedCounter=Math.min(e.recentlyUsedCounter+1,T),e.recentlyUsed=e.recentlyUsed.length>=T?[...e.recentlyUsed.slice(1),t]:[...e.recentlyUsed,t])},clearRecentlyUsed(){e.recentlyUsed=[]},setView(t){e.view=t},toggleCategory(t){e.collapsed.set(t,!e.collapsed.get(t))},setCategoryCollapsed(t,r){e.collapsed.set(t,r)},expandAllCategories(){e.collapsed.clear()},setCollapsedCategories(t){e.collapsed.replace(t)},clearFilterText(){e.filterText=""},setFilterText(t){e.filterText=t}}))).views((t=>({isSelected:e=>t.selectionSet.has(e),isFavorite:e=>t.favoritesSet.has(e),isRecentlyUsed:e=>t.recentlyUsedSet.has(e),getRefSeqTrackConf(r){const{assemblyManager:n}=(0,i.getSession)(t),a=n.get(r),o=a?.configuration.sequence,s=e.getViewType(t.view.type);if(o)for(const e of o.displays)if(s.displayTypes.some((t=>t.name===e.type)))return o}}))).views((e=>({get activeSortTrackNames(){return e.sortTrackNames??(0,o.getConf)((0,i.getSession)(e),["hierarchical","sort","trackNames"])},get activeSortCategories(){return e.sortCategories??(0,o.getConf)((0,i.getSession)(e),["hierarchical","sort","categories"])},get configAndSessionTrackConfigurations(){return[...e.assemblyNames.map((t=>e.getRefSeqTrackConf(t))),...m((0,i.getSession)(e).tracks,e)].filter(i.notEmpty)},get allTrackConfigurations(){const{connectionInstances:t=[]}=(0,i.getSession)(e);return[...this.configAndSessionTrackConfigurations,...t.flatMap((e=>e.tracks))]},get allTrackConfigurationTrackIdSet(){return new Map(this.allTrackConfigurations.map((e=>[e.trackId,e])))}}))).views((e=>({get favoriteTracks(){return e.favorites.filter((t=>e.allTrackConfigurationTrackIdSet.has(t))).map((t=>e.allTrackConfigurationTrackIdSet.get(t)))},get recentlyUsedTracks(){return e.recentlyUsed.filter((t=>e.allTrackConfigurationTrackIdSet.has(t))).map((t=>e.allTrackConfigurationTrackIdSet.get(t)))}}))).views((e=>({get allTracks(){const{connectionInstances:t=[]}=(0,i.getSession)(e);return[{group:"Tracks",tracks:e.configAndSessionTrackConfigurations,noCategories:!1,menuItems:[]},...t.flatMap((e=>({group:(0,o.getConf)(e,"name"),tracks:e.tracks,noCategories:!1,menuItems:[]})))]}}))).views((e=>({get hierarchy(){return{name:"Root",id:"Root",isOpenByDefault:!0,type:"category",children:e.allTracks.map((t=>({name:t.group,id:t.group,type:"category",isOpenByDefault:!e.collapsed.get(t.group),menuItems:t.menuItems,children:g({model:e,trackConfs:t.tracks,extra:t.group,noCategories:t.noCategories})})))}}}))).actions((e=>({collapseSubCategories(){const t=[];u(e.hierarchy.children,t);for(const r of t)e.setCategoryCollapsed(r,!0)},collapseTopLevelCategories(){const t=[];for(const r of e.hierarchy.children)r.children.length&&p(r.children,t);for(const r of t)e.setCategoryCollapsed(r,!0)}}))).views((e=>({get hasAnySubcategories(){return e.allTracks.some((e=>e.tracks.some((e=>(0,o.readConfObject)(e,"category")?.length>1))))}}))).actions((e=>({afterAttach(){(0,n.addDisposer)(e,(0,a.autorun)((()=>{const{assemblyNames:t,view:r}=e;if(e.setRecentlyUsed(S(w(t),[])),r){const n=S(C(t,r.type),void 0),a=["hierarchical","defaultCollapsed"],s=(0,i.getSession)(e);if(n)e.setCollapsedCategories(n);else{e.expandAllCategories(),(0,o.getConf)(s,[...a,"topLevelCategories"])&&e.collapseTopLevelCategories(),(0,o.getConf)(s,[...a,"subCategories"])&&e.collapseSubCategories();for(const t of(0,o.getConf)(s,[...a,"categoryNames"]))e.setCategoryCollapsed(`Tracks-${t}`,!0)}}}))),(0,n.addDisposer)(e,(0,a.autorun)((()=>{const{sortTrackNames:t,sortCategories:r,favorites:n,recentlyUsed:a,assemblyNames:o,collapsed:i,view:s}=e;k(w(o),a),k(v(),n),k("sortTrackNames",t),k("sortCategories",r),s&&k(C(o,s.type),i)})))}})))}const A=(0,o.ConfigurationSchema)("HierarchicalTrackSelectorWidget",{});var P=r(58921),M=r(7552);function E(e){e.addWidgetType((()=>new P.WidgetType({name:"HierarchicalTrackSelectorWidget",heading:"Available tracks",configSchema:A,stateModel:x(e),ReactComponent:(0,M.lazy)((()=>Promise.all([r.e(1725),r.e(5331)]).then(r.bind(r,25331))))})))}},679:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(68584),a=r(58921),o=r(7552),i=r(36422),s=r(8832);function l(e){return i.types.model("PluginStoreModel",{id:s.ElementId,type:i.types.literal("PluginStoreWidget"),filterText:"",view:i.types.safeReference(e.pluggableMstType("view","stateModel"))}).actions((e=>({clearFilterText(){e.filterText=""},setFilterText(t){e.filterText=t}})))}const c=(0,n.ConfigurationSchema)("PluginStoreWidget",{});function d(e){e.addWidgetType((()=>new a.WidgetType({name:"PluginStoreWidget",heading:"Plugin store",configSchema:c,stateModel:l(e),ReactComponent:(0,o.lazy)((()=>Promise.all([r.e(3011),r.e(7902)]).then(r.bind(r,87902))))})))}},9043:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(58921),a=r(1622),o=r(68584),i=r(36422);const s=(0,o.ConfigurationSchema)("UCSCTrackHubConnection",{hubTxtLocation:{type:"fileLocation",defaultValue:{uri:"http://mysite.com/path/to/hub.txt",locationType:"UriLocation"},description:"location of the hub file (usually called hub.txt)"},assemblyNames:{type:"stringArray",defaultValue:[],description:"optional list of genomes to import from this track hub, if empty all genomes will be imported"}},{baseConfiguration:a.baseConnectionConfig});function l(e){return i.types.compose("UCSCTrackHubConnection",(0,a.BaseConnectionModelFactory)(e),i.types.model({configuration:(0,o.ConfigurationReference)(s),type:i.types.literal("UCSCTrackHubConnection")})).actions((e=>({async connect(){const{doConnect:t}=await r.e(8435).then(r.bind(r,48435));t(e)}})))}function c(e){e.addConnectionType((()=>new n.ConnectionType({name:"UCSCTrackHubConnection",configSchema:s,stateModel:l(e),displayName:"UCSC Track Hub",description:"A track or assembly hub in the Track Hub format",url:"//genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html#Intro"})))}},90257:(e,t,r)=>{"use strict";function n(e,t,r=!0){const{assemblyName:n,refName:a,start:o,offset:i,oob:s}=t.pxToBp(e),l=Math.floor(o+i);return s?"out of bounds":`${r?`{${n}}`:""}${a}:${l.toLocaleString("en-US")}`}function a(e,t,r){const n=new Set,a=[...e].sort(((e,t)=>{const r=e.end-e.start;return t.end-t.start-r})),o=Array.from({length:Math.round(t)});for(const{key:e,offsetPx:i}of a){const a=Math.round(t-i+r),s=[Math.max(a-12,0),a];0===a||o.slice(...s).some(Boolean)?n.add(e):o.fill(!0,...s)}return n}function o(e,t,r=!0,n=!0){const a=[],o=function(e){const t=60*(e=Math.abs(e));let r=10**+Number(t).toExponential().split(/e/i)[1];for(;r<t&&(r*=2,!(r>=t));)r*=2.5;r=Math.max(r,5);const n=r/e;let a=0;return!(r%10)&&n/10>=15?a=r/10:!(r%5)&&n/5>=15?a=r/5:!(r%2)&&n/2>=15&&(a=r/2),{majorPitch:r,minorPitch:a}}(t),i=o.minorPitch||o.majorPitch;for(const{start:t,end:s,refName:l}of e){let e=0;const c=t,d=s;for(let s=Math.floor(c/i)*i;s<Math.ceil(d/i)*i+1;s+=i)n&&s%o.majorPitch?(a.push({type:"minor",base:s-1,index:e,refName:l}),e+=1):r&&Math.abs(s-t)>o.minorPitch&&(a.push({type:"major",base:s-1,index:e,refName:l}),e+=1)}return a}r.d(t,{H2:()=>o,rQ:()=>a,wJ:()=>n})},42752:(e,t,r)=>{"use strict";r.d(t,{$G:()=>s,Db:()=>l,fK:()=>c});var n=r(7552),a=r(75785),o=r(68446);const i=(0,a.n9)()((e=>({contentBlock:{position:"relative",minHeight:"100%",boxSizing:"border-box",whiteSpace:"nowrap",overflow:"hidden"},elidedBlock:{minHeight:"100%",boxSizing:"border-box",backgroundColor:"#999",backgroundImage:"repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)"},interRegionPaddingBlock:{minHeight:"100%",backgroundColor:e.palette.text.disabled},boundaryPaddingBlock:{minHeight:"100%",backgroundColor:e.palette.action.disabledBackground}}))),s=(0,o.observer)((function({block:e,children:t}){const{classes:r}=i(),{widthPx:a}=e;return n.createElement("div",{style:{width:a},className:r.contentBlock},t)}));function l({width:e}){const{classes:t}=i();return n.createElement("div",{className:t.elidedBlock,style:{width:e}})}function c({boundary:e,width:t,style:r={}}){const{classes:a}=i();return n.createElement("div",{style:{...r,width:t},className:e?a.boundaryPaddingBlock:a.interRegionPaddingBlock})}},37205:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(7552),a=r(9937),o=r(89003);const i=(0,r(75785).n9)()({ellipses:{textOverflow:"ellipsis",overflow:"hidden"}});function s({message:e,severity:t,action:r}){const{classes:s}=i();return n.createElement(a.A,{severity:t,action:r,classes:{message:s.ellipses}},n.createElement(o.A,{title:e},n.createElement("div",null,e)))}},2286:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>c});var n=r(7552),a=r(68584),o=r(49823),i=r(68446);const s=(0,n.lazy)((()=>Promise.resolve().then(r.bind(r,9236)))),l=n.forwardRef((function({message:e},t){return n.createElement("div",{ref:t},n.isValidElement(e)?e:e?n.createElement(o.SanitizedHTML,{html:String(e)}):null)})),c=(0,i.observer)((function({model:e,clientMouseCoord:t}){const{featureUnderMouse:r}=e,o=t[0]+15,i=t[1],c=r?(0,a.getConf)(e,"mouseover",{feature:r}):void 0;return r&&c?n.createElement(n.Suspense,{fallback:null},n.createElement(s,{clientPoint:{x:o,y:i}},n.createElement(l,{message:c}))):null}))},66344:(e,t,r)=>{"use strict";r.d(t,{A:()=>S,s:()=>k});var n=r(36422),a=r(68584),o=r(99546),i=r(8832),s=r(92516),l=r(91468),c=r(7552),d=r(89003),u=r(61723),p=r(75785),m=r(68446),g=r(49823),h=r(4902),f=r(71627),y=r(37205);const b=(0,c.lazy)((()=>Promise.all([r.e(9245),r.e(4630)]).then(r.bind(r,74630)))),w=(0,p.n9)()((e=>{const t=e.palette.action.disabledBackground;return{loading:{paddingLeft:"0.6em",backgroundColor:e.palette.background.default,backgroundImage:`repeating-linear-gradient(45deg, transparent, transparent 5px, ${t} 5px, ${t} 10px)`,textAlign:"center"}}})),v=(0,m.observer)((({model:e})=>{const{classes:t}=w(),{status:r}=e,{message:a}=(0,n.getParent)(e,2),o=a||r;return c.createElement("div",{className:t.loading},c.createElement(g.LoadingEllipses,{message:o}))})),C=(0,m.observer)((function({model:e}){return e.error?c.createElement(y.A,{message:`${e.error}`,severity:"error",action:c.createElement(c.Fragment,null,c.createElement(d.A,{title:"Reload track"},c.createElement(u.A,{"data-testid":"reload_button",onClick:()=>{e.reload()}},c.createElement(h.A,null))),c.createElement(d.A,{title:"Show stack trace"},c.createElement(u.A,{onClick:()=>{(0,o.getSession)(e).queueDialog((t=>[b,{onClose:t,error:e.error}]))}},c.createElement(f.A,null))))}):e.message?c.isValidElement(e.message)?e.message:c.createElement(y.A,{message:`${e.message}`,severity:"info"}):e.filled?e.reactElement:c.createElement(v,{model:e})})),S=n.types.model("BlockState",{key:n.types.string,region:i.Region,reloadFlag:0,isLeftEndOfDisplayedRegion:!1,isRightEndOfDisplayedRegion:!1}).volatile((()=>({renderInProgress:void 0,filled:!1,reactElement:void 0,features:void 0,layout:void 0,status:"",error:void 0,message:void 0,maxHeightReached:!1,ReactComponent:C,renderProps:void 0}))).actions((e=>{let t;return{doReload(){e.reloadFlag=e.reloadFlag+1},afterAttach(){const t=(0,o.getContainingDisplay)(e);setTimeout((()=>{(0,n.isAlive)(e)&&(0,o.makeAbortableReaction)(e,k,T,{name:`${t.id}/${(0,o.assembleLocString)(e.region)} rendering`,delay:t.renderDelay,fireImmediately:!0},this.setLoading,this.setRendered,this.setError)}),t.renderDelay)},setStatus(t){e.status=t},setLoading(r){void 0===t||t.signal.aborted||t.abort(),e.filled=!1,e.message=void 0,e.reactElement=void 0,e.features=void 0,e.layout=void 0,e.error=void 0,e.maxHeightReached=!1,e.renderProps=void 0,t=r},setMessage(r){t&&!t.signal.aborted&&t.abort(),e.filled=!1,e.message=r,e.reactElement=void 0,e.features=void 0,e.layout=void 0,e.error=void 0,e.maxHeightReached=!1,e.renderProps=void 0,t=void 0},setRendered(r){if(!r)return;const{reactElement:n,features:a,layout:o,maxHeightReached:i,renderProps:s}=r;e.filled=!0,e.message=void 0,e.reactElement=n,e.features=a,e.layout=o,e.error=void 0,e.maxHeightReached=i,e.renderProps=s,t=void 0},setError(r){console.error(r),t&&!t.signal.aborted&&t.abort(),e.filled=!1,e.message=void 0,e.reactElement=void 0,e.features=void 0,e.layout=void 0,e.maxHeightReached=!1,e.error=r,e.renderProps=void 0,t=void 0,(0,s.yH)(r)&&this.reload()},reload(){e.renderInProgress=void 0,e.filled=!1,e.reactElement=void 0,e.features=void 0,e.layout=void 0,e.error=void 0,e.message=void 0,e.maxHeightReached=!1,e.ReactComponent=C,e.renderProps=void 0,(0,n.getParent)(e,2).reload()},beforeDestroy(){(async()=>{try{t&&!t.signal.aborted&&t.abort();const r=(0,o.getContainingDisplay)(e),{rpcManager:a}=(0,o.getSession)(e),{rendererType:i}=r,{renderArgs:s}=k((0,n.cast)(e));s&&await i.freeResourcesInClient(a,JSON.parse(JSON.stringify(s)))}catch(e){console.error("Error while destroying block",e)}})()}}}));function k(e,t){try{const r=t||(0,o.getContainingDisplay)(e),{assemblyManager:i,rpcManager:s}=(0,o.getSession)(r),{adapterConfig:c,rendererType:d,error:u,parentTrack:p}=r,m=(0,l.getTrackAssemblyNames)(p),g=e.region.assemblyName;if(!m.includes(g)&&!m.some((e=>i.get(e)?.hasName(g))))throw new Error(`region assembly (${g}) does not match track assemblies (${m})`);const h=r.renderProps(),{config:f}=h;(0,a.readConfObject)(f);const y=(0,l.getRpcSessionId)(r),b=(0,o.getContainingView)(r).id;return{rendererType:d,rpcManager:s,renderProps:h,cannotBeRenderedReason:r.regionCannotBeRendered(e.region),displayError:u,renderArgs:{statusCallback:t=>{(0,n.isAlive)(e)&&e.setStatus(t)},assemblyName:e.region.assemblyName,regions:[(0,n.getSnapshot)(e.region)],adapterConfig:c,rendererType:d.name,sessionId:y,layoutId:b,blockKey:e.key,reloadFlag:e.reloadFlag,timeout:1e6}}}catch(e){return{displayError:e}}}async function T(e,t,r){if(!e)return;const{rendererType:a,renderProps:i,rpcManager:s,renderArgs:l,cannotBeRenderedReason:c,displayError:d}=e;if(!(0,n.isAlive)(r))return;if(d)return void r.setError(d);if(c)return void r.setMessage(c);if(i.notReady)return;const{reactElement:u,features:p,layout:m,maxHeightReached:g}=await a.renderInClient(s,{...l,...i,viewParams:(0,o.getViewParams)(r),signal:t});return{reactElement:u,features:p,layout:m,maxHeightReached:g,renderProps:i}}},21479:(e,t,r)=>{"use strict";r.d(t,{OX:()=>s,W7:()=>i,bf:()=>l});var n=r(99546),a=r(91468),o=r(36422);function i(e){return Math.floor(e/1e6)>0?`${Number.parseFloat((e/1e6).toPrecision(3))} Mb`:Math.floor(e/1e3)>0?`${Number.parseFloat((e/1e3).toPrecision(3))} Kb`:`${Math.floor(e)} bytes`}function s(e,t){const r="undefined"==typeof jest;return["clip",r?e:"jest",t,r?Math.random():""].filter((e=>!!e)).join("-")}async function l(e){const t=(0,n.getContainingView)(e).staticBlocks.contentBlocks,{rpcManager:r}=(0,n.getSession)(e),{adapterConfig:i}=e;if(!i)return{};const s=(0,a.getRpcSessionId)(e);return r.call(s,"CoreGetFeatureDensityStats",{sessionId:s,regions:t,adapterConfig:i,statusCallback:t=>{(0,o.isAlive)(e)&&e.setMessage(t)}})}},84481:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(7552),a=r(68446),o=r(99546),i=r(50574),s=r(76239);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(null,arguments)}function c(e,t,r,n,a){return`M${e},${t}h${r-a}a${a},${a} 0 0 1 ${a},${a}v${n-2*a}a${a},${a} 0 0 1 ${-a},${a}h${a-r}z`}function d(e,t,r,n){return[[e,0],[e+r,n/2],[e,n]].toString()}function u(e,t,r,n){return[[e,n/2],[e+r,0],[e+r,n]].toString()}const p={gneg:"rgb(227,227,227)",gpos25:"rgb(142,142,142)",gpos50:"rgb(85,85,85)",gpos100:"rgb(0,0,0)",gpos75:"rgb(57,57,57)",gvar:"rgb(0,0,0)",stalk:"rgb(127,127,127)",acen:"#800"},m=(0,a.observer)((function({overview:e,block:t,assembly:r}){const{offsetPx:a,reversed:m}=t,g=(0,i.S5)(r,t.refName),h=m?g.length-1:0,f=m?0:g.length-1,y=s.Gu;let b=!1;return n.createElement("g",{transform:`translate(-${a})`},g.map(((t,r)=>{const a=JSON.stringify(t),{refName:i,type:s,start:g,end:w}=t,v=e.bpToPx({refName:i,coord:g})||0,C=e.bpToPx({refName:i,coord:w})||0,S=Math.min(v,C),k=Math.abs(C-v),T=p[s]||"black";return"acen"!==s||b?"acen"===s&&b?n.createElement("polygon",l({key:a,points:m?d(v-k,0,k,y):u(v,0,k,y)},(0,o.getFillProps)(T))):h===r?n.createElement("path",l({key:a,d:(x=S,A=k,P=y,`M${x+8},0h${A-8}v${P}h${8-A}a8,8 0 0 1 -8,-8v${16-P}a8,8 0 0 1 8,-8z`)},(0,o.getFillProps)(T))):f===r?n.createElement("path",l({key:a,d:c(S,0,k,y,8)},(0,o.getFillProps)(T))):n.createElement("rect",l({key:a,x:S,y:0,width:k,height:y},(0,o.getFillProps)(T))):(b=!0,n.createElement("polygon",l({key:a,points:m?u(v-k,0,k,y):d(v,0,k,y)},(0,o.getFillProps)(T))));var x,A,P})))}))},98273:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>ve});var n=r(7552),a=r(75785),o=r(49823),i=r(99546),s=r(68446),l=r(943),c=r(36422),d=r(82725),u=r(72639),p=r(61723),m=r(36715),g=r(68584),h=r(91468),f=r(23758),y=r(17307),b=r(30157),w=r(16217),v=r(374),C=r(91388),S=r(42281),k=r(66195),T=r(21430),x=r(35050);const A=(0,a.n9)()({dragHandle:{cursor:"grab"},dragHandleIcon:{display:"inline-block",verticalAlign:"middle",pointerEvents:"none"}}),P=function({trackId:e,view:t,track:r}){const{classes:a}=A();return n.createElement("span",{draggable:!0,className:a.dragHandle,onDragStart:e=>{const n=e.currentTarget;if(n.parentNode){const a=n.parentNode;e.dataTransfer.setDragImage(a,20,20),t.setDraggingTrackId(r.id)}},onDragEnd:()=>{t.setDraggingTrackId(void 0)},"data-testid":`dragHandle-${t.id}-${e}`},n.createElement(x.A,{className:a.dragHandleIcon,fontSize:"small"}))},M=(0,a.n9)()((e=>({root:{background:(0,u.X4)(e.palette.background.paper,.8),"&:hover":{background:e.palette.background.paper}},trackName:{fontSize:"0.8rem"},iconButton:{padding:e.spacing(1)}}))),E=(0,s.observer)(n.forwardRef((function({track:e,className:t},r){const{classes:a,cx:s}=M(),c=(0,i.getContainingView)(e),d=(0,i.getSession)(e),u=e.configuration,x=e.minimized,A=(0,g.getConf)(e,"trackId"),E=(0,h.getTrackName)(u,d),R=[{label:"Track order",type:"subMenu",priority:2e3,subMenu:[{label:x?"Restore track":"Minimize track",icon:x?v.A:w.A,onClick:()=>{e.setMinimized(!x)}},{label:"Move track to top",icon:S.A,onClick:()=>{c.moveTrackToTop(e.id)}},{label:"Move track up",icon:T.A,onClick:()=>{c.moveTrackUp(e.id)}},{label:"Move track down",icon:k.A,onClick:()=>{c.moveTrackDown(e.id)}},{label:"Move track to bottom",icon:C.A,onClick:()=>{c.moveTrackToBottom(e.id)}}]},...d.getTrackActionMenuItems?.(u)||[],...e.trackMenuItems()].sort(((e,t)=>(t?.priority||0)-(e?.priority||0)));return n.createElement(l.A,{ref:r,className:s(t,a.root)},n.createElement(P,{track:e,trackId:A,view:c}),n.createElement(p.A,{onClick:()=>c.hideTrack(A),className:a.iconButton,title:"close this track"},n.createElement(b.A,{fontSize:"small"})),n.createElement(m.A,{variant:"body1",component:"span",className:a.trackName,onMouseDown:e=>{e.stopPropagation()}},n.createElement(o.SanitizedHTML,{html:[E,x?"(minimized)":""].filter((e=>!!e)).join(" ")})),n.createElement(f.A,{menuItems:R,"data-testid":"track_menu_icon"},n.createElement(y.A,{fontSize:"small"})))}))),R=(0,a.n9)()({trackLabel:{zIndex:3},trackLabelOffset:{position:"relative",display:"inline-block"},trackLabelOverlap:{position:"absolute"}}),I=(0,s.observer)((function({track:e,view:t}){const{classes:r,cx:a}=R(),o=e.displays[0],{trackLabel:i,trackLabelOverlap:s,trackLabelOffset:l}=r,c="overlapping"!==t.trackLabelsSetting||o.prefersOffset?l:s;return"hidden"!==t.trackLabelsSetting?n.createElement(E,{track:e,className:a(i,c)}):null})),N=(0,a.n9)()({renderingComponentContainer:{position:"absolute",left:-1,height:"100%",width:"100%"},trackRenderingContainer:{overflowY:"auto",overflowX:"hidden",whiteSpace:"nowrap",position:"relative",background:"none",zIndex:2}}),F=(0,s.observer)((function({model:e,track:t,onDragEnter:r}){const{classes:a}=N(),i=t.displays[0],{height:s,RenderingComponent:l,DisplayBlurb:c}=i,{trackRefs:d,id:u,scaleFactor:p}=e,m=(0,g.getConf)(t,"trackId"),h=(0,n.useRef)(null),f=t.minimized;return(0,n.useEffect)((()=>(h.current&&(d[m]=h.current),()=>{delete d[m]})),[d,m]),n.createElement("div",{className:a.trackRenderingContainer,style:{height:f?20:s},onScroll:e=>i.setScrollTop(e.currentTarget.scrollTop),onDragEnter:r,"data-testid":`trackRenderingContainer-${u}-${m}`},f?null:n.createElement(n.Fragment,null,n.createElement("div",{ref:h,className:a.renderingComponentContainer,style:{transform:1!==p?`scaleX(${p})`:void 0}},n.createElement(n.Suspense,{fallback:n.createElement(o.LoadingEllipses,null)},n.createElement(l,{model:i,onHorizontalScroll:e.horizontalScroll}))),c?n.createElement("div",{style:{position:"absolute",left:0,top:i.height-20}},n.createElement(c,{model:i})):null))})),L=(0,a.n9)()({root:{marginTop:2},resizeHandle:{height:3,boxSizing:"border-box",position:"relative",zIndex:2}}),D=(0,s.observer)((function({model:e,track:t}){const{classes:r}=L(),a=t.displays[0],{draggingTrackId:i,showTrackOutlines:s}=e,u=(0,n.useRef)(null);return n.createElement(l.A,{ref:u,className:r.root,variant:s?"outlined":void 0,elevation:s?void 0:0,onClick:r=>{if(2===r.detail&&!t.displays[0].featureIdUnderMouse){const t=u.current?.getBoundingClientRect().left||0;e.zoomTo(e.bpPerPx/2,r.clientX-t,!0)}}},n.createElement(I,{track:t,view:e}),n.createElement(d.tH,{FallbackComponent:e=>n.createElement(o.ErrorMessage,{error:e.error})},n.createElement(F,{model:e,track:t,onDragEnter:()=>{(0,c.isAlive)(a)&&void 0!==i&&i!==a.id&&e.moveTrack(i,t.id)}})),n.createElement(o.ResizeHandle,{onDrag:a.resizeHeight,className:r.resizeHandle}))}));var B=r(50574);function V(e,t,r){const[a,o]=(0,n.useState)(),[i,s]=(0,n.useState)(),[l,c]=(0,n.useState)(),[d,u]=(0,n.useState)(),p=void 0!==a&&void 0===l;function m(t){if(r&&!t.shiftKey)return;t.preventDefault(),t.stopPropagation();const n=(0,B.Pn)(t,e.current);o(n),s(n)}function g(t){r?t.shiftKey?u((0,B.Pn)(t,e.current)):u(void 0):u((0,B.Pn)(t,e.current))}function h(){u(void 0),t.setOffsets(void 0,void 0)}function f(){c(void 0),o(void 0),s(void 0)}function y(e,t){t(),f()}(0,n.useEffect)((()=>{function r(t){if(e.current&&p){const r=(0,B.Pn)(t,e.current);s(r)}}function n(r){if(void 0!==a&&e.current){const{clientX:n,clientY:o}=r,i=(0,B.Pn)(r,e.current);c({offsetX:i,clientX:n,clientY:o});const s=function(e){if(void 0===a)return;const r=Math.min(a,e),n=Math.max(a,e);return{leftOffset:t.pxToBp(r),rightOffset:t.pxToBp(n)}}(i);s&&t.setOffsets(s.leftOffset,s.rightOffset),u(void 0)}}return p?(window.addEventListener("mousemove",r),window.addEventListener("mouseup",n),()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n)}):()=>{}}),[a,p,t,e]),(0,n.useEffect)((()=>{!p&&void 0!==i&&void 0!==a&&Math.abs(i-a)<=3&&f()}),[p,i,a]);const b=Boolean(l);if(void 0===a)return{open:b,guideX:d,mouseDown:m,mouseMove:g,mouseOut:h,handleMenuItemClick:y};const w=l?l.offsetX:i||0,v=w<a?w:a,C=Math.abs(w-a);return{open:b,rubberbandOn:!0,mouseDown:m,mouseMove:g,mouseOut:h,handleClose:f,handleMenuItemClick:y,leftBpOffset:t.pxToBp(v),rightBpOffset:t.pxToBp(v+C),anchorPosition:l,numOfBpSelected:Math.ceil(C*t.bpPerPx),width:C,left:v}}var z=r(89003);const O=(0,a.n9)()({guide:{pointerEvents:"none",height:"100%",width:1,position:"absolute",zIndex:10}}),H=(0,s.observer)((function({model:e,coordX:t}){const{classes:r}=O();return n.createElement(z.A,{open:!0,placement:"top",title:(0,i.stringify)(e.pxToBp(t)),arrow:!0},n.createElement("div",{className:r.guide,style:{left:t,background:"red"}}))}));var j=r(91289);const W=(0,a.n9)()({rubberbandControl:{cursor:"crosshair",width:"100%",minHeight:8}}),G=(0,s.observer)((function({model:e,ControlComponent:t=n.createElement("div",null)}){const r=(0,n.useRef)(null),{classes:a}=W(),{guideX:i,rubberbandOn:s,leftBpOffset:l,rightBpOffset:c,numOfBpSelected:d,width:u,left:p,anchorPosition:m,handleMenuItemClick:g,open:h,handleClose:f,mouseMove:y,mouseDown:b,mouseOut:w}=V(r,e);return n.createElement(n.Fragment,null,void 0!==i?n.createElement(H,{model:e,coordX:i}):s?n.createElement(j.A,{leftBpOffset:l,rightBpOffset:c,numOfBpSelected:d,width:u,left:p}):null,m?n.createElement(o.Menu,{anchorReference:"anchorPosition",anchorPosition:{left:m.clientX,top:m.clientY},onMenuItemClick:g,open:h,onClose:f,menuItems:e.rubberBandMenuItems()}):null,n.createElement("div",{"data-testid":"rubberband_controls",className:a.rubberbandControl,ref:r,onMouseDown:b,onMouseMove:y,onMouseOut:w},t))}));var $=r(42752),q=r(27703);const _=(0,a.n9)()((e=>({majorTickLabel:{fontSize:11,zIndex:1,background:e.palette.background.paper,lineHeight:"normal",pointerEvents:"none"},tick:{position:"absolute",width:0,display:"flex",justifyContent:"center",pointerEvents:"none"}}))),U=function({block:e,bpPerPx:t}){const{classes:r}=_(),{reversed:a,start:o,end:s}=e,l=(0,q.H2)(o,s,t,!0,!1);return n.createElement($.$G,{block:e},l.map((({type:e,base:l})=>{if("major"===e){const e=(a?s-l:l-o)/t,c=l+1;return n.createElement("div",{key:l,className:r.tick,style:{left:e}},c?n.createElement(m.A,{className:r.majorTickLabel},(0,i.getTickDisplayStr)(c,t)):null)}return null})))},J=(0,s.observer)((function({model:e}){const{staticBlocks:t,bpPerPx:r}=e;return n.createElement(n.Fragment,null,t.map(((e,t)=>{const{key:a,widthPx:o}=e,i=`${a}-${t}`;return"ContentBlock"===e.type?n.createElement(U,{key:i,block:e,bpPerPx:r}):"ElidedBlock"===e.type?n.createElement($.Db,{key:i,width:o}):"InterRegionPaddingBlock"===e.type?n.createElement($.fK,{key:i,width:o,style:{background:"none"},boundary:"boundary"===e.variant}):null})))})),X=(0,a.n9)()((e=>({refLabel:{fontSize:11,position:"absolute",left:2,top:-1,fontWeight:"bold",lineHeight:"normal",zIndex:1,background:e.palette.background.paper},b0:{left:0,zIndex:100}}))),Y=(0,s.observer)((function({model:e}){const{classes:t,cx:r}=X(),{staticBlocks:a,offsetPx:o,scaleBarDisplayPrefix:i}=e;let s=0;a.forEach(((e,t)=>{e.offsetPx-o<0&&(s=t)}));const l=i(),c=a.blocks[0];return n.createElement(n.Fragment,null,"ContentBlock"!==c?.type&&l?n.createElement(m.A,{className:r(t.b0,t.refLabel)},l):null,a.map(((e,r)=>{const{offsetPx:a,isLeftEndOfDisplayedRegion:i,key:c,type:d,refName:u}=e,p=r=s;return"ContentBlock"===d&&(i||p)?n.createElement(m.A,{key:`refLabel-${c}-${r}`,style:{left:p?Math.max(0,-o):a-o-1,paddingLeft:p?0:1},className:t.refLabel,"data-testid":`refLabel-${u}`},p&&l?`${l}:`:"",u):null})))}));function K(){return K=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},K.apply(null,arguments)}const Q=(0,a.n9)()({container:{overflow:"hidden",position:"relative"},zoomContainer:{position:"relative",zIndex:1},scalebar:{position:"absolute",display:"flex",pointerEvents:"none"}}),Z=(0,s.observer)(n.forwardRef((function({model:e,style:t,className:r,...a},o){const{classes:i,cx:s}=Q(),{staticBlocks:c,offsetPx:d,scaleFactor:u}=e,p=c.offsetPx-d;return n.createElement(l.A,K({"data-resizer":"true",className:s(i.container,r),variant:"outlined",ref:o,style:t},a),n.createElement("div",{className:i.zoomContainer,style:{transform:1!==u?`scaleX(${u})`:void 0}},n.createElement("div",{className:i.scalebar,style:{left:p-1,width:c.totalWidthPx,...t}},n.createElement(J,{model:e}))),n.createElement(Y,{model:e}))}))),ee=(0,a.n9)()((e=>({verticalGuidesZoomContainer:{position:"absolute",height:"100%",width:"100%",zIndex:1,pointerEvents:"none"},verticalGuidesContainer:{position:"absolute",height:"100%",zIndex:1,pointerEvents:"none",display:"flex"},tick:{position:"absolute",height:"100%",width:1},majorTick:{background:e.palette.action.disabled},minorTick:{background:e.palette.divider}})));function te({block:e,bpPerPx:t}){const{classes:r,cx:a}=ee(),o=(0,q.H2)(e.start,e.end,t);return n.createElement($.$G,{block:e},o.map((({type:o,base:i})=>{const s=(e.reversed?e.end-i:i-e.start)/t;return n.createElement("div",{key:i,className:a(r.tick,"major"===o||"labeledMajor"===o?r.majorTick:r.minorTick),style:{left:s}})})))}const re=(0,s.observer)((({model:e})=>{const{staticBlocks:t,bpPerPx:r}=e;return n.createElement(n.Fragment,null,t.map(((e,t)=>{const a=`${e.key}-${t}`;return"ContentBlock"===e.type?n.createElement(te,{key:a,block:e,bpPerPx:r}):"ElidedBlock"===e.type?n.createElement($.Db,{key:a,width:e.widthPx}):"InterRegionPaddingBlock"===e.type?n.createElement($.fK,{key:a,width:e.widthPx,boundary:"boundary"===e.variant}):null})))})),ne=(0,s.observer)((function({model:e}){const{classes:t}=ee(),r=e.staticBlocks.offsetPx-e.offsetPx;return n.createElement("div",{className:t.verticalGuidesZoomContainer,style:{transform:1!==e.scaleFactor?`scaleX(${e.scaleFactor})`:void 0}},n.createElement("div",{className:t.verticalGuidesContainer,style:{left:r,width:e.staticBlocks.totalWidthPx}},n.createElement(re,{model:e})))})),ae=(0,a.n9)()((e=>({centerLineContainer:{background:"transparent",height:"100%",zIndex:5,position:"absolute",border:`1px ${e.palette.action.active} dashed`,borderTop:"none",borderBottom:"none",pointerEvents:"none"},centerLineText:{position:"absolute",pointerEvents:"none",whiteSpace:"nowrap",fontWeight:"bold"}}))),oe=(0,s.observer)((function({model:e}){const{bpPerPx:t,centerLineInfo:r,trackHeights:a,tracks:o,width:i}=e,s=(0,n.useRef)(null),{classes:l}=ae(),c=i/2;return o.length?n.createElement("div",{"data-testid":"centerline_container",className:l.centerLineContainer,role:"presentation",ref:s,style:{left:`${c}px`,width:Math.max(1/t,1)}},r&&n.createElement("div",{"data-testid":"centerline_text",className:l.centerLineText,role:"presentation",style:{left:Math.max(1/t,1)+5,top:a}},r.refName,":"," ",Math.max(Math.round(r.offset)+1,0))):null})),ie=oe;var se=r(87485),le=r(75441),ce=r(11353);const de=(0,a.n9)()((e=>({highlight:{height:"100%",position:"absolute",overflow:"hidden",background:(0,se.M)(e.palette.highlight.main).alpha(.35).toRgbString()},linkIcon:{color:(0,se.M)(e.palette.highlight.main).darken(.2).toRgbString()}}))),ue=(0,s.observer)((function({model:e,highlight:t}){const{classes:r}=de(),[a,s]=(0,n.useState)(!1),l=(0,n.useRef)(null),c=(0,i.getSession)(e),{assemblyManager:d}=c,u=()=>{e.removeHighlight(t)};function m(){s(!1)}const g=d.get(t.assemblyName),h=(t=>{const r=e.bpToPx({refName:t.refName,coord:t.start}),n=e.bpToPx({refName:t.refName,coord:t.end});return r&&n?{width:Math.max(Math.abs(n.offsetPx-r.offsetPx),3),left:Math.min(r.offsetPx,n.offsetPx)-e.offsetPx}:void 0})({...t,refName:g?.getCanonicalRefName(t.refName)??t.refName});return h?n.createElement("div",{className:r.highlight,style:{left:h.left,width:h.width}},n.createElement(z.A,{title:"Highlighted from URL parameter",arrow:!0},n.createElement(p.A,{ref:l,onClick:()=>{s(!0)},style:{zIndex:3}},n.createElement(le.A,{fontSize:"small",className:r.linkIcon}))),n.createElement(o.Menu,{anchorEl:l.current,onMenuItemClick:(e,t)=>{t(c),m()},open:a,onClose:m,menuItems:[{label:"Dismiss highlight",icon:b.A,onClick:()=>{u()}},{label:"Bookmark highlighted region",icon:ce.A,onClick:()=>{let e=c.widgets.get("GridBookmark");e||(e=c.addWidget("GridBookmarkWidget","GridBookmark")),e.addBookmark(t),u()}}]})):null})),pe=(0,s.observer)((function({model:e}){return e.highlight.map(((t,r)=>n.createElement(ue,{key:`${JSON.stringify(t)}-${r}`,model:e,highlight:t})))}));var me=r(76239);const ge=(0,a.n9)()({tracksContainer:{position:"relative",overflow:"hidden"}}),he=(0,s.observer)((function({children:e,model:t}){const{classes:r}=ge(),{pluginManager:a}=(0,i.getEnv)(t),{mouseDown:s,mouseUp:l}=function(e){const[t,r]=(0,n.useState)(!1),a=(0,n.useRef)(!1),o=(0,n.useRef)(0);return(0,n.useEffect)((()=>{let n=()=>{};function i(t){t.preventDefault();const r=t.clientX-o.current;r&&(a.current||(a.current=!0,window.requestAnimationFrame((()=>{e.horizontalScroll(-r),a.current=!1,o.current=t.clientX}))))}function s(){o.current=0,t&&r(!1)}return t&&(window.addEventListener("mousemove",i,!0),window.addEventListener("mouseup",s,!0),n=()=>{window.removeEventListener("mousemove",i,!0),window.removeEventListener("mouseup",s,!0)}),n}),[e,t]),{mouseDown:function(e){if(e.shiftKey)return;const t=e.target;t.draggable||t.dataset.resizer||0===e.button&&(o.current=e.clientX,r(!0))},mouseUp:function(e){e.preventDefault(),r(!1)}}}(t),c=(0,n.useRef)(null),{guideX:d,rubberbandOn:u,leftBpOffset:p,rightBpOffset:m,numOfBpSelected:g,width:h,left:f,anchorPosition:y,open:b,handleMenuItemClick:w,handleClose:v,mouseMove:C,mouseDown:S}=V(c,t,!0);!function(e,t){const r=(0,n.useRef)(0),a=(0,n.useRef)(),o=(0,n.useRef)(!1);(0,n.useEffect)((()=>{const n=e.current;function i(e){e.ctrlKey?(e.preventDefault(),r.current+=e.deltaY/500,t.setScaleFactor(r.current<0?1-r.current:1/(1+r.current)),a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{t.setScaleFactor(1),t.zoomTo(r.current>0?t.bpPerPx*(1+r.current):t.bpPerPx/(1-r.current),e.clientX-(n?.getBoundingClientRect().left||0)),r.current=0}),300)):(Math.abs(e.deltaX)>Math.abs(2*e.deltaY)&&e.preventDefault(),r.current+=e.deltaX,o.current||(o.current=!0,window.requestAnimationFrame((()=>{t.horizontalScroll(r.current),r.current=0,o.current=!1}))))}return n?(n.addEventListener("wheel",i),()=>{n.removeEventListener("wheel",i)}):()=>{}}),[t,e])}(c,t);const k=a.evaluateExtensionPoint("LinearGenomeView-TracksContainerComponent",void 0,{model:t});return n.createElement("div",{ref:c,"data-testid":"trackContainer",className:r.tracksContainer,onMouseDown:e=>{s(e),S(e)},onMouseMove:C,onMouseUp:l},t.showGridlines?n.createElement(ne,{model:t}):null,t.showCenterLine?n.createElement(ie,{model:t}):null,void 0!==d?n.createElement(H,{model:t,coordX:d}):u?n.createElement(j.A,{leftBpOffset:p,rightBpOffset:m,numOfBpSelected:g,width:h,left:f}):null,y?n.createElement(o.Menu,{anchorReference:"anchorPosition",anchorPosition:{left:y.clientX,top:y.clientY},onMenuItemClick:w,open:b,onClose:v,menuItems:t.rubberBandMenuItems()}):null,n.createElement(G,{model:t,ControlComponent:n.createElement(Z,{model:t,style:{height:me.jE,boxSizing:"border-box"}})}),n.createElement(pe,{model:t}),k,e)})),fe=(0,n.lazy)((()=>r.e(9372).then(r.bind(r,29372)))),ye=(0,n.lazy)((()=>r.e(1189).then(r.bind(r,21189)))),be=(0,a.n9)()((e=>({note:{textAlign:"center",paddingTop:e.spacing(1),paddingBottom:e.spacing(1)},rel:{position:"relative"},top:{zIndex:1e3}}))),we=(0,s.observer)((function({model:e}){const{tracks:t,error:r,initialized:a,hasDisplayedRegions:s}=e,l=(0,n.useRef)(null),c=(0,i.getSession)(e),{classes:d}=be();if((0,n.useEffect)((()=>{function t(t){t.target instanceof Element&&l.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)}}),[c,e]),!a&&!r)return n.createElement(o.LoadingEllipses,{variant:"h6"});if(!s||r)return n.createElement(fe,{model:e});const u=e.MiniControlsComponent(),p=e.HeaderComponent();return n.createElement("div",{className:d.rel,ref:l,onMouseLeave:()=>{c.setHovered(void 0)},onMouseMove:t=>{const r=l.current;if(!r)return;const{tracks:n}=e,a=t.clientX-r.getBoundingClientRect().left,o=e.pxToBp(a),i=n.find((e=>e.displays[0].featureUnderMouse));c.setHovered({hoverPosition:o,hoverFeature:i})}},n.createElement(p,{model:e}),n.createElement(u,{model:e}),n.createElement(he,{model:e},t.length?t.map((t=>n.createElement(D,{key:t.id,model:e,track:t}))):n.createElement(n.Suspense,{fallback:n.createElement(n.Fragment,null)},n.createElement(ye,{model:e}))))})),ve=we},32474:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(7552),a=r(48231),o=r(72639),i=r(68446),s=r(99546),l=r(76239);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c.apply(null,arguments)}const d=(0,i.observer)((function({model:e,overview:t,useOffset:r=!0}){const i=(0,a.A)(),d=Number(r),{interRegionPaddingWidth:u,offsetPx:p,dynamicBlocks:m,cytobandOffset:g}=e,{contentBlocks:h,totalWidthPxWithoutBorders:f}=m,y=i.palette.tertiary.light;if(!h.length)return null;const b=h.at(0),w=h.at(-1),v=(t.bpToPx({...b,coord:b.reversed?b.end:b.start})||0)+g*d,C=(t.bpToPx({...w,coord:w.reversed?w.start:w.end})||0)+g*d,S=Math.max(0,-p),k=S+f+h.length*u/2,T=[[S,l.Ij],[k,l.Ij],[C,0],[v,0]];return n.createElement("polygon",c({points:T.toString()},(0,s.getFillProps)((0,o.X4)(y,.3)),(0,s.getStrokeProps)((0,o.X4)(y,.8))))}))},5658:(e,t,r)=>{"use strict";r.d(t,{A:()=>b});var n=r(7552),a=r(68446),o=r(99546),i=r(8656),s=r(48901),l=r(1343),c=r(61723),d=r(93117),u=r(59121),p=r(25914);const m=(0,n.lazy)((()=>r.e(9374).then(r.bind(r,39374))));function g(){const[e,t]=(0,n.useState)(!1);return n.createElement(n.Fragment,null,n.createElement(c.A,{onClick:()=>{t(!0)},size:"small"},n.createElement(p.A,{fontSize:"small"})),e?n.createElement(n.Suspense,{fallback:null},n.createElement(m,{handleClose:()=>{t(!1)}})):null)}function h({showHelp:e,endAdornment:t}){return n.createElement(n.Fragment,null,n.createElement(d.A,{position:"end",style:{marginRight:7}},n.createElement(u.A,{fontSize:"small"}),e?n.createElement(g,null):null),t)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(null,arguments)}function y({TextFieldProps:e,inputBoxVal:t,params:r,showHelp:a,setInputValue:o,setCurrentSearch:i}){const{helperText:s,InputProps:c={}}=e;return n.createElement(l.A,f({onBlur:()=>{o(t)}},r,e,{size:"small",helperText:s,slotProps:{input:{...r.InputProps,...c,endAdornment:n.createElement(h,{showHelp:a,endAdornment:r.InputProps.endAdornment})}},placeholder:"Search for location",onChange:e=>{i(e.target.value)}}))}const b=(0,a.observer)((function({model:e,onSelect:t,assemblyName:r,style:a,fetchResults:l,onChange:c,value:d,showHelp:u=!0,minWidth:p=200,maxWidth:m=550,TextFieldProps:g={}}){const h=(0,o.getSession)(e),{assemblyManager:f}=h,[b,w]=(0,n.useState)(!1),[v,C]=(0,n.useState)(!0),[S,k]=(0,n.useState)(""),[T,x]=(0,n.useState)(""),[A,P]=(0,n.useState)(),M=(0,o.useDebounce)(S,300),E=r?f.get(r):void 0,{coarseVisibleLocStrings:R,hasDisplayedRegions:I}=e;(0,n.useEffect)((()=>{(async()=>{try{if(""===M||!r)return;C(!1);const e=await l(M);C(!0),P(function(e){return Object.entries(function(e){const t={};for(const r of e){const e=r.getDisplayString();t[e]||(t[e]=[]),t[e].push(r)}return t}(e)).map((([e,t])=>1===t.length?{result:t[0]}:{result:new i.A({displayString:e,results:t,label:e})}))}(e))}catch(e){console.error(e),h.notifyError(`${e}`,e)}})()}),[r,l,M,h]);const N=R||d||"",F=Math.min(Math.max((0,o.measureText)(N,14)+100,p),m),L=E?.refNames,D=L?.map((e=>({result:new i.S({refName:e,label:e,matchedAttribute:"refName"})})))||[];return n.createElement(s.A,{"data-testid":"autocomplete",disableListWrap:!0,disableClearable:!0,disabled:!r,freeSolo:!0,includeInputInList:!0,selectOnFocus:!0,style:{...a,width:F},value:N,loading:!v,inputValue:T,onInputChange:(e,t)=>{x(t),c?.(t)},loadingText:"loading results",open:b,onOpen:()=>{w(!0)},onClose:()=>{w(!1),C(!0),I&&(k(""),P(void 0))},onChange:(e,n)=>{n&&r&&(t?.("string"==typeof n?new i.A({label:n}):n.result),x(N))},options:A?.length?A:D,getOptionDisabled:e=>"limitOption"===e.group,filterOptions:(e,{inputValue:t})=>function(e,t){const r=(n=e,a=t.toLocaleLowerCase(),n.filter((({result:e})=>e.getLabel().toLowerCase().includes(a)||e.matchedObject)));var n,a;return[...r.slice(0,100),...r.length>100?[{group:"limitOption",result:new i.A({label:"keep typing for more results"})}]:[]]}(e,t),renderInput:e=>n.createElement(y,{showHelp:u,params:e,inputBoxVal:N,TextFieldProps:g,setCurrentSearch:k,setInputValue:x}),getOptionLabel:e=>"string"==typeof e?e:e.result.getDisplayString()})}))},91289:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var n=r(7552),a=r(75785),o=r(72639),i=r(9555),s=r(36715),l=r(99546);const c=(0,a.n9)()((e=>{const{tertiary:t}=e.palette;return{rubberband:{height:"100%",background:(0,o.X4)(t.light,.7),position:"absolute",zIndex:10,textAlign:"center",overflow:"hidden"},rubberbandControl:{cursor:"crosshair",width:"100%",minHeight:8},rubberbandText:{color:t.contrastText},popover:{mouseEvents:"none",cursor:"crosshair"},paper:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)}}}));function d({leftBpOffset:e,rightBpOffset:t,numOfBpSelected:r,left:a,width:o}){const d=(0,n.useRef)(null),{classes:u}=c();return n.createElement(n.Fragment,null,d.current?n.createElement(n.Fragment,null,n.createElement(i.Ay,{className:u.popover,classes:{paper:u.paper},open:!0,anchorEl:d.current,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,disableRestoreFocus:!0},n.createElement(s.A,null,(0,l.stringify)(e))),n.createElement(i.Ay,{className:u.popover,classes:{paper:u.paper},open:!0,anchorEl:d.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,disableRestoreFocus:!0},n.createElement(s.A,null,(0,l.stringify)(t)))):null,n.createElement("div",{ref:d,className:u.rubberband,style:{left:a,width:o}},r?n.createElement(s.A,{variant:"h6",className:u.rubberbandText},(0,l.toLocale)(r)," bp"):null))}},50574:(e,t,r)=>{"use strict";r.d(t,{Jf:()=>o,Pn:()=>i,S5:()=>s});var n=r(99546),a=r(8656);async function o({queryString:e,searchType:t,searchScope:r,rankSearchResults:o,textSearchManager:i,assembly:s}){i||console.warn("No text search manager");const l=await(i?.search({queryString:e,searchType:t},r,o)),c=s?.allRefNames?.filter((t=>t.toLowerCase().startsWith(e.toLowerCase()))).slice(0,10).map((e=>new a.A({label:e})));return(0,n.dedupe)([...c||[],...l||[]],(e=>e.getId()))}function i(e,t){return e.clientX-(t?.getBoundingClientRect().left||0)}function s(e,t){return e?.cytobands?.map((t=>({refName:e.getCanonicalRefName(t.get("refName"))||t.get("refName"),start:t.get("start"),end:t.get("end"),type:t.get("type")}))).filter((e=>e.refName===t))||[]}},76239:(e,t,r)=>{"use strict";r.d(t,{Es:()=>l,Gu:()=>a,Ij:()=>n,P5:()=>c,Rd:()=>s,i3:()=>i,jE:()=>o});const n=48,a=20,o=17,i=3,s=2,l=7,c=32},98753:(e,t,r)=>{"use strict";r.d(t,{$:()=>w,z:()=>g,renderToSvg:()=>x});var n=r(7552),a=r(42489),o=r(99546),i=r(20139),s=r(49823),l=r(91468),c=r(36422),d=r(48231);function u({width:e,height:t,shift:r}){const a=(0,d.A)();return n.createElement("rect",{width:e+2*r,height:t,fill:(0,o.stripAlpha)(a.palette.background.default)})}function p({model:e,height:t}){const{dynamicBlocks:r,offsetPx:a,interRegionPaddingWidth:o}=e;return n.createElement(n.Fragment,null,r.contentBlocks.slice(1).map((e=>n.createElement("rect",{key:e.key,x:e.offsetPx-a-o,width:o,y:0,height:t,fill:"grey"}))))}function m({trackLabels:e,trackName:t,fontSize:r,trackLabelOffset:a,x:i}){const s=(0,d.A)(),l=(0,o.stripAlpha)(s.palette.text.primary),c="overlay"===e?5:0,u="offset"===e?5:0,p=(0,o.coarseStripHTML)(t);return"none"!==e?n.createElement("g",null,"left"===e?n.createElement("text",{x:a-40,y:20,fill:l,fontSize:r,dominantBaseline:"hanging",textAnchor:"end"},p):n.createElement("text",{x:i+c,y:u,fill:l,fontSize:r,dominantBaseline:"hanging"},p)):null}function g({displayResults:e,model:t,offset:r,textHeight:a,fontSize:i,trackLabels:s="offset",trackLabelOffset:c=0}){const d=(0,o.getSession)(t),u="offset"===s?a:0;return n.createElement(n.Fragment,null,e.map((({track:e,result:a})=>{const o=r,g=e.configuration,h=(0,l.getTrackName)(g,d),f=e.displays[0],y=Math.max(-t.offsetPx,0);return r+=f.height+u,n.createElement("g",{key:g.trackId,transform:`translate(0 ${o})`},n.createElement("g",{transform:`translate(${c} ${u})`},n.createElement(p,{model:t,height:f.height}),a),n.createElement(m,{trackName:h,fontSize:i,trackLabels:s,trackLabelOffset:c,x:y}))})))}var h=r(97884),f=r(84481),y=r(27703);function b({start:e,end:t,bpPerPx:r,reversed:a=!1,major:i=!0,minor:s=!0,hideText:l=!1}){const c=(0,y.H2)(e,t,r,i,s),u=(0,d.A)(),p=(0,o.stripAlpha)(u.palette.text.secondary);return n.createElement(n.Fragment,null,c.map((o=>{const i=(a?t-o.base:o.base-e)/r;return n.createElement("line",{key:`tick-${o.base}`,x1:i,x2:i,y1:0,y2:"major"===o.type?6:4,strokeWidth:1,stroke:p})})),l?null:c.filter((e=>"major"===e.type)).map((i=>{const s=(a?t-i.base:i.base-e)/r;return n.createElement("text",{key:`label-${i.base}`,x:s-3,y:18,fontSize:11,fill:p},(0,o.getTickDisplayStr)(i.base+1,r))})))}function w({model:e,fontSize:t}){const{dynamicBlocks:{contentBlocks:r},offsetPx:a,bpPerPx:i}=e,s=r.length<5,l=(0,d.A)(),c=(0,o.stripAlpha)(l.palette.text.primary);return n.createElement(n.Fragment,null,n.createElement(p,{model:e,height:30}),r.map((e=>{const{start:r,end:o,key:l,reversed:d,offsetPx:u,refName:p,widthPx:m}=e,g=u-a,h=`clip-${l}`;return n.createElement("g",{key:l},n.createElement("defs",null,n.createElement("clipPath",{id:h},n.createElement("rect",{x:0,y:0,width:m,height:100}))),n.createElement("g",{transform:`translate(${g} 0)`},n.createElement("g",{clipPath:`url(#${h})`},n.createElement("text",{x:4,y:t,fontSize:t,fill:c},p),n.createElement("g",{transform:"translate(0 20)"},n.createElement(b,{hideText:!s,start:r,end:o,bpPerPx:i,reversed:d})))))})))}function v({model:e,fontSize:t}){const{offsetPx:r,dynamicBlocks:{totalWidthPxWithoutBorders:a,totalBp:i}}=e,s=(0,d.A)(),l=(0,o.getBpDisplayStr)(i),c=Math.max(-r,0),u=c+a,p=(0,o.stripAlpha)(s.palette.text.secondary),m=c+(u-c)/2,g=t;return n.createElement(n.Fragment,null,n.createElement("line",{x1:c,x2:u,y1:10,y2:10,stroke:p}),n.createElement("line",{x1:c,x2:c,y1:5,y2:15,stroke:p}),n.createElement("line",{x1:u,x2:u,y1:5,y2:15,stroke:p}),n.createElement("text",{x:m,y:g,textAnchor:"middle",dominantBaseline:"hanging",fontSize:t,fill:p},l))}var C=r(32474),S=r(76239);function k({model:e,fontSize:t,cytobandHeight:r,rulerHeight:a}){const{width:i,assemblyNames:s,showCytobands:l,displayedRegions:c}=e,{assemblyManager:u}=(0,o.getSession)(e),p=s.length>1?"":s[0],m=u.get(p),g=(0,d.A)(),y=(0,o.stripAlpha)(g.palette.text.primary),b=h.A.create({displayedRegions:JSON.parse(JSON.stringify(c)),interRegionPaddingWidth:0,minimumBlockWidth:e.minimumBlockWidth}),k=e.dynamicBlocks.contentBlocks;if(!k.length)return null;b.setVolatileWidth(i),b.showAllRegions();const T=b.dynamicBlocks.contentBlocks[0],x=k.at(0),A=k.at(-1),P=b.bpToPx({...x,coord:x.reversed?x.end:x.start})||0,M=b.bpToPx({...A,coord:A.reversed?A.start:A.end})||0,E=+l*r;return n.createElement("g",{id:"header"},n.createElement("text",{x:0,y:0,dominantBaseline:"hanging",fontSize:t,fill:y},p),l?n.createElement("g",{transform:`translate(0 ${a})`},n.createElement(f.A,{overview:b,assembly:m,block:T}),n.createElement("rect",{stroke:"red",fill:"rgb(255,0,0)",fillOpacity:.1,width:Math.max(M-P,.5),height:S.Gu-1,x:P,y:.5}),n.createElement("g",{transform:`translate(0,${S.Gu})`},n.createElement(C.A,{overview:b,model:e,useOffset:!1}))):null,n.createElement("g",{transform:`translate(0 ${t+E})`},n.createElement(v,{model:e,fontSize:t})),n.createElement("g",{transform:`translate(0 ${a+E})`},n.createElement(w,{model:e,fontSize:t})))}var T=r(26612);async function x(e,t){await(0,a.when)((()=>e.initialized));const{textHeight:r=18,headerHeight:d=40,rulerHeight:p=50,fontSize:m=13,cytobandHeight:h=100,trackLabels:f="offset",themeName:y="default",Wrapper:b=({children:e})=>e}=t,w=(0,o.getSession)(e),{allThemes:v}=w,{createRootFn:C}=(0,c.getRoot)(e),S=v?.()[y],{width:x,tracks:A,showCytobands:P}=e,M=d+p+ +P*h+10,E=(0,T.m)(A,r,f)+M+100,R=await Promise.all(A.map((async e=>{const r=e.displays[0];return await(0,a.when)((()=>!r.renderProps().notReady)),{track:e,result:await r.renderSvg({...t,theme:S})}}))),I=(0,o.max)(A.map((e=>(0,o.measureText)((0,l.getTrackName)(e.configuration,w),m))),0)+40,N="left"===f?I:0,F=x+N;return(0,o.renderToStaticMarkup)(n.createElement(i.A,{theme:(0,s.createJBrowseTheme)(S)},n.createElement(b,null,n.createElement("svg",{width:F,height:E,xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:[0,0,F+100,E].toString()},n.createElement(u,{width:F,height:E,shift:50}),n.createElement("g",{transform:"translate(50 0)"},n.createElement("g",{transform:`translate(${N})`},n.createElement(k,{model:e,fontSize:m,rulerHeight:p,cytobandHeight:h})),n.createElement(g,{textHeight:r,fontSize:m,model:e,displayResults:R,offset:M,trackLabels:f,trackLabelOffset:N}))))),C)}},26612:(e,t,r)=>{"use strict";r.d(t,{m:()=>a});var n=r(99546);function a(e,t,r){return(0,n.sum)(e.map((e=>e.displays[0].height+(["none","left"].includes(r)?0:t))))}},27703:(e,t,r)=>{"use strict";r.d(t,{CU:()=>s,Cz:()=>i,H2:()=>o,i3:()=>a});var n=r(99546);function a(e,t,r){const n=t*(e=Math.abs(e));let a=10**Number.parseInt(Number(n).toExponential().split(/e/i)[1],10);for(;a<n&&(a*=2,!(a>=n));)a*=2.5;a=Math.max(a,5);const o=a/e;let i=0;return!(a%10)&&o/10>=r?i=a/10:!(a%5)&&o/5>=r?i=a/5:!(a%2)&&o/2>=r&&(i=a/2),{majorPitch:a,minorPitch:i}}function o(e,t,r,n=!0,o=!0){const i=a(r,60,15);let s=e,l=t;r<0&&([s,l]=[l,s]),s-=Math.abs(20*r)-1,l+=Math.abs(20*r)+1;const c=i.minorPitch||i.majorPitch;let d=0;const u=[];for(let e=Math.floor(s/c)*c;e<Math.ceil(l/c)*c+1;e+=c)o&&e%(2*i.majorPitch)?(u.push({type:"minor",base:e-1,index:d}),d+=1):!n||e%(2*i.majorPitch)||(u.push({type:"major",base:e-1,index:d}),d+=1);return u}async function i(e,t,r){return Promise.all(e.map((async e=>{const n=e.assemblyName||r;if(!n)throw new Error("no assembly provided");const a=await t.waitForAssembly(n),{refName:o}=e;if(!a)throw new Error(`assembly ${n} not found`);const{regions:i}=a;if(!i)throw new Error(`regions not loaded yet for ${n}`);const s=a.getCanonicalRefName(e.refName);if(!s)throw new Error(`Could not find refName ${o} in ${a.name}`);const l=i.find((e=>e.refName===s));if(!l)throw new Error(`Could not find refName ${o} in ${n}`);return{...e,assemblyName:n,parentRegion:l}})))}function s(e,t,r){const a=e.split(/(\s+)/).map((e=>e.trim())).filter((e=>!!e));try{return a.map((e=>(0,n.parseLocString)(e,(e=>r(e,t)))))}catch(e){const[o,i,s]=a;if(/Unknown reference sequence/.exec(`${e}`)&&Number.isInteger(+i)&&Number.isInteger(+s))return[(0,n.parseLocString)(`${o}:${i}..${s}`,(e=>r(e,t)))];throw e}}},20529:(e,t,r)=>{"use strict";r.d(t,{Lr:()=>x,GQ:()=>V,LW:()=>w.A,e6:()=>k,$m:()=>nt.$,zh:()=>nt.z,Gd:()=>Je,_e:()=>b,Ki:()=>l,Ay:()=>yt,lw:()=>ut,bN:()=>ht,mJ:()=>ft.m});var n=r(12678),a=r(99546),o=r(68584),i=r(36422),s=r(11370);const l=(0,o.ConfigurationSchema)("BaseLinearDisplay",{maxFeatureScreenDensity:{type:"number",description:"maximum features per pixel that is displayed in the view, used if byte size estimates not available",defaultValue:.3},fetchSizeLimit:{type:"number",defaultValue:1e6,description:"maximum data to attempt to download for a given track, used if adapter doesn't specify one"},height:{type:"number",defaultValue:100,description:"default height for the track"},mouseover:{type:"string",description:"text to display when the cursor hovers over a feature",defaultValue:"jexl:get(feature,'name')",contextVariable:["feature"]},jexlFilters:{type:"stringArray",description:"default set of jexl filters to apply to a track. note: these do not use the jexl prefix because they have a deferred evaluation system",defaultValue:[]}},{explicitIdentifier:"displayId"});var c=r(7552),d=r(1622);class u{constructor(e){this.submaps=e}has(e){for(const t of this.submaps.values())if(t.has(e))return!0;return!1}get(e){for(const t of this.submaps.values())if(t.has(e))return t.get(e)}*values(){for(const e of this.keys())yield this.get(e)}*keys(){const e=new Set;for(const t of this.submaps.values())for(const r of t.keys())e.add(r);for(const t of e)yield t}find(e){for(const t of this.submaps.values())for(const r of t.values())if(e(r))return r}*[Symbol.iterator](){for(const e of this.keys())yield[e,this.get(e)]}*entries(){for(const e of this.keys())yield[e,this.get(e)]}}var p=r(91468),m=r(42489),g=r(63670),h=r(86013),f=r(66344);const y=20;function b(){return i.types.model({heightPreConfig:i.types.maybe(i.types.refinement("displayHeight",i.types.number,(e=>e>=y)))}).volatile((()=>({scrollTop:0}))).views((e=>({get height(){return e.heightPreConfig??(0,o.getConf)(e,"height")}}))).actions((e=>({setScrollTop(t){e.scrollTop=t},setHeight:t=>(e.heightPreConfig=Math.max(t,y),e.height),resizeHeight(t){const r=e.height;return this.setHeight(e.height+t)-r}})))}var w=r(37205),v=r(5401);const C=function({model:e}){const{regionTooLargeReason:t}=e;return c.createElement(w.A,{severity:"warning",action:c.createElement(v.A,{onClick:()=>{e.setFeatureDensityStatsLimit(e.featureDensityStats),e.reload()}},"Force load"),message:[t,"Zoom in to see features or force load (may be slow)"].filter((e=>!!e)).join(". ")})};var S=r(21479);function k(){return i.types.model({userBpPerPxLimit:i.types.maybe(i.types.number),userByteSizeLimit:i.types.maybe(i.types.number)}).volatile((()=>({featureDensityStatsP:void 0,featureDensityStats:void 0,currStatsBpPerPx:0}))).views((e=>({get currentBytesRequested(){return e.featureDensityStats?.bytes||0},get currentFeatureScreenDensity(){const t=(0,a.getContainingView)(e);return(e.featureDensityStats?.featureDensity||0)*t.bpPerPx},get maxFeatureScreenDensity(){return(0,o.getConf)(e,"maxFeatureScreenDensity")},get featureDensityStatsReady(){const t=(0,a.getContainingView)(e);return!(e.currStatsBpPerPx!==t.bpPerPx||!e.featureDensityStats&&!e.userBpPerPxLimit)},get maxAllowableBytes(){return e.userByteSizeLimit||e.featureDensityStats?.fetchSizeLimit||(0,o.getConf)(e,"fetchSizeLimit")}}))).actions((e=>({afterAttach(){(0,i.addDisposer)(e,(0,m.autorun)((()=>async function(e){try{const t=(0,a.getContainingView)(e);if(!t.initialized||!t.staticBlocks.contentBlocks.length||t.bpPerPx===e.currStatsBpPerPx||e.error)return;if(void 0!==e.featureDensityStats?.featureDensity)return void e.setCurrStatsBpPerPx(t.bpPerPx);e.clearFeatureDensityStats(),e.setCurrStatsBpPerPx(t.bpPerPx);const r=await e.getFeatureDensityStats();(0,i.isAlive)(e)&&e.setFeatureDensityStats(r)}catch(t){!(0,a.isAbortException)(t)&&(0,i.isAlive)(e)&&(console.error(t),e.setError(t))}}(e))))}}))).actions((e=>({setCurrStatsBpPerPx(t){e.currStatsBpPerPx=t},setFeatureDensityStatsLimit(t){const r=(0,a.getContainingView)(e);t?.bytes?e.userByteSizeLimit=t.bytes:e.userBpPerPxLimit=r.bpPerPx},getFeatureDensityStats(){return e.featureDensityStatsP||(e.featureDensityStatsP=(0,S.bf)(e).catch((t=>{throw(0,i.isAlive)(e)&&this.setFeatureDensityStatsP(void 0),t}))),e.featureDensityStatsP},setFeatureDensityStatsP(t){e.featureDensityStatsP=t},setFeatureDensityStats(t){e.featureDensityStats=t},clearFeatureDensityStats(){e.featureDensityStatsP=void 0,e.featureDensityStats=void 0}}))).views((e=>({get regionTooLarge(){const t=(0,a.getContainingView)(e);return!(!e.featureDensityStatsReady||t.dynamicBlocks.totalBp<2e4)&&(e.currentBytesRequested>e.maxAllowableBytes||(e.userBpPerPxLimit?t.bpPerPx>e.userBpPerPxLimit:e.currentFeatureScreenDensity>e.maxFeatureScreenDensity))},get regionTooLargeReason(){const t=e.currentBytesRequested,r=e.maxAllowableBytes;return t&&t>r?`Requested too much data (${(0,S.W7)(t)})`:""}}))).views((e=>({regionCannotBeRenderedText:t=>e.regionTooLarge?"Force load to see features":"",regionCannotBeRendered:t=>e.regionTooLarge?c.createElement(C,{model:e}):null})))}const T=(0,c.lazy)((()=>Promise.resolve().then(r.bind(r,2286)))),x=i.types.compose("BaseLinearDisplay",d.BaseDisplay,b(),k(),i.types.model({blockState:i.types.map(f.A),configuration:(0,o.ConfigurationReference)(l)})).volatile((()=>({featureIdUnderMouse:void 0,contextMenuFeature:void 0}))).views((e=>({get DisplayMessageComponent(){},get blockType(){return"staticBlocks"},get blockDefinitions(){const t=(0,a.getContainingView)(e);if(!t.initialized)throw new Error("view not initialized yet");return t[this.blockType]}}))).views((e=>({get renderDelay(){return 50},get TooltipComponent(){return T},get selectedFeatureId(){if((0,i.isAlive)(e)){const{selection:t}=(0,a.getSession)(e);if((0,a.isFeature)(t))return t.id()}}}))).views((e=>({get features(){const t=[];for(const r of e.blockState.values())r.features&&t.push(r.features);return new u(t)},get featureUnderMouse(){const t=e.featureIdUnderMouse;return t?this.features.get(t):void 0},getFeatureOverlapping:(t,r,n)=>e.blockState.get(t)?.layout?.getByCoord(r,n),getFeatureByID:(t,r)=>e.blockState.get(t)?.layout?.getByID(r),searchFeatureByID(t){let r;return e.blockState.forEach((e=>{const n=e.layout?.getByID(t);n&&(r=n)})),r}}))).actions((e=>({addBlock(t,r){e.blockState.set(t,f.A.create({key:t,region:r.toRegion()}))},deleteBlock(t){e.blockState.delete(t)},selectFeature(t){const r=(0,a.getSession)(e);if((0,a.isSessionModelWithWidgets)(r)){const n=r.addWidget("BaseFeatureWidget","baseFeature",{view:(0,a.getContainingView)(e),track:(0,a.getContainingTrack)(e),featureData:t.toJSON()});r.showWidget(n)}(0,a.isSelectionContainer)(r)&&r.setSelection(t)},navToFeature(t){(0,a.getContainingView)(e).navTo({refName:t.get("refName"),start:t.get("start"),end:t.get("end")})},clearFeatureSelection(){(0,a.getSession)(e).clearSelection()},setFeatureIdUnderMouse(t){e.featureIdUnderMouse=t},setContextMenuFeature(t){e.contextMenuFeature=t}}))).actions((e=>{const{reload:t}=e;return{async reload(){e.setError(),e.setCurrStatsBpPerPx(0),e.clearFeatureDensityStats(),[...e.blockState.values()].forEach((e=>{e.doReload()})),t()}}})).views((e=>({trackMenuItems:()=>[],contextMenuItems:()=>[...e.contextMenuFeature?[{label:"Open feature details",icon:g.A,onClick:()=>{e.contextMenuFeature&&e.selectFeature(e.contextMenuFeature)}},{label:"Zoom to feature",icon:h.A,onClick:()=>{e.contextMenuFeature&&e.navToFeature(e.contextMenuFeature)}}]:[]],renderProps:()=>({...(0,p.getParentRenderProps)(e),notReady:!e.featureDensityStatsReady,rpcDriverName:e.rpcDriverName,displayModel:e,onFeatureClick(t,r){const n=r||e.featureIdUnderMouse;if(n){const t=e.features.get(n);t&&e.selectFeature(t)}else e.clearFeatureSelection()},onClick(){e.clearFeatureSelection()},onFeatureContextMenu(t,r){const n=r||e.featureIdUnderMouse;n?e.setContextMenuFeature(e.features.get(n)):e.clearFeatureSelection()},onMouseMove(t,r){e.setFeatureIdUnderMouse(r)},onMouseLeave(t){e.setFeatureIdUnderMouse(void 0)},onContextMenu(){e.setContextMenuFeature(void 0),e.clearFeatureSelection()}})}))).actions((e=>({async renderSvg(t){const{renderBaseLinearDisplaySvg:n}=await r.e(3311).then(r.bind(r,23311));return n(e,t)},afterAttach(){(0,i.addDisposer)(e,(0,m.autorun)((()=>{const t={};(0,a.getContainingView)(e).initialized&&(e.blockDefinitions.contentBlocks.forEach((r=>{t[r.key]=!0,e.blockState.has(r.key)||e.addBlock(r.key,r)})),e.blockState.forEach(((r,n)=>{t[n]||e.deleteBlock(n)})))})))}}))).preProcessSnapshot((e=>{if(!e)return e;const{height:t,...r}=e;return{heightPreConfig:t,...r}})).postProcessSnapshot((e=>{const t=e,{blockState:r,...n}=t;return n}));var A=r(68446),P=r(48231),M=r(75785),E=r(49823),R=r(42752);const I=(0,M.n9)()({linearBlocks:{whiteSpace:"nowrap",textAlign:"left",position:"absolute",minHeight:"100%",display:"flex"},heightOverflowed:{position:"absolute",color:"rgb(77,77,77)",borderBottom:"2px solid rgb(77,77,77)",textShadow:"white 0px 0px 1px",whiteSpace:"nowrap",width:"100%",fontWeight:"bold",textAlign:"center",zIndex:2e3,boxSizing:"border-box"}}),N=(0,A.observer)((function({model:e}){const{classes:t}=I(),{blockDefinitions:r,blockState:n}=e;return c.createElement(c.Fragment,null,r.map((r=>{const a=`${e.id}-${r.key}`;if("ContentBlock"===r.type){const e=n.get(r.key);return c.createElement(R.$G,{block:r,key:a},e?.ReactComponent?c.createElement(e.ReactComponent,{model:e}):null,e?.maxHeightReached?c.createElement("div",{className:t.heightOverflowed,style:{top:e.layout.getTotalHeight()-16,pointerEvents:"none",height:16}},"Max height reached"):null)}if("ElidedBlock"===r.type)return c.createElement(R.Db,{key:a,width:r.widthPx});if("InterRegionPaddingBlock"===r.type)return c.createElement(R.fK,{key:a,width:r.widthPx,style:{background:"none"},boundary:"boundary"===r.variant});throw new Error(`invalid block type ${JSON.stringify(r)}`)})))})),F=(0,A.observer)((function({model:e}){const{classes:t}=I(),{blockDefinitions:r}=e,n=(0,a.getContainingView)(e);return c.createElement("div",{className:t.linearBlocks,style:{left:r.offsetPx-n.offsetPx}},c.createElement(N,{model:e}))})),L=F;r(2286);const D=(0,M.n9)()({display:{position:"relative",whiteSpace:"nowrap",textAlign:"left",width:"100%",minHeight:"100%"}}),B=(0,A.observer)((function(e){const{classes:t}=D(),r=(0,P.A)(),n=(0,c.useRef)(null),[a,i]=(0,c.useState)(),[s,l]=(0,c.useState)([0,0]),[d,u]=(0,c.useState)([0,0]),[p,m]=(0,c.useState)(),{model:g,children:h}=e,{TooltipComponent:f,DisplayMessageComponent:y,height:b}=g,w=g.contextMenuItems();return c.createElement("div",{ref:n,"data-testid":`display-${(0,o.getConf)(g,"displayId")}`,className:t.display,onContextMenu:e=>{e.preventDefault(),p?m(void 0):n.current&&m([e.clientX,e.clientY])},onMouseMove:e=>{if(!n.current)return;const t=n.current.getBoundingClientRect(),{left:r,top:a}=t;l([e.clientX-r,e.clientY-a]),u([e.clientX,e.clientY]),i(t)}},y?c.createElement(y,{model:g}):c.createElement(L,e),h,c.createElement(c.Suspense,{fallback:null},c.createElement(f,{model:g,height:b,offsetMouseCoord:s,clientMouseCoord:d,clientRect:a,mouseCoord:s})),c.createElement(E.Menu,{open:Boolean(p)&&w.length>0,onMenuItemClick:(e,t)=>{t(),m(void 0)},onClose:()=>{m(void 0),g.setContextMenuFeature(void 0)},TransitionProps:{onExit:()=>{m(void 0),g.setContextMenuFeature(void 0)}},anchorReference:"anchorPosition",anchorPosition:p?{top:p[1],left:p[0]}:void 0,style:{zIndex:r.zIndex.tooltip},menuItems:w}))})),V=B;var z=r(58921);function O(e){return(0,o.ConfigurationSchema)("LinearBareDisplay",{renderer:e.pluggableConfigSchemaType("renderer")},{baseConfiguration:l,explicitlyTyped:!0})}function H(e){return i.types.compose("LinearBareDisplay",x,i.types.model({type:i.types.literal("LinearBareDisplay"),configuration:(0,o.ConfigurationReference)(e)})).views((e=>{const{renderProps:t}=e;return{renderProps:()=>({...t(),...(0,p.getParentRenderProps)(e),rpcDriverName:e.rpcDriverName,config:e.configuration.renderer}),get rendererTypeName(){return e.configuration.renderer.type}}}))}var j=r(8832),W=r(93707),G=r(88530),$=r(97884),q=r(95095),_=r(45465),U=r(33039),J=r.n(U),X=r(90542),Y=r(25611),K=r(1633),Q=r(95947),Z=r(29417),ee=r(64502),te=r(87809),re=r(53794),ne=r(59121),ae=r(72639),oe=r(943),ie=r(61723),se=r(23758),le=r(91404),ce=r(66195);const de=(0,M.n9)()((e=>({background:{position:"absolute",right:0,zIndex:1001,background:e.palette.background.paper},focusedBackground:{background:(0,ae.X4)(e.palette.secondary.light,.2)}}))),ue=(0,A.observer)((function({model:e}){const{classes:t}=de(),{id:r,bpPerPx:n,maxBpPerPx:o,minBpPerPx:i,scaleFactor:s,hideHeader:l}=e,{focusedViewId:d}=(0,a.getSession)(e);return l?c.createElement(oe.A,{className:t.background},c.createElement(oe.A,{className:d===r?t.focusedBackground:void 0},c.createElement(se.A,{menuItems:e.menuItems()},c.createElement(ce.A,{fontSize:"small"})),c.createElement(ie.A,{"data-testid":"zoom_out",onClick:()=>{e.zoom(2*n)},disabled:n>=o-1e-4||1!==s},c.createElement(le.A,{fontSize:"small"})),c.createElement(ie.A,{"data-testid":"zoom_in",onClick:()=>{e.zoom(n/2)},disabled:n<=i+1e-4||1!==s},c.createElement(te.A,{fontSize:"small"})))):null})),pe=ue;var me=r(36715),ge=r(83867),he=r(40631),fe=r(97147),ye=r(50574),be=r(89003),we=r(91289);const ve=(0,M.n9)()({rubberbandControl:{cursor:"crosshair",width:"100%",minHeight:8},guide:{pointerEvents:"none",height:"100%",width:1,position:"absolute",zIndex:10},rel:{position:"relative"}}),Ce=(0,A.observer)((function({model:e,open:t,guideX:r,overview:n}){const{classes:o}=ve(),{cytobandOffset:i}=e,{assemblyManager:s}=(0,a.getSession)(e),l=n.pxToBp(r-i),d=s.get(l.assemblyName),u=d?.cytobands?.find((e=>l.coord>e.get("start")&&l.coord<e.get("end")&&l.refName===d.getCanonicalRefName(e.get("refName"))));return c.createElement(be.A,{open:t,placement:"top",title:[(0,a.stringify)(l),u?.get("name")].join(" "),arrow:!0},c.createElement("div",{className:o.guide,style:{left:r}}))})),Se=(0,A.observer)((function({model:e,overview:t,ControlComponent:r=c.createElement("div",null)}){const{cytobandOffset:n}=e,[o,i]=(0,c.useState)(),[s,l]=(0,c.useState)(),[d,u]=(0,c.useState)(),p=(0,c.useRef)(null),{classes:m}=ve(),g=void 0!==o;function h(e){e.preventDefault(),e.stopPropagation(),i((0,ye.Pn)(e,p.current))}function f(e){u((0,ye.Pn)(e,p.current))}function y(){u(void 0)}if((0,c.useEffect)((()=>{function r(e){const t=p.current;t&&g&&l((0,ye.Pn)(e,t))}function c(){if(void 0!==o&&void 0!==s&&Math.abs(s-o)>3){const r=Math.min(o,s),a=Math.max(o,s);e.moveTo(t.pxToBp(r-n),t.pxToBp(a-n))}if(void 0!==o&&void 0===s){const r=t.pxToBp(o-n);r.refName?e.centerAt(Math.round(r.coord),r.refName,r.index):((0,a.getSession)(e).notify("unknown position clicked"),console.error("unknown position clicked",r))}i(void 0),l(void 0),void 0!==o&&u(void 0)}function d(e){"Escape"===e.key&&(i(void 0),l(void 0))}return g?(window.addEventListener("mousemove",r,!0),window.addEventListener("mouseup",c,!0),window.addEventListener("keydown",d,!0),()=>{window.removeEventListener("mousemove",r,!0),window.removeEventListener("mouseup",c,!0),window.removeEventListener("keydown",d,!0)}):()=>{}}),[g,s,o,e,t,n]),void 0===o)return c.createElement("div",{className:m.rel},void 0!==d?c.createElement(Ce,{model:e,open:!g,overview:t,guideX:d}):null,c.createElement("div",{className:m.rubberbandControl,ref:p,onMouseDown:h,onMouseOut:y,onMouseMove:f},r));let b,w,v=o||0,C=0;return void 0!==s&&(v=s<o?s:o,C=s-o),o&&(b=t.pxToBp(o-n),w=t.pxToBp(o+C-n),void 0!==s&&s<o&&([b,w]=[w,b])),c.createElement("div",{className:m.rel},b&&w?c.createElement(we.A,{leftBpOffset:b,rightBpOffset:w,width:Math.abs(C),left:v}):null,c.createElement("div",{"data-testid":"rubberband_controls",className:m.rubberbandControl,ref:p,onMouseDown:h,onMouseOut:y,onMouseMove:f},r))})),ke=Se;var Te=r(84481),xe=r(32474),Ae=r(87485);const Pe=(0,M.n9)()((e=>({highlight:{height:"100%",position:"absolute",background:(0,Ae.M)(e.palette.highlight.main).alpha(.35).toRgbString(),borderLeft:`1px solid ${e.palette.highlight.main}`,borderRight:`1px solid ${e.palette.highlight.main}`}}))),Me=(0,A.observer)((function({model:e,overview:t}){const{classes:r}=Pe(),{highlight:n,cytobandOffset:o}=e,i=(0,a.getSession)(e),{assemblyManager:s}=i;return n.map((e=>{const r=s.get(e.assemblyName),n=r?.getCanonicalRefName(e.refName)??e.refName,a=t.bpToPx({...e,refName:n,coord:e.start}),i=t.bpToPx({...e,refName:n,coord:e.end});return void 0!==a&&void 0!==i?{width:Math.abs(i-a),left:a+o}:void 0})).filter(a.notEmpty).map((({left:e,width:t},n)=>c.createElement("div",{key:`${e}_${t}_${n}`,className:r.highlight,style:{width:t,left:e}})))})),Ee=Me;var Re=r(27703),Ie=r(76239);const Ne=(0,M.n9)()({scalebarLabel:{height:Ie.Gu,position:"absolute",display:"flex",justifyContent:"center",pointerEvents:"none"}}),Fe=(0,A.observer)((function({block:e,scale:t,overview:r,model:n}){const{classes:o}=Ne(),{start:i,end:s,reversed:l,refName:d,assemblyName:u}=e,{majorPitch:p}=(0,Re.i3)(t,120,15),{assemblyManager:m}=(0,a.getSession)(n),g=m.get(u),h=g?.getRefNameColor(d),f=[];for(let e=0;e<Math.floor((s-i)/p);e++){const t=(e+1)*p;f.push(l?s-t:i+t)}return f.map(((n,i)=>c.createElement(me.A,{key:`${JSON.stringify(e)}-${n}-${i}`,className:o.scalebarLabel,variant:"body2",style:{left:(i+1)*p/t,pointerEvents:"none",color:h}},(0,a.getTickDisplayStr)(n,r.bpPerPx))))})),Le=Fe,De=(0,M.n9)()((e=>({scalebar:{height:Ie.Gu},scalebarBorder:{border:"1px solid"},scalebarContig:{backgroundColor:e.palette.background.default,position:"absolute",top:0,height:Ie.Gu,overflow:"hidden"},scalebarContigForward:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='${e.palette.divider}'/%3E%3C/svg%3E")`,backgroundRepeat:"repeat"},scalebarContigReverse:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='${e.palette.divider}'/%3E%3C/svg%3E")`,backgroundRepeat:"repeat"},scalebarRefName:{position:"absolute",fontWeight:"bold",pointerEvents:"none",zIndex:100},scalebarVisibleRegion:{position:"absolute",height:Ie.Gu,pointerEvents:"none",zIndex:100,border:"1px solid"},overview:{height:Ie.Ij,position:"relative"},overviewSvg:{pointerEvents:"none",width:"100%",position:"absolute"}}))),Be=(0,A.observer)((function({scale:e,model:t,block:r,overview:n}){const{classes:o,cx:i}=De(),s=(0,P.A)(),{cytobandOffset:l,showCytobands:d}=t,{reversed:u,refName:p,assemblyName:m}=r,{assemblyManager:g}=(0,a.getSession)(t),h=g.get(m),f=h?.getRefNameColor(p),y=d&&(0,ye.S5)(h,r.refName).length;return c.createElement("div",null,c.createElement(me.A,{style:{left:r.offsetPx+3,color:y?s.palette.text.primary:f},className:o.scalebarRefName},p),c.createElement("div",{className:i(o.scalebarContig,y?void 0:u?o.scalebarContigReverse:o.scalebarContigForward,y?void 0:o.scalebarBorder),style:{left:r.offsetPx+l,width:r.widthPx,borderColor:f}},y?c.createElement("svg",{style:{width:"100%"}},c.createElement(Te.A,{overview:n,assembly:h,block:r})):c.createElement(Le,{model:t,overview:n,scale:e,block:r})))})),Ve=(0,A.observer)((function({model:e,scale:t,overview:r}){const{classes:n}=De(),o=(0,P.A)(),{dynamicBlocks:i,showCytobands:s,cytobandOffset:l}=e,{pluginManager:d}=(0,a.getEnv)(e),u=i.contentBlocks,p=r.dynamicBlocks,m=o.palette.tertiary.light;if(!u.length)return null;const g=u.at(0),h=u.at(-1),f=r.bpToPx({...g,coord:g.reversed?g.end:g.start})||0,y=r.bpToPx({...h,coord:h.reversed?h.start:h.end})||0,b=s?"#f00":m,w=s?.1:.3,v=d.evaluateExtensionPoint("LinearGenomeView-OverviewScalebarComponent",void 0,{model:e,overview:r});return c.createElement("div",{className:n.scalebar},c.createElement("div",{className:n.scalebarVisibleRegion,style:{width:y-f,left:f+l,background:(0,ae.X4)(b,w),borderColor:b}}),p.map(((a,o)=>"ContentBlock"!==a.type?c.createElement("div",{key:`${JSON.stringify(a)}-${o}`,className:n.scalebarContig,style:{width:a.widthPx,left:a.offsetPx,backgroundColor:"#999",backgroundImage:"repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)"}}):c.createElement(Be,{scale:t,block:a,model:e,overview:r,key:`${JSON.stringify(a)}-${o}`}))),c.createElement(Ee,{model:e,overview:r}),v)})),ze=(0,A.observer)((function({model:e,children:t}){const{classes:r}=De(),{minimumBlockWidth:n,totalBp:a,width:o,cytobandOffset:i,displayedRegions:s}=e,l=o-i,d=JSON.stringify(s),u=(0,c.useMemo)((()=>{const e=$.A.create({displayedRegions:JSON.parse(d),interRegionPaddingWidth:0,minimumBlockWidth:n});return e.setVolatileWidth(l),e.showAllRegions(),e}),[d,n,l]),p=a/(l-2*(s.length-1));return c.createElement("div",null,c.createElement(ke,{model:e,overview:u,ControlComponent:c.createElement(Ve,{model:e,overview:u,scale:p})}),c.createElement("div",{className:r.overview},c.createElement("svg",{height:Ie.Ij,className:r.overviewSvg},c.createElement(xe.A,{model:e,overview:u})),t))})),Oe=ze;var He=r(77005);const je=(0,M.n9)()((e=>({container:{display:"flex",flexDirection:"row",alignItems:"center"},slider:{width:70,color:e.palette.text.secondary}}))),We=(0,A.observer)((function({model:e}){const{classes:t}=je(),{maxBpPerPx:r,minBpPerPx:n,bpPerPx:a}=e,[o,i]=(0,c.useState)(100*-Math.log2(a));return(0,c.useEffect)((()=>{i(100*-Math.log2(a))}),[a]),c.createElement("div",{className:t.container},c.createElement(ie.A,{"data-testid":"zoom_out",onClick:()=>{e.zoom(2*a)},disabled:a>=r-1e-4,size:"large"},c.createElement(le.A,null)),c.createElement(He.Ay,{size:"small",className:t.slider,value:o,min:100*-Math.log2(r),max:100*-Math.log2(n),onChange:(e,t)=>{i(t)},onChangeCommitted:()=>e.zoomTo(2**(-o/100))}),c.createElement(ie.A,{"data-testid":"zoom_in",onClick:()=>{e.zoom(e.bpPerPx/2)},disabled:a<=n+1e-4,size:"large"},c.createElement(te.A,null)))})),Ge=We;var $e=r(5658),qe=r(6184);const _e=(0,M.n9)()((()=>({headerRefName:{minWidth:100}}))),Ue=(0,A.observer)((function({model:e,showHelp:t}){const{classes:r}=_e(),n=(0,P.A)(),o=(0,a.getSession)(e),{textSearchManager:i,assemblyManager:s}=o,{assemblyNames:l,rankSearchResults:d}=e,u=l[0],p=s.get(u),m=e.searchScope(u);return c.createElement($e.A,{showHelp:t,onSelect:async t=>{try{t.hasLocation()?await(0,qe.Kd)({option:t,model:e,assemblyName:u}):t.results?.length?e.setSearchResults(t.results,t.getLabel()):p&&await(0,qe.cm)({input:t.getLabel(),assembly:p,model:e})}catch(t){console.error(t),(0,a.getSession)(e).notify(`${t}`,"warning")}},assemblyName:u,fetchResults:e=>(0,ye.Jf)({queryString:e,searchScope:m,rankSearchResults:d,textSearchManager:i,assembly:p}),model:e,minWidth:175,TextFieldProps:{variant:"outlined",className:r.headerRefName,style:{margin:Ie.Es},InputProps:{style:{padding:0,height:Ie.P5,background:(0,ae.X4)(n.palette.background.paper,.8)}}}})})),Je=Ue,Xe=(0,M.n9)()((e=>({headerBar:{display:"flex"},headerForm:{flexWrap:"nowrap",marginRight:7},spacer:{flexGrow:1},panButton:{background:(0,ae.X4)(e.palette.background.paper,.8),color:e.palette.text.primary,margin:Ie.Es},bp:{display:"flex",alignItems:"center",marginLeft:5},toggleButton:{height:44,border:"none",marginLeft:e.spacing(4)},buttonSpacer:{marginRight:e.spacing(2)}}))),Ye=(0,A.observer)((({model:e})=>{const{classes:t}=Xe();return c.createElement(ie.A,{onClick:e.activateTrackSelector,className:t.toggleButton,title:"Open track selector",value:"track_select"},c.createElement(X.xU,{className:t.buttonSpacer}))}));function Ke({model:e}){const{classes:t}=Xe();return c.createElement(c.Fragment,null,c.createElement(v.A,{variant:"outlined",className:t.panButton,onClick:()=>{e.slide(-.9)}},c.createElement(fe.A,null)),c.createElement(v.A,{variant:"outlined",className:t.panButton,onClick:()=>{e.slide(.9)}},c.createElement(he.A,null)))}const Qe=(0,A.observer)((function({model:e}){const{classes:t}=Xe(),{coarseTotalBp:r}=e;return c.createElement(me.A,{variant:"body2",color:"textSecondary",className:t.bp},(0,a.getBpDisplayStr)(r))})),Ze=({model:e})=>{const{classes:t}=Xe();return c.createElement("div",{className:t.headerBar},c.createElement(Ye,{model:e}),c.createElement("div",{className:t.spacer}),c.createElement(ge.A,{row:!0,className:t.headerForm},c.createElement(Ke,{model:e}),c.createElement(Je,{model:e})),c.createElement(Qe,{model:e}),c.createElement(Ge,{model:e}),c.createElement("div",{className:t.spacer}))},et=(0,A.observer)((function({model:e}){const{hideHeader:t,hideHeaderOverview:r}=e;return t?null:r?c.createElement(Ze,{model:e}):c.createElement(Oe,{model:e},c.createElement(Ze,{model:e}))})),tt=et;var rt=r(98273),nt=r(98753);const at=(0,c.lazy)((()=>Promise.resolve().then(r.bind(r,87686)))),ot=(0,c.lazy)((()=>r.e(1281).then(r.bind(r,61281)))),it=(0,c.lazy)((()=>r.e(8528).then(r.bind(r,98528)))),st=(0,c.lazy)((()=>r.e(7761).then(r.bind(r,77761)))),lt=(0,c.lazy)((()=>r.e(9067).then(r.bind(r,79067))));function ct(e){if(!e.length)return"";const t=e.every((t=>t.assemblyName===e[0].assemblyName));return e.map((e=>(0,a.assembleLocString)({...e,start:Math.round(e.start),end:Math.round(e.end),assemblyName:t?void 0:e.assemblyName}))).join(" ")}function dt(e){return i.types.compose("LinearGenomeView",d.BaseViewModel,i.types.model({id:j.ElementId,type:i.types.literal("LinearGenomeView"),offsetPx:0,bpPerPx:1,displayedRegions:i.types.optional(i.types.frozen(),[]),tracks:i.types.array(e.pluggableMstType("track","stateModel")),hideHeader:!1,hideHeaderOverview:!1,hideNoTracksActive:!1,trackSelectorType:i.types.optional(i.types.enumeration(["hierarchical"]),"hierarchical"),showCenterLine:i.types.optional(i.types.boolean,(()=>Boolean(JSON.parse((0,a.localStorageGetItem)("lgv-showCenterLine")||"false")))),showCytobandsSetting:i.types.optional(i.types.boolean,(()=>Boolean(JSON.parse((0,a.localStorageGetItem)("lgv-showCytobands")||"true")))),trackLabels:i.types.optional(i.types.string,(()=>(0,a.localStorageGetItem)("lgv-trackLabels")||"")),showGridlines:!0,highlight:i.types.optional(i.types.array(i.types.frozen()),[]),colorByCDS:i.types.optional(i.types.boolean,(()=>Boolean(JSON.parse((0,a.localStorageGetItem)("lgv-colorByCDS")||"false")))),showTrackOutlines:i.types.optional(i.types.boolean,(()=>Boolean(JSON.parse((0,a.localStorageGetItem)("lgv-showTrackOutlines")||"true"))))})).volatile((()=>({volatileWidth:void 0,minimumBlockWidth:3,draggingTrackId:void 0,volatileError:void 0,afterDisplayedRegionsSetCallbacks:[],scaleFactor:1,trackRefs:{},coarseDynamicBlocks:[],coarseTotalBp:0,leftOffset:void 0,rightOffset:void 0}))).views((e=>({get trackLabelsSetting(){const t=(0,o.getConf)((0,a.getSession)(e),["LinearGenomeViewPlugin","trackLabels"]);return e.trackLabels||t},get width(){if(void 0===e.volatileWidth)throw new Error("width undefined, make sure to check for model.initialized");return e.volatileWidth},get interRegionPaddingWidth(){return Ie.Rd},get assemblyNames(){return[...new Set(e.displayedRegions.map((e=>e.assemblyName)))]}}))).views((e=>({scaleBarDisplayPrefix:()=>"LinearSyntenyView"===(0,i.getParent)(e,2).type?e.assemblyNames[0]:"",MiniControlsComponent:()=>pe,HeaderComponent:()=>tt,get assemblyErrors(){const{assemblyManager:t}=(0,a.getSession)(e);return e.assemblyNames.map((e=>t.get(e)?.error)).filter((e=>!!e)).join(", ")},get assembliesInitialized(){const{assemblyManager:t}=(0,a.getSession)(e),{assemblyNames:r}=e;return r.every((e=>t.get(e)?.initialized))},get initialized(){return void 0!==e.volatileWidth&&this.assembliesInitialized},get hasDisplayedRegions(){return e.displayedRegions.length>0},get scaleBarHeight(){return Ie.jE+Ie.i3},get headerHeight(){return e.hideHeader?0:e.hideHeaderOverview?Ie.Ij:Ie.Ij+Ie.Gu},get trackHeights(){return(0,a.sum)(e.tracks.map((e=>e.displays[0].height)))},get trackHeightsWithResizeHandles(){return this.trackHeights+e.tracks.length*Ie.i3},get height(){return this.trackHeightsWithResizeHandles+this.headerHeight+this.scaleBarHeight},get totalBp(){return(0,a.sum)(e.displayedRegions.map((e=>e.end-e.start)))},get maxBpPerPx(){return this.totalBp/(.9*e.width)},get minBpPerPx(){return.02},get error(){return e.volatileError||this.assemblyErrors},get maxOffset(){return this.displayedRegionsTotalPx-10},get minOffset(){return 30-e.width},get displayedRegionsTotalPx(){return this.totalBp/e.bpPerPx},renderProps:()=>({...(0,p.getParentRenderProps)(e),bpPerPx:e.bpPerPx,colorByCDS:e.colorByCDS}),searchScope:t=>({assemblyName:t,includeAggregateIndexes:!0,tracks:e.tracks}),getTrack:t=>e.tracks.find((e=>e.configuration.trackId===t)),rankSearchResults(t){const r=new Set(e.tracks.map((e=>e.configuration.trackId)));for(const e of t)r.has(e.trackId)&&e.updateScore(e.getScore()+1);return t},rewriteOnClicks(t,r){r.forEach((r=>{if("subMenu"in r&&this.rewriteOnClicks(t,r.subMenu),"onClick"in r){const n=r.onClick;r.onClick=(...r)=>{e.tracks.forEach((e=>{e.type===t&&n.apply(e,[e,...r])}))}}}))},get trackTypeActions(){const t=new Map;return e.tracks.forEach((e=>{if(!t.get(e.type)){const r=J()(e.viewMenuActions);this.rewriteOnClicks(e.type,r),t.set(e.type,r)}})),t}}))).actions((t=>({setShowTrackOutlines(e){t.showTrackOutlines=e},setColorByCDS(e){t.colorByCDS=e},setShowCytobands(e){t.showCytobandsSetting=e},setWidth(e){t.volatileWidth=e},setError(e){t.volatileError=e},setHideHeader(e){t.hideHeader=e},setHideHeaderOverview(e){t.hideHeaderOverview=e},setHideNoTracksActive(e){t.hideNoTracksActive=e},setShowGridlines(e){t.showGridlines=e},addToHighlights(e){t.highlight.push(e)},setHighlight(e){t.highlight=(0,i.cast)(e)},removeHighlight(e){t.highlight.remove(e)},scrollTo(e){const r=(0,a.clamp)(e,t.minOffset,t.maxOffset);return t.offsetPx=r,r},zoomTo(e,r=t.width/2,n=!1){const o=(0,a.clamp)(e,t.minBpPerPx,t.maxBpPerPx);if(o===t.bpPerPx)return o;const i=t.bpPerPx;return Math.abs(i-o)<1e-6?(console.warn("zoomTo bpPerPx rounding error"),i):(t.bpPerPx=o,this.scrollTo(Math.round((t.offsetPx+r)*i/o-(n?t.width/2:r))),o)},setOffsets(e,r){t.leftOffset=e,t.rightOffset=r},setSearchResults(e,r,n){(0,a.getSession)(t).queueDialog((a=>[lt,{model:t,searchResults:e,searchQuery:r,handleClose:a,assemblyName:n}]))},setNewView(e,t){this.zoomTo(e),this.scrollTo(t)},horizontallyFlip(){t.displayedRegions=(0,i.cast)([...t.displayedRegions].reverse().map((e=>({...e,reversed:!e.reversed})))),this.scrollTo(t.totalBp/t.bpPerPx-t.offsetPx-t.width)},showTrack(r,n={},a={}){const o=e.pluggableConfigSchemaType("track"),s=(0,i.resolveIdentifier)(o,(0,i.getRoot)(t),r);if(!s)throw new Error(`Could not resolve identifier "${r}"`);const l=e.getTrackType(s?.type);if(!l)throw new Error(`Unknown track type ${s.type}`);const c=e.getViewType(t.type),d=new Set(c.displayTypes.map((e=>e.name))),u=s.displays.find((e=>d.has(e.type)));if(!u)throw new Error(`Could not find a compatible display for view type ${t.type}`);const p=t.tracks.filter((e=>e.configuration===s));if(0===p.length){const e=l.stateModel.create({...n,type:s.type,configuration:s,displays:[{type:u.type,configuration:u,...a}]});return t.tracks.push(e),e}return p[0]},hideTrack(r){const n=e.pluggableConfigSchemaType("track"),a=(0,i.resolveIdentifier)(n,(0,i.getRoot)(t),r),o=t.tracks.filter((e=>e.configuration===a));return(0,m.transaction)((()=>{o.forEach((e=>t.tracks.remove(e)))})),o.length}}))).actions((e=>({moveTrackDown(t){const r=e.tracks.findIndex((e=>e.id===t));-1!==r&&-1!==r&&r<e.tracks.length-1&&e.tracks.splice(r,2,e.tracks[r+1],e.tracks[r])},moveTrackUp(t){const r=e.tracks.findIndex((e=>e.id===t));r>0&&e.tracks.splice(r-1,2,e.tracks[r],e.tracks[r-1])},moveTrackToTop(t){const r=e.tracks.findIndex((e=>e.id===t));e.tracks=(0,i.cast)([e.tracks[r],...e.tracks.filter((e=>e.id!==t))])},moveTrackToBottom(t){const r=e.tracks.findIndex((e=>e.id===t));e.tracks=(0,i.cast)([...e.tracks.filter((e=>e.id!==t)),e.tracks[r]])},moveTrack(t,r){const n=e.tracks.findIndex((e=>e.id===t));if(-1===n)throw new Error(`Track ID ${t} not found`);const a=e.tracks.findIndex((e=>e.id===r));if(-1===a)throw new Error(`Track ID ${r} not found`);const o=e.tracks.filter(((e,t)=>t!==n));o.splice(a,0,e.tracks[n]),e.tracks=(0,i.cast)(o)},toggleTrack:t=>!e.hideTrack(t)&&(e.showTrack(t),!0),setTrackLabels(t){localStorage.setItem("lgv-trackLabels",t),e.trackLabels=t},setShowCenterLine(t){e.showCenterLine=t},setDisplayedRegions(t){e.displayedRegions=(0,i.cast)(t),e.zoomTo(e.bpPerPx)},activateTrackSelector(){if("hierarchical"===e.trackSelectorType){const t=(0,a.getSession)(e);if((0,a.isSessionModelWithWidgets)(t)){const r=t.addWidget("HierarchicalTrackSelectorWidget","hierarchicalTrackSelector",{view:e});return t.showWidget(r),r}}throw new Error(`invalid track selector type ${e.trackSelectorType}`)},getSelectedRegions(t,r){const n=(0,i.getSnapshot)(e),a=$.A.create({...n,interRegionPaddingWidth:e.interRegionPaddingWidth});return a.setVolatileWidth(e.width),a.moveTo(t,r),a.dynamicBlocks.contentBlocks.map((e=>({...e,start:Math.floor(e.start),end:Math.ceil(e.end)})))},afterDisplayedRegionsSet(t){e.afterDisplayedRegionsSetCallbacks.push(t)},horizontalScroll(t){const r=e.offsetPx;return e.scrollTo(e.offsetPx+t)-r},center(){const t=e.totalBp/2/e.bpPerPx;e.scrollTo(Math.round(t-e.width/2))},showAllRegions(){e.zoomTo(e.maxBpPerPx),this.center()},showAllRegionsInAssembly(t){const r=(0,a.getSession)(e),{assemblyManager:n}=r;if(!t){const n=new Set(e.displayedRegions.map((e=>e.assemblyName)));if(n.size>1)return void r.notify("Can't perform operation with multiple assemblies currently");[t]=[...n]}const o=n.get(t);if(o){const{regions:t}=o;t&&(this.setDisplayedRegions(t),e.zoomTo(e.maxBpPerPx),this.center())}},setDraggingTrackId(t){e.draggingTrackId=t},setScaleFactor(t){e.scaleFactor=t},clearView(){this.setDisplayedRegions([]),e.tracks.clear(),e.scrollTo(0),e.zoomTo(10)},async exportSvg(t={}){const{renderToSvg:n}=await Promise.resolve().then(r.bind(r,98753)),a=await n(e,t),o=new Blob([a],{type:"image/svg+xml"});(0,_.saveAs)(o,t.filename||"image.svg")}}))).actions((e=>{let t=()=>{};return{slide:function(r){const[n,o]=(0,a.springAnimate)(e.offsetPx,e.offsetPx+e.width*r,e.scrollTo,void 0,void 0,200);t(),t=o,n()}}})).actions((e=>{let t=()=>{};return{zoom:function(r){if(e.zoomTo(e.bpPerPx),r<e.bpPerPx&&e.bpPerPx===e.minBpPerPx||r>e.bpPerPx&&e.bpPerPx===e.maxBpPerPx)return;const n=e.bpPerPx/r,[o,i]=(0,a.springAnimate)(1,n,e.setScaleFactor,(()=>{e.zoomTo(r),e.setScaleFactor(1)}));t(),t=i,o()}}})).views((e=>({get canShowCytobands(){return 1===e.displayedRegions.length&&this.anyCytobandsExist},get showCytobands(){return this.canShowCytobands&&e.showCytobandsSetting},get anyCytobandsExist(){const{assemblyManager:t}=(0,a.getSession)(e);return e.assemblyNames.some((e=>t.get(e)?.cytobands?.length))},get cytobandOffset(){return this.showCytobands?(0,a.measureText)(e.displayedRegions[0]?.refName||"",12)+15:0}}))).views((e=>({menuItems(){const{canShowCytobands:t,showCytobands:r}=e,n=(0,a.getSession)(e),o=[{label:"Return to import form",onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[at,{model:e,handleClose:t}]))},icon:Z.A},...(0,a.isSessionWithAddTracks)(n)?[{label:"Sequence search",icon:ne.A,onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[ot,{model:e,handleClose:t}]))}}]:[],{label:"Export SVG",icon:ee.A,onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[it,{model:e,handleClose:t}]))}},{label:"Open track selector",onClick:e.activateTrackSelector,icon:X.xU},{label:"Horizontally flip",icon:Y.A,onClick:e.horizontallyFlip},{label:"Color by CDS",type:"checkbox",checked:e.colorByCDS,icon:re.A,onClick:()=>{e.setColorByCDS(!e.colorByCDS)}},{label:"Show...",icon:K.A,subMenu:[{label:"Show all regions in assembly",onClick:e.showAllRegionsInAssembly},{label:"Show center line",type:"checkbox",checked:e.showCenterLine,onClick:()=>{e.setShowCenterLine(!e.showCenterLine)}},{label:"Show header",type:"checkbox",checked:!e.hideHeader,onClick:()=>{e.setHideHeader(!e.hideHeader)}},{label:"Show track outlines",type:"checkbox",checked:e.showTrackOutlines,onClick:()=>{e.setShowTrackOutlines(!e.showTrackOutlines)}},{label:"Show header overview",type:"checkbox",checked:!e.hideHeaderOverview,onClick:()=>{e.setHideHeaderOverview(!e.hideHeaderOverview)},disabled:e.hideHeader},{label:"Show no tracks active button",type:"checkbox",checked:!e.hideNoTracksActive,onClick:()=>{e.setHideNoTracksActive(!e.hideNoTracksActive)}},{label:"Show guidelines",type:"checkbox",checked:e.showGridlines,onClick:()=>{e.setShowGridlines(!e.showGridlines)}},...t?[{label:"Show ideogram",type:"checkbox",checked:e.showCytobands,onClick:()=>{e.setShowCytobands(!r)}}]:[]]},{label:"Track labels",icon:Q.A,subMenu:[{label:"Overlapping",icon:K.A,type:"radio",checked:"overlapping"===e.trackLabelsSetting,onClick:()=>{e.setTrackLabels("overlapping")}},{label:"Offset",icon:K.A,type:"radio",checked:"offset"===e.trackLabelsSetting,onClick:()=>{e.setTrackLabels("offset")}},{label:"Hidden",icon:K.A,type:"radio",checked:"hidden"===e.trackLabelsSetting,onClick:()=>{e.setTrackLabels("hidden")}}]}];for(const[t,r]of e.trackTypeActions.entries())r.length&&(o.push({type:"divider"},{type:"subHeader",label:t}),r.forEach((e=>o.push(e))));return o}}))).views((e=>{let t,r="";return{get staticBlocks(){const n=(0,G.A)(e),a=JSON.stringify(n);return r!==a&&(t=n,r=a),t},get dynamicBlocks(){return(0,W.A)(e)},get roundedDynamicBlocks(){return this.dynamicBlocks.contentBlocks.map((e=>({...e,start:Math.floor(e.start),end:Math.ceil(e.end)})))},get visibleLocStrings(){return ct(this.dynamicBlocks.contentBlocks)},get coarseVisibleLocStrings(){return ct(e.coarseDynamicBlocks)}}})).actions((e=>({setCoarseDynamicBlocks(t){e.coarseDynamicBlocks=t.contentBlocks,e.coarseTotalBp=t.totalBp},afterAttach(){(0,i.addDisposer)(e,(0,m.autorun)((()=>{e.initialized&&this.setCoarseDynamicBlocks(e.dynamicBlocks)}),{delay:150})),(0,i.addDisposer)(e,(0,m.autorun)((()=>{const t=e=>JSON.stringify(e),{showCytobandsSetting:r,showCenterLine:n,colorByCDS:o}=e;(0,a.localStorageSetItem)("lgv-showCytobands",t(r)),(0,a.localStorageSetItem)("lgv-showCenterLine",t(n)),(0,a.localStorageSetItem)("lgv-colorByCDS",t(o))})))}}))).actions((e=>({moveTo(t,r){(0,q.tw)(e,t,r)},async navToLocString(t,r){const{assemblyNames:n}=e,{assemblyManager:o}=(0,a.getSession)(e),i=r||n[0];return i&&await o.waitForAssembly(i),this.navToLocations((0,Re.CU)(t,i,((e,t)=>o.isValidRefName(e,t))),i)},async navToSearchString({input:t,assembly:r}){await(0,qe.cm)({input:t,assembly:r,model:e})},async navToLocations(t,r){const{assemblyManager:n}=(0,a.getSession)(e);await(0,m.when)((()=>void 0!==e.volatileWidth));const o=await(0,Re.Cz)(t,n,r);if(1===o.length){const t=o[0],{reversed:r,parentRegion:n,start:i,end:s}=t;e.setDisplayedRegions([{reversed:r,...n}]),this.navTo({...t,start:(0,a.clamp)(i??0,0,n.end),end:(0,a.clamp)(s??n.end,0,n.end)})}else e.setDisplayedRegions(o.map((e=>void 0===e.start?e.parentRegion:e))),e.showAllRegions()},navTo(e){this.navToMultiple([e])},navToMultiple(t){if(t.some((e=>void 0!==e.start&&void 0!==e.end&&e.start>e.end)))throw new Error("found start greater than end");const r=t.at(0),n=t.at(-1);if(!r||!n)return;const o=e.assemblyNames[0],{assemblyManager:i}=(0,a.getSession)(e),s=i.get(r.assemblyName||o),l=i.get(n.assemblyName||o),c=s?.getCanonicalRefName(r.refName)||r.refName,d=l?.getCanonicalRefName(n.refName)||n.refName,u=e.displayedRegions.find((e=>e.refName===c)),p=(0,a.findLast)(e.displayedRegions,(e=>e.refName===d));if(!u)throw new Error(`could not find a region with refName "${c}"`);if(!p)throw new Error(`could not find a region with refName "${d}"`);const m=void 0===r.start?u.start:r.start,g=void 0===r.end?u.end:r.end,h=void 0===n.start?p.start:n.start,f=void 0===n.end?p.end:n.end,y=e.displayedRegions.findIndex((e=>c===e.refName&&m>=e.start&&m<=e.end&&g<=e.end&&g>=e.start)),b=e.displayedRegions.findIndex((e=>d===e.refName&&h>=e.start&&h<=e.end&&f<=e.end&&f>=e.start));if(-1===y||-1===b)throw new Error(`could not find a region that contained "${t.map((e=>(0,a.assembleLocString)(e)))}"`);const w=e.displayedRegions[y],v=e.displayedRegions[b];this.moveTo({index:y,offset:w.reversed?w.end-g:m-w.start},{index:b,offset:v.reversed?v.end-h:f-v.start})}}))).views((e=>({rubberBandMenuItems:()=>[{label:"Zoom to region",icon:te.A,onClick:()=>{e.moveTo(e.leftOffset,e.rightOffset)}},{label:"Get sequence",icon:g.A,onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[st,{model:e,handleClose:t}]))}}],bpToPx:({refName:t,coord:r,regionNumber:n})=>(0,q.eB)({refName:t,coord:r,regionNumber:n,self:e}),centerAt(t,r,n){const a=this.bpToPx({refName:r,coord:t,regionNumber:n});void 0!==a&&e.scrollTo(Math.round(a.offsetPx-e.width/2))},pxToBp:t=>(0,q.Ii)(e,t),get centerLineInfo(){return e.displayedRegions.length>0?this.pxToBp(e.width/2):void 0}}))).actions((e=>({afterCreate(){function t(t){(0,a.getSession)(e).focusedViewId===e.id&&(t.ctrlKey||t.metaKey)&&("ArrowLeft"===t.code?(t.preventDefault(),e.slide(-.9)):"ArrowRight"===t.code?(t.preventDefault(),e.slide(.9)):"ArrowUp"===t.code&&1===e.scaleFactor?(t.preventDefault(),e.zoom(e.bpPerPx/2)):"ArrowDown"===t.code&&1===e.scaleFactor&&(t.preventDefault(),e.zoom(2*e.bpPerPx)))}document.addEventListener("keydown",t),(0,i.addDisposer)(e,(()=>{document.removeEventListener("keydown",t)}))}}))).preProcessSnapshot((e=>{if(!e)return e;const{highlight:t,...r}=e;return{highlight:Array.isArray(t)||void 0===t?t:[t],...r}}))}const ut=function(e){return(0,o.ConfigurationSchema)("LinearBasicDisplay",{renderer:e.pluggableConfigSchemaType("renderer")},{baseConfiguration:l,explicitlyTyped:!0})};var pt=r(93100);const mt=(0,c.lazy)((()=>r.e(4033).then(r.bind(r,34033)))),gt=(0,c.lazy)((()=>r.e(2412).then(r.bind(r,92412)))),ht=function(e){return i.types.compose("LinearBasicDisplay",x,i.types.model({type:i.types.literal("LinearBasicDisplay"),trackShowLabels:i.types.maybe(i.types.boolean),trackShowDescriptions:i.types.maybe(i.types.boolean),trackDisplayMode:i.types.maybe(i.types.string),trackMaxHeight:i.types.maybe(i.types.number),configuration:(0,o.ConfigurationReference)(e),jexlFilters:i.types.maybe(i.types.array(i.types.string))})).views((e=>({get activeFilters(){return e.jexlFilters??(0,o.getConf)(e,"jexlFilters").map((e=>`jexl:${e}`))},get rendererTypeName(){return(0,o.getConf)(e,["renderer","type"])},get showLabels(){return e.trackShowLabels??(0,o.getConf)(e,["renderer","showLabels"])},get showDescriptions(){return e.trackShowDescriptions??(0,o.getConf)(e,["renderer","showDescriptions"])},get maxHeight(){return e.trackMaxHeight??(0,o.getConf)(e,["renderer","maxHeight"])},get displayMode(){return e.trackDisplayMode??(0,o.getConf)(e,["renderer","displayMode"])}}))).views((e=>({get rendererConfig(){const t=(0,o.getConf)(e,["renderer"])||{};return e.rendererType.configSchema.create({...t,showLabels:e.showLabels,showDescriptions:e.showDescriptions,displayMode:e.displayMode,maxHeight:e.maxHeight},(0,i.getEnv)(e))}}))).actions((e=>({setJexlFilters(t){e.jexlFilters=(0,i.cast)(t)},toggleShowLabels(){e.trackShowLabels=!e.showLabels},toggleShowDescriptions(){e.trackShowDescriptions=!e.showDescriptions},setDisplayMode(t){e.trackDisplayMode=t},setMaxHeight(t){e.trackMaxHeight=t}}))).views((e=>{const{trackMenuItems:t,renderProps:r}=e;return{renderProps:()=>({...r(),config:e.rendererConfig,filters:new pt.A({filters:e.activeFilters})}),trackMenuItems:()=>[...t(),{label:"Show labels",icon:K.A,type:"checkbox",checked:e.showLabels,onClick:()=>{e.toggleShowLabels()}},{label:"Show descriptions",icon:K.A,type:"checkbox",checked:e.showDescriptions,onClick:()=>{e.toggleShowDescriptions()}},{label:"Display mode",icon:K.A,subMenu:["compact","reducedRepresentation","normal","collapse"].map((t=>({label:t,onClick:()=>{e.setDisplayMode(t)}})))},{label:"Set max height",onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[mt,{model:e,handleClose:t}]))}},{label:"Edit filters",onClick:()=>{(0,a.getSession)(e).queueDialog((t=>[gt,{model:e,handleClose:t}]))}}]}}))};var ft=r(26612);class yt extends n.A{name="LinearGenomeViewPlugin";exports={BaseLinearDisplayComponent:V,BaseLinearDisplay:x,baseLinearDisplayConfigSchema:l,SearchBox:Je,ZoomControls:Ge,LinearGenomeView:rt.default};configurationSchema=(0,o.ConfigurationSchema)("LinearGenomeViewConfigSchema",{trackLabels:{type:"string",defaultValue:"overlapping",model:i.types.enumeration("trackLabelOptions",["offset","overlapping","hidden"])}});install(e){var t;(t=e).addTrackType((()=>{const e=(e=>(0,o.ConfigurationSchema)("FeatureTrack",{},{baseConfiguration:(0,z.createBaseTrackConfig)(e),explicitIdentifier:"trackId"}))(t);return new z.TrackType({name:"FeatureTrack",displayName:"Feature track",configSchema:e,stateModel:(0,z.createBaseTrackModel)(t,"FeatureTrack",e)})})),function(e){e.addTrackType((()=>{const t=(e=>(0,o.ConfigurationSchema)("BasicTrack",{},{baseConfiguration:(0,z.createBaseTrackConfig)(e),explicitIdentifier:"trackId"}))(e);return new z.TrackType({name:"BasicTrack",configSchema:t,stateModel:(0,z.createBaseTrackModel)(e,"BasicTrack",t)})}))}(e),function(e){e.addDisplayType((()=>{const t=ut(e);return new z.DisplayType({name:"LinearBasicDisplay",displayName:"Basic feature display",configSchema:t,stateModel:ht(t),trackType:"FeatureTrack",viewType:"LinearGenomeView",ReactComponent:V})}))}(e),function(e){e.addViewType((()=>new z.ViewType({name:"LinearGenomeView",displayName:"Linear genome view",stateModel:dt(e),ReactComponent:(0,c.lazy)((()=>Promise.resolve().then(r.bind(r,98273))))})))}(e),function(e){e.addDisplayType((()=>{const t=O(e);return new z.DisplayType({name:"LinearBareDisplay",configSchema:t,displayName:"Bare feature display",stateModel:H(t),trackType:"BasicTrack",viewType:"LinearGenomeView",ReactComponent:V})}))}(e),function(e){e.addToExtensionPoint("LaunchView-LinearGenomeView",(async({session:e,assembly:t,loc:r,tracks:n=[],tracklist:o,nav:i,highlight:s})=>{try{const{assemblyManager:l}=e,{isValidRefName:c}=l,d=e.addView("LinearGenomeView",{});if(await(0,a.when)((()=>!!d.volatileWidth)),!t)throw new Error("No assembly provided when launching linear genome view");const u=await l.waitForAssembly(t);if(!u)throw new Error(`Assembly "${t}" not found when launching linear genome view`);o&&d.activateTrackSelector(),void 0!==i&&d.setHideHeader(!i),void 0!==s&&s.forEach((async e=>{const r=(0,a.parseLocString)(e,(e=>c(e,t))),{start:n,end:o}=r;void 0!==n&&void 0!==o&&d.addToHighlights({...r,start:n,end:o,assemblyName:t})})),await(0,qe.cm)({input:r,model:d,assembly:u});const p=[];if(n.forEach((e=>{!function(e,t,r){try{e.showTrack(t)}catch(e){if(!/Could not resolve identifier/.exec(`${e}`))throw e;r.push(t)}}(d,e,p)})),p.length)throw new Error(`Could not resolve identifiers: ${p.join(",")}`)}catch(t){throw e.notifyError(`${t}`,t),t}}))}(e)}configure(e){(0,a.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToSubMenu(["Add"],{label:"Linear genome view",icon:s.A,onClick:e=>{e.addView("LinearGenomeView",{})}})}}},6184:(e,t,r)=>{"use strict";r.d(t,{Kd:()=>o,cm:()=>i});var n=r(99546),a=r(8656);async function o({option:e,model:t,assemblyName:r}){const n=e.getLocation(),a=e.getTrackId();n&&(await t.navToLocString(n,r),a&&t.showTrack(a))}async function i({input:e,model:t,assembly:r}){const i=r.allRefNamesWithLowerCase||[],s=r.name;if(e.split(" ").every((e=>function(e,t){const[r,n]=function(e){const t=e.lastIndexOf(":");if(-1===t)return[e,""];return[e.slice(0,t),e.slice(t+1)]}(e);return t.includes(e)||t.includes(r)&&!Number.isNaN(Number.parseInt(n,10))}(e,i))))await t.navToLocString(e,r.name);else{const i=t.searchScope(s),{textSearchManager:l}=(0,n.getSession)(t),c=await async function({queryString:e,searchType:t,searchScope:r,rankSearchResults:o,textSearchManager:i,assembly:s}){i||console.warn("No text search manager");const l=await(i?.search({queryString:e,searchType:t},r,o)),c=s?.allRefNames?.filter((t=>t.toLowerCase().startsWith(e.toLowerCase()))).slice(0,10).map((e=>new a.A({label:e})));return(0,n.dedupe)([...c||[],...l||[]],(e=>e.getId()))}({queryString:e,searchType:"exact",searchScope:i,rankSearchResults:t.rankSearchResults,textSearchManager:l,assembly:r});c.length>1?t.setSearchResults(c,e.toLowerCase(),s):1===c.length?await o({option:c[0],model:t,assemblyName:s}):await t.navToLocString(e,s)}}},54702:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(9502);const a={DEL:"deletion",INS:"insertion",DUP:"duplication",INV:"inversion",INVDUP:"inverted_duplication",CNV:"copy_number_variation",TRA:"translocation","DUP:TANDEM":"tandem_duplication",NON_REF:"sequence_variant","*":"sequence_variant"};function o(e,t,r){if(!t||0===t.length)return["remark","no alternative alleles"];const a=new Set;let o=new Set;if(t.forEach((t=>{let[l,c]=i(t,r);l||([l,c]=function(e,t){if((0,n.h)(t))return["breakend",t];if(1===e.length&&1===t.length)return["SNV",s("SNV",e,t)];if("<INS>"===t)return["insertion",t];if("<DEL>"===t)return["deletion",t];if("<DUP>"===t)return["duplication",t];if("<CNV>"===t)return["cnv",t];if("<INV>"===t)return["inversion",t];if("<TRA>"===t)return["translocation",t];if(t.includes("<"))return["sv",t];if(e.length===t.length)return e.split("").reverse().join("")===t?["inversion",s("inversion",e,t)]:["substitution",s("substitution",e,t)];if(e.length<=t.length){const r=t.length-e.length,n=r.toLocaleString("en-US");return["insertion",r>5?`${n}bp INS`:s("insertion",e,t)]}if(e.length>t.length){const r=e.length-t.length,n=r.toLocaleString("en-US");return["deletion",r>5?`${n}bp DEL`:s("deletion",e,t)]}return["indel",s("indel",e,t)]}(e,t)),l&&c&&(a.add(l),o.add(c))})),o.size>1){const e=[...o],t=new Set(e.map((e=>{const t=e.split("->");return t[1]?t[0]:e})).filter((e=>!!e)));o=new Set([...t].map((e=>e.trim())).map((t=>{const r=e.map((e=>e.split("->").map((e=>e.trim())))).map((e=>e[1]&&e[0]===t?e[1]:"")).filter((e=>!!e));return r.length?`${t} -> ${r.join(",")}`:t})))}return a.size?[[...a].join(","),[...o].join(",")]:[]}function i(e,t){if("string"==typeof e&&!e.startsWith("<"))return[];let r=a[e];if(!r&&t.getMetadata("ALT",e)&&(r="sequence_variant"),r)return[r,e];const n=e.split(":");return n.length>1?i(`<${n.slice(0,-1).join(":")}>`,t):[]}function s(e,t,r){return`${e} ${t} -> ${r}`}class l{constructor(e){this.variant=e.variant,this.parser=e.parser,this.data=this.dataFromVariant(this.variant),this._id=e.id}get(e){return"samples"===e?this.variant.SAMPLES:this.data[e]??this.variant[e]}set(){}parent(){}children(){}tags(){return[...Object.keys(this.data),...Object.keys(this.variant),"samples"]}id(){return this._id}dataFromVariant(e){const{REF:t,ALT:r,POS:n,CHROM:a,INFO:i,ID:s}=e,l=n-1,[c,d]=o(t,r,this.parser),u=r?.includes("<TRA>"),p=r?.some((e=>e.includes("<")));return{refName:a,start:l,end:p&&i.END&&!u?+i.END[0]:l+t.length,description:d,type:c,name:s?.join(","),aliases:s&&s.length>1?s.slice(1):void 0}}toJSON(){return{uniqueId:this._id,...this.variant,...this.data,samples:this.variant.SAMPLES}}}},79230:(e,t,r)=>{"use strict";r.d(t,{_:()=>I.A,A:()=>N});var n=r(47369),a=r(68584);const o=(0,a.ConfigurationSchema)("VcfAdapter",{vcfLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.vcf",locationType:"UriLocation"}}},{explicitlyTyped:!0});var i=r(36422);const s=(0,a.ConfigurationSchema)("VcfTabixAdapter",{vcfGzLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.vcf.gz",locationType:"UriLocation"}},index:(0,a.ConfigurationSchema)("VcfIndex",{indexType:{model:i.types.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:{type:"fileLocation",defaultValue:{uri:"/path/to/my.vcf.gz.tbi",locationType:"UriLocation"}}})},{explicitlyTyped:!0});var l=r(91468),c=r(58273),d=r(1622),u=r(58921);var p=r(12678),m=r(14349),g=r(56328);var h=r(99546);var f=r(20529);function y(e){return i.types.compose("LinearVariantDisplay",(0,f.bN)(e),i.types.model({type:i.types.literal("LinearVariantDisplay"),configuration:(0,a.ConfigurationReference)(e)})).actions((e=>({async selectFeature(t){const r=(0,h.getSession)(e);if((0,h.isSessionModelWithWidgets)(r)){const{rpcManager:n}=r,o=(0,l.getRpcSessionId)(e),i=(0,h.getContainingTrack)(e),s=(0,h.getContainingView)(e),c=(0,a.getConf)(i,"adapter"),d=await n.call(o,"CoreGetMetadata",{adapterConfig:c});r.showWidget(r.addWidget("VariantFeatureWidget","variantFeature",{featureData:t.toJSON(),view:s,track:i,descriptions:d}))}r.setSelection(t)}})))}var b=r(94318);const w=(0,a.ConfigurationSchema)("StructuralVariantChordRenderer",{strokeColor:{type:"color",description:"the line color of each arc",defaultValue:"rgba(255,133,0,0.32)",contextVariable:["feature"]},strokeColorSelected:{type:"color",description:"the line color of an arc that has been selected",defaultValue:"black",contextVariable:["feature"]},strokeColorHover:{type:"color",description:"the line color of an arc that is being hovered over with the mouse",defaultValue:"#555",contextVariable:["feature"]}},{explicitlyTyped:!0});var v=r(7552),C=r(68446),S=r(9502);function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(null,arguments)}function T(e,t){const r=e.region.elided?0:e.region.start,n=e.region.elided?0:e.region.end;return(e.flipped?n-t:t-r)/e.bpPerRadian+e.startRadians}const x=(0,C.observer)((function({feature:e,blocksForRefs:t,radius:r,config:n,bezierRadius:o,selected:i,onClick:s}){const[l,c]=(0,v.useState)(!1),d=t[e.get("refName")];if(!d)return null;let u,p,m;e.get("INFO")?[u]=e.get("INFO").SVTYPE||[]:e.get("mate")&&(u="mate");const g=e.get("ALT")?.[0],f=g&&(0,S.h)(g),y=e.get("start");if(f){const e=f.MatePosition.split(":");p=+e[1],m=t[e[0]]}else if("<TRA>"===g){const r=e.get("INFO")?.CHR2?.[0],n=e.get("INFO")?.END?.[0];p=Number.parseInt(n,10),m=t[r]}else if("mate"===u){const r=e.get("mate"),n=r.refName;p=r.start,m=t[n]}else console.warn("unknown sv type",u),p=y+1;if(m){const t=T(d,y),u=T(m,p),g=(0,h.polarToCartesian)(r,t),f=(0,h.polarToCartesian)(r,u),b=(0,h.polarToCartesian)(o,(u+t)/2),w=i?(0,a.readConfObject)(n,"strokeColorSelected",{feature:e}):(0,a.readConfObject)(n,"strokeColor",{feature:e}),C=(0,a.readConfObject)(n,"strokeColorHover",{feature:e});return v.createElement("path",k({"data-testid":`chord-${e.id()}`,cursor:"crosshair",fill:"none",d:["M",...g,"Q",...b,...f].join(" ")},(0,h.getStrokeProps)(l?C:w),{strokeWidth:l?3:1,onClick:t=>{s(e,d.region,m.region,t)},onMouseOver:()=>{i||c(!0)},onMouseOut:()=>{i||c(!1)}}))}return null})),A=(0,C.observer)((function({features:e,config:t,blockDefinitions:r,radius:n,bezierRadius:a,displayModel:o,onChordClick:i}){const{selectedFeatureId:s}=o||{},l=(0,v.useMemo)((()=>{const e={};for(const t of r){const r=t.region.elided?t.region.regions:[t.region];for(const n of r)e[n.refName]=t}return e}),[r]);return v.createElement("g",{"data-testid":"structuralVariantChordRenderer"},[...e.values()].map((e=>{const r=e.id(),o=String(s)===String(r);return v.createElement(x,{key:r,feature:e,config:t,radius:n,bezierRadius:a,blocksForRefs:l,selected:o,onClick:i})})))}));var P=r(67736),M=r(9342);function E(e){const t=(0,M.n)(e);return i.types.compose(t,i.types.model("VariantFeatureWidget",{type:i.types.literal("VariantFeatureWidget"),descriptions:i.types.frozen()}))}const R=(0,a.ConfigurationSchema)("VariantFeatureWidget",{});var I=r(54702);class N extends p.A{name="VariantsPlugin";install(e){var t;!function(e){e.addAdapterType((()=>new n.A({name:"VcfAdapter",displayName:"VCF adapter",configSchema:o,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4499),r.e(8343)]).then(r.bind(r,98343)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new n.A({name:"VcfTabixAdapter",displayName:"VCF tabix adapter",configSchema:s,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(8120),r.e(6621)]).then(r.bind(r,66621)).then((e=>e.default))})))}(e),function(e){e.addWidgetType((()=>new P.A({name:"VariantFeatureWidget",heading:"Feature details",configSchema:R,stateModel:E(e),ReactComponent:(0,v.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(5008),r.e(8984),r.e(8109)]).then(r.bind(r,88109))))})))}(e),(t=e).addTrackType((()=>{const e=(e=>(0,a.ConfigurationSchema)("VariantTrack",{},{baseConfiguration:(0,u.createBaseTrackConfig)(e)}))(t);return new c.A({name:"VariantTrack",displayName:"Variant track",configSchema:e,stateModel:(0,d.createBaseTrackModel)(t,"VariantTrack",e)})})),function(e){e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="VcfTabixAdapter",o=(0,l.getFileName)(t),i=r&&(0,l.getFileName)(r),s={type:a,vcfGzLocation:t,index:{location:r||(0,l.makeIndex)(t,".tbi"),indexType:(0,l.makeIndexType)(i,"CSI","TBI")}};return/\.vcf\.b?gz$/i.test(o)&&!n||n===a?s:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"VcfTabixAdapter"===t||"VcfAdapter"===t?"VariantTrack":e(t))),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="VcfAdapter",o=(0,l.getFileName)(t);return/\.vcf$/i.test(o)||n===a?{type:a,vcfLocation:t}:e(t,r,n)}))}(e),function(e){e.addDisplayType((()=>{const t=function(e){return(0,a.ConfigurationSchema)("LinearVariantDisplay",{},{baseConfiguration:(0,f.lw)(e),explicitlyTyped:!0})}(e);return new g.A({name:"LinearVariantDisplay",displayName:"Variant display",configSchema:t,stateModel:y(t),trackType:"VariantTrack",viewType:"LinearGenomeView",ReactComponent:f.GQ})}))}(e),function(e){e.addRendererType((()=>new b.A({name:"StructuralVariantChordRenderer",displayName:"SV chord renderer",ReactComponent:A,configSchema:w,pluginManager:e})))}(e),function(e){e.addDisplayType((()=>{const t=function(e){return(0,a.ConfigurationSchema)("ChordVariantDisplay",{renderer:i.types.optional(e.pluggableConfigSchemaType("renderer"),{type:"StructuralVariantChordRenderer"})},{baseConfiguration:m.kO,explicitlyTyped:!0})}(e),r=(e=>i.types.compose("ChordVariantDisplay",m.dg,i.types.model({type:i.types.literal("ChordVariantDisplay"),configuration:(0,a.ConfigurationReference)(e)})).views((e=>({get rendererTypeName(){return e.configuration.renderer.type},renderProps(){const t=(0,h.getContainingView)(e);return{...(0,l.getParentRenderProps)(e),rpcDriverName:e.rpcDriverName,displayModel:e,bezierRadius:t.radiusPx*e.bezierRadiusRatio,radius:t.radiusPx,blockDefinitions:e.blockDefinitions,config:e.configuration.renderer,onChordClick:t=>{e.onChordClick(t)}}}}))))(t);return new g.A({name:"ChordVariantDisplay",displayName:"Chord variant display",configSchema:t,stateModel:r,trackType:"VariantTrack",viewType:"CircularView",ReactComponent:m.DO})}))}(e)}}},57266:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Tooltip:()=>o.A,default:()=>d});var n=r(7552),a=r(68446),o=r(88262),i=r(75429);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(null,arguments)}const l=e=>e.toLocaleString("en-US"),c=n.forwardRef((function({feature:e},t){const r=e.get("start"),a=e.get("end"),o=[e.get("refName"),e.get("name"),r===a?l(r):`${l(r)}..${l(a)}`].filter((e=>!!e)).join(":");return void 0!==e.get("summary")?n.createElement("div",{ref:t},o,n.createElement("br",null),"Max: ",(0,i.toP)(e.get("maxScore")),n.createElement("br",null),"Avg: ",(0,i.toP)(e.get("score")),n.createElement("br",null),"Min: ",(0,i.toP)(e.get("minScore"))):n.createElement("div",{ref:t},o,n.createElement("br",null),`${(0,i.toP)(e.get("score"))}`)})),d=(0,a.observer)((function(e){return n.createElement(o.A,s({TooltipContents:c},e))}))},98911:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>c});var n=r(7552),a=r(68446),o=r(99546),i=r(68584),s=r(20529),l=r(90461);const c=(0,a.observer)((e=>{const{model:t}=e,{stats:r,height:a,needsScalebar:c}=t,{trackLabels:d}=(0,o.getContainingView)(t),u=(0,o.getContainingTrack)(t),p="overlapping"===d?(0,o.measureText)((0,i.getConf)(u,"name"),12.8)+100:50;return n.createElement("div",null,n.createElement(s.GQ,e),r&&c?n.createElement("svg",{style:{position:"absolute",top:0,left:p,pointerEvents:"none",height:a,width:50}},n.createElement(l.A,{model:t})):null)}))},88262:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(7552),a=r(68446),o=r(75785),i=r(9236),s=r(75429);const l=(0,o.n9)()({hoverVertical:{background:"#333",border:"none",width:1,height:"100%",top:s.YSCALEBAR_LABEL_OFFSET,cursor:"default",position:"absolute",pointerEvents:"none"}}),c=(0,a.observer)((function({model:e,height:t,clientMouseCoord:r,offsetMouseCoord:a,clientRect:o,TooltipContents:c,useClientY:d}){const{featureUnderMouse:u}=e,{classes:p}=l(),m=r[0]+5,g=d?r[1]:o?.top||0;return u?n.createElement(n.Fragment,null,n.createElement(n.Suspense,{fallback:null},n.createElement(i.default,{clientPoint:{x:m,y:g}},n.createElement(c,{model:e,feature:u}))),n.createElement("div",{className:p.hoverVertical,style:{left:a[0],height:t-2*s.YSCALEBAR_LABEL_OFFSET}})):null}))},17970:(e,t,r)=>{"use strict";r.d(t,{r:()=>q.default,m_:()=>$.default,er:()=>s,Ep:()=>k,Oy:()=>y.YSCALEBAR_LABEL_OFFSET,Ay:()=>we,$z:()=>y.getOrigin,X_:()=>y.getScale,_i:()=>G});var n=r(12678),a=r(91468),o=r(92880),i=r(99546);class s extends o.default{supportsSVG=!0;async render(e){const t=await this.getFeatures(e),{height:r,regions:n,bpPerPx:a}=e,o=n[0],s=(o.end-o.start)/a,{reducedFeatures:l,...c}=await(0,i.renderToAbstractCanvas)(s,r,e,(r=>this.draw(r,{...e,features:t}))),d=await super.render({...e,...c,features:t,height:r,width:s});return{...d,...c,features:l?new Map(l.map((e=>[e.id(),e]))):d.features,height:r,width:s,containsNoTransferables:!0}}}var l=r(47369),c=r(68584);const d=(0,c.ConfigurationSchema)("BigWigAdapter",{bigWigLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bw",locationType:"UriLocation"}},source:{type:"string",defaultValue:"",description:"Used for multiwiggle"}},{explicitlyTyped:!0});var u=r(1622),p=r(58273);const m=(0,c.ConfigurationSchema)("MultiWiggleAdapter",{subadapters:{type:"frozen",defaultValue:[],description:"array of subadapter JSON objects"},bigWigs:{type:"frozen",description:"array of bigwig filenames, alternative to the subadapters slot",defaultValue:[]}},{explicitlyTyped:!0});var g=r(36422);const h=(0,c.ConfigurationSchema)("WiggleRenderer",{color:{type:"color",description:"the color of track, overrides posColor and negColor",defaultValue:"#f0f"},posColor:{type:"color",description:"the color to use when the score is positive",defaultValue:"blue"},negColor:{type:"color",description:"the color to use when the score is negative",defaultValue:"red"},clipColor:{type:"color",description:"the color of the clipping marker",defaultValue:"red"},bicolorPivot:{type:"stringEnum",model:g.types.enumeration("Scale type",["numeric","mean","z_score","none"]),description:"type of bicolor pivot",defaultValue:"numeric"},bicolorPivotValue:{type:"number",defaultValue:0,description:"value to use for bicolor pivot"}},{explicitlyTyped:!0}),f=(0,c.ConfigurationSchema)("DensityRenderer",{},{baseConfiguration:h,explicitlyTyped:!0});var y=r(75429);function b(e,t){const{features:r,regions:n,bpPerPx:a,scaleOpts:o,height:s,config:l}=t,d=n[0],u=(0,c.readConfObject)(l,"bicolorPivot"),p=(0,c.readConfObject)(l,"bicolorPivotValue"),m=(0,c.readConfObject)(l,"negColor"),g=(0,c.readConfObject)(l,"posColor"),h=(0,c.readConfObject)(l,"color"),f=(0,c.readConfObject)(l,"clipColor"),b="none"!==u&&"log"!==o.scaleType,w=(0,y.getScale)({...o,pivotValue:b?p:void 0,range:b?[m,"white",g]:["white",g]}),v="#f0f"===h?(e,t)=>w(t):(e,t)=>(0,c.readConfObject)(l,"color",{feature:e,score:t}),C=(0,y.getScale)({...o,range:[0,s]}).domain(),S=C[0],k=C[1];let T=Number.NEGATIVE_INFINITY,x=!1;const A=[];for(const t of r.values()){const[r,n]=(0,i.featureSpanPx)(t,d,a);Math.floor(r)!==Math.floor(T)&&(A.push(t),T=r);const o=t.get("score");x=x||o>k||o<S;const l=n-r+.3;e.fillStyle=v(t,o),e.fillRect(r,0,l,s)}if(e.save(),x){e.fillStyle=f;for(const t of r.values()){const[r,n]=(0,i.featureSpanPx)(t,d,a),s=n-r+.3,l=t.get("score");(l>k||l<S&&"log"!==o.scaleType)&&(0,y.fillRectCtx)(r,0,s,2,e)}}return e.restore(),{reducedFeatures:A}}class w extends s{async draw(e,t){return b(e,t)}}var v=r(68446),C=r(7552),S=r(49823);const k=(0,v.observer)((function(e){const{regions:t,features:r,bpPerPx:n,width:a,height:o,onMouseLeave:i,onMouseMove:s,onFeatureClick:l}=e,c=t[0],d=(0,C.useRef)(null);function u(e){let t=0;d.current&&(t=d.current.getBoundingClientRect().left);const o=e-t,i=c.reversed?a-o:o,s=c.start+n*i;let l;for(const e of r.values())if(s<=e.get("end")+n&&s>=e.get("start")){l=e;break}return l}return C.createElement("div",{ref:d,"data-testid":"wiggle-rendering-test",onMouseMove:e=>s?.(e,u(e.clientX)?.id()),onClick:e=>l?.(e,u(e.clientX)?.id()),onMouseLeave:e=>i?.(e),style:{overflow:"visible",position:"relative",height:o}},C.createElement(S.PrerenderedCanvas,e))}));var T=r(87485);function x(e,t){const r=e.toHsl(),n=r.l*(1+t);return(0,T.M)({...r,l:(0,i.clamp)(n,0,100)})}function A(e,t){const r=e.toHsl(),n=r.l*(1-t);return(0,T.M)({...r,l:(0,i.clamp)(n,0,100)})}const P=.3;function M(e,t){const{features:r,bpPerPx:n,regions:a,scaleOpts:o,height:s,config:l,ticks:d,displayCrossHatches:u,offset:p=0,colorCallback:m}=t,g=a[0],h=(g.end-g.start)/n,f=s-2*p,b=(0,c.readConfObject)(l,"filled"),w=(0,c.readConfObject)(l,"clipColor"),v=(0,c.readConfObject)(l,"summaryScoreMode"),C=(0,c.readConfObject)(l,"bicolorPivotValue"),S=(0,c.readConfObject)(l,"minSize"),k=(0,y.getScale)({...o,range:[0,f]}),M=(0,y.getOrigin)(o.scaleType),E=k.domain(),R=E[0],I=E[1],N=e=>(0,i.clamp)(f-(k(e)||0),0,f)+p,F=e=>b?(e=>N(M)-N(e))(e):Math.max(S,1);let L=!1,D=Number.NEGATIVE_INFINITY;const B=[],V=R<C&&I>C;if("whiskers"===v){let t,a;for(const o of r.values()){const[r,s]=(0,i.featureSpanPx)(o,g,n);if(o.get("summary")){const n=Math.max(s-r+P,S),i=o.get("maxScore"),l=m(o,i),c=V?l:l===t?a:a=x((0,T.M)(l),.4).toHex();(0,y.fillRectCtx)(r,N(i),n,F(i),e,c),t=l}}a=void 0,t=void 0;for(const o of r.values()){const[r,s]=(0,i.featureSpanPx)(o,g,n),l=o.get("score"),c=o.get("maxScore"),d=o.get("minScore"),u=o.get("summary"),p=m(o,l),h=V&&u?p===t?a:a=(0,T.M)(m(o,c)).mix((0,T.M)(m(o,d))).toString():p,f=Math.max(s-r+P,S);Math.floor(r)!==Math.floor(D)&&(B.push(o),D=r),L=L||l<R||l>I,(0,y.fillRectCtx)(r,N(l),f,F(l),e,h),t=p}a=void 0,t=void 0;for(const o of r.values()){const[r,s]=(0,i.featureSpanPx)(o,g,n);if(o.get("summary")){const n=o.get("minScore"),i=m(o,n),l=Math.max(s-r+P,S),c=V?i:i===t?a:a=A((0,T.M)(i),.4).toHex();(0,y.fillRectCtx)(r,N(n),l,F(n),e,c),t=i}}}else for(const t of r.values()){const[r,a]=(0,i.featureSpanPx)(t,g,n);Math.floor(r)!==Math.floor(D)&&(B.push(t),D=r);const o=t.get("score"),s=m(t,o);L=L||o<R||o>I;const l=Math.max(a-r+P,S);if("max"===v){const n=t.get("summary")?t.get("maxScore"):o;(0,y.fillRectCtx)(r,N(n),l,F(n),e,s)}else if("min"===v){const n=t.get("summary")?t.get("minScore"):o;(0,y.fillRectCtx)(r,N(n),l,F(n),e,s)}else(0,y.fillRectCtx)(r,N(o),l,F(o),e,s)}if(e.save(),L){e.fillStyle=w;for(const t of r.values()){const[r,a]=(0,i.featureSpanPx)(t,g,n),l=a-r+P,c=t.get("score");c>I?(0,y.fillRectCtx)(r,p,l,2,e):c<R&&"log"!==o.scaleType&&(0,y.fillRectCtx)(r,s,l,2,e)}}return e.restore(),u&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.5)",d.values.forEach((t=>{e.beginPath(),e.moveTo(0,Math.round(N(t))),e.lineTo(h,Math.round(N(t))),e.stroke()}))),{reducedFeatures:B}}class E extends s{async draw(e,t){const{features:r,config:n}=t,a=(0,c.readConfObject)(n,"bicolorPivotValue"),o=(0,c.readConfObject)(n,"negColor"),i=(0,c.readConfObject)(n,"posColor");return M(e,{...t,colorCallback:"#f0f"===(0,c.readConfObject)(n,"color")?(e,t)=>t<a?o:i:(e,t)=>(0,c.readConfObject)(n,"color",{feature:e}),offset:y.YSCALEBAR_LABEL_OFFSET,features:[...r.values()]})}}const R=(0,c.ConfigurationSchema)("XYPlotRenderer",{filled:{type:"boolean",defaultValue:!0},displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1},summaryScoreMode:{type:"stringEnum",model:g.types.enumeration("Score type",["max","min","avg","whiskers"]),description:"choose whether to use max/min/average or whiskers which combines all three into the same rendering",defaultValue:"whiskers"},minSize:{type:"number",defaultValue:0}},{baseConfiguration:h,explicitlyTyped:!0}),I=(0,c.ConfigurationSchema)("LinePlotRenderer",{displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1}},{baseConfiguration:h,explicitlyTyped:!0});function N(e,t){const{features:r,regions:n,bpPerPx:a,scaleOpts:o,height:s,ticks:{values:l},displayCrossHatches:d,colorCallback:u,config:p,offset:m=0}=t,g=n[0],h=(g.end-g.start)/a,f=s-2*m,b=(0,c.readConfObject)(p,"clipColor"),w=(0,y.getScale)({...o,range:[0,f]}),v=w.domain(),C=v[0],S=v[1],k=e=>(0,i.clamp)(f-(w(e)||0),0,f)+m;let T,x=Number.NEGATIVE_INFINITY;const A=[];for(const t of r.values()){const[r,n]=(0,i.featureSpanPx)(t,g,a);Math.floor(r)!==Math.floor(x)&&(A.push(t),x=r);const s=t.get("score"),l=s<C,c=s>S,d=n-r+.3,p=u(t,s);e.beginPath(),e.strokeStyle=p;const h=void 0!==T?T:s;g.reversed?(e.moveTo(n,k(h)),e.lineTo(n,k(s)),e.lineTo(r,k(s))):(e.moveTo(r,k(h)),e.lineTo(r,k(s)),e.lineTo(n,k(s))),e.stroke(),T=s,c?(e.fillStyle=b,e.fillRect(r,m,d,2)):l&&"log"!==o.scaleType&&(e.fillStyle=b,e.fillRect(r,f-2,d,f))}return d&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.5)",l.forEach((t=>{e.beginPath(),e.moveTo(0,Math.round(k(t))),e.lineTo(h,Math.round(k(t))),e.stroke()}))),{reducedFeatures:A}}class F extends s{async draw(e,t){const{config:r}=t,n=(0,c.readConfObject)(r,"color");return N(e,{...t,offset:y.YSCALEBAR_LABEL_OFFSET,colorCallback:"#f0f"===n?()=>"grey":e=>(0,c.readConfObject)(r,"color",{feature:e})})}}var L=r(56328),D=r(20529);function B(){return(0,c.ConfigurationSchema)("SharedWiggleDisplay",{autoscale:{type:"stringEnum",defaultValue:"local",model:g.types.enumeration("Autoscale type",["global","local","globalsd","localsd","zscore"]),description:"global/local using their min/max values or w/ standard deviations (globalsd/localsd)"},minimalTicks:{type:"boolean",defaultValue:!1,description:"use the minimal amount of ticks"},minScore:{type:"number",defaultValue:Number.MIN_VALUE,description:"minimum value for the y-scale"},maxScore:{type:"number",description:"maximum value for the y-scale",defaultValue:Number.MAX_VALUE},numStdDev:{type:"number",description:"number of standard deviations to use for autoscale types globalsd or localsd",defaultValue:3},scaleType:{type:"stringEnum",model:g.types.enumeration("Scale type",["linear","log"]),description:"The type of scale to use",defaultValue:"linear"},inverted:{type:"boolean",description:"draw upside down",defaultValue:!1}},{baseConfiguration:D.Ki,explicitlyTyped:!0})}var V=r(77126);const z=(0,C.lazy)((()=>r.e(8615).then(r.bind(r,8615))));function O(e){return g.types.compose(D.Lr,g.types.model({selectedRendering:g.types.optional(g.types.string,""),resolution:g.types.optional(g.types.number,1),fill:g.types.maybe(g.types.boolean),minSize:g.types.maybe(g.types.number),color:g.types.maybe(g.types.string),posColor:g.types.maybe(g.types.string),negColor:g.types.maybe(g.types.string),summaryScoreMode:g.types.maybe(g.types.string),rendererTypeNameState:g.types.maybe(g.types.string),scale:g.types.maybe(g.types.string),autoscale:g.types.maybe(g.types.string),displayCrossHatches:g.types.maybe(g.types.boolean),constraints:g.types.optional(g.types.model({max:g.types.maybe(g.types.number),min:g.types.maybe(g.types.number)}),{}),configuration:(0,c.ConfigurationReference)(e)})).volatile((()=>({message:void 0,stats:void 0,statsFetchInProgress:void 0}))).actions((e=>({updateQuantitativeStats(t){const{scoreMin:r,scoreMax:n}=t,a=1e-6;e.stats?(Math.abs(e.stats.scoreMax-n)>a||Math.abs(e.stats.scoreMin-r)>a)&&(e.stats={scoreMin:r,scoreMax:n}):e.stats={scoreMin:r,scoreMax:n}},setColor(t){e.color=t},setPosColor(t){e.posColor=t},setNegColor(t){e.negColor=t},setLoading(t){const{statsFetchInProgress:r}=e;void 0===r||r.signal.aborted||r.abort(),e.statsFetchInProgress=t},selectFeature(t){const r=(0,i.getSession)(e);(0,i.isSelectionContainer)(r)&&r.setSelection(t)},setResolution(t){e.resolution=t},setFill(t){0===t?(e.fill=!0,e.minSize=0):1===t?(e.fill=!1,e.minSize=1):2===t&&(e.fill=!1,e.minSize=2)},toggleLogScale(){e.scale="log"===e.scale?"linear":"log"},setScaleType(t){e.scale=t},setSummaryScoreMode(t){e.summaryScoreMode=t},setAutoscale(t){e.autoscale=t},setMaxScore(t){e.constraints.max=t},setRendererType(t){e.rendererTypeNameState=t},setMinScore(t){e.constraints.min=t},toggleCrossHatches(){e.displayCrossHatches=!e.displayCrossHatches},setCrossHatches(t){e.displayCrossHatches=t}}))).views((e=>({get adapterTypeName(){return e.adapterConfig.type},get rendererTypeNameSimple(){return e.rendererTypeNameState??(0,c.getConf)(e,"defaultRendering")},get filters(){},get scaleType(){return e.scale??(0,c.getConf)(e,"scaleType")},get maxScore(){return e.constraints.max??(0,c.getConf)(e,"maxScore")},get minScore(){return e.constraints.min??(0,c.getConf)(e,"minScore")}}))).views((e=>({get adapterCapabilities(){const t=e.adapterTypeName,{pluginManager:r}=(0,i.getEnv)(e);return r.getAdapterType(t).adapterCapabilities},get rendererConfig(){const{color:t,displayCrossHatches:r,fill:n,minSize:a,negColor:o,posColor:s,summaryScoreMode:l,scaleType:d,rendererTypeName:u}=e,p=(0,c.getConf)(e,["renderers",u])||{};return e.rendererType.configSchema.create({...p,...d?{scaleType:d}:{},...void 0!==n?{filled:n}:{},...void 0!==r?{displayCrossHatches:r}:{},...void 0!==l?{summaryScoreMode:l}:{},...void 0!==t?{color:t}:{},...void 0!==o?{negColor:o}:{},...void 0!==s?{posColor:s}:{},...void 0!==a?{minSize:a}:{}},(0,i.getEnv)(e))},get autoscaleType(){return e.autoscale??(0,c.getConf)(e,"autoscale")}}))).views((e=>{let t=[0,0];return{get domain(){const{stats:r,scaleType:n,minScore:a,maxScore:o}=e;if(!r)return;const i=(0,y.getNiceDomain)({domain:[r.scoreMin,r.scoreMax],bounds:[a,o],scaleType:n});return"log"===n&&i[1]===Number.MIN_VALUE?[0,Number.MIN_VALUE]:(JSON.stringify(t)!==JSON.stringify(i)&&(t=i),t)}}})).views((e=>({get filled(){const{fill:t,rendererConfig:r}=e;return t??(0,c.readConfObject)(r,"filled")},get summaryScoreModeSetting(){const{summaryScoreMode:t,rendererConfig:r}=e;return t??(0,c.readConfObject)(r,"summaryScoreMode")},get scaleOpts(){return{domain:e.domain,stats:e.stats,autoscaleType:e.autoscaleType,scaleType:e.scaleType,inverted:(0,c.getConf)(e,"inverted")}},get canHaveFill(){return"XYPlotRenderer"===e.rendererTypeName},get displayCrossHatchesSetting(){const{displayCrossHatches:t,rendererConfig:r}=e;return t??(0,c.readConfObject)(r,"displayCrossHatches")},get hasResolution(){return e.adapterCapabilities.includes("hasResolution")},get hasGlobalStats(){return e.adapterCapabilities.includes("hasGlobalStats")}}))).views((e=>({scoreTrackMenuItems:()=>[...e.hasResolution?[{label:"Resolution",subMenu:[{label:"Finer resolution",onClick:()=>{e.setResolution(5*e.resolution)}},{label:"Coarser resolution",onClick:()=>{e.setResolution(e.resolution/5)}}]},{label:"Summary score mode",subMenu:["min","max","avg","whiskers"].map((t=>({label:t,type:"radio",checked:e.summaryScoreModeSetting===t,onClick:()=>{e.setSummaryScoreMode(t)}})))}]:[],{label:"log"===e.scaleType?"Set linear scale":"Set log scale",onClick:()=>{e.toggleLogScale()}},{label:"Autoscale type",subMenu:[["local","Local"],...e.hasGlobalStats?[["global","Global"],["globalsd","Global ± 3σ"]]:[],["localsd","Local ± 3σ"]].map((([t,r])=>({label:r,type:"radio",checked:e.autoscaleType===t,onClick:()=>{e.setAutoscale(t)}})))},{label:"Set min/max score",onClick:()=>{(0,i.getSession)(e).queueDialog((t=>[z,{model:e,handleClose:t}]))}}]}))).actions((e=>{const{reload:t}=e;return{async reload(){e.setError(),t()}}}))}const H=(0,C.lazy)((()=>Promise.resolve().then(r.bind(r,57266)))),j=(0,C.lazy)((()=>Promise.all([r.e(6395),r.e(3106)]).then(r.bind(r,23106)))),W=new Map([["xyplot","XYPlotRenderer"],["density","DensityRenderer"],["line","LinePlotRenderer"]]),G=function(e,t){return g.types.compose("LinearWiggleDisplay",O(t),g.types.model({type:g.types.literal("LinearWiggleDisplay")})).views((e=>({get TooltipComponent(){return H},get rendererTypeName(){const t=e.rendererTypeNameSimple,r=W.get(t);if(!r)throw new Error(`unknown renderer ${t}`);return r}}))).views((e=>({get ticks(){const{scaleType:t,domain:r,height:n}=e,a=(0,c.getConf)(e,"minimalTicks"),o=(0,c.getConf)(e,"inverted"),i=[n-y.YSCALEBAR_LABEL_OFFSET,y.YSCALEBAR_LABEL_OFFSET];if(!r)return;const s=(0,y.getScale)({scaleType:t,domain:r,range:i,inverted:o}),l=(0,V.axisPropsFromTickScale)(s,4);return n<100||a?{...l,values:r}:l}}))).views((e=>{const{renderProps:t}=e;return{renderProps(){const r=t(),{filters:n,ticks:a,height:o,resolution:i,scaleOpts:s}=e;return{...r,notReady:r.notReady||!e.stats,rpcDriverName:e.rpcDriverName,displayModel:e,config:e.rendererConfig,displayCrossHatches:e.displayCrossHatchesSetting,scaleOpts:s,resolution:i,height:o,ticks:a,filters:n}},get needsScalebar(){const{rendererTypeName:t}=e;return"XYPlotRenderer"===t||"LinePlotRenderer"===t},get fillSetting(){return e.filled?0:1===e.minSize?1:2}}})).views((e=>{const{trackMenuItems:t}=e,r=(0,c.getConf)(e,"defaultRendering");return{trackMenuItems:()=>[...t(),{label:"Score",subMenu:e.scoreTrackMenuItems()},...e.canHaveFill?[{label:"Fill mode",subMenu:["filled","no fill","no fill w/ emphasis"].map(((t,r)=>({label:t,type:"radio",checked:e.fillSetting===r,onClick:()=>{e.setFill(r)}})))}]:[],...e.needsScalebar?[{type:"checkbox",label:"Draw cross hatches",checked:e.displayCrossHatchesSetting,onClick:()=>{e.toggleCrossHatches()}}]:[],...r?[{label:"Renderer type",subMenu:["xyplot","density","line"].map((t=>({label:t,type:"radio",checked:e.rendererTypeNameSimple===t,onClick:()=>{e.setRendererType(t)}})))}]:[],{label:"Set color",onClick:()=>{(0,i.getSession)(e).queueDialog((t=>[j,{model:e,handleClose:t}]))}}]}})).actions((e=>{const{renderSvg:t}=e;return{afterAttach(){(async()=>{const{quantitativeStatsAutorun:t}=await Promise.resolve().then(r.bind(r,75429));t(e)})()},async renderSvg(n){const{renderSvg:a}=await r.e(7627).then(r.bind(r,57627));return a(e,n,t)}}}))};var $=r(57266),q=r(98911);var _=r(42489),U=r(41365),J=r.n(U),X=r(40898);const Y=(0,C.lazy)((()=>r.e(6021).then(r.bind(r,96021)))),K=(0,C.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(5640),r.e(6395),r.e(6932)]).then(r.bind(r,36932)))),Q=new Map([["xyplot","MultiXYPlotRenderer"],["multirowxy","MultiRowXYPlotRenderer"],["multirowdensity","MultiDensityRenderer"],["multiline","MultiLineRenderer"],["multirowline","MultiRowLineRenderer"]]),Z=function(e,t){return g.types.compose("MultiLinearWiggleDisplay",O(t),g.types.model({type:g.types.literal("MultiLinearWiggleDisplay"),layout:g.types.optional(g.types.frozen(),[])})).volatile((()=>({featureUnderMouseVolatile:void 0,sourcesVolatile:void 0}))).actions((e=>({setLayout(t){e.layout=t},clearLayout(){e.layout=[]},setSources(t){J()(t,e.sourcesVolatile)||(e.sourcesVolatile=t)},setFeatureUnderMouse(t){e.featureUnderMouseVolatile=t}}))).views((e=>({get featureUnderMouse(){return e.featureUnderMouseVolatile},get TooltipComponent(){return Y},get rendererTypeName(){const t=e.rendererTypeNameSimple,r=Q.get(t);if(!r)throw new Error(`unknown renderer ${t}`);return r}}))).views((e=>({get needsScalebar(){return"MultiXYPlotRenderer"===e.rendererTypeName||"MultiRowXYPlotRenderer"===e.rendererTypeName||"MultiLineRenderer"===e.rendererTypeName||"MultiRowLineRenderer"===e.rendererTypeName},get needsFullHeightScalebar(){return"MultiXYPlotRenderer"===e.rendererTypeName||"MultiLineRenderer"===e.rendererTypeName},get isMultiRow(){return"MultiRowXYPlotRenderer"===e.rendererTypeName||"MultiRowLineRenderer"===e.rendererTypeName||"MultiDensityRenderer"===e.rendererTypeName},get needsCustomLegend(){return"MultiDensityRenderer"===e.rendererTypeName},get canHaveFill(){return"MultiXYPlotRenderer"===e.rendererTypeName||"MultiRowXYPlotRenderer"===e.rendererTypeName},get renderColorBoxes(){return!("MultiRowLineRenderer"===e.rendererTypeName||"MultiRowXYPlotRenderer"===e.rendererTypeName)},get prefersOffset(){return this.isMultiRow},get sources(){const t=Object.fromEntries(e.sourcesVolatile?.map((e=>[e.name,e]))||[]),r=e.layout.length?e.layout:e.sourcesVolatile;return r?.map((e=>({...t[e.name],...e}))).map(((e,t)=>({...e,color:e.color||(this.isMultiRow?"blue":X.set1[t]||"#000000".replaceAll("0",(()=>(~~(16*Math.random())).toString(16))))})))}}))).views((e=>({get rowHeight(){const{sources:t,height:r,isMultiRow:n}=e;return n?r/(t?.length||1):r},get rowHeightTooSmallForScalebar(){return this.rowHeight<70},get useMinimalTicks(){return(0,c.getConf)(e,"minimalTicks")||this.rowHeightTooSmallForScalebar}}))).views((e=>({get ticks(){const{scaleType:t,domain:r,isMultiRow:n,rowHeight:a,useMinimalTicks:o}=e;if(!r)return;const i=n?0:y.YSCALEBAR_LABEL_OFFSET,s=(0,V.axisPropsFromTickScale)((0,y.getScale)({scaleType:t,domain:r,range:[a-i,i],inverted:(0,c.getConf)(e,"inverted")}),4);return o?{...s,values:r}:s},get colors(){return["red","blue","green","orange","purple","cyan","pink","darkblue","darkred","pink"]}}))).views((e=>{const{renderProps:t}=e;return{renderProps(){const r=t(),{displayCrossHatches:n,filters:a,height:o,resolution:i,rpcDriverName:s,scaleOpts:l,stats:c,sources:d,ticks:u,rendererConfig:p}=e;return{...r,notReady:r.notReady||!d||!c,displayModel:e,config:p,displayCrossHatches:n,filters:a,height:o,resolution:i,rpcDriverName:s,scaleOpts:l,sources:d,ticks:u,onMouseMove:(t,r)=>{e.setFeatureUnderMouse(r)},onMouseLeave:()=>{e.setFeatureUnderMouse(void 0)}}},get hasResolution(){return e.adapterCapabilities.includes("hasResolution")},get hasGlobalStats(){return e.adapterCapabilities.includes("hasGlobalStats")},get fillSetting(){return e.filled?0:1===e.minSize?1:2}}})).views((e=>{const{trackMenuItems:t}=e,r=(0,c.getConf)(e,"defaultRendering");return{trackMenuItems:()=>[...t(),{label:"Score",subMenu:e.scoreTrackMenuItems()},...e.canHaveFill?[{label:"Fill mode",subMenu:["filled","no fill","no fill w/ emphasis"].map(((t,r)=>({label:t,type:"radio",checked:e.fillSetting===r,onClick:()=>{e.setFill(r)}})))}]:[],...e.needsScalebar?[{type:"checkbox",label:"Draw cross hatches",checked:e.displayCrossHatchesSetting,onClick:()=>{e.toggleCrossHatches()}}]:[],...r?[{label:"Renderer type",subMenu:["xyplot","multirowxy","multirowdensity","multiline","multirowline"].map((t=>({label:t,type:"radio",checked:e.rendererTypeNameSimple===t,onClick:()=>{e.setRendererType(t)}})))}]:[],{label:"Edit colors/arrangement...",onClick:()=>{(0,i.getSession)(e).queueDialog((t=>[K,{model:e,handleClose:t}]))}}]}})).actions((e=>{const{renderSvg:t}=e;return{afterAttach(){(async()=>{const{quantitativeStatsAutorun:t}=await Promise.resolve().then(r.bind(r,75429));t(e),(0,g.addDisposer)(e,(0,_.autorun)((async()=>{const{rpcManager:t}=(0,i.getSession)(e),{adapterConfig:r}=e,n=(0,a.getRpcSessionId)(e),o=await t.call(n,"MultiWiggleGetSources",{sessionId:n,adapterConfig:r});(0,g.isAlive)(e)&&e.setSources(o)})))})()},async renderSvg(n){const{renderSvg:a}=await r.e(8880).then(r.bind(r,28880));return a(e,n,t)}}}))};const ee=(0,v.observer)((function(e){const{regions:t,features:r,bpPerPx:n,width:a,height:o,sources:s,onMouseLeave:l=()=>{},onMouseMove:c=()=>{},onFeatureClick:d=()=>{},displayModel:u}=e,p=t[0],m=(0,C.useRef)(null),{isMultiRow:g}=u||{};function h(e,t){if(!m.current)return;const l=m.current.getBoundingClientRect(),c=e-l.left,d=t-l.top,u=s[Math.floor(d/o*s.length)];if(!u)return;const h=p.reversed?a-c:c,f=p.start+n*h;let y;if(g){for(const e of r.values())if(e.get("source")===u.name&&f<=e.get("end")+n&&f>=e.get("start")){y=e;break}}else{const e=[];for(const t of r.values())f<=t.get("end")+n&&f>=t.get("start")&&e.push(t);if(e.length){const t=Math.floor(f);y=new i.SimpleFeature({uniqueId:"mouseoverfeat",sources:Object.fromEntries(e.map((e=>e.toJSON())).map((e=>{const{refName:t,start:r,end:n,source:a,...o}=e;return[a,o]}))),...p,start:t,end:t+1})}}return y}return C.createElement("div",{ref:m,onMouseMove:e=>{const{clientX:t,clientY:r}=e,n=h(t,r);c(e,n)},onClick:e=>{const{clientX:t,clientY:r}=e,n=h(t,r);d(e,n)},onMouseLeave:e=>{l(e)},style:{overflow:"visible",position:"relative",height:o}},C.createElement(S.PrerenderedCanvas,e))}));class te extends s{async draw(e,t){const{sources:r,features:n}=t,a=(0,i.groupBy)(n.values(),(e=>e.get("source")));let o=[];for(const n of r){const r=a[n.name]||[],{reducedFeatures:i}=M(e,{...t,features:r,offset:y.YSCALEBAR_LABEL_OFFSET,colorCallback:()=>n.color||"blue"});o=o.concat(i)}return{reducedFeatures:o}}}const re=(0,c.ConfigurationSchema)("MultiXYPlotRenderer",{filled:{type:"boolean",defaultValue:!0},displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1},summaryScoreMode:{type:"stringEnum",model:g.types.enumeration("Score type",["max","min","avg","whiskers"]),description:"choose whether to use max/min/average or whiskers which combines all three into the same rendering",defaultValue:"avg"},minSize:{type:"number",defaultValue:0}},{baseConfiguration:h,explicitlyTyped:!0});class ne extends s{async draw(e,t){const{bpPerPx:r,sources:n,regions:a,features:o}=t,s=a[0],l=(0,i.groupBy)(o.values(),(e=>e.get("source"))),c=t.height/n.length,d=(s.end-s.start)/r;let u=[];return e.save(),n.forEach((r=>{const{reducedFeatures:n}=M(e,{...t,features:l[r.name]||[],height:c,colorCallback:()=>r.color||"blue"});e.strokeStyle="rgba(200,200,200,0.8)",e.beginPath(),e.moveTo(0,c),e.lineTo(d,c),e.stroke(),e.translate(0,c),u=u.concat(n)})),e.restore(),{reducedFeatures:u}}}const ae=(0,c.ConfigurationSchema)("MultiRowXYPlotRenderer",{filled:{type:"boolean",defaultValue:!0},displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1},summaryScoreMode:{type:"stringEnum",model:g.types.enumeration("Score type",["max","min","avg","whiskers"]),description:"choose whether to use max/min/average or whiskers which combines all three into the same rendering",defaultValue:"whiskers"},minSize:{type:"number",defaultValue:0}},{baseConfiguration:h,explicitlyTyped:!0}),oe=(0,c.ConfigurationSchema)("MultiDensityRenderer",{},{baseConfiguration:h,explicitlyTyped:!0});class ie extends s{async draw(e,t){const{sources:r,features:n}=t,a=(0,i.groupBy)(n.values(),(e=>e.get("source"))),o=t.height/r.length;let s=[];return e.save(),r.forEach((r=>{const n=a[r.name]||[],{reducedFeatures:i}=b(e,{...t,features:n,height:o});e.translate(0,o),s=s.concat(i)})),e.restore(),{reducedFeatures:s}}}class se extends s{async draw(e,t){const{sources:r,features:n}=t,a=(0,i.groupBy)(n.values(),(e=>e.get("source")));let o=[];return r.forEach((r=>{const{reducedFeatures:n}=N(e,{...t,features:a[r.name]||[],colorCallback:()=>r.color||"blue"});o=o.concat(n)})),{reducedFeatures:o}}}const le=(0,c.ConfigurationSchema)("MultiLineRenderer",{displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1},summaryScoreMode:{type:"stringEnum",model:g.types.enumeration("Score type",["max","min","avg","whiskers"]),description:"choose whether to use max/min/average or whiskers which combines all three into the same rendering",defaultValue:"avg"}},{baseConfiguration:h,explicitlyTyped:!0});class ce extends s{async draw(e,t){const{bpPerPx:r,sources:n,regions:a,features:o}=t,s=a[0],l=(0,i.groupBy)(o.values(),(e=>e.get("source"))),c=t.height/n.length,d=(s.end-s.start)/r;let u=[];return e.save(),n.forEach((r=>{const{reducedFeatures:n}=N(e,{...t,features:l[r.name]||[],height:c,colorCallback:()=>r.color||"blue"});e.strokeStyle="rgba(200,200,200,0.8)",e.beginPath(),e.moveTo(0,c),e.lineTo(d,c),e.stroke(),e.translate(0,c),u=u.concat(n)})),e.restore(),{reducedFeatures:u}}}const de=(0,c.ConfigurationSchema)("MultiRowLineRenderer",{displayCrossHatches:{type:"boolean",description:"choose to draw cross hatches (sideways lines)",defaultValue:!1},summaryScoreMode:{type:"stringEnum",model:g.types.enumeration("Score type",["max","min","avg","whiskers"]),description:"choose whether to use max/min/average or whiskers which combines all three into the same rendering",defaultValue:"avg"}},{baseConfiguration:h,explicitlyTyped:!0}),ue=(0,C.lazy)((()=>r.e(9305).then(r.bind(r,69305))));var pe=r(58921),me=r(2406),ge=r(93100),he=r(3496);class fe extends me.A{name="MultiWiggleGetSources";async deserializeArguments(e,t){return{...await super.deserializeArguments(e,t),filters:e.filters?new ge.A({filters:e.filters}):void 0}}async serializeArguments(e,t){const r=this.pluginManager,n=r.rootModel?.session?.assemblyManager;if(!n)return e;const a=await(0,i.renameRegionsIfNeeded)(n,{...e,filters:e.filters?.toJSON().filters});return super.serializeArguments(a,t)}async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{regions:a,adapterConfig:o,sessionId:i}=n,{dataAdapter:s}=await(0,he.cK)(r,i,o);return s.getSources(a,n)}}class ye extends me.A{name="WiggleGetMultiRegionQuantitativeStats";async deserializeArguments(e,t){return{...await super.deserializeArguments(e,t),filters:e.filters?new ge.A({filters:e.filters}):void 0}}async serializeArguments(e,t){const r=this.pluginManager,n=r.rootModel?.session?.assemblyManager;if(!n)return e;const a=await(0,i.renameRegionsIfNeeded)(n,{...e,filters:e.filters?.toJSON().filters});return super.serializeArguments(a,t)}async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{regions:a,adapterConfig:o,sessionId:i}=n,{dataAdapter:s}=await(0,he.cK)(r,i,o);return s.getMultiRegionQuantitativeStats(a,n)}}class be extends me.A{name="WiggleGetGlobalQuantitativeStats";async deserializeArguments(e,t){return{...await super.deserializeArguments(e,t),filters:e.filters?new ge.A({filters:e.filters}):void 0}}async execute(e,t){const r=this.pluginManager,n=await this.deserializeArguments(e,t),{adapterConfig:a,sessionId:o}=n,{dataAdapter:i}=await(0,he.cK)(r,o,a);return i.getGlobalStats(n)}}class we extends n.A{name="WigglePlugin";install(e){e.addAdapterType((()=>new l.A({name:"MultiWiggleAdapter",displayName:"Multi-wiggle adapter",configSchema:m,adapterCapabilities:["hasResolution","hasLocalStats","hasGlobalStats"],adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>r.e(1822).then(r.bind(r,31822)).then((e=>e.default))}))),e.addAdapterType((()=>new l.A({name:"BigWigAdapter",displayName:"BigWig adapter",configSchema:d,adapterCapabilities:["hasResolution","hasLocalStats","hasGlobalStats"],getAdapterClass:()=>Promise.all([r.e(3902),r.e(4234)]).then(r.bind(r,14234)).then((e=>e.default))}))),function(e){e.addTrackType((()=>{const t=function(e){return(0,c.ConfigurationSchema)("QuantitativeTrack",{},{baseConfiguration:(0,u.createBaseTrackConfig)(e)})}(e);return new p.A({name:"QuantitativeTrack",displayName:"Quantitative track",configSchema:t,stateModel:(0,u.createBaseTrackModel)(e,"QuantitativeTrack",t)})}))}(e),function(e){e.addTrackType((()=>{const t=(e=>(0,c.ConfigurationSchema)("MultiQuantitativeTrack",{},{baseConfiguration:(0,u.createBaseTrackConfig)(e)}))(e);return new p.A({name:"MultiQuantitativeTrack",displayName:"Multi-quantitative track",configSchema:t,stateModel:(0,u.createBaseTrackModel)(e,"MultiQuantitativeTrack",t)})}))}(e),function(e){e.addDisplayType((()=>{const t=function(e){const t=e.getRendererType("XYPlotRenderer").configSchema,r=e.getRendererType("DensityRenderer").configSchema,n=e.getRendererType("LinePlotRenderer").configSchema;return(0,c.ConfigurationSchema)("LinearWiggleDisplay",{defaultRendering:{type:"stringEnum",model:g.types.enumeration("Rendering",["density","xyplot","line"]),defaultValue:"xyplot"},renderers:(0,c.ConfigurationSchema)("RenderersConfiguration",{DensityRenderer:r,XYPlotRenderer:t,LinePlotRenderer:n})},{baseConfiguration:B(),explicitlyTyped:!0})}(e),n=G(e,t);return new L.A({name:"LinearWiggleDisplay",displayName:"Wiggle display",configSchema:t,stateModel:n,trackType:"QuantitativeTrack",viewType:"LinearGenomeView",ReactComponent:(0,C.lazy)((()=>Promise.resolve().then(r.bind(r,98911))))})}))}(e),function(e){e.addDisplayType((()=>{const t=function(e){const t=e.getRendererType("MultiXYPlotRenderer").configSchema,r=e.getRendererType("MultiDensityRenderer").configSchema,n=e.getRendererType("MultiRowXYPlotRenderer").configSchema,a=e.getRendererType("MultiLineRenderer").configSchema,o=e.getRendererType("MultiRowLineRenderer").configSchema;return(0,c.ConfigurationSchema)("MultiLinearWiggleDisplay",{defaultRendering:{type:"stringEnum",model:g.types.enumeration("Rendering",["multirowxy","xyplot","multirowdensity","multiline","multirowline"]),defaultValue:"multirowxy"},renderers:(0,c.ConfigurationSchema)("RenderersConfiguration",{MultiXYPlotRenderer:t,MultiDensityRenderer:r,MultiRowXYPlotRenderer:n,MultiLineRenderer:a,MultiRowLineRenderer:o}),height:{type:"number",defaultValue:200}},{baseConfiguration:B(),explicitlyTyped:!0})}(e);return new L.A({name:"MultiLinearWiggleDisplay",displayName:"Multi-wiggle display",configSchema:t,stateModel:Z(0,t),trackType:"MultiQuantitativeTrack",viewType:"LinearGenomeView",ReactComponent:(0,C.lazy)((()=>r.e(8526).then(r.bind(r,8526))))})}))}(e),function(e){e.addRendererType((()=>new F({name:"LinePlotRenderer",ReactComponent:k,configSchema:I,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new E({name:"XYPlotRenderer",ReactComponent:k,configSchema:R,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new w({name:"DensityRenderer",ReactComponent:k,configSchema:f,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new te({name:"MultiXYPlotRenderer",ReactComponent:ee,configSchema:re,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new ne({name:"MultiRowXYPlotRenderer",ReactComponent:ee,configSchema:ae,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new ie({name:"MultiDensityRenderer",ReactComponent:ee,configSchema:oe,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new se({name:"MultiLineRenderer",ReactComponent:ee,configSchema:le,pluginManager:e})))}(e),function(e){e.addRendererType((()=>new ce({name:"MultiRowLineRenderer",ReactComponent:ee,configSchema:de,pluginManager:e})))}(e),function(e){e.addAddTrackWorkflowType((()=>new pe.AddTrackWorkflowType({name:"Multi-wiggle track",ReactComponent:(0,C.lazy)((()=>r.e(2018).then(r.bind(r,52018)))),stateModel:g.types.model({})})))}(e),function(e){e.addToExtensionPoint("TrackSelector-multiTrackMenuItems",((e,t)=>{const{session:r}=t;return[...e,...(0,i.isSessionWithAddTracks)(r)?[{label:"Create multi-wiggle track",onClick:e=>{const t=e.selection,r=t.map((e=>(0,c.readConfObject)(e,"name")));(0,i.getSession)(e).queueDialog((n=>[ue,{tracks:t,onClose:(a,o)=>{a&&o&&function(n){const a=t.map((e=>(0,c.readConfObject)(e,"adapter"))).map(((e,t)=>({...e,source:r[t]}))),o=[...new Set(t.flatMap((e=>(0,c.readConfObject)(e,"assemblyNames"))))],s=`multitrack-${+Date.now()}-sessionTrack`,l=(0,i.getSession)(e);(0,i.isSessionWithAddTracks)(l)&&(l.addTrackConf({type:"MultiQuantitativeTrack",trackId:s,name:n.name,assemblyNames:o,adapter:{type:"MultiWiggleAdapter",subadapters:a}}),e.view.showTrack(s))}(o),n()}}]))}}]:[]]}))}(e),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const o="BigWigAdapter",i=(0,a.getFileName)(t),s={type:o,bigWigLocation:t};return/\.(bw|bigwig)$/i.test(i)&&!n||n===o?s:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"BigWigAdapter"===t?"QuantitativeTrack":e(t))),e.addRpcMethod((()=>new be(e))),e.addRpcMethod((()=>new ye(e))),e.addRpcMethod((()=>new fe(e)))}exports={LinearWiggleDisplayReactComponent:q.default,XYPlotRendererReactComponent:k,XYPlotRenderer:E,WiggleBaseRenderer:s,linearWiggleDisplayModelFactory:G,xyPlotRendererConfigSchema:R,utils:y}}},90461:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var n=r(7552),a=r(48231),o=r(68446),i=r(77126);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(null,arguments)}const l=(0,o.observer)((function({model:e,orientation:t}){const{ticks:r}=e,o=(0,a.A)();return r?n.createElement(i.Axis,s({},r,{shadow:2,format:e=>e,style:{orient:"left"===t?i.LEFT:i.RIGHT},bg:o.palette.background.default,fg:o.palette.text.primary})):null}))},75429:(e,t,r)=>{"use strict";r.r(t),r.d(t,{YSCALEBAR_LABEL_OFFSET:()=>u,fillRectCtx:()=>w,getNiceDomain:()=>g,getOrigin:()=>m,getQuantitativeStats:()=>h,getScale:()=>p,quantitativeStatsAutorun:()=>f,round:()=>b,toP:()=>y});var n=r(45824),a=r(35873),o=r(6754),i=r(42489),s=r(99546),l=r(91468),c=r(36422),d=r(68584);const u=5;function p({domain:e=[],range:t=[],scaleType:r,pivotValue:i,inverted:s}){let l;const[c,d]=e;if(void 0===c||void 0===d)throw new Error("invalid domain");if("linear"===r)l=(0,n.A)();else if("log"===r)l=(0,a.A)().base(2);else{if("quantize"!==r)throw new Error("undefined scaleType");l=(0,o.A)()}l.domain(void 0!==i?[c,i,d]:[c,d]),l.nice();const[u,p]=t;if(void 0===u||void 0===p)throw new Error("invalid range");return l.range(s?t.slice().reverse():t),l}function m(e){return"log"===e?1:0}function g({scaleType:e,domain:t,bounds:r}){const[i,s]=r;let[l,c]=t;"linear"===e&&(c<0&&(c=0),l>0&&(l=0)),"log"===e&&l>=0&&c>1&&(l=1),void 0!==i&&i!==Number.MIN_VALUE&&(l=i),void 0!==s&&s!==Number.MAX_VALUE&&(c=s);const d=(e=>{if("linear"===e)return(0,n.A)();if("log"===e){const e=(0,a.A)();return e.base(2),e}if("quantize"===e)return(0,o.A)();throw new Error(`undefined scaleType ${e}`)})(e);return d.domain([l,c]),d.nice(),d.domain()}async function h(e,t){const{rpcManager:r}=(0,s.getSession)(e),n=(0,d.getConf)(e,"numStdDev")||3,{adapterConfig:a,autoscaleType:o}=e,i=(0,l.getRpcSessionId)(e),u={sessionId:i,adapterConfig:a,statusCallback:t=>{(0,c.isAlive)(e)&&e.setMessage(t)},...t};if("global"===o||"globalsd"===o){const e=await r.call(i,"WiggleGetGlobalQuantitativeStats",u),{scoreMin:t,scoreMean:a,scoreStdDev:s}=e;return"globalsd"===o?{...e,scoreMin:t>=0?0:a-n*s,scoreMax:a+n*s}:e}if("local"===o||"localsd"===o){const{dynamicBlocks:t,bpPerPx:a}=(0,s.getContainingView)(e),l=await r.call(i,"WiggleGetMultiRegionQuantitativeStats",{...u,regions:t.contentBlocks.map((e=>{const{start:t,end:r}=e;return{...JSON.parse(JSON.stringify(e)),start:Math.floor(t),end:Math.ceil(r)}})),bpPerPx:a}),{scoreMin:c,scoreMean:d,scoreStdDev:p}=l;return"localsd"===o?{...l,scoreMin:c>=0?0:d-n*p,scoreMax:d+n*p}:l}if("zscale"===o)return r.call(i,"WiggleGetGlobalQuantitativeStats",u);throw new Error(`invalid autoscaleType '${o}'`)}function f(e){(0,c.addDisposer)(e,(0,i.autorun)((async()=>{try{const t=new AbortController,r=(0,s.getContainingView)(e);if(e.setLoading(t),!r.initialized||!e.featureDensityStatsReady||e.regionTooLarge||e.error)return;const n=JSON.stringify(r.dynamicBlocks),a=await h(e,{signal:t.signal,filters:[],...e.renderProps()});(0,c.isAlive)(e)&&e.updateQuantitativeStats(a,n)}catch(t){!(0,s.isAbortException)(t)&&(0,c.isAlive)(e)&&(console.error(t),e.setError(t))}}),{delay:1e3}))}function y(e=0){return+(+e).toPrecision(6)}function b(e){return Math.round(1e5*e)/1e5}function w(e,t,r,n,a,o){r<0&&(e+=r,r=-r),n<0&&(t+=n,n=-n),o&&(a.fillStyle=o),a.fillRect(e,t,r,n)}},63163:(e,t,r)=>{"use strict";r.d(t,{A:()=>Mo});var n=r(82727),a=r(12678),o=r(92070),i=r(68584),s=r(1622);const l=(0,i.ConfigurationSchema)("OAuthInternetAccount",{tokenType:{description:"a custom name for a token to include in the header",type:"string",defaultValue:"Bearer"},authEndpoint:{description:"the authorization code endpoint of the internet account",type:"string",defaultValue:""},tokenEndpoint:{description:"the token endpoint of the internet account",type:"string",defaultValue:""},needsPKCE:{description:"boolean to indicate if the endpoint needs a PKCE code",type:"boolean",defaultValue:!1},clientId:{description:"id for the OAuth application",type:"string",defaultValue:""},scopes:{description:"optional scopes for the authorization call",type:"string",defaultValue:""},state:{description:"optional state for the authorization call",type:"string",defaultValue:""},responseType:{description:"the type of response from the authorization endpoint. can be 'token' or 'code'",type:"string",defaultValue:"code"}},{baseConfiguration:s.BaseInternetAccountConfig,explicitlyTyped:!0});var c=r(99546),d=r(36422),u=r(35451);function p(e){return e.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function m(e,t){try{const r=JSON.parse(e);return"invalid_grant"===r.error&&t(),r?.error_description??e}catch(e){}return e}function g(e,t){return e.refresh_token&&t(e.refresh_token),e.access_token}async function h({response:e,reason:t,statusText:r}){return[`HTTP ${e.status}`,t,r??await f(e)].filter((e=>!!e)).join(" - ")}async function f(e){try{return await e.text()}catch(t){return e.statusText}}const y=e=>s.InternetAccount.named("OAuthInternetAccount").props({type:d.types.literal("OAuthInternetAccount"),configuration:(0,i.ConfigurationReference)(e)}).views((()=>{let e;return{get codeVerifierPKCE(){if(e)return e;const t=new Uint8Array(32);return globalThis.crypto.getRandomValues(t),e=p(u.hp.from(t).toString("base64")),e}}})).views((e=>({get authEndpoint(){return(0,i.getConf)(e,"authEndpoint")},get tokenEndpoint(){return(0,i.getConf)(e,"tokenEndpoint")},get needsPKCE(){return(0,i.getConf)(e,"needsPKCE")},get clientId(){return(0,i.getConf)(e,"clientId")},get scopes(){return(0,i.getConf)(e,"scopes")},state:()=>(0,i.getConf)(e,"state"),get responseType(){return(0,i.getConf)(e,"responseType")},get refreshTokenKey(){return`${e.internetAccountId}-refreshToken`}}))).actions((e=>({storeRefreshToken(t){localStorage.setItem(e.refreshTokenKey,t)},removeRefreshToken(){localStorage.removeItem(e.refreshTokenKey)},retrieveRefreshToken:()=>localStorage.getItem(e.refreshTokenKey),async exchangeAuthorizationForAccessToken(t,r){const n=new URLSearchParams(Object.entries({code:t,grant_type:"authorization_code",client_id:e.clientId,redirect_uri:r,...e.needsPKCE?{code_verifier:e.codeVerifierPKCE}:{}})),a=await fetch(e.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()});if(!a.ok)throw new Error(await h({response:a,reason:"Failed to obtain token"}));return g(await a.json(),(e=>{this.storeRefreshToken(e)}))},async exchangeRefreshForAccessToken(t){const r=await fetch(e.tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(Object.entries({grant_type:"refresh_token",refresh_token:t,client_id:e.clientId})).toString()});if(!r.ok){e.removeToken();const t=await r.text();throw new Error(await h({response:r,statusText:m(t,(()=>{this.removeRefreshToken()}))}))}return g(await r.json(),(e=>{this.storeRefreshToken(e)}))}}))).actions((e=>{let t,n;return{addMessageChannel(e,r){t=t=>{this.finishOAuthWindow(t,e,r)},window.addEventListener("message",t)},deleteMessageChannel(){window.removeEventListener("message",t)},async finishOAuthWindow(t,r,n){if(t.data.name!==`JBrowseAuthWindow-${e.internetAccountId}`)return void this.deleteMessageChannel();const a=t.data.redirectUri,o=a.replace("#","?"),i=new URL(o),s=i.search,l=new URLSearchParams(s);if(l.has("access_token")){const t=l.get("access_token");return t?(e.storeToken(t),void r(t)):void n(new Error("Error with token endpoint"))}if(l.has("code")){const t=l.get("code");if(!t)return void n(new Error("Error with authorization endpoint"));try{const n=await e.exchangeAuthorizationForAccessToken(t,i.origin+i.pathname);return e.storeToken(n),void r(n)}catch(e){return void(e instanceof Error?n(e):n(new Error(String(e))))}}a.includes("access_denied")?n(new Error("OAuth flow was cancelled")):a.includes("error")?n(new Error(`OAuth flow error: ${s}`)):this.deleteMessageChannel()},async useEndpointForAuthorization(t,n){const a=c.isElectron?"http://localhost/auth":window.location.origin+window.location.pathname,o={client_id:e.clientId,redirect_uri:a,response_type:e.responseType,token_access_type:"offline"};e.state()&&(o.state=e.state()),e.scopes&&(o.scope=e.scopes),e.needsPKCE&&(o.code_challenge=await async function(e){const t=await Promise.all([r.e(7753),r.e(8424)]).then(r.t.bind(r,27181,23)).then((e=>e.default));return p((await Promise.all([r.e(7753),r.e(6435)]).then(r.t.bind(r,29038,23))).stringify(t(e)))}(e.codeVerifierPKCE),o.code_challenge_method="S256");const i=new URLSearchParams(Object.entries(o)),s=new URL(e.authEndpoint);s.search=i.toString();const l=`JBrowseAuthWindow-${e.internetAccountId}`;if(c.isElectron){const{ipcRenderer:r}=window.require("electron"),a=await r.invoke("openAuthWindow",{internetAccountId:e.internetAccountId,data:o,url:s.toString()}),i=new MessageEvent("message",{data:{name:l,redirectUri:a}});this.finishOAuthWindow(i,t,n)}else window.open(s,l,"width=500,height=600,left=0,top=0")},async getTokenFromUser(t,r){const n=e.retrieveRefreshToken();let a=!0;if(n)try{t(await e.exchangeRefreshForAccessToken(n)),a=!1}catch(t){console.error(t),e.removeRefreshToken()}a&&(this.addMessageChannel(t,r),this.useEndpointForAuthorization(t,r))},async validateToken(t,r){const a=e.addAuthHeaderToInit({method:"HEAD"},t),o=await fetch(r.uri,a);if(!o.ok){e.removeToken();const t=e.retrieveRefreshToken();if(t)try{n||(n=e.exchangeRefreshForAccessToken(t));const r=await n;return n=void 0,r}catch(e){console.error("Token could not be refreshed",e)}throw new Error(await h({response:o,reason:"Error validating token"}))}return t}}})).actions((e=>{const t=e.getFetcher;return{getFetcher(r){const n=t(r);return async(t,a)=>(r&&await e.validateToken(await e.getToken(r),r),n(t,a))}}})),b=(0,i.ConfigurationSchema)("ExternalTokenInternetAccount",{validateWithHEAD:{description:"validate the token with a HEAD request before using it",type:"boolean",defaultValue:!0}},{baseConfiguration:s.BaseInternetAccountConfig,explicitlyTyped:!0});var w=r(7552),v=r(29499),C=r(1343),S=r(58507),k=r(5401),T=r(49823);const x=({internetAccountId:e,handleClose:t})=>{const[r,n]=(0,w.useState)("");return w.createElement(T.Dialog,{open:!0,maxWidth:"xl","data-testid":"externalToken-form",title:`Enter token for ${e}`},w.createElement(v.A,{style:{display:"flex",flexDirection:"column"}},w.createElement(C.A,{required:!0,label:"Enter Token",variant:"outlined",inputProps:{"data-testid":"entry-externalToken"},onChange:e=>{n(e.target.value)},margin:"dense"})),w.createElement(S.A,null,w.createElement(k.A,{variant:"contained",color:"primary",type:"submit",disabled:!r,onClick:()=>{r&&t(r)}},"Add"),w.createElement(k.A,{variant:"contained",color:"secondary",onClick:()=>{t()}},"Cancel")))},A=e=>s.InternetAccount.named("ExternalTokenInternetAccount").props({type:d.types.literal("ExternalTokenInternetAccount"),configuration:(0,i.ConfigurationReference)(e)}).views((e=>({get validateWithHEAD(){return(0,i.getConf)(e,"validateWithHEAD")}}))).actions((e=>({getTokenFromUser(t,r){const{session:n}=(0,d.getRoot)(e);n.queueDialog((n=>[x,{internetAccountId:e.internetAccountId,handleClose:e=>{e?t(e):r(new Error("user cancelled entry")),n()}}]))},async validateToken(t,r){if(!e.validateWithHEAD)return t;const n=e.addAuthHeaderToInit({method:"HEAD"},t),a=await fetch(r.uri,n);if(!a.ok){let e;try{e=await a.text()}catch(t){e=""}throw new Error(`Token could not be validated — ${a.status} ${e?` (${e})`:""}`)}return t}}))),P=(0,i.ConfigurationSchema)("HTTPBasicInternetAccount",{tokenType:{description:"a custom name for a token to include in the header",type:"string",defaultValue:"Basic"},validateWithHEAD:{description:"validate the token with a HEAD request before using it",type:"boolean",defaultValue:!0}},{baseConfiguration:s.BaseInternetAccountConfig,explicitlyTyped:!0});function M({internetAccountId:e,handleClose:t}){const[r,n]=(0,w.useState)(""),[a,o]=(0,w.useState)("");return w.createElement(T.Dialog,{open:!0,maxWidth:"xl","data-testid":"login-httpbasic",title:`Log in for ${e}`},w.createElement("form",{onSubmit:e=>{r&&a?t(btoa(`${r}:${a}`)):t(),e.preventDefault()}},w.createElement(v.A,{style:{display:"flex",flexDirection:"column"}},w.createElement(C.A,{required:!0,label:"Username",variant:"outlined",inputProps:{"data-testid":"login-httpbasic-username"},onChange:e=>{n(e.target.value)},margin:"dense"}),w.createElement(C.A,{required:!0,label:"Password",type:"password",autoComplete:"current-password",variant:"outlined",inputProps:{"data-testid":"login-httpbasic-password"},onChange:e=>{o(e.target.value)},margin:"dense"})),w.createElement(S.A,null,w.createElement(k.A,{variant:"contained",color:"primary",type:"submit"},"Submit"),w.createElement(k.A,{variant:"contained",color:"secondary",type:"submit",onClick:()=>{t()}},"Cancel"))))}const E=e=>s.InternetAccount.named("HTTPBasicInternetAccount").props({type:d.types.literal("HTTPBasicInternetAccount"),configuration:(0,i.ConfigurationReference)(e)}).views((e=>({get validateWithHEAD(){return(0,i.getConf)(e,"validateWithHEAD")}}))).actions((e=>({getTokenFromUser(t,r){const{session:n}=(0,d.getRoot)(e);n.queueDialog((n=>[M,{internetAccountId:e.internetAccountId,handleClose:e=>{e?t(e):r(new Error("User cancelled entry")),n()}}]))},async validateToken(t,r){if(!e.validateWithHEAD)return t;const n=e.addAuthHeaderToInit({method:"HEAD"},t),a=await fetch(r.uri,n);if(!a.ok)throw new Error(await h({response:a,reason:"Error validating token"}));return t}}))),R=(0,i.ConfigurationSchema)("DropboxOAuthInternetAccount",{authEndpoint:{description:"the authorization code endpoint of the internet account",type:"string",defaultValue:"https://www.dropbox.com/oauth2/authorize"},tokenEndpoint:{description:"the token endpoint of the internet account",type:"string",defaultValue:"https://api.dropbox.com/oauth2/token"},needsPKCE:{description:"boolean to indicate if the endpoint needs a PKCE code",type:"boolean",defaultValue:!0},domains:{description:"array of valid domains the url can contain to use this account",type:"stringArray",defaultValue:["addtodropbox.com","db.tt","dropbox.com","dropboxapi.com","dropboxbusiness.com","dropbox.tech","getdropbox.com"]}},{baseConfiguration:l,explicitlyTyped:!0}),I={shared_link_not_found:"The shared link wasn't found.",shared_link_access_denied:"The caller is not allowed to access this shared link.",unsupported_link_type:"This type of link is not supported; use files/export instead.",shared_link_is_directory:"Directories cannot be retrieved by this endpoint."};async function N(e,t){let r="";try{const t=JSON.parse(await e.text()).error[".tag"];r=I[t]||t}catch(e){}return h({response:e,reason:t,statusText:r})}var F=r(2859);function L(e){return w.createElement(F.A,e,w.createElement("path",{d:"M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z"}))}const D=e=>y(l).named("DropboxOAuthInternetAccount").props({type:d.types.literal("DropboxOAuthInternetAccount"),configuration:(0,i.ConfigurationReference)(e)}).views((()=>({get toggleContents(){return w.createElement(L,null)},get selectorLabel(){return"Enter Dropbox share link"}}))).actions((e=>({getFetcher:t=>async(r,n)=>{const a=await e.getToken(t),o=e.addAuthHeaderToInit({...n,method:"POST"},a);o.headers.append("Dropbox-API-Arg",JSON.stringify({url:r}));const i=await fetch("https://content.dropboxapi.com/2/sharing/get_shared_link_file",o);if(!i.ok)throw new Error(await N(i));return i},async validateToken(t,r){const n=await fetch("https://api.dropboxapi.com/2/sharing/get_shared_link_metadata",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({url:r.uri})});if(!n.ok){const t=e.retrieveRefreshToken();if(t){e.removeRefreshToken();const n=await e.exchangeRefreshForAccessToken(t);return this.validateToken(n,r)}throw new Error(await N(n,"Token could not be validated"))}return t}}))),B=(0,i.ConfigurationSchema)("GoogleDriveOAuthInternetAccount",{authEndpoint:{description:"the authorization code endpoint of the internet account",type:"string",defaultValue:"https://accounts.google.com/o/oauth2/v2/auth"},scopes:{description:"optional scopes for the authorization call",type:"string",defaultValue:"https://www.googleapis.com/auth/drive.readonly"},domains:{description:"array of valid domains the url can contain to use this account",type:"stringArray",defaultValue:['drive.google.com"']},responseType:{description:"the type of response from the authorization endpoint",type:"string",defaultValue:"token"}},{baseConfiguration:l,explicitlyTyped:!0});async function V(e,t){let r="";try{r=JSON.parse(await e.text()).error.message}catch(e){}return h({response:e,reason:t,statusText:r})}var z=r(99834);class O extends z.RemoteFileWithRangeCache{constructor(e,t){super(e,t),this.statsPromise=this.fetch(e,{metadataOnly:!0}).then((e=>e.json()))}async fetch(e,t){return super.fetch(e,t)}async stat(){return this.statsPromise}}function H(e){return w.createElement(F.A,e,w.createElement("path",{d:"M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z"}))}function j(e){return`https://www.googleapis.com/drive/v3/files/${/[-\w]{25,}/.exec(e)}`}function W(e){return y(l).named("GoogleDriveOAuthInternetAccount").props({type:d.types.literal("GoogleDriveOAuthInternetAccount"),configuration:(0,i.ConfigurationReference)(e)}).views((()=>({get toggleContents(){return w.createElement(H,null)},get selectorLabel(){return"Enter Google Drive share link"}}))).actions((e=>({getFetcher:t=>async(r,n)=>{const a=new URL(j(String(r))),o=new URLSearchParams;n?.metadataOnly?o.append("fields","size"):o.append("alt","media"),a.search=o.toString();const i=await e.getToken(t),s=await fetch(a,e.addAuthHeaderToInit({...n,method:"GET",credentials:"same-origin"},i));if(!s.ok)throw new Error(await V(s));return s},openLocation(e){return new O(e.uri,{fetch:this.getFetcher(e)})},async validateToken(e,t){const r=await fetch(j(t.uri),{headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/x-www-form-urlencoded"}});if(!r.ok)throw new Error(await V(r,"Token could not be validated"));return e}})))}class G extends a.A{name="AuthenticationPlugin";exports={OAuthConfigSchema:l,OAuthInternetAccountModelFactory:y,ExternalTokenConfigSchema:b,ExternalTokenInternetAccountModelFactory:A,HTTPBasicConfigSchema:P,HTTPBasicInternetAccountModelFactory:E,DropboxOAuthConfigSchema:R,DropboxOAuthInternetAccountModelFactory:D,GoogleDriveOAuthConfigSchema:B,GoogleDriveOAuthInternetAccountModelFactory:W};install(e){e.addInternetAccountType((()=>new o.A({name:"OAuthInternetAccount",configSchema:l,stateModel:y(l)}))),e.addInternetAccountType((()=>new o.A({name:"ExternalTokenInternetAccount",configSchema:b,stateModel:A(b)}))),e.addInternetAccountType((()=>new o.A({name:"HTTPBasicInternetAccount",configSchema:P,stateModel:E(P)}))),e.addInternetAccountType((()=>new o.A({name:"DropboxOAuthInternetAccount",configSchema:R,stateModel:D(R)}))),e.addInternetAccountType((()=>new o.A({name:"GoogleDriveOAuthInternetAccount",configSchema:B,stateModel:W(B)})))}}var $=r(47369);const q=(0,i.ConfigurationSchema)("BigBedAdapter",{bigBedLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bb",locationType:"UriLocation"}},scoreColumn:{type:"string",description:'The column to use as a "score" attribute',defaultValue:""},aggregateField:{type:"string",description:"An attribute to aggregate features with",defaultValue:"geneName"}},{explicitlyTyped:!0}),_=(0,i.ConfigurationSchema)("BedpeAdapter",{bedpeLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bedpe.gz",locationType:"UriLocation"}},columnNames:{type:"stringArray",description:"List of column names",defaultValue:[]}},{explicitlyTyped:!0}),U=(0,i.ConfigurationSchema)("BedTabixAdapter",{bedGzLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bed.gz",locationType:"UriLocation"}},index:(0,i.ConfigurationSchema)("TabixIndex",{indexType:{model:d.types.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bed.gz.tbi",locationType:"UriLocation"}}}),columnNames:{type:"stringArray",description:"List of column names",defaultValue:[]},scoreColumn:{type:"string",description:'The column to use as a "score" attribute',defaultValue:""},autoSql:{type:"string",description:"The autoSql definition for the data fields in the file",defaultValue:""}},{explicitlyTyped:!0}),J=(0,i.ConfigurationSchema)("BedAdapter",{bedLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.bed.gz",locationType:"UriLocation"}},columnNames:{type:"stringArray",description:"List of column names",defaultValue:[]},scoreColumn:{type:"string",description:'The column to use as a "score" attribute',defaultValue:""},autoSql:{type:"string",description:"The autoSql definition for the data fields in the file",defaultValue:""},colRef:{type:"number",description:'The column to use as a "refName" attribute',defaultValue:0},colStart:{type:"number",description:'The column to use as a "start" attribute',defaultValue:1},colEnd:{type:"number",description:'The column to use as a "end" attribute',defaultValue:2}},{explicitlyTyped:!0});var X=r(91468);class Y extends a.A{name="BedPlugin";install(e){!function(e){e.addAdapterType((()=>new $.A({name:"BigBedAdapter",displayName:"BigBed adapter",configSchema:q,getAdapterClass:()=>Promise.all([r.e(972),r.e(3902),r.e(6834)]).then(r.bind(r,6834)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"BedAdapter",displayName:"BED adapter",configSchema:J,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4499),r.e(972),r.e(4864)]).then(r.bind(r,34864)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"BedpeAdapter",displayName:"BEDPE adapter",configSchema:_,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4499),r.e(14)]).then(r.bind(r,10014)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"BedTabixAdapter",displayName:"BED tabix adapter",configSchema:U,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(8120),r.e(972),r.e(6214)]).then(r.bind(r,86214)).then((e=>e.default))})))}(e),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BigBedAdapter",o=(0,X.getFileName)(t),i={type:a,bigBedLocation:t};return/\.(bb|bigbed)$/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BedpeAdapter",o=(0,X.getFileName)(t);return/\.bedpe(\.gz)?$/i.test(o)||n===a?{type:a,bedpeLocation:t}:e(t,r,n)})),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BedTabixAdapter",o=(0,X.getFileName)(t),i=r&&(0,X.getFileName)(r);return/\.bed\.b?gz$/i.test(o)||n===a?{type:a,bedGzLocation:t,index:{location:r||(0,X.makeIndex)(t,".tbi"),indexType:(0,X.makeIndexType)(i,"CSI","TBI")}}:e(t,r,n)})),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BedAdapter",o=(0,X.getFileName)(t);return/\.bed$/i.test(o)||n===a?{type:a,bedLocation:t}:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"BedpeAdapter"===t?"VariantTrack":e(t)))}}var K=r(8832),Q=r(58921);const Z=(0,i.ConfigurationSchema)("BreakpointAlignmentsWidget",{}),ee=d.types.model("BreakpointAlignmentsWidget",{id:K.ElementId,type:d.types.literal("BreakpointAlignmentsWidget"),featureData:d.types.frozen()}).actions((e=>({setFeatureData(t){e.featureData=t},clearFeatureData(){e.featureData=void 0}})));var te=r(63589),re=r(9502);class ne extends te.A{getBreakendCoveringRegions({feature:e,assembly:t}){const r=e.get("ALT")?.[0],n=r?(0,re.h)(r):void 0,a=e.get("start"),o=e.get("refName");let i,s;if("<TRA>"===r){const t=e.get("INFO");i=t.END[0]-1,s=t.CHR2[0]}else if(n?.MatePosition){const e=n.MatePosition.split(":");i=+e[1]-1,s=e[0]}else if(e.get("mate")){const t=e.get("mate");s=t.refName,i=t.start}else i=a+1;if(!s)throw new Error(`unable to resolve mate refName ${s} in reference genome`);return{pos:a,refName:t.getCanonicalRefName(o),mateRefName:t.getCanonicalRefName(s),matePos:i}}singleLevelSnapshotFromBreakendFeature(e,t){const r=(0,c.getSession)(t),{assemblyName:n}=t.displayedRegions[0],{assemblyManager:a}=r,o=a.get(n);if(!o)throw new Error(`assembly ${n} not found`);if(!o.regions)throw new Error(`assembly ${n} regions not loaded`);const{refName:i,pos:s,mateRefName:l,matePos:d}=this.getBreakendCoveringRegions({feature:e,assembly:o}),u=o.regions.find((e=>e.refName===i)),p=o.regions.find((e=>e.refName===l)),m=[{...u},{...u}],g=[{...p},{...p}];return m[0].end=s,m[1].start=s,g[0].end=d,g[1].start=d,{type:"BreakpointSplitView",views:[{type:"LinearGenomeView",displayedRegions:m,hideHeader:!0,bpPerPx:10,offsetPx:(u.start+e.get("start"))/10}],displayName:`${e.get("name")||e.get("id")||"breakend"} split detail`,featureData:void 0}}snapshotFromBreakendFeature(e,t){const r=(0,c.getSession)(t),{assemblyName:n}=t.displayedRegions[0],{assemblyManager:a}=r,o=a.get(n);if(!o)throw new Error(`assembly ${n} not found`);if(!o.regions)throw new Error(`assembly ${n} regions not loaded`);const{refName:i,pos:s,mateRefName:l,matePos:d}=this.getBreakendCoveringRegions({feature:e,assembly:o}),u=o.regions.find((e=>e.refName===i)),p=o.regions.find((e=>e.refName===l)),m=[{...u},{...u}],g=[{...p},{...p}];return m[0].end=s,m[1].start=s,g[0].end=d,g[1].start=d,{type:"BreakpointSplitView",views:[{type:"LinearGenomeView",displayedRegions:m,hideHeader:!0,bpPerPx:10,offsetPx:(u.start+e.get("start"))/10},{type:"LinearGenomeView",displayedRegions:g,hideHeader:!0,bpPerPx:10,offsetPx:(p.start+d)/10}],displayName:`${e.get("name")||e.get("id")||"breakend"} split detail`}}}var ae=r(42489),oe=r(45465),ie=r(64502),se=r(75441),le=r(49473);const ce=(0,w.lazy)((()=>r.e(7790).then(r.bind(r,47790))));function de(e,t){return e.displays[0].searchFeatureByID?.(t.id())}async function ue(e,t){const{views:r}=e,{rpcManager:n,assemblyManager:a}=(0,c.getSession)(e),o=e.views[0]?.assemblyNames[0];if(!o)return;if(!await a.waitForAssembly(o))return;const s=t.configuration.trackId;return Promise.all(r.map((async e=>(await n.call(s,"CoreGetFeatures",{adapterConfig:(0,i.getConf)(t,["adapter"]),sessionId:s,regions:e.staticBlocks.contentBlocks})).flat())))}function pe(e){return d.types.compose("BreakpointSplitView",s.BaseViewModel,d.types.model({type:d.types.literal("BreakpointSplitView"),height:d.types.optional(d.types.refinement("viewHeight",d.types.number,(e=>e>=40)),400),trackSelectorType:"hierarchical",showIntraviewLinks:!0,linkViews:!1,interactToggled:!1,views:d.types.array(e.getViewType("LinearGenomeView").stateModel)})).volatile((()=>({width:800,matchedTrackFeatures:{}}))).views((e=>({async exportSvg(t={}){const{renderToSvg:n}=await Promise.all([r.e(5727),r.e(5668)]).then(r.bind(r,95668)),a=await n(e,t),o=new Blob([a],{type:"image/svg+xml"});(0,oe.saveAs)(o,t.filename||"image.svg")}}))).views((e=>({get matchedTracks(){return 1===e.views.length?e.views[0].tracks:(0,le.y$)((e=>e.configuration.trackId),...e.views.map((e=>e.tracks)))},getMatchedTracks:t=>e.views.map((e=>e.getTrack(t))).filter((e=>!!e)),hasTranslocations(e){return[...this.getTrackFeatures(e).values()].find((e=>"translocation"===e.get("type")))},hasPairedFeatures(e){return[...this.getTrackFeatures(e).values()].find((e=>"paired_feature"===e.get("type")))},getTrackFeatures:t=>new Map(e.matchedTrackFeatures[t]?.flat().map((e=>[e.id(),e]))),getMatchedFeaturesInLayout(e,t){const r=this.getMatchedTracks(e);return t.map((e=>e.map((e=>{const t=r.findIndex((t=>de(t,e)));return-1!==t?{feature:e,layout:de(r[t],e),level:t}:void 0})).filter(c.notEmpty)))}}))).actions((e=>({afterAttach(){(0,d.addDisposer)(e,(0,d.onAction)(e,(({name:t,path:r,args:n})=>{e.linkViews&&["horizontalScroll","zoomTo","setScaleFactor","showTrack","toggleTrack","hideTrack","setTrackLabels","toggleCenterLine"].includes(t)&&r&&this.onSubviewAction(t,r,n)})))},onSubviewAction(t,r,n){e.views.forEach((e=>{(0,d.getPath)(e).endsWith(r)||e[t](n?.[0])}))},setWidth(t){e.width=t,e.views.forEach((e=>{e.setWidth(t)}))},removeView(t){e.views.remove(t)},toggleInteract(){e.interactToggled=!e.interactToggled},toggleIntraviewLinks(){e.showIntraviewLinks=!e.showIntraviewLinks},toggleLinkViews(){e.linkViews=!e.linkViews},setMatchedTrackFeatures(t){e.matchedTrackFeatures=t},reverseViewOrder(){e.views.reverse()}}))).actions((e=>({afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((async()=>{try{if(!e.views.every((e=>e.initialized)))return;e.setMatchedTrackFeatures(Object.fromEntries(await Promise.all(e.matchedTracks.map((async t=>[t.configuration.trackId,await ue(e,t)])))))}catch(t){console.error(t),(0,c.getSession)(e).notifyError(`${t}`,t)}})))},menuItems:()=>[...e.views.map(((e,t)=>[t,e.menuItems()])).map((e=>({label:`Row ${e[0]+1} view menu`,subMenu:e[1]}))),{label:"Reverse view order",onClick:()=>{e.reverseViewOrder()}},{label:"Show intra-view links",type:"checkbox",checked:e.showIntraviewLinks,onClick:()=>{e.toggleIntraviewLinks()}},{label:"Allow clicking alignment squiggles?",type:"checkbox",checked:e.interactToggled,onClick:()=>{e.toggleInteract()}},{label:"Link views",type:"checkbox",icon:se.A,checked:e.linkViews,onClick:()=>{e.toggleLinkViews()}},{label:"Export SVG",icon:ie.A,onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[ce,{model:e,handleClose:t}]))}}]})))}class me extends a.A{name="BreakpointSplitViewPlugin";install(e){!function(e){e.addViewType((()=>new ne({name:"BreakpointSplitView",displayName:"Breakpoint split view",stateModel:pe(e),ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(5727),r.e(7348)]).then(r.bind(r,67348))))})))}(e),function(e){e.addWidgetType((()=>new Q.WidgetType({name:"BreakpointAlignmentsWidget",heading:"Breakpoint feature details",configSchema:Z,stateModel:ee,ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(3011),r.e(6157),r.e(6683),r.e(2627),r.e(8984),r.e(5677)]).then(r.bind(r,90439))))})))}(e)}configure(){}}var ge=r(14349),he=r(59099);const fe=(0,i.ConfigurationSchema)("PAFAdapter",{assemblyNames:{type:"stringArray",defaultValue:[],description:"Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second"},targetAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the target assembly name"},queryAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the query assembly name"},pafLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/file.paf",locationType:"UriLocation"}}},{explicitlyTyped:!0}),ye=(0,i.ConfigurationSchema)("PairwiseIndexedPAFAdapter",{assemblyNames:{type:"stringArray",defaultValue:[],description:"Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second"},targetAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the target assembly name"},queryAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the query assembly name"},pifGzLocation:{type:"fileLocation",description:"location of pairwise tabix indexed PAF (pif)",defaultValue:{uri:"/path/to/data/file.pif.gz",locationType:"UriLocation"}},index:(0,i.ConfigurationSchema)("TabixIndex",{indexType:{model:d.types.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:{type:"fileLocation",defaultValue:{uri:"/path/to/my.paf.gz.tbi",locationType:"UriLocation"}}})},{explicitlyTyped:!0}),be=(0,i.ConfigurationSchema)("MCScanAnchorsAdapter",{mcscanAnchorsLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/mcscan.anchors",locationType:"UriLocation"}},bed1Location:{type:"fileLocation",defaultValue:{uri:"/path/to/file.bed",locationType:"UriLocation"}},bed2Location:{type:"fileLocation",defaultValue:{uri:"/path/to/file.bed",locationType:"UriLocation"}},assemblyNames:{type:"stringArray",defaultValue:[]}},{explicitlyTyped:!0}),we=(0,i.ConfigurationSchema)("MCScanSimpleAnchorsAdapter",{mcscanSimpleAnchorsLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/mcscan.anchors.simple",locationType:"UriLocation"}},bed1Location:{type:"fileLocation",defaultValue:{uri:"/path/to/file.bed",locationType:"UriLocation"}},bed2Location:{type:"fileLocation",defaultValue:{uri:"/path/to/file.bed",locationType:"UriLocation"}},assemblyNames:{type:"stringArray",defaultValue:[]}},{explicitlyTyped:!0}),ve=(0,i.ConfigurationSchema)("MashMapAdapter",{assemblyNames:{type:"stringArray",defaultValue:[],description:"Target is the first value in the array, query is the second"},targetAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames array: the target assembly"},queryAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames array: the query assembly"},outLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/mashmap.out",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Ce=(0,i.ConfigurationSchema)("DeltaAdapter",{assemblyNames:{type:"stringArray",defaultValue:[],description:"Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second"},targetAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the target assembly name"},queryAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames: the query assembly name"},deltaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/file.delta",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Se=(0,i.ConfigurationSchema)("ChainAdapter",{assemblyNames:{type:"stringArray",defaultValue:[],description:"Target is the first value in the array, query is the second"},targetAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames array: the target assembly"},queryAssembly:{type:"string",defaultValue:"",description:"Alternative to assemblyNames array: the query assembly"},chainLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/file.chain",locationType:"UriLocation"}}},{explicitlyTyped:!0});class ke extends a.A{name="ComparativeAdaptersPlugin";install(e){!function(e){e.addAdapterType((()=>new $.A({name:"PAFAdapter",displayName:"PAF adapter",configSchema:fe,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(5904)]).then(r.bind(r,35904)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"PairwiseIndexedPAFAdapter",displayName:"Pairwise indexed PAF adapter",configSchema:ye,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(8120),r.e(3167)]).then(r.bind(r,23167)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"DeltaAdapter",displayName:"MUMmer delta adapter",configSchema:Ce,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(5904),r.e(2820)]).then(r.bind(r,12820)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"ChainAdapter",displayName:"Liftover chain adapter",configSchema:Se,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(5904),r.e(8929)]).then(r.bind(r,98929)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"MCScanAnchorsAdapter",displayName:"MCScan anchors adapter",configSchema:be,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(8965)]).then(r.bind(r,28965)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"MCScanSimpleAnchorsAdapter",displayName:"MCScan anchors.simple adapter",configSchema:we,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(9409)]).then(r.bind(r,69409)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"MashMapAdapter",displayName:"MashMap adapter",configSchema:ve,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(5904),r.e(9449)]).then(r.bind(r,29449)).then((e=>e.default))})))}(e),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="PAFAdapter",o=(0,X.getFileName)(t);return/\.paf/i.test(o)||n===a?{type:a,pafLocation:t}:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"PAFAdapter"===t?"SyntenyTrack":e(t)))}}var Te=r(16574),xe=r(24006),Ae=r(7772),Pe=r(90542),Me=r(29417),Ee=r(97884),Re=r(93707);const Ie=Ee.A.extend((e=>{const t=ae.observable.box(1);return{views:{get dynamicBlocks(){return(0,Re.A)(e,!1,!1)},get scaleFactor(){return t.get()},get maxBpPerPx(){return e.totalBp/(e.width-50)},get minBpPerPx(){return.02},get maxOffset(){return e.displayedRegionsTotalPx-.2*e.width},get minOffset(){return.8*-e.width}},actions:{setScaleFactor(e){t.set(e)},center(){const t=e.totalBp/2/e.bpPerPx;e.scrollTo(t-e.width/2)}}}})),Ne=Ie.extend((e=>({views:{get width(){return(0,d.getParent)(e).viewWidth}}}))),Fe=Ie.extend((e=>({views:{get width(){return(0,d.getParent)(e).viewHeight}}})));var Le=r(90257);const De=(0,w.lazy)((()=>r.e(8859).then(r.bind(r,78859)))),Be=(0,w.lazy)((()=>Promise.resolve().then(r.bind(r,87686))));function Ve(e){return(0,c.measureText)(e.slice(0,30))}function ze(e,t,r){return(0,c.max)([...e.filter((e=>!r.has(e.key))).map((e=>Ve(e.refName))),...e.filter((e=>!r.has(e.key))).map((e=>Ve((0,c.getTickDisplayStr)(e.end,t))))])}var Oe=r(56328),He=r(75785),je=r(36715),We=r(68446);const Ge=(0,He.n9)()((e=>{const t=e.palette.action.disabledBackground;return{loading:{paddingLeft:"0.6em",backgroundColor:e.palette.background.default,backgroundImage:`repeating-linear-gradient(45deg, transparent, transparent 5px, ${t} 5px, ${t} 10px)`,textAlign:"center"},blockMessage:{backgroundColor:t,padding:"10px"},blockError:{backgroundColor:t,padding:"10px",color:"red"}}}));function $e(){const[e,t]=(0,w.useState)(!1),{classes:r}=Ge();return(0,w.useEffect)((()=>{const e=setTimeout((()=>{t(!0)}),300);return()=>{clearTimeout(e)}}),[]),e?w.createElement("div",{className:r.loading},w.createElement(T.LoadingEllipses,null)):null}function qe({messageText:e}){const{classes:t}=Ge();return w.createElement("div",{className:t.blockMessage},w.createElement(je.A,null,e))}function _e({error:e}){const{classes:t}=Ge();return w.createElement("div",{className:t.blockError},w.createElement(je.A,null,`${e}`))}const Ue=(0,We.observer)((function({model:e,style:t}){return e.error?w.createElement(_e,{error:e.error,"data-testid":"reload_button"}):e.message?w.createElement(qe,{messageText:e.message}):e.filled?e.shouldDisplay?w.createElement("div",{style:t},e.reactElement):null:w.createElement($e,null)})),Je=Ue;var Xe=r(33039),Ye=r.n(Xe);function Ke(e){const{rpcManager:t}=(0,c.getSession)(e),{rendererType:r}=e,{adapterConfig:n}=e,a=(0,c.getContainingView)(e);if((0,i.readConfObject)(e.configuration),(0,d.getSnapshot)(a),a.initialized){const{viewWidth:o,viewHeight:i,borderSize:s,borderX:l,borderY:c}=a;return{rendererType:r,rpcManager:t,renderProps:{...e.renderProps(),view:Ye()((0,d.getSnapshot)(a)),width:o,height:i,borderSize:s,borderX:l,borderY:c,adapterConfig:n,rendererType:r.name,sessionId:(0,X.getRpcSessionId)(e),timeout:1e6}}}}function Qe(e){return d.types.compose("DotplotDisplay",s.BaseDisplay,d.types.model({type:d.types.literal("DotplotDisplay"),configuration:(0,i.ConfigurationReference)(e)}).volatile((()=>({warnings:[],renderInProgress:void 0,filled:!1,data:void 0,reactElement:void 0,message:void 0,renderingComponent:void 0,ReactComponent2:Je})))).views((e=>({get shouldDisplay(){const{vview:t,hview:r}=(0,c.getContainingView)(e);return t.bpPerPx===e.data.bpPerPxY&&r.bpPerPx===e.data.bpPerPxX},get rendererTypeName(){return(0,i.getConf)(e,["renderer","type"])},renderProps:()=>({...(0,X.getParentRenderProps)(e),rpcDriverName:e.rpcDriverName,displayModel:e,config:e.configuration.renderer})}))).views((e=>({async renderSvg(t){const r=Ke(e);if(!r)return null;const{rendererType:n,rpcManager:a,renderProps:o}=r,i=await n.renderInClient(a,{...o,exportSVG:t,theme:t.theme||o.theme}),{hview:s,vview:l}=(0,c.getContainingView)(e),d=-s.offsetPx+i.offsetX,u=-l.offsetPx+i.offsetY;return w.createElement("g",{transform:`translate(${d} ${-u})`},w.createElement(c.ReactRendering,{rendering:i}))}}))).actions((e=>{let t;return{afterAttach(){(0,c.makeAbortableReaction)(e,(()=>Ke(e)),(e=>async function(e){if(!e)return;const{rendererType:t,rpcManager:r,renderProps:n}=e,{reactElement:a,...o}=await t.renderInClient(r,n);return{reactElement:a,data:o,renderingComponent:t.ReactComponent}}(e)),{name:`${e.type} ${e.id} rendering`,delay:500,fireImmediately:!0},this.setLoading,this.setRendered,this.setError)},setLoading(r){e.filled=!1,e.message=void 0,e.reactElement=void 0,e.data=void 0,e.error=void 0,e.renderingComponent=void 0,t=r},setMessage(r){t&&!t.signal.aborted&&t.abort(),e.filled=!1,e.message=r,e.reactElement=void 0,e.data=void 0,e.error=void 0,e.renderingComponent=void 0,t=void 0},setRendered(r){if(void 0===r)return;const{data:n,reactElement:a,renderingComponent:o}=r;e.warnings=n.warnings,e.filled=!0,e.message=void 0,e.reactElement=a,e.data=n,e.error=void 0,e.renderingComponent=o,t=void 0},setError(r){console.error(r),t&&!t.signal.aborted&&t.abort(),e.filled=!1,e.message=void 0,e.reactElement=void 0,e.data=void 0,e.error=r,e.renderingComponent=void 0,t=void 0}}}))}function Ze(){return Ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ze.apply(null,arguments)}const et=(0,We.observer)((function(e){const{model:t,children:r}=e,{offsetX:n=0,offsetY:a=0}=t.data||{},o=(0,c.getContainingView)(t),i=o.vview.offsetPx-a,s=-(o.hview.offsetPx-n);return w.createElement("div",{style:{position:"relative"}},w.createElement(t.ReactComponent2,Ze({},e,{style:{position:"absolute",top:i,left:s}})),r)})),tt=et;const rt=(0,We.observer)((function(e){return w.createElement(T.PrerenderedCanvas,e)}));var nt=r(57027);class at extends nt.A{supportsSVG=!0;async renameRegionsIfNeeded(e){const t=this.pluginManager,r=t.rootModel?.session?.assemblyManager,{view:n,sessionId:a,adapterConfig:o}=e;async function i(e){if(!r)throw new Error("No assembly manager provided");return(await(0,c.renameRegionsIfNeeded)(r,{sessionId:a,adapterConfig:o,regions:e})).regions}return n.hview.displayedRegions=await i(n.hview.displayedRegions),n.vview.displayedRegions=await i(n.vview.displayedRegions),e}async render(e){const{width:t,height:n,view:{hview:a,vview:o}}=e,i=[t,n],s=[a,o].map(((e,t)=>{const r=Ie.create(e);return r.setVolatileWidth(i[t]),r})),l=s[0],d=await this.getFeatures({...e,regions:l.dynamicBlocks.contentBlocks});l.setFeatures(d);const{drawDotplot:u}=await r.e(1752).then(r.bind(r,31752)),p=await(0,c.renderToAbstractCanvas)(t,n,e,(t=>u(t,{...e,views:s})));return{...await super.render({...e,...p,height:n,width:t}),...p,height:n,width:t,offsetX:s[0].dynamicBlocks.blocks[0]?.offsetPx||0,offsetY:s[1].dynamicBlocks.blocks[0]?.offsetPx||0,bpPerPxX:s[0].bpPerPx,bpPerPxY:s[1].bpPerPx}}}const ot=(0,i.ConfigurationSchema)("DotplotRenderer",{color:{type:"color",description:"the color of each feature in a synteny, used with colorBy:default",defaultValue:"#f0f",contextVariable:["feature"]},posColor:{type:"color",description:"the color for forward alignments, used with colorBy:strand",defaultValue:"blue"},negColor:{type:"color",description:"the color for reverse alignments, used with colorBy:strand",defaultValue:"red"},lineWidth:{type:"number",description:"width of the lines to be drawn",defaultValue:2.5},colorBy:{type:"stringEnum",model:d.types.enumeration("colorBy",["identity","meanQueryIdentity","mappingQuality","strand","default"]),description:'Color by options:<br/>\n<ul>\n <li>"identity" - the identity of the particular hit, similar to D-GENIES, use the other config slots \'thresholds\' and \'thresholdsPalette\' to define colors for this setting</li>\n <li>"meanQueryIdentity" - calculates the weighted mean identity (weighted by alignment length) of all the hits that the query maps to (e.g. if the query is split aligned to many target, uses their weighted mean. can help show patterns of more related and distant synteny after WGD)</li>\n <li>"mappingQuality" - uses mapping quality from PAF, some adapters don\'t have this setting</li>\n <li>"strand" - colors negative alignments with negColor and positive alignments with posColor</li>\n <li>"default" - uses the \'color\' config slot</li>\n</ul>',defaultValue:"default"},thresholdsPalette:{type:"stringArray",defaultValue:["#094b09","#2ebd40","#d5670b","#ffd84b"],description:"threshold colors, used with colorBy:identity"},thresholds:{type:"stringArray",defaultValue:["0.75","0.5","0.25","0"],description:"threshold breakpoints, used with colorBy:identity"}},{explicitlyTyped:!0});var it=r(2406);class st extends it.A{name="ComparativeRender";async renameRegionsIfNeeded(e,t){return t.renameRegionsIfNeeded(e)}getRenderer(e){return this.pluginManager.getRendererType(e)}async serializeArguments(e,t){const{rendererType:r}=e,n=this.getRenderer(r),a=await super.serializeArguments(e,t),o=await this.renameRegionsIfNeeded(a,n);return"MainThreadRpcDriver"===t?o:n.serializeArgsInClient(o)}async execute(e,t){let r=e;"MainThreadRpcDriver"!==t&&(r=await this.deserializeArguments(e,t));const{sessionId:n,rendererType:a,signal:o}=r;if(!n)throw new Error("must pass a unique session id");(0,c.checkAbortSignal)(o);const i=this.getRenderer(a);return"MainThreadRpcDriver"===t?i.render(r):i.renderInWorker(r)}async deserializeReturn(e,t,r){const n=await super.deserializeReturn(e,t,r);return"MainThreadRpcDriver"===r?n:this.getRenderer(t.rendererType).deserializeResultsInClient(n,t)}}var lt=r(374);const{featurizeSA:ct,getClip:dt,getTag:ut,getLength:pt,getLengthSansClipping:mt}=n.aF;class gt extends a.A{name="DotplotPlugin";install(e){var t;!function(e){e.addViewType((()=>{return new te.A({name:"DotplotView",displayName:"Dotplot view",stateModel:(t=e,d.types.compose("DotplotView",Ae.A,d.types.model({id:K.ElementId,type:d.types.literal("DotplotView"),height:600,borderSize:20,tickSize:5,vtextRotation:0,htextRotation:-90,fontSize:15,trackSelectorType:"hierarchical",assemblyNames:d.types.array(d.types.string),drawCigar:!0,hview:d.types.optional(Ne,{}),vview:d.types.optional(Fe,{}),tracks:d.types.array(t.pluggableMstType("track","stateModel")),viewTrackConfigs:d.types.array(t.pluggableConfigSchemaType("track"))})).volatile((()=>({volatileWidth:void 0,volatileError:void 0,cursorMode:(0,c.localStorageGetItem)("dotplot-cursorMode")||"crosshair",showPanButtons:Boolean(JSON.parse((0,c.localStorageGetItem)("dotplot-showPanbuttons")||"true")),wheelMode:(0,c.localStorageGetItem)("dotplot-wheelMode")||"zoom",borderX:100,borderY:100}))).views((e=>({get width(){if(!e.volatileWidth)throw new Error("width not initialized");return e.volatileWidth}}))).views((e=>({get assemblyErrors(){const{assemblyManager:t}=(0,c.getSession)(e);return e.assemblyNames.map((e=>t.get(e)?.error)).filter((e=>!!e)).join(", ")},get assembliesInitialized(){const{assemblyManager:t}=(0,c.getSession)(e);return e.assemblyNames.every((e=>t.get(e)?.initialized??!0))}}))).views((e=>({get initialized(){return void 0!==e.volatileWidth&&e.hview.displayedRegions.length>0&&e.vview.displayedRegions.length>0&&e.assembliesInitialized},get hticks(){const{hview:t}=e,{dynamicBlocks:r,staticBlocks:n,bpPerPx:a}=t;return r.contentBlocks.length>5?[]:(0,Le.H2)(n.contentBlocks,a)},get vticks(){const{vview:t}=e,{dynamicBlocks:r,staticBlocks:n,bpPerPx:a}=t;return r.contentBlocks.length>5?[]:(0,Le.H2)(n.contentBlocks,a)},get loading(){return e.assemblyNames.length>0&&!this.initialized},get viewWidth(){return e.width-e.borderX},get viewHeight(){return e.height-e.borderY},get views(){return[e.hview,e.vview]},renderProps(){const t=(0,c.getSession)(e);return{...(0,X.getParentRenderProps)(e),drawCigar:e.drawCigar,highResolutionScaling:(0,i.getConf)(t,"highResolutionScaling")}}}))).actions((e=>({setShowPanButtons(t){e.showPanButtons=t},setWheelMode(t){e.wheelMode=t},setCursorMode(t){e.cursorMode=t},setDrawCigar(t){e.drawCigar=t},clearView(){e.hview.setDisplayedRegions([]),e.vview.setDisplayedRegions([]),e.assemblyNames=(0,d.cast)([]),e.tracks.clear()},setBorderX(t){e.borderX=t},setBorderY(t){e.borderY=t},setWidth:t=>(e.volatileWidth=t,e.volatileWidth),setHeight:t=>(e.height=t,e.height),setError(t){e.volatileError=t},zoomOutButton(){e.hview.zoomOut(),e.vview.zoomOut()},zoomInButton(){e.hview.zoomIn(),e.vview.zoomIn()},activateTrackSelector(){if("hierarchical"===e.trackSelectorType){const t=(0,c.getSession)(e);if((0,c.isSessionModelWithWidgets)(t)){const r=t.addWidget("HierarchicalTrackSelectorWidget","hierarchicalTrackSelector",{view:e});return t.showWidget(r),r}}throw new Error(`invalid track selector type ${e.trackSelectorType}`)},showTrack(r,n={}){const a=t.pluggableConfigSchemaType("track"),o=(0,d.resolveIdentifier)(a,(0,d.getRoot)(e),r),i=t.getTrackType(o.type);if(!i)throw new Error(`unknown track type ${o.type}`);const s=t.getViewType(e.type),l=o.displays.find((e=>s.displayTypes.find((t=>t.name===e.type))));if(!l)throw new Error(`could not find a compatible display for view type ${e.type}`);const c=i.stateModel.create({...n,type:o.type,configuration:o,displays:[{type:l.type,configuration:l}]});e.tracks.push(c)},hideTrack(r){const n=t.pluggableConfigSchemaType("track"),a=(0,d.resolveIdentifier)(n,(0,d.getRoot)(e),r),o=e.tracks.filter((e=>e.configuration===a));return(0,ae.transaction)((()=>{o.forEach((t=>e.tracks.remove(t)))})),o.length},toggleTrack(e){return!this.hideTrack(e)&&(this.showTrack(e),!0)},setAssemblyNames(t,r){e.assemblyNames=(0,d.cast)([t,r])},setViews(t){e.hview=(0,d.cast)(t[0]),e.vview=(0,d.cast)(t[1])},getCoords(t,r){const[n,a]=(0,c.minmax)(r[0],t[0]),[o,i]=(0,c.minmax)(r[1],t[1]);return Math.abs(a-n)>3&&Math.abs(i-o)>3?[e.hview.pxToBp(n),e.hview.pxToBp(a),e.vview.pxToBp(e.viewHeight-o),e.vview.pxToBp(e.viewHeight-i)]:void 0},zoomIn(t,r){const n=this.getCoords(t,r);if(n){const[t,r,a,o]=n;e.hview.moveTo(t,r),e.vview.moveTo(o,a)}},showAllRegions(){e.hview.zoomTo(e.hview.maxBpPerPx),e.vview.zoomTo(e.vview.maxBpPerPx),e.vview.center(),e.hview.center()},onDotplotView(t,r){const n=this.getCoords(t,r);if(n){const[t,r,a,o]=n,i=(0,c.getSession)(e),s=Ie.create({...(0,d.getSnapshot)(e.hview),minimumBlockWidth:0,interRegionPaddingWidth:0}),l=Ie.create({...(0,d.getSnapshot)(e.vview),minimumBlockWidth:0,interRegionPaddingWidth:0});s.setVolatileWidth(e.hview.width),l.setVolatileWidth(e.vview.width),s.moveTo(t,r),l.moveTo(o,a),s.zoomTo(s.bpPerPx/(e.width/e.hview.width),0),l.zoomTo(l.bpPerPx/(e.width/e.vview.width),0);const u=e.tracks.map((e=>e.configuration.displays.find((e=>"LinearSyntenyDisplay"===e.type)))).filter((e=>!!e)).map((e=>{const t=(0,d.getParent)(e,2);return{type:t.type,configuration:t,displays:[{type:e.type,configuration:e}]}})),{id:p,...m}=(0,d.getSnapshot)(s),{id:g,...h}=(0,d.getSnapshot)(l),f={type:"LinearSyntenyView",views:[{type:"LinearGenomeView",tracks:[],hideHeader:!0,...m},{type:"LinearGenomeView",tracks:[],hideHeader:!0,...h}],tracks:u};i.addView("LinearSyntenyView",f)}}}))).actions((e=>({async exportSvg(t={}){const{renderToSvg:n}=await r.e(1266).then(r.bind(r,11266)),a=await n(e,t),o=new Blob([a],{type:"image/svg+xml"});(0,oe.saveAs)(o,t.filename||"image.svg")},beforeDestroy(){const t=(0,c.getSession)(e);for(const r in e.assemblyNames)t.removeTemporaryAssembly?.(r)},afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((()=>{const{showPanButtons:t,wheelMode:r,cursorMode:n}=e;var a;"undefined"!=typeof localStorage&&(localStorage.setItem("dotplot-showPanbuttons",(a=t,JSON.stringify(a))),localStorage.setItem("dotplot-cursorMode",n),localStorage.setItem("dotplot-wheelMode",r))}))),(0,d.addDisposer)(e,(0,ae.autorun)((()=>{const t=(0,c.getSession)(e);if(void 0===e.volatileWidth||!e.assembliesInitialized)return;if(e.hview.displayedRegions.length>0&&e.vview.displayedRegions.length>0)return;const r=[e.hview,e.vview];(0,ae.transaction)((()=>{e.assemblyNames.forEach(((e,n)=>{const a=t.assemblyManager.get(e);r[n].setDisplayedRegions(a?.regions||[])})),e.showAllRegions()}))}),{delay:1e3})),(0,d.addDisposer)(e,(0,ae.autorun)((function(){if(void 0===e.volatileWidth)return;const{vview:t,hview:r,viewHeight:n,viewWidth:a}=e,o=t.dynamicBlocks.contentBlocks,i=r.dynamicBlocks.contentBlocks,s=r.offsetPx,l=t.offsetPx,c=(0,Le.rQ)(o,n,l),d=(0,Le.rQ)(i,a,s),u=ze(i,t.bpPerPx,d),p=ze(o,r.bpPerPx,c);e.setBorderY(Math.max(u+40,50)),e.setBorderX(Math.max(p+40,50))})))},squareView(){const{hview:t,vview:r}=e,n=(t.bpPerPx+r.bpPerPx)/2,a=t.pxToBp(t.width/2),o=r.pxToBp(r.width/2);t.setBpPerPx(n),t.centerAt(a.coord,a.refName,a.index),r.setBpPerPx(n),r.centerAt(o.coord,o.refName,o.index)},squareViewProportional(){const{hview:t,vview:r}=e,n=t.width/r.width,a=(t.bpPerPx+r.bpPerPx)/2,o=t.pxToBp(t.width/2),i=r.pxToBp(r.width/2);t.setBpPerPx(a/n),t.centerAt(o.coord,o.refName,o.index),r.setBpPerPx(a),r.centerAt(i.coord,i.refName,i.index)}}))).views((e=>({menuItems(){const t=(0,c.getSession)(e);return[{label:"Return to import form",onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Be,{model:e,handleClose:t}]))},icon:Me.A},{label:"Square view - same bp per pixel",onClick:()=>{e.squareView()}},{label:"Rectangular view - same total bp",onClick:()=>{e.squareView()}},{label:"Show all regions",onClick:()=>{e.showAllRegions()}},{label:"Export SVG",icon:ie.A,onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[De,{model:e,handleClose:t}]))}},...(0,c.isSessionModelWithWidgets)(t)?[{label:"Open track selector",onClick:e.activateTrackSelector,icon:Pe.xU}]:[]]},get error(){return e.volatileError||e.assemblyErrors}})))),ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(5515),r.e(3474)]).then(r.bind(r,63474))))});var t}))}(e),(t=e).addDisplayType((()=>{const e=function(e){return(0,i.ConfigurationSchema)("DotplotDisplay",{renderer:d.types.optional(e.pluggableConfigSchemaType("renderer"),{type:"DotplotRenderer"})},{explicitIdentifier:"displayId",explicitlyTyped:!0})}(t);return new Oe.A({name:"DotplotDisplay",displayName:"Dotplot display",configSchema:e,stateModel:Qe(e),trackType:"SyntenyTrack",viewType:"DotplotView",ReactComponent:tt})})),function(e){e.addRendererType((()=>new at({name:"DotplotRenderer",configSchema:ot,ReactComponent:rt,pluginManager:e})))}(e),function(e){e.addToExtensionPoint("LaunchView-DotplotView",(async({session:e,views:t,tracks:r=[]})=>{try{const n=e.addView("DotplotView",{}),a=t.map((e=>e.assembly));(0,ae.transaction)((()=>{n.setViews([{bpPerPx:.1,offsetPx:0},{bpPerPx:.1,offsetPx:0}]),n.setAssemblyNames(a[0],a[1])}));const o=[];if(r.forEach((e=>{!function(e,t,r){try{e.showTrack(t)}catch(e){if(!/Could not resolve identifier/.exec(`${e}`))throw e;r.push(t)}}(n,e,o)})),o.length)throw new Error(`Could not resolve identifiers: ${o.join(",")}`)}catch(t){throw e.notifyError(`${t}`,t),t}}))}(e),function(e){e.addToExtensionPoint("Core-extendPluggableElement",(e=>{if("LinearPileupDisplay"===e.name){const{stateModel:t}=e,r=t.extend((e=>{const t=e.contextMenuItems;return{views:{contextMenuItems(){const r=e.contextMenuFeature;return[...t(),...r?[{label:"Dotplot of read vs ref",icon:lt.A,onClick:()=>{!function(e,t){const r=(0,c.getSession)(t);try{const n=e.get("CIGAR"),a=dt(n,1),o=e.get("flags"),s=e.get("strand"),l=e.get("name"),d=`${l}_assembly_${Date.now()}`,{parentTrack:u}=t,[p]=(0,i.getConf)(u,"assemblyNames"),m=[p,d],g=`track-${Date.now()}`,h=`${l}_vs_${p}`,f=ut(e,"SA")||"",y=ct(f,e.id(),s,l,!0),b=e.toJSON();b.strand=1,b.mate={refName:l,start:a,end:a+mt(n)};const w=pt(2048&o?y[0].CIGAR:n),v=[b,...y];v.sort(((e,t)=>e.clipPos-t.clipPos));const C=v.reduce(((e,t)=>e+t.end-t.start),0);r.addView("DotplotView",{type:"DotplotView",hview:{offsetPx:0,bpPerPx:C/800,displayedRegions:(0,c.gatherOverlaps)(v.map(((e,t)=>{const{start:r,end:n,refName:a}=e;return{start:r,end:n,refName:a,index:t,assemblyName:p}})))},vview:{offsetPx:0,bpPerPx:w/400,minimumBlockWidth:0,interRegionPaddingWidth:0,displayedRegions:[{assemblyName:d,start:0,end:w,refName:l}]},viewTrackConfigs:[{type:"SyntenyTrack",assemblyNames:m,adapter:{type:"FromConfigAdapter",features:v},trackId:g,name:h}],assemblyNames:m,tracks:[{configuration:g,type:"SyntenyTrack",displays:[{type:"DotplotDisplay",configuration:`${g}-DotplotDisplay`}]}],displayName:`${l} vs ${p}`})}catch(e){console.error(e),r.notifyError(`${e}`,e)}}(r,e)}}]:[]]}}}}));e.stateModel=r}return e}))}(e),e.addRpcMethod((()=>new st(e)))}configure(e){(0,c.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToSubMenu(["Add"],{label:"Dotplot view",icon:xe.A,onClick:e=>{e.addView("DotplotView",{})}})}}const ht=(0,i.ConfigurationSchema)("GtfAdapter",{gtfLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.gtf",locationType:"UriLocation"}}},{explicitlyTyped:!0});class ft extends a.A{name="GTFPlugin";install(e){e.addAdapterType((()=>new $.A({name:"GtfAdapter",displayName:"GTF adapter",configSchema:ht,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4499),r.e(1503)]).then(r.bind(r,61503)).then((e=>e.default))}))),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="GtfAdapter",o=(0,X.getFileName)(t),i={type:a,gtfLocation:t};return/\.gtf(\.gz)?$/i.test(o)&&!n||n===a?i:e(t,r,n)}))}}const yt=(0,i.ConfigurationSchema)("Gff3TabixAdapter",{gffGzLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.gff.gz",locationType:"UriLocation"}},index:(0,i.ConfigurationSchema)("Gff3TabixIndex",{indexType:{model:d.types.enumeration("IndexType",["TBI","CSI"]),type:"stringEnum",defaultValue:"TBI"},location:{type:"fileLocation",defaultValue:{uri:"/path/to/my.gff.gz.tbi",locationType:"UriLocation"}}}),dontRedispatch:{type:"stringArray",defaultValue:["chromosome","region","contig"]}},{explicitlyTyped:!0}),bt=(0,i.ConfigurationSchema)("Gff3Adapter",{gffLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.gff",locationType:"UriLocation"}}},{explicitlyTyped:!0});class wt extends a.A{name="GFF3Plugin";install(e){!function(e){e.addAdapterType((()=>new Q.AdapterType({name:"Gff3TabixAdapter",displayName:"GFF3 tabix adapter",configSchema:yt,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(8120),r.e(2645),r.e(7409)]).then(r.bind(r,27409)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new Q.AdapterType({name:"Gff3Adapter",displayName:"GFF3 adapter",configSchema:bt,getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(4499),r.e(2645),r.e(7809)]).then(r.bind(r,37809)).then((e=>e.default))})))}(e),function(e){e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="Gff3TabixAdapter",o=(0,X.getFileName)(t),i=r&&(0,X.getFileName)(r);return/\.gff3?\.b?gz$/i.test(o)||n===a?{type:a,bamLocation:t,gffGzLocation:t,index:{location:r||(0,X.makeIndex)(t,".tbi"),indexType:(0,X.makeIndexType)(i,"CSI","TBI")}}:e(t,r,n)})),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="Gff3Adapter",o=(0,X.getFileName)(t),i={type:a,gffLocation:t};return/\.gff3?$/i.test(o)&&!n||n===a?i:e(t,r,n)}))}(e)}}const vt=d.types.model("Job",{name:d.types.string,statusMessage:d.types.maybe(d.types.string),progressPct:d.types.number}).volatile((()=>({cancelCallback(){}}))).actions((e=>({setCancelCallback(t){e.cancelCallback=t},setStatusMessage(t){e.statusMessage=t},setProgressPct(t){e.progressPct=t}}))),Ct=(0,i.ConfigurationSchema)("JobsListWidget",{});class St extends a.A{name="JobsManagementPlugin";install(e){!function(e){e.addWidgetType((()=>new Q.WidgetType({name:"JobsListWidget",heading:"Jobs list",configSchema:Ct,stateModel:d.types.model("JobsListModel",{id:K.ElementId,type:d.types.literal("JobsListWidget"),jobs:d.types.array(vt),finished:d.types.array(vt),queued:d.types.array(vt),aborted:d.types.array(vt)}).actions((e=>({addJob(t){const{cancelCallback:r}=t,n=e.jobs.push(t),a=e.jobs[n-1];return a.setCancelCallback(r),a},removeJob(t){const r=e.jobs.findIndex((e=>e.name===t)),n=e.jobs[r];return e.jobs.splice(r,1),n},addFinishedJob:t=>(e.finished.push(t),e.finished),addQueuedJob:t=>(e.queued.push(t),e.finished),addAbortedJob:t=>(e.aborted.push(t),e.aborted),removeQueuedJob(t){const r=e.queued.findIndex((e=>e.name===t)),n=e.queued[r];return e.queued.splice(r,1),n},updateJobStatusMessage(t,r){const n=e.jobs.find((e=>e.name===t));if(!n)throw new Error(`No job found with name ${t}`);n.setStatusMessage(r)},updateJobProgressPct(t,r){const n=e.jobs.find((e=>e.name===t));if(!n)throw new Error(`No job found with name ${t}`);n.setProgressPct(r)}}))),ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(3011),r.e(9168)]).then(r.bind(r,29168))))})))}(e)}configure(e){(0,c.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToMenu("Tools",{label:"Jobs list",icon:Pe.jT,onClick:e=>{if((0,c.isSessionModelWithWidgets)(e)){const{widgets:t}=e;let r=t.get("JobsList");r||(r=e.addWidget("JobsListWidget","JobsList")),e.showWidget(r)}}})}}const kt=(0,i.ConfigurationSchema)("NCListAdapter",{rootUrlTemplate:{type:"fileLocation",defaultValue:{uri:"/path/to/my/{refseq}/trackData.json",locationType:"UriLocation"}},refNames:{type:"stringArray",defaultValue:[],description:"List of refNames used by the NCList used for aliasing"}},{explicitlyTyped:!0});var Tt=r(8024);const xt=(0,i.ConfigurationSchema)("JBrowse1TextSearchAdapter",{namesIndexLocation:{type:"fileLocation",defaultValue:{uri:"/volvox/names",locationType:"UriLocation"},description:"the location of the JBrowse1 names index data directory"},tracks:{type:"stringArray",defaultValue:[],description:"List of tracks covered by text search adapter"},assemblyNames:{type:"stringArray",defaultValue:[],description:"List of assemblies covered by text search adapter"}},{explicitlyTyped:!0,explicitIdentifier:"textSearchAdapterId"});var At=r(91612);const Pt=(0,i.ConfigurationSchema)("JBrowse1Connection",{dataDirLocation:{type:"fileLocation",defaultValue:{uri:"http://mysite.com/jbrowse/data/",locationType:"UriLocation"},description:"the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/"},assemblyNames:{description:"name of the assembly the connection belongs to, should be a single entry",type:"stringArray",defaultValue:[]}},{baseConfiguration:s.baseConnectionConfig});function Mt(e){return d.types.compose("JBrowse1Connection",(0,s.BaseConnectionModelFactory)(e),d.types.model({configuration:(0,i.ConfigurationReference)(Pt),type:d.types.literal("JBrowse1Connection")})).actions((e=>({async connect(){const t=(0,c.getSession)(e);try{const n=(0,i.getConf)(e,"dataDirLocation"),{fetchJb1:a}=await r.e(7911).then(r.bind(r,77911)),{convertTrackConfig:o}=await r.e(5998).then(r.bind(r,55998)),s=await a(n),l=(0,i.getConf)(e,"assemblyNames")[0];if(!l)throw new Error("assembly name required for JBrowse 1 connection");const c=t.assemblies.find((e=>(0,i.readConfObject)(e,"name")===l));if(!c)throw new Error(`Assembly "${l}" not found`);const d=(0,i.readConfObject)(c,["sequence","adapter"]),u=s.tracks?.map((e=>({...o(e,s.dataRoot||"",d),assemblyNames:[l]})));e.setTrackConfs(u)}catch(r){console.error(r),t.notifyError(`There was a problem connecting to the JBrowse 1 data directory "${e.name}". Please make sure you have entered a valid location. The error that was thrown is: "${r}"`,r),t.breakConnection?.(e.configuration)}}})))}class Et extends a.A{name="LegacyJBrowsePlugin";install(e){!function(e){e.addAdapterType((()=>new Q.AdapterType({name:"NCListAdapter",displayName:"NCList adapter",configSchema:kt,getAdapterClass:()=>r.e(3525).then(r.bind(r,33525)).then((e=>e.default))})))}(e),function(e){e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="NCListAdapter",o=(0,X.getFileName)(t);return/trackData.jsonz?$/i.test(o)||n===a?{type:a,rootUrlTemplate:t}:e(t,r,n)}))}(e),function(e){e.addTextSearchAdapterType((()=>new Tt.A({name:"JBrowse1TextSearchAdapter",configSchema:xt,description:"A JBrowse 1 text search adapter",getAdapterClass:()=>r.e(8797).then(r.bind(r,58797)).then((e=>e.default))})))}(e),function(e){e.addConnectionType((()=>new At.A({name:"JBrowse1Connection",configSchema:Pt,stateModel:Mt(e),displayName:"JBrowse 1 Data",description:"A JBrowse 1 data directory",url:"//jbrowse.org/"})))}(e)}}var Rt=r(20529),It=r(24250);const Nt=function(e){return(0,i.ConfigurationSchema)("LinearComparativeDisplay",{},{explicitlyTyped:!0,explicitIdentifier:"displayId"})};function Ft(e){const{rpcManager:t}=(0,c.getSession)(e),r=e;(0,i.readConfObject)(e.configuration);const{adapterConfig:n}=e,a=(0,c.getContainingView)(e),o=(0,X.getRpcSessionId)(e);return(0,d.getSnapshot)(a),a.initialized?{rpcManager:t,renderProps:{...r.renderProps(),view:a,adapterConfig:n,sessionId:o,timeout:1e6,self:e}}:void 0}async function Lt(e){if(!e)return;const{rpcManager:t,renderProps:r}=e,{adapterConfig:n}=r,a=r.view.views[0],o=await t.call("getFeats","CoreGetFeatures",{regions:a.staticBlocks.contentBlocks,sessionId:"getFeats",adapterConfig:n});return{features:(0,c.dedupe)(o,(e=>e.id()))}}const Dt=function(e){return d.types.compose("LinearComparativeDisplay",s.BaseDisplay,d.types.model({type:d.types.literal("LinearComparativeDisplay"),configuration:(0,i.ConfigurationReference)(e),height:100})).volatile((()=>({renderInProgress:void 0,features:void 0,message:void 0}))).views((e=>({renderProps:()=>({rpcDriverName:e.rpcDriverName,displayModel:e,highResolutionScaling:2})}))).actions((e=>{let t;return{setLoading(r){e.message=void 0,e.error=void 0,t=r},setMessage(r){t&&!t.signal.aborted&&t.abort(),e.message=r,e.error=void 0,t=void 0},setRendered(r){if(!r)return;const{features:n}=r,a=e.features||[],o=new Set(a.map((e=>e.id()))),i=new Set(n.map((e=>e.id())));let s=!1,l=!1;for(const e of n)if(!o.has(e.id())){s=!0;break}for(const e of a)if(!i.has(e.id())){l=!0;break}e.message=void 0,e.error=void 0,t=void 0,(s||l||!e.features)&&(e.features=n)},setError(r){console.error(r),t&&!t.signal.aborted&&t.abort(),e.message=void 0,e.error=r,t=void 0}}})).actions((e=>({afterAttach(){(0,c.makeAbortableReaction)(e,Ft,Lt,{name:`${e.type} ${e.id} rendering`,delay:1e3,fireImmediately:!0},e.setLoading,e.setRendered,e.setError)}})))},Bt=(0,w.lazy)((()=>Promise.resolve().then(r.bind(r,87686)))),Vt=function(e){return d.types.compose("LinearComparativeView",Ae.A,d.types.model({id:K.ElementId,type:d.types.literal("LinearComparativeView"),trackSelectorType:"hierarchical",showIntraviewLinks:!0,interactToggled:!1,middleComparativeHeight:100,tracks:d.types.array(e.pluggableMstType("track","stateModel")),views:d.types.array(e.getViewType("LinearGenomeView").stateModel),viewTrackConfigs:d.types.array(e.pluggableConfigSchemaType("track"))})).volatile((()=>({width:void 0}))).views((e=>({get highResolutionScaling(){return 2},get initialized(){return void 0!==e.width&&e.views.length>0&&e.views.every((e=>e.initialized))},get refNames(){return e.views.map((e=>[...new Set(e.staticBlocks.map((e=>e.refName)))]))},get assemblyNames(){return[...new Set(e.views.flatMap((e=>e.assemblyNames)))]}}))).actions((t=>({beforeDestroy(){const e=(0,c.getSession)(t);for(const r of t.assemblyNames)e.removeTemporaryAssembly?.(r)},onSubviewAction(e,r,n){t.views.forEach((t=>{(0,d.getPath)(t).endsWith(r)||t[e](n?.[0])}))},setWidth(e){t.width=e},setViews(e){t.views=(0,d.cast)(e)},removeView(e){t.views.remove(e)},setMiddleComparativeHeight:e=>(t.middleComparativeHeight=e,t.middleComparativeHeight),activateTrackSelector(){if("hierarchical"!==t.trackSelectorType)throw new Error(`invalid track selector type ${t.trackSelectorType}`);{const e=(0,c.getSession)(t);if((0,c.isSessionModelWithWidgets)(e)){const r=e.addWidget("HierarchicalTrackSelectorWidget","hierarchicalTrackSelector",{view:t});return e.showWidget(r),r}}},toggleTrack(e){return!this.hideTrack(e)&&(this.showTrack(e),!0)},showTrack(r,n={}){const a=e.pluggableConfigSchemaType("track"),o=(0,d.resolveIdentifier)(a,(0,d.getRoot)(t),r);if(!o)throw new Error(`track not found ${r}`);const i=e.getTrackType(o.type);if(!i)throw new Error(`unknown track type ${o.type}`);const s=e.getViewType(t.type),l=new Set(s.displayTypes.map((e=>e.name))),c=o.displays.find((e=>l.has(e.type)));if(!c)throw new Error(`could not find a compatible display for view type ${t.type}`);t.tracks.push(i.stateModel.create({...n,type:o.type,configuration:o,displays:[{type:c.type,configuration:c}]}))},hideTrack(r){const n=e.pluggableConfigSchemaType("track"),a=(0,d.resolveIdentifier)(n,(0,d.getRoot)(t),r),o=t.tracks.filter((e=>e.configuration===a));return(0,ae.transaction)((()=>{o.forEach((e=>t.tracks.remove(e)))})),o.length},squareView(){const e=(0,c.avg)(t.views.map((e=>e.bpPerPx)));t.views.forEach((t=>{const r=t.pxToBp(t.width/2);t.setNewView(e,t.offsetPx),r.refName&&t.centerAt(r.coord,r.refName,r.index)}))},clearView(){t.views=(0,d.cast)([]),t.tracks=(0,d.cast)([])}}))).views((()=>({headerMenuItems:()=>[]}))).views((e=>({menuItems:()=>[...e.views.map(((e,t)=>[t,e.menuItems()])).map((e=>({label:`View ${e[0]+1} Menu`,subMenu:e[1]}))),{label:"Return to import form",onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Bt,{model:e,handleClose:t}]))},icon:Me.A},{label:"Open track selector",onClick:e.activateTrackSelector,icon:Pe.xU}],rubberBandMenuItems:()=>[{label:"Zoom to region(s)",onClick:()=>{e.views.forEach((e=>{const{leftOffset:t,rightOffset:r}=e;t&&r&&e.moveTo(t,r)}))}}]}))).actions((e=>({afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((()=>{e.width&&e.views.forEach((t=>{t.setWidth(e.width)}))})))}})))},zt=function(e){return d.types.compose("LinearSyntenyDisplay",Dt(e),d.types.model({type:d.types.literal("LinearSyntenyDisplay"),configuration:(0,i.ConfigurationReference)(e)})).volatile((()=>({mainCanvas:null,clickMapCanvas:null,cigarClickMapCanvas:null,mouseoverCanvas:null,featPositions:[],mouseoverId:void 0,clickId:void 0,cigarMouseoverId:-1}))).actions((e=>({setFeatPositions(t){e.featPositions=t},setMainCanvasRef(t){e.mainCanvas=t},setClickMapCanvasRef(t){e.clickMapCanvas=t},setCigarClickMapCanvasRef(t){e.cigarClickMapCanvas=t},setMouseoverCanvasRef(t){e.mouseoverCanvas=t},setMouseoverId(t){e.mouseoverId=t},setCigarMouseoverId(t){e.cigarMouseoverId=t},setClickId(t){e.clickId=t}}))).views((e=>({get adapterConfig(){return{name:e.parentTrack.configuration.adapter.type,assemblyNames:(0,i.getConf)(e,"assemblyNames"),...(0,i.getConf)(e.parentTrack,"adapter")}},get trackIds(){return(0,i.getConf)(e,"trackIds")},get numFeats(){return e.featPositions.length},get ready(){return this.numFeats>0},get featMap(){return Object.fromEntries(e.featPositions.map((e=>[e.f.id(),e])))}}))).actions((e=>({afterAttach(){(async()=>{try{const{doAfterAttach:t}=await r.e(8856).then(r.bind(r,28856));t(e)}catch(t){console.error(t),e.setError(t)}})()}})))},Ot=(0,w.lazy)((()=>r.e(5682).then(r.bind(r,33301))));var Ht=r(52521),jt=r(1633);function Wt(e){return w.createElement(F.A,e,w.createElement("path",{fill:"currentColor",d:"M16.5,21C13.5,21 12.31,16.76 11.05,12.28C10.14,9.04 9,5 7.5,5C4.11,5 4,11.93 4,12H2C2,11.63 2.06,3 7.5,3C10.5,3 11.71,7.25 12.97,11.74C13.83,14.8 15,19 16.5,19C19.94,19 20.03,12.07 20.03,12H22.03C22.03,12.37 21.97,21 16.5,21Z"}))}const Gt=(0,w.lazy)((()=>r.e(8869).then(r.bind(r,78869))));function $t(e){return d.types.compose("LinearSyntenyView",Vt(e),d.types.model({type:d.types.literal("LinearSyntenyView"),drawCIGAR:!0,drawCurves:!1})).actions((e=>({toggleCurves(){e.drawCurves=!e.drawCurves},toggleCIGAR(){e.drawCIGAR=!e.drawCIGAR},showAllRegions(){(0,ae.transaction)((()=>{e.views.forEach((e=>{e.showAllRegionsInAssembly()}))}))}}))).actions((e=>({async exportSvg(t){const{renderToSvg:n}=await r.e(9658).then(r.bind(r,69658)),a=await n(e,t),o=new Blob([a],{type:"image/svg+xml"});(0,oe.saveAs)(o,t.filename||"image.svg")}}))).views((e=>{const t=e.headerMenuItems,r=e.menuItems;return{headerMenuItems:()=>[...t(),{label:"Square view",onClick:e.squareView,description:"Makes both views use the same zoom level, adjusting to the average of each",icon:Ht.A},{label:"Show all regions",onClick:e.showAllRegions,description:"Show entire genome assemblies",icon:jt.A},{label:"Draw CIGAR",onClick:e.toggleCIGAR,checked:e.drawCIGAR,type:"checkbox",description:"Draws per-base CIGAR level alignments"},{label:"Use curved lines",type:"checkbox",checked:e.drawCurves,onClick:e.toggleCurves,icon:Wt},{label:"Export SVG",icon:ie.A,onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Gt,{model:e,handleClose:t}]))}}],menuItems:()=>[...r(),{label:"Export SVG",icon:ie.A,onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Gt,{model:e,handleClose:t}]))}}]}}))}function qt(e,t,r){try{e.showTrack(t)}catch(e){if(!/Could not resolve identifier/.exec(`${e}`))throw e;r.push(t)}}var _t=r(58273);const Ut=(0,w.lazy)((()=>r.e(3416).then(r.bind(r,3416))));class Jt extends a.A{name="LinearComparativeViewPlugin";install(e){!function(e){e.addViewType((()=>new te.A({name:"LinearComparativeView",displayName:"Linear comparative view",stateModel:Vt(e),ReactComponent:(0,w.lazy)((()=>r.e(8876).then(r.bind(r,98876))))})))}(e),function(e){e.addViewType((()=>new te.A({name:"LinearSyntenyView",displayName:"Linear synteny view",stateModel:$t(e),ReactComponent:(0,w.lazy)((()=>r.e(3795).then(r.bind(r,13795))))})))}(e),function(e){e.addDisplayType((()=>{const e=Nt();return new Oe.A({name:"LinearComparativeDisplay",configSchema:e,stateModel:Dt(e),trackType:"SyntenyTrack",viewType:"LinearComparativeView",ReactComponent:()=>null})}))}(e),function(e){e.addDisplayType((()=>{const e=(0,i.ConfigurationSchema)("LinearSyntenyDisplay",{trackIds:{type:"stringArray",defaultValue:[]},middle:{type:"boolean",defaultValue:!0}},{baseConfiguration:Nt(),explicitlyTyped:!0});return new Oe.A({name:"LinearSyntenyDisplay",configSchema:e,stateModel:zt(e),trackType:"SyntenyTrack",viewType:"LinearSyntenyView",ReactComponent:(0,w.lazy)((()=>r.e(4753).then(r.bind(r,44753))))})}))}(e),function(e){e.addDisplayType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("LGVSyntenyDisplay",{},{baseConfiguration:(0,n.ww)(e),explicitlyTyped:!0})}(e),r=(a=t,d.types.compose("LGVSyntenyDisplay",(0,n.N5)(a),d.types.model({type:d.types.literal("LGVSyntenyDisplay"),configuration:(0,i.ConfigurationReference)(a)})).views((e=>{const t=e.contextMenuItems;return{contextMenuItems(){const r=e.contextMenuFeature;return[...t(),...r?[{label:"Open synteny view for this position",onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Ot,{model:e,handleClose:t,feature:r}]))}}]:[]]}}})).views((e=>{const{trackMenuItems:t,colorSchemeSubMenuItems:r}=e;return{trackMenuItems:()=>[...t(),{label:"Color scheme",subMenu:[...r()]}]}})).actions((e=>({afterCreate(){e.colorBy?e.setColorScheme({...e.colorBy}):e.setColorScheme({type:"strand"})}}))));var a;return new Oe.A({name:"LGVSyntenyDisplay",configSchema:t,stateModel:r,trackType:"SyntenyTrack",viewType:"LinearGenomeView",ReactComponent:Rt.GQ})}))}(e),function(e){e.addToExtensionPoint("LaunchView-LinearSyntenyView",(async({session:e,views:t,tracks:r=[]})=>{try{const{assemblyManager:n}=e,a=e.addView("LinearSyntenyView",{});await(0,ae.when)((()=>!!a.width)),a.setViews(await Promise.all(t.map((async e=>{const t=await n.waitForAssembly(e.assembly);if(!t)throw new Error(`Assembly ${e.assembly} failed to load`);return{type:"LinearGenomeView",bpPerPx:1,offsetPx:0,hideHeader:!0,displayedRegions:t.regions}})))),await Promise.all(a.views.map((e=>(0,ae.when)((()=>e.initialized)))));const o=[];if(await Promise.all(t.map((async(e,t)=>{const r=a.views[t],{assembly:i,loc:s,tracks:l=[]}=e,c=await n.waitForAssembly(i);if(!c)throw new Error(`Assembly ${e.assembly} failed to load`);await r.navToSearchString({input:s,assembly:c}),l.forEach((e=>{qt(r,e,o)}))}))),r.forEach((e=>{qt(a,e,o)})),o.length)throw new Error(`Could not resolve identifiers: ${o.join(",")}`)}catch(t){throw e.notifyError(`${t}`,t),t}}))}(e),function(e){e.addTrackType((()=>{const t=(e=>(0,i.ConfigurationSchema)("SyntenyTrack",{},{baseConfiguration:(0,s.createBaseTrackConfig)(e)}))(e);return new _t.A({name:"SyntenyTrack",configSchema:t,stateModel:(0,s.createBaseTrackModel)(e,"SyntenyTrack",t)})}))}(e),e.addToExtensionPoint("Core-extendPluggableElement",(e=>("LinearPileupDisplay"!==e.name||(e.stateModel=e.stateModel.extend((e=>{const t=e.contextMenuItems;return{views:{contextMenuItems(){const r=e.contextMenuFeature,n=(0,c.getContainingTrack)(e);return[...t(),...r?[{label:"Linear read vs ref",icon:lt.A,onClick:()=>{(0,c.getSession)(e).queueDialog((e=>[Ut,{track:n,feature:r,handleClose:e}]))}}]:[]]}}}}))),e)))}configure(e){(0,c.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToSubMenu(["Add"],{label:"Linear synteny view",icon:It.A,onClick:e=>{e.addView("LinearSyntenyView",{})}})}}function Xt(e){return d.types.compose("LinearLollipopDisplay",Rt.Lr,d.types.model({type:d.types.literal("LinearLollipopDisplay"),configuration:(0,i.ConfigurationReference)(e)})).views((e=>{const{renderProps:t}=e;return{get blockType(){return"dynamicBlocks"},get renderDelay(){return 500},renderProps:()=>({...t(),rpcDriverName:e.rpcDriverName,config:e.configuration.renderer}),get rendererTypeName(){return e.configuration.renderer.type}}}))}var Yt=r(98111),Kt=r(2265),Qt=r(32595);class Zt{totalHeight=0;constructor({width:e}){if(!e)throw new Error("width required to make a new FloatingLayout");this.width=e}items=[];layout=new Map;layoutDirty=!1;add(e,t,r,n,a){this.items.push({uniqueId:e,anchorLocation:t,width:r,height:n,data:a}),this.layoutDirty=!0}getLayout(e){if(!this.layoutDirty)return this.layout;if(!e)throw new Error("configuration object required");const t=(0,i.readConfObject)(e,"minStickLength"),r=this.items.sort(((e,t)=>e.data.score-t.data.score));let n=0;const a=new Array(r.length);for(let e=0;e<r.length;e+=1){const o=r[e],{anchorLocation:i,width:s,height:l}=o,c=i-s/2,d=c+s;let u=t,p=u+l;for(let t=0;t<e;t+=1){const[,e]=a[t],{x:r,y:n,width:o,height:i}=e,s=r+o,m=n+i;(0,Qt.R6)(r,s,c,d)&&(0,Qt.R6)(n,m,u,p)&&(u=m,p=u+l,t=-1)}a[e]=[o.uniqueId,{...o,x:c,y:u}],p>n&&(n=p)}return this.totalHeight=n,this.layout=new Map(a),this.layoutDirty=!1,this.layout}getTotalHeight(){if(this.layoutDirty)throw new Error("getTotalHeight does not work when the layout is dirty.");return this.totalHeight}serializeRegion(){return this.toJSON()}toJSON(){if(this.layoutDirty)throw new Error("toJSON does not work when the layout is dirty.");return{pairs:[...this.getLayout()],totalHeight:this.getTotalHeight()}}static fromJSON(){throw new Error("not supported")}}class er{constructor({pairs:e,totalHeight:t}){this.layout=new Map(e),this.totalHeight=t}add(e){if(!this.layout.has(e))throw new Error(`layout error, precomputed layout is missing ${e}`)}getLayout(){return this.layout}getTotalHeight(){return this.totalHeight}static fromJSON(e){return new er(e)}}class tr extends Yt.LayoutSession{makeLayout(){const{end:e,start:t}=this.regions[0],r=(e-t)/this.bpPerPx;return new Kt.A(Zt,{width:r})}layoutIsValid(){return!1}}class rr extends Yt.default{createSession(e){return new tr(e)}deserializeLayoutInClient(e){return new er(e)}}const nr=(0,i.ConfigurationSchema)("LollipopRenderer",{strokeColor:{type:"color",description:"the outer color of each lollipop",defaultValue:"green",contextVariable:["feature"]},innerColor:{type:"color",description:"the inner color of each lollipop",defaultValue:"#7fc75f",contextVariable:["feature"]},strokeWidth:{type:"number",description:"width of the stroked border",defaultValue:4,contextVariable:["feature"]},radius:{type:"number",description:"radius in pixels of each lollipop body",defaultValue:"jexl:sqrt(max(3, (get(feature,'score')*10)/3.14))",contextVariable:["feature"]},caption:{type:"string",description:"the tooltip caption displayed when the mouse hovers over a lollipop",defaultValue:"jexl:get(feature,'name')",contextVariable:["feature"]},minStickLength:{type:"number",description:'minimum lollipop "stick" length, in pixels',defaultValue:5},stickColor:{type:"color",description:"color of the lollipop stick",defaultValue:"black",contextVariable:["feature"]},stickWidth:{type:"number",description:"width in pixels of the lollipop stick",defaultValue:2,contextVariable:["feature"]},score:{type:"number",description:'the "score" of each lollipop, displayed as a number in the center of the circle',defaultValue:"jexl:get(feature,'score')",contextVariable:["feature"]}},{explicitlyTyped:!0});class ar extends a.A{name="LollipopPlugin";install(e){!function(e){e.addRendererType((()=>new rr({name:"LollipopRenderer",ReactComponent:(0,w.lazy)((()=>r.e(6861).then(r.bind(r,46861)))),configSchema:nr,pluginManager:e})))}(e),function(e){e.addDisplayType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("LinearLollipopDisplay",{renderer:e.pluggableConfigSchemaType("renderer")},{baseConfiguration:Rt.Ki,explicitlyTyped:!0})}(e);return new Q.DisplayType({name:"LinearLollipopDisplay",configSchema:t,stateModel:Xt(t),trackType:"LollipopTrack",viewType:"LinearGenomeView",ReactComponent:Rt.GQ})}))}(e)}}function or(e){return d.types.compose("LinearArcDisplay",Rt.Lr,d.types.model({type:d.types.literal("LinearArcDisplay"),configuration:(0,i.ConfigurationReference)(e),displayMode:d.types.maybe(d.types.string)})).views((e=>({get blockType(){return"staticBlocks"},get renderDelay(){return 500},get rendererTypeName(){return e.configuration.renderer.type}}))).views((e=>({get displayModeSetting(){return e.displayMode??(0,i.getConf)(e,["renderer","displayMode"])}}))).views((e=>({get rendererConfig(){const t=(0,i.getConf)(e,["renderer"])||{};return e.rendererType.configSchema.create({...t,displayMode:e.displayModeSetting},(0,c.getEnv)(e))}}))).views((e=>{const{renderProps:t}=e;return{renderProps:()=>({...t(),rpcDriverName:e.rpcDriverName,config:e.rendererConfig,height:e.height})}})).actions((e=>({setDisplayMode(t){e.displayMode=t}}))).views((e=>{const t=e.trackMenuItems;return{trackMenuItems:()=>[...t(),{label:"Display mode",subMenu:[{type:"radio",label:"Arcs",onClick:()=>{e.setDisplayMode("arcs")},checked:"arcs"===e.displayMode},{type:"radio",label:"Semi-circles",onClick:()=>{e.setDisplayMode("semicircles")},checked:"semicircles"===e.displayMode}]}]}}))}function ir(e){return d.types.compose("LinearPairedArcDisplay",Q.BaseDisplay,(0,Rt._e)(),(0,Rt.e6)(),d.types.model({type:d.types.literal("LinearPairedArcDisplay"),configuration:(0,i.ConfigurationReference)(e),displayMode:d.types.maybe(d.types.string)})).volatile((()=>({lastDrawnOffsetPx:0,features:void 0,loading:!1,drawn:!0}))).views((e=>({get displayModeSetting(){return e.displayMode??(0,i.getConf)(e,["renderer","displayMode"])}}))).actions((e=>({selectFeature(t){const r=(0,c.getSession)(e);if((0,c.isSessionModelWithWidgets)(r)){const n=r.addWidget("VariantFeatureWidget","variantFeature",{view:(0,c.getContainingView)(e),track:(0,c.getContainingTrack)(e),featureData:t.toJSON()});r.showWidget(n)}(0,c.isSelectionContainer)(r)&&r.setSelection(t)},setLoading(t){e.loading=t},setFeatures(t){e.features=t},setDisplayMode(t){e.displayMode=t}}))).actions((e=>({afterAttach(){(async()=>{try{const{doAfterAttach:t}=await r.e(3497).then(r.bind(r,93497));t(e)}catch(t){console.error(t),e.setError(t)}})()},async renderSvg(t){const{renderArcSvg:n}=await r.e(4345).then(r.bind(r,44345));return n(e,t)}})))}function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sr.apply(null,arguments)}const lr=(0,w.lazy)((()=>r.e(2241).then(r.bind(r,72241))));function cr({selectedFeatureId:e,region:t,bpPerPx:r,config:n,height:a,feature:o,onFeatureClick:s}){const[l,d]=(0,w.useState)(!1),[u,p]=(0,c.bpSpanPx)(o.get("start"),o.get("end"),t,r),m=o.id(),g=e&&String(e)===String(o.id()),h=g?"red":(0,i.readConfObject)(n,"color",{feature:o}),f=g?"red":"black",y=(0,i.readConfObject)(n,"label",{feature:o}),b=(0,i.readConfObject)(n,"caption",{feature:o}),v=(0,i.readConfObject)(n,"thickness",{feature:o})||2,C=Math.min((0,i.readConfObject)(n,"height",{feature:o})||100,a),S=w.createRef(),k=.5*C*.75+.375*C;return w.createElement("g",null,w.createElement("path",sr({ref:S},(0,c.getStrokeProps)(h),{d:`M ${u} 0 C ${u} ${C}, ${p} ${C}, ${p} 0`,strokeWidth:v,fill:"transparent",onClick:e=>{s(e,m)},onMouseOver:()=>{d(!0)},onMouseLeave:()=>{d(!1)},pointerEvents:"stroke"})),l?w.createElement(w.Suspense,{fallback:null},w.createElement(lr,{contents:b})):null,w.createElement("text",{x:u+(p-u)/2,y:k+3,stroke:"white",strokeWidth:"0.6em"},y),w.createElement("text",{x:u+(p-u)/2,y:k+3,stroke:f},y))}function dr(e,t,r,n){const a=(n-90)*Math.PI/180;return{x:e+r*Math.cos(a),y:t+r*Math.sin(a)}}function ur(e,t,r,n,a){const o=dr(e,t,r,a),i=dr(e,t,r,n),s=a-n<=180?"0":"1";return["M",o.x,o.y,"A",r,r,0,s,0,i.x,i.y].join(" ")}function pr({selectedFeatureId:e,region:t,bpPerPx:r,config:n,onFeatureClick:a,feature:o}){const[s,l]=(0,w.useState)(!1),[d,u]=(0,c.bpSpanPx)(o.get("start"),o.get("end"),t,r),p=o.id(),m=e&&String(e)===String(o.id()),g=m?"red":(0,i.readConfObject)(n,"color",{feature:o}),h=m?"red":"black",f=(0,i.readConfObject)(n,"label",{feature:o}),y=(0,i.readConfObject)(n,"caption",{feature:o}),b=(0,i.readConfObject)(n,"thickness",{feature:o})||2,v=w.createRef(),C=(u-d)/2;return w.createElement("g",null,w.createElement("path",sr({d:ur(d+(u-d)/2,0,(u-d)/2,90,270)},(0,c.getStrokeProps)(g),{strokeWidth:b,fill:"transparent",onClick:e=>{a(e,p)},onMouseOver:()=>{l(!0)},onMouseLeave:()=>{l(!1)},ref:v,pointerEvents:"stroke"})),s?w.createElement(lr,{contents:y}):null,w.createElement("text",{x:d+(u-d)/2,y:C+3,stroke:"white",strokeWidth:"0.6em"},f),w.createElement("text",{x:d+(u-d)/2,y:C+3,stroke:h},f))}function mr({exportSVG:e,width:t,height:r,children:n}){return e?n:w.createElement("svg",{width:t,height:r},n)}const gr=(0,We.observer)((function({features:e,config:t,regions:r,bpPerPx:n,height:a,exportSVG:o,displayModel:s,onFeatureClick:l}){const c=r[0],d=(c.end-c.start)/n,u="semicircles"===(0,i.readConfObject)(t,"displayMode"),{selectedFeatureId:p}=s||{};return w.createElement(mr,{exportSVG:o,width:d,height:a},[...e.values()].map((e=>u?w.createElement(pr,{key:e.id(),config:t,region:c,bpPerPx:n,selectedFeatureId:p,onFeatureClick:l,feature:e}):w.createElement(cr,{key:e.id(),height:a,config:t,region:c,bpPerPx:n,selectedFeatureId:p,onFeatureClick:l,feature:e}))))})),hr=(0,i.ConfigurationSchema)("ArcRenderer",{color:{type:"color",description:"the color of the arcs",defaultValue:"darkblue",contextVariable:["feature"]},thickness:{type:"number",description:"the thickness of the arcs",defaultValue:"jexl:logThickness(feature,'score')",contextVariable:["feature"]},label:{type:"string",description:"the label to appear at the apex of the arcs",defaultValue:"jexl:get(feature,'score')",contextVariable:["feature"]},height:{type:"number",description:"the height of the arcs",defaultValue:"jexl:log10(get(feature,'end')-get(feature,'start'))*50",contextVariable:["feature"]},caption:{type:"string",description:"the caption to appear when hovering over any point on the arcs",defaultValue:"jexl:get(feature,'name')",contextVariable:["feature"]},displayMode:{type:"enum",defaultValue:"arcs",model:d.types.enumeration("DisplayMode",["arcs","semicircles"]),description:"render semi-circles instead of arcs"}},{explicitlyTyped:!0});var fr=r(92880);class yr extends fr.default{}var br=r(40898);class wr extends a.A{name="ArcRenderer";install(e){!function(e){e.addRendererType((()=>new yr({name:"ArcRenderer",ReactComponent:gr,configSchema:hr,pluginManager:e})))}(e),function(e){e.addDisplayType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("LinearArcDisplay",{renderer:d.types.optional(e.pluggableConfigSchemaType("renderer"),{type:"ArcRenderer"})},{baseConfiguration:Rt.Ki,explicitlyTyped:!0})}(e);return new Q.DisplayType({name:"LinearArcDisplay",displayName:"Arc display",configSchema:t,stateModel:or(t),trackType:"FeatureTrack",viewType:"LinearGenomeView",ReactComponent:Rt.GQ})}))}(e),function(e){e.addDisplayType((()=>{const e=(0,i.ConfigurationSchema)("LinearPairedArcDisplay",{color:{type:"color",description:"the color of the arcs",defaultValue:"jexl:defaultPairedArcColor(feature,alt)",contextVariable:["feature","alt"]}},{baseConfiguration:Rt.Ki,explicitlyTyped:!0});return new Q.DisplayType({name:"LinearPairedArcDisplay",displayName:"Arc display",configSchema:e,stateModel:ir(e),trackType:"VariantTrack",viewType:"LinearGenomeView",ReactComponent:(0,w.lazy)((()=>r.e(7126).then(r.bind(r,87126))))})}))}(e),e.jexl.addFunction("logThickness",((e,t)=>Math.log(e.get(t)+1))),e.jexl.addFunction("defaultPairedArcColor",((e,t)=>t?.startsWith("<DEL")?br.set1[0]:t?.startsWith("<DUP")?br.set1[1]:t?.startsWith("<INV")?br.set1[2]:t?.startsWith("<TRA")?br.set1[3]:t?.startsWith("<CNV")?br.set1[4]:br.set1[6]))}}var vr=r(67736),Cr=r(25914),Sr=r(36993);const kr=(0,i.ConfigurationSchema)("AboutWidget",{}),Tr=d.types.model("AboutWidget",{id:K.ElementId,type:d.types.literal("AboutWidget")}),xr=(0,i.ConfigurationSchema)("HelpWidget",{}),Ar=d.types.model("HelpWidget",{id:K.ElementId,type:d.types.literal("HelpWidget")}),Pr=(0,i.ConfigurationSchema)("ImportSessionWidget",{}),Mr=d.types.model("ImportSessionWidget",{id:K.ElementId,type:d.types.literal("ImportSessionWidget")}),Er=(0,i.ConfigurationSchema)("SessionManager",{}),Rr=d.types.model("SessionManager",{id:K.ElementId,type:d.types.literal("SessionManager")});class Ir extends a.A{name="MenusPlugin";install(e){e.addWidgetType((()=>new vr.A({name:"AboutWidget",heading:"About",configSchema:kr,stateModel:Tr,ReactComponent:(0,w.lazy)((()=>r.e(9032).then(r.bind(r,99032))))}))),e.addWidgetType((()=>new vr.A({name:"HelpWidget",heading:"Help",configSchema:xr,stateModel:Ar,ReactComponent:(0,w.lazy)((()=>r.e(4974).then(r.bind(r,74974))))}))),e.addWidgetType((()=>new vr.A({name:"ImportSessionWidget",heading:"Import session",configSchema:Pr,stateModel:Mr,ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(3778),r.e(7389)]).then(r.bind(r,67389))))}))),e.addWidgetType((()=>new vr.A({name:"SessionManager",heading:"Sessions",configSchema:Er,stateModel:Rr,ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(3162),r.e(8762)]).then(r.bind(r,58762))))})))}configure(e){(0,c.isAbstractMenuManager)(e.rootModel)&&(e.rootModel.appendToMenu("Help",{label:"About",icon:Sr.A,onClick:e=>{const t=e.addWidget("AboutWidget","aboutWidget");e.showWidget(t)}}),e.rootModel.appendToMenu("Help",{label:"Help",icon:Cr.A,onClick:e=>{const t=e.addWidget("HelpWidget","helpWidget");e.showWidget(t)}}))}}var Nr=r(46377),Fr=r(66885),Lr=r(6434),Dr=r(2401),Br=r.n(Dr);class Vr extends Nr.BaseFeatureDataAdapter{constructor(e,t,r){super(e,t,r),this.endpoint=(0,i.readConfObject)(e,"endpoint").uri,this.queryTemplate=(0,i.readConfObject)(e,"queryTemplate"),this.additionalQueryParams=(0,i.readConfObject)(e,"additionalQueryParams"),this.refNamesQueryTemplate=(0,i.readConfObject)(e,"refNamesQueryTemplate"),this.configRefNames=(0,i.readConfObject)(e,"refNames")}async getRefNames(e={}){if(this.refNames)return this.refNames;if(this.refNamesQueryTemplate){const t=encodeURIComponent(this.refNamesQueryTemplate),r=await this.querySparql(t,e);this.refNames=this.resultsToRefNames(r)}else this.refNames=this.configRefNames;return this.refNames}getFeatures(e,t={}){return(0,Fr.ObservableCreate)((async r=>{const n=encodeURIComponent(Br()(this.queryTemplate,e)),{refName:a}=e,o=await this.querySparql(n,t);this.resultsToFeatures(o,a).forEach((e=>{r.next(e)})),r.complete()}),t.signal)}async querySparql(e,t){let r="";this.additionalQueryParams.length&&(r=`&${this.additionalQueryParams.join("&")}`);const n=t?.signal;return(await fetch(`${this.endpoint}?query=${e}${r}`,{headers:{accept:"application/json,application/sparql-results+json"},signal:n})).json()}resultsToRefNames(e){const t=e.results.bindings||[];if(!e.head.vars.includes("refName"))throw new Error('"refName" not found in refNamesQueryTemplate response');return t.map((e=>e.refName.value))}resultsToFeatures(e,t){const r=e.results.bindings||[],n=e.head.vars;["start","end","uniqueId"].forEach((e=>{n.includes(e)||console.error(`Required field ${e} missing from feature data`)}));const a={};r.forEach((e=>{const r=[{}];n.forEach((t=>{if(t in e){const{value:n}=e[t];let a=0;for(;t.startsWith("sub_");)t=t.slice(4),a+=1;for(;a>r.length-1;)r.push({});r[a][t]=n}})),r.forEach(((e,n)=>{const{uniqueId:o,start:i,end:s,strand:l}=e;n<r.length-1&&(r[n+1].parentUniqueId=o),a[o]={data:{...e,uniqueId:o,refName:t,start:Number.parseInt(i,10),end:Number.parseInt(s,10),strand:Number.parseInt(l,10)||0}}}))}));for(const[e,t]of Object.entries(a)){const r=t.data.parentUniqueId;if(t.data.parentUniqueId=void 0,r){const n=a[r];if(n)n.data.subfeatures||(n.data.subfeatures=[]),n.data.subfeatures.push({...t.data,uniqueId:e}),delete a[e];else{const n=Object.values(a).map((e=>e.data.subfeatures)).filter((e=>!!e)).flat();let o=!1;for(const i of n){if(i.uniqueId===r){i.subfeatures||(i.subfeatures=[]),i.subfeatures.push({...t.data,uniqueId:e}),delete a[e],o=!0;break}i.subfeatures&&n.push(...i.subfeatures)}o||console.error(`Could not find parentID ${r}`)}}}return Object.keys(a).map((e=>new Lr.A({...a[e].data,uniqueId:e,subfeatures:a[e].data.subfeatures})))}async hasDataForRefName(e,t={}){const r=await this.getRefNames(t);return!(r.length&&!r.includes(e))}freeResources(){}}const zr=(0,i.ConfigurationSchema)("SPARQLAdapter",{endpoint:{type:"fileLocation",defaultValue:{uri:"https://somesite.com/sparql",locationType:"UriLocation"},description:"URL of the SPARQL endpoint"},queryTemplate:{type:"text",defaultValue:"",description:"SPARQL query where {start} {end} and {refName} will get replaced for each call"},refNamesQueryTemplate:{type:"text",defaultValue:"",description:"SPARQL query that returns the possible refNames in a ?refName column"},refNames:{type:"stringArray",defaultValue:[],description:'Possible refNames used by the SPARQL endpoint (ignored if "refNamesQueryTemplate" is provided)'},additionalQueryParams:{type:"stringArray",defaultValue:[],description:'Additional parameters to add to the query, e.g. "format=JSON"'}},{explicitlyTyped:!0});class Or extends a.A{name="RdfPlugin";install(e){e.addAdapterType((()=>new $.A({name:"SPARQLAdapter",displayName:"SPARQL adapter",configSchema:zr,AdapterClass:Vr}))),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="SPARQLAdapter",o=(0,X.getFileName)(t);return/\/sparql$/i.test(o)||n===a?{type:a,endpoint:t}:e(t,r,n)}))}}const Hr=(0,i.ConfigurationSchema)("TwoBitAdapter",{twoBitLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.2bit",locationType:"UriLocation"}},chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/default.chrom.sizes",locationType:"UriLocation"},description:"An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time"}},{explicitlyTyped:!0});function jr(){return jr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jr.apply(null,arguments)}function Wr({codonTable:e,seq:t,frame:r,bpPerPx:n,colorByCDS:a,region:o,seqStart:i,height:s,y:l,reverse:d=!1,theme:u}){const p=(Math.abs(r)-1-i%3+3)%3,m=t.length-p,g=m-m%3,h=t.slice(p,p+g),f=[];for(let t=0;t<h.length;t+=3){const r=h.slice(t,t+3),n=d?(0,c.revcom)(r):r,a=e[n]||"";f.push({letter:a,codon:n.toUpperCase()})}const y=(o.end-o.start)/n,b=1/n*3,v=1/n>=12,C=p/n-(o.start-i)/n,S=a?u?.palette.framesCDS.at(r)?.main:u?.palette.frames.at(r)?.main;return w.createElement(w.Fragment,null,w.createElement("rect",{x:0,y:l,width:y,height:s,fill:S}),f.map(((e,t)=>{const r=o.reversed?y-(t+1)*b-C:b*t+C,{letter:n,codon:a}=e,i=c.defaultStarts.includes(a)?u?.palette.startCodon:c.defaultStops.includes(a)?u?.palette.stopCodon:void 0;return v||i?w.createElement(w.Fragment,{key:`${t}-${n}`},w.createElement("rect",{x:r,y:l,width:v?b:b+.7,height:s,stroke:v?"#555":"none",fill:i||"none"}),v?w.createElement("text",{x:r+b/2,fontSize:s-2,y:l+s/2,dominantBaseline:"middle",textAnchor:"middle"},n):null):null})))}function Gr({bpPerPx:e,region:t,feature:r,sequenceType:n,theme:a,height:o,seq:i,y:s}){const l=1/e>=12,d=r.get("start"),u=r.get("end"),[p,m]=(0,c.bpSpanPx)(d,u,t,e),g=t.reversed,h=u-d,f=Math.max((m-p)/h,.8);return w.createElement(w.Fragment,null,i.split("").map(((e,t)=>{const r="dna"===n?a.palette.bases[e.toUpperCase()]:void 0,i=g?m-(t+1)*f:p+t*f;return w.createElement(w.Fragment,{key:`${e}-${t}`},w.createElement("rect",{x:i,y:s,width:f,height:o,fill:r?r.main:"#aaa",stroke:l?"#555":"none"}),l?w.createElement("text",{x:i+f/2,y:s+o/2,dominantBaseline:"middle",textAnchor:"middle",fontSize:o-2,fill:r?a.palette.getContrastText(r.main):"black"},e):null)})))}function $r({regions:e,theme:t,colorByCDS:r,features:n=new Map,showReverse:a=!0,showForward:o=!0,showTranslation:i=!0,sequenceType:s="dna",bpPerPx:l,rowHeight:d}){const u=e[0],p=(0,T.createJBrowseTheme)(t),m=(0,c.generateCodonTable)(c.defaultCodonTable),[g]=[...n.values()];if(!g)return null;const h=g.get("seq");if(!h)return null;let f=-d;const y=l<=1,b=i&&o?[3,2,1]:[],v=i&&a?[-1,-2,-3]:[],[C,S]=u.reversed?[v.toReversed(),b.toReversed()]:[b,v];return w.createElement(w.Fragment,null,C.map((e=>w.createElement(Wr,{key:`translation-${e}`,colorByCDS:r,seq:h,y:f+=d,codonTable:m,frame:e,bpPerPx:l,region:u,seqStart:g.get("start"),theme:p,height:d,reverse:u.reversed}))),o&&y?w.createElement(Gr,{height:d,sequenceType:s,y:f+=d,feature:g,region:u,seq:u.reversed?(0,c.complement)(h):h,bpPerPx:l,theme:p}):null,a&&y?w.createElement(Gr,{height:d,sequenceType:s,y:f+=d,feature:g,region:u,seq:u.reversed?h:(0,c.complement)(h),bpPerPx:l,theme:p}):null,S.map((e=>w.createElement(Wr,{key:`rev-translation-${e}`,colorByCDS:r,seq:h,y:f+=d,codonTable:m,frame:e,bpPerPx:l,region:u,seqStart:g.get("start"),theme:p,height:d,reverse:!u.reversed}))))}function qr({exportSVG:e,width:t,totalHeight:r,children:n}){return e?n:w.createElement("svg",{"data-testid":"sequence_track",width:t,height:r,style:{display:"block",width:t,height:r,userSelect:"none"}},n)}const _r=(0,We.observer)((function(e){const{regions:t,bpPerPx:r,sequenceHeight:n}=e,a=t[0],o=(a.end-a.start)/r;return w.createElement(qr,jr({},e,{totalHeight:n,width:o}),w.createElement($r,e))})),Ur=(0,i.ConfigurationSchema)("DivSequenceRenderer",{height:{type:"number",description:"height in pixels of each line of sequence",defaultValue:16}},{explicitlyTyped:!0});class Jr extends fr.default{supportsSVG=!0;getExpandedRegion(e){return{...e,start:Math.max(e.start-3,0),end:e.end+3}}}const Xr=(0,i.ConfigurationSchema)("BgzipFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.fai",locationType:"UriLocation"}},metadataLocation:{description:"Optional metadata file",type:"fileLocation",defaultValue:{uri:"/path/to/fa.metadata.yaml",locationType:"UriLocation"}},gziLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.gz.gzi",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Yr=(0,i.ConfigurationSchema)("ChromSizesAdapter",{chromSizesLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/species.chrom.sizes",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Kr=(0,i.ConfigurationSchema)("IndexedFastaAdapter",{fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa",locationType:"UriLocation"}},faiLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa.fai",locationType:"UriLocation"}},metadataLocation:{description:"Optional metadata file",type:"fileLocation",defaultValue:{uri:"/path/to/fa.metadata.yaml",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Qr=(0,i.ConfigurationSchema)("UnindexedFastaAdapter",{rewriteRefNames:{type:"string",defaultValue:"",contextVariable:["refName"]},fastaLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/seq.fa",locationType:"UriLocation"}},metadataLocation:{description:"Optional metadata file",type:"fileLocation",defaultValue:{uri:"/path/to/fa.metadata.yaml",locationType:"UriLocation"}}},{explicitlyTyped:!0}),Zr=(0,i.ConfigurationSchema)("SequenceSearchAdapter",{search:{type:"string",defaultValue:"",description:"Search string or regex to search for"},sequenceAdapter:{type:"frozen",defaultValue:null},searchForward:{type:"boolean",defaultValue:!0},searchReverse:{type:"boolean",defaultValue:!0},caseInsensitive:{type:"boolean",defaultValue:!0}},{explicitlyTyped:!0});const en=(0,i.ConfigurationSchema)("LinearReferenceSequenceDisplay",{renderer:Ur},{explicitIdentifier:"displayId",explicitlyTyped:!0});class tn extends a.A{name="SequencePlugin";install(e){!function(e){e.addRendererType((()=>new Jr({name:"DivSequenceRenderer",ReactComponent:_r,configSchema:Ur,pluginManager:e})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"TwoBitAdapter",displayName:"TwoBit adapter",configSchema:Hr,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>r.e(9280).then(r.bind(r,79280)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"BgzipFastaAdapter",displayName:"Bgzip-indexed FASTA adapter",configSchema:Xr,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(2977),r.e(9206)]).then(r.bind(r,79206)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"ChromSizesAdapter",displayName:"Chrom sizes adapter",configSchema:Yr,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>r.e(7842).then(r.bind(r,57842)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"IndexedFastaAdapter",displayName:"Indexed FASTA adapter",configSchema:Kr,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>Promise.all([r.e(7864),r.e(9086),r.e(2977),r.e(7489)]).then(r.bind(r,69870)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"UnindexedFastaAdapter",displayName:"Unindexed FASTA adapter",configSchema:Qr,adapterMetadata:{hiddenFromGUI:!0},getAdapterClass:()=>r.e(3578).then(r.bind(r,93578)).then((e=>e.default))})))}(e),function(e){e.addAdapterType((()=>new $.A({name:"SequenceSearchAdapter",displayName:"Sequence search adapter",adapterMetadata:{hiddenFromGUI:!0},configSchema:Zr,getAdapterClass:()=>r.e(946).then(r.bind(r,90946)).then((e=>e.default))})))}(e),function(e){e.addTrackType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("ReferenceSequenceTrack",{adapter:e.pluggableConfigSchemaType("adapter"),displays:d.types.array(e.pluggableConfigSchemaType("display")),name:{type:"string",description:'optional track name, otherwise uses the "Reference sequence (assemblyName)"',defaultValue:""},sequenceType:{type:"string",description:"either dna or pep",defaultValue:"dna"},description:{description:"a description of the track",type:"string",defaultValue:""},metadata:{type:"frozen",description:"anything to add about this track",defaultValue:{}},formatAbout:(0,i.ConfigurationSchema)("FormatAbout",{config:{type:"frozen",description:"formats configuration in about dialog",defaultValue:{},contextVariable:["config"]},hideUris:{type:"boolean",defaultValue:!1}})},{preProcessSnapshot:t=>{const r=JSON.parse(JSON.stringify(t)),n=new Set,{displays:a=[]}=r;if("placeholderId"!==r.trackId){a.forEach((e=>e&&n.add(e.type)));const t=e.getTrackType(r.type);t?.displayTypes.forEach((e=>{n.has(e.name)||a.push({displayId:`${r.trackId}-${e.name}`,type:e.name})}))}return{...r,displays:a}},explicitIdentifier:"trackId",explicitlyTyped:!0,actions:e=>({addDisplayConf(t){const{type:r}=t;if(!r)throw new Error(`unknown display type ${r}`);const n=e.displays.find((e=>e&&e.displayId===t.displayId));if(n)return n;const a=e.displays.push(t);return e.displays[a-1]}})})}(e);return new _t.A({name:"ReferenceSequenceTrack",displayName:"Reference sequence track",configSchema:t,stateModel:(0,s.createBaseTrackModel)(e,"ReferenceSequenceTrack",t)})}))}(e),function(e){e.addDisplayType((()=>{const e=function(e){return d.types.compose("LinearReferenceSequenceDisplay",Rt.Lr,d.types.model({type:d.types.literal("LinearReferenceSequenceDisplay"),configuration:(0,i.ConfigurationReference)(e),showForward:!0,showReverse:!0,showTranslation:!0})).volatile((()=>({rowHeight:15}))).views((e=>({get sequenceType(){return(0,i.getConf)((0,c.getContainingTrack)(e),"sequenceType")},get showForwardActual(){return e.showForward},get showReverseActual(){return"dna"===this.sequenceType&&e.showReverse},get showTranslationActual(){return"dna"===this.sequenceType&&e.showTranslation}}))).views((e=>({get sequenceHeight(){const{rowHeight:t,showTranslationActual:r,showReverseActual:n,showForwardActual:a}=e;return(n&&r?3*t:0)+(a&&r?3*t:0)+(n?t:0)+(a?t:0)}}))).views((e=>{const{renderProps:t}=e;return{renderProps(){const{rpcDriverName:r,showForwardActual:n,showReverseActual:a,showTranslationActual:o,rowHeight:i,sequenceHeight:s,sequenceType:l}=e;return{...t(),...(0,X.getParentRenderProps)(e),config:e.configuration.renderer,rpcDriverName:r,showForward:n,showReverse:a,showTranslation:o,sequenceType:l,rowHeight:i,sequenceHeight:s}}}})).views((e=>({regionCannotBeRendered:()=>(0,c.getContainingView)(e).bpPerPx>3?"Zoom in to see sequence":void 0,get rendererTypeName(){return e.configuration.renderer.type}}))).actions((e=>({toggleShowForward(){e.showForward=!e.showForward},toggleShowReverse(){e.showReverse=!e.showReverse},toggleShowTranslation(){e.showTranslation=!e.showTranslation},afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((()=>{(0,c.getContainingView)(e).bpPerPx>3?e.setHeight(50):e.setHeight(e.sequenceHeight)})))}}))).views((e=>({trackMenuItems:()=>[..."dna"===e.sequenceType?[{label:"Show forward",type:"checkbox",checked:e.showForward,onClick:()=>{e.toggleShowForward()}},{label:"Show reverse",type:"checkbox",checked:e.showReverse,onClick:()=>{e.toggleShowReverse()}},{label:"Show translation",type:"checkbox",checked:e.showTranslation,onClick:()=>{e.toggleShowTranslation()}}]:[]]})))}(en);return new Q.DisplayType({name:"LinearReferenceSequenceDisplay",configSchema:en,stateModel:e,displayName:"Reference sequence display",trackType:"ReferenceSequenceTrack",viewType:"LinearGenomeView",ReactComponent:Rt.GQ})}))}(e),function(e){e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="TwoBitAdapter",o=(0,X.getFileName)(t),i={type:a,twoBitLocation:t};return/\.2bit$/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"TwoBitAdapter"===t?"ReferenceSequenceTrack":e(t))),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="IndexedFastaAdapter",o=(0,X.getFileName)(t),i={type:a,fastaLocation:t,faiLocation:r||(0,X.makeIndex)(t,".fai")};return/\.(fa|fasta|fas|fna|mfa)$/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"IndexedFastaAdapter"===t?"ReferenceSequenceTrack":e(t))),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="BgzipFastaAdapter",o=(0,X.getFileName)(t),i={type:a,faiLocation:(0,X.makeIndex)(t,".fai"),gziLocation:(0,X.makeIndex)(t,".gzi")};return/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"BgzipFastaAdapter"===t?"ReferenceSequenceTrack":e(t)))}(e)}}var rn=r(88217),nn=r(48231);const an=(0,We.observer)((function({text:e,x:t,y:r,region:n,reversed:a,bpPerPx:o,exportSVG:i,feature:s,viewParams:l,color:u="black",fontHeight:p=11,featureWidth:m=0,allowedWidthExpansion:g=0,displayModel:h={}}){const f=m+g,y=(0,c.measureText)(e,p),b=(0,d.isStateTreeNode)(h)&&(0,d.isAlive)(h)&&!i?(0,c.getViewParams)(h):l,v=a?b.end:b.start,[C,S]=(0,w.useState)(i),k=(0,nn.A)();if((0,w.useEffect)((()=>{S(!0)}),[]),(0,d.isStateTreeNode)(n)&&!(0,d.isAlive)(n))return null;const T=n.start,x=n.end,A=s.get("start"),P=s.get("end"),M=y*o;return v<x&&v>T&&A<v&&v+M<P?t=b.offsetPx:A<v&&v+M<P&&v+M>T&&v+M<x&&(t=b.offsetPx1),C?w.createElement("text",{x:t,y:r+p,fill:"#f0f"===u?(0,c.stripAlpha)(k.palette.text.primary):u,fontSize:p},y>f?`${e.slice(0,f/(.6*p))}...`:e):null}));function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},on.apply(null,arguments)}const sn=(0,We.observer)((function(e){const{feature:t,rootLayout:r,config:n,name:a,description:o,shouldShowName:s,shouldShowDescription:l}=e,c=r.getSubRecord(String(t.id()));if(!c)return null;const{GlyphComponent:d}=c.data||{};return w.createElement("g",null,w.createElement(d,on({featureLayout:c},e)),s?w.createElement(an,on({text:a,x:r.getSubRecord("nameLabel")?.absolute.left||0,y:r.getSubRecord("nameLabel")?.absolute.top||0,color:(0,i.readConfObject)(n,["labels","nameColor"],{feature:t}),featureWidth:c.width},e)):null,l?w.createElement(an,on({text:o,x:r.getSubRecord("descriptionLabel")?.absolute.left||0,y:r.getSubRecord("descriptionLabel")?.absolute.top||0,color:(0,i.readConfObject)(n,["labels","descriptionColor"],{feature:t}),featureWidth:c.width},e)):null)}));function ln(){return ln=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ln.apply(null,arguments)}function cn({rect:e,region:t,bpPerPx:r,...n}){if(!e)return null;const[a,o,i,s]=e,[l,d]=(0,c.bpSpanPx)(a,i,t,r),u=Math.round(o),p=(t.end-t.start)/r,m=Math.round(s-o),g=d-l;if(l+g<0)return null;const h=Math.max(l,0),f=h-l,y=Math.max(1,Math.min(g-f,p));return w.createElement("rect",ln({x:h-2,y:u-2,width:y+4,height:m+4},n))}const dn=(0,We.observer)((function({displayModel:e={},blockKey:t,region:r,bpPerPx:n,movedDuringLastMouseDown:a,...o}){const{selectedFeatureId:i,featureIdUnderMouse:s,contextMenuFeature:l}=e,c=s||l?.id(),[d,u]=(0,w.useState)(!1);function p(e){const{onFeatureMouseOut:t}=o;t&&c&&t(e,c)}function m(e){const{onFeatureMouseOver:t}=o;t&&c&&t(e,c)}return(0,w.useEffect)((()=>{u(!0)}),[]),d?w.createElement(w.Fragment,null,c?w.createElement(cn,{rect:e.getFeatureByID?.(t,c),region:r,bpPerPx:n,fill:"#000",fillOpacity:"0.2",onMouseDown:function(e){const{onFeatureMouseDown:t}=o;t&&c&&t(e,c)},onMouseEnter:function(e){const{onFeatureMouseEnter:t}=o;t&&c&&t(e,c)},onMouseOut:p,onMouseOver:m,onMouseUp:function(e){const{onFeatureMouseUp:t}=o;t&&c&&t(e,c)},onMouseLeave:function(e){const{onFeatureMouseLeave:t}=o;t&&c&&t(e,c)},onMouseMove:function(e){const{onFeatureMouseMove:t}=o;t&&c&&t(e,c)},onClick:function(e){if(a)return;const{onFeatureClick:t}=o;t&&c&&(e.stopPropagation(),t(e,c))},onContextMenu:function(e){const{onFeatureContextMenu:t}=o;t&&c&&t(e,c)},onFocus:m,onBlur:p,"data-testid":c}):null,i?w.createElement(cn,{rect:e.getFeatureByID?.(t,i),region:r,bpPerPx:n,stroke:"#00b8ff",fill:"none"}):null):null})),un=(0,We.observer)((function({feature:e,featureLayout:t,config:r,region:n}){const a=e.get("strand"),o=n.reversed?-1:1,s=7*a*o,{left:l=0,top:d=0,width:u=0,height:p=0}=t.absolute,m=(0,i.readConfObject)(r,"color2",{feature:e}),g=(0,nn.A)(),h="#f0f"===m?(0,c.stripAlpha)(g.palette.text.secondary):m,f=a*o==-1?l:a*o==1?l+u:null,y=d+p/2;return f?w.createElement(w.Fragment,null,w.createElement("line",{x1:f,x2:f+s,y1:y,y2:y,stroke:h}),w.createElement("polygon",{points:[[f+s/2,y-2.5],[f+s/2,y+2.5],[f+s,y]].toString(),stroke:h,fill:h})):null})),pn=(0,We.observer)((function(e){const t=(0,nn.A)(),{colorByCDS:r,feature:n,region:a,config:o,featureLayout:s,bpPerPx:l,topLevel:d}=e,{start:u,end:p}=a,m=(p-u)/l,g=n.get("start"),h=n.get("end"),f=n.get("type"),y=n.get("strand"),b=n.get("phase"),v=(h-g)/l,{left:C=0}=s.absolute;let{top:S=0,height:k=0}=s.absolute;if(C+v<0)return null;Pn(n)&&(S+=.175*k,k*=.65);const T=Math.max(C,0),x=T-C,A=Math.max(2,Math.min(v-x,m));let P=Pn(n)?(0,i.readConfObject)(o,"color3",{feature:n}):(0,i.readConfObject)(o,"color1",{feature:n});if(r&&"CDS"===f&&void 0!==y&&void 0!==b){const e=(0,c.getFrame)(g,h,y,b),r=t.palette.framesCDS.at(e)?.main;r&&(P=r)}return n.parent()&&"intron"===f?null:w.createElement(w.Fragment,null,d?w.createElement(un,e):null,w.createElement("rect",{"data-testid":`box-${n.id()}`,x:T,y:S,width:A,height:k,fill:P,stroke:(0,i.readConfObject)(o,"outline",{feature:n})}))}));function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mn.apply(null,arguments)}const gn=(0,We.observer)((function(e){const{feature:t,featureLayout:r,selected:n,config:a,subfeatures:o=t.get("subfeatures")}=e,s=(0,nn.A)(),l=(0,i.readConfObject)(a,"color2",{feature:t}),d="#f0f"===l?(0,c.stripAlpha)(s.palette.text.secondary):l,{left:u=0,top:p=0,width:m=0,height:g=0}=r.absolute,h=p+g/2;return w.createElement(w.Fragment,null,w.createElement("line",{"data-testid":t.id(),x1:u,y1:h,y2:h,x2:u+m,stroke:d}),o?.map((t=>{const a=String(t.id()),o=r.getSubRecord(a);if(!o)return null;const{GlyphComponent:i}=o.data||{};return w.createElement(i,mn({key:`glyph-${a}`},e,{feature:t,topLevel:!1,featureLayout:o,selected:n}))})),w.createElement(un,e))}));function hn(){return hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},hn.apply(null,arguments)}function fn(e){return/(\bUTR|_UTR|untranslated[_\s]region)\b/.test(e.get("type")||"")}function yn(e,t){let r=e.get("subfeatures");if(!r||0===r.length)return[];const n=r.some((e=>fn(e))),a=["mRNA","transcript"].includes(e.get("type"));return(!n&&a||(0,i.readConfObject)(t,"impliedUTRs"))&&(r=function(e,t){const r=[...t];let n,a,o=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=[];for(const t of r){const r=t.get("type");/^cds/i.test(r)?(o>t.get("start")&&(o=t.get("start")),i<t.get("end")&&(i=t.get("end"))):/exon/i.test(r)?s.push(t):fn(t)&&(n=t.get("start")===e.get("start"),a=t.get("end")===e.get("end"))}if(!(s.length&&o<Number.POSITIVE_INFINITY&&i>Number.NEGATIVE_INFINITY))return r;s.sort(((e,t)=>e.get("start")-t.get("start")));const l=e.get("strand");let d,u;if(!n)for(let t=0;t<s.length&&(d=s[t].get("start"),!(d>=o));t++){u=o>s[t].get("end")?s[t].get("end"):o;const n=l>=0?"five_prime_UTR":"three_prime_UTR";r.unshift(new c.SimpleFeature({parent:e,id:`${e.id()}_${n}_${t}`,data:{start:d,end:u,strand:l,type:n}}))}if(!a)for(let t=s.length-1;t>=0&&(u=s[t].get("end"),!(u<=i));t--){d=i<s[t].get("start")?s[t].get("start"):i;const n=l>=0?"three_prime_UTR":"five_prime_UTR";r.push(new c.SimpleFeature({parent:e,id:`${e.id()}_${n}_${t}`,data:{start:d,end:u,strand:l,type:n}}))}return r}(e,r)),r.filter((e=>function(e,t){return function(e,t){const r=(0,i.readConfObject)(t,"subParts"),n="string"==typeof r?r.split(/\s*,\s*/):r;return e=>n.map((e=>e.toLowerCase())).includes(e.get("type").toLowerCase())}(0,t)(e)}(e,t)))}const bn=(0,We.observer)((function(e){const{feature:t,config:r}=e,n=yn(t,r);return w.createElement(gn,hn({},e,{subfeatures:n}))}));bn.layOut=({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o})=>{const i=xn({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o});return An({layout:i,subfeatures:yn(t,a),bpPerPx:r,reversed:n,config:a,extraGlyphs:o}),i};const wn=bn;function vn(){return vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vn.apply(null,arguments)}const Cn=(0,We.observer)((function(e){const{feature:t,featureLayout:r,selected:n}=e;return t.get("subfeatures")?.map((t=>{const a=String(t.id()),o=r.getSubRecord(a);if(!o)return null;const{GlyphComponent:i}=o.data||{};return w.createElement(i,vn({key:`glyph-${a}`},e,{feature:t,featureLayout:o,selected:n}))}))}));Cn.layOut=({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o})=>{const s=xn({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o}),l=(0,i.readConfObject)(a,"displayMode");if("reducedRepresentation"!==l){let e=0;t.get("subfeatures")?.forEach((t=>{const c=kn(t,o),d=(0,i.readConfObject)(a,"height",{feature:t});(c.layOut||Tn)({layout:s,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o}).move(0,e),e+="collapse"===l?0:("compact"===l?d/3:d)+2}))}return s};const Sn=Cn;function kn(e,t){const r=e.get("type"),n=e.get("subfeatures");if(n?.length&&"CDS"!==r){const t=n.find((e=>!!e.get("subfeatures")));return["mRNA","transcript","primary_transcript"].includes(r)&&n.some((e=>"CDS"===e.get("type")))?wn:!e.parent()&&t?Sn:gn}return t?.find((t=>t.validator(e)))?.glyph||pn}function Tn({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o}){const s=(0,i.readConfObject)(a,"displayMode"),l=xn({layout:e,feature:t,bpPerPx:r,reversed:n,config:a,extraGlyphs:o});return"reducedRepresentation"!==s&&An({layout:l,subfeatures:t.get("subfeatures")||[],bpPerPx:r,reversed:n,config:a,extraGlyphs:o}),l}function xn(e){const{layout:t,feature:r,bpPerPx:n,reversed:a,config:o,extraGlyphs:s}=e,l=(0,i.readConfObject)(o,"displayMode"),c="reducedRepresentation"===l?pn:kn(r,s),d=r.parent();let u=0;d&&(u=(a?d.get("end")-r.get("end"):r.get("start")-d.get("start"))/n);const p=(0,i.readConfObject)(o,"height",{feature:r}),m=(r.get("end")-r.get("start"))/n,g=t.parent,h=g?g.top:0;return t.addChild(String(r.id()),u,"collapse"===l?0:h,Math.max(m,1),"compact"===l?p/2:p,{GlyphComponent:c})}function An(e){const{layout:t,subfeatures:r,bpPerPx:n,reversed:a,config:o,extraGlyphs:i}=e;r.forEach((e=>{(kn(e,i).layOut||Tn)({layout:t,feature:e,bpPerPx:n,reversed:a,config:o,extraGlyphs:i})}))}function Pn(e){return/(\bUTR|_UTR|untranslated[_\s]region)\b/.test(e.get("type")||"")}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mn.apply(null,arguments)}function En(e){const{feature:t,detectRerender:r,bpPerPx:n,region:a,config:o,displayMode:s,layout:l,extraGlyphs:d}=e;r?.();const{reversed:u}=a,p=t.get(u?"end":"start"),m=(0,c.bpToPx)(p,a,n),g="collapsed"!==s,h=new rn.SceneGraph("root",0,0,0,0),f=(kn(t,d).layOut||Tn)({layout:h,feature:t,bpPerPx:n,reversed:u,config:o,extraGlyphs:d});let y=!1,b=!1,v="",C="",S=0,k=0;if(g){const e=(0,i.readConfObject)(o,"showLabels"),r=(0,i.readConfObject)(o,"showDescriptions");S=(0,i.readConfObject)(o,["labels","fontSize"],{feature:t}),k=(0,i.readConfObject)(o,"maxFeatureGlyphExpansion")||0,v=String((0,i.readConfObject)(o,["labels","name"],{feature:t})||""),y=/\S/.test(v)&&e;const n=e=>{const t=h.width+k,r=(0,c.measureText)(e,S);return Math.round(Math.min(r,t))};if(C=String((0,i.readConfObject)(o,["labels","description"],{feature:t})||""),b=/\S/.test(C)&&r,y&&h.addChild("nameLabel",0,f.bottom,n(v),S),b){const e=y?h.getSubRecord("nameLabel"):f;if(!e)throw new Error("failed to layout nameLabel");h.addChild("descriptionLabel",0,e.bottom,n(C),S)}}const T=l.addRect(t.id(),t.get("start"),t.get("start")+h.width*n+3*n,h.height+5);return null===T?null:(h.move(m,T),w.createElement(sn,Mn({rootLayout:h,name:v,shouldShowName:y,description:C,shouldShowDescription:b,fontHeight:S,allowedWidthExpansion:k,reversed:a.reversed,topLevel:!0},e)))}const Rn=(0,We.observer)((function(e){const{features:t=new Map,isFeatureDisplayed:r}=e;return w.createElement(w.Fragment,null,[...t.values()].filter((e=>!r||r(e))).map((t=>w.createElement(En,Mn({key:t.id(),feature:t},e)))))})),In=(0,We.observer)((function(e){const{layout:t,blockKey:r,regions:n=[],bpPerPx:a,config:o,displayModel:s={},exportSVG:l,featureDisplayHandler:c,onMouseOut:d,onMouseDown:u,onMouseLeave:p,onMouseEnter:m,onMouseOver:g,onMouseMove:h,onMouseUp:f,onClick:y}=e,b=n[0],v=(b.end-b.start)/a,C=(0,i.readConfObject)(o,"displayMode"),S=(0,i.readConfObject)(o,"maxHeight"),k=(0,w.useRef)(null),[T,x]=(0,w.useState)(!1),[A,P]=(0,w.useState)(S),[M,E]=(0,w.useState)(!1),R=(0,w.useCallback)((e=>(x(!0),E(!1),u?.(e))),[u]),I=(0,w.useCallback)((e=>(x(!1),f?.(e))),[f]),N=(0,w.useCallback)((e=>{if(!k.current)return;T&&E(!0);const{left:t,top:n}=k.current.getBoundingClientRect(),o=e.clientX-t,i=e.clientY-n,l=b.reversed?v-o:o,c=b.start+a*l,d=s.getFeatureOverlapping?.(r,c,i);h&&h(e,d)}),[r,a,T,h,b.reversed,b.start,s,v]),F=(0,w.useCallback)((e=>{M||y?.(e)}),[M,y]);return(0,w.useEffect)((()=>{P(t.getTotalHeight())}),[t]),l?w.createElement(Rn,Mn({displayMode:C,isFeatureDisplayed:c,region:b},e)):w.createElement("svg",{ref:k,"data-testid":"svgfeatures",width:v,height:A+100,style:{display:"block"},onMouseDown:R,onMouseUp:I,onMouseEnter:m,onMouseLeave:p,onMouseOver:g,onMouseOut:d,onMouseMove:N,onClick:F},w.createElement(Rn,Mn({displayMode:C,region:b,movedDuringLastMouseDown:M,isFeatureDisplayed:c},e)),w.createElement(dn,Mn({},e,{region:b,movedDuringLastMouseDown:M})))})),Nn=(0,i.ConfigurationSchema)("SvgFeatureRenderer",{color1:{type:"color",description:"the main color of each feature",defaultValue:"goldenrod",contextVariable:["feature"]},color2:{type:"color",description:"the secondary color of each feature, used for connecting lines, etc",defaultValue:"#f0f",contextVariable:["feature"]},color3:{type:"color",description:"the tertiary color of each feature, often used for contrasting fills, like on UTRs",defaultValue:"#357089",contextVariable:["feature"]},outline:{type:"color",description:"the outline for features",defaultValue:"",contextVariable:["feature"]},height:{type:"number",description:"height in pixels of the main body of each feature",defaultValue:10,contextVariable:["feature"]},showLabels:{type:"boolean",defaultValue:!0},showDescriptions:{type:"boolean",defaultValue:!0},labels:(0,i.ConfigurationSchema)("SvgFeatureLabels",{name:{type:"string",description:"the primary name of the feature to show, if space is available",defaultValue:"jexl:get(feature,'name') || get(feature,'id')",contextVariable:["feature"]},nameColor:{type:"color",description:"the color of the name label, if shown",defaultValue:"#f0f",contextVariable:["feature"]},description:{type:"string",description:"the text description to show, if space is available",defaultValue:"jexl:get(feature,'note') || get(feature,'description')",contextVariable:["feature"]},descriptionColor:{type:"color",description:"the color of the description, if shown",defaultValue:"blue",contextVariable:["feature"]},fontSize:{type:"number",description:"height in pixels of the text to use for names and descriptions",defaultValue:12,contextVariable:["feature"]}}),displayMode:{type:"stringEnum",model:d.types.enumeration("displayMode",["normal","compact","reducedRepresentation","collapse"]),description:"Alternative display modes",defaultValue:"normal"},maxFeatureGlyphExpansion:{type:"number",description:"maximum number of pixels on each side of a feature's bounding coordinates that a glyph is allowed to use",defaultValue:500},maxHeight:{type:"integer",description:"the maximum height to be used in a svg rendering",defaultValue:1200},subParts:{type:"string",description:"subparts for a glyph",defaultValue:"CDS,UTR,five_prime_UTR,three_prime_UTR"},impliedUTRs:{type:"boolean",description:"imply UTR from the exon and CDS differences",defaultValue:!1}},{explicitlyTyped:!0});class Fn extends Yt.default{supportsSVG=!0}class Ln extends a.A{name="SVGPlugin";install(e){e.addRendererType((()=>new Fn({name:"SvgFeatureRenderer",ReactComponent:In,configSchema:Nn,pluginManager:e})))}}var Dn=r(79230),Bn=r(17970);const Vn=(0,w.lazy)((()=>r.e(3384).then(r.bind(r,93384))));function zn(e,t){return d.types.compose("SharedGCContentModel",(0,Bn._i)(e,t),d.types.model({windowSize:d.types.maybe(d.types.number),windowDelta:d.types.maybe(d.types.number)})).actions((e=>({setGCContentParams({windowSize:t,windowDelta:r}){e.windowSize=t,e.windowDelta=r}}))).views((e=>({get windowSizeSetting(){return e.windowSize??(0,i.getConf)(e,"windowSize")},get windowDeltaSetting(){return e.windowDelta??(0,i.getConf)(e,"windowDelta")}}))).views((e=>{const{trackMenuItems:t,renderProps:r}=e;return{trackMenuItems:()=>[...t(),{label:"Change GC parameters",onClick:()=>{(0,c.getSession)(e).queueDialog((t=>[Vn,{model:e,handleClose:t}]))}}],renderProps(){const t=(0,i.getConf)(e.parentTrack,"adapter");return{...r(),adapterConfig:{type:"GCContentAdapter",sequenceAdapter:t,windowSize:e.windowSizeSetting,windowDelta:e.windowDeltaSetting}}}}}))}class On extends a.A{name="GCContentPlugin";install(e){var t;!function(e){e.addAdapterType((()=>new $.A({name:"GCContentAdapter",displayName:"GC content adapter",adapterMetadata:{hiddenFromGUI:!0},configSchema:(0,i.ConfigurationSchema)("GCContentAdapter",{sequenceAdapter:{type:"frozen",defaultValue:null},windowSize:{type:"number",defaultValue:100},windowDelta:{type:"number",defaultValue:100}},{explicitlyTyped:!0}),getAdapterClass:()=>r.e(9756).then(r.bind(r,49756)).then((e=>e.default))})))}(e),(t=e).addTrackType((()=>{const e=(e=>(0,i.ConfigurationSchema)("GCContentTrack",{},{baseConfiguration:(0,Q.createBaseTrackConfig)(e)}))(t);return new _t.A({name:"GCContentTrack",displayName:"GCContent track",configSchema:e,stateModel:(0,s.createBaseTrackModel)(t,"GCContentTrack",e)})})),function(e){e.addDisplayType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("LinearGCContentDisplay",{windowSize:{type:"number",defaultValue:100},windowDelta:{type:"number",defaultValue:100}},{baseConfiguration:e.getDisplayType("LinearWiggleDisplay").configSchema,explicitlyTyped:!0})}(e),r=function(e,t){return d.types.compose("LinearGCContentDisplay",zn(e,t),d.types.model({type:d.types.literal("LinearGCContentDisplay")}))}(e,t);return new Q.DisplayType({name:"LinearGCContentDisplay",configSchema:t,stateModel:r,displayName:"GC content display",trackType:"ReferenceSequenceTrack",viewType:"LinearGenomeView",ReactComponent:Bn.r})})),e.addDisplayType((()=>{const t=function(e){return(0,i.ConfigurationSchema)("LinearGCContentTrackDisplay",{windowSize:{type:"number",defaultValue:100},windowDelta:{type:"number",defaultValue:100}},{baseConfiguration:e.getDisplayType("LinearWiggleDisplay").configSchema,explicitlyTyped:!0})}(e),r=function(e,t){return d.types.compose("LinearGCContentTrackDisplay",zn(e,t),d.types.model({type:d.types.literal("LinearGCContentTrackDisplay")}))}(e,t);return new Q.DisplayType({name:"LinearGCContentTrackDisplay",configSchema:t,stateModel:r,displayName:"GC content display",trackType:"GCContentTrack",viewType:"LinearGenomeView",ReactComponent:Bn.r})}))}(e)}}var Hn=r(39494),jn=r(4449),Wn=r(43283),Gn=r(98360),$n=r(29629),qn=r(93117),_n=r(61723),Un=r(23550),Jn=r(31892);function Xn(e,{DataCellReactComponent:t=null,FilterModelType:r=null,compare:n,displayName:a,categoryName:o}){return d.types.model(`ColumnDataType${e}`,{type:d.types.literal(e)}).volatile((()=>({DataCellReactComponent:t,FilterModelType:r,displayName:a||e,categoryName:o}))).views((()=>({compare:n,get hasFilter(){return!!r}})))}const Yn=(0,He.n9)()({textFilterControlAdornment:{marginRight:"-18px"},textFilterControl:{"& .MuiInput-formControl":{marginTop:8},"& .MuiInputLabel-formControl":{top:"-7px","&.MuiInputLabel-shrink":{top:"-3px"}}}}),Kn=(0,We.observer)((function({filterModel:e}){const{classes:t}=Yn(),r=(0,Un.getEnumerationValues)((0,Un.getSubType)((0,Un.getPropertyType)((0,d.getPropertyMembers)(e),"operation")));return w.createElement(w.Fragment,null,w.createElement(Gn.A,{value:e.operation,onChange:t=>e.setOperation(String(t.target.value))},r.map((e=>w.createElement($n.A,{key:e,value:e},e))))," ",w.createElement(C.A,{label:"range",placeholder:"chr1:100-200",error:e.locStringIsInvalid,value:e.locString,onChange:t=>e.setLocString(t.target.value),className:t.textFilterControl,InputProps:{endAdornment:w.createElement(qn.A,{className:t.textFilterControlAdornment,position:"end"},w.createElement(_n.A,{"aria-label":"clear filter",onClick:()=>e.setLocString("")},w.createElement(Jn.A,null)))}}))})),Qn={"overlaps with":(e,t)=>e.refName===t.refName&&(0,c.doesIntersect2)(e.start,e.end,t.start,t.end),"contained within":(e,t)=>e.refName===t.refName&&(0,c.isContainedWithin)(e.start,e.end,t.start,t.end),"fully contains":(e,t)=>e.refName===t.refName&&(0,c.isContainedWithin)(t.start,t.end,e.start,e.end),"does not overlap":(e,t)=>!Qn["overlaps with"](e,t),"not contained within":(e,t)=>!Qn["contained within"](e,t),"does not contain":(e,t)=>!Qn["fully contains"](e,t)},Zn=d.types.model("ColumnLocStringFilter",{type:d.types.literal("LocString"),columnNumber:d.types.integer,locString:"",operation:d.types.optional(d.types.string,"overlaps with")}).views((e=>({get locStringIsInvalid(){if(e.locString){const e=this.parsedLocString;return!e||""===e.refName||"number"!=typeof e.start||"number"!=typeof e.end||e.start>e.end}return!1},get parsedLocString(){const t=(0,c.getSession)(e),r=(0,d.getParent)(e,3).spreadsheet,{assemblyName:n}=r;try{return(0,c.parseLocString)(e.locString,(e=>t.assemblyManager.isValidRefName(e,n)))}catch(e){return}}}))).views((e=>({get predicate(){const{locString:t,locStringIsInvalid:r,parsedLocString:n,operation:a,columnNumber:o}=e;return t&&!r&&n?function(e,t){const{cellsWithDerived:r}=t,i=r[o];if(!i?.text||!i.extendedData)return!1;const s=i.extendedData;if(!s.refName)return!1;const l=Qn[a];if(!l)throw new Error(`"${a}" not implemented in location filter`);return l(s,n)}:function(){return!0}}}))).actions((e=>({setLocString(t){e.locString=t},setOperation(t){e.operation=t}}))).volatile((()=>({ReactComponent:Kn}))),ea=Xn("LocString",{categoryName:"Location",displayName:"Full location",compare:(e,t)=>(0,c.compareLocs)(e.extendedData,t.extendedData),FilterModelType:Zn,DataCellReactComponent:(0,We.observer)((function({cell:e,columnNumber:t,spreadsheet:r}){return w.createElement("a",{onClick:async t=>{t.preventDefault();const n=(0,c.getSession)(r);try{await async function(e,t,r){const n=(0,c.getSession)(e),{assemblyName:a}=e,{id:o}=(0,d.getParent)(e),i=`${o}_${a}`;let s=n.views.find((e=>e.id===i));s||(s=n.addView("LinearGenomeView",{id:i})),await s.navToLocString(r.text,a)}(r,0,e)}catch(e){console.error(e),n.notifyError(`${e}`,e)}},title:"open a new linear genome view here",href:"#"},e.text)}))}),ta=["equals","contains","does not contain","does not equal","starts with","ends with"],ra={contains:(e,t)=>e.toLowerCase().includes(t),equals:(e,t)=>e.toLowerCase()===t,"starts with":(e,t)=>e.toLowerCase().startsWith(t),"ends with":(e,t)=>{const r=e.toLowerCase().indexOf(t);return-1!==r&&r===e.length-t.length},"does not contain":(e,t)=>!ra.contains(e,t),"does not equal":(e,t)=>!ra.equals(e,t)},na=(0,He.n9)()({textFilterControlAdornment:{marginRight:"-18px"},textFilterControl:{margin:0,"& .MuiInput-formControl":{marginTop:8},"& .MuiInputLabel-formControl":{top:"-7px","&.MuiInputLabel-shrink":{top:"-3px"}}}}),aa=(0,We.observer)((({filterModel:e})=>{const{classes:t}=na(),r=(0,Un.getEnumerationValues)((0,Un.getSubType)((0,Un.getPropertyType)((0,d.getPropertyMembers)(e),"operation")));return w.createElement(w.Fragment,null,w.createElement(Gn.A,{value:e.operation,onChange:t=>{e.setOperation(String(t.target.value))}},r.map((e=>w.createElement($n.A,{key:e,value:e},e))))," ",w.createElement(C.A,{label:"text",value:e.stringToFind,onChange:t=>e.setString(t.target.value),className:t.textFilterControl,InputProps:{endAdornment:w.createElement(qn.A,{className:t.textFilterControlAdornment,position:"end"},w.createElement(_n.A,{"aria-label":"clear filter",onClick:()=>e.setString("")},w.createElement(Jn.A,null)))}}))})),oa=d.types.model("ColumnTextFilter",{type:d.types.literal("Text"),columnNumber:d.types.integer,stringToFind:"",operation:d.types.optional(d.types.enumeration(ta),ta[0])}).views((e=>({get predicate(){const{stringToFind:t,columnNumber:r,operation:n}=e;if(!t)return function(){return!0};const a=t.toLowerCase();return function(e,t){const{cellsWithDerived:o}=t,i=o[r];if(!i?.text)return!1;const s=ra[n];if(!s)throw new Error(`"${n}" not implemented in location filter`);return s(i.text,a)}}}))).actions((e=>({setString(t){e.stringToFind=t},setOperation(t){e.operation=t}}))).volatile((()=>({ReactComponent:aa}))),ia=Xn("Text",{compare:(e,t)=>e.text.localeCompare(t.text),FilterModelType:oa}),sa=Xn("LocRef",{categoryName:"Location",displayName:"Reference seq",compare:(e,t)=>e.text.localeCompare(t.text),FilterModelType:d.types.compose(oa,d.types.model({type:d.types.literal("LocRef")}))}),la=["equals","greater than","less than","between","not between"],ca={equals:(e,t)=>e===t,"greater than":(e,t)=>e>t,"less than":(e,t)=>e<t,between:(e,t,r)=>e>t&&void 0!==r&&e<r,"not between":(e,t,r)=>!ca.between(e,t,r)},da=(0,He.n9)()({textFilterControlAdornment:{marginRight:"-18px"},textFilterControl:{"& .MuiInput-formControl":{marginTop:8},"& .MuiInputLabel-formControl":{top:"-7px","&.MuiInputLabel-shrink":{top:"-3px"}}}}),ua=(0,We.observer)((({filterModel:e})=>{const{classes:t}=da(),r=la;return w.createElement(w.Fragment,null,w.createElement(Gn.A,{value:e.operation,onChange:t=>e.setOperation(String(t.target.value))},r.map((e=>w.createElement($n.A,{key:e,value:e},e))))," ",w.createElement(C.A,{label:"number",placeholder:"123",type:"number",error:e.firstNumberIsInvalid,defaultValue:e.firstNumber,onChange:t=>{e.setFirstNumber(Number.parseFloat(t.target.value))},className:t.textFilterControl}),"between"!==e.operation&&"not between"!==e.operation?null:w.createElement(w.Fragment,null," and ",w.createElement(C.A,{label:"number",placeholder:"456",type:"number",error:e.secondNumberIsInvalid,defaultValue:e.secondNumber,onChange:t=>e.setSecondNumber(Number.parseFloat(t.target.value)),className:t.textFilterControl})))})),pa=d.types.model("ColumnNumberFilter",{type:d.types.literal("Number"),columnNumber:d.types.integer,firstNumber:d.types.maybe(d.types.number),secondNumber:d.types.maybe(d.types.number),operation:d.types.optional(d.types.enumeration(la),la[0])}).views((e=>({get predicate(){if("number"!=typeof e.firstNumber)return function(){return!0};const{firstNumber:t,secondNumber:r,operation:n,columnNumber:a}=e;return function(e,o){const{cellsWithDerived:i}=o,s=i[a];if(!s?.text)return!1;const l=Number.parseFloat(s.text);if("number"!=typeof l)return!1;const c=ca[n];if(!c)throw new Error(`"${n}" not implemented in location filter`);return c(l,t,r)}}}))).actions((e=>({setFirstNumber(t){e.firstNumber=Number.isNaN(t)||"number"!=typeof t?void 0:t},setSecondNumber(t){e.secondNumber=Number.isNaN(t)||"number"!=typeof t?void 0:t},setOperation(t){e.operation=t}}))).volatile((()=>({ReactComponent:ua}))),ma={Number:Xn("Number",{compare:(e,t)=>Number.parseFloat(e.text)-Number.parseFloat(t.text),FilterModelType:pa}),Text:ia,LocString:ea,LocRef:sa,LocStart:Xn("LocStart",{categoryName:"Location",displayName:"Start",compare:(e,t)=>Number.parseFloat(e.text)-Number.parseFloat(t.text),FilterModelType:d.types.compose(pa,d.types.model({type:d.types.literal("LocStart")}))}),LocEnd:Xn("LocEnd",{categoryName:"Location",displayName:"End",compare:(e,t)=>Number.parseFloat(e.text)-Number.parseFloat(t.text),FilterModelType:d.types.compose(pa,d.types.model({type:d.types.literal("LocEnd")}))})},ga=Object.values(ma),ha=d.types.union(...ga),fa=d.types.union(...ga.map((e=>{const{FilterModelType:t}=e.create({type:e.properties.type.value});return t})).filter((e=>!!e))),ya=d.types.model("SpreadsheetCell",{text:d.types.string,extendedData:d.types.maybe(d.types.frozen())}),ba=d.types.model("SpreadsheetRow",{id:d.types.identifier,cells:d.types.array(ya),extendedData:d.types.maybe(d.types.frozen()),isSelected:!1}).actions((e=>({toggleSelect(){e.isSelected=!e.isSelected},unSelect(){e.isSelected=!1},select(){e.isSelected=!0},setExtendedData(t){e.extendedData=t}}))).views((e=>({get cellsWithDerived(){const{columns:t}=(0,d.getParent)(e,3);let r=0;return t.map((t=>t.isDerived?t.expr.evalSync({row:e}):e.cells[r++]))}}))),wa=d.types.model("StaticRowSet",{isLoaded:d.types.literal(!0),rows:d.types.array(ba)}).views((e=>({get count(){return e.rows.length},get passingFiltersCount(){return this.sortedFilteredRows.length},get selectedCount(){return this.selectedRows.length},get selectedAndPassingFiltersCount(){return this.selectedFilteredRows.length},get sortedRows(){const t=(0,d.getParent)(e);return[...e.rows].sort(t.rowSortingComparisonFunction)},get selectedRows(){return e.rows.filter((e=>e.isSelected))},get selectedFilteredRows(){const t=(0,d.getParent)(e),r=(0,d.getParent)(t),{filterControls:n}=r;return this.selectedRows.filter((e=>n.rowPassesFilters(t,e)))},get sortedFilteredRows(){const t=(0,d.getParent)(e),r=(0,d.getParent)(t),{filterControls:n}=r;return e.rows.filter((e=>n.rowPassesFilters(t,e))).sort(t.rowSortingComparisonFunction)}}))).actions((e=>({unselectAll(){e.rows.forEach((e=>{e.unSelect()}))}}))),va=d.types.model("ColumnDefinition",{name:d.types.maybe(d.types.string),dataType:d.types.optional(ha,(()=>({type:"Text"}))),isDerived:!1,derivationFunctionText:d.types.maybe(d.types.string)}).views((e=>({get expr(){if(e.isDerived)return(0,Wn.A)(String(e.derivationFunctionText),(0,c.getEnv)(e).pluginManager.jexl)}}))),Ca=d.types.model("Spreadsheet",{rowSet:d.types.optional(wa,(()=>wa.create())),columns:d.types.array(va),columnDisplayOrder:d.types.array(d.types.number),hasColumnNames:!1,sortColumns:d.types.array(d.types.model("SortColumns",{columnNumber:d.types.number,descending:!1}).actions((e=>({switchDirection(){e.descending=!e.descending}})))),assemblyName:d.types.maybe(d.types.string)}).volatile((()=>({defaultDataType:ma.Text,rowMenuPosition:null,isLoaded:!1}))).views((e=>({get initialized(){const t=(0,c.getSession)(e),r=e.assemblyName;return!!r&&t.assemblyManager.get(r)?.initialized},get hideRowSelection(){return(0,d.getParent)(e).hideRowSelection},get dataTypeChoices(){return Object.keys(ma).map((e=>{const t=ma[e].create({type:e}),{displayName:r,categoryName:n}=t;return{typeName:e,displayName:r,categoryName:n}}))},rowSortingComparisonFunction(t,r){for(const{columnNumber:n,descending:a}of e.sortColumns){const{dataType:o}=e.columns[n],i=o.compare(t.cellsWithDerived[n],r.cellsWithDerived[n]);if(i)return a?-i:i}return 0}}))).actions((e=>({afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((async()=>{const t=(0,c.getSession)(e),{assemblyManager:r}=t;try{e.assemblyName&&(await r.waitForAssembly(e.assemblyName),this.setLoaded(!0))}catch(r){t.notify(`failed to load assembly ${e.assemblyName} ${r}`,"error")}})))},setLoaded(t){e.isLoaded=t},setRowMenuPosition(t){e.rowMenuPosition=t},setSortColumns(t){t&&(e.sortColumns=t)},setColumnType(t,r){e.columns[t].dataType={type:r}},unselectAll(){e.rowSet.unselectAll()}}))),Sa=["CSV","TSV","VCF","BED","BEDPE","STAR-Fusion"],ka={CSV:()=>r.e(9870).then(r.bind(r,59870)).then((e=>e.parseCsvBuffer)),TSV:()=>r.e(9870).then(r.bind(r,59870)).then((e=>e.parseTsvBuffer)),VCF:()=>r.e(9314).then(r.bind(r,99314)).then((e=>e.parseVcfBuffer)),BED:()=>r.e(6310).then(r.bind(r,6310)).then((e=>e.parseBedBuffer)),BEDPE:()=>r.e(6310).then(r.bind(r,6310)).then((e=>e.parseBedPEBuffer)),"STAR-Fusion":()=>r.e(759).then(r.bind(r,759)).then((e=>e.parseSTARFusionBuffer))},Ta=new RegExp(`\\.(${Sa.join("|")})(\\.gz)?$`,"i"),xa=d.types.model("SpreadsheetImportWizard",{fileType:d.types.optional(d.types.enumeration(Sa),"CSV"),hasColumnNameLine:!0,columnNameLineNumber:1,selectedAssemblyName:d.types.maybe(d.types.string)}).volatile((()=>({fileTypes:Sa,fileSource:void 0,error:void 0,loading:!1}))).views((e=>({get isReadyToOpen(){return!e.error&&e.fileSource&&(e.fileSource.blobId||e.fileSource.localPath||e.fileSource.uri)},get canCancel(){return(0,d.getParent)(e).readyToDisplay},get fileName(){return e.fileSource.uri||e.fileSource.localPath||e.fileSource.blobId&&e.fileSource.name},get requiresUnzip(){return this.fileName.endsWith("gz")},isValidRefName(t,r){const{assemblyManager:n}=(0,c.getSession)(e);return!!r&&n.isValidRefName(t,r)}}))).actions((e=>({setSelectedAssemblyName(t){e.selectedAssemblyName=t},setFileSource(t){if(e.fileSource=t,e.error=void 0,e.fileSource){const t=e.fileName;if(t){const r=Ta.exec(t)?.[1];r&&(e.fileType="tsv"===r&&t.includes("star-fusion")?"STAR-Fusion":r.toUpperCase())}}},toggleHasColumnNameLine(){e.hasColumnNameLine=!e.hasColumnNameLine},setColumnNameLineNumber(t){t>0&&(e.columnNameLineNumber=t)},setFileType(t){e.fileType=t},setError(t){console.error(t),e.loading=!1,e.error=t},setLoaded(){e.loading=!1,e.error=void 0},cancelButton(){e.error=void 0,(0,d.getParent)(e).setDisplayMode()},async import(t){if(!e.fileSource)return;if(e.loading)throw new Error("Cannot import, load already in progress");e.selectedAssemblyName=t,e.loading=!0;const n=e.fileType,a=await ka[n](),{unzip:o}=await Promise.all([r.e(7864),r.e(9086),r.e(7706)]).then(r.bind(r,7706)),{pluginManager:i}=(0,c.getEnv)(e),s=(0,z.openLocation)(e.fileSource,i);try{if((await s.stat()).size>3e7)throw new Error(`File is too big. Tabular files are limited to at most ${3e4.toLocaleString()}kb.`)}catch(e){console.warn(e)}try{await s.readFile().then((t=>e.requiresUnzip?o(t):t)).then((t=>a(t,e))).then((t=>{this.setLoaded(),(0,d.getParent)(e).displaySpreadsheet(t)}))}catch(e){this.setError(e)}}}))),Aa=xa,Pa=d.types.model("RowFullTextFilter",{type:d.types.literal("RowFullText"),stringToFind:""}).views((e=>({get predicate(){let t=e.stringToFind;return t?(t=t.toLowerCase(),function(e,r){const{cellsWithDerived:n}=r;for(const e of n)if(e.text.toLowerCase().includes(t))return!0;return!1}):function(){return!0}}}))).actions((e=>({setString(t){e.stringToFind=t},clear(){e.stringToFind=""}}))),Ma=d.types.model("SpreadsheetFilterControls",{rowFullText:d.types.optional(Pa,(()=>({type:"RowFullText",stringToFind:""}))),columnFilters:d.types.array(fa)}).views((e=>({get filters(){return[e.rowFullText,...e.columnFilters].filter((e=>!!e))},setRowFullTextFilter(t){e.rowFullText={type:"RowFullText",stringToFind:t}},rowPassesFilters(e,t){for(const r of this.filters)if(!r.predicate(e,t))return!1;return!0}}))).actions((e=>({addBlankColumnFilter(t){const{dataType:r}=(0,d.getParent)(e).spreadsheet.columns[t];e.columnFilters.push({type:r.type,columnNumber:t})},removeColumnFilter:t=>e.columnFilters.remove(t),clearAllFilters(){e.columnFilters.clear(),e.rowFullText.clear()}}))),Ea=[{label:"Toggle select",icon:jn.A,onClick(e,t){const r=t.rowMenuPosition?.rowNumber;void 0!==r&&t.rowSet.rows[+r-1].toggleSelect()}}],Ra=d.types.model("SpreadsheetView",{type:d.types.literal("SpreadsheetView"),offsetPx:0,height:d.types.optional(d.types.refinement("SpreadsheetViewHeight",d.types.number,(e=>e>=40)),440),hideVerticalResizeHandle:!1,hideFilterControls:!1,filterControls:d.types.optional(Ma,(()=>Ma.create({}))),mode:d.types.optional(d.types.enumeration("SpreadsheetViewMode",["import","display"]),"import"),importWizard:d.types.optional(Aa,(()=>Aa.create())),spreadsheet:d.types.maybe(Ca)}).volatile((()=>({width:400,rowMenuItems:Ea}))).views((e=>({get readyToDisplay(){return!!e.spreadsheet&&e.spreadsheet.isLoaded},get hideRowSelection(){return!!(0,d.getEnv)(e).hideRowSelection},get outputRows(){if(e.spreadsheet?.rowSet.isLoaded){const t=e.spreadsheet.rowSet.selectedFilteredRows;return t.length?t:e.spreadsheet.rowSet.sortedFilteredRows}},get assembly(){const t=e.spreadsheet?.assemblyName;if(t)return(0,c.getSession)(e).assemblies.find((e=>(0,i.readConfObject)(e,"name")===t))}}))).actions((e=>({setRowMenuItems(t){e.rowMenuItems=t},setWidth:t=>(e.width=t,e.width),setHeight:t=>(e.height=t>40?t:40,e.height),resizeHeight(t){const r=e.height;return this.setHeight(e.height+t)-r},resizeWidth(t){const r=e.width;return this.setWidth(e.width+t)-r},displaySpreadsheet(t){e.filterControls.clearAllFilters(),e.spreadsheet=(0,d.cast)(t),e.mode="display"},setImportMode(){e.mode="import"},setDisplayMode(){e.readyToDisplay&&(e.mode="display")}}))).views((e=>({menuItems:()=>[{label:"Return to import form",onClick:()=>{e.setImportMode()},icon:Me.A}]}))),Ia=d.types.compose(s.BaseViewModel,Ra);class Na extends a.A{name="SpreadsheetViewPlugin";install(e){!function(e){e.addViewType((()=>new Q.ViewType({name:"SpreadsheetView",displayName:"Spreadsheet view",stateModel:Ia,ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(8565),r.e(3682),r.e(8546)]).then(r.bind(r,78546))))})))}(e),function(e){e.addToExtensionPoint("LaunchView-SpreadsheetView",(async({session:e,assembly:t,uri:r,fileType:n})=>{const a=e.addView("SpreadsheetView"),o=r.split(".");let i=o.pop()?.toUpperCase();"GZ"===i&&(i=o.pop()?.toUpperCase()),a.importWizard.setFileType(n||i||""),a.importWizard.setSelectedAssemblyName(t),a.importWizard.setFileSource({uri:r,locationType:"UriLocation"}),await a.importWizard.import(t)}))}(e)}configure(e){const{rootModel:t}=e;(0,c.isAbstractMenuManager)(t)&&t.appendToSubMenu(["Add"],{label:"Spreadsheet view",icon:Hn.A,onClick:e=>{e.addView("SpreadsheetView",{})}})}}var Fa=r(92516),La=r(67393),Da=r(67314),Ba=r(33371),Va=r(32808);const za=(0,He.n9)()((e=>({circularViewOptions:{padding:e.spacing(1)}}))),Oa=(0,We.observer)((function({svInspector:e}){const{classes:t}=za();return w.createElement(Da.Ay,{container:!0,className:t.circularViewOptions,style:{height:e.circularViewOptionsBarHeight}},w.createElement(Da.Ay,{item:!0},w.createElement(Ba.A,{control:w.createElement(Va.A,{checked:e.onlyDisplayRelevantRegionsInCircularView,onChange:t=>{e.setOnlyDisplayRelevantRegionsInCircularView(t.target.checked)}}),label:"show only regions with data"})))})),Ha=(0,He.n9)()((e=>({resizeHandleVert:{background:e.palette.action.selected,width:4,boxSizing:"border-box",borderTop:"1px solid #fafafa"},resizeHandleHoriz:{background:e.palette.action.selected,height:4,boxSizing:"border-box",borderTop:"1px solid #fafafa"},viewControls:{margin:0},viewsContainer:{display:"flex"},container:{overflow:"hidden"}}))),ja=(0,We.observer)((function({model:e}){const{classes:t}=Ha(),{SpreadsheetViewReactComponent:r,CircularViewReactComponent:n,showCircularView:a}=e;return w.createElement("div",{className:t.container},w.createElement("div",{className:t.viewsContainer},w.createElement("div",{style:{width:e.spreadsheetView.width},className:t.container},w.createElement(r,{model:e.spreadsheetView})),a?w.createElement(w.Fragment,null,w.createElement(T.ResizeHandle,{onDrag:t=>{const r=e.circularView.resizeWidth(-t);return e.spreadsheetView.resizeWidth(-r)},vertical:!0,flexbox:!0,className:t.resizeHandleVert}),w.createElement("div",{style:{width:e.circularView.width}},w.createElement(Oa,{svInspector:e}),w.createElement(n,{model:e.circularView}))):null),w.createElement(T.ResizeHandle,{onDrag:e.resizeHeight,className:t.resizeHandleHoriz}))})),Wa=ja;var Ga=r(52686);function $a(e,t,r,n,a,o){const i={};return e.forEach(((e,n)=>{if(t.includes(n))return;let{text:a}=r.cells[n];"Number"===e.dataType.type&&(a=Number.parseFloat(a)),i[e.name]=a})),{...i,uniqueId:`sv-inspector-adhoc-${o}`,refName:n.refName,start:n.start,end:n.end,mate:{refName:a.refName,start:a.start,end:a.end}}}function qa(e,t,r,n){return r.extendedData?.vcfFeature||r.extendedData?.feature||function(e,t,r,n){const{columns:a,columnDisplayOrder:o}=e,i={};o.forEach((e=>{const t=a[e];i[t.dataType.type]||(i[t.dataType.type]=[]),i[t.dataType.type].push(e)}));const s=i.LocString||[],l=i.LocStart||[],d=i.LocEnd||[],u=i.LocRef||[];return s.length>=2?function(e,t,r,n,a){const o=(0,c.parseLocString)(r.cells[t[0]].text,a),i=(0,c.parseLocString)(r.cells[t[1]].text,a);return $a(e,[t[0],t[1]],r,o,i,n)}(a,s,r,t,n):u.length>=2&&l.length>=2&&d.length>=2?function(e,t,r,n,a,o){const i=e=>a.cells[e].text,s={refName:i(t[0]),start:Number.parseInt(i(r[0]),10)-1,end:Number.parseInt(i(n[0]),10)},l={refName:i(t[1]),start:Number.parseInt(i(r[1]),10)-1,end:Number.parseInt(i(n[1]),10)};return $a(e,[t[0],r[0],n[0],t[1],r[1],n[1]],a,s,l,o)}(a,u,l,d,r,t):void 0}(t.spreadsheet,n,r,e.assemblyManager.isValidRefName)}function _a(e,t,r,n,a){const{pluginManager:o}=(0,c.getEnv)(e),i=(0,c.getSession)(t),s=qa(i,r,n,a);if(s){const t=new c.SimpleFeature(s);return i.setSelection(t),o.getViewType("BreakpointSplitView").snapshotFromBreakendFeature(t,e.circularView)}}function Ua(e,t,r){const n=(0,c.getSession)(t);n.setSelection(e);const a=(0,c.getContainingView)(t),o=r.getViewType("BreakpointSplitView").snapshotFromBreakendFeature(e,a);o.views[0].offsetPx-=a.width/2+100,o.views[1].offsetPx-=a.width/2+100,n.addView("BreakpointSplitView",o)}class Ja extends a.A{name="SvInspectorViewPlugin";install(e){!function(e){e.jexl.addFunction("defaultOnChordClick",Ua),e.addViewType((()=>{const t=function(e){const t=e.getViewType("SpreadsheetView"),r=e.getViewType("CircularView"),n=t.stateModel,a=r.stateModel;return d.types.compose("SvInspectorView",s.BaseViewModel,d.types.model({id:K.ElementId,type:d.types.literal("SvInspectorView"),height:d.types.optional(d.types.refinement("SvInspectorViewHeight",d.types.number,(e=>e>=400)),550),onlyDisplayRelevantRegionsInCircularView:!1,mode:d.types.optional(d.types.enumeration("SvInspectorViewMode",["import","display"]),"import"),spreadsheetView:d.types.optional(n,(()=>n.create({type:"SpreadsheetView",hideVerticalResizeHandle:!0}))),circularView:d.types.optional(a,(()=>a.create({type:"CircularView",hideVerticalResizeHandle:!0,hideTrackSelectorButton:!0,disableImportForm:!0})))})).volatile((()=>({width:800}))).views((e=>({get selectedRows(){return e.spreadsheetView.spreadsheet?.rowSet.selectedRows},get assemblyName(){const{assembly:t}=e.spreadsheetView;return t?(0,i.readConfObject)(t,"name"):void 0},get showCircularView(){return"display"===e.spreadsheetView.mode},get features(){const t=(0,c.getSession)(e),{spreadsheetView:r}=e,{outputRows:n=[]}=r;return n.map(((e,n)=>qa(t,r,e,n))).filter((e=>!!e))},get featuresAdapterConfigSnapshot(){return{type:"FromConfigAdapter",features:this.features}},get featureRefNames(){return[...this.features.map((e=>e.refName)),...this.features.flatMap((e=>e.INFO?.CHR2)).filter((e=>!!e))]},get featuresCircularTrackConfiguration(){return{type:"VariantTrack",trackId:`sv-inspector-variant-track-${e.id}`,name:"features from tabular data",adapter:this.featuresAdapterConfigSnapshot,assemblyNames:[this.assemblyName],displays:[{type:"ChordVariantDisplay",displayId:`sv-inspector-variant-track-chord-display-${e.id}`,onChordClick:"jexl:defaultOnChordClick(feature, track, pluginManager)",renderer:{type:"StructuralVariantChordRenderer"}}]}}}))).volatile((()=>({SpreadsheetViewReactComponent:t.ReactComponent,CircularViewReactComponent:r.ReactComponent,circularViewOptionsBarHeight:52}))).actions((e=>({setWidth(t){e.width=t},setHeight:t=>(e.height=t>400?t:400,e.height),setImportMode(){e.spreadsheetView.setImportMode()},setDisplayMode(){e.spreadsheetView.setDisplayMode()},setDisplayedRegions(t){e.circularView.setDisplayedRegions(t)},setOnlyDisplayRelevantRegionsInCircularView(t){e.onlyDisplayRelevantRegionsInCircularView=Boolean(t)}}))).views((e=>({menuItems:()=>[{label:"Return to import form",onClick:()=>{e.setImportMode()},icon:Me.A}]}))).actions((e=>({resizeHeight(t){const r=e.height;return e.setHeight(e.height+t)-r},afterAttach(){(0,d.addDisposer)(e,(0,ae.autorun)((()=>{if(e.showCircularView){const t=Math.round(.66*e.width),r=e.width-t;e.spreadsheetView.setWidth(t-1),e.circularView.setWidth(r)}else e.spreadsheetView.setWidth(e.width)}),{name:"SvInspectorView width binding"})),(0,d.addDisposer)(e,(0,ae.autorun)((()=>{e.spreadsheetView.setHeight(e.height-52),e.circularView.setHeight(e.height-52-52)}),{name:"SvInspectorView height binding"})),(0,d.addDisposer)(e,(0,ae.autorun)((async()=>{const{assemblyName:t,onlyDisplayRelevantRegionsInCircularView:r,circularView:n,featureRefNames:a}=e,{tracks:o}=n,{assemblyManager:i}=(0,c.getSession)(e);if(!t)return;const s=await i.waitForAssembly(t);if(!s)return;const{getCanonicalRefName:l,regions:d=[]}=s;if(r){if(1===o.length)try{const e=new Set(a.map((e=>l(e)||e)));n.setDisplayedRegions(Ye()(d.filter((t=>e.has(t.refName)))))}catch(e){n.setError(e)}}else n.setDisplayedRegions(d)}),{name:"SvInspectorView displayed regions bind"})),(0,d.addDisposer)(e,(0,ae.reaction)((()=>({generatedTrackConf:e.featuresCircularTrackConfiguration,assemblyName:e.assemblyName})),(t=>{const{assemblyName:r,generatedTrackConf:n}=t,{circularView:a}=e;a.tracks.forEach((e=>a.hideTrack(e.configuration.trackId))),r&&a.addTrackConf(n,{assemblyName:r})}),{name:"SvInspectorView track configuration binding",fireImmediately:!0})),(0,d.addDisposer)(e,(0,ae.autorun)((()=>{e.spreadsheetView.setRowMenuItems([{label:"Open split detail view",icon:Ga.A,disabled:(t,r,n,a)=>!function(e,t,r,n,a){try{return Boolean(_a(e,t,r,n,a))}catch(e){return console.error("Unable to open breakpoint split view from table row",e),!1}}(e,t,r,a,n),onClick(t,r,n,a){!function(e,t,r,n,a){const o=_a(e,t,r,n,a);if(o){const{circularView:r}=e;o.views[0].offsetPx-=r.width/2+100,o.views[1].offsetPx-=r.width/2+100,(0,c.getSession)(t).addView("BreakpointSplitView",o)}}(e,t,r,a,n)}}])})))}})))}(e);return new te.A({name:"SvInspectorView",displayName:"SV inspector",stateModel:t,ReactComponent:Wa})}))}(e),function(e){e.addToExtensionPoint("LaunchView-SvInspectorView",(async({session:e,assembly:t,uri:r,fileType:n})=>{const a=e.addView("SvInspectorView"),o=r.split(".");let i=o.pop()?.toUpperCase();"GZ"===i&&(i=o.pop()?.toUpperCase()),a.spreadsheetView.importWizard.setFileType(n||i||""),a.spreadsheetView.importWizard.setSelectedAssemblyName(t),a.spreadsheetView.importWizard.setFileSource({uri:r,locationType:"UriLocation"}),await a.spreadsheetView.importWizard.import(t)}))}(e)}configure(e){(0,Fa.Nh)(e.rootModel)&&e.rootModel.appendToSubMenu(["Add"],{label:"SV inspector",icon:La.A,onClick:e=>{e.addView("SvInspectorView",{})}})}}var Xa=r(87485);function Ya(){return Ya=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ya.apply(null,arguments)}const Ka=(0,We.observer)((function(e){const{width:t,height:r}=e,n=Math.ceil(t);return w.createElement("div",{style:{position:"relative",width:n,height:r}},w.createElement(T.PrerenderedCanvas,Ya({},e,{style:{position:"absolute",left:0,top:0}})))})),Qa=(0,i.ConfigurationSchema)("HicRenderer",{baseColor:{type:"color",description:"base color to be used in the hic alignment",defaultValue:"#f00"},color:{type:"color",description:"the color of each feature in a hic alignment",defaultValue:"jexl:interpolate(count,scale)",contextVariable:["count","maxScore","baseColor","scale"]},maxHeight:{type:"integer",description:"the maximum height to be used in a hic rendering",defaultValue:600}},{explicitlyTyped:!0});var Za=r(198),eo=r(98506),to=r(82088),ro=r(3496),no=r(44728);class ao extends Za.default{supportsSVG=!0;async render(e){const{config:t,regions:n,bpPerPx:a}=e,o=n[0],s=(o.end-o.start)/a,l=(0,i.readConfObject)(t,"maxHeight"),c=await this.getFeatures(e),{makeImageData:d}=await r.e(9088).then(r.bind(r,49088)),u=await(0,eo.u1)(s,l,e,(t=>d(t,{...e,features:c,pluginManager:this.pluginManager})));return{...await super.render({...e,...u,features:c,region:e.regions[0],height:l,width:s}),...u,height:l,width:s}}async getFeatures(e){const{regions:t,sessionId:r,adapterConfig:n}=e,{dataAdapter:a}=await(0,ro.cK)(this.pluginManager,r,n);return await(0,no._)(a.getFeatures(t[0],e).pipe((0,to.$)()))}}function oo(e){return d.types.compose("LinearHicDisplay",Rt.Lr,d.types.model({type:d.types.literal("LinearHicDisplay"),configuration:(0,i.ConfigurationReference)(e),resolution:d.types.optional(d.types.number,1),useLogScale:!1,colorScheme:d.types.maybe(d.types.string)})).views((e=>{const{renderProps:t}=e;return{get blockType(){return"dynamicBlocks"},get rendererTypeName(){return"HicRenderer"},renderProps(){const r=e.rendererType.configSchema.create({...(0,i.getConf)(e,"renderer"),...e.colorScheme?{color:"jexl:interpolate(count,scale)"}:{}},(0,d.getEnv)(e));return{...t(),config:r,rpcDriverName:e.rpcDriverName,displayModel:e,resolution:e.resolution,useLogScale:e.useLogScale,colorScheme:e.colorScheme}}}})).actions((e=>({setResolution(t){e.resolution=t},setUseLogScale(t){e.useLogScale=t},setColorScheme(t){e.colorScheme=t}}))).views((e=>{const{trackMenuItems:t}=e;return{trackMenuItems:()=>[...t(),{label:"Use log scale",type:"checkbox",checked:e.useLogScale,onClick:()=>{e.setUseLogScale(!e.useLogScale)}},{label:"Color scheme",type:"subMenu",subMenu:[{label:"Fall",onClick:()=>{e.setColorScheme("fall")}},{label:"Viridis",onClick:()=>{e.setColorScheme("viridis")}},{label:"Juicebox",onClick:()=>{e.setColorScheme("juicebox")}},{label:"Clear",onClick:()=>{e.setColorScheme(void 0)}}]},{label:"Resolution",subMenu:[{label:"Finer resolution",onClick:()=>{e.setResolution(2*e.resolution)}},{label:"Coarser resolution",onClick:()=>{e.setResolution(e.resolution/2)}}]}]}}))}const io=(0,i.ConfigurationSchema)("HicAdapter",{hicLocation:{type:"fileLocation",defaultValue:{uri:"/path/to/my.hic",locationType:"UriLocation"}}},{explicitlyTyped:!0});class so extends a.A{name="HicPlugin";install(e){!function(e){e.addAdapterType((()=>new Q.AdapterType({name:"HicAdapter",displayName:"Hi-C adapter",configSchema:io,getAdapterClass:()=>Promise.all([r.e(6514),r.e(937)]).then(r.bind(r,90937)).then((e=>e.default))})))}(e),function(e){e.addRendererType((()=>new ao({name:"HicRenderer",ReactComponent:Ka,configSchema:Qa,pluginManager:e})))}(e),function(e){e.addTrackType((()=>{const t=(e=>(0,i.ConfigurationSchema)("HicTrack",{},{baseConfiguration:(0,Q.createBaseTrackConfig)(e)}))(e);return new _t.A({name:"HicTrack",displayName:"Hi-C track",configSchema:t,stateModel:(0,s.createBaseTrackModel)(e,"HicTrack",t)})}))}(e),function(e){e.addDisplayType((()=>{const t=(e=>(0,i.ConfigurationSchema)("LinearHicDisplay",{renderer:e.getRendererType("HicRenderer").configSchema},{baseConfiguration:Rt.Ki,explicitlyTyped:!0}))(e);return new Q.DisplayType({name:"LinearHicDisplay",displayName:"Hi-C contact matrix display",configSchema:t,stateModel:oo(t),trackType:"HicTrack",viewType:"LinearGenomeView",ReactComponent:Rt.GQ})}))}(e),e.addToExtensionPoint("Core-guessAdapterForLocation",(e=>(t,r,n)=>{const a="HicAdapter",o=(0,X.getFileName)(t),i={type:a,hicLocation:t};return/\.hic/i.test(o)&&!n||n===a?i:e(t,r,n)})),e.addToExtensionPoint("Core-guessTrackTypeForLocation",(e=>t=>"HicAdapter"===t?"HicTrack":e(t)))}configure(e){const{jexl:t}=e;t.addFunction("alpha",((e,t)=>e.alpha(t))),t.addFunction("hsl",(e=>(0,Xa.M)(e.toHsl()))),t.addFunction("colorString",(e=>e.toHex())),t.addFunction("interpolate",((e,t)=>t(e)))}}const lo=(0,i.ConfigurationSchema)("TrixTextSearchAdapter",{ixFilePath:{type:"fileLocation",defaultValue:{uri:"out.ix",locationType:"UriLocation"},description:"the location of the trix ix file"},ixxFilePath:{type:"fileLocation",defaultValue:{uri:"out.ixx",locationType:"UriLocation"},description:"the location of the trix ixx file"},metaFilePath:{type:"fileLocation",defaultValue:{uri:"meta.json",locationType:"UriLocation"},description:"the location of the metadata json file for the trix index"},tracks:{type:"stringArray",defaultValue:[],description:"List of tracks covered by text search adapter"},assemblyNames:{type:"stringArray",defaultValue:[],description:"List of assemblies covered by text search adapter"}},{explicitlyTyped:!0,explicitIdentifier:"textSearchAdapterId"});class co extends a.A{name="TrixPlugin";install(e){e.addTextSearchAdapterType((()=>new Tt.A({name:"TrixTextSearchAdapter",displayName:"Trix text search adapter",configSchema:lo,description:"Trix text search adapter",getAdapterClass:()=>r.e(5260).then(r.bind(r,15260)).then((e=>e.default))})))}}var uo=r(11353),po=r(29948),mo=r(17037),go=r(95947);const ho=d.types.compose(K.Region,d.types.model("Label",{label:d.types.optional(d.types.string,""),highlight:d.types.optional(d.types.string,"rgba(247, 129, 192, 0.35)")})).actions((e=>({setLabel(t){e.label=t},setHighlight(t){e.highlight=t}}))),fo=d.types.model("SharedBookmarksModel",{sharedBookmarks:d.types.maybe(d.types.array(ho))}),yo=()=>"undefined"!=typeof window?`bookmarks-${[window.location.host+window.location.pathname].join("-")}`:"empty";var bo=r(89003),wo=r(23758);const vo=(0,He.n9)()({highlight:{overflow:"hidden",height:"100%",position:"absolute",zIndex:100,pointerEvents:"none"},highlightButton:{pointerEvents:"auto"}}),Co=(0,We.observer)((function({model:e}){const{classes:t}=vo(),r=(0,c.getSession)(e),{assemblyManager:n}=r,{showBookmarkHighlights:a,showBookmarkLabels:o}=e,i=r.widgets.get("GridBookmark");(0,w.useEffect)((()=>{i||r.addWidget("GridBookmarkWidget","GridBookmark")}),[r,i]);const s=new Set(e.assemblyNames);return a&&i?.bookmarks?i.bookmarks.filter((e=>s.has(e.assemblyName))).map((t=>{const r=n.get(t.assemblyName),a=r?.getCanonicalRefName(t.refName)??t.refName,o=e.bpToPx({refName:a,coord:t.start}),i=e.bpToPx({refName:a,coord:t.end});return o&&i?{width:Math.max(Math.abs(i.offsetPx-o.offsetPx),3),left:Math.min(o.offsetPx,i.offsetPx)-e.offsetPx,highlight:t.highlight,label:t.label,bookmark:t}:void 0})).filter(c.notEmpty).map((({left:e,width:n,highlight:a,label:s,bookmark:l},c)=>w.createElement("div",{key:`${e}_${n}_${c}`,className:t.highlight,style:{left:e,width:n,background:a}},o?w.createElement("div",{className:t.highlightButton},w.createElement(wo.A,{menuItems:[{label:"Open bookmark widget",onClick:()=>{r.showWidget(i)}},{label:"Remove bookmark",onClick:()=>{i.removeBookmarkObject(l)}}]},w.createElement(bo.A,{title:s,arrow:!0},w.createElement(uo.A,{fontSize:"small",sx:{color:0!==(0,Xa.M)(a).alpha()?(0,Xa.M)(a).alpha(.8).toRgbString():(0,Xa.M)(a).alpha(0).toRgbString()}})))):null))):null})),So=Co,ko=(0,He.n9)()({highlight:{height:"100%",position:"absolute"}}),To=(0,We.observer)((function({model:e,overview:t}){const{cytobandOffset:r}=e,n=(0,c.getSession)(e),{classes:a}=ko(),{assemblyManager:o}=n,{showBookmarkHighlights:i,showBookmarkLabels:s}=e,l=n.widgets.get("GridBookmark");(0,w.useEffect)((()=>{l||n.addWidget("GridBookmarkWidget","GridBookmark")}),[n,l]);const d=new Set(e.assemblyNames);return i&&l?.bookmarks?l.bookmarks.filter((e=>d.has(e.assemblyName))).map((e=>{const n=o.get(e.assemblyName),a=n?.getCanonicalRefName(e.refName)??e.refName,i=e.reversed,s=t.bpToPx({refName:a,coord:i?e.end:e.start}),l=t.bpToPx({refName:a,coord:i?e.start:e.end});return void 0!==s&&void 0!==l?{width:Math.abs(l-s),left:s+r,highlight:e.highlight,label:e.label}:void 0})).filter(c.notEmpty).map(((e,t)=>{const{left:r,width:n,highlight:o,label:i}=e;return w.createElement(bo.A,{key:`${JSON.stringify(e)}-${t}`,title:s?i:"",arrow:!0},w.createElement("div",{className:a.highlight,style:{left:r,width:n,background:o,borderLeft:`1px solid ${o}`,borderRight:`1px solid ${o}`}}))})):null})),xo=To,Ao=(0,i.ConfigurationSchema)("GridBookmarkWidget",{});class Po extends a.A{name="GridBookmarkPlugin";install(e){(function(e){e.addWidgetType((()=>new Q.WidgetType({name:"GridBookmarkWidget",heading:"Bookmarked regions",configSchema:Ao,stateModel:d.types.model("GridBookmarkModel",{id:K.ElementId,type:d.types.literal("GridBookmarkWidget"),bookmarks:d.types.optional(d.types.array(ho),(()=>JSON.parse((0,c.localStorageGetItem)(yo())||"[]")))}).volatile((()=>({selectedBookmarks:[],selectedAssembliesPre:void 0}))).views((e=>({get bookmarkAssemblies(){return[...new Set(e.bookmarks.map((e=>e.assemblyName)))]},get validAssemblies(){const{assemblyManager:t}=(0,c.getSession)(e);return new Set(this.bookmarkAssemblies.filter((e=>t.get(e))))},get areBookmarksHighlightedOnAllOpenViews(){const{views:t}=(0,c.getSession)(e);return t.every((e=>!("showBookmarkHighlights"in e)||e.showBookmarkHighlights))},get areBookmarksHighlightLabelsOnAllOpenViews(){const{views:t}=(0,c.getSession)(e);return t.every((e=>!("showBookmarkLabels"in e)||e.showBookmarkLabels))}}))).views((e=>({get bookmarksWithValidAssemblies(){return e.bookmarks.filter((t=>e.validAssemblies.has(t.assemblyName)))}}))).views((e=>({get sharedBookmarksModel(){return fo.create({sharedBookmarks:JSON.parse(JSON.stringify(e.selectedBookmarks))})},get allBookmarksModel(){return fo.create({sharedBookmarks:JSON.parse(JSON.stringify(e.bookmarksWithValidAssemblies))})}}))).actions((e=>({setSelectedAssemblies(t){e.selectedAssembliesPre=t}}))).views((e=>({get selectedAssemblies(){return e.selectedAssembliesPre?.filter((t=>e.validAssemblies.has(t)))??[...e.validAssemblies]}}))).actions((e=>({importBookmarks(t){e.bookmarks=(0,d.cast)([...e.bookmarks,...t])},addBookmark(t){e.bookmarks.push(t)},removeBookmark(t){e.bookmarks.splice(t,1)},updateBookmarkLabel(e,t){e.correspondingObj.setLabel(t)},updateBookmarkHighlight(e,t){e.correspondingObj.setHighlight(t)},updateBulkBookmarkHighlights(t){e.selectedBookmarks.forEach((e=>{this.updateBookmarkHighlight(e,t)}))},setSelectedBookmarks(t){e.selectedBookmarks=t},setBookmarkedRegions(t){e.bookmarks=(0,d.cast)(t)},setHighlightToggle(t){const{views:r}=(0,c.getSession)(e);r.forEach((e=>{e.toggleShowBookmarkHighlights?.(t)}))},setLabelToggle(t){const{views:r}=(0,c.getSession)(e);r.forEach((e=>{e.toggleShowBookmarkLabels?.(t)}))}}))).actions((e=>({clearAllBookmarks(){e.setBookmarkedRegions(e.bookmarks.filter((t=>!e.validAssemblies.has(t.assemblyName))))},clearSelectedBookmarks(){for(const t of e.selectedBookmarks)e.bookmarks.remove(t.correspondingObj);e.selectedBookmarks=[]},removeBookmarkObject(t){e.bookmarks.remove(t)}}))).actions((e=>({afterAttach(){const t=yo();function r(r){if(r.key===t){const r=JSON.parse((0,c.localStorageGetItem)(t)||"[]");e.setBookmarkedRegions(r)}}window.addEventListener("storage",r),(0,d.addDisposer)(e,(()=>{window.removeEventListener("storage",r)})),(0,d.addDisposer)(e,(0,ae.autorun)((()=>{(0,c.localStorageSetItem)(t,JSON.stringify(e.bookmarks))})))}}))).postProcessSnapshot((e=>{const{bookmarks:t,...r}=e;return r})),ReactComponent:(0,w.lazy)((()=>Promise.all([r.e(8565),r.e(5676),r.e(5031),r.e(6395),r.e(3199)]).then(r.bind(r,53199))))}))),function(e){e.addToExtensionPoint("LinearGenomeView-TracksContainerComponent",((e,{model:t})=>[...e||[],w.createElement(So,{key:"highlight_grid_bookmark",model:t})])),e.addToExtensionPoint("LinearGenomeView-OverviewScalebarComponent",((e,{model:t,overview:r})=>[...e||[],w.createElement(xo,{key:"overview_highlight_grid_bookmark",model:t,overview:r})]))}(e)})(e),e.addToExtensionPoint("Core-extendPluggableElement",(e=>{if("LinearGenomeView"===e.name){const{stateModel:t}=e,r=t.props({showBookmarkHighlights:!0,showBookmarkLabels:!0}).actions((e=>({toggleShowBookmarkHighlights(t){e.showBookmarkHighlights=void 0!==t?t:!e.showBookmarkHighlights},toggleShowBookmarkLabels(t){e.showBookmarkLabels=void 0!==t?t:!e.showBookmarkLabels},activateBookmarkWidget(){const t=(0,c.getSession)(e);if((0,c.isSessionModelWithWidgets)(t)){let e=t.widgets.get("GridBookmark");return e||(e=t.addWidget("GridBookmarkWidget","GridBookmark")),t.showWidget(e),t.widgets.get("GridBookmark")}throw new Error("Could not open bookmark widget")}}))).actions((e=>({navigateNewestBookmark(){const t=(0,c.getSession)(e),r=e.activateBookmarkWidget();r.bookmarks.length?e.navTo(r.bookmarks.at(-1)):t.notify("There are no recent bookmarks to navigate to.","info")},bookmarkCurrentRegion(){if(e.id===(0,c.getSession)(e).focusedViewId){const t=e.getSelectedRegions(void 0,void 0),r=e.activateBookmarkWidget();if(!t.length)throw new Error("no region selected");r.addBookmark(t[0])}}}))).views((e=>{const t=e.menuItems,r=e.rubberBandMenuItems;return{menuItems:()=>[...t(),{type:"divider"},{label:"Bookmarks",icon:po.A,subMenu:[{label:"Open bookmark widget",icon:po.A,onClick:()=>e.activateBookmarkWidget()},{label:"Bookmark current region",icon:uo.A,onClick:()=>{e.bookmarkCurrentRegion()}},{label:"Toggle bookmark highlights",icon:mo.A,type:"checkbox",checked:e.showBookmarkHighlights,onClick:()=>{e.toggleShowBookmarkHighlights()}},{label:"Toggle bookmark labels",icon:go.A,type:"checkbox",checked:e.showBookmarkLabels,onClick:()=>{e.toggleShowBookmarkLabels()}}]}],rubberBandMenuItems:()=>[...r(),{label:"Bookmark region",icon:uo.A,onClick:()=>{const{leftOffset:t,rightOffset:r}=e,n=e.getSelectedRegions(t,r),a=e.activateBookmarkWidget();if(!n.length)throw new Error("no regions selected");a.addBookmark(n[0])}}]}})).actions((e=>({afterCreate(){document.addEventListener("keydown",(t=>{const r=(t.ctrlKey||t.metaKey)&&t.shiftKey;r&&"KeyD"===t.code&&(t.preventDefault(),e.activateBookmarkWidget(),e.bookmarkCurrentRegion(),(0,c.getSession)(e).notify("Bookmark created.","success")),r&&"KeyM"===t.code&&(t.preventDefault(),e.navigateNewestBookmark())}))}})));e.stateModel=r}return e}))}configure(e){(0,c.isAbstractMenuManager)(e.rootModel)&&e.rootModel.appendToMenu("Tools",{label:"Bookmarks",icon:po.A,onClick:e=>{let t=e.widgets.get("GridBookmark");t||(t=e.addWidget("GridBookmarkWidget","GridBookmark")),e.showWidget(t)}})}}const Mo=[Ln,Rt.Ay,n.Ay,G,Y,ge.Ay,he.Ay,Te.A,gt,ft,wt,St,Et,Jt,ar,Ir,Or,tn,Dn.A,Bn.Ay,On,Na,Ja,me,so,co,Po,ke,wr]},52404:()=>{}}]);
15 //# sourceMappingURL=6837.a706c464.chunk.js.map