@hpcc-js/html 3.3.19 → 3.3.20

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,3 +1,10 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common"),require("@hpcc-js/util"),require("@hpcc-js/react")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common","@hpcc-js/util","@hpcc-js/react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/html"]={},t["@hpcc-js/common"],t["@hpcc-js/util"],t["@hpcc-js/react"])}(this,function(t,e,o,i){"use strict";var r=Object.defineProperty,s=(t,e)=>r(t,"name",{value:e,configurable:!0}),l=(t,e,o)=>((t,e,o)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,"symbol"!=typeof e?e+"":e,o);const n=class _HTMLTooltip extends e.HTMLWidget{_triggerElement;_contentNode;_prevContentNode;_tooltipElement;_arrowElement;_tooltipHTMLCallback=s(t=>"<b>_tooltipHTMLCallback is undefined</b>","_tooltipHTMLCallback");_logger=o.scopedLogger("html/HTMLTooltip");constructor(){super(),this.visible(!1)}tooltipHTML(t){return this._tooltipHTMLCallback=t,this}tooltipContent(t){return arguments.length?(this._contentNode=t,this):this._contentNode}triggerElement(t){return this._triggerElement=t,this}enter(t,o){super.enter(t,o);const i=e.select("body");this._tooltipElement=i.append("div").attr("class","tooltip-div").style("z-index","2147483638").style("position","fixed"),this._arrowElement=i.append("div").attr("class","arrow-div").style("z-index","2147483638").style("position","fixed")}update(t,e){if(super.update(t,e),this._contentNode!==this._prevContentNode){const t=this._tooltipElement.node();[...t.querySelectorAll("*")].map(t=>t.__data__).filter(t=>t).forEach(t=>{"function"==typeof t.target&&t.target(null),"function"==typeof t.exit&&t.exit()}),t.innerHTML="",t.appendChild(this._contentNode),this._prevContentNode=this._contentNode}if(this._contentNode?this.onShowContent(this._contentNode):this._tooltipElement.html(()=>this._tooltipHTMLCallback(this.data())),this.fitContent()){this._tooltipElement.style("width","auto").style("height","auto").style("padding","0px").style("box-sizing","content-box");const t=this._tooltipElement.node().getBoundingClientRect();this.tooltipWidth_default(t.width),this.tooltipHeight_default(t.height)}this._closing=!1,this._tooltipElement.style("background-color",this.tooltipColor()).style("color",this.fontColor()).style("width",this.tooltipWidth()+"px").style("height",this.tooltipHeight()+"px").style("opacity",1).style("padding",this.padding()+"px").style("pointer-events",this.enablePointerEvents()?"all":"none").style("box-sizing","content-box"),this._arrowElement.style("opacity",1).style("pointer-events","none"),this.updateTooltipPosition()}onShowContent(t){}updateTooltipPosition(){const t=this.calcReferenceBBox(),e=this.calcTooltipDirection(t),o=t[e];return this._tooltipElement.style("top",o.y+"px").style("left",o.x+"px"),this.setArrowPosition(o,e),o}calcTooltipDirection(t){const e=Object.keys(t),o=this.direction();e.sort((t,e)=>t===o?-1:1);const i={top:0,left:0,width:window.innerWidth,height:window.innerHeight};for(let r=0;r<e.length;r++){const o={top:t[e[r]].y,left:t[e[r]].x,width:this.tooltipWidth(),height:this.tooltipHeight()};if(this.rectFits(o,i))return e[r]}return this._logger.warning(`Tooltip doesn't fit in the window for any of the directions. Defaulting to '${o}'`),this._logger.debug(i),this._logger.debug({top:t[o].y,left:t[o].x,width:this.tooltipWidth(),height:this.tooltipHeight()}),o}rectFits(t,e){return t.top>=e.top&&t.left>=e.left&&t.width+t.left<=e.width+e.left&&t.height+t.top<=e.height+e.top}setArrowPosition(t,e){let o,i,r="border-top-color";switch(this._arrowElement.style("border",`${this.arrowHeight()}px solid ${this.tooltipColor()}`).style("border-top-color","transparent").style("border-right-color","transparent").style("border-bottom-color","transparent").style("border-left-color","transparent"),e){case"n":o=t.y+this.tooltipHeight()+2*this.padding(),i=t.x+this.tooltipWidth()/2-this.arrowWidth()/2+this.padding(),r="border-top-color",this._arrowElement.style("border-top-width",`${this.arrowHeight()}px`).style("border-bottom-width","0px").style("border-left-width",this.arrowWidth()/2+"px").style("border-right-width",this.arrowWidth()/2+"px");break;case"s":o=t.y-this.arrowHeight(),i=t.x+this.padding()+this.tooltipWidth()/2-this.arrowWidth()/2,r="border-bottom-color",this._arrowElement.style("border-top-width","0px").style("border-bottom-width",`${this.arrowHeight()}px`).style("border-left-width",this.arrowWidth()/2+"px").style("border-right-width",this.arrowWidth()/2+"px");break;case"e":o=t.y+this.tooltipHeight()/2+this.padding()-this.arrowWidth()/2,i=t.x-this.arrowHeight(),r="border-right-color",this._arrowElement.style("border-top-width",this.arrowWidth()/2+"px").style("border-bottom-width",this.arrowWidth()/2+"px").style("border-left-width","0px").style("border-right-width",`${this.arrowHeight()}px`);break;case"w":o=t.y+this.tooltipHeight()/2-this.arrowWidth()/2+this.padding(),i=t.x+this.tooltipWidth()+2*this.padding(),r="border-left-color",this._arrowElement.style("border-top-width",this.arrowWidth()/2+"px").style("border-bottom-width",this.arrowWidth()/2+"px").style("border-left-width",`${this.arrowHeight()}px`).style("border-right-width","0px")}return void 0!==o&&void 0!==i?this._arrowElement.style("top",o+"px").style("left",i+"px").style(r,this.tooltipColor()).style("opacity",1):this._arrowElement.style("opacity",0),t}getReferenceNode(){return this._triggerElement?this._triggerElement.node():this.element().node().parentNode.parentNode}_cursorLoc;calcReferenceBBox(){const t=this.getReferenceNode();let{top:e,left:o,width:i,height:r}=t.getBoundingClientRect();const s=this.tooltipWidth(),l=this.tooltipHeight(),n=s/2,h=l/2,a=this.arrowHeight(),p=this.padding(),d=2*p;this.followCursor()&&this._cursorLoc&&(o=this._cursorLoc[0],e=this._cursorLoc[1],i=1,r=1);return{n:{x:o+i/2-n-p,y:e-l-a-d},e:{x:o+i+a,y:e+r/2-h-p},s:{x:o+i/2-n-p,y:e+r+a},w:{x:o-s-a-d,y:e+r/2-h-p},nw:{x:o-s-d,y:e-l-d},ne:{x:o+i,y:e-l-d},se:{x:o+i,y:e+r},sw:{x:o-s-d,y:e+r}}}_closing=!1;mouseout(){this._closing=!0,this._tooltipElement.on("mouseover",()=>{this._closing=!1}),this._tooltipElement.on("mouseout",()=>{this.mouseout()}),setTimeout(()=>{this._closing&&this.visible(!1)},this.closeDelay())}visible(t){return arguments.length?(this._arrowElement&&(this._arrowElement.style("visibility",t?"visible":"hidden"),this._tooltipElement.style("visibility",t?"visible":"hidden")),super.visible(t),this):super.visible()}exit(t,e){this._arrowElement&&(this._arrowElement.remove(),this._tooltipElement.remove()),super.exit(t,e)}};s(n,"HTMLTooltip");let h=n;h.prototype._class+=" html_HTMLTooltip",h.prototype.publish("fitContent",!1,"boolean","If true, tooltip will grow to fit its html content"),h.prototype.publish("followCursor",!1,"boolean","If true, tooltip will display relative to cursor location"),h.prototype.publish("closeDelay",400,"number","Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)"),h.prototype.publish("direction","n","set","Direction in which to display the tooltip",["n","s","e","w","ne","nw","se","sw"]),h.prototype.publish("padding",8,"number","Padding (pixels)"),h.prototype.publish("arrowWidth",16,"number","Width (or height depending on direction) of the tooltip arrow (pixels)"),h.prototype.publish("arrowHeight",8,"number","Height (or width depending on direction) of the tooltip arrow (pixels)"),h.prototype.publish("fontColor","#FFF","html-color","The default font color for text in the tooltip"),h.prototype.publish("tooltipColor","#000000EE","html-color","Background color of the tooltip"),h.prototype.publish("tooltipWidth",200,"number","Width of the tooltip (not including arrow) (pixels)"),h.prototype.publish("tooltipHeight",200,"number","Height of the tooltip (not including arrow) (pixels)"),h.prototype.publish("enablePointerEvents",!1,"boolean","If true, the 'pointer-events: all' style will be used");const a=class _SimpleTable extends e.HTMLWidget{_table;_tbody;_thead;_theadRow;constructor(){super()}transformData(){return this.data()}enter(t,e){super.enter(t,e),this._table=e.append("table"),this._thead=this._table.append("thead"),this._theadRow=this._thead.append("tr"),this._tbody=this._table.append("tbody")}update(t,o){super.update(t,o),this._table.style("width",this.autoWidth()?"auto":"100%");const i=this._theadRow.selectAll("th").data(this.columns());i.enter().append("th").attr("class",(t,e)=>`th-${e}`).merge(i).text(t=>t.toString()),i.exit().remove();const r=this._tbody.selectAll("tr").data(this.transformData());r.enter().append("tr").merge(r).each(function(t){const o=e.select(this).selectAll("td").data(t);o.enter().append("td").attr("class",(t,e)=>`col-${e}`).merge(o).text(t=>t.toString()),o.exit().remove()}),r.exit().remove()}};s(a,"SimpleTable");let p=a;p.prototype._class+=" html_SimpleTable",p.prototype.publish("autoWidth",!1,"boolean","If true, table width will be set to 'auto'. If false, the width is set to '100%'");const d=class _StyledTable extends p{constructor(){super()}applyStyleObject(t,e){Object.keys(e).forEach(o=>{t.style(o,e[o])})}update(t,e){super.update(t,e),e.selectAll("tr,th,td").attr("style","").style("font-family",this.fontFamily()).style("color",this.fontColor()),this.theadColumnStyles().forEach((t,o)=>{this.applyStyleObject(e.select(`.th-${o}`),t)}),this.tbodyColumnStyles().forEach((t,o)=>{this.applyStyleObject(e.selectAll(`.col-${o}`),t)});const o=Object.keys(this.evenRowStyles()).length>0,i=Object.keys(this.lastRowStyles()).length>0,r=e.selectAll("tbody > tr");if(o){const t=r.select(function(t,e){return e%2?this:null});this.applyStyleObject(t,this.evenRowStyles())}if(i){const t=r.select(function(t,e,o){return e===o.length-1?this:null});this.applyStyleObject(t,this.lastRowStyles())}}};s(d,"StyledTable");let c=d;c.prototype._class+=" html_StyledTable",c.prototype.publish("fontFamily","Verdana","string","Base font-family used within the table"),c.prototype.publish("fontColor","#333","string","Base font color used within the table"),c.prototype.publish("theadColumnStyles",[],"array",'Array of objects containing styles for the thead columns (ex: [{"color":"red"},{"color":"blue"}])'),c.prototype.publish("tbodyColumnStyles",[],"array",'Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])'),c.prototype.publish("lastRowStyles",{},"object",'Object containing styles for the last row (ex: {"color":"red"})'),c.prototype.publish("evenRowStyles",{},"object",'Object containing styles for even rows (ex: {"background-color":"#AAA"})');const u=class _BreakdownTable extends c{_tooltip;constructor(){super()}transformData(){const t=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount();return this.breakdownData(t)}breakdownData(t){const e=this.data().length,o=this.data().reduce((t,e)=>t+e[1],0),i=[];let r=0;this.data().sort((t,e)=>t[1]>e[1]?-1:1);const s=e-t>0;if(this.data().filter((e,o)=>!s||o<t-1).forEach(t=>{const e=Math.round(t[1]/o*100);r+=e,i.push([t[0],e+"%"])}),s){const o=`${this.otherLabel()} (${e-t+1})`,s="~"+(100-r)+"%";i.push([o,s])}return i}calculateRowCount(){const t=this.columns().length>0?this.thFontSize()+5:0,e=this.fontSize()+5,o=this.height()-t;return Math.floor(o/e)}enter(t,e){super.enter(t,e),this._tooltip=(new h).target(t),this._tooltip.tooltipHTML(t=>{const e=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount(),o=Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).height))??this.fontSize(),i=Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).width)),r=2*(i+30)+2*this._tooltip.padding(),s=o*Math.ceil((t.length-e)/2)+2*this._tooltip.padding();this._tooltip.tooltipWidth(r),this._tooltip.tooltipHeight(s);const l=this.breakdownData(this.data().length).slice(e-1);return`<div style="\n width: 100%;\n height: 100%;\n font-size: ${this.fontSize()}px;\n ">${l.map(t=>`<div style="\n float:left;\n width:${Math.floor(49.5)}%;\n ">${t[0]}: ${t[1]}</div>`).join("")}</div>`})}update(t,e){this.theadColumnStyles_default([{color:this.thFirstColor(),"font-size":this.thFontSize()+"px","font-weight":this.thFontWeight(),"text-align":this.labelAlignment(),width:"auto",padding:"0px"},{width:"1%","font-size":this.thFontSize()+"px","font-weight":this.thFontWeight(),"text-align":this.percentageAlignment(),padding:"0px"}]),this.tbodyColumnStyles_default([{color:this.topLabelColor(),"font-size":this.fontSize()+"px","font-weight":"normal","text-align":this.labelAlignment(),width:"auto",padding:"0px"},{color:this.topPercentageColor(),"font-size":this.fontSize()+"px","font-weight":"normal","text-align":this.percentageAlignment(),width:"1%",padding:"0px"}]),this.lastRowStyles_default([{color:this.otherLabelColor(),"font-size":this.fontSize()+"px","font-weight":this.otherLabelBold()?"bold":"normal","text-align":this.labelAlignment(),width:"auto",padding:"0px"},{color:this.otherLabelColor(),"font-size":this.fontSize()+"px","font-weight":this.otherPercentageBold()?"bold":"normal","text-align":this.percentageAlignment(),width:"1%",padding:"0px"}]),super.update(t,e);if((this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount())<this.data().length){const t=e.select("tbody > tr:last-child"),o=this;t.on("mouseout.tooltip",e=>{o._tooltip._triggerElement=t,o._tooltip.visible(!1).render()}).on("mouseenter.tooltip",e=>{o._tooltip._triggerElement=t,o._tooltip.direction("n").data(o.data()).visible(!0).render()})}}};s(u,"BreakdownTable");let g=u;g.prototype._class+=" html_BreakdownTable",g.prototype.publish("useCalculatedRowCount",!0,"boolean","If true, rowCount will be calculated and its default will be overwritten"),g.prototype.publish("rowCount",5,"number","Number of total rows to display (including the 'other' row)",void 0,{disable:s(t=>t.useCalculatedRowCount(),"disable")}),g.prototype.publish("fontSize",14,"number","Font size (pixels)"),g.prototype.publish("labelAlignment","left","set","Alignment of the label column text",["left","center","right"]),g.prototype.publish("percentageAlignment","center","set","Alignment of the percentage column text",["left","center","right"]),g.prototype.publish("topLabelColor","#333","html-color","Color of displayed 'top' labels"),g.prototype.publish("topPercentageColor","#1A99D5","html-color","Color of displayed 'top' percentages"),g.prototype.publish("topPercentageBold",!0,"html-color","If true, the 'top' percentages will be bold"),g.prototype.publish("otherLabel","Other","string","Label text for the 'other' row"),g.prototype.publish("otherLabelColor","#AAA","html-color","Color of the 'other' label"),g.prototype.publish("otherLabelBold",!1,"html-color","If true, the 'other' label will be bold"),g.prototype.publish("otherPercentageColor","#AAA","html-color","Color of the 'other' percentage"),g.prototype.publish("otherPercentageBold",!1,"html-color","If true, the 'other' percentage will be bold"),g.prototype.publish("thFontWeight","bold","string","Font weight for th elements"),g.prototype.publish("thFontSize",26,"number","Font size for th elements"),g.prototype.publish("thFirstColor","#333","html-color","Text color of the first th element"),g.prototype.publish("thLastColor","#333","html-color","Text color of the last th element");const b=class _JSXWidget extends e.HTMLWidget{rootNode;jsxRender(t,e){this.rootNode=i.React.render(t,e,this.rootNode)}};s(b,"JSXWidget"),l(b,"Component",i.React.Component),l(b,"createElement",i.React.createElement);let y=b;y.prototype._class+=" html_JSXWidget";const m=class _VNode{_attrs;_children;constructor(t,e){this._attrs=t,this._children=e}type(){return"div"}attrs(){return this._attrs}attr(t){return this._attrs[t]}children(){return this._children}update(t){for(const e in this._attrs)t.attr(e,this._attrs[e])}render(t){const o=t.selectAll(`${t.node().tagName} > *`).data([this]);return o.exit().remove(),o.enter().append(this.type()).attr("reactd3",0).merge(o).each(function(t){const o=e.select(this);t.update(o),t.renderChildren(o)})}renderChildren(t){const o=t.selectAll(`${t.node().tagName} > *`).data(this._children);return o.exit().remove(),o.enter().append(t=>document.createElement(t.type())).attr("reactd3",(t,e)=>e).merge(o).each(function(t){const o=e.select(this);t.update(o),t.renderChildren(o)})}};s(m,"VNode");let f=m;const _=class _ConstVNode extends f{_type;constructor(t,e,o){super(e,o),this._type=t}type(){return this._type}};s(_,"ConstVNode");let w=_;const x=class _TextVNode extends f{_text;constructor(t){super({},[]),this._text=t}type(){return"span"}update(t){super.update(t),t.text(this._text)}};s(x,"TextVNode");let C=x;function v(t){return"function"==typeof t}function S(t){return t.prototype&&t.prototype instanceof f}s(v,"isReactFn"),s(S,"isIVNode");const T=class _ReactD3{static createElement(t,e,...o){return S(t)?new t(e):v(t)?t(e):new w(t,e,o.map(t=>"string"==typeof t?new C(t):t))}static render(t,e){t.render(e)}};s(T,"ReactD3");let E=T;var W;W={__e:s(function(t,e,o,i){for(var r,s,l;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&null!=s.getDerivedStateFromError&&(r.setState(s.getDerivedStateFromError(t)),l=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(t,i||{}),l=r.__d),l)return r.__E=r}catch(n){t=n}throw t},"__e")},"function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Math.random().toString(8);var R=0;function B(t,e,o,i,r,s){e||(e={});var l,n,h=e;if("ref"in h)for(n in h={},e)"ref"==n?l=e[n]:h[n]=e[n];var a={type:t,props:h,key:o,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--R,__i:-1,__u:0,__source:r,__self:s};return W.vnode&&W.vnode(a),a}s(B,"u");const H=class _VizComponent extends y.Component{widget;refreshProps(){for(const t in this.props)this.widget[t]&&"function"==typeof this.widget[t]&&this.widget[t](this.props[t])}componentDidMount(){this.widget=(new this.props.type).target(this.base),this.refreshProps(),this.widget.render()}componentWillUnmount(){this.widget.target(null).render()}render(){return B("div",{style:this.props.style})}componentDidUpdate(){this.refreshProps(),this.widget.render()}};s(H,"VizComponent");let A=H;const k=class _VizInstance extends y.Component{widget;refreshProps(){for(const t in this.props)this.widget[t]&&"function"==typeof this.widget[t]&&this.widget[t](this.props[t])}componentDidMount(){this.widget=this.props.instance.target(this.base),this.refreshProps(),this.widget.render()}componentWillUnmount(){this.widget.target(null).render()}render(){return B("div",{style:this.props.style})}componentDidUpdate(){this.refreshProps(),this.widget.render()}};s(k,"VizInstance");let z=k;const F=class _StatsTable extends c{transformData(){const t=[["Total",0,0]],o=this.data();return o.forEach(e=>{t[0][1]+=e[1],t[0][2]+=e[2]}),o.concat(t).map(t=>[t[0],this.secondColumnFormat_exists()?e.format(this.secondColumnFormat())(t[1]):t[1],this.thirdColumnFormat_exists()?e.format(this.thirdColumnFormat())(t[2]):t[2]])}update(t,e){this.tbodyColumnStyles_default([{"font-weight":"bold",width:this.firstColumnWidth(),"text-align":"left"},{width:this.secondColumnWidth(),"text-align":"right"},{width:this.thirdColumnWidth(),"text-align":"right"}]),this.evenRowStyles_default([{"font-weight":"bold",width:this.firstColumnWidth(),"text-align":"left","font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()},{width:this.secondColumnWidth(),"text-align":"right","font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()},{width:this.thirdColumnWidth(),"text-align":"right","font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()}]),this.lastRowStyles_default({"font-weight":"bold"}),super.update(t,e)}};s(F,"StatsTable");let L=F;L.prototype._class+=" html_StatsTable",L.prototype.publish("labelColor","#333","html-color","Color of the text in the first column"),L.prototype.publish("primaryValueColor","#333","html-color","Color of the text in the second column"),L.prototype.publish("secondaryValueColor","#333","html-color","Color of the text in the third column"),L.prototype.publish("evenRowBackgroundColor","#333","html-color","Background color of the even rows"),L.prototype.publish("evenRowFontColor","#333","html-color","Font color of the even rows"),L.prototype.publish("firstColumnWidth","auto","string","CSS style applied as the 'width' for the first column (ex: 40px)"),L.prototype.publish("secondColumnWidth","1%","string","CSS style applied as the 'width' for the second column (ex: 40px)"),L.prototype.publish("thirdColumnWidth","1%","string","CSS style applied as the 'width' for the third column (ex: 40px)"),L.prototype.publish("secondColumnFormat","$,.0f","string","d3-format specifier applied to the second column's values",void 0,{optional:!0}),L.prototype.publish("thirdColumnFormat",null,"string","d3-format specifier applied to the third column's values",void 0,{optional:!0});const N=class _Item extends e.HTMLWidget{_owner;constructor(t){super(),this._owner=t,this._tag="a"}};s(N,"Item");let M=N;M.prototype._class+=" html_Item";const j=class _Button extends M{_icon;constructor(t,e){super(t),this._icon=e}icon(){return this._icon}enter(t,e){super.enter(t,e),e.attr("href","#").on("click",(t,e,o)=>this._owner.titleBarClick(this,t,e,o)).append("i").attr("class",`fa ${this._icon} fa-lg fa-fw`)}};s(j,"Button");let D=j;D.prototype._class+=" html_Button";const P=class _ToggleButton extends D{enter(t,e){e.on("click.sel",(t,e,o)=>{this.selected(!this.selected()),this.render()}),super.enter(t,e)}update(t,e){super.update(t,e),this._element.classed("selected",this.selected())}};s(P,"ToggleButton");let I=P;I.prototype._class+=" html_ToggleButton",I.prototype.publish("selected",!1,"boolean");const $=class _Spacer extends M{enter(t,e){super.enter(t,e),e.attr("class","spacer").attr("href","#").append("i")}};s($,"Spacer");let V=$;V.prototype._class+=" html_Spacer";const O=class _TitleBar extends y{_divMain;_divIconBar;_divTitle;constructor(){super()}enter(t,e){super.enter(t,e),this._divMain=e.append("div").attr("class","main"),this._divIconBar=this._divMain.append("div").attr("class","icon-bar"),this._divTitle=this._divMain.append("div").attr("class","title")}update(t,e){super.update(t,e),this._divTitle.text(this.title());const o=this._divIconBar.selectAll(".icon-bar-item").data(this.buttons());o.enter().append("div").attr("class","icon-bar-item").each(function(t){t.target(this)}).merge(o).each(function(t){t.render()}),o.exit().each(function(t){t.target(null)}).remove(),o.order()}};s(O,"TitleBar");let U=O;U.prototype._class+=" html_TitleBar",U.prototype.publish("title","","string"),U.prototype.publish("buttons",[],"widgetArray"),t.BUILD_VERSION="3.24.0",t.BreakdownTable=g,t.Button=D,t.HTMLTooltip=h,t.Item=M,t.JSXWidget=y,t.PKG_NAME="@hpcc-js/html",t.PKG_VERSION="3.3.19",t.ReactD3=E,t.SimpleTable=p,t.Spacer=V,t.StatsTable=L,t.StyledTable=c,t.TitleBar=U,t.ToggleButton=I,t.VNode=f,t.VizComponent=A,t.VizInstance=z,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,n){typeof exports==`object`&&typeof module<`u`?n(exports,require("@hpcc-js/common"),require("@hpcc-js/util"),require("@hpcc-js/react")):typeof define==`function`&&define.amd?define([`exports`,`@hpcc-js/common`,`@hpcc-js/util`,`@hpcc-js/react`],n):(t=typeof globalThis<`u`?globalThis:t||self,n(t[`@hpcc-js/html`]={},t[`@hpcc-js/common`],t[`@hpcc-js/util`],t[`@hpcc-js/react`]))})(this,function(t,n,r,i){Object.defineProperty(t,Symbol.toStringTag,{value:`Module`});var a=`@hpcc-js/html`,o=`3.3.20`,s=`3.25.1`,HTMLTooltip=class extends n.HTMLWidget{_triggerElement;_contentNode;_prevContentNode;_tooltipElement;_arrowElement;_tooltipHTMLCallback=t=>`<b>_tooltipHTMLCallback is undefined</b>`;_logger=(0,r.scopedLogger)(`html/HTMLTooltip`);constructor(){super(),this.visible(!1)}tooltipHTML(t){return this._tooltipHTMLCallback=t,this}tooltipContent(t){return arguments.length?(this._contentNode=t,this):this._contentNode}triggerElement(t){return this._triggerElement=t,this}enter(t,r){super.enter(t,r);let i=(0,n.select)(`body`);this._tooltipElement=i.append(`div`).attr(`class`,`tooltip-div`).style(`z-index`,`2147483638`).style(`position`,`fixed`),this._arrowElement=i.append(`div`).attr(`class`,`arrow-div`).style(`z-index`,`2147483638`).style(`position`,`fixed`)}update(t,n){if(super.update(t,n),this._contentNode!==this._prevContentNode){let t=this._tooltipElement.node();[...t.querySelectorAll(`*`)].map(t=>t.__data__).filter(t=>t).forEach(t=>{typeof t.target==`function`&&t.target(null),typeof t.exit==`function`&&t.exit()}),t.innerHTML=``,t.appendChild(this._contentNode),this._prevContentNode=this._contentNode}if(this._contentNode?this.onShowContent(this._contentNode):this._tooltipElement.html(()=>this._tooltipHTMLCallback(this.data())),this.fitContent()){this._tooltipElement.style(`width`,`auto`).style(`height`,`auto`).style(`padding`,`0px`).style(`box-sizing`,`content-box`);let t=this._tooltipElement.node().getBoundingClientRect();this.tooltipWidth_default(t.width),this.tooltipHeight_default(t.height)}this._closing=!1,this._tooltipElement.style(`background-color`,this.tooltipColor()).style(`color`,this.fontColor()).style(`width`,this.tooltipWidth()+`px`).style(`height`,this.tooltipHeight()+`px`).style(`opacity`,1).style(`padding`,this.padding()+`px`).style(`pointer-events`,this.enablePointerEvents()?`all`:`none`).style(`box-sizing`,`content-box`),this._arrowElement.style(`opacity`,1).style(`pointer-events`,`none`),this.updateTooltipPosition()}onShowContent(t){}updateTooltipPosition(){let t=this.calcReferenceBBox(),n=this.calcTooltipDirection(t),r=t[n];return this._tooltipElement.style(`top`,r.y+`px`).style(`left`,r.x+`px`),this.setArrowPosition(r,n),r}calcTooltipDirection(t){let n=Object.keys(t),r=this.direction();n.sort((t,n)=>t===r?-1:1);let i={top:0,left:0,width:window.innerWidth,height:window.innerHeight};for(let r=0;r<n.length;r++){let a={top:t[n[r]].y,left:t[n[r]].x,width:this.tooltipWidth(),height:this.tooltipHeight()};if(this.rectFits(a,i))return n[r]}return this._logger.warning(`Tooltip doesn't fit in the window for any of the directions. Defaulting to '${r}'`),this._logger.debug(i),this._logger.debug({top:t[r].y,left:t[r].x,width:this.tooltipWidth(),height:this.tooltipHeight()}),r}rectFits(t,n){return t.top>=n.top&&t.left>=n.left&&t.width+t.left<=n.width+n.left&&t.height+t.top<=n.height+n.top}setArrowPosition(t,n){let r,i,a=`border-top-color`;switch(this._arrowElement.style(`border`,`${this.arrowHeight()}px solid ${this.tooltipColor()}`).style(`border-top-color`,`transparent`).style(`border-right-color`,`transparent`).style(`border-bottom-color`,`transparent`).style(`border-left-color`,`transparent`),n){case`n`:r=t.y+this.tooltipHeight()+this.padding()*2,i=t.x+this.tooltipWidth()/2-this.arrowWidth()/2+this.padding(),a=`border-top-color`,this._arrowElement.style(`border-top-width`,`${this.arrowHeight()}px`).style(`border-bottom-width`,`0px`).style(`border-left-width`,`${this.arrowWidth()/2}px`).style(`border-right-width`,`${this.arrowWidth()/2}px`);break;case`s`:r=t.y-this.arrowHeight(),i=t.x+this.padding()+this.tooltipWidth()/2-this.arrowWidth()/2,a=`border-bottom-color`,this._arrowElement.style(`border-top-width`,`0px`).style(`border-bottom-width`,`${this.arrowHeight()}px`).style(`border-left-width`,`${this.arrowWidth()/2}px`).style(`border-right-width`,`${this.arrowWidth()/2}px`);break;case`e`:r=t.y+this.tooltipHeight()/2+this.padding()-this.arrowWidth()/2,i=t.x-this.arrowHeight(),a=`border-right-color`,this._arrowElement.style(`border-top-width`,`${this.arrowWidth()/2}px`).style(`border-bottom-width`,`${this.arrowWidth()/2}px`).style(`border-left-width`,`0px`).style(`border-right-width`,`${this.arrowHeight()}px`);break;case`w`:r=t.y+this.tooltipHeight()/2-this.arrowWidth()/2+this.padding(),i=t.x+this.tooltipWidth()+this.padding()*2,a=`border-left-color`,this._arrowElement.style(`border-top-width`,`${this.arrowWidth()/2}px`).style(`border-bottom-width`,`${this.arrowWidth()/2}px`).style(`border-left-width`,`${this.arrowHeight()}px`).style(`border-right-width`,`0px`);break}return r!==void 0&&i!==void 0?this._arrowElement.style(`top`,r+`px`).style(`left`,i+`px`).style(a,this.tooltipColor()).style(`opacity`,1):this._arrowElement.style(`opacity`,0),t}getReferenceNode(){return this._triggerElement?this._triggerElement.node():this.element().node().parentNode.parentNode}_cursorLoc;calcReferenceBBox(){let{top:t,left:n,width:r,height:i}=this.getReferenceNode().getBoundingClientRect(),a=this.tooltipWidth(),o=this.tooltipHeight(),s=a/2,c=o/2,l=this.arrowHeight(),d=this.padding(),f=d*2;return this.followCursor()&&this._cursorLoc&&(n=this._cursorLoc[0],t=this._cursorLoc[1],r=1,i=1),{n:{x:n+r/2-s-d,y:t-o-l-f},e:{x:n+r+l,y:t+i/2-c-d},s:{x:n+r/2-s-d,y:t+i+l},w:{x:n-a-l-f,y:t+i/2-c-d},nw:{x:n-a-f,y:t-o-f},ne:{x:n+r,y:t-o-f},se:{x:n+r,y:t+i},sw:{x:n-a-f,y:t+i}}}_closing=!1;mouseout(){this._closing=!0,this._tooltipElement.on(`mouseover`,()=>{this._closing=!1}),this._tooltipElement.on(`mouseout`,()=>{this.mouseout()}),setTimeout(()=>{this._closing&&this.visible(!1)},this.closeDelay())}visible(t){return arguments.length?(this._arrowElement&&(this._arrowElement.style(`visibility`,t?`visible`:`hidden`),this._tooltipElement.style(`visibility`,t?`visible`:`hidden`)),super.visible(t),this):super.visible()}exit(t,n){this._arrowElement&&(this._arrowElement.remove(),this._tooltipElement.remove()),super.exit(t,n)}};HTMLTooltip.prototype._class+=` html_HTMLTooltip`,HTMLTooltip.prototype.publish(`fitContent`,!1,`boolean`,`If true, tooltip will grow to fit its html content`),HTMLTooltip.prototype.publish(`followCursor`,!1,`boolean`,`If true, tooltip will display relative to cursor location`),HTMLTooltip.prototype.publish(`closeDelay`,400,`number`,`Number of milliseconds to wait before closing tooltip (cancelled on tooltip mouseover event)`),HTMLTooltip.prototype.publish(`direction`,`n`,`set`,`Direction in which to display the tooltip`,[`n`,`s`,`e`,`w`,`ne`,`nw`,`se`,`sw`]),HTMLTooltip.prototype.publish(`padding`,8,`number`,`Padding (pixels)`),HTMLTooltip.prototype.publish(`arrowWidth`,16,`number`,`Width (or height depending on direction) of the tooltip arrow (pixels)`),HTMLTooltip.prototype.publish(`arrowHeight`,8,`number`,`Height (or width depending on direction) of the tooltip arrow (pixels)`),HTMLTooltip.prototype.publish(`fontColor`,`#FFF`,`html-color`,`The default font color for text in the tooltip`),HTMLTooltip.prototype.publish(`tooltipColor`,`#000000EE`,`html-color`,`Background color of the tooltip`),HTMLTooltip.prototype.publish(`tooltipWidth`,200,`number`,`Width of the tooltip (not including arrow) (pixels)`),HTMLTooltip.prototype.publish(`tooltipHeight`,200,`number`,`Height of the tooltip (not including arrow) (pixels)`),HTMLTooltip.prototype.publish(`enablePointerEvents`,!1,`boolean`,`If true, the 'pointer-events: all' style will be used`);var SimpleTable=class extends n.HTMLWidget{_table;_tbody;_thead;_theadRow;constructor(){super()}transformData(){return this.data()}enter(t,n){super.enter(t,n),this._table=n.append(`table`),this._thead=this._table.append(`thead`),this._theadRow=this._thead.append(`tr`),this._tbody=this._table.append(`tbody`)}update(t,r){super.update(t,r),this._table.style(`width`,this.autoWidth()?`auto`:`100%`);let i=this._theadRow.selectAll(`th`).data(this.columns());i.enter().append(`th`).attr(`class`,(t,n)=>`th-${n}`).merge(i).text(t=>t.toString()),i.exit().remove();let a=this._tbody.selectAll(`tr`).data(this.transformData());a.enter().append(`tr`).merge(a).each(function(t){let r=(0,n.select)(this).selectAll(`td`).data(t);r.enter().append(`td`).attr(`class`,(t,n)=>`col-${n}`).merge(r).text(t=>t.toString()),r.exit().remove()}),a.exit().remove()}};SimpleTable.prototype._class+=` html_SimpleTable`,SimpleTable.prototype.publish(`autoWidth`,!1,`boolean`,`If true, table width will be set to 'auto'. If false, the width is set to '100%'`);var StyledTable=class extends SimpleTable{constructor(){super()}applyStyleObject(t,n){Object.keys(n).forEach(r=>{t.style(r,n[r])})}update(t,n){super.update(t,n),n.selectAll(`tr,th,td`).attr(`style`,``).style(`font-family`,this.fontFamily()).style(`color`,this.fontColor()),this.theadColumnStyles().forEach((t,r)=>{this.applyStyleObject(n.select(`.th-${r}`),t)}),this.tbodyColumnStyles().forEach((t,r)=>{this.applyStyleObject(n.selectAll(`.col-${r}`),t)});let r=Object.keys(this.evenRowStyles()).length>0,i=Object.keys(this.lastRowStyles()).length>0,a=n.selectAll(`tbody > tr`);if(r){let t=a.select(function(t,n){return n%2?this:null});this.applyStyleObject(t,this.evenRowStyles())}if(i){let t=a.select(function(t,n,r){return n===r.length-1?this:null});this.applyStyleObject(t,this.lastRowStyles())}}};StyledTable.prototype._class+=` html_StyledTable`,StyledTable.prototype.publish(`fontFamily`,`Verdana`,`string`,`Base font-family used within the table`),StyledTable.prototype.publish(`fontColor`,`#333`,`string`,`Base font color used within the table`),StyledTable.prototype.publish(`theadColumnStyles`,[],`array`,`Array of objects containing styles for the thead columns (ex: [{"color":"red"},{"color":"blue"}])`),StyledTable.prototype.publish(`tbodyColumnStyles`,[],`array`,`Array of objects containing styles for the tbody columns (ex: [{"color":"red"},{"color":"blue"}])`),StyledTable.prototype.publish(`lastRowStyles`,{},`object`,`Object containing styles for the last row (ex: {"color":"red"})`),StyledTable.prototype.publish(`evenRowStyles`,{},`object`,`Object containing styles for even rows (ex: {"background-color":"#AAA"})`);var BreakdownTable=class extends StyledTable{_tooltip;constructor(){super()}transformData(){let t=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount();return this.breakdownData(t)}breakdownData(t){let n=this.data().length,r=this.data().reduce((t,n)=>t+n[1],0),i=[],a=0;this.data().sort((t,n)=>t[1]>n[1]?-1:1);let o=n-t>0;if(this.data().filter((n,r)=>o?r<t-1:!0).forEach(t=>{let n=Math.round(t[1]/r*100);a+=n,i.push([t[0],n+`%`])}),o){let r=`${this.otherLabel()} (${n-t+1})`,o=`~`+(100-a)+`%`;i.push([r,o])}return i}calculateRowCount(){let t=this.columns().length>0?this.thFontSize()+5:0,n=this.fontSize()+5,r=this.height()-t;return Math.floor(r/n)}enter(t,n){super.enter(t,n),this._tooltip=new HTMLTooltip().target(t),this._tooltip.tooltipHTML(t=>{let n=this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount(),r=Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).height))??this.fontSize(),i=2*(Math.max(...t.map(t=>this.textSize(t[0],this.fontFamily(),this.fontSize()).width))+30)+this._tooltip.padding()*2,a=r*Math.ceil((t.length-n)/2)+this._tooltip.padding()*2;this._tooltip.tooltipWidth(i),this._tooltip.tooltipHeight(a);let o=this.breakdownData(this.data().length).slice(n-1);return`<div style="
2
+ width: 100%;
3
+ height: 100%;
4
+ font-size: ${this.fontSize()}px;
5
+ ">${o.map(t=>`<div style="
6
+ float:left;
7
+ width:49%;
8
+ ">${t[0]}: ${t[1]}</div>`).join(``)}</div>`})}update(t,n){if(this.theadColumnStyles_default([{color:this.thFirstColor(),"font-size":this.thFontSize()+`px`,"font-weight":this.thFontWeight(),"text-align":this.labelAlignment(),width:`auto`,padding:`0px`},{width:`1%`,"font-size":this.thFontSize()+`px`,"font-weight":this.thFontWeight(),"text-align":this.percentageAlignment(),padding:`0px`}]),this.tbodyColumnStyles_default([{color:this.topLabelColor(),"font-size":this.fontSize()+`px`,"font-weight":`normal`,"text-align":this.labelAlignment(),width:`auto`,padding:`0px`},{color:this.topPercentageColor(),"font-size":this.fontSize()+`px`,"font-weight":`normal`,"text-align":this.percentageAlignment(),width:`1%`,padding:`0px`}]),this.lastRowStyles_default([{color:this.otherLabelColor(),"font-size":this.fontSize()+`px`,"font-weight":this.otherLabelBold()?`bold`:`normal`,"text-align":this.labelAlignment(),width:`auto`,padding:`0px`},{color:this.otherLabelColor(),"font-size":this.fontSize()+`px`,"font-weight":this.otherPercentageBold()?`bold`:`normal`,"text-align":this.percentageAlignment(),width:`1%`,padding:`0px`}]),super.update(t,n),(this.useCalculatedRowCount()?this.calculateRowCount():this.rowCount())<this.data().length){let t=n.select(`tbody > tr:last-child`),r=this;t.on(`mouseout.tooltip`,n=>{r._tooltip._triggerElement=t,r._tooltip.visible(!1).render()}).on(`mouseenter.tooltip`,n=>{r._tooltip._triggerElement=t,r._tooltip.direction(`n`).data(r.data()).visible(!0).render()})}}};BreakdownTable.prototype._class+=` html_BreakdownTable`,BreakdownTable.prototype.publish(`useCalculatedRowCount`,!0,`boolean`,`If true, rowCount will be calculated and its default will be overwritten`),BreakdownTable.prototype.publish(`rowCount`,5,`number`,`Number of total rows to display (including the 'other' row)`,void 0,{disable:t=>t.useCalculatedRowCount()}),BreakdownTable.prototype.publish(`fontSize`,14,`number`,`Font size (pixels)`),BreakdownTable.prototype.publish(`labelAlignment`,`left`,`set`,`Alignment of the label column text`,[`left`,`center`,`right`]),BreakdownTable.prototype.publish(`percentageAlignment`,`center`,`set`,`Alignment of the percentage column text`,[`left`,`center`,`right`]),BreakdownTable.prototype.publish(`topLabelColor`,`#333`,`html-color`,`Color of displayed 'top' labels`),BreakdownTable.prototype.publish(`topPercentageColor`,`#1A99D5`,`html-color`,`Color of displayed 'top' percentages`),BreakdownTable.prototype.publish(`topPercentageBold`,!0,`html-color`,`If true, the 'top' percentages will be bold`),BreakdownTable.prototype.publish(`otherLabel`,`Other`,`string`,`Label text for the 'other' row`),BreakdownTable.prototype.publish(`otherLabelColor`,`#AAA`,`html-color`,`Color of the 'other' label`),BreakdownTable.prototype.publish(`otherLabelBold`,!1,`html-color`,`If true, the 'other' label will be bold`),BreakdownTable.prototype.publish(`otherPercentageColor`,`#AAA`,`html-color`,`Color of the 'other' percentage`),BreakdownTable.prototype.publish(`otherPercentageBold`,!1,`html-color`,`If true, the 'other' percentage will be bold`),BreakdownTable.prototype.publish(`thFontWeight`,`bold`,`string`,`Font weight for th elements`),BreakdownTable.prototype.publish(`thFontSize`,26,`number`,`Font size for th elements`),BreakdownTable.prototype.publish(`thFirstColor`,`#333`,`html-color`,`Text color of the first th element`),BreakdownTable.prototype.publish(`thLastColor`,`#333`,`html-color`,`Text color of the last th element`);var JSXWidget=class extends n.HTMLWidget{static Component=i.React.Component;static createElement=i.React.createElement;rootNode;jsxRender(t,n){this.rootNode=i.React.render(t,n,this.rootNode)}};JSXWidget.prototype._class+=` html_JSXWidget`;var VNode=class{_attrs;_children;constructor(t,n){this._attrs=t,this._children=n}type(){return`div`}attrs(){return this._attrs}attr(t){return this._attrs[t]}children(){return this._children}update(t){for(let n in this._attrs)t.attr(n,this._attrs[n])}render(t){let r=t.selectAll(`${t.node().tagName} > *`).data([this]);return r.exit().remove(),r.enter().append(this.type()).attr(`reactd3`,0).merge(r).each(function(t){let r=(0,n.select)(this);t.update(r),t.renderChildren(r)})}renderChildren(t){let r=t.selectAll(`${t.node().tagName} > *`).data(this._children);return r.exit().remove(),r.enter().append(t=>document.createElement(t.type())).attr(`reactd3`,(t,n)=>n).merge(r).each(function(t){let r=(0,n.select)(this);t.update(r),t.renderChildren(r)})}},ConstVNode=class extends VNode{_type;constructor(t,n,r){super(n,r),this._type=t}type(){return this._type}},TextVNode=class extends VNode{_text;constructor(t){super({},[]),this._text=t}type(){return`span`}update(t){super.update(t),t.text(this._text)}};function isReactFn(t){return typeof t==`function`}function isIVNode(t){return t.prototype&&t.prototype instanceof VNode}var ReactD3=class{static createElement(t,n,...r){return isIVNode(t)?new t(n):isReactFn(t)?t(n):new ConstVNode(t,n,r.map(t=>typeof t==`string`?new TextVNode(t):t))}static render(t,n){t.render(n)}},c,l,d,f,p,h,e,g,_,v,y,w,k,M,F={},R=[],U=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,W=Array.isArray;function m(t,n){for(var r in n)t[r]=n[r];return t}function b(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function x(t,n,r,i,a){var o={type:t,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++d,__i:-1,__u:0};return a==null&&l.vnode!=null&&l.vnode(o),o}function S(t){return t.children}function C(t,n){this.props=t,this.context=n}function $(t,n){if(n==null)return t.__?$(t.__,t.__i+1):null;for(var r;n<t.__k.length;n++)if((r=t.__k[n])!=null&&r.__e!=null)return r.__e;return typeof t.type==`function`?$(t):null}function I(t){if(t.__P&&t.__d){var n=t.__v,r=n.__e,i=[],a=[],o=m({},n);o.__v=n.__v+1,l.vnode&&l.vnode(o),q(t.__P,o,n,t.__n,t.__P.namespaceURI,32&n.__u?[r]:null,i,r??$(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,D(i,o,a),n.__e=n.__=null,o.__e!=r&&P(o)}}function P(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(n){if(n!=null&&n.__e!=null)return t.__e=t.__c.base=n.__e}),P(t)}function A(t){(!t.__d&&(t.__d=!0)&&f.push(t)&&!H.__r++||p!=l.debounceRendering)&&((p=l.debounceRendering)||h)(H)}function H(){try{for(var t,n=1;f.length;)f.length>n&&f.sort(e),t=f.shift(),n=f.length,I(t)}finally{f.length=H.__r=0}}function L(t,n,r,i,a,o,s,c,l,d,f){var p,h,g,_,v,y,w,k=i&&i.__k||R,M=n.length;for(l=T(r,n,k,l,M),p=0;p<M;p++)(g=r.__k[p])!=null&&(h=g.__i!=-1&&k[g.__i]||F,g.__i=p,y=q(t,g,h,a,o,s,c,l,d,f),_=g.__e,g.ref&&h.ref!=g.ref&&(h.ref&&J(h.ref,null,g),f.push(g.ref,g.__c||_,g)),v==null&&_!=null&&(v=_),(w=!!(4&g.__u))||h.__k===g.__k?(l=j(g,l,t,w),w&&h.__e&&(h.__e=null)):typeof g.type==`function`&&y!==void 0?l=y:_&&(l=_.nextSibling),g.__u&=-7);return r.__e=v,l}function T(t,n,r,i,a){var o,s,c,l,d,f=r.length,p=f,h=0;for(t.__k=Array(a),o=0;o<a;o++)(s=n[o])!=null&&typeof s!=`boolean`&&typeof s!=`function`?(typeof s==`string`||typeof s==`number`||typeof s==`bigint`||s.constructor==String?s=t.__k[o]=x(null,s,null,null,null):W(s)?s=t.__k[o]=x(S,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=t.__k[o]=x(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):t.__k[o]=s,l=o+h,s.__=t,s.__b=t.__b+1,c=null,(d=s.__i=O(s,r,l,p))!=-1&&(p--,(c=r[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(a>f?h--:a<f&&h++),typeof s.type!=`function`&&(s.__u|=4)):d!=l&&(d==l-1?h--:d==l+1?h++:(d>l?h--:h++,s.__u|=4))):t.__k[o]=null;if(p)for(o=0;o<f;o++)(c=r[o])!=null&&!(2&c.__u)&&(c.__e==i&&(i=$(c)),K(c,c));return i}function j(t,n,r,i){var a,o;if(typeof t.type==`function`){for(a=t.__k,o=0;a&&o<a.length;o++)a[o]&&(a[o].__=t,n=j(a[o],n,r,i));return n}t.__e!=n&&(i&&(n&&t.type&&!n.parentNode&&(n=$(t)),r.insertBefore(t.__e,n||null)),n=t.__e);do n&&=n.nextSibling;while(n!=null&&n.nodeType==8);return n}function O(t,n,r,i){var a,o,s,c=t.key,l=t.type,d=n[r],f=d!=null&&(2&d.__u)==0;if(d===null&&c==null||f&&c==d.key&&l==d.type)return r;if(i>+!!f){for(a=r-1,o=r+1;a>=0||o<n.length;)if((d=n[s=a>=0?a--:o++])!=null&&!(2&d.__u)&&c==d.key&&l==d.type)return s}return-1}function z(t,n,r){n[0]==`-`?t.setProperty(n,r??``):t[n]=r==null?``:typeof r!=`number`||U.test(n)?r:r+`px`}function N(t,n,r,i,a){var o,s;n:if(n==`style`)if(typeof r==`string`)t.style.cssText=r;else{if(typeof i==`string`&&(t.style.cssText=i=``),i)for(n in i)r&&n in r||z(t.style,n,``);if(r)for(n in r)i&&r[n]==i[n]||z(t.style,n,r[n])}else if(n[0]==`o`&&n[1]==`n`)o=n!=(n=n.replace(y,`$1`)),s=n.toLowerCase(),n=s in t||n==`onFocusOut`||n==`onFocusIn`?s.slice(2):n.slice(2),t.l||={},t.l[n+o]=r,r?i?r[v]=i[v]:(r[v]=w,t.addEventListener(n,o?M:k,o)):t.removeEventListener(n,o?M:k,o);else{if(a==`http://www.w3.org/2000/svg`)n=n.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(n!=`width`&&n!=`height`&&n!=`href`&&n!=`list`&&n!=`form`&&n!=`tabIndex`&&n!=`download`&&n!=`rowSpan`&&n!=`colSpan`&&n!=`role`&&n!=`popover`&&n in t)try{t[n]=r??``;break n}catch{}typeof r==`function`||(r==null||!1===r&&n[4]!=`-`?t.removeAttribute(n):t.setAttribute(n,n==`popover`&&r==1?``:r))}}function V(t){return function(n){if(this.l){var r=this.l[n.type+t];if(n[_]==null)n[_]=w++;else if(n[_]<r[v])return;return r(l.event?l.event(n):n)}}}function q(t,n,r,i,a,o,s,c,d,f){var p,h,g,_,v,y,w,k,M,F,U,Y,ee,X,te,Z=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(d=!!(32&r.__u),o=[c=n.__e=r.__e]),(p=l.__b)&&p(n);n:if(typeof Z==`function`)try{if(k=n.props,M=Z.prototype&&Z.prototype.render,F=(p=Z.contextType)&&i[p.__c],U=p?F?F.props.value:p.__:i,r.__c?w=(h=n.__c=r.__c).__=h.__E:(M?n.__c=h=new Z(k,U):(n.__c=h=new C(k,U),h.constructor=Z,h.render=Q),F&&F.sub(h),h.state||={},h.__n=i,g=h.__d=!0,h.__h=[],h._sb=[]),M&&h.__s==null&&(h.__s=h.state),M&&Z.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=m({},h.__s)),m(h.__s,Z.getDerivedStateFromProps(k,h.__s))),_=h.props,v=h.state,h.__v=n,g)M&&Z.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),M&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(M&&Z.getDerivedStateFromProps==null&&k!==_&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(k,U),n.__v==r.__v||!h.__e&&h.shouldComponentUpdate!=null&&!1===h.shouldComponentUpdate(k,h.__s,U)){n.__v!=r.__v&&(h.props=k,h.state=h.__s,h.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(t){t&&(t.__=n)}),R.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&s.push(h);break n}h.componentWillUpdate!=null&&h.componentWillUpdate(k,h.__s,U),M&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(_,v,y)})}if(h.context=U,h.props=k,h.__P=t,h.__e=!1,Y=l.__r,ee=0,M)h.state=h.__s,h.__d=!1,Y&&Y(n),p=h.render(h.props,h.state,h.context),R.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,Y&&Y(n),p=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++ee<25);h.state=h.__s,h.getChildContext!=null&&(i=m(m({},i),h.getChildContext())),M&&!g&&h.getSnapshotBeforeUpdate!=null&&(y=h.getSnapshotBeforeUpdate(_,v)),X=p!=null&&p.type===S&&p.key==null?E(p.props.children):p,c=L(t,W(X)?X:[X],n,r,i,a,o,s,c,d,f),h.base=n.__e,n.__u&=-161,h.__h.length&&s.push(h),w&&(h.__E=h.__=null)}catch(t){if(n.__v=null,d||o!=null)if(t.then){for(n.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,n.__e=c}else{for(te=o.length;te--;)b(o[te]);B(n)}else n.__e=r.__e,n.__k=r.__k,t.then||B(n);l.__e(t,n,r)}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=G(r.__e,n,r,i,a,o,s,d,f);return(p=l.diffed)&&p(n),128&n.__u?void 0:c}function B(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(B))}function D(t,n,r){for(var i=0;i<r.length;i++)J(r[i],r[++i],r[++i]);l.__c&&l.__c(n,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(t){t.call(n)})}catch(t){l.__e(t,n.__v)}})}function E(t){return typeof t!=`object`||!t||t.__b>0?t:W(t)?t.map(E):t.constructor===void 0?m({},t):null}function G(t,n,r,i,a,o,s,d,f){var p,h,g,_,v,y,w,k=r.props||F,M=n.props,R=n.type;if(R==`svg`?a=`http://www.w3.org/2000/svg`:R==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o!=null){for(p=0;p<o.length;p++)if((v=o[p])&&`setAttribute`in v==!!R&&(R?v.localName==R:v.nodeType==3)){t=v,o[p]=null;break}}if(t==null){if(R==null)return document.createTextNode(M);t=document.createElementNS(a,R,M.is&&M),d&&=(l.__m&&l.__m(n,o),!1),o=null}if(R==null)k===M||d&&t.data==M||(t.data=M);else{if(o=R==`textarea`&&M.defaultValue!=null?null:o&&c.call(t.childNodes),!d&&o!=null)for(k={},p=0;p<t.attributes.length;p++)k[(v=t.attributes[p]).name]=v.value;for(p in k)v=k[p],p==`dangerouslySetInnerHTML`?g=v:p==`children`||p in M||p==`value`&&`defaultValue`in M||p==`checked`&&`defaultChecked`in M||N(t,p,null,v,a);for(p in M)v=M[p],p==`children`?_=v:p==`dangerouslySetInnerHTML`?h=v:p==`value`?y=v:p==`checked`?w=v:d&&typeof v!=`function`||k[p]===v||N(t,p,v,k[p],a);if(h)d||g&&(h.__html==g.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),n.__k=[];else if(g&&(t.innerHTML=``),L(n.type==`template`?t.content:t,W(_)?_:[_],n,r,i,R==`foreignObject`?`http://www.w3.org/1999/xhtml`:a,o,s,o?o[0]:r.__k&&$(r,0),d,f),o!=null)for(p=o.length;p--;)b(o[p]);d&&R!=`textarea`||(p=`value`,R==`progress`&&y==null?t.removeAttribute(`value`):y!=null&&(y!==t[p]||R==`progress`&&!y||R==`option`&&y!=k[p])&&N(t,p,y,k[p],a),p=`checked`,w!=null&&w!=t[p]&&N(t,p,w,k[p],a))}return t}function J(t,n,r){try{if(typeof t==`function`){var i=typeof t.__u==`function`;i&&t.__u(),i&&n==null||(t.__u=t(n))}else t.current=n}catch(t){l.__e(t,r)}}function K(t,n,r){var i,a;if(l.unmount&&l.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||J(i,null,n)),(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){l.__e(t,n)}i.base=i.__P=null}if(i=t.__k)for(a=0;a<i.length;a++)i[a]&&K(i[a],n,r||typeof t.type!=`function`);r||b(t.__e),t.__c=t.__=t.__e=void 0}function Q(t,n,r){return this.constructor(t,r)}c=R.slice,l={__e:function(t,n,r,i){for(var a,o,s;n=n.__;)if((a=n.__c)&&!a.__)try{if((o=a.constructor)&&o.getDerivedStateFromError!=null&&(a.setState(o.getDerivedStateFromError(t)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(t,i||{}),s=a.__d),s)return a.__E=a}catch(n){t=n}throw t}},d=0,C.prototype.setState=function(t,n){var r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=m({},this.state);typeof t==`function`&&(t=t(m({},r),this.props)),t&&m(r,t),t!=null&&this.__v&&(n&&this._sb.push(n),A(this))},C.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),A(this))},C.prototype.render=S,f=[],h=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(t,n){return t.__v.__b-n.__v.__b},H.__r=0,g=Math.random().toString(8),_=`__d`+g,v=`__a`+g,y=/(PointerCapture)$|Capture$/i,w=0,k=V(!1),M=V(!0);var Y=0;Array.isArray;function u(t,n,r,i,a,o){n||={};var s,c,d=n;if(`ref`in d)for(c in d={},n)c==`ref`?s=n[c]:d[c]=n[c];var f={type:t,props:d,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Y,__i:-1,__u:0,__source:a,__self:o};if(typeof t==`function`&&(s=t.defaultProps))for(c in s)d[c]===void 0&&(d[c]=s[c]);return l.vnode&&l.vnode(f),f}var VizComponent=class extends JSXWidget.Component{widget;refreshProps(){for(let t in this.props)this.widget[t]&&typeof this.widget[t]==`function`&&this.widget[t](this.props[t])}componentDidMount(){this.widget=new this.props.type().target(this.base),this.refreshProps(),this.widget.render()}componentWillUnmount(){this.widget.target(null).render()}render(){return u(`div`,{style:this.props.style})}componentDidUpdate(){this.refreshProps(),this.widget.render()}},VizInstance=class extends JSXWidget.Component{widget;refreshProps(){for(let t in this.props)this.widget[t]&&typeof this.widget[t]==`function`&&this.widget[t](this.props[t])}componentDidMount(){this.widget=this.props.instance.target(this.base),this.refreshProps(),this.widget.render()}componentWillUnmount(){this.widget.target(null).render()}render(){return u(`div`,{style:this.props.style})}componentDidUpdate(){this.refreshProps(),this.widget.render()}},StatsTable=class extends StyledTable{transformData(){let t=[[`Total`,0,0]],r=this.data();return r.forEach(n=>{t[0][1]+=n[1],t[0][2]+=n[2]}),r.concat(t).map(t=>[t[0],this.secondColumnFormat_exists()?(0,n.format)(this.secondColumnFormat())(t[1]):t[1],this.thirdColumnFormat_exists()?(0,n.format)(this.thirdColumnFormat())(t[2]):t[2]])}update(t,n){this.tbodyColumnStyles_default([{"font-weight":`bold`,width:this.firstColumnWidth(),"text-align":`left`},{width:this.secondColumnWidth(),"text-align":`right`},{width:this.thirdColumnWidth(),"text-align":`right`}]),this.evenRowStyles_default([{"font-weight":`bold`,width:this.firstColumnWidth(),"text-align":`left`,"font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()},{width:this.secondColumnWidth(),"text-align":`right`,"font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()},{width:this.thirdColumnWidth(),"text-align":`right`,"font-color":this.evenRowFontColor(),"background-color":this.evenRowBackgroundColor()}]),this.lastRowStyles_default({"font-weight":`bold`}),super.update(t,n)}};StatsTable.prototype._class+=` html_StatsTable`,StatsTable.prototype.publish(`labelColor`,`#333`,`html-color`,`Color of the text in the first column`),StatsTable.prototype.publish(`primaryValueColor`,`#333`,`html-color`,`Color of the text in the second column`),StatsTable.prototype.publish(`secondaryValueColor`,`#333`,`html-color`,`Color of the text in the third column`),StatsTable.prototype.publish(`evenRowBackgroundColor`,`#333`,`html-color`,`Background color of the even rows`),StatsTable.prototype.publish(`evenRowFontColor`,`#333`,`html-color`,`Font color of the even rows`),StatsTable.prototype.publish(`firstColumnWidth`,`auto`,`string`,`CSS style applied as the 'width' for the first column (ex: 40px)`),StatsTable.prototype.publish(`secondColumnWidth`,`1%`,`string`,`CSS style applied as the 'width' for the second column (ex: 40px)`),StatsTable.prototype.publish(`thirdColumnWidth`,`1%`,`string`,`CSS style applied as the 'width' for the third column (ex: 40px)`),StatsTable.prototype.publish(`secondColumnFormat`,`$,.0f`,`string`,`d3-format specifier applied to the second column's values`,void 0,{optional:!0}),StatsTable.prototype.publish(`thirdColumnFormat`,null,`string`,`d3-format specifier applied to the third column's values`,void 0,{optional:!0});var Item=class extends n.HTMLWidget{_owner;constructor(t){super(),this._owner=t,this._tag=`a`}};Item.prototype._class+=` html_Item`;var Button=class extends Item{_icon;constructor(t,n){super(t),this._icon=n}icon(){return this._icon}enter(t,n){super.enter(t,n),n.attr(`href`,`#`).on(`click`,(t,n,r)=>this._owner.titleBarClick(this,t,n,r)).append(`i`).attr(`class`,`fa ${this._icon} fa-lg fa-fw`)}};Button.prototype._class+=` html_Button`;var ToggleButton=class extends Button{enter(t,n){n.on(`click.sel`,(t,n,r)=>{this.selected(!this.selected()),this.render()}),super.enter(t,n)}update(t,n){super.update(t,n),this._element.classed(`selected`,this.selected())}};ToggleButton.prototype._class+=` html_ToggleButton`,ToggleButton.prototype.publish(`selected`,!1,`boolean`);var Spacer=class extends Item{enter(t,n){super.enter(t,n),n.attr(`class`,`spacer`).attr(`href`,`#`).append(`i`)}};Spacer.prototype._class+=` html_Spacer`;var TitleBar=class extends JSXWidget{_divMain;_divIconBar;_divTitle;constructor(){super()}enter(t,n){super.enter(t,n),this._divMain=n.append(`div`).attr(`class`,`main`),this._divIconBar=this._divMain.append(`div`).attr(`class`,`icon-bar`),this._divTitle=this._divMain.append(`div`).attr(`class`,`title`)}update(t,n){super.update(t,n),this._divTitle.text(this.title());let r=this._divIconBar.selectAll(`.icon-bar-item`).data(this.buttons());r.enter().append(`div`).attr(`class`,`icon-bar-item`).each(function(t){t.target(this)}).merge(r).each(function(t){t.render()}),r.exit().each(function(t){t.target(null)}).remove(),r.order()}};TitleBar.prototype._class+=` html_TitleBar`,TitleBar.prototype.publish(`title`,``,`string`),TitleBar.prototype.publish(`buttons`,[],`widgetArray`),t.BUILD_VERSION=s,t.BreakdownTable=BreakdownTable,t.Button=Button,t.HTMLTooltip=HTMLTooltip,t.Item=Item,t.JSXWidget=JSXWidget,t.PKG_NAME=a,t.PKG_VERSION=o,t.ReactD3=ReactD3,t.SimpleTable=SimpleTable,t.Spacer=Spacer,t.StatsTable=StatsTable,t.StyledTable=StyledTable,t.TitleBar=TitleBar,t.ToggleButton=ToggleButton,t.VNode=VNode,t.VizComponent=VizComponent,t.VizInstance=VizInstance});
2
9
  //# sourceMappingURL=index.umd.cjs.map
3
- !function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode("#wrap{width:100%}#left,#right{padding:5px}#left{background-color:red;text-align:left;display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#right{background-color:orange;float:right;text-align:right;white-space:nowrap}.html_TitleBar>.main{width:100%;display:block}.html_TitleBar .title{padding:4px;text-align:left;display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-size:20px;font-weight:700}.html_TitleBar .icon-bar{padding:4px;float:right;text-align:right;white-space:nowrap;line-height:28px}.html_TitleBar .icon-bar-item{display:inline}.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{text-align:center;padding-top:4px;padding-bottom:4px;transition:all .3s ease;color:#a9a9a9}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{text-align:center;padding-top:2px;padding-left:8px;padding-bottom:0;color:none}.html_TitleBar .icon-bar a.spacer:hover{background-color:transparent}.html_TitleBar .icon-bar .active{background-color:#4caf50}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
10
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`#wrap{width:100%}#left,#right{padding:5px}#left{text-align:left;text-overflow:ellipsis;white-space:nowrap;background-color:red;display:block;overflow:hidden}#right{float:right;text-align:right;white-space:nowrap;background-color:orange}.html_TitleBar>.main{width:100%;display:block}.html_TitleBar .title{text-align:left;text-overflow:ellipsis;white-space:nowrap;padding:4px;font-size:20px;font-weight:700;display:block;overflow:hidden}.html_TitleBar .icon-bar{float:right;text-align:right;white-space:nowrap;padding:4px;line-height:28px}.html_TitleBar .icon-bar-item,.html_TitleBar .icon-bar-item>div{display:inline}.html_TitleBar .icon-bar a{text-align:center;color:#a9a9a9;padding-top:4px;padding-bottom:4px;transition:all .3s}.html_TitleBar .icon-bar a:hover{background-color:#f5f5f5}.html_TitleBar .icon-bar a.selected{background-color:#efe5e5}.html_TitleBar .icon-bar a.spacer{text-align:center;color:none;padding-top:2px;padding-bottom:0;padding-left:8px}.html_TitleBar .icon-bar a.spacer:hover{background-color:#0000}.html_TitleBar .icon-bar .active{background-color:#4caf50}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();