"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[2311],{22311:(e,n,t)=>{t.r(n),t.d(n,{default:()=>m});var a=t(89965),o=t(23450),i=t(17994),s=t(6513),l=t(98836),d=t(14039);const r="@jupyterlab/extensionmanager-extension:plugin";var c;!function(e){e.showPanel="extensionmanager:show-panel",e.toggle="extensionmanager:toggle"}(c||(c={}));const g={id:r,autoStart:!0,requires:[s.ISettingRegistry],optional:[l.ITranslator,a.ILayoutRestorer,o.ICommandPalette],activate:async(e,n,t,a,o)=>{const{commands:s,shell:m,serviceManager:b}=e,h=(t=null!=t?t:l.nullTranslator).load("jupyterlab"),_=new i.ListModel(b,t),E=()=>{const e=new i.ExtensionsPanel({model:_,translator:t});return e.id="extensionmanager.main-view",e.title.icon=d.extensionIcon,e.title.caption=h.__("Extension Manager"),e.node.setAttribute("role","region"),e.node.setAttribute("aria-label",h.__("Extension Manager section")),a&&a.add(e,e.id),m.add(e,"left",{rank:1e3}),e};let p=E();Promise.all([e.restored,n.load(r)]).then((([,n])=>{_.isDisclaimed=n.get("disclaimed").composite,_.isEnabled=n.get("enabled").composite,_.stateChanged.connect((()=>{_.isDisclaimed!==n.get("disclaimed").composite&&n.set("disclaimed",_.isDisclaimed).catch((e=>{console.error(`Failed to set setting 'disclaimed'.\n${e}`)})),_.isEnabled!==n.get("enabled").composite&&n.set("enabled",_.isEnabled).catch((e=>{console.error(`Failed to set setting 'enabled'.\n${e}`)}))})),_.isEnabled?p=null!=p?p:E():(null==p||p.dispose(),p=null),n.changed.connect((async()=>{if(_.isDisclaimed=n.get("disclaimed").composite,_.isEnabled=n.get("enabled").composite,e.commands.notifyCommandChanged(c.toggle),_.isEnabled){if(!(null!==p&&p.isAttached||await u.showWarning(h)))return void n.set("enabled",!1);p=null!=p?p:E()}else null==p||p.dispose(),p=null}))})).catch((e=>{console.error(`Something went wrong when reading the settings.\n${e}`)})),s.addCommand(c.showPanel,{label:h.__("Extension Manager"),execute:()=>{p&&m.activateById(p.id)},isVisible:()=>_.isEnabled}),s.addCommand(c.toggle,{label:h.__("Enable Extension Manager"),execute:()=>{n&&n.set(g.id,"enabled",!_.isEnabled)},isToggled:()=>_.isEnabled}),o&&o.addItem({command:c.toggle,category:h.__("Extension Manager")})}},m=g;var u;!function(e){e.showWarning=async function(e){return(await(0,o.showDialog)({title:e.__("Enable Extension Manager?"),body:e.__("Thanks for trying out JupyterLab's extension manager.\nThe JupyterLab development team is excited to have a robust\nthird-party extension community.\nHowever, we cannot vouch for every extension,\nand some may introduce security risks.\nDo you want to continue?"),buttons:[o.Dialog.cancelButton({label:e.__("Disable")}),o.Dialog.warnButton({label:e.__("Enable")})]})).button.accept}}(u||(u={}))}}]);