"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[868],{888274:(e,t,r)=>{r.d(t,{Z:()=>x});var i=r(667294),s=r(347859),o=r(949302),n=r(22222),a=r(468135),h=r(80644),d=r(311064),l=r(61988),c=r(354085),p=r(674464),u=r(709330),m=r(389453),f=r(135944);function g(e){return e}const v=()=>null,y={id:"",className:"",preTransformProps:g,overrideTransformProps:void 0,postTransformProps:g,onRenderSuccess(){},onRenderFailure(){}},P=new u.Z;class w extends i.PureComponent{constructor(...e){super(...e),this.container=void 0,this.processChartProps=(0,n.P1)([e=>e.chartProps,e=>e.preTransformProps,e=>e.transformProps,e=>e.postTransformProps],((e,t=g,r=g,i=g)=>i(r(t(e))))),this.createLoadableRenderer=(0,n.P1)([e=>e.chartType,e=>e.overrideTransformProps],((e,t)=>{if(e){const r=(0,m.Z)({loader:{Chart:()=>(0,c.Z)().getAsPromise(e),transformProps:t?()=>Promise.resolve(t):()=>(0,p.Z)().getAsPromise(e)},loading:t=>this.renderLoading(t,e),render:this.renderChart});return r.preload(),r}return v})),this.renderChart=(e,t)=>{const{Chart:r,transformProps:i}=e,{chartProps:s,preTransformProps:o,postTransformProps:n}=t;return(0,f.tZ)(r,{...this.processChartProps({chartProps:s,preTransformProps:o,transformProps:i,postTransformProps:n})})},this.renderLoading=(e,t)=>{const{error:r}=e;return r?(0,f.BX)("div",{className:"alert alert-warning",role:"alert",children:[(0,f.tZ)("strong",{children:(0,l.t)("ERROR")})," ",(0,f.BX)("code",{children:['chartType="',t,'"']})," —",r.toString()]}):null},this.setRef=e=>{this.container=e}}render(){const{id:e,className:t,preTransformProps:r,postTransformProps:i,chartProps:s=P,onRenderSuccess:o,onRenderFailure:n}=this.props,a=this.createLoadableRenderer(this.props);if(null===s)return null;const h={};return e&&(h.id=e),t&&(h.className=t),(0,f.tZ)("div",{...h,ref:this.setRef,children:(0,f.tZ)(a,{preTransformProps:r,postTransformProps:i,chartProps:s,onRenderSuccess:o,onRenderFailure:n})})}}w.defaultProps=y;var R=r(751995),S=r(211965);const Z={maxWidth:800},D=R.iK.div`
  ${({theme:e,width:t,height:r})=>S.iv`
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    height: ${r}px;
    width: ${t}px;
    padding: ${4*e.gridUnit}px;

    & .no-results-title {
      font-size: ${e.typography.sizes.l}px;
      font-weight: ${e.typography.weights.bold};
      padding-bottom: ${2*e.gridUnit};
    }

    & .no-results-body {
      font-size: ${e.typography.sizes.m}px;
    }
  `}
`,C=({className:e,height:t,id:r,width:i})=>{const s="string"==typeof i||i>250,o=(0,l.t)("No results were returned for this query. If you expected results to be returned, ensure any filters are configured properly and the datasource contains data for the selected time range.");return(0,f.tZ)(D,{height:t,width:i,className:e,id:r,title:s?void 0:o,children:(0,f.BX)("div",{style:Z,children:[(0,f.tZ)("div",{className:"no-results-title",children:(0,l.t)("No Results")}),s&&(0,f.tZ)("div",{className:"no-results-body",children:o})]})})},b={FallbackComponent:function({componentStack:e,error:t,height:r,width:i}){return(0,f.BX)("div",{css:e=>({backgroundColor:e.colors.grayscale.dark2,color:e.colors.grayscale.light5,overflow:"auto",padding:32}),style:{height:r,width:i},children:[(0,f.BX)("div",{children:[(0,f.tZ)("div",{children:(0,f.tZ)("b",{children:(0,l.t)("Oops! An error occurred!")})}),(0,f.tZ)("code",{children:t?t.toString():"Unknown Error"})]}),e&&(0,f.BX)("div",{children:[(0,f.tZ)("b",{children:(0,l.t)("Stack Trace:")}),(0,f.tZ)("code",{children:e.split("\n").map((e=>(0,f.tZ)("div",{children:e},e)))})]})]})},height:400,width:"100%",enableNoResults:!0};class T extends i.PureComponent{constructor(...e){super(...e),this.core=void 0,this.createChartProps=u.Z.createSelector(),this.parseDimension=(0,n.P1)([({width:e})=>e,({height:e})=>e],((e,t)=>{const r=(0,h.Z)(e),s=(0,h.Z)(t),o={height:s.isDynamic?100*s.multiplier+"%":s.value,width:r.isDynamic?100*r.multiplier+"%":r.value};return{BoundingBox:r.isDynamic&&s.isDynamic&&1===r.multiplier&&1===s.multiplier?i.Fragment:({children:e})=>(0,f.tZ)("div",{style:o,children:e}),heightInfo:s,widthInfo:r}})),this.setRef=e=>{this.core=e},this.getQueryCount=()=>{var e,t;return null!=(e=null==(t=(0,d.Z)().get(this.props.chartType))?void 0:t.queryObjectCount)?e:1}}renderChart(e,t){const{id:r,className:i,chartType:o,preTransformProps:n,overrideTransformProps:a,postTransformProps:h,onRenderSuccess:d,onRenderFailure:l,disableErrorBoundary:c,FallbackComponent:p,onErrorBoundary:u,Wrapper:m,queriesData:g,enableNoResults:v,noResults:y,theme:P,...R}=this.props,S=this.createChartProps({...R,queriesData:g,height:t,width:e,theme:P});let Z;if(!v||g&&!g.slice(0,this.getQueryCount()).every((({data:e})=>!e||Array.isArray(e)&&0===e.length))){const s=(0,f.tZ)(w,{ref:this.setRef,id:r,className:i,chartType:o,chartProps:S,preTransformProps:n,overrideTransformProps:a,postTransformProps:h,onRenderSuccess:d,onRenderFailure:l});Z=m?(0,f.tZ)(m,{width:e,height:t,children:s}):s}else Z=y||(0,f.tZ)(C,{id:r,className:i,height:t,width:e});return!0===c?Z:(0,f.tZ)(s.ZP,{FallbackComponent:r=>(0,f.tZ)(p,{width:e,height:t,...r}),onError:u,children:Z})}render(){const{heightInfo:e,widthInfo:t,BoundingBox:r}=this.parseDimension(this.props);if(t.isDynamic||e.isDynamic){const{debounceTime:i}=this.props;return(0,f.tZ)(r,{children:(0,f.tZ)(o.Z,{debounceTime:i,children:({width:r,height:i})=>this.renderChart(t.isDynamic?Math.floor(r):t.value,e.isDynamic?Math.floor(i):e.value)})})}return this.renderChart(t.value,e.value)}}T.defaultProps=b;const x=(0,a.b)(T)},389453:(e,t,r)=>{r.d(t,{Z:()=>n});var i=r(268356),s=r.n(i);const o={onRenderFailure(){},onRenderSuccess(){}};function n(e){const t=s().Map(e);class r extends t{componentDidMount(){this.afterRender()}componentDidUpdate(){this.afterRender()}afterRender(){const{loaded:e,loading:t,error:r}=this.state,{onRenderFailure:i,onRenderSuccess:s}=this.props;t||(r?i(r):e&&Object.keys(e).length>0&&s())}}return r.defaultProps=void 0,r.defaultProps=o,r.preload=t.preload,r}},709330:(e,t,r)=>{r.d(t,{Z:()=>a});var i=r(22222),s=r(978036);const o=800,n=600;class a{constructor(e={}){this.annotationData=void 0,this.datasource=void 0,this.rawDatasource=void 0,this.initialValues=void 0,this.formData=void 0,this.rawFormData=void 0,this.height=void 0,this.hooks=void 0,this.ownState=void 0,this.filterState=void 0,this.legendState=void 0,this.queriesData=void 0,this.width=void 0,this.behaviors=void 0,this.displaySettings=void 0,this.appSection=void 0,this.isRefreshing=void 0,this.inputRef=void 0,this.inContextMenu=void 0,this.emitCrossFilters=void 0,this.theme=void 0;const{annotationData:t={},datasource:r={},formData:i={},hooks:a={},ownState:h={},filterState:d={},legendState:l,initialValues:c={},queriesData:p=[],behaviors:u=[],displaySettings:m={},width:f=o,height:g=n,appSection:v,isRefreshing:y,inputRef:P,inContextMenu:w=!1,emitCrossFilters:R=!1,theme:S}=e;this.width=f,this.height=g,this.annotationData=t,this.datasource=(0,s.Z)(r),this.rawDatasource=r,this.formData=(0,s.Z)(i),this.rawFormData=i,this.hooks=a,this.initialValues=c,this.queriesData=p,this.ownState=h,this.filterState=d,this.legendState=l,this.behaviors=u,this.displaySettings=m,this.appSection=v,this.isRefreshing=y,this.inputRef=P,this.inContextMenu=w,this.emitCrossFilters=R,this.theme=S}}a.createSelector=void 0,a.createSelector=function(){return(0,i.P1)((e=>e.annotationData),(e=>e.datasource),(e=>e.formData),(e=>e.height),(e=>e.hooks),(e=>e.initialValues),(e=>e.queriesData),(e=>e.width),(e=>e.ownState),(e=>e.filterState),(e=>e.legendState),(e=>e.behaviors),(e=>e.displaySettings),(e=>e.appSection),(e=>e.isRefreshing),(e=>e.inputRef),(e=>e.inContextMenu),(e=>e.emitCrossFilters),(e=>e.theme),((e,t,r,i,s,o,n,h,d,l,c,p,u,m,f,g,v,y,P)=>new a({annotationData:e,datasource:t,formData:r,height:i,hooks:s,initialValues:o,queriesData:n,ownState:d,filterState:l,legendState:c,width:h,behaviors:p,displaySettings:u,appSection:m,isRefreshing:f,inputRef:g,inContextMenu:v,emitCrossFilters:y,theme:P})))}},80644:(e,t,r)=>{r.d(t,{Z:()=>s});const i={isDynamic:!0,multiplier:1};function s(e){return"auto"===e||"100%"===e?i:"string"==typeof e&&e.length>0&&"%"===e[e.length-1]?{isDynamic:!0,multiplier:parseFloat(e)/100}:{isDynamic:!1,value:"number"==typeof e?e:parseFloat(e)}}},28291:(e,t,r)=>{r.d(t,{S:()=>o});var i=r(667294),s=r(785716);function o(e,t){const r=(0,s.D)(e);(0,i.useEffect)((()=>{e!==r&&t(r,e)}),[e,r,t])}},978036:(e,t,r)=>{r.d(t,{Z:()=>d});var i=r(567523),s=r.n(i),o=r(968630),n=r.n(o),a=r(968929),h=r.n(a);function d(e){if(null==e)return e;if(n()(e))return s()(e,((e,t)=>h()(t)));throw new Error(`Cannot convert input that is not a plain object: ${e}`)}}}]);
//# sourceMappingURL=083f726dbe041f51a988.chunk.js.map