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