"use strict";(self.webpackChunk_jupyter_shared_docprovider_extension=self.webpackChunk_jupyter_shared_docprovider_extension||[]).push([[612],{4612:(e,t,r)=>{r.r(t),r.d(t,{default:()=>I});var o=r(5256),i=r(7460),a=r(7909),n=r(2200),l=r(7313),s=r(4614),d=r(2678),c=r(2697),u=r(5190),p=r(1937);const v={id:"@jupyter/docprovider-extension:drive",description:"The default collaborative drive provider",provides:u.ICollaborativeDrive,requires:[l.IDefaultFileBrowser],optional:[d.ITranslator],activate:(e,t,r)=>{const o=(r=null!=r?r:d.nullTranslator).load("jupyter-shared-drive");return new p.SharedDrive(e.serviceManager.user,t,o,null,"Shared")}},h={id:"@jupyter/shared-docprovider-extension:yfile",description:"Plugin to register the shared model factory for the content type 'file'",autoStart:!0,requires:[u.ICollaborativeDrive],optional:[],activate:(e,t)=>{t.sharedModelFactory.registerDocumentFactory("file",(()=>new c.YFile))}},y={id:"@jupyter/shared-docprovider-extension:ynotebook",description:"Plugin to register the shared model factory for the content type 'notebook'",autoStart:!0,requires:[u.ICollaborativeDrive],optional:[s.ISettingRegistry],activate:(e,t,r)=>{let o=!0;r&&r.load("@jupyterlab/notebook-extension:tracker").then((e=>{const t=e=>{var t;const r=null==e?void 0:e.get("experimentalEnableDocumentWideUndoRedo").composite;o=null===(t=!r)||void 0===t||t};t(e),e.changed.connect((e=>t(e)))})),t.sharedModelFactory.registerDocumentFactory("notebook",(()=>new c.YNotebook({disableDocumentWideUndoRedo:o})))}},b={id:"jupyter-shared-drive:sharedFileBrowser",description:"The shared file browser factory provider",autoStart:!0,requires:[u.ICollaborativeDrive,l.IFileBrowserFactory],optional:[a.IRouter,a.JupyterFrontEnd.ITreeResolver,a.ILabShell,d.ITranslator],activate:async(e,t,r,o,a,l,s)=>{const{createFileBrowser:c}=r,u=(s=null!=s?s:d.nullTranslator).load("jupyter-shared-drive");e.serviceManager.contents.addDrive(t);const p=c("jp-shared-contents-browser",{driveName:t.name,restore:!1});p.title.caption=u.__("Shared Drive"),p.title.icon=i.listIcon;const v=new n.ToolbarButton({icon:i.fileIcon,onClick:async()=>{const e=n.Dialog.okButton({label:u.__("Import"),accept:!0}),r=await(0,n.showDialog)({title:u.__("Import File…"),body:new f(""),buttons:[n.Dialog.cancelButton(),e]}).then((e=>{var t;if(e.button.accept)return null!==(t=e.value)&&void 0!==t?t:void 0}));if(r)try{await t.importFile(r,p.model.path)}catch(e){await(0,n.showErrorMessage)(u.__("File Import Error for %1",r),e)}},tooltip:"Import File"}),h=new n.ToolbarButton({icon:i.refreshIcon,onClick:async()=>{p.model.refresh()},tooltip:"Refresh File Browser"});p.toolbar.insertItem(0,"refresh",h),p.toolbar.insertItem(1,"import",v),e.shell.add(p,"left")}};class f extends o.Widget{constructor(e){super({node:m(e)})}getValue(){return this.node.value}}function m(e){const t=document.createElement("input");return t.value=e,t}const I=[v,h,y,b]}}]);