UNPKG

@hpcc-js/composite

Version:
1 lines 145 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common"),require("@hpcc-js/dgrid"),require("@hpcc-js/api"),require("@hpcc-js/form"),require("@hpcc-js/other")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common","@hpcc-js/dgrid","@hpcc-js/api","@hpcc-js/form","@hpcc-js/other"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/composite"]={},t["@hpcc-js/common"],t["@hpcc-js/dgrid"],t["@hpcc-js/api"],t["@hpcc-js/form"],t["@hpcc-js/other"])}(this,function(t,e,i,o,s,l){"use strict";var r,n,a,h,d,c,p,u,g,_,y,f,b,w,m,x,v,C,T,S=Object.defineProperty,P=(t,e)=>S(t,"name",{value:e,configurable:!0});var B=Object.defineProperty,z=P((t,e)=>B(t,"name",{value:e,configurable:!0}),"__name");function A(t,e){for(var i=0;i<e.length;i++){const o=e[i];if("string"!=typeof o&&!Array.isArray(o))for(const e in o)if("default"!==e&&!(e in t)){const i=Object.getOwnPropertyDescriptor(o,e);i&&Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:z(()=>o[e],"get")})}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}P(A,"_mergeNamespaces$1"),z(A,"_mergeNamespaces");const W=(r=class extends e.HTMLWidget{constructor(){super(),this._tag="div"}enter(t,e){super.enter(t,e)}update(t,e){super.update(t,e);let i=0,o=0,s=this.clientWidth(),l=this.clientHeight();switch(this.units()){case"pixels":i=this.widgetX(),o=this.widgetY(),s=""===this.widgetWidth()?s-i:Number(this.widgetWidth()),l=""===this.widgetHeight()?l-o:Number(this.widgetHeight());break;case"percent":i=this.widgetX()*s/100,o=this.widgetY()*l/100,s=""===this.widgetWidth()?s-i:Number(this.widgetWidth())*s/100,l=""===this.widgetHeight()?l-o:Number(this.widgetHeight())*l/100}e.style("opacity",this.opacity());const r=e.selectAll("#"+this._id+" > .placeholder").data(this.widget()?[this.widget()]:[],function(t){return t._id});r.enter().append("div").attr("class","placeholder").each(function(t){t.target(this)}).merge(r).style("left",i+"px").style("top",o+"px").style("width",s+"px").style("bottom",l+"px").each(function(t){t.resize({width:s,height:l})}),r.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widget()&&this.widget().target(null),super.exit(t,e)}},P(r,"_AbsoluteSurface"),r);z(W,"AbsoluteSurface");let k=W;k.prototype._class+=" layout_AbsoluteSurface",k.prototype.publish("units","percent","set","Units",["pixels","percent"]),k.prototype.publish("widgetX",0,"number","Widget XPos"),k.prototype.publish("widgetY",0,"number","Widget YPos"),k.prototype.publish("widgetWidth","100","string","Widget Width, omit for full"),k.prototype.publish("widgetHeight","100","string","Widget Height, omit for full"),k.prototype.publish("widget",null,"widget","Widget",null,{tags:["Private"]}),k.prototype.publish("opacity",1,"number","Opacity");const I=(n=class extends e.HTMLWidget{_isClosed;titleSpan;iconDiv;ul;icon;constructor(){super(),this._tag="div",this._isClosed=!1}pushListItem(t,e=!1,i=!1){const o=this.content();return t._protected=i,e?o.unshift(t):o.push(t),this.content(o),this}clearListItems(){const t=[];for(const e in this.content())this.content()[e]._protected&&t.push(this.content()[e]);return this.content(t),this}collapseClick(t){t.classed("closed")?(this._isClosed=!1,t.classed("open",!0),t.classed("closed",!1)):(this._isClosed=!0,t.classed("open",!1),t.classed("closed",!0))}enter(t,i){super.enter(t,i);const o=this;this._isClosed=this.defaultCollapsed(),i.classed(this._isClosed?"closed":"open",!0),this.titleSpan=i.append("span").classed("collapsible-title",!0),this.iconDiv=i.append("div").classed("collapsible-icon",!0),this.ul=i.append("ul"),this.icon=(new e.FAChar).size({height:24,width:24}).target(this.iconDiv.node()),this.iconDiv.on("click",function(){o.collapseClick(i),o.render()}),this.titleSpan.on("click",function(){o.collapseClick(i),o.render()})}update(t,e){super.update(t,e);const i=this;this.titleSpan.text(i.title().length>0?i.title()+"":"Accordion ["+i._id+"]");const o=this.ul.selectAll("#"+i._id+" > ul > li").data(this.content(),function(t){return t._id});o.enter().append(function(t){const e=document.createElement("li");if(null!==t._target)return t._target;{const o=t.size();if(0===o.width||0===o.height){const e=i.size();t.size({width:e.width,height:e.width})}t.target(e)}return e}),o.exit().remove(),this.icon.text_colorFill(this.titleFontColor()).char(this._isClosed?this.closedIcon():this.openIcon()).render()}exit(t,e){super.exit(t,e)}},P(n,"_Accordion"),n);z(I,"Accordion");let M=I;M.prototype._class+=" layout_Accordion",M.prototype.publish("content",[],"widgetArray","Array of widgets",null,{tags:["Basic"]}),M.prototype.publish("title","","string","Title of collapsible section",null,{tags:["Private"]}),M.prototype.publish("openIcon","","string","Icon to display when list is open",null,{tags:["Private"]}),M.prototype.publish("closedIcon","","string","Icon to display when list is closed",null,{tags:["Private"]}),M.prototype.publish("titleFontColor","#FFFFFF","html-color","Title font color",null,{tags:["Private"]}),M.prototype.publish("titleBackgroundColor","#333333","html-color","Title background color",null,{tags:["Private"]}),M.prototype.publish("defaultCollapsed",!1,"boolean","Collapsed by default if true",null,{tags:["Private"]});const H=(a=class extends e.HTMLWidget{_surfaceButtons;constructor(){super(),this._tag="div",this._surfaceButtons=[]}widgetSize(t,e){let i=this.clientWidth(),o=this.clientHeight();return this.title()&&(o-=this.calcHeight(t)),o-=this.calcFrameHeight(e),i-=this.calcFrameWidth(e),{width:i,height:o}}enter(t,e){super.enter(t,e)}update(t,i){super.update(t,i);const o=this;i.classed("shadow2",this.surfaceShadow()).style("border-width",this.surfaceBorderWidth_exists()?this.surfaceBorderWidth()+"px":null).style("border-color",this.surfaceBorderColor()).style("border-radius",this.surfaceBorderRadius_exists()?this.surfaceBorderRadius()+"px":null).style("background-color",this.surfaceBackgroundColor());const s=i.selectAll(".surfaceTitle").data(this.title()?[this.title()]:[]);s.enter().insert("h3","div").attr("class","surfaceTitle").merge(s).text(function(t){return t}).style("text-align",this.surfaceTitleAlignment()).style("color",this.surfaceTitleFontColor()).style("font-size",this.surfaceTitleFontSize_exists()?this.surfaceTitleFontSize()+"px":null).style("font-family",this.surfaceTitleFontFamily()).style("font-weight",this.surfaceTitleFontBold()?"bold":"normal").style("background-color",this.surfaceTitleBackgroundColor()).style("padding",this.surfaceTitlePadding_exists()?this.surfaceTitlePadding()+"px":null).style("title",this.altText_exists()?this.altText():null),s.exit().remove();const l=i.select(".surfaceTitle").append("div").attr("class","html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());l.enter().append("button").classed("surface-button",!0).each(function(t,i){const s=o._surfaceButtons[i]=e.select(this).attr("class","surface-button"+(t.class?" "+t.class:"")).attr("id",t.id).style("padding",t.padding).style("width",t.width).style("height",t.height).style("cursor","pointer");"FontAwesome"===t.font?s.style("background","transparent").style("border","none").on("click",function(t){o.click(t)}).append("i").attr("class","fa").text(function(){return t.label}):s.text(function(){return t.label}).on("click",function(t){o.click(t)})}),l.exit().each(function(t,i){const s=e.select(this);delete o._surfaceButtons[i],s.remove()});const r=i.selectAll("#"+this._id+" > .surfaceWidget").data(this.widget()?[this.widget()]:[],function(t){return t._id});r.enter().append("div").attr("class","surfaceWidget").each(function(t){e.select(o.element().node().parentElement).classed("content-icon content-icon-"+t.classID().split("_")[1],!0),t.target(this)}).merge(r).style("padding",this.surfacePadding_exists()?this.surfacePadding()+"px":null).each(function(t){const s=o.widgetSize(i.select("h3"),e.select(this));s.width<0&&(s.width=0),s.height<0&&(s.height=0),t.resize({width:s.width,height:s.height})}),r.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widget()&&this.widget().target(null),super.exit(t,e)}click(t){}},P(a,"_Surface"),a);z(H,"Surface");let D=H;D.prototype._class+=" layout_Surface",D.prototype.publish("title","","string","Title",null,{tags:["Intermediate"]}),D.prototype.publish("altText",null,"string","Alt text",null,{optional:!0}),D.prototype.publish("surfaceTitlePadding",null,"number","Title Padding (px)",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleFontSize",null,"number","Title Font Size (px)",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleFontColor",null,"html-color","Title Font Color",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleFontFamily",null,"string","Title Font Family",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleFontBold",!0,"boolean","Enable Bold Title Font",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleBackgroundColor",null,"html-color","Title Background Color",null,{tags:["Advanced"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceTitleAlignment","center","set","Title Alignment",["left","right","center"],{tags:["Basic"],disable:z(t=>!t.title(),"disable")}),D.prototype.publish("surfaceShadow",!1,"boolean","3D Shadow"),D.prototype.publish("surfacePadding",null,"string","Surface Padding (px)",null,{tags:["Intermediate"]}),D.prototype.publish("surfaceBackgroundColor",null,"html-color","Surface Background Color",null,{tags:["Advanced"]}),D.prototype.publish("surfaceBorderWidth",null,"number","Surface Border Width (px)",null,{tags:["Advanced"]}),D.prototype.publish("surfaceBorderColor",null,"html-color","Surface Border Color",null,{tags:["Advanced"]}),D.prototype.publish("surfaceBorderRadius",null,"number","Surface Border Radius (px)",null,{tags:["Advanced"]}),D.prototype.publish("buttonAnnotations",[],"array","Button Array",null,{tags:["Private"]}),D.prototype.publish("widget",null,"widget","Widget",null,{tags:["Basic"]});const L=(h=class extends D{_indicateTheseIds;constructor(){super(),this._indicateTheseIds=[]}indicateTheseIds(t){return arguments.length?(this._indicateTheseIds=t,this):this._indicateTheseIds}enter(t,e){super.enter(t,e);const i=this;e.classed("layout_Surface",!0).on("mouseenter",function(){i.onMouseEnter()}).on("mouseleave",function(){i.onMouseLeave()})}update(t,e){super.update(t,e)}onMouseEnter(){const t=this.indicateTheseIds(),i=this.indicatorOpacity(),o=this.indicatorBorderColor(),s=this.indicatorGlowColor();for(let l=0;l<t.length;l++){const r=e.select("#"+t[l]),n=r.datum();r&&n&&r.append("div").attr("class","update-indicator").style("width",n.width()+"px").style("height",n.height()+"px").style("opacity",i).style("border-color",o).style("-webkit-box-shadow","inset 0px 0px 30px 0px "+s).style("-moz-box-shadow","inset 0px 0px 30px 0px "+s).style("box-shadow","inset 0px 0px 30px 0px "+s)}}onMouseLeave(){const t=this.indicateTheseIds();for(let i=0;i<t.length;i++)e.selectAll("#"+t[i]+" > div.update-indicator").remove()}},P(h,"_Cell"),h);z(L,"Cell");let O=L;O.prototype._class+=" layout_Cell",O.prototype.publish("gridRow",0,"number","Grid Row Position",null,{tags:["Private"]}),O.prototype.publish("gridCol",0,"number","Grid Column Position",null,{tags:["Private"]}),O.prototype.publish("gridRowSpan",1,"number","Grid Row Span",null,{tags:["Private"]}),O.prototype.publish("gridColSpan",1,"number","Grid Column Span",null,{tags:["Private"]}),O.prototype.publish("indicatorGlowColor","#EEEE11","html-color","Glow color of update-indicator",null,{tags:["Basic"]}),O.prototype.publish("indicatorBorderColor","#F48A00","html-color","Border color of update-indicator",null,{tags:["Basic"]}),O.prototype.publish("indicatorOpacity",.8,"number","Opacity of update-indicator",null,{tags:["Basic"]});const F=(d=class extends e.HTMLWidget{_colCount;_rowCount;_colSize;_rowSize;_shrinkWrapBoxes;_watch;_offsetX;_offsetY;_dragCell;_dragCellSize;_dragCellStartSize;_handleTop;_handleLeft;_dragPrevX;_dragPrevY;_cellSizes;contentDiv;_scrollBarWidth;_borderHandles;_sectionTypeArr;constructor(){super(),this._tag="div",this._colCount=0,this._rowCount=0,this._colSize=0,this._rowSize=0,this._shrinkWrapBoxes={},this.content([]),this.sectionTypes([])}watchWidget(t){if(void 0===this._watch&&(this._watch={}),this._watch[t.id()]&&(this._watch[t.id()].remove(),delete this._watch[t.id()]),t){const e=this;this._watch[t.id()]=t.monitor(function(t,i,o){o!==i&&e.lazyPostUpdate()})}}lazyPostUpdate=e.Utility.debounce(function(){this.postUpdate()},100);applyLayoutType(){const t=this.borderLayoutObject();this.content().forEach(function(e,i){e._fixedLeft=t[this.sectionTypes()[i]].left,e._fixedTop=t[this.sectionTypes()[i]].top,e._fixedWidth=t[this.sectionTypes()[i]].width,e._fixedHeight=t[this.sectionTypes()[i]].height,e._dragHandles=this.cellSpecificDragHandles(this.sectionTypes()[i])},this)}cellSpecificDragHandles(t){switch(t){case"top":return["s"];case"right":return["w"];case"bottom":return["n"];case"left":return["e"];case"center":return[]}}borderLayoutObject(t){const e={},i=this;let o,s,l,r,n,a,h,d;const c=this.target().getBoundingClientRect();c.top,c.left,c.bottom,c.right,this.target()instanceof SVGElement?(parseFloat(this.target().getAttribute("width")),parseFloat(this.target().getAttribute("height"))):(c.width,c.height),-1!==this.sectionTypes().indexOf("top")&&(o=this.topSize(),s=this.topPercentage(),void 0!==this._shrinkWrapBoxes.top&&(o=this._shrinkWrapBoxes.top.height+this.gutter(),s=0)),-1!==this.sectionTypes().indexOf("bottom")&&(l=this.bottomSize(),r=this.bottomPercentage(),void 0!==this._shrinkWrapBoxes.bottom&&(l=this._shrinkWrapBoxes.bottom.height+this.gutter(),r=0)),-1!==this.sectionTypes().indexOf("left")&&(n=this.leftSize(),a=this.leftPercentage(),void 0!==this._shrinkWrapBoxes.left&&(n=this._shrinkWrapBoxes.left.width+this.gutter(),a=0)),-1!==this.sectionTypes().indexOf("right")&&(h=this.rightSize(),d=this.rightPercentage(),void 0!==this._shrinkWrapBoxes.right&&(h=this._shrinkWrapBoxes.right.width+this.gutter(),d=0));const p=f({width:{px:0,"%":100},height:{px:o,"%":s},top:{px:0,"%":0},left:{px:0,"%":0}}),u=f({width:{px:0,"%":100},height:{px:l,"%":r},top:{px:0,"%":100},left:{px:0,"%":0}});u.top-=u.height;const g=f({width:{px:n,"%":a},height:{px:-p.height-u.height,"%":100},top:{px:p.height,"%":0},left:{px:0,"%":0}}),_=f({width:{px:h,"%":d},height:{px:-p.height-u.height,"%":100},top:{px:p.height,"%":0},left:{px:0,"%":100}});_.left-=_.width;const y=f({width:{px:-_.width-g.width,"%":100},height:{px:-p.height-u.height,"%":100},top:{px:p.height,"%":0},left:{px:g.width,"%":0}});return e.top=p,e.bottom=u,e.right=_,e.left=g,e.center=y,e;function f(t){t.width.px=void 0!==t.width.px?t.width.px:0,t.width["%"]=void 0!==t.width["%"]?t.width["%"]:0,t.height.px=void 0!==t.height.px?t.height.px:0,t.height["%"]=void 0!==t.height["%"]?t.height["%"]:0;return{width:t.width.px+t.width["%"]/100*i.width(),height:t.height.px+t.height["%"]/100*i.height(),top:t.top.px+t.top["%"]/100*i.height()+i.gutter()/2,left:t.left.px+t.left["%"]/100*i.width()+i.gutter()/2}}}clearContent(t){if(t){const i=this.sectionTypes().indexOf(t);i>=0&&(this._watch&&this.content()[i]&&delete this._watch[this.content()[i].id()],this.content()[i].target(null),e.select("#"+this.id()+" > div.borderHandle_"+t).classed("borderHandleDisabled",!0),this.content().splice(i,1),this.sectionTypes().splice(i,1))}else this.content().forEach(function(t){return t.target(null),!1}),e.select("#"+this.id()+" > div.borderHandle").classed("borderHandleDisabled",!0),delete this._watch,this.content([]),this.sectionTypes([])}hasContent(t,e,i){return this.sectionTypes().indexOf(t)>=0}setContent(t,e,i){if(this.clearContent(t),i=void 0!==i?i:"",e){const o=(new O).surfaceBorderWidth(0).widget(e).title(i);this.watchWidget(e),this.content().push(o),this.sectionTypes().push(t)}return this}getCell(t){const e=this.sectionTypes().indexOf(t);return e>=0?this.content()[e]:null}getContent(t){const e=this.sectionTypes().indexOf(t);return e>=0?this.content()[e].widget():null}setLayoutOffsets(){this._offsetX=this._element.node().getBoundingClientRect().left+this.gutter()/2,this._offsetY=this._element.node().getBoundingClientRect().top+this.gutter()/2}dragStart(t){const i=e.d3Event();i.sourceEvent.stopPropagation();const o=this;this._dragCell=t,this._dragCellStartSize=this[t+"Size"](),this[t+"ShrinkWrap"]()&&(this[t+"Percentage"](0),this[t+"ShrinkWrap"](!1));const s=e.select("#"+o.id()+" > div.borderHandle_"+t);o._handleTop=parseFloat(s.style("top").split("px")[0]),o._handleLeft=parseFloat(s.style("left").split("px")[0]),this._dragPrevX=i.sourceEvent.clientX,this._dragPrevY=i.sourceEvent.clientY}dragTick(t){const i=this,o=e.d3Event(),s=this._dragPrevX-o.sourceEvent.clientX,l=this._dragPrevY-o.sourceEvent.clientY;switch(t){case"top":case"bottom":r(t,l);break;case"right":case"left":r(t,s)}function r(t,o){if(0===o)return;const s=e.selectAll("#"+i.id()+" > div.borderHandle"),l=e.select("#"+i.id()+" > div.borderHandle_"+t);l.classed("borderHandle_top")?(l.style("top",i._handleTop-o+"px"),i._cellSizes.topHeight=i._handleTop-o,i._cellSizes.leftHeight=i._cellSizes.height,i._cellSizes.leftHeight-=i._cellSizes.topHeight,i._cellSizes.leftHeight-=i._cellSizes.bottomHeight,i._cellSizes.rightHeight=i._cellSizes.leftHeight):l.classed("borderHandle_right")?(l.style("left",i._handleLeft-o+"px"),i._cellSizes.rightWidth=i._cellSizes.width-i._handleLeft+o):l.classed("borderHandle_bottom")?(l.style("top",i._handleTop-o+"px"),i._cellSizes.bottomHeight=i._cellSizes.height-i._handleTop+o,i._cellSizes.leftHeight=i._cellSizes.height,i._cellSizes.leftHeight-=i._cellSizes.bottomHeight,i._cellSizes.leftHeight-=i._cellSizes.topHeight,i._cellSizes.rightHeight=i._cellSizes.leftHeight):l.classed("borderHandle_left")&&(l.style("left",i._handleLeft-o+"px"),i._cellSizes.leftWidth=i._handleLeft-o),s.each(function(){const t=e.select(this);t.classed("borderHandle_top")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.topHeight-3+"px")):t.classed("borderHandle_right")?(t.style("left",i._cellSizes.width-i._cellSizes.rightWidth+"px"),t.style("top",i._cellSizes.topHeight+3+"px"),t.style("height",i._cellSizes.rightHeight+"px")):t.classed("borderHandle_bottom")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.height-i._cellSizes.bottomHeight-3+"px")):t.classed("borderHandle_left")&&(t.style("left",i._cellSizes.leftWidth+"px"),t.style("height",i._cellSizes.leftHeight+"px"),t.style("top",i._cellSizes.topHeight+3+"px"))})}P(r,"_moveHandles"),z(r,"_moveHandles")}dragEnd(t){if(t){const i=e.d3Event(),o=this._dragPrevX-i.sourceEvent.clientX,s=this._dragPrevY-i.sourceEvent.clientY;switch(t){case"top":0!==s&&(this.topPercentage(0),this.topSize(0===this.topSize()?this.getContent("top").getBBox().height-s:this.topSize()-s));break;case"right":0!==o&&(this.rightPercentage(0),this.rightSize(0===this.rightSize()?this.getContent("right").getBBox().width+o:this.rightSize()+o));break;case"bottom":0!==s&&(this.bottomPercentage(0),this.bottomSize(0===this.bottomSize()?this.getContent("bottom").getBBox().height+s:this.bottomSize()+s));break;case"left":0!==o&&(this.leftPercentage(0),this.leftSize(0===this.leftSize()?this.getContent("left").getBBox().width-o:this.leftSize()-o))}this._dragPrevX=i.sourceEvent.clientX,this._dragPrevY=i.sourceEvent.clientY}this.render()}size(t){const i=e.HTMLWidget.prototype.size.apply(this,arguments);return arguments.length&&this.contentDiv&&this.contentDiv.style("width",this._size.width+"px").style("height",this._size.height+"px"),i}enter(t,i){super.enter(t,i);const o=this;i.style("position","relative"),this.contentDiv=i.append("div").classed("border-content",!0),this._scrollBarWidth=e.Platform.getScrollbarWidth(),this._borderHandles=["top","left","right","bottom"];i.selectAll("div.borderHandle").data(this._borderHandles).enter().append("div").classed("borderHandle",!0).each(function(t){e.select(this).classed("borderHandle_"+t,!0).classed("borderHandleDisabled",null===o.getContent(t))})}update(t,i){super.update(t,i),this._sectionTypeArr=this.sectionTypes();const o=this;i.classed("design-mode",this.designMode()),this.setLayoutOffsets();const s=this.contentDiv.selectAll(".cell_"+this._id).data(this.content(),function(t){return t._id}),l=s.enter().append("div").classed("cell_"+this._id,!0).style("position","absolute").each(function(t,i){e.select(this).classed("border-cell border-cell-"+o._sectionTypeArr[i],!0),t.target(this),e.select("#"+o.id()+" > div.borderHandle_"+o._sectionTypeArr[i]).classed("borderHandleDisabled",!1)}).merge(s);l.each(function(t,e){const i=o.sectionTypes()[e];void 0!==o[i+"ShrinkWrap"]&&o[i+"ShrinkWrap"]()?(t.render(),o._shrinkWrapBoxes[i]=t.widget().getBBox(!0)):delete o._shrinkWrapBoxes[i]});const r=e.drag().on("start",function(t,e){o.dragStart.call(o,t,e)}).on("drag",function(t,e){o.dragTick.call(o,t,e)}).on("end",function(t,e){o.dragEnd.call(o,t,e)});this.designMode()?i.selectAll("#"+this.id()+" > div.borderHandle").call(r):i.selectAll("#"+this.id()+" > div.borderHandle").on(".drag",null);const n=this.borderLayoutObject();this.content().forEach(function(t,e){t._fixedLeft=n[this.sectionTypes()[e]].left,t._fixedTop=n[this.sectionTypes()[e]].top,t._fixedWidth=n[this.sectionTypes()[e]].width,t._fixedHeight=n[this.sectionTypes()[e]].height,t._dragHandles=[]},this),l.style("left",function(t){return t._fixedLeft+"px"}).style("top",function(t){return t._fixedTop+"px"}).style("width",function(t){return t._fixedWidth-o.gutter()+"px"}).style("height",function(t){return t._fixedHeight-o.gutter()+"px"}).each(function(t){t._placeholderElement.attr("draggable",o.designMode()).selectAll(".dragHandle").attr("draggable",o.designMode()),t.surfacePadding(o.surfacePadding()).resize()}),s.exit().each(function(t){t.target(null)}).remove(),this.getCellSizes(),i.selectAll("#"+this.id()+" > div.borderHandle").each(function(){const t=e.select(this);t.classed("borderHandle_top")?(t.style("width",o._cellSizes.width+"px"),t.style("top",o._cellSizes.topHeight-3+"px")):t.classed("borderHandle_right")?(t.style("left",o._cellSizes.width-o._cellSizes.rightWidth+"px"),t.style("top",o._cellSizes.topHeight+3+"px"),t.style("height",o._cellSizes.rightHeight+"px")):t.classed("borderHandle_bottom")?(t.style("width",o._cellSizes.width+"px"),t.style("top",o._cellSizes.height-o._cellSizes.bottomHeight-3+"px")):t.classed("borderHandle_left")&&(t.style("left",o._cellSizes.leftWidth+"px"),t.style("height",o._cellSizes.leftHeight+"px"),t.style("top",o._cellSizes.topHeight+3+"px"))})}getCellSizes(){const t=this;t._cellSizes={};const i=this.element().node().getBoundingClientRect();t._cellSizes.width=i.width,t._cellSizes.height=i.height,this.element().selectAll("#"+this.id()+" > div > div.border-cell").each(function(){const i=e.select(this);if("function"==typeof i.node){const e=i.node().getBoundingClientRect();i.classed("border-cell-top")?t._cellSizes.topHeight=e.height:i.classed("border-cell-left")?(t._cellSizes.leftWidth=e.width,t._cellSizes.leftHeight=e.height):i.classed("border-cell-right")?(t._cellSizes.rightWidth=e.width,t._cellSizes.rightHeight=e.height):i.classed("border-cell-bottom")&&(t._cellSizes.bottomHeight=e.height)}});["height","width","topHeight","bottomHeight","leftHeight","rightHeight","leftWidth","rightWidth"].forEach(function(e){t._cellSizes[e]=void 0===t._cellSizes[e]?0:t._cellSizes[e]})}postUpdate(t,e){const i=this;this.content().forEach(function(t){if(null!==t._element.node()&&t.widget()){const e=t.widget().getBBox(!1,!0),o=t.widget().getBBox(!0,!0);e.width===o.width&&e.height===o.height||i.lazyRender()}})}exit(t,e){this.content().forEach(t=>t.target(null)),super.exit(t,e)}},P(d,"_Border"),d);z(F,"Border");let E=F;E.prototype._class+=" layout_Border",E.prototype.publish("designMode",!1,"boolean","Design Mode",null,{tags:["Basic"]}),E.prototype.publish("content",[],"widgetArray","widgets",null,{tags:["Intermediate"]}),E.prototype.publish("gutter",0,"number","Gap Between Widgets",null,{tags:["Basic"]}),E.prototype.publish("topShrinkWrap",!1,"boolean","'Top' Cell shrinks to fit content",null,{tags:["Intermediate"]}),E.prototype.publish("leftShrinkWrap",!1,"boolean","'Left' Cell shrinks to fit content",null,{tags:["Intermediate"]}),E.prototype.publish("rightShrinkWrap",!1,"boolean","'Right' Cell shrinks to fit content",null,{tags:["Intermediate"]}),E.prototype.publish("bottomShrinkWrap",!1,"boolean","'Bottom' Cell shrinks to fit content",null,{tags:["Intermediate"]}),E.prototype.publish("topSize",0,"number","Height of the 'Top' Cell (px)",null,{tags:["Private"]}),E.prototype.publish("leftSize",0,"number","Width of the 'Left' Cell (px)",null,{tags:["Private"]}),E.prototype.publish("rightSize",0,"number","Width of the 'Right' Cell (px)",null,{tags:["Private"]}),E.prototype.publish("bottomSize",0,"number","Height of the 'Bottom' Cell (px)",null,{tags:["Private"]}),E.prototype.publish("topPercentage",20,"number","Percentage (of parent) Height of the 'Top' Cell",null,{tags:["Private"]}),E.prototype.publish("leftPercentage",20,"number","Percentage (of parent) Width of the 'Left' Cell",null,{tags:["Private"]}),E.prototype.publish("rightPercentage",20,"number","Percentage (of parent) Width of the 'Right' Cell",null,{tags:["Private"]}),E.prototype.publish("bottomPercentage",20,"number","Percentage (of parent) Height of the 'Bottom' Cell",null,{tags:["Private"]}),E.prototype.publish("surfacePadding",0,"number","Cell Padding (px)",null,{tags:["Intermediate"]}),E.prototype.publish("sectionTypes",[],"array","Section Types sharing an index with 'content' - Used to determine position/size.",null,{tags:["Private"]});const R=(c=class{_div;_overlay=!1;_overflowX="visible";_overflowY="visible";_widget;constructor(t){this._div=t}overlay(t){return arguments.length?(this._overlay=t,this):this._overlay}overflowX(t){return arguments.length?(this._overflowX=t,this._div.style("overflow-x",t),this):this._overflowX}overflowY(t){return arguments.length?(this._overflowY=t,this._div.style("overflow-y",t),this):this._overflowY}element(){return this._div}node(){return this._div.node()}widget(t){return arguments.length?(this._widget!==t&&(this._widget&&this._widget.target(null),this._widget=t,this._widget&&this._widget.target(this._div.node())),this):this._widget}resize(t){return this._widget&&(this._div.style("width",`${t.width}px`).style("height",`${t.height}px`),this._widget.resize(t)),this}async render(t,i,o){let s=this.overflowX();this.overlay()||"visible"!==s||(s=null);let l=this.overflowY();return this.overlay()||"visible"!==l||(l=null),this._div.style("height",this.overlay()?"0px":null).style("overflow-x",s).style("overflow-y",l),this._widget?this._widget.renderPromise().then(s=>{if(t&&this._widget.visible()){const t=this._widget.getBBox();return t.width+=8,void 0!==i&&t.height>i&&(t.width+=e.Platform.getScrollbarWidth()),void 0!==o&&t.width>o&&(t.height+=e.Platform.getScrollbarWidth()),this.overlay()?t.height=0:t.height+=4,t}return t?{x:0,y:0,width:0,height:0}:void 0}):Promise.resolve(t?{x:0,y:0,width:0,height:0}:void 0)}},P(c,"_WidgetDiv"),c);z(R,"WidgetDiv");let G=R;const N=(p=class extends e.HTMLWidget{_bodyElement;_topWA;_leftWA;_centerWA;_rightWA;_bottomWA;_topPrevOverflow;_leftPrevOverflow;_rightPrevOverflow;_bottomPrevOverflow;constructor(){super(),this._tag="div"}enter(t,e){super.enter(t,e);const i=e.append("header");this._bodyElement=e.append("div").attr("class","body");const o=this._bodyElement.append("div").attr("class","center"),s=this._bodyElement.append("div").attr("class","lhs"),l=this._bodyElement.append("div").attr("class","rhs"),r=e.append("div").attr("class","footer");this._topWA=new G(i),this._centerWA=new G(o),this._leftWA=new G(s),this._rightWA=new G(l),this._bottomWA=new G(r)}update(t,e){super.update(t,e),this._topWA.element().style("display",this.showTop()?null:"none"),this._rightWA.element().style("display",this.showRight()?null:"none"),this._bottomWA.element().style("display",this.showBottom()?null:"none"),this._leftWA.element().style("display",this.showLeft()?null:"none"),this.topOverflowX()!==this._topWA.overflowX()&&this._topWA.overflowX(this.topOverflowX()),this.rightOverflowX()!==this._rightWA.overflowX()&&this._rightWA.overflowX(this.rightOverflowX()),this.bottomOverflowX()!==this._bottomWA.overflowX()&&this._bottomWA.overflowX(this.bottomOverflowX()),this.leftOverflowX()!==this._leftWA.overflowX()&&this._leftWA.overflowX(this.leftOverflowX()),this.topOverflowY()!==this._topWA.overflowY()&&this._topWA.overflowY(this.topOverflowY()),this.rightOverflowY()!==this._rightWA.overflowY()&&this._rightWA.overflowY(this.rightOverflowY()),this.bottomOverflowY()!==this._bottomWA.overflowY()&&this._bottomWA.overflowY(this.bottomOverflowY()),this.leftOverflowY()!==this._leftWA.overflowY()&&this._leftWA.overflowY(this.leftOverflowY()),this.element().style("width",`${this.width()}px`).style("height",`${this.height()}px`)}targetNull(t){t&&t.target(null)}exit(t,e){this.targetNull(this.center()),this.targetNull(this.bottom()),this.targetNull(this.right()),this.targetNull(this.left()),this.targetNull(this.top()),super.exit(t,e)}swap(t,e){const i=this[t](),o=this[e]();return this.targetNull(i),this.targetNull(o),this[`_${t}WA`].widget(null),this[`_${e}WA`].widget(null),this[t](o),this[e](i),this}render(t){return super.render(e=>{this._topWA?this._topWA.widget(this.top()).overlay(this.topOverlay()).render(!0).then(async e=>{const i=await this._bottomWA.widget(this.bottom()).render(!0,void 0,this.width()),o=this.height()-(e.height+i.height),s=await this._leftWA.widget(this.left()).render(!0,o),l=await this._rightWA.widget(this.right()).render(!0,o);this.bottomHeight_exists()&&(i.height=this.bottomHeight());const r=this.width()-(s.width+l.width),n=this.height()-(e.height+i.height),a=this.centerOverflowX(),h=this.centerOverflowY(),d=-1!==["auto","scroll"].indexOf(a),c=-1!==["auto","scroll"].indexOf(h);(d||c)&&this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({width:r,height:n}).render(),this._bodyElement.style("height",`${n}px`);const p=[this._topWA.overflowX(this.topOverflowX()).overflowY(this.topOverflowY()).resize({width:this.width(),height:e.height}).render(),this._leftWA.overflowX(this.leftOverflowX()).overflowY(this.leftOverflowY()).resize({width:s.width,height:n}).render(),this._rightWA.overflowX(this.rightOverflowX()).overflowY(this.rightOverflowY()).resize({width:l.width,height:n}).render(),this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({width:r,height:n}).render(),this._bottomWA.overflowX(this.bottomOverflowX()).overflowY(this.bottomOverflowY()).resize({width:this.width(),height:i.height}).render()];Promise.all(p).then(e=>{t&&t(this)})}):t&&t(this)})}},P(p,"_Border2"),p);z(N,"Border2");let Y=N;Y.prototype._class+=" layout_Border2",Y.prototype.publish("showTop",!0,"boolean","If true, top widget adapter will display"),Y.prototype.publish("showRight",!0,"boolean","If true, right widget adapter will display"),Y.prototype.publish("showBottom",!0,"boolean","If true, bottom widget adapter will display"),Y.prototype.publish("showLeft",!0,"boolean","If true, left widget adapter will display"),Y.prototype.publish("topOverflowX","visible","set","Sets the overflow-x css style for the top widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("rightOverflowX","visible","set","Sets the overflow-x css style for the right widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("bottomOverflowX","visible","set","Sets the overflow-x css style for the bottom widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("leftOverflowX","visible","set","Sets the overflow-x css style for the left widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("centerOverflowX","visible","set","Sets the overflow-x css style for the center widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("topOverflowY","visible","set","Sets the overflow-y css style for the top widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("rightOverflowY","visible","set","Sets the overflow-y css style for the right widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("bottomOverflowY","visible","set","Sets the overflow-y css style for the bottom widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("leftOverflowY","visible","set","Sets the overflow-y css style for the left widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("centerOverflowY","visible","set","Sets the overflow-y css style for the center widget adapter",["hidden","scroll","visible","auto"]),Y.prototype.publish("top",null,"widget","Top Widget",void 0,{render:!1}),Y.prototype.publish("topOverlay",!1,"boolean","Overlay Top Widget"),Y.prototype.publish("left",null,"widget","Left Widget",void 0,{render:!1}),Y.prototype.publish("center",null,"widget","Center Widget",void 0,{render:!1}),Y.prototype.publish("right",null,"widget","Right Widget",void 0,{render:!1}),Y.prototype.publish("bottom",null,"widget","Bottom Widget",void 0,{render:!1}),Y.prototype.publish("bottomHeight",null,"number","Bottom Fixed Height",void 0,{optional:!0});const V=(u=class extends e.HTMLWidget{_prevActive=0;_root;activeWidget(){return this.widgets()[this.active()]}enter(t,e){super.enter(t,e),this._root=e.append("div").attr("id",`${this.id()}_root`)}update(t,i){super.update(t,i);const o=this.active(),s=this.width();this._root.style("width",`${s}px`).style("height",`${this.height()}px`);const l=this._root.selectAll(`#${this.id()}_root > .carouselItem`).data(this.widgets(),t=>t.id()),r=l.enter().append("div").attr("class","carouselItem").each(function(t){t.target(this)}).merge(l).style("left",(t,e)=>(e-this._prevActive)*s+"px").style("width",`${s}px`);this._prevActive!==o&&(r.style("display",(t,e)=>e===this._prevActive||e===o?null:"none").transition().duration(this.transitionDuration()).style("left",(t,e)=>(e-o)*s+"px").on("end",function(t,i){e.select(this).style("display",()=>i===o?null:"none")}),this._prevActive=o),l.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widgets().forEach(t=>t.target(null)),super.exit(t,e)}render(t){return super.render(e=>{if(!this.visible()||this.isDOMHidden())t&&t(e);else{const i=this.activeWidget();i&&i.resize(this.size()).render(i=>{t&&t(e)})}})}},P(u,"_Carousel"),u);z(V,"Carousel");let X=V;X.prototype._class+=" layout_Carousel",X.prototype.publish("widgets",[],"widgetArray","Widgets",null,{render:!1}),X.prototype.publish("active",0,"number","Active widget"),X.prototype.publish("transitionDuration",500,"number","Transition duration");var U=Math.PI,j=2*U,q=1e-6,$=j-q;function J(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function K(){return new J}function Z(t){return z(P(function(){return t},"constant2"),"constant")}P(J,"Path"),z(J,"Path"),P(K,"path"),z(K,"path"),J.prototype=K.prototype={constructor:J,moveTo:z(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:z(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:z(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:z(function(t,e,i,o){this._+="Q"+ +t+","+ +e+","+(this._x1=+i)+","+(this._y1=+o)},"quadraticCurveTo"),bezierCurveTo:z(function(t,e,i,o,s,l){this._+="C"+ +t+","+ +e+","+ +i+","+ +o+","+(this._x1=+s)+","+(this._y1=+l)},"bezierCurveTo"),arcTo:z(function(t,e,i,o,s){t=+t,e=+e,i=+i,o=+o,s=+s;var l=this._x1,r=this._y1,n=i-t,a=o-e,h=l-t,d=r-e,c=h*h+d*d;if(s<0)throw new Error("negative radius: "+s);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>q)if(Math.abs(d*n-a*h)>q&&s){var p=i-l,u=o-r,g=n*n+a*a,_=p*p+u*u,y=Math.sqrt(g),f=Math.sqrt(c),b=s*Math.tan((U-Math.acos((g+c-_)/(2*y*f)))/2),w=b/f,m=b/y;Math.abs(w-1)>q&&(this._+="L"+(t+w*h)+","+(e+w*d)),this._+="A"+s+","+s+",0,0,"+ +(d*p>h*u)+","+(this._x1=t+m*n)+","+(this._y1=e+m*a)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:z(function(t,e,i,o,s,l){t=+t,e=+e,l=!!l;var r=(i=+i)*Math.cos(o),n=i*Math.sin(o),a=t+r,h=e+n,d=1^l,c=l?o-s:s-o;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+a+","+h:(Math.abs(this._x1-a)>q||Math.abs(this._y1-h)>q)&&(this._+="L"+a+","+h),i&&(c<0&&(c=c%j+j),c>$?this._+="A"+i+","+i+",0,1,"+d+","+(t-r)+","+(e-n)+"A"+i+","+i+",0,1,"+d+","+(this._x1=a)+","+(this._y1=h):c>q&&(this._+="A"+i+","+i+",0,"+ +(c>=U)+","+d+","+(this._x1=t+i*Math.cos(s))+","+(this._y1=e+i*Math.sin(s))))},"arc"),rect:z(function(t,e,i,o){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +o+"h"+-i+"Z"},"rect"),toString:z(function(){return this._},"toString")},P(Z,"constant"),z(Z,"constant");var Q=Math.PI,tt=2*Q;const et={draw:z(function(t,e){var i=Math.sqrt(e/Q);t.moveTo(i,0),t.arc(0,0,i,0,tt)},"draw")},it={draw:z(function(t,e){var i=Math.sqrt(e/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()},"draw")};var ot=Math.sqrt(1/3),st=2*ot;const lt={draw:z(function(t,e){var i=Math.sqrt(e/st),o=i*ot;t.moveTo(0,-i),t.lineTo(o,0),t.lineTo(0,i),t.lineTo(-o,0),t.closePath()},"draw")};var rt=Math.sin(Q/10)/Math.sin(7*Q/10),nt=Math.sin(tt/10)*rt,at=-Math.cos(tt/10)*rt;const ht={draw:z(function(t,e){var i=Math.sqrt(.8908130915292852*e),o=nt*i,s=at*i;t.moveTo(0,-i),t.lineTo(o,s);for(var l=1;l<5;++l){var r=tt*l/5,n=Math.cos(r),a=Math.sin(r);t.lineTo(a*i,-n*i),t.lineTo(n*o-a*s,a*o+n*s)}t.closePath()},"draw")},dt={draw:z(function(t,e){var i=Math.sqrt(e),o=-i/2;t.rect(o,o,i,i)},"draw")};var ct=Math.sqrt(3);const pt={draw:z(function(t,e){var i=-Math.sqrt(e/(3*ct));t.moveTo(0,2*i),t.lineTo(-ct*i,-i),t.lineTo(ct*i,-i),t.closePath()},"draw")};var ut=-.5,gt=Math.sqrt(3)/2,_t=1/Math.sqrt(12),yt=3*(_t/2+1);const ft={draw:z(function(t,e){var i=Math.sqrt(e/yt),o=i/2,s=i*_t,l=o,r=i*_t+i,n=-l,a=r;t.moveTo(o,s),t.lineTo(l,r),t.lineTo(n,a),t.lineTo(ut*o-gt*s,gt*o+ut*s),t.lineTo(ut*l-gt*r,gt*l+ut*r),t.lineTo(ut*n-gt*a,gt*n+ut*a),t.lineTo(ut*o+gt*s,ut*s-gt*o),t.lineTo(ut*l+gt*r,ut*r-gt*l),t.lineTo(ut*n+gt*a,ut*a-gt*n),t.closePath()},"draw")};function bt(){var t=Z(et),e=Z(64),i=null;function o(){var o;if(i||(i=o=K()),t.apply(this,arguments).draw(i,+e.apply(this,arguments)),o)return i=null,o+""||null}return P(o,"symbol"),z(o,"symbol"),o.type=function(e){return arguments.length?(t="function"==typeof e?e:Z(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:Z(+t),o):e},o.context=function(t){return arguments.length?(i=null==t?null:t,o):i},o}P(bt,"d3Symbol"),z(bt,"d3Symbol");var wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt=z(P(function(t){return t},"d3_identity2"),"d3_identity"),xt=z(P(function(t){for(var e=[],i=0,o=t.length;i<o;i++)e[i]=t[o-i-1];return e},"d3_reverse2"),"d3_reverse"),vt=z(P(function(t,i){t.each(function(){var t,o=e.select(this),s=o.text().split(/\s+/).reverse(),l=[];o.attr("y");for(var r=parseFloat(o.attr("dy"))||0,n=o.text(null).append("tspan").attr("x",0).attr("dy",r+"em");t=s.pop();)l.push(t),n.text(l.join(" ")),n.node().getComputedTextLength()>i&&l.length>1&&(l.pop(),n.text(l.join(" ")),l=[t],n=o.append("tspan").attr("x",0).attr("dy",1.2+r+"em").text(t))})},"d3_textWrapping2"),"d3_textWrapping"),Ct=z(P(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1],i=arguments[2],o=arguments[3],s=arguments[4];if("object"===(void 0===e?"undefined":wt(e))){if(0===e.length)return t;for(var l=e.length;l<t.length;l++)e.push(t[l]);return e}if("function"==typeof e){for(var r=[],n=t.length,a=0;a<n;a++)r.push(e({i:a,genLength:n,generatedLabels:t,domain:i,range:o,labelDelimiter:s}));return r}return t},"d3_mergeLabels2"),"d3_mergeLabels"),Tt=z(P(function(t,e,i){var o=[];if(e.length>1)o=e;else for(var s=t.domain(),l=(s[s.length-1]-s[0])/(e-1),r=0;r<e;r++)o.push(s[0]+r*l);var n=o.map(i);return{data:o,labels:n,feature:z(P(function(e){return t(e)},"feature"),"feature")}},"d3_linearLegend2"),"d3_linearLegend"),St=z(P(function(t,e,i){var o=t.range().map(function(o){var s=t.invertExtent(o);return e(s[0])+" "+i+" "+e(s[1])});return{data:t.range(),labels:o,feature:mt}},"d3_quantLegend2"),"d3_quantLegend"),Pt=z(P(function(t){return{data:t.domain(),labels:t.domain(),feature:z(P(function(e){return t(e)},"feature"),"feature")}},"d3_ordinalLegend2"),"d3_ordinalLegend"),Bt=z(P(function(t,e,i){t.call("cellover",i,e)},"d3_cellOver2"),"d3_cellOver"),zt=z(P(function(t,e,i){t.call("cellout",i,e)},"d3_cellOut2"),"d3_cellOut"),At=z(P(function(t,e,i){t.call("cellclick",i,e)},"d3_cellClick2"),"d3_cellClick"),Wt={d3_drawShapes:z(P(function(t,e,i,o,s,l){"rect"===t?e.attr("height",i).attr("width",o):"circle"===t?e.attr("r",s):"line"===t?e.attr("x1",0).attr("x2",o).attr("y1",0).attr("y2",0):"path"===t&&e.attr("d",l)},"d3_drawShapes"),"d3_drawShapes"),d3_addText:z(P(function(t,e,i,o,s){e.append("text").attr("class",o+"label");var l=t.selectAll("g."+o+"cell text."+o+"label").data(i).text(mt);return s&&t.selectAll("g."+o+"cell text."+o+"label").call(vt,s),l},"d3_addText"),"d3_addText"),d3_calcType:z(P(function(t,e,i,o,s,l){var r=t.invertExtent?St(t,s,l):t.ticks?Tt(t,i,s):Pt(t),n=t.range&&t.range()||t.domain();return r.labels=Ct(r.labels,o,t.domain(),n,l),e&&(r.labels=xt(r.labels),r.data=xt(r.data)),r},"d3_calcType"),"d3_calcType"),d3_filterCells:z(P(function(t,e){var i=t.data.map(function(e,i){return{data:e,label:t.labels[i]}}).filter(e),o=i.map(function(t){return t.data}),s=i.map(function(t){return t.label});return t.data=t.data.filter(function(t){return-1!==o.indexOf(t)}),t.labels=t.labels.filter(function(t){return-1!==s.indexOf(t)}),t},"d3_filterCells"),"d3_filterCells"),d3_placement:z(P(function(t,e,i,o,s,l){e.attr("transform",i),o.attr("transform",s),"horizontal"===t&&o.style("text-anchor",l)},"d3_placement"),"d3_placement"),d3_addEvents:z(P(function(t,e){t.on("mouseover.legend",function(t){Bt(e,t,this)}).on("mouseout.legend",function(t){zt(e,t,this)}).on("click.legend",function(t){At(e,t,this)})},"d3_addEvents"),"d3_addEvents"),d3_title:z(P(function(t,e,i,o){if(""!==e){t.selectAll("text."+i+"legendTitle").data([e]).enter().append("text").attr("class",i+"legendTitle"),t.selectAll("text."+i+"legendTitle").text(e),o&&t.selectAll("text."+i+"legendTitle").call(vt,o);var s=t.select("."+i+"legendCells"),l=t.select("."+i+"legendTitle").nodes().map(function(t){return t.getBBox().height})[0],r=-s.nodes().map(function(t){return t.getBBox().x})[0];s.attr("transform","translate("+r+","+l+")")}},"d3_title"),"d3_title"),d3_defaultLocale:{format:e.format,formatPrefix:e.formatPrefix},d3_defaultFormatSpecifier:".01f",d3_defaultDelimiter:"to"};function kt(){var t=e.scaleLinear(),i="rect",o=15,s=15,l=10,r=2,n=[5],a=void 0,h=[],d="",c=!1,p="",u=Wt.d3_defaultLocale,g=Wt.d3_defaultFormatSpecifier,_=10,y="middle",f=Wt.d3_defaultDelimiter,b=void 0,w="vertical",m=!1,x=void 0,v=void 0,C=e.dispatch("cellover","cellout","cellclick");function T(T){var S=Wt.d3_calcType(t,m,n,h,u.format(g),f);T.selectAll("g").data([t]).enter().append("g").attr("class",d+"legendCells"),a&&Wt.d3_filterCells(S,a);var B=T.select("."+d+"legendCells").selectAll("."+d+"cell").data(S.data),A=B.enter().append("g").attr("class",d+"cell");A.append(i).attr("class",d+"swatch");var W=T.selectAll("g."+d+"cell "+i+"."+d+"swatch").data(S.data);Wt.d3_addEvents(A,C),B.exit().transition().style("opacity",0).remove(),W.exit().transition().style("opacity",0).remove(),W=W.merge(W),Wt.d3_drawShapes(i,W,s,o,l,x);var k=Wt.d3_addText(T,A,S.labels,d,b);B=A.merge(B);var I=k.nodes().map(function(t){return t.getBBox()}),M=W.nodes().map(function(t){return t.getBBox()});c?W.attr("class",function(t){return d+"swatch "+S.feature(t)}):"line"==i?W.style("stroke",S.feature):W.style("fill",S.feature);var H,D=void 0,L=void 0,O="start"==y?0:"middle"==y?.5:1;"vertical"===w?(H=I.map(function(t,e){return Math.max(t.height,M[e].height)}),D=z(P(function(t,i){return"translate(0, "+(e.sum(H.slice(0,i))+i*r)+")"},"cellTrans2"),"cellTrans"),L=z(P(function(t,e){return"translate( "+(M[e].width+M[e].x+_)+", "+(M[e].y+M[e].height/2+5)+")"},"textTrans2"),"textTrans")):"horizontal"===w&&(D=z(P(function(t,e){return"translate("+e*(M[e].width+r)+",0)"},"cellTrans2"),"cellTrans"),L=z(P(function(t,e){return"translate("+(M[e].width*O+M[e].x)+",\n "+(M[e].height+M[e].y+_+8)+")"},"textTrans2"),"textTrans")),Wt.d3_placement(w,B,D,k,L,y),Wt.d3_title(T,p,d,v),B.transition().style("opacity",1)}return P(T,"legend"),z(T,"legend"),T.scale=function(e){return arguments.length?(t=e,T):t},T.cells=function(t){return arguments.length?((t.length>1||t>=2)&&(n=t),T):n},T.cellFilter=function(t){return arguments.length?(a=t,T):a},T.shape=function(t,e){return arguments.length?(("rect"==t||"circle"==t||"line"==t||"path"==t&&"string"==typeof e)&&(i=t,x=e),T):i},T.shapeWidth=function(t){return arguments.length?(o=+t,T):o},T.shapeHeight=function(t){return arguments.length?(s=+t,T):s},T.shapeRadius=function(t){return arguments.length?(l=+t,T):l},T.shapePadding=function(t){return arguments.length?(r=+t,T):r},T.labels=function(t){return arguments.length?(h=t,T):h},T.labelAlign=function(t){return arguments.length?("start"!=t&&"end"!=t&&"middle"!=t||(y=t),T):y},T.locale=function(t){return arguments.length?(u=e.formatLocale(t),T):u},T.labelFormat=function(t){return arguments.length?(g=e.formatSpecifier(t),T):T.locale().format(g)},T.labelOffset=function(t){return arguments.length?(_=+t,T):_},T.labelDelimiter=function(t){return arguments.length?(f=t,T):f},T.labelWrap=function(t){return arguments.length?(b=t,T):b},T.useClass=function(t){return arguments.length?(!0!==t&&!1!==t||(c=t),T):c},T.orient=function(t){return arguments.length?("horizontal"!=(t=t.toLowerCase())&&"vertical"!=t||(w=t),T):w},T.ascending=function(t){return arguments.length?(m=!!t,T):m},T.classPrefix=function(t){return arguments.length?(d=t,T):d},T.title=function(t){return arguments.length?(p=t,T):p},T.titleWidth=function(t){return arguments.length?(v=t,T):v},T.textWrap=function(t){return arguments.length?(textWrap=t,T):textWrap},T.on=function(){var t=C.on.apply(C,arguments);return t===C?T:t},T}P(kt,"color"),z(kt,"color");const It=(g=class extends e.SVGWidget{_owner;_targetWidget;_targetWidgetMonitor;_legendOrdinal;_disabled=[];_symbolTypeMap={circle:et,cross:it,diamond:lt,square:dt,star:ht,triangle:pt,wye:ft};constructor(t){super(),this._owner=t,this._drawStartPos="origin";const e=this;this._legendOrdinal=kt().shape("path",bt().type(et).size(150)()).shapePadding(10).shapeRadius(10).on("cellclick",function(t){e.onClick(t,this)}).on("cellover",t=>{e.onOver(t,this)}).on("cellout",t=>{e.onOut(t,this)})}isDisabled(t){return void 0!==t&&("string"==typeof t?0===t.indexOf("__")||this._disabled.indexOf(t)>=0:t instanceof e.Database.Field?0===t.id().indexOf("__")||this._disabled.indexOf(t.id())>=0:this._disabled.indexOf(t)>=0)}filteredFields(){switch(this.dataFamily()){case"2D":return this.fields();case"ND":return this.fields().filter(t=>!this.isDisabled(t))}return this.fields()}filteredColumns(){switch(this.dataFamily()){case"2D":return this.columns();case"ND":return this.columns().filter(t=>!this.isDisabled(t))}return this.columns()}filteredData(){switch(this.dataFamily()){case"2D":return this.data().filter(t=>!this.isDisabled(t[0]));case"ND":const t={};let e=!1;return this.columns().forEach((i,o)=>{const s=this.isDisabled(i);t[o]=s,s&&(e=!0)}),e?this.data().map(e=>e.filter((e,i)=>!t[i])):this.data()}return this.data()}isRainbow(){const t=this.getWidget();return t&&t._palette&&"rainbow"===t._palette.type()}targetWidget(t){if(!arguments.length)return this._targetWidget;if(this._targetWidget=t,this._targetWidgetMonitor&&(this._targetWidgetMonitor.remove(),delete this._targetWidgetMonitor),this._targetWidget){const t=this;this._targetWidgetMonitor=this._targetWidget.monitor(function(e,i,o,s){switch(e){case"chart":case"columns":case"data":case"paletteID":t.lazyRender()}})}return this}getWidget(){return this._targetWidget&&"composite_MultiChart"===this._targetWidget.classID()?this._targetWidget.chart():this._targetWidget}getPalette(){const t=this.getWidget();if(t&&t._palette)switch(t._palette.type()){case"ordinal":return e.Palette.ordinal(t._palette.id());case"rainbow":return e.Palette.rainbow(t._palette.id())}return e.Palette.ordinal("default")}getPaletteType(){return this.getPalette().type()}fillColorFunc(){const t=this.getWidget();if(t&&t.fillColor)return t._palette&&t.paletteID&&t._palette.name!==t.paletteID()&&(t._palette=t._palette.switch(t.paletteID())),(e,i,o)=>t.fillColor(e,i,o);const i=e.Palette.ordinal(t&&t.paletteID&&t.paletteID()||"default");return(t,e,o)=>i(e)}fillColor(t,e,i){return this.fillColorFunc()(t,e,i)}_g;enter(t,e){super.enter(t,e),this._g=e.append("g").attr("class","legendOrdinal")}calcMetaData(){let t=[],i=0,o=0;const s=this.columns().length;if(this._targetWidget){const l=this.columns();switch(this.getPaletteType()){case"ordinal":const r=this.fillColorFunc();let n=0;switch(this.dataFamily()){case"2D":t=this.data().map(function(t,e){n=this.data()[e].slice(1,s).reduce((t,e)=>t+e,0);const l=this.isDisabled(t[0]);l||(i+=n);const a=t[0]+(!l&&this.showSeriesTotal()?` (${n})`:""),h=this.textSize(a);return o<h.width&&(o=h.width),[r(t,t[0],!1),t[0],a]},this);break;case"ND":t=this.columns().filter(t=>0!==t.indexOf("__")).filter(function(t,e){return e>0}).map(function(t,e){n=this.data().reduce((t,i)=>t+i[e