(self.webpackChunkpyesasky=self.webpackChunkpyesasky||[]).push([[209],{209:(e,t,s)=>{"use strict";s.r(t),s.d(t,{ESASkyJSModel:()=>o,ESASkyJSView:()=>l,default:()=>n,version:()=>a});var i=s(449),d=s(983);class o extends i.DOMWidgetModel{initialize(e,t){super.initialize(e,t)}defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ESASkyJSModel",_view_name:"ESASkyJSView",_model_module:"pyesasky",_view_module:"pyesasky",view_module_ids:[]})}}class l extends i.DOMWidgetView{constructor(){super(...arguments),this.apiAddr="https://sky.esa.int"}render(){let e=this;var t=document.createElement("div");this.base_url=d.PageConfig.getBaseUrl(),this.base_url=d.PageConfig.getBaseUrl(),this.modelId="esaskyFrame"+Math.random().toString(36).substr(2,10);var s=this.model.get("_view_module_ids");s.push(this.modelId),this.model.set("_view_module_ids",s);var i=this.model.get("_view_language");console.log(i);var o=document.createElement("iframe");o.setAttribute("id",this.modelId.toString()),o.setAttribute("width","100%"),o.setAttribute("height","800px"),o.setAttribute("style","border: none"),o.setAttribute("src",this.apiAddr+"?hide_welcome=true&hide_sci_switch=true&hide_banner_info=true"),o.onload=function(){o.contentWindow.postMessage({event:"initTest",origin:"pyesasky"},e.apiAddr),console.log("Init message sent")},t.appendChild(o),this.el.appendChild(t);let l=this.el;new MutationObserver((()=>{l.style.height="auto"})).observe(l,{attributes:!0,childList:!0}),this.model.on("msg:custom",this.handle_custom_message,this),this.listenTo(this.model,"change:view_height",this.height_changed),this.oldMsgId=null,this.oldMsgIdToFront=null;var n=this;window.addEventListener("message",(function(e){var t=e.data;console.log("Back inside pyesasky.js"),n.oldMsgId!=t.msgId&&(n.oldMsgId=t.msgId,n.model.send(t,null,null))}))}height_changed(){console.log("Changing view height");var e=this.model.get("view_height");let t=this.model.get("_view_module_ids");for(var s=t.length-1;s>=0;s--){let i=t[s];if(null!=document.getElementById(i)){document.getElementById(i).style.height=e;break}}}handle_custom_message(e){let t,s=this.model.get("_view_module_ids");for(var i=s.length-1;i>=0&&(t=s[i],null==document.getElementById(t));i--);this.oldMsgIdToFront!=e.msgId&&this.modelId==t&&(this.oldMsgIdToFront=e.msgId,console.log("Inside pyesasky.js"),document.getElementById(this.modelId).contentWindow.postMessage(e,this.apiAddr))}}const n={id:"pyesasky:plugin",autoStart:!0,activate:(e,t)=>{console.log("JupyterLab extension pyesasky is activated!")}},a=s(306).i8},306:e=>{"use strict";e.exports={i8:"1.9.2"}}}]);