"use strict";(self.webpackChunkastronbs=self.webpackChunkastronbs||[]).push([[763],{763:(o,e,t)=>{t.r(e),t.d(e,{default:()=>i});var a=t(829),n=t(306),s=t(194),r=t(512),c=t(655),l=t(12),m=t(322);async function p(o="",e={}){const t=m.ServerConnection.makeSettings(),a=l.URLExt.join(t.baseUrl,"astronbs",o);let n;try{n=await m.ServerConnection.makeRequest(a,e,t)}catch(o){throw new m.ServerConnection.NetworkError(o)}let s=await n.text();if(s.length>0)try{s=JSON.parse(s)}catch(o){console.log("Not a JSON response body.",n)}if(!n.ok)throw new m.ServerConnection.ResponseError(n,s.message||s);return s}const d={id:"astronbs:plugin",autoStart:!0,optional:[a.ISettingRegistry,r.ILauncher,n.IFileBrowserFactory,s.IDocumentManager],activate:(o,e,t,a,n)=>{console.log("JupyterLab extension astronbs is activated!"),e&&e.load(d.id).then((o=>{console.log("astronbs settings loaded:",o.composite)})).catch((o=>{console.error("Failed to load settings for astronbs.",o)})),o.commands.addCommand("astronbs:reduction_template",{execute:()=>{const o=p("reduction_template",{body:JSON.stringify({path:a.defaultBrowser.model.path,package_path:"astronbs.notebooks",nb_name:"reduction_template.ipynb"}),method:"POST"});console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"Reduction Template"}),o.commands.addCommand("astronbs:reprojection_template",{execute:()=>{const o=p("reprojection_template",{body:JSON.stringify({path:a.defaultBrowser.model.path}),method:"POST"});console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"Reprojection Template"}),o.commands.addCommand("astronbs:light_combo_template",{execute:()=>{const o=p("light_combo_template",{body:JSON.stringify({path:a.defaultBrowser.model.path}),method:"POST"});console.log("I am back in open2"),console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"Light Combo Template"}),o.commands.addCommand("astronbs:01_seeing_profile",{execute:()=>{const o=p("nb_make",{body:JSON.stringify({path:a.defaultBrowser.model.path,package_path:"stellarphot.notebooks.photometry",nb_name:"01-viewer-seeing-template.ipynb"}),method:"POST"});console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"01 Seeing Profile"}),o.commands.addCommand("astronbs:02_comp_stars",{execute:()=>{const o=p("nb_make",{body:JSON.stringify({path:a.defaultBrowser.model.path,package_path:"stellarphot.notebooks.photometry",nb_name:"02-comp-star-plotter-template.ipynb"}),method:"POST"});console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"02 Comparison Stars"}),o.commands.addCommand("astronbs:03_do_photometry",{execute:()=>{const o=p("nb_make",{body:JSON.stringify({path:a.defaultBrowser.model.path,package_path:"stellarphot.notebooks.photometry",nb_name:"03-photometry-template.ipynb"}),method:"POST"});console.log(o),o.then((o=>{console.log(o),n&&n.open(o.path)}))},icon:c.imageIcon,label:"03 Do photometry"}),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}),t.add({command:"astronbs:01_seeing_profile",category:"Photometry",rank:0}),t.add({command:"astronbs:02_comp_stars",category:"Photometry",rank:0}),t.add({command:"astronbs:03_do_photometry",category:"Photometry",rank:0})),p("get_example").then((o=>{console.log(o)})).catch((o=>{console.error(`The astronbs server extension appears to be missing.\n${o}`)}))}},i=d}}]);