"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[1958],{31958:(e,t,o)=>{o.r(t),o.d(t,{Grid:()=>i,GridModel:()=>c});var a,r=o(18498),n=o(47479),s=o(46947),l=o(77952),d=o(78947);class i extends s.Panel{constructor(e){super();const{commands:t,model:o,themeManager:n}=e;this.model=o;const s=new c(e.translator),l=new r.DataGrid,i=new a.MouseHandler;i.doubleClicked.connect(((e,o)=>t.execute(d.q.CommandIDs.inspectVariable,{variableReference:s.getVariableReference(o.row),name:s.getVariableName(o.row)}))),i.selected.connect(((e,t)=>{const{row:o}=t;this.model.selectedVariable={name:s.getVariableName(o),value:s.data("body",o,1),type:s.data("body",o,2),variablesReference:s.getVariableReference(o)}})),l.dataModel=s,l.keyHandler=new r.BasicKeyHandler,l.mouseHandler=i,l.selectionModel=new r.BasicSelectionModel({dataModel:s}),l.stretchLastColumn=!0,l.node.style.height="100%",this._grid=l,n&&n.themeChanged.connect(this._updateStyles,this),this.addWidget(l)}set filter(e){this._grid.dataModel.filter=e,this.update()}set scope(e){this._grid.dataModel.scope=e,this.update()}get dataModel(){return this._grid.dataModel}onAfterAttach(e){super.onAfterAttach(e),this._updateStyles()}_updateStyles(){const{style:e,textRenderer:t}=a.computeStyle();this._grid.cellRenderers.update({},t),this._grid.style=e}}class c extends r.DataModel{constructor(e){super(),this._filter=new Set,this._scope="",this._data={name:[],type:[],value:[],variablesReference:[]},this._trans=(e||l.nullTranslator).load("jupyterlab")}get filter(){return this._filter}set filter(e){this._filter=e}get scope(){return this._scope}set scope(e){this._scope=e}rowCount(e){return"body"===e?this._data.name.length:1}columnCount(e){return"body"===e?2:1}data(e,t,o){return"row-header"===e?this._data.name[t]:"column-header"===e?1===o?this._trans.__("Value"):this._trans.__("Type"):"corner-header"===e?this._trans.__("Name"):1===o?this._data.value[t]:this._data.type[t]}getVariableReference(e){return this._data.variablesReference[e]}getVariableName(e){return this._data.name[e]}setData(e){var t,o;this._clearData(),this.emitChanged({type:"model-reset",region:"body"});const a=null!==(t=e.find((e=>e.name===this._scope)))&&void 0!==t?t:e[0],r=(null!==(o=null==a?void 0:a.variables)&&void 0!==o?o:[]).filter((e=>e.name&&!this._filter.has(e.name)));r.forEach(((e,t)=>{var o;this._data.name[t]=e.name,this._data.type[t]=null!==(o=e.type)&&void 0!==o?o:"",this._data.value[t]=e.value,this._data.variablesReference[t]=e.variablesReference})),this.emitChanged({type:"rows-inserted",region:"body",index:1,span:r.length})}_clearData(){this._data={name:[],type:[],value:[],variablesReference:[]}}}!function(e){e.computeStyle=function(){const e=function(){const e=document.createElement("div");return e.className="jp-DebuggerVariables-colorPalette",e.innerHTML='\n        <div class="jp-mod-void"></div>\n        <div class="jp-mod-background"></div>\n        <div class="jp-mod-header-background"></div>\n        <div class="jp-mod-grid-line"></div>\n        <div class="jp-mod-header-grid-line"></div>\n        <div class="jp-mod-selection"></div>\n        <div class="jp-mod-text"></div>\n      ',e}();let t;document.body.appendChild(e),t=e.querySelector(".jp-mod-void");const o=getComputedStyle(t).color;t=e.querySelector(".jp-mod-background");const a=getComputedStyle(t).color;t=e.querySelector(".jp-mod-header-background");const n=getComputedStyle(t).color;t=e.querySelector(".jp-mod-grid-line");const s=getComputedStyle(t).color;t=e.querySelector(".jp-mod-header-grid-line");const l=getComputedStyle(t).color;t=e.querySelector(".jp-mod-selection");const d=getComputedStyle(t).color;t=e.querySelector(".jp-mod-text");const i=getComputedStyle(t).color;return document.body.removeChild(e),{style:{voidColor:o,backgroundColor:a,headerBackgroundColor:n,gridLineColor:s,headerGridLineColor:l,rowBackgroundColor:e=>e%2==0?o:a,selectionFillColor:d},textRenderer:new r.TextRenderer({font:"12px sans-serif",textColor:i,backgroundColor:"",verticalAlignment:"center",horizontalAlignment:"left"})}};class t extends r.BasicMouseHandler{constructor(){super(...arguments),this._doubleClicked=new n.Signal(this),this._selected=new n.Signal(this)}get doubleClicked(){return this._doubleClicked}get selected(){return this._selected}dispose(){this.isDisposed||(n.Signal.disconnectSender(this),super.dispose())}onMouseDoubleClick(e,t){const o=e.hitTest(t.clientX,t.clientY);this._doubleClicked.emit(o)}onMouseDown(e,t){let{clientX:o,clientY:a}=t,r=e.hitTest(o,a);this._selected.emit(r),super.onMouseDown(e,t)}onContextMenu(e,t){let{clientX:o,clientY:a}=t,r=e.hitTest(o,a);this._selected.emit(r)}}e.MouseHandler=t}(a||(a={}))}}]);