"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[9],{70009:function(e,r,s){s.r(r);var n=s(32723),t=s(34795),a=s(96234),o=s(30969),c=s(40909),i=s(90550),u=s(59767),l=s(87006),h=s(59071),d=s(72807),f=s(94551),p=s(33359),x=s(96074),w=s(72097),Z=s(34760),j=s.n(Z),v=s(64934),S=s(14079),b=s(22417),k=s(48785),C=s(15688),g=s(84730),m=s(37574),L=(0,o.lazy)((function(){return s.e(6096).then(s.bind(s,16096))}));function y(e){var r=e.url;return(0,m.jsx)(l.Z,{label:"URL",value:r,InputProps:{readOnly:!0},variant:"filled",fullWidth:!0,onClick:function(e){e.target.select()}})}var R=(0,i.observer)((function(e){var r=e.handleClose,s=e.session,i=(0,o.useState)(""),l=(0,a.Z)(i,2),Z=l[0],R=l[1],U=(0,o.useState)(""),P=(0,a.Z)(U,2),I=P[0],V=P[1],B=(0,o.useState)(""),D=(0,a.Z)(B,2),J=D[0],_=D[1],z=(0,o.useState)(""),M=(0,a.Z)(z,2),E=M[0],F=M[1],N=(0,o.useState)(!0),O=(0,a.Z)(N,2),Q=O[0],W=O[1],A=(0,o.useState)(),G=(0,a.Z)(A,2),Y=G[0],q=G[1],H=(0,o.useState)(!1),K=(0,a.Z)(H,2),T=K[0],X=K[1],$=(0,v.useQueryParam)("password",v.StringParam),ee=(0,a.Z)($,2)[1],re=(0,v.useQueryParam)("session",v.StringParam),se=(0,a.Z)(re,2)[1],ne=s.shareURL,te=localStorage.getItem("jbrowse-shareURL")||"short",ae=(0,c.getSnapshot)(s);return(0,o.useEffect)((function(){var e=!1;return(0,t.Z)((0,n.Z)().mark((function r(){var t,a,o,i,u,l;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"short"!==te){r.next=10;break}return W(!0),t=new URL(window.location.href),r.next=6,(0,g.p)(ae,ne,t.href);case 6:a=r.sent,e||((o=new URLSearchParams(t.search)).set("session","share-".concat(a.json.sessionId)),o.set("password",a.password),t.search=o.toString(),_(t.href),R("share-".concat(a.json.sessionId)),V(a.password)),r.next=19;break;case 10:return r.next=12,(0,C.JY)(JSON.stringify((0,c.getSnapshot)(s)));case 12:i=r.sent,u=new URL(window.location.href),(l=new URLSearchParams(u.search)).set("session","encoded-".concat(i)),R("encoded-".concat(i)),u.search=l.toString(),e||F(u.toString());case 19:r.next=24;break;case 21:r.prev=21,r.t0=r.catch(0),q(r.t0);case 24:return r.prev=24,W(!1),r.finish(24);case 27:case"end":return r.stop()}}),r,null,[[0,21,24,27]])})))(),function(){e=!0}}),[te,s,ne,ae]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(u.Dialog,{maxWidth:"xl",open:!0,onClose:r,title:"JBrowse Shareable Link",children:[(0,m.jsxs)(h.Z,{children:[(0,m.jsxs)(d.Z,{children:["Copy the URL below to share your current JBrowse session.",(0,m.jsx)(f.Z,{onClick:function(){return X(!0)},children:(0,m.jsx)(S.Z,{})})]}),"short"===te?Y?(0,m.jsx)(u.ErrorMessage,{error:Y}):Q?(0,m.jsx)(p.Z,{children:"Generating short URL..."}):(0,m.jsx)(y,{url:J}):(0,m.jsx)(y,{url:E})]}),(0,m.jsxs)(x.Z,{children:[(0,m.jsx)(w.Z,{startIcon:(0,m.jsx)(k.Z,{}),disabled:"short"===te&&Q,onClick:function(e){e.preventDefault(),ee(I),se(Z),alert("Now press Ctrl+D (PC) or Cmd+D (Mac)")},children:"Bookmark"}),(0,m.jsx)(w.Z,{onClick:function(){j()(J||E),s.notify("Copied to clipboard","success")},startIcon:(0,m.jsx)(b.pt,{}),disabled:"short"===te&&Q,children:"Copy to Clipboard"}),(0,m.jsx)(w.Z,{onClick:r,autoFocus:!0,children:"Close"})]})]}),(0,m.jsx)(L,{open:T,onClose:function(){return X(!1)},currentSetting:te})]})}));r.default=R},48785:function(e,r,s){var n=s(71600);r.Z=void 0;var t=n(s(48035)),a=s(37574),o=(0,t.default)((0,a.jsx)("path",{d:"M21 7h-2v2h-2V7h-2V5h2V3h2v2h2v2zm-2 14-7-3-7 3V5c0-1.1.9-2 2-2h7c-.63.84-1 1.87-1 3 0 2.76 2.24 5 5 5 .34 0 .68-.03 1-.1V21z"}),"BookmarkAdd");r.Z=o}}]);
//# sourceMappingURL=9.645cd9f2.chunk.js.map