"use strict";(self.webpackChunkastronbs=self.webpackChunkastronbs||[]).push([[763],{763:(e,o,t)=>{t.r(o),t.d(o,{default:()=>p});var n=t(829),a=t(306),s=t(194),r=t(512),c=t(655),l=t(12),i=t(322);async function m(e="",o={}){const t=i.ServerConnection.makeSettings(),n=l.URLExt.join(t.baseUrl,"astronbs",e);let a;try{a=await i.ServerConnection.makeRequest(n,o,t)}catch(e){throw new i.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 i.ServerConnection.ResponseError(a,s.message||s);return s}const d={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(d.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=m("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"}),e.commands.addCommand("astronbs:reprojection_template",{execute:()=>{const e=m("reprojection_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:"Reprojection Template"}),e.commands.addCommand("astronbs:light_combo_template",{execute:()=>{const e=m("light_combo_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:"Light Combo Template"}),t&&(t.add({command:"astronbs:reduction_template",category:"Astro",rank:0}),t.add({command:"astronbs:reprojection_template",category:"Astro",rank:10}),t.add({command:"astronbs:light_combo_template",category:"Astro",rank:20})),m("get_example").then((e=>{console.log(e)})).catch((e=>{console.error(`The astronbs server extension appears to be missing.\n${e}`)}))}},p=d}}]);