"use strict";(self.webpackChunk_elyra_r_editor_extension=self.webpackChunk_elyra_r_editor_extension||[]).push([[509],{6238:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.REditor=void 0;const o=r(4196),a=r(792);class n extends o.ScriptEditor{constructor(e){super(e)}getLanguage(){return"R"}getIcon(){return a.rIcon}}t.REditor=n},8509:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=r(4196),a=r(792),n=r(5607),c=r(9246),i=r(8745),d=r(7931),s=r(6176),l=r(8213),m=r(9723),p=r(2912),u=r(6238),g="R Editor",y="elyra-r-script-editor-extension",h="script-editor:create-new-r-editor",f="docmanager:open",w={id:y,autoStart:!0,requires:[i.IEditorServices,s.IEditorTracker,c.ICommandPalette,p.ISettingRegistry,d.IFileBrowserFactory],optional:[n.ILayoutRestorer,m.IMainMenu,l.ILauncher],activate:(e,t,r,n,i,d,s,l,m)=>{console.log("Elyra - r-editor extension is activated!");const p=new o.ScriptEditorWidgetFactory({editorServices:t,factoryOptions:{name:g,fileTypes:["r"],defaultFor:["r"]},instanceCreator:e=>new u.REditor(e)});e.docRegistry.addFileType({name:"r",displayName:"R File",extensions:[".r"],pattern:".*\\.r$",mimeTypes:["text/x-rsrc"],icon:a.rIcon});const{restored:w}=e,x=new c.WidgetTracker({namespace:y});let E={};s&&s.restore(x,{command:f,args:e=>({path:e.context.path,factory:g}),name:e=>e.context.path});const I=t=>{E=Object.assign({},t.get("editorConfig").composite),e.commands.notifyCommandChanged()},R=()=>{x.forEach((e=>{_(e)}))},_=e=>{r.has(e)||r.add(e);const t=e.content.editor,o=E||{};Object.keys(o).forEach((e=>{const r=o[e];void 0!==r&&t.setOption(e,r)}))};Promise.all([i.load("@jupyterlab/fileeditor-extension:plugin"),w]).then((([e])=>{I(e),R(),e.changed.connect((()=>{I(e),R()}))})).catch((e=>{console.error(e.message),R()})),e.docRegistry.addWidgetFactory(p),p.widgetCreated.connect(((e,t)=>{x.add(t),t.context.pathChanged.connect((()=>{x.save(t)})),_(t)})),x.widgetAdded.connect(((e,t)=>{_(t)})),m&&m.add({command:h,category:"Elyra",rank:5}),l&&l.fileMenu.newMenu.addGroup([{command:h,args:{isMenu:!0}}],93),e.commands.addCommand(h,{label:e=>e.isPalette?"New R Editor":"R Editor",caption:"Create a new R Editor",icon:e=>e.isPalette?void 0:a.rIcon,execute:t=>{const r=d.createFileBrowser("myFileBrowser");return o=t.cwd?String(t.cwd):r.model.path,e.commands.execute("docmanager:new-untitled",{path:o,type:"file",ext:".r"}).then((t=>e.commands.execute(f,{path:t.path,factory:g})));var o}}),n.addItem({command:h,args:{isPalette:!0},category:"Elyra"})}};t.default=w}}]);