"use strict";(self.webpackChunk_elyra_metadata_extension=self.webpackChunk_elyra_metadata_extension||[]).push([[509],{8509:function(e,t,a){var n=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(i,d){function s(e){try{l(n.next(e))}catch(e){d(e)}}function o(e){try{l(n.throw(e))}catch(e){d(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=a(21657),d=a(72451),s=a(86427),o=a(87909),l=a(12200),c=a(40131),r=a(2678),m=a(87460),u=a(64053),p="elyra-metadata-editor",h="elyra-metadata",f="@elyra/metadata-extension",y="elyra-metadata:open",g={id:h,autoStart:!0,requires:[l.ICommandPalette,c.IEditorServices,o.ILabStatus,m.IFormRendererRegistry,r.ITranslator],activate:(e,t,a,o,c,r)=>n(void 0,void 0,void 0,(function*(){console.log("Elyra - metadata extension is activated!"),c.addRenderer(`${f}:plugin.code`,{fieldRenderer:e=>(0,s.CodeBlock)(e)}),c.addRenderer(`${f}:plugin.tags`,{fieldRenderer:e=>(0,s.TagsField)(e)}),c.addRenderer(`${f}:plugin.dropdown`,{fieldRenderer:e=>(0,s.DropDown)(e)}),c.addRenderer(`${f}:plugin.password`,{fieldRenderer:e=>(0,s.PasswordField)(e)}),e.commands.addCommand(`${p}:open`,{label:e=>`New ${e.title} ${e.appendToTitle?e.titleContext:""}`,execute:t=>{(t=>{let n;n=t.name?t.name:`New ${t.schema}`;const d=`${p}:${t.schemaspace}:${t.schema}:${t.name?t.name:"new"}`;if((0,u.find)(e.shell.widgets("main"),((e,t)=>e.id===d)))return void e.shell.activateById(d);const s=new i.MetadataEditorWidget(Object.assign(Object.assign({},t),{schemaName:t.schema,editorServices:a,status:o,translator:r.load("jupyterlab"),componentRegistry:c})),h=new l.MainAreaWidget({content:s});h.title.label=n,h.id=d,h.title.closable=!0,h.title.icon=m.textEditorIcon,s.addClass(p),e.shell.add(h,"main")})(t)}});const n=y;e.commands.addCommand(n,{label:e=>e.label,execute:t=>{(t=>{const a=m.LabIcon.resolve({icon:t.icon}),n=`${h}:${t.schemaspace}`,d=new i.MetadataWidget({app:e,display_name:t.display_name,schemaspace:t.schemaspace,icon:a});d.id=n,d.title.icon=a,d.title.caption=t.display_name,void 0===(0,u.find)(e.shell.widgets("left"),(e=>e.id===n))&&e.shell.add(d,"left",{rank:1e3}),e.shell.activateById(n)})(t)}});const g="elyra-metadata:close";e.commands.addCommand(g,{label:"Close Tab",execute:t=>{const a=e.contextMenuHitTest((e=>!!e.dataset.id));if(a){const t=a.dataset.id,n=(0,u.find)(e.shell.widgets("left"),((e,a)=>e.id===t));n&&n.dispose()}}}),e.contextMenu.addItem({selector:'[data-id^="elyra-metadata:"]:not([data-id$="code-snippets"]):not([data-id$="runtimes"])',command:g});try{const e=yield d.MetadataService.getAllSchema();for(const a of e){let e="ui-components:text-editor",n=a.title;a.uihints&&(a.uihints.icon&&(e=a.uihints.icon),a.uihints.title&&(n=a.uihints.title)),t.addItem({command:y,args:{label:`Manage ${n}`,display_name:a.uihints.title,schemaspace:a.schemaspace,icon:e},category:"Elyra"})}}catch(e){s.RequestErrors.serverError(e)}}))};t.default=g}}]);