"use strict";(self.webpackChunk_jupyter_collaboration_extension=self.webpackChunk_jupyter_collaboration_extension||[]).push([[842],{4842:(e,r,a)=>{a.r(r),a.d(r,{default:()=>I});var o=a(8805),t=a(2564),n=a(6593),s=a(5681),i=a(6249),l=a(8708),c=a(5955),d=a(4947),u=a(4503),p=a(5256),m=a(5653),b=a(2206),y=a(7784);const w={id:"@jupyter/collaboration-extension:userMenu",description:"Provide connected user menu.",requires:[],provides:m.IUserMenu,activate:e=>{const{commands:r}=e,{user:a}=e.serviceManager;return new m.UserMenu({commands:r,user:a})}},v={id:"@jupyter/collaboration-extension:user-menu-bar",description:"Add user menu to the interface.",autoStart:!0,requires:[m.IUserMenu,o.IToolbarWidgetRegistry],activate:async(e,r,a)=>{const{user:o}=e.serviceManager,t=new p.MenuBar({forceItemsPosition:{forceX:!1,forceY:!1},renderer:new m.RendererUserMenu(o)});t.id="jp-UserMenu",o.userChanged.connect((()=>t.update())),t.addMenu(r),a.addFactory("TopBar","user-menu",(()=>t))}},g={id:"@jupyter/collaboration-extension:rtcGlobalAwareness",description:"Add global awareness to share working document of users.",requires:[d.IStateDB],provides:n.IGlobalAwareness,activate:(e,r)=>{const{user:a}=e.serviceManager,o=new b.Doc,t=new y.ww(o),n=c.ServerConnection.makeSettings(),i=l.URLExt.join(n.wsUrl,"api/collaboration/room");return new s.WebSocketAwarenessProvider({url:i,roomID:"JupyterLab:globalAwareness",awareness:t,user:a}),r.changed.connect((async()=>{var e,a;const o=(null===(a=null===(e=(await r.toJSON())["layout-restorer:data"])||void 0===e?void 0:e.main)||void 0===a?void 0:a.current)||"";o.match(/^\w+:.+/)?t.setLocalStateField("current",o):t.setLocalStateField("current",null)})),t}},h={id:"@jupyter/collaboration-extension:rtcPanel",description:"Add side panel to display all currently connected users.",autoStart:!0,requires:[n.IGlobalAwareness],optional:[u.ITranslator],activate:(e,r,a)=>{const{user:o}=e.serviceManager,t=(null!=a?a:u.nullTranslator).load("jupyter_collaboration"),n=new i.SidePanel({alignment:"justify"});n.id="jp-collaboration-panel",n.title.icon=i.usersIcon,n.title.caption=t.__("Collaboration"),n.addClass("jp-RTCPanel"),e.shell.add(n,"left",{rank:300});const s=new m.UserInfoPanel({userManager:o,trans:t});s.title.label=t.__("User info"),s.title.caption=t.__("User information"),n.addWidget(s);const l=new m.CollaboratorsPanel(o,r,(r=>{e.commands.execute("docmanager:open",{path:r})}),e.docRegistry);l.title.label=t.__("Online Collaborators"),n.addWidget(l)}},_={id:"@jupyter/collaboration-extension:userEditorCursors",description:"Add CodeMirror extension to display remote user cursors and selections.",autoStart:!0,requires:[t.IEditorExtensionRegistry],activate:(e,r)=>{r.addExtension({name:"remote-user-cursors",factory(e){const{awareness:r,ysource:a}=e.model.sharedModel;return t.EditorExtensionRegistry.createImmutableExtension((0,m.remoteUserCursors)({awareness:r,ytext:a}))}})}};var x;!function(e){e.share="collaboration:shared-link"}(x||(x={}));const I=[w,v,g,h,{id:"@jupyter/collaboration-extension:shared-link",autoStart:!0,optional:[o.ICommandPalette,u.ITranslator],activate:async(e,r,a)=>{const{commands:t}=e,n=(null!=a?a:u.nullTranslator).load("jupyter_collaboration");t.addCommand(x.share,{label:n.__("Generate a Shared Link"),icon:i.shareIcon,execute:async()=>{const e=await(0,m.showSharedLinkDialog)({translator:a});e.button.accept&&e.value&&o.Clipboard.copyToSystem(e.value)}}),r&&r.addItem({command:x.share,category:n.__("Server")})}},_]}}]);