"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[3017],{33017:function(e,n,r){r.r(n),r.d(n,{default:function(){return E}});var t=r(96234),i=r(96902),s=r(36897),o=r(4782),a=r(27664),l=r(20893),c=r(66379),d=r(6880),u=r(91188),h=r(54896),g=r(29938),x=(0,u.ZL)()((function(e){return{paper:{overflowY:"auto",height:"100%",zIndex:e.zIndex.drawer,outline:"none",background:e.palette.background.default},resizeHandle:{width:4,position:"fixed",top:0,zIndex:e.zIndex.drawer+1}}}));var v=(0,o.observer)((function(e){var n=e.children,r=e.session,t=r.drawerPosition,i=r.drawerWidth,s=x().classes;return(0,g.jsxs)(d.Z,{className:s.paper,elevation:16,square:!0,children:["right"===t?(0,g.jsx)(h.Z,{onDrag:r.resizeDrawer,className:s.resizeHandle,vertical:!0}):null,n,"left"===t?(0,g.jsx)(h.Z,{onDrag:r.resizeDrawer,className:s.resizeHandle,style:{left:i},vertical:!0}):null]})})),f=r(68079),j=r(19459),p=r(82658),w=r(13655),m=r(33266),Z=r(35388),b=r(15996),C=r(25322),k=r(50543),y=r(5966),W=r(31946),z=r(47057),D=r(21630),H=r(38238),T=(0,u.ZL)()((function(e){return{formControl:{margin:0},spacer:{flexGrow:1},drawerSelect:{margin:0,color:e.palette.secondary.contrastText},dropDownIcon:{color:e.palette.secondary.contrastText},header:{background:e.palette.secondary.main}}})),N=(0,o.observer)((function(e){var n=e.session,r=e.setToolbarHeight,t=T().classes;return(0,g.jsx)(j.Z,{position:"sticky",className:t.header,ref:function(e){return r((null===e||void 0===e?void 0:e.getBoundingClientRect().height)||0)},children:(0,g.jsxs)(p.Z,{disableGutters:!0,children:[(0,g.jsx)(I,{session:n}),(0,g.jsx)("div",{className:t.spacer}),(0,g.jsx)(S,{session:n})]})})})),I=(0,o.observer)((function(e){var n=e.session,r=n.visibleWidget,t=n.activeWidgets,i=T().classes,s=(0,a.getEnv)(n).pluginManager;return(0,g.jsx)(w.Z,{className:i.formControl,children:(0,g.jsx)(m.Z,{value:null===r||void 0===r?void 0:r.id,"data-testid":"widget-drawer-selects",className:i.drawerSelect,classes:{icon:i.dropDownIcon},renderValue:function(e){var r=n.activeWidgets.get(e);if(!r)return(0,g.jsx)(Z.Z,{variant:"h6",color:"inherit",children:"Unknown widget"});var t=s.getWidgetType(r.type),i=t.HeadingComponent,o=t.heading;return i?(0,g.jsx)(i,{model:r}):(0,g.jsx)(Z.Z,{variant:"h6",color:"inherit",children:o})},onChange:function(e){var r=n.activeWidgets.get(e.target.value);r?n.showWidget(r):n.notify("Widget not found ".concat(e.target.value),"warning")},children:(0,f.Z)(t.values()).map((function(e){var r=s.getWidgetType(e.type),t=r.HeadingComponent,i=r.heading;return(0,g.jsxs)(b.Z,{"data-testid":"widget-drawer-selects-item-".concat(e.type),value:e.id,children:[t?(0,g.jsx)(t,{model:e}):(0,g.jsx)(Z.Z,{variant:"h6",color:"inherit",children:i}),(0,g.jsx)(C.Z,{"data-testid":"".concat(e.type,"-drawer-delete"),color:"inherit","aria-label":"Delete",onClick:function(){return n.hideWidget(e)},children:(0,g.jsx)(W.Z,{})})]},e.id)}))})})})),S=(0,o.observer)((function(e){var n=e.session,r=(0,i.useState)(null),s=(0,t.Z)(r,2),o=s[0],a=s[1],l=n.drawerPosition,c=n.visibleWidget;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(C.Z,{color:"inherit",onClick:function(e){return a(e.currentTarget)},children:(0,g.jsx)(H.Z,{})}),(0,g.jsx)(k.Z,{title:"Minimize drawer",children:(0,g.jsx)(C.Z,{"data-testid":"drawer-minimize",color:"inherit",onClick:function(){n.notify("Drawer minimized, click button on ".concat(l," side of screen to re-open"),"info"),n.minimizeWidgetDrawer()},children:(0,g.jsx)(D.Z,{})})}),(0,g.jsx)(k.Z,{title:"Close drawer",children:(0,g.jsx)(C.Z,{color:"inherit",onClick:function(){return n.hideWidget(c)},children:(0,g.jsx)(z.Z,{})})}),(0,g.jsx)(y.Z,{anchorEl:o,open:Boolean(o),onClose:function(){return a(null)},children:["left","right"].map((function(e){return(0,g.jsx)(b.Z,{selected:"option"===l,onClick:function(){n.setDrawerPosition(e),a(null)},children:e},e)}))})]})})),E=(0,o.observer)((function(e){var n=e.session,r=n.visibleWidget,o=(0,a.getEnv)(n).pluginManager,d=r?o.evaluateExtensionPoint("Core-replaceWidget",o.getWidgetType(r.type).ReactComponent,{session:n,model:r}):null,u=(0,i.useState)(0),h=(0,t.Z)(u,2),x=h[0],f=h[1];return(0,g.jsxs)(v,{session:n,children:[(0,g.jsx)(N,{session:n,setToolbarHeight:f}),(0,g.jsx)(i.Suspense,{fallback:(0,g.jsx)(l.Z,{}),children:(0,g.jsx)(s.SV,{FallbackComponent:function(e){var n=e.error;return(0,g.jsx)(c.Z,{error:n})},children:d?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d,{model:r,session:n,toolbarHeight:x}),(0,g.jsx)("div",{style:{height:300}})]}):null})})]})}))}}]);
//# sourceMappingURL=3017.c3df85c4.chunk.js.map