@hpcc-js/eclwatch 3.6.13 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@hpcc-js/codemirror"),require("@hpcc-js/comms"),require("@hpcc-js/phosphor"),require("@hpcc-js/tree"),require("@hpcc-js/util"),require("@hpcc-js/common"),require("@hpcc-js/dgrid"),require("@hpcc-js/graph"),require("@hpcc-js/layout"),require("@hpcc-js/timeline")):typeof define==`function`&&define.amd?define([`exports`,`@hpcc-js/codemirror`,`@hpcc-js/comms`,`@hpcc-js/phosphor`,`@hpcc-js/tree`,`@hpcc-js/util`,`@hpcc-js/common`,`@hpcc-js/dgrid`,`@hpcc-js/graph`,`@hpcc-js/layout`,`@hpcc-js/timeline`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@hpcc-js/eclwatch`]={},e[`@hpcc-js/codemirror`],e[`@hpcc-js/comms`],e[`@hpcc-js/phosphor`],e[`@hpcc-js/tree`],e[`@hpcc-js/util`],e[`@hpcc-js/common`],e[`@hpcc-js/dgrid`],e[`@hpcc-js/graph`],e[`@hpcc-js/layout`],e[`@hpcc-js/timeline`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=`@hpcc-js/eclwatch`,f=`3.6.13`,p=`3.25.1`,ECLArchiveViewer=class extends r.SplitPanel{_prevHash;_contentStr;_directoryPane=new i.DirectoryTree;_fileEditorPane=new t.Editor().text(``);constructor(){super(`horizontal`),this._directoryPane.rowClick=e=>{this._fileEditorPane.text(e).render()}}transformArchiveTreeData(e){let t={label:e.name,children:e._children.map(transformNode).filter(e=>e)};if(t.children&&t.children[0]&&t.children[0].label===`html`)return{label:`root`,children:[{label:`error`,content:JSON.stringify(t,null,4)}]};return t;function transformNode(e){let t={};if(t.label=e.name+(e.$&&e.$.key?` (${e.$.key})`:``),e._children&&e._children.length>0)t.children=e._children.map(e=>transformNode(e)).filter(e=>e);else if(typeof e.content==`string`&&e.content.trim())t.content=e.content;else return!1;return t}}updateDirectoryPane(e){let t;if(e)try{t=JSON.parse(e)}catch{t=(0,a.xml2json)(e)}if(t){let e=this.transformArchiveTreeData(t);this._directoryPane.data(e).render()}}enter(e,t){super.enter(e,t),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(e,t){super.update(e,t);let r=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==r||this._contentStr===void 0?n.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(e=>{this._contentStr=e,this.updateDirectoryPane(this._contentStr),this._prevHash=r}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}};ECLArchiveViewer.prototype._class+=` eclwatch_ECLArchiveViewer`,ECLArchiveViewer.prototype.publish(`baseUrl`,``,`string`,`HPCC Platform Base URL`),ECLArchiveViewer.prototype.publish(`wuid`,``,`string`,`Workunit ID`),ECLArchiveViewer.prototype.publish(`directoryWidthRatio`,.38,`number`,`Default directory panel width ratio relative to the full width`),ECLArchiveViewer.prototype.publish(`contentString`,null,`string`,`XML/JSON archive content string`),ECLArchiveViewer.prototype.publishProxy(`directoryPaneColor`,`_directoryPane`,`backgroundColor`),ECLArchiveViewer.prototype.publishProxy(`directoryPaneHoverColor`,`_directoryPane`,`hoverBackgroundColor`),ECLArchiveViewer.prototype.publishProxy(`iconSize`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontColor`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontFamily`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontSize`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`folderIconOpen`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`folderIconClosed`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`textFileIcon`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`codeFileIcon`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`verticalScroll`,`_directoryPane`);var LegendVertex=class extends c.Vertex{constructor(){super()}enter(e,t){super.enter(e,t),this._icon.on(`click`,()=>{this.click(this.data())})}click(e){}},WUGraphLegend=class extends l.Legend{icon=(0,o.local)();_disabled2={};disabled(e){if(!arguments.length){let e=[];for(let t in this._disabled2)this._disabled2[t]&&e.push(t);return e}return this._disabled2={},e.forEach(e=>this._disabled2[e]=!0),this}toggle(e){this._disabled2[e]=!this._disabled2[e]}update(e,t){super.update(e,t);let n=this,r=this._g.selectAll(`.legendItem`).data(this.data(),e=>e.kind);r.enter().append(`g`).attr(`class`,`legendItem`).each(function(e){n.icon.set(this,new LegendVertex().target(this).data(e.kind).textbox_shape_colorStroke(`none`).textbox_shape_colorFill(`none`).iconAnchor(`left`).faChar(e.faChar).text(`${e.label} (${e.count})`).tooltip(`${e.kind} - ${e.label}`).on(`click`,e=>{n.toggle(e),n.render(),n.click(e)}).on(`mouseover`,e=>{n.mouseover(e)}).on(`mouseout`,e=>{n.mouseout(e)}))}).merge(r).each(function(e,t){let r=n.icon.get(this).icon_shape_colorFill(n._disabled2[e.kind]?`gray`:null).render().getBBox();(0,o.select)(this).attr(`transform`,`translate(${r.width/2}, ${t*30})`)}),r.exit().each(function(e){n.icon.get(this).target(null).render()}).remove();let i=this.getBBox(!0,!0);this._g.attr(`transform`,`translate(16, ${this.height()/2-i.height/2})`)}click(e){}mouseover(e){}mouseout(e){}};WUGraphLegend.prototype._class+=` eclwatch_WUGraphLegend`;function faCharFactory(e){switch(e){case`2`:return``;case`3`:return``;case`5`:return``;case`6`:return``;case`12`:return``;case`15`:return``;case`17`:return``;case`22`:return``;case`23`:return``;case`25`:return``;case`26`:return``;case`29`:return``;case`36`:return``;case`44`:return``;case`47`:return``;case`54`:return``;case`56`:return``;case`59`:return``;case`61`:return``;case`82`:return``;case`88`:return``;case`92`:return``;case`93`:return``;case`99`:return``;case`105`:return``;case`7`:return``;case`9`:return``;case`16`:return``;case`19`:return``;case`21`:return``;case`35`:return``;case`37`:return``;case`71`:return``;case`133`:return``;case`148`:return``;case`168`:return``}return``}var WUScopeController=class{graphDB;subgraphsMap={};rSubgraphsMap={};verticesMap={};rVerticesMap={};edgesMap={};rEdgesMap={};kindMap={};_disabled={};constructor(){}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(e){this.graphDB=e,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(e=>{if(!(e instanceof a.Subgraph))if(e instanceof a.Vertex){let t=e._.attr(`Kind`).RawValue;this.kindMap[t]||(this.kindMap[t]=[]),this.kindMap[t].push(e)}else e instanceof a.Edge})}disabled(e){if(!arguments.length){let e=[];for(let t in this._disabled)this._disabled[t]&&e.push(t);return e}return this._disabled={},e.forEach(e=>this._disabled[e]=!0),this}graphGui(e){let t={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return e.walk(e=>{if(e instanceof a.Subgraph){let n=this.appendSubgraph(e,t.hierarchy,t.subgraphs);n.showMinMax(e.vertices.length>3||n.minState()!==`normal`)}else e instanceof a.Vertex?this.appendVertex(e,t.hierarchy,t.vertices):e instanceof a.Edge&&this.appendEdge(e,t.edges)}),t}format(e,t){let n=``,r=e.indexOf(`%`),i=-1;for(;r>=0;){if(n+=e.substring(i+1,r),i=e.indexOf(`%`,r+1),i<0){console.warn(`Invalid Label Template`);break}let a=e.substring(r+1,i);n+=a?t[e.substring(r+1,i)]||``:`%`,r=e.indexOf(`%`,i+1)}return n+=e.substring(i+1,e.length),n.split(`\\n`).join(`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@hpcc-js/codemirror"),require("@hpcc-js/comms"),require("@hpcc-js/phosphor"),require("@hpcc-js/tree"),require("@hpcc-js/util"),require("@hpcc-js/common"),require("@hpcc-js/dgrid"),require("@hpcc-js/graph"),require("@hpcc-js/layout"),require("@hpcc-js/timeline")):typeof define==`function`&&define.amd?define([`exports`,`@hpcc-js/codemirror`,`@hpcc-js/comms`,`@hpcc-js/phosphor`,`@hpcc-js/tree`,`@hpcc-js/util`,`@hpcc-js/common`,`@hpcc-js/dgrid`,`@hpcc-js/graph`,`@hpcc-js/layout`,`@hpcc-js/timeline`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@hpcc-js/eclwatch`]={},e[`@hpcc-js/codemirror`],e[`@hpcc-js/comms`],e[`@hpcc-js/phosphor`],e[`@hpcc-js/tree`],e[`@hpcc-js/util`],e[`@hpcc-js/common`],e[`@hpcc-js/dgrid`],e[`@hpcc-js/graph`],e[`@hpcc-js/layout`],e[`@hpcc-js/timeline`]))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=`@hpcc-js/eclwatch`,f=`3.7.0`,p=`3.26.0`,ECLArchiveViewer=class extends r.SplitPanel{_prevHash;_contentStr;_directoryPane=new i.DirectoryTree;_fileEditorPane=new t.Editor().text(``);constructor(){super(`horizontal`),this._directoryPane.rowClick=e=>{this._fileEditorPane.text(e).render()}}transformArchiveTreeData(e){let t={label:e.name,children:e._children.map(transformNode).filter(e=>e)};if(t.children&&t.children[0]&&t.children[0].label===`html`)return{label:`root`,children:[{label:`error`,content:JSON.stringify(t,null,4)}]};return t;function transformNode(e){let t={};if(t.label=e.name+(e.$&&e.$.key?` (${e.$.key})`:``),e._children&&e._children.length>0)t.children=e._children.map(e=>transformNode(e)).filter(e=>e);else if(typeof e.content==`string`&&e.content.trim())t.content=e.content;else return!1;return t}}updateDirectoryPane(e){let t;if(e)try{t=JSON.parse(e)}catch{t=(0,a.xml2json)(e)}if(t){let e=this.transformArchiveTreeData(t);this._directoryPane.data(e).render()}}enter(e,t){super.enter(e,t),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(e,t){super.update(e,t);let r=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==r||this._contentStr===void 0?n.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(e=>{this._contentStr=e,this.updateDirectoryPane(this._contentStr),this._prevHash=r}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}};ECLArchiveViewer.prototype._class+=` eclwatch_ECLArchiveViewer`,ECLArchiveViewer.prototype.publish(`baseUrl`,``,`string`,`HPCC Platform Base URL`),ECLArchiveViewer.prototype.publish(`wuid`,``,`string`,`Workunit ID`),ECLArchiveViewer.prototype.publish(`directoryWidthRatio`,.38,`number`,`Default directory panel width ratio relative to the full width`),ECLArchiveViewer.prototype.publish(`contentString`,null,`string`,`XML/JSON archive content string`),ECLArchiveViewer.prototype.publishProxy(`directoryPaneColor`,`_directoryPane`,`backgroundColor`),ECLArchiveViewer.prototype.publishProxy(`directoryPaneHoverColor`,`_directoryPane`,`hoverBackgroundColor`),ECLArchiveViewer.prototype.publishProxy(`iconSize`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontColor`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontFamily`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`fontSize`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`folderIconOpen`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`folderIconClosed`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`textFileIcon`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`codeFileIcon`,`_directoryPane`),ECLArchiveViewer.prototype.publishProxy(`verticalScroll`,`_directoryPane`);var LegendVertex=class extends c.Vertex{constructor(){super()}enter(e,t){super.enter(e,t),this._icon.on(`click`,()=>{this.click(this.data())})}click(e){}},WUGraphLegend=class extends l.Legend{icon=(0,o.local)();_disabled2={};disabled(e){if(!arguments.length){let e=[];for(let t in this._disabled2)this._disabled2[t]&&e.push(t);return e}return this._disabled2={},e.forEach(e=>this._disabled2[e]=!0),this}toggle(e){this._disabled2[e]=!this._disabled2[e]}update(e,t){super.update(e,t);let n=this,r=this._g.selectAll(`.legendItem`).data(this.data(),e=>e.kind);r.enter().append(`g`).attr(`class`,`legendItem`).each(function(e){n.icon.set(this,new LegendVertex().target(this).data(e.kind).textbox_shape_colorStroke(`none`).textbox_shape_colorFill(`none`).iconAnchor(`left`).faChar(e.faChar).text(`${e.label} (${e.count})`).tooltip(`${e.kind} - ${e.label}`).on(`click`,e=>{n.toggle(e),n.render(),n.click(e)}).on(`mouseover`,e=>{n.mouseover(e)}).on(`mouseout`,e=>{n.mouseout(e)}))}).merge(r).each(function(e,t){let r=n.icon.get(this).icon_shape_colorFill(n._disabled2[e.kind]?`gray`:null).render().getBBox();(0,o.select)(this).attr(`transform`,`translate(${r.width/2}, ${t*30})`)}),r.exit().each(function(e){n.icon.get(this).target(null).render()}).remove();let i=this.getBBox(!0,!0);this._g.attr(`transform`,`translate(16, ${this.height()/2-i.height/2})`)}click(e){}mouseover(e){}mouseout(e){}};WUGraphLegend.prototype._class+=` eclwatch_WUGraphLegend`;function faCharFactory(e){switch(e){case`2`:return``;case`3`:return``;case`5`:return``;case`6`:return``;case`12`:return``;case`15`:return``;case`17`:return``;case`22`:return``;case`23`:return``;case`25`:return``;case`26`:return``;case`29`:return``;case`36`:return``;case`44`:return``;case`47`:return``;case`54`:return``;case`56`:return``;case`59`:return``;case`61`:return``;case`82`:return``;case`88`:return``;case`92`:return``;case`93`:return``;case`99`:return``;case`105`:return``;case`7`:return``;case`9`:return``;case`16`:return``;case`19`:return``;case`21`:return``;case`35`:return``;case`37`:return``;case`71`:return``;case`133`:return``;case`148`:return``;case`168`:return``}return``}var WUScopeController=class{graphDB;subgraphsMap={};rSubgraphsMap={};verticesMap={};rVerticesMap={};edgesMap={};rEdgesMap={};kindMap={};_disabled={};constructor(){}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(e){this.graphDB=e,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(e=>{if(!(e instanceof a.Subgraph))if(e instanceof a.Vertex){let t=e._.attr(`Kind`).RawValue;this.kindMap[t]||(this.kindMap[t]=[]),this.kindMap[t].push(e)}else e instanceof a.Edge})}disabled(e){if(!arguments.length){let e=[];for(let t in this._disabled)this._disabled[t]&&e.push(t);return e}return this._disabled={},e.forEach(e=>this._disabled[e]=!0),this}graphGui(e){let t={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return e.walk(e=>{if(e instanceof a.Subgraph){let n=this.appendSubgraph(e,t.hierarchy,t.subgraphs);n.showMinMax(e.vertices.length>3||n.minState()!==`normal`)}else e instanceof a.Vertex?this.appendVertex(e,t.hierarchy,t.vertices):e instanceof a.Edge&&this.appendEdge(e,t.edges)}),t}format(e,t){let n=``,r=e.indexOf(`%`),i=-1;for(;r>=0;){if(n+=e.substring(i+1,r),i=e.indexOf(`%`,r+1),i<0){console.warn(`Invalid Label Template`);break}let a=e.substring(r+1,i);n+=a?t[e.substring(r+1,i)]||``:`%`,r=e.indexOf(`%`,i+1)}return n+=e.substring(i+1,e.length),n.split(`\\n`).join(`
2
2
  `)}createSubgraph(e){let t=this.subgraphsMap[e._.Id];return t||(t=new c.Subgraph().title(e._.Id).on(`minClick`,()=>{this.minClick(t)}),this.subgraphsMap[e._.Id]=t,this.rSubgraphsMap[t.id()]=e),t}createVertex(e){let t=this.verticesMap[e._.Id];if(!t){let n=e._.rawAttrs();if(e._.ScopeType===`dummy`){let n=this.subgraphsMap[e.parent._.Id];t=new o.Icon().shape_colorFill(`darkred`).shape_colorStroke(`darkred`).image_colorFill(`white`).faChar(``).on(`click`,()=>{n.minState(`normal`),this.minClick(n)})}else{t=new c.Vertex().icon_shape_colorFill(`#1f77b4`).icon_image_colorFill(`white`).faChar(faCharFactory(n.Kind)).text(n.Label);let r=[];e._.hasAttr(`Definition`)&&r.push({faChar:``,tooltip:`Definition`,shape_colorFill:`lightgray`,shape_colorStroke:`lightgray`,image_colorFill:`black`}),e._.hasAttr(`IsInternal`)&&r.push({faChar:``,tooltip:`IsInternal`,shape_colorFill:`red`,shape_colorStroke:`red`,image_colorFill:`white`}),t.annotationIcons(r)}this.verticesMap[e._.Id]=t,this.rVerticesMap[t.id()]=e}return t}isSpill(e){let t=e.source._.attr(`Kind`).RawValue,n=e.target._.attr(`Kind`).RawValue;return t===`2`||n===`71`}spansSubgraph(e){return e.source.parent._.Id!==e.target.parent._.Id}createEdge(e){let t=this.edgesMap[e._.Id];if(!t){let n=e._.rawAttrs(),r=this.verticesMap[e.source._.Id],i=this.verticesMap[e.target._.Id];if(r&&i){let a=this.isSpill(e),o=this.spansSubgraph(e),s=this.format(`%Label%
3
3
  %NumRowsProcessed%`,n),l=null,u=100;n.IsDependency?(u=10,l=`1,5`):n._childGraph?l=`5,5`:a?(u=25,l=`5,5,10,5`):o&&(u=5,l=`5,5`),t=new c.Edge().sourceVertex(r).targetVertex(i).sourceMarker(`circle`).targetMarker(`arrow`).weight(u).strokeDasharray(l).text(s),this.edgesMap[e._.Id]=t,this.rEdgesMap[t.id()]=e}}return t}appendSubgraph(e,t,n){let r=this.createSubgraph(e);n.push(r);let i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:r}),r}appendVertex(e,t,n){let r=this.createVertex(e);n.push(r);let i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:r}),r}appendEdge(e,t){let n=this.createEdge(e);return n&&t.push(n),n}filterLegend(e){for(let t=e.vertices.length-1;t>=0;--t){let r=e.vertices[t],i=r._.attr(`Kind`).RawValue;this._disabled[i]&&r.remove(!1,(e,t)=>new n.BaseScope({ScopeName:r._.ScopeName+`:in`,Id:e.Id+`->`+t.Id,ScopeType:`dummy-edge`,Properties:{Property:[r._.attr(`Label`)]},Notes:{Note:[]},SinkActivity:``}))}}filterPartial(e){for(let t of e.subgraphs)switch(this.subgraphsMap[t._.Id].minState()){case`partial`:let e=t.vertices,r=[],i=[];for(let t of e)t.inEdges.length===0||t.inEdges.some(e=>e.source.parent!==e.target.parent)||t.outEdges.length===0||t.outEdges.some(e=>e.source.parent!==e.target.parent)?r.push(t):i.push(t);if(i.length>1){let e=new n.BaseScope({ScopeName:t._.ScopeName,Id:t._.Id+`:dummy`,ScopeType:`dummy`,Properties:{Property:[{Name:`Activities`,RawValue:``+i.length,Formatted:``+i.length,Measure:`count`,Creator:``,CreatorType:``}]},Notes:{Note:[]},SinkActivity:``}),a=t.createVertex(e);for(let e of i){for(let i of e.inEdges)if(r.indexOf(i.source)>=0){let e=new n.BaseScope({ScopeName:i.source._.ScopeName,Id:i.source._.Id+`->`+a._.Id,ScopeType:`dummy-in`,Properties:{Property:[]},Notes:{Note:[]},SinkActivity:``});t.createEdge(i.source,a,e)}for(let i of e.outEdges)if(r.indexOf(i.target)>=0){let e=new n.BaseScope({ScopeName:i.target._.ScopeName,Id:a._.Id+`->`+i.target._.Id,ScopeType:`dummy-out`,Properties:{Property:[]},Notes:{Note:[]},SinkActivity:``});t.createEdge(a,i.target,e)}}i.forEach(e=>e.remove(!0))}break}}filterEmptySubgraphs(e){for(;;){let t=e.subgraphs.filter(e=>e.subgraphs.length===0&&e.vertices.length===0);if(t.length===0)break;t.forEach(e=>e.remove(!0))}}removeObsoleteSubgraphs(e){for(let t of[...e.subgraphs])t.vertices.length===0&&t.remove(!1)}graphData(){let e=this.graphDB.clone();return this.filterLegend(e),this.filterPartial(e),this.filterEmptySubgraphs(e),this.removeObsoleteSubgraphs(e),this.graphGui(e)}calcLegend(){let e=[];for(let t in this.kindMap)e.push({kind:parseInt(t),faChar:faCharFactory(t),label:this.kindMap[t][0]._.attr(`Label`).RawValue.split(`
4
4
  `)[0],count:this.kindMap[t].length});return e}vertices(e){let t=[];for(let n of this.kindMap[e])t.push(this.verticesMap[n._.Id]);return t}formatRow(e,t,n){let r=e._.formattedAttrs();for(let e in r){let i=t.indexOf(e);i===-1?(t.push(e),n.push(r[e])):n[i]=r[e]}for(let e=0;e<100;++e)n[e]===void 0&&(n[e]=``);return n}activityData(){let e=[`Id`,`Kind`,`Label`];return{columns:e,data:this.graphDB.vertices.map(t=>{let n=[parseInt(t._.Id.split(`a`)[1])];return this.formatRow(t,e,n)})}}edgeData(){let e=[`Id`,`Label`];return{columns:e,data:this.graphDB.edges.map(t=>{let n=[t._.Id];return this.formatRow(t,e,n)})}}subgraphData(){let e=[`Id`,`Label`];return{columns:e,data:this.graphDB.subgraphs.map(t=>{let n=[t._.Id];return this.formatRow(t,e,n)})}}calcGraphTooltip(e){let t,n;if(e instanceof c.Subgraph){let r=this.rSubgraphsMap[e.id()];t=r._,n=r.parent._}else if(e instanceof c.Vertex||e instanceof o.Icon){let r=this.rVerticesMap[e.id()];t=r._,n=r.parent._}else if(e instanceof c.Edge){let r=this.rEdgesMap[e.id()];t=r._,n=r.parent._}return t?t.calcTooltip(n):``}subgraph(e){return this.subgraphsMap[e]}vertex(e){return this.verticesMap[e]}edge(e){return this.edgesMap[e]}minClick(e){}},WUGraph=class extends l.ChartPanel{_partialAll=new o.Button().faChar(`fa-window-restore`).tooltip(`Partial All`).on(`click`,()=>{this.stateClick(this._partialAll)});_maxAll=new o.Button().faChar(`fa-window-maximize`).tooltip(`Max All`).on(`click`,()=>{this.stateClick(this._maxAll)});_toggleGraph=new o.ToggleButton().faChar(`fa-chain`).tooltip(`Graph`).selected(!0).on(`click`,()=>{this.viewClick(this._toggleGraph)});_toggleActivities=new o.ToggleButton().faChar(`fa-table`).tooltip(`Activitiies`).selected(!1).on(`click`,()=>{this.viewClick(this._toggleActivities)});_toggleEdges=new o.ToggleButton().faChar(`fa-table`).tooltip(`Edges`).selected(!1).on(`click`,()=>{this.viewClick(this._toggleEdges)});_toggleSubgraphs=new o.ToggleButton().faChar(`fa-table`).tooltip(`Subgraphs`).selected(!1).on(`click`,()=>{this.viewClick(this._toggleSubgraphs)});_graph=new c.Graph().layout(`Hierarchy`).applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1);_activities=new s.Table().pagination(!1);_edges=new s.Table().pagination(!1);_subgraphs=new s.Table().pagination(!1);_legend=new WUGraphLegend(this).on(`click`,e=>{this.render()}).on(`mouseover`,e=>{let t={};for(let n of this._gc.vertices(e))t[n.id()]=!0;this._graph.highlightVerticies(t)}).on(`mouseout`,e=>{this._graph.highlightVerticies()});_view=new l.Carousel().widgets([this._graph,this._activities,this._edges,this._subgraphs]);_gc=new WUScopeController;constructor(){super(),this.topOverlay(!1),this.widget(this._view);let e=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new o.Spacer,this._partialAll,this._maxAll,new o.Spacer,...this._graph.iconBarButtons(),new o.Spacer];this.buttons(e.concat(this.buttons())),this._gc.minClick=e=>{this.loadGraph(),this._graph.render(t=>{this._graph.selection([e]).centerOnItem(e)})},this._graph.tooltipHTML(e=>this._gc.calcGraphTooltip(e))}stateClick(e){switch(e){case this._partialAll:this._graph.data().subgraphs.forEach(e=>{e.minState(`partial`)});break;case this._maxAll:this._graph.data().subgraphs.forEach(e=>{e.minState(`normal`)});break}this.render()}viewClick(e){switch(this._toggleGraph.selected(e===this._toggleGraph),this._toggleActivities.selected(e===this._toggleActivities),this._toggleEdges.selected(e===this._toggleEdges),this._toggleSubgraphs.selected(e===this._toggleSubgraphs),e){case this._toggleGraph:this._view.active(0);break;case this._toggleActivities:this._view.active(1);break;case this._toggleEdges:this._view.active(2);break;case this._toggleSubgraphs:this._view.active(3);break}this.render(e=>{})}_prevHashSum;_prevScopeGraph;fetchScopeGraph(){let e=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});return!this._prevScopeGraph||this._prevHashSum!==e?(this.startProgress(),this._prevHashSum=e,this._gc.clear(),n.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(e=>{for(let t of e)if(t.Name===this.graphID())return this.finishProgress(),t.fetchScopeGraph(this.subgraphID())}).then(e=>(this._prevScopeGraph=e,this._prevScopeGraph))):Promise.resolve(this._prevScopeGraph)}enter(e,t){super.enter(e,t)}update(e,t){super.update(e,t)}exit(e,t){super.exit(e,t)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{let{columns:e,data:t}=this._gc.activityData();this._activities.columns(e).data(t)}{let{columns:e,data:t}=this._gc.edgeData();this._edges.columns(e).data(t)}{let{columns:e,data:t}=this._gc.subgraphData();this._subgraphs.columns(e).data(t)}}render(e){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(t=>{this._gc.set(t),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(e)}):super.render(e),this}selection(e){if(!arguments.length)return this._graph.selection();let t=this._gc.vertex(e)||this._gc.edge(e)||this._gc.subgraph(e);return t&&this._graph.selection([t]),this}};WUGraph.prototype._class+=` eclwatch_WUGraph`,WUGraph.prototype.publish(`baseUrl`,``,`string`,`HPCC Platform Base URL`),WUGraph.prototype.publish(`wuid`,``,`string`,`Workunit ID`),WUGraph.prototype.publish(`graphID`,``,`string`,`Graph ID`),WUGraph.prototype.publish(`subgraphID`,``,`string`,`Subgraph ID`);function entitiesEncode(e){return String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function safeEncode(e){switch(Object.prototype.toString.call(e)){case`[object Undefined]`:case`[object Boolean]`:case`[object Number]`:return e;case`[object String]`:return entitiesEncode(e);default:console.warn(`Unknown cell type: `+Object.prototype.toString.call(e))}return e}var Store=class{wuResult;schema;_columns;_cache={};rowFormatter;_filter={};onError;constructor(e,t,n,r={},i){this.wuResult=e,this.schema=t,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new s.RowFormatter(this._columns,n),this._filter=r,this.onError=i}columns(){return this._columns}schema2Columns(e,t=``){return e?e.children().filter(e=>e.name.indexOf(`__hidden`,e.name.length-8)===-1).map((e,n)=>{let r=e.name,i=e.attrs[`hpcc:keyed`],a={field:t+r,leafID:r,idx:n,label:r+(i?` (i)`:``),className:`resultGridCell`,hidden:!1,sortable:!1,width:i?16:0,isSet:e.isSet},o=this.schema2Columns(e,t+r+`_`);return o.length?(a.width+=10+o.reduce((e,t)=>e+t.width,0),a.children=o):(a.width+=e.charWidth()*9,a.formatter=(e,t)=>{switch(typeof e){case`string`:return{html:e.replace(/\t/g,`&nbsp;&nbsp;&nbsp;&nbsp;`).trim()};case`undefined`:return``}return e}),a}):[]}isChildDataset(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=0,n=null;for(let r in e)n||=Object.prototype.toString.call(e[r]),t++;return t===1&&n===`[object Array]`}rowToTable(e,t,n){if(this.isChildDataset(e)){for(let r in e)this.rowToTable(e[r],t,n);return}let r=s.domConstruct.create(`table`,{border:1,cellspacing:0,width:`100%`},n);switch(Object.prototype.toString.call(e)){case`[object Object]`:let i=s.domConstruct.create(`tr`,null,r);for(let t in e)s.domConstruct.create(`th`,{innerHTML:safeEncode(t)},i);i=s.domConstruct.create(`tr`,null,r);for(let r in e)switch(Object.prototype.toString.call(e[r])){case`[object Object]`:case`[object Array]`:this.rowToTable(e[r],t,n);break;default:s.domConstruct.create(`td`,{innerHTML:safeEncode(e[r])},i);break}break;case`[object Array]`:for(let t=0;t<e.length;++t)switch(Object.prototype.toString.call(e[t])){case`[object Boolean]`:case`[object Number]`:case`[object String]`:let n=s.domConstruct.create(`tr`,null,r);s.domConstruct.create(`td`,{innerHTML:safeEncode(e[t])},n);break;default:if(t===0){let n=s.domConstruct.create(`tr`,null,r);for(let r in e[t])s.domConstruct.create(`th`,{innerHTML:safeEncode(r)},n)}s.domConstruct.create(`tr`,null,r);for(let r in e[t])if(e[t][r])if(Object.prototype.toString.call(e[t][r])===`[object Object]`||Object.prototype.toString.call(e[t][r])===`[object Array]`){let i=s.domConstruct.create(`td`,null,n);this.rowToTable(e[t][r],e[t],i)}else if(r.indexOf(`__html`,r.length-6)!==-1)s.domConstruct.create(`td`,{innerHTML:e[t][r]},n);else if(r.indexOf(`__javascript`,r.length-12)!==-1)s.domConstruct.create(`td`,null,n);else{let i=e[t][r];s.domConstruct.create(`td`,{innerHTML:safeEncode(i)},n)}else s.domConstruct.create(`td`,{innerHTML:``},n)}break}}getIdentity(e){return e.__hpcc_id}_request(e,t){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});let n=`${e}->${t}`;if(this._cache[n])return this._cache[n];let r=this.wuResult.fetchRows(e,t-e,!1,this._filter).then(t=>({totalLength:this.wuResult.Total,data:t.map((t,n)=>{let r=this.rowFormatter.format(t);return r.__hpcc_id=e+n,r.__hpcc_orig=t,r})})).catch(e=>(this.onError(e.Message||`An exception has occurred`),{totalLength:0,data:[]}));return this._cache[n]=r,r}fetchRange(e){let t=new s.Deferred;return this._request(e.start,e.end).then(e=>t.resolve(e)),new s.QueryResults(t.then(e=>e.data),{totalLength:t.then(e=>e.totalLength)})}},WUResult=class extends s.Common{_result;_localStore;constructor(){super(),this.renderHtml(!1)}hashSum(e={}){return(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid(),resultName:this.resultName(),sequence:this.sequence(),nodeGroup:this.nodeGroup(),logicalFile:this.logicalFile(),userID:this.user(),password:this.password(),bypassCache:this.bypassCache(),...e})}_prevResultHash;calcResult(){let e=this.hashSum();if(this._prevResultHash!==e){this._prevResultHash=e;let t={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=n.Result.attach(t,this.wuid(),this.resultName()):this.wuid()&&this.sequence()!==void 0?this._result=n.Result.attach(t,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=n.Result.attachLogicalFile(t,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=n.Result.attachLogicalFile(t,``,this.logicalFile())),this._result&&this.bypassCache()&&this._result.bypassCache(this.bypassCache())}return this._result}fetch(e,t,n=new AbortController){let r=this.calcResult();return r?r.fetchRows(e,t,!1,{},n.signal):Promise.resolve([])}_prevStoreHash;_prevQueryHash;update(e,t){super.update(e,t);let n=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==n){this._prevStoreHash=n;let e=this.calcResult();e&&e.fetchXMLSchema().then(t=>{this._localStore=new Store(e,t,this.renderHtml(),this.filter(),e=>{this._dgrid&&(this._dgrid.noDataMessage=`<span class='dojoxGridNoData'>${e}</span>`,this._dgrid.refresh())}),this._dgrid?.set(`columns`,this._localStore.columns()),this._dgrid?.set(`collection`,this._localStore)})}}click(e,t,n){}};WUResult.prototype._class+=` eclwatch_WUResult`,WUResult.prototype.publish(`baseUrl`,``,`string`,`URL to WsWorkunits`),WUResult.prototype.publish(`user`,``,`string`,`User ID`),WUResult.prototype.publish(`password`,``,`string`,`Password`),WUResult.prototype.publish(`wuid`,``,`string`,`Workunit ID`),WUResult.prototype.publish(`resultName`,``,`string`,`Result Name`),WUResult.prototype.publish(`sequence`,void 0,`number`,`Sequence Number`),WUResult.prototype.publish(`nodeGroup`,``,`string`,`NodeGroup`),WUResult.prototype.publish(`logicalFile`,``,`string`,`Logical File Name`),WUResult.prototype.publish(`filter`,{},`object`,`Filter`),WUResult.prototype.publish(`bypassCache`,!1,`boolean`,`Bypass cached results`);var m=function(e){return e.CREATE=`Created`,e.COMPILE=`Compiled`,e.EXECUTE=`Executed`,e.COMPLETE=`Completed`,e}({}),h=function(e){return e.CREATE=`Creating`,e.COMPILE=`Compiling`,e.EXECUTE=`Executing`,e.COMPLETE=`Completed`,e}({}),WUStatus=class extends c.Graph{_wu;_wuHandle;_create;_compile;_execute;_complete;constructor(){super(),this.zoomable(!1).zoomToFitLimit(1).layout(`Hierarchy`).hierarchyRankDirection(`LR`).showToolbar(!1).allowDragging(!1)}_prevHash;attachWorkunit(){let e=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==e&&(this._prevHash=e,this._wu=n.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(e=>{this.lazyRender()}))}createVertex(e){return new c.Vertex().icon_diameter(32).icon_shape_colorFill(`none`).icon_shape_colorStroke(`none`).icon_image_colorFill(`darkgray`).iconAnchor(`middle`).textbox_shape_colorFill(`none`).textbox_shape_colorStroke(`none`).textbox_text_colorFill(`darkgray`).faChar(e)}updateVertex(e,t){e.icon_image_colorFill(t).textbox_text_colorFill(t)}updateVertexStatus(e,t=!1){let n=this._wu.isFailed()?`darkred`:`darkgreen`;switch(this._create.text(`Created`),this._compile.text(`Compiled`),this._execute.text(`Executed`),this._complete.text(`Completed`),e){case 0:this.updateVertex(this._create,`darkgray`),this.updateVertex(this._compile,`darkgray`),this.updateVertex(this._execute,`darkgray`),this.updateVertex(this._complete,`darkgray`);break;case 1:this._create.text(`Creating`),this.updateVertex(this._create,t?`orange`:n),this.updateVertex(this._compile,`darkgray`),this.updateVertex(this._execute,`darkgray`),this.updateVertex(this._complete,`darkgray`);break;case 2:this._compile.text(`Compiling`),this.updateVertex(this._create,n),this.updateVertex(this._compile,t?`orange`:n),this.updateVertex(this._execute,n),this.updateVertex(this._complete,`darkgray`);break;case 3:this._execute.text(`Executing`),this.updateVertex(this._create,n),this.updateVertex(this._compile,n),this.updateVertex(this._execute,t?`orange`:n),this.updateVertex(this._complete,`darkgray`);break;case 4:this.updateVertex(this._create,n),this.updateVertex(this._compile,n),this.updateVertex(this._execute,n),this.updateVertex(this._complete,n);break}}createEdge(e,t){return new c.Edge().sourceVertex(e).targetVertex(t).strokeColor(`black`).showArc(!1)}enter(e,t){super.enter(e,t),this._create=this.createVertex(``),this._compile=this.createVertex(``),this._execute=this.createVertex(``),this._complete=this.createVertex(``);let n=this.createEdge(this._create,this._compile),r=this.createEdge(this._compile,this._execute),i=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[n,r,i]})}update(e,t){switch(this.attachWorkunit(),this._wu.StateID){case n.WUStateID.Blocked:case n.WUStateID.Wait:case n.WUStateID.Scheduled:case n.WUStateID.UploadingFiled:this.updateVertexStatus(1);break;case n.WUStateID.Compiling:this.updateVertexStatus(2,!0);break;case n.WUStateID.Submitted:this.updateVertexStatus(1,!0);break;case n.WUStateID.Compiled:this.updateVertexStatus(2);break;case n.WUStateID.Aborting:case n.WUStateID.Running:this.updateVertexStatus(3,!0);break;case n.WUStateID.Aborted:case n.WUStateID.Archived:case n.WUStateID.Completed:this.updateVertexStatus(4);break;case n.WUStateID.Failed:this.updateVertexStatus(4,!1);break;case n.WUStateID.DebugPaused:case n.WUStateID.DebugRunning:case n.WUStateID.Paused:case n.WUStateID.Unknown:default:this.updateVertexStatus(0);break}super.update(e,t),this.zoomToFit()}exit(e,t){this._wuHandle&&this._wuHandle.release(),super.exit(e,t)}};WUStatus.prototype._class+=` eclwatch_WUStatus`,WUStatus.prototype.publish(`baseUrl`,``,`string`,`HPCC Platform Base URL`),WUStatus.prototype.publish(`wuid`,``,`string`,`Workunit ID`);function I1DChart(){}I1DChart.prototype._dataFamily=`1D`,I1DChart.prototype._palette=o.Palette.rainbow(`default`),I1DChart.prototype.click=function(e,t,n){},I1DChart.prototype.dblclick=function(e,t,n){};function I2DChart(){}I2DChart.prototype._dataFamily=`2D`,I2DChart.prototype._palette=o.Palette.ordinal(`default`),I2DChart.prototype.fillColor=function(e,t,n,r){return this._palette(e[0])},I2DChart.prototype.strokeColor=function(e,t,n,r){return(0,o.hsl)(this.fillColor(e,t,n,r)).darker().toString()},I2DChart.prototype.textColor=function(e,t,n,r){return o.Palette.textColor(this.fillColor(e,t,n,r))},I2DChart.prototype.click=function(e,t,n){},I2DChart.prototype.dblclick=function(e,t,n){};function I2DAggrChart(){}I2DAggrChart.prototype._palette=o.Palette.rainbow(`default`),I2DAggrChart.prototype.fillColor=function(e,t,n){return this._palette(e.length)},I2DAggrChart.prototype.strokeColor=function(e,t,n){return(0,o.hsl)(this.fillColor(e,t,n)).darker().toString()},I2DAggrChart.prototype.textColor=function(e,t,n){return o.Palette.textColor(this.fillColor(e,t,n))},I2DAggrChart.prototype.click=function(e,t,n){},I2DAggrChart.prototype.dblclick=function(e,t,n){};function IGraph(){}IGraph.prototype._dataFamily=`graph`,IGraph.prototype.vertex_click=function(e,t,n,r){r&&r.vertex},IGraph.prototype.vertex_dblclick=function(e,t,n,r){r&&r.vertex},IGraph.prototype.edge_click=function(e,t,n,r){r&&r.edge},IGraph.prototype.edge_dblclick=function(e,t,n,r){r&&r.edge};function IInput(){}IInput.prototype=Object.create(o.Widget.prototype),IInput.prototype.constructor=IInput,IInput.prototype.isValid=function(){return!(this.validate()&&!new RegExp(this.validate()).test(this.value()))},IInput.prototype.hasValue=function(){if(typeof this.type==`function`){switch(this.type()){case`radio`:case`checkbox`:if(this.value()&&this.value()!==`false`)return!0;break;default:if(this.value())return!0;break}return!1}return this.value()!==``},IInput.prototype.blur=function(e){},IInput.prototype.keyup=function(e){},IInput.prototype.focus=function(e){},IInput.prototype.click=function(e){},IInput.prototype.dblclick=function(e){},IInput.prototype.change=function(e,t){},IInput.prototype.resetValue=function(e){e.value(e._inputElement[0].node().value)},IInput.prototype.disable=function(e){this._inputElement.forEach(function(t,n){t.attr(`disabled`,e?`disabled`:null)})},IInput.prototype.setFocus=function(){this._inputElement.length&&this._inputElement[0].node().focus()},IInput.prototype.publish(`name`,``,`string`,`HTML name for the input`),IInput.prototype.publish(`label`,``,`string`,`Descriptive label`),IInput.prototype.publish(`value`,``,`string`,`Input Current Value`),IInput.prototype.publish(`validate`,null,`string`,`Input Validation`);function INDChart(){}INDChart.prototype._dataFamily=`ND`,INDChart.prototype._palette=o.Palette.ordinal(`default`),INDChart.prototype.fillColor=function(e,t,n,r){return this._palette(t)},INDChart.prototype.strokeColor=function(e,t,n,r){return(0,o.hsl)(this.fillColor(e,t,n,r)).darker().toString()},INDChart.prototype.textColor=function(e,t,n,r){return o.Palette.textColor(this.fillColor(e,t,n,r))},INDChart.prototype.click=function(e,t,n){},INDChart.prototype.dblclick=function(e,t,n){};function tip(){let e=d3TipDirection,t=d3TipOffset,n=d3TipHTML,r=functor(document.body),i=initNode(),a=null,s=null,c=null,tip=function(e){if(a=getSVGNode(e),!a)return;s=a.createSVGPoint();let t=r();t&&i&&t.appendChild(i)};tip.show=function(e,i,a){c=a[i];let o=Array.prototype.slice.call(arguments),s=n.apply(this,o);if(s===null)return tip;let d=t.apply(this,o),f=getNodeEl(),p=u.length,m,h=r().getBoundingClientRect();for(f.html(s).style(`opacity`,1).style(`pointer-events`,`all`);p--;)f.classed(u[p],!1);let g=!1,_={},v=u[0];for(let e=0;e<u.length&&(g=_placement_attempt(u[e]),!g);e++);if(g)f.classed(`notick`,!1);else{f.classed(`notick`,!0);let e=_vertical_adjustment(_[v]),t=_horizontal_adjustment(_[v]);_placement_attempt(v,e,t)}return tip;function _horizontal_adjustment(e){return e.left>e.right?e.left>0?-e.left:0:e.right>0?e.right:0}function _vertical_adjustment(e){return e.top>e.bottom?e.top>0?-e.top:0:e.bottom}function _placement_attempt(e,t,n){t||=0,n||=0,f.style(`white-space`,`nowrap`),m=l.get(e).apply(this),f.classed(e,!0).style(`top`,m.top+d[0]-t+`px`).style(`left`,m.left+d[1]-n+`px`);let r=f.node().getBoundingClientRect(),i=r.top>h.top&&r.left>h.left&&r.bottom<h.bottom&&r.right<h.right;return _[e]={top:h.top-r.top,right:r.right-h.right,bottom:r.bottom-h.bottom,left:h.left-r.left},f.style(`white-space`,`normal`),_[e].total_overflow=Object.keys(_[e]).filter(t=>_[e][t]>0).reduce((t,n)=>t+_[e][n],0),_[v].total_overflow>_[e].total_overflow&&(v=e),i||f.classed(e,!1),i}},tip.hide=function(){return getNodeEl().style(`opacity`,0).style(`pointer-events`,`none`),tip},tip.attr=function(e,t){if(arguments.length<2&&typeof e==`string`)return getNodeEl().attr(e);let n=Array.prototype.slice.call(arguments);return o.selection.prototype.attr.apply(getNodeEl(),n),tip},tip.style=function(e,t){if(arguments.length<2&&typeof e==`string`)return getNodeEl().style(e);let n=Array.prototype.slice.call(arguments);return o.selection.prototype.style.apply(getNodeEl(),n),tip},tip.direction=function(t){return arguments.length?(e=t==null?t:functor(t),tip):e},tip.offset=function(e){return arguments.length?(t=e==null?e:functor(e),tip):t},tip.html=function(e){return arguments.length?(n=e==null?e:functor(e),tip):n},tip.rootElement=function(e){return arguments.length?(r=functor(e),tip):r},tip.destroy=function(){return i&&=(getNodeEl().remove(),null),tip};function d3TipDirection(){return`n`}function d3TipOffset(){return[0,0]}function d3TipHTML(){return` `}let l=(0,o.map)({n:directionNorth,s:directionSouth,e:directionEast,w:directionWest,nw:directionNorthWest,ne:directionNorthEast,sw:directionSouthWest,se:directionSouthEast}),u=l.keys();function directionNorth(){let e=getScreenBBox(window);return{top:e.n.y-i.offsetHeight,left:e.n.x-i.offsetWidth/2}}function directionSouth(){let e=getScreenBBox(window);return{top:e.s.y+8,left:e.s.x-i.offsetWidth/2}}function directionEast(){let e=getScreenBBox(window);return{top:e.e.y-i.offsetHeight/2,left:e.e.x+8}}function directionWest(){let e=getScreenBBox(window);return{top:e.w.y-i.offsetHeight/2,left:e.w.x-i.offsetWidth-8}}function directionNorthWest(){let e=getScreenBBox(window);return{top:e.nw.y-i.offsetHeight,left:e.nw.x-i.offsetWidth}}function directionNorthEast(){let e=getScreenBBox(window);return{top:e.ne.y-i.offsetHeight,left:e.ne.x}}function directionSouthWest(){let e=getScreenBBox(window);return{top:e.sw.y,left:e.sw.x-i.offsetWidth}}function directionSouthEast(){let e=getScreenBBox(window);return{top:e.se.y,left:e.se.x}}function initNode(){let e=(0,o.select)(document.createElement(`div`));return e.attr(`class`,`d3-tip`).style(`position`,`absolute`).style(`top`,`0px`).style(`opacity`,0).style(`pointer-events`,`none`).style(`box-sizing`,`border-box`),e.node()}function getSVGNode(e){let t=e.node();return t?t.tagName.toLowerCase()===`svg`?t:t.ownerSVGElement:null}function getNodeEl(){return i??(i=initNode(),r().appendChild(i)),(0,o.select)(i)}function getScreenBBox(e){let t=c||e;for(;t.getCTM==null&&t.parentNode!=null;)t=t.parentNode;let n={},r=t.getCTM(),i=t.getBBox(),a=i.width,o=i.height,l=i.x,u=i.y;return s.x=l,s.y=u,n.nw=s.matrixTransform(r),s.x+=a,n.ne=s.matrixTransform(r),s.y+=o,n.se=s.matrixTransform(r),s.x-=a,n.sw=s.matrixTransform(r),s.y-=o/2,n.w=s.matrixTransform(r),s.x+=a,n.e=s.matrixTransform(r),s.x-=a/2,s.y-=o/2,n.n=s.matrixTransform(r),s.y+=o,n.s=s.matrixTransform(r),n}function functor(e){return typeof e==`function`?e:function(){return e}}return tip}function ITooltip(){if(this.tooltip=tip(),this.tooltipLabelFormat_exists()&&(this._labelFormatter=(0,o.format)(this.tooltipLabelFormat())),this.tooltipValueFormat_exists()&&(this._valueFormatter=(0,o.format)(this.tooltipValueFormat())),this.layerEnter){let e=this.layerEnter;this.layerEnter=function(t,n,r){this._parentOverlay||=t._parentOverlay,this.tooltipEnter(n),e.apply(this,arguments)};let t=this.layerUpdate;this.layerUpdate=function(e){t.apply(this,arguments),this.tooltipUpdate()};let n=this.layerExit;this.layerExit=function(e){this.tooltipExit(),n.apply(this,arguments)}}else{let e=this.enter;this.enter=function(t,n){this.tooltipEnter(n),e.apply(this,arguments)};let t=this.update;this.update=function(e,n){t.apply(this,arguments),this.tooltipUpdate()};let n=this.exit;this.exit=function(e,t){this.tooltipExit(),n.apply(this,arguments)}}}ITooltip.prototype=Object.create(o.Widget.prototype),ITooltip.prototype.constructor=ITooltip,ITooltip.prototype.tooltipEnter=function(e){let t=this.parentOverlay();t.empty()||this.tooltip.rootElement(t.node().parentNode),e.call(this.tooltip)},ITooltip.prototype.tooltipUpdate=function(){this.tooltip.offset(()=>{if(event&&this.tooltipFollowMouse()){let e=document.querySelector(`.d3-tip`);return e.style.display=`block`,e.style.left=this.tooltipOffset()+event.clientX+`px`,e.style.top=event.clientY+`px`,[]}switch(this.tooltip.direction()()){case`e`:return[0,this.tooltipOffset()];default:return[-this.tooltipOffset(),0]}});let e=this.tooltip.attr(`class`);e&&(e=e.split(` notick`).join(``)+(this.tooltipTick()?``:` notick`)+(this.tooltipStyle()===`none`?` hidden`:``),e=e.split(` `).filter(function(e){return e.indexOf(`ITooltip-tooltipStyle-`)!==0}).join(` `),e+=` ITooltip-tooltipStyle-`+this.tooltipStyle(),this.tooltip.attr(`class`,e))},ITooltip.prototype.tooltipExit=function(){this.tooltip&&this.tooltip.destroy()},ITooltip.prototype._tooltipHTML=function(e){return e},ITooltip.prototype.tooltipHTML=function(e){return this.tooltip.html(e)},ITooltip.prototype.tooltipFormat=function(e={}){switch(e.label=e.label===void 0?``:e.label,this._labelFormatter?e.label=this._labelFormatter(e.label)||``:this.formatData&&this.parseData&&(e.label=this.formatData(this.parseData(e.label))),e.series=e.series||``,e.value instanceof Date?e.value=e.value||``:this._valueFormatter?e.value=this._valueFormatter(e.value)||``:this.formatValue&&this.parseValue&&(e.value=this.formatValue(this.parseValue(e.value))),this.tooltipStyle()){case`none`:break;case`series-table`:let t=`<table class="ITooltip-series-table"><thead><tr><th colspan="2">`+e.label+`</th></tr></thead><tbody>`;return e.arr.forEach(function(e){t+=`<tr>`,t+=`<td>`,t+=`<div class="series-table-row-color" style="background-color:`+e.color+`"></div>`,t+=`<div class="series-table-row-label">`+e.label+`</div>`,t+=`</td>`,t+=`<td><div class="series-table-row-value">`+e.value+`</div></td>`,t+=`</tr>`}),t+=`</tbody>`,t+=`</table>`,t;default:return e.series?`<span style='color:`+this.tooltipSeriesColor()+`'>`+e.series+`</span> / <span style='color:`+this.tooltipLabelColor()+`'>`+e.label+`</span>: <span style='color:`+this.tooltipValueColor()+`'>`+e.value+`</span>`:e.label===``?`<span style='color:`+this.tooltipValueColor()+`'>`+e.value+`</span>`:`<span style='color:`+this.tooltipLabelColor()+`'>`+e.label+`</span>: <span style='color:`+this.tooltipValueColor()+`'>`+e.value+`</span>`}},ITooltip.prototype.tooltipKeyValueFormat=function(e,t){let n=``;for(let r in t)if(r!==e){let e=t&&t[r]?t[r]:``;n+=`<tr><td style="${this.tooltipLabelColor_exists()?`color:`+this.tooltipLabelColor():``}">${r}</td><td style="font-weight:normal">${e}</td></tr>`}return`<table>