"use strict";(self.webpackChunkastronbs=self.webpackChunkastronbs||[]).push([[763],{763:(e,o,t)=>{t.r(o),t.d(o,{default:()=>g});var n=t(87),a=t(341),s=t(101),r=t(944),c=t(822),i=t(524),l=t(608);async function d(e="",o={}){const t=l.ServerConnection.makeSettings(),n=i.URLExt.join(t.baseUrl,"astronbs",e);let a;try{a=await l.ServerConnection.makeRequest(n,o,t)}catch(e){throw new l.ServerConnection.NetworkError(e)}let s=await a.text();if(s.length>0)try{s=JSON.parse(s)}catch(e){console.log("Not a JSON response body.",a)}if(!a.ok)throw new l.ServerConnection.ResponseError(a,s.message||s);return s}const p={id:"astronbs:plugin",autoStart:!0,optional:[n.ISettingRegistry,r.ILauncher,a.IFileBrowserFactory,s.IDocumentManager],activate:(e,o,t,n,a)=>{console.log("JupyterLab extension astronbs is activated!"),o&&o.load(p.id).then((e=>{console.log("astronbs settings loaded:",e.composite)})).catch((e=>{console.error("Failed to load settings for astronbs.",e)})),e.commands.addCommand("astronbs:reduction_template",{execute:()=>{const e=d("reduction_template",{body:JSON.stringify({path:n.defaultBrowser.model.path}),method:"POST"});console.log("I am back in open2"),console.log(e),e.then((e=>{console.log(e),a&&a.open(e.path)}))},icon:c.imageIcon,label:"Reduction Template"}),t&&t.add({command:"astronbs:reduction_template",category:"Astro",rank:0}),d("get_example").then((e=>{console.log(e)})).catch((e=>{console.error(`The astronbs server extension appears to be missing.\n${e}`)}))}},g=p}}]);