wg-backend-django/dell-env/share/jupyter/labextensions/jupyterlab-plotly/static/423.d0d3e2912c33c7566484.js

1 line
8.1 KiB
JavaScript
Raw Normal View History

2023-10-30 03:40:43 -04:00
(self.webpackChunkjupyterlab_plotly=self.webpackChunkjupyterlab_plotly||[]).push([[423],{423:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MIME_TYPE:()=>i,RenderedPlotly:()=>s,default:()=>a,rendererFactory:()=>r});var o=n(832),l=(n(549),function(e,t,n,o){return new(n||(n=Promise))((function(l,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function r(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,r)}a((o=o.apply(e,t||[])).next())}))});const i="application/vnd.plotly.v1+json";class s extends o.Widget{constructor(e){super(),this.addClass("jp-RenderedPlotly"),this._mimeType=e.mimeType,this._img_el=document.createElement("img"),this._img_el.className="plot-img",this.node.appendChild(this._img_el),this._img_el.addEventListener("mouseenter",(e=>{this.createGraph(this._model)}))}renderModel(e){if(this.hasGraphElement())return Promise.resolve();this._model=e;const t=e.data["image/png"];return null!=t?(this.updateImage(t),Promise.resolve()):this.createGraph(e)}hasGraphElement(){return null!==this.node.querySelector(".plot-container")}updateImage(e){this.hideGraph(),this._img_el.src="data:image/png;base64,"+e,this.showImage()}hideGraph(){let e=this.node.querySelector(".plot-container");null!=e&&(e.style.display="none")}showGraph(){let e=this.node.querySelector(".plot-container");null!=e&&(e.style.display="block")}hideImage(){let e=this.node.querySelector(".plot-img");null!=e&&(e.style.display="none")}showImage(){let e=this.node.querySelector(".plot-img");null!=e&&(e.style.display="block")}createGraph(e){const{data:t,layout:o,frames:i,config:r}=e.data[this._mimeType];return o.height||(o.height=360),(()=>l(this,void 0,void 0,(function*(){return null===s.Plotly&&(s.Plotly=yield n.e(478).then(n.t.bind(n,478,23)),s._resolveLoadingPlotly()),s.loadingPlotly})))().then((()=>s.Plotly.react(this.node,t,o,r))).then((t=>{this.showGraph(),this.hideImage(),this.update(),i&&s.Plotly.addFrames(this.node,i),this.node.offsetWidth>0&&this.node.offsetHeight>0&&s.Plotly.toImage(t,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then((t=>{const n=t.split(",")[1];e.data["image/png"]!==n&&e.setData({data:Object.assign(Object.assign({},e.data),{"image/png":n})})})),this.node.on("plotly_webglcontextlost",(()=>{const t=e.data["image/png"];if(null!=t)return this.updateImage(t),Promise.resolve()}))}))}onAfterShow(e){this.update()}onResize(e){this.update()}onUpdateRequest(e){s.Plotly&&this.isVisible&&this.hasGraphElement()&&s.Plotly.redraw(this.node).then((()=>{s.Plotly.Plots.resize(this.node)}))}}s.Plotly=null,s.loadingPlotly=new Promise((e=>{s._resolveLoadingPlotly=e}));const r={safe:!0,mimeTypes:[i],createRenderer:e=>new s(e)},a=[{id:"@jupyterlab/plotly-extension:factory",rendererFactory:r,rank:0,dataType:"json",fileTypes:[{name:"plotly",mimeTypes:[i],extensions:[".plotly",".plotly.json"],iconClass:"jp-MaterialIcon jp-PlotlyIcon"}],documentWidgetFactoryOptions:{name:"Plotly",primaryFileType:"plotly",fileTypes:["plotly","json"],defaultFor:["plotly"]}}]},760:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>h});var o=n(645),l=n.n(o),i=n(667),s=n.n(i),r=n(745),a=n.n(r),c=l()((function(e){return e[1]})),d=s()(a());c.push([e.id,"/**\n Copyright (c) Jupyter Development Team.\n Distributed under the terms of the Modified BSD License.\n*/\n\n/* Add CSS variables to :root */\n:root {\n --jp-icon-plotly: url("+d+");\n}\n\n/* Base styles */\n.jp-RenderedPlotly {\n width: 100%;\n height: 100%;\n padding: 0;\n overflow: hidden;\n}\n\n/* Document styles */\n.jp-MimeDocument .jp-RenderedPlotly {\n overflow: hidden;\n}\n\n/* Document icon */\n.jp-PlotlyIcon {\n background-image: var(--jp-icon-plotly);\n}\n",""]);const h=c},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var l={};if(o)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(l[s]=!0)}for(var r=0;r