"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(9560),t=a(3993),n=a(7980),s=a(8772),i=a(484),l=a(1689),c=a(186),d=a(2826),u=a(4918),p=a(5256),m=a(8636),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(o);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("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")})}},_]}}]);