"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),h=require("react"),D=require("react-redux"),S=require("react-intl");require("semantic-ui-react");const I=require("../data/DataContext.js"),l=require("../reducers/data.js");class q extends h.Component{constructor(t){super(t),this.debounces=[]}componentDidMount(){const{app:t,useAncestor:n,parent:o,source:e,store:a,params:i,csv:p,group:s,editing:u,waitForFilters:c=!1}=this.props;this.props.onLoadData({app:t,source:e,store:a,params:i,group:s})}componentDidUpdate(t,n,o){const{app:e,filters:a,useAncestor:i,parent:p,source:s,store:u,params:c,csv:d,group:f,editing:J}=this.props;(a!=t.filters||JSON.stringify(c)!=JSON.stringify(t.params)||e!=t.app||JSON.stringify(t.source)!=JSON.stringify(s)||d!=t.csv)&&this.props.onLoadData({app:e,source:s,store:u,params:c,group:f})}componentWillUnmount(){}render(){const{data:t,style:n,loading:o,time:e,error:a,editing:i}=this.props;return m.jsx(I.DataContext.Provider,{value:t,children:this.props.children})}}const g=(r,t,n)=>{const o=[t],e=r.getIn(["data","filters-settings",n])?r.getIn(["data","filters-settings",n]).toJS():null;if(e){const a=e[t];a&&a.parent&&o.push(...g(r,a.parent,n))}return o},v=(r,t)=>{const{store:n,readGroup:o,app:e,blockName:a,params:i,parent:p}=t;let s={...i};return p&&g(r,p,e).forEach(c=>{const d=r.getIn(["data","filters",e,c]);d&&d.size>0&&(s={...s,...d.toJS()})}),{params:s,data:r.getIn(["data",...n,"data"]),filters:r.getIn(["data","filters",e,o]),error:r.getIn(["data",...n,"error"]),loading:r.getIn(["data",...n,"loading"])}},x={onSetData:l.setData,onLoadData:l.getData},y=D.connect(v,x)(S.injectIntl(q));exports.default=y;
