react-autoql 8.1.0 → 8.1.1

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 +1 @@
1
- import"react-perfect-scrollbar/dist/css/styles.css";import e from"lodash.get";import t from"lodash.filter";import n from"lodash.isequal";import o from"dayjs";import a from"dayjs/plugin/advancedFormat";import r from"dayjs/plugin/localizedFormat";import i from"dayjs/plugin/utc";import l from"dayjs/plugin/timezone";import s from"dayjs/plugin/isBetween";import c from"dayjs/plugin/weekOfYear";import u from"dayjs/plugin/quarterOfYear";import d from"dayjs/plugin/customParseFormat";import p from"dayjs/plugin/isSameOrBefore";import m from"dayjs/plugin/isToday";import f,{useEffect as g,Component as v,Fragment as h}from"react";import b,{PropTypes as y}from"prop-types";import{v4 as C}from"uuid";import E from"axios";import S from"lodash.clonedeep";import{AiOutlineBook as T}from"@react-icons/all-files/ai/AiOutlineBook";import{AiOutlineBulb as D}from"@react-icons/all-files/ai/AiOutlineBulb";import{AiOutlineDashboard as x}from"@react-icons/all-files/ai/AiOutlineDashboard";import{AiOutlineEdit as R}from"@react-icons/all-files/ai/AiOutlineEdit";import{AiOutlineFileText as I}from"@react-icons/all-files/ai/AiOutlineFileText";import{AiOutlineMenu as A}from"@react-icons/all-files/ai/AiOutlineMenu";import{AiOutlineQuestionCircle as N}from"@react-icons/all-files/ai/AiOutlineQuestionCircle";import{AiOutlineTag as w}from"@react-icons/all-files/ai/AiOutlineTag";import{AiOutlineFileSearch as k}from"@react-icons/all-files/ai/AiOutlineFileSearch";import{AiOutlineNumber as P}from"@react-icons/all-files/ai/AiOutlineNumber";import{BiLineChart as O}from"@react-icons/all-files/bi/BiLineChart";import{BiSearchAlt as L}from"@react-icons/all-files/bi/BiSearchAlt";import{BiBookmark as M}from"@react-icons/all-files/bi/BiBookmark";import{BiBook as q}from"@react-icons/all-files/bi/BiBook";import{BiNote as V}from"@react-icons/all-files/bi/BiNote";import{BiAbacus as _}from"@react-icons/all-files/bi/BiAbacus";import{BiEnvelope as F}from"@react-icons/all-files/bi/BiEnvelope";import{BiEnvelopeOpen as z}from"@react-icons/all-files/bi/BiEnvelopeOpen";import{BsArrowBarUp as B}from"@react-icons/all-files/bs/BsArrowBarUp";import{BsArrowBarDown as H}from"@react-icons/all-files/bs/BsArrowBarDown";import{BsLightning as Q}from"@react-icons/all-files/bs/BsLightning";import{FaMicrophoneAlt as U}from"@react-icons/all-files/fa/FaMicrophoneAlt";import{FiAlertTriangle as Y}from"@react-icons/all-files/fi/FiAlertTriangle";import{FiArrowLeft as K}from"@react-icons/all-files/fi/FiArrowLeft";import{FiBell as j}from"@react-icons/all-files/fi/FiBell";import{FiBellOff as W}from"@react-icons/all-files/fi/FiBellOff";import{FiCalendar as G}from"@react-icons/all-files/fi/FiCalendar";import{FiCheck as X}from"@react-icons/all-files/fi/FiCheck";import{FiDatabase as J}from"@react-icons/all-files/fi/FiDatabase";import{FiDownload as Z}from"@react-icons/all-files/fi/FiDownload";import{FiEye as $}from"@react-icons/all-files/fi/FiEye";import{FiMoreHorizontal as ee}from"@react-icons/all-files/fi/FiMoreHorizontal";import{FiMoreVertical as te}from"@react-icons/all-files/fi/FiMoreVertical";import{FiPauseCircle as ne}from"@react-icons/all-files/fi/FiPauseCircle";import{FiPlus as oe}from"@react-icons/all-files/fi/FiPlus";import{FiSend as ae}from"@react-icons/all-files/fi/FiSend";import{FiSettings as re}from"@react-icons/all-files/fi/FiSettings";import{FiTrash2 as ie}from"@react-icons/all-files/fi/FiTrash2";import{FiMaximize as le}from"@react-icons/all-files/fi/FiMaximize";import{FiMinimize as se}from"@react-icons/all-files/fi/FiMinimize";import{FiRefreshCw as ce}from"@react-icons/all-files/fi/FiRefreshCw";import{FiTool as ue}from"@react-icons/all-files/fi/FiTool";import{RiFilterLine as de}from"@react-icons/all-files/ri/RiFilterLine";import{RiFilterOffLine as pe}from"@react-icons/all-files/ri/RiFilterOffLine";import{RiListSettingsLine as me}from"@react-icons/all-files/ri/RiListSettingsLine";import{RiBroadcastFill as fe}from"@react-icons/all-files/ri/RiBroadcastFill";import{GoReport as ge}from"@react-icons/all-files/go/GoReport";import{IoIosCloseCircleOutline as ve}from"@react-icons/all-files/io/IoIosCloseCircleOutline";import{IoIosGlobe as he}from"@react-icons/all-files/io/IoIosGlobe";import{IoIosHourglass as be}from"@react-icons/all-files/io/IoIosHourglass";import{IoIosSearch as ye}from"@react-icons/all-files/io/IoIosSearch";import{IoIosArrowDown as Ce}from"@react-icons/all-files/io/IoIosArrowDown";import{IoIosArrowUp as Ee}from"@react-icons/all-files/io/IoIosArrowUp";import{IoIosArrowBack as Se}from"@react-icons/all-files/io/IoIosArrowBack";import{IoIosArrowForward as Te}from"@react-icons/all-files/io/IoIosArrowForward";import{MdClose as De}from"@react-icons/all-files/md/MdClose";import{MdContentCopy as xe}from"@react-icons/all-files/md/MdContentCopy";import{MdError as Re}from"@react-icons/all-files/md/MdError";import{MdInfoOutline as Ie}from"@react-icons/all-files/md/MdInfoOutline";import{MdLock as Ae}from"@react-icons/all-files/md/MdLock";import{MdLockOpen as Ne}from"@react-icons/all-files/md/MdLockOpen";import{MdPlayCircleOutline as we}from"@react-icons/all-files/md/MdPlayCircleOutline";import{MdAttachMoney as ke}from"@react-icons/all-files/md/MdAttachMoney";import{isMobile as Pe,isBrowser as Oe}from"react-device-detect";import{ArrowContainer as Le,Popover as Me}from"react-tiny-popover";import qe from"react-modal";import Ve from"react-tooltip";import _e from"lodash.isempty";import Fe from"html-react-parser";import{fetchExploreQueries as ze,fetchDataExplorerSuggestions as Be,fetchSubjectList as He,fetchDataExplorerAutocomplete as Qe,fetchDataPreview as Ue,fetchVLAutocomplete as Ye,fetchAutocomplete as Ke,runQueryOnly as je,runQueryNewPage as We,AGG_TYPES as Ge,getLegendLabelsForMultiSeries as Xe,legendColor as Je,formatChartLabel as Ze,getBandScale as $e,getLinearScales as et,getPieChartData as tt,getNumberColumnIndices as nt,getMinAndMaxValues as ot,getLinearScale as at,getBinLinearScale as rt,getHistogramScale as it,aggregateData as lt,runDrilldown as st,AggTypes as ct,sendSuggestion as ut,reportProblem as dt,exportCSV as pt,setColumnVisibility as mt,setFilters as ft,unsetFilterFromAPI as gt,fetchFilters as vt,runQuery as ht}from"autoql-fe-utils";import{TabulatorFull as bt}from"tabulator-tables";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import{DateRange as yt}from"react-date-range";import"react-date-range/dist/styles.css";import"react-date-range/dist/theme/default.css";import{scaleOrdinal as Ct,scaleLinear as Et}from"d3-scale";import{select as St}from"d3-selection";import{max as Tt,min as Dt,mean as xt,deviation as Rt,median as It,bin as At}from"d3-array";import{axisTop as Nt,axisRight as wt,axisLeft as kt,axisBottom as Pt}from"d3-axis";import Ot from"react-perfect-scrollbar";import{symbol as Lt,symbolSquare as Mt,arc as qt}from"d3-shape";import{createPortal as Vt}from"react-dom";import _t from"react-slider";import Ft from"jstat";import"d3-transition";import{format as zt}from"sql-formatter";import Bt from"parse-num";import Ht from"moment-timezone";import Qt from"react-infinite-scroller";import Ut from"rc-drawer";import Yt from"react-localization";import"rc-drawer/assets/index.css";import Kt from"react-autosuggest";import{toast as jt,ToastContainer as Wt,Slide as Gt}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import Xt from"lodash.has";import Jt from"react-speech-recognition";import Zt,{WidthProvider as $t}from"react-grid-layout";import en from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import tn,{StereoAudioRecorder as nn}from"recordrtc";function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function an(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?on(Object(n),!0).forEach((function(t){mn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):on(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rn(){rn=function(){return t};var e,t={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",l=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var r=t&&t.prototype instanceof v?t:v,i=Object.create(r.prototype),l=new N(o||[]);return a(i,"_invoke",{value:x(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",m="executing",f="completed",g={};function v(){}function h(){}function b(){}var y={};c(y,i,(function(){return this}));var C=Object.getPrototypeOf,E=C&&C(C(w([])));E&&E!==n&&o.call(E,i)&&(y=E);var S=b.prototype=v.prototype=Object.create(y);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function n(a,r,i,l){var s=d(e[a],e,r);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==typeof u&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,l)}))}l(s.arg)}var r;a(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,a){n(e,o,t,a)}))}return r=r?r.then(a,a):a()}})}function x(t,n,o){var a=p;return function(r,i){if(a===m)throw new Error("Generator is already running");if(a===f){if("throw"===r)throw i;return{value:e,done:!0}}for(o.method=r,o.arg=i;;){var l=o.delegate;if(l){var s=R(l,o);if(s){if(s===g)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(a===p)throw a=f,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a=m;var c=d(t,n,o);if("normal"===c.type){if(a=o.done?f:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:o.done}}"throw"===c.type&&(a=f,o.method="throw",o.arg=c.arg)}}}function R(t,n){var o=n.method,a=t.iterator[o];if(a===e)return n.delegate=null,"throw"===o&&t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),g;var r=d(a,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;var i=r.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function w(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,r=function n(){for(;++a<t.length;)if(o.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return r.next=r}}throw new TypeError(typeof t+" is not iterable")}return h.prototype=b,a(S,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:h,configurable:!0}),h.displayName=c(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},T(D.prototype),c(D.prototype,l,(function(){return this})),t.AsyncIterator=D,t.async=function(e,n,o,a,r){void 0===r&&(r=Promise);var i=new D(u(e,n,o,a),r);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(S),c(S,s,"Generator"),c(S,i,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=w,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(o,a){return l.type="throw",l.arg=t,n.next=o,a&&(n.method="next",n.arg=e),!!a}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var r=a;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var i=r?r.completion:{};return i.type=e,i.arg=t,r?(this.method="next",this.next=r.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var a=o.arg;A(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,o){return this.delegate={iterator:w(t),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=e),g}},t}function ln(e){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sn(e,t,n,o,a,r,i){try{var l=e[r](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,a)}function cn(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var r=e.apply(t,n);function i(e){sn(r,o,a,i,l,"next",e)}function l(e){sn(r,o,a,i,l,"throw",e)}i(void 0)}))}}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,xn(o.key),o)}}function pn(e,t,n){return t&&dn(e.prototype,t),n&&dn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function mn(e,t,n){return(t=xn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fn(){return(fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function gn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hn(e,t)}function vn(e){return(vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hn(e,t){return(hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function bn(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function yn(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Cn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function En(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Cn(e)}function Sn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=vn(e);if(t){var a=vn(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return En(this,n)}}function Tn(e){return function(e){if(Array.isArray(e))return Dn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function xn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var Rn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{hasError:!1}),mn(Cn(e),"componentDidCatch",(function(t,n){console.error("Error HOC caught error:",t),e.setState({hasError:!0}),console.error(t),console.error(n)})),mn(Cn(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),mn(Cn(e),"render",(function(){return e.state.hasError?f.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return pn(n)}();mn(Rn,"propTypes",{message:b.string}),mn(Rn,"defaultProps",{message:null});var In=f.createElement("svg",{x:"0px",y:"0px",width:"23px",height:"23px",viewBox:"0 0 23 23",style:{strokeWidth:"1.4px",marginBottom:"2px",marginLeft:"1px"}},f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-outlined",d:"M0.732,9.04l9.975-5.195c0.432-0.225,0.946-0.227,1.38-0.005l10.18,5.202c0.23,0.118,0.232,0.446,0.002,0.566\nl-10.069,5.258c-0.436,0.228-0.957,0.228-1.393,0L0.731,9.605C0.503,9.486,0.503,9.159,0.732,9.04z"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M8.324,18.906c0.842,0.251,1.887,0.419,3.176,0.419c5.065,0,6.217-2.596,6.217-2.596v-4.745"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M5.134,11.903"}),f.createElement("ellipse",{className:"react-autoql-icon-outlined",cx:"11.425",cy:"9.005",rx:"0.91",ry:"0.611"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M10.584,9.356l-5.107,2.808v2.51l-1.105,3.941c0,0,1.23,0.842,2.072,0l-0.966-3.941"}))),An=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M8.7,3.6l0.1,0l0,0l0,0l0.1,0c2.2,0,4.3,1.3,5.2,3.3c0.2,0.4,0.3,0.7,0.4,1.1l0,0c0.1,0.4,0.1,0.8,0.1,1.2 c0,1.3-0.5,2.5-1.3,3.4c-0.4,0.4-0.8,0.7-1.2,1c-0.3,0.2-0.7,0.4-1,0.5c-0.4,0.1-0.7,0.2-1.1,0.3c-0.4,0.1-0.8,0.1-1.2,0.1 c-0.2,0-0.4,0-0.6,0c-0.2,0-0.4,0-0.6-0.1l-0.2,0c-0.3-0.1-0.6-0.2-1-0.3c-0.4-0.2-0.7-0.4-1-0.6l-1-0.9l-1,1 c-0.1,0.1-0.2,0.2-0.3,0.2c0-0.3,0-0.6,0-1l0-3.6c0-0.1,0-0.1,0-0.2C3.2,6,5.7,3.6,8.7,3.6L8.7,3.6 M8.7,2.1c-3.8,0-6.9,3-7,6.9 c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c0.1,0,0.2,0,0.3,0c1.3,0,2.5-0.5,3.5-1.4c0.4,0.4,0.9,0.7,1.5,0.9c0.5,0.2,1,0.3,1.5,0.4 l0,0C7.7,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0,0,0,0,0,0c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4c0.4-0.2,0.9-0.4,1.3-0.6 c0.6-0.4,1.1-0.8,1.6-1.3c1.1-1.2,1.7-2.8,1.7-4.5c0-0.5-0.1-1-0.2-1.5l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1-0.5-0.3-1-0.5-1.5 c-1.2-2.5-3.8-4.1-6.6-4.1c0,0-0.1,0-0.1,0C8.8,2.1,8.7,2.1,8.7,2.1L8.7,2.1z"}),f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M15,9.1c3,0,5.4,2.4,5.5,5.4c0,0.1,0,0.1,0,0.2v3.6c0,0.4,0,0.7,0,1c-0.1-0.1-0.2-0.2-0.3-0.2l-1-1l-1,0.9 c-0.3,0.3-0.7,0.5-1,0.6c-0.3,0.1-0.6,0.2-0.9,0.3L16,20c-0.2,0-0.4,0.1-0.6,0.1c-0.2,0-0.4,0-0.6,0c-0.4,0-0.8,0-1.2-0.1 c-0.4-0.1-0.8-0.2-1.1-0.3c-0.3-0.1-0.7-0.3-1-0.5c-0.5-0.3-0.9-0.6-1.2-1C9.5,17.2,9,16,9,14.7c0-0.4,0-0.8,0.1-1.1l0,0l0,0 c0.1-0.4,0.2-0.8,0.4-1.1c1-2,3-3.3,5.2-3.3l0.1,0l0,0l0,0L15,9.1 M15,7.6c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c-2.8,0-5.4,1.6-6.6,4.1 c-0.2,0.5-0.4,1-0.5,1.5l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1,0.5-0.2,1-0.2,1.5c0,1.6,0.6,3.2,1.7,4.5c0.5,0.5,1,1,1.6,1.3 c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4c0.5,0.1,1,0.1,1.5,0.1c0,0,0,0,0,0c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0 c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9c0.9,0.9,2.2,1.4,3.5,1.4c0.1,0,0.2,0,0.3,0c0,0-1-0.6-1-3.2v-3.6 c0-0.1,0-0.2,0-0.2C21.9,10.7,18.8,7.6,15,7.6L15,7.6z"})),Nn=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M16,7.7L16,7.7C16,7.7,16,7.7,16,7.7C16,7.7,16,7.7,16,7.7L16,7.7c-0.1-0.5-0.3-1-0.5-1.5C14.3,3.6,11.7,2,8.8,2.1 C5,2,1.8,5.1,1.7,8.9c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c1.4,0.1,2.7-0.4,3.7-1.4c0.4,0.4,0.9,0.7,1.5,0.9 c0.5,0.2,1,0.3,1.5,0.4l0,0C7.7,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4 c0.4-0.2,0.9-0.4,1.3-0.6c0.6-0.4,1.1-0.8,1.6-1.3c1.1-1.2,1.7-2.8,1.7-4.5C16.2,8.7,16.1,8.2,16,7.7z"})),f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M16.1,9.1c0,1.6-0.6,3.2-1.7,4.5c-0.5,0.5-1,1-1.6,1.3c-0.4,0.2-0.8,0.5-1.3,0.6c-0.4,0.2-0.9,0.3-1.4,0.4 C9.8,16,9.3,16,8.8,16c-0.2,0-0.5,0-0.7,0c-0.2,0-0.3,0-0.5-0.1c0,0,0,0,0,0C7.8,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0,0,0,0,0,0 c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4c0.4-0.2,0.9-0.4,1.3-0.6c0.6-0.4,1.1-0.8,1.6-1.3C15.6,12.4,16.2,10.8,16.1,9.1 c0.1-0.5,0-0.9-0.1-1.4c0,0,0,0,0,0C16.1,8.2,16.1,8.6,16.1,9.1z"})),f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M22,18.3v-3.6c0-0.1,0-0.2,0-0.2c-0.1-2.9-1.8-5.3-4.3-6.3c0,0.3,0.1,0.7,0.1,1c0,2-0.7,3.9-2,5.5 c-0.6,0.6-1.2,1.2-1.9,1.6c-0.5,0.3-1,0.5-1.5,0.7c-0.5,0.2-1.1,0.4-1.7,0.5c-0.6,0.1-1.2,0.2-1.8,0.2c-0.3,0-0.5,0-0.8,0 c0.3,0.6,0.6,1.1,1.1,1.6c0.5,0.5,1,1,1.6,1.3c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4c0.5,0.1,1,0.1,1.5,0.1 c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9c1,0.9,2.3,1.4,3.7,1.4 C22.9,21.5,22,20.9,22,18.3z"}))))),wn=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M7.7,13.2L7.7,13.2C7.7,13.2,7.7,13.2,7.7,13.2C7.7,13.2,7.7,13.2,7.7,13.2L7.7,13.2c0.1-0.5,0.3-1,0.5-1.5 c1.2-2.6,3.8-4.2,6.7-4.1c0.4,0,0.8,0,1.2,0.1c0,0,0,0,0-0.1l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1-0.5-0.3-1-0.5-1.5 C14.3,3.6,11.7,2,8.8,2.1C5,2,1.8,5.1,1.7,8.9c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c1.4,0.1,2.7-0.4,3.7-1.4 c0.4,0.4,0.9,0.7,1.5,0.9c0.5,0.2,1,0.3,1.5,0.4l0,0c0.1,0,0.1,0,0.2,0c-0.1-0.4-0.1-0.8-0.1-1.2C7.5,14.2,7.6,13.7,7.7,13.2z"})),f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M22,18.3v-3.6c0-0.1,0-0.2,0-0.2C22,11,19.4,8.2,16,7.7c0.1,0.5,0.2,1,0.2,1.4c0,1.6-0.6,3.2-1.7,4.5 c-0.5,0.5-1,1-1.6,1.3c-0.4,0.2-0.8,0.5-1.3,0.6c-0.4,0.2-0.9,0.3-1.4,0.4c-0.5,0.1-1,0.1-1.5,0.1c-0.2,0-0.5,0-0.7,0 C8,16,7.8,16,7.6,16c0.2,1.2,0.8,2.3,1.6,3.2c0.5,0.5,1,1,1.6,1.3c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4 c0.5,0.1,1,0.1,1.5,0.1c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9 c1,0.9,2.3,1.4,3.7,1.4C23,21.6,22,20.9,22,18.3z"})))),kn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M8,0.8c2.3,0,4.6,0,6.9,0c0.8,0,1.1,0.3,1.1,1.1c0,4,0,7.9,0,11.9c0,0.8-0.3,1.1-1.1,1.1c-4.6,0-9.3,0-13.9,0\nc-0.7,0-1-0.3-1-1c0-4,0-8,0-12c0-0.7,0.3-1,1-1C3.4,0.8,5.7,0.8,8,0.8L8,0.8z M5,11.1H1v2.7h4V11.1L5,11.1z M10,13.8v-2.7H6v2.7\nL10,13.8L10,13.8z M11,13.8h4v-2.7h-4V13.8L11,13.8z M1.1,7.5v2.7h4V7.5H1.1L1.1,7.5z M11,10.2c1.3,0,2.5,0,3.8,0\nc0.1,0,0.2-0.1,0.2-0.2c0-0.8,0-1.7,0-2.5h-4C11,8.4,11,9.3,11,10.2L11,10.2z M6,10.1h4V7.5H6V10.1L6,10.1z M5,6.6V3.9H1\nc0,0.8,0,1.6,0,2.4c0,0.1,0.2,0.2,0.3,0.2C2.5,6.6,3.7,6.6,5,6.6L5,6.6z M6,6.5h4V3.9H6V6.5L6,6.5z M14.9,6.5V3.9h-4v2.7L14.9,6.5\nL14.9,6.5z"})),Pn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M8,0.7c2.3,0,4.6,0,6.9,0C15.7,0.7,16,1,16,1.8c0,4,0,7.9,0,11.9c0,0.8-0.3,1.1-1.1,1.1c-4.6,0-9.3,0-13.9,0 c-0.7,0-1-0.3-1-1c0-4,0-8,0-12c0-0.7,0.3-1,1-1C3.4,0.7,5.7,0.7,8,0.7L8,0.7z M5.1,6.4h4.4V3.8H5.1V6.4L5.1,6.4z M14.9,6.4V3.8 h-4.4v2.7L14.9,6.4L14.9,6.4z M5.1,10.1h4.4V7.4H5.1V10.1L5.1,10.1z M14.9,10.1V7.4h-4.4v2.7H14.9L14.9,10.1z M5.1,13.7h4.4V11H5.1 V13.7L5.1,13.7z M14.9,13.7V11h-4.4v2.7L14.9,13.7L14.9,13.7z"})),On=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M12.6,0h-2.4C9.4,0,8.8,0.6,8.8,1.4v2.7c0,0,0,0,0,0H6.3c-0.8,0-1.4,0.6-1.4,1.4v3.2c0,0-0.1,0-0.1,0H2.4 C1.6,8.7,1,9.4,1,10.1v4.5C1,15.4,1.6,16,2.4,16h2.4c0,0,0.1,0,0.1,0h1.3c0,0,0.1,0,0.1,0h2.4c0,0,0.1,0,0.1,0H10c0,0,0.1,0,0.1,0 h2.4c0.8,0,1.4-0.6,1.4-1.4V1.4C14,0.6,13.3,0,12.6,0z M6.3,5.5h2.4v9.1H6.3V5.5z M2.4,10.1h2.4v4.5H2.4V10.1z M12.6,14.6h-2.4V1.4 h2.4V14.6z"})),Ln=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M14.6,1.6H1.4C0.6,1.6,0,2.2,0,3v2.4v0.1v1.2v0.1v2.4v0.1v1.3v0.1v2.4c0,0.8,0.6,1.4,1.4,1.4h4.5 c0.7,0,1.4-0.6,1.4-1.4v-2.4v-0.1h3.2c0.8,0,1.4-0.6,1.4-1.4V6.7l0,0h2.7c0.8,0,1.4-0.6,1.4-1.4V2.9C16,2.2,15.4,1.5,14.6,1.6z M1.4,9.2V6.8h9.1v2.4H1.4z M1.4,13.1v-2.4h4.5v2.4H1.4z M14.6,2.9v2.4H1.4V2.9H14.6z"})),Mn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M1,12.2c-0.2,0-0.3-0.1-0.5-0.2c-0.3-0.3-0.3-0.7,0-1l3.8-3.9C4.5,7,4.7,7,4.9,7s0.4,0.1,0.5,0.3l2.3,3l6.8-7.1 c0.3-0.3,0.7-0.3,1,0c0.3,0.3,0.3,0.7,0,1l-7.3,7.7C8,11.9,7.8,12,7.6,12s-0.4-0.1-0.5-0.3l-2.3-3L1.5,12C1.4,12.2,1.2,12.2,1,12.2z "})),qn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M12.6,8.5H7.4V3.3c0-0.4-0.3-0.7-0.7-0.7c-0.9,0-1.8,0.2-2.6,0.5C3.3,3.5,2.6,3.9,2,4.6 C1.3,5.2,0.9,5.9,0.5,6.7C0.2,7.5,0,8.4,0,9.3c0,0.9,0.2,1.8,0.5,2.6C0.9,12.7,1.3,13.4,2,14c0.6,0.6,1.3,1.1,2.1,1.4 C4.9,15.8,5.8,16,6.7,16c0.9,0,1.8-0.2,2.6-0.5c0.8-0.3,1.5-0.8,2.1-1.4c0.6-0.6,1.1-1.3,1.4-2.1c0.3-0.8,0.5-1.7,0.5-2.6 C13.4,8.9,13,8.5,12.6,8.5z M6.7,10h5.2c-0.2,1.1-0.7,2.1-1.5,3c-1,1-2.3,1.5-3.7,1.5C5.3,14.5,4,14,3,13c-1-1-1.5-2.3-1.5-3.7 C1.5,7.9,2,6.6,3,5.6c0.8-0.8,1.8-1.3,3-1.5v5.2C6,9.7,6.3,10,6.7,10z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M15.5,4.1C15.1,3.3,14.7,2.6,14,2c-0.6-0.6-1.3-1.1-2.1-1.4C11.1,0.2,10.2,0,9.3,0C8.9,0,8.6,0.3,8.6,0.7v6 c0,0.4,0.3,0.7,0.7,0.7h6c0.4,0,0.7-0.3,0.7-0.7C16,5.8,15.8,4.9,15.5,4.1z M10,6V1.5c1.1,0.2,2.2,0.7,3,1.5c0.8,0.8,1.3,1.8,1.5,3 H10z"})),Vn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),f.createElement("path",{className:"hm2",d:"M8,10.7l-1.1,0V16L8,16c0.9,0,1.7-0.6,1.7-1.4v-2.5C9.7,11.3,8.9,10.7,8,10.7L8,10.7z"}),f.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),f.createElement("path",{className:"hm2",d:"M9.2,0v5.4h1.9c0.9,0,1.6-0.7,1.6-1.5V1.5C12.7,0.7,12,0,11.2,0L9.2,0z"}),f.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),f.createElement("g",null,f.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),f.createElement("path",{className:"hm2",d:"M11.4,5.4v5.2h3.1c0.8,0,1.4-0.6,1.4-1.4V6.9c0-0.8-0.6-1.4-1.4-1.4H11.4z"}),f.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),_n=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),f.createElement("path",{className:"hm2",d:"M5.3,8c0-0.9-0.6-1.7-1.4-1.7H1.4C0.6,6.3,0,7.1,0,8l0,1.1h5.3V8L5.3,8z"}),f.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),f.createElement("path",{className:"hm2",d:"M16,4.8c0-0.9-0.7-1.6-1.5-1.6H12c-0.8,0-1.5,0.7-1.5,1.6v1.9H16V4.8z"}),f.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),f.createElement("g",null,f.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),f.createElement("path",{className:"hm2",d:"M10.6,1.4C10.6,0.6,9.9,0,9.1,0H6.7C6,0,5.3,0.6,5.3,1.4v3.1h5.2V1.4z"}),f.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Fn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",{className:"st2"},f.createElement("polygon",{className:"hm2",points:"12,5.5 9.1,10 4.8,0 0,5 0,8 4.4,6.1 9.1,11.8 12,9.3 16,10.7 16,9.7 \t\t"})),f.createElement("polygon",{className:"hm0",points:"12,9.3 9.1,11.8 4.4,6.1 0,8 0,12.4 4.2,7.7 9.7,15.4 12.2,11.1 16,14.3 16,10.7 \t"}),f.createElement("path",{className:"hm1",d:"M9.7,15.4L4.2,7.6L0,12.4v2.3c0,0.7,0.6,1.3,1.3,1.3h13.4c0.7,0,1.3-0.6,1.3-1.3v-0.4L12.2,11L9.7,15.4z"})),zn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),f.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),f.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),f.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),f.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),f.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),f.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),f.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),f.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),f.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),f.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),f.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),f.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),f.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),f.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),Bn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Hn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M13,4.2H9.5c-0.5,0-0.9,0.4-0.9,0.9v1.3h-3c-0.5,0-0.9,0.4-0.9,0.9v2.4h-3C1.4,9.6,1,10,1,10.5v4.7\nC1,15.6,1.4,16,1.9,16h3h1.4h2.4h1.4h3c0.5,0,0.9-0.4,0.9-0.9v-10C13.9,4.6,13.5,4.2,13,4.2z M4.8,14.6H2.4V11h2.4V14.6z M8.7,14.6\nH6.2v-5V7.8h2.4V14.6z M12.5,14.6h-2.4V6.4V5.6h2.4V14.6z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M5.5,5.5c-0.1,0-0.2,0-0.3-0.1l-4-1.7C0.9,3.6,0.7,3.2,0.9,2.9C1,2.5,1.4,2.3,1.8,2.5L5.4,4L9,0.3\nc0.2-0.2,0.5-0.3,0.8-0.1l4,1.9c0.3,0.2,0.5,0.6,0.3,0.9c-0.2,0.4-0.6,0.5-0.9,0.3L9.6,1.7L6,5.3C5.9,5.4,5.7,5.5,5.5,5.5z"})),Qn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M1.6,14.4v-3.8H0v3.7c0,1,0.8,1.7,1.7,1.7h12.6c1,0,1.7-0.8,1.7-1.7v-3.7h-1.6v3.8H1.6z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M0,1.7v3.6l1.6,0V1.6l12.8,0v3.8H16V1.7c0-1-0.8-1.7-1.7-1.7H1.7C0.8,0,0,0.8,0,1.7z"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Un=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M14.3,0H1.7C0.8,0,0,0.8,0,1.7v2.8v0.8v5.3v0.6v3.1c0,1,0.8,1.7,1.7,1.7h12.6c1,0,1.7-0.8,1.7-1.7v-3.4v-0.3V5.4V5V1.7 C16,0.7,15.2,0,14.3,0z M14.4,5.4v5.2v0.3v3.5H1.6v-3.2v-0.6V5.3V4.5V1.6h12.8V5V5.4z"}),f.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),Yn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("rect",{x:"0.482",y:"9.788",className:"chart-icon-svg-0",width:"2.016",height:"6.212"}),f.createElement("rect",{x:"3.755",y:"3.923",className:"chart-icon-svg-0",width:"2.016",height:"12.077"}),f.createElement("rect",{x:"7.027",className:"chart-icon-svg-0",width:"2.016",height:"16"}),f.createElement("rect",{x:"10.3",y:"5.406",className:"chart-icon-svg-0",width:"2.016",height:"10.594"}),f.createElement("rect",{x:"13.571",y:"11.542",className:"chart-icon-svg-0",width:"2.016",height:"4.458"})),Kn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("circle",{className:"chart-icon-svg-0",cx:"9.399",cy:"10.008",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"9.219",cy:"6.29",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"11.082",cy:"1.73",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"14.596",cy:"2.341",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"5.863",cy:"13.68",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"3.45",cy:"7.892",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"1.504",cy:"13.9",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"6.116",cy:"10.008",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"13.559",cy:"6.895",r:"1.2"})),jn=["type","size","showBadge","warning","danger","spinning","disabled"],Wn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger,t.spinning,t.disabled;var n=yn(t,jn),o=null;if(!e.props.type)return null;switch(e.props.type){case"back":o=f.createElement(K,null);break;case"bar-chart":o=Ln;break;case"book":o=f.createElement(q,null);break;case"bookmark":o=f.createElement(M,null);break;case"scatterplot":o=Kn;break;case"stacked-bar-chart":o=Vn;break;case"bubble-chart":o=Bn;break;case"calendar":o=f.createElement(G,null);break;case"caret-right":o=f.createElement(Te,null);break;case"caret-left":o=f.createElement(Se,null);break;case"caret-down":o=f.createElement(Ce,null);break;case"caret-up":o=f.createElement(Ee,null);break;case"react-autoql-bubbles-outlined":o=An;break;case"react-autoql-bubbles-filled":o=wn;break;case"react-autoql-bubbles-filled-alt":o=Nn;break;case"chart":o=f.createElement(O,null);break;case"check":o=f.createElement(X,null);break;case"close":o=f.createElement(De,null);break;case"mark-read":o=f.createElement(z,null);break;case"mark-unread":o=f.createElement(F,null);break;case"maximize":o=f.createElement(le,null);break;case"minimize":o=f.createElement(se,null);break;case"money":o=f.createElement(ke,null);break;case"close-circle":o=f.createElement(ve,null);break;case"collapse":o=f.createElement(B,null);break;case"column-chart":o=On;break;case"column-line-chart":o=Hn;break;case"stacked-column-chart":o=_n;break;case"copy":o=f.createElement(xe,null);break;case"dashboard":o=f.createElement(x,null);break;case"database":o=f.createElement(J,null);break;case"description":o=f.createElement(I,null);break;case"download":o=f.createElement(Z,null);break;case"edit":o=f.createElement(R,null);break;case"expand":o=f.createElement(H,null);break;case"eye":o=f.createElement($,null);break;case"filter":o=f.createElement(de,null);break;case"filter-off":o=f.createElement(pe,null);break;case"grad-cap":o=In;break;case"globe":o=f.createElement(he,null);break;case"heatmap":o=zn;break;case"histogram-chart":o=Yn;break;case"hour-glass":o=f.createElement(be,null);break;case"info":o=f.createElement(Ie,null);break;case"light-bulb":o=f.createElement(D,null);break;case"lightning":o=f.createElement(Q,null);break;case"line-chart":o=Mn;break;case"list-settings":o=f.createElement(me,null);break;case"live":o=f.createElement(fe,null);break;case"lock":o=f.createElement(Ae,null);break;case"stacked-line-chart":o=Fn;break;case"menu":o=f.createElement(A,null);break;case"microphone":o=f.createElement(U,null);break;case"more-vertical":o=f.createElement(te,null);break;case"more-horizontal":o=f.createElement(ee,null);break;case"note":o=f.createElement(V,null);break;case"notification":o=f.createElement(j,null);break;case"notification-off":o=f.createElement(W,null);break;case"notification-pause":o=f.createElement(ne,null);break;case"number":o=f.createElement(P,null);break;case"abacus":o=f.createElement(_,null);break;case"pie-chart":o=qn;break;case"play":o=f.createElement(we,null);break;case"pivot-table":o=Pn;break;case"plus":o=f.createElement(oe,null);break;case"preview":o=f.createElement(k,null);break;case"question":o=f.createElement(N,null);break;case"refresh":o=f.createElement(ce,null);break;case"report":o=f.createElement(ge,null);break;case"search":o=f.createElement(ye,null);break;case"data-search":o=f.createElement(L,null);break;case"send":o=f.createElement(ae,null);break;case"settings":o=f.createElement(re,null);break;case"split-view":o=Qn;break;case"single-view":o=Un;break;case"table":o=kn;break;case"tag":o=f.createElement(w,null);break;case"title":o=f.createElement(T,null);break;case"tool":o=f.createElement(ue,null);break;case"trash":o=f.createElement(ie,null);break;case"unlock":o=f.createElement(Ne,null);break;case"warning":o=f.createElement(Re,null);break;case"warning-triangle":o=f.createElement(Y,null)}return f.createElement(Rn,null,f.createElement("span",fn({},n,{"data-test":"react-autoql-icon",className:"react-autoql-icon\n ".concat(e.props.className||"","\n react-autoql-icon-").concat(e.props.type,"\n ").concat(e.props.warning?"react-autoql-icon-warning":"","\n ").concat(e.props.danger?"react-autoql-icon-danger":"","\n ").concat(e.props.spinning?"react-autoql-icon-spinning":"","\n ").concat(e.props.disabled?"react-autoql-icon-disabled":""),style:an({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),o,e.props.showBadge&&f.createElement("div",{className:"react-autoql-badge"})))})),e}return pn(n)}();mn(Wn,"propTypes",{type:b.string,size:b.number,showBadge:b.bool,color:b.string,warning:b.bool,danger:b.bool,spinning:b.bool,disabled:b.bool}),mn(Wn,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1,spinning:!1,disabled:!1});var Gn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"renderContent",(function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("function"==typeof e.props.content)return e.props.content(n);if(e.props.showArrow&&!Pe){var o,a=n.position,r=n.childRect,i=n.popoverRect;return f.createElement(Le,{className:"popover-arrow-container",arrowClassName:"popover-arrow",position:a,childRect:r,popoverRect:i,arrowSize:10},f.createElement("div",{className:"popover-arrow-container-content"},f.createElement("div",{className:"popover-container-content ".concat(null!==(o=e.props.contentClassName)&&void 0!==o?o:"")},e.props.content)))}return f.createElement("div",{className:"popover-container-content ".concat(null!==(t=e.props.contentClassName)&&void 0!==t?t:"")},e.props.content)})),mn(Cn(e),"render",(function(){var t;return e.props.children?f.createElement(Me,{id:e.props.id,containerClassName:"react-tiny-popover-container react-autoql-popover".concat(Pe?"-mobile":"","\n ").concat(null!==(t=e.props.containerClassName)&&void 0!==t?t:"","\n ").concat(e.props.showArrow&&"function"!=typeof e.props.content&&!Pe?"popover-with-arrow-container":""),isOpen:e.props.isOpen,content:e.renderContent,ref:e.props.innerRef,onClickOutside:function(t){t.stopPropagation(),t.preventDefault(),e.props.onClickOutside(t)},parentElement:Pe?void 0:e.props.parentElement,boundaryElement:Pe?void 0:e.props.boundaryElement,positions:e.props.positions,align:e.props.align,reposition:!0,padding:e.props.padding,boundaryInset:e.props.boundaryInset},e.props.children):null})),e}return pn(n)}();mn(Gn,"propTypes",{padding:b.number,showArrow:b.bool}),mn(Gn,"defaultProps",{padding:10,showArrow:!1});var Xn=f.forwardRef((function(e,t){return f.createElement(Gn,fn({innerRef:t},e))})),Jn="react-autoql-tooltip-rebuild-timer",Zn=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],$n=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line","column_line","histogram","scatterplot"],eo=["line","stacked_line"],to=["column_line"],no=["January","February","March","April","May","June","July","August","September","October","November","December"],oo={CURRENCY:"DOLLAR_AMT",QUANTITY:"QUANTITY",RATIO:"RATIO",PERCENT:"PERCENT"},ao={DOLLAR_AMT:"Currency",QUANTITY:"Quantity",RATIO:"Ratio",PERCENT:"Percent"},ro=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],io=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],lo=["SP","SU","FA","HO"],so="DAY",co="MONTH",uo="YEAR",po="WEEK",mo="QUARTER",fo="DATE_HOUR",go="DATE_MINUTE",vo="HOUR",ho="MINUTE",bo={DAY:"ll",MONTH:"MMMM YYYY",YEAR:"YYYY",DATE_HOUR:"ll h:00A",DATE_MINUTE:"ll h:mmA"},yo=["histogram","scatterplot"],Co=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,t=sessionStorage.getItem(Jn);t||Ve.rebuild(),clearTimeout(t),sessionStorage.setItem(Jn,setTimeout((function(){sessionStorage.removeItem(Jn),t&&Ve.rebuild()}),e))},Eo=function(){Ve.hide()};function So(e){return Pe?null:f.createElement(Ve,fn({},e,{html:!0}))}var To=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"render",(function(){var e,t;return f.createElement("li",{id:null!==(e=o.props.id)&&void 0!==e?e:"react-autoql-menu-item-".concat(o.ID),key:"react-autoql-menu-item-".concat(o.ID),className:"react-autoql-menu-item\n ".concat(null!==(t=o.props.className)&&void 0!==t?t:"","\n ").concat(o.props.subtitle?"has-subtitles":"","\n ").concat(o.props.active?"active":""),"data-tip":o.props.tooltip,"data-for":o.props.tooltipID,"data-offset":10,onClick:function(e){e.stopPropagation(),o.props.onClick()}},f.createElement("span",{className:"select-option-span"},f.createElement("span",{className:"select-option-value-container"},f.createElement("span",{className:"react-autoql-menu-item-title"},!!o.props.icon&&f.createElement("span",{className:"react-autoql-menu-icon"},f.createElement(Wn,{type:o.props.icon}),"  "),f.createElement("span",null,o.props.title)),!!o.props.subtitle&&f.createElement("span",{className:"select-option-value-subtitle"},o.props.subtitle))))})),o.ID=C(),o}return pn(n)}();mn(To,"propTypes",{title:b.oneOfType([b.string,b.element]),subtitle:b.oneOfType([b.string,b.element]),icon:b.string,active:b.bool,tooltip:b.string,tooltipID:b.string,onClick:b.func}),mn(To,"defaultProps",{title:"",subtitle:void 0,icon:void 0,active:!1,tooltip:void 0,tooltipID:void 0,onClick:function(){}});var Do=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"render",(function(){var t;return f.createElement(Rn,null,f.createElement("ul",{className:"react-autoql-menu ".concat(null!==(t=e.props.className)&&void 0!==t?t:""),onClick:function(e){return e.stopPropagation()}},e.props.children))})),e}return pn(n)}(),xo=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co(),o.scrollToValue()})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isOpen!==t.isOpen&&(Eo(),Co(),o.state.isOpen&&o.scrollToValue()),o.props.value!==e.value&&Co()})),mn(Cn(o),"scrollToValue",(function(){var e,t=null===(e=o.props.options)||void 0===e?void 0:e.findIndex((function(e){return o.props.value===e.value})),n=document.querySelector("#select-option-".concat(o.ID,"-").concat(t));n&&n.scrollIntoView({behavior:"auto",block:"center",inline:"center"})})),mn(Cn(o),"renderSelect",(function(){var e,t,n=o.props.options.find((function(e){return e.value===o.props.value}));return f.createElement("div",{className:"react-autoql-select-and-label\n ".concat(null!==(e=o.props.className)&&void 0!==e?e:"","\n ").concat(o.props.fullWidth?"react-autoql-select-full-width":"")},!!o.props.label&&f.createElement("div",{className:"react-autoql-input-label"},o.props.label),f.createElement("div",{className:"react-autoql-select\n ".concat(o.props.outlined?"outlined":"","\n ").concat("small"===o.props.size?"react-autoql-select-small":"react-autoql-select-large"),"data-test":"react-autoql-select",onClick:function(){return o.setState({isOpen:!o.state.isOpen})},style:o.props.style,"data-tip":o.props.tooltip,"data-for":o.props.tooltipID,"data-offset":10,"data-delay-show":500},f.createElement("span",{className:"react-autoql-select-text"},null!=n&&n.label||null!=n&&n.value?f.createElement("span",{className:"react-autoql-menu-item-value-title"},!!n.icon&&f.createElement("span",null,f.createElement(Wn,{style:{marginLeft:"-3px"},type:n.icon}),"  "),f.createElement("span",null,null!==(t=n.label)&&void 0!==t?t:n.value)):f.createElement("span",{className:"react-autoql-select-text-placeholder"},o.props.placeholder)),o.props.showArrow&&f.createElement("div",{className:"react-autoql-select-arrow"},f.createElement(Wn,{type:"caret-down"}))))})),mn(Cn(o),"renderPopoverContent",(function(){var e;return f.createElement("div",{className:"react-autoql-select-popup-container",style:{width:o.props.style.width}},!o.props.tooltipID&&f.createElement(So,{id:"select-tooltip-".concat(o.ID),className:"react-autoql-tooltip",effect:"solid",delayShow:500}),f.createElement(Do,{options:o.props.options},null===(e=o.props.options)||void 0===e?void 0:e.map((function(e,t){var n,a,r;return f.createElement(To,{id:"select-option-".concat(o.ID,"-").concat(t),key:e.value,title:null!==(n=null!==(a=e.listLabel)&&void 0!==a?a:e.label)&&void 0!==n?n:e.value,subtitle:e.subtitle,tooltip:e.tooltip,tooltipID:null!==(r=o.props.tooltipID)&&void 0!==r?r:"select-tooltip-".concat(o.ID),active:e.value===o.props.value,icon:e.icon,onClick:function(){o.setState({isOpen:!1}),o.props.onChange(e.value)}})}))))})),mn(Cn(o),"render",(function(){var e,t,n;return o.props.options?f.createElement(Rn,null,f.createElement(Xn,{id:"select-popover-".concat(o.ID),key:"select-popover-".concat(o.ID),containerClassName:"react-tiny-popover-container react-autoql-select-popover-container ".concat(null!==(e=o.props.popupClassname)&&void 0!==e?e:""),isOpen:o.state.isOpen,positions:null!==(t=o.props.positions)&&void 0!==t?t:["bottom","top","left","right"],align:null!==(n=o.props.align)&&void 0!==n?n:"start",padding:0,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverBoundaryElement,onClickOutside:function(){return o.setState({isOpen:!1})},content:o.renderPopoverContent()},o.renderSelect())):null})),o.ID=C(),o.state={isOpen:!1},o}return pn(n)}();function Ro(e){return f.createElement(Rn,null,f.createElement("div",fn({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}mn(xo,"propTypes",{onChange:b.func,options:b.arrayOf(b.shape({})),popupClassname:b.string,value:b.oneOfType([b.string,b.number]),label:b.oneOfType([b.element,b.string]),size:b.string,showArrow:b.bool,outlined:b.bool,placeholder:b.string,fullWidth:b.bool}),mn(xo,"defaultProps",{onChange:function(){},options:[],popupClassname:null,value:null,label:null,size:"large",style:{},showArrow:!0,outlined:!0,placeholder:"Select an item",fullWidth:!1});var Io=["default","primary","danger"],Ao=["small","medium","large"],No=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Io.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),mn(Cn(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(Ao.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),mn(Cn(e),"renderIcon",(function(){return e.props.icon?f.createElement(Wn,{className:"react-autoql-btn-icon",type:e.props.icon}):null})),mn(Cn(e),"render",(function(){var t=e.getType(),n=e.getSize(),o=e.props.loading||e.props.disabled;return f.createElement(Rn,null,f.createElement("button",{ref:e.props.innerRef,className:"react-autoql-btn\n ".concat(e.props.className||"","\n react-autoql-btn-").concat(t,"\n react-autoql-btn-").concat(n,"\n ").concat(o?" disabled":"","\n ").concat(e.props.border?"":"btn-no-border","\n ").concat(e.props.filled?"btn-filled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:an({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.props.tooltipID},e.props.loading?f.createElement(Ro,{"data-test":"react-autoql-btn-loading"}):e.renderIcon(),f.createElement("div",null,e.props.children)))})),e}return pn(n)}();mn(No,"propTypes",{type:b.oneOf(Io),size:b.oneOf(Ao),onClick:b.func,loading:b.bool,disabled:b.bool,multiline:b.bool,filled:b.bool,border:b.bool,tooltip:b.string,icon:b.string}),mn(No,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,filled:!1,border:!0,icon:void 0,onClick:function(){}});var wo=f.forwardRef((function(e,t){return f.createElement(No,fn({innerRef:t},e))})),ko=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),mn(Cn(t),"suggestionLists",[]),mn(Cn(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),mn(Cn(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),mn(Cn(t),"getSuggestionLists",(function(e,t){var n=[];return t.length&&t.forEach((function(t){var o=e.slice(t.start,t.end),a=t.suggestions.map((function(e){return an({id:C(),hidden:!1},e)})),r=[].concat(Tn(a),[{id:C(),text:o}]);n.push(r)})),n})),mn(Cn(t),"getPlainTextList",(function(e,t){var n=[],o=0;return t.forEach((function(a,r){n.push(e.slice(o,a.start)),r===t.length-1&&n.push(e.slice(a.end,e.length)),o=a.end})),n})),mn(Cn(t),"isInitialSelectionValid",(function(){var e=!0;return t.props.initialSelections.length!==t.suggestionLists.length&&(e=!1),t.props.initialSelections.forEach((function(n,o){t.suggestionLists[o]&&t.suggestionLists[o].find((function(e){return e.text===n.text}))||(e=!1)})),e})),mn(Cn(t),"updateStartAndEndIndexes",(function(n){if(e(n,"length")){var o="";t.plainTextList.forEach((function(e,t){o=o.concat(e);var a=n[t];if(a&&!a.hidden){var r=o.length;a.start=r,a.end=r+a.text.length,o=o.concat(a.text)}}))}})),mn(Cn(t),"setInitialSelections",(function(){var e;t.props.initialSelections&&t.isInitialSelectionValid()?(t.suggestionLists.forEach((function(e,n){e.find((function(e){return e.text===t.props.initialSelections[n].text})).id=t.props.initialSelections[n].id||C()})),e=t.props.initialSelections):e=t.props.autoSelectSuggestion?t.suggestionLists.map((function(e){return e[0]})):t.suggestionLists.map((function(e){return e[e.length-1]})),t.updateStartAndEndIndexes(e),t.setState({selectedSuggestions:S(e)})})),mn(Cn(t),"initializeQueryValidationOptions",(function(e){var n=e.data,o=n.replacements,a=n.query,r=o.sort((function(e,t){return e.start-t.start}));if(!r||!a)return[];t.suggestionLists=t.getSuggestionLists(a,r),t.plainTextList=t.getPlainTextList(a,r),t.setInitialSelections()})),mn(Cn(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var o=t.suggestionLists[n].find((function(t){return t.id===e})),a=S(t.state.selectedSuggestions);a[n]=o,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(a),a),t.updateStartAndEndIndexes(a),t.setState({selectedSuggestions:S(a)})}else t.deleteQueryValidationSuggestion(n)})),mn(Cn(t),"deleteQueryValidationSuggestion",(function(e){var n=S(t.state.selectedSuggestions.map((function(t,n){return n===e?an(an({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:S(n)})})),mn(Cn(t),"renderWordSelector",(function(e){var n=S(t.state.selectedSuggestions[e]);if(!n||n.hidden)return null;var o=t.suggestionLists[e],a=[];return o.forEach((function(e,t){if(null!=e&&e.text){var n={value:e.id,label:e.text};t===o.length-1?n.listLabel=f.createElement("span",null,n.label," ",f.createElement("em",null,"(Original term)")):n.listLabel=f.createElement("span",null,e.text,e.value_label?f.createElement("em",null," (",e.value_label,")"):null),a.push(n)}})),a.push({value:"remove-word",label:f.createElement("span",null,f.createElement(Wn,{type:"trash"})," Remove term")}),f.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},f.createElement(xo,{options:a,key:C(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",outlined:!1,showArrow:!1,onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),mn(Cn(t),"renderQueryValidationQuery",(function(){return f.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var o=f.createElement("span",{key:"query-element-".concat(n)},e),a=t.renderWordSelector(n);return f.createElement("span",{key:C()},o,a)})))})),mn(Cn(t),"getQueryValidationQueryText",(function(e){var n="";return t.plainTextList.forEach((function(t,o){n=n.concat(t);var a=e[o];a&&!a.hidden&&(n=n.concat(a.text))})),n})),mn(Cn(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?f.createElement("div",{className:"react-autoql-query-validation-container"},f.createElement("div",{className:"react-autoql-query-validation-description"},f.createElement("span",null,t.props.message||"I need your help matching a term you used to the exact corresponding term in your database. Verify by selecting the correct term from the menu below:")),f.createElement("div",null,t.renderQueryValidationQuery(),f.createElement("div",{className:"react-autoql-query-validation-execute-btn-container"},f.createElement(wo,{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions,scope:t.props.scope})},icon:t.props.submitIcon||"play"},t.props.submitText||"Run Query")))):null})),mn(Cn(t),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return pn(o)}();mn(ko,"propTypes",{response:b.shape({}),onSuggestionClick:b.func,autoSelectSuggestion:b.bool,isQueryRunning:b.bool,initialSelections:b.arrayOf(b.shape({})),onQueryValidationSelectOption:b.func,message:b.string}),mn(ko,"defaultProps",{response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var Po=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"MAX_UPDATE_DURATION",5e3),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.update()})),mn(Cn(e),"componentDidUpdate",(function(t){t.contentHidden&&!e.props.contentHidden&&e.update()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1,clearInterval(e.intervalID),clearTimeout(e.timeoutID)})),mn(Cn(e),"update",(function(t){if(e._isMounted)if("number"!=typeof t||t>e.MAX_UPDATE_DURATION){var n;null===(n=e.ref)||void 0===n||null===(n=n._ps)||void 0===n||n.update()}else{clearInterval(e.intervalID);var o=Math.ceil(t/50);e.x=0,e.intervalID=setInterval((function(){var t;null===(t=e.ref)||void 0===t||null===(t=t._ps)||void 0===t||t.update(),++e.x===o&&clearInterval(e.intervalID)}),50)}})),mn(Cn(e),"getContainer",(function(){var t;return null===(t=e.ref)||void 0===t?void 0:t._container})),mn(Cn(e),"getScrollTop",(function(){var t;return null===(t=e.ref)||void 0===t||null===(t=t._container)||void 0===t?void 0:t.scrollTop})),mn(Cn(e),"getClientHeight",(function(){var t;return null===(t=e.ref)||void 0===t||null===(t=t._container)||void 0===t?void 0:t.clientHeight})),mn(Cn(e),"scrollToTop",(function(){var t;null!==(t=e.ref)&&void 0!==t&&t._container&&(e.ref._container.scrollTop=0)})),mn(Cn(e),"scrollToBottom",(function(){var t,n=null===(t=e.ref)||void 0===t?void 0:t._container;n&&(n.scrollBottom=0,n.scrollTop=n.scrollHeight-n.clientHeight)})),mn(Cn(e),"getStyleProp",(function(){var t={};return e.props.style&&(t=an({},e.props.style)),t.maxHeight=e.props.maxHeight,t.minHeight=e.props.minHeight,t})),mn(Cn(e),"render",(function(){var t;return e.props.children?f.createElement(Ot,{className:"react-autoql-custom-scrollbars \n ".concat(null!==(t=e.props.className)&&void 0!==t?t:"","\n ").concat(e.props.autoHide?"autohide":""),ref:function(t){return e.ref=t},style:e.getStyleProp()},e.props.children):null})),e}return pn(n)}();mn(Po,"propTypes",{style:b.shape({}),autoHide:b.bool,autoHeightMax:b.number,autoHeightMin:b.number,contentHidden:b.bool}),mn(Po,"defaultProps",{style:{},autoHide:!1,autoHeightMin:void 0,autoHeightMax:void 0,contentHidden:!1});var Oo=["scrollbarProps","className","contentHidden","children"],Lo=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"updateScrollbars",(function(e){var t;null===(t=o.scrollComponent)||void 0===t||null===(t=t.current)||void 0===t||t.update(e)})),mn(Cn(o),"render",(function(){var e=o.props,t=e.scrollbarProps,n=void 0===t?{}:t,a=e.className,r=e.contentHidden,i=e.children,l=yn(e,Oo);return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-infinite-scroll-container"},f.createElement(Po,fn({},n,{ref:o.scrollComponent,contentHidden:r}),f.createElement(Qt,fn({},l,{className:"react-autoql-infinite-scroll ".concat(a||""),getScrollParent:function(){var e;return null===(e=o.scrollComponent)||void 0===e||null===(e=e.current)||void 0===e?void 0:e.getContainer()}}),i))))})),o.COMPONENT_KEY=C(),o.scrollComponent=f.createRef(),o}return pn(n)}();mn(Lo,"propTypes",{getScrollParent:b.func,contentHidden:b.bool}),mn(Lo,"defaultProps",{getScrollParent:void 0,contentHidden:!1}),o.extend(i),o.extend(m),o.extend(l),o.extend(s),o.extend(c),o.extend(u),o.extend(a),o.extend(p),o.extend(r),o.extend(d),function(){var e=window.navigator.language||"en",t=e.split("-")[0];try{require("dayjs/locale/".concat(e,".js")),o.locale(e)}catch(e){try{require("dayjs/locale/".concat(t,".js")),o.locale(t)}catch(e){}}}();var Mo={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},qo={timestampFormat:"ISO8601",currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:2,ratioDecimals:4,comparisonDisplay:"PERCENT",monthYearFormat:"MMMM YYYY",dayMonthYearFormat:"ll"},Vo={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableCSVDownload:!0,enableReportProblem:!0},_o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Mo),e)},Fo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},qo),e)},zo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Vo),e)},Bo=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},Ho=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Qo=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t||"UNKNOWN"===t},Uo=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Yo=function(e,t){var n,o=[],a=[],r=[];e.forEach((function(e,t){var n=e.type;e.is_visible&&!e.pivot&&("DOLLAR_AMT"===n?o.push(t):"QUANTITY"===n?a.push(t):"PERCENT"!==n&&"RATIO"!==n||r.push(t))}));var i,l,s=[],c=[];return o.length?(n=o[0],s=o,l="currency"):a.length?(n=a[0],s=a,l="quantity"):r.length&&(n=r[0],s=r,l="ratio"),t||(s=n>=0?[n]:[],"currency"===l?a.length?i=a[0]:r.length?i=r[0]:o.length>1&&(i=o[1]):"quantity"===l?r.length?i=r[0]:a.length>1&&(i=a[1]):"ratio"===l&&a.length>1&&(i=r[1]),isNaN(i)||(c=i>=0?[i]:[])),{numberColumnIndex:n,numberColumnIndices:s,numberColumnIndices2:c,numberColumnIndex2:i,currencyColumnIndices:null!=o?o:[],currencyColumnIndex:o[0],quantityColumnIndices:null!=a?a:[],quantityColumnIndex:a[0],ratioColumnIndices:null!=r?r:[],ratioColumnIndex:r[0]}},Ko=function(e){if(e&&function(e){return!Bo(e)&&e.findIndex((function(e){return!0===e.multi_series}))>=0}(e))return e.findIndex((function(e){return e&&e.is_visible&&!0===e.multi_series}))},jo=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},Wo=function(e,t){if(e){var n=[],o=Ko(e),a=jo(e);e.forEach((function(e,t){Qo(e)&&t!==o&&e.is_visible&&n.push(t)}));var r=e.findIndex((function(e){return e.isDrilldownColumn}));if(r>=0)return{stringColumnIndices:n,stringColumnIndex:r};var i,l,s=n[0];if(t)s=(null===(i=e[a])||void 0===i?void 0:i.groupable)?a:null!==(l=n.findIndex((function(t){return e[t].groupable})))&&void 0!==l?l:n[1];else a>=0?s=a:n[1]>=0&&(s=n[1]);return{stringColumnIndex:s,stringColumnIndices:n}}},Go=function(e){var t=0,n=0;return e.forEach((function(e){Ho(e)&&e.is_visible?n+=1:Qo(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},Xo=function(e,t,n){return n.indexOf(e)===t},Jo=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=[],a=0;a<t;a++){o[a]=[];for(var r=0;r<e;r++)o[a][r]=n}return o},Zo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e){var a=t.precision,r=n.dayMonthYearFormat||qo.dayMonthYearFormat,i=o.utc(e).utc();if(!i.isValid())return e;var l=i.format(r);try{switch(a){case so:break;case po:var s=i.startOf("week").format("MMM D"),c=i.endOf("week").format("MMM D"),u=i.week(),d=i.format("YYYY");l="".concat(s," - ").concat(c,", ").concat(d," (Week ").concat(u,")");break;case co:var p=n.monthYearFormat||qo.monthYearFormat;l=i.format(p);break;case mo:var m=i.quarter(),f=i.format("YYYY");l="".concat(f,"-Q").concat(m);break;case uo:l=i.format("YYYY");break;case fo:l=i.format("".concat(r," h:00A"));break;case go:l=i.format("".concat(r," h:mmA"))}return l}catch(e){console.error(e)}}},$o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e)try{var a,r=n.monthYearFormat,i=n.dayMonthYearFormat,l="YYYY",s=r||qo.monthYearFormat,c=i||qo.dayMonthYearFormat,u=t.title;if(!(a=isNaN(parseFloat(e))?o.utc(e).utc():o.unix(e).utc()).isValid())return e;var d=a.format(c);return isNaN(parseFloat(e))?(u&&u.toLowerCase().includes("year")?d=a.format(l):u&&u.toLowerCase().includes("month")&&(d=a.format(s)),d=a.format(c)):u&&u.toLowerCase().includes("year")?d=a.format(l):u&&u.toLowerCase().includes("month")&&(d=a.format(s)),d}catch(t){return console.error(t),e}},ea=function(e,t){if(e){var n=e;try{switch(t.precision){case"DOW":n=function(e,t){var n=t.dow_style;n||(n="NUM_1_MON");var o=e,a=Number(e);switch(n){case"NUM_1_MON":var r=a-1;r>=0?o=ro[r]:console.warn("dow style is NUM_1_MON but the value could not be converted to a number: ".concat(e));break;case"NUM_1_SUN":var i=a-1;i>=0?o=io[i]:console.warn("dow style is NUM_1_SUN but the value could not be converted to a number: ".concat(e));break;case"NUM_0_MON":a>=0?o=ro[a]:console.warn("dow style is NUM_0_MON but the value could not be converted to a number: ".concat(e));break;case"NUM_0_SUN":a>=0?o=io[a]:console.warn("dow style is NUM_0_SUN but the value could not be converted to a number: ".concat(e));break;case"ALPHA_MON":case"ALPHA_SUN":var l=ro.find((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())}));l?o=l:console.warn("dow style is ALPHA but the value could not be matched to a weekday name: ".concat(e));break;default:console.warn("could not format dow value. dow_style was not recognized: ".concat(t.dow_style))}return o}(e,t);break;case"HOUR":var a=o.utc(e,"THH:mm:ss.SSSZ").utc();a.isValid()&&(n=a.format("h:00A"));break;case"MINUTE":var r=o.utc(e,"THH:mm:ss.SSSZ").utc();r.isValid()&&(n=r.format("h:mmA"));break;case"MONTH":default:n=e}return n}catch(t){return console.error(t),e}}},ta=function(t,n){if(t){if(t&&"string"==typeof t){var a,r,i=t.split("-"),l=e(i,"[0]"),s=e(i,"[2]");e(i,"[1]","").includes("W")?r=e(i,"[1]"):a=e(i,"[1]");var c=n.monthYearFormat,u=n.dayMonthYearFormat,d=c||qo.monthYearFormat,p=u||qo.dayMonthYearFormat,m=o.utc(t).utc();if(!m.isValid())return t;var f=t;return s?f=m.format(p):a?f=m.format(d):r||l&&(f=l),f}return t}},na=function(e){return/^\d+$/.test(e)},oa=function(e){var t=e.value,n=e.column;return e.config,"DATE_STRING"===n.type?function(e,t){if(e)try{switch(t.precision){case"DOW":return;case"HOUR":case"MINUTE":return o.utc(e,"THH:mm:ss.SSSZ").utc();case"MONTH":default:return}}catch(e){return void console.error(e)}}(t,n):na(t)?o.unix(t).utc():o.utc(t).utc()},aa=function(e){var t=e.element,n=e.column,o=e.config,a=void 0===o?{}:o,r=e.htmlElement,i=e.isChart;try{var l=t,s=a.currencyCode,c=a.languageCode,u=a.currencyDecimals,d=a.quantityDecimals,p=a.ratioDecimals,m=null==n?void 0:n.type;if(i&&["count","deviation","variance"].includes(null==n?void 0:n.aggType)&&(m="QUANTITY"),n)switch(m){case"STRING":break;case"DOLLAR_AMT":if(!isNaN(parseFloat(t))){var f=s||"USD",g=u||0===u?u:void 0;try{l=new Intl.NumberFormat(c,{style:"currency",currency:"".concat(f),minimumFractionDigits:g,maximumFractionDigits:g}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(c,{style:"currency",currency:"USD",minimumFractionDigits:g,maximumFractionDigits:g}).format(t)}}break;case"QUANTITY":var v=isNaN(d)?2:d;if(!isNaN(parseFloat(t))){var h=parseFloat(t)%1!=0?v:0;l=new Intl.NumberFormat(c,{minimumFractionDigits:h,maximumFractionDigits:h}).format(t)}break;case"DATE":l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return na(e)?$o(e,t,n):Zo(e,t,n)}(t,n,a);break;case"DATE_STRING":l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.precision?ea(e,t):ta(e,n)}(t,n,a);break;case"RATIO":var b=isNaN(p)?4:p;isNaN(parseFloat(t))||(l=new Intl.NumberFormat(c,{minimumFractionDigits:b,maximumFractionDigits:b}).format(t));break;case"PERCENT":if(!isNaN(parseFloat(t))){var y=parseFloat(t)/100;l=new Intl.NumberFormat(c,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(y),r&&(t<0?r.classList.add("comparison-value-negative"):t>0&&r.classList.add("comparison-value-positive"))}}return l}catch(e){return console.error(e),t}},ra=function(e){try{if(!(window.URL||window.webkitURL||window))throw new Error("(browser doesnt support this)");if(!e)throw new Error("(svg element does not exist)");var t=(new XMLSerializer).serializeToString(e),n=btoa(unescape(encodeURIComponent(t)));return"data:image/svg+xml;base64,".concat(n)}catch(e){return}},ia=function(e){if(e&&e.getBBox)return e.getBBox()},la=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},sa=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t},ca=function(e){return $n.includes(e)},ua=function(e){return Zn.includes(e)},da=function(e){var t,n=e.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),o=e[n];return o&&(null==o||null===(t=o.display_name)||void 0===t?void 0:t.toLowerCase().includes("month"))&&2===(null==e?void 0:e.length)},pa=function(e,t,n){var o,a,r,i,l,s;if(t<=1)return!1;var c=sa(e);if(!(2===(null==c?void 0:c.length)))return!1;var u=ha(e),d=e[c[0]],p=e[c[1]];if(!(d.is_visible&&p.is_visible&&(null==u?void 0:u.length)>=3))return!1;var m=null!==(o=null==n?void 0:n.map((function(e){return e[c[0]]})))&&void 0!==o?o:[],f=null!==(a=null==n?void 0:n.map((function(e){return e[c[1]]})))&&void 0!==a?a:[],g=null!==(r=null==m||null===(i=m.filter(Xo))||void 0===i?void 0:i.length)&&void 0!==r?r:0,v=null!==(l=null==f||null===(s=f.filter(Xo))||void 0===s?void 0:s.length)&&void 0!==l?l:0;return!(g>22&&v>22)||(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The calculated dimensions would be: ".concat(g," x ").concat(v)),!1)},ma=function(e){var t,n=!(null===(t=e.filter((function(e){return Ho(e)})))||void 0===t||!t.length);return n},fa=function(e){var t,n=!(null===(t=e.filter((function(e){return Qo(e)})))||void 0===t||!t.length);return n},ga=function(e){var t,n=!(null===(t=e.filter((function(e){return Uo(e)})))||void 0===t||!t.length);return n},va=function(e,t){if(t<=1)return!1;var n=Go(e),o=n.amountOfNumberColumns,a=n.amountOfStringColumns;return o>0&&a>0},ha=function(e){return t(e,(function(e){return e.is_visible}))},ba=function(e){var n=null==e?void 0:e.length,o=function(e){return t(e,(function(e){return!e.is_visible}))}(e);return n&&!!o.length},ya=function(e){var t=ha(e);return(null==e?void 0:e.length)&&!t.length},Ca=function(e){var t,n,o,a;if(!e)return!1;var r=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.rows,i=null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.columns,l=null==e||null===(o=e.data)||void 0===o?void 0:o.reference_id,s=r&&!(null!=r&&r.length),c=1===(null==i?void 0:i.length);return!(!s||!c||"1.1.211"!==l)||!(1!==(null==r?void 0:r.length)||1!==(null===(a=r[0])||void 0===a?void 0:a.length))},Ea=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,o=t.columns,a=t.dataLength,r=t.pivotDataLength,i=t.isDataLimited;try{var l,s,c,u,d;if(null==n||null===(l=n.data)||void 0===l||null===(l=l.data)||void 0===l||!l.display_type)return[];var p=n.data.data.display_type;if("suggestion"===p||"help"===p||"html"===p)return[p];var m=null!==(s=null==n||null===(c=n.data)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.rows)&&void 0!==s?s:[],f=o||(null==n||null===(u=n.data)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.columns),g=ha(f);if(null==g||!g.length)return["text"];if(Ca(n))return["single-value"];if(null==m||!m.length)return["table"];var v=10,h=null!=a?a:m.length,b=!0,y=null!=r;if(y&&(b=!!r),pa(g,h,null==n||null===(d=n.data)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.rows)){var C=["table"];return i||C.push("pivot_table"),b&&(C.push("stacked_column","stacked_bar","column","bar","bubble","heatmap"),ga(g)&&C.push("stacked_line","line")),C}if(va(g,h)){var E=["table","column","bar"];h>20&&E.push("histogram"),ga(g)&&E.push("line"),h>1&&h<=v&&E.push("pie");var S=Go(g),T=S.amountOfNumberColumns;if(T>1&&(E.push("column_line"),E.push("scatterplot")),!i&&da(g)){var D=g.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),x=g[D],R=e(n,"data.data.rows"),I=[];R.forEach((function(e){var t=aa({element:e[D],column:x,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});I.includes(t)||I.push(t)})),I.length>1&&E.push("pivot_table")}return E}return["table"]}catch(e){return console.error(e),["table"]}},Sa=function(e,t,n,o,a,r){var i,l=Ea({response:e,columns:null!=a?a:null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.columns,dataLength:n,pivotDataLength:o,isDataLimited:r});return t&&l.includes(t)},Ta=function(e,t){var n=e.find((function(e){return ca(e)}));return n||t},Da=function(t,n,o,a,r,i,l){var s,c=Ea({response:t,columns:null!=o?o:null==t||null===(s=t.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.columns,dataLength:a,pivotDataLength:r,isDataLimited:l});if(i&&c.includes(i))return i;var u=e(t,"data.data.display_type");if(c.includes(i))return i;if("suggestion"===u||"help"===u||"html"===u)return u;if(1===c.length)return c[0];if(c.includes("pivot_table")){var d="pivot_table";return n&&(d=Bo(e(t,"data.data.columns"))?Ta(c,"pivot_table"):"pivot_table"),d}if(!u&&function(t){return!!t&&(e(t,"data.data.rows.length")&&e(t,"data.data.rows.length"))}(t)||"data"===u){var p="table";return n&&(p=Bo(e(t,"data.data.columns"))?Ta(c,"table"):"table"),p}return"text"},xa=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},Ra=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},Ia=function(t){if(t)try{"function"==typeof t.forEach&&e(t,"length")?t.forEach((function(e){e&&"function"==typeof e.remove&&e.remove()})):"function"==typeof t.remove&&t.remove()}catch(e){console.error(e)}},Aa=function(e,t){if(e.includes("-W")){var n=e.substring(0,4),o=t.substring(0,4);return n!==o?n-o:e.substring(6,8)-t.substring(6,8)}if(ro.includes(e.trim())){var a=ro.findIndex((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())})),r=ro.findIndex((function(e){return e.toLowerCase().includes(t.trim().toLowerCase())})),i=e-t;return a>=0&&r>=0&&(i=a-r),i}if(no.includes(e.trim())){var l=no.findIndex((function(t){return t===e.trim()})),s=no.findIndex((function(e){return e===t.trim()}));return l>=0&&s>=0?s-l:e-t}if(lo.includes(e.substr(0,2))){var c=lo.findIndex((function(t){return t===e.substr(0,2)})),u=lo.findIndex((function(e){return e===t.substr(0,2)})),d=Number(e.substr(2)),p=Number(t.substr(2));return d===p?c-u:d-p}return e-t},Na=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"!=typeof e||"string"!=typeof t)return e-t;var a=e.trim(),r=t.trim();switch(n.precision){case"DOW":var i,l=null!==(i=n.dow_style)&&void 0!==i?i:"ALPHA_MON",s=ro.findIndex((function(e){return e.toLowerCase().includes(a.toLowerCase())})),c=ro.findIndex((function(e){return e.toLowerCase().includes(r.toLowerCase())}));return"ALPHA_SUN"===l&&(s=io.findIndex((function(e){return e.toLowerCase().includes(a.toLowerCase())})),c=io.findIndex((function(e){return e.toLowerCase().includes(r.toLowerCase())}))),s-c;case"HOUR":case"MINUTE":var u=o.utc(a,"THH:mm:ss.SSSZ").utc(),d=o.utc(r,"THH:mm:ss.SSSZ").utc();return u.unix()-d.unix();case"MONTH":var p=no.findIndex((function(e){return e.toLowerCase()===a.toLowerCase()})),m=no.findIndex((function(e){return e.toLowerCase()===r.toLowerCase()}));return p-m;default:return Aa(a,r)}},wa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;try{if(!e&&!t)return 0;if(!e&&t)return 1;if(e&&!t)return-1;var r=Number(e),i=Number(t),l=r-i;return(isNaN(r)||isNaN(i))&&(l="DATE_STRING"===n.type?Na(e,t,n):o.utc(e).unix()-o.utc(t).unix()),a&&"DOW"===n.precision&&(l*=-1),l}catch(e){return console.error(e),-1}},ka=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desc",o=arguments.length>3?arguments[3]:void 0;try{if(!e||"object"!==ln(e))throw new Error("Could not sort data by date - no data supplied");var a=jo(t),r=t[a];if(a>=0){var i="desc"===n?-1:1,l=Tn(e).sort((function(e,t){return i*wa(e[a],t[a],r,o)}));return l}}catch(e){console.error(e)}return e},Pa=function(e){var t=e.text,n=void 0===t?"":t,o=e.inputRef,a=e.callback,r=void 0===a?function(){}:a,i=e.totalAnimationTime,l=void 0===i?1e3:i;return n.length&&o&&"string"==typeof n?new Promise((function(e){for(var t=Math.round(l/n.length),a=function(a){setTimeout((function(){o.value=n.slice(0,a),a===n.length&&setTimeout((function(){r(),e()}),300)}),a*t)},i=1;i<=n.length;i++)a(i)})):Promise.resolve()},Oa=function(){return new Promise((function(e){setTimeout(e,0)}))},La=function(e){return"object"===ln(e)&&!Array.isArray(e)&&null!=e},Ma=function(e,t){var o=n(e,t);if(o)return!0;var a=La(e),r=La(t);if(!a||!r)return o;var i,l,s=Object.keys(e),c=Object.keys(t);if(s.length!==c.length)return!1;for(var u=0;u<s.length;u++)if("function"==typeof e[s[u]]&&"function"==typeof t[s[u]]){if(i=e[s[u]],l=t[s[u]],(null==i?void 0:i.toString())!=(null==l?void 0:l.toString()))return!1}else if(!hasOwnProperty.call(t,s[u])||!n(e[s[u]],t[s[u]]))return!1;return!0},qa=function(e){return"string"==typeof e||"number"==typeof e?e:Array.isArray(e)&&e.length?e.join("."):null},Va=function(e,t){var n=null;try{var o=qa(e),a=qa(t);o&&a?n=[o,a].join("."):o?n=o:a&&(n=a)}catch(e){console.error(e)}return n},_a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.ceil(e/t)*t},Fa=function(e,t){return e.slice(0,t).concat(e.slice(t+1))},za={"accent-color":"#28A8E0","accent-color-secondary":"#1EA0D8","background-color-primary":"#F8F8F8","background-color-secondary":"#FFFFFF","background-color-tertiary":"#E8E8E8","background-color-switch-input":"#BABABA","background-color-switch-thumb":"#FFFFFF","background-color-disabled":"#EDEDED","background-color-disabled-dark":"#857D83","background-color-checkbox":"#FFFFFF","border-color":"#D8D8D8","table-border-color":"#EFEFEF","hover-color":"#F6F7F9","text-color-primary":"#343434","text-color-accent":"#FFFFFF","text-color-placeholder":"#0000004D","dashboard-title-color":"#28A8E0","font-family":"'Roboto', sans-serif","font-size":"15px","chart-font-size":"12px","highlight-color":"#000000","badge-color":"#F5222D","danger-color":"#CA0B00","warning-color":"#FFB600","success-color":"#47b84c","info-color":"#28A8E0","box-shadow-color":"#85858528","mask-color":"#0000000F","mobile-mask-color":"#00000059","scrollbar-color":"#aeaeae","box-shadow-1":"0px 1px 2px 1px var(--react-autoql-box-shadow-color)","box-shadow-2":"0px 1px 2px 0px var(--react-autoql-box-shadow-color)"},Ba={"accent-color":"#193a48","accent-color-secondary":"#1ea0d8","background-color-primary":"#20252A","background-color-secondary":"#3B3F46","background-color-tertiary":"#292929","background-color-switch-input":"#252525","background-color-switch-thumb":"#ececec","background-color-checkbox":"#292929","background-color-disabled":"#5d6167","background-color-disabled-dark":"#857d83","table-border-color":"#53565c","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#ececec","text-color-accent":"#ffffff","text-color-placeholder":"#ffffff6e","dashboard-title-color":"#193a48","font-family":"'Roboto', sans-serif","font-size":"12px","chart-font-size":"12px","highlight-color":"#ffffff","badge-color":"#f5222d","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#47b84c","info-color":"#28a8e0","box-shadow-color":"#00000066","mask-color":"#00000021","mobile-mask-color":"#00000059","scrollbar-color":"#727477","box-shadow-1":"0px 1px 1px 0px var(--react-autoql-box-shadow-color)","box-shadow-2":"0px 1px 2px 0px var(--react-autoql-box-shadow-color)"},Ha={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",textColor:void 0,accentTextColor:void 0,backgroundColorPrimary:void 0,backgroundColorSecondary:void 0},Qa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Ha),e)},Ua=function(e){return document.documentElement.style.getPropertyValue("--react-autoql-".concat(e))},Ya=function(){try{for(var e=[],t=[],n=0;n<100;){try{var o,a=Ua("chart-color-".concat(n)),r=null!==(o=Ua("chart-color-dark-".concat(n)))&&void 0!==o?o:a;if(!a)return{chartColors:e,chartColorsDark:t};e.push(a),t.push(r)}catch(e){}n+=1}return{chartColors:e,chartColorsDark:t}}catch(e){return console.error("Could not get chart color css vars. See below for error details"),console.error(e),[]}},Ka=function(e,t){var n,o=("#"===(n=e).slice(0,1)&&(n=n.slice(1)),3===n.length&&(n=n.split("").map((function(e){return e+e})).join("")),(299*parseInt(n.substr(0,2),16)+587*parseInt(n.substr(2,2),16)+114*parseInt(n.substr(4,2),16))/1e3);t["text-color-accent"]=o>=140?"black":"white"},ja=function(e,t){var n=e||Ha.chartColors;Array.isArray(n)?n.length?n.forEach((function(e,n){t["chart-color-".concat(n)]=e;var o=function(e,t){var n=!1;"#"==e[0]&&(e=e.slice(1),n=!0);var o=parseInt(e,16),a=(o>>16)+t;a>255?a=255:a<0&&(a=0);var r=(o>>8&255)+t;r>255?r=255:r<0&&(r=0);var i=(255&o)+t;i>255?i=255:i<0&&(i=0);var l="000000"+(i|r<<8|a<<16).toString(16);return(n?"#":"")+l.substring(l.length-6)}(e,-10);t["chart-color-dark-".concat(n)]=o})):console.error("configureTheme chartColors option must not be empty. If you meant to use the default colors, do not supply a chart colors array"):console.error("configureTheme chartColors option must be an array")},Wa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Qa(e),n=t.theme,o=t.textColor,a=t.fontFamily,r=t.chartColors,i=t.accentColor,l=t.accentTextColor,s=t.dashboardTitleColor,c=t.backgroundColorPrimary,u=t.backgroundColorSecondary,d="light"===n?za:Ba;for(var p in o&&(d["text-color-primary"]=o),l?d["text-color-accent"]=l:Ka(i,d),a&&(d["font-family"]=a),i&&(d["accent-color"]=i),d["dashboard-title-color"]=s||d["accent-color"],c&&(d["background-color-primary"]=c),u&&(d["background-color-secondary"]=u),ja(r,d),d)document.documentElement.style.setProperty("--react-autoql-".concat(p),d[p])},Ga=function(e){var t=f.forwardRef((function(t,n){var o=fn({},(bn(t),t));return g((function(){!!Ua("accent-color")||Wa()}),[]),f.createElement(e,fn({ref:n},o))}));return t.displayName="ThemeProvider",t};var Xa=Ga((function(){return f.createElement("div",{className:"response-loading","data-test":"loading-dots"},f.createElement("div",null),f.createElement("div",null),f.createElement("div",null),f.createElement("div",null))})),Ja=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.shouldRender&&o.focusInput()})),mn(Cn(o),"componentDidUpdate",(function(e){o.props.shouldRender&&!e.shouldRender&&o.focusInput()})),mn(Cn(o),"componentWillUnmount",(function(){clearTimeout(o.animateTextDelay),clearTimeout(o.animateTextTimeout)})),mn(Cn(o),"focusInput",(function(){var e;null===(e=o.inputRef)||void 0===e||e.focus()})),mn(Cn(o),"loadMore",(function(e,t){if(o.state.loading)return Promise.resolve();var n={validationResponse:void 0};1===e?(n.initialLoading=!0,n.hasMore=!0):n.loading=!0;var a=o.state.inputValue;return a!==o.state.keywords&&(n.queryList=void 0),o.setState(n),ze(an(an({},o.props.authentication),{},{keywords:a,pageSize:o.pageSize,pageNumber:e,skipQueryValidation:t})).then((function(e){var t,n={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.replacements)n.validationResponse=e;else{var r,i,l,s;((null==e||null===(r=e.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.pagination)||void 0===r?void 0:r.current_page)>=(null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.pagination)||void 0===i?void 0:i.total_pages)||null==e||null===(l=e.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.items)||void 0===l||!l.length)&&(n.hasMore=!1);var c=(null==e||null===(s=e.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.items)||[];if(o.state.queryList){var u=o.state.queryList.concat(c);n.queryList=u}else n.queryList=c;n.keywords=a}return o.setState(n),Promise.resolve()})).catch((function(e){return o.setState({loading:!1,initialLoading:!1}),console.error(e),Promise.reject()}))})),mn(Cn(o),"onInputChange",(function(e){o.setState({inputValue:e.target.value})})),mn(Cn(o),"onKeyPress",(function(e){"Enter"==e.key&&o.loadMore(1)})),mn(Cn(o),"onValidationSuggestionClick",(function(e){var t=e.query;o.animateQITextAndSubmit(t,!0)})),mn(Cn(o),"animateQITextAndSubmit",(function(e,t){return Pa({text:e,inputRef:o.inputRef,callback:function(){o.setState({inputValue:e},(function(){return o.loadMore(1,t)}))}})})),mn(Cn(o),"clearExploreQueries",(function(){o.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){o.focusInput()}))})),mn(Cn(o),"renderIntroMessage",(function(){return f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement("h2",null,"Welcome to Explore Queries"),o.props.introMessage?f.createElement("p",null,o.props.introMessage):f.createElement(f.Fragment,null,f.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),f.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger.")))})),mn(Cn(o),"renderQueryList",(function(){var e;return o.state.initialLoading?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(Xa,null)):o.state.validationResponse?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(ko,{response:o.state.validationResponse,onSuggestionClick:o.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"})):o.state.queryList?0===(null===(e=o.state.queryList)||void 0===e?void 0:e.length)?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):f.createElement(Lo,{pageStart:1,loadMore:o.loadMore,hasMore:o.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(Ro,{style:{width:"19px",height:"20px",color:"#999"}}))},o.state.queryList.map((function(e,t){return f.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return o.props.executeQuery(e)},key:"query-tip-".concat(t),style:{display:"block"}},e)}))):o.renderIntroMessage()})),mn(Cn(o),"render",(function(){var e,t;return o.props.shouldRender?f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.exploreQueriesPage=e},className:"query-tips-page-container","data-test":"query-tips-tab"},f.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},f.createElement("input",{className:"react-autoql-chatbar-input left-padding right-padding",placeholder:o.props.inputPlaceholder,value:o.state.inputValue,onChange:o.onInputChange,onKeyPress:o.onKeyPress,spellCheck:!1,ref:function(e){return o.inputRef=e},"data-test":"explore-queries-input-bar",autoFocus:!0}),f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}})),f.createElement("div",{className:"chat-bar-clear-btn ".concat(null!==(e=o.state.queryList)&&void 0!==e&&e.length||o.state.inputValue?"visible":""),"data-for":null!==(t=o.props.tooltipID)&&void 0!==t?t:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(Wn,{type:"close",onClick:o.clearExploreQueries}))),f.createElement("div",{className:"query-tips-result-container"},o.renderQueryList())),!o.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"explore-queries-tooltips",delayShow:800,effect:"solid"})):null})),o.pageSize=25,o.state={inputValue:"",keywords:"",queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},o}return pn(n)}();mn(Ja,"propTypes",{shouldRender:b.bool,executeQuery:b.func,inputPlaceholder:b.string}),mn(Ja,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var Za=Ga(Ja),$a=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a.loadMore(1)})),mn(Cn(a),"componentDidUpdate",(function(e){(a.props.searchText&&a.props.searchText!==e.searchText||a.props.context!==e.context||!n(a.props.valueLabel,e.valueLabel))&&a.setState({queryList:void 0},(function(){a.loadMore(1)}))})),mn(Cn(a),"loadMore",(function(e){if(!a.state.loading&&!a.props.hidden&&(a.props.searchText||a.props.context||a.props.valueLabel)){var t={validationResponse:void 0};1===e?(t.initialLoading=!0,t.hasMore=!0):t.loading=!0;var n=a.props.searchText;return n!==a.state.keywords&&(t.queryList=void 0),a.setState(t),Be(an(an({},a.props.authentication),{},{pageSize:a.pageSize,pageNumber:e,text:a.props.searchText,selectedVL:a.props.valueLabel,userVLSelection:a.props.userSelection,context:a.props.context,skipQueryValidation:a.props.skipQueryValidation||e>1})).then((function(e){var t;a.props.onSuggestionListResponse({response:e});var o={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.replacements)o.validationResponse=e;else{var r,i,l,s;((null==e||null===(r=e.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.pagination)||void 0===r?void 0:r.current_page)>=(null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.pagination)||void 0===i?void 0:i.total_pages)||null==e||null===(l=e.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.items)||void 0===l||!l.length)&&(o.hasMore=!1);var c=(null==e||null===(s=e.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.items)||[];if(a.state.queryList){var u=a.state.queryList.concat(c);o.queryList=u}else o.queryList=c;o.keywords=n}a.setState(o)})).catch((function(e){console.error(e),a.props.onSuggestionListResponse({error:e}),a.setState({loading:!1,initialLoading:!1})}))}})),mn(Cn(a),"onValidationSuggestionClick",(function(e){a.props.onValidationSuggestionClick(e)})),mn(Cn(a),"updateScrollbars",(function(){var e;setTimeout(null===(e=a.infiniteScroll)||void 0===e?void 0:e.updateScrollbars,400)})),mn(Cn(a),"clearQueryList",(function(){a.setState({queryList:void 0,validationResponse:void 0})})),mn(Cn(a),"render",(function(){var e;return a.state.initialLoading?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(Xa,null)):a.state.validationResponse?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(ko,{response:a.state.validationResponse,onSuggestionClick:a.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search",scope:a.props.scope})):a.state.queryList?0===(null===(e=a.state.queryList)||void 0===e?void 0:e.length)?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):f.createElement(Lo,{ref:function(e){return a.infiniteScroll=e},pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,className:"data-preview-scroll-container",useWindow:!1,initialLoad:!1,threshold:100,contentHidden:a.props.hidden,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(Ro,{style:{width:"19px",height:"20px",color:"#999"}}))},f.createElement("div",{className:"query-suggestion-list"},a.state.queryList.map((function(e,t){return f.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return a.props.executeQuery(e)},key:"query-tip-".concat(t)},f.createElement("div",{className:"query-suggestion-text"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," ",e))})))):null})),a.pageSize=25,a.state={queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},a}return pn(o)}();mn($a,"propTypes",{searchText:b.string,subject:b.shape({}),valueLabel:b.shape({}),skipQueryValidation:b.bool,onSuggestionListResponse:b.func,executeQuery:b.func}),mn($a,"defaultProps",{searchText:"",subject:void 0,valueLabel:void 0,skipQueryValidation:!1,onSuggestionListResponse:function(){},executeQuery:function(){}});var er="subject",tr="VL",nr=b.shape({token:b.string,apiKey:b.string,domain:b.string}),or=b.shape({currencyCode:b.string,languageCode:b.string,currencyDecimals:b.number,quantityDecimals:b.number,comparisonDisplay:b.string,monthYearFormat:b.string,dayMonthYearFormat:b.string}),ar=b.shape({debug:b.bool,test:b.bool,enableAutocomplete:b.bool,enableQueryValidation:b.bool,enableDrilldowns:b.bool,enableQuerySuggestions:b.bool,enableColumnVisibilityManager:b.bool,enableNotifications:b.bool});b.shape({stringColumnIndices:b.arrayOf(b.number),numberColumnIndices:b.arrayOf(b.number),stringColumnIndex:b.number,legendColumnIndex:b.number,numberColumnIndex:b.number});var rr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.topic;if(!t)return null;var n=null;return t.type===er?n="book":t.type===tr&&(n="bookmark"),f.createElement(Rn,null,f.createElement("span",null,f.createElement(Wn,{className:"data-explorer-topic-icon",type:n}),t.display_name))},ir={GENERAL_QUERY:f.createElement("span",null,"Internal Service Error: Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."),GENERAL_HTML:f.createElement("span",null,"Internal Service Error: Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."),UNAUTHENTICATED:f.createElement("span",null,"Uh oh.. It looks like you don't have access to this resource. Please double check that all required authentication fields are correct.")},lr={CANCELLED:"Request cancelled"},sr=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.fetchAllSubjects()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.inputAnimationTimeout)})),mn(Cn(a),"fetchAllSubjects",(function(){He(an({},a.props.authentication)).then((function(e){var t,n=(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.subjects)||[],o=[];n.length&&(o=n.map((function(e){return an(an({},e),{},{type:er})})).filter((function(e){return!a.isAggSeed(e)})).sort((function(e,t){return e.display_name.localeCompare(t.display_name)}))),a._isMounted&&a.setState({allSubjects:o})})).catch((function(e){return console.error(e)}))})),mn(Cn(a),"blurInput",(function(){var e;null===(e=a.autoSuggest)||void 0===e||null===(e=e.input)||void 0===e||e.blur()})),mn(Cn(a),"getNewRecentSuggestions",(function(e){var t=S(a.state.recentSuggestions),o=t.findIndex((function(t){return n(t,e)}));return o>-1&&t.splice(o,1),5===t.length&&t.splice(-1),t.unshift(e),t})),mn(Cn(a),"selectSubject",(function(e){a._isMounted&&(a.userSelectedValue=null,a.setState({inputValue:e.display_name,recentSuggestions:a.getNewRecentSuggestions(e)}),a.props.onSelection(e))})),mn(Cn(a),"submitRawText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=a.state.allSubjects.find((function(t){return t.display_name.toLowerCase().trim()===e.toLowerCase().trim()}));n?a.selectSubject(n):n={type:"text",display_name:e},a.props.onSelection(n,t),a.setState({recentSuggestions:a.getNewRecentSuggestions(n),inputValue:n.display_name})})),mn(Cn(a),"animateTextAndSubmit",(function(e){Pa({text:e,inputRef:a.inputRef,callback:function(){return a.submitRawText(e,!0)}})})),mn(Cn(a),"onInputChange",(function(e){if(a._isMounted){var t,n;if(a.userSelectedValue&&("ArrowDown"===e.key||"ArrowUp"===e.key))return;(null!=e&&null!==(t=e.target)&&void 0!==t&&t.value||""===(null==e||null===(n=e.target)||void 0===n?void 0:n.value))&&"Enter"!==e.key?(a.userSelectedValue=null,a.userTypedValue=e.target.value,a.isDirty=!0,a.setState({inputValue:e.target.value})):a.selectSubject(a.userSelectedValue)}})),mn(Cn(a),"onInputFocus",(function(){a._isMounted&&a.setState({inputFocused:!0})})),mn(Cn(a),"onInputBlur",(function(){a._isMounted&&a.setState({inputFocused:!1})})),mn(Cn(a),"onKeyPress",(function(e){"Enter"==e.key&&(a.userSelectedValue?a.selectSubject(a.userSelectedValue):a.state.inputValue&&a.submitRawText(a.state.inputValue),a.blurInput())})),mn(Cn(a),"clearInput",(function(){a._isMounted&&(a.setState({inputValue:""}),a.userTypedValue=null,a.userSelectedValue=null,a.props.onClearInputClick())})),mn(Cn(a),"userSelectedSuggestionHandler",(function(e){a.userSelectedValue=e,null!=e&&e.display_name&&a._isMounted&&a.setState({inputValue:e.display_name})})),mn(Cn(a),"cancelCurrentRequest",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"requestSuggestions",(function(e){var t;a.setState({loadingAutocomplete:!0,loadingAutocompleteText:e}),clearTimeout(a.autoCompleteTimer),a.cancelCurrentRequest(),a.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),a.autoCompleteTimer=setTimeout((function(){var t;Qe(an(an({suggestion:e},a.props.authentication),{},{cancelToken:null===(t=a.axiosSource)||void 0===t?void 0:t.token})).then((function(e){a.setState({suggestions:e,loadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&(console.error(e),a.setState({suggestions:[],loadingAutocomplete:!1}))}))}),100)})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&a.isDirty&&a._isMounted&&a.requestSuggestions(t)})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a._isMounted&&a.setState({suggestions:[]})})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title),e.emptyState?f.createElement("div",{className:"data-explorer-no-suggestions"},f.createElement("em",null,"No results")):null)})),mn(Cn(a),"getSectionSuggestions",(function(e){return e.suggestions})),mn(Cn(a),"hasNoSuggestions",(function(){var e;return!(null!==(e=a.state.suggestions)&&void 0!==e&&e.length||a.state.loadingAutocomplete||!a.userTypedValue)})),mn(Cn(a),"getSuggestions",(function(){var e,t,n,o=[],r=!(null===(e=a.state.recentSuggestions)||void 0===e||!e.length),i=!a.userTypedValue,l=!a.state.loadingAutocomplete,s=!(null===(t=a.state.suggestions)||void 0===t||!t.length),c=!(null!==(n=a.state.suggestions)&&void 0!==n&&n.length)&&l;return r&&o.push({title:"Recent",suggestions:a.state.recentSuggestions}),i?o.push({title:"All Topics",suggestions:a.state.allSubjects}):s?o.push({title:'Related to "'.concat(a.state.loadingAutocompleteText,'"'),suggestions:a.state.suggestions}):c&&o.push({title:'Related to "'.concat(a.state.loadingAutocompleteText,'"'),suggestions:[{name:""}],emptyState:!0}),o})),mn(Cn(a),"renderSuggestion",(function(e){return f.createElement(rr,{topic:e})})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children,r=250,i=(null===(t=a.props.dataExplorerRef)||void 0===t?void 0:t.clientHeight)-200;return!isNaN(i)&&i>250&&(r=i),f.createElement("div",n,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},f.createElement(Po,{autoHeight:!0,autoHeightMin:0,maxHeight:r},o)))})),mn(Cn(a),"renderInputIcon",(function(){return f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}}))})),mn(Cn(a),"renderClearInputBtn",(function(){var e;return f.createElement("div",{className:"chat-bar-clear-btn ".concat(a.state.inputValue?"visible":""),"data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(Wn,{type:"close",onClick:a.clearInput}))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-chatbar-input-container data-explorer ".concat(a.hasNoSuggestions()?"no-suggestions":""),"data-test":"data-explorer-autocomplete"},f.createElement(Kt,{id:"data-explorer-autosuggest-".concat(a.componentKey),className:"react-autoql-data-explorer-autosuggest",onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,getSuggestionValue:a.userSelectedSuggestionHandler,renderSuggestionsContainer:a.renderSuggestionsContainer,suggestions:a.getSuggestions(),multiSection:!0,renderSectionTitle:a.renderSectionTitle,getSectionSuggestions:a.getSectionSuggestions,shouldRenderSuggestions:function(){return!0},ref:function(e){return a.autoSuggest=e},renderSuggestion:a.renderSuggestion,focusInputOnSuggestionClick:!1,inputProps:{ref:function(e){return a.inputRef=e},className:"react-autoql-chatbar-input",placeholder:a.props.inputPlaceholder,"data-test":"data-explorer-input-component",value:a.state.inputValue,onChange:a.onInputChange,onKeyPress:a.onKeyPress,onFocus:a.onInputFocus,onBlur:a.onInputBlur}}),a.renderInputIcon(),a.renderClearInputBtn()))})),a.componentKey=C(),a.userTypedValue=null,a.userSelectedValue=null,a.isDirty=!1,a.state={inputValue:"",loadingAutocomplete:!1,recentSuggestions:[],suggestions:[],allSubjects:[]},a}return pn(o,[{key:"isAggSeed",value:function(e){return e.display_name.toLowerCase().endsWith("by day")||e.display_name.toLowerCase().endsWith("by week")||e.display_name.toLowerCase().endsWith("by month")||e.display_name.toLowerCase().endsWith("by year")}}]),o}();mn(sr,"propTypes",{authentication:nr,inputPlaceholder:b.string,onClearInputClick:b.func,onSelection:b.func}),mn(sr,"defaultProps",{authentication:{},inputPlaceholder:"Search terms or topics",onClearInputClick:function(){},onSelection:function(){}});var cr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.initialCollapseTimer=setTimeout((function(){o.saveCurrentCardHeight(),o.props.onIsCollapsedChange(o.props.isCollapsed)}),400)})),mn(Cn(o),"componentDidUpdate",(function(e){if(o.props.isCollapsed!==e.isCollapsed){var t=o.getIsCSSCollapsed();"boolean"==typeof t&&t!==o.props.isCollapsed&&(o.setIsCollapsedCSS(o.props.isCollapsed),o.forceUpdate())}})),mn(Cn(o),"componentWillUnmount",(function(){clearTimeout(o.collapseTimer),clearTimeout(o.initialCollapseTimer)})),mn(Cn(o),"getIsCSSCollapsed",(function(){var e;if(null!==(e=o.contentRef)&&void 0!==e&&e.style)return"hidden"===o.contentRef.style.visibility})),mn(Cn(o),"getIsCollapsed",(function(){return"boolean"==typeof o.props.isCollapsed?o.props.isCollapsed:o.state.isCollapsed})),mn(Cn(o),"handleClick",(function(){o.setIsCollapsedCSS(!o.getIsCSSCollapsed())})),mn(Cn(o),"saveCurrentCardHeight",(function(){if(o.contentRef)if(o.getIsCollapsed())o.contentRef.style.maxHeight="0px",o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute";else{var e=o.contentRef.offsetHeight||0;o.contentRef.style.maxHeight="".concat(e,"px"),o.contentRef.style.position="relative",o.contentRef.style.visibility="visible"}})),mn(Cn(o),"setIsCollapsedCSS",(function(e){var t=o.getIsCSSCollapsed();if(!(e&&t||!e&&!t)){if(o.contentRef){var n=o.contentRef.offsetHeight;e?(clearTimeout(o.collapseTimer),o.contentRef.style.maxHeight="unset",o.contentRef.style.maxHeight="".concat(n,"px"),setTimeout((function(){o.contentRef.style.maxHeight="0px"}),0),o.collapseTimer=setTimeout((function(){o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute"}),300)):(o.collapseTimer&&(clearTimeout(o.collapseTimer),o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute"),o.contentRef.style.maxHeight="unset",n=o.contentRef.offsetHeight,o.contentRef.style.maxHeight="0px",o.contentRef.style.position="relative",o.contentRef.style.visibility="visible",setTimeout((function(){o.contentRef.style.maxHeight="".concat(n,"px")}),0))}o.props.onIsCollapsedChange(e),o.setState({isCollapsed:e})}})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-card\n ".concat(o.getIsCollapsed()?" collapsed":"","\n ").concat(o.props.className?o.props.className:""),style:o.props.style},f.createElement("div",{className:"react-autoql-card-title",onClick:o.handleClick},f.createElement("div",null,o.props.title),f.createElement(Wn,{type:o.getIsCollapsed()?"caret-left":"caret-down"})),f.createElement("div",{ref:function(e){return o.contentRef=e},className:"react-autoql-card-content"},!!o.props.subtitle&&f.createElement("div",{className:"react-autoql-card-subtitle"},o.props.subtitle),f.createElement("div",{className:"react-autoql-card-user-content"},o.props.children))))})),o.COMPONENT_ID=C(),o.state={isCollapsed:e.defaultCollapsed},o}return pn(n)}();mn(cr,"propTypes",{title:b.oneOfType([b.string,b.element]),subtitle:b.oneOfType([b.string,b.element]),defaultCollapsed:b.bool,isCollapsed:b.bool,onIsCollapsedChange:b.func}),mn(cr,"defaultProps",{title:null,subtitle:null,defaultCollapsed:!1,isCollapsed:void 0,onIsCollapsedChange:function(){}});var ur=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.subject&&a.getDataPreview()})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.subject&&!n(a.props.subject,e.subject)&&a.getDataPreview(),a.state.dataPreview&&!n(a.state.dataPreview,t.dataPreview)&&Co()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1})),mn(Cn(a),"cancelCurrentRequest",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"getDataPreview",(function(){var e,t;a.cancelCurrentRequest(),a.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source(),a.setState({loading:!0,error:void 0,dataPreview:void 0}),Ue(an(an({},a.props.authentication),{},{subject:null===(t=a.props.subject)||void 0===t?void 0:t.name,numRows:a.DATA_PREVIEW_ROWS,source:"data_explorer.data_preview",scope:"data_explorer",cancelToken:a.axiosSource.token})).then((function(e){a.setState({dataPreview:e,loading:!1})})).catch((function(e){var t;(null==e?void 0:e.message)!==lr.CANCELLED&&(console.error(e),a.setState({loading:!1,error:null==e||null===(t=e.response)||void 0===t?void 0:t.data}))}))})),mn(Cn(a),"formatColumnHeader",(function(e){var t;return f.createElement("div",{className:"data-preview-col-header","data-for":null!==(t=a.props.tooltipID)&&void 0!==t?t:"data-preview-tooltip"},null==e?void 0:e.display_name)})),mn(Cn(a),"formatCell",(function(e){var t=e.cell,n=e.column,o=e.config;return f.createElement("div",{className:"data-preview-cell",style:{textAlign:"DOLLAR_AMT"===n.type?"right":"center"}},aa({element:t,column:n,config:o}))})),mn(Cn(a),"renderDataPreviewGrid",(function(){var e,t,n,o=null===(e=a.state.dataPreview)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.rows,r=null===(t=a.state.dataPreview)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.columns;if(!(a.state.error||r&&o))return null;var i=Fo(a.props.dataFormatting);return null===(n=a.props.dataExplorerRef)||void 0===n||n.clientHeight,f.createElement("div",{className:"data-preview"},f.createElement(Po,{style:{height:"165px"}},a.state.error?f.createElement("div",{className:"data-preview-error-message"},f.createElement("div",null,a.state.error.message),a.state.error.reference_id&&f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",a.state.error.reference_id))):f.createElement("table",null,f.createElement("thead",null,f.createElement("tr",null,r.map((function(e,t){return f.createElement("th",{key:"col-header-".concat(t)},a.formatColumnHeader(e))})))),f.createElement("tbody",null,o.map((function(e,t){return f.createElement("tr",{key:"row-".concat(t),className:"data-preview-row"},e.map((function(e,t){var n=r[t];return f.createElement("td",{key:"cell-".concat(t)},a.formatCell({cell:e,column:n,config:i}))})))}))))))})),mn(Cn(a),"renderLoadingContainer",(function(){return f.createElement("div",{className:"data-explorer-card-placeholder data-preview"},f.createElement(Xa,null))})),mn(Cn(a),"renderDataPreviewTitle",(function(){var e;return f.createElement("div",{className:"react-autoql-card-title-text"},f.createElement(Wn,{style:{fontSize:"20px"},type:"table"}),' Data Preview - "',null===(e=a.props.subject)||void 0===e?void 0:e.query,'"')})),mn(Cn(a),"render",(function(){return a.props.shouldRender?f.createElement(Rn,null,f.createElement(cr,{className:"data-explorer-data-preview","data-test":"data-explorer-data-preview",title:a.renderDataPreviewTitle(),isCollapsed:a.props.isCollapsed,onIsCollapsedChange:a.props.onIsCollapsedChange,defaultCollapsed:a.props.defaultCollapsed},a.state.loading?a.renderLoadingContainer():a.renderDataPreviewGrid())):null})),a.DATA_PREVIEW_ROWS=5,a.state={dataPreview:null},a}return pn(o)}();mn(ur,"propTypes",{dataFormatting:or,authentication:nr,shouldRender:b.bool,subject:b.shape({}),isCollapsed:b.bool,onIsCollapsedChange:b.func,defaultCollapsed:b.bool}),mn(ur,"defaultProps",{dataFormatting:qo,authentication:{},shouldRender:!0,subject:null,rebuildTooltips:void 0,isCollapsed:void 0,onIsCollapsedChange:function(){},defaultCollapsed:!1});var dr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"onInputSelection",(function(e,t){var n;(null==e?void 0:e.type)===er?o.setState({selectedSubject:e,selectedKeywords:null,selectedVL:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):(null==e?void 0:e.type)===tr?o.setState({selectedVL:e,selectedKeywords:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):"text"===(null==e?void 0:e.type)&&o.setState({selectedSubject:null,selectedVL:null,selectedKeywords:e,activeTopicType:null==e?void 0:e.type,skipQueryValidation:t}),null===(n=o.inputRef)||void 0===n||n.blurInput()})),mn(Cn(o),"renderIntroMessage",(function(){return f.createElement("div",{className:"data-explorer-intro-message"},f.createElement("h2",null,"Welcome to ",f.createElement(Wn,{type:"data-search"}),"Data Explorer"),o.props.introMessage?f.createElement("p",null,o.props.introMessage):f.createElement("div",null,f.createElement("p",null,"Explore your data and discover what you can ask AutoQL. Simply enter a term or topic above and:"),f.createElement("div",{className:"intro-message-list-container"},f.createElement("div",null,f.createElement("p",null,f.createElement(Wn,{type:"table"})," Preview available data in a snapshot"),f.createElement("p",null,f.createElement(Wn,{type:"abacus"})," Explore data structure and column types"),f.createElement("p",null,f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," View a variety of query suggestions")))))})),mn(Cn(o),"animateDETextAndSubmit",(function(e){var t;null!==(t=o.inputRef)&&void 0!==t&&t._isMounted&&o.inputRef.animateTextAndSubmit(e)})),mn(Cn(o),"onValidationSuggestionClick",(function(e){var t=e.query,n=e.userSelection;o.querySuggestionsKey=C(),o.animateDETextAndSubmit(t),o.setState({userSelection:n})})),mn(Cn(o),"reloadScrollbars",(function(){var e;null===(e=o.querySuggestionList)||void 0===e||e.updateScrollbars()})),mn(Cn(o),"renderDataPreview",(function(){return o.state.selectedSubject&&o.state.activeTopicType===er?f.createElement("div",{className:"data-explorer-section data-preview-section"},f.createElement(ur,{authentication:o.props.authentication,dataFormatting:o.props.dataFormatting,subject:o.state.selectedSubject,shouldRender:o.props.shouldRender,dataExplorerRef:o.dataExplorerPage,isCollapsed:o.props.isSmallScreen?o.state.isDataPreviewCollapsed:void 0,tooltipID:o.props.tooltipID,onIsCollapsedChange:function(e){o.setState({isDataPreviewCollapsed:e,isQuerySuggestionCollapsed:!e||o.state.isQuerySuggestionCollapsed})},defaultCollapsed:!o.props.isSmallScreen&&void 0})):null})),mn(Cn(o),"renderVLSubjectList",(function(){return o.state.selectedVL&&o.activeTopicType===tr?f.createElement("div",null,f.createElement("h2",null,"List of subjects for VL"),f.createElement("p",null,"list of subjects goes here")):null})),mn(Cn(o),"renderQuerySuggestionCardTitle",(function(e){return f.createElement("div",{className:"react-autoql-card-title-text"},f.createElement(Wn,{style:{fontSize:"20px"},type:"react-autoql-bubbles-outlined"}),' Query Suggestions for "',null==e?void 0:e.display_name,'"')})),mn(Cn(o),"renderQuerySuggestions",(function(){var e,t,n=o.getSelectedTopic();if(!n)return null;var a=o.props.isSmallScreen?o.state.isQuerySuggestionCollapsed:void 0,r=!(!o.state.selectedSubject||o.state.activeTopicType!==er);return f.createElement("div",{className:"data-explorer-section query-suggestions"},f.createElement(cr,{title:o.renderQuerySuggestionCardTitle(n),defaultCollapsed:o.props.isSmallScreen?r:void 0,isCollapsed:a,onIsCollapsedChange:function(e){o.reloadScrollbars(),o.setState({isQuerySuggestionCollapsed:e,isDataPreviewCollapsed:!e||o.state.isDataPreviewCollapsed})}},f.createElement("div",{className:"data-explorer-query-suggestion-list"},f.createElement($a,{ref:function(e){return o.querySuggestionList=e},key:o.querySuggestionsKey,authentication:o.props.authentication,context:null===(e=o.state.selectedSubject)||void 0===e?void 0:e.name,valueLabel:o.state.selectedVL,searchText:null===(t=o.state.selectedKeywords)||void 0===t?void 0:t.display_name,selectedType:o.state.activeTopicType,executeQuery:o.props.executeQuery,skipQueryValidation:o.state.skipQueryValidation,userSelection:o.state.userSelection,onValidationSuggestionClick:o.onValidationSuggestionClick,onSuggestionListResponse:function(){o.reloadScrollbars(),o.setState({skipQueryValidation:!1})},hidden:!0===a,scope:o.props.scope}))))})),mn(Cn(o),"getSelectedTopic",(function(){var e=o.state.activeTopicType;return e===er?o.state.selectedSubject:e===tr?o.state.selectedVL:"text"===e?o.state.selectedKeywords:null})),mn(Cn(o),"clearContent",(function(){o.setState({activeTopicType:null,selectedSubject:null,selectedVL:null,selectedKeywords:null})})),mn(Cn(o),"renderDataExplorerContent",(function(){var e;return o.getSelectedTopic()?f.createElement("div",{className:"data-explorer-result-container"},f.createElement(Po,null,f.createElement("div",{key:"data-explorer-sections-container-".concat(null===(e=o.state.selectedSubject)||void 0===e?void 0:e.name),className:"data-explorer-sections-container"},o.renderDataPreview(),o.renderQuerySuggestions()))):o.renderIntroMessage()})),mn(Cn(o),"formatColumnType",(function(e){switch(e){case"DATE":case"DATE_STRING":return f.createElement("span",null,f.createElement(Wn,{type:"calendar"})," Date");case"STRING":return f.createElement("span",null,f.createElement(Wn,{type:"note"})," Description");case"DOLLAR_AMT":return f.createElement("span",null,f.createElement(Wn,{type:"money"})," Currency");case"QUANTITY":return f.createElement("span",null,f.createElement(Wn,{type:"abacus"})," Quantity")}})),mn(Cn(o),"renderColumnQuerySuggestions",(function(e){var t,n,a=(null===(t=o.state.selectedSubject)||void 0===t?void 0:t.display_name)||"";if(!a)return null;var r=a.toLowerCase(),i=r[0].toUpperCase()+r.substring(1),l=null==e||null===(n=e.display_name)||void 0===n?void 0:n.toLowerCase(),s=[];return"STRING"===e.type&&(s.push("Show ".concat(r," by ").concat(l)),s.push("List all ".concat(l))),"DATE"===e.type&&(s.push("".concat(i," by month this year")),s.push("Show ".concat(r," in the last 2 weeks"))),"DATE_STRING"===e.type&&s.push("Show ".concat(r," by ").concat(l)),"DOLLAR_AMT"===e.type&&(s.push("Total ".concat(l," ").concat(r)),s.push("Highest ".concat(l," ").concat(r))),"QUANTITY"===e.type&&(s.push("Average ".concat(l," ").concat(r)),s.push("Lowest ".concat(l," ").concat(r))),f.createElement(f.Fragment,null,s.map((function(e,t){return f.createElement("div",{key:t,onClick:function(){return o.props.executeQuery(e)},className:"data-explorer-tooltip-query"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," ",e)})))})),mn(Cn(o),"renderHeaderTooltipContent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=JSON.parse(e);if(!t)return null;var n=o.formatColumnType(null==t?void 0:t.type);return f.createElement("div",null,f.createElement("div",{className:"data-explorer-tooltip-title"},null==t?void 0:t.display_name),!!n&&f.createElement("div",{className:"data-explorer-tooltip-section"},n))})),mn(Cn(o),"render",(function(){var e;return o.props.shouldRender||(e="none"),f.createElement("div",{ref:function(e){return o.dataExplorerPage=e},className:"data-explorer-page-container","data-test":"data-explorer-tab",style:{display:e}},f.createElement(Rn,null,f.createElement(sr,{ref:function(e){return o.inputRef=e},authentication:o.props.authentication,inputPlaceholder:o.props.inputPlaceholder,onSelection:o.onInputSelection,dataExplorerRef:o.dataExplorerPage,onClearInputClick:o.clearContent,tooltipID:o.props.tooltipID}),o.renderDataExplorerContent(),!o.props.tooltipID&&f.createElement(So,{className:"data-preview-tooltip",id:"data-preview-tooltip",place:"right",delayHide:200,delayUpdate:200,effect:"solid",getContent:o.renderHeaderTooltipContent,clickable:!0})))})),o.querySuggestionsKey=C(),o.state={activeTopicType:null,selectedSubject:null,selectedVL:null,isQuerySuggestionSectionVisible:!0,isQuerySuggestionCollapsed:!0,isDataPreviewCollapsed:!1},o}return pn(n)}();mn(dr,"propTypes",{authentication:nr,dataFormatting:or,shouldRender:b.bool,inputPlaceholder:b.string,introMessage:b.oneOfType([b.string,b.element]),executeQuery:b.func,isSmallScreen:b.bool}),mn(dr,"defaultProps",{authentication:{},dataFormatting:qo,shouldRender:!0,inputPlaceholder:void 0,introMessage:void 0,rebuildTooltips:void 0,executeQuery:function(){},isSmallScreen:!1});var pr=function(e){var t=e.query,n=e.domain,o=e.apiKey,a=e.token;return t&&t.trim()?o&&n&&a?E.post("".concat(n,"/autoql/api/v1/query?key=").concat(o),{text:t,translation:"exclude"},{headers:{Authorization:"Bearer ".concat(a)}}):Promise.reject({error:"Unauthenticated"}):Promise.reject({error:"No query supplied"})},mr=function(e){var t=e.domain,n=e.apiKey,o=e.token,a=e.offset,r=e.limit;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=E.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n,"&offset=").concat(a,"&limit=").concat(r);return i.get(l).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},fr=function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts?key=").concat(n);return a.get(r).then((function(e){return Promise.resolve(null==e?void 0:e.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},gr=function(e){var t=e.id,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(t,"/initialize?key=").concat(o);return r.put(i).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},vr=function(e){var t=e.dataAlertId,n=e.status,o=e.token,a=e.domain,r=e.apiKey;return"INACTIVE"===n?function(e){var t=e.dataAlertId,n=e.token,o=e.domain,a=e.apiKey,r={headers:{Authorization:"Bearer ".concat(n)}},i="".concat(o,"/autoql/api/v1/data-alerts/").concat(t,"/user?key=").concat(a);return E.delete(i,r).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,token:o,domain:a,apiKey:r}):function(e){var t=e.dataAlertId,n=e.token,o=e.domain,a=e.apiKey,r={headers:{Authorization:"Bearer ".concat(n)}},i="".concat(o,"/autoql/api/v1/data-alerts/").concat(t,"/user?key=").concat(a);return E.post(i,{},r).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,token:o,domain:a,apiKey:r})},hr=function(e){var t=e.dataAlertId,n=e.status,o=e.type,a=e.domain,r=e.apiKey,i=e.token;return i&&r&&a?t?"PROJECT"===o?vr({dataAlertId:t,status:n,token:i,domain:a,apiKey:r}):function(e){var t=e.dataAlertId,n=e.status,o=e.token,a=e.domain,r=e.apiKey,i={status:n},l={headers:{Authorization:"Bearer ".concat(o)}},s="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(r);return E.put(s,i,l).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,status:n,token:i,domain:a,apiKey:r}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},br=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o._isMounted=!0,o.getNotificationCount(),o.clearPollingComponent(),o.subscribeToNotificationCount();case 4:case"end":return e.stop()}}),e)})))),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.count!==t.count&&o.props.onCount(o.state.count)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,o.clearPollingComponent(),clearInterval(o.pollInterval)})),mn(Cn(o),"getNotificationCount",(function(e){var t=e||o.state.count;return o.props.pausePolling?Promise.resolve(t):function(e){var t=e.domain,n=e.apiKey,o=e.token,a=e.unacknowledged,r=void 0===a?0:a;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=E.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(r);return i.get(l,{timeout:18e4})}(an(an({},_o(o.props.authentication)),{},{unacknowledged:t})).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.unacknowledged;return n&&n!==o.state.count&&(o.setState({count:n}),o.HAS_FETCHED_COUNT&&o.props.onNewNotification(n)),o.HAS_FETCHED_COUNT=!0,Promise.resolve(n)})).catch((function(e){return console.error(e),o.props.onErrorCallback(e)}))})),mn(Cn(o),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),mn(Cn(o),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",o.COMPONENT_KEY)})),mn(Cn(o),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),mn(Cn(o),"subscribeToNotificationCount",(function(e){var t=o.getPollingComponent(),n=!t||t===o.COMPONENT_KEY;o._isMounted&&n&&(clearInterval(o.pollInterval),o.setPollingComponent(),o.pollInterval=setInterval((function(){o.getNotificationCount(e).then((function(e){o.subscribeToNotificationCount(e),o.FAILED_POLL_ATTEMPTS=0})).catch((function(e){var t;if(5===o.FAILED_POLL_ATTEMPTS){var n=new Error("There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.");return console.error(n),o.props.onErrorCallback(n),void clearInterval(o.pollInterval)}504==(null==e||null===(t=e.response)||void 0===t?void 0:t.status)?o.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){o.subscribeToNotificationCount()})),o.FAILED_POLL_ATTEMPTS+=1}))}),o.INTERVAL_LENGTH))})),mn(Cn(o),"resetCount",(function(){(function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n);return a.put(r,{notification_id:null,state:"ACKNOWLEDGED"}).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))})(an({},_o(o.props.authentication))).catch((function(e){console.error(e)})).finally((function(){o.setState({count:0})}))})),mn(Cn(o),"getCurrentCount",(function(){return"number"==typeof o.props.count?o.props.count:o.state.count})),mn(Cn(o),"renderBadge",(function(){var e=o.props.overflowCount,t=o.getCurrentCount();if(!t)return null;if(o.props.useDot)return f.createElement("div",{className:"react-autoql-notifications-badge-dot"});var n=t;return t>e&&(n="".concat(e,"+")),f.createElement("div",{className:"react-autoql-notifications-badge"},n)})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-notifications-button-container ".concat(o.props.useDot?"dot":"","\n ").concat(o.props.className||"","\n ").concat(o.state.count||o.props.count?"":"no-badge"),"data-test":"notification-button",style:an({},o.props.style),onClick:function(){o.props.clearCountOnClick&&o.resetCount()}},f.createElement(Wn,{type:"notification",className:"react-autoql-notifications-button"}),o.renderBadge()))})),o.NUMBER_OF_NOTIFICATIONS_TO_FETCH=10,o.INTERVAL_LENGTH=9e4,o.FAILED_POLL_ATTEMPTS=0,o.COMPONENT_KEY=C(),o.HAS_FETCHED_COUNT=!1,o.pollInterval=void 0,o.state={count:0},o}return pn(n)}();mn(br,"propTypes",{authentication:nr,overflowCount:b.number,style:b.shape({}),size:b.number,useDot:b.bool,clearCountOnClick:b.bool,onNewNotification:b.func,onErrorCallback:b.func,pausePolling:b.bool,count:b.number,onCount:b.func}),mn(br,"defaultProps",{authentication:Mo,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var yr=Ga(br),Cr=function(e){if(!e)return!1;try{return!!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(e)&&new Date(e).toISOString()===e}catch(e){return!1}},Er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.precision;return t===co||t===uo?t:so},Sr=function(e){switch(e){case so:return"day";case co:return"month";case uo:return"year";case po:return"week";case mo:return"quarter";case vo:case fo:return"hour";case ho:case go:return"minute";default:return"day"}},Tr=function(e){var t=e.filter((function(e){return"FILTER"===e.c_type||"SEED"===e.c_type}));if(!t.length)return[];var n=[];return t.forEach((function(e){var t=e.eng.split(" ").filter((function(e){return Cr(e)}));if(t.length){var a=function(e){try{var t=e.match(/\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/g);return t?t.slice(-1).pop().slice(1,-1):null}catch(e){return console.error(e),null}}(e.eng);if(a){var r=function(e){var t=o(e[0]),n=e[1]?o(e[1]):t;if(n.isBefore(t)){var a=t;t=n,n=a}var r=t.utc().format("ll"),i=n.utc().format("ll"),l=new Date(r),s=new Date(i);return s.setHours(23,59,59,999),{startDate:l,endDate:s}}(t),i=r.startDate,l=r.endDate,s={columnName:a,startDate:i,endDate:l},c=n.findIndex((function(e){return e.columnName===a}));if(c>=0){var u=n[c];n[c]=an(an({},n[c]),function(e,t){try{var n=e.startDate,a=e.endDate,r=t.startDate,i=t.endDate,l=o(n).isAfter(o(r))?n:r,s=o(a).isBefore(o(i))?a:i;return o(l).isAfter(o(s))?null:{startDate:l,endDate:s}}catch(e){return console.error(e),null}}(s,u))}else n.push(s)}}})),null!=n&&n.length?n:[]},Dr=["icon","area","size","selectOptions","style","selectValue","onSelectChange","fullWidth"],xr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onFocus",(function(){o.setState({focused:!0}),o.props.onFocus&&o.props.onFocus()})),mn(Cn(o),"onBlur",(function(){o.setState({focused:!1}),o.props.onBlur&&o.props.onBlur()})),mn(Cn(o),"focus",(function(){var e;null===(e=o.inputRef)||void 0===e||e.focus()})),mn(Cn(o),"onSelectChange",(function(e){o.props.onSelectChange(e),o.focus()})),mn(Cn(o),"simulateOnChange",(function(){var e;null===(e=o.inputRef)||void 0===e||e.dispatchEvent(new Event("change",{bubbles:!0}))})),mn(Cn(o),"incrementNumber",(function(){var e;null===(e=o.inputRef)||void 0===e||e.stepUp(),o.simulateOnChange()})),mn(Cn(o),"decrementNumber",(function(){var e;null===(e=o.inputRef)||void 0===e||e.stepDown(),o.simulateOnChange()})),mn(Cn(o),"renderSpinWheel",(function(){return f.createElement("div",{className:"react-autoql-input-number-spin-button-container"},f.createElement("button",{className:"react-autoql-input-number-spin-button",onClick:o.incrementNumber},f.createElement(Wn,{type:"caret-up"})),f.createElement("button",{className:"react-autoql-input-number-spin-button",onClick:o.decrementNumber},f.createElement(Wn,{type:"caret-down"})))})),mn(Cn(o),"renderSelectDropdown",(function(){return f.createElement(xo,{className:"react-autoql-text-input-selector",options:o.props.selectOptions,value:o.props.selectValue,onChange:o.onSelectChange})})),mn(Cn(o),"render",(function(){var e=o.props,t=e.icon,n=e.area,a=e.size,r=e.selectOptions,i=e.style;e.selectValue,e.onSelectChange;var l=e.fullWidth,s=yn(e,Dr),c=s.className,u=s.type,d=s.label,p=!(null==r||!r.length);return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-input-and-label-container\n ".concat(null!=c?c:"","\n ").concat(l?"react-autoql-input-full-width":""),style:i},!!d&&f.createElement("div",{className:"react-autoql-input-label"},d),f.createElement("div",{className:"react-autoql-input-container\n ".concat(o.state.focused?"focus":"","\n ").concat(p?"with-select":"","\n ").concat("small"===a?"react-autoql-input-small":"react-autoql-input-large","\n ").concat("number"===u?"react-autoql-input-number":""),"data-test":"react-autoql-input"},p&&o.renderSelectDropdown(),n?f.createElement("textarea",fn({},s,{ref:function(e){return o.inputRef=e},className:"react-autoql-input area",onFocus:o.onFocus,onBlur:o.onBlur})):f.createElement("div",{className:"react-autoql-input-and-icon"},f.createElement("input",fn({autoComplete:"one-time-code"},s,{ref:function(e){return o.inputRef=e},className:"react-autoql-input\n ".concat(t?"with-icon":"","\n ").concat(p?"with-select":""),onFocus:o.onFocus,onBlur:o.onBlur})),t&&f.createElement(Wn,{className:"react-autoql-input-icon ".concat(o.state.focused?" focus":""),type:t})),"number"===u&&o.renderSpinWheel())))})),o.state={focused:!1},o}return pn(n)}();mn(xr,"propTypes",{icon:b.string,type:b.string,step:b.string,size:b.oneOf(["small","large"]),label:b.oneOfType([b.element,b.string]),fullWidth:b.bool}),mn(xr,"defaultProps",{icon:void 0,type:"text",step:"1",size:"large",label:"",fullWidth:!1});var Rr,Ir,Ar=function(e,t){try{if(null!=e&&e[0]){var n,o=null==e||null===(n=e[0])||void 0===n?void 0:n.condition;return o&&o===Mr?[Mr]:[Lr]}return Ca(t)?[Lr]:[Mr]}catch(e){return console.error(e),[]}},Nr=function(e){return!!e.reset_date&&o(e.reset_date).valueOf()>o().valueOf()},wr=function(e,t){if(!e.reset_date)return"";var n=o(e.reset_date).tz(e.time_zone);return t?"".concat(n.format("ll h:mma")):"".concat(n.format("ll [at] h:mma")," (").concat(e.time_zone,")")},kr=function(e,t){var n,a;if(null==e||!e.length)return"";var r=null===(n=e[0])||void 0===n?void 0:n.next_evaluation,i=null===(a=e[0])||void 0===a?void 0:a.time_zone,l=o(r).tz(i);if(t){var s=o().tz(i).startOf("day"),c=l.startOf("day").diff(s,"day"),u="".concat(l.format("ll"));return 0===c?u="Today at":1===c&&(u="Tomorrow at"),"".concat(u," ").concat(l.format("h:mma"))}return"".concat(l.format("ll [at] h:mma")," (").concat(i,")")},Pr="PERIODIC",Or="CONTINUOUS",Lr="COMPARE",Mr="EXISTS",qr=["ACTIVE","RETRY","WAITING"],Vr={GREATER_THAN:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"greater")," than"),symbol:">",conditionText:"exceeds",conditionTextPast:"exceeded"},GREATER_THAN_EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"greater")," than ",f.createElement("strong",null,"or equal")," to"),symbol:">=",conditionText:"is equal to or exceeds",conditionTextPast:"was equal to or exceeded"},LESS_THAN:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"less")," than"),symbol:"<",conditionText:"falls below",conditionTextPast:"fell below"},LESS_THAN_EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"less")," than ",f.createElement("strong",null,"or equal")," to"),symbol:"<=",conditionText:"is equal to or falls below",conditionTextPast:"was equal to or fell below"},EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"equal")," to"),symbol:"=",conditionText:"equals",conditionTextPast:"was equal to"}},_r=(mn(Rr={},Lr,{displayName:"When a specific condition is met"}),mn(Rr,Mr,{displayName:"If new data is detected"}),Rr),Fr=(mn(Ir={},"SCHEDULED",{label:"at the following times:",listLabel:"at the following times"}),mn(Ir,Or,{label:"right away.",listLabel:"right away"}),Ir),zr={DAY:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"day")),getLocalStartDate:function(e){var t=e.timeObj,n=e.timezone,a=e.daysToAdd,r=void 0===a?0:a;try{var i=o().tz(n),l=i.startOf("minute").set("hour",t.hour24).set("minute",t.minute);return l.valueOf()<i.valueOf()&&(l=l.add(1,"day")),l.add(r,"days").format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}},WEEK:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"week")),getLocalStartDate:function(e){var t=e.weekDay,n=e.timeObj,a=e.timezone;try{var r=o().tz(a),i=io.findIndex((function(e){return t.toLowerCase()===e.toLowerCase()})),l=r.day(i).startOf("minute").hour(n.hour24).minute(n.minute);return l.valueOf()<r.valueOf()?l.add(1,"week").format("YYYY-MM-DD[T]HH:mm:00"):l.format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}},MONTH:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"month")),getLocalStartDate:function(e){var t=e.monthDay,n=e.timeObj,a=e.timezone;try{var r,i=o().tz(a);return"LAST"===t?r=i.endOf("month").startOf("day").format("ll HH:mm"):"FIRST"===t&&(r=i.add(1,"month").startOf("month").format("ll HH:mm")),o.tz(r,a).hour(n.hour24).minute(n.minute).format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}}},Br={DAY:{displayText:"Scheduled daily"},WEEK:{displayText:"Scheduled weekly"},MONTH:{displayText:"Scheduled for the 1st of every month"},MONTH_LAST_DAY:{displayText:"Scheduled for the end of every month"},YEAR:{displayText:"Scheduled yearly"}},Hr={DAY:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a day")),displayText:"At most once a day"},WEEK:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a week")),displayText:"At most once a week"},MONTH:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a month")),displayText:"At most once a month"},NONE:{displayName:f.createElement("span",null,f.createElement("strong",null,"Every time")," new data is detected"),displayText:"Continuous"}},Qr={FIRST:f.createElement("span",null,"on the ",f.createElement("strong",null,"first day")),LAST:f.createElement("span",null,"on the ",f.createElement("strong",null,"last day"))},Ur={1:{value:1,label:"1 min"},2:{value:2,label:"2 mins"},3:{value:3,label:"3 mins"},5:{value:5,label:"5 mins",listLabel:f.createElement("span",null,"5 mins ",f.createElement("em",null,"(Recommended)"))},10:{value:10,label:"10 mins"},30:{value:30,label:"30 mins"},60:{value:60,label:"60 mins"}},Yr=function(e){try{for(var t,n,a,r=/\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/g,i=/'(''|[^'])*'/g,l=e.eng,s=l.split(r),c=[];null!==(a=r.exec(l));)c.push(a);if(!c.length||!s.length||"(Date)"===(null===(t=c[0])||void 0===t?void 0:t[0])||null!==(n=s[0])&&void 0!==n&&null!==(n=n.split(" "))&&void 0!==n&&n.find((function(e){return Cr(e)})))return[function(e){var t=!1,n=e.eng,a=[];try{n=e.eng.split(" ").map((function(e){if(Cr(e)){var n=o(e).utc(),r=n.format("ll");if("Invalid Date"!==r)return t=!0,a.push(n),r}return e})).join(" ")}catch(e){t=!1}return t?{c_type:"DATE",eng:n,dateArray:a}:{c_type:"FILTER"===e.type?"FILTER":"TEXT",eng:n}}(e)];var u=[];return s.forEach((function(e,t){var n,o=[];"null"===e.trim()||e.includes(" null ")?o=function(e){var t,n=[],o=e.split("null");return o[0]&&n.push({c_type:"VL_PREFIX",eng:o[0],for:"null"}),n.push({c_type:"VALUE_LABEL",eng:"null",for:"null",operator:null!==(t=o[0].trim())&&void 0!==t?t:void 0}),o[1]&&n.push({c_type:"VL_PREFIX",eng:o[1],for:"null"}),n}(e):o=null!==(n=function(e,t){if(!e)return[];if(null==t||!t.length)return[{type:"TEXT",eng:e}];var n=0,o=[];return t.forEach((function(a,r){var i,l=a[0].length+a.index,s=e.substring(a.index,l),c=(i=s).substring(1,i.length-1).replace("''","'");if(a.index>n){var u=e.substring(n,a.index);u&&o.push({c_type:"VL_PREFIX",eng:u,for:c})}if(o.push({c_type:"VALUE_LABEL",eng:c,for:c}),r===t.length-1&&l<e.length){var d=e.substring(l,e.length);d&&o.push({c_type:"VL_PREFIX",eng:d,for:c})}n=l})),o}(e,function(e,t){if(!e)return[];for(var n,o=[];null!==(n=t.exec(e));)n&&o.push(n);return o}(e,i)))&&void 0!==n?n:[];u=[].concat(Tn(u),Tn(o));var a,r,l=c[t];l&&u.push({c_type:"VL_SUFFIX",eng:null===(a=l[0])||void 0===a?void 0:a.trim(),for:null===(r=o.find((function(e){return"VALUE_LABEL"===e.c_type})))||void 0===r?void 0:r.for})})),u}catch(t){return console.error(t),[{c_type:"TEXT",eng:e.eng}]}},Kr=function(e){try{if(!e)return;var t=[];return null!=e&&e.length&&e.forEach((function(e){"FILTER"===e.c_type||"SEED"===e.c_type?Yr(e).forEach((function(e){t.push(e)})):t.push(e)})),t}catch(e){return void console.error(e)}},jr=function(e){if(null!=e&&e.length){if(1===e.length)return"DAY";if(2===e.length){var t=o(e[1]).diff(o(e[0]),"day");if(t<=1)return"DAY";if(t<=7)return"WEEK";if(t<=31)return"MONTH"}return"MONTH"}},Wr=function(e){var t=function(e){try{var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.parsed_interpretation;if(!n)return;var o=Kr(n).findLast((function(e){return"DATE"===e.c_type}));return null==o?void 0:o.dateArray}catch(e){return void console.error(e)}}(e);return jr(t)},Gr=function(e){var t=null==e?void 0:e.dateArray,n=jr(t);if(n&&t&&t.length){var a=n.toLowerCase(),r=o.utc(t[0]).utc().startOf(a),i=o.utc(t[1]).utc().endOf(a),l=o.utc(t[0]).utc().add(1,a),s=o.utc(t[1]).utc().add(1,a),c=o().utc(),u=c.isBetween(r,i),d=c.isBetween(l,s),p="between ".concat(r.format("ll")," and ").concat(i.format("ll"));if(u)switch(n){case"DAY":return"today";case"MONTH":return"this month";case"WEEK":return"this week";case"YEAR":return"this year";default:return p}else if(d)switch(n){case"DAY":return"yesterday";case"MONTH":return"last month";case"WEEK":return"last week";case"YEAR":return"last year";default:return p}var m=r.toISOString(),f=aa({element:m,column:{type:"DATE",precision:n}});switch(n){case"DAY":return"on ".concat(f);case"MONTH":return"in ".concat(f);case"WEEK":return"on week ".concat(f);case"YEAR":return"in ".concat(f);default:return p}}},Xr=function(e){gn(o,f.Component);var n=Sn(o);function o(e){var a,r;un(this,o),mn(Cn(r=n.call(this,e)),"componentDidMount",(function(){var e;r._isMounted=!0,r.props.onValueLabelClick&&null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length&&r.validateAndUpdateValueLabels()})),mn(Cn(r),"shouldComponentUpdate",(function(e){return!e.isResizing||!r.props.isResizing})),mn(Cn(r),"componentDidUpdate",(function(e,t){var n,o,a;Ma(null===(n=e.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.parsed_interpretation,null===(o=r.props.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.parsed_interpretation)||r.setState({reverseTranslationArray:Kr(null===(a=r.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.parsed_interpretation)},(function(){r.validateAndUpdateValueLabels()}))})),mn(Cn(r),"componentWillUnmount",(function(){r._isMounted=!1})),mn(Cn(r),"validateAndUpdateValueLabels",(function(){var e,n,o,a,i,l=null!==(e=null===(n=r.props.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.persistent_filter_locks)&&void 0!==e?e:[],s=null!==(o=null===(a=r.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.fe_req)||void 0===a?void 0:a.session_filter_locks)&&void 0!==o?o:[],c=null!==(i=[].concat(Tn(s),Tn(l)))&&void 0!==i?i:[];if(r.state.reverseTranslationArray.length){var u=[],d=t(r.state.reverseTranslationArray);r.state.reverseTranslationArray.forEach((function(e,t){"VALUE_LABEL"===e.c_type&&u.push(Ye(an({suggestion:e.eng},_o(r.props.authentication))).then((function(e){var n;null!=e&&null!==(n=e.data)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.matches)&&void 0!==n&&n.length&&(d[t].c_type="VALIDATED_VALUE_LABEL",!!c.find((function(e){var n;return(null==e||null===(n=e.value)||void 0===n||null===(n=n.toLowerCase())||void 0===n?void 0:n.trim())===d[t].eng.toLowerCase().trim()}))&&(d[t].isLocked=!0))})).catch((function(e){return console.error(e)})))})),Promise.all(u).finally((function(){r._isMounted&&r.setState({reverseTranslationArray:d})}))}})),mn(Cn(r),"renderValueLabelLink",(function(e){return f.createElement("a",{id:"react-autoql-interpreted-value-label",className:"react-autoql-condition-link-filtered","data-test":"react-autoql-condition-link",onClick:function(t){t.stopPropagation(),r.props.onValueLabelClick(e.eng)}}," ",e.isLocked&&f.createElement(Wn,{type:"lock"})," ",f.createElement("span",null,e.eng))})),mn(Cn(r),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return r.props.onValueLabelClick&&!r.props.textOnly?r.renderValueLabelLink(e):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),mn(Cn(r),"getText",(function(){var e="";return r.state.reverseTranslationArray.map((function(t,n){e="".concat(e).concat(r.renderInterpretationChunk(t))})),e.trim()})),mn(Cn(r),"render",(function(){var e,t;return null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length?f.createElement(Rn,null,r.props.textOnly?f.createElement("span",null,r.getText()):f.createElement(f.Fragment,null,f.createElement("div",{id:r.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},f.createElement("div",{className:"react-autoql-reverse-translation"},f.createElement(Wn,{type:"info","data-tip":"This statement reflects how your query was interpreted in order to return this data response.","data-for":null!==(t=r.props.tooltipID)&&void 0!==t?t:"react-autoql-reverse-translation-tooltip-".concat(r.COMPONENT_KEY)}),f.createElement("strong",null," Interpreted as: "),r.state.reverseTranslationArray.map((function(e,t){return f.createElement("span",{key:"rt-item-".concat(r.COMPONENT_KEY,"-").concat(t)},r.renderInterpretationChunk(e))})))),!r.props.tooltipID&&f.createElement(So,{className:"react-autoql-reverse-translation-tooltip",id:"react-autoql-reverse-translation-tooltip-".concat(r.COMPONENT_KEY),effect:"solid",place:"right",html:!0}))):null})),r.COMPONENT_KEY=C();var i=Kr(null===(a=e.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.parsed_interpretation);return r.state={reverseTranslationArray:i},r}return pn(o)}();mn(Xr,"propTypes",{authentication:nr,onValueLabelClick:b.func,queryResponse:b.shape({}),tooltipID:b.string,textOnly:b.bool}),mn(Xr,"defaultProps",{authentication:Mo,onValueLabelClick:void 0,queryResponse:void 0,tooltipID:void 0,textOnly:!1});var Jr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"close",(function(){o.setState({isOpen:!1})})),mn(Cn(o),"onConfirmClick",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.setState({loading:!0}),e.prev=1,e.next=4,o.props.onConfirm();case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0);case 9:o.setState({isOpen:!1,loading:!1});case 10:case"end":return e.stop()}}),e,null,[[1,6]])})))),mn(Cn(o),"renderContent",(function(){return f.createElement("div",{className:"react-autoql-confirm-popover-content"},f.createElement("div",{className:"react-autoql-confirm-popover-title"},o.props.icon?f.createElement(Wn,{type:o.props.icon}):null,o.props.title),f.createElement("div",{className:"react-autoql-confirm-popover-text"},o.props.text),f.createElement("div",{className:"react-autoql-confirm-popover-button-container"},f.createElement(wo,{type:"default",size:"medium",onClick:o.close,tooltipID:o.props.tooltipID},o.props.backText),f.createElement(wo,{type:o.props.danger?"danger":"primary",onClick:o.onConfirmClick,loading:o.props.confirmLoading,tooltipID:o.props.tooltipID,size:"medium",filled:!0},o.props.confirmText)))})),mn(Cn(o),"render",(function(){var e;return f.createElement(Rn,null,f.createElement(Xn,{isOpen:o.state.isOpen,content:o.renderContent,className:"react-autoql-confirm-popover",parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,padding:o.props.padding,align:o.props.align,onClickOutside:o.close},f.createElement("div",{className:"react-autoql-confirm-popover-click-wrapper ".concat(null!==(e=o.props.className)&&void 0!==e?e:""),onClick:function(){return o.setState({isOpen:!o.state.isOpen})}},o.props.children)))})),o.state={isOpen:!1},o}return pn(n)}();mn(Jr,"propTypes",{title:b.string,text:b.string,backText:b.string,confirmText:b.string,danger:b.bool,padding:b.number,positions:b.arrayOf(b.string),align:b.string,icon:b.string,onClose:b.func,onConfirm:b.func}),mn(Jr,"defaultProps",{title:"Are you sure you want to proceed?",text:"",backText:"Go back",confirmText:"Continue",danger:!1,padding:void 0,positions:void 0,align:void 0,icon:void 0,onClose:function(){},onConfirm:function(){}});var Zr=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"COMPONENT_KEY","react-autoql-chip-".concat(C())),mn(Cn(e),"state",{isConfirmPopoverVisible:!1}),mn(Cn(e),"onCloseClick",(function(){Eo(),e.setState({isConfirmPopoverVisible:!0})})),mn(Cn(e),"renderDeleteButton",(function(){return e.props.confirmDelete?f.createElement(Jr,{className:"react-autoql-chip-delete-confirm-popover",popoverParentElement:e.props.popoverParentElement,title:e.props.confirmText,onConfirm:function(){e.setState({isConfirmPopoverVisible:!1},e.props.onDelete)},confirmText:"Remove",backText:"Cancel",positions:["top","bottom","right","left"],padding:e.props.popoverPadding,align:"end"},f.createElement(Wn,{className:"react-autoql-chip-delete-btn",type:"close",onClick:e.onCloseClick,"data-tip":e.props.deleteTooltip,"data-for":e.props.tooltipID})):f.createElement(Wn,{className:"react-autoql-chip-delete-btn",type:"close",onClick:e.props.onDelete})})),mn(Cn(e),"render",(function(){var t=e.props.loading||e.props.disabled;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-chip\n ".concat(e.props.className||"","\n ").concat(t?" disabled":"","\n ").concat(e.props.selected?" selected":""),"data-test":"react-autoql-chip","data-multiline":e.props.multiline,style:an({},e.props.style),onClick:e.props.onClick,"data-for":e.props.tooltipID,"data-tip":e.props.tooltip},f.createElement("div",{className:"react-autoql-chip-background"}),f.createElement("div",{className:"react-autoql-chip-content"},f.createElement("div",null,e.props.children),e.renderDeleteButton())))})),e}return pn(n)}();mn(Zr,"propTypes",{onClick:b.func,onDelete:b.func,disabled:b.bool,multiline:b.bool,selected:b.bool,confirmDelete:b.bool,confirmText:b.string,deleteTooltip:b.string,tooltip:b.string}),mn(Zr,"defaultProps",{onClick:function(){},onDelete:function(){},disabled:!1,multiline:!1,selected:!1,confirmDelete:!1,confirmText:"Are you sure?",deleteTooltip:void 0,tooltip:void 0});var $r=function(e){gn(a,f.Component);var t=Sn(a);function a(e){var r,i,l,s,c,u;un(this,a),mn(Cn(u=t.call(this,e)),"autoCompleteTimer",void 0),mn(Cn(u),"componentDidMount",(function(){var e;u._isMounted=!0,u.props.onUpdate(u.props.ruleId,u.isComplete(),u.isValid()),null===(e=u.secondInput)||void 0===e||e.focus()})),mn(Cn(u),"componentDidUpdate",(function(e,t){var o;n(u.state,t)||u.props.onUpdate(u.props.ruleId,u.isComplete(),u.isValid()),"QUERY"===u.state.secondTermType&&u.state.secondInputValue!==t.secondInputValue&&null!==(o=u.state.secondInputValue)&&void 0!==o&&o.length&&u.validateSecondQuery()})),mn(Cn(u),"componentWillUnmount",(function(){u._isMounted=!1,u.autoCompleteTimer&&clearTimeout(u.autoCompleteTimer)})),mn(Cn(u),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=e.useRT,o=e.sentenceCase,a=void 0!==o&&o,r=e.withFilters,i=void 0!==r&&r,l=u.getFormattedQueryText({sentenceCase:a,withFilters:i});n&&(l=f.createElement(Xr,{queryResponse:u.props.queryResponse,textOnly:!0}));var s=Vr[u.state.selectedOperator],c="past"===t?null==s?void 0:s.conditionTextPast:null==s?void 0:s.conditionText,d=u.state.secondInputValue;return"QUERY"===u.state.secondTermType&&(d='"'.concat(d,'"')),l&&c&&void 0!==d?f.createElement("span",{className:"data-alert-condition-statement"},f.createElement("span",{className:"data-alert-condition-statement-query1"},'"',l,'"')," ",f.createElement("span",{className:"data-alert-condition-statement-operator"},c)," ",f.createElement("span",{className:"data-alert-condition-statement-query2"},d)):l?f.createElement("span",{className:"data-alert-condition-statement"},f.createElement("span",{className:"data-alert-condition-statement-operator"},a?"N":"n","ew data ","past"===t?"was":"is"," detected for the query")," ",f.createElement("span",{className:"data-alert-condition-statement-query1"},'"',l,'"')):void 0})),mn(Cn(u),"getJSON",(function(){var e,t,n,o,a,r=u.state.secondInputValue,i=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.fe_req)||void 0===e?void 0:e.disambiguation,l=null===(t=u.state.queryFilters)||void 0===t?void 0:t.filter((function(e){return"table"===e.type})),s=null===(n=u.state.queryFilters)||void 0===n?void 0:n.filter((function(e){return"locked"===e.type})),c=[{id:u.TERM_ID_1,term_type:"QUERY",condition:u.state.selectedOperator,term_value:u.state.inputValue,user_selection:null!==(o=null===(a=u.props.initialData)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.user_selection)&&void 0!==o?o:i,filters:l,session_filter_locks:s}];if(u.allowOperators()){var d,p,m={id:u.TERM_ID_2,term_type:u.state.secondTermType,condition:"TERMINATOR",term_value:r};if("QUERY"===u.state.secondTermType)m.session_filter_locks=s,m.user_selection=null!==(d=null===(p=u.props.initialData)||void 0===p||null===(p=p[1])||void 0===p?void 0:p.user_selection)&&void 0!==d?d:i;c.push(m)}return c})),mn(Cn(u),"isNumerical",(function(e){try{if("CONSTANT"===ln(e))return!0;if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=Bt(e);return!isNaN(Number(n))}catch(e){return!1}})),mn(Cn(u),"isComplete",(function(){var e,t;return!(null===(e=u.state.inputValue)||void 0===e||!e.length)&&(!u.allowOperators()||!("QUERY"===u.state.secondTermType&&(u.state.secondQueryInvalid||u.state.secondQueryValidating||!u.state.secondQueryValidated))&&!(!na(u.state.secondInputValue)&&(null===(t=u.state.secondInputValue)||void 0===t||!t.length)))})),mn(Cn(u),"isValid",(function(){return!0})),mn(Cn(u),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(u.userSelectedValue=e.name,u.userSelectedSuggestion=!0,u.setState({inputValue:e.name}))})),mn(Cn(u),"onSuggestionsFetchRequested",(function(e){var t=e.value;u.autoCompleteTimer&&clearTimeout(u.autoCompleteTimer),u.autoCompleteTimer=setTimeout((function(){Ke(an(an(an({},_o(u.props.authentication)),zo(u.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],o=[];t=e.data.matches;for(var a=0;a<t.length&&(n.push(t[a]),4!==a);a++);n.sort((function(e,t){return t.length-e.length}));for(var r=0;r<n.length;r++){var i={name:n[r]};o.push(i)}u.setState({suggestions:o})})).catch((function(e){console.error(e)}))}),500)})),mn(Cn(u),"onSuggestionsClearRequested",(function(){u.setState({suggestions:[]})})),mn(Cn(u),"onSecondTermTypeChange",(function(e){e!==u.state.secondTermType&&(u.cancelSecondValidation(),u.setState({secondTermType:e,secondInputValue:"",secondQueryValidating:!1,secondQueryValidated:!1,secondQueryInvalid:!1,secondQueryError:""}))})),mn(Cn(u),"renderValidationError",(function(){return u.state.secondQueryValidating?f.createElement("span",{className:"expression-term-validation expression-term-validation-loading"},"Validating..."):u.state.secondQueryInvalid?f.createElement("span",{className:"expression-term-validation expression-term-validation-error"},f.createElement(Wn,{type:"warning-triangle"})," ",u.state.secondQueryError?f.createElement("span",null,u.state.secondQueryError):f.createElement("span",null,"That query is invalid. Try entering a different query.")):u.state.secondQueryValidated?f.createElement("span",{className:"expression-term-validation expression-term-validation-valid"},f.createElement(Wn,{type:"check"})," ",f.createElement("span",null,"Valid")):null})),mn(Cn(u),"renderOperatorSelector",(function(){var e,t=null===(e=u.SUPPORTED_OPERATORS)||void 0===e?void 0:e.map((function(e){var t=Vr[e],n=t.symbol?"(".concat(t.symbol,")"):"";return{value:e,listLabel:f.createElement("span",null,t.displayName," ",n),label:t.displayName}}));return f.createElement(xo,{options:t,value:u.state.selectedOperator,className:"react-autoql-rule-condition-select",label:"Meets this condition",onChange:function(e){u.setState({selectedOperator:e})}})})),mn(Cn(u),"renderRTChunk",(function(e,t,n){return f.createElement("span",{key:"data-alert-chunked-rt-".concat(u.COMPONENT_KEY,"-").concat(n),className:"data-alert-chunked-rt ".concat(t)},e," ")})),mn(Cn(u),"onValidationResponse",(function(e){var t,n=!1;Ca(u.props.queryResponse)&&!Ca(e)&&(n=!0,t=f.createElement("span",null,"The result of this query must be a single value")),u.setState({secondQueryValidating:!1,secondQueryInvalid:n,secondQueryValidated:!0,secondQueryError:t})})),mn(Cn(u),"cancelSecondValidation",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(u),"runSecondValidation",(function(){var e;u.state.secondInputValue&&(u.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source(),je(an(an(an({query:u.state.secondInputValue},_o(u.props.authentication)),zo(u.props.autoQLConfig)),{},{source:"data_alert_validation",pageSize:2,cancelToken:u.axiosSource.token,allowSuggestions:!1})).then((function(e){u.onValidationResponse(e)})).catch((function(e){var t;(null==e||null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&u.setState({secondQueryValidating:!1,secondQueryInvalid:!0})})))})),mn(Cn(u),"validateSecondQuery",(function(){u.cancelSecondValidation(),u.state.secondQueryValidating||u.setState({secondQueryValidating:!0}),clearTimeout(u.secondValidationTimeout),u.secondValidationTimeout=setTimeout((function(){u.runSecondValidation()}),1e3)})),mn(Cn(u),"onSecondQueryChange",(function(e){var t=e.target.value,n={secondInputValue:t};null!=t&&t.length||(n.secondQueryValidating=!1),u.setState(n)})),mn(Cn(u),"getChunkedInterpretationText",(function(){var e,t,n,o=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation,a=Kr(o);if(null==o||!o.length)return null===(n=u.props.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.text;var r="",i=0;return a.forEach((function(e,t){var n,o=null===(n=e.eng)||void 0===n?void 0:n.trim(),a=e.c_type;if(o&&a&&"VL_SUFFIX"!==a&&"DELIM"!==a){var l="";if("VALUE_LABEL"===a&&(i||(l="for "),i+=1),"DATE"===a){var s=Gr(e);if(!s)return;o=s}r="".concat(r," ").concat(l).concat(o)}})),null===(t=r)||void 0===t?void 0:t.trim()})),mn(Cn(u),"renderChunkedInterpretation",(function(){var e,t,n=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation,o=Kr(n);if(null==n||!n.length)return null===(t=u.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text;var a=0;return o.map((function(e,t){var n=e.eng,o=e.c_type;if(!n||!o)return null;if(0===t&&(n=n[0].toUpperCase()+n.substring(1)),"VL_SUFFIX"===o||"DELIM"===o)return null;if("DATE"===o){var r=Gr(e);if(!r)return null;n=r}var i="";return"VALUE_LABEL"===o&&(a||(i="for"),a+=1),f.createElement(f.Fragment,null,!!i&&u.renderRTChunk(i,"VL_PREFIX","".concat(t,"-").concat(t)),u.renderRTChunk(n,o,t))}))})),mn(Cn(u),"getQueryFiltersText",(function(){var e,t=Kr(null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation),n=u.state.queryFilters,o="",a=[];return n.forEach((function(e){var n,o=null===(n=e.value)||void 0===n?void 0:n.trim().toLowerCase(),r=t.filter((function(e){var t;return(null===(t=e.for)||void 0===t||null===(t=t.trim())||void 0===t?void 0:t.toLowerCase())===o})),i="";null!=r&&r.length&&r.forEach((function(e){i+=e.eng})),i&&a.push(i)})),a.length&&a.forEach((function(e,t){var n=t!==a.length-1?", ":"";o="".concat(o).concat(e).concat(n)})),o})),mn(Cn(u),"getFormattedDate",(function(e){var t,n=!1,a=[];try{var r=e.value.split(",").map((function(e){if(Cr(e)){var t=o(e).utc(),r=t.format("ll");if("Invalid Date"!==r)return n=!0,a.push(t),r}return e})),i=r[0],l=r[1];t="Between ".concat(i," and ").concat(l),i===l&&(t="".concat(i))}catch(e){console.error(e),n=!1}if(n)return t})),mn(Cn(u),"getFormattedQueryText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sentenceCase,n=void 0===t||t,o=e.withFilters;try{var a,r="",i=u.state.inputValue;if(u.props.queryResponse)i=null===(a=u.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.text,r=u.getQueryFiltersText();return i?(n&&(i=i[0].toUpperCase()+i.substring(1)),o&&(i="".concat(i," ").concat(r)),i):""}catch(e){return console.error(e),""}})),mn(Cn(u),"renderFormattedQuery",(function(){})),mn(Cn(u),"getFilters",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.props,n=[],o=[];if(t.queryResponse){var a,r,i,l,s,c,d=null!==(a=null===(r=t.queryResponse)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.fe_req)||void 0===r?void 0:r.persistent_filter_locks)&&void 0!==a?a:[],p=null!==(i=null===(l=t.queryResponse)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.fe_req)||void 0===l?void 0:l.session_filter_locks)&&void 0!==i?i:[];n=null!==(s=[].concat(Tn(d),Tn(p)))&&void 0!==s?s:[],o=null!==(c=t.filters)&&void 0!==c?c:[]}else{var m,f,g,v;n=null!==(m=null===(f=t.initialData[0])||void 0===f?void 0:f.session_filter_locks)&&void 0!==m?m:[],o=null!==(g=null===(v=t.initialData[0])||void 0===v?void 0:v.filters)&&void 0!==g?g:[]}var h=null!==(e=o.map((function(e){var t;return an(an({},e),{},{value:null!==(t=null==e?void 0:e.displayValue)&&void 0!==t?t:null==e?void 0:e.value,type:"table"})})))&&void 0!==e?e:[],b=n.map((function(e){return an(an({},e),{},{type:"locked"})})),y=[].concat(Tn(h),Tn(b));return y})),mn(Cn(u),"removeFilter",(function(e){var t,o=null===(t=u.state.queryFilters)||void 0===t?void 0:t.filter((function(t){return!n(t,e)}));u.setState({queryFilters:o})})),mn(Cn(u),"renderFilterChips",(function(){var e=u.state.queryFilters;return null!=e&&e.length?f.createElement("div",{className:"react-autoql-data-alert-filters-container"},e.map((function(e,t){if(e){var n=null;if("table"===e.type){var o,a,r=null!==(o=" "+e.operator)&&void 0!==o?o:"like";"between"!==e.operator||e.value.includes(" and ")||(r=":"),"AMOUNT"!==e.column_type&&(a=u.getFormattedDate(e));var i=e.value;"like"===e.operator&&(i='"'.concat(e.value,'"')),a&&(i=a),n=f.createElement("span",null,f.createElement("strong",null,f.createElement(Wn,{type:"table"})," ",e.columnName),r," ",f.createElement("em",null,i))}else if("locked"===e.type){var l,s;n=f.createElement("span",null,f.createElement("strong",null,f.createElement(Wn,{type:"lock"})," ",null!==(l=e.show_message)&&void 0!==l?l:"Value"),"exclude"===(null===(s=e.filter_type)||void 0===s?void 0:s.toLowerCase())?f.createElement("span",null," ",f.createElement("u",null,"not")," "):": ",e.value)}if(n)return f.createElement(Zr,{key:"filter-chip-".concat(t),onDelete:function(){return u.removeFilter(e)},confirmDelete:!0,confirmText:"Remove this filter?",tooltip:"This ".concat(e.type,' filter is currently applied to your query data. It will also be applied to your Data Alert unless you remove it by hitting "x".'),tooltipID:u.props.tooltipID,popoverPadding:10},n)}return null}))):null})),mn(Cn(u),"renderBaseQuery",(function(){return f.createElement("div",{className:"react-autoql-rule-input"},f.createElement("div",null,f.createElement("span",{className:"data-alert-rule-query-readonly-container","data-for":u.props.tooltipID,"data-tip":"Editing this query is not permitted. To use a different query, simply create a new Data Alert via Data Messenger or a Dashboard."},f.createElement(xr,{label:u.allowOperators()?"Trigger Alert when this query":"Trigger Alert when new data is detected for this query",value:u.getFormattedQueryText(),readOnly:!0,disabled:!0,fullWidth:!0})),u.renderFilterChips()))})),mn(Cn(u),"getSecondInputPlaceholder",(function(){var e=u.state.secondTermType,t=u.props.queryResponse;if("CONSTANT"===e){var n,o=null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.rows)||void 0===n||null===(n=n[0])||void 0===n?void 0:n[0];return na(o)?"".concat("Type a number",' (eg. "').concat(o,'")'):"Type a number"}if("QUERY"===e)return"Type a query"})),mn(Cn(u),"shouldRenderValidationSection",(function(){return u.allowOperators()&&"QUERY"===u.state.secondTermType})),mn(Cn(u),"renderTermValidationSection",(function(){return u.shouldRenderValidationSection()?f.createElement("div",{className:"rule-simple-validation-container"},u.renderValidationError()):null})),mn(Cn(u),"renderSecondTermInput",(function(){return f.createElement(xr,{ref:function(e){return u.secondInput=e},spellCheck:!1,placeholder:u.getSecondInputPlaceholder(),value:u.state.secondInputValue,type:"CONSTANT"===u.state.secondTermType?"number":void 0,onKeyDown:function(e){"Enter"===e.key&&u.props.onLastInputEnterPress()},selectOptions:[{value:"CONSTANT",label:f.createElement("span",null,"this ",f.createElement("strong",null,"number:"))},{value:"QUERY",label:f.createElement("span",null,"the result of this ",f.createElement("strong",null,"query:"))}],onSelectChange:u.onSecondTermTypeChange,selectValue:u.state.secondTermType,onChange:u.onSecondQueryChange})})),mn(Cn(u),"allowOperators",(function(){return u.SUPPORTED_CONDITION_TYPES.includes(Lr)})),mn(Cn(u),"render",(function(){return u.props.conditionStatementOnly?null:f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-rule-simple\n ".concat(u.shouldRenderValidationSection()?"with-query-validation":""),style:u.props.style},f.createElement("div",{className:"react-autoql-rule-simple-first-query","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-first-input-container"},u.renderBaseQuery())),f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},u.allowOperators()&&f.createElement(f.Fragment,null,f.createElement("div",{className:"react-autoql-rule-condition-select-input-container"},u.renderOperatorSelector()),f.createElement("div",{className:"react-autoql-rule-second-input-container"},f.createElement("div",{className:"react-autoql-rule-input"},u.renderSecondTermInput()),u.renderTermValidationSection())))))}));var d=e.initialData,p=e.queryResponse;u.SUPPORTED_CONDITION_TYPES=Ar(d,p),u.SUPPORTED_OPERATORS=[],(u.SUPPORTED_CONDITION_TYPES.includes(Lr)||Object.keys(Vr).includes(null==d||null===(r=d[0])||void 0===r?void 0:r.condition))&&(u.SUPPORTED_OPERATORS=Object.keys(Vr)),u.TERM_ID_1=C(),u.TERM_ID_2=C();var m,g,v,h,b,y,S=u.SUPPORTED_CONDITION_TYPES.includes(Lr)?u.SUPPORTED_OPERATORS[0]:Mr,T={selectedOperator:null!==(i=null==d||null===(l=d[0])||void 0===l?void 0:l.condition)&&void 0!==i?i:S,inputValue:null!==(s=null==p||null===(c=p.data)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.text)&&void 0!==s?s:"",secondInputValue:"",secondTermType:"CONSTANT",secondQueryValidating:!1,secondQueryValidated:!1,secondQueryInvalid:!1,secondQueryError:"",isEditingQuery:!1,queryFilters:u.getFilters(e)};null!=d&&d.length&&(u.TERM_ID_1=d[0].id,u.TERM_ID_2=d.length>1?d[1].id:C(),T.selectedOperator=null!==(m=d[0].condition)&&void 0!==m?m:u.SUPPORTED_OPERATORS[0],T.inputValue=null!==(g=d[0].term_value)&&void 0!==g?g:"",T.secondInputValue=null!==(v=null===(h=d[1])||void 0===h?void 0:h.term_value)&&void 0!==v?v:"",T.secondTermType=null!==(b=null===(y=d[1])||void 0===y||null===(y=y.term_type)||void 0===y?void 0:y.toUpperCase())&&void 0!==b?b:"CONSTANT",T.secondQueryValidated=!0);return u.state=T,u}return pn(a)}();mn($r,"propTypes",{authentication:nr,ruleId:b.string,onUpdate:b.func,initialData:b.arrayOf(b.shape({})),queryResponse:b.shape({}),onLastInputEnterPress:b.func}),mn($r,"defaultProps",{authentication:Mo,ruleId:void 0,onUpdate:function(){},initialData:void 0,queryResponse:void 0,onLastInputEnterPress:function(){}});var ei=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"componentDidUpdate",(function(e,t){n(t,a.state)||a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1})),mn(Cn(a),"getInitialState",(function(e){var t,n,o,r=(null!=e?e:a.props).expression,i=void 0,l=!1;if(Array.isArray(r)&&"QUERY"===(null==r||null===(t=r[0])||void 0===t?void 0:t.term_type))i=r;else if("QUERY"===(null==r||null===(n=r.term_value)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.term_type))i=r.term_value;else if("GROUP"===(null==r||null===(o=r[0])||void 0===o?void 0:o.term_type)){var s,c;(null==r?void 0:r.length)>1||(null==r||null===(s=r[0])||void 0===s||null===(s=s.term_value)||void 0===s?void 0:s.length)>1?l=!0:"QUERY"===(null==r||null===(c=r[0])||void 0===c||null===(c=c.term_value)||void 0===c||null===(c=c[0])||void 0===c||null===(c=c.term_value)||void 0===c||null===(c=c[0])||void 0===c?void 0:c.term_type)?i=S(r[0].term_value[0].term_value):l=!0}return{expression:i,expressionError:l}})),mn(Cn(a),"isComplete",(function(){return!!a.state.expressionError||(a.ruleRef?a.ruleRef.isComplete():void 0)})),mn(Cn(a),"isValid",(function(){return!a.state.expressionError&&(a.ruleRef?a.ruleRef.isValid():void 0)})),mn(Cn(a),"getJSON",(function(){var e;return a.ruleRef&&(e=a.ruleRef.getJSON()),e})),mn(Cn(a),"resetConditions",(function(){a.setState({expression:void 0,expressionError:!1},(function(){a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())}))})),mn(Cn(a),"onRuleUpdate",(function(e,t,n){a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"getFormattedQueryText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sentenceCase,n=e.withFilters;return a.ruleRef?a.ruleRef.getFormattedQueryText({sentenceCase:t,withFilters:n}):null})),mn(Cn(a),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=void 0===t?a.props.conditionTense:t,o=e.useRT,r=void 0===o?a.props.useRT:o,i=e.sentenceCase,l=void 0===i?a.props.sentenceCase:i,s=e.withFilters,c=void 0===s?a.props.withFilters:s;return a.ruleRef?a.ruleRef.getConditionStatement({tense:n,useRT:r,sentenceCase:l,withFilters:c}):null})),mn(Cn(a),"getFirstQuery",(function(e){var t,n;if(e?t=e:a.ruleRef&&(t=a.ruleRef.getJSON()),t)return Array.isArray(t)&&(t=t[0]),"GROUP"===t.term_type?a.getFirstQuery(null===(n=t)||void 0===n||null===(n=n.term_value)||void 0===n?void 0:n[0]):"QUERY"===t.term_type?t.term_value:void 0})),mn(Cn(a),"renderExpressionErrorMessage",(function(){return f.createElement("div",{className:"expression-error-message"},f.createElement(Wn,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported. ",f.createElement("a",{onClick:a.resetConditions},"Reset Conditions"))})),mn(Cn(a),"render",(function(){var e,t,n={};return a.props.conditionStatementOnly&&(n.visibility="hidden",n.position="absolute",n.height="0",n.width="0",n.opacity="0"),f.createElement(Rn,null,f.createElement("div",{className:"data-alerts-container"},f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},a.state.expressionError?a.renderExpressionErrorMessage():f.createElement(f.Fragment,null,f.createElement($r,{style:n,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,ref:function(e){return a.ruleRef=e},ruleId:null!==(e=null===(t=a.props.expression)||void 0===t?void 0:t.id)&&void 0!==e?e:C(),onUpdate:a.onRuleUpdate,initialData:a.props.expression,tooltipID:a.props.tooltipID,queryResponse:a.props.queryResponse,onLastInputEnterPress:a.props.onLastInputEnterPress,filters:a.props.filters}),a.props.conditionStatementOnly&&f.createElement("span",{className:"condition-builder-statement"},a.getConditionStatement(a.props.conditionTense,a.props.useRT,a.props.sentenceCase))))))})),a.ruleRef=void 0,a.state=a.getInitialState(e),a}return pn(o)}();mn(ei,"propTypes",{authentication:nr,expression:b.oneOfType([b.shape({}),b.array]),conditionStatementOnly:b.bool,onChange:b.func,onLastInputEnterPress:b.func}),mn(ei,"defaultProps",{authentication:Mo,expression:void 0,conditionStatementOnly:!1,conditionTense:"present",useRT:!1,sentenceCase:!0,withFilters:!1,onChange:function(){},onLastInputEnterPress:function(){}});var ti=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o._isMounted=!0,o.instantiateTabulator();case 2:case"end":return e.stop()}}),e)})))),mn(Cn(o),"shouldComponentUpdate",(function(){return!1})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,o.isInitialized=!1,setTimeout((function(){o.tabulator.destroy()}),1e3)})),mn(Cn(o),"instantiateTabulator",(function(){var e;o.tabulator=new bt(o.tableRef,an(an({columns:o.props.columns,data:null!==(e=o.props.options)&&void 0!==e&&e.ajaxRequestFunc?[]:o.props.data},o.defaultOptions),o.props.options)),o.tabulator.on("renderComplete",(function(){setTimeout((function(){o.blockRedraw()}),1e3)})),o.tabulator.on("dataLoadError",o.props.onDataLoadError),o.tabulator.on("cellClick",o.props.onCellClick),o.tabulator.on("dataSorting",o.props.onDataSorting),o.tabulator.on("dataSorted",o.props.onDataSorted),o.tabulator.on("dataFiltering",o.props.onDataFiltering),o.tabulator.on("dataFiltered",o.props.onDataFiltered),o.tabulator.on("tableBuilt",cn(rn().mark((function e(){var t;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.isInitialized=!0,null===(t=o.props.options)||void 0===t||!t.ajaxRequestFunc){e.next=4;break}return e.next=4,o.tabulator.setData();case 4:o.props.onTableBuilt();case 5:case"end":return e.stop()}}),e)}))))})),mn(Cn(o),"blockRedraw",(function(e){var t;o.isInitialized&&(o.redrawRestored=!1,null===(t=o.tabulator)||void 0===t||t.blockRedraw())})),mn(Cn(o),"restoreRedraw",(function(e){o.tabulator&&o.isInitialized&&!o.redrawRestored&&o._isMounted&&(o.redrawRestored=!0,o.tabulator.restoreRedraw())})),mn(Cn(o),"updateData",(function(e){var t;o.props.hidden?setTimeout((function(){var t;o.restoreRedraw(),null===(t=o.tabulator)||void 0===t||t.setData(e)}),0):(o.restoreRedraw(),null===(t=o.tabulator)||void 0===t||t.setData(e))})),mn(Cn(o),"render",(function(){return f.createElement("div",{ref:function(e){return o.tableRef=e},className:"table-condensed ".concat(o.props.className),id:"react-tabulator-id-".concat(o.COMPONENT_KEY),key:o.COMPONENT_KEY})})),o.COMPONENT_KEY=C(),o.tableRef=f.createRef(),o.tabulator=null,o.redrawRestored=!0,o.defaultOptions={height:o.props.height||"100%",headerFilterLiveFilterDelay:300,minHeight:100,reactiveData:!1,autoResize:!1,rowHeight:25,layout:"fitDataFill",clipboard:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1}},o}return pn(n)}();mn(ti,"propTypes",{tableKey:b.string,options:b.shape({}),onDataLoadError:b.func,onTableBuilt:b.func,onCellClick:b.func,onDataSorting:b.func,onDataSorted:b.func,onDataFiltering:b.func,onDataFiltered:b.func}),mn(ti,"defaultProps",{tableKey:void 0,options:{},onDataLoadError:function(){},onTableBuilt:function(){},onCellClick:function(){},onDataSorting:function(){},onDataSorted:function(){},onDataFiltering:function(){},onDataFiltered:function(){}});var ni=function(e,t){return{sorters:oi(e,t),filters:ai(e,t),page:null==e?void 0:e.page}},oi=function(e,t){var n,o=[];return(null==e||null===(n=e.sort)||void 0===n?void 0:n.length)>0&&e.sort.forEach((function(e){try{var n=null==t?void 0:t[Number(e.field)];if(n){var a=n.name,r=e.dir.toUpperCase();a&&r&&o.push({name:a,sort:r})}}catch(e){console.error(e)}})),o},ai=function(e,t){var n,a=[];return(null==e||null===(n=e.filter)||void 0===n?void 0:n.length)>0&&e.filter.forEach((function(e){try{var n=null==t?void 0:t[Number(e.field)];if(n){var r={name:n.name,columnName:n.title,value:e.value,operator:"like"};if(Ho(n)){var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.trim().replace(/[^0-9.]/g,""),n=Number(t);if(!t||isNaN(n))throw new Error("Unable to convert string to number");var o="=",a=e.trim();return a.length>=2&&(["<=",">=","!="].includes(a.substring(0,2))?o=a.substring(0,2):["=","<",">"].includes(a.substring(0,1))&&(o=a.substring(0,1))),{value:t,operator:o}}(e.value);r.operator=i.operator,r.value=i.value}else if("DATE"===n.type){var l,s=e.value.split(" to "),c=Sr(n.precision),u=o.utc(s[0]).startOf(c).toISOString(),d=o.utc(null!==(l=s[1])&&void 0!==l?l:s[0]).endOf(c).toISOString();r.value="".concat(u,",").concat(d),r.operator="between",r.column_type="TIME",r.displayValue=e.value.replaceAll(" to "," and ")}a.push(r)}}catch(e){console.warn(e)}})),a},ri=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;un(this,n),mn(Cn(a=t.call(this,e)),"selectedRangeIncludesMonth",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"month")})),mn(Cn(a),"handleMonthHover",(function(e){var t=a.state.selectedStart,n=e.startOf("month"),o=e.endOf("month");t&&"end"===a.state.focusedDateDisplay&&(o.isBefore(t)?o=t.endOf("month"):t.isBefore(n)&&(n=t.startOf("month"))),a.setState({previewStart:n,previewEnd:o})})),mn(Cn(a),"handleMonthClick",(function(e){"start"===a.state.focusedDateDisplay?a.onMonthStartSelection(e):a.onMonthEndSelection(e)})),mn(Cn(a),"incrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)+1)})})),mn(Cn(a),"decrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)-1)})})),mn(Cn(a),"onMonthStartSelection",(function(e){a.setState({selectedStart:e.startOf("month"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("month"),e],n=t[0].startOf("month"),o=t[1].endOf("month");a.props.onRangeSelection({startDate:n.toDate(),endDate:o.toDate()})})),mn(Cn(a),"onMonthEndSelection",(function(e){try{var t=a.state.selectedStart;t||a.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var o=n[0].startOf("month"),r=n[1].endOf("month");a.setState({selectedStart:o,selectedEnd:r}),a.props.onRangeSelection({startDate:o.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),mn(Cn(a),"renderDateDisplay",(function(){var e,t,n,o,r,i=null!==(e=null===(t=a.state.selectedStart)||void 0===t?void 0:t.startOf("month").format("MMM YYYY"))&&void 0!==e?e:"",l=null!==(n=null!==(o=null===(r=a.state.selectedEnd)||void 0===r?void 0:r.startOf("month").format("MMM YYYY"))&&void 0!==o?o:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem\n ".concat("start"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return a.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),mn(Cn(a),"renderYearPicker",(function(){var e=a.props.minDate?o(a.props.minDate).year():o(new Date).add(-100,"year").year(),t=a.props.maxDate?o(a.props.maxDate).year():o(new Date).add(20,"year").year();return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:a.decrementYear,disabled:a.state.visibleYear===e},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:a.state.visibleYear,onChange:function(e){return a.setState({visibleYear:Number(e.target.value)})}},new Array(t-e+1).fill(t).map((function(e,t){var n=e-t;return f.createElement("option",{key:n,value:n},n)}))),f.createElement("button",{className:"rdrNextPrevButton rdrNextButton",onClick:a.incrementYear,disabled:a.state.visibleYear===t},f.createElement("i",null)))})),mn(Cn(a),"isSelected",(function(e){var t=a.state,n=t.selectedStart,o=t.selectedEnd,r=e.startOf("month").isSame(null==n?void 0:n.startOf("month")),i=r&&!o||e.endOf("month").isSame(null==o?void 0:o.endOf("month"));return{isSelected:r||i||a.selectedRangeIncludesMonth(e),isSelectedStart:r,isSelectedEnd:i}})),mn(Cn(a),"isPreview",(function(e){var t=a.state,n=t.previewStart,o=t.previewEnd,r=e.startOf("month").isSame(n),i=e.endOf("month").isSame(o);return{isPreview:r||i||e.isBetween(n,o,"month"),isPreviewStart:r,isPreviewEnd:i}})),mn(Cn(a),"isDisabled",(function(e){var t=a.props.minDate&&e.isBefore(o(a.props.minDate).startOf("month")),n=a.props.maxDate&&e.isAfter(o(a.props.maxDate).endOf("month"));return t||n})),mn(Cn(a),"renderMonthGrid",(function(){return f.createElement("div",{className:"react-autoql-month-picker-month-picker"},[[0,1,2],[3,4,5],[6,7,8],[9,10,11]].map((function(e,t){return f.createElement("div",{className:"month-picker-row",key:"month-row-".concat(t)},e.map((function(e){var t=o("".concat(a.state.visibleYear,"-").concat(e+1,"-15")),n=o("2021-".concat(e+1,"-15")).format("MMM"),r=a.isSelected(t),i=r.isSelected,l=r.isSelectedStart,s=r.isSelectedEnd,c=a.isPreview(t),u=c.isPreview,d=c.isPreviewStart,p=c.isPreviewEnd,m=a.isDisabled(t),g=e===o().month()&&a.state.visibleYear==o().year();return f.createElement("div",{key:e,className:"month-picker-month\n ".concat(g?" current-month":"","\n ").concat(l?" selection-start":"","\n ").concat(s?" selection-end":"","\n ").concat(i?" active":"","\n ").concat(d?" preview-start":"","\n ").concat(p?" preview-end":"","\n ").concat(u?" preview":"","\n ").concat(m?" rdrDayDisabled":""),onClick:function(){return a.handleMonthClick(t)},onMouseEnter:function(){return!m&&a.handleMonthHover(t)},onMouseLeave:function(){return!m&&a.setState({previewStart:void 0,previewEnd:void 0})}},f.createElement("div",{className:"month-picker-month-text-wrapper"},f.createElement("div",{className:"month-picker-month-text"},f.createElement("span",null,n))))})))})))})),mn(Cn(a),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},a.renderDateDisplay(),a.renderYearPicker(),a.renderMonthGrid())})),a.COMPONENT_KEY=C();var r=o(),i=r.year(),l=r.startOf("month"),s=r.endOf("month");return e.initialRange?(l=o(a.props.initialRange.startDate).startOf("month"),i=(s=o(a.props.initialRange.endDate).endOf("month")).year()):e.minDate&&e.maxDate&&(r.isBefore(o(e.minDate))||r.isAfter(o(e.maxDate)))&&(l=o(e.minDate).startOf("month"),s=o(e.maxDate).endOf("month")),a.state={selectedRange:a.props.initialRange,visibleYear:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},a}return pn(n)}();mn(ri,"propTypes",{minDate:b.instanceOf(Date),maxDate:b.instanceOf(Date),initialRange:b.shape({startDate:b.instanceOf(Date),endDate:b.instanceOf(Date)}),onRangeSelection:b.func}),mn(ri,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var ii=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;un(this,n),mn(Cn(a=t.call(this,e)),"getDecade",(function(e){var t=e-e%10;return[t,t+9]})),mn(Cn(a),"isInDecade",(function(e,t){return e>=t[0]&&e<=t[1]})),mn(Cn(a),"selectedRangeIncludesYear",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"year")})),mn(Cn(a),"handleYearHover",(function(e){var t=a.state.selectedStart,n=e.startOf("year"),o=e.endOf("year");t&&"end"===a.state.focusedDateDisplay&&(o.isBefore(t)?o=t.endOf("year"):t.isBefore(n)&&(n=t.startOf("year"))),a.setState({previewStart:n,previewEnd:o})})),mn(Cn(a),"handleYearClick",(function(e){"start"===a.state.focusedDateDisplay?a.onYearStartSelection(e):a.onYearEndSelection(e)})),mn(Cn(a),"incrementDecade",(function(){var e=a.state.visibleDecade[1];a.setState({visibleDecade:[e+1,e+10]})})),mn(Cn(a),"decrementDecade",(function(){var e=a.state.visibleDecade[0];a.setState({visibleDecade:[e-10,e-1]})})),mn(Cn(a),"onYearStartSelection",(function(e){a.setState({selectedStart:e.startOf("year"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("year"),e],n=t[0].startOf("year"),o=t[1].endOf("year");a.props.onRangeSelection({startDate:n.toDate(),endDate:o.toDate()})})),mn(Cn(a),"onYearEndSelection",(function(e){try{var t=a.state.selectedStart;t||a.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var o=n[0].startOf("year"),r=n[1].endOf("year");a.setState({selectedStart:o,selectedEnd:r}),a.props.onRangeSelection({startDate:o.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),mn(Cn(a),"renderDateDisplay",(function(){var e,t,n,o,r,i=null!==(e=null===(t=a.state.selectedStart)||void 0===t?void 0:t.year())&&void 0!==e?e:"",l=null!==(n=null!==(o=null===(r=a.state.selectedEnd)||void 0===r?void 0:r.year())&&void 0!==o?o:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem\n ".concat("start"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return a.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),mn(Cn(a),"renderDecadePicker",(function(){var e=a.props.minDate?a.getDecade(o(a.props.minDate).year()):a.getDecade(o(new Date).add(-100,"year").year()),t=a.props.maxDate?a.getDecade(o(a.props.maxDate).year()):a.getDecade(o(new Date).add(20,"year").year()),n=(t[0]-e[0])/10||1;return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:a.decrementDecade,disabled:a.state.visibleDecade[0]===e[0]},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:"".concat(a.state.visibleDecade[0]," - ").concat(a.state.visibleDecade[1]),onChange:function(e){var t=e.target.value.split(" - ").map((function(e){return Number(e)}));a.setState({visibleDecade:t})}},new Array(n).fill(e).map((function(e,t){var n="".concat(e[0]+10*t," - ").concat(e[1]+10*t);return f.createElement("option",{key:t,value:n},n)}))),f.createElement("button",{className:"rdrNextPrevButton rdrNextButton",onClick:a.incrementDecade,disabled:a.state.visibleDecade[0]===t[0]},f.createElement("i",null)))})),mn(Cn(a),"isSelected",(function(e){var t=a.state,n=t.selectedStart,o=t.selectedEnd,r=e.startOf("year").isSame(null==n?void 0:n.startOf("year")),i=r&&!o||e.endOf("year").isSame(null==o?void 0:o.endOf("year"));return{isSelected:r||i||a.selectedRangeIncludesYear(e),isSelectedStart:r,isSelectedEnd:i}})),mn(Cn(a),"isPreview",(function(e){var t=a.state,n=t.previewStart,o=t.previewEnd,r=e.startOf("year").isSame(n),i=e.endOf("year").isSame(o);return{isPreview:r||i||e.isBetween(n,o,"year"),isPreviewStart:r,isPreviewEnd:i}})),mn(Cn(a),"isDisabled",(function(e){var t=a.props.minDate&&e.isBefore(o(a.props.minDate).startOf("year")),n=a.props.maxDate&&e.isAfter(o(a.props.maxDate).endOf("year"));return t||n})),mn(Cn(a),"renderYearGrid",(function(){var e=a.state.visibleDecade,t=new Array(10).fill(e[0]).map((function(e,t){return e+t})),n=[Tn(t.slice(0,3)),Tn(t.slice(3,6)),Tn(t.slice(6,9)),[t[9]]];return f.createElement("div",{className:"react-autoql-month-picker-month-picker"},n.map((function(e,t){return f.createElement("div",{className:"month-picker-row",key:"month-row-".concat(t)},e.map((function(e){var t=o("".concat(e,"-01-15")),n=a.isSelected(t),r=n.isSelected,i=n.isSelectedStart,l=n.isSelectedEnd,s=a.isPreview(t),c=s.isPreview,u=s.isPreviewStart,d=s.isPreviewEnd,p=a.isDisabled(t),m=e===o().year();return f.createElement("div",{key:e,className:"month-picker-month\n ".concat(m?" current-month":"","\n ").concat(i?" selection-start":"","\n ").concat(l?" selection-end":"","\n ").concat(r?" active":"","\n ").concat(u?" preview-start":"","\n ").concat(d?" preview-end":"","\n ").concat(c?" preview":"","\n ").concat(p?" rdrDayDisabled":""),onClick:function(){return a.handleYearClick(t)},onMouseEnter:function(){return!p&&a.handleYearHover(t)},onMouseLeave:function(){return!p&&a.setState({previewStart:void 0,previewEnd:void 0})}},f.createElement("div",{className:"month-picker-month-text-wrapper"},f.createElement("div",{className:"month-picker-month-text"},f.createElement("span",null,e))))})))})))})),mn(Cn(a),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},a.renderDateDisplay(),a.renderDecadePicker(),a.renderYearGrid())})),a.COMPONENT_KEY=C();var r=o(),i=a.getDecade(r.year()),l=r.startOf("year"),s=r.endOf("year");return e.initialRange?(l=o(a.props.initialRange.startDate).startOf("year"),s=o(a.props.initialRange.endDate).endOf("year"),i=a.getDecade(s.year())):e.minDate&&e.maxDate&&(r.isBefore(o(e.minDate))||r.isAfter(o(e.maxDate)))&&(l=o(e.minDate).startOf("year"),s=o(e.maxDate).endOf("year")),a.state={selectedRange:a.props.initialRange,visibleDecade:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},a}return pn(n)}();mn(ii,"propTypes",{minDate:b.instanceOf(Date),maxDate:b.instanceOf(Date),initialRange:b.shape({startDate:b.instanceOf(Date),endDate:b.instanceOf(Date)}),onRangeSelection:b.func}),mn(ii,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var li=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r,i,l,s,c,u,d;return un(this,n),mn(Cn(d=t.call(this,e)),"handleSelect",(function(e){d.setState({selectedRange:e.selection},(function(){d.props.onSelection(e.selection)}))})),mn(Cn(d),"renderDateRangePicker",(function(){switch(d.props.type){case co:var e,t;return f.createElement(ri,{onRangeSelection:function(e){return d.props.onSelection(e)},minDate:null===(e=d.props.validRange)||void 0===e?void 0:e.startDate,maxDate:null===(t=d.props.validRange)||void 0===t?void 0:t.endDate,initialRange:d.state.selectedRange});case uo:var n,o;return f.createElement(ii,{onRangeSelection:function(e){return d.props.onSelection(e)},minDate:null===(n=d.props.validRange)||void 0===n?void 0:n.startDate,maxDate:null===(o=d.props.validRange)||void 0===o?void 0:o.endDate,initialRange:d.state.selectedRange});default:var a,r;return f.createElement(yt,{ref:function(e){return d.datePicker=e},ranges:[d.state.selectedRange],onChange:d.handleSelect,minDate:null===(a=d.props.validRange)||void 0===a?void 0:a.startDate,maxDate:null===(r=d.props.validRange)||void 0===r?void 0:r.endDate,dragSelectionEnabled:!1,rangeColors:[d.accentColor],showMonthAndYearPickers:!0})}})),mn(Cn(d),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker"},d.renderDateRangePicker())})),d.accentColor=Ua("accent-color"),d.state={selectedRange:{startDate:null!==(o=null!==(a=null===(r=e.initialRange)||void 0===r?void 0:r.startDate)&&void 0!==a?a:null===(i=e.validRange)||void 0===i?void 0:i.startDate)&&void 0!==o?o:new Date,endDate:null!==(l=null!==(s=null===(c=e.initialRange)||void 0===c?void 0:c.endDate)&&void 0!==s?s:null===(u=e.validRange)||void 0===u?void 0:u.endDate)&&void 0!==l?l:new Date,key:"selection"}},d}return pn(n)}();mn(li,"propTypes",{initialRange:b.shape({}),validRange:b.shape({}),type:b.string}),mn(li,"defaultProps",{initialRange:void 0,validRange:void 0,type:so});var si=["title","field","visible","hozAlign","vertAlign","headerHozAlign","width","minWidth","maxWidth","maxInitialWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","htmlOutput","print","clipboard","sorter","sorterParams","formatter","formatterParams","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","variableHeight","editable","editor","editorParams","validator","contextMenu","clickMenu","dblClickMenu","contextPopup","clickPopup","dblClickPopup","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","mutateLink","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","download","titleDownload","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellMouseDown","cellMouseUp","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerMouseEnter","headerMouseLeave","headerMouseOver","headerMouseOut","headerMouseMove","headerMouseDown","headerMouseUp","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerWordWrap","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","headerMenu","headerClickMenu","headerDblClickMenu","headerContextMenu","headerPopup","headerClickPopup","headerContextPopup"],ci=function(t){gn(r,f.Component);var a=Sn(r);function r(t){var i,l,s,c,u;return un(this,r),mn(Cn(u=a.call(this,t)),"componentDidMount",(function(){var e;(u._isMounted=!0,u.props.autoHeight)||(u.initialTableHeight=null===(e=u.tabulatorContainer)||void 0===e?void 0:e.clientHeight,u.lockedTableHeight=u.initialTableHeight);u.setState({firstRender:!1})})),mn(Cn(u),"shouldComponentUpdate",(function(e,t){return!(u.state.tabulatorMounted||!t.tabulatorMounted)||(u.props.rowChangeCount!==e.rowChangeCount||(!(!u.props.isAnimating||e.isAnimating)||(!(!u.state.datePickerColumn||t.datePickerColumn)||(u.props.hidden!==e.hidden||!u.props.hidden&&!Ma(u.props.columns,e.columns)||!(u.props.hidden&&e.hidden||u.state.scrollLoading&&t.scrollLoading||u.state.pageLoading&&t.pageLoading||u.props.isResizing&&e.isResizing||u.props.isAnimating&&e.isAnimating)&&(!Ma(u.props,e)||!Ma(u.state,t))))))})),mn(Cn(u),"getSnapshotBeforeUpdate",(function(e,t){var n,o;return(!u.props.isResizing&&e.isResizing||!u.props.isAnimating&&e.isAnimating||!u.state.firstRender&&t.firstRender||!u.props.hidden&&e.hidden&&!u.hasSetTableHeight)&&(o=!0),u.props.isResizing&&!e.isResizing&&(o=!0,n="100%"),{shouldSetTableHeight:o,newTableHeight:n}})),mn(Cn(u),"componentDidUpdate",(function(e,t,n){var o,a,r=n.shouldSetTableHeight,i=n.newTableHeight;(u.props.rowChangeCount!==e.rowChangeCount&&u.props.hidden&&u.setState({subscribedData:u.props.data}),r&&u.setTableHeight(i),!u.props.hidden&&e.hidden)&&(u.state.subscribedData?(u.updateData(u.state.subscribedData),u.setState({subscribedData:void 0})):null===(o=u.ref)||void 0===o||o.restoreRedraw());u.props.columns&&!Ma(u.props.columns,e.columns)&&(null===(a=u.ref)||void 0===a||null===(a=a.tabulator)||void 0===a||a.setColumns(u.getFilteredTabulatorColumnDefinitions()),u.setHeaderInputEventListeners(),u.setFilters());u.state.tabulatorMounted&&!t.tabulatorMounted&&(u.setHeaderInputEventListeners(),u.props.hidden||u.setTableHeight(),u.hasSetInitialParams=!0)})),mn(Cn(u),"componentWillUnmount",(function(){try{u._isMounted=!1,clearTimeout(u.clickListenerTimeout),clearTimeout(u.setDimensionsTimeout),clearTimeout(u.setStateTimeout),u.cancelCurrentRequest(),u.existingFilterTag=void 0,u.filterTagElements=void 0}catch(e){console.error(e)}})),mn(Cn(u),"setInfiniteScroll",(function(e){var t;null!==(t=u.ref)&&void 0!==t&&null!==(t=t.tabulator)&&void 0!==t&&t.options&&(e?(u.ref.tabulator.options.sortMode="remote",u.ref.tabulator.options.filterMode="remote",u.ref.tabulator.options.paginationMode="remote"):(u.ref.tabulator.options.sortMode="local",u.ref.tabulator.options.filterMode="local",u.ref.tabulator.options.paginationMode="local"))})),mn(Cn(u),"updateData",(function(e,t){var n;(null==e?void 0:e.length)===u.props.totalRows?u.setInfiniteScroll(!1):t&&u.setInfiniteScroll(!0),null===(n=u.ref)||void 0===n||n.updateData(e)})),mn(Cn(u),"onDataSorting",(function(e){if(u._isMounted){var t,o,a=e.map((function(e){return{dir:e.dir,field:e.field}}));null!==(t=u.tableParams)&&void 0!==t&&t.sort&&!n(a,null===(o=u.tableParams)||void 0===o?void 0:o.sort)&&(u.isSorting=!0,u.setLoading(!0))}})),mn(Cn(u),"onDataSorted",(function(e,t){u.isSorting&&(u.isSorting=!1,!u.useInfiniteScroll&&u.ref&&u.props.onSorterCallback(e),u.setLoading(!1))})),mn(Cn(u),"onDataFiltering",(function(){if(u._isMounted&&u.state.tabulatorMounted){var e,t,o=null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getHeaderFilters();o&&!n(o,null===(t=u.tableParams)||void 0===t?void 0:t.filter)&&(u.isFiltering=!0,u.setLoading(!0))}})),mn(Cn(u),"onDataFiltered",(function(e,t){if(u.isFiltering&&u.state.tabulatorMounted){var n;u.isFiltering=!1;var o=null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n?void 0:n.getHeaderFilters();u.useInfiniteScroll||(u.tableParams.filter=S(o),u.props.onFilterCallback(o,t)),setTimeout((function(){u._isMounted&&u.setState({loading:!1})}),0)}u.setFilterBadgeClasses()})),mn(Cn(u),"setLoading",(function(e){e!==u.state.loading&&u._isMounted&&u.setState({loading:e})})),mn(Cn(u),"isLoading",(function(){return u.state.loading||u.state.firstRender||u.state.pageLoading||u.state.scrollLoading||u.isFiltering||u.isSorting||!u.hasSetInitialParams})),mn(Cn(u),"onTableBuilt",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u._isMounted&&u.setState({tabulatorMounted:!0,pageLoading:!1});case 1:case"end":return e.stop()}}),e)})))),mn(Cn(u),"setTableHeight",(function(e){if(u.state.tabulatorMounted&&u.tabulatorContainer&&!u.props.isAnimating&&!u.props.isResizing&&!u.props.hidden){var t,n=null!=e?e:u.tabulatorContainer.clientHeight;if(n&&n!==u.lockedTableHeight)null===(t=u.ref)||void 0===t||null===(t=t.tabulator)||void 0===t||t.setHeight(n),u.lockedTableHeight=n,"100%"!==e&&(u.hasSetTableHeight=!0)}})),mn(Cn(u),"cancelCurrentRequest",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(u),"ajaxRequesting",(function(e,t){})),mn(Cn(u),"ajaxRequestFunc",function(){var t=cn(rn().mark((function t(o,a){var r,i,l,s,c,d,p,m,f,g,v,h,b,y;return rn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l=null!==(r=null===(i=u.props.response)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.data)&&void 0!==r?r:{},s=an(an({},l),{},{page:1,isPreviousData:!0}),t.prev=2,!u.props.hidden){t.next=5;break}return t.abrupt("return",s);case 5:if(d=(null==a?void 0:a.page)>1&&u.state.pageLoading,u.hasSetInitialData){t.next=9;break}return u.hasSetInitialData=!0,t.abrupt("return",s);case 9:if(!d){t.next=11;break}return t.abrupt("return",s);case 11:if(p=ni(u.tableParams,o.columns),m=ni(a,o.columns),!n(p,m)){t.next=15;break}return t.abrupt("return",s);case 15:if(u.tableParams=a,o.queryRequestData){t.next=19;break}return console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),t.abrupt("return",s);case 19:if(u.cancelCurrentRequest(),u.axiosSource=null===(c=E.CancelToken)||void 0===c?void 0:c.source(),!((null==a?void 0:a.page)>1)){t.next=29;break}return u._isMounted&&u.setState({scrollLoading:!0}),t.next=25,u.getNewPage(o,m);case 25:f=t.sent,u.props.onNewPage(null===(g=f)||void 0===g?void 0:g.rows),t.next=40;break;case 29:return u._isMounted&&u.setState({pageLoading:!0}),t.next=32,o.queryFn({tableFilters:null==m?void 0:m.filters,orders:null==m?void 0:m.sorters,cancelToken:u.axiosSource.token});case 32:return b=t.sent,u.queryID=null==b||null===(v=b.data)||void 0===v||null===(v=v.data)||void 0===v?void 0:v.query_id,f=an(an({},e(b,"data.data",{})),{},{page:1}),u.scrollLeft=null===(h=u.ref)||void 0===h||null===(h=h.tabulator)||void 0===h||null===(h=h.rowManager)||void 0===h||null===(h=h.element)||void 0===h?void 0:h.scrollLeft,t.next=38,Oa();case 38:u.props.onTableParamsChange(a,m),u.props.onNewData(b);case 40:return u.clearLoadingIndicators(),t.abrupt("return",f);case 44:if(t.prev=44,t.t0=t.catch(2),(null===t.t0||void 0===t.t0||null===(y=t.t0.data)||void 0===y?void 0:y.message)!==lr.CANCELLED){t.next=48;break}return t.abrupt("return",s);case 48:return console.error(t.t0),u.clearLoadingIndicators(),t.abrupt("return",s);case 51:case"end":return t.stop()}}),t,null,[[2,44]])})));return function(e,n){return t.apply(this,arguments)}}()),mn(Cn(u),"clearLoadingIndicators",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Oa();case 2:void 0!==u.scrollLeft&&(u.scrollLeft=void 0,u.ref.tabulator.rowManager.element.scrollLeft=u.scrollLeft),u._isMounted&&u.setState({loading:!1,scrollLoading:!1,pageLoading:!1});case 4:case"end":return e.stop()}}),e)})))),mn(Cn(u),"clearHeaderFilters",(function(){var e;null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e||e.clearHeaderFilter()})),mn(Cn(u),"getNewPage",(function(e,t){return We(an(an(an({},_o(e.authentication)),t),{},{queryId:u.queryID,cancelToken:u.axiosSource.token}))})),mn(Cn(u),"ajaxResponseFunc",(function(t,n){if(n){var o;if(!n.isPreviousData)null===(o=u.ref)||void 0===o||o.restoreRedraw();u.currentPage=n.page;var a=e(n,"rows.length",0)<t.pageSize;u.lastPage=a?u.currentPage:u.currentPage+1,u._isMounted&&(a&&!u.state.isLastPage?u.setState({isLastPage:!0}):!a&&u.state.isLastPage&&u.setState({isLastPage:!1}));var r={};return r.data=n.rows,r.last_page=u.lastPage,r}return{data:[],last_page:u.lastPage}})),mn(Cn(u),"cellClick",(function(e,t){u.props.onCellClick(t)})),mn(Cn(u),"copyToClipboard",(function(){var e;u._isMounted&&null!==(e=u.ref)&&void 0!==e&&e.tabulator&&u.ref.tabulator.copyToClipboard("active",!0)})),mn(Cn(u),"saveAsCSV",(function(e){try{var t;if(u._isMounted&&null!==(t=u.ref)&&void 0!==t&&t.tabulator){var n=S(u.ref.tabulator);return new Promise((function(t,o){setTimeout((function(){n.download("csv","export.csv",{delimiter:","}),n=void 0,t()}),e)}))}}catch(e){console.error(e)}return Promise.reject()})),mn(Cn(u),"debounceSetState",(function(e){u.stateToSet=an(an({},u.stateToSet),e),clearTimeout(u.setStateTimeout),u.setStateTimeout=setTimeout((function(){u._isMounted&&(u.setState(u.stateToSet),u.stateToSet={})}),50)})),mn(Cn(u),"inputKeydownListener",(function(){var e;u.useInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),mn(Cn(u),"inputSearchListener",(function(){var e;u.useInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),mn(Cn(u),"inputDateSearchListener",(function(){u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0})})),mn(Cn(u),"inputDateClickListener",(function(e,t){var n=e.target.getBoundingClientRect(),o=u.tableContainer.getBoundingClientRect();null!=n&&n.top&&null!=n&&n.left&&u.debounceSetState({datePickerLocation:{top:n.top-o.top+n.height+5,left:n.left-o.left},datePickerColumn:t})})),mn(Cn(u),"inputDateKeypressListener",(function(e){e.stopPropagation(),e.preventDefault()})),mn(Cn(u),"renderHeaderInputClearBtn",(function(e,t){var n=document.createElement("span");n.innerHTML="&#x00d7;";var o=document.createElement("div");o.className="react-autoql-input-clear-btn",o.id="react-autoql-clear-btn-".concat(u.TABLE_ID,"-").concat(t.field),o.setAttribute("data-for",u.props.tooltipID),o.setAttribute("data-tip","Clear filter"),o.appendChild(n),o.addEventListener("click",(function(n){n.stopPropagation(),u.setHeaderInputValue(e,""),"DATE"!==t.type||t.pivot||(u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0}))})),e.parentNode.appendChild(o)})),mn(Cn(u),"setHeaderInputEventListeners",(function(){var e=u.props.columns;e&&e.forEach((function(e){var t=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-content input'));if(t&&(t.removeEventListener("keydown",u.inputKeydownListener),t.addEventListener("keydown",u.inputKeydownListener),document.querySelector("#react-autoql-clear-btn-".concat(u.TABLE_ID,"-").concat(e.field))||u.renderHeaderInputClearBtn(t,e),"DATE"===e.type&&!e.pivot)){t.removeEventListener("click",(function(t){return u.inputDateClickListener(t,e)})),t.addEventListener("click",(function(t){return u.inputDateClickListener(t,e)}));["keypress","keydown","keyup"].forEach((function(e){t.removeEventListener(e,u.inputDateKeypressListener),t.addEventListener(e,u.inputDateKeypressListener)}))}}))})),mn(Cn(u),"setFilterBadgeClasses",(function(){var e;u._isMounted&&u.state.tabulatorMounted&&(null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e||null===(e=e.getColumns())||void 0===e||e.forEach((function(e){var t,n=!(null===(t=u.tableParams)||void 0===t||null===(t=t.filter)||void 0===t||!t.find((function(t){return t.field===e.getField()}))),o=null==e?void 0:e.getElement();n?null==o||o.classList.add("is-filtered"):null==o||o.classList.remove("is-filtered")})))})),mn(Cn(u),"setFilters",(function(){var e,t=null===(e=u.tableParams)||void 0===e?void 0:e.filter;u.settingFilterInputs=!0,t&&t.forEach((function(e,t){try{var n,o;if(null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n||n.setHeaderFilterValue(e.field,e.value),!u.useInfiniteScroll)null===(o=u.ref)||void 0===o||null===(o=o.tabulator)||void 0===o||o.setFilter(e.field,e.type,e.value)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingFilterInputs=!1})),mn(Cn(u),"onDateRangeSelectionApplied",(function(){u.setState({datePickerColumn:void 0});var e=u.state.datePickerColumn;if(u.state.dateRangeSelection){var t=u.state.dateRangeSelection,n=t.startDate,a=t.endDate;if(e){var r=n,i=a;n&&!a?i=r:!n&&a&&(r=i);var l=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-content input'));if(l){var s=Er(e),c=bo[s],d=o(r).format(c),p=o.utc(d).toISOString(),m=o(p).utc().format(c),f=o(i).format(c),g=o.utc(f).toISOString(),v=o(g).utc().format(c),h="".concat(m," to ").concat(v);m===v&&(h=m),u.setHeaderInputValue(l,h),u.currentDateRangeSelections=mn({},e.field,u.state.dateRangeSelection)}}}})),mn(Cn(u),"onDateRangeSelection",(function(e){u.setState({dateRangeSelection:e})})),mn(Cn(u),"setSorters",(function(){var e,t=null===(e=u.tableParams)||void 0===e?void 0:e.sort;u.settingSorters=!0,t&&t.forEach((function(e,t){try{var n;null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n||n.setSort(e.field,e.dir)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingSorters=!1})),mn(Cn(u),"toggleIsFiltering",(function(e,t){var n,o;t&&null!==(n=u.tableParams)&&void 0!==n&&null!==(n=n.filter)&&void 0!==n&&n.length&&(null===(o=u.ref)||void 0===o||null===(o=o.tabulator)||void 0===o||null===(o=o.getColumns())||void 0===o?void 0:o.find((function(e){var t;return e.getField()===(null===(t=u.tableParams.filter[0])||void 0===t?void 0:t.field)}))).scrollTo("middle");var a=!u.state.isFiltering;return"boolean"==typeof e&&(a=e),u._isMounted&&u.setState({isFiltering:a}),a})),mn(Cn(u),"setHeaderInputValue",(function(e,t){var n;e&&(e.focus(),null===(n=u.ref)||void 0===n||n.restoreRedraw(),e.value=t,e.title=t,e.blur())})),mn(Cn(u),"renderEmptyPlaceholderText",(function(){return f.createElement("div",{className:"table-loader table-page-loader table-placeholder"},f.createElement("div",null,"No data matching your query"))})),mn(Cn(u),"renderPageLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(Ro,null)))})),mn(Cn(u),"renderScrollLoader",(function(){return f.createElement("div",{className:"table-loader table-scroll-loader"},f.createElement(Ro,null))})),mn(Cn(u),"renderDateRangePickerPopover",(function(){var e,t,n;return u.state.datePickerColumn?f.createElement(Xn,{isOpen:!!u.state.datePickerColumn,align:"start",positions:["bottom","right","left","top"],onClickOutside:function(e){e.stopPropagation(),u._isMounted&&u.setState({datePickerColumn:void 0})},content:f.createElement("div",{className:"react-autoql-popover-date-picker"},f.createElement("h3",null,u.state.datePickerColumn.display_name),f.createElement(li,{initialRange:null===(e=u.currentDateRangeSelections)||void 0===e?void 0:e[u.state.datePickerColumn.field],onSelection:u.onDateRangeSelection,validRange:u.state.datePickerColumn.dateRange,type:u.state.datePickerColumn.precision}),f.createElement(wo,{type:"primary",onClick:u.onDateRangeSelectionApplied},"Apply"))},f.createElement("div",{style:{position:"absolute",top:null===(t=u.state.datePickerLocation)||void 0===t?void 0:t.top,left:null===(n=u.state.datePickerLocation)||void 0===n?void 0:n.left}})):null})),mn(Cn(u),"getFilteredTabulatorColumnDefinitions",(function(){try{var e;if(null!==(e=u.props.columns)&&void 0!==e&&e.length)return u.props.columns.map((function(e){var t={};return Object.keys(e).forEach((function(n){si.includes(n)&&(t[n]=e[n])})),t}))}catch(e){console.error(e)}return[]})),mn(Cn(u),"renderTableRowCount",(function(){var e,t=null===(e=u.props.data)||void 0===e?void 0:e.length,n=u.props.totalRows;if(!(u.props.enableAjaxTableData&&n&&t))return null;var o=u.getTabulatorRowCount();return u.useInfiniteScroll||void 0===o||(t=o,n=o),f.createElement("div",{className:"table-row-count"},f.createElement("span",null,"Scrolled ".concat(t," / ").concat(n," rows")))})),mn(Cn(u),"getTabulatorRowCount",(function(){var e;return null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getDataCount("active")})),mn(Cn(u),"getTabulatorHeaderFilters",(function(){var e;if(u._isMounted&&u.state.tabulatorMounted)return null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getHeaderFilters()})),mn(Cn(u),"isTableEmpty",(function(){var e;if(0===(null===(e=u.props.data)||void 0===e?void 0:e.length))return!0;var t=u.getTabulatorRowCount();return!!(u.props.rowChangeCount>0&&u.state.tabulatorMounted&&0===t)})),mn(Cn(u),"render",(function(){var e=u.isTableEmpty();return f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-table-container-".concat(u.TABLE_ID),ref:function(e){return u.tableContainer=e},"data-test":"react-autoql-table",style:u.props.style,className:"react-autoql-table-container \n ".concat(u.state.pageLoading||!u.state.tabulatorMounted?"loading":"","\n ").concat(u.props.supportsDrilldowns?"supports-drilldown":"","\n ").concat(u.state.isFiltering?"filtering":"","\n ").concat(u.props.isResizing?"resizing":"","\n ").concat(u.props.isAnimating?"animating":"","\n ").concat(u.useInfiniteScroll?"infinite":"limited","\n ").concat(u.useInfiniteScroll&&u.state.isLastPage?"last-page":"","\n ").concat(u.props.pivot?"pivot":"","\n ").concat(u.props.hidden?"hidden":"","\n ").concat(e?"empty":"")},f.createElement("div",{ref:function(e){return u.tabulatorContainer=e},className:"react-autoql-tabulator-container"},!!u.props.data&&!!u.props.columns&&(u.props.autoHeight||!u.state.firstRender)&&f.createElement(f.Fragment,null,f.createElement(ti,{ref:function(e){return u.ref=e},height:u.initialTableHeight,tableKey:"react-autoql-table-".concat(u.TABLE_ID),id:"react-autoql-table-".concat(u.TABLE_ID),key:"react-autoql-table-wrapper-".concat(u.TABLE_ID),"data-test":"autoql-tabulator-table",columns:u.getFilteredTabulatorColumnDefinitions(),data:u.props.data,options:u.tableOptions,hidden:u.props.hidden,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",onTableBuilt:u.onTableBuilt,onCellClick:u.cellClick,onDataSorting:u.onDataSorting,onDataSorted:u.onDataSorted,onDataFiltering:u.onDataFiltering,onDataFiltered:u.onDataFiltered,pivot:u.props.pivot}),e&&u.renderEmptyPlaceholderText(),(u.state.pageLoading||!u.state.tabulatorMounted)&&u.renderPageLoader(),u.state.scrollLoading&&u.renderScrollLoader())),u.renderDateRangePickerPopover(),!e&&u.renderTableRowCount()))})),u.TABLE_ID=C(),u.hasSetInitialData=!1,u.hasSetInitialParams=!1,u.currentPage=1,u.lastPage=(null===(i=t.data)||void 0===i?void 0:i.length)<t.pageSize?1:2,u.filterTagElements=[],u.queryID=t.queryID,u.isFiltering=!1,u.isSorting=!1,u.tableParams=null!==(l=S(t.initialParams))&&void 0!==l?l:{filter:[],sort:[]},u.useInfiniteScroll=t.useInfiniteScroll,u.tableOptions={selectableCheck:function(){return!1},initialSort:u.useInfiniteScroll||null===(s=u.tableParams)||void 0===s?void 0:s.sort,initialFilter:u.useInfiniteScroll||null===(c=u.tableParams)||void 0===c?void 0:c.filter,progressiveLoadScrollMargin:100,downloadEncoder:function(e,t){return new Blob([e],{type:t})}},u.useInfiniteScroll&&(u.tableOptions.sortMode="remote",u.tableOptions.filterMode="remote",u.tableOptions.paginationMode="remote",u.tableOptions.progressiveLoad="scroll",u.tableOptions.ajaxURL="https://required-placeholder-url.com",u.tableOptions.paginationSize=t.pageSize,u.tableOptions.paginationInitialPage=1,u.tableOptions.ajaxRequesting=function(e,n){return u.ajaxRequesting(t,n)},u.tableOptions.ajaxRequestFunc=function(e,n,o){return u.ajaxRequestFunc(t,o)},u.tableOptions.ajaxResponse=function(e,n,o){return u.ajaxResponseFunc(t,o)}),u.state={isFiltering:!1,isSorting:!1,loading:!1,pageLoading:!1,scrollLoading:!1,isLastPage:1===u.lastPage,ref:null,subscribedData:void 0,firstRender:!0},u}return pn(r)}();mn(ci,"propTypes",{data:b.arrayOf(b.array),columns:b.arrayOf(b.shape({})),shouldRender:b.bool,onFilterCallback:b.func,onSorterCallback:b.func,onTableParamsChange:b.func,isResizing:b.bool,pageSize:b.number,useInfiniteScroll:b.bool,onSetTableHeight:b.func,onRenderComplete:b.func}),mn(ci,"defaultProps",{queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:void 0,useInfiniteScroll:!0,source:null,shouldRender:!0,autoHeight:!0,onFilterCallback:function(){},onSorterCallback:function(){},onTableParamsChange:function(){},onCellClick:function(){},onErrorCallback:function(){},onSetTableHeight:function(){},onRenderComplete:function(){}});var ui={dataFormatting:or,data:b.arrayOf(b.array).isRequired,columns:b.arrayOf(b.shape({})).isRequired,numberColumnIndices:b.arrayOf(b.number).isRequired,stringColumnIndices:b.arrayOf(b.number).isRequired,stringColumnIndex:b.number.isRequired,numberColumnIndex:b.number.isRequired,legendColumnIndex:b.number,enableDynamicCharting:b.bool,legendLocation:b.string,isResizing:b.bool,onLegendClick:b.func,onLabelChange:b.func,onXAxisClick:b.func,onYAxisClick:b.func},di={dataFormatting:qo,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},pi=an(an({},ui),{},{visibleSeriesIndices:b.arrayOf(b.number).isRequired,height:b.number.isRequired,width:b.number.isRequired,deltaX:b.number,deltaY:b.number}),mi=an(an({},di),{},{deltaX:0,deltaY:0}),fi=an(an({},pi),{},{xScale:b.func.isRequired,yScale:b.func.isRequired,innerHeight:b.number,innerWidth:b.number,onLabelRotation:b.func}),gi=an(an({},mi),{},{innerHeight:0,innerWidth:0,onLabelRotation:function(){}}),vi=an(an({},pi),{},{xScale:b.func.isRequired,yScale:b.func.isRequired}),hi={activeKey:void 0,onChartClick:function(){}},bi=function(e){var t=null==e?void 0:e.domain();if(!(null==t?void 0:t.length))return(null==e?void 0:e(0))||0;var n=t[0],o=t[(null==t?void 0:t.length)-1];return e(n>0&&o>0?n:n<0&&o<0?o:0)},yi=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return"".concat(e,"-").concat(t,"-").concat(n)},Ci=function(e){var t=e.row,n=e.columns,o=e.colIndex,a=e.colIndex2,r=e.legendColumn,i=e.dataFormatting,l=e.aggregated,s=void 0===l||l;try{var c,u,d="",p="",m="",f=n[o],g=n[a];if(r&&null!=f&&f.origColumn)d="<div><strong>".concat(null!==(c=r.tooltipTitle)&&void 0!==c?c:r.title,":</strong> ").concat(null!==(u=f.tooltipTitle)&&void 0!==u?u:f.title,"</div>");if(f){var v,h,b=f.origColumn?null!==(v=f.origColumn.tooltipTitle)&&void 0!==v?v:f.origColumn.title:null!==(h=f.tooltipTitle)&&void 0!==h?h:f.title;if(s){var y,C=null===(y=Ge[f.aggType])||void 0===y?void 0:y.displayName;C&&(b="".concat(b," (").concat(C,")"))}var E=aa({element:t[o]||0,column:n[o],config:i,isChart:!0});p="<div><strong>".concat(b,":</strong> ").concat(E,"</div>")}if(g){var S,T=null!==(S=g.tooltipTitle)&&void 0!==S?S:g.title,D=aa({element:t[a],column:g,config:i,isChart:!0});m="<div><strong>".concat(T,":</strong> ").concat(D,"</div>")}return"<div>\n ".concat(d,"\n ").concat(p,"\n ").concat(m,"\n </div>")}catch(e){return console.error(e),null}},Ei=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return console.error(e),0}},Si=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",o="bottom",a=Pe?o:n;if("column_line"===t)return o;var r=["pie","heatmap","bubble","scatterplot","histogram"];return(null==e?void 0:e.length)<2||r.includes(t)?void 0:"stacked_column"===t||"stacked_bar"===t||"stacked_line"===t||(null==e?void 0:e.length)>2||(null==e?void 0:e.length)>1?a:void 0},Ti=function(e){var t=e.filter((function(e){return!!e}));if(null!=t&&t.length)try{var n,o,a,r;return t.forEach((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.left,i=e.bottom,l=e.right,s=e.top;if(!(isNaN(t)||isNaN(i)||isNaN(l)||isNaN(s))){var c=l-t,u=i-s;c<=0&&u<=0||((void 0===n||t<n)&&(n=t),(void 0===o||i>o)&&(o=i),(void 0===a||l>a)&&(a=l),(void 0===r||s<r)&&(r=s))}})),{x:n,y:r,height:Math.abs(o-r),width:Math.abs(a-n)}}catch(e){return void console.error(e)}},Di=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.renderAllLegends()})),mn(Cn(o),"shouldComponentUpdate",(function(e){return!Ma(o.props.columns,e.columns)||(o.props.height!==e.height||o.props.outerHeight!==e.outerHeight)})),mn(Cn(o),"componentDidUpdate",(function(){o.renderAllLegends()})),mn(Cn(o),"componentWillUnmount",(function(){var e;null===(e=o.legendElements)||void 0===e||e.forEach((function(e){return Ia(e)}))})),mn(Cn(o),"getTotalLeftPadding",(function(){return o.props.paddingLeft+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalRightPadding",(function(){return o.props.paddingRight+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalHorizontalPadding",(function(){return o.getTotalLeftPadding()+o.getTotalRightPadding()})),mn(Cn(o),"getTotalBottomPadding",(function(){return o.props.paddingBottom+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalTopPadding",(function(){return o.props.paddingTop+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalVerticalPadding",(function(){return o.getTotalBottomPadding()+o.getTotalTopPadding()})),mn(Cn(o),"getMaxLegendHeight",(function(){return"vertical"===o.props.orientation?o.props.height-o.getTotalVerticalPadding():Math.floor(.5*o.props.outerHeight)-Math.ceil(2*o.BORDER_PADDING)})),mn(Cn(o),"getMaxSectionWidth",(function(){var e=o.DEFAULT_MAX_WIDTH;if("horizontal"===o.props.orientation){var t=o.getTotalHorizontalPadding(),n=1*o.HORIZONTAL_LEGEND_SPACING,a=2*o.props.chartPadding,r=o.props.outerWidth-t-n-a,i=Math.floor(r/2);i<o.DEFAULT_MAX_WIDTH&&(e=i)}return e})),mn(Cn(o),"renderAllLegends",(function(){var e;o.legendLabels1=Xe(o.props.columns,o.props.colorScale,o.props.legendColumnIndices),o.legendLabels2=o.props.hasSecondAxis?o.legendLabels2=Xe(o.props.columns,o.props.colorScale2,o.props.numberColumnIndices2):[],o.legendLabelSections=o.getlegendLabelSections(o.legendLabels1,o.legendLabels2),null===(e=o.legendLabelSections)||void 0===e||e.forEach((function(e,t){o.renderLegend(e,t)})),o.justMounted&&(o.justMounted=!1,o.props.onRenderComplete())})),mn(Cn(o),"distributeListsEvenly",(function(e,t,n){var o,a,r=S(e),i=S(t),l=null!==(o=null==r?void 0:r.length)&&void 0!==o?o:0,s=null!==(a=null==i?void 0:i.length)&&void 0!==a?a:0,c=l+s,u=l/c,d=Math.round(u*n);s&&(d===n&&n>1&&(d=n-1),0===d&&n>1&&(d=1));for(var p=Tn(new Array(n)).map((function(){return[]})),m=function(e){p.forEach((function(t,n){var o=n>=d,a=o?i:r;if(a.length>0){var l=a.shift();l.legendNumber=o?2:1,l.legendSectionIndex=e,(0===n||n===d)&&(l.isFirst=!0),t.push(l)}}))},f=0;f<c;f++)m(f);return p})),mn(Cn(o),"getlegendLabelSections",(function(e,t){var n,a,r=o.totalPossibleSections,i=(null!==(n=null==e?void 0:e.length)&&void 0!==n?n:0)+(null!==(a=null==t?void 0:t.length)&&void 0!==a?a:0);return i<o.totalPossibleSections&&(r=i),o.distributeListsEvenly(e,t,r)})),mn(Cn(o),"removeHiddenLegendLabels",(function(e){var t,n,a,r=null===(t=o.legendBorder)||void 0===t?void 0:t.getBoundingClientRect(),i=(null!==(n=null==r?void 0:r.y)&&void 0!==n?n:0)+(null!==(a=null==r?void 0:r.height)&&void 0!==a?a:0)-o.BORDER_PADDING,l=!1,s=void 0,c=void 0;if(St(e).selectAll(".cell").each((function(){if(l)St(this).remove();else{var e,t,n=this.getBoundingClientRect();if((null!==(e=null==n?void 0:n.y)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.height)&&void 0!==t?t:0)>i){var o,a,r=this.getBBox();s=(null!==(o=null==r?void 0:r.y)&&void 0!==o?o:0)+(null!==(a=null==r?void 0:r.height)&&void 0!==a?a:0),c=St(this).attr("transform"),St(this).remove(),l=!0}}})),l&&c){var u=o.props.chartTooltipID;St(e).select(".legend-hidden-field-arrow").remove(),St(e).append("text").html("&#9660 ...").attr("class","legend-hidden-field-arrow").attr("y",s).attr("transform",c).attr("data-tip","Some legend fields are hidden. Please expand the chart size to view them.").attr("data-for",u).style("font-size","".concat(o.props.fontSize-3,"px")).style("color","red").style("font-weight","bold").style("cursor","default")}})),mn(Cn(o),"styleLegendTitleNoBorder",(function(e,t){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).style("transform","translateY(-5px)")})),mn(Cn(o),"styleLegendTitleWithBorder",(function(e){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").append("tspan").text(" ▼").style("font-size","8px").style("opacity",0).attr("class","react-autoql-axis-selector-arrow"),o.titleBBox={};try{o.titleBBox=St(e).select(".legendTitle").node().getBBox()}catch(e){console.error(e)}})),mn(Cn(o),"onClick",(function(e,t){var n=null==t?void 0:t.find((function(t){return t.label===e}));if(n){var a=!n.hidden,r=null==t?void 0:t.filter((function(e){return!e.hidden}));(!a||(null==r?void 0:r.length)>1)&&o.props.onLegendClick(n)}})),mn(Cn(o),"getLegendTitleCase",(function(e){return(null==e?void 0:e.length)<2?e:e[0].toUpperCase()+e.substring(1)})),mn(Cn(o),"getLegendTitleFromColumns",(function(e){var t,n;if(o.props.isAggregated)return null!==(t=null===(n=o.props.legendColumn)||void 0===n?void 0:n.display_name)&&void 0!==t?t:"Legend";var a="Fields",r=e.map((function(e){return o.props.columns[e]})),i=e.map((function(e){return o.props.columns[e].type})),l=!i.find((function(e){return e!==i[0]}));if(o.props.hasSecondAxis&&l){var s=ao[i[0]];s&&(a="".concat(s," ").concat(a))}var c=r.map((function(e){return e.aggType}));if(!c.find((function(e){return e!==c[0]}))){var u,d=null===(u=Ge[c[0]])||void 0===u?void 0:u.displayName;d&&(a="".concat(a," (").concat(d,")"))}return a})),mn(Cn(o),"renderLegend",(function(e,t){try{var n,a,r=Cn(o);if(null==e||!e.length)return;var i=null===(n=e[0])||void 0===n?void 0:n.legendNumber,l=2===i?o.props.numberColumnIndices2:o.props.legendColumnIndices,s=!(null===(a=e[0])||void 0===a||!a.isFirst),c=o.legendElements[t],u=2===i,d=2===i?o.legendLabels2:o.legendLabels1,p=o.getLegendTitleCase(o.getLegendTitleFromColumns(l)),m=o.getLegendScale(e),f=o.getMaxSectionWidth(),g=Je().orient("vertical").path(Lt().type(Mt).size(o.SHAPE_SIZE)()).shapePadding(8).labelWrap(f-20).labelOffset(10).scale(m).title(p).titleWidth(f).on("cellclick",(function(e){r.onClick(e,d)}));if(u?g.shape("line"):o.props.shape&&g.shape(o.props.shape),St(c).call(g).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","".concat(o.props.fontSize,"px")),St(c).selectAll(".cell").style("font-size","".concat(o.props.fontSize-2,"px")),t>0){var v=Ti(o.legendElements.filter((function(e,n){return e&&n<t})).map((function(e){return e.getBoundingClientRect()})));if("vertical"===o.props.orientation){var h,b=(null!==(h=null==v?void 0:v.height)&&void 0!==h?h:0)+o.VERTICAL_LEGEND_SPACING;St(c).attr("transform","translate(0,".concat(b,")"))}else if("horizontal"===o.props.orientation){var y,C=(null!==(y=null==v?void 0:v.width)&&void 0!==y?y:0)+o.HORIZONTAL_LEGEND_SPACING;St(c).attr("transform","translate(".concat(C,",0)"))}}o.applyTitleStyles(p,s,c);var E=Ti(o.legendElements.map((function(e){return null==e?void 0:e.getBoundingClientRect()})));o.combinedLegendWidth=isNaN(null==E?void 0:E.width)?0:null==E?void 0:E.width,o.combinedLegendHeight=isNaN(null==E?void 0:E.height)?0:null==E?void 0:E.height;var S=o.getTotalHorizontalPadding(),T=o.getTotalVerticalPadding(),D=o.props.outerWidth-S,x=o.getMaxLegendHeight(),R=o.combinedLegendHeight<=x?o.combinedLegendHeight:x,I=o.combinedLegendWidth<=D?o.combinedLegendWidth:D;St(o.legendClippingContainer).attr("height",R+T).attr("width",I+S),St(o.legendBorder).attr("height",R+2*o.BORDER_PADDING).attr("width",I+2*o.BORDER_PADDING),o.removeHiddenLegendLabels(c),o.applyStylesForHiddenSeries(c,e)}catch(e){console.error(e)}})),mn(Cn(o),"applyTitleStyles",(function(e,t,n){e&&(o.props.onLegendTitleClick?o.styleLegendTitleWithBorder(n,t):o.styleLegendTitleNoBorder(n),t||St(n).select(".legendTitle").style("fill-opacity",0))})),mn(Cn(o),"applyStylesForHiddenSeries",(function(e,t){try{St(e).selectAll(".cell").each((function(e){var n=t.find((function(t){return t.label===e}));n&&(St(this).select(".swatch").attr("stroke",n.color).attr("stroke-location","outside"),n.hidden?St(this).attr("class","cell hidden"):St(this).attr("class","cell visible"))}))}catch(e){console.error(e)}})),mn(Cn(o),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return Ct().domain(e.map((function(e){return e.label}))).range(t)})),mn(Cn(o),"renderLegendSections",(function(){if("horizontal"===o.props.orientation){var e=o.getMaxSectionWidth(),t=o.getTotalHorizontalPadding(),n=o.props.outerWidth-t,a=n-o.HORIZONTAL_LEGEND_SPACING*(Math.ceil(n/e)-1),r=Math.floor(a/e);o.totalPossibleSections=r>=2?r:2}else o.props.hasSecondAxis&&(o.totalPossibleSections=2);return o.totalPossibleSections||(o.totalPossibleSections=1),Tn(new Array(o.totalPossibleSections)).map((function(e,t){return f.createElement("g",{ref:function(e){return o.legendElements[t]=e},key:"".concat(o.LEGEND_ID,"-").concat(t),"data-test":"react-autoql-legend",className:"legendOrdinal react-autoql-legend"})}))})),mn(Cn(o),"renderLegendBorder",(function(){return f.createElement("rect",{ref:function(e){return o.legendBorder=e},width:0,height:0,rx:2,transform:"translate(".concat(-o.BORDER_PADDING-o.BORDER_THICKNESS,",").concat(-o.BORDER_PADDING-o.TOP_ADJUSTMENT-o.BORDER_THICKNESS,")"),style:{stroke:"var(--react-autoql-border-color)",fill:"transparent",pointerEvents:"none",strokeOpacity:.6}})})),mn(Cn(o),"renderLegendClippingContainer",(function(e,t){return f.createElement("rect",{ref:function(e){return o.legendClippingContainer=e},width:0,height:0,rx:4,transform:"translate(".concat(-e,",").concat(-t,")"),style:{stroke:"transparent",fill:"transparent",pointerEvents:"none"}})})),mn(Cn(o),"render",(function(){var e=o.getTotalLeftPadding(),t=o.getTotalTopPadding()+o.TOP_ADJUSTMENT;return f.createElement("g",{"data-test":"legend",transform:"translate(".concat(e,", ").concat(t,")")},o.renderLegendSections(),o.renderLegendClippingContainer(e,t),o.renderLegendBorder())})),o.legendElements=[],o.legendLabels1=[],o.legendLabels2=[],o.LEGEND_ID="axis-".concat(C()),o.BORDER_PADDING=Pe?10:15,o.BORDER_THICKNESS=1,o.HORIZONTAL_LEGEND_SPACING=Pe?15:20,o.VERTICAL_LEGEND_SPACING=Pe?15:25,o.SHAPE_SIZE=Pe?50:75,o.TOP_ADJUSTMENT=Pe?12:15,o.DEFAULT_MAX_WIDTH=Pe?100:140,o.justMounted=!0,o}return pn(n)}();mn(Di,"propTypes",{title:b.string,paddingLeft:b.number,paddingRight:b.number,paddingTop:b.number,paddingBottom:b.number,legendColumn:b.shape({}),orientation:b.string,onLabelChange:b.func,onLegendClick:b.func,onLegendTitleClick:b.func,numberColumnIndices:b.arrayOf(b.number),topMargin:b.number,bottomMargin:b.number,scale:b.func,translate:b.string,height:b.number,width:b.number,onRenderComplete:b.func}),mn(Di,"defaultProps",{title:void 0,paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,fontSize:11,onLabelChange:function(){},onLegendClick:function(){},onRenderComplete:function(){},translate:void 0,orientation:"vertical"});var xi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"render",(function(){return f.createElement("rect",fn({},o.props.childProps,{className:"axis-scaler-border","data-test":"axis-scaler-border",fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4",onClick:o.props.toggleChartScale}))})),o}return pn(n)}(),Ri=["label","type","indeterminate","hasError","style","onChange","checked"],Ii=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"ID",C()),mn(Cn(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),mn(Cn(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),mn(Cn(e),"onCheckedChange",(function(t){e.props.onChange(t)})),mn(Cn(e),"render",(function(){var t=e.props,n=t.label,o=t.type;t.indeterminate;var a=t.hasError;t.style,t.onChange,t.checked;var r=yn(t,Ri),i="\n react-autoql-checkbox\n ".concat("switch"===o&&"react-autoql-checkbox--switch","\n ").concat(a&&"react-autoql-checkbox--has-error","\n "),l="\n react-autoql-checkbox__input\n ".concat("switch"===o?"react-autoql-checkbox--switch__input":"react-autoql-checkbox--checkbox__input","\n ").concat(a?"react-autoql-checkbox--has-error__input":"","\n ");return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox-container",style:e.props.style},f.createElement("div",{className:i},f.createElement("input",fn({},r,{type:"checkbox","data-test":"react-autoql-checkbox",className:l,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,disabled:e.props.disabled,onClick:function(e){return e.stopPropagation()},onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&f.createElement("div",{className:"react-autoql-checkbox-tick"},f.createElement(Wn,{type:"check"})),n&&f.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return pn(n)}();mn(Ii,"propTypes",{hasError:b.bool,indeterminate:b.bool,label:b.string,type:b.oneOf(["default","switch"]),checked:b.bool,onChange:b.func}),mn(Ii,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Ai=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"selectAll",(function(){var e=[];o.props.items.forEach((function(t,n){t.disabled||e.push(n)})),o.setState({selected:e})})),mn(Cn(o),"unselectAll",(function(){o.setState({selected:[]})})),mn(Cn(o),"interpolateArray",(function(e,t){for(var n=Math.min(e,t),o=Math.max(e,t),a=[],r=n;r<=o;r++)a.push(r);return a})),mn(Cn(o),"handleShiftSelect",(function(e,t){if(o.state.selected.length){var n=Math.min.apply(Math,Tn(o.state.selected)),a=[e];e<n?a=o.interpolateArray(e,n):e>n&&(a=o.interpolateArray(n,e));var r=(a=a.filter((function(e){return!o.props.items[e].disabled}))).map((function(e){return an({},o.props.items[e])}));o.props.onSelect(a,r),o.setState({selected:a})}else o.props.onSelect([e],[t]),o.setState({selected:[e]})})),mn(Cn(o),"handleCtrlSelect",(function(e){var t=[];t=o.state.selected.includes(e)?o.state.selected.filter((function(t){return t!==e})):[].concat(Tn(o.state.selected),[e]),o.props.onSelect(t),o.setState({selected:t})})),mn(Cn(o),"checkAll",(function(){var e=o.props.items.map((function(e){return an(an({},e),{},{checked:!e.disabled||e.checked})}));o.props.onChange(e,e,!0)})),mn(Cn(o),"unCheckAll",(function(){var e=o.props.items.map((function(e){return an(an({},e),{},{checked:!!e.disabled&&e.checked})}));o.props.onChange(e,e,!1)})),mn(Cn(o),"handleMultipleCheck",(function(e){var t=o.state.selected,n=t.every((function(t){return e[t].checked})),a=!0,r=o.props.items.map((function(e,o){return n&&t.includes(o)?(a=!1,an(an({},e),{},{checked:!1})):t.includes(o)?an(an({},e),{},{checked:!0}):e}));o.props.onChange(r,t,a)})),mn(Cn(o),"render",(function(){var e,t=o.props.items;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list"},!(null===(e=o.props.columns)||void 0===e||!e.length)&&f.createElement("div",{className:"col-visibility-header"},o.props.columns.map((function(e,n){if(n===o.props.columns.length-1){var a=t.find((function(e){return e.checked}))&&t.every((function(e){return e.checked||e.disabled}));return f.createElement("div",{key:"list-header-".concat(n)},e.name,f.createElement(Ii,{checked:a,disabled:t.every((function(e){return e.disabled})),style:{marginLeft:"10px"},onChange:function(e){a?o.unCheckAll():o.checkAll()}}))}return f.createElement("div",{key:"list-header-".concat(n)},e.name)}))),!(null==t||!t.length)&&t.map((function(e,n){var a;return f.createElement("div",{key:null!==(a=e.key)&&void 0!==a?a:"list-item-".concat(n,"-").concat(o.KEY),className:"react-autoql-list-item\n ".concat(o.state.selected.includes(n)?"selected":"","\n ").concat(e.disabled?"disabled":"","\n ").concat(e.checked?"checked":""),onClick:function(t){t.shiftKey?o.handleShiftSelect(n,e):t.ctrlKey||t.metaKey?o.handleCtrlSelect(n,e):(o.props.onSelect([n],[e]),o.setState({selected:[n]}))}},f.createElement("div",{className:"react-autoql-selectable-list-item-content-container"},e.content),f.createElement("div",null,f.createElement(Ii,{checked:e.checked,disabled:e.disabled,onChange:function(){if(o.state.selected.length>1&&o.state.selected.includes(n))o.handleMultipleCheck(t);else{var a=t.map((function(e,t){return n===t?an(an({},e),{},{checked:!e.checked}):e}));o.props.onChange(a,[e],!e.checked)}}})))}))))})),o.KEY=C(),o.state={selected:[]},o}return pn(n)}();mn(Ai,"propTypes",{columns:b.arrayOf(b.shape({})),items:b.arrayOf(b.shape({}))}),mn(Ai,"defaultProps",{onChange:function(){},onSelect:function(){},columns:[],items:[]});var Ni=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.hidden||Co()})),mn(Cn(o),"componentDidUpdate",(function(e,t){!t.isOpen&&o.state.isOpen&&o.setState({selectedColumns:[],checkedColumns:o.getCheckedFromNumberColumnIndices(o.props),columns:o.props.columns})})),mn(Cn(o),"getCheckedFromNumberColumnIndices",(function(e){var t,n;return e.isSecondAxis?null!==(t=e.numberColumnIndices2)&&void 0!==t?t:[]:null!==(n=e.numberColumnIndices)&&void 0!==n?n:[]})),mn(Cn(o),"onAggTypeSelect",(function(e,t){var n=o.state.columns.map((function(n){return n.field===t.field?an(an({},n),{},{aggType:e}):n}));o.setState({columns:n})})),mn(Cn(o),"getColumnsOfType",(function(e){var t;return null===(t=o.state.columns)||void 0===t?void 0:t.filter((function(t){return t.type===e}))})),mn(Cn(o),"getSelectableListItems",(function(e){var t=o.state.columns,n=[],a=o.getOtherAxisColumns();return t.forEach((function(t,r){if(t.type===e&&t.is_visible&&!t.pivot){var i=o.state.checkedColumns.includes(r),l=a.includes(r),s=Ge[t.aggType],c={key:"selectable-list-item-".concat(o.COMPONENT_KEY,"-").concat(e,"-").concat(r),content:f.createElement("div",{className:"agg-selector-column-item",key:"column-agg-type-symbol-".concat(o.COMPONENT_KEY)},!o.props.isAggregation&&t.aggType&&f.createElement(xo,{className:"agg-type-symbol",popupClassname:"agg-type-symbol-select",popoverParentElement:o.popoverContentRef,popoverBoundaryElement:o.popoverContentRef,tooltipID:o.props.tooltipID,tooltip:s.tooltip,value:s.type,showArrow:!1,align:"start",size:"small",options:Object.keys(Ge).map((function(e){return{value:Ge[e].type,label:Ge[e].symbol,listLabel:f.createElement("span",null,f.createElement("span",{className:"agg-select-list-symbol"},Ge[e].symbol),Ge[e].displayName),tooltip:Ge[e].tooltip}})),onChange:function(e){o.onAggTypeSelect(e,t)}}),f.createElement("div",{className:"agg-select-text"},f.createElement("span",null,t.title))),disabled:l,checked:i,columnIndex:r};n.push(c)}})),n})),mn(Cn(o),"getOtherAxisColumns",(function(){var e,t;return o.props.hasSecondAxis?o.props.isSecondAxis?null!==(e=o.props.numberColumnIndices)&&void 0!==e?e:[]:null!==(t=o.props.numberColumnIndices2)&&void 0!==t?t:[]:[]})),mn(Cn(o),"areAllDisabled",(function(e){var t,n=null===(t=o.getOtherAxisColumns())||void 0===t?void 0:t.filter((function(t){return o.state.columns[t].type===e})),a=o.getColumnsOfType(e);return(null==n?void 0:n.length)===(null==a?void 0:a.length)})),mn(Cn(o),"getAllChecked",(function(e){var t=o.getOtherAxisColumns();return!o.areAllDisabled(e)&&o.state.columns.every((function(n,a){return e!==n.type||o.state.checkedColumns.includes(a)||t.includes(a)}))})),mn(Cn(o),"onColumnSelection",(function(e,t){var n=t.map((function(e){return e.columnIndex}));o.setState({selectedColumns:n})})),mn(Cn(o),"onColumnCheck",(function(e){var t=Tn(o.state.checkedColumns);e.forEach((function(e){var n=t.indexOf(e.columnIndex);e.checked&&-1===n?t.push(e.columnIndex):!e.checked&&n>-1&&t.splice(n,1)})),o.setState({checkedColumns:t})})),mn(Cn(o),"renderSelectorContent",(function(e){return e.position,e.nudgedLeft,e.nudgedTop,o.props.hidden?null:f.createElement("div",{ref:function(e){return o.popoverContentRef=e},className:"number-axis-selector-popover"},f.createElement("div",{className:"number-axis-selector-popover-content"},o.renderSeriesSelectors(),o.renderApplyButton()))})),mn(Cn(o),"renderSeriesSelector",(function(e){var t=o.getColumnsOfType(e);if(null==t||!t.length)return null;var n=ao[e],a=o.getSelectableListItems(e),r=o.getAllChecked(e),i=o.areAllDisabled(e);return f.createElement("div",{className:"number-selector-field-group",key:"series-selector-group-".concat(e,"-").concat(o.COMPONENT_KEY)},f.createElement("div",{className:"number-selector-header"},f.createElement("div",{className:"number-selector-header-title"},o.state.columns&&void 0!==o.props.legendColumn?f.createElement("span",null,o.props.legendColumn.display_name):f.createElement("span",null,n," Fields")),f.createElement("div",null,f.createElement(Ii,{checked:r,disabled:i,className:"number-selector-list-checkbox",onChange:function(){var t,n;r?null===(t=o.listRefs[e])||void 0===t||t.unCheckAll():null===(n=o.listRefs[e])||void 0===n||n.checkAll()}}))),f.createElement("div",{className:"react-autoql-custom-scrollbars"},f.createElement(Po,{autoHeight:!0,autoHeightMin:100,maxHeight:Pe?void 0:250},f.createElement(Ai,{ref:function(t){return o.listRefs[e]=t},items:a,onSelect:o.onColumnSelection,onChange:o.onColumnCheck}))))})),mn(Cn(o),"renderSeriesSelectors",(function(){return f.createElement("div",{className:"axis-series-selector"},f.createElement("div",{className:"number-selector-field-group-container"},Object.keys(oo).map((function(e){return o.renderSeriesSelector(oo[e])}))))})),mn(Cn(o),"renderApplyButton",(function(){var e;return f.createElement("div",{className:"axis-selector-apply-btn-container"},f.createElement(wo,{className:"axis-selector-apply-btn",type:"primary",disabled:!(null!==(e=o.state.checkedColumns)&&void 0!==e&&e.length),tooltipID:o.props.tooltipID,onClick:function(){var e=o.state.checkedColumns;o.props.isSecondAxis?o.props.changeNumberColumnIndices(o.props.numberColumnIndices,e,o.state.columns):o.props.changeNumberColumnIndices(e,o.props.numberColumnIndices2,o.state.columns),o.props.closeSelector()}},"Apply"))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"number-axis-selector-".concat(o.COMPONENT_KEY),isOpen:o.props.isOpen,content:o.renderSelectorContent,innerRef:o.props.axisSelectorRef,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},o.props.children):null})),o.COMPONENT_KEY=C(),o.listRefs={};var a=o.getCheckedFromNumberColumnIndices(e);return o.state={aggType:void 0,selectedColumns:[],checkedColumns:a,columns:e.columns},o}return pn(n)}();mn(Ni,"propTypes",{changeNumberColumnIndices:b.func,positions:b.arrayOf(b.string)}),mn(Ni,"defaultProps",{changeNumberColumnIndices:function(){},positions:["right","bottom","top","left"]});var wi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"renderSelectorContent",(function(e){var t;e.position,e.childRect,e.popoverRect;var n=o.props,a=n.hidden,r=n.scale,i=n.columns;if(a||!r||!i)return null;var l=300,s=null===(t=o.props.chartContainerRef)||void 0===t?void 0:t.clientHeight;s&&s>85?l=s-50:s&&s<85&&(l=35),l>Window.innerHeight&&(l=Window.innerHeight);var c=r.secondScale,u=i.filter((function(e){var t;return!(null!=c&&null!==(t=c.fields)&&void 0!==t&&t.find((function(t){return t.name===e.name})))}));return f.createElement("div",{className:Pe?"mobile-string-axis-selector-popover-content":"string-axis-selector-popover-content"},f.createElement(Po,{autoHeight:!0,autoHeightMin:35,autoHeightMax:l},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},u.map((function(e){if(!Ho(e))return null;var t=i.findIndex((function(t){return t.name===e.name}));return f.createElement("li",{className:"string-select-list-item ".concat(t===r.columnIndex?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.props.closeSelector(),r.changeColumnIndices([t])}},e.display_name)}))))))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"string-axis-selector-".concat(o.COMPONENT_KEY),ref:o.props.axisSelectorRef,isOpen:o.props.isOpen,content:o.renderSelectorContent,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align,reposition:!0,padding:10},o.props.children):null})),o.COMPONENT_KEY=C(),o}return pn(n)}(),ki=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"getAllStringColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Qo(t)&&t.is_visible&&e.push(n)})),e})),mn(Cn(o),"getDateColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Uo(t)&&t.is_visible&&e.push(n)})),e})),mn(Cn(o),"renderSelectorContent",(function(e){var t;if(e.position,e.childRect,e.popoverRect,o.props.hidden)return null;var n=300,a=null===(t=o.props.chartContainerRef)||void 0===t?void 0:t.clientHeight;a&&a>85?n=a-50:a&&a<85&&(n=35),n>Window.innerHeight&&(n=Window.innerHeight);var r=[];return r=o.props.dateColumnsOnly?o.getDateColumnIndices():o.getAllStringColumnIndices(),f.createElement("div",{className:Pe?"mobile-string-axis-selector-popover-content":"string-axis-selector-popover-content"},f.createElement(Po,{autoHeight:!0,autoHeightMin:35,maxHeight:n},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},r.map((function(e,t){var n;return f.createElement("li",{className:"string-select-list-item ".concat(e===o.props.stringColumnIndex?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.props.closeSelector(),o.props.changeStringColumnIndex(e)}},null===(n=o.props.columns)||void 0===n||null===(n=n[e])||void 0===n?void 0:n.display_name)}))))))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"string-axis-selector-".concat(o.COMPONENT_KEY),innerRef:o.props.axisSelectorRef,isOpen:o.props.isOpen,content:o.renderSelectorContent,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},o.props.children):null})),o.COMPONENT_KEY=C(),o}return pn(n)}(),Pi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"renderSingleNumberAxisSelector",(function(e){return f.createElement(wi,fn({"data-test":"single-number-axis-selector"},e))})),mn(Cn(o),"renderNumberAxisSelector",(function(e){return f.createElement(Ni,fn({},e,{"data-test":"number-axis-selector"}))})),mn(Cn(o),"renderSingleStringAxisSelector",(function(e){return f.createElement(ki,fn({},e,{"data-test":"string-axis-selector"}))})),mn(Cn(o),"render",(function(){var e=o.props.scale;if(!e)return null;var t=an(an({},o.props),{},{key:o.KEY,ref:function(e){return o.ref=e}});return"BIN"===e.type?o.renderSingleNumberAxisSelector(t):"LINEAR"===e.type?e.allowMultipleSeries?o.renderNumberAxisSelector(t):o.renderSingleNumberAxisSelector(t):"BAND"===(null==e?void 0:e.type)||"TIME"===(null==e?void 0:e.type)?o.renderSingleStringAxisSelector(t):null})),o.KEY=C(),o}return pn(n)}(),Oi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"openSelector",(function(){o.setState({isOpen:!0})})),mn(Cn(o),"closeSelector",(function(){o.state.isOpen&&o.setState({isOpen:!1})})),mn(Cn(o),"loadMoreChartData",function(){var e=cn(rn().mark((function e(t,n){var a,r,i,l;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.props.currentRowNumber,e.prev=1,r=n?5e3:t,o.props.setCurrentRowNumber(t),o.props.setIsLoadingMoreRows(!0),e.next=7,o.props.queryFn({pageSize:r});case 7:i=e.sent,o.props.onNewData(i,r),o.props.setIsLoadingMoreRows(!1),e.next=17;break;case 12:e.prev=12,e.t0=e.catch(1),(null===e.t0||void 0===e.t0||null===(l=e.t0.data)||void 0===l?void 0:l.message)!==lr.CANCELLED&&(console.error(e.t0),o.props.onErrorCallback(e.t0)),o.props.setCurrentRowNumber(a),o.props.setIsLoadingMoreRows(!1);case 17:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(t,n){return e.apply(this,arguments)}}()),mn(Cn(o),"rowNumberListConstructor",(function(e){for(var t=500,n=[];t<e&&t<5e3;)n.push(t),t*=10;return e>5e3?n.push(5e3):n.push(e),n})),mn(Cn(o),"renderSelectorContent",(function(){var e,t=300,n=null===(e=o.props.chartContainerRef)||void 0===e?void 0:e.clientHeight;n&&n>85?t=n-50:n&&n<85&&(t=35);var a=o.rowNumberListConstructor(o.props.totalRowCount);return f.createElement(Po,{autoHeight:!0,autoHeightMin:35,maxHeight:t},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},a.map((function(e,t){var n=e;5e3===e?n="".concat(5e3," (Maximum)"):500!==e&&5e3!==e&&(n="".concat(e," (All)"));var r=t===a.length-1;return f.createElement("li",{className:"string-select-list-item ".concat(e===o.props.currentRowNumber?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.closeSelector(),o.loadMoreChartData(e,r)}},n)})))))})),mn(Cn(o),"render",(function(){return f.createElement(Xn,{isOpen:o.state.isOpen,innerRef:function(e){return o.popoverRef=e},content:o.renderSelectorContent,onClickOutside:o.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},f.createElement("rect",{className:"axis-label-border","data-test":"axis-label-border",onClick:o.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),o.state={isOpen:!1},o}return pn(n)}();mn(Oi,"propTypes",an(an({},fi),{},{onErrorCallback:b.func})),mn(Oi,"defaultProps",an(an({},gi),{},{onErrorCallback:function(){}}));var Li=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.applyStyles()})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.currentRowNumber!==t.currentRowNumber&&o.forceUpdate(),o.applyStyles()})),mn(Cn(o),"applyRowNumberSelectorStyles",(function(){var e,t,n,a=ia(o.currentRowNumber),r=null!==(e=null==a?void 0:a.width)&&void 0!==e?e:0,i=null!==(t=null==a?void 0:a.height)&&void 0!==t?t:0;St(null===(n=o.rowNumberSelector)||void 0===n?void 0:n.popoverRef).attr("x",(null==a?void 0:a.x)-o.BUTTON_PADDING_LEFT).attr("y",(null==a?void 0:a.y)-o.BUTTON_PADDING_TOP).attr("width",r+2*o.BUTTON_PADDING_LEFT).attr("height",i+2*o.BUTTON_PADDING_TOP)})),mn(Cn(o),"applyWarningIconStyles",(function(){var e,t=ia(o.ref),n=null!==(e=null==t?void 0:t.width)&&void 0!==e?e:0,a=(null==t?void 0:t.x)+n+5;St(o.warningIcon).attr("x",a).attr("y",-5)})),mn(Cn(o),"applyStyles",(function(){o.applyWarningIconStyles(),o.applyRowNumberSelectorStyles()})),mn(Cn(o),"initializeWidth",(function(){St(o.visualizingSpan).text(o.VISUALIZING_TEXT),St(o.ref).attr("textLength",null),o.applyStyles()})),mn(Cn(o),"adjustWidth",(function(e){var t;if(St(o.visualizingSpan).text(""),o.applyStyles(),(null===(t=ia(o.LoadMoreDropdownRef))||void 0===t?void 0:t.width)>e){var n=e-(o.warningIcon?25:0);St(o.ref).attr("textLength",n),o.applyStyles()}})),mn(Cn(o),"renderRowCountText",(function(){var e={};return o.props.isRowCountSelectable&&(e.textDecoration="underline"),f.createElement("text",{ref:function(e){return o.ref=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"hanging",textAnchor:"middle",style:o.props.style,textLength:10,lengthAdjust:"spacingAndGlyphs"},f.createElement("tspan",{ref:function(e){return o.allText=e},className:"load-more-drop-down-span",id:"load-more-drop-down-span-".concat(o.COMPONENT_ID)},f.createElement("tspan",{ref:function(e){return o.visualizingSpan=e},id:"visualizing-span-".concat(o.COMPONENT_ID),className:"visualizing-span"},o.VISUALIZING_TEXT),f.createElement("tspan",{ref:function(e){return o.currentRowNumber=e},style:e,id:"row-number-span-".concat(o.COMPONENT_ID)},o.state.currentRowNumber),f.createElement("tspan",null," / ".concat(o.props.totalRowCount," rows"))))})),mn(Cn(o),"renderRowDropdownButton",(function(){return o.props.isRowCountSelectable?f.createElement(Oi,fn({},o.props,{ref:function(e){return o.rowNumberSelector=e},column:o.props.xCol,positions:["top","bottom","right","left"],align:"center",totalRowCount:o.props.totalRowCount,currentRowNumber:o.state.currentRowNumber,setCurrentRowNumber:function(e){o.setState({currentRowNumber:e})}})):null})),mn(Cn(o),"renderDrilldownInfoIcon",(function(){return f.createElement("svg",{ref:function(e){return o.warningIcon=e},className:"drilldown-info-icon",viewBox:"0 0 24 24",height:"1.4em",width:"1.4em",xmlns:"http://www.w3.org/2000/svg","data-tip":"This visualization is showing a subset of the data. <em>Drilldowns</em> will be executed on the <strong>full</strong> dataset.","data-for":o.props.chartTooltipID},f.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))})),mn(Cn(o),"renderMaxRowWarningIcon",(function(){return f.createElement("svg",{ref:function(e){return o.warningIcon=e},className:"max-rows-info-icon",viewBox:"0 0 24 24",height:"1.4em",width:"1.4em",xmlns:"http://www.w3.org/2000/svg","data-tip":"Row limit (5000) reached. Try applying a filter or narrowing your search to return full results.","data-for":o.props.chartTooltipID},f.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))})),mn(Cn(o),"renderInfoIcon",(function(){return o.props.totalRowCount>o.maxRows?o.renderMaxRowWarningIcon():o.state.currentRowNumber<o.props.totalRowCount?o.renderDrilldownInfoIcon():null})),mn(Cn(o),"render",(function(){return f.createElement("g",{ref:function(e){return o.LoadMoreDropdownRef=e}},o.renderRowCountText(),o.renderRowDropdownButton(),o.renderInfoIcon())})),o.maxRows=5e3,o.BUTTON_PADDING_TOP=2,o.BUTTON_PADDING_LEFT=4,o.VISUALIZING_TEXT="Visualizing ",o.state={currentRowNumber:e.currentRowCount},o}return pn(n)}();mn(Li,"propTypes",an({},fi)),mn(Li,"defaultProps",an({},gi));var Mi=function(e){gn(o,v);var t=Sn(o);function o(e){var a,r;return un(this,o),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){r._isMounted=!0,r.renderAxis(),r.setState({axisRenderComplete:!0})})),mn(Cn(r),"shouldComponentUpdate",(function(e,t){if(r.state.isAxisSelectorOpen&&t.isAxisSelectorOpen)return!1;var o=n(r.props,e),a=n(r.state,t);return!o||!a})),mn(Cn(r),"componentDidUpdate",(function(e,t){if((!n(e.visibleSeriesIndices,r.props.visibleSeriesIndices)||e.stringColumnIndex!==r.props.stringColumnIndex)&&r.state.isAxisSelectorOpen!==t.isAxisSelectorOpen){var o=!r.props.scale.fields[0].hasOwnProperty("aggType");r.props.source,r.props.type,r.props.scale.axis,r.props.scale.type,o?(r.props.scale.column.name,r.props.scale.column.type):r.props.scale.fields.map((function(e){return{name:e.name,aggType:e.hasOwnProperty("aggType")?e.aggType:void 0,type:e.type}}))}var a=r.state.axisRenderComplete&&!t.axisRenderComplete;r.state.isAxisSelectorOpen||r.renderAxis(a)})),mn(Cn(r),"componentWillUnmount",(function(){r._isMounted=!1})),mn(Cn(r),"onAxisRenderComplete",(function(e){"Legend"===e?r.legendComplete=!0:r.axisComplete=!0,r.props.hasLegend||r.legendComplete||(r.legendComplete=!0),r.axisComplete&&r.legendComplete&&r.props.onAxisRenderComplete(r.props.orient)})),mn(Cn(r),"setScale",(function(){r.axis.scale(r.props.scale)})),mn(Cn(r),"adjustLegendLocation",(function(){if(r.legendContainer){var e,t=0,n=0,o=ia(r.ref);if("right"===r.props.orient)t=null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0;else if("bottom"===r.props.orient){var a,i,l=r.props.innerWidth/2,s=null===(a=r.legendContainer)||void 0===a?void 0:a.getBBox();t=l-(s.x+s.width/2),n=null!==(i=null==o?void 0:o.height)&&void 0!==i?i:0;var c=s.x+s.width+t,u=r.props.outerWidth-r.props.deltaX-r.props.chartPadding-c;u<0&&(t+=u)}St(r.legendContainer).attr("transform","translate (".concat(t,",").concat(n,")"))}})),mn(Cn(r),"getMaxTickLabelWidth",(function(){var e,t,n=r.props,o=n.orient,a=n.outerHeight,i=n.outerWidth,l="top"===o||"bottom"===o,s="left"===o||"right"===o;if(l&&!r.shouldLabelsRotate)return 100;l?t=Math.floor(.5*a/6):s&&(t=Math.floor(.3*i/6));var c=r.maxLabelWidth;return t<6?c=6:t<100&&(c=t),null!==(e=c)&&void 0!==e?e:100})),mn(Cn(r),"setTickValues",(function(){var e,t=r.props.scale,n=r.maxLabelWidth;r.axis.tickFormat((function(e){var o=Ze({d:e,scale:t,maxLabelWidth:n});return null!=o&&o.formattedLabel?o.formattedLabel:e})),null!==(e=r.props.scale)&&void 0!==e&&null!==(e=e.tickLabels)&&void 0!==e&&e.length&&r.axis.tickValues(r.props.scale.tickLabels),r.setTickSize()})),mn(Cn(r),"setTickSize",(function(){r.axis.tickSizeOuter(0),"left"===r.props.orient&&r.props.innerWidth?r.axis.tickSizeInner(-r.props.innerWidth):"bottom"===r.props.orient&&r.props.innerHeight?r.axis.tickSizeInner(r.props.innerHeight):r.axis.tickSizeInner(0)})),mn(Cn(r),"applyAxis",(function(){r.axisElement&&St(r.axisElement).call(r.axis)})),mn(Cn(r),"styleAxisLabels",(function(){"bottom"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(0, 10)"):"top"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(0, -5)"):"left"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(-5, 0)"):"right"===r.props.orient&&St(r.axisElement).selectAll(".tick text").attr("transform","translate(5, 0)")})),mn(Cn(r),"rotateLabelsIfNeeded",(function(){if("bottom"===r.props.orient||"top"===r.props.orient){var e=r.shouldLabelsRotate||(t=r.axisElement,o=!1,St(t).selectAll("g.tick text").each((function(){if(!o){var e=St(this).node().getBoundingClientRect();n&&e.x<n.x+n.width+10&&(o=!0),n=e}})),o);e&&("bottom"===r.props.orient?St(r.axisElement).selectAll(".tick text").style("text-anchor","end").attr("dominant-baseline","text-top").attr("transform","rotate(-45, 0, ".concat(r.props.innerHeight,") translate(-10, 0)")):"top"===r.props.orient&&St(r.axisElement).selectAll(".tick text").style("text-anchor","start").attr("dominant-baseline","auto").attr("transform","rotate(-45, 0, 0) translate(5, 0)")),r.shouldLabelsRotate=e}var t,n,o})),mn(Cn(r),"addTooltipsToLabels",(function(){var e=r.props.scale,t=r.maxLabelWidth;St(r.axisElement).selectAll(".axis .tick text").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").attr("data-for",r.props.chartTooltipID).attr("data-effect","float").attr("data-tip",(function(n){var o;if("..."===(null===(o=St(this).text())||void 0===o?void 0:o.slice(-3))){var a=Ze({d:n,scale:e,maxLabelWidth:t}).fullWidthLabel;if(a)return a}return null}))})),mn(Cn(r),"drawAxisAndLabels",(function(){r.maxLabelWidth=r.getMaxTickLabelWidth(),r.setTickValues(),r.applyAxis(),r.styleAxisLabels(),r.rotateLabelsIfNeeded()})),mn(Cn(r),"renderAxis",(function(e){var t;if(r.props.scale){switch(r.prevShouldLabelsRotate=r.shouldLabelsRotate,r.props.orient){case"bottom":r.axis=Pt();break;case"left":r.axis=kt();break;case"right":r.axis=wt();break;case"top":r.axis=Nt()}if(r.setScale(),r.drawAxisAndLabels(),r.shouldLabelsRotate&&!r.prevShouldLabelsRotate&&r.drawAxisAndLabels(),r.addTooltipsToLabels(),St(r.axisElement).selectAll(".axis path").style("display","none"),"LINEAR"!==(null===(t=r.props.scale)||void 0===t?void 0:t.type)?St(r.axisElement).selectAll("g.tick").select("line").style("opacity",0):(St(r.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.08").style("shape-rendering","crispedges"),St(r.axisElement).selectAll("g.tick").select("line").style("opacity",.1),St(r.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.3)),r.axisElement){var n=r.axisElement.getBBox?r.axisElement.getBBox():void 0,o=r.axisElement.getBoundingClientRect?r.axisElement.getBoundingClientRect():void 0,a=0,i=0;n&&o&&(a=(null==o?void 0:o.x)-(null==n?void 0:n.x),i=(null==o?void 0:o.y)-(null==n?void 0:n.y));var l=[];if(St(r.axisElement).selectAll("g.tick text").each((function(){var e=St(this).node().getBoundingClientRect();l.push({left:e.left-a,bottom:e.bottom-i,right:e.right-a,top:e.top-i})})),l){var s=Ti(l);r.labelsBBox=an({},s)}}r.adjustTitleToFit(),r.adjustLoadMoreSelectorToFit(),r.adjustAxisSelectorBorder(),r.adjustAxisScalerBorder(),r.adjustLegendLocation(),e?r.onAxisRenderComplete(r.props.orient):r.state.axisRenderComplete&&r.prevShouldLabelsRotate!==r.shouldLabelsRotate&&r.props.onLabelRotation()}})),mn(Cn(r),"getLegendOrientation",(function(){switch(r.props.orient.toLowerCase()){case"right":case"left":return"vertical";case"bottom":case"top":return"horizontal";default:return}})),mn(Cn(r),"renderLegend",(function(){var e=r.getLegendOrientation(),t={top:0,bottom:0,left:20,right:0};return"horizontal"===e&&(t.right=t.left=r.props.chartPadding,t.top=r.LOAD_MORE_DROPDOWN_PADDING_BOTTOM),f.createElement("g",{ref:function(e){return r.legendContainer=e}},f.createElement(Di,fn({},r.props,{ref:function(e){return r.legendRef=e},legendColumnIndices:r.props.numberColumnIndices,legendColumnIndices2:r.props.numberColumnIndices2,placement:r.props.orient,onRenderComplete:function(){return r.onAxisRenderComplete("Legend")},paddingBottom:t.bottom,paddingRight:t.right,paddingTop:t.top,paddingLeft:t.left,hasSecondAxis:r.props.hasSecondAxis,shape:r.props.legendShape,orientation:e,fontSize:r.fontSize})))})),mn(Cn(r),"getTitleTextHeight",(function(){var e,t=parseInt(null===(e=r.titleRef)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize,r.labelInlineStyles.fontSize);return isNaN(t)?r.fontSize:t})),mn(Cn(r),"openSelector",(function(){r.setState({isAxisSelectorOpen:!0})})),mn(Cn(r),"closeSelector",(function(){r.setState({isAxisSelectorOpen:!1})})),mn(Cn(r),"renderAxisSelector",(function(e){var t,n=e.positions,o=e.isSecondAxis,a=e.childProps,i=void 0===a?{}:a;return f.createElement(Pi,{chartContainerRef:r.props.chartContainerRef,changeNumberColumnIndices:r.props.changeNumberColumnIndices,changeStringColumnIndex:r.props.changeStringColumnIndex,legendColumn:r.props.legendColumn,popoverParentElement:r.props.popoverParentElement,numberColumnIndices:r.props.numberColumnIndices,numberColumnIndices2:r.props.numberColumnIndices2,stringColumnIndices:r.props.stringColumnIndices,stringColumnIndex:r.props.stringColumnIndex,dateColumnsOnly:r.props.dateColumnsOnly,isAggregation:r.props.isAggregation,tooltipID:r.props.tooltipID,hidden:!r.shouldRenderAxisSelector(),columns:r.props.columns,scale:r.props.scale,secondScale:null===(t=r.props.scale)||void 0===t?void 0:t.secondScale,align:"center",position:"right",positions:n,childProps:i,hasSecondAxis:r.props.hasSecondAxis,axisSelectorRef:function(e){return r.axisSelector=e},isOpen:r.state.isAxisSelectorOpen,closeSelector:r.closeSelector,isSecondAxis:o},f.createElement("rect",{ref:function(e){return r.axisSelector=e},className:"axis-label-border ".concat(r.shouldRenderAxisSelector()?"":"hidden"),"data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),mn(Cn(r),"renderAxisTitleText",(function(){var e,t=r.props.scale,n=null!==(e=null==t?void 0:t.title)&&void 0!==e?e:"";return n.length>35?f.createElement("tspan",{"data-tip":n,"data-for":r.props.chartTooltipID,"data-test":"axis-label"},"".concat(n.substring(0,35),"...")):f.createElement("tspan",{"data-test":"axis-label"},f.createElement("tspan",{ref:function(e){return r.titleText=e}},n),r.shouldRenderAxisSelector()&&f.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),mn(Cn(r),"renderBottomAxisTitle",(function(){return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({positions:["top","bottom","right","left"]}))})),mn(Cn(r),"renderLeftAxisTitle",(function(){var e,t,n=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-r.AXIS_TITLE_PADDING_TOP,o=-.5*r.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},id:"left-axis-title-".concat(r.AXIS_KEY),className:"left-axis-title","data-test":"left-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:o,y:n,textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({positions:["right","bottom","left","top"]}))})),mn(Cn(r),"renderRightAxisTitle",(function(){var e,t,n,o,a=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)+(null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.width)&&void 0!==n?n:0)+r.AXIS_TITLE_PADDING_TOP,i=-.5*r.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},id:"right-axis-title-".concat(r.AXIS_KEY),className:"right-axis-title","data-test":"right-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:i,y:a,textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({isSecondAxis:!0,positions:["left","top","bottom","right"]}))})),mn(Cn(r),"renderTopAxisTitle",(function(){var e,t,n=null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,o=r.props.innerWidth/2,a=n-r.AXIS_TITLE_PADDING_TOP;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:o,y:a,style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({isSecondAxis:!0,positions:["bottom","top","left","right"]}))})),mn(Cn(r),"adjustAxisSelectorBorder",(function(){var e,t,n;if(r.titleRef){var o=ia(r.titleRef),a=null!==(e=null==o?void 0:o.height)&&void 0!==e?e:0,i=null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0;St(r.axisSelector).attr("transform",null===(n=r.titleRef)||void 0===n?void 0:n.getAttribute("transform")).attr("width",Math.round(i+2*r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("height",Math.round(a+2*r.AXIS_TITLE_BORDER_PADDING_TOP)).attr("x",Math.round((null==o?void 0:o.x)-r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("y",Math.round((null==o?void 0:o.y)-r.AXIS_TITLE_BORDER_PADDING_TOP))}})),mn(Cn(r),"adjustAxisScalerBorder",(function(){var e,t,n,o,a,i,l,s;r.axisScaler&&St(r.axisScaler).attr("x",Math.round((null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-r.BUTTON_PADDING)).attr("y",Math.round((null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.y)&&void 0!==n?n:0)-r.BUTTON_PADDING)).attr("width",Math.round((null!==(a=null===(i=r.labelsBBox)||void 0===i?void 0:i.width)&&void 0!==a?a:0)+2*r.BUTTON_PADDING)).attr("height",Math.round((null!==(l=null===(s=r.labelsBBox)||void 0===s?void 0:s.height)&&void 0!==l?l:0)+2*r.BUTTON_PADDING))})),mn(Cn(r),"adjustBottomTitleToFit",(function(){var e,t,n,o,a=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.height)&&void 0!==n?n:0),i=r.props.innerWidth/2,l=a+r.AXIS_TITLE_PADDING_TOP;if(St(r.titleRef).attr("x",i).attr("y",l),r.props.chartRef){var s,c=r.props.outerWidth-2*r.props.chartPadding;if(St(r.titleRef).attr("textLength",null),(null!==(s=r.titleRef.getBBox().width)&&void 0!==s?s:0)+2*r.AXIS_TITLE_BORDER_PADDING_LEFT>c){var u=Math.floor(c)-2*r.AXIS_TITLE_BORDER_PADDING_LEFT;u<0&&(u=r.MINIMUM_TITLE_LENGTH),St(r.titleRef).attr("textLength",u)}var d=r.titleRef.getBBox(),p=d.x+d.width+r.props.deltaX+r.AXIS_TITLE_BORDER_PADDING_LEFT,m=r.props.outerWidth-r.props.chartPadding;if(p>m){var f=p-m;St(r.titleRef).attr("x",i-f)}}})),mn(Cn(r),"adjustTopTitleToFit",(function(){var e,t,n=null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,o=r.props.innerWidth/2,a=n-r.AXIS_TITLE_PADDING_TOP;St(r.titleRef).attr("x",o).attr("y",a)})),mn(Cn(r),"adjustVerticalTitleToFit",(function(){if(r.props.chartRef){var e,t=r.props.outerHeight-2*r.props.chartPadding;if(St(r.titleRef).attr("textLength",null),(null!==(e=r.titleRef.getBBox().width)&&void 0!==e?e:0)+2*r.AXIS_TITLE_BORDER_PADDING_LEFT>t){var n=Math.floor(t)-2*r.AXIS_TITLE_BORDER_PADDING_LEFT;n<0&&(n=r.MINIMUM_TITLE_LENGTH),St(r.titleRef).attr("textLength",n)}var o=r.titleRef.getBBox(),a=-1*(o.x+o.width)+r.props.deltaY-r.AXIS_TITLE_BORDER_PADDING_LEFT-r.props.chartPadding;if(a<0){var i=-a;St(r.titleRef).attr("transform","rotate(-90) translate(".concat(-i,", 0)"))}}})),mn(Cn(r),"adjustTitleToFit",(function(){r.titleRef&&("bottom"===r.props.orient?r.adjustBottomTitleToFit():"top"===r.props.orient?r.adjustTopTitleToFit():"left"!==r.props.orient&&"right"!==r.props.orient||r.adjustVerticalTitleToFit())})),mn(Cn(r),"adjustLoadMoreSelectorToFit",(function(){var e,t,n,o,a,i,l;if(r.loadMoreDropdownComponent&&r.props.chartRef){null===(e=(t=r.loadMoreDropdownComponent).initializeWidth)||void 0===e||e.call(t);var s,c,u=ia(r.loadMoreDropdown),d=r.props.outerWidth-2*r.props.chartPadding;if((null!==(n=u.width)&&void 0!==n?n:0)>d)null===(s=(c=r.loadMoreDropdownComponent).adjustWidth)||void 0===s||s.call(c,d);u=ia(r.loadMoreDropdown);var p=r.props.innerWidth/2-(u.x+u.width/2),m=(null!==(o=null===(a=r.labelsBBox)||void 0===a?void 0:a.y)&&void 0!==o?o:0)+(null!==(i=null===(l=r.labelsBBox)||void 0===l?void 0:l.height)&&void 0!==i?i:0)+(r.AXIS_TITLE_PADDING_TOP+r.AXIS_TITLE_PADDING_BOTTOM+r.fontSize),f=u.x+u.width+p,g=r.props.outerWidth-r.props.deltaX-r.props.chartPadding-f;g<0&&(p+=g),St(r.loadMoreDropdown).attr("transform","translate(".concat(p,", ").concat(m,")"))}})),mn(Cn(r),"renderAxisTitle",(function(){switch(r.props.orient){case"left":return r.renderLeftAxisTitle();case"right":return r.renderRightAxisTitle();case"bottom":return r.renderBottomAxisTitle();case"top":return r.renderTopAxisTitle();default:return null}})),mn(Cn(r),"renderLoadMoreDropdown",(function(){return"bottom"===r.props.orient&&r.props.enableAjaxTableData?f.createElement("g",{ref:function(e){return r.loadMoreDropdown=e}},f.createElement(Li,fn({ref:function(e){return r.loadMoreDropdownComponent=e}},r.props,{style:an(an({},r.labelInlineStyles),{},{fontSize:r.fontSize})}))):null})),mn(Cn(r),"shouldRenderAxisSelector",(function(){var e;return null===(e=r.props.scale)||void 0===e?void 0:e.hasDropdown})),mn(Cn(r),"shouldRenderAxisScaler",(function(){var e,t,n;return!(!r.labelsBBox||"LINEAR"!==(null===(e=r.props.scale)||void 0===e?void 0:e.type)||1===(null===(t=r.props.scale)||void 0===t?void 0:t.domain().length)||null!==(n=r.props.scale)&&void 0!==n&&n.disableAutoScale)})),mn(Cn(r),"renderAxisScaler",(function(){return r.shouldRenderAxisScaler()?f.createElement(xi,{toggleChartScale:r.props.toggleChartScale,labelBBox:r.labelsBBox,childProps:{ref:function(e){return r.axisScaler=e}}}):null})),mn(Cn(r),"render",(function(){return f.createElement(f.Fragment,null,!!r.props.scale&&f.createElement("g",{"data-test":"axis",ref:function(e){return r.ref=e},transform:"translate(".concat(r.props.translateX,", ").concat(r.props.translateY,")"),style:r.labelInlineStyles},f.createElement("g",{className:"axis axis-".concat(r.props.orient),ref:function(e){return r.axisElement=e}}),r.renderAxisTitle(),r.renderLoadMoreDropdown(),r.renderAxisScaler()),r.props.hasLegend&&r.renderLegend())})),r.AXIS_KEY=C(),r.LEGEND_ID="axis-".concat(C()),r.BUTTON_PADDING=5,r.AXIS_TITLE_PADDING_TOP=20,r.AXIS_TITLE_PADDING_BOTTOM=0,r.AXIS_TITLE_BORDER_PADDING_LEFT=5,r.AXIS_TITLE_BORDER_PADDING_TOP=3,r.LOAD_MORE_DROPDOWN_PADDING_BOTTOM=10,r.MINIMUM_TITLE_LENGTH=10,r.swatchElements=[],r.maxRows=5e3,r.initialRowNumber=50,r.fontSize=Pe?10:12,r.labelInlineStyles=(mn(a={fontSize:"".concat(r.fontSize,"px"),fontFamily:"inherit",fill:"currentColor",fillOpacity:1,cursor:"default"},"fontFamily","var(--react-autoql-font-family)"),mn(a,"letterSpacing","normal"),a),r.shouldLabelsRotate=!1,r.prevShouldLabelsRotate=!1,r.state={isAxisSelectorOpen:!1},r}return pn(o)}();mn(Mi,"propTypes",an(an({},fi),{},{scale:b.func,orient:b.string,translateX:b.number,translateY:b.number})),mn(Mi,"defaultProps",an(an({},gi),{},{orient:"bottom",translate:void 0,translateX:0,translateY:0,onAxisRenderComplete:function(){}}));var qi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onAxisRenderComplete",(function(e){switch(e){case"right":o.rightAxisComplete=!0;break;case"left":o.leftAxisComplete=!0;break;case"bottom":o.bottomAxisComplete=!0;break;case"top":o.topAxisComplete=!0}o.shouldRenderRightAxis()||o.rightAxisComplete||(o.rightAxisComplete=!0),o.shouldRenderTopAxis()||o.topAxisComplete||(o.topAxisComplete=!0),o.topAxisComplete&&o.bottomAxisComplete&&o.leftAxisComplete&&o.rightAxisComplete&&o.props.onAxesRenderComplete()})),mn(Cn(o),"renderBottomAxis",(function(e,t){return f.createElement("g",{ref:function(e){return o.bottomAxis=e}},f.createElement(Mi,fn({},o.props,{ref:function(e){return o.bottomAxisWithoutLegend=e},key:o.BOTTOM_AXIS_KEY,orient:"bottom",scale:o.props.xScale,translateY:0,translateX:0,hasLegend:o.shouldRenderBottomLegend(),innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()})))})),mn(Cn(o),"renderLeftAxis",(function(e,t){return f.createElement(Mi,fn({},o.props,{key:o.LEFT_AXIS_KEY,ref:function(e){return o.leftAxis=e},orient:"left",scale:o.props.yScale,showGridLines:o.props.yGridLines,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()}))})),mn(Cn(o),"shouldRenderTopAxis",(function(){return!!o.props.xScale2})),mn(Cn(o),"renderTopAxis",(function(e,t){return o.shouldRenderTopAxis()?f.createElement(Mi,fn({},o.props,{key:o.TOP_AXIS_KEY,ref:function(e){return o.topAxis=e},orient:"top",scale:o.props.xScale2,showGridLines:!1,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()})):null})),mn(Cn(o),"shouldRenderRightAxis",(function(){return!!o.props.yCol2&&!!o.props.yScale2})),mn(Cn(o),"shouldRenderRightLegend",(function(){return"right"===o.props.legendLocation})),mn(Cn(o),"shouldRenderBottomLegend",(function(){return"bottom"===o.props.legendLocation})),mn(Cn(o),"renderRightAxis",(function(e,t){var n=o.shouldRenderRightAxis(),a=o.shouldRenderRightLegend();return n||a?f.createElement("g",{ref:function(e){return o.rightAxis=e},transform:"translate(".concat(e,", 0)")},f.createElement(Mi,fn({},o.props,{ref:function(e){return o.rightAxisWithoutLegend=e},key:o.RIGHT_AXIS_KEY,orient:"right",scale:o.props.yScale2,showGridLines:!1,hasLegend:a,innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()}))):null})),mn(Cn(o),"hasSecondAxis",(function(){return o.shouldRenderRightAxis()||o.shouldRenderTopAxis()})),mn(Cn(o),"render",(function(){var e,t,n;if(!(o.props.yScale&&o.props.xScale&&o.props.height&&o.props.width))return null;var a=(null===(e=o.props.xScale)||void 0===e?void 0:e.range())||[0,0],r=(null===(t=o.props.yScale)||void 0===t?void 0:t.range())||[0,0],i=a[1]-a[0],l=r[0]-r[1];return f.createElement("g",{ref:function(e){return o.ref=e}},null!==(n=o.props.children)&&void 0!==n?n:null,f.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},o.renderBottomAxis(i,l),o.renderLeftAxis(i,l),o.renderRightAxis(i,l),o.renderTopAxis(i,l)))})),o.LEGEND_PADDING=20,o.BOTTOM_AXIS_KEY=C(),o.LEFT_AXIS_KEY=C(),o.RIGHT_AXIS_KEY=C(),o.TOP_AXIS_KEY=C(),o}return pn(n)}();mn(qi,"propTypes",an(an({},fi),{},{onAxesRenderComplete:b.func})),mn(qi,"defaultProps",an(an({},gi),{},{onAxesRenderComplete:function(){}}));var Vi=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"getBars",(function(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e.props,r=a.columns,i=a.legendColumn,l=a.stringColumnIndex,s=a.dataFormatting,c=a.xScale;if(null==t||!t.length||!n||!e.barWidth)return null;var u=o,d=[];return t.forEach((function(t,o){if(!r[t].isSeriesHidden){var a=e.props.colorScale(t);d.push(e.props.data.map((function(d,p){var m=d[t];if(!m)return null;var g=m<0?bi(n):n(m),v=Math.abs(n(m)-bi(n));if((isNaN(v)||isNaN(m))&&(g=bi(n),v=0),v<.05)return null;var h=c.getValue(d[l])+u*e.barWidth,b=Ci({row:d,columns:r,colIndex:t,colIndex2:l,legendColumn:i,dataFormatting:s}),y=yi(t,p);return f.createElement("rect",{key:y,className:"bar".concat(e.state.activeKey===y?" active":""),"data-test":"bar-".concat(o,"-").concat(p),x:h,y:g,height:v,width:e.barWidth,onClick:function(){return e.onColumnClick(d,t,p)},"data-tip":b,"data-for":e.props.chartTooltipID,style:{fill:a,fillOpacity:.7}})}))),u+=1}})),d})),mn(Cn(e),"render",(function(){var t;if(e.props.isLoading)return null;var n=e.props,o=n.columns,a=n.numberColumnIndices,r=n.numberColumnIndices2,i=n.xScale,l=n.yScale,s=n.yScale2,c=a.filter((function(e){return!o[e].isSeriesHidden})),u=null==r?void 0:r.filter((function(e){return!o[e].isSeriesHidden}));if(!c.length)return null;var d=c.length+(s&&null!==(t=null==u?void 0:u.length)&&void 0!==t?t:0);e.barWidth=(i.bandwidth?i.bandwidth():0)/d;var p=e.getBars(a,l);return f.createElement("g",{"data-test":"columns"},p)})),e}return pn(n)}();mn(Vi,"propTypes",vi),mn(Vi,"defaultProps",hi);var _i=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"y",isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled}));o.yScale=r.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,linearAxis:"y",toggleChartScale:o.toggleChartScale,yGridLines:!0}),f.createElement(Vi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.state={isChartScaled:!0},o}return pn(n)}();mn(_i,"propTypes",pi),mn(_i,"defaultProps",mi);var Fi=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onBarClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale,c=a.filter((function(e){return!n[e].isSeriesHidden}));if(!c.length)return null;var u=[],d=l.tickSize/c.length,p=0;return a.forEach((function(t,a){if(!n[t].isSeriesHidden){var c=e.props.colorScale(t);u.push(e.props.data.map((function(u,m){var g=u[t];if(!g)return null;var v=Math.abs(s(g)-bi(s));if(isNaN(v)&&(v=0),v<.05)return null;var h=l(u[r])+p*d,b=Ci({row:u,columns:n,colIndex:t,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(t,m),className:"bar".concat(e.state.activeKey===yi(t,m)?" active":""),"data-test":"bar-".concat(a,"-").concat(m),y:h,x:g>0?bi(s):s(g),width:v,height:d,onClick:function(){return e.onBarClick(u,t,m)},"data-tip":b,"data-for":e.props.chartTooltipID,style:{fill:c,fillOpacity:1}})}))),p+=1}})),f.createElement("g",{"data-test":"bars"},u)})),e}return pn(n)}();mn(Fi,"propTypes",vi),mn(Fi,"defaultProps",hi);var zi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.yScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,config:e.dataFormatting,axis:"y"}));var r=et(an(an({},e),{},{config:e.dataFormatting,columnIndices1:a,isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled,axis:"x"}));o.xScale=r.scale,o.xTickValues=o.xScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-bar-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:e,yCol:o.props.columns[o.props.stringColumnIndex],linearAxis:"x",toggleChartScale:o.toggleChartScale}),f.createElement(Fi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.state={isChartScaled:!0},o}return pn(n)}();mn(zi,"propTypes",pi),mn(zi,"defaultProps",mi);var Bi=function(e,t){var n=t[0]-e[0],o=t[1]-e[1];return{length:Math.sqrt(Math.pow(n,2)+Math.pow(o,2)),angle:Math.atan2(o,n)}},Hi=function(e,t,n,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2,r=e,i=t,l=n;i||(i=e),l||(l=e);var s=Bi(i,l),c=Bi(i,r),u=Bi(r,l);s.length>2*u.length?s.length=2*u.length:s.length>2*c.length&&(s.length=2*c.length);var d=s.angle+(o?Math.PI:0),p=s.length*a,m=e[0]+Math.cos(d)*p,f=e[1]+Math.sin(d)*p;return[m,f]},Qi=function(e,t,n,o){var a=Hi(n[t-1],n[t-2],e,!1,o),r=Hi(e,n[t-1],n[t+1],!0,o);return"C ".concat(a.join(",")," ").concat(r.join(",")," ").concat(e.join(","))},Ui=function(e){return"L ".concat(e.join(","))},Yi=function(e,t,n){return e.reduce((function(e,o,a,r){return 0===a?"M ".concat(o.join(",")):"".concat(e," ").concat(t(o,a,r,n))}),"")},Ki=function(e,t){return t?Yi(e,Qi,t):Yi(e,Ui)},ji=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"onDotClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"makeChartElements",(function(){var e,t=o.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,i=t.stringColumnIndex,l=t.dataFormatting,s=t.yScale,c=t.xScale,u=Ua("background-color-secondary"),d=o.props.width/(null===(e=o.props.data)||void 0===e?void 0:e.length)<10,p=[],m=[];return r.forEach((function(e,t){var r=[],g=o.props.colorScale(e);n[e].isSeriesHidden||o.props.data.forEach((function(t,m){var v=t[e];if(v||0===v){var h=c.tickSize/2,b=c.getValue(t[i])+h,y=s.domain()[0],C=s(v||y),E=[b,C];r.push(E);var S=Ci({row:t,columns:n,colIndex:e,colIndex2:i,legendColumn:a,dataFormatting:l});if(!isNaN(C)){var T=yi(e,m),D=f.createElement("circle",{key:"hover-circle-".concat(T),cx:b,cy:C,r:6,style:{stroke:"transparent",fill:"transparent",cursor:"pointer"}}),x=f.createElement("circle",{className:"line-dot-inner-circle",key:T,cx:b,cy:C,r:2.5,style:{pointerEvents:"none",stroke:g,strokeWidth:4,paintOrder:"stroke",color:g,opacity:d?0:1,fill:o.state.activeKey===T?g:u||"#fff"}});p.push(f.createElement("g",{className:"line-dot".concat(o.state.activeKey===T?" active":"").concat(d?" hidden-dot":""),key:"circle-group-".concat(T),onClick:function(){return o.onDotClick(t,e,m)},"data-tip":S,"data-for":o.props.chartTooltipID},x,D))}}}));var v=Ki(r,o.PATH_SMOOTHING),h=f.createElement("path",{key:"line-".concat(yi(0,t,0)),className:"line",d:v,fill:"none",stroke:g,strokeWidth:2});m.push(h)})),{paths:m,innerCircles:p}})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props.numberColumnIndices.filter((function(e){var t;return!(null!==(t=o.props.columns[e])&&void 0!==t&&t.isSeriesHidden)}));if(!(null==e?void 0:e.length))return null;var t=o.makeChartElements(),n=t.paths,a=t.innerCircles;return f.createElement("g",{"data-test":"line"},n,a)})),o.PATH_SMOOTHING=.2,o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(ji,"propTypes",vi),mn(ji,"defaultProps",hi);var Wi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"state",{isChartScaled:!0}),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"y",isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled}));o.yScale=r.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-line-chart"},f.createElement(ji,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,toggleChartScale:o.toggleChartScale,legendShape:"line",dateColumnsOnly:!0,yGridLines:!0})))})),o}return pn(n)}();mn(Wi,"propTypes",pi),mn(Wi,"defaultProps",mi);var Gi=function(t){gn(o,v);var n=Sn(o);function o(t){var a;un(this,o),mn(Cn(a=n.call(this,t)),"componentDidMount",(function(){a.renderPie(),Co()})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){if(a.props.isResizing&&e.isResizing)return!1;var n=Ma(a.props,e),o=Ma(a.state,t);return!n||!o})),mn(Cn(a),"componentDidUpdate",(function(){a.renderPie()})),mn(Cn(a),"componentWillUnmount",(function(){Ia(a.legend),Ia(a.pieChartContainer)})),mn(Cn(a),"renderPie",(function(){Ia(a.pieChartContainer),a.setPieRadius();var e=Ya().chartColors,t=tt({data:a.sortedData,numberColumnIndex:a.props.numberColumnIndex,legendLabels:a.state.legendLabels,chartColors:e}),n=t.pieChartFn,o=t.legendScale;a.pieChartFn=n,a.legendScale=o,a.renderPieContainer(),a.renderPieSlices(),a.renderLegend(),a.centerVisualization(),a.renderComplete||(a.renderComplete=!0,a.props.onAxesRenderComplete())})),mn(Cn(a),"renderPieContainer",(function(){var e=a.props,t=e.width,n=e.height;a.pieChartContainer=St(a.chartElement).append("svg").attr("width",t).attr("height",n).append("g").attr("class","slices").attr("transform","translate(".concat(t/2+a.outerRadius,",").concat(n/2,")"))})),mn(Cn(a),"onSliceClick",(function(e){var t=e.data.key;t===a.state.activeKey?a.setState({activeKey:null}):(a.props.onChartClick({row:e.data.value,columnIndex:a.props.numberColumnIndex,columns:a.props.columns,stringColumnIndex:a.props.stringColumnIndex,legendColumn:a.props.legendColumn,activeKey:t}),a.setState({activeKey:t}))})),mn(Cn(a),"renderPieSlices",(function(){var e=Cn(a);a.pieChartContainer.selectAll(".slices").data(e.pieChartFn).enter().append("path").attr("class","slice").attr("d",qt().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for",a.props.chartTooltipID).attr("data-tip",(function(t){return Ci({row:t.data.value,columns:e.props.columns,colIndex:e.props.numberColumnIndex,colIndex2:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting})})).style("fill-opacity",.85).attr("stroke-width","0.5px").attr("stroke",a.props.backgroundColor).on("mouseover",(function(e){St(this).style("fill-opacity",1)})).on("mouseout",(function(e){St(this).style("fill-opacity",.85)})).on("click",a.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){St(this).transition().duration(500).attr("transform",(function(t){if(t.data.key===e.state.activeKey){var n=t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2;return"translate("+10*Math.cos(n)+","+10*Math.sin(n)+")"}}))}))})),mn(Cn(a),"centerVisualization",(function(){var t,n=St("#pie-chart-container-".concat(a.CHART_ID)).node();n&&(t=n.getBBox());var o=e(t,"width",0),r=e(t,"x",0),i=(a.props.width-o)/2-r;St("#pie-chart-container-".concat(a.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),mn(Cn(a),"onLegendClick",(function(e){var t,n=JSON.parse(e),o=null==n?void 0:n.dataIndex,r=null===(t=a.state.legendLabels)||void 0===t?void 0:t[o];if(r&&!a.state.legendLabels.every((function(e){return e.label===r.label||e.hidden}))){var i=S(a.state.legendLabels);i[o].hidden=!a.state.legendLabels[o].hidden,a.setState({legendLabels:i},(function(){Co()}))}})),mn(Cn(a),"renderLegend",(function(){var t=Cn(a),n=a.props.height;if(Ya().chartColors,a.legendScale){var o=a.props.width/2-70;a.legend=St(a.legendElement),a.legend.append("g").attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","0.7").style("font-family","inherit").style("font-size","10px").style("stroke-width","2px");var r,i=Je().orient("vertical").shapePadding(5).labels(t.state.legendLabels.map((function(e){return e.label}))).labelWrap(o).labelOffset(10).scale(t.legendScale).on("cellclick",a.onLegendClick);a.legend.select(".legendOrdinal").call(i);var l=a.legend.select(".legendOrdinal").node();l&&(r=l.getBBox());var s=e(r,"height",0),c=e(r,"width",0),u=a.props.width/2-c-20,d=s<n-20?(n-s)/2:15;a.legend.select(".legendOrdinal").attr("transform","translate(".concat(u,", ").concat(d,")")),a.applyStylesForHiddenSeries()}})),mn(Cn(a),"applyStylesForHiddenSeries",(function(){var e=a.state.legendLabels.filter((function(e){return e.hidden})).map((function(e){return e.label}));a.legendSwatchElements=document.querySelectorAll("#".concat(a.LEGEND_ID," .label tspan")),a.legendSwatchElements&&a.legendSwatchElements.forEach((function(t){var n=t.parentElement.parentElement.querySelector(".swatch");n.style.strokeWidth="2px",e.includes(t.textContent)?n.style.opacity=.3:n.style.opacity=1}))})),mn(Cn(a),"setPieRadius",(function(){var e,t=a.props,n=t.width,o=t.height,r=t.margin;e=n<o?n/2-r:2*o<n?o-r:n/2-r,a.outerRadius=e/2,a.innerRadius=a.outerRadius-50>15?a.outerRadius-50:0})),mn(Cn(a),"render",(function(){return f.createElement("g",{id:"pie-chart-container-".concat(a.CHART_ID),"data-test":"react-autoql-pie-chart"},f.createElement("svg",{className:"pie-chart",ref:function(e){a.chartElement=e},width:a.props.width,height:a.props.height}),f.createElement("g",{ref:function(e){a.legendElement=e},id:a.LEGEND_ID,className:"legendOrdinal"}))})),a.CHART_ID=C(),a.LEGEND_ID="react-autoql-pie-legend-".concat(C()),a.sortedData=t.data.concat().sort((function(e,n){var o=e[t.numberColumnIndex]||0,a=n[t.numberColumnIndex]||0;return parseFloat(a)-parseFloat(o)}));var r=Ya().chartColors;a.colorScale=Ct().domain(a.sortedData.map((function(e){return e[t.stringColumnIndex]}))).range(r);var i=a.sortedData.map((function(n,o){var a,r;return{label:"".concat(aa({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(a=t.columns)||void 0===a?void 0:a[t.stringColumnIndex]}),": ").concat(aa({element:n[t.numberColumnIndex]||0,column:e(t,"columns[".concat(t.numberColumnIndex,"]")),config:null===(r=t.columns)||void 0===r?void 0:r[t.dataFormatting]})).trim(),hidden:!1,dataIndex:o}}));return a.state={activeKey:a.props.activeChartElementKey,legendLabels:i},a}return pn(o)}();mn(Gi,"propTypes",an(an({},pi),{},{onAxesRenderComplete:b.func,backgroundColor:b.string,margin:b.number})),mn(Gi,"defaultProps",an(an({},mi),{},{onAxesRenderComplete:function(){},backgroundColor:"transparent",margin:40}));var Xi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"onSquareClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.legendColumn,a=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!a.length)return null;var u=[];return o.props.data.forEach((function(e,d){a.forEach((function(a,p){var m=e[a],g=Number(m),v=isNaN(g)?0:g,h=e[r],b=l[p].label,y=Ya().chartColors,C=y[0],E=v>=0?C:"rgb(221, 106, 106)",S=y[1],T=Ci({row:e,columns:t,colIndex:a,colIndex2:r,legendColumn:n,dataFormatting:i});u.push(f.createElement("rect",{key:yi(a,d),"data-test":"squares",className:"square".concat(o.state.activeKey===yi(a,d)?" active":""),x:c(h),y:s(b),width:c.bandwidth(),height:s.bandwidth(),onClick:function(){return o.onSquareClick(e,a,d)},"data-tip":T,"data-for":o.props.chartTooltipID,style:{color:S},fill:E,fillOpacity:o.opacityScale(Math.abs(v))}))}))})),f.createElement("g",null,u)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return o.opacityScale=Et().domain([r,a]).range([0,1]),o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(Xi,"propTypes",vi),mn(Xi,"defaultProps",hi);var Ji=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:0})),o.yScale=$e(an(an({},e),{},{domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:0}))})),mn(Cn(o),"render",(function(){return o.setChartData(o.props),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-heatmap-chart","data-test":"react-autoql-heatmap-chart"},f.createElement(Xi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:o.props.legendColumn})))})),o}return pn(n)}();mn(Ji,"propTypes",pi),mn(Ji,"defaultProps",mi);var Zi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"state",{activeKey:o.props.activeChartElementKey}),mn(Cn(o),"componentDidMount",(function(){Co()})),mn(Cn(o),"onCircleClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.legendColumn,a=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!a.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var u=[],d=s.bandwidth()||0,p=c.bandwidth()||0,m=Ya().chartColors,g=m[0],v=m[1];return o.props.data.forEach((function(e,m){a.forEach((function(a,h){if(!t[a].isSeriesHidden){var b=e[a],y=Number(b),C=isNaN(y)?0:y,E=e[r],S=l[h].label,T=Ci({row:e,columns:t,colIndex:a,colIndex2:r,legendColumn:n,dataFormatting:i}),D=c(E),x=s(S);u.push(f.createElement("circle",{key:yi(a,m),"data-test":"circles",className:"circle".concat(o.state.activeKey===yi(a,m)?" active":""),cx:D+p/2,cy:x+d/2,r:C<0?0:o.radiusScale(C)/2,onClick:function(){return o.onCircleClick(e,a,m)},"data-tip":T,"data-for":o.props.chartTooltipID,style:{stroke:"transparent",strokeWidth:10,fill:o.state.activeKey===yi(a,m)?v:g,fillOpacity:.7}}))}}))})),f.createElement("g",null,u)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))})));return o.radiusScale=Et().domain([r,a]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),o}return pn(n)}();mn(Zi,"propTypes",vi),mn(Zi,"defaultProps",hi);var $i=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:.1})),o.yScale=$e(an(an({},e),{},{domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:.1}))})),mn(Cn(o),"render",(function(){return o.setChartData(o.props),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},f.createElement(Zi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:o.props.legendColumn})))})),o}return pn(n)}();mn($i,"propTypes",pi),mn($i,"defaultProps",mi);var el=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var c=e.props.data.map((function(t,c){var u=0,d=0;return a.map((function(a,p){if(!n[a].isSeriesHidden){var m,g,v=t[a],h=Number(v),b=isNaN(h)?0:h,y=e.props.colorScale(a);if(!b)return null;if(b>=0){var C=u+b;g=Math.abs(s(b)-s(0)-.5),m=s(u),u=C}else{var E=d+b;g=Math.abs(s(Math.abs(b))-s(0)-.5),m=s(E),d=E}if(g<.05)return null;var S=Ci({row:t,columns:n,colIndex:a,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(a,c),className:"column".concat(e.state.activeKey===yi(a,c)?" active":""),x:m,y:l(t[r]),width:g,height:l.bandwidth(),onClick:function(){return e.onColumnClick(t,a,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:y,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-bars"},c)})),e}return pn(n)}();mn(el,"propTypes",vi),mn(el,"defaultProps",hi);var tl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.yScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"y"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"x",stacked:!0}));o.xScale=r.scale,o.xTickValues=o.xScale.tickLabels,o.xScale2=r.scale2,o.xTickValues2=null===(n=o.xScale2)||void 0===n?void 0:n.tickLabels})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex],t=o.props.columns[o.props.numberColumnIndex2];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-bar-chart"},f.createElement(el,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,xScale2:o.xScale2,yScale:o.yScale,xCol:e,xCol2:t,yCol:o.props.columns[o.props.stringColumnIndex],linearAxis:"x"})))})),o}return pn(n)}();mn(tl,"propTypes",pi),mn(tl,"defaultProps",mi);var nl=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var c=e.props.data.map((function(t,c){var u=0,d=0;return a.map((function(a,p){if(!n[a].isSeriesHidden){var m,g,v=t[a],h=Number(v),b=isNaN(h)?0:h,y=e.props.colorScale(a);if(!b)return null;if(b>=0){var C=u+b;g=Math.abs(l(b)-l(0))-.5,m=l(C)+.5,u=C}else{var E=d+b;g=Math.abs(l(b)-l(0))-.5,m=l(d)+.5,d=E}if(g<.05)return null;var S=Ci({row:t,columns:n,colIndex:a,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(a,c),className:"bar".concat(e.state.activeKey===yi(a,c)?" active":""),x:s(t[r]),y:m,width:s.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,a,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:y,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-columns"},c)})),e}return pn(n)}();mn(nl,"propTypes",vi),mn(nl,"defaultProps",hi);var ol=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var a=et(an(an({},e),{},{columnIndices1:n,axis:"y",stacked:!0}));o.yScale=a.scale})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-column-chart"},f.createElement(nl,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,linearAxis:"y",yGridLines:!0})))})),o}return pn(n)}();mn(ol,"propTypes",pi),mn(ol,"defaultProps",mi);var al=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onDotClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"createPolygonVertexDot",(function(t,n,o,a,r,i,l){var s=Ci({row:t,columns:e.props.columns,colIndex:r,colIndex2:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return f.createElement("circle",{key:"dot-".concat(yi(r,i)),className:"vertex-dot".concat(e.state.activeKey===yi(r,i)?" active":""),cy:a,cx:o,r:4,onClick:function(){return e.onDotClick(t,r,n)},"data-tip":s,"data-for":e.props.chartTooltipID,style:{opacity:e.state.activeKey===yi(r,i)?1:0,cursor:"pointer",stroke:l,strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),mn(Cn(e),"createPolygon",(function(t,n,o){var a=e.props.stringColumnIndex,r=n.map((function(e){return e.join(",")})).join(" ");return f.createElement("polygon",{key:"polygon-".concat(yi(a,t)),className:"stacked-area".concat(e.state.activeKey===yi(a,t)?" active":""),points:r,"data-tip":"\n <div>\n <strong>Field</strong>: ".concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":e.props.chartTooltipID,"data-effect":"float",style:{fill:o,fillOpacity:.7}})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.numberColumnIndices,a=t.stringColumnIndex,r=t.yScale,i=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var l=[],s=[],c=r.domain()[0];c<0&&(c=0);var u=[],d=[];return i.domain().forEach((function(e){u.push(c),d.push([i(e),r(c)])})),o.forEach((function(t,o){var c=[],p=[];if(!n[t].isSeriesHidden){var m=e.props.colorScale(t);e.props.data.forEach((function(n,l){var d=n[t],f=Number(d),g=isNaN(f)?0:f,v=i(n[a]),h=u[l]+g,b=r(h);if(c[l]=h,p.push([v,b]),0!==g){var y=e.createPolygonVertexDot(n,o,v,b,t,l,m);s.push(y)}}));var f=d.reverse().concat(p);l.push(e.createPolygon(o,f,m)),u=c,d=p}})),f.createElement("g",{"data-test":"stacked-lines"},l,s)})),e}return pn(n)}();mn(al,"propTypes",vi),mn(al,"defaultProps",hi);var rl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:1,outerPadding:0}));var a=et(an(an({},e),{},{columnIndices1:n,axis:"y",stacked:!0}));o.yScale=a.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-line-chart"},f.createElement(al,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,dateColumnsOnly:!0,yGridLines:!0})))})),o}return pn(n)}();mn(rl,"propTypes",pi),mn(rl,"defaultProps",mi);var il=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"onPointClick",(function(e,t,n){o.setState({activeKey:n})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.numberColumnIndex,a=e.numberColumnIndex2,r=e.dataFormatting,i=e.yScale,l=e.xScale;if(isNaN(n)||isNaN(a))return null;var s=Ya().chartColors,c=s[0],u=s[1],d=[];return o.props.data.forEach((function(e,s){var p=e[n],m=Number(p),g=isNaN(m)?0:m,v=e[a],h=Number(v),b=isNaN(h)?0:h,y=Ci({row:e,columns:t,colIndex:n,colIndex2:a,dataFormatting:r,aggregated:o.props.aggregated}),C=yi(n,s),E=o.state.activeKey===C;d.push(f.createElement("circle",{key:C,"data-test":"points",className:"point".concat(E?" active":""),cx:l(g),cy:i(b),r:E?6:3,onClick:function(){return o.onPointClick(e,n,C)},"data-tip":y,"data-for":o.props.chartTooltipID,style:{color:u,stroke:"transparent",fill:c,fillOpacity:.7}}))})),f.createElement("g",null,d)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return o.opacityScale=Et().domain([r,a]).range([0,1]),o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(il,"propTypes",vi),mn(il,"defaultProps",hi);var ll=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"setNumberColumnIndices",(function(e){if(o.numberColumnIndex=e.numberColumnIndex,o.numberColumnIndex2=e.numberColumnIndex2,o.numberColumnIndices=e.numberColumnIndices,o.numberColumnIndices2=e.numberColumnIndices2,isNaN(o.numberColumnIndex)||isNaN(o.numberColumnIndex2)){var t=nt(o.props.columns),n=t.numberColumnIndex,a=t.numberColumnIndex2,r=t.numberColumnIndices,i=t.numberColumnIndices2;o.numberColumnIndex=n,o.numberColumnIndex2=a,o.numberColumnIndices=r,o.numberColumnIndices2=i}})),mn(Cn(o),"setChartData",(function(e){var t=o.state,n=t.isXScaled,a=t.isYScaled;o.setNumberColumnIndices(e);var r=ot(e.data,o.numberColumnIndices,n),i=r.maxValue,l=r.minValue;o.xScale=at(an(an({},e),{},{minValue:l,maxValue:i,axis:"x",isScaled:n,columnIndex:o.numberColumnIndex,changeColumnIndices:function(t){return e.changeNumberColumnIndices(t)},allowMultipleSeries:!1}));var s=ot(e.data,o.numberColumnIndices2,a),c=s.maxValue,u=s.minValue;o.yScale=at(an(an({},e),{},{minValue:u,maxValue:c,axis:"y",isScaled:a,columnIndex:o.numberColumnIndex2,changeColumnIndices:function(t){return e.changeNumberColumnIndices(o.numberColumnIndices,t)},allowMultipleSeries:!1})),o.xScale.secondScale=o.yScale,o.yScale.secondScale=o.xScale})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e={numberColumnIndex:o.numberColumnIndex,numberColumnIndex2:o.numberColumnIndex2,numberColumnIndices:o.numberColumnIndices,numberColumnIndices2:o.numberColumnIndices2};return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-scatterplot-chart","data-test":"react-autoql-scatterplot-chart"},f.createElement(il,fn({},o.props,{xScale:o.xScale,yScale:o.yScale},e)),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.numberColumnIndex],yCol:o.props.columns[o.numberColumnIndex2]},e)))})),o.state={isXScaled:!0,isYScaled:!0},o}return pn(n)}();mn(ll,"propTypes",pi),mn(ll,"defaultProps",mi);var sl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"setChartData",(function(e){var t,n,a,r,i=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(i=e.visibleSeriesIndices);var l=e.numberColumnIndices2;null!==(n=e.visibleSeriesIndices2)&&void 0!==n&&n.length&&(l=e.visibleSeriesIndices2),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var s=et(an(an({},e),{},{columnIndices1:i,columnIndices2:l,axis:"y",isScaled:null===(a=o.state)||void 0===a?void 0:a.isChartScaled}));o.yScale=s.scale,o.yTickValues=o.yScale.tickLabels,o.yScale2=s.scale2,o.yTickValues2=null===(r=o.yScale2)||void 0===r?void 0:r.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex],t=o.props.columns[o.props.numberColumnIndex2];return o.props.height&&o.props.width?f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-line-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,yScale2:o.yScale2,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,yCol2:t,linearAxis:"y",toggleChartScale:o.toggleChartScale,yGridLines:!0}),f.createElement(Vi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),!!o.yScale2&&f.createElement(ji,fn({},o.props,{numberColumnIndices:o.props.numberColumnIndices2,xScale:o.xScale,yScale:o.yScale2,colorScale:o.props.colorScale2})))):null})),o.state={isChartScaled:!0},o}return pn(n)}();mn(sl,"propTypes",pi),mn(sl,"defaultProps",mi);var cl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentWillUnmount",(function(){clearTimeout(o.debounceTimer),clearTimeout(o.throttleTimer)})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.value!==t.value&&(o.props.throttle?o.throttledOnChange(o.state.value):o.props.debounce?o.debouncedOnChange(o.state.value):o.props.onChange(o.state.value))})),mn(Cn(o),"debouncedOnChange",(function(e){o.props.debounce?(clearTimeout(o.debounceTimer),o.debounceTimer=setTimeout((function(){o.props.onChange(e)}),o.props.debounceDelay)):o.props.onChange(e)})),mn(Cn(o),"throttledOnChange",(function(e){o.inThrottle||(o.props.onChange(e),o.inThrottle=!0,o.throttleTimer=setTimeout((function(){return o.inThrottle=!1}),o.props.throttleDelay))})),mn(Cn(o),"onInputChange",(function(e){var t=e.target.value,n=o.isValueValidForSlider(t)?Number(t):o.state.value;o.setState({inputValue:t,value:n})})),mn(Cn(o),"onInputBlur",(function(){o.state.inputValue!==o.state.value&&o.setState({inputValue:o.state.value})})),mn(Cn(o),"isValueValidForSlider",(function(e){var t=Number(e);return!isNaN(e)&&t>=o.props.min&&t<=o.props.max})),mn(Cn(o),"onSliderChange",(function(e){o.setState({value:e,inputValue:e})})),mn(Cn(o),"renderThumb",(function(e,t){var n=t.valueNow;return o.props.renderThumbNumber&&o.props.valueFormatter&&(n=o.props.valueFormatter(t.valueNow)),f.createElement("div",e,!!o.props.renderThumbNumber&&f.createElement("div",{className:"react-autoql-slider-value-bubble"},n))})),mn(Cn(o),"render",(function(){var e,t,n,a=o.props.min,r=o.props.max,i=void 0;isNaN(o.props.step)||(i="".concat(o.props.step)),isNaN(a)&&(a=0),isNaN(r)&&(r=100);var l=[a,r];return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-slider-wrapper ".concat(null!==(e=o.props.className)&&void 0!==e?e:""," ").concat(Pe?"mobile":""),style:o.props.style},f.createElement("div",{className:"react-autoql-slider-and-label-container"},f.createElement("div",{className:"react-autoql-slider-container"},f.createElement("div",{className:"react-autoql-slider-min-max-labels"},f.createElement("div",{className:"react-autoql-slider-mark-label"},null!==(t=o.props.minLabel)&&void 0!==t?t:a),f.createElement("label",{id:"react-autoql-slider-label",className:"react-autoql-slider-label"},o.props.label),f.createElement("div",{className:"react-autoql-slider-mark-label"},null!==(n=o.props.maxLabel)&&void 0!==n?n:r)),f.createElement(_t,{className:"react-autoql-slider",thumbClassName:"react-autoql-slider-thumb",trackClassName:"react-autoql-slider-track",markClassName:"react-autoql-slider-mark",ariaLabelledby:"react-autoql-slider-label",thumbActiveClassName:"react-autoql-slider-thumb-active",min:a,max:r,step:o.props.step,marks:l,value:o.state.value,onChange:o.onSliderChange,renderThumb:o.renderThumb}))),o.props.showInput&&f.createElement("div",{className:"react-autoql-slider-input-wrapper"},f.createElement(xr,{type:"number",value:"".concat(o.state.inputValue),onChange:o.onInputChange,onBlur:o.onInputBlur,min:a,max:r,step:i}))))})),o.state={value:e.initialValue,inputValue:e.initialValue},o}return pn(n)}();mn(cl,"propTypes",{renderThumbNumber:b.bool,initialValue:b.number,min:b.number,max:b.number,minLabel:b.string,maxLabel:b.string,marks:b.oneOfType([b.number,b.array,b.bool]),debounce:b.bool,debounceDelay:b.number,showInput:b.bool,label:b.string,step:b.number,onChange:b.func}),mn(cl,"defaultProps",{renderThumbNumber:!0,initialValue:void 0,min:0,max:100,minLabel:void 0,maxLabel:void 0,marks:10,debounce:!1,throttle:!0,debounceDelay:20,throttleDelay:20,showInput:!1,label:void 0,step:1,onChange:function(){}});var ul=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"componentDidUpdate",(function(t){var n,o;(null===(n=t.buckets)||void 0===n?void 0:n.length)!==(null===(o=e.props.buckets)||void 0===o?void 0:o.length)&&Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a,r=yi(o);e.props.onChartClick({activeKey:r,filter:{name:null===(a=e.props.columns[e.props.numberColumnIndex])||void 0===a?void 0:a.name,value:"".concat(t,",").concat(n),operator:"between",column_type:"AMOUNT"}}),e.setState({activeKey:r})})),mn(Cn(e),"getBars",(function(){var t,n=e.props,o=n.xScale,a=n.yScale,r=n.buckets;if(!o||!a||null==r||!r.length)return null;var i=null===(t=Ya())||void 0===t||null===(t=t.chartColors)||void 0===t?void 0:t[0];return e.props.buckets.map((function(t,n){if(!t)return null;var r=o.getValue(t.x0)+1,l=a(t.length),s=Math.max(0,o.getValue(t.x1)-o.getValue(t.x0)-1),c=a(0)-a(t.length),u=aa({element:t.x0,column:o.column,config:o.dataFormatting}),d=aa({element:t.x1,column:o.column,config:o.dataFormatting}),p="<div><strong>".concat(o.title," (Range):</strong> ").concat(u," - ").concat(d,"</div>\n <div><strong>Count:</strong> ").concat(t.length,"</div>"),m=yi(n);return f.createElement("rect",{key:m,className:"bar".concat(e.state.activeKey===m?" active":""),"data-test":"bar-".concat(n),x:r,y:l,height:c,width:s,onClick:function(){return e.onColumnClick(t.x0,t.x1,n)},"data-tip":p,"data-for":e.props.chartTooltipID,style:{fill:i,fillOpacity:1,cursor:"default"}})}))})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.getBars();return f.createElement("g",{"data-test":"columns"},t)})),e}return pn(n)}();mn(ul,"propTypes",vi),mn(ul,"defaultProps",hi);var dl=function(e){var t=e.value,n=e.mean,o=e.stdDev;return Ft.normal.pdf(t,n,o)},pl=function(e){var t=e.value,n=1/e.mean;return Ft.exponential.pdf(t,n)},ml=["d","key","className","strokeWidth","stroke","fill","tooltip"],fl=function(e){gn(n,v);var t=Sn(n);function n(e){var o,a,r;un(this,n),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(r),"createEquallySpacedPoints",(function(e,t){var n=e[0],o=(e[1]-n)/(t-1);return Tn(Array(t).keys()).map((function(e){return n+e*o}))})),mn(Cn(r),"formatValue",(function(e){var t;return aa({element:e,column:null===(t=r.props.xScale)||void 0===t?void 0:t.column,config:r.props.dataFormatting})})),mn(Cn(r),"createPathWithHoverStroke",(function(e){var t=e.d,n=e.key,o=e.className,a=e.strokeWidth,i=void 0===a?1:a,l=e.stroke,s=e.fill,c=void 0===s?"none":s,u=e.tooltip,d=yn(e,ml);return f.createElement("g",{key:"".concat(n,"-group")},f.createElement("path",fn({d:t,key:n,className:o,stroke:l,strokeWidth:1,fill:c,style:{color:l}},d)),f.createElement("path",{d:t,key:"".concat(n,"-hover"),className:"path-hover-line","data-tip":u,"data-for":r.props.chartTooltipID,"data-effect":"float",stroke:"transparent",strokeWidth:i+5,fill:"none"}))})),mn(Cn(r),"getScaledBucketProbability",(function(e,t){return e.fn({value:t,mean:r.mean,stdDev:r.stdDev,median:r.median,dataSize:r.props.data.length})*r.scaleFactor})),mn(Cn(r),"getDistributionLines",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=r.props,o=n.xScale,a=n.yScale,i=n.colorScale,l=i(t+1),s=[],c=a.range(),u=o.range(),d=r.createEquallySpacedPoints(o.domain(),1e3),p=[],m=[];if(d.forEach((function(t,n){var i=r.getScaledBucketProbability(e,t),l=o.getValue(t),s=a.getValue(i);s<c[0]&&s>c[1]?m.push([l,s]):m.length&&(p.push(m),m=[]),n===(null==d?void 0:d.length)-1&&m.length&&p.push(m)})),p.forEach((function(n){s.push(r.createPathWithHoverStroke({d:Ki(n,r.PATH_SMOOTHING),key:"distribution-line-".concat(e.type,"-").concat(r.COMPONENT_KEY,"-").concat(t),tooltip:e.tooltip({mean:r.mean,stdDev:r.stdDev}),className:"distribution-line",stroke:r.props.colorScale(t+1)}))})),r.TYPES_WITH_MEAN.includes(e.type)){var f=r.getScaledBucketProbability(e,r.mean),g=a.getValue(f);g>c[0]&&(g=c[0]);var v=r.props.xScale(r.mean),h=[v,c[1]],b=[v,c[0]],y=[h,b],C=r.createPathWithHoverStroke({d:Ki(y,0),key:"distribution-mean-line-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Mean: ".concat(r.formatValue(r.mean)),stroke:l,strokeDasharray:6});s.push(C)}if(r.TYPES_WITH_STD_DEV.includes(e.type)){var E=r.mean-r.stdDev,S=o.getValue(E);if(S>=u[0]){var T=r.getScaledBucketProbability(e,E),D=a.getValue(T);D<c[1]&&(D=c[1]);var x=[S,a.getValue(T)],R=[S,a.getValue(0)],I=[R,x],A=r.createPathWithHoverStroke({d:Ki(I,0),key:"distribution-stddev-line-left-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Standard Deviation: ±".concat(r.formatValue(r.stdDev)),stroke:l,strokeDasharray:6});s.push(A)}var N=r.mean+r.stdDev,w=o.getValue(N);if(w<=u[1]){var k=r.getScaledBucketProbability(e,N),P=a.getValue(k);P<c[1]&&(P=c[1]);var O=[w,P],L=[w,r.props.yScale(0)],M=[L,O],q=r.createPathWithHoverStroke({d:Ki(M,0),key:"distribution-stddev-line-right-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Standard Deviation: ±".concat(r.formatValue(r.stdDev)),stroke:l,strokeDasharray:6});s.push(q)}}return s})),mn(Cn(r),"render",(function(){var e,t;if(!r.state.activeDistribution||r.props.isLoading)return null;var n=r.DISTRIBUTION_TYPES.find((function(e){return e.type===r.state.activeDistribution}));if(!n)return null;var o=r.props,a=o.xScale,i=o.yScale,l=o.numberColumnIndex,s=o.data,c=o.buckets;if(!a||!i||null==s||!s.length||isNaN(l)||null==c||!c.length)return null;var u=s.map((function(e){return e[l]})),d=null!==(e=c[1])&&void 0!==e?e:c[0];r.mean=xt(u),r.stdDev=Rt(u),r.median=It(u),r.bucketSize=d.x1-d.x0,r.scaleFactor=r.bucketSize*(null===(t=r.props.data)||void 0===t?void 0:t.length);var p=r.getDistributionLines(n);return f.createElement("g",{"data-test":"distribution-lines"},p)})),r.PATH_SMOOTHING=.2,r.COMPONENT_KEY=C();var i=new Intl.NumberFormat(null!==(o=null===(a=e.dataFormatting)||void 0===a?void 0:a.languageCode)&&void 0!==o?o:"en-US",{maximumFractionDigits:5});return r.DISTRIBUTION_TYPES=[{type:"normal",fn:dl,tooltip:function(e){var t=e.mean,n=e.stdDev;return"Normal Distribution<br/>Mean: ".concat(r.formatValue(t),"<br/>Standard Deviation: ±").concat(r.formatValue(n))}},{type:"exponential",fn:pl,tooltip:function(e){var t=e.mean;return"Exponential Distribution<br/>Lambda: ".concat(i.format(1/t))}}],r.TYPES_WITH_MEAN=["normal"],r.TYPES_WITH_STD_DEV=["normal"],r.state={activeDistribution:void 0},r}return pn(n)}();mn(fl,"propTypes",vi),mn(fl,"defaultProps",hi);var gl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"getDefaultBucketConfig",(function(e,t){var n,o,a={bucketSize:t,minBucketSize:void 0,maxBucketSize:void 0,minNumBuckets:5,maxNumBuckets:20,bucketStepSize:1};return(null==e||null===(n=e.data)||void 0===n?void 0:n.length)<5&&(a.minNumBuckets=2),(null==e||null===(o=e.data)||void 0===o?void 0:o.length)<20&&(a.maxNumBuckets=e.data.length),a})),mn(Cn(o),"getInitialBucketSize",(function(e,t){var n,a=Math.round(1+Math.log2(null===(n=o.props.data)||void 0===n?void 0:n.length)),r=_a((t-e)/a,o.bucketConfig.bucketStepSize);return r<o.bucketConfig.minBucketSize?r=o.bucketConfig.minBucketSize:r>o.bucketConfig.maxBucketSize&&(r=o.bucketConfig.maxBucketSize),r})),mn(Cn(o),"getBinData",(function(e){var t,n,a,r,i=Dt(o.props.data,(function(e){return Ei(e[o.props.numberColumnIndex])})),l=Tt(o.props.data,(function(e){return Ei(e[o.props.numberColumnIndex])}));i===l&&(i-=1,l+=1);var s,c,u=(l-i)/(null!==(t=o.bucketConfig.minNumBuckets)&&void 0!==t?t:1)-(l-i)/(null!==(n=o.bucketConfig.maxNumBuckets)&&void 0!==n?n:1);if(u<=10){o.bucketConfig.bucketStepSize=(s=u/100,c=Math.pow(10,Math.ceil(Math.log10(s))),parseFloat(c.toPrecision(1)))}o.bucketConfig.maxBucketSize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.floor(e/t)*t}((l-i)/(null!==(a=o.bucketConfig.minNumBuckets)&&void 0!==a?a:1),o.bucketConfig.bucketStepSize),o.bucketConfig.minBucketSize=_a((l-i)/(null!==(r=o.bucketConfig.maxNumBuckets)&&void 0!==r?r:1),o.bucketConfig.bucketStepSize),o.bucketConfig.minBucketSize<=0&&(o.bucketConfig.minBucketSize=o.bucketConfig.bucketStepSize),o.bucketConfig.maxBucketSize===o.bucketConfig.minBucketSize&&(o.bucketConfig.maxBucketSize=o.bucketConfig.minBucketSize+o.bucketConfig.bucketStepSize),e<o.bucketConfig.maxBucketSize&&e>o.bucketConfig.minBucketSize?o.bucketConfig.bucketSize=e:o.bucketConfig.bucketSize=void 0,o.bucketConfig.bucketSize||(o.bucketConfig.bucketSize=o.getInitialBucketSize(i,l));for(var d=_a(i,o.bucketConfig.bucketSize),p=[d];d<l;)d+=o.bucketConfig.bucketSize,p.push(d);return{buckets:At().value((function(e){return e[o.props.numberColumnIndex]})).domain([p[0],p[p.length-1]]).thresholds(p)(o.props.data),bins:p}})),mn(Cn(o),"changeNumberColumnIndices",(function(e,t,n){var a=Dt(o.props.data,(function(t){return Ei(t[e[0]])})),r=Tt(o.props.data,(function(t){return Ei(t[e[0]])}));o.setInitialBucketSize(a,r),o.props.changeNumberColumnIndices(e,t,n,bucketSize)})),mn(Cn(o),"setChartData",(function(e,t){o.xScale&&o.props.numberColumnIndex!==o.xScale.columnIndex&&(o.props.onBucketSizeChange(void 0),o.bucketConfig=o.getDefaultBucketConfig(e));var n=e.data.map((function(t){return t[e.numberColumnIndex]})).filter(Xo).length;n<o.bucketConfig.maxBucketSize&&(o.bucketConfig.maxNumBuckets=n);var a=o.getBinData(t),r=a.buckets,i=a.bins;o.buckets=r,o.bins=i,o.xScale=rt(an(an({},e),{},{columnIndex:e.numberColumnIndex,axis:"x",buckets:o.buckets,bins:i})),o.yScale=it(an(an({},e),{},{axis:"y",buckets:o.buckets,columnIndex:e.numberColumnIndex}))})),mn(Cn(o),"onBucketSizeChange",(function(e){o.setState({bucketSize:e}),o.props.onBucketSizeChange(e)})),mn(Cn(o),"formatSliderLabel",(function(e){var t,n=o.bucketConfig.bucketStepSize<1?o.bucketConfig.bucketStepSize.toString().split(".")[1].length:void 0;return null===(t=Ze({d:e,column:o.props.columns[o.props.numberColumnIndex],dataFormatting:o.props.dataFormatting,scale:o.xScale,sigDigits:n}))||void 0===t?void 0:t.fullWidthLabel})),mn(Cn(o),"renderHistogramSlider",(function(){if(isNaN(o.bucketConfig.bucketSize)||isNaN(o.bucketConfig.minBucketSize)||isNaN(o.bucketConfig.maxBucketSize))return null;var e=o.bucketConfig.minBucketSize,t=o.bucketConfig.maxBucketSize;return f.createElement(cl,{key:"".concat(o.HISTOGRAM_SLIDER_KEY,"-").concat(o.props.numberColumnIndex),className:"react-autoql-histogram-slider",initialValue:o.bucketConfig.bucketSize,min:e,max:t,step:o.bucketConfig.bucketStepSize,minLabel:o.formatSliderLabel(e),maxLabel:o.formatSliderLabel(t),onChange:o.onBucketSizeChange,valueFormatter:o.formatSliderLabel,label:"Interval size",showInput:!0,marks:!0})})),mn(Cn(o),"render",(function(){return o.setChartData(o.props,o.state.bucketSize),f.createElement(f.Fragment,null,o.props.portalRef&&Vt(o.renderHistogramSlider(),o.props.portalRef),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-histogram-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,changeNumberColumnIndices:o.changeNumberColumnIndices,linearAxis:"y",yGridLines:!0}),f.createElement(ul,fn({},o.props,{xScale:o.xScale,yScale:o.yScale,buckets:o.buckets,bins:o.bins})),f.createElement(fl,fn({},o.props,{xScale:o.xScale,yScale:o.yScale,buckets:o.buckets})))))})),o.bucketConfig=o.getDefaultBucketConfig(e,e.initialBucketSize),o.state={bucketSize:e.initialBucketSize},o.setChartData(o.props,e.initialBucketSize),o}return pn(n)}();mn(gl,"propTypes",an(an({},pi),{},{initialBucketSize:y.number,onBucketSizeChange:y.func})),mn(gl,"defaultProps",an(an({},mi),{},{initialBucketSize:void 0,onBucketSizeChange:function(){}}));var vl=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;un(this,o),mn(Cn(a=t.call(this,e)),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),mn(Cn(a),"componentDidMount",(function(){a._isMounted=!0,a.props.isResizing||a.props.hidden||(a.firstRender=!1,a.forceUpdate())})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){if(a.props.isResizing&&!e.isResizing)return a.shouldRecalculateDimensions=!0,!0;if(a.props.dataChangeCount!==e.dataChangeCount)return!0;if(e.isResizing&&a.props.isResizing||e.hidden&&a.props.hidden)return!1;var n=Ma(a.props,e),o=Ma(a.state,t);return!n||!o})),mn(Cn(a),"componentDidUpdate",(function(e){if(a._isMounted){if(!0!==a.firstRender||a.props.hidden||(a.firstRender=!1),a.props.hidden&&!e.hidden&&(a.firstRender=!0),(!a.props.isResizing&&e.isResizing&&!a.props.hidden||!a.props.hidden&&e.hidden)&&(a.chartContainerRef&&(a.chartContainerRef.style.flexBasis="100vh"),a.setState({chartID:C(),deltaX:0,deltaY:0,isLoading:!0})),a.props.type!==e.type&&eo.includes(a.props.type)&&!Uo(a.props.columns[a.props.stringColumnIndex])){var t=jo(a.props.columns);a.props.changeStringColumnIndex(t)}else if(a.props.type!==e.type&&to.includes(a.props.type)){var o=a.props.numberColumnIndices.filter((function(e){return a.props.numberColumnIndices2.includes(e)}));if(!(null==o||!o.length)){console.debug("Selected columns already exist on the other axis. Exiting");var r=a.props.numberColumnIndices.filter((function(e){return!a.props.numberColumnIndices2.includes(e)}));a.props.changeNumberColumnIndices(r,a.props.numberColumnIndices2)}}if(a._isMounted&&(!a.props.isDrilldownChartHidden&&e.isDrilldownChartHidden||e.type&&a.props.type!==e.type)&&a.setState({chartID:C(),deltaX:0,deltaY:0,isLoading:!0}),function(e,t){var o,a;return(null===(o=e.data)||void 0===o?void 0:o.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||e.stringColumnIndex!==t.stringColumnIndex||e.numberColumnIndex!==t.numberColumnIndex||!n(e.legendColumn,t.legendColumn)||!n(e.columns,t.columns)||!n(e.numberColumnIndices,t.numberColumnIndices)||!n(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!n(e.data,t.data)}(a.props,e)||a.props.dataChangeCount!==e.dataChangeCount){var i=a.getData(a.props);a.setState({data:i,chartID:C(),deltaX:0,deltaY:0,isLoading:!0})}}})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.adjustVerticalPositionTimeout)})),mn(Cn(a),"getColorScales",(function(){var e,t,n=a.props,o=n.numberColumnIndices,r=n.numberColumnIndices2,i=Ya(),l=i.chartColors,s=function(e,t){var n=Tn(e);(t%=e.length)<0&&(t=e.length+t);for(var o=0;o<t;o++)n.unshift(n.pop());return n}(i.chartColorsDark,-1*(null!==(e=null==o?void 0:o.length)&&void 0!==e?e:1)),c=Ct().range(l).domain(o);return null!=r&&r.length&&(t=Ct().range(s).domain(r)),{colorScale:c,colorScale2:t}})),mn(Cn(a),"getData",(function(e){var t,n;if(null!==(t=e.data)&&void 0!==t&&t.length&&null!==(n=e.columns)&&void 0!==n&&n.length){if(e.isDataAggregated)return ka(e.data,e.columns,"asc");var o,a,r=null!==(o=e.numberColumnIndices)&&void 0!==o?o:[],i=null!==(a=e.numberColumnIndices2)&&void 0!==a?a:[],l=[].concat(Tn(r),Tn(i)).filter(Xo);if(l.length)return lt({data:e.data,aggColIndex:e.stringColumnIndex,columns:e.columns,numberIndices:l,dataFormatting:e.dataFormatting})}})),mn(Cn(a),"setFinishedLoading",(function(){clearTimeout(a.loadingTimeout),a.loadingTimeout=setTimeout((function(){a._isMounted&&a.setState({isLoading:!1})}),0)})),mn(Cn(a),"adjustVerticalPosition",(function(){a.props.hidden||(clearTimeout(a.adjustVerticalPositionTimeout),a.adjustVerticalPositionTimeout=setTimeout((function(){if(a._isMounted){var e=a.getDeltas().deltaY,t=a.getInnerDimensions().innerHeight;a.setState({deltaY:e,innerHeight:t},(function(){a.setFinishedLoading()}))}}),0))})),mn(Cn(a),"adjustChartPosition",(function(){a.props.hidden||(clearTimeout(a.adjustPositionTimeout),a.adjustPositionTimeout=setTimeout((function(){if(a._isMounted){var e=a.getDeltas(),t=e.deltaX,n=e.deltaY,o=a.getInnerDimensions(),r=o.innerHeight,i=o.innerWidth;a.setState({deltaX:t,deltaY:n,innerHeight:r,innerWidth:i},(function(){a.adjustVerticalPosition()}))}}),0))})),mn(Cn(a),"getDeltas",(function(){var e,t,n;if("pie"===a.props.type)return{deltaX:0,deltaY:0};var o=ia(null===(e=a.innerChartRef)||void 0===e?void 0:e.chartRef);return{deltaX:-1*Math.ceil(null!==(t=null==o?void 0:o.x)&&void 0!==t?t:0)+a.PADDING,deltaY:-1*Math.ceil(null!==(n=null==o?void 0:o.y)&&void 0!==n?n:0)+a.PADDING}})),mn(Cn(a),"getRenderedChartDimensions",(function(){var e,t,n,o,r,i,l,s,c,u=null===(e=a.innerChartRef)||void 0===e||null===(e=e.axesRef)||void 0===e||null===(e=e.leftAxis)||void 0===e||null===(e=e.ref)||void 0===e?void 0:e.getBoundingClientRect(),d=null===(t=a.innerChartRef)||void 0===t||null===(t=t.axesRef)||void 0===t||null===(t=t.topAxis)||void 0===t||null===(t=t.ref)||void 0===t?void 0:t.getBoundingClientRect(),p=null===(n=a.innerChartRef)||void 0===n||null===(n=n.axesRef)||void 0===n||null===(n=n.bottomAxis)||void 0===n?void 0:n.getBoundingClientRect(),m=null===(o=a.innerChartRef)||void 0===o||null===(o=o.axesRef)||void 0===o||null===(o=o.rightAxis)||void 0===o?void 0:o.getBoundingClientRect(),f=null===(r=a.innerChartRef)||void 0===r||null===(r=r.axesRef)||void 0===r||null===(r=r.legendRef)||void 0===r||null===(r=r.legendClippingContainer)||void 0===r?void 0:r.getBoundingClientRect(),g=Ti([u,p,m,d,f]),v=null!==(i=null==g?void 0:g.width)&&void 0!==i?i:0;return{chartHeight:null!==(l=null==g?void 0:g.height)&&void 0!==l?l:0,chartWidth:v,chartX:null!==(s=null==g?void 0:g.x)&&void 0!==s?s:0,chartY:null!==(c=null==g?void 0:g.y)&&void 0!==c?c:0}})),mn(Cn(a),"getInnerDimensions",(function(){var e,t,n,o,r,i,l=a.getRenderedChartDimensions(),s=l.chartWidth,c=l.chartHeight,u="number"==typeof a.props.width?a.props.width:void 0,d="number"==typeof a.props.height?a.props.height:void 0,p=null!==(e=null!=u?u:null===(t=a.chartContainerRef)||void 0===t?void 0:t.clientWidth)&&void 0!==e?e:0,m=null!==(n=null!=d?d:null===(o=a.chartContainerRef)||void 0===o?void 0:o.clientHeight)&&void 0!==n?n:0,f=p-2*a.PADDING;null!==(r=a.innerChartRef)&&void 0!==r&&r.xScale&&s&&(f=p-(s-(a.innerChartRef.xScale.range()[1]-a.innerChartRef.xScale.range()[0]))-2*a.PADDING);var g=m-2*a.PADDING;null!==(i=a.innerChartRef)&&void 0!==i&&i.yScale&&c&&(g=m-(c-(a.innerChartRef.yScale.range()[0]-a.innerChartRef.yScale.range()[1]))-2*a.PADDING);return f<1&&(f=1),g<1&&(g=1),{innerWidth:f,innerHeight:g}})),mn(Cn(a),"getOuterDimensions",(function(){var e={outerHeight:a.outerHeight,outerWidth:a.outerWidth};if(a.props.hidden||a.props.isAnimating||a.firstRender)return e;if(!a.outerWidth||!a.outerHeight||a.shouldRecalculateDimensions){var t,n,o;a.shouldRecalculateDimensions=!1;var r=null===(t=a.chartContainerRef)||void 0===t?void 0:t.getBoundingClientRect(),i=null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0,l=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:0,s=Math.ceil(i),c=Math.ceil(l);return a.outerWidth=s,a.outerHeight=c,{outerHeight:c,outerWidth:s}}return e})),mn(Cn(a),"getLegendLabels",(function(){var e;return Xe(a.props.columns,null===(e=a.getColorScales())||void 0===e?void 0:e.colorScale,a.props.numberColumnIndices)})),mn(Cn(a),"getBase64Data",(function(e){return a.chartRef?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return new Promise((function(n,o){try{var a=e.getBoundingClientRect(),r=a.width,i=a.height,l=r*t,s=i*t,c=e.cloneNode(!0);c.setAttribute("transform-origin","top left"),c.setAttribute("transform","scale(".concat(t,")")),c.setAttribute("width",l+"px"),c.setAttribute("height",s+"px");var u=ra(c),d=document.createElement("canvas");d.style.width=r+"px",d.style.height=i+"px",d.width=l,d.height=s;var p=d.getContext("2d"),m=new Image;m.onload=function(){p.drawImage(this,0,0,l,s),n(d.toDataURL("image/png",1))},m.onerror=function(){o("failed to load image")},m.src=u}catch(e){console.error(e),o("failed to convert svg to png "+e)}}))}(a.chartRef,e):Promise.reject()})),mn(Cn(a),"saveAsPNG",(function(e){try{a.getBase64Data(e).then((function(e){var t=document.createElement("a");t.download="Chart.png",t.href=e,t.click()}))}catch(e){return void console.error(e)}})),mn(Cn(a),"setIsLoadingMoreRows",(function(e){a._isMounted&&a.setState({isLoadingMoreRows:e})})),mn(Cn(a),"onBucketSizeChange",(function(e){a.props.onBucketSizeChange(e),a.bucketSize=e})),mn(Cn(a),"renderChartHeader",(function(){var e=a.state.deltaX-10;return(Pe||e<0||a.outerWidth<300)&&(e=25),f.createElement("div",{ref:function(e){return a.sliderRef=e},style:{paddingLeft:e},className:"react-autoql-chart-header-container ".concat(a.state.isLoading||a.props.isResizing?"loading":"")})})),mn(Cn(a),"getCommonChartProps",(function(){var e,t=a.state,n=t.deltaX,o=t.deltaY,r=a.props,i=r.numberColumnIndices,l=r.columns,s=r.enableDynamicCharting,c=i.filter((function(e){return(null==l?void 0:l[e])&&!l[e].isSeriesHidden})),u=a.getInnerDimensions(),d=u.innerHeight,p=u.innerWidth,m=a.getOuterDimensions(),f=m.outerHeight,g=m.outerWidth,v=a.getColorScales(),h=v.colorScale,b=v.colorScale2,y=!yo.includes(a.props.type),C=(y?a.state.data:null)||a.props.data;return an(an({},a.props),{},{columns:l,setIsLoadingMoreRows:a.setIsLoadingMoreRows,ref:function(e){return a.innerChartRef=e},innerChartRef:null===(e=a.innerChartRef)||void 0===e?void 0:e.chartRef,key:void 0,data:C,aggregated:y,disableTimeScale:a.disableTimeScale,colorScale:h,colorScale2:b,height:d,width:p,outerHeight:f,outerWidth:g,deltaX:n,deltaY:o,chartPadding:a.PADDING,enableAxisDropdown:s&&!a.props.isAggregated,legendLocation:Si(i,a.props.type,a.props.legendLocation),onLabelRotation:a.adjustVerticalPosition,visibleSeriesIndices:c,tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID,chartContainerRef:a.chartContainerRef,popoverParentElement:a.props.popoverParentElement,totalRowCount:a.props.totalRowCount,chartID:a.state.chartID,isLoading:a.state.isLoading,changeNumberColumnIndices:a.props.changeNumberColumnIndices,onAxesRenderComplete:a.adjustChartPosition})})),mn(Cn(a),"renderChartLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(Ro,null)))})),mn(Cn(a),"renderChart",(function(){var e=a.getCommonChartProps();switch(a.props.type){case"column":return f.createElement(_i,fn({},e,{legendLabels:a.getLegendLabels()}));case"bar":return f.createElement(zi,fn({},e,{legendLabels:a.getLegendLabels()}));case"line":return f.createElement(Wi,fn({},e,{legendLabels:a.getLegendLabels()}));case"pie":return f.createElement(Gi,fn({},e,{legendLabels:a.getLegendLabels()}));case"bubble":return f.createElement($i,fn({},e,{legendLabels:a.getLegendLabels()}));case"heatmap":return f.createElement(Ji,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_column":return f.createElement(ol,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_bar":return f.createElement(tl,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_line":return f.createElement(rl,fn({},e,{legendLabels:a.getLegendLabels()}));case"column_line":var t,n=null===(t=a.props.numberColumnIndices2)||void 0===t?void 0:t.filter((function(e){var t;return(null===(t=a.props.columns)||void 0===t?void 0:t[e])&&!a.props.columns[e].isSeriesHidden}));return f.createElement(sl,fn({},e,{visibleSeriesIndices2:n,legendLabels:a.getLegendLabels()}));case"histogram":return f.createElement(gl,fn({},e,{initialBucketSize:a.bucketSize,onBucketSizeChange:a.onBucketSizeChange,portalRef:a.sliderRef}));case"scatterplot":return f.createElement(ll,e);default:return"Unknown Display Type"}})),mn(Cn(a),"render",(function(){var e;if(null===(e=a.state.data)||void 0===e||!e.length)return null;var t=Ua("font-family"),n=Ua("text-color-primary"),o=Ua("background-color-secondary");return f.createElement(Rn,null,f.createElement(f.Fragment,null,a.renderChartHeader(),f.createElement("div",{id:"react-autoql-chart-".concat(a.state.chartID),key:"react-autoql-chart-".concat(a.state.chartID),ref:function(e){return a.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container\n ".concat(a.state.isLoading||a.props.isResizing?"loading":"","\n ").concat(a.state.isLoadingMoreRows?"loading-rows":"","\n ").concat(a.props.hidden?"hidden":"")},!a.firstRender&&!a.props.isResizing&&!a.props.isAnimating&&f.createElement("svg",{ref:function(e){return a.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",style:{fontSize:"12px",fontFamily:t,color:n,background:o}},f.createElement("g",{transform:"translate(".concat(a.state.deltaX,", ").concat(a.state.deltaY,")"),className:"react-autoql-chart-content-container"},a.renderChart())),a.state.isLoadingMoreRows&&a.renderChartLoader())))}));var r=a.getData(e);return a.PADDING=0,a.FONT_SIZE=12,a.HISTOGRAM_SLIDER_KEY=C(),a.firstRender=!0,a.bucketSize=e.bucketSize,a.shouldRecalculateDimensions=!1,a.state={chartID:C(),data:r,deltaX:0,deltaY:0,isLoading:!0,isLoadingMoreRows:!1},a}return pn(o)}();mn(vl,"propTypes",an(an({},ui),{},{type:b.string.isRequired,onBucketSizeChange:b.func})),mn(vl,"defaultProps",an(an({},di),{},{onBucketSizeChange:function(){}}));var hl=function(t){gn(r,f.Component);var a=Sn(r);function r(t){var i,l,s,c,u,d,p,m,g;un(this,r),mn(Cn(g=a.call(this,t)),"componentDidMount",(function(){try{g.onRenderComplete(),g._isMounted=!0,g.updateToolbars(),g.props.onMount()}catch(e){console.error(e),g.props.onErrorCallback(e)}})),mn(Cn(g),"shouldComponentUpdate",(function(e,t){return!(!g.props.shouldRender&&!e.shouldRender)&&((!g.props.isResizing||!e.isResizing)&&(!(!g.props.queryResponse&&!g.queryResponse)&&(!Ma(g.props,e)||!Ma(g.state,t))))})),mn(Cn(g),"componentDidUpdate",(function(e,t){try{var o,a,r={},i=!1;g.props.queryResponse&&!e.queryResponse&&g.onRenderComplete(),g.props.onDisplayTypeChange&&g.state.displayType!==t.displayType&&g.props.onDisplayTypeChange(g.state.displayType),n(g.props.initialTableConfigs,{tableConfig:g.tableConfig,pivotTableConfig:g.pivotTableConfig})||!g.props.onTableConfigChange||g.hasCalledInitialTableConfigChange||(g.hasCalledInitialTableConfigChange=!0,g.onTableConfigChange()),n(g.state.aggConfig,t.aggConfig)||g.props.onAggConfigChange(g.state.aggConfig),t.displayType!==g.state.displayType&&Co(),((null===(o=g.state.visibleRows)||void 0===o?void 0:o.length)!==(null===(a=t.visibleRows)||void 0===a?void 0:a.length)||"table"===g.state.displayType&&"text"===t.displayType)&&setTimeout((function(){g.props.onRowChange()}),0);var l=g.state.columnChangeCount!==t.columnChangeCount,s=g.state.visibleRowChangeCount!==t.visibleRowChangeCount;if(l||s){l&&g.props.onColumnChange(g.state.columns),g.shouldGeneratePivotData()&&(g.generatePivotData({isFirstGeneration:!0,dataChanged:!0}),i=!0);var c=g.getCurrentSupportedDisplayTypes();n(c,g.state.supportedDisplayTypes)||(r.supportedDisplayTypes=c)}n(g.state.supportedDisplayTypes,t.supportedDisplayTypes)||g.isCurrentDisplayTypeValid()||(r.displayType=g.getUpdatedDefaultDisplayType("table")),g.updateToolbars(),_e(r)?i&&g.forceUpdate():g.setState(r)}catch(e){console.error(e)}})),mn(Cn(g),"componentWillUnmount",(function(){try{g._isMounted=!1,Eo()}catch(e){console.error(e)}})),mn(Cn(g),"onChartRenderComplete",(function(){ca(g.state.displayType)&&g.props.onRenderComplete()})),mn(Cn(g),"onTableRenderComplete",(function(){"table"===g.state.displayType&&g.props.onRenderComplete()})),mn(Cn(g),"onPivotTableRenderComplete",(function(){"pivot_table"===g.state.displayType&&g.props.onRenderComplete()})),mn(Cn(g),"onRenderComplete",(function(){g.props.queryResponse&&(g._isMounted||(ca(g.state.displayType)||ua(g.state.displayType))&&!Ca(g.queryResponse)||(g.renderComplete=!0,g.props.onRenderComplete()))})),mn(Cn(g),"refreshLayout",(function(){var e;g.chartRef&&(null===(e=g.chartRef)||void 0===e||e.adjustChartPosition())})),mn(Cn(g),"onTableConfigChange",(function(){g.props.onTableConfigChange({tableConfig:g.tableConfig,pivotTableConfig:g.pivotTableConfig})})),mn(Cn(g),"checkAndUpdateTableConfigs",(function(e){(g.isTableConfigValid(g.tableConfig,g.state.columns,e)||g.setTableConfig(),g.currentlySupportsPivot())&&(g.isTableConfigValid(g.pivotTableConfig,g.pivotTableColumns,e)||g.resetPivotTableConfig())})),mn(Cn(g),"changeDisplayType",(function(e,t){g.checkAndUpdateTableConfigs(e),g.setState({displayType:e},(function(){"function"==typeof t&&t()}))})),mn(Cn(g),"displayTypeInvalidWarning",(function(e){console.warn('Initial display type "'.concat(g.props.initialDisplayType,'" provided is not valid for this dataset. Using ').concat(e||g.state.displayType," instead."))})),mn(Cn(g),"getDataLength",(function(){var e,t,n;return null!==(e=g.state)&&void 0!==e&&e.visibleRows?null===(t=g.state)||void 0===t||null===(t=t.visibleRows)||void 0===t?void 0:t.length:null===(n=g.tableData)||void 0===n?void 0:n.length})),mn(Cn(g),"getPivotDataLength",(function(){var e,t,n;return null!==(e=g.state)&&void 0!==e&&e.visiblePivotRows?null===(t=g.state)||void 0===t||null===(t=t.visiblePivotRows)||void 0===t?void 0:t.length:null===(n=g.pivotTableData)||void 0===n?void 0:n.length})),mn(Cn(g),"getUpdatedDefaultDisplayType",(function(e){return Da(g.props.queryResponse,g.props.autoChartAggregations,g.getColumns(),g.getDataLength(),g.getPivotDataLength(),e,g.isDataLimited())})),mn(Cn(g),"getDisplayTypeFromInitial",(function(e){var t,n,o=e.initialDisplayType,a=g.getUpdatedDefaultDisplayType(g.props.preferredDisplayType);return o&&Sa(e.queryResponse,o,null===(t=g.tableData)||void 0===t?void 0:t.length,null===(n=g.pivotTableData)||void 0===n?void 0:n.length,g.getColumns(),g.isDataLimited())||(o=a),o})),mn(Cn(g),"hasError",(function(e){try{var t=Number(e.data.reference_id.split(".")[2]);if(t>=200&&t<300)return!1}catch(e){}return!0})),mn(Cn(g),"getColumns",(function(){var e;return g._isMounted?g.state.columns:g.formatColumnsForTable(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.columns)})),mn(Cn(g),"currentlySupportsCharts",(function(){var e=g.getCurrentSupportedDisplayTypes().filter((function(e){return $n.includes(e)}));return!(null==e||!e.length)})),mn(Cn(g),"currentlySupportsPivot",(function(){var e=g.getCurrentSupportedDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),mn(Cn(g),"potentiallySupportsPivot",(function(){var e=g.getPotentialDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),mn(Cn(g),"potentiallySupportsDatePivot",(function(){var e=g.getColumns();return g.potentiallySupportsPivot()&&2===(null==e?void 0:e.length)})),mn(Cn(g),"usePivotDataForChart",(function(){return g.potentiallySupportsPivot()&&!g.potentiallySupportsDatePivot()})),mn(Cn(g),"areColumnsValid",(function(e){var t,n=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.columns;return!(null==e||!e.length||null==n||!n.length)&&e.every((function(e){return n.find((function(t){e.name,t.name}))}))})),mn(Cn(g),"numberIndicesArraysOverlap",(function(e){return e.numberColumnIndices.length&&e.numberColumnIndices2.length&&(e.numberColumnIndices.filter((function(t){return e.numberColumnIndices2.includes(t)})).length||e.numberColumnIndices2.filter((function(t){return e.numberColumnIndices.includes(t)})).length)})),mn(Cn(g),"isTableConfigValid",(function(e,t,n){var o;if(!t||null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.rows)||void 0===o||!o.length)return!1;try{if(!e||!e.numberColumnIndices||!e.stringColumnIndices||ma(t)&&!na(e.numberColumnIndex)||fa(t)&&!na(e.stringColumnIndex))return console.debug("Table config provided was incomplete",!e,!e.numberColumnIndices,!e.stringColumnIndices,ma(t)&&!na(e.numberColumnIndex),fa(t)&&!na(e.stringColumnIndex)),!1;if(!Array.isArray(e.numberColumnIndices))return console.debug("Number column indices array not valid in table config"),!1;if(!Array.isArray(e.stringColumnIndices))return console.debug("String column indices array not valid in table config"),!1;if(na(e.stringColumnIndex)&&(!t[e.stringColumnIndex].is_visible||void 0!==e.stringColumnIndices.find((function(e){return!t[e].is_visible}))))return console.debug("Table config invalid: Some of the number columns were hidden."),!1;if(na(e.numberColumnIndex)&&(!t[e.numberColumnIndex].is_visible||void 0!==e.numberColumnIndices.find((function(e){return!t[e].is_visible}))))return console.debug("Table config invalid: Some of the string columns were hidden."),!1;if("column_line"===n||"scatterplot"===n){if(!g.isColumnIndexValid(e.numberColumnIndex,t)||!g.isColumnIndexValid(e.numberColumnIndex2,t)||e.numberColumnIndex===e.numberColumnIndex2)return console.debug("Two unique number column indices were not found. This is required for display type: ".concat(n),e),!1;if(g.numberIndicesArraysOverlap(e))return console.debug("Both axes reference one or more of the same number column index"),!1;if(e.numberColumnIndices2.find((function(e){return!t[e].is_visible})))return console.debug("Second axis indices had hidden columns"),!1}if(!e.numberColumnIndices.every((function(e){return t[e]&&Ho(t[e])})))return console.debug("Saved number indices are not number columns"),!1;if(!e.stringColumnIndices.every((function(e){return t[e]&&Qo(t[e])})))return console.debug("Saved string indices are not string columns"),!1;if(!e.numberColumnIndices2){var a=Yo(t,g.usePivotDataForChart()),r=a.numberColumnIndices2,i=a.numberColumnIndex2;e.numberColumnIndices2=r,e.numberColumnIndex2=i}return!0}catch(e){return console.debug("Saved table config was not valid for response:",null==e?void 0:e.message),!1}})),mn(Cn(g),"updateColumns",(function(e){if(e&&g._isMounted){var t=g.formatColumnsForTable(e);g.isTableConfigValid(g.tableConfig,t,g.state.displayType)||(g.tableConfig=void 0,g.setTableConfig(t),g.chartID=C()),g.setState({columns:t,aggConfig:g.getAggConfig(e),columnChangeCount:g.state.columnChangeCount+1})}})),mn(Cn(g),"generateAllData",(function(){var e;null!==(e=g.queryResponse)&&void 0!==e&&null!==(e=e.data)&&void 0!==e&&e.data&&g.shouldGenerateTableData()&&(g.generateTableData(),g.shouldGeneratePivotData()&&g.generatePivotData({isFirstGeneration:!0}))})),mn(Cn(g),"shouldGeneratePivotData",(function(){var e;return((null===(e=g.state)||void 0===e?void 0:e.visibleRows)||g.tableData)&&g.potentiallySupportsPivot()})),mn(Cn(g),"shouldGenerateTableData",(function(){var e;return!(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||!e.rows)})),mn(Cn(g),"generateTableData",(function(e,t){if(t)g.tableData=t;else{var n,o=e||g.getColumns();g.tableData=null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.rows,g.setTableConfig(),g._isMounted&&g.setState({columns:o})}})),mn(Cn(g),"generatePivotData",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,o=t.dataChanged;try{var a;g.pivotTableID=C();var r=(null===(a=g.state)||void 0===a?void 0:a.visibleRows)||g.tableData,i=g.getColumns();2===i.length?g.generateDatePivotData(r):g.generatePivotTableData({isFirstGeneration:n})}catch(e){console.error(e),g.props.onErrorCallback(e),g.pivotTableData=void 0}g.props.allowDisplayTypeChange&&(null===(e=g.pivotTableRef)||void 0===e||e.updateData(g.pivotTableData));o&&g._isMounted&&g.setState({visiblePivotRowChangeCount:g.state.visiblePivotRowChangeCount+1})})),mn(Cn(g),"renderSuggestionMessage",(function(e,t){var n;try{n=f.createElement("div",{className:"react-autoql-suggestion-message","data-test":"suggestion-message-container"},f.createElement("div",{className:"react-autoql-suggestions-container"},g.props.showSuggestionPrefix&&f.createElement("div",{className:"react-autoql-suggestion-message-prefix"},"I want to make sure I understood your query. Did you mean:"),g.props.renderSuggestionsAsDropdown?f.createElement("select",{key:C(),onChange:function(e){g._isMounted&&(g.setState({selectedSuggestion:e.target.value}),g.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:g.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return f.createElement("option",{key:C(),value:e},e)}))):e.map((function(e){return f.createElement("div",{key:C(),"data-test":"suggestion-list-button"},f.createElement("button",{onClick:function(){return g.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t,scope:g.props.scope})},className:"react-autoql-suggestion-btn"},e),f.createElement("br",null))}))))}catch(e){return f.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return g.props.renderFullSuggestionMessage?f.createElement("div",{style:{textAlign:"center"}},g.renderError(g.queryResponse),n):n})),mn(Cn(g),"renderSingleValueResponse",(function(){var e,t,n,o;return f.createElement("div",{className:"single-value-response-flex-container"},f.createElement("div",{className:"single-value-response-container"},f.createElement("a",{className:"single-value-response ".concat(zo(g.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){g.processDrilldown({groupBys:[],supportedByAPI:!0})}},g.props.showSingleValueResponseTitle&&f.createElement("span",null,f.createElement("strong",null,null===(e=g.state.columns)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.display_name,": ")),aa({element:null!==(t=null===(n=g.queryResponse.data.data.rows[0])||void 0===n?void 0:n[0])&&void 0!==t?t:0,column:null===(o=g.state.columns)||void 0===o?void 0:o[0],config:Fo(g.props.dataFormatting)}))))})),mn(Cn(g),"copyTableToClipboard",(function(){var e,t;"table"===g.state.displayType&&null!==(e=g.tableRef)&&void 0!==e&&e._isMounted?g.tableRef.copyToClipboard():"pivot_table"===g.state.displayType&&null!==(t=g.pivotTableRef)&&void 0!==t&&t._isMounted&&g.pivotTableRef.copyToClipboard()})),mn(Cn(g),"getBase64Data",(function(){var e,t;if(g.chartRef&&ca(g.state.displayType))return g.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=g.tableRef)&&void 0!==e&&e._isMounted&&"table"===g.state.displayType){var n=g.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=g.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===g.state.displayType){var o=g.pivotTableRef.getBase64Data();return Promise.resolve(o)}})),mn(Cn(g),"saveChartAsPNG",(function(){g.chartRef&&g.chartRef.saveAsPNG()})),mn(Cn(g),"queryFn",(function(){var e,t,n,o,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.fe_req,i=g.getCombinedFilters();return g.cancelCurrentRequest(),g.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),g.setState({isLoadingData:!0}),g.isDrilldown()?st(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{source:g.props.source,scope:g.props.scope,debug:"include"===(null==r?void 0:r.translation),filters:null==r?void 0:r.session_filter_locks,pageSize:null==r?void 0:r.page_size,test:null==r?void 0:r.test,groupBys:null==r?void 0:r.columns,queryID:g.props.originalQueryID,orders:null===(o=g.formattedTableParams)||void 0===o?void 0:o.sorters,tableFilters:i,cancelToken:g.axiosSource.token},a)).finally((function(){g.setState({isLoadingData:!1})})):je(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{query:null==r?void 0:r.text,debug:"include"===(null==r?void 0:r.translation),userSelection:null==r?void 0:r.disambiguation,filters:null==r?void 0:r.session_filter_locks,test:null==r?void 0:r.test,pageSize:null==r?void 0:r.page_size,orders:null===(n=g.formattedTableParams)||void 0===n?void 0:n.sorters,tableFilters:i,source:g.props.source,scope:g.props.scope,cancelToken:g.axiosSource.token},a)).finally((function(){g.setState({isLoadingData:!1})}))})),mn(Cn(g),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var o,a=null===(o=g.tableData)||void 0===o?void 0:o.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=S(g.queryResponse);return r.data.data.rows=a,r.data.data.count_rows=a.length,r}catch(e){console.error(e)}})),mn(Cn(g),"cancelCurrentRequest",(function(){var e;null===(e=g.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(g),"processDrilldown",function(){var e=cn(rn().mark((function e(t){var n,o,a,r,i,l,s,c,u,d,p;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.groupBys,o=t.supportedByAPI,a=t.row,r=t.activeKey,i=t.stringColumnIndex,l=t.filter,!zo(g.props.autoQLConfig).enableDrilldowns){e.next=39;break}if(e.prev=2,s=g.getDefaultQueryPageSize(),!o){e.next=18;break}return g.props.onDrilldownStart(r),e.prev=6,e.next=9,st(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{queryID:g.queryID,source:g.props.source,groupBys:n,pageSize:s}));case 9:c=e.sent,g.props.onDrilldownEnd({response:c,originalQueryID:g.queryID}),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),g.props.onDrilldownEnd({response:e.t0});case 16:e.next=33;break;case 18:if(!(!isNaN(i)&&null!=a&&a.length||l)){e.next=33;break}return g.props.onDrilldownStart(r),u=l,l||(u=g.constructFilter({column:g.state.columns[i],value:a[i]})),d=g.getCombinedFilters(u),e.prev=23,e.next=26,g.queryFn({tableFilters:d,pageSize:s});case 26:p=e.sent,e.next=32;break;case 29:e.prev=29,e.t1=e.catch(23),p=e.t1;case 32:g.props.onDrilldownEnd({response:p,originalQueryID:g.queryID});case 33:e.next=39;break;case 35:e.prev=35,e.t2=e.catch(2),console.error(e.t2),g.props.onDrilldownEnd({error:"Error processing drilldown"});case 39:case"end":return e.stop()}}),e,null,[[2,35],[6,13],[23,29]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(g),"constructFilter",(function(e){var t,n=e.column,o=e.value,a=o,r="=";if(null===a)a="NULL",r="is";else if("DATE"===n.type){var i=oa({value:o,column:n,config:g.props.dataFormatting}),l=Sr(n.precision),s=i.startOf(l).toISOString(),c=i.endOf(l).toISOString();a="".concat(s,",").concat(c),r="between",t="TIME"}return{name:n.name,operator:r,value:a,column_type:t}})),mn(Cn(g),"getCombinedFilters",(function(e){var t,n,o=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.fe_req,a=(null==o?void 0:o.filters)||[],r=(null===(n=g.formattedTableParams)||void 0===n?void 0:n.filters)||[],i=[];if(r.forEach((function(e){var t=e,n=a.find((function(t){return t.name===e.name}));n&&(t=an(an({},e),n)),i.push(t)})),a.forEach((function(e){i.find((function(t){return t.name===e.name}))||i.push(e)})),e){var l=i.findIndex((function(t){return t.name===e.name}));l>=0?i[l]=e:i.push(e)}return i.map((function(e){var t,n=null===(t=g.getColumns())||void 0===t?void 0:t.find((function(t){return t.name===e.name}));return an(an({},e),{},{columnName:null==n?void 0:n.title})}))})),mn(Cn(g),"onTableCellClick",(function(e){var t;if(null==e||null===(t=e.getColumn())||void 0===t||null===(t=t.getDefinition())||void 0===t||!t.pivot){var n=g.getColumns();if(n){var o={};if(g.pivotTableColumns&&"pivot_table"===g.state.displayType){var a;if(null==e||null===(a=e.getValue)||void 0===a||!a.call(e))return;if(g.potentiallySupportsDatePivot()){var r,i,l,s,c=jo(n),u=null===(r=e.getColumn())||void 0===r||null===(r=r.getDefinition())||void 0===r?void 0:r.title,d=null===(i=e.getData())||void 0===i?void 0:i[0],p=null===(l=g.pivotOriginalColumnData)||void 0===l||null===(l=l[u])||void 0===l?void 0:l[d];o=[{name:null===(s=n[c])||void 0===s?void 0:s.name,value:p}]}else{var m=n[g.tableConfig.legendColumnIndex],f=n[g.tableConfig.stringColumnIndex];o=function(e){var t=e.cell,n=e.rowHeaders,o=e.columnHeaders,a=e.rowHeaderDefinition,r=e.columnHeaderDefinition;try{var i,l=r.name,s=Number(t.getField())-1,c=xa(o,s),u=a.name,d=(null==t||null===(i=t.getRow())||void 0===i?void 0:i.getPosition())-1,p=xa(n,d);if(l&&u&&void 0!==c&&void 0!==p)return[{name:l,value:"".concat(c)},{name:u,value:"".concat(p)}]}catch(e){console.error(e)}}({cell:e,rowHeaders:g.pivotRowHeaders,columnHeaders:g.pivotColumnHeaders,rowHeaderDefinition:f,columnHeaderDefinition:m})}}else o=function(e,t){if(e&&t){var n=sa(t);if(n.length){var o=e.getData(),a=[];return n.forEach((function(e){var n=t[e].name,r="".concat(o[e]);a.push({name:n,value:r})})),a}}}(e,n);g.processDrilldown({groupBys:o,supportedByAPI:!!o})}}})),mn(Cn(g),"onChartClick",(function(e){var t,n,o=e.row,a=e.columnIndex,r=e.columns,i=e.stringColumnIndex,l=e.legendColumn,s=e.activeKey,c=e.filter;if(c)return g.processDrilldown({supportedByAPI:!1,activeKey:s,filter:c});var u=[],d=r[a],p=(null==r||null===(t=r[i])||void 0===t?void 0:t.origColumn)||(null==r?void 0:r[i]);if(null!=r&&null!==(n=r[i])&&void 0!==n&&n.datePivot){var m,f,v=Number(null==r||null===(m=r[a])||void 0===m?void 0:m.name),h=null==o?void 0:o[i],b="".concat(null===(f=g.pivotOriginalColumnData)||void 0===f||null===(f=f[v])||void 0===f?void 0:f[h]);u.push({name:p.name,value:b})}else null!=p&&p.groupable&&u.push({name:p.name,value:"".concat(null==o?void 0:o[i])});null!=l&&l.groupable&&d.origColumn&&u.push({name:l.name,value:"".concat(null==d?void 0:d.name)}),u.length,g.processDrilldown({groupBys:u,supportedByAPI:!!u.length,row:o,activeKey:s,stringColumnIndex:i})})),mn(Cn(g),"updateToolbars",(function(){g.updateVizToolbar(),g.updateOptionsToolbar()})),mn(Cn(g),"updateVizToolbar",(function(){var e;null!==(e=g.props.vizToolbarRef)&&void 0!==e&&e._isMounted&&g.props.vizToolbarRef.updateDisplayTypes(g.getCurrentSupportedDisplayTypes(),g.state.displayType)})),mn(Cn(g),"updateOptionsToolbar",(function(){var e;null!==(e=g.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&g.props.optionsToolbarRef.forceUpdate()})),mn(Cn(g),"isFilteringTable",(function(){var e;return(null===(e=g.tableRef)||void 0===e?void 0:e._isMounted)&&g.tableRef.state.isFiltering})),mn(Cn(g),"getTabulatorHeaderFilters",(function(){var e;return(null===(e=g.tableRef)||void 0===e?void 0:e._isMounted)&&g.tableRef.getTabulatorHeaderFilters()})),mn(Cn(g),"toggleTableFilter",(function(e,t){var n,o;return"table"===g.state.displayType?(null===(n=g.tableRef)||void 0===n?void 0:n._isMounted)&&g.tableRef.toggleIsFiltering(e,t):"pivot_table"===g.state.displayType?(null===(o=g.pivotTableRef)||void 0===o?void 0:o._isMounted)&&g.pivotTableRef.toggleIsFiltering(e,t):void 0})),mn(Cn(g),"onNewPage",(function(e){if(null!=e&&e.length)try{g.tableData=[].concat(Tn(g.tableData),Tn(e)),g.setState({visibleRowChangeCount:g.state.visibleRowChangeCount+1,visibleRows:g.tableData})}catch(e){console.error(e)}})),mn(Cn(g),"onTableParamsChange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.tableParams=S(e),g.formattedTableParams=t})),mn(Cn(g),"onNewData",(function(e,t){var n;g.isOriginalData=!1,g.queryResponse=e;var o,a=null==e||null===(n=e.data)||void 0===n?void 0:n.data;(g.tableData=(null==a?void 0:a.rows)||[],"table"!==g.state.displayType&&g.props.allowDisplayTypeChange)&&(null===(o=g.tableRef)||void 0===o||o.updateData(g.tableData,g.isDataLimited()));g.setState({visibleRows:e.data.data.rows,visibleRowChangeCount:g.state.visibleRowChangeCount+1},(function(){var n,o=null!=t?t:null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.page_size;g.props.onPageSizeChange(o,g.state.visibleRows)}))})),mn(Cn(g),"onTableFilter",function(){var e=cn(rn().mark((function e(t,o){var a,r;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!n(t,null===(a=g.tableParams)||void 0===a?void 0:a.filter)){e.next=2;break}return e.abrupt("return");case 2:g.tableParams.filter=S(t),g.formattedTableParams=ni(g.tableParams,g.getColumns()),r=[],o.forEach((function(e){r.push(e.getData())})),g.setState({visibleRows:r,visibleRowChangeCount:g.state.visibleRowChangeCount+1});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),mn(Cn(g),"onTableSort",(function(e){g.tableParams.sort=S(e)})),mn(Cn(g),"onLegendClick",(function(e){if(e){var t=null==e?void 0:e.columnIndex,n=g.usePivotDataForChart(),o=S(n?g.pivotTableColumns:g.state.columns);if(null!=o&&o.length)if(o[t].isSeriesHidden=!o[t].isSeriesHidden,n)g.pivotTableColumns=o,g.forceUpdate();else{var a=g.formatColumnsForTable(o);g.setState({columns:a})}}else console.debug("no legend item was provided on click event")})),mn(Cn(g),"onChangeStringColumnIndex",(function(e){g.usePivotDataForChart()?(g.pivotTableConfig.legendColumnIndex===e&&(g.pivotTableConfig.legendColumnIndex=void 0),g.pivotTableConfig.stringColumnIndex=e,g.generatePivotTableData()):(g.tableConfig.legendColumnIndex===e&&(g.tableConfig.legendColumnIndex=void 0),g.tableConfig.stringColumnIndex=e),g.forceUpdate()})),mn(Cn(g),"onChangeLegendColumnIndex",(function(e){g.usePivotDataForChart()?(g.pivotTableConfig.stringColumnIndex===e&&(g.pivotTableConfig.stringColumnIndex=void 0),g.pivotTableConfig.legendColumnIndex=e,g.generatePivotTableData()):(g.tableConfig.stringColumnIndex===e&&(g.tableConfig.stringColumnIndex=void 0),g.tableConfig.legendColumnIndex=e),g.forceUpdate()})),mn(Cn(g),"onChangeNumberColumnIndices",(function(e,t,n){if(g.usePivotDataForChart())e&&(g.pivotTableConfig.numberColumnIndices=e,g.pivotTableConfig.numberColumnIndex=e[0]),t&&(g.pivotTableConfig.numberColumnIndices2=t,g.pivotTableConfig.numberColumnIndex2=t[0]),n&&(g.pivotTableColumns=n),g.forceUpdate();else{e&&(g.tableConfig.numberColumnIndices=e,g.tableConfig.numberColumnIndex=e[0]),t&&(g.tableConfig.numberColumnIndices2=t,g.tableConfig.numberColumnIndex2=t[0]);var o=null!=n?n:g.state.columns;g.updateColumns(o)}})),mn(Cn(g),"resetPivotTableConfig",(function(){g.pivotTableConfig=void 0,g.setPivotTableConfig()})),mn(Cn(g),"setPivotTableConfig",(function(e){var t=g.pivotTableColumns;if(t){var o=S(g.pivotTableConfig);if(g.pivotTableConfig||(g.pivotTableConfig={}),e||!g.pivotTableConfig.stringColumnIndices||!(g.pivotTableConfig.stringColumnIndex>=0)){var a=Wo(t,"supportsPivot"),r=a.stringColumnIndices,i=a.stringColumnIndex;g.pivotTableConfig.stringColumnIndices=r,g.pivotTableConfig.stringColumnIndex=i}if(e||!g.pivotTableConfig.numberColumnIndices){var l=Yo(t,g.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;g.pivotTableConfig.numberColumnIndices=c,g.pivotTableConfig.numberColumnIndex=s,g.pivotTableConfig.numberColumnIndices2=d,g.pivotTableConfig.numberColumnIndex2=u,g.pivotTableConfig.currencyColumnIndices=p,g.pivotTableConfig.quantityColumnIndices=m,g.pivotTableConfig.ratioColumnIndices=f}n(o,g.pivotTableConfig)||g.onTableConfigChange()}})),mn(Cn(g),"resetTableConfig",(function(){g.tableConfig=void 0,g.setTableConfig()})),mn(Cn(g),"isColumnIndexValid",(function(e,t){return!(null==t||!t.length)&&!!t[e]})),mn(Cn(g),"isColumnIndicesValid",(function(e,t){return!(null==e||!e.length||null==t||!t.length)&&e.every((function(e){return g.isColumnIndexValid(e,t)}))})),mn(Cn(g),"hasIndex",(function(e,t){return-1!==(null==e?void 0:e.findIndex((function(e){return t===e})))})),mn(Cn(g),"setTableConfig",(function(e){var t,o,a=null!=e?e:g.getColumns();if(a){var r=S(g.tableConfig);if(g.tableConfig||(g.tableConfig={}),!g.tableConfig.stringColumnIndices||!g.isColumnIndexValid(g.tableConfig.stringColumnIndex,a)){var i=Wo(a),l=i.stringColumnIndices,s=i.stringColumnIndex;g.tableConfig.stringColumnIndices=l,g.tableConfig.stringColumnIndex=s}var c=(null!==(t=Go(a))&&void 0!==t?t:{}).amountOfNumberColumns;if(null!==(o=g.tableConfig.numberColumnIndices)&&void 0!==o&&o.length&&g.tableConfig.numberColumnIndex>=0&&g.tableConfig.numberColumnIndices.includes(g.tableConfig.numberColumnIndex))if(!(c>1&&g.isColumnIndexValid(g.tableConfig.numberColumnIndex,a))||g.isColumnIndicesValid(g.tableConfig.numberColumnIndices2,a)&&g.isColumnIndexValid(g.tableConfig.numberColumnIndex,a)){if(c>1&&g.numberIndicesArraysOverlap(g.tableConfig)){if(g.tableConfig.numberColumnIndices.length===c){var u=g.tableConfig.numberColumnIndices.findIndex((function(e){return e!==g.tableConfig.numberColumnIndex}));-1!==u&&(g.tableConfig.numberColumnIndices=Fa(g.tableConfig.numberColumnIndices,u))}else if(g.tableConfig.numberColumnIndices2.length===c){var d=g.tableConfig.numberColumnIndices2.findIndex((function(e){return e!==g.tableConfig.numberColumnIndex2}));-1!==d&&(g.tableConfig.numberColumnIndices2=Fa(g.tableConfig.numberColumnIndices2,d))}g.tableConfig.numberColumnIndex===g.tableConfig.numberColumnIndex2&&(g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return Ho(e)&&t!==g.tableConfig.numberColumnIndex})),-1===g.tableConfig.numberColumnIndices2.indexOf(g.tableConfig.numberColumnIndex2)&&g.tableConfig.numberColumnIndices2.push(g.tableConfig.numberColumnIndex2),n(g.tableConfig.numberColumnIndices2,g.tableConfig.numberColumnIndices)&&g.tableConfig.numberColumnIndices2.shift());var p=g.tableConfig.numberColumnIndices.filter((function(e){return e!==g.tableConfig.numberColumnIndex2&&!g.hasIndex(g.tableConfig.numberColumnIndices2,e)}));p.length&&(g.tableConfig.numberColumnIndices=p);var m=g.tableConfig.numberColumnIndices2.filter((function(e){return e!==g.tableConfig.numberColumnIndex&&!g.hasIndex(g.tableConfig.numberColumnIndices,e)}));m.length&&(g.tableConfig.numberColumnIndices2=m)}}else g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return t!==g.tableConfig.numberColumnIndex&&Ho(e)})),g.tableConfig.numberColumnIndices2=[g.tableConfig.numberColumnIndex2];else{var f=Yo(a,g.usePivotDataForChart()),v=f.numberColumnIndex,h=f.numberColumnIndices,b=f.numberColumnIndex2,y=f.numberColumnIndices2,C=f.currencyColumnIndices,E=f.quantityColumnIndices,T=f.ratioColumnIndices;g.tableConfig.numberColumnIndices=h,g.tableConfig.numberColumnIndex=v,g.tableConfig.numberColumnIndices2=y,g.tableConfig.numberColumnIndex2=b,g.tableConfig.currencyColumnIndices=C,g.tableConfig.quantityColumnIndices=E,g.tableConfig.ratioColumnIndices=T}if(g.tableConfig.numberColumnIndices2.find((function(e){return!a[e].is_visible}))&&(g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return Ho(e)&&t!==g.tableConfig.numberColumnIndex&&t!==g.tableConfig.numberColumnIndex2})),g.tableConfig.numberColumnIndices2=[g.tableConfig.numberColumnIndex2]),g.usePivotDataForChart()){var D=a.findIndex((function(e,t){return e.groupable&&t!==g.tableConfig.stringColumnIndex}));D>=0&&(g.tableConfig.legendColumnIndex=D)}n(r,g.tableConfig)||g.onTableConfigChange()}})),mn(Cn(g),"getPotentialDisplayTypes",(function(){var e;return Ea({response:g.queryResponse,columns:null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.columns)||void 0===e?void 0:e.map((function(e){return an({},e)}))})})),mn(Cn(g),"isCurrentDisplayTypeValid",(function(){return Sa(g.queryResponse,g.state.displayType,g.getDataLength(),g.getPivotDataLength(),g.getColumns(),g.isDataLimited())})),mn(Cn(g),"getCurrentSupportedDisplayTypes",(function(){return Ea({response:g.queryResponse,columns:g.getColumns(),dataLength:g.getDataLength(),pivotDataLength:g.getPivotDataLength(),isDataLimited:g.isDataLimited()})})),mn(Cn(g),"setFilterFunction",(function(e){var t=Cn(g);return"DATE"===e.type?function(t,n,a,r){try{var i;if(!n)return!1;var l=oa({value:n,column:e,config:g.props.dataFormatting}),s=t.split(" to "),c=Sr(Er(e.precision)),u=o.utc(s[0]).startOf(c),d=o.utc(null!==(i=s[1])&&void 0!==i?i:s[0]).endOf(c),p=u.isSameOrBefore(l),m=l.isSameOrBefore(d);return p&&m}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:"DATE_STRING"===e.type?function(n,o,a,r){try{if(!o)return!1;var i=aa({element:o,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,o){try{if(!t)return!1;var a=e.trim();if(a.length>=2){var r=Number(a.substr(1).replace(/[^0-9.]/g,""));if(">"===a[0]&&"="===a[1])return t>=r;if(">"===a[0])return t>r;if("<"===a[0]&&"="===a[1])return t<=r;if("<"===a[0])return t<r;if("!"===a[0]&&"="===a[1])return t!==r;if("="===a[0])return t===r}var i=parseFloat(null==t?void 0:t.replace(/[^0-9.]/g,"")),l=parseFloat(null==e?void 0:e.replace(/[^0-9.]/g,""));return!isNaN(i)&&i===l}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:void 0})),mn(Cn(g),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(t,n){return wa(t,n,e,"isTable")}:(e.type,"alphanum")})),mn(Cn(g),"setHeaderFilterPlaceholder",(function(e){return"DATE"!==e.type||e.pivot?"Filter":"Pick range"})),mn(Cn(g),"getAggConfig",(function(e){if(!e)return null;var t={};return e.forEach((function(e){t[e.name]=e.aggType})),t})),mn(Cn(g),"getDrilldownGroupby",(function(e,t){var n;return null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n||null===(n=n.columns)||void 0===n?void 0:n.find((function(e){return t.name===e.name}))})),mn(Cn(g),"formatColumnsForTable",(function(e,t){if(!e)return null;var n=0===la(e);return e.map((function(e,o){var a=S(e);a.id=C(),a.field="".concat(o),a.title=e.display_name,a.visible=e.is_visible,a.download=e.is_visible,a.minWidth="90px","DATE"===a.type&&(a.minWidth="125px"),a.maxWidth="300px","DOLLAR_AMT"===a.type||"RATIO"===a.type||"NUMBER"===a.type?a.hozAlign="right":a.hozAlign="center";var r=g.getDrilldownGroupby(g.queryResponse,a);a.cssClass="".concat(a.type),r&&(a.cssClass="".concat(a.cssClass," DRILLDOWN")),a.formatter=function(e,t,n){return aa({element:e.getValue(),column:a,config:Fo(g.props.dataFormatting),htmlElement:e.getElement()})},a.headerFilter="input",a.headerFilterPlaceholder=g.setHeaderFilterPlaceholder(a),a.headerFilterFunc=g.setFilterFunction(a),a.sorter=g.setSorterFunction(a),a.headerSort=!!g.props.enableTableSorting,a.headerSortStartingDir="desc",a.headerClick=function(){var e;null===(e=g.tableRef)||void 0===e||null===(e=e.ref)||void 0===e||e.restoreRedraw()},r&&(a.isDrilldownColumn=!0,a.tooltipTitle=a.title,a.title="".concat(a.title,' <em>(Clicked: "').concat(r.value,'")</em>'));var i=e.aggType;t&&(i=t[e.name]),n&&Ho(e)&&(a.aggType=i||ct.SUM);var l=g.columnDateRanges.find((function(e){return"DATE"===a.type&&(e.columnName===a.display_name||!!a.groupable)}));return l&&(a.dateRange=l),a}))})),mn(Cn(g),"formatDatePivotYear",(function(e,t){var n=g.getColumns();return"DATE"===n[t].type?oa({value:e[t],column:n[t],config:g.props.dataFormatting}).year().toString():o(e[t]).format("YYYY")})),mn(Cn(g),"formatDatePivotMonth",(function(e,t){var n=g.getColumns();return"DATE"===n[t].type?oa({value:e[t],column:n[t],config:g.props.dataFormatting}).format("MMMM"):o(e[t]).format("MMMM")})),mn(Cn(g),"generateDatePivotData",(function(t){try{var n=g.getColumns(),a=jo(n),r=g.tableConfig.numberColumnIndex;r>=0||(r=n.findIndex((function(e,t){return t!==a&&Ho(e)})));var i=t||e(g.queryResponse,"data.data.rows"),l=Tn(i.map((function(e){return"DATE"===n[a].type?oa({value:e[a],column:n[a],config:g.props.dataFormatting}).year():Number(o(e[a]).format("YYYY"))}))).filter(Xo).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),s=n[a],c=an(an({},s),{},{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:s,pivot:!0,cssClass:"pivot-category",sorter:function(e,t){return wa(e,t,s,"isTable")},headerFilter:!1,headerFilterPlaceholder:"filter..."}),u=[an(an({},c),{},{formatter:function(e){return aa({element:e.getValue(),column:c,config:Fo(g.props.dataFormatting),htmlElement:e.getElement()})}})];Object.keys(l).forEach((function(e,t){u.push(an(an({},n[r]),{},{origColumn:n[r],origValues:{},name:e,title:e,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var d=Jo(Object.keys(l).length,12),p={};no.forEach((function(e,t){d[t][0]=e})),i.forEach((function(e){var t,o=g.formatDatePivotYear(e,a),i=g.formatDatePivotMonth(e,a),s=l[o],c=no.findIndex((function(e){return i===e})),m=u.findIndex((function(e){return e.name===o}));c>=0&&s&&(d[c][s]=e[r],p[o]=an(an({},p[o]),{},mn({},i,e[a])),u[m].origValues[i]={name:null===(t=n[a])||void 0===t?void 0:t.name,value:e[a]||""})})),g.pivotOriginalColumnData=p,g.pivotTableColumns=u,g.pivotTableData=d,g.numberOfPivotTableRows=12,g.setPivotTableConfig()}catch(e){console.error(e);var m=g.getCurrentSupportedDisplayTypes();g.setState({displayType:"table",supportedDisplayTypes:m.filter((function(e){return"pivot_table"!==e}))})}})),mn(Cn(g),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var o,a=(null===(o=g.state)||void 0===o?void 0:o.visibleRows)||g.tableData||e(g.queryResponse,"data.data.rows");a=a.filter((function(e){return null!==e[0]}));var r=g.getColumns(),i=g.tableConfig,l=i.legendColumnIndex,s=i.stringColumnIndex,c=i.numberColumnIndex,u=ka(a,r,"desc","isTable").map((function(e){return e[s]})).filter(Xo).reduce((function(e,t,n){return e[t]=n,e}),{}),d=ka(a,r,"desc","isTable").map((function(e){return e[l]})).filter(Xo).reduce((function(e,t,n){return e[t]=n,e}),{}),p=s,m=l;if(n&&Object.keys(d).length>Object.keys(u).length&&(!Uo(r[s])||Object.keys(d).length>22)){p=l,m=s;var f=S(u);u=S(d),d=S(f)}g.pivotColumnHeaders=d,g.pivotRowHeaders=u,g.tableConfig.legendColumnIndex=m,g.tableConfig.stringColumnIndex=p;var v=[an(an({},r[p]),{},{frozen:!0,visible:!0,is_visible:!0,field:"0",cssClass:"pivot-category",pivot:!0,headerFilter:!1})];Object.keys(d).forEach((function(e,t){var n=aa({element:e,column:r[m],config:Fo(g.props.dataFormatting)});v.push(an(an({},r[c]),{},{origColumn:r[c],origPivotColumn:r[m],origValues:{},name:e,title:n,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var h=Jo(Object.keys(d).length+1,Object.keys(u).length);a.forEach((function(e){var t,n=u[e[p]],o=e[p];h[n][0]=o;var a=d[e[m]]+1,i=Number(e[c]);h[n][a]=i,v[a].origValues[o]={name:null===(t=r[p])||void 0===t?void 0:t.name,value:o}})),g.pivotTableColumns=v,g.pivotTableData=h,g.numberOfPivotTableRows=e(g.pivotTableData,"length",0),g.setPivotTableConfig(n)}catch(e){console.error(e),g.props.onErrorCallback(e)}})),mn(Cn(g),"onSuggestionClick",(function(e){var t,n,o=e.query,a=e.queryId,r=e.userSelection,i=e.isButtonClick,l=e.skipQueryValidation,s=e.source;(r||ut(an(an({},_o(g.props.authentication)),{},{queryId:a,suggestion:o})).catch((function(e){return console.error(e)})),"None of these"===o)?(g.props.onNoneOfTheseClick&&g.props.onNoneOfTheseClick(),g.props.mutable&&g.setState({customResponse:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")})):(g.props.onSuggestionClick&&g.props.onSuggestionClick({query:o,userSelection:r,isButtonClick:i,skipQueryValidation:l,source:s,scope:g.props.scope}),null!==(t=g.props.queryInputRef)&&void 0!==t&&t._isMounted&&(null===(n=g.props.queryInputRef)||void 0===n||n.animateInputTextAndSubmit({queryText:o,userSelection:r,skipQueryValidation:!0,source:s,scope:g.props.scope})))})),mn(Cn(g),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return f.createElement("div",{className:"query-output-error-message"},t.map((function(e,n){return f.createElement("span",{key:"error-message-part-".concat(g.COMPONENT_KEY,"-").concat(n)},f.createElement("span",null,e),n!==t.length-1&&f.createElement("button",{className:"report-like-text-button",onClick:g.props.reportProblemCallback},"report"))})))}catch(t){return f.createElement("span",null,e)}})),mn(Cn(g),"isDrilldown",(function(){try{var e;return"Drilldown"===((null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text)||"").split(":")[0]}catch(e){return!1}})),mn(Cn(g),"renderAllColumnsHiddenMessage",(function(){return f.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},f.createElement(Wn,{className:"warning-icon",type:"warning-triangle"}),f.createElement("div",null,"All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",f.createElement(Wn,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),mn(Cn(g),"getDefaultQueryPageSize",(function(){var e;return null!==(e=g.props.dataPageSize)&&void 0!==e?e:500})),mn(Cn(g),"getQueryPageSize",(function(){var e,t,n;return null!==(e=null!==(t=g.props.dataPageSize)&&void 0!==t?t:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.page_size)&&void 0!==e?e:500})),mn(Cn(g),"renderTable",(function(){var e,t,n;return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():g.tableData?f.createElement(Rn,null,f.createElement(ci,{key:g.tableID,autoHeight:g.props.autoHeight,authentication:g.props.authentication,dataFormatting:g.props.dataFormatting,rowChangeCount:g.state.visibleRowChangeCount,ref:function(e){return g.tableRef=e},columns:g.state.columns,response:g.queryResponse,data:g.tableData,columnDateRanges:g.columnDateRanges,onCellClick:g.onTableCellClick,queryID:g.queryID,initialParams:g.tableParams,onFilterCallback:g.onTableFilter,onSorterCallback:g.onTableSort,onTableParamsChange:g.onTableParamsChange,onNewPage:g.onNewPage,onNewData:g.onNewData,isAnimating:g.props.isAnimating,isResizing:g.props.isResizing,pageSize:g.getQueryPageSize(),useInfiniteScroll:!g.isOriginalData||g.props.enableAjaxTableData&&g.isDataLimited(),enableAjaxTableData:g.props.enableAjaxTableData,queryRequestData:null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.fe_req,queryText:null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text,originalQueryID:g.props.originalQueryID,isDrilldown:g.isDrilldown(),isQueryOutputMounted:g._isMounted,popoverParentElement:g.props.popoverParentElement,hidden:"table"!==g.state.displayType,totalRows:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.count_rows,supportsDrilldowns:Bo(g.state.columns)&&zo(g.props.autoQLConfig).enableDrilldowns,tooltipID:g.props.tooltipID,queryFn:g.queryFn,source:g.props.source,scope:g.props.scope})):g.renderMessage("Error: There was no data supplied for this table")})),mn(Cn(g),"renderPivotTable",(function(){return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():"pivot_table"!==g.state.displayType||g.pivotTableData?f.createElement(Rn,null,f.createElement(ci,{ref:function(e){return g.pivotTableRef=e},columns:g.pivotTableColumns,rowChangeCount:g.state.visibleRowChangeCount,data:g.pivotTableData,onCellClick:g.onTableCellClick,isAnimating:g.props.isAnimating,isResizing:g.props.isResizing,hidden:"pivot_table"!==g.state.displayType,useInfiniteScroll:!1,supportsDrilldowns:!0,autoHeight:g.props.autoHeight,source:g.props.source,scope:g.props.scope,tooltipID:g.props.tooltipID,pivot:!0})):g.renderMessage("Error: There was no data supplied for this table")})),mn(Cn(g),"renderChart",(function(){var e,t,n,o,a,r;if(!g.tableData||!g.state.columns||!g.tableConfig)return console.error("Required table data was missing for chart"),g.renderMessage("Error: There was no data supplied for this chart");var i=g.usePivotDataForChart();if(i&&(!g.pivotTableData||!g.pivotTableColumns||!g.pivotTableConfig))return g.renderMessage("Error: There was no data supplied for this chart");var l=g.isDataLimited(),s=i?g.pivotTableConfig:g.tableConfig,c=g.getCombinedFilters();an(an({},g.formattedTableParams),{},{filters:c});var u=!1,d=la(g.state.columns);(1===d||d>=2&&i)&&(u=!0);var p,m=i?g.state.visiblePivotRows||g.pivotTableData:g.state.visibleRows||g.tableData,v=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.count_rows;!l&&g.state.visibleRows&&(null===(t=g.state.visibleRows)||void 0===t?void 0:t.length)<5e3&&(v=null===(p=g.state.visibleRows)||void 0===p?void 0:p.length);return f.createElement(Rn,null,f.createElement(vl,fn({key:g.chartID},s,{data:m,hidden:!ca(g.state.displayType),authentication:g.props.authentication,ref:function(e){return g.chartRef=e},type:g.state.displayType,isDataAggregated:u,popoverParentElement:g.props.popoverParentElement,dataChangeCount:i?g.state.visiblePivotRowChangeCount:g.state.visibleRowChangeCount,columns:i?g.pivotTableColumns:g.state.columns,isAggregated:i,dataFormatting:g.props.dataFormatting,activeChartElementKey:g.props.activeChartElementKey,onLegendClick:g.onLegendClick,legendColumn:g.state.columns[null===(n=g.tableConfig)||void 0===n?void 0:n.legendColumnIndex],changeStringColumnIndex:g.onChangeStringColumnIndex,changeLegendColumnIndex:g.onChangeLegendColumnIndex,changeNumberColumnIndices:g.onChangeNumberColumnIndices,onChartClick:g.onChartClick,isResizing:g.props.isResizing,isAnimating:g.props.isAnimating,isDrilldownChartHidden:g.props.isDrilldownChartHidden,enableDynamicCharting:g.props.enableDynamicCharting,enableAjaxTableData:g.props.enableAjaxTableData,tooltipID:null!==(o=g.props.tooltipID)&&void 0!==o?o:g.TOOLTIP_ID,chartTooltipID:null!==(a=g.props.chartTooltipID)&&void 0!==a?a:g.CHART_TOOLTIP_ID,height:g.props.height,width:g.props.width,onNewData:g.onNewData,isDrilldown:g.isDrilldown(),totalRowCount:v,currentRowCount:null===(r=g.state.visibleRows)||void 0===r?void 0:r.length,updateColumns:g.updateColumns,source:g.props.source,scope:g.props.scope,isRowCountSelectable:!g.isOriginalData||l,queryFn:g.queryFn,onBucketSizeChange:g.props.onBucketSizeChange,bucketSize:g.props.bucketSize})))})),mn(Cn(g),"renderHelpResponse",(function(){var t=e(g.queryResponse,"data.data.rows[0]");if(!t)return null;var n=t.includes("#"),o=t;if(n){var a=t.split("#")[1].replace(/-/g," ");o=a.charAt(0).toUpperCase()+a.substr(1)}return f.createElement(h,null,"Great news, I can help with that:",f.createElement("br",null),f.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},f.createElement(Wn,{type:"globe",className:"react-autoql-help-link-icon"}),o))})),mn(Cn(g),"renderError",(function(t){return t?e(t,"data.message")?g.renderMessage(t.data):g.renderMessage():(console.warn("Warning: No response object supplied"),g.renderMessage("No response supplied"))})),mn(Cn(g),"isDataLimited",(function(){var e,t,n,o,a=null!==(e=null===(t=g.tableData)||void 0===t?void 0:t.length)&&void 0!==e?e:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.rows)||void 0===n?void 0:n.length,r=null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.count_rows;return!(!a||!r)&&a<r})),mn(Cn(g),"noDataFound",(function(){var e;return 0===(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.rows)||void 0===e?void 0:e.length)&&g.isOriginalData})),mn(Cn(g),"renderMessage",(function(e){try{if("object"===ln(e)){var t,n=ir.GENERAL_QUERY;if((null==e?void 0:e.message)===(null==lr?void 0:lr.CANCELLED))n=f.createElement("span",null,"Query cancelled"," ",f.createElement(Wn,{"data-tip":"Pressing the ESC key will cancel the current query request. If you wish to re-run your last query, simply press the UP arrow in the input bar then hit ENTER.","data-for":null!==(t=g.props.tooltipID)&&void 0!==t?t:g.TOOLTIP_ID,type:"question"}));else null!=e&&e.message&&(n=e.message,n=g.props.reportProblemCallback?g.replaceErrorTextWithLinks(e.message):n.replace("<report>","report"));return f.createElement("div",{className:"query-output-error-message"},f.createElement("div",null,n),e.reference_id&&f.createElement(h,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",e.reference_id)))}var o=e||ir.GENERAL_QUERY;return f.createElement("div",{className:"query-output-error-message"},o)}catch(e){return console.warn(e),f.createElement("div",{className:"query-output-error-message"},ir.GENERAL_QUERY)}})),mn(Cn(g),"renderHTMLMessage",(function(){var e,t=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.answer;return t?Fe(t,{}):f.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),mn(Cn(g),"renderTextResponse",(function(){return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():null})),mn(Cn(g),"renderResponse",(function(){var t=g.state.displayType;if(g.hasError(g.queryResponse))return g.renderError(g.queryResponse);if("html"===t)return g.renderHTMLMessage();if(g.state.customResponse)return g.state.customResponse;if(!!e(g.queryResponse,"data.data.items"))return g.renderSuggestionMessage(g.queryResponse.data.data.items,g.queryResponse.data.data.query_id);if(e(g.queryResponse,"data.data.replacements"))return f.createElement(ko,{key:g.QUERY_VALIDATION_KEY,response:g.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return g.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"],scope:g.props.scope})},onQueryValidationSelectOption:g.props.onQueryValidationSelectOption,initialSelections:g.props.queryValidationSelections,autoSelectSuggestion:g.props.autoSelectQueryValidationSuggestion,scope:g.props.scope});if(t&&e(g.queryResponse,"data.data.rows")){if("help"===t)return g.renderHelpResponse();if("text"===t)return g.renderTextResponse();if(Ca(g.queryResponse))return g.renderSingleValueResponse();if(!ua(t)&&!ca(t))return console.warn("display type not recognized: ".concat(g.state.displayType," - rendering as plain text")),g.renderMessage("display type not recognized: ".concat(g.state.displayType))}var n=ca(g.state.displayType),o=ua(g.state.displayType),a="pivot_table"===g.state.displayType,r=g.props.allowDisplayTypeChange,i=g.currentlySupportsCharts(),l=g.currentlySupportsPivot(),s=g.usePivotDataForChart()?g.pivotTableColumns:g.getColumns(),c=g.usePivotDataForChart()?g.pivotTableConfig:g.tableConfig,u=g.isTableConfigValid(c,s,g.state.displayType),d=(r||n)&&i&&u,p=r||o,m=(r||a)&&l;return f.createElement(f.Fragment,null,p&&g.renderTable(),d&&g.renderChart(),m&&g.renderPivotTable())})),mn(Cn(g),"shouldRenderReverseTranslation",(function(){var e;return zo(g.props.autoQLConfig).enableQueryInterpretation&&g.props.showQueryInterpretation&&(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation)})),mn(Cn(g),"getFilters",(function(){var e,t,n,o,a,r=null!==(e=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.fe_req)||void 0===t?void 0:t.persistent_filter_locks)&&void 0!==e?e:[],i=null!==(n=null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.fe_req)||void 0===o?void 0:o.session_filter_locks)&&void 0!==n?n:[];return null!==(a=[].concat(Tn(r),Tn(i)))&&void 0!==a?a:[]})),mn(Cn(g),"renderReverseTranslation",(function(){return f.createElement(Xr,{authentication:g.props.authentication,onValueLabelClick:g.props.onRTValueLabelClick,appliedFilters:g.getFilters(),isResizing:g.props.isResizing,queryResponse:g.queryResponse,tooltipID:g.props.tooltipID})})),mn(Cn(g),"shouldRenderDataLimitWarning",(function(){var e=!g.props.enableAjaxTableData&&"table"===g.state.displayType,t=!g.props.enableAjaxTableData&&ca(g.state.displayType);return g.isDataLimited()&&!ya(g.getColumns())&&(e||t)})),mn(Cn(g),"renderDataLimitWarning",(function(){var e,t,n=zo(g.props.autoQLConfig).enableQueryInterpretation&&g.props.showQueryInterpretation;return f.createElement("div",{className:"dashboard-data-limit-warning-icon"},f.createElement(Wn,{type:"warning","data-tip":"The display limit of ".concat(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.row_limit," rows has been reached. Try querying a smaller time-frame to ensure all your data is displayed."),"data-for":null!==(t=g.props.tooltipID)&&void 0!==t?t:g.TOOLTIP_ID,"data-place":n?"left":"right"}))})),mn(Cn(g),"renderFooter",(function(){var e=g.shouldRenderReverseTranslation(),t=g.shouldRenderDataLimitWarning(),n="query-output-footer ".concat(e?"":"no-margin"," ").concat(g.props.reverseTranslationPlacement);return f.createElement("div",{className:n},e&&g.renderReverseTranslation(),t&&g.renderDataLimitWarning())})),mn(Cn(g),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{key:g.COMPONENT_KEY,ref:function(e){return g.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(g.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(ua(g.state.displayType)?"table":"","\n ").concat(ca(g.state.displayType)?"chart":"")},"top"===g.props.reverseTranslationPlacement&&g.renderFooter(),g.renderResponse(),"top"!==g.props.reverseTranslationPlacement&&g.renderFooter()),!g.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:g.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),!g.props.chartTooltipID&&f.createElement(So,{className:"react-autoql-chart-tooltip",id:g.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),g.COMPONENT_KEY=C(),g.QUERY_VALIDATION_KEY=C(),g.TOOLTIP_ID="react-autoql-query-output-tooltip-".concat(g.COMPONENT_KEY),g.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(g.COMPONENT_KEY),g.queryResponse=S(t.queryResponse),g.columnDateRanges=function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.parsed_interpretation;if(!n)return[];var o=Tr(n);return null!=o&&o.length?o:[]}(t.queryResponse),g.queryID=e(g.queryResponse,"data.data.query_id"),g.interpretation=e(g.queryResponse,"data.data.parsed_interpretation"),g.tableParams={},g.chartID=C(),g.tableID=C(),g.pivotTableID=C(),g.initialSupportedDisplayTypes=g.getCurrentSupportedDisplayTypes(),g.isOriginalData=!0,g.renderComplete=!1,g.hasCalledInitialTableConfigChange=!1,g.generateAllData();var v=g.formatColumnsForTable(null===(i=g.queryResponse)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.columns,t.initialAggConfig);g.initialSupportedDisplayTypes=g.getCurrentSupportedDisplayTypes();var b=g.getDisplayTypeFromInitial(t);if(t.onDisplayTypeChange&&t.onDisplayTypeChange(b),null!==(l=t.initialTableConfigs)&&void 0!==l&&l.tableConfig&&g.isTableConfigValid(null===(s=t.initialTableConfigs)||void 0===s?void 0:s.tableConfig,v,b)){var y=t.initialTableConfigs.tableConfig;g.tableConfig=S(y)}if(null!==(c=t.initialTableConfigs)&&void 0!==c&&c.pivotTableConfig&&g.isTableConfigValid(null===(u=t.initialTableConfigs)||void 0===u?void 0:u.pivotTableConfig,g.pivotTableColumns,b)){var T=t.initialTableConfigs.pivotTableConfig;g.pivotTableConfig=S(T)}return g.formattedTableParams={filters:(null===(d=g.queryResponse)||void 0===d||null===(d=d.data)||void 0===d||null===(d=d.data)||void 0===d||null===(d=d.fe_req)||void 0===d?void 0:d.filters)||[],sorters:(null===(p=g.queryResponse)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.fe_req)||void 0===p?void 0:p.sorters)||[]},g.state={displayType:b,aggConfig:t.initialAggConfig,supportedDisplayTypes:g.initialSupportedDisplayTypes,columns:v,selectedSuggestion:t.defaultSelectedSuggestion,visibleRows:null===(m=g.queryResponse)||void 0===m||null===(m=m.data)||void 0===m||null===(m=m.data)||void 0===m?void 0:m.rows,visibleRowChangeCount:0,visiblePivotRowChangeCount:0,columnChangeCount:0},g}return pn(r)}();mn(hl,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,initialTableConfigs:b.shape({}),initialAggConfig:b.shape({}),queryResponse:b.shape({}),onSuggestionClick:b.func,initialDisplayType:b.string,onQueryValidationSelectOption:b.func,autoSelectQueryValidationSuggestion:b.bool,queryValidationSelections:b.arrayOf(b.shape({})),renderSuggestionsAsDropdown:b.bool,defaultSelectedSuggestion:b.string,reverseTranslationPlacement:b.string,activeChartElementKey:b.string,preferredDisplayType:b.string,isResizing:b.bool,enableDynamicCharting:b.bool,onTableConfigChange:b.func,onAggConfigChange:b.func,onNoneOfTheseClick:b.func,autoChartAggregations:b.bool,onRTValueLabelClick:b.func,isTaskModule:b.bool,onDrilldownStart:b.func,onDrilldownEnd:b.func,enableAjaxTableData:b.bool,enableTableSorting:b.bool,showSingleValueResponseTitle:b.bool,onRowChange:b.func,mutable:b.bool,showSuggestionPrefix:b.bool,onDisplayTypeChange:b.func,onColumnChange:b.func,shouldRender:b.bool,dataPageSize:b.number,onPageSizeChange:b.func,allowDisplayTypeChange:b.bool,onRenderComplete:b.func,onMount:b.func,onBucketSizeChange:b.func,bucketSize:b.number}),mn(hl,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,initialTableConfigs:void 0,initialAggConfig:void 0,queryResponse:void 0,initialDisplayType:null,onSuggestionClick:void 0,autoSelectQueryValidationSuggestion:!0,queryValidationSelections:void 0,renderSuggestionsAsDropdown:!1,defaultSelectedSuggestion:void 0,reverseTranslationPlacement:"bottom",activeChartElementKey:void 0,isResizing:!1,enableDynamicCharting:!0,onNoneOfTheseClick:void 0,autoChartAggregations:!0,enableFilterLocking:!1,showQueryInterpretation:!1,isTaskModule:!1,enableAjaxTableData:!1,enableTableSorting:!0,preferredDisplayType:void 0,onRTValueLabelClick:void 0,mutable:!0,showSuggestionPrefix:!0,shouldRender:!0,dataPageSize:void 0,allowDisplayTypeChange:!0,showSingleValueResponseTitle:!1,bucketSize:void 0,onRowChange:function(){},onTableConfigChange:function(){},onAggConfigChange:function(){},onQueryValidationSelectOption:function(){},onErrorCallback:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){},onColumnChange:function(){},onPageSizeChange:function(){},onRenderComplete:function(){},onMount:function(){},onBucketSizeChange:function(){}});var bl=Ga(hl),yl=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a,r,i,l;return un(this,o),mn(Cn(l=t.call(this,e)),"componentDidMount",(function(){l._isMounted=!0,Co()})),mn(Cn(l),"shouldComponentUpdate",(function(e){return!(!l.props.shouldRender&&!e.shouldRender)})),mn(Cn(l),"componentDidUpdate",(function(e,t){n(l.state.supportedDisplayTypes,t.supportedDisplayTypes)||Co()})),mn(Cn(l),"componentWillUnmount",(function(){l._isMounted=!1})),mn(Cn(l),"updateDisplayTypes",(function(e,t){l.setState({supportedDisplayTypes:e,displayType:t})})),mn(Cn(l),"showDisplayTypeButton",(function(e){if(l.props.disableCharts&&$n.includes(e))return!1;var t=l.state.supportedDisplayTypes;return t&&t.includes(e)})),mn(Cn(l),"onDisplayTypeChange",(function(e){var t,n;null!==(t=l.props.responseRef)&&void 0!==t&&t._isMounted&&(null===(n=l.props.responseRef)||void 0===n||n.changeDisplayType(e))})),mn(Cn(l),"createVisButton",(function(e,t,n){if(l.showDisplayTypeButton(e)){var o,a,r=l.state.displayType;return f.createElement(wo,{onClick:function(){return l.onDisplayTypeChange(e)},className:"react-autoql-toolbar-btn\n ".concat(e===r?"react-autoql-toolbar-btn-selected":""),tooltip:t,tooltipID:null!==(o=l.props.tooltipID)&&void 0!==o?o:"react-autoql-viz-toolbar-tooltip-".concat(l.COMPONENT_KEY),"data-test":"viz-toolbar-button",disabled:null===(a=l.props.responseRef)||void 0===a||null===(a=a.state)||void 0===a?void 0:a.isLoadingData},n)}return null})),mn(Cn(l),"render",(function(){var e;if(null===(e=l.props.responseRef)||void 0===e||!e._isMounted)return null;var t=l.state.displayType,n=l.state.supportedDisplayTypes;return!n||n.length<=1||!n.includes("pivot_table")&&l.props.disableCharts?null:Zn.includes(t)||$n.includes(t)?f.createElement(Rn,null,f.createElement("div",{className:"".concat(l.props.className||""," ").concat(Pe?"react-autoql-toolbar-mobile":"react-autoql-toolbar"," viz-toolbar ").concat(l.props.vertical?"vertical":""),"data-test":"viz-toolbar"},l.createVisButton("table","Table",f.createElement(Wn,{type:"table"})),l.createVisButton("pivot_table","Pivot View",f.createElement(Wn,{type:"pivot-table"})),l.createVisButton("column","Column Chart",f.createElement(Wn,{type:"column-chart"})),l.createVisButton("bar","Bar Chart",f.createElement(Wn,{type:"bar-chart"})),l.createVisButton("line","Line Chart",f.createElement(Wn,{type:"line-chart"})),l.createVisButton("pie","Pie Chart",f.createElement(Wn,{type:"pie-chart"})),l.createVisButton("heatmap","Heatmap",f.createElement(Wn,{type:"heatmap"})),l.createVisButton("bubble","Bubble Chart",f.createElement(Wn,{type:"bubble-chart"})),l.createVisButton("stacked_bar","Stacked Bar Chart",f.createElement(Wn,{type:"stacked-bar-chart"})),l.createVisButton("stacked_column","Stacked Column Chart",f.createElement(Wn,{type:"stacked-column-chart"})),l.createVisButton("stacked_line","Stacked Area Chart",f.createElement(Wn,{type:"stacked-line-chart"})),l.createVisButton("column_line","Column Line Combo Chart",f.createElement(Wn,{type:"column-line-chart"})),l.createVisButton("histogram","Histogram",f.createElement(Wn,{type:"histogram-chart"})),l.createVisButton("scatterplot","Scatterplot",f.createElement(Wn,{type:"scatterplot"}))),!l.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-viz-toolbar-tooltip-".concat(l.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),l.COMPONENT_KEY=C(),l.state={displayType:null===(a=e.responseRef)||void 0===a||null===(a=a.state)||void 0===a?void 0:a.displayType,supportedDisplayTypes:null!==(r=e.responseRef)&&void 0!==r&&r._isMounted?null===(i=e.responseRef)||void 0===i?void 0:i.getCurrentSupportedDisplayTypes():[]},l}return pn(o)}();mn(yl,"propTypes",{shouldRender:b.bool,disableCharts:b.bool,vertical:b.bool}),mn(yl,"defaultProps",{shouldRender:!0,disableCharts:!1,vertical:!1});var Cl=yl,El=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),mn(Cn(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",{className:"modal-footer-button-container right"},f.createElement(wo,{type:"default",onClick:e.props.onClose,tooltipID:e.props.tooltipID},e.props.backText),f.createElement(wo,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading,tooltipID:e.props.tooltipID,filled:!0},e.props.confirmText))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,f.createElement(qe,{isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container",ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-confirm-modal",style:{content:an(an({},e.props.style),{},{width:e.props.width,height:e.props.height})}},f.createElement("div",{className:"react-autoql-modal-body"},e.props.children),f.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return pn(n)}();mn(El,"propTypes",{isVisible:b.bool,onClose:b.func,onConfirm:b.func,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),confirmLoading:b.bool,backText:b.string,confirmText:b.string,footer:b.element}),mn(El,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,backText:"Go back",confirmText:"Continue",footer:void 0,onClose:function(){},onConfirm:function(){}});var Sl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),mn(Cn(e),"shouldComponentUpdate",(function(t,n){return!(!t.shouldRender&&!e.props.shouldRender)&&(!Ma(e.props,t)||!Ma(e.state,n))})),mn(Cn(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.props.onOpened(),!e.props.isVisible&&t.isVisible&&e.props.onClosed()})),mn(Cn(e),"onClose",(function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e.props.confirmOnClose&&t?e.setState({isConfirmCloseModalVisible:!0}):e.props.onClose()})),mn(Cn(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",{className:"modal-footer-button-container right"},e.props.showCancelButton&&f.createElement(wo,{type:"default",onClick:e.onClose},"Cancel"),f.createElement(wo,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),mn(Cn(e),"render",(function(){var t;return f.createElement(Rn,null,f.createElement(qe,{ref:function(t){return e.ref=t},isOpen:e.props.isVisible,className:"".concat(Pe?"react-autoql-modal-mobile":"react-autoql-modal").concat(e.props.contentClassName?" ".concat(e.props.contentClassName):""),bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:an(an({},e.props.style),{},{width:e.props.width,height:e.props.height}),overlay:an({},e.props.overlayStyle)}},f.createElement("div",{className:"react-autoql-modal-content".concat(Pe?" react-autoql-modal-content-mobile":""),ref:function(t){return e.modalContent=t},onClick:function(e){return e.stopPropagation()}},f.createElement("div",{className:"react-autoql-modal-header"},f.createElement("div",{className:"react-autoql-modal-header-title-container"},f.createElement("div",{className:"react-autoql-modal-header-title"},e.props.titleIcon," ",e.props.title),f.createElement("div",{className:"react-autoql-modal-header-subtitle"},e.props.subtitle)),f.createElement(Wn,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),f.createElement("div",{className:"react-autoql-modal-body ".concat(null!==(t=e.props.bodyClassName)&&void 0!==t?t:""),style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&f.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter()))),!!e.props.confirmOnClose&&f.createElement(El,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){return e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.props.onClose(),e.setState({isConfirmCloseModalVisible:!1})}},f.createElement("h3",null,"Are you sure you want to leave this page?"),f.createElement("p",null,"All unsaved changes will be lost.")))})),e}return pn(n)}();mn(Sl,"propTypes",{title:b.oneOfType([b.element,b.string]),titleIcon:b.oneOfType([b.element,b.instanceOf(Wn)]),subtitle:b.string,isVisible:b.bool,onClose:b.func,onConfirm:b.func,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),showCancelButton:b.bool,showFooter:b.bool,enableBodyScroll:b.bool,confirmLoading:b.bool,confirmText:b.string,confirmDisabled:b.bool,footer:b.element,confirmOnClose:b.bool,shouldRender:b.bool,onOpened:b.func,onClosed:b.func}),mn(Sl,"defaultProps",{title:"",titleIcon:void 0,subtitle:"",isVisible:!1,width:"80vw",height:void 0,showCancelButton:!0,enableBodyScroll:!1,showFooter:!0,confirmLoading:!1,confirmText:void 0,footer:void 0,confirmDisabled:!1,confirmOnClose:!1,shouldRender:!0,onClose:function(){},onConfirm:function(){},onOpened:function(){},onClosed:function(){}});var Tl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{columns:e.props.columns}),mn(Cn(e),"shouldComponentUpdate",(function(t,n){return!Ma(e.props,t)||!Ma(e.state,n)})),mn(Cn(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),mn(Cn(e),"onListChange",(function(t){e.setState({columns:t})})),mn(Cn(e),"onConfirm",(function(){return e.props.onConfirm(e.state.columns)})),mn(Cn(e),"render",(function(){return f.createElement(Sl,{isVisible:e.props.isVisible,onClose:e.props.onClose,onConfirm:e.onConfirm,title:"Show/Hide Columns",enableBodyScroll:!0,width:"600px",confirmText:"Apply",confirmLoading:e.props.isSettingColumns},f.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},f.createElement(Ai,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:e.onListChange})))})),e}return pn(n)}();mn(Tl,"propTypes",{isSettingColumns:b.bool}),mn(Tl,"defaultProps",{isSettingColumns:!1});var Dl=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",C()),mn(Cn(t),"renderButtonType",(function(){var e;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-radio-btn-container\n react-autoql-radio-btn-container-buttons\n ".concat(null!==(e=t.props.className)&&void 0!==e?e:""),"data-test":"react-autoql-radio"},t.props.options.map((function(e,n){var o,a=t.props.value===e;return t.props.multiSelect&&(a=t.props.value.includes(e)),f.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(a?" active":""),"data-test":"react-autoql-radio-btn",onClick:function(){return t.props.onChange(e)},"data-tip":null===(o=t.props.tooltips)||void 0===o?void 0:o[n],"data-for":t.props.tooltipID,"data-delay-show":500},f.createElement("div",null,e))}))))})),mn(Cn(t),"renderOriginalType",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-radio-btn-container react-autoql-radio-btn-container-list ".concat(t.props.className),"data-test":"react-autoql-radio"},t.props.options.map((function(e,n){var o=t.props.value===e;return t.props.multiSelect&&(o=t.props.value.includes(e)),f.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},f.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:o}),f.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),mn(Cn(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return pn(o)}();mn(Dl,"propTypes",{options:b.arrayOf(b.string),onChange:b.func,value:b.string,multiSelect:b.bool,type:b.string,tooltips:b.arrayOf(b.string),tooltipId:b.string}),mn(Dl,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var xl=function(t){gn(a,f.Component);var o=Sn(a);function a(t){var r;un(this,a),mn(Cn(r=o.call(this,t)),"autoCompleteTimer",void 0),mn(Cn(r),"state",an({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),o="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:o,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(o,"length")}}return{}}(r.props.initialData))),mn(Cn(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),mn(Cn(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),mn(Cn(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),mn(Cn(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=C(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),mn(Cn(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?Number(e):e}]})),mn(Cn(r),"isNumerical",(function(e){return!isNaN(Number(e))})),mn(Cn(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),mn(Cn(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),mn(Cn(r),"validateFirstTerm",(function(){r.props.enableQueryValidation?r.state.input1Value&&!r.state.isValidatingFirstTerm&&r.state.lastCheckedFirstTermValue!==r.state.input1Value&&(r.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:r.state.input1Value,isValidatingFirstTerm:!0}),pr(an({query:r.state.input1Value},_o(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),mn(Cn(r),"validateSecondTerm",(function(){r.props.enableQueryValidation?r.state.input2Value&&isNaN(Number(r.state.input2Value))?r.state.isValidatingSecondTerm||r.state.lastCheckedSecondTermValue===r.state.input2Value||(r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value,isValidatingSecondTerm:!0}),pr(an({query:r.state.input2Value},_o(r.props.authentication))).then((function(){r.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){r.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value}):r.setState({isSecondTermValid:!0})})),mn(Cn(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),mn(Cn(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){Ke(an(an(an({},_o(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],o=[];t=e.data.matches;for(var a=0;a<t.length&&(n.push(t[a]),4!==a);a++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var l={name:n[i]};o.push(l)}r.setState({suggestions:o})})).catch((function(e){console.error(e)}))}),500)})),mn(Cn(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),mn(Cn(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),mn(Cn(r),"renderReadOnlyRule",(function(){return f.createElement(Rn,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(Ra(r.state.input1Value))),f.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&f.createElement("span",{className:"read-only-rule-term"},Ra(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),mn(Cn(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(Wn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),mn(Cn(r),"renderRule",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(xr,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})},onBlur:r.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateFirstTerm()}}),!r.state.isFirstTermValid&&r.renderValidationError()),f.createElement(xo,{options:[{value:"GREATER_THAN",label:">",tooltip:"Greater Than"},{value:"LESS_THAN",label:"<",tooltip:"Less Than"},{value:"EQUAL_TO",label:"=",tooltip:"EQUAL_TO"},{value:"EXISTS",label:f.createElement("span",null,"∃"),tooltip:"Exists"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}}),f.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(xr,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})},onBlur:r.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateSecondTerm()}}),!r.state.isSecondTermValid&&r.renderValidationError())),f.createElement(Wn,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){r.props.onDelete(r.props.ruleId)}})))})),mn(Cn(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=C(),r.TERM_ID_2=C();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=C()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return pn(a)}();mn(xl,"propTypes",{authentication:nr,ruleId:b.string,onAdd:b.func,onDelete:b.func,onUpdate:b.func,initialData:b.arrayOf(b.shape({})),readOnly:b.bool,enableQueryValidation:b.bool}),mn(xl,"defaultProps",{authentication:Mo,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var Rl=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,o=e.id||C();n.push({id:o,type:(t=e.term_value,!t[0]||"AND"!==t[0].condition&&"OR"!==t[0].condition&&"TERMINATOR"!==t[0].condition?"rule":"group"),isComplete:!0,termValue:e.term_value||[]})})),t={rules:n,andOrSelectValue:"OR"===e[0].condition?"ANY":"ALL"}):(n.push({id:C(),type:"rule",isComplete:!1}),t={rules:n}),t},Il=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"ID",C()),mn(Cn(e),"ruleRefs",[]),mn(Cn(e),"state",an({rules:[],andOrSelectValue:"ALL"},Rl(e.props.initialData))),mn(Cn(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),mn(Cn(e),"getJSON",(function(){return e.state.rules.map((function(t,n){var o="ALL"===e.state.andOrSelectValue?"AND":"OR";n===e.state.rules.length-1&&(o="TERMINATOR");var a=e.ruleRefs[n],r=[];return a&&(r=a.getJSON()),{id:t.id||C(),term_type:"group",condition:o,term_value:r}}))})),mn(Cn(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isComplete()}))})),mn(Cn(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isValid()}))})),mn(Cn(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),mn(Cn(e),"onRuleUpdate",(function(t,n,o){var a=e.state.rules.map((function(e){return e.id===t?an(an({},e),{},{isComplete:n,termValue:o}):e}));e.setState({rules:a}),e.props.onUpdate(e.props.groupId,e.isComplete())})),mn(Cn(e),"addRule",(function(){var t=C(),n=[].concat(Tn(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),mn(Cn(e),"addGroup",(function(){var t=C(),n=[].concat(Tn(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),mn(Cn(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),mn(Cn(e),"renderAllAnySelect",(function(){return f.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",f.createElement(Dl,{options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),mn(Cn(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:f.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},f.createElement(Wn,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),mn(Cn(e),"renderAddBtn",(function(){return e.props.readOnly?null:f.createElement("div",{className:"notification-rule-btn-container"},f.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},f.createElement(Wn,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),mn(Cn(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return f.createElement(Rn,null,f.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&f.createElement("div",{className:"notification-and-or-break",style:{top:e.props.hideTopCondition?"0px":"-19px",height:e.props.hideTopCondition?"100%":"calc(100% + 19px)"}},!e.props.hideTopCondition&&f.createElement("div",{className:"notification-and-or-text",style:{background:"ALL"===e.props.topCondition?"#bae9ff":"#fffaca",border:"ALL"===e.props.topCondition?"1px solid rgb(144, 221, 255)":"1px solid #FFEB3B"}},"ALL"===e.props.topCondition?"AND":"OR")),f.createElement("div",{className:"react-autoql-notification-group-container".concat(t?" disable-first-delete":""),"data-test":"rule-group"},e.state.rules.map((function(t,o){return"rule"===t.type?f.createElement(xl,{authentication:e.props.authentication,ref:function(t){return e.ruleRefs[o]=t},ruleId:t.id,key:t.id,initialData:t.termValue,onDelete:function(){return e.deleteRuleOrGroup(t.id)},onUpdate:e.onRuleUpdate,onAdd:e.addRule,readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation}):"group"===t.type?f.createElement(n,{authentication:e.props.authentication,groupId:t.id,key:t.id,initialData:t.termValue,onDelete:function(){return e.deleteRuleOrGroup(t.id)},readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation}):void 0})),e.renderAllAnySelect(),e.renderDeleteGroupBtn(),e.renderAddBtn())))})),mn(Cn(e),"renderReadOnlyGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1,o=null;return"ALL"===e.state.andOrSelectValue?o="AND":"ANY"===e.state.andOrSelectValue&&(o="OR"),f.createElement(Rn,null,f.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,a){return"rule"===t.type?f.createElement(xl,{key:"rule-readonly-".concat(t.id),ref:function(t){return e.ruleRefs[a]=t},ruleId:t.id,initialData:t.termValue,andOrValue:a!==e.state.rules.length-1?o:null,enableQueryValidation:!1,readOnly:!0}):"group"===t.type?f.createElement("div",{key:"group-".concat(t.id)},f.createElement(n,{authentication:e.props.authentication,groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),a!==e.state.rules.length-1&&f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},o))):void 0}))))})),mn(Cn(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return pn(n)}();mn(Il,"propTypes",{authentication:nr,groupId:b.string,onDelete:b.func,onUpdate:b.func,disableAddGroupBtn:b.bool,hideTopCondition:b.bool,readOnly:b.bool,enableQueryValidation:b.bool}),mn(Il,"defaultProps",{authentication:Mo,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Al=function(t){var n={},o=[];return e(t,"length")?(t.map((function(e){o.push({initialData:e.term_value,isComplete:!0,type:"group",id:e.id})})),n={groups:o,andOrValue:"OR"===t[0].condition?"ANY":"ALL"}):(o.push({id:C(),isComplete:!1}),n={groups:o}),n},Nl=function(e){gn(o,f.Component);var t=Sn(o);function o(){var e;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),mn(Cn(e),"state",an({groups:[],andOrValue:"ALL"},Al(e.props.expression))),mn(Cn(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"componentDidUpdate",(function(t,o){n(t.expression,e.props.expression)||e.setState(an({},Al(e.props.expression))),n(o,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isComplete()}))})),mn(Cn(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isValid()}))})),mn(Cn(e),"getJSON",(function(){return e.state.groups.map((function(t,n){var o="ALL"===e.state.andOrValue?"AND":"OR";n===e.state.groups.length-1&&(o="TERMINATOR");var a=e.groupRefs[n],r=[];return a&&(r=a.getJSON()),{id:t.id||C(),term_type:"group",condition:o,term_value:r}}))})),mn(Cn(e),"addGroup",(function(t){var n=t.initialData,o=t.isComplete,a=t.id||C(),r=[].concat(Tn(e.state.groups),[{initialData:n,isComplete:o,id:a}]);e.setState({groups:r})})),mn(Cn(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),mn(Cn(e),"getAndOrValue",(function(){return e.state.andOrValue})),mn(Cn(e),"onGroupUpdate",(function(t,n){var o=e.state.groups.map((function(e){return e.id===t?an(an({},e),{},{isComplete:n}):e}));e.setState({groups:o}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"renderReadOnlyRules",(function(){var t=e.state.groups.length<=1,n=null;return"ALL"===e.state.andOrValue?n="AND":"ANY"===e.state.andOrValue&&(n="OR"),f.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(o,a){return f.createElement("div",{key:"expression-group-readonly-".concat(o.id,"-").concat(a)},f.createElement(Il,{ref:function(t){return e.groupRefs[a]=t},groupId:o.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===a,topCondition:e.state.andOrValue,onlyGroup:t,initialData:o.initialData,readOnly:e.props.readOnly,enableQueryValidation:!1}),a!==e.state.groups.length-1&&f.createElement("div",{style:{textAlign:"center",margin:"2px"}},f.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),mn(Cn(e),"renderRules",(function(){var t=e.state.groups.length<=1;return f.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&f.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",f.createElement(Dl,{options:["ALL","ANY"],value:e.state.andOrValue,type:"button",onChange:function(t){return e.setState({andOrValue:t})}})," ","of the following conditions are met:"),f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,o){return f.createElement(Il,{authentication:e.props.authentication,ref:function(t){return e.groupRefs[o]=t},key:"group-".concat(n.id,"-").concat(o),groupId:n.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===o,topCondition:e.state.andOrValue,onlyGroup:t,initialData:n.initialData,readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation})})),!e.props.readOnly&&f.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},f.createElement(Wn,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),!e.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return pn(o)}();mn(Nl,"propTypes",{authentication:nr,expression:b.arrayOf(b.shape({})),readOnly:b.bool,onChange:b.func}),mn(Nl,"defaultProps",{authentication:Mo,expression:void 0,readOnly:!1,onChange:function(){}});var wl=Ht.tz.names().map((function(e){return{value:e,label:e}})),kl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){var e=o.getSelectedOption();o.props.onChange(e)})),mn(Cn(o),"getSelectedOption",(function(){var e,t=o.props.value||o.defaultTimeZone;return null===(e=wl.find((function(e){return e.label===t})))||void 0===e?void 0:e.value})),mn(Cn(o),"render",(function(){var e=o.getSelectedOption();return f.createElement(xo,{className:"react-autoql-timezone-select",options:wl,value:e,onChange:o.props.onChange,menuPlacement:"top",maxMenuHeight:180,popoverParentElement:o.props.popoverParentElement,popoverBoundaryElement:o.props.popoverBoundaryElement,label:o.props.label,isSearchable:!0})})),o.defaultTimeZone=Ht.tz.guess(),o}return pn(n)}();mn(kl,"propTypes",{onChange:b.func,value:b.string,label:b.string}),mn(kl,"defaultProps",{onChange:function(){},value:void 0,label:""});var Pl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"componentDidUpdate",(function(e){o.props.interval!==e.interval&&o.setState({optionArray:o.getOptionArray()})})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"onChange",(function(e){var t=o.state.optionArray.find((function(t){return t.value===e}));o.props.onChange(t)})),mn(Cn(o),"isValid",(function(){var e=!!o.props.value,t=!!o.state.optionArray.find((function(e){return e.value===o.props.value}));return e&&t})),mn(Cn(o),"getOptionArray",(function(){var e=o.props.interval;60%e!=0&&(console.warn("Interval provided to TimePicker was invalid. 60 is not divisible ".concat(e,".")),e=30);for(var t=60/e,n=[],a=0;a<24;a++)for(var r=0;r<t;r++){var i="am";a>=12&&(i="pm");var l=a%12;0===l&&(l=12);var s=o.minuteFormatter.format(r*e);n.push({ampm:i,minute:s,hour:l,hour24:a,value:"".concat(l,":").concat(s).concat(i),value24hr:"".concat(a,":").concat(s)})}return n})),mn(Cn(o),"render",(function(){return f.createElement(xo,{options:o.state.optionArray.map((function(e){return{value:e.value}})),value:o.props.value,onChange:o.onChange})})),o.minuteFormatter=new Intl.NumberFormat("en-US",{minimumIntegerDigits:2,minimumFractionDigits:0});var a=o.getOptionArray();return o.state={selectedTime:o.props.value,optionArray:a},o}return pn(n)}();mn(Pl,"propTypes",{value:b.string,interval:b.number}),mn(Pl,"defaultProps",{value:void 0,interval:30});var Ol=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a,r,i,l,s,c;un(this,n),mn(Cn(c=t.call(this,e)),"componentDidMount",(function(){c._isMounted=!0,c.isCompleteChanged()&&c.props.onCompleteChange(c.isFormComplete)})),mn(Cn(c),"componentDidUpdate",(function(e){var t,n;if(c.isCompleteChanged()&&c.props.onCompleteChange(c.isFormComplete),(null===(t=c.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text)!==(null===(n=e.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.text)&&(c.timeRange=Wr(props.queryResponse)),c.props.frequencyType!==e.frequencyType){c.getInitialStateFromDataAlert(c.props,state),c.setState({})}})),mn(Cn(c),"componentWillUnmount",(function(){c._isMounted=!1})),mn(Cn(c),"isComplete",(function(){var e;return!!c._isMounted&&(!(c.shouldRenderResetPeriodSelector()&&!c.state.resetPeriodSelectValue)&&(!(c.shouldRenderEvaluationFrequencySelector()&&!c.state.evaluationFrequencySelectValue)&&!(null!==(e=c.timePickerRef)&&void 0!==e&&e._isMounted&&!c.timePickerRef.isValid())))})),mn(Cn(c),"isCompleteChanged",(function(){var e=c.isComplete();return e!==c.isFormComplete&&(c.isFormComplete=e,!0)})),mn(Cn(c),"getInitialStateFromDataAlert",(function(e,t){var n=e.dataAlert;try{var a,r,i;if(t.frequencyType=null!==(a=null!==(r=e.frequencyType)&&void 0!==r?r:null==n?void 0:n.notification_type)&&void 0!==a?a:c.DEFAULT_FREQUENCY_TYPE,t.evaluationFrequencySelectValue=null==n?void 0:n.evaluation_frequency,t.timezone=null==n?void 0:n.time_zone,t.resetPeriodSelectValue=null==n?void 0:n.reset_period,!t.resetPeriodSelectValue&&"SCHEDULED"!==t.frequencyType&&c.SUPPORTED_CONDITION_TYPE===Lr)t.resetPeriodSelectValue=null!==(i=c.timeRange)&&void 0!==i?i:c.DEFAULT_RESET_PERIOD_SELECT_VALUE;if(null===t.resetPeriodSelectValue&&(t.resetPeriodSelectValue="NONE"),"SCHEDULED"===t.frequencyType){var l,s,u,d,p=null==n?void 0:n.schedules,m=null!==(l=null==p||null===(s=p[0])||void 0===s?void 0:s.notification_period)&&void 0!==l?l:c.DEFAULT_RESET_PERIOD_SELECT_VALUE;if(t.resetPeriodSelectValue=m,t.intervalTimeSelectValue=null!==(u=function(e,t){if(e&&t){var n=o(e).tz(t),a=n.hour(),r=a%12;return 0===r&&(r=12),{ampm:n.format("a"),value:n.format("h:mma"),value24hr:n.format("H:mm"),minute:n.minute(),hour24:a,hour:r}}}(null==p||null===(d=p[0])||void 0===d?void 0:d.start_date,null==n?void 0:n.time_zone))&&void 0!==u?u:c.DEFAULT_TIME_SELECT_VALUE,"MONTH_LAST_DAY"===m)t.resetPeriodSelectValue="MONTH",t.monthDaySelectValue="LAST";else if("MONTH"===m)t.monthDaySelectValue="FIRST";else if("WEEK"===m&&7===n.schedules.length)t.resetPeriodSelectValue="DAY";else if("WEEK"===m){var f;t.weekDaySelectValue=function(e,t){var n=o(e).tz(t).day();return io[n]}(null===(f=p[0])||void 0===f?void 0:f.start_date,null==n?void 0:n.time_zone)}}}catch(e){console.error(e)}})),mn(Cn(c),"getSummary",(function(){var e;return"".concat(c.state.resetPeriodSelectValue," ").concat(c.getDayOfSelection(c.state.resetPeriodSelectValue)," ").concat(null===(e=c.state.intervalTimeSelectValue)||void 0===e?void 0:e.value," ").concat(c.state.timezone)})),mn(Cn(c),"getData",(function(){var e=c.getNotificationType(),t="SCHEDULED"!==c.state.frequencyType?c.getResetPeriod():void 0,n=c.getSchedules(),o=c.state.timezone;return{notificationType:e,evaluationFrequency:c.state.evaluationFrequencySelectValue,resetPeriod:t,schedules:n,timezone:o}})),mn(Cn(c),"getNotificationPeriod",(function(){return"MONTH"===c.state.resetPeriodSelectValue&&"LAST"===c.state.monthDaySelectValue?"MONTH_LAST_DAY":c.state.resetPeriodSelectValue})),mn(Cn(c),"getLocalStartDate",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.daysToAdd;return null===(e=zr[c.state.resetPeriodSelectValue])||void 0===e?void 0:e.getLocalStartDate({timeObj:c.state.intervalTimeSelectValue,timezone:c.state.timezone,monthDay:c.state.monthDaySelectValue,weekDay:c.state.weekDaySelectValue,daysToAdd:n})})),mn(Cn(c),"getSchedules",(function(){if("SCHEDULED"===c.state.frequencyType){if("DAY"===c.state.resetPeriodSelectValue){var e=[];return ro.forEach((function(t,n){e.push({notification_period:"WEEK",start_date:c.getLocalStartDate({daysToAdd:n}),time_zone:c.state.timezone})})),e}return[{notification_period:c.getNotificationPeriod(),start_date:c.getLocalStartDate(),time_zone:c.state.timezone}]}})),mn(Cn(c),"getResetPeriod",(function(){return"NONE"===c.state.resetPeriodSelectValue?null:c.state.resetPeriodSelectValue})),mn(Cn(c),"getNotificationType",(function(){return c.state.frequencyType===Or&&"NONE"!==c.state.resetPeriodSelectValue?Pr:c.state.frequencyType})),mn(Cn(c),"shouldRenderResetPeriodSelector",(function(){return"SCHEDULED"!==c.state.frequencyType&&c.SUPPORTED_CONDITION_TYPE===Lr})),mn(Cn(c),"renderQuery",(function(){var e,t=null===(e=c.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text;return t=t[0].toUpperCase()+t.substring(1),f.createElement("div",null,"Query: ",t)})),mn(Cn(c),"getResetPeriodSelectValue",(function(){var e=c.props.dataAlert;return e?e.notification_type!==Pr?Hr[e.reset_period]:void 0:c.timeRange})),mn(Cn(c),"scheduleIntervalSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{options:Object.keys(zr).map((function(e){return{value:e,label:zr[e].displayName}})),label:"Send a Notification",value:c.state.resetPeriodSelectValue,onChange:function(e){return c.setState({resetPeriodSelectValue:e})}}))})),mn(Cn(c),"dayOfWeekSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{value:c.state.weekDaySelectValue,onChange:function(e){return c.setState({weekDaySelectValue:e})},options:ro.map((function(e){return{value:e,label:f.createElement("span",null,"on ",f.createElement("strong",null,e))}}))}))})),mn(Cn(c),"dayOfMonthSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{value:c.state.monthDaySelectValue,onChange:function(e){return c.setState({monthDaySelectValue:e})},options:Object.keys(Qr).map((function(e){return{value:e,label:Qr[e]}}))}))})),mn(Cn(c),"dayOfYearSelector",(function(){return f.createElement("span",{className:"schedule-builder-day-of-year-selector"},f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-at-connector"},f.createElement("span",null,"in")),f.createElement(xo,{options:no.map((function(e){return{value:e}})),value:c.state.monthOfYearSelectValue,onChange:function(e){return c.setState({monthOfYearSelectValue:e})}}),c.dayOfMonthSelector())})),mn(Cn(c),"getDayOfSelection",(function(e){switch(e){case"YEAR":return c.state.monthOfYearSelectValue;case"MONTH":return c.state.monthDaySelectValue;case"WEEK":return c.state.weekDaySelectValue}return null})),mn(Cn(c),"dayOfSelector",(function(){switch(c.state.resetPeriodSelectValue){case"YEAR":return c.dayOfYearSelector();case"MONTH":return c.dayOfMonthSelector();case"WEEK":return c.dayOfWeekSelector()}return null})),mn(Cn(c),"hourMinSelector",(function(){var e;return f.createElement(f.Fragment,null,f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-at-connector"},f.createElement("span",null,"at")),f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(Pl,{ref:function(e){return c.timePickerRef=e},value:null===(e=c.state.intervalTimeSelectValue)||void 0===e?void 0:e.value,onChange:function(e){c.setState({intervalTimeSelectValue:e})}})))})),mn(Cn(c),"timezoneSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-timezone-section"},f.createElement("div",null,f.createElement(kl,{value:c.state.timezone,onChange:function(e){return c.setState({timezone:e})},popoverParentElement:c.props.popoverParentElement,popoverBoundaryElement:c.props.popoverBoundaryElement,label:"Time Zone"})))})),mn(Cn(c),"shouldRenderEvaluationFrequencySelector",(function(){var e,t;return(t=null===(e=c.state)||void 0===e?void 0:e.frequencyType)===Or||t===Pr})),mn(Cn(c),"evaluationFrequencySelector",(function(){if(c.shouldRenderEvaluationFrequencySelector()){var e="How often should we run the query to check for new data? (You will only be notified if there is new data)";c.SUPPORTED_CONDITION_TYPE===Lr&&(e="How often should we run the query to check if the conditions are met?");var t=Object.keys(Ur).map((function(e){var t=Ur[e];return{value:null==t?void 0:t.value,label:null==t?void 0:t.label,listLabel:null==t?void 0:t.listLabel}}));return f.createElement("div",{className:"react-autoql-data-alert-frequency-option check-frequency"},f.createElement(xo,{options:t,value:c.state.evaluationFrequencySelectValue,label:f.createElement("span",null,"Check conditions every"," ",f.createElement(Wn,{className:"react-autoql-info-tooltip",type:"info","data-for":c.props.tooltipID,"data-tip":e})),onChange:function(e){return c.setState({evaluationFrequencySelectValue:e})}}))}return null})),mn(Cn(c),"resetPeriodSelector",(function(){return c.shouldRenderResetPeriodSelector()?f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{options:Object.keys(Hr).map((function(e){return{value:e,label:Hr[e].displayName}})).filter((function(e){return"NONE"!==(null==e?void 0:e.value)||c.SUPPORTED_CONDITION_TYPE===Mr})),label:"Send a notification",value:c.state.resetPeriodSelectValue,onChange:function(e){return c.setState({resetPeriodSelectValue:e})}})):null})),mn(Cn(c),"scheduleFrequencyOptions",(function(){return f.createElement("div",null,f.createElement("div",{className:"react-autoql-data-alert-frequency-options-container"},c.scheduleIntervalSelector(),c.dayOfSelector(),c.hourMinSelector(),c.timezoneSelector()))})),mn(Cn(c),"continuousFrequencyOptions",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-options-container continuous-alert"},c.evaluationFrequencySelector(),c.resetPeriodSelector())})),mn(Cn(c),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=e.useRT,o=e.sentenceCase,a=e.withFilters,r=c.props.expressionRef;return r?r.getConditionStatement({tense:t,useRT:n,sentenceCase:o,withFilters:a}):"the Data Alert is triggered"})),mn(Cn(c),"frequencyTypeSection",(function(){var e,t,n,o,a,r;if(!c.props.showTypeSelector)return null;null!==(e=null!==(t=null===(n=c.props.expressionRef)||void 0===n?void 0:n.getFirstQuery())&&void 0!==t?t:null===(o=c.props.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.text)&&void 0!==e||null===(a=c.props.dataAlert)||void 0===a||null===(a=a.expression)||void 0===a||null===(a=a[0])||void 0===a||a.term_value;var i=c.state.frequencyType;return i===Pr&&(i=Or),f.createElement("div",{className:"frequency-type-container"},f.createElement("span",null,f.createElement("span",null,"If ",null!==(r=c.props.conditionStatement)&&void 0!==r?r:c.getConditionStatement({tense:"present",sentenceCase:!1}),", you'll be notified"),f.createElement(xo,{className:"data-alert-schedule-step-type-selector",options:Object.keys(Fr).map((function(e){var t,n;return{value:e,label:null===(t=Fr[e])||void 0===t?void 0:t.label,listLabel:null===(n=Fr[e])||void 0===n?void 0:n.listLabel}})),value:i,onChange:function(e){return c.setState({frequencyType:e})},outlined:!1})))})),mn(Cn(c),"frequencyOptionsSection",(function(){var e=null;switch(c.state.frequencyType){case"SCHEDULED":e=c.scheduleFrequencyOptions();break;case Or:case Pr:e=c.continuousFrequencyOptions()}return e?f.createElement("div",{className:"frequency-settings-container"},e):null})),mn(Cn(c),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"data-alert-schedule-builder-step","data-test":"schedule-builder"},c.frequencyTypeSection(),c.frequencyOptionsSection()))})),c.COMPONENT_KEY=C(),c.SUPPORTED_CONDITION_TYPE=null!==(a=null===(r=Ar(null===(i=e.dataAlert)||void 0===i?void 0:i.expression,e.queryResponse))||void 0===r?void 0:r[0])&&void 0!==a?a:Mr,c.DEFAULT_EVALUATION_FREQUENCY=5,c.DEFAULT_WEEKDAY_SELECT_VALUE="Friday",c.DEFAULT_MONTH_DAY_SELECT_VALUE="LAST",c.DEFAULT_MONTH_OF_YEAR_SELECT_VALUE="December",c.DEFAULT_FREQUENCY_TYPE="SCHEDULED",c.DEFAULT_RESET_PERIOD_SELECT_VALUE="MONTH",c.DEFAULT_TIME_SELECT_VALUE={ampm:"pm",minute:0,hour:5,hour24:17,value:"5:00pm",value24hr:"17:00"},c.timeRange=Wr(e.queryResponse),void 0!==(null===(l=e.dataAlert)||void 0===l?void 0:l.reset_period)&&(c.timeRange=e.dataAlert.reset_period);var u={evaluationFrequencySelectValue:c.DEFAULT_EVALUATION_FREQUENCY,frequencyType:c.DEFAULT_FREQUENCY_TYPE,intervalTimeSelectValue:c.DEFAULT_TIME_SELECT_VALUE,weekDaySelectValue:c.DEFAULT_WEEKDAY_SELECT_VALUE,monthOfYearSelectValue:c.DEFAULT_MONTH_OF_YEAR_SELECT_VALUE,resetPeriodSelectValue:null!==(s=c.timeRange)&&void 0!==s?s:c.DEFAULT_RESET_PERIOD_SELECT_VALUE,monthDaySelectValue:c.DEFAULT_MONTH_DAY_SELECT_VALUE,timezone:void 0};return e.dataAlert&&c.getInitialStateFromDataAlert(e,u),c.state=u,c}return pn(n)}();mn(Ol,"propTypes",{conditionType:b.string,showTypeSelector:b.bool,dataAlert:b.shape({}),onChange:b.func,onCompleteChange:b.func,onErrorCallback:b.func}),mn(Ol,"defaultProps",{conditionType:Mr,showTypeSelector:!0,dataAlert:void 0,onChange:function(){},onCompleteChange:function(){},onErrorCallback:function(){}});var Ll=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.steps&&o.props.steps.length||console.warn("No steps were provided to StepsHoz component")})),mn(Cn(o),"componentDidUpdate",(function(e,t){if(!Ma(o.state,t)||!Ma(o.props,e))return!0})),mn(Cn(o),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),mn(Cn(o),"isStepDisabled",(function(e,t){var n;return 0===e||e===o.props.activeStep||null!=t&&t.complete||null!==(n=o.props.steps)&&void 0!==n&&null!==(n=n[e-1])&&void 0!==n&&n.complete?"":" disabled"})),mn(Cn(o),"onClick",(function(e,t){t||o.props.onStepChange(e)})),mn(Cn(o),"render",(function(){return o.props.steps&&o.props.steps.length?f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-steps-hoz-".concat(o.COMPONENT_KEY),className:"react-autoql-steps-hoz-container","data-test":"react-autoql-steps"},o.props.steps.map((function(e,t){var n=o.isStepDisabled(t,e),a=o.props.activeStep===t,r=o.getStepStatus(e);return f.createElement("div",{key:"steps-hoz-".concat(o.COMPONENT_KEY,"-").concat(t),className:"react-autoql-step-hoz-container\n ".concat(r,"\n ").concat(a?" active":"","\n ").concat(n?" disabled":""),"data-test":"react-autoql-step-container-".concat(t)},0!==t&&f.createElement("div",{className:"react-autoql-step-connector-container"},f.createElement("span",{className:"react-autoql-step-connector"})),f.createElement("div",{className:"react-autoql-step-hoz"},f.createElement("button",{className:"react-autoql-step-hoz-dot",onClick:function(){return o.onClick(t,n)}},"complete"!==r||a?t+1:f.createElement(Wn,{type:"check"})),f.createElement("div",{className:"react-autoql-step-hoz-title-container","data-test":"react-autoql-step-hoz-title-".concat(t),onClick:function(){return o.onClick(t,n)}},f.createElement("span",{className:"react-autoql-step-hoz-title"},e.title))))})))):null})),o.COMPONENT_KEY=C(),o}return pn(n)}();mn(Ll,"propTypes",{steps:b.arrayOf(b.shape({})).isRequired,activeStep:b.number.isRequired}),mn(Ll,"defaultProps",{});var Ml=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onDataAlertDelete",(function(){o.props.dataAlertId&&(o.setState({isDeletingDataAlert:!0}),function(e,t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(e,"?key=").concat(o);return r.delete(i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(o.props.dataAlertId,_o(o.props.authentication)).then((function(){o.props.onDelete(o.props.dataAlertId),o.props.onSuccessAlert("Data Alert was successfully deleted.")})).catch((function(e){console.error(e),o.props.onErrorCallback(e)})).finally((function(){o.setState({isDeletingDataAlert:!1})})))})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement(El,{isVisible:o.props.isVisible,onConfirm:o.onDataAlertDelete,confirmLoading:o.state.isDeletingDataAlert,onClose:o.props.onClose,backText:"Go back",confirmText:"Delete",width:"450px"},f.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),f.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),o.state={isDeletingDataAlert:!1},o}return pn(n)}();mn(Ml,"propTypes",{authentication:nr,dataAlertId:b.string,isVisible:b.bool,onClose:b.func,onErrorCallback:b.func}),mn(Ml,"defaultProps",{authentication:Mo,dataAlertId:void 0,isVisible:!1,onClose:function(){},onErrorCallback:function(){}});var ql=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"focusTitleInput",(function(){var e;null===(e=o.titleInputRef)||void 0===e||e.focus()})),mn(Cn(o),"renderDataAlertNameInput",(function(){return f.createElement(xr,{ref:function(e){return o.titleInputRef=e},className:"react-autoql-notification-display-name-input",placeholder:'eg. "Budget alert!"',icon:"title",maxLength:"50",label:"Title",value:o.props.titleInput,onChange:o.props.onTitleInputChange})})),mn(Cn(o),"renderDataAlertMessageInput",(function(){return f.createElement(xr,{className:"react-autoql-notification-message-input",placeholder:'eg. "You have spent 80% of your budget for the month."',area:!0,maxLength:"200",label:"Message (optional)",value:o.props.messageInput,onChange:o.props.onMessageInputChange})})),mn(Cn(o),"renderDataAlertPreview",(function(){return f.createElement("div",{className:"data-alert-preview"},f.createElement(ns,{notification:{id:"preview-".concat(o.COMPONENT_KEY),title:o.props.titleInput||f.createElement("span",null,f.createElement("em",null,"[Title]")),message:o.props.messageInput,created_at:o.SAMPLE_CREATED_AT.toISOString(),state:"UNACKNOWLEDGED",expanded:!1}}))})),mn(Cn(o),"render",(function(){var e,t=null!==(e=o.props.conditionStatement)&&void 0!==e?e:"the Data Alert is triggered";return f.createElement("div",null,o.props.showConditionStatement?f.createElement("div",{className:"compose-message-section-condition-statement"},f.createElement("span",null,"If ",t,", you'll receive a notification with this ",f.createElement("strong",null,"title and message:"))):null,f.createElement("div",{className:"compose-message-section"},f.createElement("div",{className:"form-section"},o.renderDataAlertNameInput(),o.renderDataAlertMessageInput()),f.createElement("div",{className:"preview-section"},f.createElement("div",{className:"react-autoql-input-label"},"Preview"),o.renderDataAlertPreview())))})),o.COMPONENT_KEY=C(),o.SAMPLE_CREATED_AT=new Date,o}return pn(n)}();mn(ql,"propTypes",{titleInput:b.string,messageInput:b.string,onTitleInputChange:b.func,onMessageInputChange:b.func,showConditionStatement:b.bool}),mn(ql,"defaultProps",{titleInput:"",messageInput:"",showConditionStatement:!0,queryText:"",onTitleInputChange:function(){},onMessageInputChange:function(){}});var Vl=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,n=e.children;return f.createElement("div",{className:"react-autoql-data-alert-setting-section"},t?f.createElement("div",{className:"react-autoql-data-alert-setting-section-title"},t):null,n)},_l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.children,n=e.className;return f.createElement("div",{className:"react-autoql-flex-table-container ".concat(null!=n?n:""),role:"table"},null!=t?t:null)},Fl=function(e){e.horizontal;var t=e.vertical;return f.createElement("div",{className:"react-autoql-settings-vertical-divider ".concat(t?"react-autoql-settings-vertical-divider-vertical":"react-autoql-settings-vertical-divider-horizontal")})},zl=function(e){var t=e.children,n=e.flex,o=e.flexSize;return t?f.createElement("div",{className:"react-autoql-data-alert-setting-group",style:{flex:o,display:n?"flex":"block"}},t):null},Bl=function(e){var t=e.children,n=e.flex,o=e.flexSize;return t?f.createElement("div",{className:"react-autoql-data-alert-setting",style:{flex:o,display:n?"flex":"block"}},t):null},Hl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){o.isCompleteChanged()&&o.props.onCompleteChange(o.isFormComplete)})),mn(Cn(o),"getInitialState",(function(e){var t,n,a=(null!=e?e:o.props).currentDataAlert;if(!a)return{};var r=null==a?void 0:a.notification_type;return r===Pr&&(r=Or),{titleInput:null!==(t=a.title)&&void 0!==t?t:"",messageInput:null!==(n=a.message)&&void 0!==n?n:"",notificationType:r,evaluationFrequencySelectValue:a.reset_period,isConfirmDeleteModalVisible:!1,expressionKey:C(),filters:a.filters,expression:a.expression}})),mn(Cn(o),"isCompleteChanged",(function(){var e=o.isComplete();return e!==o.isFormComplete&&(o.isFormComplete=e,!0)})),mn(Cn(o),"getData",(function(){var e,t,n,a,r=null!==(e=null===(t=o.scheduleBuilderRef)||void 0===t?void 0:t.getData())&&void 0!==e?e:{},i=o.state.notificationType;return null!=r&&r.resetPeriod&&i===Or&&(i=Pr),{id:null===(n=o.props.currentDataAlert)||void 0===n?void 0:n.id,data_return_query:null===(a=o.props.currentDataAlert)||void 0===a?void 0:a.data_return_query,title:o.state.titleInput,message:o.state.messageInput,expression:S(o.state.expression),notification_type:i,reset_period:r.resetPeriod,time_zone:r.timezone,schedules:r.schedules,evaluation_frequency:r.evaluationFrequency}})),mn(Cn(o),"initializeFields",(function(e){o.setState(o.getInitialState(e))})),mn(Cn(o),"isComplete",(function(){return o.state.isConditionSectionComplete&&o.state.isScheduleSectionComplete&&!!o.state.titleInput})),mn(Cn(o),"onExpressionChange",(function(e,t,n){o.setState({expression:n,isConditionSectionComplete:e})})),mn(Cn(o),"AppearanceSettings",(function(){return f.createElement(ql,{titleInput:o.state.titleInput,messageInput:o.state.messageInput,onTitleInputChange:function(e){o.setState({titleInput:e.target.value})},onMessageInputChange:function(e){o.setState({messageInput:e.target.value})},showConditionStatement:!1})})),mn(Cn(o),"AlertTypeSetting",(function(){return f.createElement(xo,{value:o.state.notificationType,onChange:function(e){return o.setState({notificationType:e})},className:"react-autoql-alert-type-setting-select",label:"Alert Type",fullWidth:!0,options:[{value:"SCHEDULED",label:"Scheduled",subtitle:"Get notifications at specific times.",icon:"calendar"},{value:Or,label:"Live",subtitle:"Get notifications as soon as the conditions are met.",icon:"live"}]})})),mn(Cn(o),"ScheduleSettings",(function(){return f.createElement(Ol,{ref:function(e){return o.scheduleBuilderRef=e},key:"data-alert-settings-schedule-builder-".concat(o.state.notificationType),tooltipID:o.props.tooltipID,dataAlert:o.props.currentDataAlert,showTypeSelector:!1,onErrorCallback:o.props.onErrorCallback,frequencyType:o.state.notificationType,onCompleteChange:function(e){return o.setState({isScheduleSectionComplete:e})}})})),mn(Cn(o),"ConditionsSettings",(function(){return f.createElement(ei,{authentication:o.props.authentication,ref:function(e){return o.expressionRef=e},key:"expression-".concat(o.state.expressionKey),onChange:o.onExpressionChange,expression:o.state.expression,tooltipID:o.props.tooltipID})})),mn(Cn(o),"render",(function(){return o.props.currentDataAlert?f.createElement(Rn,null,f.createElement(_l,{className:"data-alert-settings-modal-content"},f.createElement(Vl,{title:"Conditions"},o.ConditionsSettings()),f.createElement(Fl,{horizontal:!0}),f.createElement(Vl,{title:"Timing"},f.createElement(zl,{flex:!0},f.createElement(Bl,{flexSize:1},o.AlertTypeSetting()),f.createElement(zl,{flexSize:2},f.createElement(Bl,null,o.ScheduleSettings())))),f.createElement(Fl,{horizontal:!0}),f.createElement(Vl,{title:"Appearance"},o.AppearanceSettings()))):null})),o.COMPONENT_KEY=C(),o.isFormComplete=!0,o.state=o.getInitialState(e),o}return pn(n)}();mn(Hl,"propTypes",{authentication:nr,currentDataAlert:b.shape({}),onErrorCallback:b.func,onExpressionChange:b.func,onCompleteChange:b.func}),mn(Hl,"defaultProps",{authentication:Mo,currentDataAlert:void 0,onErrorCallback:function(){},onExpressionChange:function(){},onCompleteChange:function(){}});var Ql=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){if(!o.props.isVisible&&e.isVisible&&(setTimeout(o.initializeFields,500),o.props.onClosed()),o.props.isVisible&&!e.isVisible)o.initializeFields();else if(o.props.isVisible){var n;if(o.state.activeStep!==t.activeStep)if(o.state.activeStep===o.getStepNumber(o.MESSAGE_STEP))null===(n=o.appearanceSectionRef)||void 0===n||n.focusTitleInput();if(!o.state.isFrequencySectionReady&&t.isFrequencySectionReady){var a=o.getStepNumber(o.FREQUENCY_STEP),r=Tn(o.state.completedSections);r[a]=!1,o.setState({completedSections:r})}}})),mn(Cn(o),"showConditionsStep",(function(){return o.conditionsEditable()||o.hasFilters()})),mn(Cn(o),"getSteps",(function(e){var t,n=null!=e?e:o.props;o.SUPPORTED_CONDITION_TYPES=Ar(null===(t=n.currentDataAlert)||void 0===t?void 0:t.expression,n.queryResponse);var a=[{title:"Configure Timing",value:o.FREQUENCY_STEP},{title:"Customize Appearance",value:o.MESSAGE_STEP}];return o.showConditionsStep()&&a.unshift({title:"Set Up Conditions",value:o.CONDITIONS_STEP}),a})),mn(Cn(o),"getInitialState",(function(e){var t,n=null!=e?e:o.props,a={titleInput:"",messageInput:"",expressionJSON:[],isConfirmDeleteModalVisible:!1,selectedConditionType:null===(t=o.SUPPORTED_CONDITION_TYPES)||void 0===t?void 0:t[0],activeStep:0,completedSections:[],expressionKey:C(),isMounted:!1,isSettingsFormComplete:!0};if(n.currentDataAlert){var r,i,l,s,c,u=n.currentDataAlert;a.titleInput=null!==(r=u.title)&&void 0!==r?r:"",a.messageInput=null!==(i=u.message)&&void 0!==i?i:"",a.selectedConditionType=null!==(l=null===(s=u.expression)||void 0===s||null===(s=s[0])||void 0===s?void 0:s.condition)&&void 0!==l?l:null===(c=o.SUPPORTED_CONDITION_TYPES)||void 0===c?void 0:c[0],a.activeStep=0,a.completedSections=o.steps.map((function(){return!0})),a.expressionJSON=null==u?void 0:u.expression}return a})),mn(Cn(o),"initializeFields",(function(e){o.steps=o.getSteps(e),o.setState(o.getInitialState(e))})),mn(Cn(o),"getDataAlertData",(function(){try{var e,t,n=o.props,a=n.currentDataAlert,r=n.queryResponse,i=o.state,l=i.titleInput,s=i.messageInput;if(null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id)return null===(t=o.settingsViewRef)||void 0===t?void 0:t.getData();var c,u=S(o.state.expressionJSON);if(o.expressionRef)c=o.expressionRef.getFirstQuery(),u=o.expressionRef.getJSON();else if(a)c=a.data_return_query,u=a.expression;else{var d,p,m=null==r||null===(d=r.data)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.text;c=m,u=[{id:C(),term_type:"QUERY",condition:Mr,term_value:m,user_selection:null==r||null===(p=r.data)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.fe_req)||void 0===p?void 0:p.disambiguation}]}var f={};return o.scheduleBuilderRef&&(f=o.scheduleBuilderRef.getData()),{title:l,data_return_query:c,message:s,expression:u,notification_type:f.notificationType,reset_period:f.resetPeriod,time_zone:f.timezone,schedules:f.schedules,evaluation_frequency:f.evaluationFrequency}}catch(e){console.error(e)}})),mn(Cn(o),"onExpressionChange",(function(e,t,n){o.setState({expressionJSON:n})})),mn(Cn(o),"isConditionSectionReady",(function(){var e,t;return!o.conditionsEditable()||null===(e=o.expressionRef)||void 0===e||!e._isMounted||(null===(t=o.expressionRef)||void 0===t?void 0:t.isComplete())})),mn(Cn(o),"onDataAlertSave",(function(){var e,t;o.setState({isSavingDataAlert:!0});var n=null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?null===(t=o.settingsViewRef)||void 0===t?void 0:t.getData():o.getDataAlertData(),a=an({dataAlert:n},_o(o.props.authentication));o.props.isManagement?(o.props.onManagementCreateDataAlert(n),o.setState({isSavingDataAlert:!1})):n.id?function(e){var t=e.dataAlert,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No rule to update"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(t.id,"?key=").concat(o);return r.put(i,t).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},a)).then((function(e){o.props.onSave(e),o.props.onSuccessAlert("Data Alert updated!"),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(null==e?void 0:e.message),o.setState({isSavingDataAlert:!1})})):function(e){var t=e.dataAlert,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i=S(t);delete i.id;var l="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(o);return r.post(l,i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},a)).then((function(e){o.props.onSave(e),o.props.onSuccessAlert("Data Alert created!"),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o.setState({isSavingDataAlert:!1})}))})),mn(Cn(o),"nextStep",(function(){if(o.isStepReady()){var e=Tn(o.state.completedSections);e[o.state.activeStep]=!0,o.setState({activeStep:o.state.activeStep+1,completedSections:e})}})),mn(Cn(o),"previousStep",(function(){o.state.activeStep>0&&o.setState({activeStep:o.state.activeStep-1})})),mn(Cn(o),"setStep",(function(e){o.setState({activeStep:e})})),mn(Cn(o),"isFinishBtnDisabled",(function(){var e;if(null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id)return!o.state.isSettingsFormComplete;var t=o.steps.length-1,n=!!o.steps.find((function(e,n){return n!==t&&!o.state.completedSections[n]})),a=o.isStepReady(t);return n||!a})),mn(Cn(o),"renderNextBtn",(function(){var e;return null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?f.createElement(wo,{type:"primary",loading:o.state.isSavingDataAlert,onClick:o.onDataAlertSave,disabled:o.isFinishBtnDisabled(),tooltipID:o.TOOLTIP_ID},"Save Changes"):o.state.activeStep===o.steps.length-1?f.createElement(wo,{type:"primary",loading:o.state.isSavingDataAlert,onClick:o.onDataAlertSave,disabled:o.isFinishBtnDisabled(),tooltipID:o.TOOLTIP_ID},"Finish & Save"):f.createElement(wo,{className:"react-autoql-data-alert-next-btn",onClick:o.nextStep,disabled:!o.isStepReady(),type:"primary",tooltipID:o.TOOLTIP_ID},"Next")})),mn(Cn(o),"renderBackBtn",(function(e){return 0===o.state.activeStep?null:f.createElement(wo,{className:e,tooltipID:o.TOOLTIP_ID,onClick:o.previousStep},"Back")})),mn(Cn(o),"renderCancelBtn",(function(){return f.createElement(wo,{tooltipID:o.TOOLTIP_ID,border:!1,onClick:function(e){e.stopPropagation(),o.modalRef&&o.modalRef.onClose()}},"Cancel")})),mn(Cn(o),"renderDeleteBtn",(function(){return f.createElement(wo,{type:"danger",onClick:function(){o.setState({isConfirmDeleteModalVisible:!0})},tooltipID:o.TOOLTIP_ID},"Delete Data Alert")})),mn(Cn(o),"renderFooter",(function(){return f.createElement("div",{className:"data-alert-modal-footer-container"},o.renderQuerySummary(),f.createElement("div",{ref:function(e){return o.footerElement=e},className:"react-autoql-data-alert-modal-footer"},f.createElement("div",{className:"modal-footer-button-container"},o.props.currentDataAlert&&o.props.allowDelete&&o.renderDeleteBtn()),f.createElement("div",{className:"modal-footer-button-container"},o.renderCancelBtn(),o.renderBackBtn(),o.renderNextBtn())))})),mn(Cn(o),"renderConditionTypeSelector",(function(){var e,t=null===(e=o.SUPPORTED_CONDITION_TYPES)||void 0===e?void 0:e.map((function(e){return{value:e,label:_r[e].displayName}}));return f.createElement(xo,{style:{width:"100%"},options:t,value:o.state.selectedConditionType,className:"react-autoql-rule-condition-type-select",onChange:function(e){o.setState({selectedConditionType:e})}})})),mn(Cn(o),"renderConditionsStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{flex:1}},f.createElement(ei,{authentication:o.props.authentication,ref:function(e){return o.expressionRef=e},key:"expression-".concat(o.state.expressionKey),onChange:o.onExpressionChange,expression:o.state.expressionJSON,queryResponse:o.props.queryResponse,tooltipID:o.TOOLTIP_ID,onLastInputEnterPress:o.nextStep,filters:o.props.filters}))))})),mn(Cn(o),"getConditionStatement",(function(){return o.conditionsEditable()?"the Data Alert conditions are met":"new data is detected for your query"})),mn(Cn(o),"renderFrequencyStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement(Ol,{ref:function(e){return o.scheduleBuilderRef=e},key:"schedule-".concat(o.COMPONENT_KEY),dataAlert:o.props.currentDataAlert,onCompleteChange:function(e){return o.setState({isFrequencySectionReady:e})},onErrorCallback:o.props.onErrorCallback,conditionType:o.state.selectedConditionType,conditionStatement:o.getConditionStatement(),queryResponse:o.props.queryResponse,expressionRef:o.expressionRef,tooltipID:o.TOOLTIP_ID}))})),mn(Cn(o),"renderComposeMessageStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement(ql,{ref:function(e){return o.appearanceSectionRef=e},titleInput:o.state.titleInput,messageInput:o.state.messageInput,onTitleInputChange:function(e){return o.setState({titleInput:e.target.value})},onMessageInputChange:function(e){return o.setState({messageInput:e.target.value})},queryText:o.getQueryText(),showConditionStatement:!0,conditionStatement:o.getConditionStatement()}))})),mn(Cn(o),"getStepNumber",(function(e){return o.steps.findIndex((function(t){return t.value&&e&&t.value===e}))})),mn(Cn(o),"onDataAlertDelete",(function(){var e,t=null===(e=o.props.currentDataAlert)||void 0===e?void 0:e.id;t&&(o.setState({isConfirmDeleteModalVisible:!1}),o.props.onDelete(t))})),mn(Cn(o),"renderStepContent",(function(){var e=o.state.activeStep;return f.createElement(f.Fragment,null,o.renderConditionsStep(e===o.getStepNumber(o.CONDITIONS_STEP)),o.renderFrequencyStep(e===o.getStepNumber(o.FREQUENCY_STEP)),o.renderComposeMessageStep(e===o.getStepNumber(o.MESSAGE_STEP)))})),mn(Cn(o),"hasFilters",(function(){var e,t,n,a,r;return!!(null!==(e=o.props.filters)&&void 0!==e&&e.length||null!==(t=o.props.queryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.fe_req)&&void 0!==t&&null!==(t=t.session_filter_locks)&&void 0!==t&&t.length||null!==(n=o.props.queryResponse)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.fe_req)&&void 0!==n&&null!==(n=n.persistent_filter_locks)&&void 0!==n&&n.length||null!==(a=o.props.currentDataAlert)&&void 0!==a&&null!==(a=a.expression)&&void 0!==a&&null!==(a=a[0])&&void 0!==a&&null!==(a=a.session_filter_locks)&&void 0!==a&&a.length||null!==(r=o.props.currentDataAlert)&&void 0!==r&&null!==(r=r.expression)&&void 0!==r&&null!==(r=r[0])&&void 0!==r&&null!==(r=r.filters)&&void 0!==r&&r.length)})),mn(Cn(o),"conditionsEditable",(function(){var e;return null===(e=o.SUPPORTED_CONDITION_TYPES)||void 0===e?void 0:e.includes(Lr)})),mn(Cn(o),"onSettingsCompleteChange",(function(e){o.setState({isSettingsFormComplete:e})})),mn(Cn(o),"renderQuerySummary",(function(){var e,t;return o.state.activeStep===o.getStepNumber(o.CONDITIONS_STEP)||null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?null:f.createElement("div",{className:"data-alert-modal-query-summary-container"},f.createElement("div",{className:"data-alert-modal-query-summary-background"}),f.createElement("div",{className:"data-alert-modal-query-summary"},f.createElement("strong",null,"Your query:"),' "',null===(t=o.expressionRef)||void 0===t?void 0:t.getFormattedQueryText({sentenceCase:!1,withFilters:!0}),'"'))})),mn(Cn(o),"renderContent",(function(){var e;return o.props.isVisible?null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?f.createElement(Po,{className:"data-alert-modal-settings-scroll-container"},f.createElement(Hl,{ref:function(e){return o.settingsViewRef=e},authentication:o.props.authentication,currentDataAlert:o.props.currentDataAlert,enableQueryValidation:o.props.enableQueryValidation,supportedConditionTypes:o.SUPPORTED_CONDITION_TYPES,onErrorCallback:o.props.onErrorCallback,onCompleteChange:o.onSettingsCompleteChange,tooltipID:o.TOOLTIP_ID})):f.createElement(f.Fragment,null,f.createElement(Ll,{activeStep:o.state.activeStep,onStepChange:o.setStep,steps:o.steps.map((function(e,t){return{title:e.title,complete:o.state.completedSections[t]}}))}),f.createElement("div",{className:"data-alert-modal-step-content-container"},o.renderStepContent())):null})),mn(Cn(o),"isStepReady",(function(){var e,t=o.state.activeStep;switch(null===(e=o.steps)||void 0===e||null===(e=e[t])||void 0===e?void 0:e.value){case o.CONDITIONS_STEP:return o.isConditionSectionReady();case o.FREQUENCY_STEP:return o.state.isFrequencySectionReady;case o.MESSAGE_STEP:return!!o.state.titleInput;default:return!1}})),mn(Cn(o),"getTitleIcon",(function(){return _e(o.props.currentDataAlert)?f.createElement("span",{key:"title-icon-".concat(o.COMPONENT_KEY)}):f.createElement(Wn,{key:"title-icon-".concat(o.COMPONENT_KEY),type:"settings"})})),mn(Cn(o),"getQueryText",(function(){var e,t,n;return null!==(e=null===(t=o.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text)&&void 0!==e?e:null===(n=o.props.currentDataAlert)||void 0===n?void 0:n.data_return_query})),mn(Cn(o),"render",(function(){var e,t;return o.getQueryText(),f.createElement(Rn,null,f.createElement(Sl,{contentClassName:"react-autoql-data-alert-creation-modal",bodyClassName:"react-autoql-data-alert-modal-body",overlayStyle:{zIndex:"9998"},title:null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?"Edit Data Alert Settings":"Create Data Alert",titleIcon:o.getTitleIcon(),ref:function(e){return o.modalRef=e},isVisible:o.props.isVisible,onClose:o.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,width:"1200px",footer:o.renderFooter(),onOpened:o.props.onOpened,onClosed:o.props.onClosed},f.createElement(So,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:500,place:"top"}),f.createElement("div",{key:"data-alert-modal-content-".concat(o.COMPONENT_KEY),ref:function(e){return o.contentRef=e},className:"react-autoql-data-alert-modal-content"},o.renderContent())),f.createElement(Ml,{authentication:o.props.authentication,dataAlertId:null===(t=o.props.currentDataAlert)||void 0===t?void 0:t.id,isVisible:o.state.isConfirmDeleteModalVisible,onDelete:o.onDataAlertDelete,onClose:function(){return o.setState({isConfirmDeleteModalVisible:!1})},onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessAlert}))})),o.COMPONENT_KEY=C(),o.TOOLTIP_ID="react-autoql-data-alert-modal-tooltip-".concat(o.COMPONENT_KEY),o.CONDITIONS_STEP="CONDITIONS",o.FREQUENCY_STEP="FREQUENCY",o.MESSAGE_STEP="MESSAGE",o.steps=o.getSteps(e),o.state=o.getInitialState(e),o}return pn(n)}();mn(Ql,"propTypes",{authentication:nr,onErrorCallback:b.func,onSave:b.func,queryResponse:b.shape({}),currentDataAlert:b.shape({}),isVisible:b.bool,allowDelete:b.bool,onClose:b.func,isManagement:b.bool,onManagementCreateDataAlert:b.func,onManagementDeleteDataAlert:b.func,onSuccessAlert:b.func,enableQueryValidation:b.bool,onClosed:b.func,onOpened:b.func,editView:b.bool}),mn(Ql,"defaultProps",{authentication:Mo,onSave:function(){},onErrorCallback:function(){},currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},onSuccessAlert:function(){},onClosed:function(){},onOpened:function(){},enableQueryValidation:!0,editView:!1});var Ul=Ga(Ql),Yl=["type","hasError","style","onChange","checked","offText","onText"],Kl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"toggleChecked",(function(){e.props.onChange(!e.props.checked)})),mn(Cn(e),"render",(function(){var t=e.props;t.type,t.hasError,t.style,t.onChange,t.checked,t.offText,t.onText;var n=yn(t,Yl),o=e.props.checked?e.props.onText:e.props.offText;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-switch-container ".concat(e.props.checked?"react-autoql-switch-container-checked":"react-autoql-switch-container-unchecked"," ").concat(e.props.className),"data-test":"react-autoql-switch-container",style:e.props.style},f.createElement("span",{className:"toggle-switch-text-ruler"},o),f.createElement("div",{className:"react-autoql-toggle-switch"},f.createElement("input",fn({},n,{type:"checkbox","data-test":"react-autoql-switch",ref:function(t){return e.selector=t},checked:e.props.checked,disabled:e.props.disabled,onClick:function(e){return e.stopPropagation()},onChange:e.toggleChecked})),f.createElement("span",{className:"toggle-switch-slider",onClick:e.toggleChecked},f.createElement("span",{className:"toggle-switch-text"},o)))))})),e}return pn(n)}();mn(Kl,"propTypes",{hasError:b.bool,checked:b.bool,onChange:b.func,onText:b.string,offText:b.string}),mn(Kl,"defaultProps",{hasError:!1,checked:!1,onChange:function(){},onText:"",offText:""});var jl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r,i;return un(this,n),mn(Cn(i=t.call(this,e)),"componentDidUpdate",(function(e){var t,n;null!==(t=i.props.dataAlert)&&void 0!==t&&t.status&&i.props.dataAlert.status!==(null===(n=e.dataAlert)||void 0===n?void 0:n.status)&&i.setState({status:i.props.dataAlert.status})})),mn(Cn(i),"getDataAlertObj",(function(){return an(an({},i.props.dataAlert),{},{status:i.state.status,title:i.state.title,message:i.state.message})})),mn(Cn(i),"hasError",(function(){return"GENERAL_ERROR"===i.state.status||"EVALUATION_ERROR"===i.state.status||"DATA_RETURN_ERROR"===i.state.status})),mn(Cn(i),"isEnabled",(function(){return qr.includes(i.state.status)})),mn(Cn(i),"onInitializeClick",(function(e){var t;e.stopPropagation(),i.setState({isInitializing:!0}),gr(an({id:null===(t=i.props.dataAlert)||void 0===t?void 0:t.id},_o(i.props.authentication))).finally((function(){i.setState({isInitializing:!1}),i.props.onInitialize(i.props.dataAlert)}))})),mn(Cn(i),"onDeleteClick",(function(e){e.stopPropagation(),i.props.onDeleteClick()})),mn(Cn(i),"onEditClick",(function(e,t){e.stopPropagation(),"CUSTOM"===i.props.dataAlert.type&&i.openEditModal(t)})),mn(Cn(i),"openEditModal",(function(e){var t=i.getDataAlertObj();i.props.openEditModal(t,e)})),mn(Cn(i),"onEnableSwitchChange",(function(e){Eo();var t=i.state.status,n=e?"ACTIVE":"INACTIVE";i.setState({status:n}),hr(an(an({},_o(i.props.authentication)),{},{dataAlertId:i.props.dataAlert.id,type:i.props.dataAlert.type,status:n})).then((function(){i.props.onDataAlertStatusChange()})).catch((function(e){console.error(e),i.props.onErrorCallback(new Error("Something went wrong. Please try again.")),i.setState({status:t})}))})),mn(Cn(i),"getCycleFromResetPeriod",(function(e){var t,n;return e?null!==(t=null===(n=Hr[e])||void 0===n?void 0:n.displayText)&&void 0!==t?t:"-":"Continuous"})),mn(Cn(i),"getFrequencyTooltip",(function(){return null})),mn(Cn(i),"renderDataAlertCycle",(function(){var e,t=null===(e=i.props.dataAlert)||void 0===e?void 0:e.notification_type,n="-";if("SCHEDULED"===t){var o,a,r,l,s,c=null===(o=i.props.dataAlert)||void 0===o?void 0:o.schedules;if(7===(null==c?void 0:c.length))n=null===(a=Br.DAY)||void 0===a?void 0:a.displayText;else n=null!==(r=null===(l=Br[null==c||null===(s=c[0])||void 0===s?void 0:s.notification_period])||void 0===l?void 0:l.displayText)&&void 0!==r?r:"-"}else t!==Or&&t!==Pr||(n=i.getCycleFromResetPeriod(i.props.dataAlert.reset_period));return n})),mn(Cn(i),"renderDataAlertState",(function(){var e=i.props.dataAlert,t=i.hasError(),n=i.isEnabled(),o="CUSTOM"===e.type,a=n?"data-alert-on":"data-alert-off",r=!!e.reset_date,l=wr(e),s=kr(e.schedules);if(t)return f.createElement("div",{className:"data-alert-state data-alert-error ".concat(a),"data-for":i.props.tooltipID,"data-tip":o?"There was a problem with this Data Alert. Try restarting the Alert by clicking the <em>refresh</em> button. If the problem persists, please contact your system administrator.":"There was a problem with this Data Alert. For more information, please contact your system administrator."},f.createElement(Wn,{type:"warning-triangle"}),f.createElement("span",null,"Error"),o&&f.createElement(Wn,{type:"refresh",className:"react-autoql-notification-state-action-btn","data-for":i.props.tooltipID,onClick:i.onInitializeClick,spinning:i.state.isInitializing,disabled:i.state.isInitializing}));if(e.reset_date&&Nr(e))return f.createElement("div",{className:"data-alert-state data-alert-triggered ".concat(a)},f.createElement("span",{"data-tip":"This Alert has been triggered for this cycle. You will not receive notifications until the start of the next cycle, ".concat(l,".<br/>You can edit this in the <em>Data Alert Settings</em>"),"data-for":i.props.tooltipID},f.createElement(Wn,{type:"lightning"}),f.createElement("span",null,"Triggered")),o&&f.createElement(Wn,{type:"refresh",className:"react-autoql-notification-state-action-btn","data-for":i.props.tooltipID,"data-tip":r?"Restart Alert cycle (This will allow your Alert to be triggered again in the current frequency cycle)":"",onClick:i.onInitializeClick,spinning:i.state.isInitializing,disabled:i.state.isInitializing}));if("ACTIVE"===i.state.status&&"SCHEDULED"===e.notification_type){var c="This Alert runs on a schedule";return s&&(c="".concat(c," - a notification is scheduled for ").concat(s,". If your data hasn't changed by then, you will not receive a notification.")),f.createElement("div",{className:"data-alert-state data-alert-scheduled ".concat(a),"data-tip":c,"data-for":i.props.tooltipID},f.createElement(Wn,{type:"calendar"}),f.createElement("span",null,"Scheduled"))}return n?f.createElement("div",{className:"data-alert-state data-alert-active ".concat(a),"data-tip":"This Alert is live - Whenever the conditions are met, you will be notified.","data-for":i.props.tooltipID},f.createElement(Wn,{className:"react-autoql-icon-filled",type:"live"}),f.createElement("span",null,"Live")):f.createElement("div",{className:"data-alert-state data-alert-ready ".concat(a),"data-tip":"This Alert is ready to go live - you will start receiving notifications once you set the Alert Status to <em>Active</em>.","data-for":i.props.tooltipID},f.createElement(Wn,{type:"check"}),f.createElement("span",null,"Ready"))})),mn(Cn(i),"renderDataAlertCycleStart",(function(){var e=i.props.dataAlert;if(!e||i.hasError())return"-";if("SCHEDULED"===e.notification_type){var t=kr(e.schedules,!0);return t?f.createElement("span",null,t):"-"}if(!e.reset_date||!Nr(e)){var n,o=null!==(n=e.evaluation_frequency)&&void 0!==n?n:5;return"< ".concat(o,"m")}return f.createElement("span",null,wr(e,!0))})),mn(Cn(i),"render",(function(){var e=i.props.dataAlert,t=i.isEnabled(),n="CUSTOM"===e.type;return f.createElement("div",{className:"react-autoql-notification-setting-item\n ".concat(i.props.showHeader?"react-autoql-dataalert-show-header":"","\n ").concat(t?"data-alert-enabled":"data-alert-disabled","\n ").concat(e.type)},f.createElement("div",{className:"react-autoql-notification-setting-item-header"},f.createElement("div",{className:"react-autoql-notification-setting-display-name react-autoql-data-alert-list-item-section"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Data Alert Name")),f.createElement("div",{className:"data-alert-section-content"},f.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},f.createElement("span",null,i.state.title)))),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-frequency"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Notification Frequency")),f.createElement("div",{className:"data-alert-section-content data-alert-section-cycle","data-for":i.props.tooltipID,"data-tip":i.getFrequencyTooltip()},i.renderDataAlertCycle())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-state"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"State")),f.createElement("div",{className:"data-alert-section-content"},i.renderDataAlertState())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-next-check"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Next Check")),f.createElement("div",{className:"data-alert-section-content data-alert-section-cycle-start"},i.renderDataAlertCycleStart())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-status"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Status")),f.createElement("div",{className:"data-alert-section-content notification-status"},f.createElement(Kl,{checked:t,className:"react-autoql-notification-enable-checkbox",onClick:function(e){return e.stopPropagation()},"data-tip":t?"Active":"Inactive","data-for":i.props.tooltipID,onChange:i.onEnableSwitchChange,onText:"Active",offText:"Inactive"}))),n&&f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-actions"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Actions")),f.createElement("div",{className:"data-alert-section-content"},f.createElement("div",{className:"react-autoql-notification-action-btn"},f.createElement(Wn,{type:"settings","data-for":i.props.tooltipID,"data-tip":"Open Data Alert settings",onClick:i.onEditClick})),f.createElement("div",{className:"react-autoql-notification-action-btn react-autoql-notification-action-btn-delete"},f.createElement(Wn,{type:"trash","data-for":i.props.tooltipID,"data-tip":"Delete Data Alert",onClick:i.onDeleteClick}))))))})),i.ACTION_HIDDEN_CLASS="react-autoql-notification-action-hidden",i.state={status:null===(o=e.dataAlert)||void 0===o?void 0:o.status,title:null===(a=e.dataAlert)||void 0===a?void 0:a.title,message:null===(r=e.dataAlert)||void 0===r?void 0:r.message,isInitializing:!1},i}return pn(n)}();mn(jl,"propTypes",{authentication:nr,onErrorCallback:b.func,onSuccessAlert:b.func,onDeleteClick:b.func,onDataAlertStatusChange:b.func}),mn(jl,"defaultProps",{authentication:Mo,onErrorCallback:function(){},onSuccessAlert:function(){},onDeleteClick:function(){},onDataAlertStatusChange:function(){}});var Wl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAPoCAMAAAB6fSTWAAABd1BMVEUAAADQ090zqN9ptN8sqN+6zN2ts8HK0d6+zt7O093Q1N3P09290dUop9/J0OApp9/D0N3M1N3F0tomp98rqN8uqN/Q1N3M0t0op99ktd6rx969ztsxqN9Mrt6jxt6nx97K0dwsqN44q9+cxN3O093O1Nw2qd85qt+aw97K0tzM0t7M3+Q6q99Drd89rN94ut7B0N3O1dzR1d8qqOAtqd9Jrd9Rsd9Xst8tqd9Brd7Q1dzO1NvL0dzH0dwwqOA2qt8+qt9Pr95qtd6Au95CrN9Rr99Lr99ltt5tt95xuN6Hvt6NwN6syN2yy93K0dwzqd8/rN+Avd6Lv9+Wwd7C0N3F094yqt8yqd9Frt9Ir99VsN5cs99ds954ud6Swd7L0t2/0dzA0N1ptN+0yt0vqd8yqd8/rN9jst5Wsd5ut99xuN2Gvt5bsd9jtN9ott5Prd1Mrt9ErN5Erd9Zs951t95puN6Txd5Eq99ctd5mttslp98npt4mpt6ODqAkAAAAenRSTlMAUud38VwCVVlLUEUF+wf3V0AM/fbvTkj5l2QY6rxnYyDzz2hTPOHbbDgjA9fHx4UzFQnz7cKppujDMy0oE+zc07CUgL22tZOQjHpxYV4b5dB8dnA8D+fiwLivoJqAbjEsKJxf5d7LoqGHhHSpmo8WiWuWekwuXE9FI0oh4zsAACZUSURBVHja7MGBAAAAAICg/akXqQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYPbgQAAAAAAAyP+1EVRVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVhZ272WUoDAIwPLNpUkeasGBrY4ENlsUtWLHvfbh5QSJ+qq1W6/t5nnt4M5PzTQ4AAAAAAAAAAAAAAAAAAAAAAAAAAAAU5Wo2jHM144NZAJUYneQfeNgPoDznuRXTwwD+3WTIHRjb62E1lczwhWz0sDP3+a+mAWzVWRZiHMCLBlb1ZUYB/JXHLNhtAJuaZQWGANZ1mTWxx0Ntn9bXcxzAyrJiBwEstZf1c1gDC0yyGTcBVPJQvpGjAD45zjZdBPBmyJZpHdqd5R8FdK2Hyl84p6FfN9mXgO4cZofcxNOX7NZ1QB+m2beA9iXu4Wlc8spYp2HJO7+moU29PaYtZ6zTnGSu/di5py0Jupf8aBpLCJ0qnCSLxUJCpwL9XLPXkvrTG6FjZ9+9SfxE6BQu+YW7mE/oFC35pduYR+gULFnDWXwndIqVrGmIr4ROmUbJJuIzoVOkZEOn8ZHQeWbvblqbCsIojp8HQqD2RSoSF3GhCxelIM1OqNl17a5rEcRtrK2onXx4iyJByMTEO/dm5nn+v+9wOOfOfauQoYBTrRB0VMdQyEx/EHRUxlDQtX4j6KjKxFCWfiHoqAjPtD9oJOpdLAl6ZO5+kFgN1eV7yvksuGfozYFqwnIPzNCrqapxT87DMvSsnv3+I+V8FFybGtZwGnWGe1SGgZxp/xjuQRkGU0Opp5yl4NfcsJG3qHMLPSTD4C61R09Tzlzw6pFhH7QrTuJAnTdool1wEgdi3qgj7cOblHMjuDQz7Je2w3AHdd60J/oXco5O3hpqoGHdppyR4JChEu+0EYUO/ovqgzbjxB3UuQsnGsjXlHMseMMTr/VRFsMd1LkfyhhouC8EX/jLUq3Uu/OUcy/4wpPt9dI6DHcw2525UK+OU86t4Ak31WqnHo0p9CAM1RvrL3xtAuTcpWfqySjlfBL8eGVog1Y4iQN17pZWePYV5NytAxV3xS30AC4NbdEDhjuoc++kgYb7teCEoUEXKuiG4e7euaFNDHds79DQqgGG+53ggqFhKmNOoXtnaNoHhju4PI+g1+H+WnDgzNA+dXVEoftmcIHhDnIegTp5nHJeCu0zuPGeQgdfgIyAl9awztTgi/7T85SzFFp3avCG4Q4uzyMoPNy/CY0zuKTdfaHQ/TI4dcJwBzkP4EWx4X4ltM3g2KF2cUehu2VwbcJwB2+rRVBiuI+Els0M/mlLCwrdKf6gGEPn4T4WGsbH4aLQNhKF7hM5j4OTuLgmhji65Hwh/GTvXnqiCKIwDNenjuiCSxAQ5GIQDBBATATxsgEVDAoh0RijMRiJbHSDJro4xY9XE2Nk6JnpbrqnTp36nj/A6p1zpqjpjhc7T4vrQPjCBpNAieHiniJQclw7J76VY0fRAiXItbbMgW4RKElc3NMCShRP4lICSpbLdMyBbtBVULoKLu59jiLF/5+nzZ0lfO6rPZznqXPNfnBxt+c2KHWuyQnvvppzF0Q8cbduEESnSx/k4m5OH4j+yLW4f3cUJxA1lS4c6OaA6K8R3n01C0T/LHQa6EeOogSi/wy63z5zoFsDolMWubgbBKImvPtqD4jOuMWBbgwiNTCzsyWnbT2fGQBVwrc07ihC44jKwLbk8+wGqDzPu6/GIBZrUsYRqIQVLu7GIAJ7Q3JO86CKBvpPRxGCdvelKnOgvPimNWOg2qRUbRqUwzw7twV63ZS6bII68Lz7aoraJ8qsS81AXNzTAZWWJAtb7x52bgsUGpMu6kGMfCVK/YFRR/GBOj3SbZcQn7pD7+dANwXaTEsQXxGZukPnCxtMUfaqhitSRNJf130leBKXhjfQZFuKSTr1ekNfZeemQJEhUWALsag3dN/SN0fRgR6iRSy35nwluLinAGqIKohBnaFvsnNLPkIJ0aYX+tUZum9pzlFsLkMHKa1/roE2JqctT/UaQ/etwVFsoMKwlLB0gPwaD6WMC9AtSOjAY0dxgQYfpKgDlLNr7QQ+SOiHh4cXy3OUj7WfrPUUnOM4rxdSTAOGvC0Senk8sFdlEeFJAe9QlVe2vqrn5zOAoRuH4CYltwFUbENyuwcjPENPEIKTnB6gHvOS1x4seOIzgKHbtoDAViWXfdTpIKX93WeYYujGITA1fa1ILl8QO58FDN02hDUkObxGlwxr+dCp04HPAIZuG8JS11VDcniKmPkMWwzdtkGEtC4drSEP2x8+1RKfAQzdNoQkHU0hiA3LpfsMYOi2ISTpZBbB7Jh8hmSrcCcYum2fEM575TNz1+ZQ7/UZwNBtQzgRVNQwePt91mcAQ7cN4Uh7L6HCjrS3j9h4hp6e6whG3Ul7K5P6F48iJnwGMHTbEMqYtHMNqoxaKt1nmEElRhzphFCGIivHTuk+C6rB50op9QiBSDtjUGhP2rmDWCzX2TlLVwqBRDkeR6UNj0j4DGOoCkv/xd59rUoRRFEY7iUmjBjAHDGBoKBiuDCLilcqggnxQlAR9AGqfHgvzM6emR6c2nvtmvU9wamm/1mNntNDCUHKDGfAK+Xn099q20FX6IxOIkbeXNbk/dG/+9K6c5VOCDHKdE/ALnnp1bAGS7VnEC6IkbsUrM3889f2g65JZ3MBIdL/hciJxKVXwwksl0ongwgb8kbyU+JnkmrYiqU7OggPhMiayN9e5zzG12rA0mnSqcBfL50nPciGatiI5VPpRBChTPMB2SQsvVrQxPpBOJxEgHxtzHAp22ku+nWuSacBd511DhxJdp5q+IxGNg/CAKOo845OVD0HXZNOAt6SVdHfmW76dq7SKcBbqia6PFU1nEZDZweJtgPubhTbJeSWpfTqPeiadAJw96jYXiC7rylKv+zfOZ4NspAOOkexPUR+pzL85n41bEdTmvRwcJfplVELO1RsD0CjWtCYSl+MOme3j/3h/Wk1bERjCj3WNngrto/oxRPy0oMGXaUvJvugn6f/gob/dpe69LDOsWWQKM/grZieoyfMT+8bq+ENHGjSF5F90JO/HXmke8X0GPGqBT7eDjJKr51TTN1SXWU9597AzjXpY6UP/RHr/b9kvJ9o1XAOTlT6OOk7B+ndv3yspVcLvCj0cdKHTnnvt1JMtxDpRnDnKn2M9J2fKpaN6BThx1o1HIMfhT5G+tCL5RC6RVd6DR90lT5fn533+uDOeOJrBJ0rdHdb4Os5113v4SPXkRkGXaXP1+Ogo29Uk87RuUKfI/ugM93yXqhK/1ANd+FNpc+Te9Cv8NzxroplHdzRDLpC93UAnlZ10IENLAen6Vylz5Z70Flud3+XimEXvO2vhuMIoG9omifxt6Gbu3YZK4HjM45o0DXps2jQ02I4fGHqXKFPlXzQXxHc6nH2x78rcmM17EYQlT5df4P+CSsjftKpHtyh0L3shKut4Td6qPjS2TpX6dP0N+hYKYShF8RR6D7Ww1Ux3MZKiXymYRx0lW7ToGcX+ftxB6vhDCIpdEvy0NU5gA1hV4Fz0FX6pOSdK/SpV+Eu2mPtXKFPSB66Oo+9Di+qgeCfSDYN8pfknaPzr18a7VqZdB+t0Q66Jv1fyUPXoEdeCeLOcXKQljbBVZl0GKsp4s2Yd+Pf+zqFJv1fGvRO+F8L5kEHdg7yl8wvnFDnsy/GSzRVLRtAYpA/pB70XQr9l4BJf8c86Ar9T8lDV+fzLscdNMP94A6o9N+Sd/5eof9lre/1KNXwDjwG+SF56Or8H56/8c4/6Cr9p+SdK/R/HfK7Ihk6V+g/JA9dnUdekmPVcAVU9D9sbVzHbHnv6iyOe12TFIOuSf8p9aDvJvmKEiqxoS8OLSn075KHrkE3rC0TzqGBJKGr9G/s3dtOE1EUxvH1JSIaLa2CBhAhEhUTiUgiCF4oRImAIioqEeONBzwQfIAVHl68ajtt5+TMnll7f78H6DQ785+1mZbpKeOdvwz2JxtiOLv8MfSAwSEO9PTL0kLxrIS+KFS0RTilPcZBcRfAEEPnSD9leqBvcKD3w9C7MHQR46Fz555+ZQ5RODOhs3QRz544MQMCHF0CGXqw4NQ9DvRBDhh6p2tCRRqBQ9y5Z1ubJv4JM3SOdMsDHex8EDcXQYYeKji1xtBjMPQ2PuG9WJfglPZYAQ1enRMETMjqQOfOPdYsl6eNoRsO/TPP5Bi8DnZh6QW6Cqe0xxwobn0aCJiQzYHOiZXgBReo04gQQ/cSF6gDR7rVzh9oVBPUSXusImBCJkPnvEryi0vUxr17Uc4iAUMvw48z4xrRaC7tcYmiONJtDvShkM/i6SXNp4WACRkMXXu8RQDW9b/U7lHMLr0S8iF0eG5MM+LvxnfhSLfYeVihL2hhDhAuIYZeW8dauHWEiXt3e6GvaNQOPDSqJRlFiISMdR7CQH+jJdtGaIQYer0sqxMLCMpFIYZeH0eaEu/DZ8KRbq7zlkY9hyda6lZQT54RshX6be3mzWCa0ko8RBiEbIWufoauVQnmNryQoadC+hn6M63YJPwnZGmgexh6Q2vA/x28kO3Qv8A0rYsx+O2RUH534dgdvwa61skVeE3I8kC3HLrWzRQ8JsTQq6D5bbUQY3hHc/L66Xv8chxDT6MOme87uJBMwFdCZj5c8yX0hmb1B1md01Q8WdFEDN3SQIdGfYI9c25ukqky9TaGbjv0YViTadJ+R378tly3+0J2Q4c1mt50wUcaHdLUZuAfoXzOw7Xr1kPfdbh97vuaNwPevwtZGehN46ej0w+5BraraXj4NEkhK6HbnjuOR+njwa88HeRQvyXE0MunaeyhMFuxi7WvKWzAK0I2OrccegU3u5MWK7ihLmQ19DUYocl+omDJ1QZ2+13IauibMGFNE7VQuDTjeT6kz9TfCRn4F9VTGvUVFlS0Q9aoY/QxEdD2XcjEQLf5fZlWVSVp1Cz6WtAER/CEEEMvy1hlAzP9oX5rvAb8IMTQS1LhvjjLwQ6D2L7z6+4MvST5bsG5Dx04CaF0oawuwL2n1k6/SY21jVJlrVVjePKjtUIWBvqmsdB3q31sU+axPKxxXsM+IQuhL9sKveq9cDP7MW94fkvuspCB0D+aCl3j7KF8H/Isl+d/qAtl8x4VmLd05lVfzJNch12t/H2Xh6GbGOimfkpVYwzBgbyhAz6XLmQg9DN2zrs6xDKb98jfavDmS8HQ/7J3L6tRBFEYx88J0QQSDAkGvOQmiqKYxLiIxkUCoot4AQUhgYCICurCFziZh1dwI93V0zV9q+9Uf78XSFVT/6memcq0j9DXvSy7uxCPLg2EHivb0h8J4Yc+52TV/cboJBA6SxeaxVMdnpvQD63SYx1Mu9B1O9PSheA3dN1wseY2URIJhh4PZRpdYuguQnexo+/CBHLScgATlIl0h6Ez9E4A7eeVB2bi3YeZSncOhBh6e4dW5Z0Oq5NvIzMsXSjemibgIfRTpDLaDyLH0oWQH8b0l4PQt6G66GAUGZYuhH7njh86VhVW4n9ObTF0ht6eVVjXJDpqM7P/Wr0mhB46+Fl3q3Ch0RBD1xsWNqceLQmhh4591j394fa6AR1rM2cW9lY9Eoq1oymA37pbhXuaihXtaUO7Ob1NFwLf0KFDn+C1YEX72tQR3uwaYugOQgc+645YQpeDOQecXyMM3UHowDs6YgedjmY3m4/erwox9Iw6/9btcL5b0Ev1hs9UZeg5dd75j2OvIE5ydrx3j7asSeCGDtm5WkmW05wVQ4ff0FFDf4D2vdo/3SdpQZfqjBBDb8KCPmtiPey9ebxNF2LoDVjQoabWxyfkWdy8C4GHDnnWfWIhE03Oin5oW3mULgQeOuJZ95+wS7+fMVnIHfWE/9aCHjrirTts51/7GdQr1PlG45bO0GcF3LleWlHuM47E0COtahqIZ93ncVd9b8Py/x2bEPSGDrijW8iWIugtdMV9cYvC0Bn6bLBvY63oWDtyBXjWERg6Q5/RBvCKX+zxh+WvW8CRuiHE0ONh38POW9FIJh5hTYihZ7LcrWQ0U6/1QoihR9sE+mXnoUP/5Tp03rsz9Gjou5oVrYxo8tMx9Ci3NRGws+7YS/1Z31/6WcC5OiFU76EmgnXWfcEC3iiK3l+DbkG/zk3F0MHv3KFu3bE3dLWSkV2AKRg6Q4+E/2nUAIMDvwLVGDp66EBn3cGfUHRiRZvatQu/pQtBh46zoz8HX+QDDM7zli7E0CPgr/Hw6MZ2FSotCzH0CBbwWnEspgt9QR14IsTQM9jKqp7RPrbrUIH37gw9goP1PdTwbqJfiDCGztAjMHRHVyKIoSM/j0lhQodf3ZPhxod+KYIYeoQdTQXmrLuVfVAkg8Xn4EUvhKFH+KSpoJx1x1/bw43P65YuBPwWHeTWHfE5a/8ZtD0PL3tlDJ2h1/Gwsod8sKvTLV0IOXSIs+7wC3tx2AG6fEKTEHLoCDv6GXzoNQN0//faY+gMvYaHZW0lH7VPHp+YLsTQp9qHD31v4AF6eO0rYOgMfToPi9oYeh2GztCnc7CoFyIGOLqLUsDQGfpUHpa0MfQIB0IM3fWSTjHCLSs5VWhfhIBDT37Wfc9K3iuUqM4z+astrAoBh578rDv+gk4zwnn461KwJPSHvTtrjSIIozBcRxQX3BdQGRdU1Auj4q43AcENBfFScQMRweUPnOTHC0Glp6t6pmdGus7XOc996KL4XqqSMNPCoVe/ujNzBVLWmXmGATAzgbK9yRy62HEZYYX6O+PQA4U+ceizrVVbofrOTPP/17RD1zvRoaV35yN68jIcukPvFGCY39Zb4R31vZni0B36DMycgZR6nQe47TQ5dIfe7aP6LK9phX4cwpI59KIAN3fmvmMo79V3p8mhO/RuzLyCErJia9Hu7skcetk59Ulm7iGGw8x16EomHPpOrRNLK3RWXuAp8f1pcujaoZ/QCh1SmFvHTNtsgxocunboOxx6h/oHOsDMWchK5tCLDrFtA0J+MncXg1rX3qEmh64d+qRi6OKv/K9/oMvfeRocunboO6RChxAW3MM822qLmhy6Q+9wWnuKFQ50MPMdqpI59BJmbkCHROfYrbCIXhy6Qy8Sv5ZSI3TtTWpy6A69SHyGRTrX3qQmh+7Qy64qvzFU5UDHOtuuQtO+ZMKh1xvnTYmQxDsPdKQ7dIcu9uS59rBgDb1so21q8tc9O3S5J0c60JW3yaE7dOknR+och2RWMsenZA49d5dth6GBUqGDbT8gye9ec+hSD57nolbnYNsmJB1M5tCFHhzq4q68UVP8b3SHLvbgmeQu7robNc2hRwv9OIbBtvtQINc5NqRW08WhRwv9BAbxWHN8D8l1jl1ay+ng0KOF/hUDUL2Q/mTJAVSl/jKbLQ49WuiPMQDR0HfpXdxVt6rNoUcLHUMQnV7JzjW3qs2hO/Qitk1QHYu+oSrtT//849B7uIlahEKv/+lLah7ouKK3pJxD7+EWqvlSaYjO6Q2vauc4K7imjEPvYT+qeVFpiM7IDa9s54DkolocuvYv6T0nezTP7cSyixDAtlMQlEw49E2HvoVlx6CAbTsgKJlw6D7Rt1D44i63WUUO3aErPbdEvXOxzepwPlmk0E9gEGx7j4Vsp85jhL4/WaTQr2IQSl8vo945Hugu7S/f3KOFjqLRPLeAHU5DxU+h3erg0LVDf+fQ2eEJdOjsVheHrh06M1gY92Bhl1RG9w1JxY+mNjn00XiEKv5L6DvJc1jUXZHRnbDDSSgR2a0ZHHovR1HJ6qGfIJco/bbG6JLyf4gD4NDHA5Ww7TUWM+GWPVjMAYnRjdI5hP9Q+IdDDxb6RSzkOv/YhQWI/Gc4TOch3uGQTDf0yyuO+FNymdIlQn8dp3Ow7RnUPEqmG/qKM36KDYdjhc5AnYNt16DmaLKxhv6cU84FCn1PqM6rb9dcvrmPOPR7bPmFnqpP7vFYnUd4/VqyPvaihpds+4DeLjCzgX5qTy6DdY4Ay0zWx2dUsNL8bKyQSd3JvcBuOyHJoY8GKlhlfthh2R+/jaFwhjVocuijgRpWP5Fzu5f7+csYxma4azvg0EcEFVxb+lsnOMNxzFUvdIbsPEDoR5LJhr7s+DzlbLKhM2jnAUJP9pu9O11xIoiiOF5H1LjgLrhB3IKKiAoifpGICyoqigrRcfkkbvgGRx9eVHDrzFT1Vrl16/xeINPN/XNrZjqJu9AZ9aTLS4/uRrGdK3Q/kN/9buPDFIjIP7mn+VMZb0v9TwH/Rw+SZh+yY8NNRF1hms3YSP7QubFnME0b3Y2tyKzT9MyYbm/L1x4TWe6xHVDoniC3u70P3J3zyTy5LL1zhe4IcmPbh1busTUsl3VyGXMR5pkP/XqQckLHRmbs4uuqJ5c/lL3OSwg9iNXQW448O8Myh7NM7mn66FyhO4KsWobOXtCQ5cMhTzHuIYqg0P04hqxOtpgd9jbBfz6OPrmkl3UOhe4Kskqe+r2MOAB8ZtSH2OtjSHeZ4jVKodAdQU5seoklbjJmDT+0XOujhv6IdLXOYT90fTJkQaGj6Wt6LUzxbfzQJ0w0RUGshx7EZugpC27Rbis+ZZrZOj/BFvR3jqS/dQ77z7oHSbcT+UQn/wVTHMTfmOotxnif6kt6zVwb3RdkElvok6653GIf6GEb23iA0ih0T5ALlziOn472K3MVod/+xlYOojzGQ98epJTQATxhG1MsM80a+rY5f3F8ai8h9N1BDIbOIWA9h7OEPrn6lWQlmZsPPYjB0DmAkV7g25t3iHh7hjHuMlfovuxGDuzvJSI4iM2LxfsLFxaLzRzGBMVS6K5gfJvYHxLQHJTM+OUEMRZ6vmCe0xSUzfYF6W9xxkK/xd5mSHaaZqB0ti8pSDs7MKrcwRg5wF9D+RS6K7sxor0r2IsGUocLtq8riJ2z+8lVFfOGq3MVTpgO/VAQM6GznzPogytxAH6YDj2IldDvrvr4u4VxOrKvR6F7cxmjYB+fMIwHzOcRnFHozmBw/bbpHIPiUjqxRyh0dzC8XezqLkYw55juwCfLoZ8PYiB0drQNo5nyN/1aXn7oQVb/yMxms4ffwxzSHvim0L3B4C5dnDPdEeTDYXyBfwrdG4xq+vks13H2GXJbY09nt6EShkPX96gaDN0YdrVnhroYDj1IF9tRkeXjO71zg8vML15CrRS6O6gIG7ZAmhS6Q6jImuH5tcXujdJ/0RV6yfNrjN0bFaSbfaiI3fk1xu6NCqKVHlXX422dKXSPUBO7A2yL2fu0P4hCL3iAjTF7n4J0dQIV0dk9hUJ3CRV5anaCbTF7m4Io9Dg9M5PEbuhbgyj0OJ3dCw89iEpPcs/qCNti9S4FUehp2HAB8i+zoT8OotBT6OxedOhB+niMmhidYVuM3qQgWulptNITWA1d38Wk0BV6BaEH0TvY0rHhIORvCt0r1EQrPUahe4WarLHhFeQvRkMPoo+ITKeVHqXQ3UJN2HQb8odCdwtV0UrfmM3Qg3xn795Wm4iiOIzvdVGtxxZEewBRKWgFq6AXVfSiSi9EEUqLIKj4AsUH+NuHlx6iNLNnkszsZPbs9f0eICQD3147yRzyewZb3lS1bfiH0Mtlnmwz0hsRernMFVV9MYxkGXoAoc/qDSO9CaEXzFxR1a7hAqEXzFxZZ6Q3yDF0biLFOTNtqOqxId/QAxjpLZww0usResnMF1F6rQxDD+Ba1VZWCL0WoRfNfGGk18ovdO4tQ+htratq35Bl6AHp3DZfGOl1CL1s5ss+pdfILvR3AYTemiKODPmFHkDp7R0x0uMIvXDmjCg9KrfQA/grvRNFPDAQeuHMGUZ6VGahXwsgdEo/V3DoAaldMWc2FHHX3CP0wpk3irlq3uUU+s2A5NbMGzbvuYcecIqR3s0KpVdkFfr1gBAIvTNJPF8149ADTlF6Z+JU2DGE7oC584rNe8VeNscjYD5+mTui9HHH2RyOgBFGejeUXrWVy9HgAtURQu9uVzF/zK+lXEIPGKH07hR1y/wi9PKZQ4p6Ym5lEnrAf5SegKJemFeE7oA59E1Rh+aUxh3bwtH5nH01hyRxG4qGw/HIFo7QKxjp3Slu1VzK4t/GlwFzdcM8UtySeZRF6AHjGOndLVP6SB6hPw24jNCTOFDcsvlzkEHoAeMoPQnV+GnufOo/9HsB4wh9vqW/N3f6Dz2gitLTkMQVLmf6X+wCqgg9CUq/kMGvcQExlJ4EpZ8jdDfMq/JKl82s/9AD4ig9Famsk+TaNfqa0J0wr5ZUZ8cGqO2V9X2eTkDnDSg9lU1JKuWmMzpzx2amcSe2MITegNCT+axivqi3X6J6/Ox03ojSk9lSrU0bktabEUJ3xPzaVBHb9/ad9hk6nU9A6QmpgO27Llm3mRxq3A9bDEKfgNATuqp6ezYInVao/kY6nU9E6Slp4EO929smdE/MNTW4b5lb7bhA9RY6nU+B0pPScIf6Tvd3/byfryyEPgVCT0tDTV21PnZ5EZs/Op8Kpae1oibblqkU61Nfoa8FTEboif0e4FA/ULP2oX+3eWOgT4nSU9PQUtdEGzaVD3182ocBvXhr3qnZgWXlmaZwYlNZfOgM9L/s3deq1FAYhuH1iWIvYFdU7IKK6B4boliwd0UPrFgQ9cAL+LcXr9jLTLLWmpXkz+R9zvcmOXjnG4aUBEx6YfNW7Yn8sEg38v7ZSA1bERCJ0ou7aTU+yAeLN696K9uedAY9AaE3wOq8V/cszS7VavllFnSehNIbENNNt05ZspyzVoMIPQmhN2GLfeX3F/g5y6Jq51o9RzpPROmNML+pWz5VaHvSlwd0aqMg6an95ukBkjaVeT+hB6Ri0hthURarRRes1nGr9lkTXWuvdDp3YJXwzQmLsk7tWGMRpCVWR5MQ+rAIP1iku2rcWouwNvKoE05XTaBzH4SfLJqas2feoizRd2ut1qbYs72vJiwLcGCD8NN6i/dCDbiU8VFzxCLsjgrdVB6D7oXwm6UYqajVFu1kxkFHnavKOxbgAr/H/cUS3VYBO+Ythf7x1uLs0J9auQqQQfdD+NMlS/X5nvJtWW+Jnut/FmtfzR8tUVF07onwl3eW5bDS7HlrOTTWKYu3UN/ZOCqJ50e5slz420KbwsVFqrJ49z7Lp4ks0fnbzZfOoPsi/OuxeaQqR6yMqyqFzr0R/rPAvLmkGlaICiF0b4QxLpsnzzSR29QDnBHG2WJeXFMkK2OzCjga4MwKYTzz4I3iLfIz6gHuCJPcs44plZPUAxwSfvE066eVYYkV8UnTeBXgEFfCVrpvUTof81+s81EPcEmott9adkBT2dRl6nTul1DntLXmmqa3ucPrZ84EOHVMqPfRWrBbpXQ06gy6Z0KcTdagnSqsg9Tp3Dch1gNrxHY14ZZNYb8y3AnwTEiwxYpapAYtthw7lIVB905Idd2mt/KB2vDc4q29qWx07p+QY815y3RF7boZe/tMPt6F3gdCvt2HLNq1JerMrYnHeVLTY9D7YK9QwsNtozn726bR4ety5vWp0dzc3OjUaxVD5/0ggM4HQEA2LonrDwG5GPT+4CVNoPMhEEDnAyAgy9KAHnkkIB2D3jcC6HwABND5AAhItDegd3jQO9Iw6P20VACdzz4BdD4AAqKdDegrAZGWBfTWVgEx+OLebwLofAAE0PkACKh1NKDvBFTilrWZcFBAFb64z4aXAuh89gmg8wEQQOcDIGCCYwGzQ8AY3IL+hb27x40qCKIweiuxBEZIQ2AHJE6xE0NqeQtEECP2vwkQcmCMkPhxMHPrnD18qtfqft1tBn7hhHud1wNPWaD3+Tqg834unEHnGwzofIGBR85Cp4EH5nmzgQdvQ6+BH+5Cs4HvDqHbwFyEcmcDod+wXVjgzbBbWOF+2Cws4QGXzcIa18NWYZG7YaewitJ3Csv4et8orPNx2CYsZKZvE1ayy7ZLWOrDsEdYy2nYPcJmww5hNX+t7hC2G+q9CAzlvgSU3u59QOntAkqvF1B6vcAj50OjwE+uhj6BJ26GNgEL9XbnAaW3s32O0vsFfuti6BBwk1y9gM/3dl5FRun9rgJKbxf4I4fhdAUM9XYvA0pvdx1QervAX3o3nJqAod7uMqD0dq8C/+ZyOBUBQ72dJxpQer+bwP/5NBy7gKHe7hBQervAM7kfjlXAUG/3OfCcbofjE4ihXu42fGPv7nHiCIIwgFYlSMsiBwQQbOKEYNeRCRHcwrnN/S9hCdmBrYXhZ4fpqXrvDp+qu6aniidGxBYW8IeiXpaPasxnk4wh4B+KekE3AfM6T5alnHOcol6KZjuf42eyFOWclyjqRdwGPE/USzC1nQmSXkDAJFFfObsTWcYu+SzKOW+hqK9UwBuI+irtApZ1kczsKmB51qnPyamdYSSzOQsYRjKLx4ChJCe3DRjNZXJKLucM6iYRcxoQdTGnhUTM6cCsKTGnhUTM6SARczowAV7MaUEHXsxp4T4Rcxp4SF7B1EdWL5m0D1i95EWXASVcJ8e5mlOKgbFHuJpTUPKf7wEF7ZO/nNmpLHlyH1CambGKOT1ka+Y90kbbJrw2O81cZT9mtNNRr1k0HsDRVzZhtznNnWV52m9Qva77Mw2qZ92JHar35i4COOYxi9gEUPsQvwtg2m2uVwCl/2n1vhXe4y7X40sApYfDe8MOtRt03sNA7dJ+HcAsDjmEc4d1mN02l/MrgAlr3ut2CGAhX3N2P7xah0HsN3lqWxsWYFQPdx+M9+FbwG927JgGABgEAFj27JoYMi3g3woSuElaGWWT+yPPJOpZdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABo9uBAAAAAAADI/7URVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWlPTgkAAAAABD0/7UvTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwC5RrJqYiSfS8QAAAABJRU5ErkJggg==",Gl=function(e){gn(o,f.Component);var t=Sn(o);function o(){var e;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY",C()),mn(Cn(e),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.getDataAlerts()})),mn(Cn(e),"componentDidUpdate",(function(t,o){n(_o(e.props.authentication),_o(t.authentication))||e.getDataAlerts()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1})),mn(Cn(e),"refresh",(function(){e.getDataAlerts()})),mn(Cn(e),"getDataAlerts",(function(t){fr(an(an({},_o(e.props.authentication)),{},{type:t})).then((function(t){var n,o;e._isMounted&&e.setState({customAlertsList:null==t||null===(n=t.data)||void 0===n?void 0:n.custom_alerts,projectAlertsList:null==t||null===(o=t.data)||void 0===o?void 0:o.project_alerts})})).catch((function(e){console.error(e)}))})),mn(Cn(e),"onDataAlertSave",(function(){e.getDataAlerts(),e.setState({isEditModalVisible:!1})})),mn(Cn(e),"onDataAlertDeleteClick",(function(t){e.setState({isDeleteDialogOpen:!0,dataAlertDeleteId:t})})),mn(Cn(e),"onDataAlertDelete",(function(t){var n=e.state.customAlertsList.filter((function(e){return e.id!==t}));e.setState({customAlertsList:n,isEditModalVisible:!1,isDeleteDialogOpen:!1,dataAlertDeleteId:void 0})})),mn(Cn(e),"renderDeleteDialog",(function(){return f.createElement(Ml,{authentication:e.props.authentication,dataAlertId:e.state.dataAlertDeleteId,isVisible:e.state.isDeleteDialogOpen,onDelete:e.onDataAlertDelete,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessAlert,onClose:function(){return e.setState({isDeleteDialogOpen:!1})}})})),mn(Cn(e),"renderNotificationEditModal",(function(){return f.createElement(Ul,{ref:function(t){return e.editModalRef=t},key:e.COMPONENT_KEY,authentication:e.props.authentication,isVisible:e.state.isEditModalVisible,onClose:function(){return e.setState({isEditModalVisible:!1})},currentDataAlert:e.state.activeDataAlert,onSave:e.onDataAlertSave,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessAlert,onDelete:e.onDataAlertDelete,selectedDemoProjectId:e.props.selectedDemoProjectId,tooltipID:e.props.tooltipID,editView:!0})})),mn(Cn(e),"renderDataAlertGroupTitle",(function(e,t){return f.createElement("div",{className:"react-autoql-data-alert-section-title-container"},f.createElement("div",{style:{paddingLeft:"10px"}},f.createElement("div",{className:"react-autoql-data-alert-section-title"},e),f.createElement("div",{className:"react-autoql-data-alert-section-subtitle"},t)))})),mn(Cn(e),"openEditModal",(function(t,n){e.setState({activeDataAlert:t,isEditModalVisible:!0}),"schedule"===n&&setTimeout((function(){var t,n;null===(t=e.editModalRef)||void 0===t||t.setStep(null===(n=e.editModalRef)||void 0===n?void 0:n.FREQUENCY_STEP)}),0)})),mn(Cn(e),"renderNotificationlist",(function(t,n){return"project"!==t||null!=n&&n.length?f.createElement("div",{className:"data-alerts-list-container"},"custom"===t&&n?e.renderDataAlertGroupTitle("Custom Data Alerts",f.createElement("span",null,'View and manage your Custom Alerts here. To create a new Custom Alert, simply click on the "Create Data Alert" option from a query result in ',f.createElement("a",{onClick:e.props.onDMLinkClick},"Data Messenger")," or a"," ",f.createElement("a",{onClick:e.props.onDashboardLinkClick},"Dashboard"),".")):null,"custom"===t&&!(null!=n&&n.length)&&e.renderEmptyListMessage(),"project"===t&&e.renderDataAlertGroupTitle("Project Data Alerts","Choose from a range of ready-to-use Alerts that have been set up for you."),f.createElement("div",{className:"react-autoql-notification-settings-container"},n&&n.map((function(t,n){return f.createElement(jl,{authentication:e.props.authentication,key:t.id,dataAlert:t,onSuccessCallback:e.props.onSuccessAlert,onErrorCallback:e.props.onErrorCallback,openEditModal:e.openEditModal,onDeleteClick:function(){return e.onDataAlertDeleteClick(null==t?void 0:t.id)},tooltipID:"react-autoql-notification-settings-tooltip",onInitialize:e.getDataAlerts,onDataAlertStatusChange:e.props.onDataAlertStatusChange,showHeader:0===n})})))):null})),mn(Cn(e),"renderEmptyListMessage",(function(){return f.createElement("div",{className:"empty-list-message"},f.createElement("img",{className:"empty-list-img",src:Wl}),f.createElement("span",null,"No Custom Alerts are set up yet."))})),mn(Cn(e),"render",(function(){var t,n,o,a;if(!e.state.customAlertsList)return f.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},f.createElement(Xa,null));var r=null!==(t=null===(n=e.state)||void 0===n?void 0:n.projectAlertsList)&&void 0!==t?t:[],i=null!==(o=null===(a=e.state)||void 0===a?void 0:a.customAlertsList)&&void 0!==o?o:[];return f.createElement(Rn,null,f.createElement(Po,null,f.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},e.renderNotificationlist("project",r),e.renderNotificationlist("custom",i),e.renderNotificationEditModal(),e.renderDeleteDialog(),f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0}))))})),e}return pn(o)}();mn(Gl,"propTypes",{authentication:nr,tooltipID:b.string,onErrorCallback:b.func,onSuccessAlert:b.func,onDMLinkClick:b.func,onDashboardLinkClick:b.func,onDataAlertStatusChange:b.func}),mn(Gl,"defaultProps",{authentication:Mo,tooltipID:"react-autoql-notification-settings-tooltip",onErrorCallback:function(){},onDataAlertStatusChange:function(){},onDMLinkClick:function(){},onDashboardLinkClick:function(){},onSuccessAlert:function(){}});var Xl=Ga(Gl),Jl=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0,problemType:void 0}),mn(Cn(t),"componentDidMount",(function(){t._isMounted=!0})),mn(Cn(t),"shouldComponentUpdate",(function(e,n){return!Ma(t.props,e)||!Ma(t.state,n)})),mn(Cn(t),"componentDidUpdate",(function(e){!t.props.isVisible&&e.isVisible&&t.setState({problemType:void 0,reportProblemMessage:void 0})})),mn(Cn(t),"componentWillUnmount",(function(){t._isMounted=!1})),mn(Cn(t),"reportQueryProblem",(function(){var n=t.state.problemType;"Other"===t.state.problemType?n=t.state.reportProblemMessage:t.state.reportProblemMessage&&(n="".concat(n," - ").concat(t.state.reportProblemMessage));var o=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),dt(an({message:n,queryId:o},_o(t.props.authentication))).then((function(){t.props.onReportProblem({successMessage:"Thank you for your feedback! To continue, try asking another query."}),t._isMounted&&t.setState({isReportingProblem:!1})})).catch((function(e){t.props.onReportProblem({error:e}),t._isMounted&&t.setState({isReportingProblem:!1})}))})),mn(Cn(t),"onConfirm",(function(){t.reportQueryProblem(),t.setState({reportProblemMessage:void 0})})),mn(Cn(t),"onClose",(function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})})),mn(Cn(t),"render",(function(){return f.createElement(Rn,null,f.createElement(Sl,{className:t.props.className,contentClassName:t.props.contentClassName,isVisible:t.props.isVisible,onClose:t.onClose,onConfirm:t.onConfirm,confirmLoading:t.state.isReportingProblem,title:"Report a Problem",enableBodyScroll:!0,width:"600px",confirmText:"Report",confirmDisabled:!t.state.problemType||"Other"===t.state.problemType&&!t.state.reportProblemMessage},f.createElement("div",{className:"report-problem-modal-body"},f.createElement("h3",null,"What's happening?"),f.createElement(Dl,{className:"report-problem-radio-group",options:["The data is incorrect","The data is incomplete","Other"],"data-test":"report-problem-radio-group",value:t.state.problemType,onChange:function(e){return t.setState({problemType:e})}}),"Please tell us more about the problem you are experiencing:",f.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}}))))})),t}return pn(o)}();mn(Jl,"propTypes",{authentication:nr,onReportProblem:b.func,isVisible:b.bool}),mn(Jl,"defaultProps",{authentication:Mo,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var Zl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,Co()})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){if(a.state.activeMenu!==t.activeMenu)return!0;if(!a.props.shouldRender&&!e.shouldRender)return!1;var n=Ma(a.props,e),o=Ma(a.state,t);return!n||!o})),mn(Cn(a),"componentDidUpdate",(function(e,t){"sql"===t.activeMenu&&"sql"!==a.state.activeMenu&&a.setState({sqlCopySuccess:!1}),e.displayType!==a.props.displayType&&a.setState({activeMenu:void 0}),t.isFiltering!==a.state.isFiltering&&Eo(),Co()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.temporaryStateTimeout),clearTimeout(a.pivotTableCSVDownloadTimeout)})),mn(Cn(a),"onTableFilter",(function(e){var t;"table"===(null===(t=a.props.responseRef)||void 0===t||null===(t=t.state)||void 0===t?void 0:t.displayType)&&a.setState({disableChartingOptions:(null==e?void 0:e.length)<2})})),mn(Cn(a),"setTemporaryState",(function(e,t,n){a.setState(mn({},e,t)),a.temporaryStateTimeout=setTimeout((function(){a.setState(mn({},e,void 0))}),n)})),mn(Cn(a),"copyTableToClipboard",(function(){var e;a.props.responseRef?(null===(e=a.props.responseRef)||void 0===e||e.copyTableToClipboard(),a.props.onSuccessAlert("Successfully copied table to clipboard!"),a.setTemporaryState("copiedTable",!0,1e3),Eo()):a.setTemporaryState("copiedTable",!1,1e3)})),mn(Cn(a),"fetchCSVAndExport",(function(){var e,t,n=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.query_id,o=null===(t=a.props.responseRef)||void 0===t||null===(t=t.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text,r=C();a.props.onCSVDownloadStart({id:r,queryId:n,query:o}),pt(an(an({queryId:n},_o(a.props.authentication)),{},{csvProgressCallback:function(e){return a.props.onCSVDownloadProgress({id:r,progress:e})}})).then((function(e){var t,n,o=window.URL.createObjectURL(new Blob([e.data])),i=document.createElement("a");i.href=o,i.setAttribute("download","export.csv"),document.body.appendChild(i),i.click();var l=parseInt(null==e||null===(t=e.headers)||void 0===t?void 0:t.export_limit),s="true"==(null==e||null===(n=e.headers)||void 0===n||null===(n=n.limit_reached)||void 0===n?void 0:n.toLowerCase());a.props.onCSVDownloadFinish({id:r,exportLimit:l,limitReached:s})})).catch((function(e){a.props.onCSVDownloadFinish({id:r,error:e}),console.error(e)}))})),mn(Cn(a),"onCSVMenuButtonClick",(function(){var e;a.setState({activeMenu:void 0});var t,n,o="pivot_table"===(null===(e=a.props.responseRef)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.displayType),r=C();o?null!==(t=a.props.responseRef)&&void 0!==t&&null!==(t=t.pivotTableRef)&&void 0!==t&&t._isMounted&&(a.props.onCSVDownloadStart({id:r}),null===(n=a.props.responseRef)||void 0===n||null===(n=n.pivotTableRef)||void 0===n||n.saveAsCSV(2e3).then((function(){a.props.onCSVDownloadProgress({id:r,progress:100}),a.props.onCSVDownloadFinish({id:r})})).catch((function(e){console.error(e),a.props.onCSVDownloadFinish({id:r})}))):a.fetchCSVAndExport()})),mn(Cn(a),"saveChartAsPNG",(function(){var e;null===(e=a.props.responseRef)||void 0===e||e.saveChartAsPNG()})),mn(Cn(a),"deleteMessage",(function(){Eo(),a.props.deleteMessageCallback()})),mn(Cn(a),"copySQL",(function(){var e,t=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.sql,n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),a.setTemporaryState("copiedSQL",!0,1e3),a.props.onSuccessAlert("Successfully copied generated query to clipboard!"),a.setState({sqlCopySuccess:!0}),Eo()})),mn(Cn(a),"showHideColumnsModal",(function(){return a.setState({isHideColumnsModalVisible:!0})})),mn(Cn(a),"closeColumnVisibilityModal",(function(){return a.setState({isHideColumnsModalVisible:!1})})),mn(Cn(a),"closeDataAlertModal",(function(){return a.setState({activeMenu:void 0})})),mn(Cn(a),"onColumnVisibilitySave",(function(e){var t=a.props.authentication,n=e.map((function(e){var t=an(an({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));a.setState({isSettingColumnVisibility:!0}),mt(an(an({},t),{},{columns:n})).then((function(){var e;(a._isMounted&&a.setState({isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1}),a.props.responseRef)&&(null===(e=a.props.responseRef)||void 0===e||e.updateColumns(n));a.props.onColumnVisibilitySave(n)})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a._isMounted&&a.setState({isSettingColumnVisibility:!1})}))})),mn(Cn(a),"renderHideColumnsModal",(function(){var e,t,n=(null===(e=a.props.responseRef)||void 0===e?void 0:e._isMounted)&&(null===(t=a.props.responseRef)||void 0===t?void 0:t.getColumns());if(!n||!n.length)return null;var o=n.map((function(e){return an(an({},e),{},{content:e.display_name,checked:e.is_visible})}));return f.createElement(Rn,null,f.createElement(Tl,{columns:o,isVisible:a.state.isHideColumnsModalVisible,onClose:a.closeColumnVisibilityModal,isSettingColumns:a.state.isSettingColumnVisibility,onConfirm:a.onColumnVisibilitySave}))})),mn(Cn(a),"onDataAlertSave",(function(){a.setState({activeMenu:void 0})})),mn(Cn(a),"renderDataAlertModal",(function(){var e,t,n=S(null===(e=a.props.responseRef)||void 0===e?void 0:e.queryResponse),o=null===(t=a.props.responseRef)||void 0===t?void 0:t.getCombinedFilters();return f.createElement(Rn,null,f.createElement(Ul,{authentication:a.props.authentication,isVisible:"notification"===a.state.activeMenu,onClose:a.closeDataAlertModal,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessAlert,onSave:a.onDataAlertSave,tooltipID:a.props.tooltipID,queryResponse:n,filters:o}))})),mn(Cn(a),"renderReportProblemModal",(function(){return f.createElement(Jl,{ref:function(e){return a.reportProblemRef=e},authentication:a.props.authentication,onClose:function(){a.setState({activeMenu:void 0})},onReportProblem:function(e){var t=e.successMessage,n=e.error;t?(a.props.onSuccessAlert(t),a._isMounted&&a.setState({activeMenu:void 0})):n&&a.props.onErrorCallback(n)},responseRef:a.props.responseRef,isVisible:"report-problem"===a.state.activeMenu})})),mn(Cn(a),"reportQueryProblem",(function(e){var t;null!==(t=a.reportProblemRef)&&void 0!==t&&t._isMounted&&a.reportProblemRef.reportQueryProblem(e)})),mn(Cn(a),"refreshData",(function(){})),mn(Cn(a),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn react-autoql-btn ".concat(e||"")})),mn(Cn(a),"renderMoreOptionsMenu",(function(e,t){return f.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},f.createElement("ul",{className:"context-menu-list"},t.showSaveAsCSVButton&&f.createElement("li",{onClick:a.onCSVMenuButtonClick,style:a.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},f.createElement(Wn,{type:"download",style:{marginRight:"7px"}}),a.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),t.showSaveAsPNGButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:void 0}),a.saveChartAsPNG()}},f.createElement(Wn,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),t.showCopyButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:void 0}),a.copyTableToClipboard()}},f.createElement(Wn,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),t.showSQLButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"sql"})}},f.createElement(Wn,{type:"database"})," View generated SQL"),t.showCreateNotificationIcon&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"notification"}),a.props.createDataAlertCallback()}},f.createElement(Wn,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert...")))})),mn(Cn(a),"isDrilldownResponse",(function(e){try{var t;return"Drilldown:"===(null===(t=e.responseRef)||void 0===t||null===(t=t.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text).split(" ")[0]}catch(e){return!1}})),mn(Cn(a),"openReportProblemModal",(function(){a.setState({activeMenu:"report-problem"})})),mn(Cn(a),"renderSQLModal",(function(){var e,t=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.sql)||void 0===e?void 0:e[0];return t?f.createElement(Rn,null,f.createElement(Sl,{isVisible:"sql"===a.state.activeMenu,footer:f.createElement("div",null,f.createElement(wo,{type:"primary",onClick:function(){return a.setState({activeMenu:void 0})}},"Ok")),onClose:function(){return a.setState({activeMenu:void 0})},title:"Generated SQL",enableBodyScroll:!1,width:"600px"},f.createElement("div",{className:"copy-sql-modal-content"},f.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(zt(t)),disabled:!0}),f.createElement(wo,{className:"copy-sql-btn ".concat(a.state.sqlCopySuccess?"sql-copied":""),onClick:a.copySQL,tooltip:"Copy to Clipboard",tooltipID:a.props.tooltipID},f.createElement(Wn,{type:"copy"}),a.state.sqlCopySuccess&&f.createElement(Wn,{type:"check",className:"sql-copied"}))))):null})),mn(Cn(a),"renderFilterBtn",(function(){var e,t,n,o,r=null===(e=a.props.responseRef)||void 0===e?void 0:e.getTabulatorHeaderFilters(),i=!(null===(t=a.props.responseRef)||void 0===t||null===(t=t.formattedTableParams)||void 0===t||null===(t=t.filters)||void 0===t||!t.length||null==r||!r.length),l="table"===(null===(n=a.props.responseRef)||void 0===n||null===(n=n.state)||void 0===n?void 0:n.displayType),s=a.state.isFiltering?"Hide filters":"Filter table";return l||(s=i?"Edit table filters":"Filter data from table"),f.createElement(wo,{onClick:function(){var e,t,n,o,r=!l||!(null!==(e=a.props.responseRef)&&void 0!==e&&e.isFilteringTable());(a.setState({isFiltering:r}),"table"===(null===(t=a.props.responseRef)||void 0===t||null===(t=t.state)||void 0===t?void 0:t.displayType))?null===(n=a.props.responseRef)||void 0===n||n.toggleTableFilter(r):null===(o=a.props.responseRef)||void 0===o||o.changeDisplayType("table",(function(){var e;null===(e=a.props.responseRef)||void 0===e||e.toggleTableFilter(!0,!0)}))},className:"".concat(a.getMenuItemClass("filter-btn"),"\n ").concat(a.state.isFiltering&&l?"react-autoql-toolbar-btn-selected":""),tooltip:s,tooltipID:null!==(o=a.props.tooltipID)&&void 0!==o?o:a.TOOLTIP_ID,"data-test":"react-autoql-filter-button"},f.createElement(Wn,{type:"filter",showBadge:i}))})),mn(Cn(a),"renderColumnVizBtn",(function(e){var t;return f.createElement(wo,{onClick:a.showHideColumnsModal,className:a.getMenuItemClass(),tooltip:"Show/hide columns",tooltipID:null!==(t=a.props.tooltipID)&&void 0!==t?t:a.TOOLTIP_ID,"data-test":"options-toolbar-col-vis"},f.createElement(Wn,{type:"eye",showBadge:e.showHiddenColsBadge}))})),mn(Cn(a),"renderReportProblemBtn",(function(){var e;return f.createElement(wo,{onClick:a.openReportProblemModal,className:a.getMenuItemClass(),tooltip:"Report a problem",tooltipID:null!==(e=a.props.tooltipID)&&void 0!==e?e:a.TOOLTIP_ID},f.createElement(Wn,{type:"warning-triangle"}))})),mn(Cn(a),"renderToolbar",(function(e){var t,n,o,r;return f.createElement(Rn,null,f.createElement("div",{className:"".concat(Pe?"react-autoql-toolbar-mobile":"react-autoql-toolbar"," options-toolbar\n ").concat(a.state.activeMenu?"active":"","\n ").concat(a.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&a.renderFilterBtn(),e.showHideColumnsButton&&a.renderColumnVizBtn(e),e.showReportProblemButton&&a.renderReportProblemBtn(),e.showRefreshDataButton&&f.createElement(wo,{onClick:a.refreshData,className:a.getMenuItemClass(),tooltip:"Re-run query",tooltipID:null!==(t=a.props.tooltipID)&&void 0!==t?t:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(Wn,{type:"refresh"})),e.showDeleteButton&&f.createElement(wo,{onClick:a.deleteMessage,className:a.getMenuItemClass(),tooltip:"Delete data response",tooltipID:null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(Wn,{type:"trash"})),e.showMoreOptionsButton&&f.createElement(Xn,{key:"more-options-button-".concat(a.COMPONENT_KEY),isOpen:"more-options"===a.state.activeMenu,padding:8,onClickOutside:function(){return a.setState({activeMenu:void 0})},content:function(t){return a.renderMoreOptionsMenu(t,e)},parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement,positions:null!==(o=a.props.popoverPositions)&&void 0!==o?o:["bottom","top","left","right"],align:a.props.popoverAlign},f.createElement(wo,{onClick:function(){Eo(),a.setState({activeMenu:"more-options"})},className:a.getMenuItemClass("more-options"),tooltip:"More options",tooltipID:null!==(r=a.props.tooltipID)&&void 0!==r?r:a.TOOLTIP_ID,"data-test":"react-autoql-toolbar-more-options-btn"},f.createElement(Wn,{type:"more-vertical"})))))})),mn(Cn(a),"getShouldShowButtonObj",(function(e){var t={};try{var n,o,r,i,l,s,c,u=null===(n=e.responseRef)||void 0===n||null===(n=n.state)||void 0===n?void 0:n.displayType,d=null===(o=e.responseRef)||void 0===o?void 0:o.getColumns(),p=ua(u),m=ca(u),f=null===(r=e.responseRef)||void 0===r?void 0:r.queryResponse,g="data"===(null==f||null===(i=f.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.display_type),v=ya(d),h=ba(d),b=null==f||null===(l=f.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.rows)||void 0===l?void 0:l.length,y=b>0,C=!(null===(s=e.responseRef)||void 0===s||null===(s=s.formattedTableParams)||void 0===s||null===(s=s.filters)||void 0===s||!s.length),E=b>1&&!C||!!C,S=zo(e.autoQLConfig);(t={showFilterButton:("table"===u||ca(u))&&!v&&E,showCopyButton:p&&!v,showSaveAsPNGButton:m,showHideColumnsButton:S.enableColumnVisibilityManager&&y&&("table"===u||"text"===u&&v),showHiddenColsBadge:h,showSQLButton:g&&S.debug,showSaveAsCSVButton:p&&E&&S.enableCSVDownload,showDeleteButton:e.enableDeleteBtn,showReportProblemButton:S.enableReportProblem&&!(null==f||null===(c=f.data)||void 0===c||null===(c=c.data)||void 0===c||!c.query_id),showCreateNotificationIcon:!Pe&&(g&&S.enableNotifications&&!a.isDrilldownResponse(e)),showRefreshDataButton:!1}).showMoreOptionsButton=(t.showCopyButton||t.showSQLButton||t.showCreateNotificationIcon||t.showSaveAsCSVButton||t.showSaveAsPNGButton)&&!Pe}catch(e){console.error(e)}return t})),mn(Cn(a),"render",(function(){var e=a.getShouldShowButtonObj(a.props);return Object.values(e).find((function(e){return!0===e}))?f.createElement(Rn,null,a.renderToolbar(e),e.showHideColumnsButton&&a.renderHideColumnsModal(),e.showReportProblemButton&&a.renderReportProblemModal(),e.showCreateNotificationIcon&&a.renderDataAlertModal(),e.showSQLButton&&a.renderSQLModal(),!a.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800})):null})),a.COMPONENT_KEY=C(),a.TOOLTIP_ID="react-autoql-options-toolbar-tooltip-".concat(a.COMPONENT_KEY),a.state={isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1,isFiltering:!(null===(o=e.responseRef)||void 0===o||!o.isFilteringTable())},a}return pn(n)}();mn(Zl,"propTypes",{authentication:nr,autoQLConfig:ar,enableDeleteBtn:b.bool,shouldRender:b.bool,onSuccessAlert:b.func,onErrorCallback:b.func,onNewNotificationCallback:b.func,deleteMessageCallback:b.func,createDataAlertCallback:b.func,onCSVDownloadStart:b.func,onCSVDownloadFinish:b.func,onCSVDownloadProgress:b.func}),mn(Zl,"defaultProps",{authentication:Mo,autoQLConfig:Vo,enableDeleteBtn:!1,shouldRender:!0,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},createDataAlertCallback:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var $l=f.forwardRef((function(e,t){var n=fn({},(bn(e),e));return f.createElement(Zl,fn({},n,{ref:t}))})),es=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidMount",(function(){e.setState({isMounted:!0})})),mn(Cn(e),"renderVisualization",(function(){var t=e.props.queryResponse;return f.createElement("div",{className:"react-autoql-notification-chart-container"},f.createElement("div",{ref:function(t){return e.dataContainer=t},className:"react-autoql-notification-query-data-container"},t?f.createElement(bl,{ref:function(t){return e.OUTPUT_REF=t},vizToolbarRef:e.vizToolbarRef,optionsToolbarRef:e.optionsToolbarRef,authentication:e.props.authentication,autoQLConfig:e.props.autoQLConfig,dataFormatting:e.props.dataFormatting,queryResponse:t,autoChartAggregations:e.props.autoChartAggregations,enableAjaxTableData:e.props.enableAjaxTableData,isResizing:e.props.isResizing||!e.props.shouldRender,popoverParentElement:e.props.popoverParentElement,showSingleValueResponseTitle:!0}):f.createElement("div",{style:{position:"absolute",top:0},className:"loading-container-centered"},f.createElement(Xa,null))))})),mn(Cn(e),"renderToolbar",(function(){return e.props.shouldRender?f.createElement("div",{className:"react-autoql-notification-toolbar-container"},f.createElement("div",null,f.createElement(Cl,{autoQLConfig:e.props.autoQLConfig,ref:function(t){return e.vizToolbarRef=t},responseRef:e.OUTPUT_REF})),f.createElement("div",null,f.createElement($l,{authentication:e.props.authentication,autoQLConfig:e.props.autoQLConfig,ref:function(t){return e.optionsToolbarRef=t},responseRef:e.OUTPUT_REF,onSuccessAlert:e.props.onSuccessCallback,onErrorCallback:e.props.onErrorCallback,popoverPositions:["top","left","bottom","right"],popoverAlign:"end"}))):null})),mn(Cn(e),"render",(function(){return f.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},e.renderVisualization(),e.renderToolbar())})),e}return pn(n)}();mn(es,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tooltipID:b.string,chartTooltipID:b.string,reportProblemCallback:b.func,onSuccessCallback:b.func,onErrorCallback:b.func}),mn(es,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tooltipID:null,chartTooltipID:null,reportProblemCallback:function(){},onSuccessCallback:function(){},onErrorCallback:function(){}});var ts,ns=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidUpdate",(function(e,t){a.state.expanded&&!t.expanded&&(a.props.updateScrollbars(500),a.state.queryResponse||a.fetchNotification())})),mn(Cn(a),"componentWillUnmount",(function(){clearTimeout(a.initialCollapseTimer)})),mn(Cn(a),"isError",(function(){var e;return"ERROR"===(null===(e=a.props.notification)||void 0===e?void 0:e.outcome)})),mn(Cn(a),"isUnread",(function(){var e;return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(null===(e=a.props.notification)||void 0===e?void 0:e.state)})),mn(Cn(a),"fetchNotification",(function(){(function(e){var t=e.id,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.get(i).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.query_result;return n?Promise.resolve({data:n}):Promise.reject({response:{data:{message:"Uh oh, Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."}}})})).catch((function(e){var t;return Promise.reject({data:null==e||null===(t=e.response)||void 0===t?void 0:t.data})}))})(an({id:a.props.notification.id},_o(a.props.authentication))).then((function(e){a.setState({queryResponse:e})})).catch((function(e){a.setState({queryResponse:e})}))})),mn(Cn(a),"expand",(function(){a.setState({expanded:!0}),a.isUnread()&&a.markAsRead()})),mn(Cn(a),"collapse",(function(){a.setState({expanded:!1,isMoreOptionsMenuOpen:!1})})),mn(Cn(a),"onClick",(function(e){a.state.expanded?(a.collapse(),a.props.onCollapseCallback(e)):(a.expand(),a.props.onExpandCallback(e))})),mn(Cn(a),"markAsUnread",(function(){a.props.onUnreadCallback(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.put(i,{state:"ACKNOWLEDGED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDismissSuccessCallback).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"markAsRead",(function(){a.props.onDismissCallback(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.put(i,{state:"DISMISSED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDismissSuccessCallback).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"delete",(function(){a.props.onDeleteClick(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.delete(i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDeleteSuccessCallback).catch(a.props.onErrorCallback).finally(a.props.onDeleteEnd)})),mn(Cn(a),"changeDataAlertStatus",(function(e){hr(an({dataAlertId:a.props.notification.data_alert_id,type:a.props.notification.data_alert_type,status:e},_o(a.props.authentication))).then((function(){a.setState({dataAlertStatus:e});var t="ACTIVE"===e?"Data Alert reactivated! You will start receiving notifications for this Data Alert again.":"You will no longer receive notifications like this.";a.props.onSuccessCallback(t),a.props.onDataAlertChange()})).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"getFormattedTimestamp",(function(){var e,t=a.props.notification.created_at,n=(e=na(t)?o.unix(t):o(t)).format("h:mma"),r=e.format("MM-DD-YY"),i=o().format("MM-DD-YY"),l=o().subtract(1,"d").format("MM-DD-YY");return r===i?"Today at ".concat(n):r===l?"Yesterday at ".concat(n):o().isSame(e,"year")?"".concat(e.format("MMMM Do")," at ").concat(n):"".concat(e.format("MMMM Do, YYYY")," at ").concat(n)})),mn(Cn(a),"renderAlertColorStrip",(function(){return f.createElement("div",{className:"react-autoql-notification-alert-strip"})})),mn(Cn(a),"isDataAlertInErrorState",(function(){var e=a.props.dataAlert;return"GENERAL_ERROR"===(null==e?void 0:e.status)||"EVALUATION_ERROR"===(null==e?void 0:e.status)||"DATA_RETURN_ERROR"===(null==e?void 0:e.status)})),mn(Cn(a),"renderNotificationTitle",(function(){return a.isError()?f.createElement("span",null,f.createElement(Wn,{type:"warning-triangle"})," Data Alert Error"):f.createElement("span",null,a.props.notification.title)})),mn(Cn(a),"renderNotificationMessage",(function(){return a.isError()?'Your Data Alert "'.concat(a.props.notification.title,'" encountered a problem. Click for more information.'):a.props.notification.message})),mn(Cn(a),"renderNotificationHeader",(function(){return f.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){return a.onClick(a.props.notification)}},f.createElement("div",{className:"react-autoql-notification-display-name-container"},f.createElement("div",{className:"react-autoql-notification-display-name"},a.renderNotificationTitle()),f.createElement("div",{className:"react-autoql-notification-description"},a.renderNotificationMessage()),f.createElement("div",{className:"react-autoql-notification-timestamp-container"},f.createElement("span",{className:"react-autoql-notification-timestamp"},f.createElement(Wn,{type:"calendar"})," ",a.getFormattedTimestamp()))),a.moreOptionsButton(),a.renderExpandArrow())})),mn(Cn(a),"renderExpandArrow",(function(){return f.createElement("div",{className:"react-autoql-notification-item-expand-arrow"},f.createElement(Wn,{type:"caret-down"}))})),mn(Cn(a),"moreOptionsButton",(function(){var e;return f.createElement("div",{className:"react-autoql-notification-options-btn-container",onClick:function(){return a.setState({isMoreOptionsMenuOpen:!a.state.isMoreOptionsMenuOpen})}},f.createElement(Xn,{align:"start",positions:["left","bottom","top","right"],containerClassName:"react-autoql-notification-options-popover",content:a.moreOptionsMenu(),isOpen:a.state.isMoreOptionsMenuOpen,onClickOutside:function(){return a.setState({isMoreOptionsMenuOpen:!1})}},f.createElement("div",null,f.createElement(Wn,{type:"more-vertical",className:"react-autoql-notification-options-btn","data-tip":"Options","data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:"react-autoql-notification-tooltip",onClick:function(e){e.stopPropagation(),a.setState({isMoreOptionsMenuOpen:!0})}}))))})),mn(Cn(a),"onOptionClick",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};Eo(),a.setState({isMoreOptionsMenuOpen:!1}),e()})),mn(Cn(a),"moreOptionsMenu",(function(){var e,t,n=a.isUnread(),o=null!==(e=a.state.dataAlertStatus)&&void 0!==e?e:null===(t=a.props.dataAlert)||void 0===t?void 0:t.status,r="ACTIVE"===o||"WAITING"===o;return f.createElement(Do,null,!!a.props.dataAlert&&!Pe&&f.createElement(To,{"data-test":"react-autoql-toolbar-more-options-notification",title:"Settings",subtitle:"View and edit this Data Alert",icon:"settings",onClick:function(e){return a.onOptionClick((function(){return a.props.onEditClick(a.props.dataAlert)}))}}),!!o&&f.createElement(To,{onClick:function(){return a.onOptionClick((function(){return a.changeDataAlertStatus(r?"INACTIVE":"ACTIVE")}))},icon:r?"notification-off":"notification",title:"Turn ".concat(r?"off":"on"),subtitle:r?"Stop receiving notifications for this Data Alert":"Start receiving notifications for this Data Alert again"}),f.createElement(To,{onClick:function(){return a.onOptionClick(n?a.markAsRead:a.markAsUnread)},icon:n?"mark-read":"mark-unread",title:"Mark as ".concat(n?"read":"unread")}),f.createElement(To,{onClick:function(){return a.onOptionClick(a.delete)},icon:"trash",title:"Delete"}))})),mn(Cn(a),"renderLoader",(function(){return f.createElement("div",{style:{position:"absolute",top:0},className:"loading-container-centered"},f.createElement(Xa,null))})),mn(Cn(a),"renderSummarySection",(function(){var e=a.props.notification;if(null==e||!e.expression)return null;var t={data:null==e?void 0:e.query_result};return f.createElement("div",{className:"react-autoql-notification-condition-statement"},f.createElement("span",null,"Summary: "),f.createElement(ei,{key:"expression-builder-".concat(a.COMPONENT_KEY),expression:null==e?void 0:e.expression,queryResponse:t,conditionStatementOnly:!0,conditionTense:"past",sentenceCase:!0,useRT:!0}))})),mn(Cn(a),"restartAlert",(function(){var e;a.setState({isInitializing:!0}),gr(an({id:null===(e=a.props.dataAlert)||void 0===e?void 0:e.id},_o(a.props.authentication))).then((function(){a.setState({initializeSuccess:!0}),a.props.onSuccessCallback("Restart successful! Your Data Alert is now active.")})).catch((function(e){console.error(e),a.setState({initializeError:!0}),a.props.onErrorCallback("Data Alert restart unsuccessful. Please try again in a few minutes.")})).finally((function(){a.setState({isInitializing:!1}),a.props.onDataAlertChange()}))})),mn(Cn(a),"renderErrorDetails",(function(){var e,t,n;if(null!==(e=a.props.dataAlert)&&void 0!==e&&e.id&&!a.isDataAlertInErrorState()){var o,r=null===(o=a.props.notification)||void 0===o?void 0:o.data_return_query;return f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("span",null,"To resolve this issue, try restarting the Alert by clicking the button below."),f.createElement("br",null),f.createElement(wo,{type:"primary",icon:a.state.initializeSuccess?"check":"refresh",loading:a.state.isInitializing,className:"notification-error-reinitialize-btn ".concat(a.state.initializeSuccess?"restart-success":""),onClick:a.restartAlert},a.state.initializeSuccess?"Restarted":"Restart Alert"),f.createElement("br",null),f.createElement("span",null,"If the problem persists, you may need to create a new Data Alert",r?f.createElement("span",null," ","from the query"," ",a.props.onQueryClick?f.createElement("a",{onClick:function(){return a.props.onQueryClick(r)},"data-tip":"Click to run this query in Data Messenger","data-for":a.props.tooltipID},'"',r,'"'):f.createElement("span",null,f.createElement("em",null,'"',r,'"'))):f.createElement("span",null,".")))}return f.createElement("span",null,"It has since been"," ",null!==(t=a.props.dataAlert)&&void 0!==t&&t.id?"restarted and is no longer in an error state. ":"deleted and no longer triggering notifications."," ","Feel free to"," ",f.createElement(Jr,{className:"notification-delete-confirm-popover",popoverParentElement:null!==(n=a.props.popoverParentElement)&&void 0!==n?n:a.notificationItemRef,title:"Delete this Notification?",onConfirm:a.delete,confirmText:"Delete",backText:"Cancel",positions:["top","bottom","left","right"],align:"end"},f.createElement("a",null,"delete"))," ","this notification.")})),mn(Cn(a),"renderErrorMessage",(function(){var e=a.getFormattedTimestamp();return e.includes("today")||(e="on ".concat(e)),f.createElement("div",{className:"notification-error-message-container"},f.createElement("div",null,"This Data Alert encountered an error ",e,". ",a.renderErrorDetails()))})),mn(Cn(a),"renderNotificationContent",(function(){var e,t;return f.createElement("div",{ref:function(e){return a.contentRef=e},className:"react-autoql-notification-expanded-content\n ".concat(a.state.expanded?"expanded":"collapsed","\n ").concat(a.state.queryResponse?"":"loading")},f.createElement(f.Fragment,null,!a.state.queryResponse&&a.renderLoader(),f.createElement("div",{className:"react-autoql-notification-content-container"},a.isError()?a.renderErrorMessage():f.createElement(f.Fragment,null,a.renderSummarySection(),f.createElement(es,{key:null===(e=a.state.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.query_id,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,dataFormatting:a.props.dataFormatting,queryResponse:a.state.queryResponse,autoChartAggregations:a.props.autoChartAggregations,enableAjaxTableData:a.props.enableAjaxTableData,onSuccessCallback:a.props.onSuccessCallback,onErrorCallback:a.props.onErrorCallback,popoverParentElement:null!==(t=a.props.popoverParentElement)&&void 0!==t?t:a.notificationItemRef,isResizing:a.props.isResizing,shouldRender:a.state.expanded})))))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-notification-item-".concat(a.COMPONENT_KEY),key:"react-autoql-notification-item-".concat(a.COMPONENT_KEY),ref:function(e){return a.notificationItemRef=e},className:"react-autoql-notification-list-item\n ".concat(a.state.expanded?"expanded":"collapsed","\n ").concat(a.isUnread()?"unread":"","\n ").concat(a.isError()?"is-error":"","\n ").concat(a.state.isMoreOptionsMenuOpen?"menu-open":"")},a.renderNotificationHeader(),a.renderNotificationContent(),a.renderAlertColorStrip(),f.createElement("div",{className:"react-autoql-notification-item-hover-overlay"})))})),a.COMPONENT_KEY=C(),a.state={expanded:!1,dataAlertStatus:void 0,queryResponse:void 0,isMoreOptionsMenuOpen:!1},a}return pn(n)}();mn(ns,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,notification:b.shape({}).isRequired,onRuleFetchCallback:b.func,onExpandCallback:b.func,onCollapseCallback:b.func,onDismissCallback:b.func,onDeleteClick:b.func,onDeleteEnd:b.func,onDeleteSuccessCallback:b.func,onDismissSuccessCallback:b.func,onErrorCallback:b.func,autoChartAggregations:b.bool,enableAjaxTableData:b.bool,onClick:b.func,onDataAlertChange:b.func,onSuccessCallback:b.func,onQueryClick:b.func}),mn(ns,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,autoChartAggregations:!1,onQueryClick:void 0,onRuleFetchCallback:function(){},updateScrollbars:function(){},onExpandCallback:function(){},onCollapseCallback:function(){},onDismissCallback:function(){},onDeleteClick:function(){},onDeleteEnd:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onUnreadCallback:function(){},onErrorCallback:function(){},onClick:function(){},onDataAlertChange:function(){},onSuccessCallback:function(){}});var os=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.props.shouldRender&&(o.getNotifications(),o.getDataAlerts())})),mn(Cn(o),"componentDidUpdate",(function(e,t){var n,a;!o.props.shouldRender&&e.shouldRender?o.collapseActive():!o.props.shouldRender||e.shouldRender||o.hasFetchedNotifications||(o.getNotifications(),o.getDataAlerts()),o.props.shouldRender&&o.state.unFetchedNotifications&&!t.unFetchedNotifications&&o.refreshNotifications(),(null===(n=t.notificationList)||void 0===n?void 0:n.length)!==(null===(a=o.state.notificationList)||void 0===a?void 0:a.length)&&o.updateScrollbars(1e3)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"closeDataAlertModal",(function(){o.setState({isEditModalVisible:!1})})),mn(Cn(o),"getDataAlerts",(function(){fr(an({},_o(o.props.authentication))).then((function(e){var t,n,a,r,i=null!==(t=null==e||null===(n=e.data)||void 0===n?void 0:n.custom_alerts)&&void 0!==t?t:[],l=null!==(a=null==e||null===(r=e.data)||void 0===r?void 0:r.project_alerts)&&void 0!==a?a:[],s=[].concat(Tn(i),Tn(l));o.setState({dataAlerts:s})}))})),mn(Cn(o),"getNotifications",(function(){var e,t;if(o.props.shouldRender&&!o.state.isFetching&&!o.state.isDeleting&&!o.state.unFetchedNotifications){o.hasFetchedNotifications=!0;var n=null!==(e=null===(t=o.state.notificationList)||void 0===t?void 0:t.length)&&void 0!==e?e:0;if(!(o.state.pagination&&o.state.pagination.total_items<=n))return o.setState({isFetching:!0}),mr(an(an({},_o(o.props.authentication)),{},{limit:o.NOTIFICATION_FETCH_LIMIT,offset:n})).then((function(e){var t,n;if(null!=e&&null!==(t=e.items)&&void 0!==t&&t.length){var a=null!==(n=e.items.filter((function(e){return!o.state.notificationList.find((function(t){return t.id===e.id}))})))&&void 0!==n?n:[],r=0;a.length!==e.items.length&&(r=e.items.length-a.length);var i={isFetchingFirstNotifications:!1,fetchNotificationsError:null,unFetchedNotifications:r,isFetching:!1};null!=a&&a.length&&o._isMounted&&(i.notificationList=[].concat(Tn(o.state.notificationList),Tn(a)),i.pagination=e.pagination),o.setState(i)}else o.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:null,isFetching:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o._isMounted&&o.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e,isFetching:!1})}))}})),mn(Cn(o),"getNewNotifications",(function(){var e,t,n=((null===(e=o.state.notificationList)||void 0===e?void 0:e.length)||o.NOTIFICATION_FETCH_LIMIT)+(null!==(t=o.state.unFetchedNotifications)&&void 0!==t?t:0);mr(an(an({},_o(o.props.authentication)),{},{offset:0,limit:n})).then((function(e){var t,n,a,r,i,l=null==e?void 0:e.items,s=o.state.notificationList,c=(null===(t=e.items)||void 0===t?void 0:t.length)-1;(null==l||null===(n=l[0])||void 0===n?void 0:n.id)!==(null==s||null===(a=s[0])||void 0===a?void 0:a.id)||(null==l||null===(r=l[c])||void 0===r?void 0:r.id)!==(null==s||null===(i=s[c])||void 0===i?void 0:i.id)?o.setState({notificationList:e.items,pagination:e.pagination,unFetchedNotifications:0}):o.setState({unFetchedNotifications:0})}))})),mn(Cn(o),"refreshNotifications",(function(){return o.getDataAlerts(),o.hasFetchedNotifications?o.getNewNotifications():o.getNotifications()})),mn(Cn(o),"getNewNotificationsFromResponse",(function(e){var t=[];return e.every((function(e){return!o.state.notificationList.find((function(t){return t.id===e.id}))&&(t.push(e),!0)})),t})),mn(Cn(o),"onDeleteAllClick",(function(){})),mn(Cn(o),"onMarkAllAsReadClick",(function(){var e=o.state.notificationList.map((function(e){return an(an({},e),{},{state:"DISMISSED"})}));return o.setState({notificationList:e}),function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n);return a.put(r,{state:"DISMISSED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},_o(o.props.authentication))).then((function(){o.props.onDismissCallback(e),o.props.onChange(e)})).catch((function(e){console.error(e),o.props.onErrorCallback(e)}))})),mn(Cn(o),"onUnreadClick",(function(e){var t=o.state.notificationList.map((function(t){return e.id===t.id?an(an({},t),{},{state:"ACKNOWLEDGED"}):t}));o.setState({notificationList:t},(function(){o.props.onUnreadCallback(t)}))})),mn(Cn(o),"onDismissClick",(function(e){var t=o.state.notificationList.map((function(t){return e.id===t.id?an(an({},t),{},{state:"DISMISSED"}):t}));o.setState({notificationList:t},(function(){o.props.onDismissCallback(t)}))})),mn(Cn(o),"onDeleteClick",(function(e){var t,n=o.state.notificationList.filter((function(t){return t.id!==e.id})),a=null!==(t=o.state.pagination)&&void 0!==t?t:{};a&&(a=an(an({},a),{},{total_items:a.total_items>0?a.total_items-1:0})),o.setState({notificationList:n,pagination:a,isDeleting:!0})})),mn(Cn(o),"onDeleteEnd",(function(){o.setState({isDeleting:!1},(function(){var e;o.hasMoreNotifications()&&(null===(e=o.state.notificationList)||void 0===e?void 0:e.length)<o.NOTIFICATION_FETCH_LIMIT&&o.getNotifications()}))})),mn(Cn(o),"onDataAlertSave",(function(){o.setState({isEditModalVisible:!1})})),mn(Cn(o),"renderTopOptions",(function(){return f.createElement("div",{className:"notification-feed-top-options-container"},o.renderDeleteAllButton(),o.renderDataAlertsManagerButton(),o.renderMarkAllAsReadButton())})),mn(Cn(o),"renderDataAlertsManagerButton",(function(){return o.props.showDataAlertsManager?f.createElement("div",{onClick:function(){o.setState({isDataAlertsManagerOpen:!0})},className:"react-autoql-notification-mark-all"},f.createElement(Wn,{type:"list-settings"})," ",f.createElement("span",null,"Data Alerts")):f.createElement("div",null)})),mn(Cn(o),"renderDeleteAllButton",(function(){return null})),mn(Cn(o),"renderMarkAllAsReadButton",(function(){var e;return f.createElement(Jr,{onConfirm:o.onMarkAllAsReadClick,title:"Mark all as read?",confirmText:"Yes",backText:"Cancel",popoverParentElement:null!==(e=o.props.popoverParentElement)&&void 0!==e?e:o.feedContainer,positions:["bottom","left","right","top"],align:"end"},f.createElement("div",{className:"react-autoql-notification-mark-all"},f.createElement(Wn,{type:"mark-read"})," ",f.createElement("span",null,"Mark all as read")))})),mn(Cn(o),"showEditDataAlertModal",(function(e){o.setState({isEditModalVisible:!0,activeDataAlert:e})})),mn(Cn(o),"renderDataAlertsManagerModal",(function(){return o.props.showDataAlertsManager?f.createElement(Sl,{contentClassName:"react-autoql-data-alert-manager-modal",overlayStyle:{zIndex:"9998"},title:"Data Alerts",titleIcon:f.createElement(Wn,{type:"list-settings"}),isVisible:o.state.isDataAlertsManagerOpen,onOpened:o.props.onModalOpen,onClosed:o.props.onModalClose,onClose:function(){o.setState({isDataAlertsManagerOpen:!1})},enableBodyScroll:!0,showFooter:!1},f.createElement(Xl,{authentication:o.props.authentication,onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessCallback})):null})),mn(Cn(o),"renderEditDataAlertModal",(function(){var e;return f.createElement(Ul,{key:o.MODAL_COMPONENT_KEY,authentication:o.props.authentication,isVisible:o.state.isEditModalVisible,onClose:o.closeDataAlertModal,onOpened:o.props.onModalOpen,onClosed:o.props.onModalClose,currentDataAlert:o.state.activeDataAlert,onSave:o.onDataAlertSave,onErrorCallback:o.props.onErrorCallback,allowDelete:"CUSTOM"===(null===(e=o.state.activeDataAlert)||void 0===e?void 0:e.type),tooltipID:o.props.tooltipID,editView:!0})})),mn(Cn(o),"collapseActive",(function(){var e,t=o.state.expandedNotificationID;null===(e=o.notificationRefs[t])||void 0===e||e.collapse(),o.setState({expandedNotificationID:void 0})})),mn(Cn(o),"onNotificationExpand",(function(e){var t,n=o.state.expandedNotificationID;n&&n!==e.id&&(null===(t=o.notificationRefs[n])||void 0===t||t.collapse());o.setState({expandedNotificationID:e.id})})),mn(Cn(o),"updateScrollbars",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout(null===(e=o.infiniteScroll)||void 0===e?void 0:e.updateScrollbars,t)})),mn(Cn(o),"hasMoreNotifications",(function(){var e,t;return!o.state.isFetching&&(null===(e=o.state.pagination)||void 0===e?void 0:e.total_items)>(null===(t=o.state.notificationList)||void 0===t?void 0:t.length)})),mn(Cn(o),"render",(function(){var e,t={};return o.props.shouldRender||(t.visibility="hidden",t.opacity="0"),o.state.isFetchingFirstNotifications?f.createElement("div",{style:t,className:"notification-list-loading-container","data-test":"notification-list"},f.createElement(Xa,null)):o.state.fetchNotificationsError?f.createElement("div",{style:t,className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",f.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},f.createElement(wo,{onClick:o.getInitialNotifications},"Try Again"))):f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.feedContainer=e},style:t,className:"react-autoql-notification-list-container ".concat(Pe?"react-autoql-notification-list-container-mobile":""),"data-test":"notification-list"},o.props.tooltipID!==o.TOOLTIP_ID&&f.createElement(So,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),null!==(e=o.state.notificationList)&&void 0!==e&&e.length?f.createElement(h,null,o.renderTopOptions(),f.createElement(Lo,{ref:function(e){return o.infiniteScroll=e},pageStart:0,useWindow:!1,initialLoad:!1,loadMore:o.getNotifications,hasMore:o.hasMoreNotifications()},f.createElement("div",{className:"notification-feed-list"},o.state.notificationList.map((function(e,t){var n,a=null===(n=o.state.dataAlerts)||void 0===n?void 0:n.find((function(t){return t.id===e.data_alert_id}));return f.createElement(ns,{ref:function(t){return o.notificationRefs[e.id]=t},key:e.id,authentication:o.props.authentication,autoQLConfig:an(an({},zo(o.props.autoQLConfig)),{},{enableColumnVisibilityManager:!1,enableNotifications:!1,enableCSVDownload:!1,enableDrilldowns:!1,enableReportProblem:!1}),notification:e,dataAlert:a,expanded:!!e.expanded,onDismissCallback:o.onDismissClick,onUnreadCallback:o.onUnreadClick,onQueryClick:o.props.onQueryClick,popoverParentElement:o.props.popoverParentElement,onDismissSuccessCallback:function(){o.props.onChange(o.state.notificationList)},onDeleteClick:o.onDeleteClick,onDeleteEnd:o.onDeleteEnd,onDeleteSuccessCallback:function(){o.props.onChange(o.state.notificationList)},onExpandCallback:o.onNotificationExpand,onCollapseCallback:o.onNotificationCollapse,autoChartAggregations:o.props.autoChartAggregations,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,onDataAlertChange:o.props.onDataAlertChange,onEditClick:function(e){o.showEditDataAlertModal(e)},enableAjaxTableData:o.props.enableAjaxTableData,isResizing:o.props.isResizing,updateScrollbars:o.updateScrollbars,tooltipID:o.props.tooltipID})})),o.state.isFetching&&f.createElement("div",{className:"react-autoql-spinner-centered"},f.createElement(Ro,null))))):f.createElement("div",{className:"empty-notifications-message"},f.createElement("img",{className:"empty-notifications-img",src:Wl}),f.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),f.createElement("div",null,"Stay tuned!"),f.createElement("br",null),o.props.showCreateAlertBtn&&f.createElement(wo,{style:{marginTop:"10px"},type:"primary",onClick:o.showEditDataAlertModal},"Create Data Alert")),o.renderEditDataAlertModal(),o.renderDataAlertsManagerModal()))})),o.COMPONENT_KEY=C(),o.MODAL_COMPONENT_KEY=C(),o.NOTIFICATION_FETCH_LIMIT=10,o.TOOLTIP_ID="react-autoql-notification-tooltip",o.notificationRefs={},o.state={isFetchingFirstNotifications:!0,isDataAlertsManagerOpen:!1,unFetchedNotifications:0,notificationList:[],isFetching:!1,isDeleting:!1,pagination:{}},o}return pn(n)}();ts=os,mn(os,"propTypes",{authentication:nr,onCollapseCallback:b.func,onExpandCallback:b.func,showNotificationDetails:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,onDismissCallback:b.func,onDeleteCallback:b.func,onChange:b.func,autoChartAggregations:b.bool,showCreateAlertBtn:b.bool,enableAjaxTableData:b.bool,onModalOpen:b.func,shouldRender:b.bool,onDataAlertChange:b.func,tooltipID:b.string}),mn(os,"defaultProps",{authentication:Mo,showDataAlertsManager:!1,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,enableAjaxTableData:!1,shouldRender:!0,tooltipID:ts.TOOLTIP_ID,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onModalOpen:function(){},onUnreadCallback:function(){},onDataAlertChange:function(){},onChange:function(){}});var as=Ga(os),rs=new Yt({en:{introPrompt:"Some things you can ask me: ",use:"Use",dataExplorer:"Data Explorer",exploreQueries:"Explore Queries",explorePrompt:"to further explore the possibilities.",run:"We run on AutoQL by Chata.ai",queryPrompt:"Type your queries here ",seeMore:"See more",dataMessengerOptions:"Options menu",openFilterLocking:"Manage Filters",closeFilterLocking:"Close filter menu",filterLockingTitle:"Filter Locking",noFiltersLocked:"No Filters are locked yet",clearQueriesTooltip:"Clear queries",clearDataResponses:"Clear all queries & responses?",closeDataMessenger:"Close Data Messenger",maximizeDataMessenger:"Full Screen",minimizeDataMessenger:"Exit Full Screen",searchQueries:"Search relevant queries by topic",discoverPrompt:"Discover what you can ask by entering a topic in the search bar above. Simply click on any of the returned options to run the query in Data Messenger.",reportAProblem:"Report a problem",deleteDataResponse:"Delete data response",table:"Table",barChart:"Bar Chart",columnChart:"Column Chart",lineChart:"Line Chart",pieChart:"Pie Chart",heatMap:"Heat Map",bubbleChart:"Bubble Chart",stackedColumnChart:"Stacked Column Chart",stackedBarChart:"Stacked Bar Chart",stackedAreaChart:"Stacked Area Chart",downloadAsPNG:"Download as a PNG",filterTable:"Filter table",showHideColumns:"Show/hide columns",downloadAsCSV:"Download as a CSV",copyTableToClipboard:"Copy table to clipboard",notifications:"Notifications",filterColumn:"Filter column",columnName:"Column Name",visibility:"Visibility",cancel:"Cancel",apply:"Apply",education:"Education"},sp:{introPrompt:"Cosas que puedes preguntarme:",use:"Utiliza",dataExplorer:"Explorador de datos",exploreQueries:"Explorar Consultas",explorePrompt:"para ampliar las posibilidades.",run:"Corremos en AutoQL de Chata.ai",queryPrompt:"Escribe tus consultas aquí",seeMore:"Ver más",dataMessengerOptions:"Menú de opciones",openFilterLocking:"Administrar filtros",closeFilterLocking:"Cerrar menú de filtrar",filterLockingTitle:"Menú de Filtro",noFiltersLocked:"Ningún filtro está bloqueado todavía",clearQueriesTooltip:"Borrar todas las consultas",clearDataResponses:"¿Borrar todas las consultas y respuestas?",closeDataMessenger:"Cerrar Data mesenger",maximizeDataMessenger:"Pantalla completa",minimizeDataMessenger:"Salir de pantalla completa",searchQueries:"Buscar consultas relevantes por tema",discoverPrompt:"Descubre lo que puede preguntar ingresando un tema en la barra de búsqueda de arriba. Da clic en cualquiera de las opciones devueltas para ejecutar la consulta en Data Messenger.",reportAProblem:"Informar de un problema",deleteDataResponse:"Eliminar respuesta de datos",table:"Tabla",barChart:"Gráfico de barras",columnChart:"Gráfico de columnas",lineChart:"Gráfico de linea",pieChart:"Gráfico circular",heatMap:"Mapa de calor",bubbleChart:"Gráfico de burbujas",stackedColumnChart:"Gráfico de columnas apiladas",stackedBarChart:"Gráfico de barras apiladas",stackedAreaChart:"Gráfico de área apilada",downloadAsPNG:"Descargar como PNG",filterTable:"Tabla de filtros",showHideColumns:"Mostrar/ocultar columnas",downloadAsCSV:"Descargar como CSV",copyTableToClipboard:"Copiar tabla al portapapelas",notifications:"Notificaciones",filterColumn:"Columna de filtro",columnName:"Nombre de columna",visibility:"Visibilidad",cancel:"Cancelar",apply:"Aplicar",education:"Educación"}}),is=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.state.filters&&a.props.onChange(a.state.filters),a.props.isOpen&&a.props.insertedFilter&&a.insertFilter(a.props.insertedFilter),Co()})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.initialFilters&&!e.initialFilters&&(a.setState({filters:a.props.initialFilters}),Co()),n(a.state.filters,t.filters)||(a.props.onChange(a.state.filters),Co()),!a.props.isOpen&&e.isOpen?a.setState({inputValue:""}):a.props.isOpen&&!e.isOpen&&Co(),(a.props.isOpen&&!e.isOpen&&a.props.insertedFilter||a.props.insertedFilter&&!e.insertedFilter)&&a.insertFilter(a.props.insertedFilter)})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.focusInputTimeout),clearTimeout(a.highlightFilterEndTimeout),clearTimeout(a.highlightFilterStartTimeout),clearTimeout(a.savingIndicatorTimeout),clearTimeout(a.autocompleteTimer)})),mn(Cn(a),"showSavingIndicator",(function(){a.savingIndicatorTimeout&&clearTimeout(a.savingIndicatorTimeout),a.setState({isSaving:!0}),a.savingIndicatorTimeout=setTimeout((function(){a.setState({isSaving:!1})}),1500)})),mn(Cn(a),"animateInputTextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length)for(var t=500/e.length,n=function(n){setTimeout((function(){a._isMounted&&(a.setState({inputValue:e.slice(0,n+1)}),n===e.length-1&&(a.focusInputTimeout=setTimeout((function(){var e;a.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=a.inputElement)||void 0===e||e.focus()}),300)))}),n*t)},o=0;o<e.length;o++)n(o)})),mn(Cn(a),"insertFilter",(function(e){var t=a.findFilter({filterText:e});e&&t?a.handleHighlightFilterRow(a.getKey(t)):a.animateInputTextAndSubmit(e)})),mn(Cn(a),"getAllFilters",(function(){return a.state.filters})),mn(Cn(a),"getPersistedFilters",(function(){return S(a.state.filters.filter((function(e){return!e.isSession})))})),mn(Cn(a),"findFilter",(function(e){var t=e.filterText,n=e.value,o=e.key,r=a.state.filters;return n&&o?r.find((function(e){return e.key===o&&e.value===n})):t?r.find((function(e){return e.value===t})):void 0})),mn(Cn(a),"getTimeLeft",(function(e){return e?Math.ceil((e._idleStart+e._idleTimeout-Date.now())/1e3):0})),mn(Cn(a),"fetchSuggestions",(function(e){var t,n=e.value;a.axiosSource&&a.axiosSource.cancel(lr.CANCELLED),a.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),Ye(an(an({},_o(a.props.authentication)),{},{suggestion:n,cancelToken:a.axiosSource.token})).then((function(e){var t,n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,r=[];a.autoCompleteArray=[],n=o.matches;for(var i=0;i<n.length;i++)r.push(n[i]);r.sort((function(e,t){var n,o,a=null!==(n=e.format_txt)&&void 0!==n?n:e.keyword,r=null!==(o=t.format_txt)&&void 0!==o?o:t.keyword;return a.toUpperCase()<r.toUpperCase()?-1:a>r?1:0}));for(var l=0;l<r.length;l++){var s={name:r[l]};a.autoCompleteArray.push(s)}a.setState({suggestions:a.autoCompleteArray,isLoadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&console.error(e),a.setState({isLoadingAutocomplete:!1})}))})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;a.setState({isLoadingAutocomplete:!0}),a.axiosSource?(clearTimeout(a.autocompleteTimer),a.autocompleteStart=Date.now(),a.autocompleteTimer=setTimeout((function(){a.fetchSuggestions({value:t})}),a.autocompleteDelay)):a.fetchSuggestions({value:t})})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),mn(Cn(a),"createNewFilterFromSuggestion",(function(e){var t="include",n=a.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,format_txt:e.format_txt,show_message:e.show_message,key:e.canonical,filter_type:t}})),mn(Cn(a),"setFilterTypes",(function(e,t){var n=_o(a.props.authentication),o=e.filter((function(e){return!e.isSession}));return null!=o&&o.length?(a.showSavingIndicator(),ft(an(an({},n),{},{filters:o})).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.data,o=a.state.filters.map((function(e){var t=n.find((function(t){return a.getKey(e)===a.getKey(t)}));return t||e}));return a.setState({filters:o}),Promise.resolve(e)})).catch((function(e){return console.error(e),a.setState({filters:t,isSaving:!1}),jt.error("Something went wrong. Please try again."),Promise.reject()}))):Promise.resolve()})),mn(Cn(a),"setFilter",(function(e){var t;if(null!=e&&e.value){var n=null!==(t=a.props.authentication)&&void 0!==t?t:{};return a.showSavingIndicator(),ft(an(an({},n),{},{filters:[e]})).then((function(t){var n,o=null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.data;if(null==o||!o.length)throw new Error("No filters in the api response");var r=o.find((function(t){return a.getKey(t)===a.getKey(e)}));if(!r)throw new Error("Filter not found in the api response");if(a.findFilter(e)){var i=a.state.filters.map((function(e){return a.getKey(e)===a.getKey(r)?r:e}));a.setState({filters:i})}else a.setState({filters:[].concat(Tn(a.state.filters),[r]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),jt.error("Something went wrong. Please try again."),Promise.reject()}))}})),mn(Cn(a),"unsetFilter",(function(e){try{a.showSavingIndicator();var t=_o(a.props.authentication);return gt(an(an({},t),{},{filter:e}))}catch(e){return console.error(e),jt.error("Something went wrong. Please try again."),Promise.reject(e)}})),mn(Cn(a),"getSuggestionValue",(function(e){var t=e.name;return a.createNewFilterFromSuggestion(t)})),mn(Cn(a),"handlePersistToggle",function(){var e=cn(rn().mark((function e(t){var n,o,r;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.state.filters,o=an(an({},t),{},{isSession:!t.isSession,id:void 0}),r=a.state.filters.map((function(e){return a.getKey(e)===a.getKey(t)?o:e})),a.setState({filters:r}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,a.setFilter(o);case 8:e.next=12;break;case 10:return e.next=12,a.unsetFilter(t);case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),a.setState({filters:n});case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(a),"handleExcludeToggle",(function(e,t){var n;if(t){var o=null===(n=a.state.filters)||void 0===n||null===(n=n.find((function(t){return t.show_message===e})))||void 0===n||null===(n=n.filter_type)||void 0===n?void 0:n.toUpperCase();if(t!==o)try{var r=a.state.filters.map((function(n){return n.show_message===e?an(an({},n),{},{filter_type:t.toLowerCase()}):n})),i=r.filter((function(t){return t.show_message===e}));a.setFilterTypes(i,S(a.state.filters)),a.setState({filters:r})}catch(e){console.error(e)}}})),mn(Cn(a),"removeFilter",function(){var e=cn(rn().mark((function e(t){var n,o;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.state.filters,o=a.state.filters.filter((function(e){return a.getKey(e)!==a.getKey(t)})),a.setState({filters:o}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,a.unsetFilter(t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),a.setState({filters:n});case 13:Eo();case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(a),"onInputChange",(function(e,t){var n,o=t.newValue,r=t.method;"up"!==r&&"down"!==r&&("enter"!==r&&"click"!==r||(a.findFilter(o)?a.handleHighlightFilterRow(a.getKey(o)):a.setFilter(o)),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&a.setState({inputValue:e.target.value}))})),mn(Cn(a),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),mn(Cn(a),"renderSavingIndicator",(function(){return f.createElement("div",{className:"filter-locking-saving-indicator ".concat(a.state.isSaving?"visible":"hidden"),"data-test":"filter-locking-saving-indicator"},"Saving...")})),mn(Cn(a),"renderTitle",(function(){var e;return f.createElement("div",{className:"react-autoql-filter-locking-title"},f.createElement("h3",null,f.createElement("span",null,rs.filterLockingTitle),f.createElement(Wn,{type:"info","data-place":"bottom","data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:a.TOOLTIP_ID,"data-tip":"Filters can be applied to narrow down your query results. Locking a filter ensures that only the specific data you wish to see is returned."})))})),mn(Cn(a),"renderHeader",(function(){return f.createElement("div",{className:"filter-lock-menu-header"},a.renderTitle(),a.renderCloseBtn())})),mn(Cn(a),"renderCloseBtn",(function(){return f.createElement("div",{className:"filter-locking-close-and-saving-container"},a.renderSavingIndicator(),f.createElement(wo,{onClick:a.props.onClose,className:"filter-locking-close-btn",border:!1,size:"small"},f.createElement(Wn,{type:"close"})))})),mn(Cn(a),"renderSuggestion",(function(e){var t,n,o=e.name,r=null!==(t=o.format_txt)&&void 0!==t?t:o.keyword;return r?f.createElement("ul",{className:"filter-lock-suggestion-item","data-for":null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-delay-show":800,"data-tip":"".concat(r," <em>(").concat(o.show_message,")</em>")},f.createElement("span",null,r," ",f.createElement("em",null,"(",o.show_message,")"))):null})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children;e.query;var r=150,i=null===(t=a.filterListContainerRef)||void 0===t?void 0:t.clientHeight;return isNaN(i)||(r=i-20),f.createElement("div",n,f.createElement("div",{className:"react-autoql-filter-suggestion-container"},f.createElement(Po,{autoHeight:!0,autoHeightMin:0,maxHeight:r},o)))})),mn(Cn(a),"getSuggestions",(function(){var e,t,n=[],o=!a.state.isLoadingAutocomplete,r=!(null===(e=a.state.suggestions)||void 0===e||!e.length)&&o,i=!(null!==(t=a.state.suggestions)&&void 0!==t&&t.length)&&o;return r?n.push({title:'Related to "'.concat(a.state.inputValue,'"'),suggestions:a.state.suggestions}):i&&n.push({title:'Related to "'.concat(a.state.inputValue,'"'),suggestions:[{name:""}],emptyState:!0}),n})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title),e.emptyState?f.createElement("div",{className:"filter-locking-no-suggestions-text"},f.createElement("em",null,"No results")):null)})),mn(Cn(a),"renderVLInput",(function(){var e;return f.createElement(Kt,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:a.getSuggestions(),renderSuggestion:a.renderSuggestion,getSuggestionValue:a.getSuggestionValue,onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,renderSuggestionsContainer:a.renderSuggestionsContainer,getSectionSuggestions:function(e){return e.suggestions},renderSectionTitle:a.renderSectionTitle,multiSection:!0,inputProps:(e={onChange:a.onInputChange,value:a.state.inputValue,disabled:a.props.isFetchingFilters||a.state.isFetchingFilters,placeholder:"Search & select a filter"},mn(e,"data-test","react-autoql-filter-locking-input"),mn(e,"className","react-autoql-filter-locking-input"),mn(e,"id","react-autoql-filter-menu-input"),e)})})),mn(Cn(a),"renderFilterListCategory",(function(e,t){return f.createElement("div",{key:e,className:"react-autoql-filter-list-item-container"},a.renderFilterListCategoryHeader(e,t),f.createElement("div",{className:"react-autoql-filter-list"},a.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return a.renderFilterListItem(e)}))))})),mn(Cn(a),"renderFilterListCategoryHeader",(function(e,t){var n,o,r,i,l=null===(n=a.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return f.createElement("div",{className:"react-autoql-filter-list-title"},f.createElement("div",{className:"filter-name-column"},f.createElement("h4",{className:"filter-lock-category-title","data-for":null!==(o=a.props.tooltipID)&&void 0!==o?o:a.TOOLTIP_ID,"data-delay-show":800,"data-tip":e},e),f.createElement(Dl,{className:"include-exclude-toggle-group",options:["INCLUDE","EXCLUDE"],"data-test":"include-exclude-toggle-group",tooltips:["Only show results <strong>with</strong> these values","Show results <strong>without</strong> these values"],tooltipId:null!==(r=a.props.tooltipID)&&void 0!==r?r:a.TOOLTIP_ID,value:l,type:"button",onChange:function(t){return a.handleExcludeToggle(e,t)}})),0===t?f.createElement("div",{className:"persist-toggle-column"},f.createElement("h4",null,"Persist"),f.createElement(Wn,{type:"info","data-place":"left","data-for":null!==(i=a.props.tooltipID)&&void 0!==i?i:a.TOOLTIP_ID,"data-tip":" Persistent filters remain locked at all<br /> times, unless the filter is removed. If<br /> unchecked, the filter will be locked<br /> until you end your browser session."})):null)})),mn(Cn(a),"renderFilterListItem",(function(e){var t,n,o=a.getKey(e);return f.createElement("div",{key:o,"data-test":"react-autoql-filter-list-item",className:"react-autoql-filter-list-item ".concat(a.state.highlightedFilter===o?"react-autoql-highlight-row":""," ").concat(Pe?"mobile":"")},f.createElement("div",{className:"react-autoql-filter-list-item-filter"},null!==(t=e.format_txt)&&void 0!==t?t:e.value),f.createElement("div",{className:"react-autoql-filter-list-item-actions"},f.createElement(Ii,{className:"persist-toggle","data-test":"react-autoql-filter-lock-persist-toggle",type:"switch",checked:!e.isSession,onChange:function(){return a.handlePersistToggle(e)}}),f.createElement(Wn,{className:"react-autoql-remove-filter-icon","data-test":"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-delay-show":500,type:"trash",onClick:function(){return a.removeFilter(e)}})))})),mn(Cn(a),"renderFilterList",(function(){var e;if(a.props.isFetchingFilters||a.state.isFetchingFilters)return f.createElement("div",{className:"react-autoql-filter-lock-list-loading-container"},f.createElement(Xa,null));if(null===(e=a.state.filters)||void 0===e||!e.length)return f.createElement("div",{className:"react-autoql-empty-filter-list"},f.createElement("i",null,rs.noFiltersLocked));var t=Tn(new Set(a.state.filters.map((function(e){return e.show_message}))));return f.createElement("div",{ref:function(e){return a.filterListContainerRef=e},className:"react-autoql-filter-list-container"},f.createElement(Po,null,t.map((function(e,t){return a.renderFilterListCategory(e,t)}))))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement(Wt,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:Gt,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1}),!a.props.tooltipID&&f.createElement(So,{afterShow:function(e){return handleTooltipBoundaryCollision(e,Cn(a))},className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),f.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},a.renderHeader(),a.renderVLInput(),a.renderFilterList()))})),a.contentKey=C(),a.autoCompleteArray=[],a.autocompleteDelay=100,a.TOOLTIP_ID="filter-locking-tooltip",a.state={filters:a.props.initialFilters||[],suggestions:[],inputValue:""},a}return pn(o,[{key:"handleHighlightFilterRow",value:function(e){var t=this;jt.info("This filter has already been applied.");this.highlightFilterStartTimeout=setTimeout((function(){t.setState({highlightedFilter:e})}),0),this.highlightFilterEndTimeout=setTimeout((function(){t.setState({highlightedFilter:void 0})}),1300)}}]),o}();mn(is,"propTypes",{authentication:nr,isOpen:b.bool,onClose:b.func,onChange:b.func,insertedFilter:b.string}),mn(is,"defaultProps",{authentication:Mo,insertedFilter:null,isOpen:!1,onClose:function(){},onChange:function(){}});var ls=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{insertedFilter:null}),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.initialize()})),mn(Cn(e),"componentDidUpdate",(function(t){!e.props.isOpen&&t.isOpen?e.setState({insertedFilter:null}):e.props.isOpen&&!t.isOpen&&Co()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1})),mn(Cn(e),"initialize",(function(){e.setState({isFetchingFilters:!0}),vt(_o(e.props.authentication)).then((function(t){var n,o=(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.data)||[];e.props.onChange(o),e._isMounted&&e.setState({initialFilters:o,isFetchingFilters:!1})})).catch((function(t){console.error(t),e._isMounted&&e.setState({isFetchingFilters:!1})}))})),mn(Cn(e),"onChange",(function(t){e.props.onChange(t),e.setState({initialFilters:t})})),mn(Cn(e),"insertFilter",(function(t){e.setState({insertedFilter:t})})),mn(Cn(e),"renderContent",(function(){var t;return f.createElement(is,{authentication:e.props.authentication,isOpen:e.props.isOpen,onClose:e.props.onClose,onChange:e.onChange,containerRef:e.containerRef,insertedFilter:e.state.insertedFilter,initialFilters:e.state.initialFilters,isFetchingFilters:e.state.isFetchingFilters,tooltipID:null!==(t=e.props.tooltipID)&&void 0!==t?t:e.TOOLTIP_ID})})),mn(Cn(e),"render",(function(){return f.createElement(Xn,{containerClassName:"filter-lock-popover".concat(Pe?" filter-lock-popover-mobile":""),onClickOutside:e.props.onClose,positions:e.props.positions,isOpen:e.props.isOpen,align:e.props.align,parentElement:e.props.parentElement,boundaryElement:e.props.boundaryElement,content:e.renderContent(),boundaryInset:10,showArrow:!0},e.props.children||f.createElement("div",{style:{display:"none"}}))})),e}return pn(n)}();mn(ls,"propTypes",{authentication:nr,isOpen:b.bool,position:b.string,align:b.string,onClose:b.func,onChange:b.func}),mn(ls,"defaultProps",{authentication:Mo,isOpen:!1,position:"bottom",align:"center",onClose:function(){},onChange:function(){}});var ss=Ga(ls),cs=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidUpdate",(function(t){e.props.finalTranscript!==t.finalTranscript?e.props.onFinalTranscript(e.props.finalTranscript):e.props.transcript!==t.transcript?e.props.onTranscriptChange(e.props.transcript):e.props.interimTranscript!==t.interimTranscript&&e.props.onTranscriptChange(e.props.interimTranscript)})),mn(Cn(e),"onMouseDown",(function(){Eo(),e.props.onTranscriptStart(),e.props.startListening()})),mn(Cn(e),"render",(function(){var t,n=e.props;n.transcript,n.interimTranscript,n.resetTranscript;var o=n.browserSupportsSpeechRecognition;n.startListening;var a=n.stopListening,r=n.listening;return o?f.createElement(Rn,null,f.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(r?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":null!==(t=e.props.tooltipID)&&void 0!==t?t:"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},f.createElement(Wn,{type:"microphone"})),!e.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return pn(n)}();mn(cs,"propTypes",{transcript:b.string,interimTranscript:b.string,finalTranscript:b.string,resetTranscript:b.func,browserSupportsSpeechRecognition:b.bool,startListening:b.func,stopListening:b.func,listening:b.bool,onTranscriptChange:b.func,onFinalTranscript:b.func,onTranscriptStart:b.func}),mn(cs,"defaultProps",{onTranscriptStart:function(){},onTranscriptChange:function(){},onFinalTranscript:function(){}});var us=Jt({autoStart:!1,continuous:!1})(cs),ds=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,document.addEventListener("keydown",a.onEscKeypress)})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){return(!a.props.isResizing||!e.isResizing)&&(!Ma(a.props,e)||!Ma(a.state,t))})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.inputValue!==e.inputValue&&a.setState({inputValue:a.props.inputValue}),!a.state.inputValue||t.inputValue||a.userSelectedSuggestion||a.setState({suggestions:[]})})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.queryValidationTimer),clearTimeout(a.caretMoveTimeout),document.removeEventListener("keydown",a.onEscKeypress)})),mn(Cn(a),"onEscKeypress",(function(e){"Escape"===e.key&&(!(e.ctrlKey||e.altKey||e.shiftKey)&&a.cancelQuery())})),mn(Cn(a),"animateInputTextAndSubmit",(function(e){var t=e.query,n=e.userSelection,o=e.source,r=e.skipQueryValidation,i=e.scope;Pa({text:t,inputRef:a.inputRef,callback:function(){a.submitQuery({queryText:t,userSelection:n,skipQueryValidation:null==r||r,source:o,scope:i})}})})),mn(Cn(a),"submitDprQuery",(function(e,t){var n,o;(function(e){var t,n=e.query,o=e.dprKey,a=e.dprDomain,r=e.sessionId,i="".concat(a||"https://autoae-api-staging.chata.io","/api/v1/query?key=").concat(o),l={query:n};r||console.warn("No session ID was supplied to DPR. Using a randomly generated UUID instead");var s={headers:(t={},mn(t,"AutoAE-Referer-URL",window.location.origin),mn(t,"AutoAE-Session-ID",r||C()),t)};return E.post(i,l,s)})({dprKey:null===(n=a.props.authentication)||void 0===n?void 0:n.dprKey,dprDomain:null===(o=a.props.authentication)||void 0===o?void 0:o.dprDomain,query:e,sessionId:a.props.sessionId}).then((function(n){return a.onResponse(n,e,t)})).catch((function(n){console.error(n),a.onResponse(n,e,t)}))})),mn(Cn(a),"onResponse",(function(e,t,n){var o;a.props.onResponseCallback(e,t,n);var r={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(o=a.state)||void 0===o?void 0:o.lastQuery)};a._isMounted&&a.setState(r)})),mn(Cn(a),"cancelQuery",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"submitQuery",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryText,o=t.userSelection,r=t.skipQueryValidation,i=t.source,l=n||a.state.inputValue;if(l){a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer);var s={isQueryRunning:!0,suggestions:[],queryHistoryIndex:-1,queryValidationResponse:void 0,queryValidationComponentId:C()};a.props.clearQueryOnSubmit&&(s.inputValue=""),a._isMounted&&a.setState(s),a.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source();var c=an(an(an({query:l,userSelection:o},_o(a.props.authentication)),zo(a.props.autoQLConfig)),{},{source:Va(a.props.source,null!=i?i:"user"),scope:a.props.scope,AutoAEId:a.props.AutoAEId,filters:a.props.queryFilters,pageSize:a.props.dataPageSize,cancelToken:a.axiosSource.token});if(l.trim()){var u,d,p=C();a.props.onSubmit(l,p),a.addQueryToHistory(l),null!==(u=a.props.authentication)&&void 0!==u&&u.token||null===(d=a.props.authentication)||void 0===d||!d.dprKey?r?je(c).then((function(e){return a.onResponse(e,l,p)})).catch((function(e){var t=e||{error:ir.GENERAL_QUERY};a.onResponse(t,l,p)})):ht(c).then((function(e){return a.onResponse(e,l,p)})).catch((function(e){var t=e||{error:ir.GENERAL_QUERY};a.onResponse(t,l,p)})):a.submitDprQuery(l,p)}}})),mn(Cn(a),"onTranscriptStart",(function(){a.setState({listeningForTranscript:!0})})),mn(Cn(a),"onTranscriptChange",(function(e){a.setState({inputValue:e})})),mn(Cn(a),"onFinalTranscript",(function(e){a.setState({inputValue:e,listeningForTranscript:!1},(function(){a.focus(),Eo()}))})),mn(Cn(a),"setInputRef",(function(e){a.inputRef=e})),mn(Cn(a),"getQueryHistory",(function(){try{var e=localStorage.getItem(a.queryHistoryId);if(!e)return[];var t=JSON.parse(e);return(null==t?void 0:t.constructor)!==Array|!(null!=t&&t.length)?[]:t}catch(e){return console.error(e),[]}})),mn(Cn(a),"addQueryToHistory",(function(e){try{var t=a.getQueryHistory().filter((function(t){return t!==e}));t.unshift(e),t.length>a.MAX_QUERY_HISTORY&&(t=t.slice(0,a.MAX_QUERY_HISTORY)),localStorage.setItem(a.queryHistoryId,JSON.stringify(t))}catch(e){console.error(e)}})),mn(Cn(a),"onKeyDown",(function(e){if("ArrowUp"===e.key||"ArrowDown"===e.key){var t;if(a.userSelectedSuggestion||null!==(t=a.state.suggestions)&&void 0!==t&&t.length)return e;var n="",o=a.getQueryHistory(),r=a.state.queryHistoryIndex;"ArrowUp"===e.key&&o[r+1]?r+=1:"ArrowDown"===e.key&&r>=0&&(r-=1),-1!==r&&(n=o[r]),void 0!==n&&n!==a.state.inputValue?a.setState({inputValue:n,queryHistoryIndex:r},a.moveCaretAtEnd):a.moveCaretAtEnd()}else a.userSelectedSuggestion=!1;return e})),mn(Cn(a),"onKeyPress",(function(e){"Enter"==e.key&&a.submitQuery()})),mn(Cn(a),"focus",(function(){var e;null!==(e=a.inputRef)&&void 0!==e&&e.focus&&a.inputRef.focus()})),mn(Cn(a),"userSelectedSuggestionHandler",(function(e){e&&a._isMounted&&e.name&&(a.userSelectedValue=e.name,a.userSelectedSuggestion=!0,a.setState({inputValue:e.name}))})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&(a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer),a.autoCompleteTimer=setTimeout((function(){Ke(an({suggestion:t},_o(a.props.authentication))).then((function(e){var t;if(a.state.inputValue){var n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,r=[];a.autoCompleteArray=[],n=o.matches;for(var i=0;i<n.length&&(r.push(n[i]),4!==i);i++);r.sort((function(e,t){return t.length-e.length}));for(var l=0;l<r.length;l++){var s={name:r[l]};a.autoCompleteArray.push(s)}a.setState({suggestions:a.autoCompleteArray})}})).catch((function(e){console.error(e)}))}),300))})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t=e.containerProps,n=e.children;return f.createElement("div",t,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},n))})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title))})),mn(Cn(a),"getSectionSuggestions",(function(e){return e.suggestions})),mn(Cn(a),"getSuggestions",(function(){var e;return[{title:(null===(e=a.state.suggestions)||void 0===e?void 0:e.find((function(e){return e.fromHistory})))?"Recent":"",suggestions:a.state.suggestions}]})),mn(Cn(a),"onInputChange",(function(e){var t,n;if(a.state.listeningForTranscript)e.stopPropagation();else{var o=null==e||null===(t=e.target)||void 0===t?void 0:t.value;if(zo(a.props.autoQLConfig).enableAutocomplete){if(!(a.userSelectedSuggestion||null!==(n=a.state.suggestions)&&void 0!==n&&n.length)||"ArrowUp"!==e.key&&"ArrowDown"!==e.key)if("Enter"!==e.key){var r={};a.props.isBackButtonClicked?r.inputValue="":r.inputValue=o||""===o?o:a.userSelectedValue,o||"Backspace"!==e.key&&"Delete"!==e.key||(r.suggestions=a.getQueryHistory()),a.setState(r)}else a.setState({inputValue:o},(function(){return a.submitQuery()}))}else a.setState({inputValue:o})}})),mn(Cn(a),"showQueryHistorySuggestions",(function(){if(!a.state.inputValue){var e,t=null===(e=a.getQueryHistory())||void 0===e?void 0:e.map((function(e){return{name:e,fromHistory:!0}})).reverse();a.setState({suggestions:t})}})),mn(Cn(a),"moveCaretAtEnd",(function(e){clearTimeout(a.caretMoveTimeout),a.caretMoveTimeout=setTimeout((function(){try{var e,t,n=null===(e=a.inputRef)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.length;null===(t=a.inputRef)||void 0===t||t.setSelectionRange(n,n)}catch(e){}}),0)})),mn(Cn(a),"render",(function(){var e={ref:a.setInputRef,id:a.UNIQUE_ID,className:"".concat(a.UNIQUE_ID," react-autoql-query-input react-autoql-chatbar-input").concat(a.props.showChataIcon?" left-padding":""),placeholder:a.props.placeholder,disabled:a.props.isDisabled,onChange:a.onInputChange,onKeyPress:a.onKeyPress,onKeyDown:a.onKeyDown,value:a.state.inputValue,onFocus:a.moveCaretAtEnd,onBlur:function(){return a.setState({suggestions:[]})},onClick:a.showQueryHistorySuggestions,spellCheck:!1,autoFocus:!0,autoComplete:"one-time-code"};return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-bar-container ".concat(a.props.className," ").concat("below"===a.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},f.createElement("div",{className:"react-autoql-chatbar-input-container"},zo(a.props.autoQLConfig).enableAutocomplete?f.createElement(Kt,{onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,renderSuggestionsContainer:a.renderSuggestionsContainer,getSuggestionValue:a.userSelectedSuggestionHandler,getSectionSuggestions:a.getSectionSuggestions,renderSectionTitle:a.renderSectionTitle,suggestions:a.getSuggestions(),multiSection:!0,shouldRenderSuggestions:function(){return!a.props.isDisabled},ref:function(e){return a.autoSuggest=e},renderSuggestion:function(e){return f.createElement(h,null,null==e?void 0:e.name)},inputProps:e}):f.createElement("input",e)),a.props.showChataIcon&&f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})),a.props.showLoadingDots&&a.state.isQueryRunning&&f.createElement("div",{className:"input-response-loading-container"},f.createElement(Xa,null)),!Pe&&a.props.enableVoiceRecord&&f.createElement(us,{onTranscriptStart:a.onTranscriptStart,onTranscriptChange:a.onTranscriptChange,onFinalTranscript:a.onFinalTranscript,authentication:a.props.authentication,tooltipID:a.props.tooltipID})))})),a.UNIQUE_ID=C(),a.MAX_QUERY_HISTORY=5,a.queryHistoryId="query-history-".concat(null===(o=e.authentication)||void 0===o?void 0:o.domain),a.autoCompleteTimer=void 0,a.autoCompleteArray=[],a.state={inputValue:"",lastQuery:"",queryHistoryIndex:-1,wasInputClicked:!1,suggestions:[],isQueryRunning:!1,listeningForTranscript:!1},a}return pn(n)}();mn(ds,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,enableVoiceRecord:b.bool,isDisabled:b.bool,onSubmit:b.func,onResponseCallback:b.func,className:b.string,autoCompletePlacement:b.string,showLoadingDots:b.bool,showChataIcon:b.bool,inputValue:b.string,queryFilters:b.arrayOf(b.shape({})),placeholder:b.string,clearQueryOnSubmit:b.bool,sessionId:b.string,dataPageSize:b.number,shouldRender:b.bool}),mn(ds,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:null,queryFilters:void 0,clearQueryOnSubmit:!0,placeholder:"Type your queries here",dataPageSize:void 0,shouldRender:!0,onSubmit:function(){},onResponseCallback:function(){}});var ps,ms=Ga(ds),fs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.props.scrollToBottom(),o.scrollToBottomTimeout=setTimeout((function(){o.props.scrollToBottom()}),100),o.setIsAnimating()})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){return(!o.props.isResizing||!e.isResizing)&&(!Ma(o.props,e)||!Ma(o.state,t))})),mn(Cn(o),"getSnapshotBeforeUpdate",(function(e,t){var n,a=!1;return o.ref&&(!o.props.isResizing&&e.isResizing&&(a=!0,n=o.ref.clientWidth),o.props.isResizing&&!e.isResizing&&(a=!0,n="")),{messageWidth:n,shouldUpdateWidth:a}})),mn(Cn(o),"componentDidUpdate",(function(e,t,n){var a,r=n.messageWidth;n.shouldUpdateWidth&&null!==(a=o.ref)&&void 0!==a&&a.style&&(o.ref.style.width=r)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.scrollToBottomTimeout),clearTimeout(o.animationTimeout)})),mn(Cn(o),"setIsAnimating",(function(){if(!o.state.isAnimatingMessageBubble)return o.setState({isAnimatingMessageBubble:!0},(function(){o.clearIsAnimatingIn500ms()}));o.clearIsAnimatingIn500ms()})),mn(Cn(o),"clearIsAnimatingIn500ms",(function(){clearTimeout(o.animationTimeout),o.animationTimeout=setTimeout((function(){o.setState({isAnimatingMessageBubble:!1}),o.props.scrollToBottom()}),500)})),mn(Cn(o),"onCSVDownloadFinish",(function(e){var t,n=e.error,a=e.exportLimit,r=e.limitReached;if(n)return o.props.addMessageToDM({response:n});var i=null===(t=o.props.response)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text;o.props.addMessageToDM({content:f.createElement(f.Fragment,null,"Your file has successfully been downloaded with the query"," ",f.createElement("b",null,f.createElement("i",null,i)),".",r?f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("p",null,f.createElement("br",null),"WARNING: The file you’ve requested is larger than ",a,"MB. This exceeds the maximum download size and you will only receive partial data.")):null)})})),mn(Cn(o),"isScrolledIntoView",(function(e){if(o.props.scrollContainerRef){var t=o.props.scrollContainerRef.getScrollTop(),n=t+o.props.scrollContainerRef.getClientHeight(),a=e.offsetTop;return a+e.offsetHeight<=n&&a>=t}return!1})),mn(Cn(o),"scrollIntoView",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.delay,n=void 0===t?0:t,a=e.block,r=void 0===a?"end":a,i=e.inline,l=void 0===i?"nearest":i;e.behavior,setTimeout((function(){o.messageAndRTContainerRef&&!o.isScrolledIntoView(o.messageAndRTContainerRef)&&o.messageAndRTContainerRef.scrollIntoView({block:r,inline:l})}),n)})),mn(Cn(o),"updateDataConfig",(function(e){o.setState({dataConfig:e})})),mn(Cn(o),"renderFetchingFileMessage",(function(){return f.createElement("div",null,"Fetching your file ",f.createElement(Ro,null))})),mn(Cn(o),"renderCSVProgressMessage",(function(){return isNaN(o.state.csvDownloadProgress)?o.renderFetchingFileMessage():"Downloading your file ... ".concat(o.state.csvDownloadProgress,"%")})),mn(Cn(o),"renderContent",(function(){var e;return o.props.isCSVProgressMessage||void 0!==o.state.csvDownloadProgress?o.renderCSVProgressMessage():o.props.content?o.props.content:401===(null===(e=o.props.response)||void 0===e?void 0:e.status)?ir.UNAUTHENTICATED:o.props.response?f.createElement(bl,{ref:function(e){return o.responseRef=e},optionsToolbarRef:o.optionsToolbarRef,vizToolbarRef:o.vizToolbarRef,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,queryResponse:o.props.response,onSuggestionClick:o.props.onSuggestionClick,isQueryRunning:o.props.isChataThinking,copyToClipboard:o.copyToClipboard,tableOptions:o.props.tableOptions,dataFormatting:o.props.dataFormatting,appliedFilters:o.props.appliedFilters,onDrilldownStart:o.props.onDrilldownStart,onDrilldownEnd:o.props.onDrilldownEnd,demo:_o(o.props.authentication).demo,enableAjaxTableData:o.props.enableAjaxTableData,originalQueryID:o.props.originalQueryID,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),onErrorCallback:o.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isAnimating:o.state.isAnimatingMessageBubble,isResizing:o.props.isResizing,enableDynamicCharting:o.props.enableDynamicCharting,initialTableConfigs:o.state.dataConfig,onTableConfigChange:o.updateDataConfig,onNoneOfTheseClick:o.props.onNoneOfTheseClick,autoChartAggregations:o.props.autoChartAggregations,showQueryInterpretation:!1,enableFilterLocking:o.props.enableFilterLocking,onRTValueLabelClick:o.props.onRTValueLabelClick,source:o.props.source,scope:o.props.scope,onRowChange:o.scrollIntoView,onDisplayTypeChange:o.scrollIntoView,mutable:!1,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,showSuggestionPrefix:!1,dataPageSize:o.props.dataPageSize,popoverParentElement:o.props.popoverParentElement,reportProblemCallback:function(){var e,t;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=o.optionsToolbarRef)||void 0===t||t.openReportProblemModal())}}):ir.GENERAL_QUERY})),mn(Cn(o),"onCSVDownloadStart",(function(e){var t=e.id,n=e.queryId,a=e.query;o.props.addMessageToDM({id:t,query:a,queryId:n,content:o.renderFetchingFileMessage(),isCSVProgressMessage:!0})})),mn(Cn(o),"onDeleteMessage",(function(){return o.props.deleteMessageCallback(o.props.id)})),mn(Cn(o),"renderRightToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar right"},o.props.isResponse?f.createElement($l,{ref:function(e){return o.optionsToolbarRef=e},responseRef:o.responseRef,className:"chat-message-toolbar right",shouldRender:!o.props.isResizing&&o.props.shouldRender,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadFinish:o.onCSVDownloadFinish,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onSuccessAlert:o.props.onSuccessAlert,onErrorCallback:o.props.onErrorCallback,enableDeleteBtn:!o.props.isIntroMessage,popoverParentElement:o.props.popoverParentElement,deleteMessageCallback:o.onDeleteMessage,tooltipID:o.props.tooltipID,createDataAlertCallback:o.props.createDataAlertCallback,popoverAlign:"end"}):null)})),mn(Cn(o),"renderLeftToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar left"},o.props.isResponse&&"text"!==o.props.type?f.createElement(Cl,{ref:function(e){return o.vizToolbarRef=e},responseRef:o.responseRef,className:"chat-message-toolbar left",tooltipID:o.props.tooltipID,shouldRender:!o.props.isResizing&&o.props.shouldRender}):null)})),mn(Cn(o),"render",(function(){var e,t=!(null===(e=o.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||!e.parsed_interpretation);return f.createElement(Rn,null,f.createElement("div",{className:"chat-message-and-rt-container\n ".concat(o.props.isResponse?"response":"request","\n\t\t\t").concat(Pe?"pwa":"","\n ").concat("text"===o.props.type?"text":"","\n ").concat(o.props.isActive?"active":"","\n ").concat(o.props.disableMaxHeight||o.props.isIntroMessage?" no-max-height":""),ref:function(e){return o.messageAndRTContainerRef=e}},f.createElement("div",{id:"message-".concat(o.props.id),ref:function(e){return o.messageContainerRef=e},"data-test":"chat-message",className:"chat-single-message-container"},f.createElement("div",{ref:function(e){return o.ref=e},className:"chat-message-bubble"},f.createElement("div",{className:"chat-message-toolbars-container"},o.renderLeftToolbar(),o.renderRightToolbar()),o.renderContent())),t?f.createElement("div",{className:"chat-message-rt-container"},f.createElement(Xr,{authentication:o.props.authentication,onValueLabelClick:o.props.onRTValueLabelClick,queryResponse:o.responseRef.queryResponse,isResizing:o.props.isResizing,tooltipID:o.props.tooltipID})):null))})),o.filtering=!1,o.PIE_CHART_HEIGHT=330,o.MESSAGE_HEIGHT_MARGINS=40,o.MESSAGE_WIDTH_MARGINS=40,o.ORIGINAL_TABLE_MESSAGE_HEIGHT=void 0,o.state={csvDownloadProgress:o.props.initialCSVDownloadProgress,isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},o}return pn(n)}();mn(fs,"propTypes",(mn(ps={authentication:nr,autoQLConfig:ar,dataFormatting:or,isResponse:b.bool.isRequired,isIntroMessage:b.bool,isActive:b.bool,type:b.string,text:b.string,id:b.string.isRequired,onSuggestionClick:b.func,response:b.shape({}),content:b.oneOfType([b.string,b.shape({})]),enableColumnVisibilityManager:b.bool},"dataFormatting",or),mn(ps,"onErrorCallback",b.func),mn(ps,"onSuccessAlert",b.func),mn(ps,"isResizing",b.bool),mn(ps,"enableDynamicCharting",b.bool),mn(ps,"scrollToBottom",b.func),mn(ps,"onNoneOfTheseClick",b.func),mn(ps,"autoChartAggregations",b.bool),mn(ps,"onConditionClickCallback",b.func),mn(ps,"addMessageToDM",b.func),mn(ps,"csvDownloadProgress",b.number),mn(ps,"onRTValueLabelClick",b.func),mn(ps,"enableAjaxTableData",b.bool),mn(ps,"source",b.oneOfType([b.array,b.string])),mn(ps,"scope",b.string),mn(ps,"isVisibleInDOM",b.bool),ps)),mn(fs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,enableAjaxTableData:!1,isIntroMessage:!1,source:null,scope:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,onRTValueLabelClick:void 0,isVisibleInDOM:!0,onSuggestionClick:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){}});var gs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){var e;o._isMounted=!0,null!==(e=o.props.introMessages)&&void 0!==e&&e.length&&o.addIntroMessages(o.props.introMessages),o.props.shouldRender&&!Pe&&o.focusInput()})),mn(Cn(o),"componentDidUpdate",(function(e,t){var n;!o.props.shouldRender||e.shouldRender||Pe||o.focusInput(),null===(n=o.messengerScrollComponent)||void 0===n||n.update()})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.feedbackTimeout),clearTimeout(o.responseDelayTimeout)})),mn(Cn(o),"focusInput",(function(){var e;null!==(e=o.queryInputRef)&&void 0!==e&&e._isMounted&&o.queryInputRef.focus()})),mn(Cn(o),"scrollToBottom",(function(){var e;null===(e=o.messengerScrollComponent)||void 0===e||e.scrollToBottom()})),mn(Cn(o),"onCSVDownloadProgress",(function(e){var t,n=e.id,a=e.progress;o.csvProgressLog[n]=a,o.messageRefs[n]&&null!==(t=o.messageRefs[n])&&void 0!==t&&t._isMounted&&o.messageRefs[n].setState({csvDownloadProgress:a})})),mn(Cn(o),"clearMessages",(function(){var e;null===(e=o.queryInputRef)||void 0===e||e.cancelQuery(),o._isMounted&&o.setState({messages:o.getIntroMessages(o.props.introMessages),isClearingAllMessages:!0})})),mn(Cn(o),"animateInputTextAndSubmit",(function(){var e;if(null!==(e=o.queryInputRef)&&void 0!==e&&e._isMounted){for(var t,n=arguments.length,a=new Array(n),r=0;r<n;r++)a[r]=arguments[r];null===(t=o.queryInputRef)||void 0===t||t.animateInputTextAndSubmit.apply(t,a)}})),mn(Cn(o),"onNoneOfTheseClick",(function(){o.addRequestMessage("None of these"),o.setState({isQueryRunning:!0}),clearTimeout(o.feedbackTimeout),o.feedbackTimeout=setTimeout((function(){o._isMounted&&(clearTimeout(o.responseDelayTimeout),o.setState({isQueryRunning:!1,isInputDisabled:!1}),o.addResponseMessage({content:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")}))}),1e3)})),mn(Cn(o),"onDrilldownStart",(function(){o.state.isDrilldownRunning&&(o.keepLoading=!0),o.setState({isDrilldownRunning:!0,isInputDisabled:!0})})),mn(Cn(o),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error,a=e.originalQueryID;o._isMounted&&(o.keepLoading?o.keepLoading=!1:(clearTimeout(o.responseDelayTimeout),o.setState({isDrilldownRunning:!1,isInputDisabled:!1}),t?o.addResponseMessage({response:t,originalQueryID:a}):n&&o.addResponseMessage({content:n})))})),mn(Cn(o),"getIsSuggestionResponse",(function(e){var t;return!(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t||!t.items)})),mn(Cn(o),"deleteMessage",(function(e){var t,n=o.state.messages.findIndex((function(t){return e===t.id})),a=o.state.messages[n],r=[e];null!=a&&a.queryMessageID&&(r=null===(t=o.state.messages)||void 0===t?void 0:t.filter((function(e){return e.queryMessageID===a.queryMessageID})).map((function(e){return e.id})));var i=o.state.messages.filter((function(e){return!r.includes(e.id)}));o.setState({messages:i})})),mn(Cn(o),"getIntroMessages",(function(e){return e.map((function(e){return o.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),mn(Cn(o),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&o.addMessages(o.getIntroMessages(e))})),mn(Cn(o),"addMessage",(function(e){o.addMessages([e])})),mn(Cn(o),"addMessages",(function(e){var t=[].concat(Tn(o.state.messages),Tn(e));t.length>o.props.maxMessages&&(t=t.slice(-o.props.maxMessages)),o._isMounted&&o.setState({messages:t})})),mn(Cn(o),"addRequestMessage",(function(e,t){o.addMessage(o.createMessage({content:e,isResponse:!1,queryMessageID:t}))})),mn(Cn(o),"addResponseMessage",(function(){var e,t,n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a.isResponse=!0,"Unauthenticated"===(null==a||null===(e=a.response)||void 0===e?void 0:e.error))n=o.createErrorMessage(ir.UNAUTHENTICATED);else if("Parse error"===(null==a||null===(t=a.response)||void 0===t?void 0:t.error))n=o.createErrorMessage(ir.GENERAL_QUERY);else if(null!=a&&a.response||null!=a&&a.content){var r=o.getAppliedFilters(null==a?void 0:a.response);n=o.createMessage(an(an({},a),{},{appliedFilters:r}))}else n=o.createErrorMessage();n&&o.addMessage(n)})),mn(Cn(o),"onInputSubmit",(function(e,t){o.addRequestMessage(e,t),o.setState({isInputDisabled:!0}),o.responseDelayTimeout=setTimeout((function(){o.setState({isQueryRunning:!0})}),600)})),mn(Cn(o),"onResponse",(function(e,t,n){if(o._isMounted){var a,r;if(o.setState({isQueryRunning:!1,isInputDisabled:!1}),(null==e||null===(a=e.data)||void 0===a?void 0:a.message)===lr.CANCELLED&&o.state.isClearingAllMessages)return void o.setState({isClearingAllMessages:!1,isQueryRunning:!1,isDrilldownRunning:!1,isInputDisabled:!1});o.getIsSuggestionResponse(e)&&o.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:",queryMessageID:n}),Xt(null==e||null===(r=e.data)||void 0===r?void 0:r.data,"authorization_url")?o.addResponseMessage({content:f.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source.",f.createElement("a",{href:e.data.data.authorization_url,target:"_blank",rel:"noreferrer"},"Click here to authorize access then try querying again.")),queryMessageID:n}):o.addResponseMessage({response:e,query:t,queryMessageID:n}),clearTimeout(o.responseDelayTimeout),!Pe&&o.focusInput()}})),mn(Cn(o),"createMessage",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.id||C();return an({id:n,type:null===(e=t.response)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.display_type},t)})),mn(Cn(o),"createErrorMessage",(function(e,t){return o.createMessage({content:e||ir.GENERAL_QUERY,isResponse:!0,type:"error",queryMessageID:t})})),mn(Cn(o),"getAppliedFilters",(function(e){try{var t,n,o=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.fe_req)||void 0===t?void 0:t.persistent_filter_locks,a=null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.session_filter_locks;return Array.isArray(o)||(o=[]),Array.isArray(a)||(a=[]),[].concat(Tn(o),Tn(a))}catch(e){return[]}})),mn(Cn(o),"isChataThinking",(function(){return o.state.isQueryRunning||o.state.isDrilldownRunning})),mn(Cn(o),"render",(function(){var e,t;return o.props.shouldRender||(e="hidden",t="0"),f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.chatContentRef=e},className:"chat-content-scroll-container ".concat(o.props.shouldRender?"":"react-autoql-content-hidden"),style:{visibility:e,opacity:t}},f.createElement(Po,{ref:function(e){return o.messengerScrollComponent=e},className:"chat-content-scrollbars-container"},f.createElement("div",{className:"chat-content-container"},o.state.messages.map((function(e){return f.createElement(fs,{key:e.id,id:e.id,ref:function(t){return o.messageRefs[e.id]=t},isIntroMessage:e.isIntroMessage,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,isCSVProgressMessage:e.isCSVProgressMessage,initialCSVDownloadProgress:o.csvProgressLog[e.id],onCSVDownloadProgress:o.onCSVDownloadProgress,queryId:e.queryId,queryText:e.query,originalQueryID:e.originalQueryID,isDataMessengerOpen:o.props.isDataMessengerOpen,isActive:o.state.activeMessageId===e.id,addMessageToDM:o.addResponseMessage,onDrilldownStart:o.onDrilldownStart,onDrilldownEnd:o.onDrilldownEnd,isResponse:e.isResponse,isChataThinking:o.isChataThinking(),onSuggestionClick:o.animateInputTextAndSubmit,content:e.content,scrollToBottom:o.scrollToBottom,dataFormatting:o.props.dataFormatting,response:e.response,type:e.type,onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessAlert,deleteMessageCallback:o.deleteMessage,createDataAlertCallback:o.props.createDataAlertCallback,scrollContainerRef:o.messengerScrollComponent,isResizing:o.props.isResizing,enableDynamicCharting:o.props.enableDynamicCharting,onNoneOfTheseClick:o.onNoneOfTheseClick,autoChartAggregations:o.props.autoChartAggregations,onRTValueLabelClick:o.props.onRTValueLabelClick,appliedFilters:e.appliedFilters,disableMaxHeight:o.props.disableMaxMessageHeight,enableAjaxTableData:o.props.enableAjaxTableData,queryRequestData:e.queryRequestData,popoverParentElement:o.chatContentRef,isVisibleInDOM:o.props.shouldRender,dataPageSize:o.props.dataPageSize,shouldRender:o.props.shouldRender,source:o.props.source,scope:o.props.scope,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID})})))),o.isChataThinking()&&f.createElement("div",{className:"response-loading-container"},f.createElement(Xa,null))),f.createElement("div",{style:{visibility:e,opacity:t},className:"chat-bar-container ".concat(o.props.shouldRender?"":"react-autoql-content-hidden")},f.createElement("div",{className:"watermark"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"}),rs.run),f.createElement(ms,{ref:function(e){return o.queryInputRef=e},className:"chat-drawer-chat-bar",authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,onSubmit:o.onInputSubmit,onResponseCallback:o.onResponse,isDisabled:o.state.isInputDisabled,enableVoiceRecord:o.props.enableVoiceRecord,autoCompletePlacement:"above",showChataIcon:!1,showLoadingDots:!1,placeholder:o.props.inputPlaceholder,onErrorCallback:o.props.onErrorCallback,hideInput:o.props.hideInput,source:o.props.source,scope:o.props.scope,queryFilters:o.props.queryFilters,sessionId:o.props.sessionId,dataPageSize:o.props.dataPageSize,isResizing:o.props.isResizing,shouldRender:o.props.shouldRender,tooltipID:o.props.tooltipID})))})),o.messageRefs={},o.csvProgressLog={},o.keepLoading=!1,o.state={messages:[]},o}return pn(n)}();mn(gs,"propTypes",{authentication:nr.isRequired,autoQLConfig:ar.isRequired,dataFormatting:or.isRequired,clearOnClose:b.bool.isRequired,enableVoiceRecord:b.bool.isRequired,maxMessages:b.number.isRequired,introMessage:b.string.isRequired,inputPlaceholder:b.string.isRequired,enableDynamicCharting:b.bool.isRequired,autoChartAggregations:b.bool.isRequired,enableFilterLocking:b.bool.isRequired,onErrorCallback:b.func.isRequired,onSuccessAlert:b.func.isRequired,onRTValueLabelClick:b.func,disableMaxMessageHeight:b.bool,enableAjaxTableData:b.bool,dataPageSize:b.number,sessionId:b.string,isResizing:b.bool,source:b.oneOfType([b.arrayOf(b.string),b.string]),scope:b.string,shouldRender:b.bool}),mn(gs,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isResizing:!1,dataPageSize:void 0,source:null,scope:void 0,onRTValueLabelClick:void 0,shouldRender:!0});var vs=function(t){gn(o,f.Component);var n=Sn(o);function o(t){var a;return un(this,o),mn(Cn(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0;try{window.addEventListener("resize",a.onWindowResize)}catch(e){console.error(e),a.setState({hasError:!0})}a.props.defaultOpen&&!a.isOpen()&&a.openDataMessenger(),setTimeout(Co,1e3)})),mn(Cn(a),"componentDidUpdate",(function(e,t){try{var n={};a.props.placement!==e.placement&&(n.placement=a.getPlacementProp(a.props.placement)),a.state.isSizeMaximum!==t.isSizeMaximum&&a.forceUpdate(),"number"==typeof a.props.notificationCount&&a.props.notificationCount!==e.notificationCount&&a.refreshNotifications(),!a.state.isVisible&&t.isVisible&&a.props.clearOnClose&&a.setState({dataMessengerId:C()}),a.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),_e(n)||a.setState(an({},n))}catch(e){console.error(e),a.setState({hasError:!0})}})),mn(Cn(a),"onError",(function(){return a.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")})),mn(Cn(a),"onSave",(function(){a.props.onSuccessAlert("Notification created!"),a.setState({isDataAlertModalVisible:!1})})),mn(Cn(a),"onClose",(function(){a.setState({isDataAlertModalVisible:!1})})),mn(Cn(a),"refreshNotifications",(function(){var e;null===(e=a.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),mn(Cn(a),"getMaxWidthAndHeightFromDocument",(function(){return{maxWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-a.TAB_THICKNESS,maxHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-a.TAB_THICKNESS}})),mn(Cn(a),"onWindowResize",(function(){a.state.isWindowResizing||a.setState({isWindowResizing:!0}),clearTimeout(a.windowResizeTimer),a.windowResizeTimer=setTimeout((function(){a.setState({isWindowResizing:!1})}),300)})),mn(Cn(a),"openDataMessenger",(function(e){Pe&&a.state.isVisible?a.setState({activePage:e}):(e?a.setState({activePage:e}):Pe&&"data-messenger"===a.props.mobileActivePage&&a.setState({activePage:"data-messenger"}),a.isOpen()||a.dmRef.setState({open:!0}))})),mn(Cn(a),"closeDataMessenger",(function(){a.dmRef.setState({open:!1}),a.setState({isVisible:!1})})),mn(Cn(a),"openExploreQueries",(function(e){a.setState({activePage:"explore-queries"},(function(){var t,n;e&&null!==(t=a.exploreQueriesRef)&&void 0!==t&&t.animateQITextAndSubmit&&(null===(n=a.exploreQueriesRef)||void 0===n||n.animateQITextAndSubmit(e))}))})),mn(Cn(a),"openDataExplorer",(function(e){Pe&&a.props.setMobileActivePage("data-explorer"),a.setState({activePage:"data-explorer"},(function(){var t,n;e&&null!==(t=a.dataExplorerRef)&&void 0!==t&&t.animateDETextAndSubmit&&(null===(n=a.dataExplorerRef)||void 0===n||n.animateDETextAndSubmit(e))}))})),mn(Cn(a),"openNotificationFeed",(function(){Pe&&a.props.setMobileActivePage("notification-feed"),a.notificationBadgeRef&&a.notificationBadgeRef.resetCount(),a.setState({activePage:"notifications"})})),mn(Cn(a),"toggleFullScreen",(function(e,t,n){a.setState({width:e?a.props.width:t,height:e?a.props.height:n,isSizeMaximum:!e,isResizing:!0},(function(){a.setState({isResizing:!1})})),Eo()})),mn(Cn(a),"getHandleProp",(function(){return void 0!==a.props.customHandle?a.props.customHandle:!!a.props.showHandle&&f.createElement("div",{ref:function(e){return a.drawerHandle=e},className:"drawer-handle\n ".concat(a.state.isVisible?" hide":"","\n ").concat(a.props.handleImage?"":" default-logo"),style:a.props.handleStyles,"data-test":"data-messenger-handle"},a.props.handleImage?f.createElement("img",{src:a.props.handleImage,height:"22px",width:"22px",draggable:"false"}):f.createElement(Wn,{type:"react-autoql-bubbles-outlined",size:26}))})),mn(Cn(a),"getDrawerHeight",(function(){return"right"===a.state.placement||"left"===a.state.placement?Pe?"calc(100% - 80px)":"100vh":a.state.height})),mn(Cn(a),"getDrawerWidth",(function(){return"top"===a.state.placement||"bottom"===a.state.placement?"100vw":a.state.width})),mn(Cn(a),"getPlacementProp",(function(){var e,t=a.props.placement;return"string"!=typeof t||"right"!==(e=t.trim().toLowerCase())&&"left"!==e&&"bottom"!==e&&"top"!==e?"right":e})),mn(Cn(a),"onDrawerChange",(function(e){e?a.setState({isVisible:!0}):a.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),mn(Cn(a),"onTopicClick",(function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];null===(e=a.dataMessengerContentRef)||void 0===e||e.animateInputTextAndSubmit.apply(e,n)})),mn(Cn(a),"handleClearQueriesDropdown",(function(){a.clearQueriesDropdown&&("block"===a.clearQueriesDropdown.style.display?a.clearQueriesDropdown.style.display="none":a.clearQueriesDropdown.style.display="block")})),mn(Cn(a),"onRTValueLabelClick",(function(e){a.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=a.filterLockRef)||void 0===t||t.insertFilter(e)}))})),mn(Cn(a),"clearMessages",(function(){var e;if("data-messenger"===a.state.activePage)null===(e=a.dataMessengerContentRef)||void 0===e||e.clearMessages();else if("dpr"===a.state.activePage){var t;null===(t=a.dprMessengerContentRef)||void 0===t||t.clearMessages()}a.setState({isOptionsDropdownOpen:!1})})),mn(Cn(a),"renderTabs",(function(){if(!(a.props.enableExploreQueriesTab||a.props.enableNotificationsTab||a.props.enableDPRTab||a.props.enableDataExplorerTab))return null;var e=a.state.activePage;return f.createElement("div",{className:"data-messenger-tab-container ".concat(a.props.placement," ").concat(a.state.isVisible?"visible":"hidden")},f.createElement("div",{className:"page-switcher-shadow-container ".concat(a.props.placement)},f.createElement("div",{className:"page-switcher-container ".concat(a.props.placement)},f.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return a.setState({activePage:"data-messenger"})},"data-tip":"Home","data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})),a.props.enableExploreQueriesTab&&f.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return a.setState({activePage:"explore-queries"})},"data-tip":rs.exploreQueries,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"light-bulb",size:22})),a.props.enableDataExplorerTab&&f.createElement("div",{className:"tab".concat("data-explorer"===e?" active":""," react-autoql-data-explorer"),onClick:function(){return a.setState({activePage:"data-explorer"})},"data-tip":rs.dataExplorer,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"data-search",size:22})),a.props.enableNotificationsTab&&zo(a.props.autoQLConfig).enableNotifications&&f.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){a.notificationBadgeRef&&a.notificationBadgeRef.resetCount(),a.setState({activePage:"notifications"})},"data-tip":"Notifications","data-for":a.TOOLTIP_ID},f.createElement("div",{className:"data-messenger-notification-btn"},f.createElement(yr,{ref:function(e){return a.notificationBadgeRef=e},authentication:a.props.authentication,clearCountOnClick:!1,style:{fontSize:"19px"},overflowCount:9,count:a.props.notificationCount,useDot:!0,onCount:a.props.onNotificationCount,onErrorCallback:a.props.onErrorCallback,onNewNotification:function(e){a.props.onNewNotification(e)}}))),a.props.enableDPRTab&&f.createElement("div",{className:"tab".concat("dpr"===e?" active":""," react-autoql-dpr"),onClick:function(){return a.setState({activePage:"dpr"})},"data-tip":"Education","data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"grad-cap",size:22})))))})),mn(Cn(a),"renderRightHeaderContent",(function(){return f.createElement(f.Fragment,null,Oe?zo(a.props.autoQLConfig).enableFilterLocking&&a.renderFilterLockPopover():null,f.createElement(Jr,{className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===a.state.activePage||"dpr"===a.state.activePage?"visible":"hidden"),popoverParentElement:a.messengerDrawerRef,title:rs.clearDataResponses,onConfirm:a.clearMessages,confirmText:"Clear",backText:"Cancel",positions:["bottom","left","top","right"],align:"end"},f.createElement("button",{"data-tip":rs.clearQueriesTooltip,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"trash"}))))})),mn(Cn(a),"renderHeaderTitle",(function(){var e="";switch(a.state.activePage){case"data-messenger":e=a.props.title;break;case"explore-queries":e=rs.exploreQueries;break;case"data-explorer":e=rs.dataExplorer;break;case"notifications":e=rs.notifications;break;case"dpr":e=rs.education}return f.createElement("div",{className:"header-title"},e)})),mn(Cn(a),"openFilterLockMenu",(function(){a.state.isFilterLockMenuOpen||a.setState({isFilterLockMenuOpen:!0})})),mn(Cn(a),"closeFilterLockMenu",(function(){a.state.isFilterLockMenuOpen&&a.setState({isFilterLockMenuOpen:!1})})),mn(Cn(a),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));a.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),mn(Cn(a),"isOpen",(function(){var e;return!(null===(e=a.dmRef)||void 0===e||null===(e=e.state)||void 0===e||!e.open)})),mn(Cn(a),"shouldRenderPage",(function(e){return a.state.activePage===e&&a.isOpen()})),mn(Cn(a),"renderFilterLockPopover",(function(){return f.createElement(ss,{ref:function(e){return a.filterLockRef=e},authentication:a.props.authentication,isOpen:a.state.isFilterLockMenuOpen,onChange:a.onFilterChange,onClose:a.closeFilterLockMenu,parentElement:a.messengerDrawerRef,boundaryElement:a.messengerDrawerRef,tooltipID:a.TOOLTIP_ID,positions:["bottom","left","top","right"],align:"center"},f.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===a.state.activePage?"visible":"hidden"),"data-tip":rs.openFilterLocking,"data-for":a.TOOLTIP_ID,onClick:a.state.isFilterLockMenuOpen?a.closeFilterLockMenu:a.openFilterLockMenu},f.createElement("span",{className:"react-autoql-filter-lock-icon-container"},f.createElement(Wn,{type:a.state.hasFilters?"lock":"unlock"}),a.state.hasFilters?f.createElement("div",{className:"react-autoql-filter-lock-icon-badge"}):null)))})),mn(Cn(a),"renderHeaderContent",(function(){var e=a.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,o=a.state.width===t;return f.createElement(h,null,f.createElement("div",{className:"react-autoql-header-left-container ".concat("data-messenger"===a.state.activePage?"visible":"hidden")},Oe?f.createElement(f.Fragment,null,f.createElement("button",{onClick:a.closeDataMessenger,className:"react-autoql-drawer-header-btn","data-tip":rs.closeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"close"})),f.createElement("button",{onClick:function(){return a.toggleFullScreen(o,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":o?rs.minimizeDataMessenger:rs.maximizeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:o?"minimize":"maximize"}))):zo(a.props.autoQLConfig).enableFilterLocking&&a.renderFilterLockPopover()),f.createElement("div",{className:"react-autoql-header-center-container"},a.renderHeaderTitle()),f.createElement("div",{className:"react-autoql-header-right-container ".concat("data-messenger"===a.state.activePage?"visible":"hidden")},a.renderRightHeaderContent()))})),mn(Cn(a),"renderBodyContent",(function(){return f.createElement(f.Fragment,null,a.renderDataMessengerContent(),a.renderExploreQueriesContent(),a.renderDataExplorerContent(),a.renderNotificationsContent(),a.renderDPRContent())})),mn(Cn(a),"renderDataMessengerContent",(function(){var e=zo(a.props.autoQLConfig).enableFilterLocking?a.onRTValueLabelClick:void 0;return f.createElement(Rn,null,f.createElement(gs,fn({},a.props,{"data-test":"data-messenger-chat-content",shouldRender:a.shouldRenderPage("data-messenger"),key:a.state.dataMessengerId,ref:function(e){return a.dataMessengerContentRef=e},authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,isResizing:a.state.isResizing||a.state.isWindowResizing,source:a.SOURCE,onRTValueLabelClick:e,queryFilters:a.state.sessionFilters,introMessages:a.dataMessengerIntroMessages,inputPlaceholder:a.props.inputPlaceholder,enableAjaxTableData:a.props.enableAjaxTableData,autoChartAggregations:a.props.autoChartAggregations,popoverParentElement:a.messengerDrawerRef,dataPageSize:a.props.dataPageSize,createDataAlertCallback:a.closeDataMessenger,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,scope:a.props.scope})))})),mn(Cn(a),"renderDPRContent",(function(){var e,t;return a.props.enableDPRTab?f.createElement(Rn,null,f.createElement(gs,fn({},a.props,{shouldRender:a.shouldRenderPage("dpr"),key:a.state.dataMessengerId,ref:function(e){return a.dprMessengerContentRef=e},authentication:{dprKey:null===(e=a.props.authentication)||void 0===e?void 0:e.dprKey,dprDomain:null===(t=a.props.authentication)||void 0===t?void 0:t.dprDomain},isResizing:a.state.isResizing||a.state.isWindowResizing,source:a.SOURCE,introMessages:a.dprMessengerIntroMessages,disableMaxMessageHeight:!0,inputPlaceholder:"Type your questions here",sessionId:a.COMPONENT_KEY,autoQLConfig:{enableAutocomplete:!1,enableQueryValidation:!1,enableQuerySuggestions:!1,enableColumnVisibilityManager:!1,enableQueryInterpretation:!1,enableDrilldowns:!1,enableReportProblem:!1},createDataAlertCallback:a.closeDataMessenger,tooltipID:a.TOOLTIP_ID}))):null})),mn(Cn(a),"renderDataExplorerContent",(function(){return a.props.enableDataExplorerTab?f.createElement(Rn,null,f.createElement(dr,{ref:function(e){return a.dataExplorerRef=e},authentication:a.props.authentication,dataFormatting:a.props.dataFormatting,shouldRender:a.shouldRenderPage("data-explorer"),tooltipID:a.TOOLTIP_ID,scope:a.props.scope,executeQuery:function(e){Pe&&a.props.setMobileActivePage("data-messenger"),a.setState({activePage:"data-messenger"}),clearTimeout(a.executeQueryTimeout),a.executeQueryTimeout=setTimeout((function(){var t;null===(t=a.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["data_explorer"]})}),500)}})):null})),mn(Cn(a),"renderExploreQueriesContent",(function(){return a.props.enableExploreQueriesTab?f.createElement(Rn,null,f.createElement(Za,{ref:function(e){return a.exploreQueriesRef=e},authentication:a.props.authentication,shouldRender:a.shouldRenderPage("explore-queries"),tooltipID:a.TOOLTIP_ID,executeQuery:function(e){a.setState({activePage:"data-messenger"}),clearTimeout(a.executeQueryTimeout),a.executeQueryTimeout=setTimeout((function(){var t;null===(t=a.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["explore_queries"]})}),500)}})):null})),mn(Cn(a),"onDataAlertModalOpen",(function(){a.closeDataMessenger(),a.shouldOpenDataMessengerFromDA=!0})),mn(Cn(a),"onDataAlertModalClose",(function(){a.shouldOpenDataMessengerFromDA&&(a.shouldOpenDataMessengerFromDA=!1,a.openDataMessenger())})),mn(Cn(a),"renderNotificationsContent",(function(){return a.props.enableNotificationsTab?f.createElement(Rn,null,f.createElement(as,{ref:function(e){return a.notificationListRef=e},authentication:a.props.authentication,onExpandCallback:a.props.onNotificationExpandCallback,onCollapseCallback:a.props.onNotificationCollapseCallback,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessAlert,onModalOpen:a.onDataAlertModalOpen,onModalClose:a.onDataAlertModalClose,shouldRender:a.isOpen()&&"notifications"===a.state.activePage,tooltipID:a.TOOLTIP_ID,isResizing:a.state.isResizing||a.state.isWindowResizing,popoverParentElement:a.props.popoverParentElement})):null})),mn(Cn(a),"resizeDrawer",(function(t){var n=a.state.placement,o=a.getMaxWidthAndHeightFromDocument(),r=o.maxWidth,i=o.maxHeight;if("right"===n){var l=e(a.state.startingResizePosition,"x")-t.pageX,s=e(a.state.startingResizePosition,"width")+l;s>r&&(s=r),s<a.minWidth&&(s=a.minWidth),Number(s)&&a.setState({width:s,isSizeMaximum:!1})}else if("left"===n){var c=t.pageX-e(a.state.startingResizePosition,"x"),u=e(a.state.startingResizePosition,"width")+c;u>r&&(u=r),u<a.minWidth&&(u=a.minWidth),Number(u)&&a.setState({width:u,isSizeMaximum:!1})}else if("bottom"===n){var d=e(a.state.startingResizePosition,"y")-t.pageY,p=e(a.state.startingResizePosition,"height")+d;p>i&&(p=i),p<a.minHeight&&(p=a.minHeight),Number(p)&&a.setState({height:p,isSizeMaximum:!1})}else if("top"===n){var m=t.pageY-e(a.state.startingResizePosition,"y"),f=e(a.state.startingResizePosition,"height")+m;f>a.maxHeight&&(f=a.maxHeight),f<a.minHeight&&(f=a.minHeight),Number(f)&&a.setState({height:f,isSizeMaximum:!1})}})),mn(Cn(a),"stopResizingDrawer",(function(){"right"===a.state.placement||"left"===a.state.placement?a.setState({isResizing:!1}):"top"!==a.state.placement&&"bottom"!==a.state.placement||a.setState({isResizing:!1}),document.removeEventListener("mousemove",a.resizeDrawer),document.removeEventListener("mouseup",a.stopResizingDrawer),document.removeEventListener("mouseleave",a.stopResizingDrawer)})),mn(Cn(a),"renderResizeHandle",(function(){var e=Cn(a);if(a.state.isVisible){var t=a.getPlacementProp();return f.createElement("div",{className:"react-autoql-drawer-resize-handle ".concat(t),onMouseDown:function(t){a.setState({isResizing:!0,startingResizePosition:{x:t.pageX,y:t.pageY,width:a.state.width,height:a.state.height}}),document.addEventListener("mousemove",e.resizeDrawer),document.addEventListener("mouseup",e.stopResizingDrawer),document.addEventListener("mouseleave",e.stopResizingDrawer)}})}return null})),mn(Cn(a),"renderTooltips",(function(){return f.createElement(h,null,f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800,place:"top",html:!0}),f.createElement(So,{className:"react-autoql-chart-tooltip",id:a.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),mn(Cn(a),"render",(function(){return a.state.hasError?null:f.createElement(Rn,null,void((navigator.language||navigator.userLanguage).includes("sp")?rs.setLanguage("sp"):rs.setLanguage("en")),f.createElement(Ut,{ref:function(e){return a.dmRef=e},id:"react-autoql-drawer-".concat(a.COMPONENT_KEY),"data-test":"react-autoql-drawer-test",className:"react-autoql-drawer\n ".concat(a.state.isResizing?" disable-selection":"","\n ").concat(a.state.isVisible?" open":" closed","\n ","drawer-".concat(a.state.placement)),showMask:a.props.showMask,placement:a.getPlacementProp(),width:a.getDrawerWidth(),height:a.getDrawerHeight(),onChange:a.onDrawerChange,maskClosable:!0,handler:a.getHandleProp(),level:a.props.shiftScreen?"all":null,keyboard:!1},a.props.resizable&&Oe&&a.renderResizeHandle(),Oe?a.renderTabs():null,f.createElement("div",{ref:function(e){return a.messengerDrawerRef=e},className:Pe?"react-autoql-mobile-drawer-content-container":"react-autoql-drawer-content-container"},f.createElement("div",{className:"chat-header-container"},a.renderHeaderContent()),a.renderBodyContent())),a.renderTooltips())})),a.minWidth=400,a.minHeight=400,a.COMPONENT_KEY=C(),a.HEADER_THICKNESS=70,a.TAB_THICKNESS=45,a.SOURCE=Va(t.source,"data_messenger"),a.TOOLTIP_ID="react-autoql-data-messenger-tooltip-".concat(a.COMPONENT_KEY),a.CHART_TOOLTIP_ID="react-autoql-dm-chart-tooltip-".concat(a.COMPONENT_KEY),a.dataMessengerIntroMessages=[t.introMessage?"".concat(t.introMessage):f.createElement(f.Fragment,null,f.createElement("span",null,"Hi ",t.userDisplayName||"there","! Let’s dive into your data."),f.createElement("br",null),f.createElement("br",null),f.createElement("span",null,"Get started by asking a query below, or use "),f.createElement("span",{className:"intro-qi-link",onClick:a.openDataExplorer},f.createElement(Wn,{type:"data-search"})," ",rs.dataExplorer),f.createElement("span",null," to discover what data is available to you!"))],a.dprMessengerIntroMessages=[f.createElement(f.Fragment,null,f.createElement("span",null,"Ask questions, get answers."),f.createElement("br",null),f.createElement("br",null),f.createElement("span",null,"Get helpful information about trading and investing, simply by asking a question in your own words. Results are returned from content on"," ",f.createElement("a",{href:"https://www.investopedia.com/",target:"_blank",rel:"noopener noreferrer"},"Investopedia®"),", including applicable reference links."))],a.state={dataMessengerId:C(),hasError:!1,activePage:t.defaultTab,width:Oe?t.width:"100vw",height:t.height,isResizing:!1,isWindowResizing:!1,placement:a.getPlacementProp(t.placement),isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isSizeMaximum:!1},a}return pn(o,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.executeQueryTimeout)}catch(e){}}}]),o}();mn(vs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,placement:b.string,maskClosable:b.bool,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),showHandle:b.bool,handleImage:b.string,handleStyles:b.shape({}),shiftScreen:b.bool,userDisplayName:b.string,clearOnClose:b.bool,enableVoiceRecord:b.bool,title:b.string,maxMessages:b.number,introMessage:b.string,enableExploreQueriesTab:b.bool,enableNotificationsTab:b.bool,resizable:b.bool,inputPlaceholder:b.string,enableDPRTab:b.bool,dataPageSize:b.number,notificationCount:b.number,defaultOpen:b.bool,popoverParentElement:b.element,enableDynamicCharting:b.bool,defaultTab:b.string,autoChartAggregations:b.bool,enableFilterLocking:b.bool,enableQueryQuickStartTopics:b.bool,enableAjaxTableData:b.bool,onNotificationExpandCallback:b.func,onNewNotification:b.func,onNotificationCount:b.func,onVisibleChange:b.func,onErrorCallback:b.func,onSuccessAlert:b.func,setMobileActivePage:b.func}),mn(vs,"defaultProps",{authentication:{},autoQLConfig:Vo,dataFormatting:qo,placement:"right",maskClosable:!0,isVisible:!0,width:500,height:350,showHandle:!0,handleImage:void 0,handleStyles:void 0,shiftScreen:!1,userDisplayName:"there",clearOnClose:!1,enableVoiceRecord:!0,title:"Data Messenger",maxMessages:20,introMessage:"",enableExploreQueriesTab:!1,enableNotificationsTab:!1,resizable:!0,inputPlaceholder:"Type your queries here",dataPageSize:void 0,notificationCount:void 0,defaultOpen:!1,popoverParentElement:void 0,enableDynamicCharting:!0,defaultTab:"data-messenger",autoChartAggregations:!0,enableFilterLocking:!1,enableQueryQuickStartTopics:!0,enableAjaxTableData:!1,enableDPRTab:!1,mobileActivePage:"data-messenger",setMobileActivePage:function(){},onNotificationExpandCallback:function(){},onNewNotification:function(){},onNotificationCount:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var hs=Ga(vs),bs=["style","className","key"],ys=[],Cs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r;un(this,n),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){r._isMounted=!0})),mn(Cn(r),"shouldComponentUpdate",(function(e,t){if(e.isDragging&&r.props.isDragging)return!1;var n=r.getFilteredProps(r.props),o=r.getFilteredProps(e);return!Ma(n,o)||!Ma(r.state,t)})),mn(Cn(r),"componentDidUpdate",(function(e,t){var n,o,a,i,l,s,c,u,d,p,m,f;(e.tile!==r.props.tile&&r.setState({isTitleOverFlow:r.isTitleOverFlow()}),(null===(n=r.props.tile)||void 0===n?void 0:n.title)!==(null===(o=e.tile)||void 0===o?void 0:o.title))&&r.setState({title:null===(p=r.props.tile)||void 0===p?void 0:p.title});(null===(a=r.props.tile)||void 0===a?void 0:a.query)!==(null===(i=e.tile)||void 0===i?void 0:i.query)&&r.setState({query:null===(m=r.props.tile)||void 0===m?void 0:m.query});(null===(l=r.props.tile)||void 0===l?void 0:l.secondQuery)!==(null===(s=e.tile)||void 0===s?void 0:s.secondQuery)&&r.setState({secondQuery:null===(f=r.props.tile)||void 0===f?void 0:f.secondQuery});null!==(c=r.responseRef)&&void 0!==c&&c._isMounted&&null!==(u=r.props.tile)&&void 0!==u&&u.displayType&&r.props.tile.displayType!==(null===(d=e.tile)||void 0===d?void 0:d.displayType)&&r.props.tile.displayType!==r.responseRef.state.displayType&&r.responseRef.changeDisplayType(r.props.tile.displayType)})),mn(Cn(r),"componentWillUnmount",(function(){try{r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.dragEndTimeout),clearTimeout(r.setParamsForTileTimeout),clearTimeout(r.queryInputTimer),clearTimeout(r.secondQueryInputTimer),r.props.cancelQueriesOnUnmount&&r.cancelAllQueries()}catch(e){console.error(e)}})),mn(Cn(r),"refreshLayout",(function(){var e,t;null===(e=r.state.responseRef)||void 0===e||e.refreshLayout(),null===(t=r.state.secondResponseRef)||void 0===t||t.refreshLayout()})),mn(Cn(r),"cancelAllQueries",(function(){var e,t;null===(e=r.axiosSource)||void 0===e||e.cancel(lr.CANCELLED),null===(t=r.secondAxiosSource)||void 0===t||t.cancel(lr.CANCELLED)})),mn(Cn(r),"debouncedSetParamsForTile",(function(e,t){r._isMounted?(r.paramsToSet=an(an({},r.paramsToSet),e),"function"==typeof t&&(r.callbackArray=[].concat(Tn(r.callbackArray),[t])),clearTimeout(r.setParamsForTileTimeout),r.setParamsForTileTimeout=setTimeout((function(){r.props.setParamsForTile(r.paramsToSet,r.props.tile.i,S(r.callbackArray)),r.paramsToSet={},r.callbackArray=[]}),r.debounceTime)):clearTimeout(r.setParamsForTileTimeout)})),mn(Cn(r),"getFilteredProps",(function(e){return an(an({},e),{},{children:void 0,tileRef:void 0})})),mn(Cn(r),"isQueryValid",(function(e){return!!e&&!!e.trim()})),mn(Cn(r),"setTopExecuted",(function(){r._isMounted&&r.setState({isTopExecuting:!1,isTopExecuted:!0})})),mn(Cn(r),"endTopQuery",(function(e){var t,n=e.response;return(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==lr.CANCELLED?(r.debouncedSetParamsForTile({queryResponse:n,defaultSelectedSuggestion:void 0},r.setTopExecuted),n):Promise.reject(lr.CANCELLED)})),mn(Cn(r),"setBottomExecuted",(function(){r._isMounted&&r.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),mn(Cn(r),"endBottomQuery",(function(e){var t,n=e.response;return(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==lr.CANCELLED?(r.debouncedSetParamsForTile({secondQueryResponse:n,secondDefaultSelectedSuggestion:void 0},r.setBottomExecuted),n):Promise.reject(lr.CANCELLED)})),mn(Cn(r),"processQuery",(function(e){var t=e.query,n=e.userSelection,o=e.skipQueryValidation;e.source;var a=e.isSecondHalf;if(r.isQueryValid(t)){var i,l,s,c;if(a&&ca(r.props.tile.secondDisplayType))s=null!==(c=r.props.tile.secondPageSize)&&void 0!==c?c:r.props.dataPageSize;else if(ca(r.props.tile.displayType)){var u;s=null!==(u=r.props.tile.pageSize)&&void 0!==u?u:r.props.dataPageSize}var d=a&&!r.areTopAndBottomSameQuery()?null===(i=r.secondAxiosSource)||void 0===i?void 0:i.token:null===(l=r.axiosSource)||void 0===l?void 0:l.token,p=an(an(an({},_o(r.props.authentication)),zo(r.props.autoQLConfig)),{},{enableQueryValidation:!!r.props.isEditing&&zo(r.props.autoQLConfig).enableQueryValidation,skipQueryValidation:o,source:"dashboards.user",scope:"dashboards",userSelection:n,cancelToken:d,pageSize:s,query:t});return ht(p).then((function(e){return a?r.bottomRequestData=p:r.topRequestData=p,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),mn(Cn(r),"processTileTop",(function(e){var t,n=e.query,o=e.userSelection,a=e.skipQueryValidation,i=e.source,l=e.pageSize;r.setState({isTopExecuting:!0,queryResponse:null});var s=r.props.tile.query!==n,c=a||r.props.tile.skipQueryValidation&&!s,u=o||(s||null===(t=r.props.tile)||void 0===t?void 0:t.queryValidationSelections);return r.debouncedSetParamsForTile({query:n,dataConfig:s?void 0:r.props.tile.dataConfig,skipQueryValidation:c,columns:s?void 0:r.props.tile.columns,defaultSelectedSuggestion:void 0,queryValidationSelections:u}),r.processQuery({query:n,userSelection:u,skipQueryValidation:a,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){return r.endTopQuery({response:e})})).catch((function(e){var t;if((null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED)return r.endTopQuery({response:e})}))})),mn(Cn(r),"processTileBottom",(function(e){var t,n=e.query,o=e.userSelection,a=e.skipQueryValidation,i=e.source;r.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondQueryResponse:null});var l=r.props.tile.secondQuery!==n,s=a||r.props.tile.secondskipQueryValidation&&!l,c=o||(l||null===(t=r.props.tile)||void 0===t?void 0:t.secondQueryValidationSelections);return r.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:l?void 0:r.props.tile.secondDataConfig,secondskipQueryValidation:s,secondColumns:l?void 0:r.props.tile.secondColumns,secondDefaultSelectedSuggestion:void 0,secondQueryValidationSelections:c}),r.processQuery({query:n,userSelection:c,skipQueryValidation:a,source:i,isSecondHalf:!0}).then((function(e){return r.endBottomQuery({response:e})})).catch((function(e){var t;if((null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED)return r.endBottomQuery({response:e})}))})),mn(Cn(r),"clearTopQueryResponse",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.setState(an({isTopExecuting:!1,isTopExecuted:!1,userSelection:void 0},e)),r.debouncedSetParamsForTile({queryResponse:void 0})})),mn(Cn(r),"clearBottomQueryResponse",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.setState(an({isBottomExecuted:!1,isBottomExecuting:!1,secondUserSelection:void 0},e)),r.debouncedSetParamsForTile({secondQueryResponse:void 0})})),mn(Cn(r),"processTile",(function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=o.query,i=o.secondQuery,l=o.skipQueryValidation,s=o.secondskipQueryValidation,c=o.source;null===(e=r.axiosSource)||void 0===e||e.cancel(lr.CANCELLED),null===(t=r.secondAxiosSource)||void 0===t||t.cancel(lr.CANCELLED),r.axiosSource=null===(n=E.CancelToken)||void 0===n?void 0:n.source(),r.secondAxiosSource=E.CancelToken.source();var u=a||r.props.tile.defaultSelectedSuggestion||r.state.query,d=i||r.props.tile.secondDefaultSelectedSuggestion||r.state.secondQuery,p=[];return r.getIsSplitView()&&d&&u!==d&&(p[1]=r.processTileBottom({query:d,skipQueryValidation:s,source:c})),p[0]=r.processTileTop({query:u,skipQueryValidation:l,source:c}),Promise.all(p).then((function(e){return an(an({},r.props.tile),{},{queryResponse:null==e?void 0:e[0],secondQueryResponse:null==e?void 0:e[1],defaultSelectedSuggestion:void 0,secondDefaultSelectedSuggestion:void 0})})).catch((function(){return Promise.reject()}))})),mn(Cn(r),"debounceQueryInputChange",(function(e){if(e!==r.state.query){var t={query:e,queryValidationSelections:void 0};r.clearTopQueryResponse(t),clearTimeout(r.queryInputTimer),r.queryInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({query:e,pageSize:void 0,aggConfig:void 0,dataConfig:void 0,queryValidationSelections:void 0})}),600)}})),mn(Cn(r),"debounceSecondQueryInputChange",(function(e){if(e!==r.state.secondQuery){var t={secondQuery:e};r.clearBottomQueryResponse(t),clearTimeout(r.secondQueryInputTimer),r.secondQueryInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({secondQuery:e,secondPageSize:void 0,secondAggConfig:void 0,secondDataConfig:void 0,secondQueryValidationSelections:void 0})}),600)}})),mn(Cn(r),"debounceTitleInputChange",(function(e){r.setState({title:e}),clearTimeout(r.titleInputTimer),r.titleInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({title:e})}),600)})),mn(Cn(r),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(r.processTile({query:e.target.value}),e.target.blur())})),mn(Cn(r),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(r.processTileBottom({query:e.target.value}),e.target.blur())})),mn(Cn(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,a=e.source;r.setState({query:t}),o?r.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:a}):r.debouncedSetParamsForTile({defaultSelectedSuggestion:t})})),mn(Cn(r),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,a=e.source;r.setState({secondQuery:t}),o?(r.debouncedSetParamsForTile({secondQuery:t,secondQueryValidationSelections:n}),r.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:a})):r.debouncedSetParamsForTile({secondQuery:t})})),mn(Cn(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){Ke(an({suggestion:t},_o(r.props.authentication))).then((function(e){if(r._isMounted){var t,n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,a=[];ys=[],n=o.matches;for(var i=0;i<n.length&&(a.push(n[i]),4!==i);i++);a.sort((function(e,t){return t.length-e.length}));for(var l=0;l<a.length;l++){var s={name:a[l]};ys.push(s)}r.setState({suggestions:ys})}})).catch((function(e){console.error(e)}))}),300)})),mn(Cn(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),mn(Cn(r),"userSelectedSuggestionHandler",(function(e){if(e&&e.name&&r._isMounted){var t=e.name;r.userSelectedValue=t,r.userSelectedSuggestion=!0,r.setState({query:t}),r.debouncedSetParamsForTile({query:t})}})),mn(Cn(r),"onQueryInputChange",(function(e){var t,n;r.props.tile.skipQueryValidation&&r.debouncedSetParamsForTile({skipQueryValidation:!1}),(!r.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(null!=e&&null!==(t=e.target)&&void 0!==t&&t.value||""===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)?r.debounceQueryInputChange(e.target.value):r.processTile({query:r.userSelectedValue}))})),mn(Cn(r),"onSecondQueryInputChange",(function(e){r.setState({secondQuery:e.target.value}),r.debouncedSetParamsForTile({secondSkipQueryValidation:!1})})),mn(Cn(r),"getIsSplitView",(function(){var e;return null===(e=r.props.tile)||void 0===e?void 0:e.splitView})),mn(Cn(r),"toggleSecondQueryInput",(function(){r.setState({isSecondQueryInputOpen:!r.state.isSecondQueryInputOpen})})),mn(Cn(r),"isTitleOverFlow",(function(){var e=r.dashboardTileTitleRef;return!!e&&e.getBoundingClientRect().width>e.parentElement.getBoundingClientRect().width})),mn(Cn(r),"onQueryValidationSelectOption",(function(e,t){r.setState({query:e}),r.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),mn(Cn(r),"onSecondQueryValidationSelectOption",(function(e,t){r.setState({secondQuery:e}),r.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),mn(Cn(r),"onPageSizeChange",(function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=null!==(t=r.props.tile)&&void 0!==t&&null!==(t=t.queryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.rows?S(r.props.tile.queryResponse):void 0;o.data.data.rows=n,r.debouncedSetParamsForTile({pageSize:e,queryResponse:o})})),mn(Cn(r),"onSecondPageSizeChange",(function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=null!==(t=r.props.tile)&&void 0!==t&&null!==(t=t.secondQueryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.rows?S(r.props.tile.secondQueryResponse):void 0,a=r.props.tile.defaultSelectedSuggestion||r.state.query,i=r.props.tile.secondDefaultSelectedSuggestion||r.state.secondQuery;r.getIsSplitView()&&i&&a===i&&(o=r.props.tile.queryResponse),o.data.data.rows=n,r.debouncedSetParamsForTile({secondPageSize:e,secondQueryResponse:o})})),mn(Cn(r),"onAggConfigChange",(function(e){return r.debouncedSetParamsForTile({aggConfig:e})})),mn(Cn(r),"onDataConfigChange",(function(e){return r.debouncedSetParamsForTile({dataConfig:e})})),mn(Cn(r),"onDisplayTypeChange",(function(e){return r.debouncedSetParamsForTile({displayType:e})})),mn(Cn(r),"onBucketSizeChange",(function(e){return r.debouncedSetParamsForTile({bucketSize:e})})),mn(Cn(r),"onSecondAggConfigChange",(function(e){return r.debouncedSetParamsForTile({secondAggConfig:e})})),mn(Cn(r),"onSecondDataConfigChange",(function(e){return r.debouncedSetParamsForTile({secondDataConfig:e})})),mn(Cn(r),"onSecondDisplayTypeChange",(function(e){return r.debouncedSetParamsForTile({secondDisplayType:e})})),mn(Cn(r),"onSecondBucketSizeChange",(function(e){return r.debouncedSetParamsForTile({secondBucketSize:e})})),mn(Cn(r),"reportProblemCallback",(function(){var e,t;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=r.optionsToolbarRef)||void 0===t||t.openReportProblemModal())})),mn(Cn(r),"secondReportProblemCallback",(function(){var e;null!==(e=r.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&r.secondOptionsToolbarRef.openReportProblemModal()})),mn(Cn(r),"onSplitViewClick",(function(){var e,t,n=!(null!==(e=r.props.tile)&&void 0!==e&&e.splitView),o=null===(t=r.props.tile)||void 0===t?void 0:t.secondQuery;n&&!o&&(o=r.state.query),r.debouncedSetParamsForTile({splitView:n,secondQuery:o}),Eo()})),mn(Cn(r),"renderSplitResponse",(function(){return f.createElement(en,{key:"dashboard-tile-splitter-layout-".concat(r.COMPONENT_KEY),vertical:!0,percentage:!0,primaryMinSize:30,secondaryMinSize:30,secondaryInitialSize:r.props.secondDisplayPercentage||50,onDragStart:function(){r.setState({isDraggingSplitter:!0})},onDragEnd:function(){r.dragEndTimeout=setTimeout((function(){var e,t,n=null!==(e=null===(t=r.tileInnerDiv)||void 0===t||null===(t=t.style)||void 0===t?void 0:t.height)&&void 0!==e?e:"",o=Number(n.substring(0,n.length-1));isNaN(o)||r.debouncedSetParamsForTile({secondDisplayPercentage:o}),r.setState({isDraggingSplitter:!1})}),1e3)}},f.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderTopResponse()),f.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderBottomResponse(),r.props.isEditing&&f.createElement("div",{className:"split-view-query-btn-container ".concat(r.state.isSecondQueryInputOpen?"open":"")},f.createElement("div",{className:"react-autoql-toolbar viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},f.createElement(wo,{onClick:function(){r.toggleSecondQueryInput(),Eo()},className:"react-autoql-toolbar-btn",tooltip:"Query",tooltipID:r.props.tooltipID},f.createElement("div",{className:"split-view-query-btn-icon-container"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"}),f.createElement(Wn,{type:r.state.isSecondQueryInputOpen?"caret-left":"caret-right"}))),f.createElement("input",{className:"dashboard-tile-input query second",value:r.state.secondQuery,spellCheck:!1,onChange:r.onSecondQueryInputChange,onKeyDown:r.onSecondQueryTextKeyDown,placeholder:r.props.tile.query||"Type a query"})))))})),mn(Cn(r),"renderHeader",(function(){return r.props.isEditing?f.createElement("div",{className:"dashboard-tile-edit-wrapper"},f.createElement("div",{className:"dashboard-tile-input-container\n ".concat(r.state.isQueryInputFocused?"query-focused":"","\n ").concat(r.state.isTitleInputFocused?"title-focused":"")},f.createElement("div",{className:"dashboard-tile-left-input-container"},f.createElement(Wn,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),zo(r.props.autoQLConfig).enableAutocomplete?f.createElement(Kt,{onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,suggestions:r.state.suggestions,ref:function(e){r.autoSuggest=e},renderSuggestion:function(e){return f.createElement(h,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":r.props.tooltipID,"data-place":"bottom",onFocus:function(e){e.stopPropagation(),r.setState({isQueryInputFocused:!0})},onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onBlur:function(){return r.setState({isQueryInputFocused:!1})}}}):f.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":r.props.tooltipID,"data-place":"bottom",spellCheck:!1,onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onFocus:function(){return r.setState({isQueryInputFocused:!0})},onBlur:function(){return r.setState({isQueryInputFocused:!1})}})),f.createElement("div",{className:"dashboard-tile-right-input-container"},f.createElement(Wn,{className:"title-input-icon",type:"title"}),f.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)","data-tip":"Title","data-for":r.props.tooltipID,"data-place":"bottom",value:r.state.title,onChange:function(e){return r.debounceTitleInputChange(e.target.value)},onFocus:function(){return r.setState({isTitleInputFocused:!0})},onBlur:function(){return r.setState({isTitleInputFocused:!1})}}))),f.createElement("div",{className:"dashboard-tile-play-button".concat(r.isQueryValid(r.state.query)?"":" disabled")},f.createElement(Wn,{type:"play",onClick:function(){return r.processTile()},"data-tip":"Run tile","data-place":"left"}))):f.createElement("div",{className:"dashboard-tile-title-container"},f.createElement("span",{ref:function(e){return r.dashboardTileTitleRef=e},className:"dashboard-tile-title",id:"dashboard-tile-title-".concat(r.COMPONENT_KEY),"data-tip":r.state.isTitleOverFlow?r.props.tile.title||r.props.tile.query||"Untitled":null,"data-for":"react-autoql-dashboard-tile-title-tooltip"},r.props.tile.title||r.props.tile.query||"Untitled"),f.createElement("div",{className:"dashboard-tile-title-divider"}))})),mn(Cn(r),"renderContentPlaceholder",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting;return t.isExecuted,n?f.createElement("div",{className:"loading-container-centered"},f.createElement(Xa,null)):null!==(e=r.state.query)&&void 0!==e&&e.trim()?f.createElement("div",{className:"loading-container-centered"},f.createElement("div",{className:"dashboard-tile-placeholder-text"},r.props.isEditing?f.createElement("span",null,"Hit ",f.createElement(Wn,{className:"edit-mode-placeholder-icon",type:"play"})," to run this tile"):f.createElement("span",null,r.props.notExecutedText))):f.createElement("div",{className:"loading-container-centered"},f.createElement("div",{className:"dashboard-tile-placeholder-text"},r.props.isEditing?f.createElement("span",null,"To get started, enter a query and click ",f.createElement(Wn,{className:"play-icon",type:"play"})):f.createElement("span",null,"No query was supplied for this tile.")))})),mn(Cn(r),"renderSplitViewBtn",(function(){return f.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},f.createElement(wo,{onClick:r.onSplitViewClick,className:"react-autoql-toolbar-btn ".concat(r.getIsSplitView()?"active":""),tooltip:r.props.tile.splitView?"Split View On":"Split View Off",tooltipID:r.props.tooltipID,"data-test":"viz-toolbar-button"},f.createElement(Wn,{type:"split-view"})))})),mn(Cn(r),"onCSVDownloadStart",(function(e){return r.props.onCSVDownloadStart(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onCSVDownloadProgress",(function(e){return r.props.onCSVDownloadProgress(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onCSVDownloadFinish",(function(e){return r.props.onCSVDownloadFinish(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onDrilldownStart",(function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!1,activeKey:e,queryOutputRef:r.state.responseRef})})),mn(Cn(r),"renderToolbars",(function(e){e.queryOutputProps;var t=e.vizToolbarProps,n=e.optionsToolbarProps,o=e.isSecondHalf;return f.createElement("div",{className:"dashboard-tile-toolbars-container"},f.createElement("div",{className:"dashboard-tile-toolbars-left-container"},r.props.isEditing&&(o||!r.getIsSplitView())&&r.renderSplitViewBtn(),r.props.isEditing&&f.createElement(Cl,fn({},t,{shouldRender:!r.props.isDragging,tooltipID:r.props.tooltipID}))),f.createElement("div",{className:"dashboard-tile-toolbars-right-container"},f.createElement($l,fn({authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessCallback,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadProgress:r.onCSVDownloadProgress,onCSVDownloadFinish:r.onCSVDownloadFinish,shouldRender:!r.props.isDragging,tooltipID:r.props.tooltipID,popoverPositions:["top","left","bottom","right"],popoverAlign:"end"},n))))})),mn(Cn(r),"renderResponseContent",(function(e){var t,n=e.queryOutputProps,o=e.isExecuting,a=e.isExecuted;return e.renderPlaceholder?r.renderContentPlaceholder({isExecuting:o,isExecuted:a}):f.createElement(bl,fn({key:"".concat(null===(t=r.props.tile)||void 0===t?void 0:t.key).concat(r.props.isEditing?"-editing":"-notediting"),authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,dataFormatting:r.props.dataFormatting,renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:r.props.autoChartAggregations,isResizing:r.props.isDragging||r.state.isDraggingSplitter,renderSuggestionsAsDropdown:r.props.tile.h<4,enableDynamicCharting:r.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),enableAjaxTableData:r.props.enableAjaxTableData,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",tooltipID:r.props.tooltipID,chartTooltipID:r.props.chartTooltipID,shouldRender:!r.props.isDragging,source:"dashboards.user",scope:"dashboards",autoHeight:!1,height:"100%",width:"100%"},n))})),mn(Cn(r),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,o=e.vizToolbarProps,a=void 0===o?{}:o,i=e.optionsToolbarProps,l=void 0===i?{}:i,s=e.isSecondHalf,c=e.isExecuting,u=e.isExecuted,d=e.renderPlaceholder;return f.createElement("div",{className:"loading-container-centered",id:n.key},r.renderResponseContent({queryOutputProps:n,isExecuting:c,isExecuted:u,renderPlaceholder:d,isSecondHalf:s}),r.renderToolbars({queryOutputProps:n,vizToolbarProps:a,optionsToolbarProps:l,isSecondHalf:s}))})),mn(Cn(r),"renderTopResponse",(function(){var e,t,n,o,a=r.state.isTopExecuting,i=r.state.isTopExecuted,l=!(null!==(e=r.props.tile)&&void 0!==e&&e.queryResponse)||a||!i,s=null===(t=r.props)||void 0===t?void 0:t.displayType;return r.renderResponse({renderPlaceholder:l,isExecuting:a,isExecuted:i,queryOutputProps:{ref:function(e){return e&&e!==r.state.responseRef&&r._isMounted&&r.setState({responseRef:e})},optionsToolbarRef:r.optionsToolbarRef,vizToolbarRef:r.vizToolbarRef,key:"dashboard-tile-query-top-".concat(r.FIRST_QUERY_RESPONSE_KEY),initialDisplayType:s,queryResponse:null===(n=r.props.tile)||void 0===n?void 0:n.queryResponse,initialTableConfigs:r.props.tile.dataConfig,initialAggConfig:r.props.tile.aggConfig,onTableConfigChange:r.onDataConfigChange,onAggConfigChange:r.onAggConfigChange,queryValidationSelections:r.props.tile.queryValidationSelections,onSuggestionClick:r.onSuggestionClick,defaultSelectedSuggestion:null===(o=r.props.tile)||void 0===o?void 0:o.defaultSelectedSuggestion,onNoneOfTheseClick:r.onNoneOfTheseClick,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onQueryValidationSelectOption,reportProblemCallback:r.reportProblemCallback,queryRequestData:r.topRequestData,onDisplayTypeChange:r.onDisplayTypeChange,dataPageSize:r.props.tile.pageSize,onPageSizeChange:r.onPageSizeChange,onBucketSizeChange:r.onBucketSizeChange,bucketSize:r.props.tile.bucketSize},vizToolbarProps:{ref:function(e){return r.vizToolbarRef=e},responseRef:r.state.responseRef},optionsToolbarProps:{ref:function(e){return r.optionsToolbarRef=e},responseRef:r.state.responseRef}})})),mn(Cn(r),"areTopAndBottomSameQuery",(function(){var e,t,n=null===(e=r.props)||void 0===e||null===(e=e.tile)||void 0===e?void 0:e.query,o=null===(t=r.props)||void 0===t||null===(t=t.tile)||void 0===t?void 0:t.secondQuery;return!o||n===o})),mn(Cn(r),"renderBottomResponse",(function(){var e,t,n,o,a,i,l=r.areTopAndBottomSameQuery(),s=r.state.isBottomExecuting,c=r.state.isBottomExecuted,u=r.bottomRequestData;l&&(s=r.state.isTopExecuting,c=r.state.isTopExecuted,u=r.topRequestData);var d=!l&&!(null!==(e=r.props.tile)&&void 0!==e&&e.secondQueryResponse)||l&&!(null!==(t=r.props.tile)&&void 0!==t&&t.queryResponse)||s||!c,p=null===(n=r.props)||void 0===n?void 0:n.secondDisplayType;return r.renderResponse({renderPlaceholder:d,isExecuting:s,isExecuted:c,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(r.SECOND_QUERY_RESPONSE_KEY),ref:function(e){return e&&e!==r.state.secondResponseRef&&r._isMounted&&r.setState({secondResponseRef:e})},optionsToolbarRef:r.secondOptionsToolbarRef,vizToolbarRef:r.secondVizToolbarRef,initialDisplayType:p,queryResponse:(null===(o=r.props.tile)||void 0===o?void 0:o.secondQueryResponse)||(null===(a=r.props.tile)||void 0===a?void 0:a.queryResponse),initialTableConfigs:r.props.tile.secondDataConfig,initialAggConfig:r.props.tile.secondAggConfig,onTableConfigChange:r.onSecondDataConfigChange,onAggConfigChange:r.onSecondAggConfigChange,queryValidationSelections:r.props.tile.secondQueryValidationSelections,onSuggestionClick:r.onSecondSuggestionClick,defaultSelectedSuggestion:null===(i=r.props.tile)||void 0===i?void 0:i.secondDefaultSelectedSuggestion,reportProblemCallback:r.secondReportProblemCallback,onNoneOfTheseClick:r.secondOnNoneOfTheseClick,onDrilldownStart:function(e){r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!0,activeKey:e,queryOutputRef:r.state.secondResponseRef})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onSecondQueryValidationSelectOption,queryRequestData:u,onDisplayTypeChange:r.onSecondDisplayTypeChange,dataPageSize:r.props.tile.secondPageSize,onPageSizeChange:r.onSecondPageSizeChange,onBucketSizeChange:r.onSecondBucketSizeChange,bucketSize:r.props.tile.secondBucketSize},vizToolbarProps:{ref:function(e){return r.secondVizToolbarRef=e},responseRef:r.state.secondResponseRef},optionsToolbarProps:{ref:function(e){return r.secondOptionsToolbarRef=e},responseRef:r.state.secondResponseRef},isSecondHalf:!0})})),mn(Cn(r),"renderContent",(function(){return f.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(r.props.isEditing?" editing":"","\n ").concat(r.props.tile.h<4?" small":"")},f.createElement("div",{className:"dashboard-tile-response-container"},r.getIsSplitView()?r.renderSplitResponse():r.renderTopResponse()))})),mn(Cn(r),"renderDragHandle",(function(e,t){return f.createElement("div",fn({},e,{className:"react-autoql-dashboard-tile-drag-handle ".concat(t)}))})),mn(Cn(r),"renderDragHandles",(function(){var e={onMouseDown:function(e){return e.stopPropagation(),r.props.onMouseDown(e)},onMouseUp:function(e){return e.stopPropagation(),r.props.onMouseUp(e)},onTouchStart:function(e){return e.stopPropagation(),r.props.onTouchStart(e)},onTouchEnd:function(e){return e.stopPropagation(),r.props.onTouchEnd(e)}};return f.createElement(h,null,r.renderDragHandle(e,"top"),r.renderDragHandle(e,"bottom"),r.renderDragHandle(e,"left"),r.renderDragHandle(e,"right"))})),mn(Cn(r),"renderDeleteBtn",(function(){return f.createElement("div",{className:"dashboard-tile-delete-button",onClick:function(){return r.props.deleteTile(r.props.tile.i)}},f.createElement(Wn,{style:{fontSize:"18px"},type:"close"}))})),mn(Cn(r),"render",(function(){var e={};return r.props.isDragging&&(e.pointerEvents="none"),f.createElement(Rn,null,f.createElement("div",{ref:function(e){return r.ref=e},className:r.props.className,style:an({},r.props.style),"data-grid":r.props.tile,"data-test":"react-autoql-dashboard-tile"},r.props.children,f.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(r.COMPONENT_KEY),ref:function(e){return r.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(r.getIsSplitView()?"split":""),style:e},f.createElement(h,null,r.renderHeader(),r.renderContent())),r.props.isEditing&&r.renderDragHandles(),r.props.isEditing&&r.renderDeleteBtn()))})),r.dashboardTileTitleRef=void 0,r.optionsToolbarRef=void 0,r.secondOptionsToolbarRef=void 0,r.COMPONENT_KEY=C(),r.FIRST_QUERY_RESPONSE_KEY=C(),r.SECOND_QUERY_RESPONSE_KEY=C(),r.DEFAULT_AJAX_PAGE_SIZE=50,r.autoCompleteTimer=void 0,r.debounceTime=50,r.paramsToSet={},r.callbackArray=[];var i=e.tile,l={};(null==i?void 0:i.aggConfig)&&(null===(o=Object.keys(i.aggConfig))||void 0===o||o.forEach((function(e){var t;null!==(t=i.aggConfig)&&void 0!==t&&t[e]&&(l[e]=i.aggConfig[e].toUpperCase())})));var s={};return(null==i?void 0:i.secondAggConfig)&&(null===(a=Object.keys(i.secondAggConfig))||void 0===a||a.forEach((function(e){var t;null!==(t=i.secondAggConfig)&&void 0!==t&&t[e]&&(s[e]=i.secondAggConfig[e].toUpperCase())}))),e.setParamsForTile({aggConfig:l,secondAggConfig:s},i.i),r.state={query:i.query,secondQuery:i.secondQuery||i.query,title:i.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,isTitleOverFlow:!1,isTopExecuted:!!i.queryResponse,isBottomExecuted:i.splitView&&(r.areTopAndBottomSameQuery()?!!i.queryResponse:!!i.secondQueryResponse)},r}return pn(n)}();mn(Cs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tile:b.shape({}).isRequired,isEditing:b.bool,deleteTile:b.func,dataPageSize:b.number,queryResponse:b.shape({}),notExecutedText:b.oneOfType([b.string,b.element]),onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool,setParamsForTile:b.func}),mn(Cs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,query:"",title:"",isEditing:!1,displayType:"table",dataPageSize:void 0,queryValidationSelections:void 0,defaultSelectedSuggestion:void 0,notExecutedText:'Hit "Execute" to run this dashboard',autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!0,deleteTile:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){},onTouchStart:function(){},onTouchEnd:function(){},setParamsForTile:function(){}});var Es=f.forwardRef((function(e,t){var n=e.style,o=e.className;e.key;var a=yn(e,bs);return f.createElement("div",{style:an({},n),className:o,ref:t},f.createElement(Cs,fn({},a,{rglRef:t,ref:a.tileRef,className:"".concat(a.innerDivClass," ").concat(a.isEditing?"editing":"")})))})),Ss=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidMount",(function(){e.setState({isMounted:!0})})),mn(Cn(e),"render",(function(){var t;return f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},f.createElement("div",{className:"dashboard-drilldown-table-and-toolbars-container"},f.createElement(bl,{ref:function(t){return e.responseRef=t},vizToolbarRef:e.vizToolbarRef,optionsToolbarRef:e.optionsToolbarRef,initialDisplayType:"table",isResizing:e.props.isResizing,authentication:e.props.authentication,autoQLConfig:an(an({},zo(e.props.autoQLConfig)),{},{enableDrilldowns:!1}),originalQueryID:null===(t=e.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.query_id,dataFormatting:e.props.dataFormatting,queryResponse:e.props.queryResponse,renderTooltips:!1,reportProblemCallback:e.props.reportProblemCallback,enableAjaxTableData:e.props.enableAjaxTableData,showQueryInterpretation:e.props.showQueryInterpretation,reverseTranslationPlacement:"top",tooltipID:e.props.tooltipID,chartTooltipID:e.props.chartTooltipID,allowDisplayTypeChange:!0,height:"100%",width:"100%"}),f.createElement("div",{className:"drilldown-modal-toolbars"},f.createElement("div",{className:"drilldown-modal-viz-toolbar"},f.createElement(Cl,{ref:function(t){return e.vizToolbarRef=t},autoQLConfig:e.props.autoQLConfig,responseRef:e.responseRef,tooltipID:e.props.tooltipID})),f.createElement("div",{className:"drilldown-modal-options-toolbar"},f.createElement($l,{authentication:e.props.authentication,autoQLConfig:an(an({},zo(e.props.autoQLConfig)),{},{enableNotifications:!1}),ref:function(t){return e.optionsToolbarRef=t},responseRef:e.responseRef,tooltipID:e.props.tooltipID,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessCallback,popoverPositions:["top","left","right","bottom"],onCSVDownloadStart:e.props.onCSVDownloadStart,onCSVDownloadProgress:e.props.onCSVDownloadProgress,onCSVDownloadFinish:e.props.onCSVDownloadFinish,popoverAlign:"end"})))))})),e}return pn(n)}();mn(Ss,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tooltipID:b.string,chartTooltipID:b.string,reportProblemCallback:b.func}),mn(Ss,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tooltipID:null,chartTooltipID:null,reportProblemCallback:function(){}});var Ts=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){var n;null!==(n=o.splitterLayoutRef)&&void 0!==n&&n.splitter&&o.renderSplitterCollapseBtn(),t.isDrilldownChartHidden!==o.state.isDrilldownChartHidden&&Co()})),mn(Cn(o),"renderSplitterCollapseBtn",(function(){var e=document.querySelector("#splitter-btn-".concat(o.COMPONENT_KEY));if(e)e.setAttribute("data-tip",o.state.isDrilldownChartHidden?"Show chart":"Hide chart");else{var t=document.createElement("div");t.innerHTML="&#94;",t.className="splitter-collapse-btn",t.id="splitter-btn-".concat(o.COMPONENT_KEY),t.setAttribute("data-for",o.props.tooltipID),t.addEventListener("click",(function(){o.setState({isDrilldownChartHidden:!o.state.isDrilldownChartHidden,isResizingDrilldown:!0},(function(){o.setState({isResizingDrilldown:!1})}))})),o.splitterLayoutRef.splitter.parentNode.insertBefore(t,o.splitterLayoutRef.splitter.nextSibling)}})),mn(Cn(o),"shouldShowOriginalQuery",(function(){var e,t=null===(e=o.props.activeDrilldownRef)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.displayType;return!!t&&$n.includes(t)})),mn(Cn(o),"reportProblemCallback",(function(){o.setState({isReportProblemOpen:!0})})),mn(Cn(o),"renderDrilldownTable",(function(){return o.props.isDrilldownRunning?f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},f.createElement("div",{className:"dashboard-tile-loading-container"},f.createElement(Xa,null))):f.createElement(Ss,{authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,dataFormatting:o.props.dataFormatting,isResizing:o.props.isAnimating||o.state.isResizingDrilldown,isLoading:o.props.isDrilldownRunning,queryResponse:o.props.drilldownResponse,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,reportProblemCallback:o.reportProblemCallback,enableAjaxTableData:o.props.enableAjaxTableData,showQueryInterpretation:o.props.showQueryInterpretation,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,onCSVDownloadStart:o.props.onCSVDownloadStart,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onCSVDownloadFinish:o.props.onCSVDownloadFinish})})),mn(Cn(o),"renderReportProblemModal",(function(){return f.createElement(Jl,{authentication:o.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:o.closeReportProblemModal,onReportProblem:o.onReportProblem,responseRef:o.drilldownTableRef,isVisible:o.state.isReportProblemOpen})})),mn(Cn(o),"closeReportProblemModal",(function(){o.setState({isReportProblemOpen:!1})})),mn(Cn(o),"onReportProblem",(function(e){var t=e.successMessage,n=e.error;t?(o.props.onSuccessCallback(t),o._isMounted&&o.setState({isReportProblemOpen:!1})):n&&o.props.onErrorCallback(n)})),mn(Cn(o),"render",(function(){var e,t,n,a,r,i,l,s;o.props.isOpen&&((i=null===(l=o.props.activeDrilldownRef)||void 0===l?void 0:l.queryResponse)&&(i.data.data.columns=null===(s=o.props.activeDrilldownRef)||void 0===s||null===(s=s.state)||void 0===s?void 0:s.columns));var c=!o.state.isDrilldownChartHidden&&o.shouldShowOriginalQuery();return f.createElement(Rn,null,f.createElement(Sl,{className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(o.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(o.shouldShowOriginalQuery()?"":"table-only"),title:null===(e=o.props.activeDrilldownRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text,isVisible:o.props.isOpen,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,shouldRender:o.props.shouldRender,onClose:o.props.onClose},f.createElement(f.Fragment,null,!(null===(t=o.props.activeDrilldownRef)||void 0===t||!t.queryResponse)&&f.createElement(en,{ref:function(e){return o.splitterLayoutRef=e},vertical:!0,percentage:!0,primaryMinSize:c?35:0,secondaryMinSize:25,secondaryInitialSize:50,onDragStart:function(){return o.setState({isResizingDrilldown:!0})},onDragEnd:function(){return o.setState({isResizingDrilldown:!1})}},f.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},o.shouldShowOriginalQuery()&&f.createElement(f.Fragment,null,!(null===(n=o.props.activeDrilldownRef)||void 0===n||!n.queryResponse)&&f.createElement(bl,fn({},o.props.activeDrilldownRef.props,{ref:function(e){return o.drilldownTopRef=e},queryResponse:i,isDrilldownChartHidden:o.state.isDrilldownChartHidden,key:"dashboard-drilldown-chart-".concat(null===(a=o.props.activeDrilldownRef)||void 0===a||null===(a=a.queryResponse)||void 0===a?void 0:a.query_id),activeChartElementKey:o.props.activeDrilldownChartElementKey,initialDisplayType:null===(r=o.props.activeDrilldownRef)||void 0===r||null===(r=r.state)||void 0===r?void 0:r.displayType,initialTableConfigs:{tableConfig:o.props.activeDrilldownRef.tableConfig,pivotTableConfig:o.props.activeDrilldownRef.pivotTableConfig},isAnimating:o.props.isAnimating,isResizing:o.state.isResizingDrilldown||!o.props.isOpen,showQueryInterpretation:o.props.showQueryInterpretation,reverseTranslationPlacement:"top",allowDisplayTypeChange:!1,source:o.props.source,height:"100%",width:"100%"})))),o.renderDrilldownTable()))),o.renderReportProblemModal())})),o.COMPONENT_KEY=C(),o.state={isReportProblemOpen:!1,isResizingDrilldown:!1},o}return pn(n)}();mn(Ts,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tiles:b.arrayOf(b.shape({})),executeOnMount:b.bool,dataPageSize:b.number,executeOnStopEditing:b.bool,isEditing:b.bool,isEditable:b.bool,notExecutedText:b.string,onChange:b.func,enableDynamicCharting:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool}),mn(Ts,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Ds=$t(Zt),xs=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.executeOnMount&&a.executeDashboard(),window.addEventListener("resize",a.onWindowResize)})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){return!Ma(a.props,e)||!Ma(a.state,t)})),mn(Cn(a),"componentDidUpdate",(function(e,t){e.isEditing&&!a.props.isEditing&&a.props.executeOnStopEditing&&a.executeDashboard(),!e.isEditing&&a.props.isEditing&&a.refreshTileLayouts(),a.props.isEditing!==e.isEditing&&(a.resetTileStateLog(),a.setState({isDragging:!0},(function(){a.setState({isDragging:!1})}))),a.state.isDrilldownModalVisible!==t.isDrilldownModalVisible&&Eo()})),mn(Cn(a),"componentWillUnmount",(function(){try{a._isMounted=!1,window.removeEventListener("resize",a.onWindowResize),clearTimeout(a.scrollToNewTileTimeout),clearTimeout(a.stopDraggingTimeout),clearTimeout(a.animationTimeout)}catch(e){console.error(e)}})),mn(Cn(a),"resetTileStateLog",(function(){var e;null!==(e=a.tileLog)&&void 0!==e&&e[0]?a.tileLog=[a.tileLog[0]]:a.tileLog=[a.getMostRecentTiles()],a.currentLogIndex=0})),mn(Cn(a),"getMostRecentTiles",(function(){return a.onChangeTiles?a.onChangeTiles:a.props.tiles})),mn(Cn(a),"subscribeToCallback",(function(e){a.callbackSubsciptions=[].concat(Tn(a.callbackSubsciptions),Tn(e))})),mn(Cn(a),"debouncedOnChange",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];a.onChangeTiles=S(e);var o=new Promise((function(e,o){try{a.subscribeToCallback([e]),null!=n&&n.length&&a.subscribeToCallback(n),t&&a.addTileStateToLog(a.onChangeTiles),a.onChangeTimer&&clearTimeout(a.onChangeTimer),a.onChangeTimer=setTimeout((function(){if(a.onChangeTiles){var t;if(a.props.onChange(a.onChangeTiles),a.onChangeTiles=null,null!==(t=a.callbackSubsciptions)&&void 0!==t&&t.length){var n=S(a.callbackSubsciptions);return a.callbackSubsciptions=[],void n.forEach((function(e,t){a.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(t+1))}))}return e()}return e()}),a.debounceTime)}catch(e){return console.error(e),a.callbackSubsciptions=[],o()}}));return o})),mn(Cn(a),"onWindowResize",(function(e){a.currentWindowWidth||(a.currentWindowWidth=window.innerWidth);var t=e.target.innerWidth!==a.currentWindowWidth;t&&a._isMounted&&(a.state.isWindowResizing||(a.currentWindowWidth=window.innerWidth,a.setState({isWindowResizing:!0})),t&&(a.windowResizeTimer=setTimeout((function(){t&&a._isMounted&&(a.currentWindowWidth=void 0,a.setState({isWindowResizing:!1}))}),500)))})),mn(Cn(a),"refreshTileLayouts",(function(){try{for(var e in a.tileRefs)a.tileRefs[e]&&a.tileRefs[e].refreshLayout()}catch(e){console.error(e)}})),mn(Cn(a),"executeDashboard",(function(){try{var e=[];for(var t in a.tileRefs)a.tileRefs[t]&&e.push(a.tileRefs[t].processTile());return Promise.all(e).catch((function(){return Promise.reject(new Error("There was an error processing this dashboard. Please try again."))}))}catch(e){return void console.error(e)}})),mn(Cn(a),"unExecuteDashboard",(function(){try{for(var e in a.tileRefs)a.tileRefs[e]&&a.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),mn(Cn(a),"getChangeDetection",(function(e,t,o){return!n(a.getChangeDetectionTileStructure(e,o),a.getChangeDetectionTileStructure(t,o))})),mn(Cn(a),"getChangeDetectionTileStructure",(function(e,t){try{if(null!=e&&e.length)return e.map((function(e){if(e)return{query:!t&&e.query,title:!t&&e.title,i:e.i,w:e.w,h:e.h,x:e.x,y:e.y}}))}catch(e){console.error(e)}return e})),mn(Cn(a),"scrollToNewTile",(function(e){a.scrollToNewTileTimeout=setTimeout((function(){try{var t,n=null===(t=a.tileRefs)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.ref;if(n){var o,r=null===(o=a.ref)||void 0===o||null===(o=o.parentElement)||void 0===o?void 0:o.getBoundingClientRect(),i=r.y,l=i+r.height,s=null==n?void 0:n.getBoundingClientRect(),c=s.y;c+s.height>l?n.scrollIntoView(!1):c<i&&n.scrollIntoView(!0)}}catch(e){}}),200)})),mn(Cn(a),"refreshLayout",(function(){window.dispatchEvent(new Event("resize")),a.setState({isWindowResizing:!0},(function(){a.setState({isWindowResizing:!1})}))})),mn(Cn(a),"onMoveStart",(function(e,t,n,o,r,i){a.setIsDragging(!0)})),mn(Cn(a),"onDrag",(function(e,t,n,o,a,r){a.stopPropagation()})),mn(Cn(a),"setIsDragging",(function(e){a._isMounted&&e!==a.state.isDragging&&a.isDragging!==e&&(a.isDragging=e,a.setState({isDragging:e}))})),mn(Cn(a),"addTileStateToLog",(function(e){a.props.isEditing&&e&&a.getChangeDetection(e,a.tileLog[a.currentLogIndex],!0)&&a.tileLog.unshift(S(e))})),mn(Cn(a),"onMoveEnd",(function(e,t,n,o,r,i){try{var l=a.getMostRecentTiles();a.getChangeDetection(l,e,!0)&&a.addTileStateToLog(l),clearTimeout(a.stopDraggingTimeout),a.stopDraggingTimeout=setTimeout((function(){a.setIsDragging(!1)}),0)}catch(e){console.error(e)}})),mn(Cn(a),"updateTileLayout",(function(e){try{var t=a.getMostRecentTiles().map((function(t,n){return an(an({},t),e[n])}));a.debouncedOnChange(t,!1)}catch(e){console.error(e)}})),mn(Cn(a),"addTile",(function(){try{var e=S(a.getMostRecentTiles()),t=C();e.push({key:t,i:t,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),a.debouncedOnChange(e).then((function(){a.scrollToNewTile(t)})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),mn(Cn(a),"changeCurrentTileState",(function(e){try{var t=S(a.tileLog[e]);t&&(a.currentLogIndex=e,a.debouncedOnChange(t,!1))}catch(e){console.error(e)}})),mn(Cn(a),"undo",(function(){a.props.isEditing?a.changeCurrentTileState(a.currentLogIndex+1):console.warn('Unable perform "undo" action outside of edit mode. Set the isEditing prop to true to enable edit mode.')})),mn(Cn(a),"redo",(function(){a.props.isEditing?a.changeCurrentTileState(a.currentLogIndex-1):console.warn('Unable perform "redo" action outside of edit mode. Set the isEditing prop to true to enable edit mode.')})),mn(Cn(a),"deleteTile",(function(e){try{var t=S(a.getMostRecentTiles()),n=t.map((function(e){return e.i})).indexOf(e);~n&&t.splice(n,1),a.debouncedOnChange(t)}catch(e){console.error(e)}})),mn(Cn(a),"setParamsForTile",(function(e,t,n){try{var o,r,i=a.getMostRecentTiles(),l=S(a.getMostRecentTiles()),s=l.map((function(e){return e.i})).indexOf(t);l[s]=an(an({},l[s]),e),Object.keys(e).includes("query")&&e.query!==(null===(o=i[s])||void 0===o?void 0:o.query)?(l[s].dataConfig=void 0,l[s].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==(null===(r=i[s])||void 0===r?void 0:r.secondQuery)&&(l[s].secondDataConfig=void 0,l[s].secondskipQueryValidation=!1),a.debouncedOnChange(l,!0,n)}catch(e){console.error(e)}})),mn(Cn(a),"onDrilldownStart",(function(e){var t=e.tileId,n=e.activeKey,o=e.isSecondHalf,r=e.queryOutputRef;zo(a.props.autoQLConfig).enableDrilldowns&&(a.activeDrilldownRef=r,a.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:o,activeDrilldownTile:t||a.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:n,isAnimatingModal:!a.state.isDrilldownModalVisible}),a.animationTimeout=setTimeout((function(){a._isMounted&&a.setState({isAnimatingModal:!1})}),500))})),mn(Cn(a),"onDrilldownEnd",(function(e){var t=e.response,n=e.error;t?a._isMounted&&a.setState({activeDrilldownResponse:t,isDrilldownRunning:!1}):n&&(console.error(n),a._isMounted&&a.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),mn(Cn(a),"closeDrilldownModal",(function(){a.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})})),mn(Cn(a),"renderEmptyDashboardMessage",(function(){return a.props.isEditable&&!a.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:a.props.startEditingCallback},"New Dashboard")):a.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:a.addTile},"New Tile")," ","to get started"):f.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),mn(Cn(a),"renderTiles",(function(){var e=a.getMostRecentTiles().map((function(e){return an(an({},e),{},{i:e.key,h:e.h>10?10:e.h,maxH:10,minH:2,minW:3})})),t=a.props.dataPageSize;return a.props.enableAjaxTableData&&!t&&(t=a.DEFAULT_AJAX_PAGE_SIZE),f.createElement(Ds,{ref:function(e){return a.rglRef=e},onLayoutChange:function(e){a.updateTileLayout(e),a.setState({layout:e})},onDrag:a.onDrag,onDragStart:a.onMoveStart,onResizeStart:a.onMoveStart,onDragStop:a.onMoveEnd,onResizeStop:a.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:a.props.isEditing,isResizable:a.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return f.createElement(Es,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(t){return a.tileRefs[e.key]=t},key:e.key,dashboardRef:a.ref,authentication:a.props.authentication,cancelQueriesOnUnmount:a.props.cancelQueriesOnUnmount,autoQLConfig:a.props.autoQLConfig,tile:an(an({},e),{},{i:e.key,maxH:10,minH:2,minW:3}),displayType:e.displayType,secondDisplayType:e.secondDisplayType,secondDisplayPercentage:e.secondDisplayPercentage,isEditing:a.props.isEditing,isDragging:a.state.isDragging||a.state.isWindowResizing,isWindowResizing:a.state.isWindowResizing,setParamsForTile:a.setParamsForTile,deleteTile:a.deleteTile,dataFormatting:a.props.dataFormatting,notExecutedText:a.props.notExecutedText,enableDynamicCharting:a.props.enableDynamicCharting,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessCallback,autoChartAggregations:a.props.autoChartAggregations,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.onDrilldownEnd,onCSVDownloadStart:a.props.onCSVDownloadStart,onCSVDownloadProgress:a.props.onCSVDownloadProgress,onCSVDownloadFinish:a.props.onCSVDownloadFinish,enableAjaxTableData:a.props.enableAjaxTableData,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,source:a.SOURCE,scope:a.props.scope})})))})),mn(Cn(a),"render",(function(){var e=a.getMostRecentTiles();return f.createElement(Rn,null,f.createElement(h,null,f.createElement("div",{ref:function(e){return a.ref=e},className:"react-autoql-dashboard-container".concat(a.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?a.renderTiles():a.renderEmptyDashboardMessage()),f.createElement(Ts,{authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,dataFormatting:a.props.dataFormatting,isOpen:a.state.isDrilldownModalVisible,onClose:a.closeDrilldownModal,drilldownResponse:a.state.activeDrilldownResponse,shouldRender:a.state.isDrilldownModalVisible&&!a.state.isDragging&&!a.state.isWindowResizing,activeDrilldownChartElementKey:a.state.activeDrilldownChartElementKey,isAnimating:a.state.isAnimatingModal,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,showQueryInterpretation:a.props.isEditing,isDrilldownRunning:a.state.isDrilldownRunning,enableAjaxTableData:a.props.enableAjaxTableData,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessCallback,activeDrilldownRef:a.activeDrilldownRef,onCSVDownloadStart:a.props.onCSVDownloadStart,onCSVDownloadProgress:a.props.onCSVDownloadProgress,onCSVDownloadFinish:a.props.onCSVDownloadFinish,source:a.SOURCE}),f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),f.createElement(So,{className:"react-autoql-chart-tooltip",id:a.CHART_TOOLTIP_ID,effect:"solid",place:"top",html:!0})))})),a.COMPONENT_KEY=C(),a.SOURCE=Va(e.source,"dashboards"),a.TOOLTIP_ID="react-autoql-dashboard-toolbar-btn-tooltip-".concat(a.COMPONENT_KEY),a.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(a.COMPONENT_KEY),a.tileRefs={},a.debounceTime=50,a.onChangeTiles=null,a.callbackSubsciptions=[],a.tileLog=[e.tiles],a.currentLogIndex=0,a.state={isDragging:!1,isReportProblemOpen:!1,isResizingDrilldown:!1},a}return pn(o)}();mn(xs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tiles:b.arrayOf(b.shape({})),executeOnMount:b.bool,dataPageSize:b.number,executeOnStopEditing:b.bool,isEditing:b.bool,isEditable:b.bool,notExecutedText:b.oneOfType([b.string,b.element]),onChange:b.func,enableDynamicCharting:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool,startEditingCallback:b.func}),mn(xs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){},startEditingCallback:function(){}});var Rs=Ga(xs),Is=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),mn(Cn(e),"componentDidUpdate",(function(t){e.props.finalTranscript!==t.finalTranscript?e.props.onFinalTranscript(e.props.finalTranscript):e.props.transcript!==t.transcript?e.props.onTranscriptChange(e.props.transcript):e.props.interimTranscript!==t.interimTranscript&&e.props.onTranscriptChange(e.props.interimTranscript)})),mn(Cn(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=tn(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:nn,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),mn(Cn(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),mn(Cn(e),"stopRecording",(function(){e.setState({isRecording:!1}),e.recordAudio.stopRecording((function(){var t=e.recordAudio.getBlob();e.onRecordStop(e.blobToFile(t),t);try{e.stream.getTracks().forEach((function(e){return e.stop()}))}catch(e){console.error(e)}}))})),mn(Cn(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),mn(Cn(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),mn(Cn(e),"onMouseDown",(function(){Eo(),e.startRecording()})),mn(Cn(e),"sendWavFile",(function(t){var n="".concat(e.props.authentication.domain,"/autoql/api/v1/query/speech-to-text?key=").concat(e.props.authentication.apiKey),o=new FormData;o.append("file",t,"speech.wav");var a={headers:{Authorization:"Bearer ".concat(e.props.authentication.token)},timeout:3e4};E.post(n,o,a).then((function(t){e.props.onTranscriptChange(t.data.data.transcription)})).catch((function(t){404===t.response.status?e.setState({errorMessage:"Oops! Speech-to-text has not been enabled. Try typing a query instead."},(function(){e.setState({showPopoverMessage:!0})})):e.setState({errorMessage:"Oops! Something wrong with your account"},(function(){e.setState({showPopoverMessage:!0})}))}))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,f.createElement(Xn,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return f.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},f.createElement(Wn,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},f.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(e.state.isRecording?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:e.stopRecording,onMouseLeave:e.state.isRecording?e.stopRecording:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.state.isRecording},f.createElement(Wn,{type:"microphone"}))),f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return pn(n)}();mn(Is,"propTypes",{authentication:nr,transcript:b.string,interimTranscript:b.string,finalTranscript:b.string,resetTranscript:b.func,onTranscriptChange:b.func,onFinalTranscript:b.func}),mn(Is,"defaultProps",{authentication:Mo});export{ei as ConditionBuilder,Rs as Dashboard,Es as DashboardTile,Ul as DataAlertModal,Xl as DataAlerts,dr as DataExplorer,hs as DataMessenger,Za as ExploreQueries,Nl as ExpressionBuilder,ss as FilterLockPopover,Wn as Icon,Xa as LoadingDots,as as NotificationFeed,yr as NotificationIcon,ns as NotificationItem,$l as OptionsToolbar,ms as QueryInput,bl as QueryOutput,$a as QuerySuggestionList,Jl as ReportProblemModal,Xr as ReverseTranslation,Ol as ScheduleBuilder,Is as SpeechToTextButton,us as SpeechToTextButtonBrowser,Cl as VizToolbar,Wa as configureTheme,Da as getDefaultDisplayType,Ea as getSupportedDisplayTypes,Sa as isDisplayTypeValid};
1
+ import"react-perfect-scrollbar/dist/css/styles.css";import e from"lodash.get";import t from"lodash.filter";import n from"lodash.isequal";import o from"dayjs";import a from"dayjs/plugin/advancedFormat";import r from"dayjs/plugin/localizedFormat";import i from"dayjs/plugin/utc";import l from"dayjs/plugin/timezone";import s from"dayjs/plugin/isBetween";import c from"dayjs/plugin/weekOfYear";import u from"dayjs/plugin/quarterOfYear";import d from"dayjs/plugin/customParseFormat";import p from"dayjs/plugin/isSameOrBefore";import m from"dayjs/plugin/isToday";import f,{useEffect as g,Component as v,Fragment as h}from"react";import b,{PropTypes as y}from"prop-types";import{v4 as C}from"uuid";import E from"axios";import S from"lodash.clonedeep";import{AiOutlineBook as T}from"@react-icons/all-files/ai/AiOutlineBook";import{AiOutlineBulb as D}from"@react-icons/all-files/ai/AiOutlineBulb";import{AiOutlineDashboard as x}from"@react-icons/all-files/ai/AiOutlineDashboard";import{AiOutlineEdit as R}from"@react-icons/all-files/ai/AiOutlineEdit";import{AiOutlineFileText as I}from"@react-icons/all-files/ai/AiOutlineFileText";import{AiOutlineMenu as A}from"@react-icons/all-files/ai/AiOutlineMenu";import{AiOutlineQuestionCircle as N}from"@react-icons/all-files/ai/AiOutlineQuestionCircle";import{AiOutlineTag as w}from"@react-icons/all-files/ai/AiOutlineTag";import{AiOutlineFileSearch as k}from"@react-icons/all-files/ai/AiOutlineFileSearch";import{AiOutlineNumber as P}from"@react-icons/all-files/ai/AiOutlineNumber";import{BiLineChart as O}from"@react-icons/all-files/bi/BiLineChart";import{BiSearchAlt as L}from"@react-icons/all-files/bi/BiSearchAlt";import{BiBookmark as M}from"@react-icons/all-files/bi/BiBookmark";import{BiBook as q}from"@react-icons/all-files/bi/BiBook";import{BiNote as V}from"@react-icons/all-files/bi/BiNote";import{BiAbacus as _}from"@react-icons/all-files/bi/BiAbacus";import{BiEnvelope as F}from"@react-icons/all-files/bi/BiEnvelope";import{BiEnvelopeOpen as z}from"@react-icons/all-files/bi/BiEnvelopeOpen";import{BsArrowBarUp as B}from"@react-icons/all-files/bs/BsArrowBarUp";import{BsArrowBarDown as H}from"@react-icons/all-files/bs/BsArrowBarDown";import{BsLightning as Q}from"@react-icons/all-files/bs/BsLightning";import{FaMicrophoneAlt as U}from"@react-icons/all-files/fa/FaMicrophoneAlt";import{FiAlertTriangle as Y}from"@react-icons/all-files/fi/FiAlertTriangle";import{FiArrowLeft as K}from"@react-icons/all-files/fi/FiArrowLeft";import{FiBell as j}from"@react-icons/all-files/fi/FiBell";import{FiBellOff as W}from"@react-icons/all-files/fi/FiBellOff";import{FiCalendar as G}from"@react-icons/all-files/fi/FiCalendar";import{FiCheck as X}from"@react-icons/all-files/fi/FiCheck";import{FiDatabase as J}from"@react-icons/all-files/fi/FiDatabase";import{FiDownload as Z}from"@react-icons/all-files/fi/FiDownload";import{FiEye as $}from"@react-icons/all-files/fi/FiEye";import{FiMoreHorizontal as ee}from"@react-icons/all-files/fi/FiMoreHorizontal";import{FiMoreVertical as te}from"@react-icons/all-files/fi/FiMoreVertical";import{FiPauseCircle as ne}from"@react-icons/all-files/fi/FiPauseCircle";import{FiPlus as oe}from"@react-icons/all-files/fi/FiPlus";import{FiSend as ae}from"@react-icons/all-files/fi/FiSend";import{FiSettings as re}from"@react-icons/all-files/fi/FiSettings";import{FiTrash2 as ie}from"@react-icons/all-files/fi/FiTrash2";import{FiMaximize as le}from"@react-icons/all-files/fi/FiMaximize";import{FiMinimize as se}from"@react-icons/all-files/fi/FiMinimize";import{FiRefreshCw as ce}from"@react-icons/all-files/fi/FiRefreshCw";import{FiTool as ue}from"@react-icons/all-files/fi/FiTool";import{RiFilterLine as de}from"@react-icons/all-files/ri/RiFilterLine";import{RiFilterOffLine as pe}from"@react-icons/all-files/ri/RiFilterOffLine";import{RiListSettingsLine as me}from"@react-icons/all-files/ri/RiListSettingsLine";import{RiBroadcastFill as fe}from"@react-icons/all-files/ri/RiBroadcastFill";import{GoReport as ge}from"@react-icons/all-files/go/GoReport";import{IoIosCloseCircleOutline as ve}from"@react-icons/all-files/io/IoIosCloseCircleOutline";import{IoIosGlobe as he}from"@react-icons/all-files/io/IoIosGlobe";import{IoIosHourglass as be}from"@react-icons/all-files/io/IoIosHourglass";import{IoIosSearch as ye}from"@react-icons/all-files/io/IoIosSearch";import{IoIosArrowDown as Ce}from"@react-icons/all-files/io/IoIosArrowDown";import{IoIosArrowUp as Ee}from"@react-icons/all-files/io/IoIosArrowUp";import{IoIosArrowBack as Se}from"@react-icons/all-files/io/IoIosArrowBack";import{IoIosArrowForward as Te}from"@react-icons/all-files/io/IoIosArrowForward";import{MdClose as De}from"@react-icons/all-files/md/MdClose";import{MdContentCopy as xe}from"@react-icons/all-files/md/MdContentCopy";import{MdError as Re}from"@react-icons/all-files/md/MdError";import{MdInfoOutline as Ie}from"@react-icons/all-files/md/MdInfoOutline";import{MdLock as Ae}from"@react-icons/all-files/md/MdLock";import{MdLockOpen as Ne}from"@react-icons/all-files/md/MdLockOpen";import{MdPlayCircleOutline as we}from"@react-icons/all-files/md/MdPlayCircleOutline";import{MdAttachMoney as ke}from"@react-icons/all-files/md/MdAttachMoney";import{isMobile as Pe,isBrowser as Oe}from"react-device-detect";import{ArrowContainer as Le,Popover as Me}from"react-tiny-popover";import qe from"react-modal";import Ve from"react-tooltip";import _e from"lodash.isempty";import Fe from"html-react-parser";import{fetchExploreQueries as ze,fetchDataExplorerSuggestions as Be,fetchSubjectList as He,fetchDataExplorerAutocomplete as Qe,fetchDataPreview as Ue,fetchVLAutocomplete as Ye,fetchAutocomplete as Ke,runQueryOnly as je,runQueryNewPage as We,AGG_TYPES as Ge,getLegendLabelsForMultiSeries as Xe,legendColor as Je,formatChartLabel as Ze,getBandScale as $e,getLinearScales as et,getPieChartData as tt,getNumberColumnIndices as nt,getMinAndMaxValues as ot,getLinearScale as at,getBinLinearScale as rt,getHistogramScale as it,aggregateData as lt,runDrilldown as st,AggTypes as ct,sendSuggestion as ut,reportProblem as dt,exportCSV as pt,setColumnVisibility as mt,setFilters as ft,unsetFilterFromAPI as gt,fetchFilters as vt,runQuery as ht}from"autoql-fe-utils";import{TabulatorFull as bt}from"tabulator-tables";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import{DateRange as yt}from"react-date-range";import"react-date-range/dist/styles.css";import"react-date-range/dist/theme/default.css";import{scaleOrdinal as Ct,scaleLinear as Et}from"d3-scale";import{select as St}from"d3-selection";import{max as Tt,min as Dt,mean as xt,deviation as Rt,median as It,bin as At}from"d3-array";import{axisTop as Nt,axisRight as wt,axisLeft as kt,axisBottom as Pt}from"d3-axis";import Ot from"react-perfect-scrollbar";import{symbol as Lt,symbolSquare as Mt,arc as qt}from"d3-shape";import{createPortal as Vt}from"react-dom";import _t from"react-slider";import Ft from"jstat";import"d3-transition";import{format as zt}from"sql-formatter";import Bt from"parse-num";import Ht from"moment-timezone";import Qt from"react-infinite-scroller";import Ut from"rc-drawer";import Yt from"react-localization";import"rc-drawer/assets/index.css";import Kt from"react-autosuggest";import{toast as jt,ToastContainer as Wt,Slide as Gt}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import Xt from"lodash.has";import Jt from"react-speech-recognition";import Zt,{WidthProvider as $t}from"react-grid-layout";import en from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import tn,{StereoAudioRecorder as nn}from"recordrtc";function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function an(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?on(Object(n),!0).forEach((function(t){mn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):on(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rn(){rn=function(){return t};var e,t={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",l=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var r=t&&t.prototype instanceof v?t:v,i=Object.create(r.prototype),l=new N(o||[]);return a(i,"_invoke",{value:x(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",m="executing",f="completed",g={};function v(){}function h(){}function b(){}var y={};c(y,i,(function(){return this}));var C=Object.getPrototypeOf,E=C&&C(C(w([])));E&&E!==n&&o.call(E,i)&&(y=E);var S=b.prototype=v.prototype=Object.create(y);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function n(a,r,i,l){var s=d(e[a],e,r);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==typeof u&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(u).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,l)}))}l(s.arg)}var r;a(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,a){n(e,o,t,a)}))}return r=r?r.then(a,a):a()}})}function x(t,n,o){var a=p;return function(r,i){if(a===m)throw new Error("Generator is already running");if(a===f){if("throw"===r)throw i;return{value:e,done:!0}}for(o.method=r,o.arg=i;;){var l=o.delegate;if(l){var s=R(l,o);if(s){if(s===g)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(a===p)throw a=f,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a=m;var c=d(t,n,o);if("normal"===c.type){if(a=o.done?f:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:o.done}}"throw"===c.type&&(a=f,o.method="throw",o.arg=c.arg)}}}function R(t,n){var o=n.method,a=t.iterator[o];if(a===e)return n.delegate=null,"throw"===o&&t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method)||"return"!==o&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+o+"' method")),g;var r=d(a,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;var i=r.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function w(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,r=function n(){for(;++a<t.length;)if(o.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return r.next=r}}throw new TypeError(typeof t+" is not iterable")}return h.prototype=b,a(S,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:h,configurable:!0}),h.displayName=c(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},T(D.prototype),c(D.prototype,l,(function(){return this})),t.AsyncIterator=D,t.async=function(e,n,o,a,r){void 0===r&&(r=Promise);var i=new D(u(e,n,o,a),r);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(S),c(S,s,"Generator"),c(S,i,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=w,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(o,a){return l.type="throw",l.arg=t,n.next=o,a&&(n.method="next",n.arg=e),!!a}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var r=a;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var i=r?r.completion:{};return i.type=e,i.arg=t,r?(this.method="next",this.next=r.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var a=o.arg;A(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,o){return this.delegate={iterator:w(t),resultName:n,nextLoc:o},"next"===this.method&&(this.arg=e),g}},t}function ln(e){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sn(e,t,n,o,a,r,i){try{var l=e[r](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,a)}function cn(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var r=e.apply(t,n);function i(e){sn(r,o,a,i,l,"next",e)}function l(e){sn(r,o,a,i,l,"throw",e)}i(void 0)}))}}function un(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,xn(o.key),o)}}function pn(e,t,n){return t&&dn(e.prototype,t),n&&dn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function mn(e,t,n){return(t=xn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fn(){return(fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function gn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&hn(e,t)}function vn(e){return(vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hn(e,t){return(hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function bn(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function yn(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Cn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function En(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Cn(e)}function Sn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=vn(e);if(t){var a=vn(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return En(this,n)}}function Tn(e){return function(e){if(Array.isArray(e))return Dn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Dn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function xn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var Rn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{hasError:!1}),mn(Cn(e),"componentDidCatch",(function(t,n){console.error("Error HOC caught error:",t),e.setState({hasError:!0}),console.error(t),console.error(n)})),mn(Cn(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),mn(Cn(e),"render",(function(){return e.state.hasError?f.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return pn(n)}();mn(Rn,"propTypes",{message:b.string}),mn(Rn,"defaultProps",{message:null});var In=f.createElement("svg",{x:"0px",y:"0px",width:"23px",height:"23px",viewBox:"0 0 23 23",style:{strokeWidth:"1.4px",marginBottom:"2px",marginLeft:"1px"}},f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-outlined",d:"M0.732,9.04l9.975-5.195c0.432-0.225,0.946-0.227,1.38-0.005l10.18,5.202c0.23,0.118,0.232,0.446,0.002,0.566\nl-10.069,5.258c-0.436,0.228-0.957,0.228-1.393,0L0.731,9.605C0.503,9.486,0.503,9.159,0.732,9.04z"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M8.324,18.906c0.842,0.251,1.887,0.419,3.176,0.419c5.065,0,6.217-2.596,6.217-2.596v-4.745"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M5.134,11.903"}),f.createElement("ellipse",{className:"react-autoql-icon-outlined",cx:"11.425",cy:"9.005",rx:"0.91",ry:"0.611"}),f.createElement("path",{className:"react-autoql-icon-outlined",d:"M10.584,9.356l-5.107,2.808v2.51l-1.105,3.941c0,0,1.23,0.842,2.072,0l-0.966-3.941"}))),An=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M8.7,3.6l0.1,0l0,0l0,0l0.1,0c2.2,0,4.3,1.3,5.2,3.3c0.2,0.4,0.3,0.7,0.4,1.1l0,0c0.1,0.4,0.1,0.8,0.1,1.2 c0,1.3-0.5,2.5-1.3,3.4c-0.4,0.4-0.8,0.7-1.2,1c-0.3,0.2-0.7,0.4-1,0.5c-0.4,0.1-0.7,0.2-1.1,0.3c-0.4,0.1-0.8,0.1-1.2,0.1 c-0.2,0-0.4,0-0.6,0c-0.2,0-0.4,0-0.6-0.1l-0.2,0c-0.3-0.1-0.6-0.2-1-0.3c-0.4-0.2-0.7-0.4-1-0.6l-1-0.9l-1,1 c-0.1,0.1-0.2,0.2-0.3,0.2c0-0.3,0-0.6,0-1l0-3.6c0-0.1,0-0.1,0-0.2C3.2,6,5.7,3.6,8.7,3.6L8.7,3.6 M8.7,2.1c-3.8,0-6.9,3-7,6.9 c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c0.1,0,0.2,0,0.3,0c1.3,0,2.5-0.5,3.5-1.4c0.4,0.4,0.9,0.7,1.5,0.9c0.5,0.2,1,0.3,1.5,0.4 l0,0C7.7,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0,0,0,0,0,0c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4c0.4-0.2,0.9-0.4,1.3-0.6 c0.6-0.4,1.1-0.8,1.6-1.3c1.1-1.2,1.7-2.8,1.7-4.5c0-0.5-0.1-1-0.2-1.5l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1-0.5-0.3-1-0.5-1.5 c-1.2-2.5-3.8-4.1-6.6-4.1c0,0-0.1,0-0.1,0C8.8,2.1,8.7,2.1,8.7,2.1L8.7,2.1z"}),f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M15,9.1c3,0,5.4,2.4,5.5,5.4c0,0.1,0,0.1,0,0.2v3.6c0,0.4,0,0.7,0,1c-0.1-0.1-0.2-0.2-0.3-0.2l-1-1l-1,0.9 c-0.3,0.3-0.7,0.5-1,0.6c-0.3,0.1-0.6,0.2-0.9,0.3L16,20c-0.2,0-0.4,0.1-0.6,0.1c-0.2,0-0.4,0-0.6,0c-0.4,0-0.8,0-1.2-0.1 c-0.4-0.1-0.8-0.2-1.1-0.3c-0.3-0.1-0.7-0.3-1-0.5c-0.5-0.3-0.9-0.6-1.2-1C9.5,17.2,9,16,9,14.7c0-0.4,0-0.8,0.1-1.1l0,0l0,0 c0.1-0.4,0.2-0.8,0.4-1.1c1-2,3-3.3,5.2-3.3l0.1,0l0,0l0,0L15,9.1 M15,7.6c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c-2.8,0-5.4,1.6-6.6,4.1 c-0.2,0.5-0.4,1-0.5,1.5l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1,0.5-0.2,1-0.2,1.5c0,1.6,0.6,3.2,1.7,4.5c0.5,0.5,1,1,1.6,1.3 c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4c0.5,0.1,1,0.1,1.5,0.1c0,0,0,0,0,0c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0 c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9c0.9,0.9,2.2,1.4,3.5,1.4c0.1,0,0.2,0,0.3,0c0,0-1-0.6-1-3.2v-3.6 c0-0.1,0-0.2,0-0.2C21.9,10.7,18.8,7.6,15,7.6L15,7.6z"})),Nn=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M16,7.7L16,7.7C16,7.7,16,7.7,16,7.7C16,7.7,16,7.7,16,7.7L16,7.7c-0.1-0.5-0.3-1-0.5-1.5C14.3,3.6,11.7,2,8.8,2.1 C5,2,1.8,5.1,1.7,8.9c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c1.4,0.1,2.7-0.4,3.7-1.4c0.4,0.4,0.9,0.7,1.5,0.9 c0.5,0.2,1,0.3,1.5,0.4l0,0C7.7,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4 c0.4-0.2,0.9-0.4,1.3-0.6c0.6-0.4,1.1-0.8,1.6-1.3c1.1-1.2,1.7-2.8,1.7-4.5C16.2,8.7,16.1,8.2,16,7.7z"})),f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M16.1,9.1c0,1.6-0.6,3.2-1.7,4.5c-0.5,0.5-1,1-1.6,1.3c-0.4,0.2-0.8,0.5-1.3,0.6c-0.4,0.2-0.9,0.3-1.4,0.4 C9.8,16,9.3,16,8.8,16c-0.2,0-0.5,0-0.7,0c-0.2,0-0.3,0-0.5-0.1c0,0,0,0,0,0C7.8,16,7.9,16,8.1,16c0.2,0,0.5,0,0.7,0c0,0,0,0,0,0 c0.5,0,1,0,1.5-0.1c0.5-0.1,0.9-0.2,1.4-0.4c0.4-0.2,0.9-0.4,1.3-0.6c0.6-0.4,1.1-0.8,1.6-1.3C15.6,12.4,16.2,10.8,16.1,9.1 c0.1-0.5,0-0.9-0.1-1.4c0,0,0,0,0,0C16.1,8.2,16.1,8.6,16.1,9.1z"})),f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M22,18.3v-3.6c0-0.1,0-0.2,0-0.2c-0.1-2.9-1.8-5.3-4.3-6.3c0,0.3,0.1,0.7,0.1,1c0,2-0.7,3.9-2,5.5 c-0.6,0.6-1.2,1.2-1.9,1.6c-0.5,0.3-1,0.5-1.5,0.7c-0.5,0.2-1.1,0.4-1.7,0.5c-0.6,0.1-1.2,0.2-1.8,0.2c-0.3,0-0.5,0-0.8,0 c0.3,0.6,0.6,1.1,1.1,1.6c0.5,0.5,1,1,1.6,1.3c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4c0.5,0.1,1,0.1,1.5,0.1 c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9c1,0.9,2.3,1.4,3.7,1.4 C22.9,21.5,22,20.9,22,18.3z"}))))),wn=f.createElement("svg",{x:"0px",y:"0px",width:"23.7px",height:"23.7px",viewBox:"0 0 23.7 23.7"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M7.7,13.2L7.7,13.2C7.7,13.2,7.7,13.2,7.7,13.2C7.7,13.2,7.7,13.2,7.7,13.2L7.7,13.2c0.1-0.5,0.3-1,0.5-1.5 c1.2-2.6,3.8-4.2,6.7-4.1c0.4,0,0.8,0,1.2,0.1c0,0,0,0,0-0.1l0,0c0,0,0,0,0,0c0,0,0,0,0,0l0,0c-0.1-0.5-0.3-1-0.5-1.5 C14.3,3.6,11.7,2,8.8,2.1C5,2,1.8,5.1,1.7,8.9c0,0.1,0,0.2,0,0.2v3.6c0,2.6-1,3.2-1,3.2c1.4,0.1,2.7-0.4,3.7-1.4 c0.4,0.4,0.9,0.7,1.5,0.9c0.5,0.2,1,0.3,1.5,0.4l0,0c0.1,0,0.1,0,0.2,0c-0.1-0.4-0.1-0.8-0.1-1.2C7.5,14.2,7.6,13.7,7.7,13.2z"})),f.createElement("g",null,f.createElement("path",{className:"react-autoql-icon-svg-0",d:"M22,18.3v-3.6c0-0.1,0-0.2,0-0.2C22,11,19.4,8.2,16,7.7c0.1,0.5,0.2,1,0.2,1.4c0,1.6-0.6,3.2-1.7,4.5 c-0.5,0.5-1,1-1.6,1.3c-0.4,0.2-0.8,0.5-1.3,0.6c-0.4,0.2-0.9,0.3-1.4,0.4c-0.5,0.1-1,0.1-1.5,0.1c-0.2,0-0.5,0-0.7,0 C8,16,7.8,16,7.6,16c0.2,1.2,0.8,2.3,1.6,3.2c0.5,0.5,1,1,1.6,1.3c0.4,0.2,0.8,0.5,1.3,0.6c0.4,0.2,0.9,0.3,1.4,0.4 c0.5,0.1,1,0.1,1.5,0.1c0.2,0,0.5,0,0.7,0c0.2,0,0.5,0,0.7-0.1l0,0c0.5-0.1,1-0.2,1.5-0.4c0.6-0.2,1.1-0.5,1.5-0.9 c1,0.9,2.3,1.4,3.7,1.4C23,21.6,22,20.9,22,18.3z"})))),kn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M8,0.8c2.3,0,4.6,0,6.9,0c0.8,0,1.1,0.3,1.1,1.1c0,4,0,7.9,0,11.9c0,0.8-0.3,1.1-1.1,1.1c-4.6,0-9.3,0-13.9,0\nc-0.7,0-1-0.3-1-1c0-4,0-8,0-12c0-0.7,0.3-1,1-1C3.4,0.8,5.7,0.8,8,0.8L8,0.8z M5,11.1H1v2.7h4V11.1L5,11.1z M10,13.8v-2.7H6v2.7\nL10,13.8L10,13.8z M11,13.8h4v-2.7h-4V13.8L11,13.8z M1.1,7.5v2.7h4V7.5H1.1L1.1,7.5z M11,10.2c1.3,0,2.5,0,3.8,0\nc0.1,0,0.2-0.1,0.2-0.2c0-0.8,0-1.7,0-2.5h-4C11,8.4,11,9.3,11,10.2L11,10.2z M6,10.1h4V7.5H6V10.1L6,10.1z M5,6.6V3.9H1\nc0,0.8,0,1.6,0,2.4c0,0.1,0.2,0.2,0.3,0.2C2.5,6.6,3.7,6.6,5,6.6L5,6.6z M6,6.5h4V3.9H6V6.5L6,6.5z M14.9,6.5V3.9h-4v2.7L14.9,6.5\nL14.9,6.5z"})),Pn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M8,0.7c2.3,0,4.6,0,6.9,0C15.7,0.7,16,1,16,1.8c0,4,0,7.9,0,11.9c0,0.8-0.3,1.1-1.1,1.1c-4.6,0-9.3,0-13.9,0 c-0.7,0-1-0.3-1-1c0-4,0-8,0-12c0-0.7,0.3-1,1-1C3.4,0.7,5.7,0.7,8,0.7L8,0.7z M5.1,6.4h4.4V3.8H5.1V6.4L5.1,6.4z M14.9,6.4V3.8 h-4.4v2.7L14.9,6.4L14.9,6.4z M5.1,10.1h4.4V7.4H5.1V10.1L5.1,10.1z M14.9,10.1V7.4h-4.4v2.7H14.9L14.9,10.1z M5.1,13.7h4.4V11H5.1 V13.7L5.1,13.7z M14.9,13.7V11h-4.4v2.7L14.9,13.7L14.9,13.7z"})),On=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M12.6,0h-2.4C9.4,0,8.8,0.6,8.8,1.4v2.7c0,0,0,0,0,0H6.3c-0.8,0-1.4,0.6-1.4,1.4v3.2c0,0-0.1,0-0.1,0H2.4 C1.6,8.7,1,9.4,1,10.1v4.5C1,15.4,1.6,16,2.4,16h2.4c0,0,0.1,0,0.1,0h1.3c0,0,0.1,0,0.1,0h2.4c0,0,0.1,0,0.1,0H10c0,0,0.1,0,0.1,0 h2.4c0.8,0,1.4-0.6,1.4-1.4V1.4C14,0.6,13.3,0,12.6,0z M6.3,5.5h2.4v9.1H6.3V5.5z M2.4,10.1h2.4v4.5H2.4V10.1z M12.6,14.6h-2.4V1.4 h2.4V14.6z"})),Ln=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M14.6,1.6H1.4C0.6,1.6,0,2.2,0,3v2.4v0.1v1.2v0.1v2.4v0.1v1.3v0.1v2.4c0,0.8,0.6,1.4,1.4,1.4h4.5 c0.7,0,1.4-0.6,1.4-1.4v-2.4v-0.1h3.2c0.8,0,1.4-0.6,1.4-1.4V6.7l0,0h2.7c0.8,0,1.4-0.6,1.4-1.4V2.9C16,2.2,15.4,1.5,14.6,1.6z M1.4,9.2V6.8h9.1v2.4H1.4z M1.4,13.1v-2.4h4.5v2.4H1.4z M14.6,2.9v2.4H1.4V2.9H14.6z"})),Mn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M1,12.2c-0.2,0-0.3-0.1-0.5-0.2c-0.3-0.3-0.3-0.7,0-1l3.8-3.9C4.5,7,4.7,7,4.9,7s0.4,0.1,0.5,0.3l2.3,3l6.8-7.1 c0.3-0.3,0.7-0.3,1,0c0.3,0.3,0.3,0.7,0,1l-7.3,7.7C8,11.9,7.8,12,7.6,12s-0.4-0.1-0.5-0.3l-2.3-3L1.5,12C1.4,12.2,1.2,12.2,1,12.2z "})),qn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M12.6,8.5H7.4V3.3c0-0.4-0.3-0.7-0.7-0.7c-0.9,0-1.8,0.2-2.6,0.5C3.3,3.5,2.6,3.9,2,4.6 C1.3,5.2,0.9,5.9,0.5,6.7C0.2,7.5,0,8.4,0,9.3c0,0.9,0.2,1.8,0.5,2.6C0.9,12.7,1.3,13.4,2,14c0.6,0.6,1.3,1.1,2.1,1.4 C4.9,15.8,5.8,16,6.7,16c0.9,0,1.8-0.2,2.6-0.5c0.8-0.3,1.5-0.8,2.1-1.4c0.6-0.6,1.1-1.3,1.4-2.1c0.3-0.8,0.5-1.7,0.5-2.6 C13.4,8.9,13,8.5,12.6,8.5z M6.7,10h5.2c-0.2,1.1-0.7,2.1-1.5,3c-1,1-2.3,1.5-3.7,1.5C5.3,14.5,4,14,3,13c-1-1-1.5-2.3-1.5-3.7 C1.5,7.9,2,6.6,3,5.6c0.8-0.8,1.8-1.3,3-1.5v5.2C6,9.7,6.3,10,6.7,10z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M15.5,4.1C15.1,3.3,14.7,2.6,14,2c-0.6-0.6-1.3-1.1-2.1-1.4C11.1,0.2,10.2,0,9.3,0C8.9,0,8.6,0.3,8.6,0.7v6 c0,0.4,0.3,0.7,0.7,0.7h6c0.4,0,0.7-0.3,0.7-0.7C16,5.8,15.8,4.9,15.5,4.1z M10,6V1.5c1.1,0.2,2.2,0.7,3,1.5c0.8,0.8,1.3,1.8,1.5,3 H10z"})),Vn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M1.4,16C0.6,16,0,15.4,0,14.6v-3.9h4.5V16H1.4z"}),f.createElement("path",{className:"hm2",d:"M8,10.7l-1.1,0V16L8,16c0.9,0,1.7-0.6,1.7-1.4v-2.5C9.7,11.3,8.9,10.7,8,10.7L8,10.7z"}),f.createElement("rect",{x:"4.5",y:"10.7",className:"hm0",width:"2.4",height:"5.3"})),f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M0,5.4l0-4.1C0,0.6,0.6,0,1.4,0h4.5v5.4H0z"}),f.createElement("path",{className:"hm2",d:"M9.2,0v5.4h1.9c0.9,0,1.6-0.7,1.6-1.5V1.5C12.7,0.7,12,0,11.2,0L9.2,0z"}),f.createElement("rect",{x:"5.9",y:"0",className:"hm0",width:"3.3",height:"5.4"})),f.createElement("g",null,f.createElement("rect",{className:"hm1",x:"0",y:"5.4",width:"8",height:"5.2"}),f.createElement("path",{className:"hm2",d:"M11.4,5.4v5.2h3.1c0.8,0,1.4-0.6,1.4-1.4V6.9c0-0.8-0.6-1.4-1.4-1.4H11.4z"}),f.createElement("rect",{x:"8",y:"5.4",className:"hm0",width:"3.4",height:"5.2"})))),_n=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M0,11.5h5.3V16H1.4C0.6,16,0,15.4,0,14.6V11.5z"}),f.createElement("path",{className:"hm2",d:"M5.3,8c0-0.9-0.6-1.7-1.4-1.7H1.4C0.6,6.3,0,7.1,0,8l0,1.1h5.3V8L5.3,8z"}),f.createElement("rect",{x:"0",y:"9.1",className:"hm0",width:"5.3",height:"2.4"})),f.createElement("g",null,f.createElement("path",{className:"hm1",d:"M10.6,10.1H16v4.5c0,0.8-0.6,1.4-1.4,1.4h-4.1V10.1z"}),f.createElement("path",{className:"hm2",d:"M16,4.8c0-0.9-0.7-1.6-1.5-1.6H12c-0.8,0-1.5,0.7-1.5,1.6v1.9H16V4.8z"}),f.createElement("rect",{x:"10.6",y:"6.8",className:"hm0",width:"5.4",height:"3.3"})),f.createElement("g",null,f.createElement("rect",{className:"hm1",x:"5.3",y:"8",width:"5.2",height:"8"}),f.createElement("path",{className:"hm2",d:"M10.6,1.4C10.6,0.6,9.9,0,9.1,0H6.7C6,0,5.3,0.6,5.3,1.4v3.1h5.2V1.4z"}),f.createElement("rect",{x:"5.3",y:"4.6",className:"hm0",width:"5.2",height:"3.4"}))),Fn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",{className:"st2"},f.createElement("polygon",{className:"hm2",points:"12,5.5 9.1,10 4.8,0 0,5 0,8 4.4,6.1 9.1,11.8 12,9.3 16,10.7 16,9.7 \t\t"})),f.createElement("polygon",{className:"hm0",points:"12,9.3 9.1,11.8 4.4,6.1 0,8 0,12.4 4.2,7.7 9.7,15.4 12.2,11.1 16,14.3 16,10.7 \t"}),f.createElement("path",{className:"hm1",d:"M9.7,15.4L4.2,7.6L0,12.4v2.3c0,0.7,0.6,1.3,1.3,1.3h13.4c0.7,0,1.3-0.6,1.3-1.3v-0.4L12.2,11L9.7,15.4z"})),zn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"hm0",d:"M12,16h2.5c0.8,0,1.5-0.7,1.5-1.5v-2.4l-4,0V16z"}),f.createElement("polygon",{className:"hm1",points:"8,4.1 8,0 4,0 4,4.1 "}),f.createElement("path",{className:"hm2",d:"M4,4.1V0L1.5,0C0.7,0,0,0.7,0,1.5l0,2.6h0l0,0L4,4.1z"}),f.createElement("polygon",{className:"hm3",points:"8,4.1 8,4.1 8,4.1 4,4.1 4,8.1 8,8.2 "}),f.createElement("polygon",{className:"hm2",points:"0,4.1 0,8.1 4,8.1 4,4.1 "}),f.createElement("polygon",{className:"hm1",points:"4,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm1",points:"4,16 8,16 8,12.1 4,12.1 "}),f.createElement("path",{className:"hm0",d:"M0,12.1v2.5C0,15.3,0.7,16,1.5,16H4v-3.9L0,12.1z"}),f.createElement("polygon",{className:"hm0",points:"0,12.1 4,12.1 4,8.2 0,8.2 "}),f.createElement("polygon",{className:"hm4",points:"8,12.1 8,8.2 4,8.2 4,12.1 "}),f.createElement("polygon",{className:"hm2",points:"16,4.1 16,4.1 16,4.1 12,4.1 12,8.2 16,8.2 "}),f.createElement("path",{className:"hm0",d:"M16,4.1l0-2.6C16,0.7,15.3,0,14.5,0L12,0v4.1L16,4.1z"}),f.createElement("polygon",{className:"hm4",points:"12,4.1 12,0 8,0 8,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm5",points:"12,4.1 8,4.1 8,4.1 "}),f.createElement("polygon",{className:"hm6",points:"12,4.1 16,4.1 16,4.1 "}),f.createElement("polygon",{className:"hm2",points:"12,12.1 16,12.1 16,8.2 12,8.2 "}),f.createElement("polygon",{className:"hm1",points:"12,8.2 8,8.2 8,12.1 12,12.1 "}),f.createElement("polygon",{className:"hm1",points:"8,12.1 8,16 12,16 12,12.1 "})),Bn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("circle",{className:"chart-icon-svg-0",cx:"7.7",cy:"11.1",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"2.6",cy:"8.8",r:"2.6"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"11.7",cy:"4.3",r:"4.3"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"1.8",cy:"14.8",r:"1.2"})),Hn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M13,4.2H9.5c-0.5,0-0.9,0.4-0.9,0.9v1.3h-3c-0.5,0-0.9,0.4-0.9,0.9v2.4h-3C1.4,9.6,1,10,1,10.5v4.7\nC1,15.6,1.4,16,1.9,16h3h1.4h2.4h1.4h3c0.5,0,0.9-0.4,0.9-0.9v-10C13.9,4.6,13.5,4.2,13,4.2z M4.8,14.6H2.4V11h2.4V14.6z M8.7,14.6\nH6.2v-5V7.8h2.4V14.6z M12.5,14.6h-2.4V6.4V5.6h2.4V14.6z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M5.5,5.5c-0.1,0-0.2,0-0.3-0.1l-4-1.7C0.9,3.6,0.7,3.2,0.9,2.9C1,2.5,1.4,2.3,1.8,2.5L5.4,4L9,0.3\nc0.2-0.2,0.5-0.3,0.8-0.1l4,1.9c0.3,0.2,0.5,0.6,0.3,0.9c-0.2,0.4-0.6,0.5-0.9,0.3L9.6,1.7L6,5.3C5.9,5.4,5.7,5.5,5.5,5.5z"})),Qn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("g",null,f.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M1.6,14.4v-3.8H0v3.7c0,1,0.8,1.7,1.7,1.7h12.6c1,0,1.7-0.8,1.7-1.7v-3.7h-1.6v3.8H1.6z"}),f.createElement("path",{className:"chart-icon-svg-0",d:"M0,1.7v3.6l1.6,0V1.6l12.8,0v3.8H16V1.7c0-1-0.8-1.7-1.7-1.7H1.7C0.8,0,0,0.8,0,1.7z"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"3.6",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"7.2",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"10.8",y:"7.2",width:"1.6",height:"1.6"}),f.createElement("rect",{className:"chart-icon-svg-0",x:"14.4",y:"7.2",width:"1.6",height:"1.6"}))),Un=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("path",{className:"chart-icon-svg-0",d:"M14.3,0H1.7C0.8,0,0,0.8,0,1.7v2.8v0.8v5.3v0.6v3.1c0,1,0.8,1.7,1.7,1.7h12.6c1,0,1.7-0.8,1.7-1.7v-3.4v-0.3V5.4V5V1.7 C16,0.7,15.2,0,14.3,0z M14.4,5.4v5.2v0.3v3.5H1.6v-3.2v-0.6V5.3V4.5V1.6h12.8V5V5.4z"}),f.createElement("rect",{className:"chart-icon-svg-0",y:"7.2",width:"1.6",height:"1.6"})),Yn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("rect",{x:"0.482",y:"9.788",className:"chart-icon-svg-0",width:"2.016",height:"6.212"}),f.createElement("rect",{x:"3.755",y:"3.923",className:"chart-icon-svg-0",width:"2.016",height:"12.077"}),f.createElement("rect",{x:"7.027",className:"chart-icon-svg-0",width:"2.016",height:"16"}),f.createElement("rect",{x:"10.3",y:"5.406",className:"chart-icon-svg-0",width:"2.016",height:"10.594"}),f.createElement("rect",{x:"13.571",y:"11.542",className:"chart-icon-svg-0",width:"2.016",height:"4.458"})),Kn=f.createElement("svg",{x:"0px",y:"0px",width:"16px",height:"16px",viewBox:"0 0 16 16"},f.createElement("circle",{className:"chart-icon-svg-0",cx:"9.399",cy:"10.008",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"9.219",cy:"6.29",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"11.082",cy:"1.73",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"14.596",cy:"2.341",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"5.863",cy:"13.68",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"3.45",cy:"7.892",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"1.504",cy:"13.9",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"6.116",cy:"10.008",r:"1.2"}),f.createElement("circle",{className:"chart-icon-svg-0",cx:"13.559",cy:"6.895",r:"1.2"})),jn=["type","size","showBadge","warning","danger","spinning","disabled"],Wn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger,t.spinning,t.disabled;var n=yn(t,jn),o=null;if(!e.props.type)return null;switch(e.props.type){case"back":o=f.createElement(K,null);break;case"bar-chart":o=Ln;break;case"book":o=f.createElement(q,null);break;case"bookmark":o=f.createElement(M,null);break;case"scatterplot":o=Kn;break;case"stacked-bar-chart":o=Vn;break;case"bubble-chart":o=Bn;break;case"calendar":o=f.createElement(G,null);break;case"caret-right":o=f.createElement(Te,null);break;case"caret-left":o=f.createElement(Se,null);break;case"caret-down":o=f.createElement(Ce,null);break;case"caret-up":o=f.createElement(Ee,null);break;case"react-autoql-bubbles-outlined":o=An;break;case"react-autoql-bubbles-filled":o=wn;break;case"react-autoql-bubbles-filled-alt":o=Nn;break;case"chart":o=f.createElement(O,null);break;case"check":o=f.createElement(X,null);break;case"close":o=f.createElement(De,null);break;case"mark-read":o=f.createElement(z,null);break;case"mark-unread":o=f.createElement(F,null);break;case"maximize":o=f.createElement(le,null);break;case"minimize":o=f.createElement(se,null);break;case"money":o=f.createElement(ke,null);break;case"close-circle":o=f.createElement(ve,null);break;case"collapse":o=f.createElement(B,null);break;case"column-chart":o=On;break;case"column-line-chart":o=Hn;break;case"stacked-column-chart":o=_n;break;case"copy":o=f.createElement(xe,null);break;case"dashboard":o=f.createElement(x,null);break;case"database":o=f.createElement(J,null);break;case"description":o=f.createElement(I,null);break;case"download":o=f.createElement(Z,null);break;case"edit":o=f.createElement(R,null);break;case"expand":o=f.createElement(H,null);break;case"eye":o=f.createElement($,null);break;case"filter":o=f.createElement(de,null);break;case"filter-off":o=f.createElement(pe,null);break;case"grad-cap":o=In;break;case"globe":o=f.createElement(he,null);break;case"heatmap":o=zn;break;case"histogram-chart":o=Yn;break;case"hour-glass":o=f.createElement(be,null);break;case"info":o=f.createElement(Ie,null);break;case"light-bulb":o=f.createElement(D,null);break;case"lightning":o=f.createElement(Q,null);break;case"line-chart":o=Mn;break;case"list-settings":o=f.createElement(me,null);break;case"live":o=f.createElement(fe,null);break;case"lock":o=f.createElement(Ae,null);break;case"stacked-line-chart":o=Fn;break;case"menu":o=f.createElement(A,null);break;case"microphone":o=f.createElement(U,null);break;case"more-vertical":o=f.createElement(te,null);break;case"more-horizontal":o=f.createElement(ee,null);break;case"note":o=f.createElement(V,null);break;case"notification":o=f.createElement(j,null);break;case"notification-off":o=f.createElement(W,null);break;case"notification-pause":o=f.createElement(ne,null);break;case"number":o=f.createElement(P,null);break;case"abacus":o=f.createElement(_,null);break;case"pie-chart":o=qn;break;case"play":o=f.createElement(we,null);break;case"pivot-table":o=Pn;break;case"plus":o=f.createElement(oe,null);break;case"preview":o=f.createElement(k,null);break;case"question":o=f.createElement(N,null);break;case"refresh":o=f.createElement(ce,null);break;case"report":o=f.createElement(ge,null);break;case"search":o=f.createElement(ye,null);break;case"data-search":o=f.createElement(L,null);break;case"send":o=f.createElement(ae,null);break;case"settings":o=f.createElement(re,null);break;case"split-view":o=Qn;break;case"single-view":o=Un;break;case"table":o=kn;break;case"tag":o=f.createElement(w,null);break;case"title":o=f.createElement(T,null);break;case"tool":o=f.createElement(ue,null);break;case"trash":o=f.createElement(ie,null);break;case"unlock":o=f.createElement(Ne,null);break;case"warning":o=f.createElement(Re,null);break;case"warning-triangle":o=f.createElement(Y,null)}return f.createElement(Rn,null,f.createElement("span",fn({},n,{"data-test":"react-autoql-icon",className:"react-autoql-icon\n ".concat(e.props.className||"","\n react-autoql-icon-").concat(e.props.type,"\n ").concat(e.props.warning?"react-autoql-icon-warning":"","\n ").concat(e.props.danger?"react-autoql-icon-danger":"","\n ").concat(e.props.spinning?"react-autoql-icon-spinning":"","\n ").concat(e.props.disabled?"react-autoql-icon-disabled":""),style:an({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),o,e.props.showBadge&&f.createElement("div",{className:"react-autoql-badge"})))})),e}return pn(n)}();mn(Wn,"propTypes",{type:b.string,size:b.number,showBadge:b.bool,color:b.string,warning:b.bool,danger:b.bool,spinning:b.bool,disabled:b.bool}),mn(Wn,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1,spinning:!1,disabled:!1});var Gn=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"renderContent",(function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("function"==typeof e.props.content)return e.props.content(n);if(e.props.showArrow&&!Pe){var o,a=n.position,r=n.childRect,i=n.popoverRect;return f.createElement(Le,{className:"popover-arrow-container",arrowClassName:"popover-arrow",position:a,childRect:r,popoverRect:i,arrowSize:10},f.createElement("div",{className:"popover-arrow-container-content"},f.createElement("div",{className:"popover-container-content ".concat(null!==(o=e.props.contentClassName)&&void 0!==o?o:"")},e.props.content)))}return f.createElement("div",{className:"popover-container-content ".concat(null!==(t=e.props.contentClassName)&&void 0!==t?t:"")},e.props.content)})),mn(Cn(e),"render",(function(){var t;return e.props.children?f.createElement(Me,{id:e.props.id,containerClassName:"react-tiny-popover-container react-autoql-popover".concat(Pe?"-mobile":"","\n ").concat(null!==(t=e.props.containerClassName)&&void 0!==t?t:"","\n ").concat(e.props.showArrow&&"function"!=typeof e.props.content&&!Pe?"popover-with-arrow-container":""),isOpen:e.props.isOpen,content:e.renderContent,ref:e.props.innerRef,onClickOutside:function(t){t.stopPropagation(),t.preventDefault(),e.props.onClickOutside(t)},parentElement:Pe?void 0:e.props.parentElement,boundaryElement:Pe?void 0:e.props.boundaryElement,positions:e.props.positions,align:e.props.align,reposition:!0,padding:e.props.padding,boundaryInset:e.props.boundaryInset},e.props.children):null})),e}return pn(n)}();mn(Gn,"propTypes",{padding:b.number,showArrow:b.bool}),mn(Gn,"defaultProps",{padding:10,showArrow:!1});var Xn=f.forwardRef((function(e,t){return f.createElement(Gn,fn({innerRef:t},e))})),Jn="react-autoql-tooltip-rebuild-timer",Zn=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],$n=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line","column_line","histogram","scatterplot"],eo=["line","stacked_line"],to=["column_line"],no=["January","February","March","April","May","June","July","August","September","October","November","December"],oo={CURRENCY:"DOLLAR_AMT",QUANTITY:"QUANTITY",RATIO:"RATIO",PERCENT:"PERCENT"},ao={DOLLAR_AMT:"Currency",QUANTITY:"Quantity",RATIO:"Ratio",PERCENT:"Percent"},ro=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],io=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],lo=["SP","SU","FA","HO"],so="DAY",co="MONTH",uo="YEAR",po="WEEK",mo="QUARTER",fo="DATE_HOUR",go="DATE_MINUTE",vo="HOUR",ho="MINUTE",bo={DAY:"ll",MONTH:"MMMM YYYY",YEAR:"YYYY",DATE_HOUR:"ll h:00A",DATE_MINUTE:"ll h:mmA"},yo=["histogram","scatterplot"],Co=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,t=sessionStorage.getItem(Jn);t||Ve.rebuild(),clearTimeout(t),sessionStorage.setItem(Jn,setTimeout((function(){sessionStorage.removeItem(Jn),t&&Ve.rebuild()}),e))},Eo=function(){Ve.hide()};function So(e){return Pe?null:f.createElement(Ve,fn({},e,{html:!0}))}var To=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"render",(function(){var e,t;return f.createElement("li",{id:null!==(e=o.props.id)&&void 0!==e?e:"react-autoql-menu-item-".concat(o.ID),key:"react-autoql-menu-item-".concat(o.ID),className:"react-autoql-menu-item\n ".concat(null!==(t=o.props.className)&&void 0!==t?t:"","\n ").concat(o.props.subtitle?"has-subtitles":"","\n ").concat(o.props.active?"active":""),"data-tip":o.props.tooltip,"data-for":o.props.tooltipID,"data-offset":10,onClick:function(e){e.stopPropagation(),o.props.onClick()}},f.createElement("span",{className:"select-option-span"},f.createElement("span",{className:"select-option-value-container"},f.createElement("span",{className:"react-autoql-menu-item-title"},!!o.props.icon&&f.createElement("span",{className:"react-autoql-menu-icon"},f.createElement(Wn,{type:o.props.icon}),"  "),f.createElement("span",null,o.props.title)),!!o.props.subtitle&&f.createElement("span",{className:"select-option-value-subtitle"},o.props.subtitle))))})),o.ID=C(),o}return pn(n)}();mn(To,"propTypes",{title:b.oneOfType([b.string,b.element]),subtitle:b.oneOfType([b.string,b.element]),icon:b.string,active:b.bool,tooltip:b.string,tooltipID:b.string,onClick:b.func}),mn(To,"defaultProps",{title:"",subtitle:void 0,icon:void 0,active:!1,tooltip:void 0,tooltipID:void 0,onClick:function(){}});var Do=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"render",(function(){var t;return f.createElement(Rn,null,f.createElement("ul",{className:"react-autoql-menu ".concat(null!==(t=e.props.className)&&void 0!==t?t:""),onClick:function(e){return e.stopPropagation()}},e.props.children))})),e}return pn(n)}(),xo=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co(),o.scrollToValue()})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isOpen!==t.isOpen&&(Eo(),Co(),o.state.isOpen&&o.scrollToValue()),o.props.value!==e.value&&Co()})),mn(Cn(o),"scrollToValue",(function(){var e,t=null===(e=o.props.options)||void 0===e?void 0:e.findIndex((function(e){return o.props.value===e.value})),n=document.querySelector("#select-option-".concat(o.ID,"-").concat(t));n&&n.scrollIntoView({behavior:"auto",block:"center",inline:"center"})})),mn(Cn(o),"renderSelect",(function(){var e,t,n=o.props.options.find((function(e){return e.value===o.props.value}));return f.createElement("div",{className:"react-autoql-select-and-label\n ".concat(null!==(e=o.props.className)&&void 0!==e?e:"","\n ").concat(o.props.fullWidth?"react-autoql-select-full-width":"")},!!o.props.label&&f.createElement("div",{className:"react-autoql-input-label"},o.props.label),f.createElement("div",{className:"react-autoql-select\n ".concat(o.props.outlined?"outlined":"","\n ").concat("small"===o.props.size?"react-autoql-select-small":"react-autoql-select-large"),"data-test":"react-autoql-select",onClick:function(){return o.setState({isOpen:!o.state.isOpen})},style:o.props.style,"data-tip":o.props.tooltip,"data-for":o.props.tooltipID,"data-offset":10,"data-delay-show":500},f.createElement("span",{className:"react-autoql-select-text"},null!=n&&n.label||null!=n&&n.value?f.createElement("span",{className:"react-autoql-menu-item-value-title"},!!n.icon&&f.createElement("span",null,f.createElement(Wn,{style:{marginLeft:"-3px"},type:n.icon}),"  "),f.createElement("span",null,null!==(t=n.label)&&void 0!==t?t:n.value)):f.createElement("span",{className:"react-autoql-select-text-placeholder"},o.props.placeholder)),o.props.showArrow&&f.createElement("div",{className:"react-autoql-select-arrow"},f.createElement(Wn,{type:"caret-down"}))))})),mn(Cn(o),"renderPopoverContent",(function(){var e;return f.createElement("div",{className:"react-autoql-select-popup-container",style:{width:o.props.style.width}},!o.props.tooltipID&&f.createElement(So,{id:"select-tooltip-".concat(o.ID),className:"react-autoql-tooltip",effect:"solid",delayShow:500}),f.createElement(Do,{options:o.props.options},null===(e=o.props.options)||void 0===e?void 0:e.map((function(e,t){var n,a,r;return f.createElement(To,{id:"select-option-".concat(o.ID,"-").concat(t),key:e.value,title:null!==(n=null!==(a=e.listLabel)&&void 0!==a?a:e.label)&&void 0!==n?n:e.value,subtitle:e.subtitle,tooltip:e.tooltip,tooltipID:null!==(r=o.props.tooltipID)&&void 0!==r?r:"select-tooltip-".concat(o.ID),active:e.value===o.props.value,icon:e.icon,onClick:function(){o.setState({isOpen:!1}),o.props.onChange(e.value)}})}))))})),mn(Cn(o),"render",(function(){var e,t,n;return o.props.options?f.createElement(Rn,null,f.createElement(Xn,{id:"select-popover-".concat(o.ID),key:"select-popover-".concat(o.ID),containerClassName:"react-tiny-popover-container react-autoql-select-popover-container ".concat(null!==(e=o.props.popupClassname)&&void 0!==e?e:""),isOpen:o.state.isOpen,positions:null!==(t=o.props.positions)&&void 0!==t?t:["bottom","top","left","right"],align:null!==(n=o.props.align)&&void 0!==n?n:"start",padding:0,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverBoundaryElement,onClickOutside:function(){return o.setState({isOpen:!1})},content:o.renderPopoverContent()},o.renderSelect())):null})),o.ID=C(),o.state={isOpen:!1},o}return pn(n)}();function Ro(e){return f.createElement(Rn,null,f.createElement("div",fn({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}mn(xo,"propTypes",{onChange:b.func,options:b.arrayOf(b.shape({})),popupClassname:b.string,value:b.oneOfType([b.string,b.number]),label:b.oneOfType([b.element,b.string]),size:b.string,showArrow:b.bool,outlined:b.bool,placeholder:b.string,fullWidth:b.bool}),mn(xo,"defaultProps",{onChange:function(){},options:[],popupClassname:null,value:null,label:null,size:"large",style:{},showArrow:!0,outlined:!0,placeholder:"Select an item",fullWidth:!1});var Io=["default","primary","danger"],Ao=["small","medium","large"],No=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(Io.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),mn(Cn(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(Ao.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),mn(Cn(e),"renderIcon",(function(){return e.props.icon?f.createElement(Wn,{className:"react-autoql-btn-icon",type:e.props.icon}):null})),mn(Cn(e),"render",(function(){var t=e.getType(),n=e.getSize(),o=e.props.loading||e.props.disabled;return f.createElement(Rn,null,f.createElement("button",{ref:e.props.innerRef,className:"react-autoql-btn\n ".concat(e.props.className||"","\n react-autoql-btn-").concat(t,"\n react-autoql-btn-").concat(n,"\n ").concat(o?" disabled":"","\n ").concat(e.props.border?"":"btn-no-border","\n ").concat(e.props.filled?"btn-filled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:an({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":e.props.tooltipID},e.props.loading?f.createElement(Ro,{"data-test":"react-autoql-btn-loading"}):e.renderIcon(),f.createElement("div",null,e.props.children)))})),e}return pn(n)}();mn(No,"propTypes",{type:b.oneOf(Io),size:b.oneOf(Ao),onClick:b.func,loading:b.bool,disabled:b.bool,multiline:b.bool,filled:b.bool,border:b.bool,tooltip:b.string,icon:b.string}),mn(No,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,filled:!1,border:!0,icon:void 0,onClick:function(){}});var wo=f.forwardRef((function(e,t){return f.createElement(No,fn({innerRef:t},e))})),ko=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),mn(Cn(t),"suggestionLists",[]),mn(Cn(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),mn(Cn(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),mn(Cn(t),"getSuggestionLists",(function(e,t){var n=[];return t.length&&t.forEach((function(t){var o=e.slice(t.start,t.end),a=t.suggestions.map((function(e){return an({id:C(),hidden:!1},e)})),r=[].concat(Tn(a),[{id:C(),text:o}]);n.push(r)})),n})),mn(Cn(t),"getPlainTextList",(function(e,t){var n=[],o=0;return t.forEach((function(a,r){n.push(e.slice(o,a.start)),r===t.length-1&&n.push(e.slice(a.end,e.length)),o=a.end})),n})),mn(Cn(t),"isInitialSelectionValid",(function(){var e=!0;return t.props.initialSelections.length!==t.suggestionLists.length&&(e=!1),t.props.initialSelections.forEach((function(n,o){t.suggestionLists[o]&&t.suggestionLists[o].find((function(e){return e.text===n.text}))||(e=!1)})),e})),mn(Cn(t),"updateStartAndEndIndexes",(function(n){if(e(n,"length")){var o="";t.plainTextList.forEach((function(e,t){o=o.concat(e);var a=n[t];if(a&&!a.hidden){var r=o.length;a.start=r,a.end=r+a.text.length,o=o.concat(a.text)}}))}})),mn(Cn(t),"setInitialSelections",(function(){var e;t.props.initialSelections&&t.isInitialSelectionValid()?(t.suggestionLists.forEach((function(e,n){e.find((function(e){return e.text===t.props.initialSelections[n].text})).id=t.props.initialSelections[n].id||C()})),e=t.props.initialSelections):e=t.props.autoSelectSuggestion?t.suggestionLists.map((function(e){return e[0]})):t.suggestionLists.map((function(e){return e[e.length-1]})),t.updateStartAndEndIndexes(e),t.setState({selectedSuggestions:S(e)})})),mn(Cn(t),"initializeQueryValidationOptions",(function(e){var n=e.data,o=n.replacements,a=n.query,r=o.sort((function(e,t){return e.start-t.start}));if(!r||!a)return[];t.suggestionLists=t.getSuggestionLists(a,r),t.plainTextList=t.getPlainTextList(a,r),t.setInitialSelections()})),mn(Cn(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var o=t.suggestionLists[n].find((function(t){return t.id===e})),a=S(t.state.selectedSuggestions);a[n]=o,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(a),a),t.updateStartAndEndIndexes(a),t.setState({selectedSuggestions:S(a)})}else t.deleteQueryValidationSuggestion(n)})),mn(Cn(t),"deleteQueryValidationSuggestion",(function(e){var n=S(t.state.selectedSuggestions.map((function(t,n){return n===e?an(an({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:S(n)})})),mn(Cn(t),"renderWordSelector",(function(e){var n=S(t.state.selectedSuggestions[e]);if(!n||n.hidden)return null;var o=t.suggestionLists[e],a=[];return o.forEach((function(e,t){if(null!=e&&e.text){var n={value:e.id,label:e.text};t===o.length-1?n.listLabel=f.createElement("span",null,n.label," ",f.createElement("em",null,"(Original term)")):n.listLabel=f.createElement("span",null,e.text,e.value_label?f.createElement("em",null," (",e.value_label,")"):null),a.push(n)}})),a.push({value:"remove-word",label:f.createElement("span",null,f.createElement(Wn,{type:"trash"})," Remove term")}),f.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},f.createElement(xo,{options:a,key:C(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",outlined:!1,showArrow:!1,onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),mn(Cn(t),"renderQueryValidationQuery",(function(){return f.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var o=f.createElement("span",{key:"query-element-".concat(n)},e),a=t.renderWordSelector(n);return f.createElement("span",{key:C()},o,a)})))})),mn(Cn(t),"getQueryValidationQueryText",(function(e){var n="";return t.plainTextList.forEach((function(t,o){n=n.concat(t);var a=e[o];a&&!a.hidden&&(n=n.concat(a.text))})),n})),mn(Cn(t),"renderResponse",(function(){return t.state.selectedSuggestions&&t.state.selectedSuggestions.length?f.createElement("div",{className:"react-autoql-query-validation-container"},f.createElement("div",{className:"react-autoql-query-validation-description"},f.createElement("span",null,t.props.message||"I need your help matching a term you used to the exact corresponding term in your database. Verify by selecting the correct term from the menu below:")),f.createElement("div",null,t.renderQueryValidationQuery(),f.createElement("div",{className:"react-autoql-query-validation-execute-btn-container"},f.createElement(wo,{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions,scope:t.props.scope})},icon:t.props.submitIcon||"play"},t.props.submitText||"Run Query")))):null})),mn(Cn(t),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return pn(o)}();mn(ko,"propTypes",{response:b.shape({}),onSuggestionClick:b.func,autoSelectSuggestion:b.bool,isQueryRunning:b.bool,initialSelections:b.arrayOf(b.shape({})),onQueryValidationSelectOption:b.func,message:b.string}),mn(ko,"defaultProps",{response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var Po=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"MAX_UPDATE_DURATION",5e3),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.update()})),mn(Cn(e),"componentDidUpdate",(function(t){t.contentHidden&&!e.props.contentHidden&&e.update()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1,clearInterval(e.intervalID),clearTimeout(e.timeoutID)})),mn(Cn(e),"update",(function(t){if(e._isMounted)if("number"!=typeof t||t>e.MAX_UPDATE_DURATION){var n;null===(n=e.ref)||void 0===n||null===(n=n._ps)||void 0===n||n.update()}else{clearInterval(e.intervalID);var o=Math.ceil(t/50);e.x=0,e.intervalID=setInterval((function(){var t;null===(t=e.ref)||void 0===t||null===(t=t._ps)||void 0===t||t.update(),++e.x===o&&clearInterval(e.intervalID)}),50)}})),mn(Cn(e),"getContainer",(function(){var t;return null===(t=e.ref)||void 0===t?void 0:t._container})),mn(Cn(e),"getScrollTop",(function(){var t;return null===(t=e.ref)||void 0===t||null===(t=t._container)||void 0===t?void 0:t.scrollTop})),mn(Cn(e),"getClientHeight",(function(){var t;return null===(t=e.ref)||void 0===t||null===(t=t._container)||void 0===t?void 0:t.clientHeight})),mn(Cn(e),"scrollToTop",(function(){var t;null!==(t=e.ref)&&void 0!==t&&t._container&&(e.ref._container.scrollTop=0)})),mn(Cn(e),"scrollToBottom",(function(){var t,n=null===(t=e.ref)||void 0===t?void 0:t._container;n&&(n.scrollBottom=0,n.scrollTop=n.scrollHeight-n.clientHeight)})),mn(Cn(e),"getStyleProp",(function(){var t={};return e.props.style&&(t=an({},e.props.style)),t.maxHeight=e.props.maxHeight,t.minHeight=e.props.minHeight,t})),mn(Cn(e),"render",(function(){var t;return e.props.children?f.createElement(Ot,{className:"react-autoql-custom-scrollbars \n ".concat(null!==(t=e.props.className)&&void 0!==t?t:"","\n ").concat(e.props.autoHide?"autohide":""),ref:function(t){return e.ref=t},style:e.getStyleProp()},e.props.children):null})),e}return pn(n)}();mn(Po,"propTypes",{style:b.shape({}),autoHide:b.bool,autoHeightMax:b.number,autoHeightMin:b.number,contentHidden:b.bool}),mn(Po,"defaultProps",{style:{},autoHide:!1,autoHeightMin:void 0,autoHeightMax:void 0,contentHidden:!1});var Oo=["scrollbarProps","className","contentHidden","children"],Lo=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"updateScrollbars",(function(e){var t;null===(t=o.scrollComponent)||void 0===t||null===(t=t.current)||void 0===t||t.update(e)})),mn(Cn(o),"render",(function(){var e=o.props,t=e.scrollbarProps,n=void 0===t?{}:t,a=e.className,r=e.contentHidden,i=e.children,l=yn(e,Oo);return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-infinite-scroll-container"},f.createElement(Po,fn({},n,{ref:o.scrollComponent,contentHidden:r}),f.createElement(Qt,fn({},l,{className:"react-autoql-infinite-scroll ".concat(a||""),getScrollParent:function(){var e;return null===(e=o.scrollComponent)||void 0===e||null===(e=e.current)||void 0===e?void 0:e.getContainer()}}),i))))})),o.COMPONENT_KEY=C(),o.scrollComponent=f.createRef(),o}return pn(n)}();mn(Lo,"propTypes",{getScrollParent:b.func,contentHidden:b.bool}),mn(Lo,"defaultProps",{getScrollParent:void 0,contentHidden:!1}),o.extend(i),o.extend(m),o.extend(l),o.extend(s),o.extend(c),o.extend(u),o.extend(a),o.extend(p),o.extend(r),o.extend(d),function(){var e=window.navigator.language||"en",t=e.split("-")[0];try{require("dayjs/locale/".concat(e,".js")),o.locale(e)}catch(e){try{require("dayjs/locale/".concat(t,".js")),o.locale(t)}catch(e){}}}();var Mo={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},qo={timestampFormat:"ISO8601",currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:2,ratioDecimals:4,comparisonDisplay:"PERCENT",monthYearFormat:"MMMM YYYY",dayMonthYearFormat:"ll"},Vo={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableCSVDownload:!0,enableReportProblem:!0},_o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Mo),e)},Fo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},qo),e)},zo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Vo),e)},Bo=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},Ho=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Qo=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t||"UNKNOWN"===t},Uo=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Yo=function(e,t){var n,o=[],a=[],r=[];e.forEach((function(e,t){var n=e.type;e.is_visible&&!e.pivot&&("DOLLAR_AMT"===n?o.push(t):"QUANTITY"===n?a.push(t):"PERCENT"!==n&&"RATIO"!==n||r.push(t))}));var i,l,s=[],c=[];return o.length?(n=o[0],s=o,l="currency"):a.length?(n=a[0],s=a,l="quantity"):r.length&&(n=r[0],s=r,l="ratio"),t||(s=n>=0?[n]:[],"currency"===l?a.length?i=a[0]:r.length?i=r[0]:o.length>1&&(i=o[1]):"quantity"===l?r.length?i=r[0]:a.length>1&&(i=a[1]):"ratio"===l&&a.length>1&&(i=r[1]),isNaN(i)||(c=i>=0?[i]:[])),{numberColumnIndex:n,numberColumnIndices:s,numberColumnIndices2:c,numberColumnIndex2:i,currencyColumnIndices:null!=o?o:[],currencyColumnIndex:o[0],quantityColumnIndices:null!=a?a:[],quantityColumnIndex:a[0],ratioColumnIndices:null!=r?r:[],ratioColumnIndex:r[0]}},Ko=function(e){if(e&&function(e){return!Bo(e)&&e.findIndex((function(e){return!0===e.multi_series}))>=0}(e))return e.findIndex((function(e){return e&&e.is_visible&&!0===e.multi_series}))},jo=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},Wo=function(e,t){if(e){var n=[],o=Ko(e),a=jo(e);e.forEach((function(e,t){Qo(e)&&t!==o&&e.is_visible&&n.push(t)}));var r=e.findIndex((function(e){return e.isDrilldownColumn}));if(r>=0)return{stringColumnIndices:n,stringColumnIndex:r};var i,l,s=n[0];if(t)s=(null===(i=e[a])||void 0===i?void 0:i.groupable)?a:null!==(l=n.findIndex((function(t){return e[t].groupable})))&&void 0!==l?l:n[1];else a>=0?s=a:n[1]>=0&&(s=n[1]);return{stringColumnIndex:s,stringColumnIndices:n}}},Go=function(e){var t=0,n=0;return e.forEach((function(e){Ho(e)&&e.is_visible?n+=1:Qo(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},Xo=function(e,t,n){return n.indexOf(e)===t},Jo=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=[],a=0;a<t;a++){o[a]=[];for(var r=0;r<e;r++)o[a][r]=n}return o},Zo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e){var a=t.precision,r=n.dayMonthYearFormat||qo.dayMonthYearFormat,i=o.utc(e).utc();if(!i.isValid())return e;var l=i.format(r);try{switch(a){case so:break;case po:var s=i.startOf("week").format("MMM D"),c=i.endOf("week").format("MMM D"),u=i.week(),d=i.format("YYYY");l="".concat(s," - ").concat(c,", ").concat(d," (Week ").concat(u,")");break;case co:var p=n.monthYearFormat||qo.monthYearFormat;l=i.format(p);break;case mo:var m=i.quarter(),f=i.format("YYYY");l="".concat(f,"-Q").concat(m);break;case uo:l=i.format("YYYY");break;case fo:l=i.format("".concat(r," h:00A"));break;case go:l=i.format("".concat(r," h:mmA"))}return l}catch(e){console.error(e)}}},$o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e)try{var a,r=n.monthYearFormat,i=n.dayMonthYearFormat,l="YYYY",s=r||qo.monthYearFormat,c=i||qo.dayMonthYearFormat,u=t.title;if(!(a=isNaN(parseFloat(e))?o.utc(e).utc():o.unix(e).utc()).isValid())return e;var d=a.format(c);return isNaN(parseFloat(e))?(u&&u.toLowerCase().includes("year")?d=a.format(l):u&&u.toLowerCase().includes("month")&&(d=a.format(s)),d=a.format(c)):u&&u.toLowerCase().includes("year")?d=a.format(l):u&&u.toLowerCase().includes("month")&&(d=a.format(s)),d}catch(t){return console.error(t),e}},ea=function(e,t){if(e){var n=e;try{switch(t.precision){case"DOW":n=function(e,t){var n=t.dow_style;n||(n="NUM_1_MON");var o=e,a=Number(e);switch(n){case"NUM_1_MON":var r=a-1;r>=0?o=ro[r]:console.warn("dow style is NUM_1_MON but the value could not be converted to a number: ".concat(e));break;case"NUM_1_SUN":var i=a-1;i>=0?o=io[i]:console.warn("dow style is NUM_1_SUN but the value could not be converted to a number: ".concat(e));break;case"NUM_0_MON":a>=0?o=ro[a]:console.warn("dow style is NUM_0_MON but the value could not be converted to a number: ".concat(e));break;case"NUM_0_SUN":a>=0?o=io[a]:console.warn("dow style is NUM_0_SUN but the value could not be converted to a number: ".concat(e));break;case"ALPHA_MON":case"ALPHA_SUN":var l=ro.find((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())}));l?o=l:console.warn("dow style is ALPHA but the value could not be matched to a weekday name: ".concat(e));break;default:console.warn("could not format dow value. dow_style was not recognized: ".concat(t.dow_style))}return o}(e,t);break;case"HOUR":var a=o.utc(e,"THH:mm:ss.SSSZ").utc();a.isValid()&&(n=a.format("h:00A"));break;case"MINUTE":var r=o.utc(e,"THH:mm:ss.SSSZ").utc();r.isValid()&&(n=r.format("h:mmA"));break;case"MONTH":default:n=e}return n}catch(t){return console.error(t),e}}},ta=function(t,n){if(t){if(t&&"string"==typeof t){var a,r,i=t.split("-"),l=e(i,"[0]"),s=e(i,"[2]");e(i,"[1]","").includes("W")?r=e(i,"[1]"):a=e(i,"[1]");var c=n.monthYearFormat,u=n.dayMonthYearFormat,d=c||qo.monthYearFormat,p=u||qo.dayMonthYearFormat,m=o.utc(t).utc();if(!m.isValid())return t;var f=t;return s?f=m.format(p):a?f=m.format(d):r||l&&(f=l),f}return t}},na=function(e){return/^\d+$/.test(e)},oa=function(e){var t=e.value,n=e.column;return e.config,"DATE_STRING"===n.type?function(e,t){if(e)try{switch(t.precision){case"DOW":return;case"HOUR":case"MINUTE":return o.utc(e,"THH:mm:ss.SSSZ").utc();case"MONTH":default:return}}catch(e){return void console.error(e)}}(t,n):na(t)?o.unix(t).utc():o.utc(t).utc()},aa=function(e){var t=e.element,n=e.column,o=e.config,a=void 0===o?{}:o,r=e.htmlElement,i=e.isChart;try{var l=t,s=a.currencyCode,c=a.languageCode,u=a.currencyDecimals,d=a.quantityDecimals,p=a.ratioDecimals,m=null==n?void 0:n.type;if(i&&["count","deviation","variance"].includes(null==n?void 0:n.aggType)&&(m="QUANTITY"),n)switch(m){case"STRING":break;case"DOLLAR_AMT":if(!isNaN(parseFloat(t))){var f=s||"USD",g=u||0===u?u:void 0;try{l=new Intl.NumberFormat(c,{style:"currency",currency:"".concat(f),minimumFractionDigits:g,maximumFractionDigits:g}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(c,{style:"currency",currency:"USD",minimumFractionDigits:g,maximumFractionDigits:g}).format(t)}}break;case"QUANTITY":var v=isNaN(d)?2:d;if(!isNaN(parseFloat(t))){var h=parseFloat(t)%1!=0?v:0;l=new Intl.NumberFormat(c,{minimumFractionDigits:h,maximumFractionDigits:h}).format(t)}break;case"DATE":l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return na(e)?$o(e,t,n):Zo(e,t,n)}(t,n,a);break;case"DATE_STRING":l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.precision?ea(e,t):ta(e,n)}(t,n,a);break;case"RATIO":var b=isNaN(p)?4:p;isNaN(parseFloat(t))||(l=new Intl.NumberFormat(c,{minimumFractionDigits:b,maximumFractionDigits:b}).format(t));break;case"PERCENT":if(!isNaN(parseFloat(t))){var y=parseFloat(t)/100;l=new Intl.NumberFormat(c,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(y),r&&(t<0?r.classList.add("comparison-value-negative"):t>0&&r.classList.add("comparison-value-positive"))}}return l}catch(e){return console.error(e),t}},ra=function(e){try{if(!(window.URL||window.webkitURL||window))throw new Error("(browser doesnt support this)");if(!e)throw new Error("(svg element does not exist)");var t=(new XMLSerializer).serializeToString(e),n=btoa(unescape(encodeURIComponent(t)));return"data:image/svg+xml;base64,".concat(n)}catch(e){return}},ia=function(e){if(e&&e.getBBox)return e.getBBox()},la=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},sa=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t},ca=function(e){return $n.includes(e)},ua=function(e){return Zn.includes(e)},da=function(e){var t,n=e.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),o=e[n];return o&&(null==o||null===(t=o.display_name)||void 0===t?void 0:t.toLowerCase().includes("month"))&&2===(null==e?void 0:e.length)},pa=function(e,t,n){var o,a,r,i,l,s;if(t<=1)return!1;var c=sa(e);if(!(2===(null==c?void 0:c.length)))return!1;var u=ha(e),d=e[c[0]],p=e[c[1]];if(!(d.is_visible&&p.is_visible&&(null==u?void 0:u.length)>=3))return!1;var m=null!==(o=null==n?void 0:n.map((function(e){return e[c[0]]})))&&void 0!==o?o:[],f=null!==(a=null==n?void 0:n.map((function(e){return e[c[1]]})))&&void 0!==a?a:[],g=null!==(r=null==m||null===(i=m.filter(Xo))||void 0===i?void 0:i.length)&&void 0!==r?r:0,v=null!==(l=null==f||null===(s=f.filter(Xo))||void 0===s?void 0:s.length)&&void 0!==l?l:0;return!(g>22&&v>22)||(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The calculated dimensions would be: ".concat(g," x ").concat(v)),!1)},ma=function(e){var t,n=!(null===(t=e.filter((function(e){return Ho(e)})))||void 0===t||!t.length);return n},fa=function(e){var t,n=!(null===(t=e.filter((function(e){return Qo(e)})))||void 0===t||!t.length);return n},ga=function(e){var t,n=!(null===(t=e.filter((function(e){return Uo(e)})))||void 0===t||!t.length);return n},va=function(e,t){if(t<=1)return!1;var n=Go(e),o=n.amountOfNumberColumns,a=n.amountOfStringColumns;return o>0&&a>0},ha=function(e){return t(e,(function(e){return e.is_visible}))},ba=function(e){var n=null==e?void 0:e.length,o=function(e){return t(e,(function(e){return!e.is_visible}))}(e);return n&&!!o.length},ya=function(e){var t=ha(e);return(null==e?void 0:e.length)&&!t.length},Ca=function(e){var t,n,o,a;if(!e)return!1;var r=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.rows,i=null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.columns,l=null==e||null===(o=e.data)||void 0===o?void 0:o.reference_id,s=r&&!(null!=r&&r.length),c=1===(null==i?void 0:i.length);return!(!s||!c||"1.1.211"!==l)||!(1!==(null==r?void 0:r.length)||1!==(null===(a=r[0])||void 0===a?void 0:a.length))},Ea=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,o=t.columns,a=t.dataLength,r=t.pivotDataLength,i=t.isDataLimited;try{var l,s,c,u,d;if(null==n||null===(l=n.data)||void 0===l||null===(l=l.data)||void 0===l||!l.display_type)return[];var p=n.data.data.display_type;if("suggestion"===p||"help"===p||"html"===p)return[p];var m=null!==(s=null==n||null===(c=n.data)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.rows)&&void 0!==s?s:[],f=o||(null==n||null===(u=n.data)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.columns),g=ha(f);if(null==g||!g.length)return["text"];if(Ca(n))return["single-value"];if(null==m||!m.length)return["table"];var v=10,h=null!=a?a:m.length,b=!0,y=null!=r;if(y&&(b=!!r),pa(g,h,null==n||null===(d=n.data)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.rows)){var C=["table"];return i||C.push("pivot_table"),b&&(C.push("stacked_column","stacked_bar","column","bar","bubble","heatmap"),ga(g)&&C.push("stacked_line","line")),C}if(va(g,h)){var E=["table","column","bar"];h>20&&E.push("histogram"),ga(g)&&E.push("line"),h>1&&h<=v&&E.push("pie");var S=Go(g),T=S.amountOfNumberColumns;if(T>1&&(E.push("column_line"),E.push("scatterplot")),!i&&da(g)){var D=g.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),x=g[D],R=e(n,"data.data.rows"),I=[];R.forEach((function(e){var t=aa({element:e[D],column:x,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});I.includes(t)||I.push(t)})),I.length>1&&E.push("pivot_table")}return E}return["table"]}catch(e){return console.error(e),["table"]}},Sa=function(e,t,n,o,a,r){var i,l=Ea({response:e,columns:null!=a?a:null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.columns,dataLength:n,pivotDataLength:o,isDataLimited:r});return t&&l.includes(t)},Ta=function(e,t){var n=e.find((function(e){return ca(e)}));return n||t},Da=function(t,n,o,a,r,i,l){var s,c=Ea({response:t,columns:null!=o?o:null==t||null===(s=t.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.columns,dataLength:a,pivotDataLength:r,isDataLimited:l});if(i&&c.includes(i))return i;var u=e(t,"data.data.display_type");if(c.includes(i))return i;if("suggestion"===u||"help"===u||"html"===u)return u;if(1===c.length)return c[0];if(c.includes("pivot_table")){var d="pivot_table";return n&&(d=Bo(e(t,"data.data.columns"))?Ta(c,"pivot_table"):"pivot_table"),d}if(!u&&function(t){return!!t&&(e(t,"data.data.rows.length")&&e(t,"data.data.rows.length"))}(t)||"data"===u){var p="table";return n&&(p=Bo(e(t,"data.data.columns"))?Ta(c,"table"):"table"),p}return"text"},xa=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},Ra=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},Ia=function(t){if(t)try{"function"==typeof t.forEach&&e(t,"length")?t.forEach((function(e){e&&"function"==typeof e.remove&&e.remove()})):"function"==typeof t.remove&&t.remove()}catch(e){console.error(e)}},Aa=function(e,t){if(e.includes("-W")){var n=e.substring(0,4),o=t.substring(0,4);return n!==o?n-o:e.substring(6,8)-t.substring(6,8)}if(ro.includes(e.trim())){var a=ro.findIndex((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())})),r=ro.findIndex((function(e){return e.toLowerCase().includes(t.trim().toLowerCase())})),i=e-t;return a>=0&&r>=0&&(i=a-r),i}if(no.includes(e.trim())){var l=no.findIndex((function(t){return t===e.trim()})),s=no.findIndex((function(e){return e===t.trim()}));return l>=0&&s>=0?s-l:e-t}if(lo.includes(e.substr(0,2))){var c=lo.findIndex((function(t){return t===e.substr(0,2)})),u=lo.findIndex((function(e){return e===t.substr(0,2)})),d=Number(e.substr(2)),p=Number(t.substr(2));return d===p?c-u:d-p}return e-t},Na=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"!=typeof e||"string"!=typeof t)return e-t;var a=e.trim(),r=t.trim();switch(n.precision){case"DOW":var i,l=null!==(i=n.dow_style)&&void 0!==i?i:"ALPHA_MON",s=ro.findIndex((function(e){return e.toLowerCase().includes(a.toLowerCase())})),c=ro.findIndex((function(e){return e.toLowerCase().includes(r.toLowerCase())}));return"ALPHA_SUN"===l&&(s=io.findIndex((function(e){return e.toLowerCase().includes(a.toLowerCase())})),c=io.findIndex((function(e){return e.toLowerCase().includes(r.toLowerCase())}))),s-c;case"HOUR":case"MINUTE":var u=o.utc(a,"THH:mm:ss.SSSZ").utc(),d=o.utc(r,"THH:mm:ss.SSSZ").utc();return u.unix()-d.unix();case"MONTH":var p=no.findIndex((function(e){return e.toLowerCase()===a.toLowerCase()})),m=no.findIndex((function(e){return e.toLowerCase()===r.toLowerCase()}));return p-m;default:return Aa(a,r)}},wa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;try{if(!e&&!t)return 0;if(!e&&t)return 1;if(e&&!t)return-1;var r=Number(e),i=Number(t),l=r-i;return(isNaN(r)||isNaN(i))&&(l="DATE_STRING"===n.type?Na(e,t,n):o.utc(e).unix()-o.utc(t).unix()),a&&"DOW"===n.precision&&(l*=-1),l}catch(e){return console.error(e),-1}},ka=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desc",o=arguments.length>3?arguments[3]:void 0;try{if(!e||"object"!==ln(e))throw new Error("Could not sort data by date - no data supplied");var a=jo(t),r=t[a];if(a>=0){var i="desc"===n?-1:1,l=Tn(e).sort((function(e,t){return i*wa(e[a],t[a],r,o)}));return l}}catch(e){console.error(e)}return e},Pa=function(e){var t=e.text,n=void 0===t?"":t,o=e.inputRef,a=e.callback,r=void 0===a?function(){}:a,i=e.totalAnimationTime,l=void 0===i?1e3:i;return n.length&&o&&"string"==typeof n?new Promise((function(e){for(var t=Math.round(l/n.length),a=function(a){setTimeout((function(){o.value=n.slice(0,a),a===n.length&&setTimeout((function(){r(),e()}),300)}),a*t)},i=1;i<=n.length;i++)a(i)})):Promise.resolve()},Oa=function(){return new Promise((function(e){setTimeout(e,0)}))},La=function(e){return"object"===ln(e)&&!Array.isArray(e)&&null!=e},Ma=function(e,t){var o=n(e,t);if(o)return!0;var a=La(e),r=La(t);if(!a||!r)return o;var i,l,s=Object.keys(e),c=Object.keys(t);if(s.length!==c.length)return!1;for(var u=0;u<s.length;u++)if("function"==typeof e[s[u]]&&"function"==typeof t[s[u]]){if(i=e[s[u]],l=t[s[u]],(null==i?void 0:i.toString())!=(null==l?void 0:l.toString()))return!1}else if(!hasOwnProperty.call(t,s[u])||!n(e[s[u]],t[s[u]]))return!1;return!0},qa=function(e){return"string"==typeof e||"number"==typeof e?e:Array.isArray(e)&&e.length?e.join("."):null},Va=function(e,t){var n=null;try{var o=qa(e),a=qa(t);o&&a?n=[o,a].join("."):o?n=o:a&&(n=a)}catch(e){console.error(e)}return n},_a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.ceil(e/t)*t},Fa=function(e,t){return e.slice(0,t).concat(e.slice(t+1))},za={"accent-color":"#28A8E0","accent-color-secondary":"#1EA0D8","background-color-primary":"#F8F8F8","background-color-secondary":"#FFFFFF","background-color-tertiary":"#E8E8E8","background-color-switch-input":"#BABABA","background-color-switch-thumb":"#FFFFFF","background-color-disabled":"#EDEDED","background-color-disabled-dark":"#857D83","background-color-checkbox":"#FFFFFF","border-color":"#D8D8D8","table-border-color":"#EFEFEF","hover-color":"#F6F7F9","text-color-primary":"#343434","text-color-accent":"#FFFFFF","text-color-placeholder":"#0000004D","dashboard-title-color":"#28A8E0","font-family":"'Roboto', sans-serif","font-size":"15px","chart-font-size":"12px","highlight-color":"#000000","badge-color":"#F5222D","danger-color":"#CA0B00","warning-color":"#FFB600","success-color":"#47b84c","info-color":"#28A8E0","box-shadow-color":"#85858528","mask-color":"#0000000F","mobile-mask-color":"#00000059","scrollbar-color":"#aeaeae","box-shadow-1":"0px 1px 2px 1px var(--react-autoql-box-shadow-color)","box-shadow-2":"0px 1px 2px 0px var(--react-autoql-box-shadow-color)"},Ba={"accent-color":"#193a48","accent-color-secondary":"#1ea0d8","background-color-primary":"#20252A","background-color-secondary":"#3B3F46","background-color-tertiary":"#292929","background-color-switch-input":"#252525","background-color-switch-thumb":"#ececec","background-color-checkbox":"#292929","background-color-disabled":"#5d6167","background-color-disabled-dark":"#857d83","table-border-color":"#53565c","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#ececec","text-color-accent":"#ffffff","text-color-placeholder":"#ffffff6e","dashboard-title-color":"#193a48","font-family":"'Roboto', sans-serif","font-size":"12px","chart-font-size":"12px","highlight-color":"#ffffff","badge-color":"#f5222d","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#47b84c","info-color":"#28a8e0","box-shadow-color":"#00000066","mask-color":"#00000021","mobile-mask-color":"#00000059","scrollbar-color":"#727477","box-shadow-1":"0px 1px 1px 0px var(--react-autoql-box-shadow-color)","box-shadow-2":"0px 1px 2px 0px var(--react-autoql-box-shadow-color)"},Ha={theme:"light",chartColors:["#26A7E9","#A5CD39","#DD6A6A","#FFA700","#00C1B2"],accentColor:"#26A7E9",fontFamily:"sans-serif",textColor:void 0,accentTextColor:void 0,backgroundColorPrimary:void 0,backgroundColorSecondary:void 0},Qa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return an(an({},Ha),e)},Ua=function(e){return document.documentElement.style.getPropertyValue("--react-autoql-".concat(e))},Ya=function(){try{for(var e=[],t=[],n=0;n<100;){try{var o,a=Ua("chart-color-".concat(n)),r=null!==(o=Ua("chart-color-dark-".concat(n)))&&void 0!==o?o:a;if(!a)return{chartColors:e,chartColorsDark:t};e.push(a),t.push(r)}catch(e){}n+=1}return{chartColors:e,chartColorsDark:t}}catch(e){return console.error("Could not get chart color css vars. See below for error details"),console.error(e),[]}},Ka=function(e,t){var n,o=("#"===(n=e).slice(0,1)&&(n=n.slice(1)),3===n.length&&(n=n.split("").map((function(e){return e+e})).join("")),(299*parseInt(n.substr(0,2),16)+587*parseInt(n.substr(2,2),16)+114*parseInt(n.substr(4,2),16))/1e3);t["text-color-accent"]=o>=140?"black":"white"},ja=function(e,t){var n=e||Ha.chartColors;Array.isArray(n)?n.length?n.forEach((function(e,n){t["chart-color-".concat(n)]=e;var o=function(e,t){var n=!1;"#"==e[0]&&(e=e.slice(1),n=!0);var o=parseInt(e,16),a=(o>>16)+t;a>255?a=255:a<0&&(a=0);var r=(o>>8&255)+t;r>255?r=255:r<0&&(r=0);var i=(255&o)+t;i>255?i=255:i<0&&(i=0);var l="000000"+(i|r<<8|a<<16).toString(16);return(n?"#":"")+l.substring(l.length-6)}(e,-10);t["chart-color-dark-".concat(n)]=o})):console.error("configureTheme chartColors option must not be empty. If you meant to use the default colors, do not supply a chart colors array"):console.error("configureTheme chartColors option must be an array")},Wa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Qa(e),n=t.theme,o=t.textColor,a=t.fontFamily,r=t.chartColors,i=t.accentColor,l=t.accentTextColor,s=t.dashboardTitleColor,c=t.backgroundColorPrimary,u=t.backgroundColorSecondary,d="light"===n?za:Ba;for(var p in o&&(d["text-color-primary"]=o),l?d["text-color-accent"]=l:Ka(i,d),a&&(d["font-family"]=a),i&&(d["accent-color"]=i),d["dashboard-title-color"]=s||d["accent-color"],c&&(d["background-color-primary"]=c),u&&(d["background-color-secondary"]=u),ja(r,d),d)document.documentElement.style.setProperty("--react-autoql-".concat(p),d[p])},Ga=function(e){var t=f.forwardRef((function(t,n){var o=fn({},(bn(t),t));return g((function(){!!Ua("accent-color")||Wa()}),[]),f.createElement(e,fn({ref:n},o))}));return t.displayName="ThemeProvider",t};var Xa=Ga((function(){return f.createElement("div",{className:"response-loading","data-test":"loading-dots"},f.createElement("div",null),f.createElement("div",null),f.createElement("div",null),f.createElement("div",null))})),Ja=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.shouldRender&&o.focusInput()})),mn(Cn(o),"componentDidUpdate",(function(e){o.props.shouldRender&&!e.shouldRender&&o.focusInput()})),mn(Cn(o),"componentWillUnmount",(function(){clearTimeout(o.animateTextDelay),clearTimeout(o.animateTextTimeout)})),mn(Cn(o),"focusInput",(function(){var e;null===(e=o.inputRef)||void 0===e||e.focus()})),mn(Cn(o),"loadMore",(function(e,t){if(o.state.loading)return Promise.resolve();var n={validationResponse:void 0};1===e?(n.initialLoading=!0,n.hasMore=!0):n.loading=!0;var a=o.state.inputValue;return a!==o.state.keywords&&(n.queryList=void 0),o.setState(n),ze(an(an({},o.props.authentication),{},{keywords:a,pageSize:o.pageSize,pageNumber:e,skipQueryValidation:t})).then((function(e){var t,n={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.replacements)n.validationResponse=e;else{var r,i,l,s;((null==e||null===(r=e.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.pagination)||void 0===r?void 0:r.current_page)>=(null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.pagination)||void 0===i?void 0:i.total_pages)||null==e||null===(l=e.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.items)||void 0===l||!l.length)&&(n.hasMore=!1);var c=(null==e||null===(s=e.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.items)||[];if(o.state.queryList){var u=o.state.queryList.concat(c);n.queryList=u}else n.queryList=c;n.keywords=a}return o.setState(n),Promise.resolve()})).catch((function(e){return o.setState({loading:!1,initialLoading:!1}),console.error(e),Promise.reject()}))})),mn(Cn(o),"onInputChange",(function(e){o.setState({inputValue:e.target.value})})),mn(Cn(o),"onKeyPress",(function(e){"Enter"==e.key&&o.loadMore(1)})),mn(Cn(o),"onValidationSuggestionClick",(function(e){var t=e.query;o.animateQITextAndSubmit(t,!0)})),mn(Cn(o),"animateQITextAndSubmit",(function(e,t){return Pa({text:e,inputRef:o.inputRef,callback:function(){o.setState({inputValue:e},(function(){return o.loadMore(1,t)}))}})})),mn(Cn(o),"clearExploreQueries",(function(){o.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){o.focusInput()}))})),mn(Cn(o),"renderIntroMessage",(function(){return f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement("h2",null,"Welcome to Explore Queries"),o.props.introMessage?f.createElement("p",null,o.props.introMessage):f.createElement(f.Fragment,null,f.createElement("p",null,"Discover what you can ask by entering a topic in the search bar above."),f.createElement("p",null,"Simply click on any of the returned options to run the query in Data Messenger.")))})),mn(Cn(o),"renderQueryList",(function(){var e;return o.state.initialLoading?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(Xa,null)):o.state.validationResponse?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(ko,{response:o.state.validationResponse,onSuggestionClick:o.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"})):o.state.queryList?0===(null===(e=o.state.queryList)||void 0===e?void 0:e.length)?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):f.createElement(Lo,{pageStart:1,loadMore:o.loadMore,hasMore:o.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(Ro,{style:{width:"19px",height:"20px",color:"#999"}}))},o.state.queryList.map((function(e,t){return f.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return o.props.executeQuery(e)},key:"query-tip-".concat(t),style:{display:"block"}},e)}))):o.renderIntroMessage()})),mn(Cn(o),"render",(function(){var e,t;return o.props.shouldRender?f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.exploreQueriesPage=e},className:"query-tips-page-container","data-test":"query-tips-tab"},f.createElement("div",{className:"react-autoql-chatbar-input-container",style:{animation:"slideDown 0.5s ease"}},f.createElement("input",{className:"react-autoql-chatbar-input left-padding right-padding",placeholder:o.props.inputPlaceholder,value:o.state.inputValue,onChange:o.onInputChange,onKeyPress:o.onKeyPress,spellCheck:!1,ref:function(e){return o.inputRef=e},"data-test":"explore-queries-input-bar",autoFocus:!0}),f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}})),f.createElement("div",{className:"chat-bar-clear-btn ".concat(null!==(e=o.state.queryList)&&void 0!==e&&e.length||o.state.inputValue?"visible":""),"data-for":null!==(t=o.props.tooltipID)&&void 0!==t?t:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(Wn,{type:"close",onClick:o.clearExploreQueries}))),f.createElement("div",{className:"query-tips-result-container"},o.renderQueryList())),!o.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"explore-queries-tooltips",delayShow:800,effect:"solid"})):null})),o.pageSize=25,o.state={inputValue:"",keywords:"",queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},o}return pn(n)}();mn(Ja,"propTypes",{shouldRender:b.bool,executeQuery:b.func,inputPlaceholder:b.string}),mn(Ja,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var Za=Ga(Ja),$a=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a.loadMore(1)})),mn(Cn(a),"componentDidUpdate",(function(e){(a.props.searchText&&a.props.searchText!==e.searchText||a.props.context!==e.context||!n(a.props.valueLabel,e.valueLabel))&&a.setState({queryList:void 0},(function(){a.loadMore(1)}))})),mn(Cn(a),"loadMore",(function(e){if(!a.state.loading&&!a.props.hidden&&(a.props.searchText||a.props.context||a.props.valueLabel)){var t={validationResponse:void 0};1===e?(t.initialLoading=!0,t.hasMore=!0):t.loading=!0;var n=a.props.searchText;return n!==a.state.keywords&&(t.queryList=void 0),a.setState(t),Be(an(an({},a.props.authentication),{},{pageSize:a.pageSize,pageNumber:e,text:a.props.searchText,selectedVL:a.props.valueLabel,userVLSelection:a.props.userSelection,context:a.props.context,skipQueryValidation:a.props.skipQueryValidation||e>1})).then((function(e){var t;a.props.onSuggestionListResponse({response:e});var o={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.replacements)o.validationResponse=e;else{var r,i,l,s;((null==e||null===(r=e.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.pagination)||void 0===r?void 0:r.current_page)>=(null==e||null===(i=e.data)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.pagination)||void 0===i?void 0:i.total_pages)||null==e||null===(l=e.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.items)||void 0===l||!l.length)&&(o.hasMore=!1);var c=(null==e||null===(s=e.data)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.items)||[];if(a.state.queryList){var u=a.state.queryList.concat(c);o.queryList=u}else o.queryList=c;o.keywords=n}a.setState(o)})).catch((function(e){console.error(e),a.props.onSuggestionListResponse({error:e}),a.setState({loading:!1,initialLoading:!1})}))}})),mn(Cn(a),"onValidationSuggestionClick",(function(e){a.props.onValidationSuggestionClick(e)})),mn(Cn(a),"updateScrollbars",(function(){var e;setTimeout(null===(e=a.infiniteScroll)||void 0===e?void 0:e.updateScrollbars,400)})),mn(Cn(a),"clearQueryList",(function(){a.setState({queryList:void 0,validationResponse:void 0})})),mn(Cn(a),"render",(function(){var e;return a.state.initialLoading?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(Xa,null)):a.state.validationResponse?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(ko,{response:a.state.validationResponse,onSuggestionClick:a.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search",scope:a.props.scope})):a.state.queryList?0===(null===(e=a.state.queryList)||void 0===e?void 0:e.length)?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement("p",null,"Sorry, I couldn’t find any queries matching your input. Try entering a different topic or keyword instead.")):f.createElement(Lo,{ref:function(e){return a.infiniteScroll=e},pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,className:"data-preview-scroll-container",useWindow:!1,initialLoad:!1,threshold:100,contentHidden:a.props.hidden,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(Ro,{style:{width:"19px",height:"20px",color:"#999"}}))},f.createElement("div",{className:"query-suggestion-list"},a.state.queryList.map((function(e,t){return f.createElement("div",{className:"query-tip-item animated-item",onClick:function(){return a.props.executeQuery(e)},key:"query-tip-".concat(t)},f.createElement("div",{className:"query-suggestion-text"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," ",e))})))):null})),a.pageSize=25,a.state={queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},a}return pn(o)}();mn($a,"propTypes",{searchText:b.string,subject:b.shape({}),valueLabel:b.shape({}),skipQueryValidation:b.bool,onSuggestionListResponse:b.func,executeQuery:b.func}),mn($a,"defaultProps",{searchText:"",subject:void 0,valueLabel:void 0,skipQueryValidation:!1,onSuggestionListResponse:function(){},executeQuery:function(){}});var er="subject",tr="VL",nr=b.shape({token:b.string,apiKey:b.string,domain:b.string}),or=b.shape({currencyCode:b.string,languageCode:b.string,currencyDecimals:b.number,quantityDecimals:b.number,comparisonDisplay:b.string,monthYearFormat:b.string,dayMonthYearFormat:b.string}),ar=b.shape({debug:b.bool,test:b.bool,enableAutocomplete:b.bool,enableQueryValidation:b.bool,enableDrilldowns:b.bool,enableQuerySuggestions:b.bool,enableColumnVisibilityManager:b.bool,enableNotifications:b.bool});b.shape({stringColumnIndices:b.arrayOf(b.number),numberColumnIndices:b.arrayOf(b.number),stringColumnIndex:b.number,legendColumnIndex:b.number,numberColumnIndex:b.number});var rr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.topic;if(!t)return null;var n=null;return t.type===er?n="book":t.type===tr&&(n="bookmark"),f.createElement(Rn,null,f.createElement("span",null,f.createElement(Wn,{className:"data-explorer-topic-icon",type:n}),t.display_name))},ir={GENERAL_QUERY:f.createElement("span",null,"Internal Service Error: Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."),GENERAL_HTML:f.createElement("span",null,"Internal Service Error: Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."),UNAUTHENTICATED:f.createElement("span",null,"Uh oh.. It looks like you don't have access to this resource. Please double check that all required authentication fields are correct.")},lr={CANCELLED:"Request cancelled"},sr=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.fetchAllSubjects()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.inputAnimationTimeout)})),mn(Cn(a),"fetchAllSubjects",(function(){He(an({},a.props.authentication)).then((function(e){var t,n=(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.subjects)||[],o=[];n.length&&(o=n.map((function(e){return an(an({},e),{},{type:er})})).filter((function(e){return!a.isAggSeed(e)})).sort((function(e,t){return e.display_name.localeCompare(t.display_name)}))),a._isMounted&&a.setState({allSubjects:o})})).catch((function(e){return console.error(e)}))})),mn(Cn(a),"blurInput",(function(){var e;null===(e=a.autoSuggest)||void 0===e||null===(e=e.input)||void 0===e||e.blur()})),mn(Cn(a),"getNewRecentSuggestions",(function(e){var t=S(a.state.recentSuggestions),o=t.findIndex((function(t){return n(t,e)}));return o>-1&&t.splice(o,1),5===t.length&&t.splice(-1),t.unshift(e),t})),mn(Cn(a),"selectSubject",(function(e){a._isMounted&&(a.userSelectedValue=null,a.setState({inputValue:e.display_name,recentSuggestions:a.getNewRecentSuggestions(e)}),a.props.onSelection(e))})),mn(Cn(a),"submitRawText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=a.state.allSubjects.find((function(t){return t.display_name.toLowerCase().trim()===e.toLowerCase().trim()}));n?a.selectSubject(n):n={type:"text",display_name:e},a.props.onSelection(n,t),a.setState({recentSuggestions:a.getNewRecentSuggestions(n),inputValue:n.display_name})})),mn(Cn(a),"animateTextAndSubmit",(function(e){Pa({text:e,inputRef:a.inputRef,callback:function(){return a.submitRawText(e,!0)}})})),mn(Cn(a),"onInputChange",(function(e){if(a._isMounted){var t,n;if(a.userSelectedValue&&("ArrowDown"===e.key||"ArrowUp"===e.key))return;(null!=e&&null!==(t=e.target)&&void 0!==t&&t.value||""===(null==e||null===(n=e.target)||void 0===n?void 0:n.value))&&"Enter"!==e.key?(a.userSelectedValue=null,a.userTypedValue=e.target.value,a.isDirty=!0,a.setState({inputValue:e.target.value})):a.selectSubject(a.userSelectedValue)}})),mn(Cn(a),"onInputFocus",(function(){a._isMounted&&a.setState({inputFocused:!0})})),mn(Cn(a),"onInputBlur",(function(){a._isMounted&&a.setState({inputFocused:!1})})),mn(Cn(a),"onKeyPress",(function(e){"Enter"==e.key&&(a.userSelectedValue?a.selectSubject(a.userSelectedValue):a.state.inputValue&&a.submitRawText(a.state.inputValue),a.blurInput())})),mn(Cn(a),"clearInput",(function(){a._isMounted&&(a.setState({inputValue:""}),a.userTypedValue=null,a.userSelectedValue=null,a.props.onClearInputClick())})),mn(Cn(a),"userSelectedSuggestionHandler",(function(e){a.userSelectedValue=e,null!=e&&e.display_name&&a._isMounted&&a.setState({inputValue:e.display_name})})),mn(Cn(a),"cancelCurrentRequest",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"requestSuggestions",(function(e){var t;a.setState({loadingAutocomplete:!0,loadingAutocompleteText:e}),clearTimeout(a.autoCompleteTimer),a.cancelCurrentRequest(),a.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),a.autoCompleteTimer=setTimeout((function(){var t;Qe(an(an({suggestion:e},a.props.authentication),{},{cancelToken:null===(t=a.axiosSource)||void 0===t?void 0:t.token})).then((function(e){a.setState({suggestions:e,loadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&(console.error(e),a.setState({suggestions:[],loadingAutocomplete:!1}))}))}),100)})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&a.isDirty&&a._isMounted&&a.requestSuggestions(t)})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a._isMounted&&a.setState({suggestions:[]})})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title),e.emptyState?f.createElement("div",{className:"data-explorer-no-suggestions"},f.createElement("em",null,"No results")):null)})),mn(Cn(a),"getSectionSuggestions",(function(e){return e.suggestions})),mn(Cn(a),"hasNoSuggestions",(function(){var e;return!(null!==(e=a.state.suggestions)&&void 0!==e&&e.length||a.state.loadingAutocomplete||!a.userTypedValue)})),mn(Cn(a),"getSuggestions",(function(){var e,t,n,o=[],r=!(null===(e=a.state.recentSuggestions)||void 0===e||!e.length),i=!a.userTypedValue,l=!a.state.loadingAutocomplete,s=!(null===(t=a.state.suggestions)||void 0===t||!t.length),c=!(null!==(n=a.state.suggestions)&&void 0!==n&&n.length)&&l;return r&&o.push({title:"Recent",suggestions:a.state.recentSuggestions}),i?o.push({title:"All Topics",suggestions:a.state.allSubjects}):s?o.push({title:'Related to "'.concat(a.state.loadingAutocompleteText,'"'),suggestions:a.state.suggestions}):c&&o.push({title:'Related to "'.concat(a.state.loadingAutocompleteText,'"'),suggestions:[{name:""}],emptyState:!0}),o})),mn(Cn(a),"renderSuggestion",(function(e){return f.createElement(rr,{topic:e})})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children,r=250,i=(null===(t=a.props.dataExplorerRef)||void 0===t?void 0:t.clientHeight)-200;return!isNaN(i)&&i>250&&(r=i),f.createElement("div",n,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},f.createElement(Po,{autoHeight:!0,autoHeightMin:0,maxHeight:r},o)))})),mn(Cn(a),"renderInputIcon",(function(){return f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}}))})),mn(Cn(a),"renderClearInputBtn",(function(){var e;return f.createElement("div",{className:"chat-bar-clear-btn ".concat(a.state.inputValue?"visible":""),"data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(Wn,{type:"close",onClick:a.clearInput}))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-chatbar-input-container data-explorer ".concat(a.hasNoSuggestions()?"no-suggestions":""),"data-test":"data-explorer-autocomplete"},f.createElement(Kt,{id:"data-explorer-autosuggest-".concat(a.componentKey),className:"react-autoql-data-explorer-autosuggest",onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,getSuggestionValue:a.userSelectedSuggestionHandler,renderSuggestionsContainer:a.renderSuggestionsContainer,suggestions:a.getSuggestions(),multiSection:!0,renderSectionTitle:a.renderSectionTitle,getSectionSuggestions:a.getSectionSuggestions,shouldRenderSuggestions:function(){return!0},ref:function(e){return a.autoSuggest=e},renderSuggestion:a.renderSuggestion,focusInputOnSuggestionClick:!1,inputProps:{ref:function(e){return a.inputRef=e},className:"react-autoql-chatbar-input",placeholder:a.props.inputPlaceholder,"data-test":"data-explorer-input-component",value:a.state.inputValue,onChange:a.onInputChange,onKeyPress:a.onKeyPress,onFocus:a.onInputFocus,onBlur:a.onInputBlur}}),a.renderInputIcon(),a.renderClearInputBtn()))})),a.componentKey=C(),a.userTypedValue=null,a.userSelectedValue=null,a.isDirty=!1,a.state={inputValue:"",loadingAutocomplete:!1,recentSuggestions:[],suggestions:[],allSubjects:[]},a}return pn(o,[{key:"isAggSeed",value:function(e){return e.display_name.toLowerCase().endsWith("by day")||e.display_name.toLowerCase().endsWith("by week")||e.display_name.toLowerCase().endsWith("by month")||e.display_name.toLowerCase().endsWith("by year")}}]),o}();mn(sr,"propTypes",{authentication:nr,inputPlaceholder:b.string,onClearInputClick:b.func,onSelection:b.func}),mn(sr,"defaultProps",{authentication:{},inputPlaceholder:"Search terms or topics",onClearInputClick:function(){},onSelection:function(){}});var cr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.initialCollapseTimer=setTimeout((function(){o.saveCurrentCardHeight(),o.props.onIsCollapsedChange(o.props.isCollapsed)}),400)})),mn(Cn(o),"componentDidUpdate",(function(e){if(o.props.isCollapsed!==e.isCollapsed){var t=o.getIsCSSCollapsed();"boolean"==typeof t&&t!==o.props.isCollapsed&&(o.setIsCollapsedCSS(o.props.isCollapsed),o.forceUpdate())}})),mn(Cn(o),"componentWillUnmount",(function(){clearTimeout(o.collapseTimer),clearTimeout(o.initialCollapseTimer)})),mn(Cn(o),"getIsCSSCollapsed",(function(){var e;if(null!==(e=o.contentRef)&&void 0!==e&&e.style)return"hidden"===o.contentRef.style.visibility})),mn(Cn(o),"getIsCollapsed",(function(){return"boolean"==typeof o.props.isCollapsed?o.props.isCollapsed:o.state.isCollapsed})),mn(Cn(o),"handleClick",(function(){o.setIsCollapsedCSS(!o.getIsCSSCollapsed())})),mn(Cn(o),"saveCurrentCardHeight",(function(){if(o.contentRef)if(o.getIsCollapsed())o.contentRef.style.maxHeight="0px",o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute";else{var e=o.contentRef.offsetHeight||0;o.contentRef.style.maxHeight="".concat(e,"px"),o.contentRef.style.position="relative",o.contentRef.style.visibility="visible"}})),mn(Cn(o),"setIsCollapsedCSS",(function(e){var t=o.getIsCSSCollapsed();if(!(e&&t||!e&&!t)){if(o.contentRef){var n=o.contentRef.offsetHeight;e?(clearTimeout(o.collapseTimer),o.contentRef.style.maxHeight="unset",o.contentRef.style.maxHeight="".concat(n,"px"),setTimeout((function(){o.contentRef.style.maxHeight="0px"}),0),o.collapseTimer=setTimeout((function(){o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute"}),300)):(o.collapseTimer&&(clearTimeout(o.collapseTimer),o.contentRef.style.visibility="hidden",o.contentRef.style.position="absolute"),o.contentRef.style.maxHeight="unset",n=o.contentRef.offsetHeight,o.contentRef.style.maxHeight="0px",o.contentRef.style.position="relative",o.contentRef.style.visibility="visible",setTimeout((function(){o.contentRef.style.maxHeight="".concat(n,"px")}),0))}o.props.onIsCollapsedChange(e),o.setState({isCollapsed:e})}})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-card\n ".concat(o.getIsCollapsed()?" collapsed":"","\n ").concat(o.props.className?o.props.className:""),style:o.props.style},f.createElement("div",{className:"react-autoql-card-title",onClick:o.handleClick},f.createElement("div",null,o.props.title),f.createElement(Wn,{type:o.getIsCollapsed()?"caret-left":"caret-down"})),f.createElement("div",{ref:function(e){return o.contentRef=e},className:"react-autoql-card-content"},!!o.props.subtitle&&f.createElement("div",{className:"react-autoql-card-subtitle"},o.props.subtitle),f.createElement("div",{className:"react-autoql-card-user-content"},o.props.children))))})),o.COMPONENT_ID=C(),o.state={isCollapsed:e.defaultCollapsed},o}return pn(n)}();mn(cr,"propTypes",{title:b.oneOfType([b.string,b.element]),subtitle:b.oneOfType([b.string,b.element]),defaultCollapsed:b.bool,isCollapsed:b.bool,onIsCollapsedChange:b.func}),mn(cr,"defaultProps",{title:null,subtitle:null,defaultCollapsed:!1,isCollapsed:void 0,onIsCollapsedChange:function(){}});var ur=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.subject&&a.getDataPreview()})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.subject&&!n(a.props.subject,e.subject)&&a.getDataPreview(),a.state.dataPreview&&!n(a.state.dataPreview,t.dataPreview)&&Co()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1})),mn(Cn(a),"cancelCurrentRequest",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"getDataPreview",(function(){var e,t;a.cancelCurrentRequest(),a.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source(),a.setState({loading:!0,error:void 0,dataPreview:void 0}),Ue(an(an({},a.props.authentication),{},{subject:null===(t=a.props.subject)||void 0===t?void 0:t.name,numRows:a.DATA_PREVIEW_ROWS,source:"data_explorer.data_preview",scope:"data_explorer",cancelToken:a.axiosSource.token})).then((function(e){a.setState({dataPreview:e,loading:!1})})).catch((function(e){var t;(null==e?void 0:e.message)!==lr.CANCELLED&&(console.error(e),a.setState({loading:!1,error:null==e||null===(t=e.response)||void 0===t?void 0:t.data}))}))})),mn(Cn(a),"formatColumnHeader",(function(e){var t;return f.createElement("div",{className:"data-preview-col-header","data-for":null!==(t=a.props.tooltipID)&&void 0!==t?t:"data-preview-tooltip"},null==e?void 0:e.display_name)})),mn(Cn(a),"formatCell",(function(e){var t=e.cell,n=e.column,o=e.config;return f.createElement("div",{className:"data-preview-cell",style:{textAlign:"DOLLAR_AMT"===n.type?"right":"center"}},aa({element:t,column:n,config:o}))})),mn(Cn(a),"renderDataPreviewGrid",(function(){var e,t,n,o=null===(e=a.state.dataPreview)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.rows,r=null===(t=a.state.dataPreview)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.columns;if(!(a.state.error||r&&o))return null;var i=Fo(a.props.dataFormatting);return null===(n=a.props.dataExplorerRef)||void 0===n||n.clientHeight,f.createElement("div",{className:"data-preview"},f.createElement(Po,{style:{height:"165px"}},a.state.error?f.createElement("div",{className:"data-preview-error-message"},f.createElement("div",null,a.state.error.message),a.state.error.reference_id&&f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",a.state.error.reference_id))):f.createElement("table",null,f.createElement("thead",null,f.createElement("tr",null,r.map((function(e,t){return f.createElement("th",{key:"col-header-".concat(t)},a.formatColumnHeader(e))})))),f.createElement("tbody",null,o.map((function(e,t){return f.createElement("tr",{key:"row-".concat(t),className:"data-preview-row"},e.map((function(e,t){var n=r[t];return f.createElement("td",{key:"cell-".concat(t)},a.formatCell({cell:e,column:n,config:i}))})))}))))))})),mn(Cn(a),"renderLoadingContainer",(function(){return f.createElement("div",{className:"data-explorer-card-placeholder data-preview"},f.createElement(Xa,null))})),mn(Cn(a),"renderDataPreviewTitle",(function(){var e;return f.createElement("div",{className:"react-autoql-card-title-text"},f.createElement(Wn,{style:{fontSize:"20px"},type:"table"}),' Data Preview - "',null===(e=a.props.subject)||void 0===e?void 0:e.query,'"')})),mn(Cn(a),"render",(function(){return a.props.shouldRender?f.createElement(Rn,null,f.createElement(cr,{className:"data-explorer-data-preview","data-test":"data-explorer-data-preview",title:a.renderDataPreviewTitle(),isCollapsed:a.props.isCollapsed,onIsCollapsedChange:a.props.onIsCollapsedChange,defaultCollapsed:a.props.defaultCollapsed},a.state.loading?a.renderLoadingContainer():a.renderDataPreviewGrid())):null})),a.DATA_PREVIEW_ROWS=5,a.state={dataPreview:null},a}return pn(o)}();mn(ur,"propTypes",{dataFormatting:or,authentication:nr,shouldRender:b.bool,subject:b.shape({}),isCollapsed:b.bool,onIsCollapsedChange:b.func,defaultCollapsed:b.bool}),mn(ur,"defaultProps",{dataFormatting:qo,authentication:{},shouldRender:!0,subject:null,rebuildTooltips:void 0,isCollapsed:void 0,onIsCollapsedChange:function(){},defaultCollapsed:!1});var dr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"onInputSelection",(function(e,t){var n;(null==e?void 0:e.type)===er?o.setState({selectedSubject:e,selectedKeywords:null,selectedVL:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):(null==e?void 0:e.type)===tr?o.setState({selectedVL:e,selectedKeywords:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):"text"===(null==e?void 0:e.type)&&o.setState({selectedSubject:null,selectedVL:null,selectedKeywords:e,activeTopicType:null==e?void 0:e.type,skipQueryValidation:t}),null===(n=o.inputRef)||void 0===n||n.blurInput()})),mn(Cn(o),"renderIntroMessage",(function(){return f.createElement("div",{className:"data-explorer-intro-message"},f.createElement("h2",null,"Welcome to ",f.createElement(Wn,{type:"data-search"}),"Data Explorer"),o.props.introMessage?f.createElement("p",null,o.props.introMessage):f.createElement("div",null,f.createElement("p",null,"Explore your data and discover what you can ask AutoQL. Simply enter a term or topic above and:"),f.createElement("div",{className:"intro-message-list-container"},f.createElement("div",null,f.createElement("p",null,f.createElement(Wn,{type:"table"})," Preview available data in a snapshot"),f.createElement("p",null,f.createElement(Wn,{type:"abacus"})," Explore data structure and column types"),f.createElement("p",null,f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," View a variety of query suggestions")))))})),mn(Cn(o),"animateDETextAndSubmit",(function(e){var t;null!==(t=o.inputRef)&&void 0!==t&&t._isMounted&&o.inputRef.animateTextAndSubmit(e)})),mn(Cn(o),"onValidationSuggestionClick",(function(e){var t=e.query,n=e.userSelection;o.querySuggestionsKey=C(),o.animateDETextAndSubmit(t),o.setState({userSelection:n})})),mn(Cn(o),"reloadScrollbars",(function(){var e;null===(e=o.querySuggestionList)||void 0===e||e.updateScrollbars()})),mn(Cn(o),"renderDataPreview",(function(){return o.state.selectedSubject&&o.state.activeTopicType===er?f.createElement("div",{className:"data-explorer-section data-preview-section"},f.createElement(ur,{authentication:o.props.authentication,dataFormatting:o.props.dataFormatting,subject:o.state.selectedSubject,shouldRender:o.props.shouldRender,dataExplorerRef:o.dataExplorerPage,isCollapsed:o.props.isSmallScreen?o.state.isDataPreviewCollapsed:void 0,tooltipID:o.props.tooltipID,onIsCollapsedChange:function(e){o.setState({isDataPreviewCollapsed:e,isQuerySuggestionCollapsed:!e||o.state.isQuerySuggestionCollapsed})},defaultCollapsed:!o.props.isSmallScreen&&void 0})):null})),mn(Cn(o),"renderVLSubjectList",(function(){return o.state.selectedVL&&o.activeTopicType===tr?f.createElement("div",null,f.createElement("h2",null,"List of subjects for VL"),f.createElement("p",null,"list of subjects goes here")):null})),mn(Cn(o),"renderQuerySuggestionCardTitle",(function(e){return f.createElement("div",{className:"react-autoql-card-title-text"},f.createElement(Wn,{style:{fontSize:"20px"},type:"react-autoql-bubbles-outlined"}),' Query Suggestions for "',null==e?void 0:e.display_name,'"')})),mn(Cn(o),"renderQuerySuggestions",(function(){var e,t,n=o.getSelectedTopic();if(!n)return null;var a=o.props.isSmallScreen?o.state.isQuerySuggestionCollapsed:void 0,r=!(!o.state.selectedSubject||o.state.activeTopicType!==er);return f.createElement("div",{className:"data-explorer-section query-suggestions"},f.createElement(cr,{title:o.renderQuerySuggestionCardTitle(n),defaultCollapsed:o.props.isSmallScreen?r:void 0,isCollapsed:a,onIsCollapsedChange:function(e){o.reloadScrollbars(),o.setState({isQuerySuggestionCollapsed:e,isDataPreviewCollapsed:!e||o.state.isDataPreviewCollapsed})}},f.createElement("div",{className:"data-explorer-query-suggestion-list"},f.createElement($a,{ref:function(e){return o.querySuggestionList=e},key:o.querySuggestionsKey,authentication:o.props.authentication,context:null===(e=o.state.selectedSubject)||void 0===e?void 0:e.name,valueLabel:o.state.selectedVL,searchText:null===(t=o.state.selectedKeywords)||void 0===t?void 0:t.display_name,selectedType:o.state.activeTopicType,executeQuery:o.props.executeQuery,skipQueryValidation:o.state.skipQueryValidation,userSelection:o.state.userSelection,onValidationSuggestionClick:o.onValidationSuggestionClick,onSuggestionListResponse:function(){o.reloadScrollbars(),o.setState({skipQueryValidation:!1})},hidden:!0===a,scope:o.props.scope}))))})),mn(Cn(o),"getSelectedTopic",(function(){var e=o.state.activeTopicType;return e===er?o.state.selectedSubject:e===tr?o.state.selectedVL:"text"===e?o.state.selectedKeywords:null})),mn(Cn(o),"clearContent",(function(){o.setState({activeTopicType:null,selectedSubject:null,selectedVL:null,selectedKeywords:null})})),mn(Cn(o),"renderDataExplorerContent",(function(){var e;return o.getSelectedTopic()?f.createElement("div",{className:"data-explorer-result-container"},f.createElement(Po,null,f.createElement("div",{key:"data-explorer-sections-container-".concat(null===(e=o.state.selectedSubject)||void 0===e?void 0:e.name),className:"data-explorer-sections-container"},o.renderDataPreview(),o.renderQuerySuggestions()))):o.renderIntroMessage()})),mn(Cn(o),"formatColumnType",(function(e){switch(e){case"DATE":case"DATE_STRING":return f.createElement("span",null,f.createElement(Wn,{type:"calendar"})," Date");case"STRING":return f.createElement("span",null,f.createElement(Wn,{type:"note"})," Description");case"DOLLAR_AMT":return f.createElement("span",null,f.createElement(Wn,{type:"money"})," Currency");case"QUANTITY":return f.createElement("span",null,f.createElement(Wn,{type:"abacus"})," Quantity")}})),mn(Cn(o),"renderColumnQuerySuggestions",(function(e){var t,n,a=(null===(t=o.state.selectedSubject)||void 0===t?void 0:t.display_name)||"";if(!a)return null;var r=a.toLowerCase(),i=r[0].toUpperCase()+r.substring(1),l=null==e||null===(n=e.display_name)||void 0===n?void 0:n.toLowerCase(),s=[];return"STRING"===e.type&&(s.push("Show ".concat(r," by ").concat(l)),s.push("List all ".concat(l))),"DATE"===e.type&&(s.push("".concat(i," by month this year")),s.push("Show ".concat(r," in the last 2 weeks"))),"DATE_STRING"===e.type&&s.push("Show ".concat(r," by ").concat(l)),"DOLLAR_AMT"===e.type&&(s.push("Total ".concat(l," ").concat(r)),s.push("Highest ".concat(l," ").concat(r))),"QUANTITY"===e.type&&(s.push("Average ".concat(l," ").concat(r)),s.push("Lowest ".concat(l," ").concat(r))),f.createElement(f.Fragment,null,s.map((function(e,t){return f.createElement("div",{key:t,onClick:function(){return o.props.executeQuery(e)},className:"data-explorer-tooltip-query"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})," ",e)})))})),mn(Cn(o),"renderHeaderTooltipContent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=JSON.parse(e);if(!t)return null;var n=o.formatColumnType(null==t?void 0:t.type);return f.createElement("div",null,f.createElement("div",{className:"data-explorer-tooltip-title"},null==t?void 0:t.display_name),!!n&&f.createElement("div",{className:"data-explorer-tooltip-section"},n))})),mn(Cn(o),"render",(function(){var e;return o.props.shouldRender||(e="none"),f.createElement("div",{ref:function(e){return o.dataExplorerPage=e},className:"data-explorer-page-container","data-test":"data-explorer-tab",style:{display:e}},f.createElement(Rn,null,f.createElement(sr,{ref:function(e){return o.inputRef=e},authentication:o.props.authentication,inputPlaceholder:o.props.inputPlaceholder,onSelection:o.onInputSelection,dataExplorerRef:o.dataExplorerPage,onClearInputClick:o.clearContent,tooltipID:o.props.tooltipID}),o.renderDataExplorerContent(),!o.props.tooltipID&&f.createElement(So,{className:"data-preview-tooltip",id:"data-preview-tooltip",place:"right",delayHide:200,delayUpdate:200,effect:"solid",getContent:o.renderHeaderTooltipContent,clickable:!0})))})),o.querySuggestionsKey=C(),o.state={activeTopicType:null,selectedSubject:null,selectedVL:null,isQuerySuggestionSectionVisible:!0,isQuerySuggestionCollapsed:!0,isDataPreviewCollapsed:!1},o}return pn(n)}();mn(dr,"propTypes",{authentication:nr,dataFormatting:or,shouldRender:b.bool,inputPlaceholder:b.string,introMessage:b.oneOfType([b.string,b.element]),executeQuery:b.func,isSmallScreen:b.bool}),mn(dr,"defaultProps",{authentication:{},dataFormatting:qo,shouldRender:!0,inputPlaceholder:void 0,introMessage:void 0,rebuildTooltips:void 0,executeQuery:function(){},isSmallScreen:!1});var pr=function(e){var t=e.query,n=e.domain,o=e.apiKey,a=e.token;return t&&t.trim()?o&&n&&a?E.post("".concat(n,"/autoql/api/v1/query?key=").concat(o),{text:t,translation:"exclude"},{headers:{Authorization:"Bearer ".concat(a)}}):Promise.reject({error:"Unauthenticated"}):Promise.reject({error:"No query supplied"})},mr=function(e){var t=e.domain,n=e.apiKey,o=e.token,a=e.offset,r=e.limit;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=E.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n,"&offset=").concat(a,"&limit=").concat(r);return i.get(l).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},fr=function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts?key=").concat(n);return a.get(r).then((function(e){return Promise.resolve(null==e?void 0:e.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},gr=function(e){var t=e.id,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(t,"/initialize?key=").concat(o);return r.put(i).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))},vr=function(e){var t=e.dataAlertId,n=e.status,o=e.token,a=e.domain,r=e.apiKey;return"INACTIVE"===n?function(e){var t=e.dataAlertId,n=e.token,o=e.domain,a=e.apiKey,r={headers:{Authorization:"Bearer ".concat(n)}},i="".concat(o,"/autoql/api/v1/data-alerts/").concat(t,"/user?key=").concat(a);return E.delete(i,r).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,token:o,domain:a,apiKey:r}):function(e){var t=e.dataAlertId,n=e.token,o=e.domain,a=e.apiKey,r={headers:{Authorization:"Bearer ".concat(n)}},i="".concat(o,"/autoql/api/v1/data-alerts/").concat(t,"/user?key=").concat(a);return E.post(i,{},r).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,token:o,domain:a,apiKey:r})},hr=function(e){var t=e.dataAlertId,n=e.status,o=e.type,a=e.domain,r=e.apiKey,i=e.token;return i&&r&&a?t?"PROJECT"===o?vr({dataAlertId:t,status:n,token:i,domain:a,apiKey:r}):function(e){var t=e.dataAlertId,n=e.status,o=e.token,a=e.domain,r=e.apiKey,i={status:n},l={headers:{Authorization:"Bearer ".concat(o)}},s="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(r);return E.put(s,i,l).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}({dataAlertId:t,status:n,token:i,domain:a,apiKey:r}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},br=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o._isMounted=!0,o.getNotificationCount(),o.clearPollingComponent(),o.subscribeToNotificationCount();case 4:case"end":return e.stop()}}),e)})))),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.count!==t.count&&o.props.onCount(o.state.count)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,o.clearPollingComponent(),clearInterval(o.pollInterval)})),mn(Cn(o),"getNotificationCount",(function(e){var t=e||o.state.count;return o.props.pausePolling?Promise.resolve(t):function(e){var t=e.domain,n=e.apiKey,o=e.token,a=e.unacknowledged,r=void 0===a?0:a;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=E.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(r);return i.get(l,{timeout:18e4})}(an(an({},_o(o.props.authentication)),{},{unacknowledged:t})).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.unacknowledged;return n&&n!==o.state.count&&(o.setState({count:n}),o.HAS_FETCHED_COUNT&&o.props.onNewNotification(n)),o.HAS_FETCHED_COUNT=!0,Promise.resolve(n)})).catch((function(e){return console.error(e),o.props.onErrorCallback(e)}))})),mn(Cn(o),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),mn(Cn(o),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",o.COMPONENT_KEY)})),mn(Cn(o),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),mn(Cn(o),"subscribeToNotificationCount",(function(e){var t=o.getPollingComponent(),n=!t||t===o.COMPONENT_KEY;o._isMounted&&n&&(clearInterval(o.pollInterval),o.setPollingComponent(),o.pollInterval=setInterval((function(){o.getNotificationCount(e).then((function(e){o.subscribeToNotificationCount(e),o.FAILED_POLL_ATTEMPTS=0})).catch((function(e){var t;if(5===o.FAILED_POLL_ATTEMPTS){var n=new Error("There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.");return console.error(n),o.props.onErrorCallback(n),void clearInterval(o.pollInterval)}504==(null==e||null===(t=e.response)||void 0===t?void 0:t.status)?o.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){o.subscribeToNotificationCount()})),o.FAILED_POLL_ATTEMPTS+=1}))}),o.INTERVAL_LENGTH))})),mn(Cn(o),"resetCount",(function(){(function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n);return a.put(r,{notification_id:null,state:"ACKNOWLEDGED"}).then((function(e){var t;return Promise.resolve(null==e||null===(t=e.data)||void 0===t?void 0:t.data)})).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))})(an({},_o(o.props.authentication))).catch((function(e){console.error(e)})).finally((function(){o.setState({count:0})}))})),mn(Cn(o),"getCurrentCount",(function(){return"number"==typeof o.props.count?o.props.count:o.state.count})),mn(Cn(o),"renderBadge",(function(){var e=o.props.overflowCount,t=o.getCurrentCount();if(!t)return null;if(o.props.useDot)return f.createElement("div",{className:"react-autoql-notifications-badge-dot"});var n=t;return t>e&&(n="".concat(e,"+")),f.createElement("div",{className:"react-autoql-notifications-badge"},n)})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-notifications-button-container ".concat(o.props.useDot?"dot":"","\n ").concat(o.props.className||"","\n ").concat(o.state.count||o.props.count?"":"no-badge"),"data-test":"notification-button",style:an({},o.props.style),onClick:function(){o.props.clearCountOnClick&&o.resetCount()}},f.createElement(Wn,{type:"notification",className:"react-autoql-notifications-button"}),o.renderBadge()))})),o.NUMBER_OF_NOTIFICATIONS_TO_FETCH=10,o.INTERVAL_LENGTH=9e4,o.FAILED_POLL_ATTEMPTS=0,o.COMPONENT_KEY=C(),o.HAS_FETCHED_COUNT=!1,o.pollInterval=void 0,o.state={count:0},o}return pn(n)}();mn(br,"propTypes",{authentication:nr,overflowCount:b.number,style:b.shape({}),size:b.number,useDot:b.bool,clearCountOnClick:b.bool,onNewNotification:b.func,onErrorCallback:b.func,pausePolling:b.bool,count:b.number,onCount:b.func}),mn(br,"defaultProps",{authentication:Mo,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var yr=Ga(br),Cr=function(e){if(!e)return!1;try{return!!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(e)&&new Date(e).toISOString()===e}catch(e){return!1}},Er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.precision;return t===co||t===uo?t:so},Sr=function(e){switch(e){case so:return"day";case co:return"month";case uo:return"year";case po:return"week";case mo:return"quarter";case vo:case fo:return"hour";case ho:case go:return"minute";default:return"day"}},Tr=function(e){var t=e.filter((function(e){return"FILTER"===e.c_type||"SEED"===e.c_type}));if(!t.length)return[];var n=[];return t.forEach((function(e){var t=e.eng.split(" ").filter((function(e){return Cr(e)}));if(t.length){var a=function(e){try{var t=e.match(/\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/g);return t?t.slice(-1).pop().slice(1,-1):null}catch(e){return console.error(e),null}}(e.eng);if(a){var r=function(e){var t=o(e[0]),n=e[1]?o(e[1]):t;if(n.isBefore(t)){var a=t;t=n,n=a}var r=t.utc().format("ll"),i=n.utc().format("ll"),l=new Date(r),s=new Date(i);return s.setHours(23,59,59,999),{startDate:l,endDate:s}}(t),i=r.startDate,l=r.endDate,s={columnName:a,startDate:i,endDate:l},c=n.findIndex((function(e){return e.columnName===a}));if(c>=0){var u=n[c];n[c]=an(an({},n[c]),function(e,t){try{var n=e.startDate,a=e.endDate,r=t.startDate,i=t.endDate,l=o(n).isAfter(o(r))?n:r,s=o(a).isBefore(o(i))?a:i;return o(l).isAfter(o(s))?null:{startDate:l,endDate:s}}catch(e){return console.error(e),null}}(s,u))}else n.push(s)}}})),null!=n&&n.length?n:[]},Dr=["icon","area","size","selectOptions","style","selectValue","onSelectChange","fullWidth"],xr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onFocus",(function(){o.setState({focused:!0}),o.props.onFocus&&o.props.onFocus()})),mn(Cn(o),"onBlur",(function(){o.setState({focused:!1}),o.props.onBlur&&o.props.onBlur()})),mn(Cn(o),"focus",(function(){var e;null===(e=o.inputRef)||void 0===e||e.focus()})),mn(Cn(o),"onSelectChange",(function(e){o.props.onSelectChange(e),o.focus()})),mn(Cn(o),"simulateOnChange",(function(){var e;null===(e=o.inputRef)||void 0===e||e.dispatchEvent(new Event("change",{bubbles:!0}))})),mn(Cn(o),"incrementNumber",(function(){var e;null===(e=o.inputRef)||void 0===e||e.stepUp(),o.simulateOnChange()})),mn(Cn(o),"decrementNumber",(function(){var e;null===(e=o.inputRef)||void 0===e||e.stepDown(),o.simulateOnChange()})),mn(Cn(o),"renderSpinWheel",(function(){return f.createElement("div",{className:"react-autoql-input-number-spin-button-container"},f.createElement("button",{className:"react-autoql-input-number-spin-button",onClick:o.incrementNumber},f.createElement(Wn,{type:"caret-up"})),f.createElement("button",{className:"react-autoql-input-number-spin-button",onClick:o.decrementNumber},f.createElement(Wn,{type:"caret-down"})))})),mn(Cn(o),"renderSelectDropdown",(function(){return f.createElement(xo,{className:"react-autoql-text-input-selector",options:o.props.selectOptions,value:o.props.selectValue,onChange:o.onSelectChange})})),mn(Cn(o),"render",(function(){var e=o.props,t=e.icon,n=e.area,a=e.size,r=e.selectOptions,i=e.style;e.selectValue,e.onSelectChange;var l=e.fullWidth,s=yn(e,Dr),c=s.className,u=s.type,d=s.label,p=!(null==r||!r.length);return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-input-and-label-container\n ".concat(null!=c?c:"","\n ").concat(l?"react-autoql-input-full-width":""),style:i},!!d&&f.createElement("div",{className:"react-autoql-input-label"},d),f.createElement("div",{className:"react-autoql-input-container\n ".concat(o.state.focused?"focus":"","\n ").concat(p?"with-select":"","\n ").concat("small"===a?"react-autoql-input-small":"react-autoql-input-large","\n ").concat("number"===u?"react-autoql-input-number":""),"data-test":"react-autoql-input"},p&&o.renderSelectDropdown(),n?f.createElement("textarea",fn({},s,{ref:function(e){return o.inputRef=e},className:"react-autoql-input area",onFocus:o.onFocus,onBlur:o.onBlur})):f.createElement("div",{className:"react-autoql-input-and-icon"},f.createElement("input",fn({autoComplete:"one-time-code"},s,{ref:function(e){return o.inputRef=e},className:"react-autoql-input\n ".concat(t?"with-icon":"","\n ").concat(p?"with-select":""),onFocus:o.onFocus,onBlur:o.onBlur})),t&&f.createElement(Wn,{className:"react-autoql-input-icon ".concat(o.state.focused?" focus":""),type:t})),"number"===u&&o.renderSpinWheel())))})),o.state={focused:!1},o}return pn(n)}();mn(xr,"propTypes",{icon:b.string,type:b.string,step:b.string,size:b.oneOf(["small","large"]),label:b.oneOfType([b.element,b.string]),fullWidth:b.bool}),mn(xr,"defaultProps",{icon:void 0,type:"text",step:"1",size:"large",label:"",fullWidth:!1});var Rr,Ir,Ar=function(e,t){try{if(null!=e&&e[0]){var n,o=null==e||null===(n=e[0])||void 0===n?void 0:n.condition;return o&&o===Mr?[Mr]:[Lr]}return Ca(t)?[Lr]:[Mr]}catch(e){return console.error(e),[]}},Nr=function(e){return!!e.reset_date&&o(e.reset_date).valueOf()>o().valueOf()},wr=function(e,t){if(!e.reset_date)return"";var n=o(e.reset_date).tz(e.time_zone);return t?"".concat(n.format("ll h:mma")):"".concat(n.format("ll [at] h:mma")," (").concat(e.time_zone,")")},kr=function(e,t){var n,a;if(null==e||!e.length)return"";var r=null===(n=e[0])||void 0===n?void 0:n.next_evaluation,i=null===(a=e[0])||void 0===a?void 0:a.time_zone,l=o(r).tz(i);if(t){var s=o().tz(i).startOf("day"),c=l.startOf("day").diff(s,"day"),u="".concat(l.format("ll"));return 0===c?u="Today at":1===c&&(u="Tomorrow at"),"".concat(u," ").concat(l.format("h:mma"))}return"".concat(l.format("ll [at] h:mma")," (").concat(i,")")},Pr="PERIODIC",Or="CONTINUOUS",Lr="COMPARE",Mr="EXISTS",qr=["ACTIVE","RETRY","WAITING"],Vr={GREATER_THAN:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"greater")," than"),symbol:">",conditionText:"exceeds",conditionTextPast:"exceeded"},GREATER_THAN_EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"greater")," than ",f.createElement("strong",null,"or equal")," to"),symbol:">=",conditionText:"is equal to or exceeds",conditionTextPast:"was equal to or exceeded"},LESS_THAN:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"less")," than"),symbol:"<",conditionText:"falls below",conditionTextPast:"fell below"},LESS_THAN_EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"less")," than ",f.createElement("strong",null,"or equal")," to"),symbol:"<=",conditionText:"is equal to or falls below",conditionTextPast:"was equal to or fell below"},EQUAL_TO:{displayName:f.createElement("span",null,"Is ",f.createElement("strong",null,"equal")," to"),symbol:"=",conditionText:"equals",conditionTextPast:"was equal to"}},_r=(mn(Rr={},Lr,{displayName:"When a specific condition is met"}),mn(Rr,Mr,{displayName:"If new data is detected"}),Rr),Fr=(mn(Ir={},"SCHEDULED",{label:"at the following times:",listLabel:"at the following times"}),mn(Ir,Or,{label:"right away.",listLabel:"right away"}),Ir),zr={DAY:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"day")),getLocalStartDate:function(e){var t=e.timeObj,n=e.timezone,a=e.daysToAdd,r=void 0===a?0:a;try{var i=o().tz(n),l=i.startOf("minute").set("hour",t.hour24).set("minute",t.minute);return l.valueOf()<i.valueOf()&&(l=l.add(1,"day")),l.add(r,"days").format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}},WEEK:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"week")),getLocalStartDate:function(e){var t=e.weekDay,n=e.timeObj,a=e.timezone;try{var r=o().tz(a),i=io.findIndex((function(e){return t.toLowerCase()===e.toLowerCase()})),l=r.day(i).startOf("minute").hour(n.hour24).minute(n.minute);return l.valueOf()<r.valueOf()?l.add(1,"week").format("YYYY-MM-DD[T]HH:mm:00"):l.format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}},MONTH:{displayName:f.createElement("span",null,"Every ",f.createElement("strong",null,"month")),getLocalStartDate:function(e){var t=e.monthDay,n=e.timeObj,a=e.timezone;try{var r,i=o().tz(a);return"LAST"===t?r=i.endOf("month").startOf("day").format("ll HH:mm"):"FIRST"===t&&(r=i.add(1,"month").startOf("month").format("ll HH:mm")),o.tz(r,a).hour(n.hour24).minute(n.minute).format("YYYY-MM-DD[T]HH:mm:00")}catch(e){return void console.error(e)}}}},Br={DAY:{displayText:"Scheduled daily"},WEEK:{displayText:"Scheduled weekly"},MONTH:{displayText:"Scheduled for the 1st of every month"},MONTH_LAST_DAY:{displayText:"Scheduled for the end of every month"},YEAR:{displayText:"Scheduled yearly"}},Hr={DAY:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a day")),displayText:"At most once a day"},WEEK:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a week")),displayText:"At most once a week"},MONTH:{displayName:f.createElement("span",null,"At most ",f.createElement("strong",null,"once a month")),displayText:"At most once a month"},NONE:{displayName:f.createElement("span",null,f.createElement("strong",null,"Every time")," new data is detected"),displayText:"Continuous"}},Qr={FIRST:f.createElement("span",null,"on the ",f.createElement("strong",null,"first day")),LAST:f.createElement("span",null,"on the ",f.createElement("strong",null,"last day"))},Ur={1:{value:1,label:"1 min"},2:{value:2,label:"2 mins"},3:{value:3,label:"3 mins"},5:{value:5,label:"5 mins",listLabel:f.createElement("span",null,"5 mins ",f.createElement("em",null,"(Recommended)"))},10:{value:10,label:"10 mins"},30:{value:30,label:"30 mins"},60:{value:60,label:"60 mins"}},Yr=function(e){try{for(var t,n,a,r=/\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)/g,i=/'(''|[^'])*'/g,l=e.eng,s=l.split(r),c=[];null!==(a=r.exec(l));)c.push(a);if(!c.length||!s.length||"(Date)"===(null===(t=c[0])||void 0===t?void 0:t[0])||null!==(n=s[0])&&void 0!==n&&null!==(n=n.split(" "))&&void 0!==n&&n.find((function(e){return Cr(e)})))return[function(e){var t=!1,n=e.eng,a=[];try{n=e.eng.split(" ").map((function(e){if(Cr(e)){var n=o(e).utc(),r=n.format("ll");if("Invalid Date"!==r)return t=!0,a.push(n),r}return e})).join(" ")}catch(e){t=!1}return t?{c_type:"DATE",eng:n,dateArray:a}:{c_type:"FILTER"===e.type?"FILTER":"TEXT",eng:n}}(e)];var u=[];return s.forEach((function(e,t){var n,o=[];"null"===e.trim()||e.includes(" null ")?o=function(e){var t,n=[],o=e.split("null");return o[0]&&n.push({c_type:"VL_PREFIX",eng:o[0],for:"null"}),n.push({c_type:"VALUE_LABEL",eng:"null",for:"null",operator:null!==(t=o[0].trim())&&void 0!==t?t:void 0}),o[1]&&n.push({c_type:"VL_PREFIX",eng:o[1],for:"null"}),n}(e):o=null!==(n=function(e,t){if(!e)return[];if(null==t||!t.length)return[{type:"TEXT",eng:e}];var n=0,o=[];return t.forEach((function(a,r){var i,l=a[0].length+a.index,s=e.substring(a.index,l),c=(i=s).substring(1,i.length-1).replace("''","'");if(a.index>n){var u=e.substring(n,a.index);u&&o.push({c_type:"VL_PREFIX",eng:u,for:c})}if(o.push({c_type:"VALUE_LABEL",eng:c,for:c}),r===t.length-1&&l<e.length){var d=e.substring(l,e.length);d&&o.push({c_type:"VL_PREFIX",eng:d,for:c})}n=l})),o}(e,function(e,t){if(!e)return[];for(var n,o=[];null!==(n=t.exec(e));)n&&o.push(n);return o}(e,i)))&&void 0!==n?n:[];u=[].concat(Tn(u),Tn(o));var a,r,l=c[t];l&&u.push({c_type:"VL_SUFFIX",eng:null===(a=l[0])||void 0===a?void 0:a.trim(),for:null===(r=o.find((function(e){return"VALUE_LABEL"===e.c_type})))||void 0===r?void 0:r.for})})),u}catch(t){return console.error(t),[{c_type:"TEXT",eng:e.eng}]}},Kr=function(e){try{if(!e)return;var t=[];return null!=e&&e.length&&e.forEach((function(e){"FILTER"===e.c_type||"SEED"===e.c_type?Yr(e).forEach((function(e){t.push(e)})):t.push(e)})),t}catch(e){return void console.error(e)}},jr=function(e){if(null!=e&&e.length){if(1===e.length)return"DAY";if(2===e.length){var t=o(e[1]).diff(o(e[0]),"day");if(t<=1)return"DAY";if(t<=7)return"WEEK";if(t<=31)return"MONTH"}return"MONTH"}},Wr=function(e){var t=function(e){try{var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.parsed_interpretation;if(!n)return;var o=Kr(n).findLast((function(e){return"DATE"===e.c_type}));return null==o?void 0:o.dateArray}catch(e){return void console.error(e)}}(e);return jr(t)},Gr=function(e){var t=null==e?void 0:e.dateArray,n=jr(t);if(n&&t&&t.length){var a=n.toLowerCase(),r=o.utc(t[0]).utc().startOf(a),i=o.utc(t[1]).utc().endOf(a),l=o.utc(t[0]).utc().add(1,a),s=o.utc(t[1]).utc().add(1,a),c=o().utc(),u=c.isBetween(r,i),d=c.isBetween(l,s),p="between ".concat(r.format("ll")," and ").concat(i.format("ll"));if(u)switch(n){case"DAY":return"today";case"MONTH":return"this month";case"WEEK":return"this week";case"YEAR":return"this year";default:return p}else if(d)switch(n){case"DAY":return"yesterday";case"MONTH":return"last month";case"WEEK":return"last week";case"YEAR":return"last year";default:return p}var m=r.toISOString(),f=aa({element:m,column:{type:"DATE",precision:n}});switch(n){case"DAY":return"on ".concat(f);case"MONTH":return"in ".concat(f);case"WEEK":return"on week ".concat(f);case"YEAR":return"in ".concat(f);default:return p}}},Xr=function(e){gn(o,f.Component);var n=Sn(o);function o(e){var a,r;un(this,o),mn(Cn(r=n.call(this,e)),"componentDidMount",(function(){var e;r._isMounted=!0,r.props.onValueLabelClick&&null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length&&r.validateAndUpdateValueLabels()})),mn(Cn(r),"shouldComponentUpdate",(function(e){return!e.isResizing||!r.props.isResizing})),mn(Cn(r),"componentDidUpdate",(function(e,t){var n,o,a;Ma(null===(n=e.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.parsed_interpretation,null===(o=r.props.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.parsed_interpretation)||r.setState({reverseTranslationArray:Kr(null===(a=r.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.parsed_interpretation)},(function(){r.validateAndUpdateValueLabels()}))})),mn(Cn(r),"componentWillUnmount",(function(){r._isMounted=!1})),mn(Cn(r),"validateAndUpdateValueLabels",(function(){var e,n,o,a,i,l=null!==(e=null===(n=r.props.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.persistent_filter_locks)&&void 0!==e?e:[],s=null!==(o=null===(a=r.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.fe_req)||void 0===a?void 0:a.session_filter_locks)&&void 0!==o?o:[],c=null!==(i=[].concat(Tn(s),Tn(l)))&&void 0!==i?i:[];if(r.state.reverseTranslationArray.length){var u=[],d=t(r.state.reverseTranslationArray);r.state.reverseTranslationArray.forEach((function(e,t){"VALUE_LABEL"===e.c_type&&u.push(Ye(an({suggestion:e.eng},_o(r.props.authentication))).then((function(e){var n;null!=e&&null!==(n=e.data)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.matches)&&void 0!==n&&n.length&&(d[t].c_type="VALIDATED_VALUE_LABEL",!!c.find((function(e){var n;return(null==e||null===(n=e.value)||void 0===n||null===(n=n.toLowerCase())||void 0===n?void 0:n.trim())===d[t].eng.toLowerCase().trim()}))&&(d[t].isLocked=!0))})).catch((function(e){return console.error(e)})))})),Promise.all(u).finally((function(){r._isMounted&&r.setState({reverseTranslationArray:d})}))}})),mn(Cn(r),"renderValueLabelLink",(function(e){return f.createElement("a",{id:"react-autoql-interpreted-value-label",className:"react-autoql-condition-link-filtered","data-test":"react-autoql-condition-link",onClick:function(t){t.stopPropagation(),r.props.onValueLabelClick(e.eng)}}," ",e.isLocked&&f.createElement(Wn,{type:"lock"})," ",f.createElement("span",null,e.eng))})),mn(Cn(r),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return r.props.onValueLabelClick&&!r.props.textOnly?r.renderValueLabelLink(e):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),mn(Cn(r),"getText",(function(){var e="";return r.state.reverseTranslationArray.map((function(t,n){e="".concat(e).concat(r.renderInterpretationChunk(t))})),e.trim()})),mn(Cn(r),"render",(function(){var e,t;return null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length?f.createElement(Rn,null,r.props.textOnly?f.createElement("span",null,r.getText()):f.createElement(f.Fragment,null,f.createElement("div",{id:r.COMPONENT_KEY,className:"react-autoql-reverse-translation-container","data-test":"react-autoql-reverse-translation-container"},f.createElement("div",{className:"react-autoql-reverse-translation"},f.createElement(Wn,{type:"info","data-tip":"This statement reflects how your query was interpreted in order to return this data response.","data-for":null!==(t=r.props.tooltipID)&&void 0!==t?t:"react-autoql-reverse-translation-tooltip-".concat(r.COMPONENT_KEY)}),f.createElement("strong",null," Interpreted as: "),r.state.reverseTranslationArray.map((function(e,t){return f.createElement("span",{key:"rt-item-".concat(r.COMPONENT_KEY,"-").concat(t)},r.renderInterpretationChunk(e))})))),!r.props.tooltipID&&f.createElement(So,{className:"react-autoql-reverse-translation-tooltip",id:"react-autoql-reverse-translation-tooltip-".concat(r.COMPONENT_KEY),effect:"solid",place:"right",html:!0}))):null})),r.COMPONENT_KEY=C();var i=Kr(null===(a=e.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.parsed_interpretation);return r.state={reverseTranslationArray:i},r}return pn(o)}();mn(Xr,"propTypes",{authentication:nr,onValueLabelClick:b.func,queryResponse:b.shape({}),tooltipID:b.string,textOnly:b.bool}),mn(Xr,"defaultProps",{authentication:Mo,onValueLabelClick:void 0,queryResponse:void 0,tooltipID:void 0,textOnly:!1});var Jr=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"close",(function(){o.setState({isOpen:!1})})),mn(Cn(o),"onConfirmClick",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.setState({loading:!0}),e.prev=1,e.next=4,o.props.onConfirm();case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0);case 9:o.setState({isOpen:!1,loading:!1});case 10:case"end":return e.stop()}}),e,null,[[1,6]])})))),mn(Cn(o),"renderContent",(function(){return f.createElement("div",{className:"react-autoql-confirm-popover-content"},f.createElement("div",{className:"react-autoql-confirm-popover-title"},o.props.icon?f.createElement(Wn,{type:o.props.icon}):null,o.props.title),f.createElement("div",{className:"react-autoql-confirm-popover-text"},o.props.text),f.createElement("div",{className:"react-autoql-confirm-popover-button-container"},f.createElement(wo,{type:"default",size:"medium",onClick:o.close,tooltipID:o.props.tooltipID},o.props.backText),f.createElement(wo,{type:o.props.danger?"danger":"primary",onClick:o.onConfirmClick,loading:o.props.confirmLoading,tooltipID:o.props.tooltipID,size:"medium",filled:!0},o.props.confirmText)))})),mn(Cn(o),"render",(function(){var e;return f.createElement(Rn,null,f.createElement(Xn,{isOpen:o.state.isOpen,content:o.renderContent,className:"react-autoql-confirm-popover",parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,padding:o.props.padding,align:o.props.align,onClickOutside:o.close},f.createElement("div",{className:"react-autoql-confirm-popover-click-wrapper ".concat(null!==(e=o.props.className)&&void 0!==e?e:""),onClick:function(){return o.setState({isOpen:!o.state.isOpen})}},o.props.children)))})),o.state={isOpen:!1},o}return pn(n)}();mn(Jr,"propTypes",{title:b.string,text:b.string,backText:b.string,confirmText:b.string,danger:b.bool,padding:b.number,positions:b.arrayOf(b.string),align:b.string,icon:b.string,onClose:b.func,onConfirm:b.func}),mn(Jr,"defaultProps",{title:"Are you sure you want to proceed?",text:"",backText:"Go back",confirmText:"Continue",danger:!1,padding:void 0,positions:void 0,align:void 0,icon:void 0,onClose:function(){},onConfirm:function(){}});var Zr=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"COMPONENT_KEY","react-autoql-chip-".concat(C())),mn(Cn(e),"state",{isConfirmPopoverVisible:!1}),mn(Cn(e),"onCloseClick",(function(){Eo(),e.setState({isConfirmPopoverVisible:!0})})),mn(Cn(e),"renderDeleteButton",(function(){return e.props.confirmDelete?f.createElement(Jr,{className:"react-autoql-chip-delete-confirm-popover",popoverParentElement:e.props.popoverParentElement,title:e.props.confirmText,onConfirm:function(){e.setState({isConfirmPopoverVisible:!1},e.props.onDelete)},confirmText:"Remove",backText:"Cancel",positions:["top","bottom","right","left"],padding:e.props.popoverPadding,align:"end"},f.createElement(Wn,{className:"react-autoql-chip-delete-btn",type:"close",onClick:e.onCloseClick,"data-tip":e.props.deleteTooltip,"data-for":e.props.tooltipID})):f.createElement(Wn,{className:"react-autoql-chip-delete-btn",type:"close",onClick:e.props.onDelete})})),mn(Cn(e),"render",(function(){var t=e.props.loading||e.props.disabled;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-chip\n ".concat(e.props.className||"","\n ").concat(t?" disabled":"","\n ").concat(e.props.selected?" selected":""),"data-test":"react-autoql-chip","data-multiline":e.props.multiline,style:an({},e.props.style),onClick:e.props.onClick,"data-for":e.props.tooltipID,"data-tip":e.props.tooltip},f.createElement("div",{className:"react-autoql-chip-background"}),f.createElement("div",{className:"react-autoql-chip-content"},f.createElement("div",null,e.props.children),e.renderDeleteButton())))})),e}return pn(n)}();mn(Zr,"propTypes",{onClick:b.func,onDelete:b.func,disabled:b.bool,multiline:b.bool,selected:b.bool,confirmDelete:b.bool,confirmText:b.string,deleteTooltip:b.string,tooltip:b.string}),mn(Zr,"defaultProps",{onClick:function(){},onDelete:function(){},disabled:!1,multiline:!1,selected:!1,confirmDelete:!1,confirmText:"Are you sure?",deleteTooltip:void 0,tooltip:void 0});var $r=function(e){gn(a,f.Component);var t=Sn(a);function a(e){var r,i,l,s,c,u;un(this,a),mn(Cn(u=t.call(this,e)),"autoCompleteTimer",void 0),mn(Cn(u),"componentDidMount",(function(){var e;u._isMounted=!0,u.props.onUpdate(u.props.ruleId,u.isComplete(),u.isValid()),null===(e=u.secondInput)||void 0===e||e.focus()})),mn(Cn(u),"componentDidUpdate",(function(e,t){var o;n(u.state,t)||u.props.onUpdate(u.props.ruleId,u.isComplete(),u.isValid()),"QUERY"===u.state.secondTermType&&u.state.secondInputValue!==t.secondInputValue&&null!==(o=u.state.secondInputValue)&&void 0!==o&&o.length&&u.validateSecondQuery()})),mn(Cn(u),"componentWillUnmount",(function(){u._isMounted=!1,u.autoCompleteTimer&&clearTimeout(u.autoCompleteTimer)})),mn(Cn(u),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=e.useRT,o=e.sentenceCase,a=void 0!==o&&o,r=e.withFilters,i=void 0!==r&&r,l=u.getFormattedQueryText({sentenceCase:a,withFilters:i});n&&(l=f.createElement(Xr,{queryResponse:u.props.queryResponse,textOnly:!0}));var s=Vr[u.state.selectedOperator],c="past"===t?null==s?void 0:s.conditionTextPast:null==s?void 0:s.conditionText,d=u.state.secondInputValue;return"QUERY"===u.state.secondTermType&&(d='"'.concat(d,'"')),l&&c&&void 0!==d?f.createElement("span",{className:"data-alert-condition-statement"},f.createElement("span",{className:"data-alert-condition-statement-query1"},'"',l,'"')," ",f.createElement("span",{className:"data-alert-condition-statement-operator"},c)," ",f.createElement("span",{className:"data-alert-condition-statement-query2"},d)):l?f.createElement("span",{className:"data-alert-condition-statement"},f.createElement("span",{className:"data-alert-condition-statement-operator"},a?"N":"n","ew data ","past"===t?"was":"is"," detected for the query")," ",f.createElement("span",{className:"data-alert-condition-statement-query1"},'"',l,'"')):void 0})),mn(Cn(u),"getJSON",(function(){var e,t,n,o,a,r=u.state.secondInputValue,i=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.fe_req)||void 0===e?void 0:e.disambiguation,l=null===(t=u.state.queryFilters)||void 0===t?void 0:t.filter((function(e){return"table"===e.type})),s=null===(n=u.state.queryFilters)||void 0===n?void 0:n.filter((function(e){return"locked"===e.type})),c=[{id:u.TERM_ID_1,term_type:"QUERY",condition:u.state.selectedOperator,term_value:u.state.inputValue,user_selection:null!==(o=null===(a=u.props.initialData)||void 0===a||null===(a=a[0])||void 0===a?void 0:a.user_selection)&&void 0!==o?o:i,filters:l,session_filter_locks:s}];if(u.allowOperators()){var d,p,m={id:u.TERM_ID_2,term_type:u.state.secondTermType,condition:"TERMINATOR",term_value:r};if("QUERY"===u.state.secondTermType)m.session_filter_locks=s,m.user_selection=null!==(d=null===(p=u.props.initialData)||void 0===p||null===(p=p[1])||void 0===p?void 0:p.user_selection)&&void 0!==d?d:i;c.push(m)}return c})),mn(Cn(u),"isNumerical",(function(e){try{if("CONSTANT"===ln(e))return!0;if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=Bt(e);return!isNaN(Number(n))}catch(e){return!1}})),mn(Cn(u),"isComplete",(function(){var e,t;return!(null===(e=u.state.inputValue)||void 0===e||!e.length)&&(!u.allowOperators()||!("QUERY"===u.state.secondTermType&&(u.state.secondQueryInvalid||u.state.secondQueryValidating||!u.state.secondQueryValidated))&&!(!na(u.state.secondInputValue)&&(null===(t=u.state.secondInputValue)||void 0===t||!t.length)))})),mn(Cn(u),"isValid",(function(){return!0})),mn(Cn(u),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(u.userSelectedValue=e.name,u.userSelectedSuggestion=!0,u.setState({inputValue:e.name}))})),mn(Cn(u),"onSuggestionsFetchRequested",(function(e){var t=e.value;u.autoCompleteTimer&&clearTimeout(u.autoCompleteTimer),u.autoCompleteTimer=setTimeout((function(){Ke(an(an(an({},_o(u.props.authentication)),zo(u.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],o=[];t=e.data.matches;for(var a=0;a<t.length&&(n.push(t[a]),4!==a);a++);n.sort((function(e,t){return t.length-e.length}));for(var r=0;r<n.length;r++){var i={name:n[r]};o.push(i)}u.setState({suggestions:o})})).catch((function(e){console.error(e)}))}),500)})),mn(Cn(u),"onSuggestionsClearRequested",(function(){u.setState({suggestions:[]})})),mn(Cn(u),"onSecondTermTypeChange",(function(e){e!==u.state.secondTermType&&(u.cancelSecondValidation(),u.setState({secondTermType:e,secondInputValue:"",secondQueryValidating:!1,secondQueryValidated:!1,secondQueryInvalid:!1,secondQueryError:""}))})),mn(Cn(u),"renderValidationError",(function(){return u.state.secondQueryValidating?f.createElement("span",{className:"expression-term-validation expression-term-validation-loading"},"Validating..."):u.state.secondQueryInvalid?f.createElement("span",{className:"expression-term-validation expression-term-validation-error"},f.createElement(Wn,{type:"warning-triangle"})," ",u.state.secondQueryError?f.createElement("span",null,u.state.secondQueryError):f.createElement("span",null,"That query is invalid. Try entering a different query.")):u.state.secondQueryValidated?f.createElement("span",{className:"expression-term-validation expression-term-validation-valid"},f.createElement(Wn,{type:"check"})," ",f.createElement("span",null,"Valid")):null})),mn(Cn(u),"renderOperatorSelector",(function(){var e,t=null===(e=u.SUPPORTED_OPERATORS)||void 0===e?void 0:e.map((function(e){var t=Vr[e],n=t.symbol?"(".concat(t.symbol,")"):"";return{value:e,listLabel:f.createElement("span",null,t.displayName," ",n),label:t.displayName}}));return f.createElement(xo,{options:t,value:u.state.selectedOperator,className:"react-autoql-rule-condition-select",label:"Meets this condition",onChange:function(e){u.setState({selectedOperator:e})}})})),mn(Cn(u),"renderRTChunk",(function(e,t,n){return f.createElement("span",{key:"data-alert-chunked-rt-".concat(u.COMPONENT_KEY,"-").concat(n),className:"data-alert-chunked-rt ".concat(t)},e," ")})),mn(Cn(u),"onValidationResponse",(function(e){var t,n=!1;Ca(u.props.queryResponse)&&!Ca(e)&&(n=!0,t=f.createElement("span",null,"The result of this query must be a single value")),u.setState({secondQueryValidating:!1,secondQueryInvalid:n,secondQueryValidated:!0,secondQueryError:t})})),mn(Cn(u),"cancelSecondValidation",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(u),"runSecondValidation",(function(){var e;u.state.secondInputValue&&(u.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source(),je(an(an(an({query:u.state.secondInputValue},_o(u.props.authentication)),zo(u.props.autoQLConfig)),{},{source:"data_alert_validation",pageSize:2,cancelToken:u.axiosSource.token,allowSuggestions:!1})).then((function(e){u.onValidationResponse(e)})).catch((function(e){var t;(null==e||null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&u.setState({secondQueryValidating:!1,secondQueryInvalid:!0})})))})),mn(Cn(u),"validateSecondQuery",(function(){u.cancelSecondValidation(),u.state.secondQueryValidating||u.setState({secondQueryValidating:!0}),clearTimeout(u.secondValidationTimeout),u.secondValidationTimeout=setTimeout((function(){u.runSecondValidation()}),1e3)})),mn(Cn(u),"onSecondQueryChange",(function(e){var t=e.target.value,n={secondInputValue:t};null!=t&&t.length||(n.secondQueryValidating=!1),u.setState(n)})),mn(Cn(u),"getChunkedInterpretationText",(function(){var e,t,n,o=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation,a=Kr(o);if(null==o||!o.length)return null===(n=u.props.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.text;var r="",i=0;return a.forEach((function(e,t){var n,o=null===(n=e.eng)||void 0===n?void 0:n.trim(),a=e.c_type;if(o&&a&&"VL_SUFFIX"!==a&&"DELIM"!==a){var l="";if("VALUE_LABEL"===a&&(i||(l="for "),i+=1),"DATE"===a){var s=Gr(e);if(!s)return;o=s}r="".concat(r," ").concat(l).concat(o)}})),null===(t=r)||void 0===t?void 0:t.trim()})),mn(Cn(u),"renderChunkedInterpretation",(function(){var e,t,n=null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation,o=Kr(n);if(null==n||!n.length)return null===(t=u.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text;var a=0;return o.map((function(e,t){var n=e.eng,o=e.c_type;if(!n||!o)return null;if(0===t&&(n=n[0].toUpperCase()+n.substring(1)),"VL_SUFFIX"===o||"DELIM"===o)return null;if("DATE"===o){var r=Gr(e);if(!r)return null;n=r}var i="";return"VALUE_LABEL"===o&&(a||(i="for"),a+=1),f.createElement(f.Fragment,null,!!i&&u.renderRTChunk(i,"VL_PREFIX","".concat(t,"-").concat(t)),u.renderRTChunk(n,o,t))}))})),mn(Cn(u),"getQueryFiltersText",(function(){var e,t=Kr(null===(e=u.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation),n=u.state.queryFilters,o="",a=[];return n.forEach((function(e){var n,o=null===(n=e.value)||void 0===n?void 0:n.trim().toLowerCase(),r=t.filter((function(e){var t;return(null===(t=e.for)||void 0===t||null===(t=t.trim())||void 0===t?void 0:t.toLowerCase())===o})),i="";null!=r&&r.length&&r.forEach((function(e){i+=e.eng})),i&&a.push(i)})),a.length&&a.forEach((function(e,t){var n=t!==a.length-1?", ":"";o="".concat(o).concat(e).concat(n)})),o})),mn(Cn(u),"getFormattedDate",(function(e){var t,n=!1,a=[];try{var r=e.value.split(",").map((function(e){if(Cr(e)){var t=o(e).utc(),r=t.format("ll");if("Invalid Date"!==r)return n=!0,a.push(t),r}return e})),i=r[0],l=r[1];t="Between ".concat(i," and ").concat(l),i===l&&(t="".concat(i))}catch(e){console.error(e),n=!1}if(n)return t})),mn(Cn(u),"getFormattedQueryText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sentenceCase,n=void 0===t||t,o=e.withFilters;try{var a,r="",i=u.state.inputValue;if(u.props.queryResponse)i=null===(a=u.props.queryResponse)||void 0===a||null===(a=a.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.text,r=u.getQueryFiltersText();return i?(n&&(i=i[0].toUpperCase()+i.substring(1)),o&&(i="".concat(i," ").concat(r)),i):""}catch(e){return console.error(e),""}})),mn(Cn(u),"renderFormattedQuery",(function(){})),mn(Cn(u),"getFilters",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.props,n=[],o=[];if(t.queryResponse){var a,r,i,l,s,c,d=null!==(a=null===(r=t.queryResponse)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.fe_req)||void 0===r?void 0:r.persistent_filter_locks)&&void 0!==a?a:[],p=null!==(i=null===(l=t.queryResponse)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.fe_req)||void 0===l?void 0:l.session_filter_locks)&&void 0!==i?i:[];n=null!==(s=[].concat(Tn(d),Tn(p)))&&void 0!==s?s:[],o=null!==(c=t.filters)&&void 0!==c?c:[]}else{var m,f,g,v;n=null!==(m=null===(f=t.initialData[0])||void 0===f?void 0:f.session_filter_locks)&&void 0!==m?m:[],o=null!==(g=null===(v=t.initialData[0])||void 0===v?void 0:v.filters)&&void 0!==g?g:[]}var h=null!==(e=o.map((function(e){var t;return an(an({},e),{},{value:null!==(t=null==e?void 0:e.displayValue)&&void 0!==t?t:null==e?void 0:e.value,type:"table"})})))&&void 0!==e?e:[],b=n.map((function(e){return an(an({},e),{},{type:"locked"})})),y=[].concat(Tn(h),Tn(b));return y})),mn(Cn(u),"removeFilter",(function(e){var t,o=null===(t=u.state.queryFilters)||void 0===t?void 0:t.filter((function(t){return!n(t,e)}));u.setState({queryFilters:o})})),mn(Cn(u),"renderFilterChips",(function(){var e=u.state.queryFilters;return null!=e&&e.length?f.createElement("div",{className:"react-autoql-data-alert-filters-container"},e.map((function(e,t){if(e){var n=null;if("table"===e.type){var o,a,r=null!==(o=" "+e.operator)&&void 0!==o?o:"like";"between"!==e.operator||e.value.includes(" and ")||(r=":"),"AMOUNT"!==e.column_type&&(a=u.getFormattedDate(e));var i=e.value;"like"===e.operator&&(i='"'.concat(e.value,'"')),a&&(i=a),n=f.createElement("span",null,f.createElement("strong",null,f.createElement(Wn,{type:"table"})," ",e.columnName),r," ",f.createElement("em",null,i))}else if("locked"===e.type){var l,s;n=f.createElement("span",null,f.createElement("strong",null,f.createElement(Wn,{type:"lock"})," ",null!==(l=e.show_message)&&void 0!==l?l:"Value"),"exclude"===(null===(s=e.filter_type)||void 0===s?void 0:s.toLowerCase())?f.createElement("span",null," ",f.createElement("u",null,"not")," "):": ",e.value)}if(n)return f.createElement(Zr,{key:"filter-chip-".concat(t),onDelete:function(){return u.removeFilter(e)},confirmDelete:!0,confirmText:"Remove this filter?",tooltip:"This ".concat(e.type,' filter is currently applied to your query data. It will also be applied to your Data Alert unless you remove it by hitting "x".'),tooltipID:u.props.tooltipID,popoverPadding:10},n)}return null}))):null})),mn(Cn(u),"renderBaseQuery",(function(){return f.createElement("div",{className:"react-autoql-rule-input"},f.createElement("div",null,f.createElement("span",{className:"data-alert-rule-query-readonly-container","data-for":u.props.tooltipID,"data-tip":"Editing this query is not permitted. To use a different query, simply create a new Data Alert via Data Messenger or a Dashboard."},f.createElement(xr,{label:u.allowOperators()?"Trigger Alert when this query":"Trigger Alert when new data is detected for this query",value:u.getFormattedQueryText(),readOnly:!0,disabled:!0,fullWidth:!0})),u.renderFilterChips()))})),mn(Cn(u),"getSecondInputPlaceholder",(function(){var e=u.state.secondTermType,t=u.props.queryResponse;if("CONSTANT"===e){var n,o=null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.rows)||void 0===n||null===(n=n[0])||void 0===n?void 0:n[0];return na(o)?"".concat("Type a number",' (eg. "').concat(o,'")'):"Type a number"}if("QUERY"===e)return"Type a query"})),mn(Cn(u),"shouldRenderValidationSection",(function(){return u.allowOperators()&&"QUERY"===u.state.secondTermType})),mn(Cn(u),"renderTermValidationSection",(function(){return u.shouldRenderValidationSection()?f.createElement("div",{className:"rule-simple-validation-container"},u.renderValidationError()):null})),mn(Cn(u),"renderSecondTermInput",(function(){return f.createElement(xr,{ref:function(e){return u.secondInput=e},spellCheck:!1,placeholder:u.getSecondInputPlaceholder(),value:u.state.secondInputValue,type:"CONSTANT"===u.state.secondTermType?"number":void 0,onKeyDown:function(e){"Enter"===e.key&&u.props.onLastInputEnterPress()},selectOptions:[{value:"CONSTANT",label:f.createElement("span",null,"this ",f.createElement("strong",null,"number:"))},{value:"QUERY",label:f.createElement("span",null,"the result of this ",f.createElement("strong",null,"query:"))}],onSelectChange:u.onSecondTermTypeChange,selectValue:u.state.secondTermType,onChange:u.onSecondQueryChange})})),mn(Cn(u),"allowOperators",(function(){return u.SUPPORTED_CONDITION_TYPES.includes(Lr)})),mn(Cn(u),"render",(function(){return u.props.conditionStatementOnly?null:f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-rule-simple\n ".concat(u.shouldRenderValidationSection()?"with-query-validation":""),style:u.props.style},f.createElement("div",{className:"react-autoql-rule-simple-first-query","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-first-input-container"},u.renderBaseQuery())),f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},u.allowOperators()&&f.createElement(f.Fragment,null,f.createElement("div",{className:"react-autoql-rule-condition-select-input-container"},u.renderOperatorSelector()),f.createElement("div",{className:"react-autoql-rule-second-input-container"},f.createElement("div",{className:"react-autoql-rule-input"},u.renderSecondTermInput()),u.renderTermValidationSection())))))}));var d=e.initialData,p=e.queryResponse;u.SUPPORTED_CONDITION_TYPES=Ar(d,p),u.SUPPORTED_OPERATORS=[],(u.SUPPORTED_CONDITION_TYPES.includes(Lr)||Object.keys(Vr).includes(null==d||null===(r=d[0])||void 0===r?void 0:r.condition))&&(u.SUPPORTED_OPERATORS=Object.keys(Vr)),u.TERM_ID_1=C(),u.TERM_ID_2=C();var m,g,v,h,b,y,S=u.SUPPORTED_CONDITION_TYPES.includes(Lr)?u.SUPPORTED_OPERATORS[0]:Mr,T={selectedOperator:null!==(i=null==d||null===(l=d[0])||void 0===l?void 0:l.condition)&&void 0!==i?i:S,inputValue:null!==(s=null==p||null===(c=p.data)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.text)&&void 0!==s?s:"",secondInputValue:"",secondTermType:"CONSTANT",secondQueryValidating:!1,secondQueryValidated:!1,secondQueryInvalid:!1,secondQueryError:"",isEditingQuery:!1,queryFilters:u.getFilters(e)};null!=d&&d.length&&(u.TERM_ID_1=d[0].id,u.TERM_ID_2=d.length>1?d[1].id:C(),T.selectedOperator=null!==(m=d[0].condition)&&void 0!==m?m:u.SUPPORTED_OPERATORS[0],T.inputValue=null!==(g=d[0].term_value)&&void 0!==g?g:"",T.secondInputValue=null!==(v=null===(h=d[1])||void 0===h?void 0:h.term_value)&&void 0!==v?v:"",T.secondTermType=null!==(b=null===(y=d[1])||void 0===y||null===(y=y.term_type)||void 0===y?void 0:y.toUpperCase())&&void 0!==b?b:"CONSTANT",T.secondQueryValidated=!0);return u.state=T,u}return pn(a)}();mn($r,"propTypes",{authentication:nr,ruleId:b.string,onUpdate:b.func,initialData:b.arrayOf(b.shape({})),queryResponse:b.shape({}),onLastInputEnterPress:b.func}),mn($r,"defaultProps",{authentication:Mo,ruleId:void 0,onUpdate:function(){},initialData:void 0,queryResponse:void 0,onLastInputEnterPress:function(){}});var ei=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"componentDidUpdate",(function(e,t){n(t,a.state)||a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1})),mn(Cn(a),"getInitialState",(function(e){var t,n,o,r=(null!=e?e:a.props).expression,i=void 0,l=!1;if(Array.isArray(r)&&"QUERY"===(null==r||null===(t=r[0])||void 0===t?void 0:t.term_type))i=r;else if("QUERY"===(null==r||null===(n=r.term_value)||void 0===n||null===(n=n[0])||void 0===n?void 0:n.term_type))i=r.term_value;else if("GROUP"===(null==r||null===(o=r[0])||void 0===o?void 0:o.term_type)){var s,c;(null==r?void 0:r.length)>1||(null==r||null===(s=r[0])||void 0===s||null===(s=s.term_value)||void 0===s?void 0:s.length)>1?l=!0:"QUERY"===(null==r||null===(c=r[0])||void 0===c||null===(c=c.term_value)||void 0===c||null===(c=c[0])||void 0===c||null===(c=c.term_value)||void 0===c||null===(c=c[0])||void 0===c?void 0:c.term_type)?i=S(r[0].term_value[0].term_value):l=!0}return{expression:i,expressionError:l}})),mn(Cn(a),"isComplete",(function(){return!!a.state.expressionError||(a.ruleRef?a.ruleRef.isComplete():void 0)})),mn(Cn(a),"isValid",(function(){return!a.state.expressionError&&(a.ruleRef?a.ruleRef.isValid():void 0)})),mn(Cn(a),"getJSON",(function(){var e;return a.ruleRef&&(e=a.ruleRef.getJSON()),e})),mn(Cn(a),"resetConditions",(function(){a.setState({expression:void 0,expressionError:!1},(function(){a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())}))})),mn(Cn(a),"onRuleUpdate",(function(e,t,n){a.props.onChange(a.isComplete(),a.isValid(),a.getJSON())})),mn(Cn(a),"getFormattedQueryText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.sentenceCase,n=e.withFilters;return a.ruleRef?a.ruleRef.getFormattedQueryText({sentenceCase:t,withFilters:n}):null})),mn(Cn(a),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=void 0===t?a.props.conditionTense:t,o=e.useRT,r=void 0===o?a.props.useRT:o,i=e.sentenceCase,l=void 0===i?a.props.sentenceCase:i,s=e.withFilters,c=void 0===s?a.props.withFilters:s;return a.ruleRef?a.ruleRef.getConditionStatement({tense:n,useRT:r,sentenceCase:l,withFilters:c}):null})),mn(Cn(a),"getFirstQuery",(function(e){var t,n;if(e?t=e:a.ruleRef&&(t=a.ruleRef.getJSON()),t)return Array.isArray(t)&&(t=t[0]),"GROUP"===t.term_type?a.getFirstQuery(null===(n=t)||void 0===n||null===(n=n.term_value)||void 0===n?void 0:n[0]):"QUERY"===t.term_type?t.term_value:void 0})),mn(Cn(a),"renderExpressionErrorMessage",(function(){return f.createElement("div",{className:"expression-error-message"},f.createElement(Wn,{type:"warning",warning:!0})," Unable to display conditions. This Data Alert may be part of an older system that is no longer supported. ",f.createElement("a",{onClick:a.resetConditions},"Reset Conditions"))})),mn(Cn(a),"render",(function(){var e,t,n={};return a.props.conditionStatementOnly&&(n.visibility="hidden",n.position="absolute",n.height="0",n.width="0",n.opacity="0"),f.createElement(Rn,null,f.createElement("div",{className:"data-alerts-container"},f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},a.state.expressionError?a.renderExpressionErrorMessage():f.createElement(f.Fragment,null,f.createElement($r,{style:n,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,ref:function(e){return a.ruleRef=e},ruleId:null!==(e=null===(t=a.props.expression)||void 0===t?void 0:t.id)&&void 0!==e?e:C(),onUpdate:a.onRuleUpdate,initialData:a.props.expression,tooltipID:a.props.tooltipID,queryResponse:a.props.queryResponse,onLastInputEnterPress:a.props.onLastInputEnterPress,filters:a.props.filters}),a.props.conditionStatementOnly&&f.createElement("span",{className:"condition-builder-statement"},a.getConditionStatement(a.props.conditionTense,a.props.useRT,a.props.sentenceCase))))))})),a.ruleRef=void 0,a.state=a.getInitialState(e),a}return pn(o)}();mn(ei,"propTypes",{authentication:nr,expression:b.oneOfType([b.shape({}),b.array]),conditionStatementOnly:b.bool,onChange:b.func,onLastInputEnterPress:b.func}),mn(ei,"defaultProps",{authentication:Mo,expression:void 0,conditionStatementOnly:!1,conditionTense:"present",useRT:!1,sentenceCase:!0,withFilters:!1,onChange:function(){},onLastInputEnterPress:function(){}});var ti=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o._isMounted=!0,o.instantiateTabulator();case 2:case"end":return e.stop()}}),e)})))),mn(Cn(o),"shouldComponentUpdate",(function(){return!1})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,o.isInitialized=!1,setTimeout((function(){o.tabulator.destroy()}),1e3)})),mn(Cn(o),"instantiateTabulator",(function(){var e;o.tabulator=new bt(o.tableRef,an(an({columns:o.props.columns,data:null!==(e=o.props.options)&&void 0!==e&&e.ajaxRequestFunc?[]:o.props.data},o.defaultOptions),o.props.options)),o.tabulator.on("renderComplete",(function(){setTimeout((function(){o.blockRedraw()}),1e3)})),o.tabulator.on("dataLoadError",o.props.onDataLoadError),o.tabulator.on("cellClick",o.props.onCellClick),o.tabulator.on("dataSorting",o.props.onDataSorting),o.tabulator.on("dataSorted",o.props.onDataSorted),o.tabulator.on("dataFiltering",o.props.onDataFiltering),o.tabulator.on("dataFiltered",o.props.onDataFiltered),o.tabulator.on("tableBuilt",cn(rn().mark((function e(){var t;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.isInitialized=!0,null===(t=o.props.options)||void 0===t||!t.ajaxRequestFunc){e.next=4;break}return e.next=4,o.tabulator.setData();case 4:o.props.onTableBuilt();case 5:case"end":return e.stop()}}),e)}))))})),mn(Cn(o),"blockRedraw",(function(e){var t;o.isInitialized&&(o.redrawRestored=!1,null===(t=o.tabulator)||void 0===t||t.blockRedraw())})),mn(Cn(o),"restoreRedraw",(function(e){o.tabulator&&o.isInitialized&&!o.redrawRestored&&o._isMounted&&(o.redrawRestored=!0,o.tabulator.restoreRedraw())})),mn(Cn(o),"updateData",(function(e){var t;o.props.hidden?setTimeout((function(){var t;o.restoreRedraw(),null===(t=o.tabulator)||void 0===t||t.setData(e)}),0):(o.restoreRedraw(),null===(t=o.tabulator)||void 0===t||t.setData(e))})),mn(Cn(o),"render",(function(){return f.createElement("div",{ref:function(e){return o.tableRef=e},className:"table-condensed ".concat(o.props.className),id:"react-tabulator-id-".concat(o.COMPONENT_KEY),key:o.COMPONENT_KEY})})),o.COMPONENT_KEY=C(),o.tableRef=f.createRef(),o.tabulator=null,o.redrawRestored=!0,o.defaultOptions={height:o.props.height||"100%",headerFilterLiveFilterDelay:300,minHeight:100,reactiveData:!1,autoResize:!1,rowHeight:25,layout:"fitDataFill",clipboard:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1}},o}return pn(n)}();mn(ti,"propTypes",{tableKey:b.string,options:b.shape({}),onDataLoadError:b.func,onTableBuilt:b.func,onCellClick:b.func,onDataSorting:b.func,onDataSorted:b.func,onDataFiltering:b.func,onDataFiltered:b.func}),mn(ti,"defaultProps",{tableKey:void 0,options:{},onDataLoadError:function(){},onTableBuilt:function(){},onCellClick:function(){},onDataSorting:function(){},onDataSorted:function(){},onDataFiltering:function(){},onDataFiltered:function(){}});var ni=function(e,t){return{sorters:oi(e,t),filters:ai(e,t),page:null==e?void 0:e.page}},oi=function(e,t){var n,o=[];return(null==e||null===(n=e.sort)||void 0===n?void 0:n.length)>0&&e.sort.forEach((function(e){try{var n=null==t?void 0:t[Number(e.field)];if(n){var a=n.name,r=e.dir.toUpperCase();a&&r&&o.push({name:a,sort:r})}}catch(e){console.error(e)}})),o},ai=function(e,t){var n,a=[];return(null==e||null===(n=e.filter)||void 0===n?void 0:n.length)>0&&e.filter.forEach((function(e){try{var n=null==t?void 0:t[Number(e.field)];if(n){var r={name:n.name,columnName:n.title,value:e.value,operator:"like"};if(Ho(n)){var i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.trim().replace(/[^0-9.]/g,""),n=Number(t);if(!t||isNaN(n))throw new Error("Unable to convert string to number");var o="=",a=e.trim();return a.length>=2&&(["<=",">=","!="].includes(a.substring(0,2))?o=a.substring(0,2):["=","<",">"].includes(a.substring(0,1))&&(o=a.substring(0,1))),{value:t,operator:o}}(e.value);r.operator=i.operator,r.value=i.value}else if("DATE"===n.type){var l,s=e.value.split(" to "),c=Sr(n.precision),u=o.utc(s[0]).startOf(c).toISOString(),d=o.utc(null!==(l=s[1])&&void 0!==l?l:s[0]).endOf(c).toISOString();r.value="".concat(u,",").concat(d),r.operator="between",r.column_type="TIME",r.displayValue=e.value.replaceAll(" to "," and ")}a.push(r)}}catch(e){console.warn(e)}})),a},ri=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;un(this,n),mn(Cn(a=t.call(this,e)),"selectedRangeIncludesMonth",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"month")})),mn(Cn(a),"handleMonthHover",(function(e){var t=a.state.selectedStart,n=e.startOf("month"),o=e.endOf("month");t&&"end"===a.state.focusedDateDisplay&&(o.isBefore(t)?o=t.endOf("month"):t.isBefore(n)&&(n=t.startOf("month"))),a.setState({previewStart:n,previewEnd:o})})),mn(Cn(a),"handleMonthClick",(function(e){"start"===a.state.focusedDateDisplay?a.onMonthStartSelection(e):a.onMonthEndSelection(e)})),mn(Cn(a),"incrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)+1)})})),mn(Cn(a),"decrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)-1)})})),mn(Cn(a),"onMonthStartSelection",(function(e){a.setState({selectedStart:e.startOf("month"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("month"),e],n=t[0].startOf("month"),o=t[1].endOf("month");a.props.onRangeSelection({startDate:n.toDate(),endDate:o.toDate()})})),mn(Cn(a),"onMonthEndSelection",(function(e){try{var t=a.state.selectedStart;t||a.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var o=n[0].startOf("month"),r=n[1].endOf("month");a.setState({selectedStart:o,selectedEnd:r}),a.props.onRangeSelection({startDate:o.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),mn(Cn(a),"renderDateDisplay",(function(){var e,t,n,o,r,i=null!==(e=null===(t=a.state.selectedStart)||void 0===t?void 0:t.startOf("month").format("MMM YYYY"))&&void 0!==e?e:"",l=null!==(n=null!==(o=null===(r=a.state.selectedEnd)||void 0===r?void 0:r.startOf("month").format("MMM YYYY"))&&void 0!==o?o:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem\n ".concat("start"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return a.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),mn(Cn(a),"renderYearPicker",(function(){var e=a.props.minDate?o(a.props.minDate).year():o(new Date).add(-100,"year").year(),t=a.props.maxDate?o(a.props.maxDate).year():o(new Date).add(20,"year").year();return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:a.decrementYear,disabled:a.state.visibleYear===e},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:a.state.visibleYear,onChange:function(e){return a.setState({visibleYear:Number(e.target.value)})}},new Array(t-e+1).fill(t).map((function(e,t){var n=e-t;return f.createElement("option",{key:n,value:n},n)}))),f.createElement("button",{className:"rdrNextPrevButton rdrNextButton",onClick:a.incrementYear,disabled:a.state.visibleYear===t},f.createElement("i",null)))})),mn(Cn(a),"isSelected",(function(e){var t=a.state,n=t.selectedStart,o=t.selectedEnd,r=e.startOf("month").isSame(null==n?void 0:n.startOf("month")),i=r&&!o||e.endOf("month").isSame(null==o?void 0:o.endOf("month"));return{isSelected:r||i||a.selectedRangeIncludesMonth(e),isSelectedStart:r,isSelectedEnd:i}})),mn(Cn(a),"isPreview",(function(e){var t=a.state,n=t.previewStart,o=t.previewEnd,r=e.startOf("month").isSame(n),i=e.endOf("month").isSame(o);return{isPreview:r||i||e.isBetween(n,o,"month"),isPreviewStart:r,isPreviewEnd:i}})),mn(Cn(a),"isDisabled",(function(e){var t=a.props.minDate&&e.isBefore(o(a.props.minDate).startOf("month")),n=a.props.maxDate&&e.isAfter(o(a.props.maxDate).endOf("month"));return t||n})),mn(Cn(a),"renderMonthGrid",(function(){return f.createElement("div",{className:"react-autoql-month-picker-month-picker"},[[0,1,2],[3,4,5],[6,7,8],[9,10,11]].map((function(e,t){return f.createElement("div",{className:"month-picker-row",key:"month-row-".concat(t)},e.map((function(e){var t=o("".concat(a.state.visibleYear,"-").concat(e+1,"-15")),n=o("2021-".concat(e+1,"-15")).format("MMM"),r=a.isSelected(t),i=r.isSelected,l=r.isSelectedStart,s=r.isSelectedEnd,c=a.isPreview(t),u=c.isPreview,d=c.isPreviewStart,p=c.isPreviewEnd,m=a.isDisabled(t),g=e===o().month()&&a.state.visibleYear==o().year();return f.createElement("div",{key:e,className:"month-picker-month\n ".concat(g?" current-month":"","\n ").concat(l?" selection-start":"","\n ").concat(s?" selection-end":"","\n ").concat(i?" active":"","\n ").concat(d?" preview-start":"","\n ").concat(p?" preview-end":"","\n ").concat(u?" preview":"","\n ").concat(m?" rdrDayDisabled":""),onClick:function(){return a.handleMonthClick(t)},onMouseEnter:function(){return!m&&a.handleMonthHover(t)},onMouseLeave:function(){return!m&&a.setState({previewStart:void 0,previewEnd:void 0})}},f.createElement("div",{className:"month-picker-month-text-wrapper"},f.createElement("div",{className:"month-picker-month-text"},f.createElement("span",null,n))))})))})))})),mn(Cn(a),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},a.renderDateDisplay(),a.renderYearPicker(),a.renderMonthGrid())})),a.COMPONENT_KEY=C();var r=o(),i=r.year(),l=r.startOf("month"),s=r.endOf("month");return e.initialRange?(l=o(a.props.initialRange.startDate).startOf("month"),i=(s=o(a.props.initialRange.endDate).endOf("month")).year()):e.minDate&&e.maxDate&&(r.isBefore(o(e.minDate))||r.isAfter(o(e.maxDate)))&&(l=o(e.minDate).startOf("month"),s=o(e.maxDate).endOf("month")),a.state={selectedRange:a.props.initialRange,visibleYear:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},a}return pn(n)}();mn(ri,"propTypes",{minDate:b.instanceOf(Date),maxDate:b.instanceOf(Date),initialRange:b.shape({startDate:b.instanceOf(Date),endDate:b.instanceOf(Date)}),onRangeSelection:b.func}),mn(ri,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var ii=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;un(this,n),mn(Cn(a=t.call(this,e)),"getDecade",(function(e){var t=e-e%10;return[t,t+9]})),mn(Cn(a),"isInDecade",(function(e,t){return e>=t[0]&&e<=t[1]})),mn(Cn(a),"selectedRangeIncludesYear",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"year")})),mn(Cn(a),"handleYearHover",(function(e){var t=a.state.selectedStart,n=e.startOf("year"),o=e.endOf("year");t&&"end"===a.state.focusedDateDisplay&&(o.isBefore(t)?o=t.endOf("year"):t.isBefore(n)&&(n=t.startOf("year"))),a.setState({previewStart:n,previewEnd:o})})),mn(Cn(a),"handleYearClick",(function(e){"start"===a.state.focusedDateDisplay?a.onYearStartSelection(e):a.onYearEndSelection(e)})),mn(Cn(a),"incrementDecade",(function(){var e=a.state.visibleDecade[1];a.setState({visibleDecade:[e+1,e+10]})})),mn(Cn(a),"decrementDecade",(function(){var e=a.state.visibleDecade[0];a.setState({visibleDecade:[e-10,e-1]})})),mn(Cn(a),"onYearStartSelection",(function(e){a.setState({selectedStart:e.startOf("year"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("year"),e],n=t[0].startOf("year"),o=t[1].endOf("year");a.props.onRangeSelection({startDate:n.toDate(),endDate:o.toDate()})})),mn(Cn(a),"onYearEndSelection",(function(e){try{var t=a.state.selectedStart;t||a.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var o=n[0].startOf("year"),r=n[1].endOf("year");a.setState({selectedStart:o,selectedEnd:r}),a.props.onRangeSelection({startDate:o.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),mn(Cn(a),"renderDateDisplay",(function(){var e,t,n,o,r,i=null!==(e=null===(t=a.state.selectedStart)||void 0===t?void 0:t.year())&&void 0!==e?e:"",l=null!==(n=null!==(o=null===(r=a.state.selectedEnd)||void 0===r?void 0:r.year())&&void 0!==o?o:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem\n ".concat("start"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return a.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDatePickerInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),mn(Cn(a),"renderDecadePicker",(function(){var e=a.props.minDate?a.getDecade(o(a.props.minDate).year()):a.getDecade(o(new Date).add(-100,"year").year()),t=a.props.maxDate?a.getDecade(o(a.props.maxDate).year()):a.getDecade(o(new Date).add(20,"year").year()),n=(t[0]-e[0])/10||1;return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:a.decrementDecade,disabled:a.state.visibleDecade[0]===e[0]},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:"".concat(a.state.visibleDecade[0]," - ").concat(a.state.visibleDecade[1]),onChange:function(e){var t=e.target.value.split(" - ").map((function(e){return Number(e)}));a.setState({visibleDecade:t})}},new Array(n).fill(e).map((function(e,t){var n="".concat(e[0]+10*t," - ").concat(e[1]+10*t);return f.createElement("option",{key:t,value:n},n)}))),f.createElement("button",{className:"rdrNextPrevButton rdrNextButton",onClick:a.incrementDecade,disabled:a.state.visibleDecade[0]===t[0]},f.createElement("i",null)))})),mn(Cn(a),"isSelected",(function(e){var t=a.state,n=t.selectedStart,o=t.selectedEnd,r=e.startOf("year").isSame(null==n?void 0:n.startOf("year")),i=r&&!o||e.endOf("year").isSame(null==o?void 0:o.endOf("year"));return{isSelected:r||i||a.selectedRangeIncludesYear(e),isSelectedStart:r,isSelectedEnd:i}})),mn(Cn(a),"isPreview",(function(e){var t=a.state,n=t.previewStart,o=t.previewEnd,r=e.startOf("year").isSame(n),i=e.endOf("year").isSame(o);return{isPreview:r||i||e.isBetween(n,o,"year"),isPreviewStart:r,isPreviewEnd:i}})),mn(Cn(a),"isDisabled",(function(e){var t=a.props.minDate&&e.isBefore(o(a.props.minDate).startOf("year")),n=a.props.maxDate&&e.isAfter(o(a.props.maxDate).endOf("year"));return t||n})),mn(Cn(a),"renderYearGrid",(function(){var e=a.state.visibleDecade,t=new Array(10).fill(e[0]).map((function(e,t){return e+t})),n=[Tn(t.slice(0,3)),Tn(t.slice(3,6)),Tn(t.slice(6,9)),[t[9]]];return f.createElement("div",{className:"react-autoql-month-picker-month-picker"},n.map((function(e,t){return f.createElement("div",{className:"month-picker-row",key:"month-row-".concat(t)},e.map((function(e){var t=o("".concat(e,"-01-15")),n=a.isSelected(t),r=n.isSelected,i=n.isSelectedStart,l=n.isSelectedEnd,s=a.isPreview(t),c=s.isPreview,u=s.isPreviewStart,d=s.isPreviewEnd,p=a.isDisabled(t),m=e===o().year();return f.createElement("div",{key:e,className:"month-picker-month\n ".concat(m?" current-month":"","\n ").concat(i?" selection-start":"","\n ").concat(l?" selection-end":"","\n ").concat(r?" active":"","\n ").concat(u?" preview-start":"","\n ").concat(d?" preview-end":"","\n ").concat(c?" preview":"","\n ").concat(p?" rdrDayDisabled":""),onClick:function(){return a.handleYearClick(t)},onMouseEnter:function(){return!p&&a.handleYearHover(t)},onMouseLeave:function(){return!p&&a.setState({previewStart:void 0,previewEnd:void 0})}},f.createElement("div",{className:"month-picker-month-text-wrapper"},f.createElement("div",{className:"month-picker-month-text"},f.createElement("span",null,e))))})))})))})),mn(Cn(a),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},a.renderDateDisplay(),a.renderDecadePicker(),a.renderYearGrid())})),a.COMPONENT_KEY=C();var r=o(),i=a.getDecade(r.year()),l=r.startOf("year"),s=r.endOf("year");return e.initialRange?(l=o(a.props.initialRange.startDate).startOf("year"),s=o(a.props.initialRange.endDate).endOf("year"),i=a.getDecade(s.year())):e.minDate&&e.maxDate&&(r.isBefore(o(e.minDate))||r.isAfter(o(e.maxDate)))&&(l=o(e.minDate).startOf("year"),s=o(e.maxDate).endOf("year")),a.state={selectedRange:a.props.initialRange,visibleDecade:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},a}return pn(n)}();mn(ii,"propTypes",{minDate:b.instanceOf(Date),maxDate:b.instanceOf(Date),initialRange:b.shape({startDate:b.instanceOf(Date),endDate:b.instanceOf(Date)}),onRangeSelection:b.func}),mn(ii,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var li=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r,i,l,s,c,u,d;return un(this,n),mn(Cn(d=t.call(this,e)),"handleSelect",(function(e){d.setState({selectedRange:e.selection},(function(){d.props.onSelection(e.selection)}))})),mn(Cn(d),"renderDateRangePicker",(function(){switch(d.props.type){case co:var e,t;return f.createElement(ri,{onRangeSelection:function(e){return d.props.onSelection(e)},minDate:null===(e=d.props.validRange)||void 0===e?void 0:e.startDate,maxDate:null===(t=d.props.validRange)||void 0===t?void 0:t.endDate,initialRange:d.state.selectedRange});case uo:var n,o;return f.createElement(ii,{onRangeSelection:function(e){return d.props.onSelection(e)},minDate:null===(n=d.props.validRange)||void 0===n?void 0:n.startDate,maxDate:null===(o=d.props.validRange)||void 0===o?void 0:o.endDate,initialRange:d.state.selectedRange});default:var a,r;return f.createElement(yt,{ref:function(e){return d.datePicker=e},ranges:[d.state.selectedRange],onChange:d.handleSelect,minDate:null===(a=d.props.validRange)||void 0===a?void 0:a.startDate,maxDate:null===(r=d.props.validRange)||void 0===r?void 0:r.endDate,dragSelectionEnabled:!1,rangeColors:[d.accentColor],showMonthAndYearPickers:!0})}})),mn(Cn(d),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker"},d.renderDateRangePicker())})),d.accentColor=Ua("accent-color"),d.state={selectedRange:{startDate:null!==(o=null!==(a=null===(r=e.initialRange)||void 0===r?void 0:r.startDate)&&void 0!==a?a:null===(i=e.validRange)||void 0===i?void 0:i.startDate)&&void 0!==o?o:new Date,endDate:null!==(l=null!==(s=null===(c=e.initialRange)||void 0===c?void 0:c.endDate)&&void 0!==s?s:null===(u=e.validRange)||void 0===u?void 0:u.endDate)&&void 0!==l?l:new Date,key:"selection"}},d}return pn(n)}();mn(li,"propTypes",{initialRange:b.shape({}),validRange:b.shape({}),type:b.string}),mn(li,"defaultProps",{initialRange:void 0,validRange:void 0,type:so});var si=["title","field","visible","hozAlign","vertAlign","headerHozAlign","width","minWidth","maxWidth","maxInitialWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","htmlOutput","print","clipboard","sorter","sorterParams","formatter","formatterParams","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","variableHeight","editable","editor","editorParams","validator","contextMenu","clickMenu","dblClickMenu","contextPopup","clickPopup","dblClickPopup","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","mutateLink","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","download","titleDownload","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellMouseDown","cellMouseUp","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerMouseEnter","headerMouseLeave","headerMouseOver","headerMouseOut","headerMouseMove","headerMouseDown","headerMouseUp","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerWordWrap","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","headerMenu","headerClickMenu","headerDblClickMenu","headerContextMenu","headerPopup","headerClickPopup","headerContextPopup"],ci=function(t){gn(r,f.Component);var a=Sn(r);function r(t){var i,l,s,c,u;return un(this,r),mn(Cn(u=a.call(this,t)),"componentDidMount",(function(){var e;(u._isMounted=!0,u.props.autoHeight)||(u.initialTableHeight=null===(e=u.tabulatorContainer)||void 0===e?void 0:e.clientHeight,u.lockedTableHeight=u.initialTableHeight);u.setState({firstRender:!1})})),mn(Cn(u),"shouldComponentUpdate",(function(e,t){return!(u.state.tabulatorMounted||!t.tabulatorMounted)||(u.props.rowChangeCount!==e.rowChangeCount||(!(!u.props.isAnimating||e.isAnimating)||(!(!u.state.datePickerColumn||t.datePickerColumn)||(u.props.hidden!==e.hidden||!u.props.hidden&&!Ma(u.props.columns,e.columns)||!(u.props.hidden&&e.hidden||u.state.scrollLoading&&t.scrollLoading||u.state.pageLoading&&t.pageLoading||u.props.isResizing&&e.isResizing||u.props.isAnimating&&e.isAnimating)&&(!Ma(u.props,e)||!Ma(u.state,t))))))})),mn(Cn(u),"getSnapshotBeforeUpdate",(function(e,t){var n,o;return(!u.props.isResizing&&e.isResizing||!u.props.isAnimating&&e.isAnimating||!u.state.firstRender&&t.firstRender||!u.props.hidden&&e.hidden&&!u.hasSetTableHeight)&&(o=!0),u.props.isResizing&&!e.isResizing&&(o=!0,n="100%"),{shouldSetTableHeight:o,newTableHeight:n}})),mn(Cn(u),"componentDidUpdate",(function(e,t,n){var o,a,r=n.shouldSetTableHeight,i=n.newTableHeight;(u.props.rowChangeCount!==e.rowChangeCount&&u.props.hidden&&u.setState({subscribedData:u.props.data}),r&&u.setTableHeight(i),!u.props.hidden&&e.hidden)&&(u.state.subscribedData?(u.updateData(u.state.subscribedData),u.setState({subscribedData:void 0})):null===(o=u.ref)||void 0===o||o.restoreRedraw());u.props.columns&&!Ma(u.props.columns,e.columns)&&(null===(a=u.ref)||void 0===a||null===(a=a.tabulator)||void 0===a||a.setColumns(u.getFilteredTabulatorColumnDefinitions()),u.setHeaderInputEventListeners(),u.setFilters());u.state.tabulatorMounted&&!t.tabulatorMounted&&(u.setHeaderInputEventListeners(),u.props.hidden||u.setTableHeight(),u.hasSetInitialParams=!0)})),mn(Cn(u),"componentWillUnmount",(function(){try{u._isMounted=!1,clearTimeout(u.clickListenerTimeout),clearTimeout(u.setDimensionsTimeout),clearTimeout(u.setStateTimeout),u.cancelCurrentRequest(),u.existingFilterTag=void 0,u.filterTagElements=void 0}catch(e){console.error(e)}})),mn(Cn(u),"setInfiniteScroll",(function(e){var t;null!==(t=u.ref)&&void 0!==t&&null!==(t=t.tabulator)&&void 0!==t&&t.options&&(e?(u.ref.tabulator.options.sortMode="remote",u.ref.tabulator.options.filterMode="remote",u.ref.tabulator.options.paginationMode="remote"):(u.ref.tabulator.options.sortMode="local",u.ref.tabulator.options.filterMode="local",u.ref.tabulator.options.paginationMode="local"))})),mn(Cn(u),"updateData",(function(e,t){var n;(null==e?void 0:e.length)===u.props.totalRows?u.setInfiniteScroll(!1):t&&u.setInfiniteScroll(!0),null===(n=u.ref)||void 0===n||n.updateData(e)})),mn(Cn(u),"onDataSorting",(function(e){if(u._isMounted){var t,o,a=e.map((function(e){return{dir:e.dir,field:e.field}}));null!==(t=u.tableParams)&&void 0!==t&&t.sort&&!n(a,null===(o=u.tableParams)||void 0===o?void 0:o.sort)&&(u.isSorting=!0,u.setLoading(!0))}})),mn(Cn(u),"onDataSorted",(function(e,t){u.isSorting&&(u.isSorting=!1,!u.useInfiniteScroll&&u.ref&&u.props.onSorterCallback(e),u.setLoading(!1))})),mn(Cn(u),"onDataFiltering",(function(){if(u._isMounted&&u.state.tabulatorMounted){var e,t,o=null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getHeaderFilters();o&&!n(o,null===(t=u.tableParams)||void 0===t?void 0:t.filter)&&(u.isFiltering=!0,u.setLoading(!0))}})),mn(Cn(u),"onDataFiltered",(function(e,t){if(u.isFiltering&&u.state.tabulatorMounted){var n;u.isFiltering=!1;var o=null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n?void 0:n.getHeaderFilters();u.useInfiniteScroll||(u.tableParams.filter=S(o),u.props.onFilterCallback(o,t)),setTimeout((function(){u._isMounted&&u.setState({loading:!1})}),0)}u.setFilterBadgeClasses()})),mn(Cn(u),"setLoading",(function(e){e!==u.state.loading&&u._isMounted&&u.setState({loading:e})})),mn(Cn(u),"isLoading",(function(){return u.state.loading||u.state.firstRender||u.state.pageLoading||u.state.scrollLoading||u.isFiltering||u.isSorting||!u.hasSetInitialParams})),mn(Cn(u),"onTableBuilt",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u._isMounted&&u.setState({tabulatorMounted:!0,pageLoading:!1});case 1:case"end":return e.stop()}}),e)})))),mn(Cn(u),"setTableHeight",(function(e){if(u.state.tabulatorMounted&&u.tabulatorContainer&&!u.props.isAnimating&&!u.props.isResizing&&!u.props.hidden){var t,n=null!=e?e:u.tabulatorContainer.clientHeight;if(n&&n!==u.lockedTableHeight)null===(t=u.ref)||void 0===t||null===(t=t.tabulator)||void 0===t||t.setHeight(n),u.lockedTableHeight=n,"100%"!==e&&(u.hasSetTableHeight=!0)}})),mn(Cn(u),"cancelCurrentRequest",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(u),"ajaxRequesting",(function(e,t){})),mn(Cn(u),"ajaxRequestFunc",function(){var t=cn(rn().mark((function t(o,a){var r,i,l,s,c,d,p,m,f,g,v,h,b,y;return rn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l=null!==(r=null===(i=u.props.response)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.data)&&void 0!==r?r:{},s=an(an({},l),{},{page:1,isPreviousData:!0}),t.prev=2,!u.props.hidden){t.next=5;break}return t.abrupt("return",s);case 5:if(d=(null==a?void 0:a.page)>1&&u.state.pageLoading,u.hasSetInitialData){t.next=9;break}return u.hasSetInitialData=!0,t.abrupt("return",s);case 9:if(!d){t.next=11;break}return t.abrupt("return",s);case 11:if(p=ni(u.tableParams,o.columns),m=ni(a,o.columns),!n(p,m)){t.next=15;break}return t.abrupt("return",s);case 15:if(u.tableParams=a,o.queryRequestData){t.next=19;break}return console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),t.abrupt("return",s);case 19:if(u.cancelCurrentRequest(),u.axiosSource=null===(c=E.CancelToken)||void 0===c?void 0:c.source(),!((null==a?void 0:a.page)>1)){t.next=29;break}return u._isMounted&&u.setState({scrollLoading:!0}),t.next=25,u.getNewPage(o,m);case 25:f=t.sent,u.props.onNewPage(null===(g=f)||void 0===g?void 0:g.rows),t.next=40;break;case 29:return u._isMounted&&u.setState({pageLoading:!0}),t.next=32,o.queryFn({tableFilters:null==m?void 0:m.filters,orders:null==m?void 0:m.sorters,cancelToken:u.axiosSource.token});case 32:return b=t.sent,u.queryID=null==b||null===(v=b.data)||void 0===v||null===(v=v.data)||void 0===v?void 0:v.query_id,f=an(an({},e(b,"data.data",{})),{},{page:1}),u.scrollLeft=null===(h=u.ref)||void 0===h||null===(h=h.tabulator)||void 0===h||null===(h=h.rowManager)||void 0===h||null===(h=h.element)||void 0===h?void 0:h.scrollLeft,t.next=38,Oa();case 38:u.props.onTableParamsChange(a,m),u.props.onNewData(b);case 40:return u.clearLoadingIndicators(),t.abrupt("return",f);case 44:if(t.prev=44,t.t0=t.catch(2),(null===t.t0||void 0===t.t0||null===(y=t.t0.data)||void 0===y?void 0:y.message)!==lr.CANCELLED){t.next=48;break}return t.abrupt("return",s);case 48:return console.error(t.t0),u.clearLoadingIndicators(),t.abrupt("return",s);case 51:case"end":return t.stop()}}),t,null,[[2,44]])})));return function(e,n){return t.apply(this,arguments)}}()),mn(Cn(u),"clearLoadingIndicators",cn(rn().mark((function e(){return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Oa();case 2:void 0!==u.scrollLeft&&(u.scrollLeft=void 0,u.ref.tabulator.rowManager.element.scrollLeft=u.scrollLeft),u._isMounted&&u.setState({loading:!1,scrollLoading:!1,pageLoading:!1});case 4:case"end":return e.stop()}}),e)})))),mn(Cn(u),"clearHeaderFilters",(function(){var e;null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e||e.clearHeaderFilter()})),mn(Cn(u),"getNewPage",(function(e,t){return We(an(an(an({},_o(e.authentication)),t),{},{queryId:u.queryID,cancelToken:u.axiosSource.token}))})),mn(Cn(u),"ajaxResponseFunc",(function(t,n){if(n){var o;if(!n.isPreviousData)null===(o=u.ref)||void 0===o||o.restoreRedraw();u.currentPage=n.page;var a=e(n,"rows.length",0)<t.pageSize;u.lastPage=a?u.currentPage:u.currentPage+1,u._isMounted&&(a&&!u.state.isLastPage?u.setState({isLastPage:!0}):!a&&u.state.isLastPage&&u.setState({isLastPage:!1}));var r={};return r.data=n.rows,r.last_page=u.lastPage,r}return{data:[],last_page:u.lastPage}})),mn(Cn(u),"cellClick",(function(e,t){u.props.onCellClick(t)})),mn(Cn(u),"copyToClipboard",(function(){var e;u._isMounted&&null!==(e=u.ref)&&void 0!==e&&e.tabulator&&u.ref.tabulator.copyToClipboard("active",!0)})),mn(Cn(u),"saveAsCSV",(function(e){try{var t;if(u._isMounted&&null!==(t=u.ref)&&void 0!==t&&t.tabulator){var n=S(u.ref.tabulator);return new Promise((function(t,o){setTimeout((function(){n.download("csv","export.csv",{delimiter:","}),n=void 0,t()}),e)}))}}catch(e){console.error(e)}return Promise.reject()})),mn(Cn(u),"debounceSetState",(function(e){u.stateToSet=an(an({},u.stateToSet),e),clearTimeout(u.setStateTimeout),u.setStateTimeout=setTimeout((function(){u._isMounted&&(u.setState(u.stateToSet),u.stateToSet={})}),50)})),mn(Cn(u),"inputKeydownListener",(function(){var e;u.useInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),mn(Cn(u),"inputSearchListener",(function(){var e;u.useInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),mn(Cn(u),"inputDateSearchListener",(function(){u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0})})),mn(Cn(u),"inputDateClickListener",(function(e,t){var n=e.target.getBoundingClientRect(),o=u.tableContainer.getBoundingClientRect();null!=n&&n.top&&null!=n&&n.left&&u.debounceSetState({datePickerLocation:{top:n.top-o.top+n.height+5,left:n.left-o.left},datePickerColumn:t})})),mn(Cn(u),"inputDateKeypressListener",(function(e){e.stopPropagation(),e.preventDefault()})),mn(Cn(u),"renderHeaderInputClearBtn",(function(e,t){var n=document.createElement("span");n.innerHTML="&#x00d7;";var o=document.createElement("div");o.className="react-autoql-input-clear-btn",o.id="react-autoql-clear-btn-".concat(u.TABLE_ID,"-").concat(t.field),o.setAttribute("data-for",u.props.tooltipID),o.setAttribute("data-tip","Clear filter"),o.appendChild(n),o.addEventListener("click",(function(n){n.stopPropagation(),u.setHeaderInputValue(e,""),"DATE"!==t.type||t.pivot||(u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0}))})),e.parentNode.appendChild(o)})),mn(Cn(u),"setHeaderInputEventListeners",(function(){var e=u.props.columns;e&&e.forEach((function(e){var t=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-content input'));if(t&&(t.removeEventListener("keydown",u.inputKeydownListener),t.addEventListener("keydown",u.inputKeydownListener),document.querySelector("#react-autoql-clear-btn-".concat(u.TABLE_ID,"-").concat(e.field))||u.renderHeaderInputClearBtn(t,e),"DATE"===e.type&&!e.pivot)){t.removeEventListener("click",(function(t){return u.inputDateClickListener(t,e)})),t.addEventListener("click",(function(t){return u.inputDateClickListener(t,e)}));["keypress","keydown","keyup"].forEach((function(e){t.removeEventListener(e,u.inputDateKeypressListener),t.addEventListener(e,u.inputDateKeypressListener)}))}}))})),mn(Cn(u),"setFilterBadgeClasses",(function(){var e;u._isMounted&&u.state.tabulatorMounted&&(null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e||null===(e=e.getColumns())||void 0===e||e.forEach((function(e){var t,n=!(null===(t=u.tableParams)||void 0===t||null===(t=t.filter)||void 0===t||!t.find((function(t){return t.field===e.getField()}))),o=null==e?void 0:e.getElement();n?null==o||o.classList.add("is-filtered"):null==o||o.classList.remove("is-filtered")})))})),mn(Cn(u),"setFilters",(function(){var e,t=null===(e=u.tableParams)||void 0===e?void 0:e.filter;u.settingFilterInputs=!0,t&&t.forEach((function(e,t){try{var n,o;if(null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n||n.setHeaderFilterValue(e.field,e.value),!u.useInfiniteScroll)null===(o=u.ref)||void 0===o||null===(o=o.tabulator)||void 0===o||o.setFilter(e.field,e.type,e.value)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingFilterInputs=!1})),mn(Cn(u),"onDateRangeSelectionApplied",(function(){u.setState({datePickerColumn:void 0});var e=u.state.datePickerColumn;if(u.state.dateRangeSelection){var t=u.state.dateRangeSelection,n=t.startDate,a=t.endDate;if(e){var r=n,i=a;n&&!a?i=r:!n&&a&&(r=i);var l=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-content input'));if(l){var s=Er(e),c=bo[s],d=o(r).format(c),p=o.utc(d).toISOString(),m=o(p).utc().format(c),f=o(i).format(c),g=o.utc(f).toISOString(),v=o(g).utc().format(c),h="".concat(m," to ").concat(v);m===v&&(h=m),u.setHeaderInputValue(l,h),u.currentDateRangeSelections=mn({},e.field,u.state.dateRangeSelection)}}}})),mn(Cn(u),"onDateRangeSelection",(function(e){u.setState({dateRangeSelection:e})})),mn(Cn(u),"setSorters",(function(){var e,t=null===(e=u.tableParams)||void 0===e?void 0:e.sort;u.settingSorters=!0,t&&t.forEach((function(e,t){try{var n;null===(n=u.ref)||void 0===n||null===(n=n.tabulator)||void 0===n||n.setSort(e.field,e.dir)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingSorters=!1})),mn(Cn(u),"toggleIsFiltering",(function(e,t){var n,o;t&&null!==(n=u.tableParams)&&void 0!==n&&null!==(n=n.filter)&&void 0!==n&&n.length&&(null===(o=u.ref)||void 0===o||null===(o=o.tabulator)||void 0===o||null===(o=o.getColumns())||void 0===o?void 0:o.find((function(e){var t;return e.getField()===(null===(t=u.tableParams.filter[0])||void 0===t?void 0:t.field)}))).scrollTo("middle");var a=!u.state.isFiltering;return"boolean"==typeof e&&(a=e),u._isMounted&&u.setState({isFiltering:a}),a})),mn(Cn(u),"setHeaderInputValue",(function(e,t){var n;e&&(e.focus(),null===(n=u.ref)||void 0===n||n.restoreRedraw(),e.value=t,e.title=t,e.blur())})),mn(Cn(u),"renderEmptyPlaceholderText",(function(){return f.createElement("div",{className:"table-loader table-page-loader table-placeholder"},f.createElement("div",null,"No data matching your query"))})),mn(Cn(u),"renderPageLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(Ro,null)))})),mn(Cn(u),"renderScrollLoader",(function(){return f.createElement("div",{className:"table-loader table-scroll-loader"},f.createElement(Ro,null))})),mn(Cn(u),"renderDateRangePickerPopover",(function(){var e,t,n;return u.state.datePickerColumn?f.createElement(Xn,{isOpen:!!u.state.datePickerColumn,align:"start",positions:["bottom","right","left","top"],onClickOutside:function(e){e.stopPropagation(),u._isMounted&&u.setState({datePickerColumn:void 0})},content:f.createElement("div",{className:"react-autoql-popover-date-picker"},f.createElement("h3",null,u.state.datePickerColumn.display_name),f.createElement(li,{initialRange:null===(e=u.currentDateRangeSelections)||void 0===e?void 0:e[u.state.datePickerColumn.field],onSelection:u.onDateRangeSelection,validRange:u.state.datePickerColumn.dateRange,type:u.state.datePickerColumn.precision}),f.createElement(wo,{type:"primary",onClick:u.onDateRangeSelectionApplied},"Apply"))},f.createElement("div",{style:{position:"absolute",top:null===(t=u.state.datePickerLocation)||void 0===t?void 0:t.top,left:null===(n=u.state.datePickerLocation)||void 0===n?void 0:n.left}})):null})),mn(Cn(u),"getFilteredTabulatorColumnDefinitions",(function(){try{var e;if(null!==(e=u.props.columns)&&void 0!==e&&e.length)return u.props.columns.map((function(e){var t={};return Object.keys(e).forEach((function(n){si.includes(n)&&(t[n]=e[n])})),t}))}catch(e){console.error(e)}return[]})),mn(Cn(u),"renderTableRowCount",(function(){var e,t=null===(e=u.props.data)||void 0===e?void 0:e.length,n=u.props.totalRows;if(!(u.props.enableAjaxTableData&&n&&t))return null;var o=u.getTabulatorRowCount();return u.useInfiniteScroll||void 0===o||(t=o,n=o),f.createElement("div",{className:"table-row-count"},f.createElement("span",null,"Scrolled ".concat(t," / ").concat(n," rows")))})),mn(Cn(u),"getTabulatorRowCount",(function(){var e;return null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getDataCount("active")})),mn(Cn(u),"getTabulatorHeaderFilters",(function(){var e;if(u._isMounted&&u.state.tabulatorMounted)return null===(e=u.ref)||void 0===e||null===(e=e.tabulator)||void 0===e?void 0:e.getHeaderFilters()})),mn(Cn(u),"isTableEmpty",(function(){var e;if(0===(null===(e=u.props.data)||void 0===e?void 0:e.length))return!0;var t=u.getTabulatorRowCount();return!!(u.props.rowChangeCount>0&&u.state.tabulatorMounted&&0===t)})),mn(Cn(u),"render",(function(){var e=u.isTableEmpty();return f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-table-container-".concat(u.TABLE_ID),ref:function(e){return u.tableContainer=e},"data-test":"react-autoql-table",style:u.props.style,className:"react-autoql-table-container \n ".concat(u.state.pageLoading||!u.state.tabulatorMounted?"loading":"","\n ").concat(u.props.supportsDrilldowns?"supports-drilldown":"","\n ").concat(u.state.isFiltering?"filtering":"","\n ").concat(u.props.isResizing?"resizing":"","\n ").concat(u.props.isAnimating?"animating":"","\n ").concat(u.useInfiniteScroll?"infinite":"limited","\n ").concat(u.useInfiniteScroll&&u.state.isLastPage?"last-page":"","\n ").concat(u.props.pivot?"pivot":"","\n ").concat(u.props.hidden?"hidden":"","\n ").concat(e?"empty":"")},f.createElement("div",{ref:function(e){return u.tabulatorContainer=e},className:"react-autoql-tabulator-container"},!!u.props.data&&!!u.props.columns&&(u.props.autoHeight||!u.state.firstRender)&&f.createElement(f.Fragment,null,f.createElement(ti,{ref:function(e){return u.ref=e},height:u.initialTableHeight,tableKey:"react-autoql-table-".concat(u.TABLE_ID),id:"react-autoql-table-".concat(u.TABLE_ID),key:"react-autoql-table-wrapper-".concat(u.TABLE_ID),"data-test":"autoql-tabulator-table",columns:u.getFilteredTabulatorColumnDefinitions(),data:u.props.data,options:u.tableOptions,hidden:u.props.hidden,"data-custom-attr":"test-custom-attribute",className:"react-autoql-table",onTableBuilt:u.onTableBuilt,onCellClick:u.cellClick,onDataSorting:u.onDataSorting,onDataSorted:u.onDataSorted,onDataFiltering:u.onDataFiltering,onDataFiltered:u.onDataFiltered,pivot:u.props.pivot}),e&&u.renderEmptyPlaceholderText(),(u.state.pageLoading||!u.state.tabulatorMounted)&&u.renderPageLoader(),u.state.scrollLoading&&u.renderScrollLoader())),u.renderDateRangePickerPopover(),!e&&u.renderTableRowCount()))})),u.TABLE_ID=C(),u.hasSetInitialData=!1,u.hasSetInitialParams=!1,u.currentPage=1,u.lastPage=(null===(i=t.data)||void 0===i?void 0:i.length)<t.pageSize?1:2,u.filterTagElements=[],u.queryID=t.queryID,u.isFiltering=!1,u.isSorting=!1,u.tableParams=null!==(l=S(t.initialParams))&&void 0!==l?l:{filter:[],sort:[]},u.useInfiniteScroll=t.useInfiniteScroll,u.tableOptions={selectableCheck:function(){return!1},initialSort:u.useInfiniteScroll||null===(s=u.tableParams)||void 0===s?void 0:s.sort,initialFilter:u.useInfiniteScroll||null===(c=u.tableParams)||void 0===c?void 0:c.filter,progressiveLoadScrollMargin:100,downloadEncoder:function(e,t){return new Blob([e],{type:t})}},u.useInfiniteScroll&&(u.tableOptions.sortMode="remote",u.tableOptions.filterMode="remote",u.tableOptions.paginationMode="remote",u.tableOptions.progressiveLoad="scroll",u.tableOptions.ajaxURL="https://required-placeholder-url.com",u.tableOptions.paginationSize=t.pageSize,u.tableOptions.paginationInitialPage=1,u.tableOptions.ajaxRequesting=function(e,n){return u.ajaxRequesting(t,n)},u.tableOptions.ajaxRequestFunc=function(e,n,o){return u.ajaxRequestFunc(t,o)},u.tableOptions.ajaxResponse=function(e,n,o){return u.ajaxResponseFunc(t,o)}),u.state={isFiltering:!1,isSorting:!1,loading:!1,pageLoading:!1,scrollLoading:!1,isLastPage:1===u.lastPage,ref:null,subscribedData:void 0,firstRender:!0},u}return pn(r)}();mn(ci,"propTypes",{data:b.arrayOf(b.array),columns:b.arrayOf(b.shape({})),shouldRender:b.bool,onFilterCallback:b.func,onSorterCallback:b.func,onTableParamsChange:b.func,isResizing:b.bool,pageSize:b.number,useInfiniteScroll:b.bool,onSetTableHeight:b.func,onRenderComplete:b.func}),mn(ci,"defaultProps",{queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:void 0,useInfiniteScroll:!0,source:null,shouldRender:!0,autoHeight:!0,onFilterCallback:function(){},onSorterCallback:function(){},onTableParamsChange:function(){},onCellClick:function(){},onErrorCallback:function(){},onSetTableHeight:function(){},onRenderComplete:function(){}});var ui={dataFormatting:or,data:b.arrayOf(b.array).isRequired,columns:b.arrayOf(b.shape({})).isRequired,numberColumnIndices:b.arrayOf(b.number).isRequired,stringColumnIndices:b.arrayOf(b.number).isRequired,stringColumnIndex:b.number.isRequired,numberColumnIndex:b.number.isRequired,legendColumnIndex:b.number,enableDynamicCharting:b.bool,legendLocation:b.string,isResizing:b.bool,onLegendClick:b.func,onLabelChange:b.func,onXAxisClick:b.func,onYAxisClick:b.func},di={dataFormatting:qo,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},pi=an(an({},ui),{},{visibleSeriesIndices:b.arrayOf(b.number).isRequired,height:b.number.isRequired,width:b.number.isRequired,deltaX:b.number,deltaY:b.number}),mi=an(an({},di),{},{deltaX:0,deltaY:0}),fi=an(an({},pi),{},{xScale:b.func.isRequired,yScale:b.func.isRequired,innerHeight:b.number,innerWidth:b.number,onLabelRotation:b.func}),gi=an(an({},mi),{},{innerHeight:0,innerWidth:0,onLabelRotation:function(){}}),vi=an(an({},pi),{},{xScale:b.func.isRequired,yScale:b.func.isRequired}),hi={activeKey:void 0,onChartClick:function(){}},bi=function(e){var t=null==e?void 0:e.domain();if(!(null==t?void 0:t.length))return(null==e?void 0:e(0))||0;var n=t[0],o=t[(null==t?void 0:t.length)-1];return e(n>0&&o>0?n:n<0&&o<0?o:0)},yi=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return"".concat(e,"-").concat(t,"-").concat(n)},Ci=function(e){var t=e.row,n=e.columns,o=e.colIndex,a=e.colIndex2,r=e.legendColumn,i=e.dataFormatting,l=e.aggregated,s=void 0===l||l;try{var c,u,d="",p="",m="",f=n[o],g=n[a];if(r&&null!=f&&f.origColumn)d="<div><strong>".concat(null!==(c=r.tooltipTitle)&&void 0!==c?c:r.title,":</strong> ").concat(null!==(u=f.tooltipTitle)&&void 0!==u?u:f.title,"</div>");if(f){var v,h,b=f.origColumn?null!==(v=f.origColumn.tooltipTitle)&&void 0!==v?v:f.origColumn.title:null!==(h=f.tooltipTitle)&&void 0!==h?h:f.title;if(s){var y,C=null===(y=Ge[f.aggType])||void 0===y?void 0:y.displayName;C&&(b="".concat(b," (").concat(C,")"))}var E=aa({element:t[o]||0,column:n[o],config:i,isChart:!0});p="<div><strong>".concat(b,":</strong> ").concat(E,"</div>")}if(g){var S,T=null!==(S=g.tooltipTitle)&&void 0!==S?S:g.title,D=aa({element:t[a],column:g,config:i,isChart:!0});m="<div><strong>".concat(T,":</strong> ").concat(D,"</div>")}return"<div>\n ".concat(d,"\n ").concat(p,"\n ").concat(m,"\n </div>")}catch(e){return console.error(e),null}},Ei=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return console.error(e),0}},Si=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",o="bottom",a=Pe?o:n;if("column_line"===t)return o;var r=["pie","heatmap","bubble","scatterplot","histogram"];return(null==e?void 0:e.length)<2||r.includes(t)?void 0:"stacked_column"===t||"stacked_bar"===t||"stacked_line"===t||(null==e?void 0:e.length)>2||(null==e?void 0:e.length)>1?a:void 0},Ti=function(e){var t=e.filter((function(e){return!!e}));if(null!=t&&t.length)try{var n,o,a,r;return t.forEach((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.left,i=e.bottom,l=e.right,s=e.top;if(!(isNaN(t)||isNaN(i)||isNaN(l)||isNaN(s))){var c=l-t,u=i-s;c<=0&&u<=0||((void 0===n||t<n)&&(n=t),(void 0===o||i>o)&&(o=i),(void 0===a||l>a)&&(a=l),(void 0===r||s<r)&&(r=s))}})),{x:n,y:r,height:Math.abs(o-r),width:Math.abs(a-n)}}catch(e){return void console.error(e)}},Di=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.renderAllLegends()})),mn(Cn(o),"shouldComponentUpdate",(function(e){return!Ma(o.props.columns,e.columns)||(o.props.height!==e.height||o.props.outerHeight!==e.outerHeight)})),mn(Cn(o),"componentDidUpdate",(function(){o.renderAllLegends()})),mn(Cn(o),"componentWillUnmount",(function(){var e;null===(e=o.legendElements)||void 0===e||e.forEach((function(e){return Ia(e)}))})),mn(Cn(o),"getTotalLeftPadding",(function(){return o.props.paddingLeft+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalRightPadding",(function(){return o.props.paddingRight+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalHorizontalPadding",(function(){return o.getTotalLeftPadding()+o.getTotalRightPadding()})),mn(Cn(o),"getTotalBottomPadding",(function(){return o.props.paddingBottom+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalTopPadding",(function(){return o.props.paddingTop+o.BORDER_PADDING+o.BORDER_THICKNESS})),mn(Cn(o),"getTotalVerticalPadding",(function(){return o.getTotalBottomPadding()+o.getTotalTopPadding()})),mn(Cn(o),"getMaxLegendHeight",(function(){return"vertical"===o.props.orientation?o.props.height-o.getTotalVerticalPadding():Math.floor(.5*o.props.outerHeight)-Math.ceil(2*o.BORDER_PADDING)})),mn(Cn(o),"getMaxSectionWidth",(function(){var e=o.DEFAULT_MAX_WIDTH;if("horizontal"===o.props.orientation){var t=o.getTotalHorizontalPadding(),n=1*o.HORIZONTAL_LEGEND_SPACING,a=2*o.props.chartPadding,r=o.props.outerWidth-t-n-a,i=Math.floor(r/2);i<o.DEFAULT_MAX_WIDTH&&(e=i)}return e})),mn(Cn(o),"renderAllLegends",(function(){var e;o.legendLabels1=Xe(o.props.columns,o.props.colorScale,o.props.legendColumnIndices),o.legendLabels2=o.props.hasSecondAxis?o.legendLabels2=Xe(o.props.columns,o.props.colorScale2,o.props.numberColumnIndices2):[],o.legendLabelSections=o.getlegendLabelSections(o.legendLabels1,o.legendLabels2),null===(e=o.legendLabelSections)||void 0===e||e.forEach((function(e,t){o.renderLegend(e,t)})),o.justMounted&&(o.justMounted=!1,o.props.onRenderComplete())})),mn(Cn(o),"distributeListsEvenly",(function(e,t,n){var o,a,r=S(e),i=S(t),l=null!==(o=null==r?void 0:r.length)&&void 0!==o?o:0,s=null!==(a=null==i?void 0:i.length)&&void 0!==a?a:0,c=l+s,u=l/c,d=Math.round(u*n);s&&(d===n&&n>1&&(d=n-1),0===d&&n>1&&(d=1));for(var p=Tn(new Array(n)).map((function(){return[]})),m=function(e){p.forEach((function(t,n){var o=n>=d,a=o?i:r;if(a.length>0){var l=a.shift();l.legendNumber=o?2:1,l.legendSectionIndex=e,(0===n||n===d)&&(l.isFirst=!0),t.push(l)}}))},f=0;f<c;f++)m(f);return p})),mn(Cn(o),"getlegendLabelSections",(function(e,t){var n,a,r=o.totalPossibleSections,i=(null!==(n=null==e?void 0:e.length)&&void 0!==n?n:0)+(null!==(a=null==t?void 0:t.length)&&void 0!==a?a:0);return i<o.totalPossibleSections&&(r=i),o.distributeListsEvenly(e,t,r)})),mn(Cn(o),"removeHiddenLegendLabels",(function(e){var t,n,a,r=null===(t=o.legendBorder)||void 0===t?void 0:t.getBoundingClientRect(),i=(null!==(n=null==r?void 0:r.y)&&void 0!==n?n:0)+(null!==(a=null==r?void 0:r.height)&&void 0!==a?a:0)-o.BORDER_PADDING,l=!1,s=void 0,c=void 0;if(St(e).selectAll(".cell").each((function(){if(l)St(this).remove();else{var e,t,n=this.getBoundingClientRect();if((null!==(e=null==n?void 0:n.y)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.height)&&void 0!==t?t:0)>i){var o,a,r=this.getBBox();s=(null!==(o=null==r?void 0:r.y)&&void 0!==o?o:0)+(null!==(a=null==r?void 0:r.height)&&void 0!==a?a:0),c=St(this).attr("transform"),St(this).remove(),l=!0}}})),l&&c){var u=o.props.chartTooltipID;St(e).select(".legend-hidden-field-arrow").remove(),St(e).append("text").html("&#9660 ...").attr("class","legend-hidden-field-arrow").attr("y",s).attr("transform",c).attr("data-tip","Some legend fields are hidden. Please expand the chart size to view them.").attr("data-for",u).style("font-size","".concat(o.props.fontSize-3,"px")).style("color","red").style("font-weight","bold").style("cursor","default")}})),mn(Cn(o),"styleLegendTitleNoBorder",(function(e,t){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).style("transform","translateY(-5px)")})),mn(Cn(o),"styleLegendTitleWithBorder",(function(e){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").append("tspan").text(" ▼").style("font-size","8px").style("opacity",0).attr("class","react-autoql-axis-selector-arrow"),o.titleBBox={};try{o.titleBBox=St(e).select(".legendTitle").node().getBBox()}catch(e){console.error(e)}})),mn(Cn(o),"onClick",(function(e,t){var n=null==t?void 0:t.find((function(t){return t.label===e}));if(n){var a=!n.hidden,r=null==t?void 0:t.filter((function(e){return!e.hidden}));(!a||(null==r?void 0:r.length)>1)&&o.props.onLegendClick(n)}})),mn(Cn(o),"getLegendTitleCase",(function(e){return(null==e?void 0:e.length)<2?e:e[0].toUpperCase()+e.substring(1)})),mn(Cn(o),"getLegendTitleFromColumns",(function(e){var t,n;if(o.props.isAggregated)return null!==(t=null===(n=o.props.legendColumn)||void 0===n?void 0:n.display_name)&&void 0!==t?t:"Legend";var a="Fields",r=e.map((function(e){return o.props.columns[e]})),i=e.map((function(e){return o.props.columns[e].type})),l=!i.find((function(e){return e!==i[0]}));if(o.props.hasSecondAxis&&l){var s=ao[i[0]];s&&(a="".concat(s," ").concat(a))}var c=r.map((function(e){return e.aggType}));if(!c.find((function(e){return e!==c[0]}))){var u,d=null===(u=Ge[c[0]])||void 0===u?void 0:u.displayName;d&&(a="".concat(a," (").concat(d,")"))}return a})),mn(Cn(o),"renderLegend",(function(e,t){try{var n,a,r=Cn(o);if(null==e||!e.length)return;var i=null===(n=e[0])||void 0===n?void 0:n.legendNumber,l=2===i?o.props.numberColumnIndices2:o.props.legendColumnIndices,s=!(null===(a=e[0])||void 0===a||!a.isFirst),c=o.legendElements[t],u=2===i,d=2===i?o.legendLabels2:o.legendLabels1,p=o.getLegendTitleCase(o.getLegendTitleFromColumns(l)),m=o.getLegendScale(e),f=o.getMaxSectionWidth(),g=Je().orient("vertical").path(Lt().type(Mt).size(o.SHAPE_SIZE)()).shapePadding(8).labelWrap(f-20).labelOffset(10).scale(m).title(p).titleWidth(f).on("cellclick",(function(e){var t;r.onClick(null===(t=St(this))||void 0===t||null===(t=t.data())||void 0===t?void 0:t[0],d)}));if(u?g.shape("line"):o.props.shape&&g.shape(o.props.shape),St(c).call(g).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","".concat(o.props.fontSize,"px")),St(c).selectAll(".cell").style("font-size","".concat(o.props.fontSize-2,"px")),t>0){var v=Ti(o.legendElements.filter((function(e,n){return e&&n<t})).map((function(e){return e.getBoundingClientRect()})));if("vertical"===o.props.orientation){var h,b=(null!==(h=null==v?void 0:v.height)&&void 0!==h?h:0)+o.VERTICAL_LEGEND_SPACING;St(c).attr("transform","translate(0,".concat(b,")"))}else if("horizontal"===o.props.orientation){var y,C=(null!==(y=null==v?void 0:v.width)&&void 0!==y?y:0)+o.HORIZONTAL_LEGEND_SPACING;St(c).attr("transform","translate(".concat(C,",0)"))}}o.applyTitleStyles(p,s,c);var E=Ti(o.legendElements.map((function(e){return null==e?void 0:e.getBoundingClientRect()})));o.combinedLegendWidth=isNaN(null==E?void 0:E.width)?0:null==E?void 0:E.width,o.combinedLegendHeight=isNaN(null==E?void 0:E.height)?0:null==E?void 0:E.height;var S=o.getTotalHorizontalPadding(),T=o.getTotalVerticalPadding(),D=o.props.outerWidth-S,x=o.getMaxLegendHeight(),R=o.combinedLegendHeight<=x?o.combinedLegendHeight:x,I=o.combinedLegendWidth<=D?o.combinedLegendWidth:D;St(o.legendClippingContainer).attr("height",R+T).attr("width",I+S),St(o.legendBorder).attr("height",R+2*o.BORDER_PADDING).attr("width",I+2*o.BORDER_PADDING),o.removeHiddenLegendLabels(c),o.applyStylesForHiddenSeries(c,e)}catch(e){console.error(e)}})),mn(Cn(o),"applyTitleStyles",(function(e,t,n){e&&(o.props.onLegendTitleClick?o.styleLegendTitleWithBorder(n,t):o.styleLegendTitleNoBorder(n),t||St(n).select(".legendTitle").style("fill-opacity",0))})),mn(Cn(o),"applyStylesForHiddenSeries",(function(e,t){try{St(e).selectAll(".cell").each((function(e){var n=t.find((function(t){return t.label===e}));n&&(St(this).select(".swatch").attr("stroke",n.color).attr("stroke-location","outside"),n.hidden?St(this).attr("class","cell hidden"):St(this).attr("class","cell visible"))}))}catch(e){console.error(e)}})),mn(Cn(o),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return Ct().domain(e.map((function(e){return e.label}))).range(t)})),mn(Cn(o),"renderLegendSections",(function(){if("horizontal"===o.props.orientation){var e=o.getMaxSectionWidth(),t=o.getTotalHorizontalPadding(),n=o.props.outerWidth-t,a=n-o.HORIZONTAL_LEGEND_SPACING*(Math.ceil(n/e)-1),r=Math.floor(a/e);o.totalPossibleSections=r>=2?r:2}else o.props.hasSecondAxis&&(o.totalPossibleSections=2);return o.totalPossibleSections||(o.totalPossibleSections=1),Tn(new Array(o.totalPossibleSections)).map((function(e,t){return f.createElement("g",{ref:function(e){return o.legendElements[t]=e},key:"".concat(o.LEGEND_ID,"-").concat(t),"data-test":"react-autoql-legend",className:"legendOrdinal react-autoql-legend"})}))})),mn(Cn(o),"renderLegendBorder",(function(){return f.createElement("rect",{ref:function(e){return o.legendBorder=e},width:0,height:0,rx:2,transform:"translate(".concat(-o.BORDER_PADDING-o.BORDER_THICKNESS,",").concat(-o.BORDER_PADDING-o.TOP_ADJUSTMENT-o.BORDER_THICKNESS,")"),style:{stroke:"var(--react-autoql-border-color)",fill:"transparent",pointerEvents:"none",strokeOpacity:.6}})})),mn(Cn(o),"renderLegendClippingContainer",(function(e,t){return f.createElement("rect",{ref:function(e){return o.legendClippingContainer=e},width:0,height:0,rx:4,transform:"translate(".concat(-e,",").concat(-t,")"),style:{stroke:"transparent",fill:"transparent",pointerEvents:"none"}})})),mn(Cn(o),"render",(function(){var e=o.getTotalLeftPadding(),t=o.getTotalTopPadding()+o.TOP_ADJUSTMENT;return f.createElement("g",{"data-test":"legend",transform:"translate(".concat(e,", ").concat(t,")")},o.renderLegendSections(),o.renderLegendClippingContainer(e,t),o.renderLegendBorder())})),o.legendElements=[],o.legendLabels1=[],o.legendLabels2=[],o.LEGEND_ID="axis-".concat(C()),o.BORDER_PADDING=Pe?10:15,o.BORDER_THICKNESS=1,o.HORIZONTAL_LEGEND_SPACING=Pe?15:20,o.VERTICAL_LEGEND_SPACING=Pe?15:25,o.SHAPE_SIZE=Pe?50:75,o.TOP_ADJUSTMENT=Pe?12:15,o.DEFAULT_MAX_WIDTH=Pe?100:140,o.justMounted=!0,o}return pn(n)}();mn(Di,"propTypes",{title:b.string,paddingLeft:b.number,paddingRight:b.number,paddingTop:b.number,paddingBottom:b.number,legendColumn:b.shape({}),orientation:b.string,onLabelChange:b.func,onLegendClick:b.func,onLegendTitleClick:b.func,numberColumnIndices:b.arrayOf(b.number),topMargin:b.number,bottomMargin:b.number,scale:b.func,translate:b.string,height:b.number,width:b.number,onRenderComplete:b.func}),mn(Di,"defaultProps",{title:void 0,paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,fontSize:11,onLabelChange:function(){},onLegendClick:function(){},onRenderComplete:function(){},translate:void 0,orientation:"vertical"});var xi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"render",(function(){return f.createElement("rect",fn({},o.props.childProps,{className:"axis-scaler-border","data-test":"axis-scaler-border",fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4",onClick:o.props.toggleChartScale}))})),o}return pn(n)}(),Ri=["label","type","indeterminate","hasError","style","onChange","checked"],Ii=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"ID",C()),mn(Cn(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),mn(Cn(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),mn(Cn(e),"onCheckedChange",(function(t){e.props.onChange(t)})),mn(Cn(e),"render",(function(){var t=e.props,n=t.label,o=t.type;t.indeterminate;var a=t.hasError;t.style,t.onChange,t.checked;var r=yn(t,Ri),i="\n react-autoql-checkbox\n ".concat("switch"===o&&"react-autoql-checkbox--switch","\n ").concat(a&&"react-autoql-checkbox--has-error","\n "),l="\n react-autoql-checkbox__input\n ".concat("switch"===o?"react-autoql-checkbox--switch__input":"react-autoql-checkbox--checkbox__input","\n ").concat(a?"react-autoql-checkbox--has-error__input":"","\n ");return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-checkbox-container ".concat(e.props.className),"data-test":"react-autoql-checkbox-container",style:e.props.style},f.createElement("div",{className:i},f.createElement("input",fn({},r,{type:"checkbox","data-test":"react-autoql-checkbox",className:l,ref:function(t){return e.selector=t},id:e.ID,checked:e.props.checked,disabled:e.props.disabled,onClick:function(e){return e.stopPropagation()},onChange:e.onCheckedChange})),e.props.checked&&"default"===e.props.type&&f.createElement("div",{className:"react-autoql-checkbox-tick"},f.createElement(Wn,{type:"check"})),n&&f.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return pn(n)}();mn(Ii,"propTypes",{hasError:b.bool,indeterminate:b.bool,label:b.string,type:b.oneOf(["default","switch"]),checked:b.bool,onChange:b.func}),mn(Ii,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Ai=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"selectAll",(function(){var e=[];o.props.items.forEach((function(t,n){t.disabled||e.push(n)})),o.setState({selected:e})})),mn(Cn(o),"unselectAll",(function(){o.setState({selected:[]})})),mn(Cn(o),"interpolateArray",(function(e,t){for(var n=Math.min(e,t),o=Math.max(e,t),a=[],r=n;r<=o;r++)a.push(r);return a})),mn(Cn(o),"handleShiftSelect",(function(e,t){if(o.state.selected.length){var n=Math.min.apply(Math,Tn(o.state.selected)),a=[e];e<n?a=o.interpolateArray(e,n):e>n&&(a=o.interpolateArray(n,e));var r=(a=a.filter((function(e){return!o.props.items[e].disabled}))).map((function(e){return an({},o.props.items[e])}));o.props.onSelect(a,r),o.setState({selected:a})}else o.props.onSelect([e],[t]),o.setState({selected:[e]})})),mn(Cn(o),"handleCtrlSelect",(function(e){var t=[];t=o.state.selected.includes(e)?o.state.selected.filter((function(t){return t!==e})):[].concat(Tn(o.state.selected),[e]),o.props.onSelect(t),o.setState({selected:t})})),mn(Cn(o),"checkAll",(function(){var e=o.props.items.map((function(e){return an(an({},e),{},{checked:!e.disabled||e.checked})}));o.props.onChange(e,e,!0)})),mn(Cn(o),"unCheckAll",(function(){var e=o.props.items.map((function(e){return an(an({},e),{},{checked:!!e.disabled&&e.checked})}));o.props.onChange(e,e,!1)})),mn(Cn(o),"handleMultipleCheck",(function(e){var t=o.state.selected,n=t.every((function(t){return e[t].checked})),a=!0,r=o.props.items.map((function(e,o){return n&&t.includes(o)?(a=!1,an(an({},e),{},{checked:!1})):t.includes(o)?an(an({},e),{},{checked:!0}):e}));o.props.onChange(r,t,a)})),mn(Cn(o),"render",(function(){var e,t=o.props.items;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list"},!(null===(e=o.props.columns)||void 0===e||!e.length)&&f.createElement("div",{className:"col-visibility-header"},o.props.columns.map((function(e,n){if(n===o.props.columns.length-1){var a=t.find((function(e){return e.checked}))&&t.every((function(e){return e.checked||e.disabled}));return f.createElement("div",{key:"list-header-".concat(n)},e.name,f.createElement(Ii,{checked:a,disabled:t.every((function(e){return e.disabled})),style:{marginLeft:"10px"},onChange:function(e){a?o.unCheckAll():o.checkAll()}}))}return f.createElement("div",{key:"list-header-".concat(n)},e.name)}))),!(null==t||!t.length)&&t.map((function(e,n){var a;return f.createElement("div",{key:null!==(a=e.key)&&void 0!==a?a:"list-item-".concat(n,"-").concat(o.KEY),className:"react-autoql-list-item\n ".concat(o.state.selected.includes(n)?"selected":"","\n ").concat(e.disabled?"disabled":"","\n ").concat(e.checked?"checked":""),onClick:function(t){t.shiftKey?o.handleShiftSelect(n,e):t.ctrlKey||t.metaKey?o.handleCtrlSelect(n,e):(o.props.onSelect([n],[e]),o.setState({selected:[n]}))}},f.createElement("div",{className:"react-autoql-selectable-list-item-content-container"},e.content),f.createElement("div",null,f.createElement(Ii,{checked:e.checked,disabled:e.disabled,onChange:function(){if(o.state.selected.length>1&&o.state.selected.includes(n))o.handleMultipleCheck(t);else{var a=t.map((function(e,t){return n===t?an(an({},e),{},{checked:!e.checked}):e}));o.props.onChange(a,[e],!e.checked)}}})))}))))})),o.KEY=C(),o.state={selected:[]},o}return pn(n)}();mn(Ai,"propTypes",{columns:b.arrayOf(b.shape({})),items:b.arrayOf(b.shape({}))}),mn(Ai,"defaultProps",{onChange:function(){},onSelect:function(){},columns:[],items:[]});var Ni=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.hidden||Co()})),mn(Cn(o),"componentDidUpdate",(function(e,t){!t.isOpen&&o.state.isOpen&&o.setState({selectedColumns:[],checkedColumns:o.getCheckedFromNumberColumnIndices(o.props),columns:o.props.columns})})),mn(Cn(o),"getCheckedFromNumberColumnIndices",(function(e){var t,n;return e.isSecondAxis?null!==(t=e.numberColumnIndices2)&&void 0!==t?t:[]:null!==(n=e.numberColumnIndices)&&void 0!==n?n:[]})),mn(Cn(o),"onAggTypeSelect",(function(e,t){var n=o.state.columns.map((function(n){return n.field===t.field?an(an({},n),{},{aggType:e}):n}));o.setState({columns:n})})),mn(Cn(o),"getColumnsOfType",(function(e){var t;return null===(t=o.state.columns)||void 0===t?void 0:t.filter((function(t){return t.type===e}))})),mn(Cn(o),"getSelectableListItems",(function(e){var t=o.state.columns,n=[],a=o.getOtherAxisColumns();return t.forEach((function(t,r){if(t.type===e&&t.is_visible&&!t.pivot){var i=o.state.checkedColumns.includes(r),l=a.includes(r),s=Ge[t.aggType],c={key:"selectable-list-item-".concat(o.COMPONENT_KEY,"-").concat(e,"-").concat(r),content:f.createElement("div",{className:"agg-selector-column-item",key:"column-agg-type-symbol-".concat(o.COMPONENT_KEY)},!o.props.isAggregation&&t.aggType&&f.createElement(xo,{className:"agg-type-symbol",popupClassname:"agg-type-symbol-select",popoverParentElement:o.popoverContentRef,popoverBoundaryElement:o.popoverContentRef,tooltipID:o.props.tooltipID,tooltip:s.tooltip,value:s.type,showArrow:!1,align:"start",size:"small",options:Object.keys(Ge).map((function(e){return{value:Ge[e].type,label:Ge[e].symbol,listLabel:f.createElement("span",null,f.createElement("span",{className:"agg-select-list-symbol"},Ge[e].symbol),Ge[e].displayName),tooltip:Ge[e].tooltip}})),onChange:function(e){o.onAggTypeSelect(e,t)}}),f.createElement("div",{className:"agg-select-text"},f.createElement("span",null,t.title))),disabled:l,checked:i,columnIndex:r};n.push(c)}})),n})),mn(Cn(o),"getOtherAxisColumns",(function(){var e,t;return o.props.hasSecondAxis?o.props.isSecondAxis?null!==(e=o.props.numberColumnIndices)&&void 0!==e?e:[]:null!==(t=o.props.numberColumnIndices2)&&void 0!==t?t:[]:[]})),mn(Cn(o),"areAllDisabled",(function(e){var t,n=null===(t=o.getOtherAxisColumns())||void 0===t?void 0:t.filter((function(t){return o.state.columns[t].type===e})),a=o.getColumnsOfType(e);return(null==n?void 0:n.length)===(null==a?void 0:a.length)})),mn(Cn(o),"getAllChecked",(function(e){var t=o.getOtherAxisColumns();return!o.areAllDisabled(e)&&o.state.columns.every((function(n,a){return e!==n.type||o.state.checkedColumns.includes(a)||t.includes(a)}))})),mn(Cn(o),"onColumnSelection",(function(e,t){var n=t.map((function(e){return e.columnIndex}));o.setState({selectedColumns:n})})),mn(Cn(o),"onColumnCheck",(function(e){var t=Tn(o.state.checkedColumns);e.forEach((function(e){var n=t.indexOf(e.columnIndex);e.checked&&-1===n?t.push(e.columnIndex):!e.checked&&n>-1&&t.splice(n,1)})),o.setState({checkedColumns:t})})),mn(Cn(o),"renderSelectorContent",(function(e){return e.position,e.nudgedLeft,e.nudgedTop,o.props.hidden?null:f.createElement("div",{ref:function(e){return o.popoverContentRef=e},className:"number-axis-selector-popover"},f.createElement("div",{className:"number-axis-selector-popover-content"},o.renderSeriesSelectors(),o.renderApplyButton()))})),mn(Cn(o),"renderSeriesSelector",(function(e){var t=o.getColumnsOfType(e);if(null==t||!t.length)return null;var n=ao[e],a=o.getSelectableListItems(e),r=o.getAllChecked(e),i=o.areAllDisabled(e);return f.createElement("div",{className:"number-selector-field-group",key:"series-selector-group-".concat(e,"-").concat(o.COMPONENT_KEY)},f.createElement("div",{className:"number-selector-header"},f.createElement("div",{className:"number-selector-header-title"},o.state.columns&&void 0!==o.props.legendColumn?f.createElement("span",null,o.props.legendColumn.display_name):f.createElement("span",null,n," Fields")),f.createElement("div",null,f.createElement(Ii,{checked:r,disabled:i,className:"number-selector-list-checkbox",onChange:function(){var t,n;r?null===(t=o.listRefs[e])||void 0===t||t.unCheckAll():null===(n=o.listRefs[e])||void 0===n||n.checkAll()}}))),f.createElement("div",{className:"react-autoql-custom-scrollbars"},f.createElement(Po,{autoHeight:!0,autoHeightMin:100,maxHeight:Pe?void 0:250},f.createElement(Ai,{ref:function(t){return o.listRefs[e]=t},items:a,onSelect:o.onColumnSelection,onChange:o.onColumnCheck}))))})),mn(Cn(o),"renderSeriesSelectors",(function(){return f.createElement("div",{className:"axis-series-selector"},f.createElement("div",{className:"number-selector-field-group-container"},Object.keys(oo).map((function(e){return o.renderSeriesSelector(oo[e])}))))})),mn(Cn(o),"renderApplyButton",(function(){var e;return f.createElement("div",{className:"axis-selector-apply-btn-container"},f.createElement(wo,{className:"axis-selector-apply-btn",type:"primary",disabled:!(null!==(e=o.state.checkedColumns)&&void 0!==e&&e.length),tooltipID:o.props.tooltipID,onClick:function(){var e=o.state.checkedColumns;o.props.isSecondAxis?o.props.changeNumberColumnIndices(o.props.numberColumnIndices,e,o.state.columns):o.props.changeNumberColumnIndices(e,o.props.numberColumnIndices2,o.state.columns),o.props.closeSelector()}},"Apply"))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"number-axis-selector-".concat(o.COMPONENT_KEY),isOpen:o.props.isOpen,content:o.renderSelectorContent,innerRef:o.props.axisSelectorRef,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},o.props.children):null})),o.COMPONENT_KEY=C(),o.listRefs={};var a=o.getCheckedFromNumberColumnIndices(e);return o.state={aggType:void 0,selectedColumns:[],checkedColumns:a,columns:e.columns},o}return pn(n)}();mn(Ni,"propTypes",{changeNumberColumnIndices:b.func,positions:b.arrayOf(b.string)}),mn(Ni,"defaultProps",{changeNumberColumnIndices:function(){},positions:["right","bottom","top","left"]});var wi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"renderSelectorContent",(function(e){var t;e.position,e.childRect,e.popoverRect;var n=o.props,a=n.hidden,r=n.scale,i=n.columns;if(a||!r||!i)return null;var l=300,s=null===(t=o.props.chartContainerRef)||void 0===t?void 0:t.clientHeight;s&&s>85?l=s-50:s&&s<85&&(l=35),l>Window.innerHeight&&(l=Window.innerHeight);var c=r.secondScale,u=i.filter((function(e){var t;return!(null!=c&&null!==(t=c.fields)&&void 0!==t&&t.find((function(t){return t.name===e.name})))}));return f.createElement("div",{className:Pe?"mobile-string-axis-selector-popover-content":"string-axis-selector-popover-content"},f.createElement(Po,{autoHeight:!0,autoHeightMin:35,autoHeightMax:l},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},u.map((function(e){if(!Ho(e))return null;var t=i.findIndex((function(t){return t.name===e.name}));return f.createElement("li",{className:"string-select-list-item ".concat(t===r.columnIndex?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.props.closeSelector(),r.changeColumnIndices([t])}},e.display_name)}))))))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"string-axis-selector-".concat(o.COMPONENT_KEY),ref:o.props.axisSelectorRef,isOpen:o.props.isOpen,content:o.renderSelectorContent,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align,reposition:!0,padding:10},o.props.children):null})),o.COMPONENT_KEY=C(),o}return pn(n)}(),ki=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"getAllStringColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Qo(t)&&t.is_visible&&e.push(n)})),e})),mn(Cn(o),"getDateColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Uo(t)&&t.is_visible&&e.push(n)})),e})),mn(Cn(o),"renderSelectorContent",(function(e){var t;if(e.position,e.childRect,e.popoverRect,o.props.hidden)return null;var n=300,a=null===(t=o.props.chartContainerRef)||void 0===t?void 0:t.clientHeight;a&&a>85?n=a-50:a&&a<85&&(n=35),n>Window.innerHeight&&(n=Window.innerHeight);var r=[];return r=o.props.dateColumnsOnly?o.getDateColumnIndices():o.getAllStringColumnIndices(),f.createElement("div",{className:Pe?"mobile-string-axis-selector-popover-content":"string-axis-selector-popover-content"},f.createElement(Po,{autoHeight:!0,autoHeightMin:35,maxHeight:n},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},r.map((function(e,t){var n;return f.createElement("li",{className:"string-select-list-item ".concat(e===o.props.stringColumnIndex?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.props.closeSelector(),o.props.changeStringColumnIndex(e)}},null===(n=o.props.columns)||void 0===n||null===(n=n[e])||void 0===n?void 0:n.display_name)}))))))})),mn(Cn(o),"render",(function(){return o.props.children?f.createElement(Xn,{id:"string-axis-selector-".concat(o.COMPONENT_KEY),innerRef:o.props.axisSelectorRef,isOpen:o.props.isOpen,content:o.renderSelectorContent,onClickOutside:o.props.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},o.props.children):null})),o.COMPONENT_KEY=C(),o}return pn(n)}(),Pi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"renderSingleNumberAxisSelector",(function(e){return f.createElement(wi,fn({"data-test":"single-number-axis-selector"},e))})),mn(Cn(o),"renderNumberAxisSelector",(function(e){return f.createElement(Ni,fn({},e,{"data-test":"number-axis-selector"}))})),mn(Cn(o),"renderSingleStringAxisSelector",(function(e){return f.createElement(ki,fn({},e,{"data-test":"string-axis-selector"}))})),mn(Cn(o),"render",(function(){var e=o.props.scale;if(!e)return null;var t=an(an({},o.props),{},{key:o.KEY,ref:function(e){return o.ref=e}});return"BIN"===e.type?o.renderSingleNumberAxisSelector(t):"LINEAR"===e.type?e.allowMultipleSeries?o.renderNumberAxisSelector(t):o.renderSingleNumberAxisSelector(t):"BAND"===(null==e?void 0:e.type)||"TIME"===(null==e?void 0:e.type)?o.renderSingleStringAxisSelector(t):null})),o.KEY=C(),o}return pn(n)}(),Oi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"openSelector",(function(){o.setState({isOpen:!0})})),mn(Cn(o),"closeSelector",(function(){o.state.isOpen&&o.setState({isOpen:!1})})),mn(Cn(o),"loadMoreChartData",function(){var e=cn(rn().mark((function e(t,n){var a,r,i,l;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.props.currentRowNumber,e.prev=1,r=n?5e3:t,o.props.setCurrentRowNumber(t),o.props.setIsLoadingMoreRows(!0),e.next=7,o.props.queryFn({pageSize:r});case 7:i=e.sent,o.props.onNewData(i,r),o.props.setIsLoadingMoreRows(!1),e.next=17;break;case 12:e.prev=12,e.t0=e.catch(1),(null===e.t0||void 0===e.t0||null===(l=e.t0.data)||void 0===l?void 0:l.message)!==lr.CANCELLED&&(console.error(e.t0),o.props.onErrorCallback(e.t0)),o.props.setCurrentRowNumber(a),o.props.setIsLoadingMoreRows(!1);case 17:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(t,n){return e.apply(this,arguments)}}()),mn(Cn(o),"rowNumberListConstructor",(function(e){for(var t=500,n=[];t<e&&t<5e3;)n.push(t),t*=10;return e>5e3?n.push(5e3):n.push(e),n})),mn(Cn(o),"renderSelectorContent",(function(){var e,t=300,n=null===(e=o.props.chartContainerRef)||void 0===e?void 0:e.clientHeight;n&&n>85?t=n-50:n&&n<85&&(t=35);var a=o.rowNumberListConstructor(o.props.totalRowCount);return f.createElement(Po,{autoHeight:!0,autoHeightMin:35,maxHeight:t},f.createElement("div",{className:"axis-selector-container",id:"string-column-selector-content",onClick:function(e){e.stopPropagation()}},f.createElement("ul",{className:"axis-selector-content"},a.map((function(e,t){var n=e;5e3===e?n="".concat(5e3," (Maximum)"):500!==e&&5e3!==e&&(n="".concat(e," (All)"));var r=t===a.length-1;return f.createElement("li",{className:"string-select-list-item ".concat(e===o.props.currentRowNumber?"active":""),key:"string-column-select-".concat(t),onClick:function(){o.closeSelector(),o.loadMoreChartData(e,r)}},n)})))))})),mn(Cn(o),"render",(function(){return f.createElement(Xn,{isOpen:o.state.isOpen,innerRef:function(e){return o.popoverRef=e},content:o.renderSelectorContent,onClickOutside:o.closeSelector,parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement,positions:o.props.positions,align:o.props.align},f.createElement("rect",{className:"axis-label-border","data-test":"axis-label-border",onClick:o.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),o.state={isOpen:!1},o}return pn(n)}();mn(Oi,"propTypes",an(an({},fi),{},{onErrorCallback:b.func})),mn(Oi,"defaultProps",an(an({},gi),{},{onErrorCallback:function(){}}));var Li=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.applyStyles()})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.currentRowNumber!==t.currentRowNumber&&o.forceUpdate(),o.applyStyles()})),mn(Cn(o),"applyRowNumberSelectorStyles",(function(){var e,t,n,a=ia(o.currentRowNumber),r=null!==(e=null==a?void 0:a.width)&&void 0!==e?e:0,i=null!==(t=null==a?void 0:a.height)&&void 0!==t?t:0;St(null===(n=o.rowNumberSelector)||void 0===n?void 0:n.popoverRef).attr("x",(null==a?void 0:a.x)-o.BUTTON_PADDING_LEFT).attr("y",(null==a?void 0:a.y)-o.BUTTON_PADDING_TOP).attr("width",r+2*o.BUTTON_PADDING_LEFT).attr("height",i+2*o.BUTTON_PADDING_TOP)})),mn(Cn(o),"applyWarningIconStyles",(function(){var e,t=ia(o.ref),n=null!==(e=null==t?void 0:t.width)&&void 0!==e?e:0,a=(null==t?void 0:t.x)+n+5;St(o.warningIcon).attr("x",a).attr("y",-5)})),mn(Cn(o),"applyStyles",(function(){o.applyWarningIconStyles(),o.applyRowNumberSelectorStyles()})),mn(Cn(o),"initializeWidth",(function(){St(o.visualizingSpan).text(o.VISUALIZING_TEXT),St(o.ref).attr("textLength",null),o.applyStyles()})),mn(Cn(o),"adjustWidth",(function(e){var t;if(St(o.visualizingSpan).text(""),o.applyStyles(),(null===(t=ia(o.LoadMoreDropdownRef))||void 0===t?void 0:t.width)>e){var n=e-(o.warningIcon?25:0);St(o.ref).attr("textLength",n),o.applyStyles()}})),mn(Cn(o),"renderRowCountText",(function(){var e={};return o.props.isRowCountSelectable&&(e.textDecoration="underline"),f.createElement("text",{ref:function(e){return o.ref=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"hanging",textAnchor:"middle",style:o.props.style,textLength:10,lengthAdjust:"spacingAndGlyphs"},f.createElement("tspan",{ref:function(e){return o.allText=e},className:"load-more-drop-down-span",id:"load-more-drop-down-span-".concat(o.COMPONENT_ID)},f.createElement("tspan",{ref:function(e){return o.visualizingSpan=e},id:"visualizing-span-".concat(o.COMPONENT_ID),className:"visualizing-span"},o.VISUALIZING_TEXT),f.createElement("tspan",{ref:function(e){return o.currentRowNumber=e},style:e,id:"row-number-span-".concat(o.COMPONENT_ID)},o.state.currentRowNumber),f.createElement("tspan",null," / ".concat(o.props.totalRowCount," rows"))))})),mn(Cn(o),"renderRowDropdownButton",(function(){return o.props.isRowCountSelectable?f.createElement(Oi,fn({},o.props,{ref:function(e){return o.rowNumberSelector=e},column:o.props.xCol,positions:["top","bottom","right","left"],align:"center",totalRowCount:o.props.totalRowCount,currentRowNumber:o.state.currentRowNumber,setCurrentRowNumber:function(e){o.setState({currentRowNumber:e})}})):null})),mn(Cn(o),"renderDrilldownInfoIcon",(function(){return f.createElement("svg",{ref:function(e){return o.warningIcon=e},className:"drilldown-info-icon",viewBox:"0 0 24 24",height:"1.4em",width:"1.4em",xmlns:"http://www.w3.org/2000/svg","data-tip":"This visualization is showing a subset of the data. <em>Drilldowns</em> will be executed on the <strong>full</strong> dataset.","data-for":o.props.chartTooltipID},f.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))})),mn(Cn(o),"renderMaxRowWarningIcon",(function(){return f.createElement("svg",{ref:function(e){return o.warningIcon=e},className:"max-rows-info-icon",viewBox:"0 0 24 24",height:"1.4em",width:"1.4em",xmlns:"http://www.w3.org/2000/svg","data-tip":"Row limit (5000) reached. Try applying a filter or narrowing your search to return full results.","data-for":o.props.chartTooltipID},f.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))})),mn(Cn(o),"renderInfoIcon",(function(){return o.props.totalRowCount>o.maxRows?o.renderMaxRowWarningIcon():o.state.currentRowNumber<o.props.totalRowCount?o.renderDrilldownInfoIcon():null})),mn(Cn(o),"render",(function(){return f.createElement("g",{ref:function(e){return o.LoadMoreDropdownRef=e}},o.renderRowCountText(),o.renderRowDropdownButton(),o.renderInfoIcon())})),o.maxRows=5e3,o.BUTTON_PADDING_TOP=2,o.BUTTON_PADDING_LEFT=4,o.VISUALIZING_TEXT="Visualizing ",o.state={currentRowNumber:e.currentRowCount},o}return pn(n)}();mn(Li,"propTypes",an({},fi)),mn(Li,"defaultProps",an({},gi));var Mi=function(e){gn(o,v);var t=Sn(o);function o(e){var a,r;return un(this,o),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){r._isMounted=!0,r.renderAxis(),r.setState({axisRenderComplete:!0})})),mn(Cn(r),"shouldComponentUpdate",(function(e,t){if(r.state.isAxisSelectorOpen&&t.isAxisSelectorOpen)return!1;var o=n(r.props,e),a=n(r.state,t);return!o||!a})),mn(Cn(r),"componentDidUpdate",(function(e,t){if((!n(e.visibleSeriesIndices,r.props.visibleSeriesIndices)||e.stringColumnIndex!==r.props.stringColumnIndex)&&r.state.isAxisSelectorOpen!==t.isAxisSelectorOpen){var o=!r.props.scale.fields[0].hasOwnProperty("aggType");r.props.source,r.props.type,r.props.scale.axis,r.props.scale.type,o?(r.props.scale.column.name,r.props.scale.column.type):r.props.scale.fields.map((function(e){return{name:e.name,aggType:e.hasOwnProperty("aggType")?e.aggType:void 0,type:e.type}}))}var a=r.state.axisRenderComplete&&!t.axisRenderComplete;r.state.isAxisSelectorOpen||r.renderAxis(a)})),mn(Cn(r),"componentWillUnmount",(function(){r._isMounted=!1})),mn(Cn(r),"onAxisRenderComplete",(function(e){"Legend"===e?r.legendComplete=!0:r.axisComplete=!0,r.props.hasLegend||r.legendComplete||(r.legendComplete=!0),r.axisComplete&&r.legendComplete&&r.props.onAxisRenderComplete(r.props.orient)})),mn(Cn(r),"setScale",(function(){r.axis.scale(r.props.scale)})),mn(Cn(r),"adjustLegendLocation",(function(){if(r.legendContainer){var e,t=0,n=0,o=ia(r.ref);if("right"===r.props.orient)t=null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0;else if("bottom"===r.props.orient){var a,i,l=r.props.innerWidth/2,s=null===(a=r.legendContainer)||void 0===a?void 0:a.getBBox();t=l-(s.x+s.width/2),n=null!==(i=null==o?void 0:o.height)&&void 0!==i?i:0;var c=s.x+s.width+t,u=r.props.outerWidth-r.props.deltaX-r.props.chartPadding-c;u<0&&(t+=u)}St(r.legendContainer).attr("transform","translate (".concat(t,",").concat(n,")"))}})),mn(Cn(r),"getMaxTickLabelWidth",(function(){var e,t,n=r.props,o=n.orient,a=n.outerHeight,i=n.outerWidth,l="top"===o||"bottom"===o,s="left"===o||"right"===o;if(l&&!r.shouldLabelsRotate)return 100;l?t=Math.floor(.5*a/6):s&&(t=Math.floor(.3*i/6));var c=r.maxLabelWidth;return t<6?c=6:t<100&&(c=t),null!==(e=c)&&void 0!==e?e:100})),mn(Cn(r),"setTickValues",(function(){var e,t=r.props.scale,n=r.maxLabelWidth;r.axis.tickFormat((function(e){var o=Ze({d:e,scale:t,maxLabelWidth:n});return null!=o&&o.formattedLabel?o.formattedLabel:e})),null!==(e=r.props.scale)&&void 0!==e&&null!==(e=e.tickLabels)&&void 0!==e&&e.length&&r.axis.tickValues(r.props.scale.tickLabels),r.setTickSize()})),mn(Cn(r),"setTickSize",(function(){r.axis.tickSizeOuter(0),"left"===r.props.orient&&r.props.innerWidth?r.axis.tickSizeInner(-r.props.innerWidth):"bottom"===r.props.orient&&r.props.innerHeight?r.axis.tickSizeInner(r.props.innerHeight):r.axis.tickSizeInner(0)})),mn(Cn(r),"applyAxis",(function(){r.axisElement&&St(r.axisElement).call(r.axis)})),mn(Cn(r),"styleAxisLabels",(function(){"bottom"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(0, 10)"):"top"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(0, -5)"):"left"===r.props.orient?St(r.axisElement).selectAll(".tick text").attr("transform","translate(-5, 0)"):"right"===r.props.orient&&St(r.axisElement).selectAll(".tick text").attr("transform","translate(5, 0)")})),mn(Cn(r),"rotateLabelsIfNeeded",(function(){if("bottom"===r.props.orient||"top"===r.props.orient){var e=r.shouldLabelsRotate||(t=r.axisElement,o=!1,St(t).selectAll("g.tick text").each((function(){if(!o){var e=St(this).node().getBoundingClientRect();n&&e.x<n.x+n.width+10&&(o=!0),n=e}})),o);e&&("bottom"===r.props.orient?St(r.axisElement).selectAll(".tick text").style("text-anchor","end").attr("dominant-baseline","text-top").attr("transform","rotate(-45, 0, ".concat(r.props.innerHeight,") translate(-10, 0)")):"top"===r.props.orient&&St(r.axisElement).selectAll(".tick text").style("text-anchor","start").attr("dominant-baseline","auto").attr("transform","rotate(-45, 0, 0) translate(5, 0)")),r.shouldLabelsRotate=e}var t,n,o})),mn(Cn(r),"addTooltipsToLabels",(function(){var e=r.props.scale,t=r.maxLabelWidth;St(r.axisElement).selectAll(".axis .tick text").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").attr("data-for",r.props.chartTooltipID).attr("data-effect","float").attr("data-tip",(function(n){var o;if("..."===(null===(o=St(this).text())||void 0===o?void 0:o.slice(-3))){var a=Ze({d:n,scale:e,maxLabelWidth:t}).fullWidthLabel;if(a)return a}return null}))})),mn(Cn(r),"drawAxisAndLabels",(function(){r.maxLabelWidth=r.getMaxTickLabelWidth(),r.setTickValues(),r.applyAxis(),r.styleAxisLabels(),r.rotateLabelsIfNeeded()})),mn(Cn(r),"renderAxis",(function(e){var t;if(r.props.scale){switch(r.prevShouldLabelsRotate=r.shouldLabelsRotate,r.props.orient){case"bottom":r.axis=Pt();break;case"left":r.axis=kt();break;case"right":r.axis=wt();break;case"top":r.axis=Nt()}if(r.setScale(),r.drawAxisAndLabels(),r.shouldLabelsRotate&&!r.prevShouldLabelsRotate&&r.drawAxisAndLabels(),r.addTooltipsToLabels(),St(r.axisElement).selectAll(".axis path").style("display","none"),"LINEAR"!==(null===(t=r.props.scale)||void 0===t?void 0:t.type)?St(r.axisElement).selectAll("g.tick").select("line").style("opacity",0):(St(r.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.08").style("shape-rendering","crispedges"),St(r.axisElement).selectAll("g.tick").select("line").style("opacity",.1),St(r.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.3)),r.axisElement){var n=r.axisElement.getBBox?r.axisElement.getBBox():void 0,o=r.axisElement.getBoundingClientRect?r.axisElement.getBoundingClientRect():void 0,a=0,i=0;n&&o&&(a=(null==o?void 0:o.x)-(null==n?void 0:n.x),i=(null==o?void 0:o.y)-(null==n?void 0:n.y));var l=[];if(St(r.axisElement).selectAll("g.tick text").each((function(){var e=St(this).node().getBoundingClientRect();l.push({left:e.left-a,bottom:e.bottom-i,right:e.right-a,top:e.top-i})})),l){var s=Ti(l);r.labelsBBox=an({},s)}}r.adjustTitleToFit(),r.adjustLoadMoreSelectorToFit(),r.adjustAxisSelectorBorder(),r.adjustAxisScalerBorder(),r.adjustLegendLocation(),e?r.onAxisRenderComplete(r.props.orient):r.state.axisRenderComplete&&r.prevShouldLabelsRotate!==r.shouldLabelsRotate&&r.props.onLabelRotation()}})),mn(Cn(r),"getLegendOrientation",(function(){switch(r.props.orient.toLowerCase()){case"right":case"left":return"vertical";case"bottom":case"top":return"horizontal";default:return}})),mn(Cn(r),"renderLegend",(function(){var e=r.getLegendOrientation(),t={top:0,bottom:0,left:20,right:0};return"horizontal"===e&&(t.right=t.left=r.props.chartPadding,t.top=r.LOAD_MORE_DROPDOWN_PADDING_BOTTOM),f.createElement("g",{ref:function(e){return r.legendContainer=e}},f.createElement(Di,fn({},r.props,{ref:function(e){return r.legendRef=e},legendColumnIndices:r.props.numberColumnIndices,legendColumnIndices2:r.props.numberColumnIndices2,placement:r.props.orient,onRenderComplete:function(){return r.onAxisRenderComplete("Legend")},paddingBottom:t.bottom,paddingRight:t.right,paddingTop:t.top,paddingLeft:t.left,hasSecondAxis:r.props.hasSecondAxis,shape:r.props.legendShape,orientation:e,fontSize:r.fontSize})))})),mn(Cn(r),"getTitleTextHeight",(function(){var e,t=parseInt(null===(e=r.titleRef)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize,r.labelInlineStyles.fontSize);return isNaN(t)?r.fontSize:t})),mn(Cn(r),"openSelector",(function(){r.setState({isAxisSelectorOpen:!0})})),mn(Cn(r),"closeSelector",(function(){r.setState({isAxisSelectorOpen:!1})})),mn(Cn(r),"renderAxisSelector",(function(e){var t,n=e.positions,o=e.isSecondAxis,a=e.childProps,i=void 0===a?{}:a;return f.createElement(Pi,{chartContainerRef:r.props.chartContainerRef,changeNumberColumnIndices:r.props.changeNumberColumnIndices,changeStringColumnIndex:r.props.changeStringColumnIndex,legendColumn:r.props.legendColumn,popoverParentElement:r.props.popoverParentElement,numberColumnIndices:r.props.numberColumnIndices,numberColumnIndices2:r.props.numberColumnIndices2,stringColumnIndices:r.props.stringColumnIndices,stringColumnIndex:r.props.stringColumnIndex,dateColumnsOnly:r.props.dateColumnsOnly,isAggregation:r.props.isAggregation,tooltipID:r.props.tooltipID,hidden:!r.shouldRenderAxisSelector(),columns:r.props.columns,scale:r.props.scale,secondScale:null===(t=r.props.scale)||void 0===t?void 0:t.secondScale,align:"center",position:"right",positions:n,childProps:i,hasSecondAxis:r.props.hasSecondAxis,axisSelectorRef:function(e){return r.axisSelector=e},isOpen:r.state.isAxisSelectorOpen,closeSelector:r.closeSelector,isSecondAxis:o},f.createElement("rect",{ref:function(e){return r.axisSelector=e},className:"axis-label-border ".concat(r.shouldRenderAxisSelector()?"":"hidden"),"data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),mn(Cn(r),"renderAxisTitleText",(function(){var e,t=r.props.scale,n=null!==(e=null==t?void 0:t.title)&&void 0!==e?e:"";return n.length>35?f.createElement("tspan",{"data-tip":n,"data-for":r.props.chartTooltipID,"data-test":"axis-label"},"".concat(n.substring(0,35),"...")):f.createElement("tspan",{"data-test":"axis-label"},f.createElement("tspan",{ref:function(e){return r.titleText=e}},n),r.shouldRenderAxisSelector()&&f.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),mn(Cn(r),"renderBottomAxisTitle",(function(){return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({positions:["top","bottom","right","left"]}))})),mn(Cn(r),"renderLeftAxisTitle",(function(){var e,t,n=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-r.AXIS_TITLE_PADDING_TOP,o=-.5*r.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},id:"left-axis-title-".concat(r.AXIS_KEY),className:"left-axis-title","data-test":"left-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:o,y:n,textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({positions:["right","bottom","left","top"]}))})),mn(Cn(r),"renderRightAxisTitle",(function(){var e,t,n,o,a=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)+(null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.width)&&void 0!==n?n:0)+r.AXIS_TITLE_PADDING_TOP,i=-.5*r.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},id:"right-axis-title-".concat(r.AXIS_KEY),className:"right-axis-title","data-test":"right-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:i,y:a,textLength:r.MINIMUM_TITLE_LENGTH,lengthAdjust:"spacingAndGlyphs",style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({isSecondAxis:!0,positions:["left","top","bottom","right"]}))})),mn(Cn(r),"renderTopAxisTitle",(function(){var e,t,n=null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,o=r.props.innerWidth/2,a=n-r.AXIS_TITLE_PADDING_TOP;return f.createElement("g",null,f.createElement("text",{ref:function(e){return r.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:o,y:a,style:r.labelInlineStyles},r.renderAxisTitleText()),r.renderAxisSelector({isSecondAxis:!0,positions:["bottom","top","left","right"]}))})),mn(Cn(r),"adjustAxisSelectorBorder",(function(){var e,t,n;if(r.titleRef){var o=ia(r.titleRef),a=null!==(e=null==o?void 0:o.height)&&void 0!==e?e:0,i=null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0;St(r.axisSelector).attr("transform",null===(n=r.titleRef)||void 0===n?void 0:n.getAttribute("transform")).attr("width",Math.round(i+2*r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("height",Math.round(a+2*r.AXIS_TITLE_BORDER_PADDING_TOP)).attr("x",Math.round((null==o?void 0:o.x)-r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("y",Math.round((null==o?void 0:o.y)-r.AXIS_TITLE_BORDER_PADDING_TOP))}})),mn(Cn(r),"adjustAxisScalerBorder",(function(){var e,t,n,o,a,i,l,s;r.axisScaler&&St(r.axisScaler).attr("x",Math.round((null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-r.BUTTON_PADDING)).attr("y",Math.round((null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.y)&&void 0!==n?n:0)-r.BUTTON_PADDING)).attr("width",Math.round((null!==(a=null===(i=r.labelsBBox)||void 0===i?void 0:i.width)&&void 0!==a?a:0)+2*r.BUTTON_PADDING)).attr("height",Math.round((null!==(l=null===(s=r.labelsBBox)||void 0===s?void 0:s.height)&&void 0!==l?l:0)+2*r.BUTTON_PADDING))})),mn(Cn(r),"adjustBottomTitleToFit",(function(){var e,t,n,o,a=(null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(o=r.labelsBBox)||void 0===o?void 0:o.height)&&void 0!==n?n:0),i=r.props.innerWidth/2,l=a+r.AXIS_TITLE_PADDING_TOP;if(St(r.titleRef).attr("x",i).attr("y",l),r.props.chartRef){var s,c=r.props.outerWidth-2*r.props.chartPadding;if(St(r.titleRef).attr("textLength",null),(null!==(s=r.titleRef.getBBox().width)&&void 0!==s?s:0)+2*r.AXIS_TITLE_BORDER_PADDING_LEFT>c){var u=Math.floor(c)-2*r.AXIS_TITLE_BORDER_PADDING_LEFT;u<0&&(u=r.MINIMUM_TITLE_LENGTH),St(r.titleRef).attr("textLength",u)}var d=r.titleRef.getBBox(),p=d.x+d.width+r.props.deltaX+r.AXIS_TITLE_BORDER_PADDING_LEFT,m=r.props.outerWidth-r.props.chartPadding;if(p>m){var f=p-m;St(r.titleRef).attr("x",i-f)}}})),mn(Cn(r),"adjustTopTitleToFit",(function(){var e,t,n=null!==(e=null===(t=r.labelsBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,o=r.props.innerWidth/2,a=n-r.AXIS_TITLE_PADDING_TOP;St(r.titleRef).attr("x",o).attr("y",a)})),mn(Cn(r),"adjustVerticalTitleToFit",(function(){if(r.props.chartRef){var e,t=r.props.outerHeight-2*r.props.chartPadding;if(St(r.titleRef).attr("textLength",null),(null!==(e=r.titleRef.getBBox().width)&&void 0!==e?e:0)+2*r.AXIS_TITLE_BORDER_PADDING_LEFT>t){var n=Math.floor(t)-2*r.AXIS_TITLE_BORDER_PADDING_LEFT;n<0&&(n=r.MINIMUM_TITLE_LENGTH),St(r.titleRef).attr("textLength",n)}var o=r.titleRef.getBBox(),a=-1*(o.x+o.width)+r.props.deltaY-r.AXIS_TITLE_BORDER_PADDING_LEFT-r.props.chartPadding;if(a<0){var i=-a;St(r.titleRef).attr("transform","rotate(-90) translate(".concat(-i,", 0)"))}}})),mn(Cn(r),"adjustTitleToFit",(function(){r.titleRef&&("bottom"===r.props.orient?r.adjustBottomTitleToFit():"top"===r.props.orient?r.adjustTopTitleToFit():"left"!==r.props.orient&&"right"!==r.props.orient||r.adjustVerticalTitleToFit())})),mn(Cn(r),"adjustLoadMoreSelectorToFit",(function(){var e,t,n,o,a,i,l;if(r.loadMoreDropdownComponent&&r.props.chartRef){null===(e=(t=r.loadMoreDropdownComponent).initializeWidth)||void 0===e||e.call(t);var s,c,u=ia(r.loadMoreDropdown),d=r.props.outerWidth-2*r.props.chartPadding;if((null!==(n=u.width)&&void 0!==n?n:0)>d)null===(s=(c=r.loadMoreDropdownComponent).adjustWidth)||void 0===s||s.call(c,d);u=ia(r.loadMoreDropdown);var p=r.props.innerWidth/2-(u.x+u.width/2),m=(null!==(o=null===(a=r.labelsBBox)||void 0===a?void 0:a.y)&&void 0!==o?o:0)+(null!==(i=null===(l=r.labelsBBox)||void 0===l?void 0:l.height)&&void 0!==i?i:0)+(r.AXIS_TITLE_PADDING_TOP+r.AXIS_TITLE_PADDING_BOTTOM+r.fontSize),f=u.x+u.width+p,g=r.props.outerWidth-r.props.deltaX-r.props.chartPadding-f;g<0&&(p+=g),St(r.loadMoreDropdown).attr("transform","translate(".concat(p,", ").concat(m,")"))}})),mn(Cn(r),"renderAxisTitle",(function(){switch(r.props.orient){case"left":return r.renderLeftAxisTitle();case"right":return r.renderRightAxisTitle();case"bottom":return r.renderBottomAxisTitle();case"top":return r.renderTopAxisTitle();default:return null}})),mn(Cn(r),"renderLoadMoreDropdown",(function(){return"bottom"===r.props.orient&&r.props.enableAjaxTableData?f.createElement("g",{ref:function(e){return r.loadMoreDropdown=e}},f.createElement(Li,fn({ref:function(e){return r.loadMoreDropdownComponent=e}},r.props,{style:an(an({},r.labelInlineStyles),{},{fontSize:r.fontSize})}))):null})),mn(Cn(r),"shouldRenderAxisSelector",(function(){var e;return null===(e=r.props.scale)||void 0===e?void 0:e.hasDropdown})),mn(Cn(r),"shouldRenderAxisScaler",(function(){var e,t,n;return!(!r.labelsBBox||"LINEAR"!==(null===(e=r.props.scale)||void 0===e?void 0:e.type)||1===(null===(t=r.props.scale)||void 0===t?void 0:t.domain().length)||null!==(n=r.props.scale)&&void 0!==n&&n.disableAutoScale)})),mn(Cn(r),"renderAxisScaler",(function(){return r.shouldRenderAxisScaler()?f.createElement(xi,{toggleChartScale:r.props.toggleChartScale,labelBBox:r.labelsBBox,childProps:{ref:function(e){return r.axisScaler=e}}}):null})),mn(Cn(r),"render",(function(){return f.createElement(f.Fragment,null,!!r.props.scale&&f.createElement("g",{"data-test":"axis",ref:function(e){return r.ref=e},transform:"translate(".concat(r.props.translateX,", ").concat(r.props.translateY,")"),style:r.labelInlineStyles},f.createElement("g",{className:"axis axis-".concat(r.props.orient),ref:function(e){return r.axisElement=e}}),r.renderAxisTitle(),r.renderLoadMoreDropdown(),r.renderAxisScaler()),r.props.hasLegend&&r.renderLegend())})),r.AXIS_KEY=C(),r.LEGEND_ID="axis-".concat(C()),r.BUTTON_PADDING=5,r.AXIS_TITLE_PADDING_TOP=20,r.AXIS_TITLE_PADDING_BOTTOM=0,r.AXIS_TITLE_BORDER_PADDING_LEFT=5,r.AXIS_TITLE_BORDER_PADDING_TOP=3,r.LOAD_MORE_DROPDOWN_PADDING_BOTTOM=10,r.MINIMUM_TITLE_LENGTH=10,r.swatchElements=[],r.maxRows=5e3,r.initialRowNumber=50,r.fontSize=Pe?10:12,r.labelInlineStyles=(mn(a={fontSize:"".concat(r.fontSize,"px"),fontFamily:"inherit",fill:"currentColor",fillOpacity:1,cursor:"default"},"fontFamily","var(--react-autoql-font-family)"),mn(a,"letterSpacing","normal"),a),r.shouldLabelsRotate=!1,r.prevShouldLabelsRotate=!1,r.state={isAxisSelectorOpen:!1},r}return pn(o)}();mn(Mi,"propTypes",an(an({},fi),{},{scale:b.func,orient:b.string,translateX:b.number,translateY:b.number})),mn(Mi,"defaultProps",an(an({},gi),{},{orient:"bottom",translate:void 0,translateX:0,translateY:0,onAxisRenderComplete:function(){}}));var qi=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onAxisRenderComplete",(function(e){switch(e){case"right":o.rightAxisComplete=!0;break;case"left":o.leftAxisComplete=!0;break;case"bottom":o.bottomAxisComplete=!0;break;case"top":o.topAxisComplete=!0}o.shouldRenderRightAxis()||o.rightAxisComplete||(o.rightAxisComplete=!0),o.shouldRenderTopAxis()||o.topAxisComplete||(o.topAxisComplete=!0),o.topAxisComplete&&o.bottomAxisComplete&&o.leftAxisComplete&&o.rightAxisComplete&&o.props.onAxesRenderComplete()})),mn(Cn(o),"renderBottomAxis",(function(e,t){return f.createElement("g",{ref:function(e){return o.bottomAxis=e}},f.createElement(Mi,fn({},o.props,{ref:function(e){return o.bottomAxisWithoutLegend=e},key:o.BOTTOM_AXIS_KEY,orient:"bottom",scale:o.props.xScale,translateY:0,translateX:0,hasLegend:o.shouldRenderBottomLegend(),innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()})))})),mn(Cn(o),"renderLeftAxis",(function(e,t){return f.createElement(Mi,fn({},o.props,{key:o.LEFT_AXIS_KEY,ref:function(e){return o.leftAxis=e},orient:"left",scale:o.props.yScale,showGridLines:o.props.yGridLines,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()}))})),mn(Cn(o),"shouldRenderTopAxis",(function(){return!!o.props.xScale2})),mn(Cn(o),"renderTopAxis",(function(e,t){return o.shouldRenderTopAxis()?f.createElement(Mi,fn({},o.props,{key:o.TOP_AXIS_KEY,ref:function(e){return o.topAxis=e},orient:"top",scale:o.props.xScale2,showGridLines:!1,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()})):null})),mn(Cn(o),"shouldRenderRightAxis",(function(){return!!o.props.yCol2&&!!o.props.yScale2})),mn(Cn(o),"shouldRenderRightLegend",(function(){return"right"===o.props.legendLocation})),mn(Cn(o),"shouldRenderBottomLegend",(function(){return"bottom"===o.props.legendLocation})),mn(Cn(o),"renderRightAxis",(function(e,t){var n=o.shouldRenderRightAxis(),a=o.shouldRenderRightLegend();return n||a?f.createElement("g",{ref:function(e){return o.rightAxis=e},transform:"translate(".concat(e,", 0)")},f.createElement(Mi,fn({},o.props,{ref:function(e){return o.rightAxisWithoutLegend=e},key:o.RIGHT_AXIS_KEY,orient:"right",scale:o.props.yScale2,showGridLines:!1,hasLegend:a,innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()}))):null})),mn(Cn(o),"hasSecondAxis",(function(){return o.shouldRenderRightAxis()||o.shouldRenderTopAxis()})),mn(Cn(o),"render",(function(){var e,t,n;if(!(o.props.yScale&&o.props.xScale&&o.props.height&&o.props.width))return null;var a=(null===(e=o.props.xScale)||void 0===e?void 0:e.range())||[0,0],r=(null===(t=o.props.yScale)||void 0===t?void 0:t.range())||[0,0],i=a[1]-a[0],l=r[0]-r[1];return f.createElement("g",{ref:function(e){return o.ref=e}},null!==(n=o.props.children)&&void 0!==n?n:null,f.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},o.renderBottomAxis(i,l),o.renderLeftAxis(i,l),o.renderRightAxis(i,l),o.renderTopAxis(i,l)))})),o.LEGEND_PADDING=20,o.BOTTOM_AXIS_KEY=C(),o.LEFT_AXIS_KEY=C(),o.RIGHT_AXIS_KEY=C(),o.TOP_AXIS_KEY=C(),o}return pn(n)}();mn(qi,"propTypes",an(an({},fi),{},{onAxesRenderComplete:b.func})),mn(qi,"defaultProps",an(an({},gi),{},{onAxesRenderComplete:function(){}}));var Vi=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"getBars",(function(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=e.props,r=a.columns,i=a.legendColumn,l=a.stringColumnIndex,s=a.dataFormatting,c=a.xScale;if(null==t||!t.length||!n||!e.barWidth)return null;var u=o,d=[];return t.forEach((function(t,o){if(!r[t].isSeriesHidden){var a=e.props.colorScale(t);d.push(e.props.data.map((function(d,p){var m=d[t];if(!m)return null;var g=m<0?bi(n):n(m),v=Math.abs(n(m)-bi(n));if((isNaN(v)||isNaN(m))&&(g=bi(n),v=0),v<.05)return null;var h=c.getValue(d[l])+u*e.barWidth,b=Ci({row:d,columns:r,colIndex:t,colIndex2:l,legendColumn:i,dataFormatting:s}),y=yi(t,p);return f.createElement("rect",{key:y,className:"bar".concat(e.state.activeKey===y?" active":""),"data-test":"bar-".concat(o,"-").concat(p),x:h,y:g,height:v,width:e.barWidth,onClick:function(){return e.onColumnClick(d,t,p)},"data-tip":b,"data-for":e.props.chartTooltipID,style:{fill:a,fillOpacity:.7}})}))),u+=1}})),d})),mn(Cn(e),"render",(function(){var t;if(e.props.isLoading)return null;var n=e.props,o=n.columns,a=n.numberColumnIndices,r=n.numberColumnIndices2,i=n.xScale,l=n.yScale,s=n.yScale2,c=a.filter((function(e){return!o[e].isSeriesHidden})),u=null==r?void 0:r.filter((function(e){return!o[e].isSeriesHidden}));if(!c.length)return null;var d=c.length+(s&&null!==(t=null==u?void 0:u.length)&&void 0!==t?t:0);e.barWidth=(i.bandwidth?i.bandwidth():0)/d;var p=e.getBars(a,l);return f.createElement("g",{"data-test":"columns"},p)})),e}return pn(n)}();mn(Vi,"propTypes",vi),mn(Vi,"defaultProps",hi);var _i=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"y",isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled}));o.yScale=r.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,linearAxis:"y",toggleChartScale:o.toggleChartScale,yGridLines:!0}),f.createElement(Vi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.state={isChartScaled:!0},o}return pn(n)}();mn(_i,"propTypes",pi),mn(_i,"defaultProps",mi);var Fi=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onBarClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale,c=a.filter((function(e){return!n[e].isSeriesHidden}));if(!c.length)return null;var u=[],d=l.tickSize/c.length,p=0;return a.forEach((function(t,a){if(!n[t].isSeriesHidden){var c=e.props.colorScale(t);u.push(e.props.data.map((function(u,m){var g=u[t];if(!g)return null;var v=Math.abs(s(g)-bi(s));if(isNaN(v)&&(v=0),v<.05)return null;var h=l(u[r])+p*d,b=Ci({row:u,columns:n,colIndex:t,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(t,m),className:"bar".concat(e.state.activeKey===yi(t,m)?" active":""),"data-test":"bar-".concat(a,"-").concat(m),y:h,x:g>0?bi(s):s(g),width:v,height:d,onClick:function(){return e.onBarClick(u,t,m)},"data-tip":b,"data-for":e.props.chartTooltipID,style:{fill:c,fillOpacity:1}})}))),p+=1}})),f.createElement("g",{"data-test":"bars"},u)})),e}return pn(n)}();mn(Fi,"propTypes",vi),mn(Fi,"defaultProps",hi);var zi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.yScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,config:e.dataFormatting,axis:"y"}));var r=et(an(an({},e),{},{config:e.dataFormatting,columnIndices1:a,isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled,axis:"x"}));o.xScale=r.scale,o.xTickValues=o.xScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-bar-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:e,yCol:o.props.columns[o.props.stringColumnIndex],linearAxis:"x",toggleChartScale:o.toggleChartScale}),f.createElement(Fi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.state={isChartScaled:!0},o}return pn(n)}();mn(zi,"propTypes",pi),mn(zi,"defaultProps",mi);var Bi=function(e,t){var n=t[0]-e[0],o=t[1]-e[1];return{length:Math.sqrt(Math.pow(n,2)+Math.pow(o,2)),angle:Math.atan2(o,n)}},Hi=function(e,t,n,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2,r=e,i=t,l=n;i||(i=e),l||(l=e);var s=Bi(i,l),c=Bi(i,r),u=Bi(r,l);s.length>2*u.length?s.length=2*u.length:s.length>2*c.length&&(s.length=2*c.length);var d=s.angle+(o?Math.PI:0),p=s.length*a,m=e[0]+Math.cos(d)*p,f=e[1]+Math.sin(d)*p;return[m,f]},Qi=function(e,t,n,o){var a=Hi(n[t-1],n[t-2],e,!1,o),r=Hi(e,n[t-1],n[t+1],!0,o);return"C ".concat(a.join(",")," ").concat(r.join(",")," ").concat(e.join(","))},Ui=function(e){return"L ".concat(e.join(","))},Yi=function(e,t,n){return e.reduce((function(e,o,a,r){return 0===a?"M ".concat(o.join(",")):"".concat(e," ").concat(t(o,a,r,n))}),"")},Ki=function(e,t){return t?Yi(e,Qi,t):Yi(e,Ui)},ji=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"onDotClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"makeChartElements",(function(){var e,t=o.props,n=t.columns,a=t.legendColumn,r=t.numberColumnIndices,i=t.stringColumnIndex,l=t.dataFormatting,s=t.yScale,c=t.xScale,u=Ua("background-color-secondary"),d=o.props.width/(null===(e=o.props.data)||void 0===e?void 0:e.length)<10,p=[],m=[];return r.forEach((function(e,t){var r=[],g=o.props.colorScale(e);n[e].isSeriesHidden||o.props.data.forEach((function(t,m){var v=t[e];if(v||0===v){var h=c.tickSize/2,b=c.getValue(t[i])+h,y=s.domain()[0],C=s(v||y),E=[b,C];r.push(E);var S=Ci({row:t,columns:n,colIndex:e,colIndex2:i,legendColumn:a,dataFormatting:l});if(!isNaN(C)){var T=yi(e,m),D=f.createElement("circle",{key:"hover-circle-".concat(T),cx:b,cy:C,r:6,style:{stroke:"transparent",fill:"transparent",cursor:"pointer"}}),x=f.createElement("circle",{className:"line-dot-inner-circle",key:T,cx:b,cy:C,r:2.5,style:{pointerEvents:"none",stroke:g,strokeWidth:4,paintOrder:"stroke",color:g,opacity:d?0:1,fill:o.state.activeKey===T?g:u||"#fff"}});p.push(f.createElement("g",{className:"line-dot".concat(o.state.activeKey===T?" active":"").concat(d?" hidden-dot":""),key:"circle-group-".concat(T),onClick:function(){return o.onDotClick(t,e,m)},"data-tip":S,"data-for":o.props.chartTooltipID},x,D))}}}));var v=Ki(r,o.PATH_SMOOTHING),h=f.createElement("path",{key:"line-".concat(yi(0,t,0)),className:"line",d:v,fill:"none",stroke:g,strokeWidth:2});m.push(h)})),{paths:m,innerCircles:p}})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props.numberColumnIndices.filter((function(e){var t;return!(null!==(t=o.props.columns[e])&&void 0!==t&&t.isSeriesHidden)}));if(!(null==e?void 0:e.length))return null;var t=o.makeChartElements(),n=t.paths,a=t.innerCircles;return f.createElement("g",{"data-test":"line"},n,a)})),o.PATH_SMOOTHING=.2,o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(ji,"propTypes",vi),mn(ji,"defaultProps",hi);var Wi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"state",{isChartScaled:!0}),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.isChartScaled!==t.isChartScaled&&Co()})),mn(Cn(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"y",isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled}));o.yScale=r.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-line-chart"},f.createElement(ji,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,toggleChartScale:o.toggleChartScale,legendShape:"line",dateColumnsOnly:!0,yGridLines:!0})))})),o}return pn(n)}();mn(Wi,"propTypes",pi),mn(Wi,"defaultProps",mi);var Gi=function(t){gn(o,v);var n=Sn(o);function o(t){var a,r;un(this,o),mn(Cn(r=n.call(this,t)),"componentDidMount",(function(){r.renderPie(),Co()})),mn(Cn(r),"shouldComponentUpdate",(function(e,t){if(r.props.isResizing&&e.isResizing)return!1;var n=Ma(r.props,e),o=Ma(r.state,t);return!n||!o})),mn(Cn(r),"componentDidUpdate",(function(){r.renderPie()})),mn(Cn(r),"componentWillUnmount",(function(){Ia(r.legend),Ia(r.pieChartContainer)})),mn(Cn(r),"aggregateOtherCategory",(function(e,t){var n=[];return t.forEach((function(o,a){var r;if(10===a)n[10]=o,n[10][e.stringColumnIndex]="Other";else if(a>10&&null!==(r=n[10])&&void 0!==r&&r[e.numberColumnIndex]){var i,l;n[10][e.numberColumnIndex]+=null!==(i=null===(l=t[a])||void 0===l?void 0:l[e.numberColumnIndex])&&void 0!==i?i:0}else n[a]=o})),n})),mn(Cn(r),"renderPie",(function(){Ia(r.pieChartContainer),r.setPieRadius();var e=Ya().chartColors,t=tt({data:r.sortedData,numberColumnIndex:r.props.numberColumnIndex,legendLabels:r.state.legendLabels,chartColors:e}),n=t.pieChartFn,o=t.legendScale;r.pieChartFn=n,r.legendScale=o,r.renderPieContainer(),r.renderPieSlices(),r.renderLegend(),r.renderLegendBorder(),r.centerVisualization(),r.renderComplete||(r.renderComplete=!0,r.props.onAxesRenderComplete())})),mn(Cn(r),"renderPieContainer",(function(){var e=r.props,t=e.width,n=e.height;r.pieChartContainer=St(r.chartElement).append("svg").attr("width",t).attr("height",n).append("g").attr("class","slices").attr("transform","translate(".concat(t/2+r.outerRadius,",").concat(n/2,")"))})),mn(Cn(r),"onSliceClick",(function(e){try{var t;if(null==e||null===(t=e.data)||void 0===t||null===(t=t.value)||void 0===t||null===(t=t.legendLabel)||void 0===t?void 0:t.isOther)return;var n=e.data.key;n===r.state.activeKey?r.setState({activeKey:null}):(r.props.onChartClick({row:Object.values(e.data.value),columnIndex:r.props.numberColumnIndex,columns:r.props.columns,stringColumnIndex:r.props.stringColumnIndex,legendColumn:r.props.legendColumn,activeKey:n}),r.setState({activeKey:n}))}catch(e){console.error(e)}})),mn(Cn(r),"renderPieSlices",(function(){var e=Cn(r);r.pieChartContainer.selectAll(".slices").data(e.pieChartFn).enter().append("path").attr("class","slice").attr("d",qt().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for",r.props.chartTooltipID).attr("data-tip",(function(t){return Ci({row:t.data.value,columns:e.props.columns,colIndex:e.props.numberColumnIndex,colIndex2:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting})})).style("fill-opacity",1).style("cursor",(function(e){var t;return null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(t=t.value)&&void 0!==t&&null!==(t=t.legendLabel)&&void 0!==t&&t.isOther?"default":"pointer"})).attr("stroke-width","0.5px").attr("stroke",r.props.backgroundColor).on("mouseover",(function(e){St(this).style("fill-opacity",1)})).on("mouseout",(function(e){St(this).style("fill-opacity",1)})).on("click",(function(t,n){e.onSliceClick(n,t)})),e.pieChartContainer.selectAll("path.slice").each((function(t){St(this).transition().duration(500).attr("transform",(function(t){var n;if(t.data.key===e.state.activeKey&&(null===(n=e.sortedData)||void 0===n?void 0:n.length)>1){var o=t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2,a=10*Math.cos(o),r=10*Math.sin(o);return"translate(".concat(a,",").concat(r,")")}}))}))})),mn(Cn(r),"centerVisualization",(function(){var t,n=St("#pie-chart-container-".concat(r.CHART_ID)).node();n&&(t=n.getBBox());var o=e(t,"width",0),a=e(t,"x",0),i=(r.props.width-o)/2-a;St("#pie-chart-container-".concat(r.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),mn(Cn(r),"onLegendClick",(function(e){var t,n,o;try{o=JSON.parse(e)}catch(e){return void console.error(e)}var a=null===(t=o)||void 0===t?void 0:t.dataIndex,i=null===(n=r.state.legendLabels)||void 0===n?void 0:n[a];if(i&&!r.state.legendLabels.every((function(e){return e.label===i.label||e.hidden}))){var l=S(r.state.legendLabels);l[a].hidden=!r.state.legendLabels[a].hidden,r.setState({legendLabels:l},(function(){Co()}))}})),mn(Cn(r),"renderLegendBorder",(function(){return f.createElement("rect",{ref:function(e){return r.legendBorder=e},width:0,height:0,rx:2,transform:"translate(".concat(-r.BORDER_PADDING-r.BORDER_THICKNESS,",").concat(-r.BORDER_PADDING-r.TOP_ADJUSTMENT-r.BORDER_THICKNESS,")"),style:{stroke:"var(--react-autoql-border-color)",fill:"transparent",pointerEvents:"none",strokeOpacity:.6}})})),mn(Cn(r),"renderLegend",(function(){var t,n=Cn(r),o=r.props.height;if(r.legendScale){var a=r.props.width/2-70,i=null===(t=r.props)||void 0===t||null===(t=t.columns)||void 0===t||null===(t=t[r.props.stringColumnIndex])||void 0===t?void 0:t.display_name;r.legend=St(r.legendElement),r.legend.select("*").remove(),r.legend.append("g").attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity",1).style("font-family","inherit").style("font-family","inherit").style("font-size","".concat(r.props.fontSize,"px")).style("stroke-width","2px");var l,s=Je().orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(a).labelOffset(10).scale(n.legendScale).title(i).titleWidth(n.props.width/2).on("cellclick",(function(){var e;n.onLegendClick(null===(e=St(this))||void 0===e?void 0:e.data())}));r.legend.select(".legendOrdinal").call(s);var c=r.legend.select(".legendOrdinal").node();St(c).selectAll(".cell").style("font-size","".concat(r.props.fontSize-2,"px")),r.applyTitleStyles(i,c),c&&(l=c.getBBox());var u=e(l,"height",0),d=e(l,"width",0),p=r.props.width/2-d-20,m=u<o-20?(o-u)/2:15;r.legendXPosition=p,r.legendYPosition=m,r.legend.select(".legendOrdinal").attr("transform","translate(".concat(p,", ").concat(m,")")),St(r.legendBorder).attr("height",u+2*r.BORDER_PADDING).attr("width",d+2*r.BORDER_PADDING),r.applyColumnSelectorStyles(),r.applyStylesForHiddenSeries()}})),mn(Cn(r),"applyColumnSelectorStyles",(function(){r.titleBBox={};try{var e,t,n=r.legend.select(".legendTitle").node().getBBox(),o=null!==(e=null==n?void 0:n.height)&&void 0!==e?e:0,a=null!==(t=null==n?void 0:n.width)&&void 0!==t?t:0;r.titleBBox=n,St(r.columnSelector).attr("transform","translate(".concat(r.legendXPosition,", ").concat(r.legendYPosition-5,")")).attr("width",Math.round(a+2*r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("height",Math.round(o+2*r.AXIS_TITLE_BORDER_PADDING_TOP)).attr("x",Math.round((null==n?void 0:n.x)-r.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("y",Math.round((null==n?void 0:n.y)-r.AXIS_TITLE_BORDER_PADDING_TOP))}catch(e){console.error(e)}})),mn(Cn(r),"styleLegendTitleNoBorder",(function(e){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).style("transform","translateY(-5px)")})),mn(Cn(r),"styleLegendTitleWithBorder",(function(e){St(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).style("transform","translateY(-5px)").append("tspan").text(" ▼").style("font-size","8px").style("opacity",0).attr("class","react-autoql-axis-selector-arrow")})),mn(Cn(r),"applyTitleStyles",(function(e,t){var n;e&&((null===(n=r.props.stringColumnIndices)||void 0===n?void 0:n.length)>1?r.styleLegendTitleWithBorder(t):r.styleLegendTitleNoBorder(t))})),mn(Cn(r),"applyStylesForHiddenSeries",(function(){var e=r.state.legendLabels.filter((function(e){return e.hidden})).map((function(e){return e.label}));r.legendSwatchElements=document.querySelectorAll("#".concat(r.LEGEND_ID," .label tspan")),r.legendSwatchElements&&r.legendSwatchElements.forEach((function(t){var n=t.parentElement.parentElement.querySelector(".swatch");n.style.strokeWidth="2px",e.includes(t.textContent)?n.style.opacity=.3:n.style.opacity=1}))})),mn(Cn(r),"setPieRadius",(function(){var e,t=r.props,n=t.width,o=t.height,a=t.margin;e=n<o?n/2-a:2*o<n?o-a:n/2-a,r.outerRadius=e/2,r.innerRadius=r.outerRadius-50>15?r.outerRadius-50:0})),mn(Cn(r),"openSelector",(function(){r.setState({isColumnSelectorOpen:!0})})),mn(Cn(r),"closeSelector",(function(){r.setState({isColumnSelectorOpen:!1})})),mn(Cn(r),"renderTitleSelector",(function(){return f.createElement(ki,{chartContainerRef:r.props.chartContainerRef,changeStringColumnIndex:r.props.changeStringColumnIndex,legendColumn:r.props.legendColumn,popoverParentElement:r.props.popoverParentElement,stringColumnIndices:r.props.stringColumnIndices,stringColumnIndex:r.props.stringColumnIndex,isAggregation:r.props.isAggregation,tooltipID:r.props.tooltipID,columns:r.props.columns,scale:r.legendScale,align:"center",position:"bottom",positions:["top","bottom","right","left"],axisSelectorRef:function(e){return r.columnSelector=e},isOpen:r.state.isColumnSelectorOpen,closeSelector:r.closeSelector},f.createElement("rect",{ref:function(e){return r.columnSelector=e},className:"axis-label-border","data-test":"axis-label-border",onClick:r.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),mn(Cn(r),"render",(function(){return f.createElement("g",{id:"pie-chart-container-".concat(r.CHART_ID),"data-test":"react-autoql-pie-chart"},f.createElement("svg",{className:"pie-chart",ref:function(e){r.chartElement=e},width:r.props.width,height:r.props.height}),f.createElement("g",{ref:function(e){r.legendElement=e},id:r.LEGEND_ID,className:"legendOrdinal"}),r.renderTitleSelector())})),r.CHART_ID=C(),r.LEGEND_ID="react-autoql-pie-legend-".concat(C()),r.BORDER_PADDING=15,r.BORDER_THICKNESS=1,r.TOP_ADJUSTMENT=15,r.AXIS_TITLE_BORDER_PADDING_LEFT=5,r.AXIS_TITLE_BORDER_PADDING_TOP=3,r.sortedData=t.data.concat().sort((function(e,n){var o=e[t.numberColumnIndex]||0,a=n[t.numberColumnIndex]||0;return parseFloat(a)-parseFloat(o)})),(null===(a=r.sortedData)||void 0===a?void 0:a.length)>10&&(r.sortedData=r.aggregateOtherCategory(t,r.sortedData));var i=Ya().chartColors;r.colorScale=Ct().domain(r.sortedData.map((function(e){return e[t.stringColumnIndex]}))).range(i);var l=r.sortedData.map((function(n,o){var a,r;return{label:"".concat(aa({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(a=t.columns)||void 0===a?void 0:a[t.stringColumnIndex]}),": ").concat(aa({element:n[t.numberColumnIndex]||0,column:e(t,"columns[".concat(t.numberColumnIndex,"]")),config:null===(r=t.columns)||void 0===r?void 0:r[t.dataFormatting]})).trim(),hidden:!1,dataIndex:o,isOther:o>=10}}));return r.state={activeKey:r.props.activeChartElementKey,legendLabels:l},r}return pn(o)}();mn(Gi,"propTypes",an(an({},pi),{},{onAxesRenderComplete:b.func,backgroundColor:b.string,fontSize:b.number,margin:b.number})),mn(Gi,"defaultProps",an(an({},mi),{},{onAxesRenderComplete:function(){},backgroundColor:"transparent",fontSize:12,margin:40}));var Xi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"onSquareClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.legendColumn,a=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!a.length)return null;var u=[];return o.props.data.forEach((function(e,d){a.forEach((function(a,p){var m=e[a],g=Number(m),v=isNaN(g)?0:g,h=e[r],b=l[p].label,y=Ya().chartColors,C=y[0],E=v>=0?C:"rgb(221, 106, 106)",S=y[1],T=Ci({row:e,columns:t,colIndex:a,colIndex2:r,legendColumn:n,dataFormatting:i});u.push(f.createElement("rect",{key:yi(a,d),"data-test":"squares",className:"square".concat(o.state.activeKey===yi(a,d)?" active":""),x:c(h),y:s(b),width:c.bandwidth(),height:s.bandwidth(),onClick:function(){return o.onSquareClick(e,a,d)},"data-tip":T,"data-for":o.props.chartTooltipID,style:{color:S},fill:E,fillOpacity:o.opacityScale(Math.abs(v))}))}))})),f.createElement("g",null,u)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return o.opacityScale=Et().domain([r,a]).range([0,1]),o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(Xi,"propTypes",vi),mn(Xi,"defaultProps",hi);var Ji=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:0})),o.yScale=$e(an(an({},e),{},{domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:0}))})),mn(Cn(o),"render",(function(){return o.setChartData(o.props),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-heatmap-chart","data-test":"react-autoql-heatmap-chart"},f.createElement(Xi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:o.props.legendColumn})))})),o}return pn(n)}();mn(Ji,"propTypes",pi),mn(Ji,"defaultProps",mi);var Zi=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"state",{activeKey:o.props.activeChartElementKey}),mn(Cn(o),"componentDidMount",(function(){Co()})),mn(Cn(o),"onCircleClick",(function(e,t,n){var a=yi(t,n);o.props.onChartClick({row:e,columnIndex:t,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:a}),o.setState({activeKey:a})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.legendColumn,a=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!a.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var u=[],d=s.bandwidth()||0,p=c.bandwidth()||0,m=Ya().chartColors,g=m[0],v=m[1];return o.props.data.forEach((function(e,m){a.forEach((function(a,h){if(!t[a].isSeriesHidden){var b=e[a],y=Number(b),C=isNaN(y)?0:y,E=e[r],S=l[h].label,T=Ci({row:e,columns:t,colIndex:a,colIndex2:r,legendColumn:n,dataFormatting:i}),D=c(E),x=s(S);u.push(f.createElement("circle",{key:yi(a,m),"data-test":"circles",className:"circle".concat(o.state.activeKey===yi(a,m)?" active":""),cx:D+p/2,cy:x+d/2,r:C<0?0:o.radiusScale(C)/2,onClick:function(){return o.onCircleClick(e,a,m)},"data-tip":T,"data-for":o.props.chartTooltipID,style:{stroke:"transparent",strokeWidth:10,fill:o.state.activeKey===yi(a,m)?v:g,fillOpacity:.7}}))}}))})),f.createElement("g",null,u)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))})));return o.radiusScale=Et().domain([r,a]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),o}return pn(n)}();mn(Zi,"propTypes",vi),mn(Zi,"defaultProps",hi);var $i=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:.1})),o.yScale=$e(an(an({},e),{},{domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:.1}))})),mn(Cn(o),"render",(function(){return o.setChartData(o.props),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},f.createElement(Zi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:o.props.legendColumn})))})),o}return pn(n)}();mn($i,"propTypes",pi),mn($i,"defaultProps",mi);var el=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var c=e.props.data.map((function(t,c){var u=0,d=0;return a.map((function(a,p){if(!n[a].isSeriesHidden){var m,g,v=t[a],h=Number(v),b=isNaN(h)?0:h,y=e.props.colorScale(a);if(!b)return null;if(b>=0){var C=u+b;g=Math.abs(s(b)-s(0)-.5),m=s(u),u=C}else{var E=d+b;g=Math.abs(s(Math.abs(b))-s(0)-.5),m=s(E),d=E}if(g<.05)return null;var S=Ci({row:t,columns:n,colIndex:a,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(a,c),className:"column".concat(e.state.activeKey===yi(a,c)?" active":""),x:m,y:l(t[r]),width:g,height:l.bandwidth(),onClick:function(){return e.onColumnClick(t,a,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:y,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-bars"},c)})),e}return pn(n)}();mn(el,"propTypes",vi),mn(el,"defaultProps",hi);var tl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.yScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"y"}));var r=et(an(an({},e),{},{columnIndices1:a,axis:"x",stacked:!0}));o.xScale=r.scale,o.xTickValues=o.xScale.tickLabels,o.xScale2=r.scale2,o.xTickValues2=null===(n=o.xScale2)||void 0===n?void 0:n.tickLabels})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex],t=o.props.columns[o.props.numberColumnIndex2];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-bar-chart"},f.createElement(el,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,xScale2:o.xScale2,yScale:o.yScale,xCol:e,xCol2:t,yCol:o.props.columns[o.props.stringColumnIndex],linearAxis:"x"})))})),o}return pn(n)}();mn(tl,"propTypes",pi),mn(tl,"defaultProps",mi);var nl=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.legendColumn,a=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!a.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var c=e.props.data.map((function(t,c){var u=0,d=0;return a.map((function(a,p){if(!n[a].isSeriesHidden){var m,g,v=t[a],h=Number(v),b=isNaN(h)?0:h,y=e.props.colorScale(a);if(!b)return null;if(b>=0){var C=u+b;g=Math.abs(l(b)-l(0))-.5,m=l(C)+.5,u=C}else{var E=d+b;g=Math.abs(l(b)-l(0))-.5,m=l(d)+.5,d=E}if(g<.05)return null;var S=Ci({row:t,columns:n,colIndex:a,colIndex2:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:yi(a,c),className:"bar".concat(e.state.activeKey===yi(a,c)?" active":""),x:s(t[r]),y:m,width:s.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,a,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:y,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-columns"},c)})),e}return pn(n)}();mn(nl,"propTypes",vi),mn(nl,"defaultProps",hi);var ol=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var a=et(an(an({},e),{},{columnIndices1:n,axis:"y",stacked:!0}));o.yScale=a.scale})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-column-chart"},f.createElement(nl,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,linearAxis:"y",yGridLines:!0})))})),o}return pn(n)}();mn(ol,"propTypes",pi),mn(ol,"defaultProps",mi);var al=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"onDotClick",(function(t,n,o){var a=yi(n,o);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:a}),e.setState({activeKey:a})})),mn(Cn(e),"createPolygonVertexDot",(function(t,n,o,a,r,i,l){var s=Ci({row:t,columns:e.props.columns,colIndex:r,colIndex2:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return f.createElement("circle",{key:"dot-".concat(yi(r,i)),className:"vertex-dot".concat(e.state.activeKey===yi(r,i)?" active":""),cy:a,cx:o,r:4,onClick:function(){return e.onDotClick(t,r,n)},"data-tip":s,"data-for":e.props.chartTooltipID,style:{opacity:e.state.activeKey===yi(r,i)?1:0,cursor:"pointer",stroke:l,strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),mn(Cn(e),"createPolygon",(function(t,n,o){var a=e.props.stringColumnIndex,r=n.map((function(e){return e.join(",")})).join(" ");return f.createElement("polygon",{key:"polygon-".concat(yi(a,t)),className:"stacked-area".concat(e.state.activeKey===yi(a,t)?" active":""),points:r,"data-tip":"\n <div>\n <strong>Field</strong>: ".concat(e.props.legendLabels[t].label,"\n </div>\n "),"data-for":e.props.chartTooltipID,"data-effect":"float",style:{fill:o,fillOpacity:.7}})})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.props,n=t.columns,o=t.numberColumnIndices,a=t.stringColumnIndex,r=t.yScale,i=t.xScale;if(!o.filter((function(e){return!n[e].isSeriesHidden})).length)return null;var l=[],s=[],c=r.domain()[0];c<0&&(c=0);var u=[],d=[];return i.domain().forEach((function(e){u.push(c),d.push([i(e),r(c)])})),o.forEach((function(t,o){var c=[],p=[];if(!n[t].isSeriesHidden){var m=e.props.colorScale(t);e.props.data.forEach((function(n,l){var d=n[t],f=Number(d),g=isNaN(f)?0:f,v=i(n[a]),h=u[l]+g,b=r(h);if(c[l]=h,p.push([v,b]),0!==g){var y=e.createPolygonVertexDot(n,o,v,b,t,l,m);s.push(y)}}));var f=d.reverse().concat(p);l.push(e.createPolygon(o,f,m)),u=c,d=p}})),f.createElement("g",{"data-test":"stacked-lines"},l,s)})),e}return pn(n)}();mn(al,"propTypes",vi),mn(al,"defaultProps",hi);var rl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x",innerPadding:1,outerPadding:0}));var a=et(an(an({},e),{},{columnIndices1:n,axis:"y",stacked:!0}));o.yScale=a.scale,o.yTickValues=o.yScale.tickLabels})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-line-chart"},f.createElement(al,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,dateColumnsOnly:!0,yGridLines:!0})))})),o}return pn(n)}();mn(rl,"propTypes",pi),mn(rl,"defaultProps",mi);var il=function(e){gn(n,v);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"onPointClick",(function(e,t,n){o.setState({activeKey:n})})),mn(Cn(o),"render",(function(){if(o.props.isLoading)return null;var e=o.props,t=e.columns,n=e.numberColumnIndex,a=e.numberColumnIndex2,r=e.dataFormatting,i=e.yScale,l=e.xScale;if(isNaN(n)||isNaN(a))return null;var s=Ya().chartColors,c=s[0],u=s[1],d=[];return o.props.data.forEach((function(e,s){var p=e[n],m=Number(p),g=isNaN(m)?0:m,v=e[a],h=Number(v),b=isNaN(h)?0:h,y=Ci({row:e,columns:t,colIndex:n,colIndex2:a,dataFormatting:r,aggregated:o.props.aggregated}),C=yi(n,s),E=o.state.activeKey===C;d.push(f.createElement("circle",{key:C,"data-test":"points",className:"point".concat(E?" active":""),cx:l(g),cy:i(b),r:E?6:3,onClick:function(){return o.onPointClick(e,n,C)},"data-tip":y,"data-for":o.props.chartTooltipID,style:{color:u,stroke:"transparent",fill:c,fillOpacity:.7}}))})),f.createElement("g",null,d)}));var a=Tt(e.data.map((function(t){return Tt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Dt(e.data.map((function(t){return Dt(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return o.opacityScale=Et().domain([r,a]).range([0,1]),o.state={activeKey:o.props.activeChartElementKey},o}return pn(n)}();mn(il,"propTypes",vi),mn(il,"defaultProps",hi);var ll=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"setNumberColumnIndices",(function(e){if(o.numberColumnIndex=e.numberColumnIndex,o.numberColumnIndex2=e.numberColumnIndex2,o.numberColumnIndices=e.numberColumnIndices,o.numberColumnIndices2=e.numberColumnIndices2,isNaN(o.numberColumnIndex)||isNaN(o.numberColumnIndex2)){var t=nt(o.props.columns),n=t.numberColumnIndex,a=t.numberColumnIndex2,r=t.numberColumnIndices,i=t.numberColumnIndices2;o.numberColumnIndex=n,o.numberColumnIndex2=a,o.numberColumnIndices=r,o.numberColumnIndices2=i}})),mn(Cn(o),"setChartData",(function(e){var t=o.state,n=t.isXScaled,a=t.isYScaled;o.setNumberColumnIndices(e);var r=ot(e.data,o.numberColumnIndices,n),i=r.maxValue,l=r.minValue;o.xScale=at(an(an({},e),{},{minValue:l,maxValue:i,axis:"x",isScaled:n,columnIndex:o.numberColumnIndex,changeColumnIndices:function(t){return e.changeNumberColumnIndices(t)},allowMultipleSeries:!1}));var s=ot(e.data,o.numberColumnIndices2,a),c=s.maxValue,u=s.minValue;o.yScale=at(an(an({},e),{},{minValue:u,maxValue:c,axis:"y",isScaled:a,columnIndex:o.numberColumnIndex2,changeColumnIndices:function(t){return e.changeNumberColumnIndices(o.numberColumnIndices,t)},allowMultipleSeries:!1})),o.xScale.secondScale=o.yScale,o.yScale.secondScale=o.xScale})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e={numberColumnIndex:o.numberColumnIndex,numberColumnIndex2:o.numberColumnIndex2,numberColumnIndices:o.numberColumnIndices,numberColumnIndices2:o.numberColumnIndices2};return f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart react-autoql-scatterplot-chart","data-test":"react-autoql-scatterplot-chart"},f.createElement(il,fn({},o.props,{xScale:o.xScale,yScale:o.yScale},e)),f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,xCol:o.props.columns[o.numberColumnIndex],yCol:o.props.columns[o.numberColumnIndex2]},e)))})),o.state={isXScaled:!0,isYScaled:!0},o}return pn(n)}();mn(ll,"propTypes",pi),mn(ll,"defaultProps",mi);var sl=function(e){gn(n,v);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"setChartData",(function(e){var t,n,a,r,i=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(i=e.visibleSeriesIndices);var l=e.numberColumnIndices2;null!==(n=e.visibleSeriesIndices2)&&void 0!==n&&n.length&&(l=e.visibleSeriesIndices2),o.xScale=$e(an(an({},e),{},{columnIndex:e.stringColumnIndex,axis:"x"}));var s=et(an(an({},e),{},{columnIndices1:i,columnIndices2:l,axis:"y",isScaled:null===(a=o.state)||void 0===a?void 0:a.isChartScaled}));o.yScale=s.scale,o.yTickValues=o.yScale.tickLabels,o.yScale2=s.scale2,o.yTickValues2=null===(r=o.yScale2)||void 0===r?void 0:r.tickLabels})),mn(Cn(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),mn(Cn(o),"render",(function(){o.setChartData(o.props);var e=o.props.columns[o.props.numberColumnIndex],t=o.props.columns[o.props.numberColumnIndex2];return o.props.height&&o.props.width?f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-line-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,yScale2:o.yScale2,xCol:o.props.columns[o.props.stringColumnIndex],yCol:e,yCol2:t,linearAxis:"y",toggleChartScale:o.toggleChartScale,yGridLines:!0}),f.createElement(Vi,fn({},o.props,{xScale:o.xScale,yScale:o.yScale})),!!o.yScale2&&f.createElement(ji,fn({},o.props,{numberColumnIndices:o.props.numberColumnIndices2,xScale:o.xScale,yScale:o.yScale2,colorScale:o.props.colorScale2})))):null})),o.state={isChartScaled:!0},o}return pn(n)}();mn(sl,"propTypes",pi),mn(sl,"defaultProps",mi);var cl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentWillUnmount",(function(){clearTimeout(o.debounceTimer),clearTimeout(o.throttleTimer)})),mn(Cn(o),"componentDidUpdate",(function(e,t){o.state.value!==t.value&&(o.props.throttle?o.throttledOnChange(o.state.value):o.props.debounce?o.debouncedOnChange(o.state.value):o.props.onChange(o.state.value))})),mn(Cn(o),"debouncedOnChange",(function(e){o.props.debounce?(clearTimeout(o.debounceTimer),o.debounceTimer=setTimeout((function(){o.props.onChange(e)}),o.props.debounceDelay)):o.props.onChange(e)})),mn(Cn(o),"throttledOnChange",(function(e){o.inThrottle||(o.props.onChange(e),o.inThrottle=!0,o.throttleTimer=setTimeout((function(){return o.inThrottle=!1}),o.props.throttleDelay))})),mn(Cn(o),"onInputChange",(function(e){var t=e.target.value,n=o.isValueValidForSlider(t)?Number(t):o.state.value;o.setState({inputValue:t,value:n})})),mn(Cn(o),"onInputBlur",(function(){o.state.inputValue!==o.state.value&&o.setState({inputValue:o.state.value})})),mn(Cn(o),"isValueValidForSlider",(function(e){var t=Number(e);return!isNaN(e)&&t>=o.props.min&&t<=o.props.max})),mn(Cn(o),"onSliderChange",(function(e){o.setState({value:e,inputValue:e})})),mn(Cn(o),"renderThumb",(function(e,t){var n=t.valueNow;return o.props.renderThumbNumber&&o.props.valueFormatter&&(n=o.props.valueFormatter(t.valueNow)),f.createElement("div",e,!!o.props.renderThumbNumber&&f.createElement("div",{className:"react-autoql-slider-value-bubble"},n))})),mn(Cn(o),"render",(function(){var e,t,n,a=o.props.min,r=o.props.max,i=void 0;isNaN(o.props.step)||(i="".concat(o.props.step)),isNaN(a)&&(a=0),isNaN(r)&&(r=100);var l=[a,r];return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-slider-wrapper ".concat(null!==(e=o.props.className)&&void 0!==e?e:""," ").concat(Pe?"mobile":""),style:o.props.style},f.createElement("div",{className:"react-autoql-slider-and-label-container"},f.createElement("div",{className:"react-autoql-slider-container"},f.createElement("div",{className:"react-autoql-slider-min-max-labels"},f.createElement("div",{className:"react-autoql-slider-mark-label"},null!==(t=o.props.minLabel)&&void 0!==t?t:a),f.createElement("label",{id:"react-autoql-slider-label",className:"react-autoql-slider-label"},o.props.label),f.createElement("div",{className:"react-autoql-slider-mark-label"},null!==(n=o.props.maxLabel)&&void 0!==n?n:r)),f.createElement(_t,{className:"react-autoql-slider",thumbClassName:"react-autoql-slider-thumb",trackClassName:"react-autoql-slider-track",markClassName:"react-autoql-slider-mark",ariaLabelledby:"react-autoql-slider-label",thumbActiveClassName:"react-autoql-slider-thumb-active",min:a,max:r,step:o.props.step,marks:l,value:o.state.value,onChange:o.onSliderChange,renderThumb:o.renderThumb}))),o.props.showInput&&f.createElement("div",{className:"react-autoql-slider-input-wrapper"},f.createElement(xr,{type:"number",value:"".concat(o.state.inputValue),onChange:o.onInputChange,onBlur:o.onInputBlur,min:a,max:r,step:i}))))})),o.state={value:e.initialValue,inputValue:e.initialValue},o}return pn(n)}();mn(cl,"propTypes",{renderThumbNumber:b.bool,initialValue:b.number,min:b.number,max:b.number,minLabel:b.string,maxLabel:b.string,marks:b.oneOfType([b.number,b.array,b.bool]),debounce:b.bool,debounceDelay:b.number,showInput:b.bool,label:b.string,step:b.number,onChange:b.func}),mn(cl,"defaultProps",{renderThumbNumber:!0,initialValue:void 0,min:0,max:100,minLabel:void 0,maxLabel:void 0,marks:10,debounce:!1,throttle:!0,debounceDelay:20,throttleDelay:20,showInput:!1,label:void 0,step:1,onChange:function(){}});var ul=function(e){gn(n,v);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),mn(Cn(e),"componentDidMount",(function(){Co()})),mn(Cn(e),"componentDidUpdate",(function(t){var n,o;(null===(n=t.buckets)||void 0===n?void 0:n.length)!==(null===(o=e.props.buckets)||void 0===o?void 0:o.length)&&Co()})),mn(Cn(e),"onColumnClick",(function(t,n,o){var a,r=yi(o);e.props.onChartClick({activeKey:r,filter:{name:null===(a=e.props.columns[e.props.numberColumnIndex])||void 0===a?void 0:a.name,value:"".concat(t,",").concat(n),operator:"between",column_type:"AMOUNT"}}),e.setState({activeKey:r})})),mn(Cn(e),"getBars",(function(){var t,n=e.props,o=n.xScale,a=n.yScale,r=n.buckets;if(!o||!a||null==r||!r.length)return null;var i=null===(t=Ya())||void 0===t||null===(t=t.chartColors)||void 0===t?void 0:t[0];return e.props.buckets.map((function(t,n){if(!t)return null;var r=o.getValue(t.x0)+1,l=a(t.length),s=Math.max(0,o.getValue(t.x1)-o.getValue(t.x0)-1),c=a(0)-a(t.length),u=aa({element:t.x0,column:o.column,config:o.dataFormatting}),d=aa({element:t.x1,column:o.column,config:o.dataFormatting}),p="<div><strong>".concat(o.title," (Range):</strong> ").concat(u," - ").concat(d,"</div>\n <div><strong>Count:</strong> ").concat(t.length,"</div>"),m=yi(n);return f.createElement("rect",{key:m,className:"bar".concat(e.state.activeKey===m?" active":""),"data-test":"bar-".concat(n),x:r,y:l,height:c,width:s,onClick:function(){return e.onColumnClick(t.x0,t.x1,n)},"data-tip":p,"data-for":e.props.chartTooltipID,style:{fill:i,fillOpacity:1,cursor:"default"}})}))})),mn(Cn(e),"render",(function(){if(e.props.isLoading)return null;var t=e.getBars();return f.createElement("g",{"data-test":"columns"},t)})),e}return pn(n)}();mn(ul,"propTypes",vi),mn(ul,"defaultProps",hi);var dl=function(e){var t=e.value,n=e.mean,o=e.stdDev;return Ft.normal.pdf(t,n,o)},pl=function(e){var t=e.value,n=1/e.mean;return Ft.exponential.pdf(t,n)},ml=["d","key","className","strokeWidth","stroke","fill","tooltip"],fl=function(e){gn(n,v);var t=Sn(n);function n(e){var o,a,r;un(this,n),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){Co()})),mn(Cn(r),"createEquallySpacedPoints",(function(e,t){var n=e[0],o=(e[1]-n)/(t-1);return Tn(Array(t).keys()).map((function(e){return n+e*o}))})),mn(Cn(r),"formatValue",(function(e){var t;return aa({element:e,column:null===(t=r.props.xScale)||void 0===t?void 0:t.column,config:r.props.dataFormatting})})),mn(Cn(r),"createPathWithHoverStroke",(function(e){var t=e.d,n=e.key,o=e.className,a=e.strokeWidth,i=void 0===a?1:a,l=e.stroke,s=e.fill,c=void 0===s?"none":s,u=e.tooltip,d=yn(e,ml);return f.createElement("g",{key:"".concat(n,"-group")},f.createElement("path",fn({d:t,key:n,className:o,stroke:l,strokeWidth:1,fill:c,style:{color:l}},d)),f.createElement("path",{d:t,key:"".concat(n,"-hover"),className:"path-hover-line","data-tip":u,"data-for":r.props.chartTooltipID,"data-effect":"float",stroke:"transparent",strokeWidth:i+5,fill:"none"}))})),mn(Cn(r),"getScaledBucketProbability",(function(e,t){return e.fn({value:t,mean:r.mean,stdDev:r.stdDev,median:r.median,dataSize:r.props.data.length})*r.scaleFactor})),mn(Cn(r),"getDistributionLines",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=r.props,o=n.xScale,a=n.yScale,i=n.colorScale,l=i(t+1),s=[],c=a.range(),u=o.range(),d=r.createEquallySpacedPoints(o.domain(),1e3),p=[],m=[];if(d.forEach((function(t,n){var i=r.getScaledBucketProbability(e,t),l=o.getValue(t),s=a.getValue(i);s<c[0]&&s>c[1]?m.push([l,s]):m.length&&(p.push(m),m=[]),n===(null==d?void 0:d.length)-1&&m.length&&p.push(m)})),p.forEach((function(n){s.push(r.createPathWithHoverStroke({d:Ki(n,r.PATH_SMOOTHING),key:"distribution-line-".concat(e.type,"-").concat(r.COMPONENT_KEY,"-").concat(t),tooltip:e.tooltip({mean:r.mean,stdDev:r.stdDev}),className:"distribution-line",stroke:r.props.colorScale(t+1)}))})),r.TYPES_WITH_MEAN.includes(e.type)){var f=r.getScaledBucketProbability(e,r.mean),g=a.getValue(f);g>c[0]&&(g=c[0]);var v=r.props.xScale(r.mean),h=[v,c[1]],b=[v,c[0]],y=[h,b],C=r.createPathWithHoverStroke({d:Ki(y,0),key:"distribution-mean-line-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Mean: ".concat(r.formatValue(r.mean)),stroke:l,strokeDasharray:6});s.push(C)}if(r.TYPES_WITH_STD_DEV.includes(e.type)){var E=r.mean-r.stdDev,S=o.getValue(E);if(S>=u[0]){var T=r.getScaledBucketProbability(e,E),D=a.getValue(T);D<c[1]&&(D=c[1]);var x=[S,a.getValue(T)],R=[S,a.getValue(0)],I=[R,x],A=r.createPathWithHoverStroke({d:Ki(I,0),key:"distribution-stddev-line-left-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Standard Deviation: ±".concat(r.formatValue(r.stdDev)),stroke:l,strokeDasharray:6});s.push(A)}var N=r.mean+r.stdDev,w=o.getValue(N);if(w<=u[1]){var k=r.getScaledBucketProbability(e,N),P=a.getValue(k);P<c[1]&&(P=c[1]);var O=[w,P],L=[w,r.props.yScale(0)],M=[L,O],q=r.createPathWithHoverStroke({d:Ki(M,0),key:"distribution-stddev-line-right-".concat(r.COMPONENT_KEY,"-").concat(t),className:"distribution-mean-line",tooltip:"Standard Deviation: ±".concat(r.formatValue(r.stdDev)),stroke:l,strokeDasharray:6});s.push(q)}}return s})),mn(Cn(r),"render",(function(){var e,t;if(!r.state.activeDistribution||r.props.isLoading)return null;var n=r.DISTRIBUTION_TYPES.find((function(e){return e.type===r.state.activeDistribution}));if(!n)return null;var o=r.props,a=o.xScale,i=o.yScale,l=o.numberColumnIndex,s=o.data,c=o.buckets;if(!a||!i||null==s||!s.length||isNaN(l)||null==c||!c.length)return null;var u=s.map((function(e){return e[l]})),d=null!==(e=c[1])&&void 0!==e?e:c[0];r.mean=xt(u),r.stdDev=Rt(u),r.median=It(u),r.bucketSize=d.x1-d.x0,r.scaleFactor=r.bucketSize*(null===(t=r.props.data)||void 0===t?void 0:t.length);var p=r.getDistributionLines(n);return f.createElement("g",{"data-test":"distribution-lines"},p)})),r.PATH_SMOOTHING=.2,r.COMPONENT_KEY=C();var i=new Intl.NumberFormat(null!==(o=null===(a=e.dataFormatting)||void 0===a?void 0:a.languageCode)&&void 0!==o?o:"en-US",{maximumFractionDigits:5});return r.DISTRIBUTION_TYPES=[{type:"normal",fn:dl,tooltip:function(e){var t=e.mean,n=e.stdDev;return"Normal Distribution<br/>Mean: ".concat(r.formatValue(t),"<br/>Standard Deviation: ±").concat(r.formatValue(n))}},{type:"exponential",fn:pl,tooltip:function(e){var t=e.mean;return"Exponential Distribution<br/>Lambda: ".concat(i.format(1/t))}}],r.TYPES_WITH_MEAN=["normal"],r.TYPES_WITH_STD_DEV=["normal"],r.state={activeDistribution:void 0},r}return pn(n)}();mn(fl,"propTypes",vi),mn(fl,"defaultProps",hi);var gl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){var n=Ma(o.props,e),a=Ma(o.state,t);return!n||!a})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"getDefaultBucketConfig",(function(e,t){var n,o,a={bucketSize:t,minBucketSize:void 0,maxBucketSize:void 0,minNumBuckets:5,maxNumBuckets:20,bucketStepSize:1};return(null==e||null===(n=e.data)||void 0===n?void 0:n.length)<5&&(a.minNumBuckets=2),(null==e||null===(o=e.data)||void 0===o?void 0:o.length)<20&&(a.maxNumBuckets=e.data.length),a})),mn(Cn(o),"getInitialBucketSize",(function(e,t){var n,a=Math.round(1+Math.log2(null===(n=o.props.data)||void 0===n?void 0:n.length)),r=_a((t-e)/a,o.bucketConfig.bucketStepSize);return r<o.bucketConfig.minBucketSize?r=o.bucketConfig.minBucketSize:r>o.bucketConfig.maxBucketSize&&(r=o.bucketConfig.maxBucketSize),r})),mn(Cn(o),"getBinData",(function(e){var t,n,a,r,i=Dt(o.props.data,(function(e){return Ei(e[o.props.numberColumnIndex])})),l=Tt(o.props.data,(function(e){return Ei(e[o.props.numberColumnIndex])}));i===l&&(i-=1,l+=1);var s,c,u=(l-i)/(null!==(t=o.bucketConfig.minNumBuckets)&&void 0!==t?t:1)-(l-i)/(null!==(n=o.bucketConfig.maxNumBuckets)&&void 0!==n?n:1);if(u<=10){o.bucketConfig.bucketStepSize=(s=u/100,c=Math.pow(10,Math.ceil(Math.log10(s))),parseFloat(c.toPrecision(1)))}o.bucketConfig.maxBucketSize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.floor(e/t)*t}((l-i)/(null!==(a=o.bucketConfig.minNumBuckets)&&void 0!==a?a:1),o.bucketConfig.bucketStepSize),o.bucketConfig.minBucketSize=_a((l-i)/(null!==(r=o.bucketConfig.maxNumBuckets)&&void 0!==r?r:1),o.bucketConfig.bucketStepSize),o.bucketConfig.minBucketSize<=0&&(o.bucketConfig.minBucketSize=o.bucketConfig.bucketStepSize),o.bucketConfig.maxBucketSize===o.bucketConfig.minBucketSize&&(o.bucketConfig.maxBucketSize=o.bucketConfig.minBucketSize+o.bucketConfig.bucketStepSize),e<o.bucketConfig.maxBucketSize&&e>o.bucketConfig.minBucketSize?o.bucketConfig.bucketSize=e:o.bucketConfig.bucketSize=void 0,o.bucketConfig.bucketSize||(o.bucketConfig.bucketSize=o.getInitialBucketSize(i,l));for(var d=_a(i,o.bucketConfig.bucketSize),p=[d];d<l;)d+=o.bucketConfig.bucketSize,p.push(d);return{buckets:At().value((function(e){return e[o.props.numberColumnIndex]})).domain([p[0],p[p.length-1]]).thresholds(p)(o.props.data),bins:p}})),mn(Cn(o),"changeNumberColumnIndices",(function(e,t,n){var a=Dt(o.props.data,(function(t){return Ei(t[e[0]])})),r=Tt(o.props.data,(function(t){return Ei(t[e[0]])}));o.setInitialBucketSize(a,r),o.props.changeNumberColumnIndices(e,t,n,bucketSize)})),mn(Cn(o),"setChartData",(function(e,t){o.xScale&&o.props.numberColumnIndex!==o.xScale.columnIndex&&(o.props.onBucketSizeChange(void 0),o.bucketConfig=o.getDefaultBucketConfig(e));var n=e.data.map((function(t){return t[e.numberColumnIndex]})).filter(Xo).length;n<o.bucketConfig.maxBucketSize&&(o.bucketConfig.maxNumBuckets=n);var a=o.getBinData(t),r=a.buckets,i=a.bins;o.buckets=r,o.bins=i,o.xScale=rt(an(an({},e),{},{columnIndex:e.numberColumnIndex,axis:"x",buckets:o.buckets,bins:i})),o.yScale=it(an(an({},e),{},{axis:"y",buckets:o.buckets,columnIndex:e.numberColumnIndex}))})),mn(Cn(o),"onBucketSizeChange",(function(e){o.setState({bucketSize:e}),o.props.onBucketSizeChange(e)})),mn(Cn(o),"formatSliderLabel",(function(e){var t,n=o.bucketConfig.bucketStepSize<1?o.bucketConfig.bucketStepSize.toString().split(".")[1].length:void 0;return null===(t=Ze({d:e,column:o.props.columns[o.props.numberColumnIndex],dataFormatting:o.props.dataFormatting,scale:o.xScale,sigDigits:n}))||void 0===t?void 0:t.fullWidthLabel})),mn(Cn(o),"renderHistogramSlider",(function(){if(isNaN(o.bucketConfig.bucketSize)||isNaN(o.bucketConfig.minBucketSize)||isNaN(o.bucketConfig.maxBucketSize))return null;var e=o.bucketConfig.minBucketSize,t=o.bucketConfig.maxBucketSize;return f.createElement(cl,{key:"".concat(o.HISTOGRAM_SLIDER_KEY,"-").concat(o.props.numberColumnIndex),className:"react-autoql-histogram-slider",initialValue:o.bucketConfig.bucketSize,min:e,max:t,step:o.bucketConfig.bucketStepSize,minLabel:o.formatSliderLabel(e),maxLabel:o.formatSliderLabel(t),onChange:o.onBucketSizeChange,valueFormatter:o.formatSliderLabel,label:"Interval size",showInput:!0,marks:!0})})),mn(Cn(o),"render",(function(){return o.setChartData(o.props,o.state.bucketSize),f.createElement(f.Fragment,null,o.props.portalRef&&Vt(o.renderHistogramSlider(),o.props.portalRef),f.createElement("g",{ref:function(e){return o.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-histogram-chart"},f.createElement(qi,fn({},o.props,{ref:function(e){return o.axesRef=e},chartRef:o.chartRef,xScale:o.xScale,yScale:o.yScale,changeNumberColumnIndices:o.changeNumberColumnIndices,linearAxis:"y",yGridLines:!0}),f.createElement(ul,fn({},o.props,{xScale:o.xScale,yScale:o.yScale,buckets:o.buckets,bins:o.bins})),f.createElement(fl,fn({},o.props,{xScale:o.xScale,yScale:o.yScale,buckets:o.buckets})))))})),o.bucketConfig=o.getDefaultBucketConfig(e,e.initialBucketSize),o.state={bucketSize:e.initialBucketSize},o.setChartData(o.props,e.initialBucketSize),o}return pn(n)}();mn(gl,"propTypes",an(an({},pi),{},{initialBucketSize:y.number,onBucketSizeChange:y.func})),mn(gl,"defaultProps",an(an({},mi),{},{initialBucketSize:void 0,onBucketSizeChange:function(){}}));var vl=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;un(this,o),mn(Cn(a=t.call(this,e)),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),mn(Cn(a),"componentDidMount",(function(){a._isMounted=!0,a.props.isResizing||a.props.hidden||(a.firstRender=!1,a.forceUpdate())})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){if(a.props.isResizing&&!e.isResizing)return a.shouldRecalculateDimensions=!0,!0;if(a.props.dataChangeCount!==e.dataChangeCount)return!0;if(e.isResizing&&a.props.isResizing||e.hidden&&a.props.hidden)return!1;var n=Ma(a.props,e),o=Ma(a.state,t);return!n||!o})),mn(Cn(a),"componentDidUpdate",(function(e){if(a._isMounted){if(!0!==a.firstRender||a.props.hidden||(a.firstRender=!1),a.props.hidden&&!e.hidden&&(a.firstRender=!0),(!a.props.isResizing&&e.isResizing&&!a.props.hidden||!a.props.hidden&&e.hidden)&&(a.chartContainerRef&&(a.chartContainerRef.style.flexBasis="100vh"),a.setState({chartID:C(),deltaX:0,deltaY:0,isLoading:!0})),a.props.type!==e.type&&eo.includes(a.props.type)&&!Uo(a.props.columns[a.props.stringColumnIndex])){var t=jo(a.props.columns);a.props.changeStringColumnIndex(t)}else if(a.props.type!==e.type&&to.includes(a.props.type)){var o=a.props.numberColumnIndices.filter((function(e){return a.props.numberColumnIndices2.includes(e)}));if(!(null==o||!o.length)){console.debug("Selected columns already exist on the other axis. Exiting");var r=a.props.numberColumnIndices.filter((function(e){return!a.props.numberColumnIndices2.includes(e)}));a.props.changeNumberColumnIndices(r,a.props.numberColumnIndices2)}}if(a._isMounted&&(!a.props.isDrilldownChartHidden&&e.isDrilldownChartHidden||e.type&&a.props.type!==e.type)&&a.setState({chartID:C(),deltaX:0,deltaY:0,isLoading:!0}),function(e,t){var o,a;return(null===(o=e.data)||void 0===o?void 0:o.length)!==(null===(a=t.data)||void 0===a?void 0:a.length)||e.stringColumnIndex!==t.stringColumnIndex||e.numberColumnIndex!==t.numberColumnIndex||!n(e.legendColumn,t.legendColumn)||!n(e.columns,t.columns)||!n(e.numberColumnIndices,t.numberColumnIndices)||!n(e.stringColumnIndices,t.stringColumnIndices)||"pie"===e.type&&!n(e.data,t.data)}(a.props,e)||a.props.dataChangeCount!==e.dataChangeCount){var i=a.getData(a.props);a.setState({data:i,chartID:C(),deltaX:0,deltaY:0,isLoading:!0})}}})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.adjustVerticalPositionTimeout)})),mn(Cn(a),"getColorScales",(function(){var e,t,n=a.props,o=n.numberColumnIndices,r=n.numberColumnIndices2,i=Ya(),l=i.chartColors,s=function(e,t){var n=Tn(e);(t%=e.length)<0&&(t=e.length+t);for(var o=0;o<t;o++)n.unshift(n.pop());return n}(i.chartColorsDark,-1*(null!==(e=null==o?void 0:o.length)&&void 0!==e?e:1)),c=Ct().range(l).domain(o);return null!=r&&r.length&&(t=Ct().range(s).domain(r)),{colorScale:c,colorScale2:t}})),mn(Cn(a),"getData",(function(e){var t,n;if(null!==(t=e.data)&&void 0!==t&&t.length&&null!==(n=e.columns)&&void 0!==n&&n.length){if(e.isDataAggregated)return ka(e.data,e.columns,"asc");var o,a,r=null!==(o=e.numberColumnIndices)&&void 0!==o?o:[],i=null!==(a=e.numberColumnIndices2)&&void 0!==a?a:[],l=[].concat(Tn(r),Tn(i)).filter(Xo);if(l.length)return lt({data:e.data,aggColIndex:e.stringColumnIndex,columns:e.columns,numberIndices:l,dataFormatting:e.dataFormatting})}})),mn(Cn(a),"setFinishedLoading",(function(){clearTimeout(a.loadingTimeout),a.loadingTimeout=setTimeout((function(){a._isMounted&&a.setState({isLoading:!1})}),0)})),mn(Cn(a),"adjustVerticalPosition",(function(){a.props.hidden||(clearTimeout(a.adjustVerticalPositionTimeout),a.adjustVerticalPositionTimeout=setTimeout((function(){if(a._isMounted){var e=a.getDeltas().deltaY,t=a.getInnerDimensions().innerHeight;a.setState({deltaY:e,innerHeight:t},(function(){a.setFinishedLoading()}))}}),0))})),mn(Cn(a),"adjustChartPosition",(function(){a.props.hidden||(clearTimeout(a.adjustPositionTimeout),a.adjustPositionTimeout=setTimeout((function(){if(a._isMounted){var e=a.getDeltas(),t=e.deltaX,n=e.deltaY,o=a.getInnerDimensions(),r=o.innerHeight,i=o.innerWidth;a.setState({deltaX:t,deltaY:n,innerHeight:r,innerWidth:i},(function(){a.adjustVerticalPosition()}))}}),0))})),mn(Cn(a),"getDeltas",(function(){var e,t,n;if("pie"===a.props.type)return{deltaX:0,deltaY:0};var o=ia(null===(e=a.innerChartRef)||void 0===e?void 0:e.chartRef);return{deltaX:-1*Math.ceil(null!==(t=null==o?void 0:o.x)&&void 0!==t?t:0)+a.PADDING,deltaY:-1*Math.ceil(null!==(n=null==o?void 0:o.y)&&void 0!==n?n:0)+a.PADDING}})),mn(Cn(a),"getRenderedChartDimensions",(function(){var e,t,n,o,r,i,l,s,c,u=null===(e=a.innerChartRef)||void 0===e||null===(e=e.axesRef)||void 0===e||null===(e=e.leftAxis)||void 0===e||null===(e=e.ref)||void 0===e?void 0:e.getBoundingClientRect(),d=null===(t=a.innerChartRef)||void 0===t||null===(t=t.axesRef)||void 0===t||null===(t=t.topAxis)||void 0===t||null===(t=t.ref)||void 0===t?void 0:t.getBoundingClientRect(),p=null===(n=a.innerChartRef)||void 0===n||null===(n=n.axesRef)||void 0===n||null===(n=n.bottomAxis)||void 0===n?void 0:n.getBoundingClientRect(),m=null===(o=a.innerChartRef)||void 0===o||null===(o=o.axesRef)||void 0===o||null===(o=o.rightAxis)||void 0===o?void 0:o.getBoundingClientRect(),f=null===(r=a.innerChartRef)||void 0===r||null===(r=r.axesRef)||void 0===r||null===(r=r.legendRef)||void 0===r||null===(r=r.legendClippingContainer)||void 0===r?void 0:r.getBoundingClientRect(),g=Ti([u,p,m,d,f]),v=null!==(i=null==g?void 0:g.width)&&void 0!==i?i:0;return{chartHeight:null!==(l=null==g?void 0:g.height)&&void 0!==l?l:0,chartWidth:v,chartX:null!==(s=null==g?void 0:g.x)&&void 0!==s?s:0,chartY:null!==(c=null==g?void 0:g.y)&&void 0!==c?c:0}})),mn(Cn(a),"getInnerDimensions",(function(){var e,t,n,o,r,i,l=a.getRenderedChartDimensions(),s=l.chartWidth,c=l.chartHeight,u="number"==typeof a.props.width?a.props.width:void 0,d="number"==typeof a.props.height?a.props.height:void 0,p=null!==(e=null!=u?u:null===(t=a.chartContainerRef)||void 0===t?void 0:t.clientWidth)&&void 0!==e?e:0,m=null!==(n=null!=d?d:null===(o=a.chartContainerRef)||void 0===o?void 0:o.clientHeight)&&void 0!==n?n:0,f=p-2*a.PADDING;null!==(r=a.innerChartRef)&&void 0!==r&&r.xScale&&s&&(f=p-(s-(a.innerChartRef.xScale.range()[1]-a.innerChartRef.xScale.range()[0]))-2*a.PADDING);var g=m-2*a.PADDING;null!==(i=a.innerChartRef)&&void 0!==i&&i.yScale&&c&&(g=m-(c-(a.innerChartRef.yScale.range()[0]-a.innerChartRef.yScale.range()[1]))-2*a.PADDING);return f<1&&(f=1),g<1&&(g=1),{innerWidth:f,innerHeight:g}})),mn(Cn(a),"getOuterDimensions",(function(){var e={outerHeight:a.outerHeight,outerWidth:a.outerWidth};if(a.props.hidden||a.props.isAnimating||a.firstRender)return e;if(!a.outerWidth||!a.outerHeight||a.shouldRecalculateDimensions){var t,n,o;a.shouldRecalculateDimensions=!1;var r=null===(t=a.chartContainerRef)||void 0===t?void 0:t.getBoundingClientRect(),i=null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0,l=null!==(o=null==r?void 0:r.height)&&void 0!==o?o:0,s=Math.ceil(i),c=Math.ceil(l);return a.outerWidth=s,a.outerHeight=c,{outerHeight:c,outerWidth:s}}return e})),mn(Cn(a),"getLegendLabels",(function(){var e;return Xe(a.props.columns,null===(e=a.getColorScales())||void 0===e?void 0:e.colorScale,a.props.numberColumnIndices)})),mn(Cn(a),"getBase64Data",(function(e){return a.chartRef?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return new Promise((function(n,o){try{var a=e.getBoundingClientRect(),r=a.width,i=a.height,l=r*t,s=i*t,c=e.cloneNode(!0);c.setAttribute("transform-origin","top left"),c.setAttribute("transform","scale(".concat(t,")")),c.setAttribute("width",l+"px"),c.setAttribute("height",s+"px");var u=ra(c),d=document.createElement("canvas");d.style.width=r+"px",d.style.height=i+"px",d.width=l,d.height=s;var p=d.getContext("2d"),m=new Image;m.onload=function(){p.drawImage(this,0,0,l,s),n(d.toDataURL("image/png",1))},m.onerror=function(){o("failed to load image")},m.src=u}catch(e){console.error(e),o("failed to convert svg to png "+e)}}))}(a.chartRef,e):Promise.reject()})),mn(Cn(a),"saveAsPNG",(function(e){try{a.getBase64Data(e).then((function(e){var t=document.createElement("a");t.download="Chart.png",t.href=e,t.click()}))}catch(e){return void console.error(e)}})),mn(Cn(a),"setIsLoadingMoreRows",(function(e){a._isMounted&&a.setState({isLoadingMoreRows:e})})),mn(Cn(a),"onBucketSizeChange",(function(e){a.props.onBucketSizeChange(e),a.bucketSize=e})),mn(Cn(a),"renderChartHeader",(function(){var e=a.state.deltaX-10;return(Pe||e<0||a.outerWidth<300)&&(e=25),f.createElement("div",{ref:function(e){return a.sliderRef=e},style:{paddingLeft:e},className:"react-autoql-chart-header-container ".concat(a.state.isLoading||a.props.isResizing?"loading":"")})})),mn(Cn(a),"getCommonChartProps",(function(){var e,t=a.state,n=t.deltaX,o=t.deltaY,r=a.props,i=r.numberColumnIndices,l=r.columns,s=r.enableDynamicCharting,c=i.filter((function(e){return(null==l?void 0:l[e])&&!l[e].isSeriesHidden})),u=a.getInnerDimensions(),d=u.innerHeight,p=u.innerWidth,m=a.getOuterDimensions(),f=m.outerHeight,g=m.outerWidth,v=a.getColorScales(),h=v.colorScale,b=v.colorScale2,y=!yo.includes(a.props.type),C=(y?a.state.data:null)||a.props.data;return an(an({},a.props),{},{columns:l,setIsLoadingMoreRows:a.setIsLoadingMoreRows,ref:function(e){return a.innerChartRef=e},innerChartRef:null===(e=a.innerChartRef)||void 0===e?void 0:e.chartRef,key:void 0,data:C,aggregated:y,disableTimeScale:a.disableTimeScale,colorScale:h,colorScale2:b,height:d,width:p,outerHeight:f,outerWidth:g,deltaX:n,deltaY:o,chartPadding:a.PADDING,enableAxisDropdown:s&&!a.props.isAggregated,legendLocation:Si(i,a.props.type,a.props.legendLocation),onLabelRotation:a.adjustVerticalPosition,visibleSeriesIndices:c,tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID,chartContainerRef:a.chartContainerRef,popoverParentElement:a.props.popoverParentElement,totalRowCount:a.props.totalRowCount,chartID:a.state.chartID,isLoading:a.state.isLoading,changeNumberColumnIndices:a.props.changeNumberColumnIndices,onAxesRenderComplete:a.adjustChartPosition})})),mn(Cn(a),"renderChartLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(Ro,null)))})),mn(Cn(a),"renderChart",(function(){var e=a.getCommonChartProps();switch(a.props.type){case"column":return f.createElement(_i,fn({},e,{legendLabels:a.getLegendLabels()}));case"bar":return f.createElement(zi,fn({},e,{legendLabels:a.getLegendLabels()}));case"line":return f.createElement(Wi,fn({},e,{legendLabels:a.getLegendLabels()}));case"pie":return f.createElement(Gi,fn({},e,{legendLabels:a.getLegendLabels()}));case"bubble":return f.createElement($i,fn({},e,{legendLabels:a.getLegendLabels()}));case"heatmap":return f.createElement(Ji,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_column":return f.createElement(ol,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_bar":return f.createElement(tl,fn({},e,{legendLabels:a.getLegendLabels()}));case"stacked_line":return f.createElement(rl,fn({},e,{legendLabels:a.getLegendLabels()}));case"column_line":var t,n=null===(t=a.props.numberColumnIndices2)||void 0===t?void 0:t.filter((function(e){var t;return(null===(t=a.props.columns)||void 0===t?void 0:t[e])&&!a.props.columns[e].isSeriesHidden}));return f.createElement(sl,fn({},e,{visibleSeriesIndices2:n,legendLabels:a.getLegendLabels()}));case"histogram":return f.createElement(gl,fn({},e,{initialBucketSize:a.bucketSize,onBucketSizeChange:a.onBucketSizeChange,portalRef:a.sliderRef}));case"scatterplot":return f.createElement(ll,e);default:return"Unknown Display Type"}})),mn(Cn(a),"render",(function(){var e;if(null===(e=a.state.data)||void 0===e||!e.length)return null;var t=Ua("font-family"),n=Ua("text-color-primary"),o=Ua("background-color-secondary");return f.createElement(Rn,null,f.createElement(f.Fragment,null,a.renderChartHeader(),f.createElement("div",{id:"react-autoql-chart-".concat(a.state.chartID),key:"react-autoql-chart-".concat(a.state.chartID),ref:function(e){return a.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container\n ".concat(a.state.isLoading||a.props.isResizing?"loading":"","\n ").concat(a.state.isLoadingMoreRows?"loading-rows":"","\n ").concat(a.props.hidden?"hidden":"")},!a.firstRender&&!a.props.isResizing&&!a.props.isAnimating&&f.createElement("svg",{ref:function(e){return a.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",style:{fontSize:"12px",fontFamily:t,color:n,background:o}},f.createElement("g",{transform:"translate(".concat(a.state.deltaX,", ").concat(a.state.deltaY,")"),className:"react-autoql-chart-content-container"},a.renderChart())),a.state.isLoadingMoreRows&&a.renderChartLoader())))}));var r=a.getData(e);return a.PADDING=0,a.FONT_SIZE=12,a.HISTOGRAM_SLIDER_KEY=C(),a.firstRender=!0,a.bucketSize=e.bucketSize,a.shouldRecalculateDimensions=!1,a.state={chartID:C(),data:r,deltaX:0,deltaY:0,isLoading:!0,isLoadingMoreRows:!1},a}return pn(o)}();mn(vl,"propTypes",an(an({},ui),{},{type:b.string.isRequired,onBucketSizeChange:b.func})),mn(vl,"defaultProps",an(an({},di),{},{onBucketSizeChange:function(){}}));var hl=function(t){gn(r,f.Component);var a=Sn(r);function r(t){var i,l,s,c,u,d,p,m,g;un(this,r),mn(Cn(g=a.call(this,t)),"componentDidMount",(function(){try{g.onRenderComplete(),g._isMounted=!0,g.updateToolbars(),g.props.onMount()}catch(e){console.error(e),g.props.onErrorCallback(e)}})),mn(Cn(g),"shouldComponentUpdate",(function(e,t){return!(!g.props.shouldRender&&!e.shouldRender)&&((!g.props.isResizing||!e.isResizing)&&(!(!g.props.queryResponse&&!g.queryResponse)&&(!Ma(g.props,e)||!Ma(g.state,t))))})),mn(Cn(g),"componentDidUpdate",(function(e,t){try{var o,a,r={},i=!1;g.props.queryResponse&&!e.queryResponse&&g.onRenderComplete(),g.props.onDisplayTypeChange&&g.state.displayType!==t.displayType&&g.props.onDisplayTypeChange(g.state.displayType),n(g.props.initialTableConfigs,{tableConfig:g.tableConfig,pivotTableConfig:g.pivotTableConfig})||!g.props.onTableConfigChange||g.hasCalledInitialTableConfigChange||(g.hasCalledInitialTableConfigChange=!0,g.onTableConfigChange()),n(g.state.aggConfig,t.aggConfig)||g.props.onAggConfigChange(g.state.aggConfig),t.displayType!==g.state.displayType&&Co(),((null===(o=g.state.visibleRows)||void 0===o?void 0:o.length)!==(null===(a=t.visibleRows)||void 0===a?void 0:a.length)||"table"===g.state.displayType&&"text"===t.displayType)&&setTimeout((function(){g.props.onRowChange()}),0);var l=g.state.columnChangeCount!==t.columnChangeCount,s=g.state.visibleRowChangeCount!==t.visibleRowChangeCount;if(l||s){l&&g.props.onColumnChange(g.state.columns),g.shouldGeneratePivotData()&&(g.generatePivotData({isFirstGeneration:!0,dataChanged:!0}),i=!0);var c=g.getCurrentSupportedDisplayTypes();n(c,g.state.supportedDisplayTypes)||(r.supportedDisplayTypes=c)}n(g.state.supportedDisplayTypes,t.supportedDisplayTypes)||g.isCurrentDisplayTypeValid()||(r.displayType=g.getUpdatedDefaultDisplayType("table")),g.updateToolbars(),_e(r)?i&&g.forceUpdate():g.setState(r)}catch(e){console.error(e)}})),mn(Cn(g),"componentWillUnmount",(function(){try{g._isMounted=!1,Eo()}catch(e){console.error(e)}})),mn(Cn(g),"onChartRenderComplete",(function(){ca(g.state.displayType)&&g.props.onRenderComplete()})),mn(Cn(g),"onTableRenderComplete",(function(){"table"===g.state.displayType&&g.props.onRenderComplete()})),mn(Cn(g),"onPivotTableRenderComplete",(function(){"pivot_table"===g.state.displayType&&g.props.onRenderComplete()})),mn(Cn(g),"onRenderComplete",(function(){g.props.queryResponse&&(g._isMounted||(ca(g.state.displayType)||ua(g.state.displayType))&&!Ca(g.queryResponse)||(g.renderComplete=!0,g.props.onRenderComplete()))})),mn(Cn(g),"refreshLayout",(function(){var e;g.chartRef&&(null===(e=g.chartRef)||void 0===e||e.adjustChartPosition())})),mn(Cn(g),"onTableConfigChange",(function(){g.props.onTableConfigChange({tableConfig:g.tableConfig,pivotTableConfig:g.pivotTableConfig})})),mn(Cn(g),"checkAndUpdateTableConfigs",(function(e){(g.isTableConfigValid(g.tableConfig,g.state.columns,e)||g.setTableConfig(),g.currentlySupportsPivot())&&(g.isTableConfigValid(g.pivotTableConfig,g.pivotTableColumns,e)||g.resetPivotTableConfig())})),mn(Cn(g),"changeDisplayType",(function(e,t){g.checkAndUpdateTableConfigs(e),g.setState({displayType:e},(function(){"function"==typeof t&&t()}))})),mn(Cn(g),"displayTypeInvalidWarning",(function(e){console.warn('Initial display type "'.concat(g.props.initialDisplayType,'" provided is not valid for this dataset. Using ').concat(e||g.state.displayType," instead."))})),mn(Cn(g),"getDataLength",(function(){var e,t,n;return null!==(e=g.state)&&void 0!==e&&e.visibleRows?null===(t=g.state)||void 0===t||null===(t=t.visibleRows)||void 0===t?void 0:t.length:null===(n=g.tableData)||void 0===n?void 0:n.length})),mn(Cn(g),"getPivotDataLength",(function(){var e,t,n;return null!==(e=g.state)&&void 0!==e&&e.visiblePivotRows?null===(t=g.state)||void 0===t||null===(t=t.visiblePivotRows)||void 0===t?void 0:t.length:null===(n=g.pivotTableData)||void 0===n?void 0:n.length})),mn(Cn(g),"getUpdatedDefaultDisplayType",(function(e){return Da(g.props.queryResponse,g.props.autoChartAggregations,g.getColumns(),g.getDataLength(),g.getPivotDataLength(),e,g.isDataLimited())})),mn(Cn(g),"getDisplayTypeFromInitial",(function(e){var t,n,o=e.initialDisplayType,a=g.getUpdatedDefaultDisplayType(g.props.preferredDisplayType);return o&&Sa(e.queryResponse,o,null===(t=g.tableData)||void 0===t?void 0:t.length,null===(n=g.pivotTableData)||void 0===n?void 0:n.length,g.getColumns(),g.isDataLimited())||(o=a),o})),mn(Cn(g),"hasError",(function(e){try{var t=Number(e.data.reference_id.split(".")[2]);if(t>=200&&t<300)return!1}catch(e){}return!0})),mn(Cn(g),"getColumns",(function(){var e;return g._isMounted?g.state.columns:g.formatColumnsForTable(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.columns)})),mn(Cn(g),"currentlySupportsCharts",(function(){var e=g.getCurrentSupportedDisplayTypes().filter((function(e){return $n.includes(e)}));return!(null==e||!e.length)})),mn(Cn(g),"currentlySupportsPivot",(function(){var e=g.getCurrentSupportedDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),mn(Cn(g),"potentiallySupportsPivot",(function(){var e=g.getPotentialDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),mn(Cn(g),"potentiallySupportsDatePivot",(function(){var e=g.getColumns();return g.potentiallySupportsPivot()&&2===(null==e?void 0:e.length)})),mn(Cn(g),"usePivotDataForChart",(function(){return g.potentiallySupportsPivot()&&!g.potentiallySupportsDatePivot()})),mn(Cn(g),"areColumnsValid",(function(e){var t,n=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.columns;return!(null==e||!e.length||null==n||!n.length)&&e.every((function(e){return n.find((function(t){e.name,t.name}))}))})),mn(Cn(g),"numberIndicesArraysOverlap",(function(e){return e.numberColumnIndices.length&&e.numberColumnIndices2.length&&(e.numberColumnIndices.filter((function(t){return e.numberColumnIndices2.includes(t)})).length||e.numberColumnIndices2.filter((function(t){return e.numberColumnIndices.includes(t)})).length)})),mn(Cn(g),"isTableConfigValid",(function(e,t,n){var o;if(!t||null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.rows)||void 0===o||!o.length)return!1;try{if(!e||!e.numberColumnIndices||!e.stringColumnIndices||ma(t)&&!na(e.numberColumnIndex)||fa(t)&&!na(e.stringColumnIndex))return console.debug("Table config provided was incomplete",!e,!e.numberColumnIndices,!e.stringColumnIndices,ma(t)&&!na(e.numberColumnIndex),fa(t)&&!na(e.stringColumnIndex)),!1;if(!Array.isArray(e.numberColumnIndices))return console.debug("Number column indices array not valid in table config"),!1;if(!Array.isArray(e.stringColumnIndices))return console.debug("String column indices array not valid in table config"),!1;if(na(e.stringColumnIndex)&&(!t[e.stringColumnIndex].is_visible||void 0!==e.stringColumnIndices.find((function(e){return!t[e].is_visible}))))return console.debug("Table config invalid: Some of the number columns were hidden."),!1;if(na(e.numberColumnIndex)&&(!t[e.numberColumnIndex].is_visible||void 0!==e.numberColumnIndices.find((function(e){return!t[e].is_visible}))))return console.debug("Table config invalid: Some of the string columns were hidden."),!1;if("column_line"===n||"scatterplot"===n){if(!g.isColumnIndexValid(e.numberColumnIndex,t)||!g.isColumnIndexValid(e.numberColumnIndex2,t)||e.numberColumnIndex===e.numberColumnIndex2)return console.debug("Two unique number column indices were not found. This is required for display type: ".concat(n),e),!1;if(g.numberIndicesArraysOverlap(e))return console.debug("Both axes reference one or more of the same number column index"),!1;if(e.numberColumnIndices2.find((function(e){return!t[e].is_visible})))return console.debug("Second axis indices had hidden columns"),!1}if(!e.numberColumnIndices.every((function(e){return t[e]&&Ho(t[e])})))return console.debug("Saved number indices are not number columns"),!1;if(!e.stringColumnIndices.every((function(e){return t[e]&&Qo(t[e])})))return console.debug("Saved string indices are not string columns"),!1;if(!e.numberColumnIndices2){var a=Yo(t,g.usePivotDataForChart()),r=a.numberColumnIndices2,i=a.numberColumnIndex2;e.numberColumnIndices2=r,e.numberColumnIndex2=i}return!0}catch(e){return console.debug("Saved table config was not valid for response:",null==e?void 0:e.message),!1}})),mn(Cn(g),"updateColumns",(function(e){if(e&&g._isMounted){var t=g.formatColumnsForTable(e);g.isTableConfigValid(g.tableConfig,t,g.state.displayType)||(g.tableConfig=void 0,g.setTableConfig(t),g.chartID=C()),g.setState({columns:t,aggConfig:g.getAggConfig(e),columnChangeCount:g.state.columnChangeCount+1})}})),mn(Cn(g),"generateAllData",(function(){var e;null!==(e=g.queryResponse)&&void 0!==e&&null!==(e=e.data)&&void 0!==e&&e.data&&g.shouldGenerateTableData()&&(g.generateTableData(),g.shouldGeneratePivotData()&&g.generatePivotData({isFirstGeneration:!0}))})),mn(Cn(g),"shouldGeneratePivotData",(function(){var e;return((null===(e=g.state)||void 0===e?void 0:e.visibleRows)||g.tableData)&&g.potentiallySupportsPivot()})),mn(Cn(g),"shouldGenerateTableData",(function(){var e;return!(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||!e.rows)})),mn(Cn(g),"generateTableData",(function(e,t){if(t)g.tableData=t;else{var n,o=e||g.getColumns();g.tableData=null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.rows,g.setTableConfig(),g._isMounted&&g.setState({columns:o})}})),mn(Cn(g),"generatePivotData",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration,o=t.dataChanged;try{var a;g.pivotTableID=C();var r=(null===(a=g.state)||void 0===a?void 0:a.visibleRows)||g.tableData,i=g.getColumns();2===i.length?g.generateDatePivotData(r):g.generatePivotTableData({isFirstGeneration:n})}catch(e){console.error(e),g.props.onErrorCallback(e),g.pivotTableData=void 0}g.props.allowDisplayTypeChange&&(null===(e=g.pivotTableRef)||void 0===e||e.updateData(g.pivotTableData));o&&g._isMounted&&g.setState({visiblePivotRowChangeCount:g.state.visiblePivotRowChangeCount+1})})),mn(Cn(g),"renderSuggestionMessage",(function(e,t){var n;try{n=f.createElement("div",{className:"react-autoql-suggestion-message","data-test":"suggestion-message-container"},f.createElement("div",{className:"react-autoql-suggestions-container"},g.props.showSuggestionPrefix&&f.createElement("div",{className:"react-autoql-suggestion-message-prefix"},"I want to make sure I understood your query. Did you mean:"),g.props.renderSuggestionsAsDropdown?f.createElement("select",{key:C(),onChange:function(e){g._isMounted&&(g.setState({selectedSuggestion:e.target.value}),g.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:g.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return f.createElement("option",{key:C(),value:e},e)}))):e.map((function(e){return f.createElement("div",{key:C(),"data-test":"suggestion-list-button"},f.createElement("button",{onClick:function(){return g.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t,scope:g.props.scope})},className:"react-autoql-suggestion-btn"},e),f.createElement("br",null))}))))}catch(e){return f.createElement("div",{className:"react-autoql-suggestion-message"},"Sorry something went wrong, I have no suggestions for you.")}return g.props.renderFullSuggestionMessage?f.createElement("div",{style:{textAlign:"center"}},g.renderError(g.queryResponse),n):n})),mn(Cn(g),"renderSingleValueResponse",(function(){var e,t,n,o;return f.createElement("div",{className:"single-value-response-flex-container"},f.createElement("div",{className:"single-value-response-container"},f.createElement("a",{className:"single-value-response ".concat(zo(g.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){g.processDrilldown({groupBys:[],supportedByAPI:!0})}},g.props.showSingleValueResponseTitle&&f.createElement("span",null,f.createElement("strong",null,null===(e=g.state.columns)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.display_name,": ")),aa({element:null!==(t=null===(n=g.queryResponse.data.data.rows[0])||void 0===n?void 0:n[0])&&void 0!==t?t:0,column:null===(o=g.state.columns)||void 0===o?void 0:o[0],config:Fo(g.props.dataFormatting)}))))})),mn(Cn(g),"copyTableToClipboard",(function(){var e,t;"table"===g.state.displayType&&null!==(e=g.tableRef)&&void 0!==e&&e._isMounted?g.tableRef.copyToClipboard():"pivot_table"===g.state.displayType&&null!==(t=g.pivotTableRef)&&void 0!==t&&t._isMounted&&g.pivotTableRef.copyToClipboard()})),mn(Cn(g),"getBase64Data",(function(){var e,t;if(g.chartRef&&ca(g.state.displayType))return g.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=g.tableRef)&&void 0!==e&&e._isMounted&&"table"===g.state.displayType){var n=g.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=g.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===g.state.displayType){var o=g.pivotTableRef.getBase64Data();return Promise.resolve(o)}})),mn(Cn(g),"saveChartAsPNG",(function(){g.chartRef&&g.chartRef.saveAsPNG()})),mn(Cn(g),"queryFn",(function(){var e,t,n,o,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.fe_req,i=g.getCombinedFilters();return g.cancelCurrentRequest(),g.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),g.setState({isLoadingData:!0}),g.isDrilldown()?st(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{source:g.props.source,scope:g.props.scope,debug:"include"===(null==r?void 0:r.translation),filters:null==r?void 0:r.session_filter_locks,pageSize:null==r?void 0:r.page_size,test:null==r?void 0:r.test,groupBys:null==r?void 0:r.columns,queryID:g.props.originalQueryID,orders:null===(o=g.formattedTableParams)||void 0===o?void 0:o.sorters,tableFilters:i,cancelToken:g.axiosSource.token},a)).finally((function(){g.setState({isLoadingData:!1})})):je(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{query:null==r?void 0:r.text,debug:"include"===(null==r?void 0:r.translation),userSelection:null==r?void 0:r.disambiguation,filters:null==r?void 0:r.session_filter_locks,test:null==r?void 0:r.test,pageSize:null==r?void 0:r.page_size,orders:null===(n=g.formattedTableParams)||void 0===n?void 0:n.sorters,tableFilters:i,source:g.props.source,scope:g.props.scope,cancelToken:g.axiosSource.token},a)).finally((function(){g.setState({isLoadingData:!1})}))})),mn(Cn(g),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var o,a=null===(o=g.tableData)||void 0===o?void 0:o.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=S(g.queryResponse);return r.data.data.rows=a,r.data.data.count_rows=a.length,r}catch(e){console.error(e)}})),mn(Cn(g),"cancelCurrentRequest",(function(){var e;null===(e=g.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(g),"processDrilldown",function(){var e=cn(rn().mark((function e(t){var n,o,a,r,i,l,s,c,u,d,p;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.groupBys,o=t.supportedByAPI,a=t.row,r=t.activeKey,i=t.stringColumnIndex,l=t.filter,!zo(g.props.autoQLConfig).enableDrilldowns){e.next=39;break}if(e.prev=2,s=g.getDefaultQueryPageSize(),!o){e.next=18;break}return g.props.onDrilldownStart(r),e.prev=6,e.next=9,st(an(an(an({},_o(g.props.authentication)),zo(g.props.autoQLConfig)),{},{queryID:g.queryID,source:g.props.source,groupBys:n,pageSize:s}));case 9:c=e.sent,g.props.onDrilldownEnd({response:c,originalQueryID:g.queryID}),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),g.props.onDrilldownEnd({response:e.t0});case 16:e.next=33;break;case 18:if(!(!isNaN(i)&&null!=a&&a.length||l)){e.next=33;break}return g.props.onDrilldownStart(r),u=l,l||(u=g.constructFilter({column:g.state.columns[i],value:a[i]})),d=g.getCombinedFilters(u),e.prev=23,e.next=26,g.queryFn({tableFilters:d,pageSize:s});case 26:p=e.sent,e.next=32;break;case 29:e.prev=29,e.t1=e.catch(23),p=e.t1;case 32:g.props.onDrilldownEnd({response:p,originalQueryID:g.queryID});case 33:e.next=39;break;case 35:e.prev=35,e.t2=e.catch(2),console.error(e.t2),g.props.onDrilldownEnd({error:"Error processing drilldown"});case 39:case"end":return e.stop()}}),e,null,[[2,35],[6,13],[23,29]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(g),"constructFilter",(function(e){var t,n=e.column,o=e.value,a=o,r="=";if(null===a)a="NULL",r="is";else if("DATE"===n.type){var i=oa({value:o,column:n,config:g.props.dataFormatting}),l=Sr(n.precision),s=i.startOf(l).toISOString(),c=i.endOf(l).toISOString();a="".concat(s,",").concat(c),r="between",t="TIME"}return{name:n.name,operator:r,value:a,column_type:t}})),mn(Cn(g),"getCombinedFilters",(function(e){var t,n,o=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.fe_req,a=(null==o?void 0:o.filters)||[],r=(null===(n=g.formattedTableParams)||void 0===n?void 0:n.filters)||[],i=[];if(r.forEach((function(e){var t=e,n=a.find((function(t){return t.name===e.name}));n&&(t=an(an({},e),n)),i.push(t)})),a.forEach((function(e){i.find((function(t){return t.name===e.name}))||i.push(e)})),e){var l=i.findIndex((function(t){return t.name===e.name}));l>=0?i[l]=e:i.push(e)}return i.map((function(e){var t,n=null===(t=g.getColumns())||void 0===t?void 0:t.find((function(t){return t.name===e.name}));return an(an({},e),{},{columnName:null==n?void 0:n.title})}))})),mn(Cn(g),"onTableCellClick",(function(e){var t;if(null==e||null===(t=e.getColumn())||void 0===t||null===(t=t.getDefinition())||void 0===t||!t.pivot){var n=g.getColumns();if(n){var o={};if(g.pivotTableColumns&&"pivot_table"===g.state.displayType){var a;if(null==e||null===(a=e.getValue)||void 0===a||!a.call(e))return;if(g.potentiallySupportsDatePivot()){var r,i,l,s,c=jo(n),u=null===(r=e.getColumn())||void 0===r||null===(r=r.getDefinition())||void 0===r?void 0:r.title,d=null===(i=e.getData())||void 0===i?void 0:i[0],p=null===(l=g.pivotOriginalColumnData)||void 0===l||null===(l=l[u])||void 0===l?void 0:l[d];o=[{name:null===(s=n[c])||void 0===s?void 0:s.name,value:p}]}else{var m=n[g.tableConfig.legendColumnIndex],f=n[g.tableConfig.stringColumnIndex];o=function(e){var t=e.cell,n=e.rowHeaders,o=e.columnHeaders,a=e.rowHeaderDefinition,r=e.columnHeaderDefinition;try{var i,l=r.name,s=Number(t.getField())-1,c=xa(o,s),u=a.name,d=(null==t||null===(i=t.getRow())||void 0===i?void 0:i.getPosition())-1,p=xa(n,d);if(l&&u&&void 0!==c&&void 0!==p)return[{name:l,value:"".concat(c)},{name:u,value:"".concat(p)}]}catch(e){console.error(e)}}({cell:e,rowHeaders:g.pivotRowHeaders,columnHeaders:g.pivotColumnHeaders,rowHeaderDefinition:f,columnHeaderDefinition:m})}}else o=function(e,t){if(e&&t){var n=sa(t);if(n.length){var o=e.getData(),a=[];return n.forEach((function(e){var n=t[e].name,r="".concat(o[e]);a.push({name:n,value:r})})),a}}}(e,n);g.processDrilldown({groupBys:o,supportedByAPI:!!o})}}})),mn(Cn(g),"onChartClick",(function(e){var t,n,o=e.row,a=e.columnIndex,r=e.columns,i=e.stringColumnIndex,l=e.legendColumn,s=e.activeKey,c=e.filter;if(c)return g.processDrilldown({supportedByAPI:!1,activeKey:s,filter:c});var u=[],d=r[a],p=(null==r||null===(t=r[i])||void 0===t?void 0:t.origColumn)||(null==r?void 0:r[i]);if(null!=r&&null!==(n=r[i])&&void 0!==n&&n.datePivot){var m,f,v=Number(null==r||null===(m=r[a])||void 0===m?void 0:m.name),h=null==o?void 0:o[i],b="".concat(null===(f=g.pivotOriginalColumnData)||void 0===f||null===(f=f[v])||void 0===f?void 0:f[h]);u.push({name:p.name,value:b})}else null!=p&&p.groupable&&u.push({name:p.name,value:"".concat(null==o?void 0:o[i])});null!=l&&l.groupable&&d.origColumn&&u.push({name:l.name,value:"".concat(null==d?void 0:d.name)}),u.length,g.processDrilldown({groupBys:u,supportedByAPI:!!u.length,row:o,activeKey:s,stringColumnIndex:i})})),mn(Cn(g),"updateToolbars",(function(){g.updateVizToolbar(),g.updateOptionsToolbar()})),mn(Cn(g),"updateVizToolbar",(function(){var e;null!==(e=g.props.vizToolbarRef)&&void 0!==e&&e._isMounted&&g.props.vizToolbarRef.updateDisplayTypes(g.getCurrentSupportedDisplayTypes(),g.state.displayType)})),mn(Cn(g),"updateOptionsToolbar",(function(){var e;null!==(e=g.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&g.props.optionsToolbarRef.forceUpdate()})),mn(Cn(g),"isFilteringTable",(function(){var e;return(null===(e=g.tableRef)||void 0===e?void 0:e._isMounted)&&g.tableRef.state.isFiltering})),mn(Cn(g),"getTabulatorHeaderFilters",(function(){var e;return(null===(e=g.tableRef)||void 0===e?void 0:e._isMounted)&&g.tableRef.getTabulatorHeaderFilters()})),mn(Cn(g),"toggleTableFilter",(function(e,t){var n,o;return"table"===g.state.displayType?(null===(n=g.tableRef)||void 0===n?void 0:n._isMounted)&&g.tableRef.toggleIsFiltering(e,t):"pivot_table"===g.state.displayType?(null===(o=g.pivotTableRef)||void 0===o?void 0:o._isMounted)&&g.pivotTableRef.toggleIsFiltering(e,t):void 0})),mn(Cn(g),"onNewPage",(function(e){if(null!=e&&e.length)try{g.tableData=[].concat(Tn(g.tableData),Tn(e)),g.setState({visibleRowChangeCount:g.state.visibleRowChangeCount+1,visibleRows:g.tableData})}catch(e){console.error(e)}})),mn(Cn(g),"onTableParamsChange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.tableParams=S(e),g.formattedTableParams=t})),mn(Cn(g),"onNewData",(function(e,t){var n;g.isOriginalData=!1,g.queryResponse=e;var o,a=null==e||null===(n=e.data)||void 0===n?void 0:n.data;(g.tableData=(null==a?void 0:a.rows)||[],"table"!==g.state.displayType&&g.props.allowDisplayTypeChange)&&(null===(o=g.tableRef)||void 0===o||o.updateData(g.tableData,g.isDataLimited()));g.setState({visibleRows:e.data.data.rows,visibleRowChangeCount:g.state.visibleRowChangeCount+1},(function(){var n,o=null!=t?t:null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.page_size;g.props.onPageSizeChange(o,g.state.visibleRows)}))})),mn(Cn(g),"onTableFilter",function(){var e=cn(rn().mark((function e(t,o){var a,r;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!n(t,null===(a=g.tableParams)||void 0===a?void 0:a.filter)){e.next=2;break}return e.abrupt("return");case 2:g.tableParams.filter=S(t),g.formattedTableParams=ni(g.tableParams,g.getColumns()),r=[],o.forEach((function(e){r.push(e.getData())})),g.setState({visibleRows:r,visibleRowChangeCount:g.state.visibleRowChangeCount+1});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),mn(Cn(g),"onTableSort",(function(e){g.tableParams.sort=S(e)})),mn(Cn(g),"onLegendClick",(function(e){if(e){var t=null==e?void 0:e.columnIndex,n=g.usePivotDataForChart(),o=S(n?g.pivotTableColumns:g.state.columns);if(null!=o&&o.length)if(o[t].isSeriesHidden=!o[t].isSeriesHidden,n)g.pivotTableColumns=o,g.forceUpdate();else{var a=g.formatColumnsForTable(o);g.setState({columns:a})}}else console.debug("no legend item was provided on click event")})),mn(Cn(g),"onChangeStringColumnIndex",(function(e){g.usePivotDataForChart()?(g.pivotTableConfig.legendColumnIndex===e&&(g.pivotTableConfig.legendColumnIndex=void 0),g.pivotTableConfig.stringColumnIndex=e,g.generatePivotTableData()):(g.tableConfig.legendColumnIndex===e&&(g.tableConfig.legendColumnIndex=void 0),g.tableConfig.stringColumnIndex=e),g.forceUpdate()})),mn(Cn(g),"onChangeLegendColumnIndex",(function(e){g.usePivotDataForChart()?(g.pivotTableConfig.stringColumnIndex===e&&(g.pivotTableConfig.stringColumnIndex=void 0),g.pivotTableConfig.legendColumnIndex=e,g.generatePivotTableData()):(g.tableConfig.stringColumnIndex===e&&(g.tableConfig.stringColumnIndex=void 0),g.tableConfig.legendColumnIndex=e),g.forceUpdate()})),mn(Cn(g),"onChangeNumberColumnIndices",(function(e,t,n){if(g.usePivotDataForChart())e&&(g.pivotTableConfig.numberColumnIndices=e,g.pivotTableConfig.numberColumnIndex=e[0]),t&&(g.pivotTableConfig.numberColumnIndices2=t,g.pivotTableConfig.numberColumnIndex2=t[0]),n&&(g.pivotTableColumns=n),g.forceUpdate();else{e&&(g.tableConfig.numberColumnIndices=e,g.tableConfig.numberColumnIndex=e[0]),t&&(g.tableConfig.numberColumnIndices2=t,g.tableConfig.numberColumnIndex2=t[0]);var o=null!=n?n:g.state.columns;g.updateColumns(o)}})),mn(Cn(g),"resetPivotTableConfig",(function(){g.pivotTableConfig=void 0,g.setPivotTableConfig()})),mn(Cn(g),"setPivotTableConfig",(function(e){var t=g.pivotTableColumns;if(t){var o=S(g.pivotTableConfig);if(g.pivotTableConfig||(g.pivotTableConfig={}),e||!g.pivotTableConfig.stringColumnIndices||!(g.pivotTableConfig.stringColumnIndex>=0)){var a=Wo(t,"supportsPivot"),r=a.stringColumnIndices,i=a.stringColumnIndex;g.pivotTableConfig.stringColumnIndices=r,g.pivotTableConfig.stringColumnIndex=i}if(e||!g.pivotTableConfig.numberColumnIndices){var l=Yo(t,g.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;g.pivotTableConfig.numberColumnIndices=c,g.pivotTableConfig.numberColumnIndex=s,g.pivotTableConfig.numberColumnIndices2=d,g.pivotTableConfig.numberColumnIndex2=u,g.pivotTableConfig.currencyColumnIndices=p,g.pivotTableConfig.quantityColumnIndices=m,g.pivotTableConfig.ratioColumnIndices=f}n(o,g.pivotTableConfig)||g.onTableConfigChange()}})),mn(Cn(g),"resetTableConfig",(function(){g.tableConfig=void 0,g.setTableConfig()})),mn(Cn(g),"isColumnIndexValid",(function(e,t){return!(null==t||!t.length)&&!!t[e]})),mn(Cn(g),"isColumnIndicesValid",(function(e,t){return!(null==e||!e.length||null==t||!t.length)&&e.every((function(e){return g.isColumnIndexValid(e,t)}))})),mn(Cn(g),"hasIndex",(function(e,t){return-1!==(null==e?void 0:e.findIndex((function(e){return t===e})))})),mn(Cn(g),"setTableConfig",(function(e){var t,o,a=null!=e?e:g.getColumns();if(a){var r=S(g.tableConfig);if(g.tableConfig||(g.tableConfig={}),!g.tableConfig.stringColumnIndices||!g.isColumnIndexValid(g.tableConfig.stringColumnIndex,a)){var i=Wo(a),l=i.stringColumnIndices,s=i.stringColumnIndex;g.tableConfig.stringColumnIndices=l,g.tableConfig.stringColumnIndex=s}var c=(null!==(t=Go(a))&&void 0!==t?t:{}).amountOfNumberColumns;if(null!==(o=g.tableConfig.numberColumnIndices)&&void 0!==o&&o.length&&g.tableConfig.numberColumnIndex>=0&&g.tableConfig.numberColumnIndices.includes(g.tableConfig.numberColumnIndex))if(!(c>1&&g.isColumnIndexValid(g.tableConfig.numberColumnIndex,a))||g.isColumnIndicesValid(g.tableConfig.numberColumnIndices2,a)&&g.isColumnIndexValid(g.tableConfig.numberColumnIndex,a)){if(c>1&&g.numberIndicesArraysOverlap(g.tableConfig)){if(g.tableConfig.numberColumnIndices.length===c){var u=g.tableConfig.numberColumnIndices.findIndex((function(e){return e!==g.tableConfig.numberColumnIndex}));-1!==u&&(g.tableConfig.numberColumnIndices=Fa(g.tableConfig.numberColumnIndices,u))}else if(g.tableConfig.numberColumnIndices2.length===c){var d=g.tableConfig.numberColumnIndices2.findIndex((function(e){return e!==g.tableConfig.numberColumnIndex2}));-1!==d&&(g.tableConfig.numberColumnIndices2=Fa(g.tableConfig.numberColumnIndices2,d))}g.tableConfig.numberColumnIndex===g.tableConfig.numberColumnIndex2&&(g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return Ho(e)&&t!==g.tableConfig.numberColumnIndex})),-1===g.tableConfig.numberColumnIndices2.indexOf(g.tableConfig.numberColumnIndex2)&&g.tableConfig.numberColumnIndices2.push(g.tableConfig.numberColumnIndex2),n(g.tableConfig.numberColumnIndices2,g.tableConfig.numberColumnIndices)&&g.tableConfig.numberColumnIndices2.shift());var p=g.tableConfig.numberColumnIndices.filter((function(e){return e!==g.tableConfig.numberColumnIndex2&&!g.hasIndex(g.tableConfig.numberColumnIndices2,e)}));p.length&&(g.tableConfig.numberColumnIndices=p);var m=g.tableConfig.numberColumnIndices2.filter((function(e){return e!==g.tableConfig.numberColumnIndex&&!g.hasIndex(g.tableConfig.numberColumnIndices,e)}));m.length&&(g.tableConfig.numberColumnIndices2=m)}}else g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return t!==g.tableConfig.numberColumnIndex&&Ho(e)})),g.tableConfig.numberColumnIndices2=[g.tableConfig.numberColumnIndex2];else{var f=Yo(a,g.usePivotDataForChart()),v=f.numberColumnIndex,h=f.numberColumnIndices,b=f.numberColumnIndex2,y=f.numberColumnIndices2,C=f.currencyColumnIndices,E=f.quantityColumnIndices,T=f.ratioColumnIndices;g.tableConfig.numberColumnIndices=h,g.tableConfig.numberColumnIndex=v,g.tableConfig.numberColumnIndices2=y,g.tableConfig.numberColumnIndex2=b,g.tableConfig.currencyColumnIndices=C,g.tableConfig.quantityColumnIndices=E,g.tableConfig.ratioColumnIndices=T}if(g.tableConfig.numberColumnIndices2.find((function(e){return!a[e].is_visible}))&&(g.tableConfig.numberColumnIndex2=a.findIndex((function(e,t){return Ho(e)&&t!==g.tableConfig.numberColumnIndex&&t!==g.tableConfig.numberColumnIndex2})),g.tableConfig.numberColumnIndices2=[g.tableConfig.numberColumnIndex2]),g.usePivotDataForChart()){var D=a.findIndex((function(e,t){return e.groupable&&t!==g.tableConfig.stringColumnIndex}));D>=0&&(g.tableConfig.legendColumnIndex=D)}n(r,g.tableConfig)||g.onTableConfigChange()}})),mn(Cn(g),"getPotentialDisplayTypes",(function(){var e;return Ea({response:g.queryResponse,columns:null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.columns)||void 0===e?void 0:e.map((function(e){return an({},e)}))})})),mn(Cn(g),"isCurrentDisplayTypeValid",(function(){return Sa(g.queryResponse,g.state.displayType,g.getDataLength(),g.getPivotDataLength(),g.getColumns(),g.isDataLimited())})),mn(Cn(g),"getCurrentSupportedDisplayTypes",(function(){return Ea({response:g.queryResponse,columns:g.getColumns(),dataLength:g.getDataLength(),pivotDataLength:g.getPivotDataLength(),isDataLimited:g.isDataLimited()})})),mn(Cn(g),"setFilterFunction",(function(e){var t=Cn(g);return"DATE"===e.type?function(t,n,a,r){try{var i;if(!n)return!1;var l=oa({value:n,column:e,config:g.props.dataFormatting}),s=t.split(" to "),c=Sr(Er(e.precision)),u=o.utc(s[0]).startOf(c),d=o.utc(null!==(i=s[1])&&void 0!==i?i:s[0]).endOf(c),p=u.isSameOrBefore(l),m=l.isSameOrBefore(d);return p&&m}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:"DATE_STRING"===e.type?function(n,o,a,r){try{if(!o)return!1;var i=aa({element:o,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,o){try{if(!t)return!1;var a=e.trim();if(a.length>=2){var r=Number(a.substr(1).replace(/[^0-9.]/g,""));if(">"===a[0]&&"="===a[1])return t>=r;if(">"===a[0])return t>r;if("<"===a[0]&&"="===a[1])return t<=r;if("<"===a[0])return t<r;if("!"===a[0]&&"="===a[1])return t!==r;if("="===a[0])return t===r}var i=parseFloat(null==t?void 0:t.replace(/[^0-9.]/g,"")),l=parseFloat(null==e?void 0:e.replace(/[^0-9.]/g,""));return!isNaN(i)&&i===l}catch(e){return console.error(e),g.props.onErrorCallback(e),!1}}:void 0})),mn(Cn(g),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(t,n){return wa(t,n,e,"isTable")}:(e.type,"alphanum")})),mn(Cn(g),"setHeaderFilterPlaceholder",(function(e){return"DATE"!==e.type||e.pivot?"Filter":"Pick range"})),mn(Cn(g),"getAggConfig",(function(e){if(!e)return null;var t={};return e.forEach((function(e){t[e.name]=e.aggType})),t})),mn(Cn(g),"getDrilldownGroupby",(function(e,t){var n;return null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n||null===(n=n.columns)||void 0===n?void 0:n.find((function(e){return t.name===e.name}))})),mn(Cn(g),"formatColumnsForTable",(function(e,t){if(!e)return null;var n=0===la(e);return e.map((function(e,o){var a=S(e);a.id=C(),a.field="".concat(o),a.title=e.display_name,a.visible=e.is_visible,a.download=e.is_visible,a.minWidth="90px","DATE"===a.type&&(a.minWidth="125px"),a.maxWidth="300px","DOLLAR_AMT"===a.type||"RATIO"===a.type||"NUMBER"===a.type?a.hozAlign="right":a.hozAlign="center";var r=g.getDrilldownGroupby(g.queryResponse,a);a.cssClass="".concat(a.type),r&&(a.cssClass="".concat(a.cssClass," DRILLDOWN")),a.formatter=function(e,t,n){return aa({element:e.getValue(),column:a,config:Fo(g.props.dataFormatting),htmlElement:e.getElement()})},a.headerFilter="input",a.headerFilterPlaceholder=g.setHeaderFilterPlaceholder(a),a.headerFilterFunc=g.setFilterFunction(a),a.sorter=g.setSorterFunction(a),a.headerSort=!!g.props.enableTableSorting,a.headerSortStartingDir="desc",a.headerClick=function(){var e;null===(e=g.tableRef)||void 0===e||null===(e=e.ref)||void 0===e||e.restoreRedraw()},r&&(a.isDrilldownColumn=!0,a.tooltipTitle=a.title,a.title="".concat(a.title,' <em>(Clicked: "').concat(r.value,'")</em>'));var i=e.aggType;t&&(i=t[e.name]),n&&Ho(e)&&(a.aggType=i||ct.SUM);var l=g.columnDateRanges.find((function(e){return"DATE"===a.type&&(e.columnName===a.display_name||!!a.groupable)}));return l&&(a.dateRange=l),a}))})),mn(Cn(g),"formatDatePivotYear",(function(e,t){var n=g.getColumns();return"DATE"===n[t].type?oa({value:e[t],column:n[t],config:g.props.dataFormatting}).year().toString():o(e[t]).format("YYYY")})),mn(Cn(g),"formatDatePivotMonth",(function(e,t){var n=g.getColumns();return"DATE"===n[t].type?oa({value:e[t],column:n[t],config:g.props.dataFormatting}).format("MMMM"):o(e[t]).format("MMMM")})),mn(Cn(g),"generateDatePivotData",(function(t){try{var n=g.getColumns(),a=jo(n),r=g.tableConfig.numberColumnIndex;r>=0||(r=n.findIndex((function(e,t){return t!==a&&Ho(e)})));var i=t||e(g.queryResponse,"data.data.rows"),l=Tn(i.map((function(e){return"DATE"===n[a].type?oa({value:e[a],column:n[a],config:g.props.dataFormatting}).year():Number(o(e[a]).format("YYYY"))}))).filter(Xo).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),s=n[a],c=an(an({},s),{},{title:"Month",name:"Month",field:"0",frozen:!0,visible:!0,is_visible:!0,type:"DATE_STRING",datePivot:!0,origColumn:s,pivot:!0,cssClass:"pivot-category",sorter:function(e,t){return wa(e,t,s,"isTable")},headerFilter:!1,headerFilterPlaceholder:"filter..."}),u=[an(an({},c),{},{formatter:function(e){return aa({element:e.getValue(),column:c,config:Fo(g.props.dataFormatting),htmlElement:e.getElement()})}})];Object.keys(l).forEach((function(e,t){u.push(an(an({},n[r]),{},{origColumn:n[r],origValues:{},name:e,title:e,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var d=Jo(Object.keys(l).length,12),p={};no.forEach((function(e,t){d[t][0]=e})),i.forEach((function(e){var t,o=g.formatDatePivotYear(e,a),i=g.formatDatePivotMonth(e,a),s=l[o],c=no.findIndex((function(e){return i===e})),m=u.findIndex((function(e){return e.name===o}));c>=0&&s&&(d[c][s]=e[r],p[o]=an(an({},p[o]),{},mn({},i,e[a])),u[m].origValues[i]={name:null===(t=n[a])||void 0===t?void 0:t.name,value:e[a]||""})})),g.pivotOriginalColumnData=p,g.pivotTableColumns=u,g.pivotTableData=d,g.numberOfPivotTableRows=12,g.setPivotTableConfig()}catch(e){console.error(e);var m=g.getCurrentSupportedDisplayTypes();g.setState({displayType:"table",supportedDisplayTypes:m.filter((function(e){return"pivot_table"!==e}))})}})),mn(Cn(g),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var o,a=(null===(o=g.state)||void 0===o?void 0:o.visibleRows)||g.tableData||e(g.queryResponse,"data.data.rows");a=a.filter((function(e){return null!==e[0]}));var r=g.getColumns(),i=g.tableConfig,l=i.legendColumnIndex,s=i.stringColumnIndex,c=i.numberColumnIndex,u=ka(a,r,"desc","isTable").map((function(e){return e[s]})).filter(Xo).reduce((function(e,t,n){return e[t]=n,e}),{}),d=ka(a,r,"desc","isTable").map((function(e){return e[l]})).filter(Xo).reduce((function(e,t,n){return e[t]=n,e}),{}),p=s,m=l;if(n&&Object.keys(d).length>Object.keys(u).length&&(!Uo(r[s])||Object.keys(d).length>22)){p=l,m=s;var f=S(u);u=S(d),d=S(f)}g.pivotColumnHeaders=d,g.pivotRowHeaders=u,g.tableConfig.legendColumnIndex=m,g.tableConfig.stringColumnIndex=p;var v=[an(an({},r[p]),{},{frozen:!0,visible:!0,is_visible:!0,field:"0",cssClass:"pivot-category",pivot:!0,headerFilter:!1})];Object.keys(d).forEach((function(e,t){var n=aa({element:e,column:r[m],config:Fo(g.props.dataFormatting)});v.push(an(an({},r[c]),{},{origColumn:r[c],origPivotColumn:r[m],origValues:{},name:e,title:n,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var h=Jo(Object.keys(d).length+1,Object.keys(u).length);a.forEach((function(e){var t,n=u[e[p]],o=e[p];h[n][0]=o;var a=d[e[m]]+1,i=Number(e[c]);h[n][a]=i,v[a].origValues[o]={name:null===(t=r[p])||void 0===t?void 0:t.name,value:o}})),g.pivotTableColumns=v,g.pivotTableData=h,g.numberOfPivotTableRows=e(g.pivotTableData,"length",0),g.setPivotTableConfig(n)}catch(e){console.error(e),g.props.onErrorCallback(e)}})),mn(Cn(g),"onSuggestionClick",(function(e){var t,n,o=e.query,a=e.queryId,r=e.userSelection,i=e.isButtonClick,l=e.skipQueryValidation,s=e.source;(r||ut(an(an({},_o(g.props.authentication)),{},{queryId:a,suggestion:o})).catch((function(e){return console.error(e)})),"None of these"===o)?(g.props.onNoneOfTheseClick&&g.props.onNoneOfTheseClick(),g.props.mutable&&g.setState({customResponse:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")})):(g.props.onSuggestionClick&&g.props.onSuggestionClick({query:o,userSelection:r,isButtonClick:i,skipQueryValidation:l,source:s,scope:g.props.scope}),null!==(t=g.props.queryInputRef)&&void 0!==t&&t._isMounted&&(null===(n=g.props.queryInputRef)||void 0===n||n.animateInputTextAndSubmit({queryText:o,userSelection:r,skipQueryValidation:!0,source:s,scope:g.props.scope})))})),mn(Cn(g),"replaceErrorTextWithLinks",(function(e){try{var t=e.split("<report>");return f.createElement("div",{className:"query-output-error-message"},t.map((function(e,n){return f.createElement("span",{key:"error-message-part-".concat(g.COMPONENT_KEY,"-").concat(n)},f.createElement("span",null,e),n!==t.length-1&&f.createElement("button",{className:"report-like-text-button",onClick:g.props.reportProblemCallback},"report"))})))}catch(t){return f.createElement("span",null,e)}})),mn(Cn(g),"isDrilldown",(function(){try{var e;return"Drilldown"===((null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text)||"").split(":")[0]}catch(e){return!1}})),mn(Cn(g),"renderAllColumnsHiddenMessage",(function(){return f.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},f.createElement(Wn,{className:"warning-icon",type:"warning-triangle"}),f.createElement("div",null,"All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",f.createElement(Wn,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),mn(Cn(g),"getDefaultQueryPageSize",(function(){var e;return null!==(e=g.props.dataPageSize)&&void 0!==e?e:500})),mn(Cn(g),"getQueryPageSize",(function(){var e,t,n;return null!==(e=null!==(t=g.props.dataPageSize)&&void 0!==t?t:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.page_size)&&void 0!==e?e:500})),mn(Cn(g),"renderTable",(function(){var e,t,n;return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():g.tableData?f.createElement(Rn,null,f.createElement(ci,{key:g.tableID,autoHeight:g.props.autoHeight,authentication:g.props.authentication,dataFormatting:g.props.dataFormatting,rowChangeCount:g.state.visibleRowChangeCount,ref:function(e){return g.tableRef=e},columns:g.state.columns,response:g.queryResponse,data:g.tableData,columnDateRanges:g.columnDateRanges,onCellClick:g.onTableCellClick,queryID:g.queryID,initialParams:g.tableParams,onFilterCallback:g.onTableFilter,onSorterCallback:g.onTableSort,onTableParamsChange:g.onTableParamsChange,onNewPage:g.onNewPage,onNewData:g.onNewData,isAnimating:g.props.isAnimating,isResizing:g.props.isResizing,pageSize:g.getQueryPageSize(),useInfiniteScroll:!g.isOriginalData||g.props.enableAjaxTableData&&g.isDataLimited(),enableAjaxTableData:g.props.enableAjaxTableData,queryRequestData:null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.fe_req,queryText:null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text,originalQueryID:g.props.originalQueryID,isDrilldown:g.isDrilldown(),isQueryOutputMounted:g._isMounted,popoverParentElement:g.props.popoverParentElement,hidden:"table"!==g.state.displayType,totalRows:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.count_rows,supportsDrilldowns:Bo(g.state.columns)&&zo(g.props.autoQLConfig).enableDrilldowns,tooltipID:g.props.tooltipID,queryFn:g.queryFn,source:g.props.source,scope:g.props.scope})):g.renderMessage("Error: There was no data supplied for this table")})),mn(Cn(g),"renderPivotTable",(function(){return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():"pivot_table"!==g.state.displayType||g.pivotTableData?f.createElement(Rn,null,f.createElement(ci,{ref:function(e){return g.pivotTableRef=e},columns:g.pivotTableColumns,rowChangeCount:g.state.visibleRowChangeCount,data:g.pivotTableData,onCellClick:g.onTableCellClick,isAnimating:g.props.isAnimating,isResizing:g.props.isResizing,hidden:"pivot_table"!==g.state.displayType,useInfiniteScroll:!1,supportsDrilldowns:!0,autoHeight:g.props.autoHeight,source:g.props.source,scope:g.props.scope,tooltipID:g.props.tooltipID,pivot:!0})):g.renderMessage("Error: There was no data supplied for this table")})),mn(Cn(g),"renderChart",(function(){var e,t,n,o,a,r;if(!g.tableData||!g.state.columns||!g.tableConfig)return console.error("Required table data was missing for chart"),g.renderMessage("Error: There was no data supplied for this chart");var i=g.usePivotDataForChart();if(i&&(!g.pivotTableData||!g.pivotTableColumns||!g.pivotTableConfig))return g.renderMessage("Error: There was no data supplied for this chart");var l=g.isDataLimited(),s=i?g.pivotTableConfig:g.tableConfig,c=g.getCombinedFilters();an(an({},g.formattedTableParams),{},{filters:c});var u=!1,d=la(g.state.columns);(1===d||d>=2&&i)&&(u=!0);var p,m=i?g.state.visiblePivotRows||g.pivotTableData:g.state.visibleRows||g.tableData,v=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.count_rows;!l&&g.state.visibleRows&&(null===(t=g.state.visibleRows)||void 0===t?void 0:t.length)<5e3&&(v=null===(p=g.state.visibleRows)||void 0===p?void 0:p.length);return f.createElement(Rn,null,f.createElement(vl,fn({key:g.chartID},s,{data:m,hidden:!ca(g.state.displayType),authentication:g.props.authentication,ref:function(e){return g.chartRef=e},type:g.state.displayType,isDataAggregated:u,popoverParentElement:g.props.popoverParentElement,dataChangeCount:i?g.state.visiblePivotRowChangeCount:g.state.visibleRowChangeCount,columns:i?g.pivotTableColumns:g.state.columns,isAggregated:i,dataFormatting:g.props.dataFormatting,activeChartElementKey:g.props.activeChartElementKey,onLegendClick:g.onLegendClick,legendColumn:g.state.columns[null===(n=g.tableConfig)||void 0===n?void 0:n.legendColumnIndex],changeStringColumnIndex:g.onChangeStringColumnIndex,changeLegendColumnIndex:g.onChangeLegendColumnIndex,changeNumberColumnIndices:g.onChangeNumberColumnIndices,onChartClick:g.onChartClick,isResizing:g.props.isResizing,isAnimating:g.props.isAnimating,isDrilldownChartHidden:g.props.isDrilldownChartHidden,enableDynamicCharting:g.props.enableDynamicCharting,enableAjaxTableData:g.props.enableAjaxTableData,tooltipID:null!==(o=g.props.tooltipID)&&void 0!==o?o:g.TOOLTIP_ID,chartTooltipID:null!==(a=g.props.chartTooltipID)&&void 0!==a?a:g.CHART_TOOLTIP_ID,height:g.props.height,width:g.props.width,onNewData:g.onNewData,isDrilldown:g.isDrilldown(),totalRowCount:v,currentRowCount:null===(r=g.state.visibleRows)||void 0===r?void 0:r.length,updateColumns:g.updateColumns,source:g.props.source,scope:g.props.scope,isRowCountSelectable:!g.isOriginalData||l,queryFn:g.queryFn,onBucketSizeChange:g.props.onBucketSizeChange,bucketSize:g.props.bucketSize})))})),mn(Cn(g),"renderHelpResponse",(function(){var t=e(g.queryResponse,"data.data.rows[0]");if(!t)return null;var n=t.includes("#"),o=t;if(n){var a=t.split("#")[1].replace(/-/g," ");o=a.charAt(0).toUpperCase()+a.substr(1)}return f.createElement(h,null,"Great news, I can help with that:",f.createElement("br",null),f.createElement("button",{className:"react-autoql-help-link-btn",target:"_blank",onClick:function(){return window.open(t,"_blank")}},f.createElement(Wn,{type:"globe",className:"react-autoql-help-link-icon"}),o))})),mn(Cn(g),"renderError",(function(t){return t?e(t,"data.message")?g.renderMessage(t.data):g.renderMessage():(console.warn("Warning: No response object supplied"),g.renderMessage("No response supplied"))})),mn(Cn(g),"isDataLimited",(function(){var e,t,n,o,a=null!==(e=null===(t=g.tableData)||void 0===t?void 0:t.length)&&void 0!==e?e:null===(n=g.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.rows)||void 0===n?void 0:n.length,r=null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.count_rows;return!(!a||!r)&&a<r})),mn(Cn(g),"noDataFound",(function(){var e;return 0===(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.rows)||void 0===e?void 0:e.length)&&g.isOriginalData})),mn(Cn(g),"renderMessage",(function(e){try{if("object"===ln(e)){var t,n=ir.GENERAL_QUERY;if((null==e?void 0:e.message)===(null==lr?void 0:lr.CANCELLED))n=f.createElement("span",null,"Query cancelled"," ",f.createElement(Wn,{"data-tip":"Pressing the ESC key will cancel the current query request. If you wish to re-run your last query, simply press the UP arrow in the input bar then hit ENTER.","data-for":null!==(t=g.props.tooltipID)&&void 0!==t?t:g.TOOLTIP_ID,type:"question"}));else null!=e&&e.message&&(n=e.message,n=g.props.reportProblemCallback?g.replaceErrorTextWithLinks(e.message):n.replace("<report>","report"));return f.createElement("div",{className:"query-output-error-message"},f.createElement("div",null,n),e.reference_id&&f.createElement(h,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",e.reference_id)))}var o=e||ir.GENERAL_QUERY;return f.createElement("div",{className:"query-output-error-message"},o)}catch(e){return console.warn(e),f.createElement("div",{className:"query-output-error-message"},ir.GENERAL_QUERY)}})),mn(Cn(g),"renderHTMLMessage",(function(){var e,t=null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.answer;return t?Fe(t,{}):f.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),mn(Cn(g),"renderTextResponse",(function(){return ya(g.getColumns())?g.renderAllColumnsHiddenMessage():null})),mn(Cn(g),"renderResponse",(function(){var t=g.state.displayType;if(g.hasError(g.queryResponse))return g.renderError(g.queryResponse);if("html"===t)return g.renderHTMLMessage();if(g.state.customResponse)return g.state.customResponse;if(!!e(g.queryResponse,"data.data.items"))return g.renderSuggestionMessage(g.queryResponse.data.data.items,g.queryResponse.data.data.query_id);if(e(g.queryResponse,"data.data.replacements"))return f.createElement(ko,{key:g.QUERY_VALIDATION_KEY,response:g.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return g.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"],scope:g.props.scope})},onQueryValidationSelectOption:g.props.onQueryValidationSelectOption,initialSelections:g.props.queryValidationSelections,autoSelectSuggestion:g.props.autoSelectQueryValidationSuggestion,scope:g.props.scope});if(t&&e(g.queryResponse,"data.data.rows")){if("help"===t)return g.renderHelpResponse();if("text"===t)return g.renderTextResponse();if(Ca(g.queryResponse))return g.renderSingleValueResponse();if(!ua(t)&&!ca(t))return console.warn("display type not recognized: ".concat(g.state.displayType," - rendering as plain text")),g.renderMessage("display type not recognized: ".concat(g.state.displayType))}var n=ca(g.state.displayType),o=ua(g.state.displayType),a="pivot_table"===g.state.displayType,r=g.props.allowDisplayTypeChange,i=g.currentlySupportsCharts(),l=g.currentlySupportsPivot(),s=g.usePivotDataForChart()?g.pivotTableColumns:g.getColumns(),c=g.usePivotDataForChart()?g.pivotTableConfig:g.tableConfig,u=g.isTableConfigValid(c,s,g.state.displayType),d=(r||n)&&i&&u,p=r||o,m=(r||a)&&l;return f.createElement(f.Fragment,null,p&&g.renderTable(),d&&g.renderChart(),m&&g.renderPivotTable())})),mn(Cn(g),"shouldRenderReverseTranslation",(function(){var e;return zo(g.props.autoQLConfig).enableQueryInterpretation&&g.props.showQueryInterpretation&&(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.parsed_interpretation)})),mn(Cn(g),"getFilters",(function(){var e,t,n,o,a,r=null!==(e=null===(t=g.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.fe_req)||void 0===t?void 0:t.persistent_filter_locks)&&void 0!==e?e:[],i=null!==(n=null===(o=g.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.fe_req)||void 0===o?void 0:o.session_filter_locks)&&void 0!==n?n:[];return null!==(a=[].concat(Tn(r),Tn(i)))&&void 0!==a?a:[]})),mn(Cn(g),"renderReverseTranslation",(function(){return f.createElement(Xr,{authentication:g.props.authentication,onValueLabelClick:g.props.onRTValueLabelClick,appliedFilters:g.getFilters(),isResizing:g.props.isResizing,queryResponse:g.queryResponse,tooltipID:g.props.tooltipID})})),mn(Cn(g),"shouldRenderDataLimitWarning",(function(){var e=!g.props.enableAjaxTableData&&"table"===g.state.displayType,t=!g.props.enableAjaxTableData&&ca(g.state.displayType);return g.isDataLimited()&&!ya(g.getColumns())&&(e||t)})),mn(Cn(g),"renderDataLimitWarning",(function(){var e,t,n=zo(g.props.autoQLConfig).enableQueryInterpretation&&g.props.showQueryInterpretation;return f.createElement("div",{className:"dashboard-data-limit-warning-icon"},f.createElement(Wn,{type:"warning","data-tip":"The display limit of ".concat(null===(e=g.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.row_limit," rows has been reached. Try querying a smaller time-frame to ensure all your data is displayed."),"data-for":null!==(t=g.props.tooltipID)&&void 0!==t?t:g.TOOLTIP_ID,"data-place":n?"left":"right"}))})),mn(Cn(g),"renderFooter",(function(){var e=g.shouldRenderReverseTranslation(),t=g.shouldRenderDataLimitWarning(),n="query-output-footer ".concat(e?"":"no-margin"," ").concat(g.props.reverseTranslationPlacement);return f.createElement("div",{className:n},e&&g.renderReverseTranslation(),t&&g.renderDataLimitWarning())})),mn(Cn(g),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{key:g.COMPONENT_KEY,ref:function(e){return g.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(g.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(ua(g.state.displayType)?"table":"","\n ").concat(ca(g.state.displayType)?"chart":"")},"top"===g.props.reverseTranslationPlacement&&g.renderFooter(),g.renderResponse(),"top"!==g.props.reverseTranslationPlacement&&g.renderFooter()),!g.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:g.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),!g.props.chartTooltipID&&f.createElement(So,{className:"react-autoql-chart-tooltip",id:g.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),g.COMPONENT_KEY=C(),g.QUERY_VALIDATION_KEY=C(),g.TOOLTIP_ID="react-autoql-query-output-tooltip-".concat(g.COMPONENT_KEY),g.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(g.COMPONENT_KEY),g.queryResponse=S(t.queryResponse),g.columnDateRanges=function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.parsed_interpretation;if(!n)return[];var o=Tr(n);return null!=o&&o.length?o:[]}(t.queryResponse),g.queryID=e(g.queryResponse,"data.data.query_id"),g.interpretation=e(g.queryResponse,"data.data.parsed_interpretation"),g.tableParams={},g.chartID=C(),g.tableID=C(),g.pivotTableID=C(),g.initialSupportedDisplayTypes=g.getCurrentSupportedDisplayTypes(),g.isOriginalData=!0,g.renderComplete=!1,g.hasCalledInitialTableConfigChange=!1,g.generateAllData();var v=g.formatColumnsForTable(null===(i=g.queryResponse)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.columns,t.initialAggConfig);g.initialSupportedDisplayTypes=g.getCurrentSupportedDisplayTypes();var b=g.getDisplayTypeFromInitial(t);if(t.onDisplayTypeChange&&t.onDisplayTypeChange(b),null!==(l=t.initialTableConfigs)&&void 0!==l&&l.tableConfig&&g.isTableConfigValid(null===(s=t.initialTableConfigs)||void 0===s?void 0:s.tableConfig,v,b)){var y=t.initialTableConfigs.tableConfig;g.tableConfig=S(y)}if(null!==(c=t.initialTableConfigs)&&void 0!==c&&c.pivotTableConfig&&g.isTableConfigValid(null===(u=t.initialTableConfigs)||void 0===u?void 0:u.pivotTableConfig,g.pivotTableColumns,b)){var T=t.initialTableConfigs.pivotTableConfig;g.pivotTableConfig=S(T)}return g.formattedTableParams={filters:(null===(d=g.queryResponse)||void 0===d||null===(d=d.data)||void 0===d||null===(d=d.data)||void 0===d||null===(d=d.fe_req)||void 0===d?void 0:d.filters)||[],sorters:(null===(p=g.queryResponse)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.fe_req)||void 0===p?void 0:p.sorters)||[]},g.state={displayType:b,aggConfig:t.initialAggConfig,supportedDisplayTypes:g.initialSupportedDisplayTypes,columns:v,selectedSuggestion:t.defaultSelectedSuggestion,visibleRows:null===(m=g.queryResponse)||void 0===m||null===(m=m.data)||void 0===m||null===(m=m.data)||void 0===m?void 0:m.rows,visibleRowChangeCount:0,visiblePivotRowChangeCount:0,columnChangeCount:0},g}return pn(r)}();mn(hl,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,initialTableConfigs:b.shape({}),initialAggConfig:b.shape({}),queryResponse:b.shape({}),onSuggestionClick:b.func,initialDisplayType:b.string,onQueryValidationSelectOption:b.func,autoSelectQueryValidationSuggestion:b.bool,queryValidationSelections:b.arrayOf(b.shape({})),renderSuggestionsAsDropdown:b.bool,defaultSelectedSuggestion:b.string,reverseTranslationPlacement:b.string,activeChartElementKey:b.string,preferredDisplayType:b.string,isResizing:b.bool,enableDynamicCharting:b.bool,onTableConfigChange:b.func,onAggConfigChange:b.func,onNoneOfTheseClick:b.func,autoChartAggregations:b.bool,onRTValueLabelClick:b.func,isTaskModule:b.bool,onDrilldownStart:b.func,onDrilldownEnd:b.func,enableAjaxTableData:b.bool,enableTableSorting:b.bool,showSingleValueResponseTitle:b.bool,onRowChange:b.func,mutable:b.bool,showSuggestionPrefix:b.bool,onDisplayTypeChange:b.func,onColumnChange:b.func,shouldRender:b.bool,dataPageSize:b.number,onPageSizeChange:b.func,allowDisplayTypeChange:b.bool,onRenderComplete:b.func,onMount:b.func,onBucketSizeChange:b.func,bucketSize:b.number}),mn(hl,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,initialTableConfigs:void 0,initialAggConfig:void 0,queryResponse:void 0,initialDisplayType:null,onSuggestionClick:void 0,autoSelectQueryValidationSuggestion:!0,queryValidationSelections:void 0,renderSuggestionsAsDropdown:!1,defaultSelectedSuggestion:void 0,reverseTranslationPlacement:"bottom",activeChartElementKey:void 0,isResizing:!1,enableDynamicCharting:!0,onNoneOfTheseClick:void 0,autoChartAggregations:!0,enableFilterLocking:!1,showQueryInterpretation:!1,isTaskModule:!1,enableAjaxTableData:!1,enableTableSorting:!0,preferredDisplayType:void 0,onRTValueLabelClick:void 0,mutable:!0,showSuggestionPrefix:!0,shouldRender:!0,dataPageSize:void 0,allowDisplayTypeChange:!0,showSingleValueResponseTitle:!1,bucketSize:void 0,onRowChange:function(){},onTableConfigChange:function(){},onAggConfigChange:function(){},onQueryValidationSelectOption:function(){},onErrorCallback:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){},onColumnChange:function(){},onPageSizeChange:function(){},onRenderComplete:function(){},onMount:function(){},onBucketSizeChange:function(){}});var bl=Ga(hl),yl=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a,r,i,l;return un(this,o),mn(Cn(l=t.call(this,e)),"componentDidMount",(function(){l._isMounted=!0,Co()})),mn(Cn(l),"shouldComponentUpdate",(function(e){return!(!l.props.shouldRender&&!e.shouldRender)})),mn(Cn(l),"componentDidUpdate",(function(e,t){n(l.state.supportedDisplayTypes,t.supportedDisplayTypes)||Co()})),mn(Cn(l),"componentWillUnmount",(function(){l._isMounted=!1})),mn(Cn(l),"updateDisplayTypes",(function(e,t){l.setState({supportedDisplayTypes:e,displayType:t})})),mn(Cn(l),"showDisplayTypeButton",(function(e){if(l.props.disableCharts&&$n.includes(e))return!1;var t=l.state.supportedDisplayTypes;return t&&t.includes(e)})),mn(Cn(l),"onDisplayTypeChange",(function(e){var t,n;null!==(t=l.props.responseRef)&&void 0!==t&&t._isMounted&&(null===(n=l.props.responseRef)||void 0===n||n.changeDisplayType(e))})),mn(Cn(l),"createVisButton",(function(e,t,n){if(l.showDisplayTypeButton(e)){var o,a,r=l.state.displayType;return f.createElement(wo,{onClick:function(){return l.onDisplayTypeChange(e)},className:"react-autoql-toolbar-btn\n ".concat(e===r?"react-autoql-toolbar-btn-selected":""),tooltip:t,tooltipID:null!==(o=l.props.tooltipID)&&void 0!==o?o:"react-autoql-viz-toolbar-tooltip-".concat(l.COMPONENT_KEY),"data-test":"viz-toolbar-button",disabled:null===(a=l.props.responseRef)||void 0===a||null===(a=a.state)||void 0===a?void 0:a.isLoadingData},n)}return null})),mn(Cn(l),"render",(function(){var e;if(null===(e=l.props.responseRef)||void 0===e||!e._isMounted)return null;var t=l.state.displayType,n=l.state.supportedDisplayTypes;return!n||n.length<=1||!n.includes("pivot_table")&&l.props.disableCharts?null:Zn.includes(t)||$n.includes(t)?f.createElement(Rn,null,f.createElement("div",{className:"".concat(l.props.className||""," ").concat(Pe?"react-autoql-toolbar-mobile":"react-autoql-toolbar"," viz-toolbar ").concat(l.props.vertical?"vertical":""),"data-test":"viz-toolbar"},l.createVisButton("table","Table",f.createElement(Wn,{type:"table"})),l.createVisButton("pivot_table","Pivot View",f.createElement(Wn,{type:"pivot-table"})),l.createVisButton("column","Column Chart",f.createElement(Wn,{type:"column-chart"})),l.createVisButton("bar","Bar Chart",f.createElement(Wn,{type:"bar-chart"})),l.createVisButton("line","Line Chart",f.createElement(Wn,{type:"line-chart"})),l.createVisButton("pie","Pie Chart",f.createElement(Wn,{type:"pie-chart"})),l.createVisButton("heatmap","Heatmap",f.createElement(Wn,{type:"heatmap"})),l.createVisButton("bubble","Bubble Chart",f.createElement(Wn,{type:"bubble-chart"})),l.createVisButton("stacked_bar","Stacked Bar Chart",f.createElement(Wn,{type:"stacked-bar-chart"})),l.createVisButton("stacked_column","Stacked Column Chart",f.createElement(Wn,{type:"stacked-column-chart"})),l.createVisButton("stacked_line","Stacked Area Chart",f.createElement(Wn,{type:"stacked-line-chart"})),l.createVisButton("column_line","Column Line Combo Chart",f.createElement(Wn,{type:"column-line-chart"})),l.createVisButton("histogram","Histogram",f.createElement(Wn,{type:"histogram-chart"})),l.createVisButton("scatterplot","Scatterplot",f.createElement(Wn,{type:"scatterplot"}))),!l.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-viz-toolbar-tooltip-".concat(l.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),l.COMPONENT_KEY=C(),l.state={displayType:null===(a=e.responseRef)||void 0===a||null===(a=a.state)||void 0===a?void 0:a.displayType,supportedDisplayTypes:null!==(r=e.responseRef)&&void 0!==r&&r._isMounted?null===(i=e.responseRef)||void 0===i?void 0:i.getCurrentSupportedDisplayTypes():[]},l}return pn(o)}();mn(yl,"propTypes",{shouldRender:b.bool,disableCharts:b.bool,vertical:b.bool}),mn(yl,"defaultProps",{shouldRender:!0,disableCharts:!1,vertical:!1});var Cl=yl,El=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),mn(Cn(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",{className:"modal-footer-button-container right"},f.createElement(wo,{type:"default",onClick:e.props.onClose,tooltipID:e.props.tooltipID},e.props.backText),f.createElement(wo,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading,tooltipID:e.props.tooltipID,filled:!0},e.props.confirmText))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,f.createElement(qe,{isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container",ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-confirm-modal",style:{content:an(an({},e.props.style),{},{width:e.props.width,height:e.props.height})}},f.createElement("div",{className:"react-autoql-modal-body"},e.props.children),f.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter())))})),e}return pn(n)}();mn(El,"propTypes",{isVisible:b.bool,onClose:b.func,onConfirm:b.func,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),confirmLoading:b.bool,backText:b.string,confirmText:b.string,footer:b.element}),mn(El,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,backText:"Go back",confirmText:"Continue",footer:void 0,onClose:function(){},onConfirm:function(){}});var Sl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),mn(Cn(e),"shouldComponentUpdate",(function(t,n){return!(!t.shouldRender&&!e.props.shouldRender)&&(!Ma(e.props,t)||!Ma(e.state,n))})),mn(Cn(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.props.onOpened(),!e.props.isVisible&&t.isVisible&&e.props.onClosed()})),mn(Cn(e),"onClose",(function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e.props.confirmOnClose&&t?e.setState({isConfirmCloseModalVisible:!0}):e.props.onClose()})),mn(Cn(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",{className:"modal-footer-button-container right"},e.props.showCancelButton&&f.createElement(wo,{type:"default",onClick:e.onClose},"Cancel"),f.createElement(wo,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),mn(Cn(e),"render",(function(){var t;return f.createElement(Rn,null,f.createElement(qe,{ref:function(t){return e.ref=t},isOpen:e.props.isVisible,className:"".concat(Pe?"react-autoql-modal-mobile":"react-autoql-modal").concat(e.props.contentClassName?" ".concat(e.props.contentClassName):""),bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:an(an({},e.props.style),{},{width:e.props.width,height:e.props.height}),overlay:an({},e.props.overlayStyle)}},f.createElement("div",{className:"react-autoql-modal-content".concat(Pe?" react-autoql-modal-content-mobile":""),ref:function(t){return e.modalContent=t},onClick:function(e){return e.stopPropagation()}},f.createElement("div",{className:"react-autoql-modal-header"},f.createElement("div",{className:"react-autoql-modal-header-title-container"},f.createElement("div",{className:"react-autoql-modal-header-title"},e.props.titleIcon," ",e.props.title),f.createElement("div",{className:"react-autoql-modal-header-subtitle"},e.props.subtitle)),f.createElement(Wn,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),f.createElement("div",{className:"react-autoql-modal-body ".concat(null!==(t=e.props.bodyClassName)&&void 0!==t?t:""),style:{overflow:e.props.enableBodyScroll?"auto":"hidden"}},e.props.children),e.props.showFooter&&f.createElement("div",{className:"react-autoql-modal-footer"},e.renderFooter()))),!!e.props.confirmOnClose&&f.createElement(El,{isVisible:e.state.isConfirmCloseModalVisible,onClose:function(){return e.setState({isConfirmCloseModalVisible:!1})},confirmText:"Discard Changes",onConfirm:function(){e.props.onClose(),e.setState({isConfirmCloseModalVisible:!1})}},f.createElement("h3",null,"Are you sure you want to leave this page?"),f.createElement("p",null,"All unsaved changes will be lost.")))})),e}return pn(n)}();mn(Sl,"propTypes",{title:b.oneOfType([b.element,b.string]),titleIcon:b.oneOfType([b.element,b.instanceOf(Wn)]),subtitle:b.string,isVisible:b.bool,onClose:b.func,onConfirm:b.func,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),showCancelButton:b.bool,showFooter:b.bool,enableBodyScroll:b.bool,confirmLoading:b.bool,confirmText:b.string,confirmDisabled:b.bool,footer:b.element,confirmOnClose:b.bool,shouldRender:b.bool,onOpened:b.func,onClosed:b.func}),mn(Sl,"defaultProps",{title:"",titleIcon:void 0,subtitle:"",isVisible:!1,width:"80vw",height:void 0,showCancelButton:!0,enableBodyScroll:!1,showFooter:!0,confirmLoading:!1,confirmText:void 0,footer:void 0,confirmDisabled:!1,confirmOnClose:!1,shouldRender:!0,onClose:function(){},onConfirm:function(){},onOpened:function(){},onClosed:function(){}});var Tl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{columns:e.props.columns}),mn(Cn(e),"shouldComponentUpdate",(function(t,n){return!Ma(e.props,t)||!Ma(e.state,n)})),mn(Cn(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),mn(Cn(e),"onListChange",(function(t){e.setState({columns:t})})),mn(Cn(e),"onConfirm",(function(){return e.props.onConfirm(e.state.columns)})),mn(Cn(e),"render",(function(){return f.createElement(Sl,{isVisible:e.props.isVisible,onClose:e.props.onClose,onConfirm:e.onConfirm,title:"Show/Hide Columns",enableBodyScroll:!0,width:"600px",confirmText:"Apply",confirmLoading:e.props.isSettingColumns},f.createElement("div",{"data-test":"column-visibility-modal",style:{padding:"0 15px"}},f.createElement(Ai,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:e.onListChange})))})),e}return pn(n)}();mn(Tl,"propTypes",{isSettingColumns:b.bool}),mn(Tl,"defaultProps",{isSettingColumns:!1});var Dl=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",C()),mn(Cn(t),"renderButtonType",(function(){var e;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-radio-btn-container\n react-autoql-radio-btn-container-buttons\n ".concat(null!==(e=t.props.className)&&void 0!==e?e:""),"data-test":"react-autoql-radio"},t.props.options.map((function(e,n){var o,a=t.props.value===e;return t.props.multiSelect&&(a=t.props.value.includes(e)),f.createElement("div",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),className:"react-autoql-radio-btn\n ".concat(a?" active":""),"data-test":"react-autoql-radio-btn",onClick:function(){return t.props.onChange(e)},"data-tip":null===(o=t.props.tooltips)||void 0===o?void 0:o[n],"data-for":t.props.tooltipID,"data-delay-show":500},f.createElement("div",null,e))}))))})),mn(Cn(t),"renderOriginalType",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-radio-btn-container react-autoql-radio-btn-container-list ".concat(t.props.className),"data-test":"react-autoql-radio"},t.props.options.map((function(e,n){var o=t.props.value===e;return t.props.multiSelect&&(o=t.props.value.includes(e)),f.createElement("p",{key:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n)},f.createElement("input",{id:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),name:"react-autoql-radio-".concat(t.COMPONENT_KEY),type:"radio",defaultChecked:o}),f.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),mn(Cn(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return pn(o)}();mn(Dl,"propTypes",{options:b.arrayOf(b.string),onChange:b.func,value:b.string,multiSelect:b.bool,type:b.string,tooltips:b.arrayOf(b.string),tooltipId:b.string}),mn(Dl,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var xl=function(t){gn(a,f.Component);var o=Sn(a);function a(t){var r;un(this,a),mn(Cn(r=o.call(this,t)),"autoCompleteTimer",void 0),mn(Cn(r),"state",an({input1Value:"",input2Value:"",conditionSelectValue:"GREATER_THAN",secondTermType:"query",isFirstTermValid:!0,isSecondTermValid:!0},function(t){if(t&&1===t.length)return{input1Value:t[0].term_value,conditionSelectValue:"EXISTS",isComplete:!!e(t[0].term_value,"length")};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),o="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:o,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(o,"length")}}return{}}(r.props.initialData))),mn(Cn(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),mn(Cn(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),mn(Cn(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),mn(Cn(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=C(),r.setState({input1Value:e[0].term_value,conditionSelectValue:"EXISTS"})):e.length>1&&(r.TERM_ID_1=e[0].id,r.TERM_ID_2=e[1].id,r.setState({input1Value:e[0].term_value,input2Value:"".concat(e[1].term_value),conditionSelectValue:e[0].condition,secondTermType:e[1].term_type}))})),mn(Cn(r),"getJSON",(function(){if("EXISTS"===r.state.conditionSelectValue)return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?Number(e):e}]})),mn(Cn(r),"isNumerical",(function(e){return!isNaN(Number(e))})),mn(Cn(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),mn(Cn(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),mn(Cn(r),"validateFirstTerm",(function(){r.props.enableQueryValidation?r.state.input1Value&&!r.state.isValidatingFirstTerm&&r.state.lastCheckedFirstTermValue!==r.state.input1Value&&(r.setState({isFirstTermValid:!0,lastCheckedFirstTermValue:r.state.input1Value,isValidatingFirstTerm:!0}),pr(an({query:r.state.input1Value},_o(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),mn(Cn(r),"validateSecondTerm",(function(){r.props.enableQueryValidation?r.state.input2Value&&isNaN(Number(r.state.input2Value))?r.state.isValidatingSecondTerm||r.state.lastCheckedSecondTermValue===r.state.input2Value||(r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value,isValidatingSecondTerm:!0}),pr(an({query:r.state.input2Value},_o(r.props.authentication))).then((function(){r.setState({isSecondTermValid:!0,isValidatingSecondTerm:!1})})).catch((function(){r.setState({isSecondTermValid:!1,isValidatingSecondTerm:!1})}))):r.setState({isSecondTermValid:!0,lastCheckedSecondTermValue:r.state.input2Value}):r.setState({isSecondTermValid:!0})})),mn(Cn(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),mn(Cn(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){Ke(an(an(an({},_o(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],o=[];t=e.data.matches;for(var a=0;a<t.length&&(n.push(t[a]),4!==a);a++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var l={name:n[i]};o.push(l)}r.setState({suggestions:o})})).catch((function(e){console.error(e)}))}),500)})),mn(Cn(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),mn(Cn(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),mn(Cn(r),"renderReadOnlyRule",(function(){return f.createElement(Rn,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(Ra(r.state.input1Value))),f.createElement("span",{className:"read-only-rule-term"},"".concat(r.renderConditionOperator(r.state.conditionSelectValue))),"EXISTS"!==r.state.conditionSelectValue&&f.createElement("span",{className:"read-only-rule-term"},Ra(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),mn(Cn(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(Wn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),mn(Cn(r),"renderRule",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(xr,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})},onBlur:r.validateFirstTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateFirstTerm()}}),!r.state.isFirstTermValid&&r.renderValidationError()),f.createElement(xo,{options:[{value:"GREATER_THAN",label:">",tooltip:"Greater Than"},{value:"LESS_THAN",label:"<",tooltip:"Less Than"},{value:"EQUAL_TO",label:"=",tooltip:"EQUAL_TO"},{value:"EXISTS",label:f.createElement("span",null,"∃"),tooltip:"Exists"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}}),f.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(xr,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})},onBlur:r.validateSecondTerm,onKeyDown:function(e){"Enter"===e.key&&r.validateSecondTerm()}}),!r.state.isSecondTermValid&&r.renderValidationError())),f.createElement(Wn,{className:"react-autoql-rule-delete-btn",type:"close","data-tip":"Remove Condition","data-for":"notification-expression-tooltip",onClick:function(){r.props.onDelete(r.props.ruleId)}})))})),mn(Cn(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=C(),r.TERM_ID_2=C();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=C()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return pn(a)}();mn(xl,"propTypes",{authentication:nr,ruleId:b.string,onAdd:b.func,onDelete:b.func,onUpdate:b.func,initialData:b.arrayOf(b.shape({})),readOnly:b.bool,enableQueryValidation:b.bool}),mn(xl,"defaultProps",{authentication:Mo,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var Rl=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,o=e.id||C();n.push({id:o,type:(t=e.term_value,!t[0]||"AND"!==t[0].condition&&"OR"!==t[0].condition&&"TERMINATOR"!==t[0].condition?"rule":"group"),isComplete:!0,termValue:e.term_value||[]})})),t={rules:n,andOrSelectValue:"OR"===e[0].condition?"ANY":"ALL"}):(n.push({id:C(),type:"rule",isComplete:!1}),t={rules:n}),t},Il=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"ID",C()),mn(Cn(e),"ruleRefs",[]),mn(Cn(e),"state",an({rules:[],andOrSelectValue:"ALL"},Rl(e.props.initialData))),mn(Cn(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),mn(Cn(e),"getJSON",(function(){return e.state.rules.map((function(t,n){var o="ALL"===e.state.andOrSelectValue?"AND":"OR";n===e.state.rules.length-1&&(o="TERMINATOR");var a=e.ruleRefs[n],r=[];return a&&(r=a.getJSON()),{id:t.id||C(),term_type:"group",condition:o,term_value:r}}))})),mn(Cn(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isComplete()}))})),mn(Cn(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isValid()}))})),mn(Cn(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),mn(Cn(e),"onRuleUpdate",(function(t,n,o){var a=e.state.rules.map((function(e){return e.id===t?an(an({},e),{},{isComplete:n,termValue:o}):e}));e.setState({rules:a}),e.props.onUpdate(e.props.groupId,e.isComplete())})),mn(Cn(e),"addRule",(function(){var t=C(),n=[].concat(Tn(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),mn(Cn(e),"addGroup",(function(){var t=C(),n=[].concat(Tn(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),mn(Cn(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),mn(Cn(e),"renderAllAnySelect",(function(){return f.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",f.createElement(Dl,{options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),mn(Cn(e),"renderDeleteGroupBtn",(function(){return e.props.readOnly||e.props.onlyGroup?null:f.createElement("div",{className:"react-autoql-notification-group-delete-btn",onClick:function(){return e.props.onDelete(e.props.groupId)}},f.createElement(Wn,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),mn(Cn(e),"renderAddBtn",(function(){return e.props.readOnly?null:f.createElement("div",{className:"notification-rule-btn-container"},f.createElement("div",{className:"react-autoql-notification-rule-add-btn",onClick:e.addRule},f.createElement(Wn,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),mn(Cn(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return f.createElement(Rn,null,f.createElement("div",{className:"notification-group-wrapper",style:{marginLeft:e.props.onlyGroup?"0px":"50px"}},!e.props.onlyGroup&&f.createElement("div",{className:"notification-and-or-break",style:{top:e.props.hideTopCondition?"0px":"-19px",height:e.props.hideTopCondition?"100%":"calc(100% + 19px)"}},!e.props.hideTopCondition&&f.createElement("div",{className:"notification-and-or-text",style:{background:"ALL"===e.props.topCondition?"#bae9ff":"#fffaca",border:"ALL"===e.props.topCondition?"1px solid rgb(144, 221, 255)":"1px solid #FFEB3B"}},"ALL"===e.props.topCondition?"AND":"OR")),f.createElement("div",{className:"react-autoql-notification-group-container".concat(t?" disable-first-delete":""),"data-test":"rule-group"},e.state.rules.map((function(t,o){return"rule"===t.type?f.createElement(xl,{authentication:e.props.authentication,ref:function(t){return e.ruleRefs[o]=t},ruleId:t.id,key:t.id,initialData:t.termValue,onDelete:function(){return e.deleteRuleOrGroup(t.id)},onUpdate:e.onRuleUpdate,onAdd:e.addRule,readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation}):"group"===t.type?f.createElement(n,{authentication:e.props.authentication,groupId:t.id,key:t.id,initialData:t.termValue,onDelete:function(){return e.deleteRuleOrGroup(t.id)},readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation}):void 0})),e.renderAllAnySelect(),e.renderDeleteGroupBtn(),e.renderAddBtn())))})),mn(Cn(e),"renderReadOnlyGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1,o=null;return"ALL"===e.state.andOrSelectValue?o="AND":"ANY"===e.state.andOrSelectValue&&(o="OR"),f.createElement(Rn,null,f.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,a){return"rule"===t.type?f.createElement(xl,{key:"rule-readonly-".concat(t.id),ref:function(t){return e.ruleRefs[a]=t},ruleId:t.id,initialData:t.termValue,andOrValue:a!==e.state.rules.length-1?o:null,enableQueryValidation:!1,readOnly:!0}):"group"===t.type?f.createElement("div",{key:"group-".concat(t.id)},f.createElement(n,{authentication:e.props.authentication,groupId:t.id,initialData:t.termValue,enableQueryValidation:!1,readOnly:!0}),a!==e.state.rules.length-1&&f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},o))):void 0}))))})),mn(Cn(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return pn(n)}();mn(Il,"propTypes",{authentication:nr,groupId:b.string,onDelete:b.func,onUpdate:b.func,disableAddGroupBtn:b.bool,hideTopCondition:b.bool,readOnly:b.bool,enableQueryValidation:b.bool}),mn(Il,"defaultProps",{authentication:Mo,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var Al=function(t){var n={},o=[];return e(t,"length")?(t.map((function(e){o.push({initialData:e.term_value,isComplete:!0,type:"group",id:e.id})})),n={groups:o,andOrValue:"OR"===t[0].condition?"ANY":"ALL"}):(o.push({id:C(),isComplete:!1}),n={groups:o}),n},Nl=function(e){gn(o,f.Component);var t=Sn(o);function o(){var e;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),mn(Cn(e),"state",an({groups:[],andOrValue:"ALL"},Al(e.props.expression))),mn(Cn(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"componentDidUpdate",(function(t,o){n(t.expression,e.props.expression)||e.setState(an({},Al(e.props.expression))),n(o,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isComplete()}))})),mn(Cn(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isValid()}))})),mn(Cn(e),"getJSON",(function(){return e.state.groups.map((function(t,n){var o="ALL"===e.state.andOrValue?"AND":"OR";n===e.state.groups.length-1&&(o="TERMINATOR");var a=e.groupRefs[n],r=[];return a&&(r=a.getJSON()),{id:t.id||C(),term_type:"group",condition:o,term_value:r}}))})),mn(Cn(e),"addGroup",(function(t){var n=t.initialData,o=t.isComplete,a=t.id||C(),r=[].concat(Tn(e.state.groups),[{initialData:n,isComplete:o,id:a}]);e.setState({groups:r})})),mn(Cn(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),mn(Cn(e),"getAndOrValue",(function(){return e.state.andOrValue})),mn(Cn(e),"onGroupUpdate",(function(t,n){var o=e.state.groups.map((function(e){return e.id===t?an(an({},e),{},{isComplete:n}):e}));e.setState({groups:o}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),mn(Cn(e),"renderReadOnlyRules",(function(){var t=e.state.groups.length<=1,n=null;return"ALL"===e.state.andOrValue?n="AND":"ANY"===e.state.andOrValue&&(n="OR"),f.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!!e.state.groups.length&&e.state.groups.map((function(o,a){return f.createElement("div",{key:"expression-group-readonly-".concat(o.id,"-").concat(a)},f.createElement(Il,{ref:function(t){return e.groupRefs[a]=t},groupId:o.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===a,topCondition:e.state.andOrValue,onlyGroup:t,initialData:o.initialData,readOnly:e.props.readOnly,enableQueryValidation:!1}),a!==e.state.groups.length-1&&f.createElement("div",{style:{textAlign:"center",margin:"2px"}},f.createElement("span",{className:"read-only-rule-term",style:{width:"100%"}},n)))})))})),mn(Cn(e),"renderRules",(function(){var t=e.state.groups.length<=1;return f.createElement("div",{className:"data-alerts-container ".concat(e.props.readOnly?"read-only":"")},!t&&f.createElement("div",{className:"notification-rule-and-or-select",style:{marginBottom:"10px"}},"Notify me when"," ",f.createElement(Dl,{options:["ALL","ANY"],value:e.state.andOrValue,type:"button",onChange:function(t){return e.setState({andOrValue:t})}})," ","of the following conditions are met:"),f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},!!e.state.groups.length&&e.state.groups.map((function(n,o){return f.createElement(Il,{authentication:e.props.authentication,ref:function(t){return e.groupRefs[o]=t},key:"group-".concat(n.id,"-").concat(o),groupId:n.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===o,topCondition:e.state.andOrValue,onlyGroup:t,initialData:n.initialData,readOnly:e.props.readOnly,enableQueryValidation:e.props.enableQueryValidation})})),!e.props.readOnly&&f.createElement("div",{className:"notification-rule-add-group-btn",onClick:e.addGroup,"data-tip":"Add Condition Group","data-for":"notification-expression-tooltip"},f.createElement(Wn,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),!e.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return pn(o)}();mn(Nl,"propTypes",{authentication:nr,expression:b.arrayOf(b.shape({})),readOnly:b.bool,onChange:b.func}),mn(Nl,"defaultProps",{authentication:Mo,expression:void 0,readOnly:!1,onChange:function(){}});var wl=Ht.tz.names().map((function(e){return{value:e,label:e}})),kl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){var e=o.getSelectedOption();o.props.onChange(e)})),mn(Cn(o),"getSelectedOption",(function(){var e,t=o.props.value||o.defaultTimeZone;return null===(e=wl.find((function(e){return e.label===t})))||void 0===e?void 0:e.value})),mn(Cn(o),"render",(function(){var e=o.getSelectedOption();return f.createElement(xo,{className:"react-autoql-timezone-select",options:wl,value:e,onChange:o.props.onChange,menuPlacement:"top",maxMenuHeight:180,popoverParentElement:o.props.popoverParentElement,popoverBoundaryElement:o.props.popoverBoundaryElement,label:o.props.label,isSearchable:!0})})),o.defaultTimeZone=Ht.tz.guess(),o}return pn(n)}();mn(kl,"propTypes",{onChange:b.func,value:b.string,label:b.string}),mn(kl,"defaultProps",{onChange:function(){},value:void 0,label:""});var Pl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),mn(Cn(o),"componentDidUpdate",(function(e){o.props.interval!==e.interval&&o.setState({optionArray:o.getOptionArray()})})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"onChange",(function(e){var t=o.state.optionArray.find((function(t){return t.value===e}));o.props.onChange(t)})),mn(Cn(o),"isValid",(function(){var e=!!o.props.value,t=!!o.state.optionArray.find((function(e){return e.value===o.props.value}));return e&&t})),mn(Cn(o),"getOptionArray",(function(){var e=o.props.interval;60%e!=0&&(console.warn("Interval provided to TimePicker was invalid. 60 is not divisible ".concat(e,".")),e=30);for(var t=60/e,n=[],a=0;a<24;a++)for(var r=0;r<t;r++){var i="am";a>=12&&(i="pm");var l=a%12;0===l&&(l=12);var s=o.minuteFormatter.format(r*e);n.push({ampm:i,minute:s,hour:l,hour24:a,value:"".concat(l,":").concat(s).concat(i),value24hr:"".concat(a,":").concat(s)})}return n})),mn(Cn(o),"render",(function(){return f.createElement(xo,{options:o.state.optionArray.map((function(e){return{value:e.value}})),value:o.props.value,onChange:o.onChange})})),o.minuteFormatter=new Intl.NumberFormat("en-US",{minimumIntegerDigits:2,minimumFractionDigits:0});var a=o.getOptionArray();return o.state={selectedTime:o.props.value,optionArray:a},o}return pn(n)}();mn(Pl,"propTypes",{value:b.string,interval:b.number}),mn(Pl,"defaultProps",{value:void 0,interval:30});var Ol=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a,r,i,l,s,c;un(this,n),mn(Cn(c=t.call(this,e)),"componentDidMount",(function(){c._isMounted=!0,c.isCompleteChanged()&&c.props.onCompleteChange(c.isFormComplete)})),mn(Cn(c),"componentDidUpdate",(function(e){var t,n;if(c.isCompleteChanged()&&c.props.onCompleteChange(c.isFormComplete),(null===(t=c.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text)!==(null===(n=e.queryResponse)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.text)&&(c.timeRange=Wr(props.queryResponse)),c.props.frequencyType!==e.frequencyType){c.getInitialStateFromDataAlert(c.props,state),c.setState({})}})),mn(Cn(c),"componentWillUnmount",(function(){c._isMounted=!1})),mn(Cn(c),"isComplete",(function(){var e;return!!c._isMounted&&(!(c.shouldRenderResetPeriodSelector()&&!c.state.resetPeriodSelectValue)&&(!(c.shouldRenderEvaluationFrequencySelector()&&!c.state.evaluationFrequencySelectValue)&&!(null!==(e=c.timePickerRef)&&void 0!==e&&e._isMounted&&!c.timePickerRef.isValid())))})),mn(Cn(c),"isCompleteChanged",(function(){var e=c.isComplete();return e!==c.isFormComplete&&(c.isFormComplete=e,!0)})),mn(Cn(c),"getInitialStateFromDataAlert",(function(e,t){var n=e.dataAlert;try{var a,r,i;if(t.frequencyType=null!==(a=null!==(r=e.frequencyType)&&void 0!==r?r:null==n?void 0:n.notification_type)&&void 0!==a?a:c.DEFAULT_FREQUENCY_TYPE,t.evaluationFrequencySelectValue=null==n?void 0:n.evaluation_frequency,t.timezone=null==n?void 0:n.time_zone,t.resetPeriodSelectValue=null==n?void 0:n.reset_period,!t.resetPeriodSelectValue&&"SCHEDULED"!==t.frequencyType&&c.SUPPORTED_CONDITION_TYPE===Lr)t.resetPeriodSelectValue=null!==(i=c.timeRange)&&void 0!==i?i:c.DEFAULT_RESET_PERIOD_SELECT_VALUE;if(null===t.resetPeriodSelectValue&&(t.resetPeriodSelectValue="NONE"),"SCHEDULED"===t.frequencyType){var l,s,u,d,p=null==n?void 0:n.schedules,m=null!==(l=null==p||null===(s=p[0])||void 0===s?void 0:s.notification_period)&&void 0!==l?l:c.DEFAULT_RESET_PERIOD_SELECT_VALUE;if(t.resetPeriodSelectValue=m,t.intervalTimeSelectValue=null!==(u=function(e,t){if(e&&t){var n=o(e).tz(t),a=n.hour(),r=a%12;return 0===r&&(r=12),{ampm:n.format("a"),value:n.format("h:mma"),value24hr:n.format("H:mm"),minute:n.minute(),hour24:a,hour:r}}}(null==p||null===(d=p[0])||void 0===d?void 0:d.start_date,null==n?void 0:n.time_zone))&&void 0!==u?u:c.DEFAULT_TIME_SELECT_VALUE,"MONTH_LAST_DAY"===m)t.resetPeriodSelectValue="MONTH",t.monthDaySelectValue="LAST";else if("MONTH"===m)t.monthDaySelectValue="FIRST";else if("WEEK"===m&&7===n.schedules.length)t.resetPeriodSelectValue="DAY";else if("WEEK"===m){var f;t.weekDaySelectValue=function(e,t){var n=o(e).tz(t).day();return io[n]}(null===(f=p[0])||void 0===f?void 0:f.start_date,null==n?void 0:n.time_zone)}}}catch(e){console.error(e)}})),mn(Cn(c),"getSummary",(function(){var e;return"".concat(c.state.resetPeriodSelectValue," ").concat(c.getDayOfSelection(c.state.resetPeriodSelectValue)," ").concat(null===(e=c.state.intervalTimeSelectValue)||void 0===e?void 0:e.value," ").concat(c.state.timezone)})),mn(Cn(c),"getData",(function(){var e=c.getNotificationType(),t="SCHEDULED"!==c.state.frequencyType?c.getResetPeriod():void 0,n=c.getSchedules(),o=c.state.timezone;return{notificationType:e,evaluationFrequency:c.state.evaluationFrequencySelectValue,resetPeriod:t,schedules:n,timezone:o}})),mn(Cn(c),"getNotificationPeriod",(function(){return"MONTH"===c.state.resetPeriodSelectValue&&"LAST"===c.state.monthDaySelectValue?"MONTH_LAST_DAY":c.state.resetPeriodSelectValue})),mn(Cn(c),"getLocalStartDate",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.daysToAdd;return null===(e=zr[c.state.resetPeriodSelectValue])||void 0===e?void 0:e.getLocalStartDate({timeObj:c.state.intervalTimeSelectValue,timezone:c.state.timezone,monthDay:c.state.monthDaySelectValue,weekDay:c.state.weekDaySelectValue,daysToAdd:n})})),mn(Cn(c),"getSchedules",(function(){if("SCHEDULED"===c.state.frequencyType){if("DAY"===c.state.resetPeriodSelectValue){var e=[];return ro.forEach((function(t,n){e.push({notification_period:"WEEK",start_date:c.getLocalStartDate({daysToAdd:n}),time_zone:c.state.timezone})})),e}return[{notification_period:c.getNotificationPeriod(),start_date:c.getLocalStartDate(),time_zone:c.state.timezone}]}})),mn(Cn(c),"getResetPeriod",(function(){return"NONE"===c.state.resetPeriodSelectValue?null:c.state.resetPeriodSelectValue})),mn(Cn(c),"getNotificationType",(function(){return c.state.frequencyType===Or&&"NONE"!==c.state.resetPeriodSelectValue?Pr:c.state.frequencyType})),mn(Cn(c),"shouldRenderResetPeriodSelector",(function(){return"SCHEDULED"!==c.state.frequencyType&&c.SUPPORTED_CONDITION_TYPE===Lr})),mn(Cn(c),"renderQuery",(function(){var e,t=null===(e=c.props.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text;return t=t[0].toUpperCase()+t.substring(1),f.createElement("div",null,"Query: ",t)})),mn(Cn(c),"getResetPeriodSelectValue",(function(){var e=c.props.dataAlert;return e?e.notification_type!==Pr?Hr[e.reset_period]:void 0:c.timeRange})),mn(Cn(c),"scheduleIntervalSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{options:Object.keys(zr).map((function(e){return{value:e,label:zr[e].displayName}})),label:"Send a Notification",value:c.state.resetPeriodSelectValue,onChange:function(e){return c.setState({resetPeriodSelectValue:e})}}))})),mn(Cn(c),"dayOfWeekSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{value:c.state.weekDaySelectValue,onChange:function(e){return c.setState({weekDaySelectValue:e})},options:ro.map((function(e){return{value:e,label:f.createElement("span",null,"on ",f.createElement("strong",null,e))}}))}))})),mn(Cn(c),"dayOfMonthSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{value:c.state.monthDaySelectValue,onChange:function(e){return c.setState({monthDaySelectValue:e})},options:Object.keys(Qr).map((function(e){return{value:e,label:Qr[e]}}))}))})),mn(Cn(c),"dayOfYearSelector",(function(){return f.createElement("span",{className:"schedule-builder-day-of-year-selector"},f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-at-connector"},f.createElement("span",null,"in")),f.createElement(xo,{options:no.map((function(e){return{value:e}})),value:c.state.monthOfYearSelectValue,onChange:function(e){return c.setState({monthOfYearSelectValue:e})}}),c.dayOfMonthSelector())})),mn(Cn(c),"getDayOfSelection",(function(e){switch(e){case"YEAR":return c.state.monthOfYearSelectValue;case"MONTH":return c.state.monthDaySelectValue;case"WEEK":return c.state.weekDaySelectValue}return null})),mn(Cn(c),"dayOfSelector",(function(){switch(c.state.resetPeriodSelectValue){case"YEAR":return c.dayOfYearSelector();case"MONTH":return c.dayOfMonthSelector();case"WEEK":return c.dayOfWeekSelector()}return null})),mn(Cn(c),"hourMinSelector",(function(){var e;return f.createElement(f.Fragment,null,f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-at-connector"},f.createElement("span",null,"at")),f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(Pl,{ref:function(e){return c.timePickerRef=e},value:null===(e=c.state.intervalTimeSelectValue)||void 0===e?void 0:e.value,onChange:function(e){c.setState({intervalTimeSelectValue:e})}})))})),mn(Cn(c),"timezoneSelector",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-option schedule-builder-timezone-section"},f.createElement("div",null,f.createElement(kl,{value:c.state.timezone,onChange:function(e){return c.setState({timezone:e})},popoverParentElement:c.props.popoverParentElement,popoverBoundaryElement:c.props.popoverBoundaryElement,label:"Time Zone"})))})),mn(Cn(c),"shouldRenderEvaluationFrequencySelector",(function(){var e,t;return(t=null===(e=c.state)||void 0===e?void 0:e.frequencyType)===Or||t===Pr})),mn(Cn(c),"evaluationFrequencySelector",(function(){if(c.shouldRenderEvaluationFrequencySelector()){var e="How often should we run the query to check for new data? (You will only be notified if there is new data)";c.SUPPORTED_CONDITION_TYPE===Lr&&(e="How often should we run the query to check if the conditions are met?");var t=Object.keys(Ur).map((function(e){var t=Ur[e];return{value:null==t?void 0:t.value,label:null==t?void 0:t.label,listLabel:null==t?void 0:t.listLabel}}));return f.createElement("div",{className:"react-autoql-data-alert-frequency-option check-frequency"},f.createElement(xo,{options:t,value:c.state.evaluationFrequencySelectValue,label:f.createElement("span",null,"Check conditions every"," ",f.createElement(Wn,{className:"react-autoql-info-tooltip",type:"info","data-for":c.props.tooltipID,"data-tip":e})),onChange:function(e){return c.setState({evaluationFrequencySelectValue:e})}}))}return null})),mn(Cn(c),"resetPeriodSelector",(function(){return c.shouldRenderResetPeriodSelector()?f.createElement("div",{className:"react-autoql-data-alert-frequency-option"},f.createElement(xo,{options:Object.keys(Hr).map((function(e){return{value:e,label:Hr[e].displayName}})).filter((function(e){return"NONE"!==(null==e?void 0:e.value)||c.SUPPORTED_CONDITION_TYPE===Mr})),label:"Send a notification",value:c.state.resetPeriodSelectValue,onChange:function(e){return c.setState({resetPeriodSelectValue:e})}})):null})),mn(Cn(c),"scheduleFrequencyOptions",(function(){return f.createElement("div",null,f.createElement("div",{className:"react-autoql-data-alert-frequency-options-container"},c.scheduleIntervalSelector(),c.dayOfSelector(),c.hourMinSelector(),c.timezoneSelector()))})),mn(Cn(c),"continuousFrequencyOptions",(function(){return f.createElement("div",{className:"react-autoql-data-alert-frequency-options-container continuous-alert"},c.evaluationFrequencySelector(),c.resetPeriodSelector())})),mn(Cn(c),"getConditionStatement",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tense,n=e.useRT,o=e.sentenceCase,a=e.withFilters,r=c.props.expressionRef;return r?r.getConditionStatement({tense:t,useRT:n,sentenceCase:o,withFilters:a}):"the Data Alert is triggered"})),mn(Cn(c),"frequencyTypeSection",(function(){var e,t,n,o,a,r;if(!c.props.showTypeSelector)return null;null!==(e=null!==(t=null===(n=c.props.expressionRef)||void 0===n?void 0:n.getFirstQuery())&&void 0!==t?t:null===(o=c.props.queryResponse)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.text)&&void 0!==e||null===(a=c.props.dataAlert)||void 0===a||null===(a=a.expression)||void 0===a||null===(a=a[0])||void 0===a||a.term_value;var i=c.state.frequencyType;return i===Pr&&(i=Or),f.createElement("div",{className:"frequency-type-container"},f.createElement("span",null,f.createElement("span",null,"If ",null!==(r=c.props.conditionStatement)&&void 0!==r?r:c.getConditionStatement({tense:"present",sentenceCase:!1}),", you'll be notified"),f.createElement(xo,{className:"data-alert-schedule-step-type-selector",options:Object.keys(Fr).map((function(e){var t,n;return{value:e,label:null===(t=Fr[e])||void 0===t?void 0:t.label,listLabel:null===(n=Fr[e])||void 0===n?void 0:n.listLabel}})),value:i,onChange:function(e){return c.setState({frequencyType:e})},outlined:!1})))})),mn(Cn(c),"frequencyOptionsSection",(function(){var e=null;switch(c.state.frequencyType){case"SCHEDULED":e=c.scheduleFrequencyOptions();break;case Or:case Pr:e=c.continuousFrequencyOptions()}return e?f.createElement("div",{className:"frequency-settings-container"},e):null})),mn(Cn(c),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{className:"data-alert-schedule-builder-step","data-test":"schedule-builder"},c.frequencyTypeSection(),c.frequencyOptionsSection()))})),c.COMPONENT_KEY=C(),c.SUPPORTED_CONDITION_TYPE=null!==(a=null===(r=Ar(null===(i=e.dataAlert)||void 0===i?void 0:i.expression,e.queryResponse))||void 0===r?void 0:r[0])&&void 0!==a?a:Mr,c.DEFAULT_EVALUATION_FREQUENCY=5,c.DEFAULT_WEEKDAY_SELECT_VALUE="Friday",c.DEFAULT_MONTH_DAY_SELECT_VALUE="LAST",c.DEFAULT_MONTH_OF_YEAR_SELECT_VALUE="December",c.DEFAULT_FREQUENCY_TYPE="SCHEDULED",c.DEFAULT_RESET_PERIOD_SELECT_VALUE="MONTH",c.DEFAULT_TIME_SELECT_VALUE={ampm:"pm",minute:0,hour:5,hour24:17,value:"5:00pm",value24hr:"17:00"},c.timeRange=Wr(e.queryResponse),void 0!==(null===(l=e.dataAlert)||void 0===l?void 0:l.reset_period)&&(c.timeRange=e.dataAlert.reset_period);var u={evaluationFrequencySelectValue:c.DEFAULT_EVALUATION_FREQUENCY,frequencyType:c.DEFAULT_FREQUENCY_TYPE,intervalTimeSelectValue:c.DEFAULT_TIME_SELECT_VALUE,weekDaySelectValue:c.DEFAULT_WEEKDAY_SELECT_VALUE,monthOfYearSelectValue:c.DEFAULT_MONTH_OF_YEAR_SELECT_VALUE,resetPeriodSelectValue:null!==(s=c.timeRange)&&void 0!==s?s:c.DEFAULT_RESET_PERIOD_SELECT_VALUE,monthDaySelectValue:c.DEFAULT_MONTH_DAY_SELECT_VALUE,timezone:void 0};return e.dataAlert&&c.getInitialStateFromDataAlert(e,u),c.state=u,c}return pn(n)}();mn(Ol,"propTypes",{conditionType:b.string,showTypeSelector:b.bool,dataAlert:b.shape({}),onChange:b.func,onCompleteChange:b.func,onErrorCallback:b.func}),mn(Ol,"defaultProps",{conditionType:Mr,showTypeSelector:!0,dataAlert:void 0,onChange:function(){},onCompleteChange:function(){},onErrorCallback:function(){}});var Ll=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o.props.steps&&o.props.steps.length||console.warn("No steps were provided to StepsHoz component")})),mn(Cn(o),"componentDidUpdate",(function(e,t){if(!Ma(o.state,t)||!Ma(o.props,e))return!0})),mn(Cn(o),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),mn(Cn(o),"isStepDisabled",(function(e,t){var n;return 0===e||e===o.props.activeStep||null!=t&&t.complete||null!==(n=o.props.steps)&&void 0!==n&&null!==(n=n[e-1])&&void 0!==n&&n.complete?"":" disabled"})),mn(Cn(o),"onClick",(function(e,t){t||o.props.onStepChange(e)})),mn(Cn(o),"render",(function(){return o.props.steps&&o.props.steps.length?f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-steps-hoz-".concat(o.COMPONENT_KEY),className:"react-autoql-steps-hoz-container","data-test":"react-autoql-steps"},o.props.steps.map((function(e,t){var n=o.isStepDisabled(t,e),a=o.props.activeStep===t,r=o.getStepStatus(e);return f.createElement("div",{key:"steps-hoz-".concat(o.COMPONENT_KEY,"-").concat(t),className:"react-autoql-step-hoz-container\n ".concat(r,"\n ").concat(a?" active":"","\n ").concat(n?" disabled":""),"data-test":"react-autoql-step-container-".concat(t)},0!==t&&f.createElement("div",{className:"react-autoql-step-connector-container"},f.createElement("span",{className:"react-autoql-step-connector"})),f.createElement("div",{className:"react-autoql-step-hoz"},f.createElement("button",{className:"react-autoql-step-hoz-dot",onClick:function(){return o.onClick(t,n)}},"complete"!==r||a?t+1:f.createElement(Wn,{type:"check"})),f.createElement("div",{className:"react-autoql-step-hoz-title-container","data-test":"react-autoql-step-hoz-title-".concat(t),onClick:function(){return o.onClick(t,n)}},f.createElement("span",{className:"react-autoql-step-hoz-title"},e.title))))})))):null})),o.COMPONENT_KEY=C(),o}return pn(n)}();mn(Ll,"propTypes",{steps:b.arrayOf(b.shape({})).isRequired,activeStep:b.number.isRequired}),mn(Ll,"defaultProps",{});var Ml=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"onDataAlertDelete",(function(){o.props.dataAlertId&&(o.setState({isDeletingDataAlert:!0}),function(e,t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(e,"?key=").concat(o);return r.delete(i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(o.props.dataAlertId,_o(o.props.authentication)).then((function(){o.props.onDelete(o.props.dataAlertId),o.props.onSuccessAlert("Data Alert was successfully deleted.")})).catch((function(e){console.error(e),o.props.onErrorCallback(e)})).finally((function(){o.setState({isDeletingDataAlert:!1})})))})),mn(Cn(o),"render",(function(){return f.createElement(Rn,null,f.createElement(El,{isVisible:o.props.isVisible,onConfirm:o.onDataAlertDelete,confirmLoading:o.state.isDeletingDataAlert,onClose:o.props.onClose,backText:"Go back",confirmText:"Delete",width:"450px"},f.createElement("h3",null,"Are you sure you want to delete this Data Alert?"),f.createElement("p",null,"You will no longer be notified about these changes in your data.")))})),o.state={isDeletingDataAlert:!1},o}return pn(n)}();mn(Ml,"propTypes",{authentication:nr,dataAlertId:b.string,isVisible:b.bool,onClose:b.func,onErrorCallback:b.func}),mn(Ml,"defaultProps",{authentication:Mo,dataAlertId:void 0,isVisible:!1,onClose:function(){},onErrorCallback:function(){}});var ql=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"focusTitleInput",(function(){var e;null===(e=o.titleInputRef)||void 0===e||e.focus()})),mn(Cn(o),"renderDataAlertNameInput",(function(){return f.createElement(xr,{ref:function(e){return o.titleInputRef=e},className:"react-autoql-notification-display-name-input",placeholder:'eg. "Budget alert!"',icon:"title",maxLength:"50",label:"Title",value:o.props.titleInput,onChange:o.props.onTitleInputChange})})),mn(Cn(o),"renderDataAlertMessageInput",(function(){return f.createElement(xr,{className:"react-autoql-notification-message-input",placeholder:'eg. "You have spent 80% of your budget for the month."',area:!0,maxLength:"200",label:"Message (optional)",value:o.props.messageInput,onChange:o.props.onMessageInputChange})})),mn(Cn(o),"renderDataAlertPreview",(function(){return f.createElement("div",{className:"data-alert-preview"},f.createElement(ns,{notification:{id:"preview-".concat(o.COMPONENT_KEY),title:o.props.titleInput||f.createElement("span",null,f.createElement("em",null,"[Title]")),message:o.props.messageInput,created_at:o.SAMPLE_CREATED_AT.toISOString(),state:"UNACKNOWLEDGED",expanded:!1}}))})),mn(Cn(o),"render",(function(){var e,t=null!==(e=o.props.conditionStatement)&&void 0!==e?e:"the Data Alert is triggered";return f.createElement("div",null,o.props.showConditionStatement?f.createElement("div",{className:"compose-message-section-condition-statement"},f.createElement("span",null,"If ",t,", you'll receive a notification with this ",f.createElement("strong",null,"title and message:"))):null,f.createElement("div",{className:"compose-message-section"},f.createElement("div",{className:"form-section"},o.renderDataAlertNameInput(),o.renderDataAlertMessageInput()),f.createElement("div",{className:"preview-section"},f.createElement("div",{className:"react-autoql-input-label"},"Preview"),o.renderDataAlertPreview())))})),o.COMPONENT_KEY=C(),o.SAMPLE_CREATED_AT=new Date,o}return pn(n)}();mn(ql,"propTypes",{titleInput:b.string,messageInput:b.string,onTitleInputChange:b.func,onMessageInputChange:b.func,showConditionStatement:b.bool}),mn(ql,"defaultProps",{titleInput:"",messageInput:"",showConditionStatement:!0,queryText:"",onTitleInputChange:function(){},onMessageInputChange:function(){}});var Vl=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,n=e.children;return f.createElement("div",{className:"react-autoql-data-alert-setting-section"},t?f.createElement("div",{className:"react-autoql-data-alert-setting-section-title"},t):null,n)},_l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.children,n=e.className;return f.createElement("div",{className:"react-autoql-flex-table-container ".concat(null!=n?n:""),role:"table"},null!=t?t:null)},Fl=function(e){e.horizontal;var t=e.vertical;return f.createElement("div",{className:"react-autoql-settings-vertical-divider ".concat(t?"react-autoql-settings-vertical-divider-vertical":"react-autoql-settings-vertical-divider-horizontal")})},zl=function(e){var t=e.children,n=e.flex,o=e.flexSize;return t?f.createElement("div",{className:"react-autoql-data-alert-setting-group",style:{flex:o,display:n?"flex":"block"}},t):null},Bl=function(e){var t=e.children,n=e.flex,o=e.flexSize;return t?f.createElement("div",{className:"react-autoql-data-alert-setting",style:{flex:o,display:n?"flex":"block"}},t):null},Hl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){o.isCompleteChanged()&&o.props.onCompleteChange(o.isFormComplete)})),mn(Cn(o),"getInitialState",(function(e){var t,n,a=(null!=e?e:o.props).currentDataAlert;if(!a)return{};var r=null==a?void 0:a.notification_type;return r===Pr&&(r=Or),{titleInput:null!==(t=a.title)&&void 0!==t?t:"",messageInput:null!==(n=a.message)&&void 0!==n?n:"",notificationType:r,evaluationFrequencySelectValue:a.reset_period,isConfirmDeleteModalVisible:!1,expressionKey:C(),filters:a.filters,expression:a.expression}})),mn(Cn(o),"isCompleteChanged",(function(){var e=o.isComplete();return e!==o.isFormComplete&&(o.isFormComplete=e,!0)})),mn(Cn(o),"getData",(function(){var e,t,n,a,r=null!==(e=null===(t=o.scheduleBuilderRef)||void 0===t?void 0:t.getData())&&void 0!==e?e:{},i=o.state.notificationType;return null!=r&&r.resetPeriod&&i===Or&&(i=Pr),{id:null===(n=o.props.currentDataAlert)||void 0===n?void 0:n.id,data_return_query:null===(a=o.props.currentDataAlert)||void 0===a?void 0:a.data_return_query,title:o.state.titleInput,message:o.state.messageInput,expression:S(o.state.expression),notification_type:i,reset_period:r.resetPeriod,time_zone:r.timezone,schedules:r.schedules,evaluation_frequency:r.evaluationFrequency}})),mn(Cn(o),"initializeFields",(function(e){o.setState(o.getInitialState(e))})),mn(Cn(o),"isComplete",(function(){return o.state.isConditionSectionComplete&&o.state.isScheduleSectionComplete&&!!o.state.titleInput})),mn(Cn(o),"onExpressionChange",(function(e,t,n){o.setState({expression:n,isConditionSectionComplete:e})})),mn(Cn(o),"AppearanceSettings",(function(){return f.createElement(ql,{titleInput:o.state.titleInput,messageInput:o.state.messageInput,onTitleInputChange:function(e){o.setState({titleInput:e.target.value})},onMessageInputChange:function(e){o.setState({messageInput:e.target.value})},showConditionStatement:!1})})),mn(Cn(o),"AlertTypeSetting",(function(){return f.createElement(xo,{value:o.state.notificationType,onChange:function(e){return o.setState({notificationType:e})},className:"react-autoql-alert-type-setting-select",label:"Alert Type",fullWidth:!0,options:[{value:"SCHEDULED",label:"Scheduled",subtitle:"Get notifications at specific times.",icon:"calendar"},{value:Or,label:"Live",subtitle:"Get notifications as soon as the conditions are met.",icon:"live"}]})})),mn(Cn(o),"ScheduleSettings",(function(){return f.createElement(Ol,{ref:function(e){return o.scheduleBuilderRef=e},key:"data-alert-settings-schedule-builder-".concat(o.state.notificationType),tooltipID:o.props.tooltipID,dataAlert:o.props.currentDataAlert,showTypeSelector:!1,onErrorCallback:o.props.onErrorCallback,frequencyType:o.state.notificationType,onCompleteChange:function(e){return o.setState({isScheduleSectionComplete:e})}})})),mn(Cn(o),"ConditionsSettings",(function(){return f.createElement(ei,{authentication:o.props.authentication,ref:function(e){return o.expressionRef=e},key:"expression-".concat(o.state.expressionKey),onChange:o.onExpressionChange,expression:o.state.expression,tooltipID:o.props.tooltipID})})),mn(Cn(o),"render",(function(){return o.props.currentDataAlert?f.createElement(Rn,null,f.createElement(_l,{className:"data-alert-settings-modal-content"},f.createElement(Vl,{title:"Conditions"},o.ConditionsSettings()),f.createElement(Fl,{horizontal:!0}),f.createElement(Vl,{title:"Timing"},f.createElement(zl,{flex:!0},f.createElement(Bl,{flexSize:1},o.AlertTypeSetting()),f.createElement(zl,{flexSize:2},f.createElement(Bl,null,o.ScheduleSettings())))),f.createElement(Fl,{horizontal:!0}),f.createElement(Vl,{title:"Appearance"},o.AppearanceSettings()))):null})),o.COMPONENT_KEY=C(),o.isFormComplete=!0,o.state=o.getInitialState(e),o}return pn(n)}();mn(Hl,"propTypes",{authentication:nr,currentDataAlert:b.shape({}),onErrorCallback:b.func,onExpressionChange:b.func,onCompleteChange:b.func}),mn(Hl,"defaultProps",{authentication:Mo,currentDataAlert:void 0,onErrorCallback:function(){},onExpressionChange:function(){},onCompleteChange:function(){}});var Ql=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){if(!o.props.isVisible&&e.isVisible&&(setTimeout(o.initializeFields,500),o.props.onClosed()),o.props.isVisible&&!e.isVisible)o.initializeFields();else if(o.props.isVisible){var n;if(o.state.activeStep!==t.activeStep)if(o.state.activeStep===o.getStepNumber(o.MESSAGE_STEP))null===(n=o.appearanceSectionRef)||void 0===n||n.focusTitleInput();if(!o.state.isFrequencySectionReady&&t.isFrequencySectionReady){var a=o.getStepNumber(o.FREQUENCY_STEP),r=Tn(o.state.completedSections);r[a]=!1,o.setState({completedSections:r})}}})),mn(Cn(o),"showConditionsStep",(function(){return o.conditionsEditable()||o.hasFilters()})),mn(Cn(o),"getSteps",(function(e){var t,n=null!=e?e:o.props;o.SUPPORTED_CONDITION_TYPES=Ar(null===(t=n.currentDataAlert)||void 0===t?void 0:t.expression,n.queryResponse);var a=[{title:"Configure Timing",value:o.FREQUENCY_STEP},{title:"Customize Appearance",value:o.MESSAGE_STEP}];return o.showConditionsStep()&&a.unshift({title:"Set Up Conditions",value:o.CONDITIONS_STEP}),a})),mn(Cn(o),"getInitialState",(function(e){var t,n=null!=e?e:o.props,a={titleInput:"",messageInput:"",expressionJSON:[],isConfirmDeleteModalVisible:!1,selectedConditionType:null===(t=o.SUPPORTED_CONDITION_TYPES)||void 0===t?void 0:t[0],activeStep:0,completedSections:[],expressionKey:C(),isMounted:!1,isSettingsFormComplete:!0};if(n.currentDataAlert){var r,i,l,s,c,u=n.currentDataAlert;a.titleInput=null!==(r=u.title)&&void 0!==r?r:"",a.messageInput=null!==(i=u.message)&&void 0!==i?i:"",a.selectedConditionType=null!==(l=null===(s=u.expression)||void 0===s||null===(s=s[0])||void 0===s?void 0:s.condition)&&void 0!==l?l:null===(c=o.SUPPORTED_CONDITION_TYPES)||void 0===c?void 0:c[0],a.activeStep=0,a.completedSections=o.steps.map((function(){return!0})),a.expressionJSON=null==u?void 0:u.expression}return a})),mn(Cn(o),"initializeFields",(function(e){o.steps=o.getSteps(e),o.setState(o.getInitialState(e))})),mn(Cn(o),"getDataAlertData",(function(){try{var e,t,n=o.props,a=n.currentDataAlert,r=n.queryResponse,i=o.state,l=i.titleInput,s=i.messageInput;if(null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id)return null===(t=o.settingsViewRef)||void 0===t?void 0:t.getData();var c,u=S(o.state.expressionJSON);if(o.expressionRef)c=o.expressionRef.getFirstQuery(),u=o.expressionRef.getJSON();else if(a)c=a.data_return_query,u=a.expression;else{var d,p,m=null==r||null===(d=r.data)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.text;c=m,u=[{id:C(),term_type:"QUERY",condition:Mr,term_value:m,user_selection:null==r||null===(p=r.data)||void 0===p||null===(p=p.data)||void 0===p||null===(p=p.fe_req)||void 0===p?void 0:p.disambiguation}]}var f={};return o.scheduleBuilderRef&&(f=o.scheduleBuilderRef.getData()),{title:l,data_return_query:c,message:s,expression:u,notification_type:f.notificationType,reset_period:f.resetPeriod,time_zone:f.timezone,schedules:f.schedules,evaluation_frequency:f.evaluationFrequency}}catch(e){console.error(e)}})),mn(Cn(o),"onExpressionChange",(function(e,t,n){o.setState({expressionJSON:n})})),mn(Cn(o),"isConditionSectionReady",(function(){var e,t;return!o.conditionsEditable()||null===(e=o.expressionRef)||void 0===e||!e._isMounted||(null===(t=o.expressionRef)||void 0===t?void 0:t.isComplete())})),mn(Cn(o),"onDataAlertSave",(function(){var e,t;o.setState({isSavingDataAlert:!0});var n=null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?null===(t=o.settingsViewRef)||void 0===t?void 0:t.getData():o.getDataAlertData(),a=an({dataAlert:n},_o(o.props.authentication));o.props.isManagement?(o.props.onManagementCreateDataAlert(n),o.setState({isSavingDataAlert:!1})):n.id?function(e){var t=e.dataAlert,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No rule to update"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/").concat(t.id,"?key=").concat(o);return r.put(i,t).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},a)).then((function(e){o.props.onSave(e),o.props.onSuccessAlert("Data Alert updated!"),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(null==e?void 0:e.message),o.setState({isSavingDataAlert:!1})})):function(e){var t=e.dataAlert,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i=S(t);delete i.id;var l="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(o);return r.post(l,i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},a)).then((function(e){o.props.onSave(e),o.props.onSuccessAlert("Data Alert created!"),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o.setState({isSavingDataAlert:!1})}))})),mn(Cn(o),"nextStep",(function(){if(o.isStepReady()){var e=Tn(o.state.completedSections);e[o.state.activeStep]=!0,o.setState({activeStep:o.state.activeStep+1,completedSections:e})}})),mn(Cn(o),"previousStep",(function(){o.state.activeStep>0&&o.setState({activeStep:o.state.activeStep-1})})),mn(Cn(o),"setStep",(function(e){o.setState({activeStep:e})})),mn(Cn(o),"isFinishBtnDisabled",(function(){var e;if(null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id)return!o.state.isSettingsFormComplete;var t=o.steps.length-1,n=!!o.steps.find((function(e,n){return n!==t&&!o.state.completedSections[n]})),a=o.isStepReady(t);return n||!a})),mn(Cn(o),"renderNextBtn",(function(){var e;return null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?f.createElement(wo,{type:"primary",loading:o.state.isSavingDataAlert,onClick:o.onDataAlertSave,disabled:o.isFinishBtnDisabled(),tooltipID:o.TOOLTIP_ID},"Save Changes"):o.state.activeStep===o.steps.length-1?f.createElement(wo,{type:"primary",loading:o.state.isSavingDataAlert,onClick:o.onDataAlertSave,disabled:o.isFinishBtnDisabled(),tooltipID:o.TOOLTIP_ID},"Finish & Save"):f.createElement(wo,{className:"react-autoql-data-alert-next-btn",onClick:o.nextStep,disabled:!o.isStepReady(),type:"primary",tooltipID:o.TOOLTIP_ID},"Next")})),mn(Cn(o),"renderBackBtn",(function(e){return 0===o.state.activeStep?null:f.createElement(wo,{className:e,tooltipID:o.TOOLTIP_ID,onClick:o.previousStep},"Back")})),mn(Cn(o),"renderCancelBtn",(function(){return f.createElement(wo,{tooltipID:o.TOOLTIP_ID,border:!1,onClick:function(e){e.stopPropagation(),o.modalRef&&o.modalRef.onClose()}},"Cancel")})),mn(Cn(o),"renderDeleteBtn",(function(){return f.createElement(wo,{type:"danger",onClick:function(){o.setState({isConfirmDeleteModalVisible:!0})},tooltipID:o.TOOLTIP_ID},"Delete Data Alert")})),mn(Cn(o),"renderFooter",(function(){return f.createElement("div",{className:"data-alert-modal-footer-container"},o.renderQuerySummary(),f.createElement("div",{ref:function(e){return o.footerElement=e},className:"react-autoql-data-alert-modal-footer"},f.createElement("div",{className:"modal-footer-button-container"},o.props.currentDataAlert&&o.props.allowDelete&&o.renderDeleteBtn()),f.createElement("div",{className:"modal-footer-button-container"},o.renderCancelBtn(),o.renderBackBtn(),o.renderNextBtn())))})),mn(Cn(o),"renderConditionTypeSelector",(function(){var e,t=null===(e=o.SUPPORTED_CONDITION_TYPES)||void 0===e?void 0:e.map((function(e){return{value:e,label:_r[e].displayName}}));return f.createElement(xo,{style:{width:"100%"},options:t,value:o.state.selectedConditionType,className:"react-autoql-rule-condition-type-select",onChange:function(e){o.setState({selectedConditionType:e})}})})),mn(Cn(o),"renderConditionsStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{flex:1}},f.createElement(ei,{authentication:o.props.authentication,ref:function(e){return o.expressionRef=e},key:"expression-".concat(o.state.expressionKey),onChange:o.onExpressionChange,expression:o.state.expressionJSON,queryResponse:o.props.queryResponse,tooltipID:o.TOOLTIP_ID,onLastInputEnterPress:o.nextStep,filters:o.props.filters}))))})),mn(Cn(o),"getConditionStatement",(function(){return o.conditionsEditable()?"the Data Alert conditions are met":"new data is detected for your query"})),mn(Cn(o),"renderFrequencyStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement(Ol,{ref:function(e){return o.scheduleBuilderRef=e},key:"schedule-".concat(o.COMPONENT_KEY),dataAlert:o.props.currentDataAlert,onCompleteChange:function(e){return o.setState({isFrequencySectionReady:e})},onErrorCallback:o.props.onErrorCallback,conditionType:o.state.selectedConditionType,conditionStatement:o.getConditionStatement(),queryResponse:o.props.queryResponse,expressionRef:o.expressionRef,tooltipID:o.TOOLTIP_ID}))})),mn(Cn(o),"renderComposeMessageStep",(function(e){return f.createElement("div",{className:"react-autoql-data-alert-modal-step ".concat(e?"":"hidden")},f.createElement(ql,{ref:function(e){return o.appearanceSectionRef=e},titleInput:o.state.titleInput,messageInput:o.state.messageInput,onTitleInputChange:function(e){return o.setState({titleInput:e.target.value})},onMessageInputChange:function(e){return o.setState({messageInput:e.target.value})},queryText:o.getQueryText(),showConditionStatement:!0,conditionStatement:o.getConditionStatement()}))})),mn(Cn(o),"getStepNumber",(function(e){return o.steps.findIndex((function(t){return t.value&&e&&t.value===e}))})),mn(Cn(o),"onDataAlertDelete",(function(){var e,t=null===(e=o.props.currentDataAlert)||void 0===e?void 0:e.id;t&&(o.setState({isConfirmDeleteModalVisible:!1}),o.props.onDelete(t))})),mn(Cn(o),"renderStepContent",(function(){var e=o.state.activeStep;return f.createElement(f.Fragment,null,o.renderConditionsStep(e===o.getStepNumber(o.CONDITIONS_STEP)),o.renderFrequencyStep(e===o.getStepNumber(o.FREQUENCY_STEP)),o.renderComposeMessageStep(e===o.getStepNumber(o.MESSAGE_STEP)))})),mn(Cn(o),"hasFilters",(function(){var e,t,n,a,r;return!!(null!==(e=o.props.filters)&&void 0!==e&&e.length||null!==(t=o.props.queryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.fe_req)&&void 0!==t&&null!==(t=t.session_filter_locks)&&void 0!==t&&t.length||null!==(n=o.props.queryResponse)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.data)&&void 0!==n&&null!==(n=n.fe_req)&&void 0!==n&&null!==(n=n.persistent_filter_locks)&&void 0!==n&&n.length||null!==(a=o.props.currentDataAlert)&&void 0!==a&&null!==(a=a.expression)&&void 0!==a&&null!==(a=a[0])&&void 0!==a&&null!==(a=a.session_filter_locks)&&void 0!==a&&a.length||null!==(r=o.props.currentDataAlert)&&void 0!==r&&null!==(r=r.expression)&&void 0!==r&&null!==(r=r[0])&&void 0!==r&&null!==(r=r.filters)&&void 0!==r&&r.length)})),mn(Cn(o),"conditionsEditable",(function(){var e;return null===(e=o.SUPPORTED_CONDITION_TYPES)||void 0===e?void 0:e.includes(Lr)})),mn(Cn(o),"onSettingsCompleteChange",(function(e){o.setState({isSettingsFormComplete:e})})),mn(Cn(o),"renderQuerySummary",(function(){var e,t;return o.state.activeStep===o.getStepNumber(o.CONDITIONS_STEP)||null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?null:f.createElement("div",{className:"data-alert-modal-query-summary-container"},f.createElement("div",{className:"data-alert-modal-query-summary-background"}),f.createElement("div",{className:"data-alert-modal-query-summary"},f.createElement("strong",null,"Your query:"),' "',null===(t=o.expressionRef)||void 0===t?void 0:t.getFormattedQueryText({sentenceCase:!1,withFilters:!0}),'"'))})),mn(Cn(o),"renderContent",(function(){var e;return o.props.isVisible?null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?f.createElement(Po,{className:"data-alert-modal-settings-scroll-container"},f.createElement(Hl,{ref:function(e){return o.settingsViewRef=e},authentication:o.props.authentication,currentDataAlert:o.props.currentDataAlert,enableQueryValidation:o.props.enableQueryValidation,supportedConditionTypes:o.SUPPORTED_CONDITION_TYPES,onErrorCallback:o.props.onErrorCallback,onCompleteChange:o.onSettingsCompleteChange,tooltipID:o.TOOLTIP_ID})):f.createElement(f.Fragment,null,f.createElement(Ll,{activeStep:o.state.activeStep,onStepChange:o.setStep,steps:o.steps.map((function(e,t){return{title:e.title,complete:o.state.completedSections[t]}}))}),f.createElement("div",{className:"data-alert-modal-step-content-container"},o.renderStepContent())):null})),mn(Cn(o),"isStepReady",(function(){var e,t=o.state.activeStep;switch(null===(e=o.steps)||void 0===e||null===(e=e[t])||void 0===e?void 0:e.value){case o.CONDITIONS_STEP:return o.isConditionSectionReady();case o.FREQUENCY_STEP:return o.state.isFrequencySectionReady;case o.MESSAGE_STEP:return!!o.state.titleInput;default:return!1}})),mn(Cn(o),"getTitleIcon",(function(){return _e(o.props.currentDataAlert)?f.createElement("span",{key:"title-icon-".concat(o.COMPONENT_KEY)}):f.createElement(Wn,{key:"title-icon-".concat(o.COMPONENT_KEY),type:"settings"})})),mn(Cn(o),"getQueryText",(function(){var e,t,n;return null!==(e=null===(t=o.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text)&&void 0!==e?e:null===(n=o.props.currentDataAlert)||void 0===n?void 0:n.data_return_query})),mn(Cn(o),"render",(function(){var e,t;return o.getQueryText(),f.createElement(Rn,null,f.createElement(Sl,{contentClassName:"react-autoql-data-alert-creation-modal",bodyClassName:"react-autoql-data-alert-modal-body",overlayStyle:{zIndex:"9998"},title:null!==(e=o.props.currentDataAlert)&&void 0!==e&&e.id?"Edit Data Alert Settings":"Create Data Alert",titleIcon:o.getTitleIcon(),ref:function(e){return o.modalRef=e},isVisible:o.props.isVisible,onClose:o.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,width:"1200px",footer:o.renderFooter(),onOpened:o.props.onOpened,onClosed:o.props.onClosed},f.createElement(So,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:500,place:"top"}),f.createElement("div",{key:"data-alert-modal-content-".concat(o.COMPONENT_KEY),ref:function(e){return o.contentRef=e},className:"react-autoql-data-alert-modal-content"},o.renderContent())),f.createElement(Ml,{authentication:o.props.authentication,dataAlertId:null===(t=o.props.currentDataAlert)||void 0===t?void 0:t.id,isVisible:o.state.isConfirmDeleteModalVisible,onDelete:o.onDataAlertDelete,onClose:function(){return o.setState({isConfirmDeleteModalVisible:!1})},onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessAlert}))})),o.COMPONENT_KEY=C(),o.TOOLTIP_ID="react-autoql-data-alert-modal-tooltip-".concat(o.COMPONENT_KEY),o.CONDITIONS_STEP="CONDITIONS",o.FREQUENCY_STEP="FREQUENCY",o.MESSAGE_STEP="MESSAGE",o.steps=o.getSteps(e),o.state=o.getInitialState(e),o}return pn(n)}();mn(Ql,"propTypes",{authentication:nr,onErrorCallback:b.func,onSave:b.func,queryResponse:b.shape({}),currentDataAlert:b.shape({}),isVisible:b.bool,allowDelete:b.bool,onClose:b.func,isManagement:b.bool,onManagementCreateDataAlert:b.func,onManagementDeleteDataAlert:b.func,onSuccessAlert:b.func,enableQueryValidation:b.bool,onClosed:b.func,onOpened:b.func,editView:b.bool}),mn(Ql,"defaultProps",{authentication:Mo,onSave:function(){},onErrorCallback:function(){},currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},onSuccessAlert:function(){},onClosed:function(){},onOpened:function(){},enableQueryValidation:!0,editView:!1});var Ul=Ga(Ql),Yl=["type","hasError","style","onChange","checked","offText","onText"],Kl=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"toggleChecked",(function(){e.props.onChange(!e.props.checked)})),mn(Cn(e),"render",(function(){var t=e.props;t.type,t.hasError,t.style,t.onChange,t.checked,t.offText,t.onText;var n=yn(t,Yl),o=e.props.checked?e.props.onText:e.props.offText;return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-switch-container ".concat(e.props.checked?"react-autoql-switch-container-checked":"react-autoql-switch-container-unchecked"," ").concat(e.props.className),"data-test":"react-autoql-switch-container",style:e.props.style},f.createElement("span",{className:"toggle-switch-text-ruler"},o),f.createElement("div",{className:"react-autoql-toggle-switch"},f.createElement("input",fn({},n,{type:"checkbox","data-test":"react-autoql-switch",ref:function(t){return e.selector=t},checked:e.props.checked,disabled:e.props.disabled,onClick:function(e){return e.stopPropagation()},onChange:e.toggleChecked})),f.createElement("span",{className:"toggle-switch-slider",onClick:e.toggleChecked},f.createElement("span",{className:"toggle-switch-text"},o)))))})),e}return pn(n)}();mn(Kl,"propTypes",{hasError:b.bool,checked:b.bool,onChange:b.func,onText:b.string,offText:b.string}),mn(Kl,"defaultProps",{hasError:!1,checked:!1,onChange:function(){},onText:"",offText:""});var jl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r,i;return un(this,n),mn(Cn(i=t.call(this,e)),"componentDidUpdate",(function(e){var t,n;null!==(t=i.props.dataAlert)&&void 0!==t&&t.status&&i.props.dataAlert.status!==(null===(n=e.dataAlert)||void 0===n?void 0:n.status)&&i.setState({status:i.props.dataAlert.status})})),mn(Cn(i),"getDataAlertObj",(function(){return an(an({},i.props.dataAlert),{},{status:i.state.status,title:i.state.title,message:i.state.message})})),mn(Cn(i),"hasError",(function(){return"GENERAL_ERROR"===i.state.status||"EVALUATION_ERROR"===i.state.status||"DATA_RETURN_ERROR"===i.state.status})),mn(Cn(i),"isEnabled",(function(){return qr.includes(i.state.status)})),mn(Cn(i),"onInitializeClick",(function(e){var t;e.stopPropagation(),i.setState({isInitializing:!0}),gr(an({id:null===(t=i.props.dataAlert)||void 0===t?void 0:t.id},_o(i.props.authentication))).finally((function(){i.setState({isInitializing:!1}),i.props.onInitialize(i.props.dataAlert)}))})),mn(Cn(i),"onDeleteClick",(function(e){e.stopPropagation(),i.props.onDeleteClick()})),mn(Cn(i),"onEditClick",(function(e,t){e.stopPropagation(),"CUSTOM"===i.props.dataAlert.type&&i.openEditModal(t)})),mn(Cn(i),"openEditModal",(function(e){var t=i.getDataAlertObj();i.props.openEditModal(t,e)})),mn(Cn(i),"onEnableSwitchChange",(function(e){Eo();var t=i.state.status,n=e?"ACTIVE":"INACTIVE";i.setState({status:n}),hr(an(an({},_o(i.props.authentication)),{},{dataAlertId:i.props.dataAlert.id,type:i.props.dataAlert.type,status:n})).then((function(){i.props.onDataAlertStatusChange()})).catch((function(e){console.error(e),i.props.onErrorCallback(new Error("Something went wrong. Please try again.")),i.setState({status:t})}))})),mn(Cn(i),"getCycleFromResetPeriod",(function(e){var t,n;return e?null!==(t=null===(n=Hr[e])||void 0===n?void 0:n.displayText)&&void 0!==t?t:"-":"Continuous"})),mn(Cn(i),"getFrequencyTooltip",(function(){return null})),mn(Cn(i),"renderDataAlertCycle",(function(){var e,t=null===(e=i.props.dataAlert)||void 0===e?void 0:e.notification_type,n="-";if("SCHEDULED"===t){var o,a,r,l,s,c=null===(o=i.props.dataAlert)||void 0===o?void 0:o.schedules;if(7===(null==c?void 0:c.length))n=null===(a=Br.DAY)||void 0===a?void 0:a.displayText;else n=null!==(r=null===(l=Br[null==c||null===(s=c[0])||void 0===s?void 0:s.notification_period])||void 0===l?void 0:l.displayText)&&void 0!==r?r:"-"}else t!==Or&&t!==Pr||(n=i.getCycleFromResetPeriod(i.props.dataAlert.reset_period));return n})),mn(Cn(i),"renderDataAlertState",(function(){var e=i.props.dataAlert,t=i.hasError(),n=i.isEnabled(),o="CUSTOM"===e.type,a=n?"data-alert-on":"data-alert-off",r=!!e.reset_date,l=wr(e),s=kr(e.schedules);if(t)return f.createElement("div",{className:"data-alert-state data-alert-error ".concat(a),"data-for":i.props.tooltipID,"data-tip":o?"There was a problem with this Data Alert. Try restarting the Alert by clicking the <em>refresh</em> button. If the problem persists, please contact your system administrator.":"There was a problem with this Data Alert. For more information, please contact your system administrator."},f.createElement(Wn,{type:"warning-triangle"}),f.createElement("span",null,"Error"),o&&f.createElement(Wn,{type:"refresh",className:"react-autoql-notification-state-action-btn","data-for":i.props.tooltipID,onClick:i.onInitializeClick,spinning:i.state.isInitializing,disabled:i.state.isInitializing}));if(e.reset_date&&Nr(e))return f.createElement("div",{className:"data-alert-state data-alert-triggered ".concat(a)},f.createElement("span",{"data-tip":"This Alert has been triggered for this cycle. You will not receive notifications until the start of the next cycle, ".concat(l,".<br/>You can edit this in the <em>Data Alert Settings</em>"),"data-for":i.props.tooltipID},f.createElement(Wn,{type:"lightning"}),f.createElement("span",null,"Triggered")),o&&f.createElement(Wn,{type:"refresh",className:"react-autoql-notification-state-action-btn","data-for":i.props.tooltipID,"data-tip":r?"Restart Alert cycle (This will allow your Alert to be triggered again in the current frequency cycle)":"",onClick:i.onInitializeClick,spinning:i.state.isInitializing,disabled:i.state.isInitializing}));if("ACTIVE"===i.state.status&&"SCHEDULED"===e.notification_type){var c="This Alert runs on a schedule";return s&&(c="".concat(c," - a notification is scheduled for ").concat(s,". If your data hasn't changed by then, you will not receive a notification.")),f.createElement("div",{className:"data-alert-state data-alert-scheduled ".concat(a),"data-tip":c,"data-for":i.props.tooltipID},f.createElement(Wn,{type:"calendar"}),f.createElement("span",null,"Scheduled"))}return n?f.createElement("div",{className:"data-alert-state data-alert-active ".concat(a),"data-tip":"This Alert is live - Whenever the conditions are met, you will be notified.","data-for":i.props.tooltipID},f.createElement(Wn,{className:"react-autoql-icon-filled",type:"live"}),f.createElement("span",null,"Live")):f.createElement("div",{className:"data-alert-state data-alert-ready ".concat(a),"data-tip":"This Alert is ready to go live - you will start receiving notifications once you set the Alert Status to <em>Active</em>.","data-for":i.props.tooltipID},f.createElement(Wn,{type:"check"}),f.createElement("span",null,"Ready"))})),mn(Cn(i),"renderDataAlertCycleStart",(function(){var e=i.props.dataAlert;if(!e||i.hasError())return"-";if("SCHEDULED"===e.notification_type){var t=kr(e.schedules,!0);return t?f.createElement("span",null,t):"-"}if(!e.reset_date||!Nr(e)){var n,o=null!==(n=e.evaluation_frequency)&&void 0!==n?n:5;return"< ".concat(o,"m")}return f.createElement("span",null,wr(e,!0))})),mn(Cn(i),"render",(function(){var e=i.props.dataAlert,t=i.isEnabled(),n="CUSTOM"===e.type;return f.createElement("div",{className:"react-autoql-notification-setting-item\n ".concat(i.props.showHeader?"react-autoql-dataalert-show-header":"","\n ").concat(t?"data-alert-enabled":"data-alert-disabled","\n ").concat(e.type)},f.createElement("div",{className:"react-autoql-notification-setting-item-header"},f.createElement("div",{className:"react-autoql-notification-setting-display-name react-autoql-data-alert-list-item-section"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Data Alert Name")),f.createElement("div",{className:"data-alert-section-content"},f.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},f.createElement("span",null,i.state.title)))),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-frequency"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Notification Frequency")),f.createElement("div",{className:"data-alert-section-content data-alert-section-cycle","data-for":i.props.tooltipID,"data-tip":i.getFrequencyTooltip()},i.renderDataAlertCycle())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-state"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"State")),f.createElement("div",{className:"data-alert-section-content"},i.renderDataAlertState())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-next-check"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Next Check")),f.createElement("div",{className:"data-alert-section-content data-alert-section-cycle-start"},i.renderDataAlertCycleStart())),f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-status"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Status")),f.createElement("div",{className:"data-alert-section-content notification-status"},f.createElement(Kl,{checked:t,className:"react-autoql-notification-enable-checkbox",onClick:function(e){return e.stopPropagation()},"data-tip":t?"Active":"Inactive","data-for":i.props.tooltipID,onChange:i.onEnableSwitchChange,onText:"Active",offText:"Inactive"}))),n&&f.createElement("div",{className:"react-autoql-data-alert-list-item-section react-autoql-data-alert-list-item-section-actions"},f.createElement("div",{className:"data-alert-header-item"},f.createElement("span",null,"Actions")),f.createElement("div",{className:"data-alert-section-content"},f.createElement("div",{className:"react-autoql-notification-action-btn"},f.createElement(Wn,{type:"settings","data-for":i.props.tooltipID,"data-tip":"Open Data Alert settings",onClick:i.onEditClick})),f.createElement("div",{className:"react-autoql-notification-action-btn react-autoql-notification-action-btn-delete"},f.createElement(Wn,{type:"trash","data-for":i.props.tooltipID,"data-tip":"Delete Data Alert",onClick:i.onDeleteClick}))))))})),i.ACTION_HIDDEN_CLASS="react-autoql-notification-action-hidden",i.state={status:null===(o=e.dataAlert)||void 0===o?void 0:o.status,title:null===(a=e.dataAlert)||void 0===a?void 0:a.title,message:null===(r=e.dataAlert)||void 0===r?void 0:r.message,isInitializing:!1},i}return pn(n)}();mn(jl,"propTypes",{authentication:nr,onErrorCallback:b.func,onSuccessAlert:b.func,onDeleteClick:b.func,onDataAlertStatusChange:b.func}),mn(jl,"defaultProps",{authentication:Mo,onErrorCallback:function(){},onSuccessAlert:function(){},onDeleteClick:function(){},onDataAlertStatusChange:function(){}});var Wl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAPoCAMAAAB6fSTWAAABd1BMVEUAAADQ090zqN9ptN8sqN+6zN2ts8HK0d6+zt7O093Q1N3P09290dUop9/J0OApp9/D0N3M1N3F0tomp98rqN8uqN/Q1N3M0t0op99ktd6rx969ztsxqN9Mrt6jxt6nx97K0dwsqN44q9+cxN3O093O1Nw2qd85qt+aw97K0tzM0t7M3+Q6q99Drd89rN94ut7B0N3O1dzR1d8qqOAtqd9Jrd9Rsd9Xst8tqd9Brd7Q1dzO1NvL0dzH0dwwqOA2qt8+qt9Pr95qtd6Au95CrN9Rr99Lr99ltt5tt95xuN6Hvt6NwN6syN2yy93K0dwzqd8/rN+Avd6Lv9+Wwd7C0N3F094yqt8yqd9Frt9Ir99VsN5cs99ds954ud6Swd7L0t2/0dzA0N1ptN+0yt0vqd8yqd8/rN9jst5Wsd5ut99xuN2Gvt5bsd9jtN9ott5Prd1Mrt9ErN5Erd9Zs951t95puN6Txd5Eq99ctd5mttslp98npt4mpt6ODqAkAAAAenRSTlMAUud38VwCVVlLUEUF+wf3V0AM/fbvTkj5l2QY6rxnYyDzz2hTPOHbbDgjA9fHx4UzFQnz7cKppujDMy0oE+zc07CUgL22tZOQjHpxYV4b5dB8dnA8D+fiwLivoJqAbjEsKJxf5d7LoqGHhHSpmo8WiWuWekwuXE9FI0oh4zsAACZUSURBVHja7MGBAAAAAICg/akXqQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYPbgQAAAAAAAyP+1EVRVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVhZ272WUoDAIwPLNpUkeasGBrY4ENlsUtWLHvfbh5QSJ+qq1W6/t5nnt4M5PzTQ4AAAAAAAAAAAAAAAAAAAAAAAAAAAAU5Wo2jHM144NZAJUYneQfeNgPoDznuRXTwwD+3WTIHRjb62E1lczwhWz0sDP3+a+mAWzVWRZiHMCLBlb1ZUYB/JXHLNhtAJuaZQWGANZ1mTWxx0Ntn9bXcxzAyrJiBwEstZf1c1gDC0yyGTcBVPJQvpGjAD45zjZdBPBmyJZpHdqd5R8FdK2Hyl84p6FfN9mXgO4cZofcxNOX7NZ1QB+m2beA9iXu4Wlc8spYp2HJO7+moU29PaYtZ6zTnGSu/di5py0Jupf8aBpLCJ0qnCSLxUJCpwL9XLPXkvrTG6FjZ9+9SfxE6BQu+YW7mE/oFC35pduYR+gULFnDWXwndIqVrGmIr4ROmUbJJuIzoVOkZEOn8ZHQeWbvblqbCsIojp8HQqD2RSoSF3GhCxelIM1OqNl17a5rEcRtrK2onXx4iyJByMTEO/dm5nn+v+9wOOfOfauQoYBTrRB0VMdQyEx/EHRUxlDQtX4j6KjKxFCWfiHoqAjPtD9oJOpdLAl6ZO5+kFgN1eV7yvksuGfozYFqwnIPzNCrqapxT87DMvSsnv3+I+V8FFybGtZwGnWGe1SGgZxp/xjuQRkGU0Opp5yl4NfcsJG3qHMLPSTD4C61R09Tzlzw6pFhH7QrTuJAnTdool1wEgdi3qgj7cOblHMjuDQz7Je2w3AHdd60J/oXco5O3hpqoGHdppyR4JChEu+0EYUO/ovqgzbjxB3UuQsnGsjXlHMseMMTr/VRFsMd1LkfyhhouC8EX/jLUq3Uu/OUcy/4wpPt9dI6DHcw2525UK+OU86t4Ak31WqnHo0p9CAM1RvrL3xtAuTcpWfqySjlfBL8eGVog1Y4iQN17pZWePYV5NytAxV3xS30AC4NbdEDhjuoc++kgYb7teCEoUEXKuiG4e7euaFNDHds79DQqgGG+53ggqFhKmNOoXtnaNoHhju4PI+g1+H+WnDgzNA+dXVEoftmcIHhDnIegTp5nHJeCu0zuPGeQgdfgIyAl9awztTgi/7T85SzFFp3avCG4Q4uzyMoPNy/CY0zuKTdfaHQ/TI4dcJwBzkP4EWx4X4ltM3g2KF2cUehu2VwbcJwB2+rRVBiuI+Els0M/mlLCwrdKf6gGEPn4T4WGsbH4aLQNhKF7hM5j4OTuLgmhji65Hwh/GTvXnqiCKIwDNenjuiCSxAQ5GIQDBBATATxsgEVDAoh0RijMRiJbHSDJro4xY9XE2Nk6JnpbrqnTp36nj/A6p1zpqjpjhc7T4vrQPjCBpNAieHiniJQclw7J76VY0fRAiXItbbMgW4RKElc3NMCShRP4lICSpbLdMyBbtBVULoKLu59jiLF/5+nzZ0lfO6rPZznqXPNfnBxt+c2KHWuyQnvvppzF0Q8cbduEESnSx/k4m5OH4j+yLW4f3cUJxA1lS4c6OaA6K8R3n01C0T/LHQa6EeOogSi/wy63z5zoFsDolMWubgbBKImvPtqD4jOuMWBbgwiNTCzsyWnbT2fGQBVwrc07ihC44jKwLbk8+wGqDzPu6/GIBZrUsYRqIQVLu7GIAJ7Q3JO86CKBvpPRxGCdvelKnOgvPimNWOg2qRUbRqUwzw7twV63ZS6bII68Lz7aoraJ8qsS81AXNzTAZWWJAtb7x52bgsUGpMu6kGMfCVK/YFRR/GBOj3SbZcQn7pD7+dANwXaTEsQXxGZukPnCxtMUfaqhitSRNJf130leBKXhjfQZFuKSTr1ekNfZeemQJEhUWALsag3dN/SN0fRgR6iRSy35nwluLinAGqIKohBnaFvsnNLPkIJ0aYX+tUZum9pzlFsLkMHKa1/roE2JqctT/UaQ/etwVFsoMKwlLB0gPwaD6WMC9AtSOjAY0dxgQYfpKgDlLNr7QQ+SOiHh4cXy3OUj7WfrPUUnOM4rxdSTAOGvC0Senk8sFdlEeFJAe9QlVe2vqrn5zOAoRuH4CYltwFUbENyuwcjPENPEIKTnB6gHvOS1x4seOIzgKHbtoDAViWXfdTpIKX93WeYYujGITA1fa1ILl8QO58FDN02hDUkObxGlwxr+dCp04HPAIZuG8JS11VDcniKmPkMWwzdtkGEtC4drSEP2x8+1RKfAQzdNoQkHU0hiA3LpfsMYOi2ISTpZBbB7Jh8hmSrcCcYum2fEM575TNz1+ZQ7/UZwNBtQzgRVNQwePt91mcAQ7cN4Uh7L6HCjrS3j9h4hp6e6whG3Ul7K5P6F48iJnwGMHTbEMqYtHMNqoxaKt1nmEElRhzphFCGIivHTuk+C6rB50op9QiBSDtjUGhP2rmDWCzX2TlLVwqBRDkeR6UNj0j4DGOoCkv/xd59rUoRRFEY7iUmjBjAHDGBoKBiuDCLilcqggnxQlAR9AGqfHgvzM6emR6c2nvtmvU9wamm/1mNntNDCUHKDGfAK+Xn099q20FX6IxOIkbeXNbk/dG/+9K6c5VOCDHKdE/ALnnp1bAGS7VnEC6IkbsUrM3889f2g65JZ3MBIdL/hciJxKVXwwksl0ongwgb8kbyU+JnkmrYiqU7OggPhMiayN9e5zzG12rA0mnSqcBfL50nPciGatiI5VPpRBChTPMB2SQsvVrQxPpBOJxEgHxtzHAp22ku+nWuSacBd511DhxJdp5q+IxGNg/CAKOo845OVD0HXZNOAt6SVdHfmW76dq7SKcBbqia6PFU1nEZDZweJtgPubhTbJeSWpfTqPeiadAJw96jYXiC7rylKv+zfOZ4NspAOOkexPUR+pzL85n41bEdTmvRwcJfplVELO1RsD0CjWtCYSl+MOme3j/3h/Wk1bERjCj3WNngrto/oxRPy0oMGXaUvJvugn6f/gob/dpe69LDOsWWQKM/grZieoyfMT+8bq+ENHGjSF5F90JO/HXmke8X0GPGqBT7eDjJKr51TTN1SXWU9597AzjXpY6UP/RHr/b9kvJ9o1XAOTlT6OOk7B+ndv3yspVcLvCj0cdKHTnnvt1JMtxDpRnDnKn2M9J2fKpaN6BThx1o1HIMfhT5G+tCL5RC6RVd6DR90lT5fn533+uDOeOJrBJ0rdHdb4Os5113v4SPXkRkGXaXP1+Ogo29Uk87RuUKfI/ugM93yXqhK/1ANd+FNpc+Te9Cv8NzxroplHdzRDLpC93UAnlZ10IENLAen6Vylz5Z70Flud3+XimEXvO2vhuMIoG9omifxt6Gbu3YZK4HjM45o0DXps2jQ02I4fGHqXKFPlXzQXxHc6nH2x78rcmM17EYQlT5df4P+CSsjftKpHtyh0L3shKut4Td6qPjS2TpX6dP0N+hYKYShF8RR6D7Ww1Ux3MZKiXymYRx0lW7ToGcX+ftxB6vhDCIpdEvy0NU5gA1hV4Fz0FX6pOSdK/SpV+Eu2mPtXKFPSB66Oo+9Di+qgeCfSDYN8pfknaPzr18a7VqZdB+t0Q66Jv1fyUPXoEdeCeLOcXKQljbBVZl0GKsp4s2Yd+Pf+zqFJv1fGvRO+F8L5kEHdg7yl8wvnFDnsy/GSzRVLRtAYpA/pB70XQr9l4BJf8c86Ar9T8lDV+fzLscdNMP94A6o9N+Sd/5eof9lre/1KNXwDjwG+SF56Or8H56/8c4/6Cr9p+SdK/R/HfK7Ihk6V+g/JA9dnUdekmPVcAVU9D9sbVzHbHnv6iyOe12TFIOuSf8p9aDvJvmKEiqxoS8OLSn075KHrkE3rC0TzqGBJKGr9G/s3dtOE1EUxvH1JSIaLa2CBhAhEhUTiUgiCF4oRImAIioqEeONBzwQfIAVHl68ajtt5+TMnll7f78H6DQ785+1mZbpKeOdvwz2JxtiOLv8MfSAwSEO9PTL0kLxrIS+KFS0RTilPcZBcRfAEEPnSD9leqBvcKD3w9C7MHQR46Fz555+ZQ5RODOhs3QRz544MQMCHF0CGXqw4NQ9DvRBDhh6p2tCRRqBQ9y5Z1ubJv4JM3SOdMsDHex8EDcXQYYeKji1xtBjMPQ2PuG9WJfglPZYAQ1enRMETMjqQOfOPdYsl6eNoRsO/TPP5Bi8DnZh6QW6Cqe0xxwobn0aCJiQzYHOiZXgBReo04gQQ/cSF6gDR7rVzh9oVBPUSXusImBCJkPnvEryi0vUxr17Uc4iAUMvw48z4xrRaC7tcYmiONJtDvShkM/i6SXNp4WACRkMXXu8RQDW9b/U7lHMLr0S8iF0eG5MM+LvxnfhSLfYeVihL2hhDhAuIYZeW8dauHWEiXt3e6GvaNQOPDSqJRlFiISMdR7CQH+jJdtGaIQYer0sqxMLCMpFIYZeH0eaEu/DZ8KRbq7zlkY9hyda6lZQT54RshX6be3mzWCa0ko8RBiEbIWufoauVQnmNryQoadC+hn6M63YJPwnZGmgexh6Q2vA/x28kO3Qv8A0rYsx+O2RUH534dgdvwa61skVeE3I8kC3HLrWzRQ8JsTQq6D5bbUQY3hHc/L66Xv8chxDT6MOme87uJBMwFdCZj5c8yX0hmb1B1md01Q8WdFEDN3SQIdGfYI9c25ukqky9TaGbjv0YViTadJ+R378tly3+0J2Q4c1mt50wUcaHdLUZuAfoXzOw7Xr1kPfdbh97vuaNwPevwtZGehN46ej0w+5BraraXj4NEkhK6HbnjuOR+njwa88HeRQvyXE0MunaeyhMFuxi7WvKWzAK0I2OrccegU3u5MWK7ihLmQ19DUYocl+omDJ1QZ2+13IauibMGFNE7VQuDTjeT6kz9TfCRn4F9VTGvUVFlS0Q9aoY/QxEdD2XcjEQLf5fZlWVSVp1Cz6WtAER/CEEEMvy1hlAzP9oX5rvAb8IMTQS1LhvjjLwQ6D2L7z6+4MvST5bsG5Dx04CaF0oawuwL2n1k6/SY21jVJlrVVjePKjtUIWBvqmsdB3q31sU+axPKxxXsM+IQuhL9sKveq9cDP7MW94fkvuspCB0D+aCl3j7KF8H/Isl+d/qAtl8x4VmLd05lVfzJNch12t/H2Xh6GbGOimfkpVYwzBgbyhAz6XLmQg9DN2zrs6xDKb98jfavDmS8HQ/7J3L6tRBFEYx88J0QQSDAkGvOQmiqKYxLiIxkUCoot4AQUhgYCICurCFziZh1dwI93V0zV9q+9Uf78XSFVT/6memcq0j9DXvSy7uxCPLg2EHivb0h8J4Yc+52TV/cboJBA6SxeaxVMdnpvQD63SYx1Mu9B1O9PSheA3dN1wseY2URIJhh4PZRpdYuguQnexo+/CBHLScgATlIl0h6Ez9E4A7eeVB2bi3YeZSncOhBh6e4dW5Z0Oq5NvIzMsXSjemibgIfRTpDLaDyLH0oWQH8b0l4PQt6G66GAUGZYuhH7njh86VhVW4n9ObTF0ht6eVVjXJDpqM7P/Wr0mhB46+Fl3q3Ch0RBD1xsWNqceLQmhh4591j394fa6AR1rM2cW9lY9Eoq1oymA37pbhXuaihXtaUO7Ob1NFwLf0KFDn+C1YEX72tQR3uwaYugOQgc+645YQpeDOQecXyMM3UHowDs6YgedjmY3m4/erwox9Iw6/9btcL5b0Ev1hs9UZeg5dd75j2OvIE5ydrx3j7asSeCGDtm5WkmW05wVQ4ff0FFDf4D2vdo/3SdpQZfqjBBDb8KCPmtiPey9ebxNF2LoDVjQoabWxyfkWdy8C4GHDnnWfWIhE03Oin5oW3mULgQeOuJZ95+wS7+fMVnIHfWE/9aCHjrirTts51/7GdQr1PlG45bO0GcF3LleWlHuM47E0COtahqIZ93ncVd9b8Py/x2bEPSGDrijW8iWIugtdMV9cYvC0Bn6bLBvY63oWDtyBXjWERg6Q5/RBvCKX+zxh+WvW8CRuiHE0ONh38POW9FIJh5hTYihZ7LcrWQ0U6/1QoihR9sE+mXnoUP/5Tp03rsz9Gjou5oVrYxo8tMx9Ci3NRGws+7YS/1Z31/6WcC5OiFU76EmgnXWfcEC3iiK3l+DbkG/zk3F0MHv3KFu3bE3dLWSkV2AKRg6Q4+E/2nUAIMDvwLVGDp66EBn3cGfUHRiRZvatQu/pQtBh46zoz8HX+QDDM7zli7E0CPgr/Hw6MZ2FSotCzH0CBbwWnEspgt9QR14IsTQM9jKqp7RPrbrUIH37gw9goP1PdTwbqJfiDCGztAjMHRHVyKIoSM/j0lhQodf3ZPhxod+KYIYeoQdTQXmrLuVfVAkg8Xn4EUvhKFH+KSpoJx1x1/bw43P65YuBPwWHeTWHfE5a/8ZtD0PL3tlDJ2h1/Gwsod8sKvTLV0IOXSIs+7wC3tx2AG6fEKTEHLoCDv6GXzoNQN0//faY+gMvYaHZW0lH7VPHp+YLsTQp9qHD31v4AF6eO0rYOgMfToPi9oYeh2GztCnc7CoFyIGOLqLUsDQGfpUHpa0MfQIB0IM3fWSTjHCLSs5VWhfhIBDT37Wfc9K3iuUqM4z+astrAoBh578rDv+gk4zwnn461KwJPSHvTtrjSIIozBcRxQX3BdQGRdU1Auj4q43AcENBfFScQMRweUPnOTHC0Glp6t6pmdGus7XOc996KL4XqqSMNPCoVe/ujNzBVLWmXmGATAzgbK9yRy62HEZYYX6O+PQA4U+ceizrVVbofrOTPP/17RD1zvRoaV35yN68jIcukPvFGCY39Zb4R31vZni0B36DMycgZR6nQe47TQ5dIfe7aP6LK9phX4cwpI59KIAN3fmvmMo79V3p8mhO/RuzLyCErJia9Hu7skcetk59Ulm7iGGw8x16EomHPpOrRNLK3RWXuAp8f1pcujaoZ/QCh1SmFvHTNtsgxocunboOxx6h/oHOsDMWchK5tCLDrFtA0J+MncXg1rX3qEmh64d+qRi6OKv/K9/oMvfeRocunboO6RChxAW3MM822qLmhy6Q+9wWnuKFQ50MPMdqpI59BJmbkCHROfYrbCIXhy6Qy8Sv5ZSI3TtTWpy6A69SHyGRTrX3qQmh+7Qy64qvzFU5UDHOtuuQtO+ZMKh1xvnTYmQxDsPdKQ7dIcu9uS59rBgDb1so21q8tc9O3S5J0c60JW3yaE7dOknR+och2RWMsenZA49d5dth6GBUqGDbT8gye9ec+hSD57nolbnYNsmJB1M5tCFHhzq4q68UVP8b3SHLvbgmeQu7robNc2hRwv9OIbBtvtQINc5NqRW08WhRwv9BAbxWHN8D8l1jl1ay+ng0KOF/hUDUL2Q/mTJAVSl/jKbLQ49WuiPMQDR0HfpXdxVt6rNoUcLHUMQnV7JzjW3qs2hO/Qitk1QHYu+oSrtT//849B7uIlahEKv/+lLah7ouKK3pJxD7+EWqvlSaYjO6Q2vauc4K7imjEPvYT+qeVFpiM7IDa9s54DkolocuvYv6T0nezTP7cSyixDAtlMQlEw49E2HvoVlx6CAbTsgKJlw6D7Rt1D44i63WUUO3aErPbdEvXOxzepwPlmk0E9gEGx7j4Vsp85jhL4/WaTQr2IQSl8vo945Hugu7S/f3KOFjqLRPLeAHU5DxU+h3erg0LVDf+fQ2eEJdOjsVheHrh06M1gY92Bhl1RG9w1JxY+mNjn00XiEKv5L6DvJc1jUXZHRnbDDSSgR2a0ZHHovR1HJ6qGfIJco/bbG6JLyf4gD4NDHA5Ww7TUWM+GWPVjMAYnRjdI5hP9Q+IdDDxb6RSzkOv/YhQWI/Gc4TOch3uGQTDf0yyuO+FNymdIlQn8dp3Ow7RnUPEqmG/qKM36KDYdjhc5AnYNt16DmaLKxhv6cU84FCn1PqM6rb9dcvrmPOPR7bPmFnqpP7vFYnUd4/VqyPvaihpds+4DeLjCzgX5qTy6DdY4Ay0zWx2dUsNL8bKyQSd3JvcBuOyHJoY8GKlhlfthh2R+/jaFwhjVocuijgRpWP5Fzu5f7+csYxma4azvg0EcEFVxb+lsnOMNxzFUvdIbsPEDoR5LJhr7s+DzlbLKhM2jnAUJP9pu9O11xIoiiOF5H1LjgLrhB3IKKiAoifpGICyoqigrRcfkkbvgGRx9eVHDrzFT1Vrl16/xeINPN/XNrZjqJu9AZ9aTLS4/uRrGdK3Q/kN/9buPDFIjIP7mn+VMZb0v9TwH/Rw+SZh+yY8NNRF1hms3YSP7QubFnME0b3Y2tyKzT9MyYbm/L1x4TWe6xHVDoniC3u70P3J3zyTy5LL1zhe4IcmPbh1busTUsl3VyGXMR5pkP/XqQckLHRmbs4uuqJ5c/lL3OSwg9iNXQW448O8Myh7NM7mn66FyhO4KsWobOXtCQ5cMhTzHuIYqg0P04hqxOtpgd9jbBfz6OPrmkl3UOhe4Kskqe+r2MOAB8ZtSH2OtjSHeZ4jVKodAdQU5seoklbjJmDT+0XOujhv6IdLXOYT90fTJkQaGj6Wt6LUzxbfzQJ0w0RUGshx7EZugpC27Rbis+ZZrZOj/BFvR3jqS/dQ77z7oHSbcT+UQn/wVTHMTfmOotxnif6kt6zVwb3RdkElvok6653GIf6GEb23iA0ih0T5ALlziOn472K3MVod/+xlYOojzGQ98epJTQATxhG1MsM80a+rY5f3F8ai8h9N1BDIbOIWA9h7OEPrn6lWQlmZsPPYjB0DmAkV7g25t3iHh7hjHuMlfovuxGDuzvJSI4iM2LxfsLFxaLzRzGBMVS6K5gfJvYHxLQHJTM+OUEMRZ6vmCe0xSUzfYF6W9xxkK/xd5mSHaaZqB0ti8pSDs7MKrcwRg5wF9D+RS6K7sxor0r2IsGUocLtq8riJ2z+8lVFfOGq3MVTpgO/VAQM6GznzPogytxAH6YDj2IldDvrvr4u4VxOrKvR6F7cxmjYB+fMIwHzOcRnFHozmBw/bbpHIPiUjqxRyh0dzC8XezqLkYw55juwCfLoZ8PYiB0drQNo5nyN/1aXn7oQVb/yMxms4ffwxzSHvim0L3B4C5dnDPdEeTDYXyBfwrdG4xq+vks13H2GXJbY09nt6EShkPX96gaDN0YdrVnhroYDj1IF9tRkeXjO71zg8vML15CrRS6O6gIG7ZAmhS6Q6jImuH5tcXujdJ/0RV6yfNrjN0bFaSbfaiI3fk1xu6NCqKVHlXX422dKXSPUBO7A2yL2fu0P4hCL3iAjTF7n4J0dQIV0dk9hUJ3CRV5anaCbTF7m4Io9Dg9M5PEbuhbgyj0OJ3dCw89iEpPcs/qCNti9S4FUehp2HAB8i+zoT8OotBT6OxedOhB+niMmhidYVuM3qQgWulptNITWA1d38Wk0BV6BaEH0TvY0rHhIORvCt0r1EQrPUahe4WarLHhFeQvRkMPoo+ITKeVHqXQ3UJN2HQb8odCdwtV0UrfmM3Qg3xn795Wm4iiOIzvdVGtxxZEewBRKWgFq6AXVfSiSi9EEUqLIKj4AsUH+NuHlx6iNLNnkszsZPbs9f0eICQD3147yRzyewZb3lS1bfiH0Mtlnmwz0hsRernMFVV9MYxkGXoAoc/qDSO9CaEXzFxR1a7hAqEXzFxZZ6Q3yDF0biLFOTNtqOqxId/QAxjpLZww0usResnMF1F6rQxDD+Ba1VZWCL0WoRfNfGGk18ovdO4tQ+htratq35Bl6AHp3DZfGOl1CL1s5ss+pdfILvR3AYTemiKODPmFHkDp7R0x0uMIvXDmjCg9KrfQA/grvRNFPDAQeuHMGUZ6VGahXwsgdEo/V3DoAaldMWc2FHHX3CP0wpk3irlq3uUU+s2A5NbMGzbvuYcecIqR3s0KpVdkFfr1gBAIvTNJPF8149ADTlF6Z+JU2DGE7oC584rNe8VeNscjYD5+mTui9HHH2RyOgBFGejeUXrWVy9HgAtURQu9uVzF/zK+lXEIPGKH07hR1y/wi9PKZQ4p6Ym5lEnrAf5SegKJemFeE7oA59E1Rh+aUxh3bwtH5nH01hyRxG4qGw/HIFo7QKxjp3Slu1VzK4t/GlwFzdcM8UtySeZRF6AHjGOndLVP6SB6hPw24jNCTOFDcsvlzkEHoAeMoPQnV+GnufOo/9HsB4wh9vqW/N3f6Dz2gitLTkMQVLmf6X+wCqgg9CUq/kMGvcQExlJ4EpZ8jdDfMq/JKl82s/9AD4ig9Famsk+TaNfqa0J0wr5ZUZ8cGqO2V9X2eTkDnDSg9lU1JKuWmMzpzx2amcSe2MITegNCT+axivqi3X6J6/Ox03ojSk9lSrU0bktabEUJ3xPzaVBHb9/ad9hk6nU9A6QmpgO27Llm3mRxq3A9bDEKfgNATuqp6ezYInVao/kY6nU9E6Slp4EO929smdE/MNTW4b5lb7bhA9RY6nU+B0pPScIf6Tvd3/byfryyEPgVCT0tDTV21PnZ5EZs/Op8Kpae1oibblqkU61Nfoa8FTEboif0e4FA/ULP2oX+3eWOgT4nSU9PQUtdEGzaVD3182ocBvXhr3qnZgWXlmaZwYlNZfOgM9L/s3deq1FAYhuH1iWIvYFdU7IKK6B4boliwd0UPrFgQ9cAL+LcXr9jLTLLWmpXkz+R9zvcmOXjnG4aUBEx6YfNW7Yn8sEg38v7ZSA1bERCJ0ou7aTU+yAeLN696K9uedAY9AaE3wOq8V/cszS7VavllFnSehNIbENNNt05ZspyzVoMIPQmhN2GLfeX3F/g5y6Jq51o9RzpPROmNML+pWz5VaHvSlwd0aqMg6an95ukBkjaVeT+hB6Ri0hthURarRRes1nGr9lkTXWuvdDp3YJXwzQmLsk7tWGMRpCVWR5MQ+rAIP1iku2rcWouwNvKoE05XTaBzH4SfLJqas2feoizRd2ut1qbYs72vJiwLcGCD8NN6i/dCDbiU8VFzxCLsjgrdVB6D7oXwm6UYqajVFu1kxkFHnavKOxbgAr/H/cUS3VYBO+Ythf7x1uLs0J9auQqQQfdD+NMlS/X5nvJtWW+Jnut/FmtfzR8tUVF07onwl3eW5bDS7HlrOTTWKYu3UN/ZOCqJ50e5slz420KbwsVFqrJ49z7Lp4ks0fnbzZfOoPsi/OuxeaQqR6yMqyqFzr0R/rPAvLmkGlaICiF0b4QxLpsnzzSR29QDnBHG2WJeXFMkK2OzCjga4MwKYTzz4I3iLfIz6gHuCJPcs44plZPUAxwSfvE066eVYYkV8UnTeBXgEFfCVrpvUTof81+s81EPcEmott9adkBT2dRl6nTul1DntLXmmqa3ucPrZ84EOHVMqPfRWrBbpXQ06gy6Z0KcTdagnSqsg9Tp3Dch1gNrxHY14ZZNYb8y3AnwTEiwxYpapAYtthw7lIVB905Idd2mt/KB2vDc4q29qWx07p+QY815y3RF7boZe/tMPt6F3gdCvt2HLNq1JerMrYnHeVLTY9D7YK9QwsNtozn726bR4ety5vWp0dzc3OjUaxVD5/0ggM4HQEA2LonrDwG5GPT+4CVNoPMhEEDnAyAgy9KAHnkkIB2D3jcC6HwABND5AAhItDegd3jQO9Iw6P20VACdzz4BdD4AAqKdDegrAZGWBfTWVgEx+OLebwLofAAE0PkACKh1NKDvBFTilrWZcFBAFb64z4aXAuh89gmg8wEQQOcDIGCCYwGzQ8AY3IL+hb27x40qCKIweiuxBEZIQ2AHJE6xE0NqeQtEECP2vwkQcmCMkPhxMHPrnD18qtfqft1tBn7hhHud1wNPWaD3+Tqg834unEHnGwzofIGBR85Cp4EH5nmzgQdvQ6+BH+5Cs4HvDqHbwFyEcmcDod+wXVjgzbBbWOF+2Cws4QGXzcIa18NWYZG7YaewitJ3Csv4et8orPNx2CYsZKZvE1ayy7ZLWOrDsEdYy2nYPcJmww5hNX+t7hC2G+q9CAzlvgSU3u59QOntAkqvF1B6vcAj50OjwE+uhj6BJ26GNgEL9XbnAaW3s32O0vsFfuti6BBwk1y9gM/3dl5FRun9rgJKbxf4I4fhdAUM9XYvA0pvdx1QervAX3o3nJqAod7uMqD0dq8C/+ZyOBUBQ72dJxpQer+bwP/5NBy7gKHe7hBQervAM7kfjlXAUG/3OfCcbofjE4ihXu42fGPv7nHiCIIwgFYlSMsiBwQQbOKEYNeRCRHcwrnN/S9hCdmBrYXhZ4fpqXrvDp+qu6aniidGxBYW8IeiXpaPasxnk4wh4B+KekE3AfM6T5alnHOcol6KZjuf42eyFOWclyjqRdwGPE/USzC1nQmSXkDAJFFfObsTWcYu+SzKOW+hqK9UwBuI+irtApZ1kczsKmB51qnPyamdYSSzOQsYRjKLx4ChJCe3DRjNZXJKLucM6iYRcxoQdTGnhUTM6cCsKTGnhUTM6SARczowAV7MaUEHXsxp4T4Rcxp4SF7B1EdWL5m0D1i95EWXASVcJ8e5mlOKgbFHuJpTUPKf7wEF7ZO/nNmpLHlyH1CambGKOT1ka+Y90kbbJrw2O81cZT9mtNNRr1k0HsDRVzZhtznNnWV52m9Qva77Mw2qZ92JHar35i4COOYxi9gEUPsQvwtg2m2uVwCl/2n1vhXe4y7X40sApYfDe8MOtRt03sNA7dJ+HcAsDjmEc4d1mN02l/MrgAlr3ut2CGAhX3N2P7xah0HsN3lqWxsWYFQPdx+M9+FbwG927JgGABgEAFj27JoYMi3g3woSuElaGWWT+yPPJOpZdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABo9uBAAAAAAADI/7URVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWlPTgkAAAAABD0/7UvTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwC5RrJqYiSfS8QAAAABJRU5ErkJggg==",Gl=function(e){gn(o,f.Component);var t=Sn(o);function o(){var e;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY",C()),mn(Cn(e),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.getDataAlerts()})),mn(Cn(e),"componentDidUpdate",(function(t,o){n(_o(e.props.authentication),_o(t.authentication))||e.getDataAlerts()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1})),mn(Cn(e),"refresh",(function(){e.getDataAlerts()})),mn(Cn(e),"getDataAlerts",(function(t){fr(an(an({},_o(e.props.authentication)),{},{type:t})).then((function(t){var n,o;e._isMounted&&e.setState({customAlertsList:null==t||null===(n=t.data)||void 0===n?void 0:n.custom_alerts,projectAlertsList:null==t||null===(o=t.data)||void 0===o?void 0:o.project_alerts})})).catch((function(e){console.error(e)}))})),mn(Cn(e),"onDataAlertSave",(function(){e.getDataAlerts(),e.setState({isEditModalVisible:!1})})),mn(Cn(e),"onDataAlertDeleteClick",(function(t){e.setState({isDeleteDialogOpen:!0,dataAlertDeleteId:t})})),mn(Cn(e),"onDataAlertDelete",(function(t){var n=e.state.customAlertsList.filter((function(e){return e.id!==t}));e.setState({customAlertsList:n,isEditModalVisible:!1,isDeleteDialogOpen:!1,dataAlertDeleteId:void 0})})),mn(Cn(e),"renderDeleteDialog",(function(){return f.createElement(Ml,{authentication:e.props.authentication,dataAlertId:e.state.dataAlertDeleteId,isVisible:e.state.isDeleteDialogOpen,onDelete:e.onDataAlertDelete,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessAlert,onClose:function(){return e.setState({isDeleteDialogOpen:!1})}})})),mn(Cn(e),"renderNotificationEditModal",(function(){return f.createElement(Ul,{ref:function(t){return e.editModalRef=t},key:e.COMPONENT_KEY,authentication:e.props.authentication,isVisible:e.state.isEditModalVisible,onClose:function(){return e.setState({isEditModalVisible:!1})},currentDataAlert:e.state.activeDataAlert,onSave:e.onDataAlertSave,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessAlert,onDelete:e.onDataAlertDelete,selectedDemoProjectId:e.props.selectedDemoProjectId,tooltipID:e.props.tooltipID,editView:!0})})),mn(Cn(e),"renderDataAlertGroupTitle",(function(e,t){return f.createElement("div",{className:"react-autoql-data-alert-section-title-container"},f.createElement("div",{style:{paddingLeft:"10px"}},f.createElement("div",{className:"react-autoql-data-alert-section-title"},e),f.createElement("div",{className:"react-autoql-data-alert-section-subtitle"},t)))})),mn(Cn(e),"openEditModal",(function(t,n){e.setState({activeDataAlert:t,isEditModalVisible:!0}),"schedule"===n&&setTimeout((function(){var t,n;null===(t=e.editModalRef)||void 0===t||t.setStep(null===(n=e.editModalRef)||void 0===n?void 0:n.FREQUENCY_STEP)}),0)})),mn(Cn(e),"renderNotificationlist",(function(t,n){return"project"!==t||null!=n&&n.length?f.createElement("div",{className:"data-alerts-list-container"},"custom"===t&&n?e.renderDataAlertGroupTitle("Custom Data Alerts",f.createElement("span",null,'View and manage your Custom Alerts here. To create a new Custom Alert, simply click on the "Create Data Alert" option from a query result in ',f.createElement("a",{onClick:e.props.onDMLinkClick},"Data Messenger")," or a"," ",f.createElement("a",{onClick:e.props.onDashboardLinkClick},"Dashboard"),".")):null,"custom"===t&&!(null!=n&&n.length)&&e.renderEmptyListMessage(),"project"===t&&e.renderDataAlertGroupTitle("Project Data Alerts","Choose from a range of ready-to-use Alerts that have been set up for you."),f.createElement("div",{className:"react-autoql-notification-settings-container"},n&&n.map((function(t,n){return f.createElement(jl,{authentication:e.props.authentication,key:t.id,dataAlert:t,onSuccessCallback:e.props.onSuccessAlert,onErrorCallback:e.props.onErrorCallback,openEditModal:e.openEditModal,onDeleteClick:function(){return e.onDataAlertDeleteClick(null==t?void 0:t.id)},tooltipID:"react-autoql-notification-settings-tooltip",onInitialize:e.getDataAlerts,onDataAlertStatusChange:e.props.onDataAlertStatusChange,showHeader:0===n})})))):null})),mn(Cn(e),"renderEmptyListMessage",(function(){return f.createElement("div",{className:"empty-list-message"},f.createElement("img",{className:"empty-list-img",src:Wl}),f.createElement("span",null,"No Custom Alerts are set up yet."))})),mn(Cn(e),"render",(function(){var t,n,o,a;if(!e.state.customAlertsList)return f.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},f.createElement(Xa,null));var r=null!==(t=null===(n=e.state)||void 0===n?void 0:n.projectAlertsList)&&void 0!==t?t:[],i=null!==(o=null===(a=e.state)||void 0===a?void 0:a.customAlertsList)&&void 0!==o?o:[];return f.createElement(Rn,null,f.createElement(Po,null,f.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},e.renderNotificationlist("project",r),e.renderNotificationlist("custom",i),e.renderNotificationEditModal(),e.renderDeleteDialog(),f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0}))))})),e}return pn(o)}();mn(Gl,"propTypes",{authentication:nr,tooltipID:b.string,onErrorCallback:b.func,onSuccessAlert:b.func,onDMLinkClick:b.func,onDashboardLinkClick:b.func,onDataAlertStatusChange:b.func}),mn(Gl,"defaultProps",{authentication:Mo,tooltipID:"react-autoql-notification-settings-tooltip",onErrorCallback:function(){},onDataAlertStatusChange:function(){},onDMLinkClick:function(){},onDashboardLinkClick:function(){},onSuccessAlert:function(){}});var Xl=Ga(Gl),Jl=function(t){gn(o,f.Component);var n=Sn(o);function o(){var t;un(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return mn(Cn(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0,problemType:void 0}),mn(Cn(t),"componentDidMount",(function(){t._isMounted=!0})),mn(Cn(t),"shouldComponentUpdate",(function(e,n){return!Ma(t.props,e)||!Ma(t.state,n)})),mn(Cn(t),"componentDidUpdate",(function(e){!t.props.isVisible&&e.isVisible&&t.setState({problemType:void 0,reportProblemMessage:void 0})})),mn(Cn(t),"componentWillUnmount",(function(){t._isMounted=!1})),mn(Cn(t),"reportQueryProblem",(function(){var n=t.state.problemType;"Other"===t.state.problemType?n=t.state.reportProblemMessage:t.state.reportProblemMessage&&(n="".concat(n," - ").concat(t.state.reportProblemMessage));var o=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),dt(an({message:n,queryId:o},_o(t.props.authentication))).then((function(){t.props.onReportProblem({successMessage:"Thank you for your feedback! To continue, try asking another query."}),t._isMounted&&t.setState({isReportingProblem:!1})})).catch((function(e){t.props.onReportProblem({error:e}),t._isMounted&&t.setState({isReportingProblem:!1})}))})),mn(Cn(t),"onConfirm",(function(){t.reportQueryProblem(),t.setState({reportProblemMessage:void 0})})),mn(Cn(t),"onClose",(function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})})),mn(Cn(t),"render",(function(){return f.createElement(Rn,null,f.createElement(Sl,{className:t.props.className,contentClassName:t.props.contentClassName,isVisible:t.props.isVisible,onClose:t.onClose,onConfirm:t.onConfirm,confirmLoading:t.state.isReportingProblem,title:"Report a Problem",enableBodyScroll:!0,width:"600px",confirmText:"Report",confirmDisabled:!t.state.problemType||"Other"===t.state.problemType&&!t.state.reportProblemMessage},f.createElement("div",{className:"report-problem-modal-body"},f.createElement("h3",null,"What's happening?"),f.createElement(Dl,{className:"report-problem-radio-group",options:["The data is incorrect","The data is incomplete","Other"],"data-test":"report-problem-radio-group",value:t.state.problemType,onChange:function(e){return t.setState({problemType:e})}}),"Please tell us more about the problem you are experiencing:",f.createElement("textarea",{className:"report-problem-text-area",onChange:function(e){return t.setState({reportProblemMessage:e.target.value})}}))))})),t}return pn(o)}();mn(Jl,"propTypes",{authentication:nr,onReportProblem:b.func,isVisible:b.bool}),mn(Jl,"defaultProps",{authentication:Mo,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var Zl=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,Co()})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){if(a.state.activeMenu!==t.activeMenu)return!0;if(!a.props.shouldRender&&!e.shouldRender)return!1;var n=Ma(a.props,e),o=Ma(a.state,t);return!n||!o})),mn(Cn(a),"componentDidUpdate",(function(e,t){"sql"===t.activeMenu&&"sql"!==a.state.activeMenu&&a.setState({sqlCopySuccess:!1}),e.displayType!==a.props.displayType&&a.setState({activeMenu:void 0}),t.isFiltering!==a.state.isFiltering&&Eo(),Co()})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.temporaryStateTimeout),clearTimeout(a.pivotTableCSVDownloadTimeout)})),mn(Cn(a),"onTableFilter",(function(e){var t;"table"===(null===(t=a.props.responseRef)||void 0===t||null===(t=t.state)||void 0===t?void 0:t.displayType)&&a.setState({disableChartingOptions:(null==e?void 0:e.length)<2})})),mn(Cn(a),"setTemporaryState",(function(e,t,n){a.setState(mn({},e,t)),a.temporaryStateTimeout=setTimeout((function(){a.setState(mn({},e,void 0))}),n)})),mn(Cn(a),"copyTableToClipboard",(function(){var e;a.props.responseRef?(null===(e=a.props.responseRef)||void 0===e||e.copyTableToClipboard(),a.props.onSuccessAlert("Successfully copied table to clipboard!"),a.setTemporaryState("copiedTable",!0,1e3),Eo()):a.setTemporaryState("copiedTable",!1,1e3)})),mn(Cn(a),"fetchCSVAndExport",(function(){var e,t,n=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.query_id,o=null===(t=a.props.responseRef)||void 0===t||null===(t=t.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text,r=C();a.props.onCSVDownloadStart({id:r,queryId:n,query:o}),pt(an(an({queryId:n},_o(a.props.authentication)),{},{csvProgressCallback:function(e){return a.props.onCSVDownloadProgress({id:r,progress:e})}})).then((function(e){var t,n,o=window.URL.createObjectURL(new Blob([e.data])),i=document.createElement("a");i.href=o,i.setAttribute("download","export.csv"),document.body.appendChild(i),i.click();var l=parseInt(null==e||null===(t=e.headers)||void 0===t?void 0:t.export_limit),s="true"==(null==e||null===(n=e.headers)||void 0===n||null===(n=n.limit_reached)||void 0===n?void 0:n.toLowerCase());a.props.onCSVDownloadFinish({id:r,exportLimit:l,limitReached:s})})).catch((function(e){a.props.onCSVDownloadFinish({id:r,error:e}),console.error(e)}))})),mn(Cn(a),"onCSVMenuButtonClick",(function(){var e;a.setState({activeMenu:void 0});var t,n,o="pivot_table"===(null===(e=a.props.responseRef)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.displayType),r=C();o?null!==(t=a.props.responseRef)&&void 0!==t&&null!==(t=t.pivotTableRef)&&void 0!==t&&t._isMounted&&(a.props.onCSVDownloadStart({id:r}),null===(n=a.props.responseRef)||void 0===n||null===(n=n.pivotTableRef)||void 0===n||n.saveAsCSV(2e3).then((function(){a.props.onCSVDownloadProgress({id:r,progress:100}),a.props.onCSVDownloadFinish({id:r})})).catch((function(e){console.error(e),a.props.onCSVDownloadFinish({id:r})}))):a.fetchCSVAndExport()})),mn(Cn(a),"saveChartAsPNG",(function(){var e;null===(e=a.props.responseRef)||void 0===e||e.saveChartAsPNG()})),mn(Cn(a),"deleteMessage",(function(){Eo(),a.props.deleteMessageCallback()})),mn(Cn(a),"copySQL",(function(){var e,t=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.sql,n=document.createElement("textarea");n.value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),a.setTemporaryState("copiedSQL",!0,1e3),a.props.onSuccessAlert("Successfully copied generated query to clipboard!"),a.setState({sqlCopySuccess:!0}),Eo()})),mn(Cn(a),"showHideColumnsModal",(function(){return a.setState({isHideColumnsModalVisible:!0})})),mn(Cn(a),"closeColumnVisibilityModal",(function(){return a.setState({isHideColumnsModalVisible:!1})})),mn(Cn(a),"closeDataAlertModal",(function(){return a.setState({activeMenu:void 0})})),mn(Cn(a),"onColumnVisibilitySave",(function(e){var t=a.props.authentication,n=e.map((function(e){var t=an(an({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));a.setState({isSettingColumnVisibility:!0}),mt(an(an({},t),{},{columns:n})).then((function(){var e;(a._isMounted&&a.setState({isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1}),a.props.responseRef)&&(null===(e=a.props.responseRef)||void 0===e||e.updateColumns(n));a.props.onColumnVisibilitySave(n)})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a._isMounted&&a.setState({isSettingColumnVisibility:!1})}))})),mn(Cn(a),"renderHideColumnsModal",(function(){var e,t,n=(null===(e=a.props.responseRef)||void 0===e?void 0:e._isMounted)&&(null===(t=a.props.responseRef)||void 0===t?void 0:t.getColumns());if(!n||!n.length)return null;var o=n.map((function(e){return an(an({},e),{},{content:e.display_name,checked:e.is_visible})}));return f.createElement(Rn,null,f.createElement(Tl,{columns:o,isVisible:a.state.isHideColumnsModalVisible,onClose:a.closeColumnVisibilityModal,isSettingColumns:a.state.isSettingColumnVisibility,onConfirm:a.onColumnVisibilitySave}))})),mn(Cn(a),"onDataAlertSave",(function(){a.setState({activeMenu:void 0})})),mn(Cn(a),"renderDataAlertModal",(function(){var e,t,n=S(null===(e=a.props.responseRef)||void 0===e?void 0:e.queryResponse),o=null===(t=a.props.responseRef)||void 0===t?void 0:t.getCombinedFilters();return f.createElement(Rn,null,f.createElement(Ul,{authentication:a.props.authentication,isVisible:"notification"===a.state.activeMenu,onClose:a.closeDataAlertModal,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessAlert,onSave:a.onDataAlertSave,tooltipID:a.props.tooltipID,queryResponse:n,filters:o}))})),mn(Cn(a),"renderReportProblemModal",(function(){return f.createElement(Jl,{ref:function(e){return a.reportProblemRef=e},authentication:a.props.authentication,onClose:function(){a.setState({activeMenu:void 0})},onReportProblem:function(e){var t=e.successMessage,n=e.error;t?(a.props.onSuccessAlert(t),a._isMounted&&a.setState({activeMenu:void 0})):n&&a.props.onErrorCallback(n)},responseRef:a.props.responseRef,isVisible:"report-problem"===a.state.activeMenu})})),mn(Cn(a),"reportQueryProblem",(function(e){var t;null!==(t=a.reportProblemRef)&&void 0!==t&&t._isMounted&&a.reportProblemRef.reportQueryProblem(e)})),mn(Cn(a),"refreshData",(function(){})),mn(Cn(a),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn react-autoql-btn ".concat(e||"")})),mn(Cn(a),"renderMoreOptionsMenu",(function(e,t){return f.createElement("div",{className:"more-options-menu","data-test":"react-autoql-toolbar-more-options"},f.createElement("ul",{className:"context-menu-list"},t.showSaveAsCSVButton&&f.createElement("li",{onClick:a.onCSVMenuButtonClick,style:a.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},f.createElement(Wn,{type:"download",style:{marginRight:"7px"}}),a.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),t.showSaveAsPNGButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:void 0}),a.saveChartAsPNG()}},f.createElement(Wn,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),t.showCopyButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:void 0}),a.copyTableToClipboard()}},f.createElement(Wn,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),t.showSQLButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"sql"})}},f.createElement(Wn,{type:"database"})," View generated SQL"),t.showCreateNotificationIcon&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"notification"}),a.props.createDataAlertCallback()}},f.createElement(Wn,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert...")))})),mn(Cn(a),"isDrilldownResponse",(function(e){try{var t;return"Drilldown:"===(null===(t=e.responseRef)||void 0===t||null===(t=t.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text).split(" ")[0]}catch(e){return!1}})),mn(Cn(a),"openReportProblemModal",(function(){a.setState({activeMenu:"report-problem"})})),mn(Cn(a),"renderSQLModal",(function(){var e,t=null===(e=a.props.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.sql)||void 0===e?void 0:e[0];return t?f.createElement(Rn,null,f.createElement(Sl,{isVisible:"sql"===a.state.activeMenu,footer:f.createElement("div",null,f.createElement(wo,{type:"primary",onClick:function(){return a.setState({activeMenu:void 0})}},"Ok")),onClose:function(){return a.setState({activeMenu:void 0})},title:"Generated SQL",enableBodyScroll:!1,width:"600px"},f.createElement("div",{className:"copy-sql-modal-content"},f.createElement("textarea",{className:"copy-sql-formatted-text",value:"".concat(zt(t)),disabled:!0}),f.createElement(wo,{className:"copy-sql-btn ".concat(a.state.sqlCopySuccess?"sql-copied":""),onClick:a.copySQL,tooltip:"Copy to Clipboard",tooltipID:a.props.tooltipID},f.createElement(Wn,{type:"copy"}),a.state.sqlCopySuccess&&f.createElement(Wn,{type:"check",className:"sql-copied"}))))):null})),mn(Cn(a),"renderFilterBtn",(function(){var e,t,n,o,r=null===(e=a.props.responseRef)||void 0===e?void 0:e.getTabulatorHeaderFilters(),i=!(null===(t=a.props.responseRef)||void 0===t||null===(t=t.formattedTableParams)||void 0===t||null===(t=t.filters)||void 0===t||!t.length||null==r||!r.length),l="table"===(null===(n=a.props.responseRef)||void 0===n||null===(n=n.state)||void 0===n?void 0:n.displayType),s=a.state.isFiltering?"Hide filters":"Filter table";return l||(s=i?"Edit table filters":"Filter data from table"),f.createElement(wo,{onClick:function(){var e,t,n,o,r=!l||!(null!==(e=a.props.responseRef)&&void 0!==e&&e.isFilteringTable());(a.setState({isFiltering:r}),"table"===(null===(t=a.props.responseRef)||void 0===t||null===(t=t.state)||void 0===t?void 0:t.displayType))?null===(n=a.props.responseRef)||void 0===n||n.toggleTableFilter(r):null===(o=a.props.responseRef)||void 0===o||o.changeDisplayType("table",(function(){var e;null===(e=a.props.responseRef)||void 0===e||e.toggleTableFilter(!0,!0)}))},className:"".concat(a.getMenuItemClass("filter-btn"),"\n ").concat(a.state.isFiltering&&l?"react-autoql-toolbar-btn-selected":""),tooltip:s,tooltipID:null!==(o=a.props.tooltipID)&&void 0!==o?o:a.TOOLTIP_ID,"data-test":"react-autoql-filter-button"},f.createElement(Wn,{type:"filter",showBadge:i}))})),mn(Cn(a),"renderColumnVizBtn",(function(e){var t;return f.createElement(wo,{onClick:a.showHideColumnsModal,className:a.getMenuItemClass(),tooltip:"Show/hide columns",tooltipID:null!==(t=a.props.tooltipID)&&void 0!==t?t:a.TOOLTIP_ID,"data-test":"options-toolbar-col-vis"},f.createElement(Wn,{type:"eye",showBadge:e.showHiddenColsBadge}))})),mn(Cn(a),"renderReportProblemBtn",(function(){var e;return f.createElement(wo,{onClick:a.openReportProblemModal,className:a.getMenuItemClass(),tooltip:"Report a problem",tooltipID:null!==(e=a.props.tooltipID)&&void 0!==e?e:a.TOOLTIP_ID},f.createElement(Wn,{type:"warning-triangle"}))})),mn(Cn(a),"renderToolbar",(function(e){var t,n,o,r;return f.createElement(Rn,null,f.createElement("div",{className:"".concat(Pe?"react-autoql-toolbar-mobile":"react-autoql-toolbar"," options-toolbar\n ").concat(a.state.activeMenu?"active":"","\n ").concat(a.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&a.renderFilterBtn(),e.showHideColumnsButton&&a.renderColumnVizBtn(e),e.showReportProblemButton&&a.renderReportProblemBtn(),e.showRefreshDataButton&&f.createElement(wo,{onClick:a.refreshData,className:a.getMenuItemClass(),tooltip:"Re-run query",tooltipID:null!==(t=a.props.tooltipID)&&void 0!==t?t:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(Wn,{type:"refresh"})),e.showDeleteButton&&f.createElement(wo,{onClick:a.deleteMessage,className:a.getMenuItemClass(),tooltip:"Delete data response",tooltipID:null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(Wn,{type:"trash"})),e.showMoreOptionsButton&&f.createElement(Xn,{key:"more-options-button-".concat(a.COMPONENT_KEY),isOpen:"more-options"===a.state.activeMenu,padding:8,onClickOutside:function(){return a.setState({activeMenu:void 0})},content:function(t){return a.renderMoreOptionsMenu(t,e)},parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement,positions:null!==(o=a.props.popoverPositions)&&void 0!==o?o:["bottom","top","left","right"],align:a.props.popoverAlign},f.createElement(wo,{onClick:function(){Eo(),a.setState({activeMenu:"more-options"})},className:a.getMenuItemClass("more-options"),tooltip:"More options",tooltipID:null!==(r=a.props.tooltipID)&&void 0!==r?r:a.TOOLTIP_ID,"data-test":"react-autoql-toolbar-more-options-btn"},f.createElement(Wn,{type:"more-vertical"})))))})),mn(Cn(a),"getShouldShowButtonObj",(function(e){var t={};try{var n,o,r,i,l,s,c,u=null===(n=e.responseRef)||void 0===n||null===(n=n.state)||void 0===n?void 0:n.displayType,d=null===(o=e.responseRef)||void 0===o?void 0:o.getColumns(),p=ua(u),m=ca(u),f=null===(r=e.responseRef)||void 0===r?void 0:r.queryResponse,g="data"===(null==f||null===(i=f.data)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.display_type),v=ya(d),h=ba(d),b=null==f||null===(l=f.data)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.rows)||void 0===l?void 0:l.length,y=b>0,C=!(null===(s=e.responseRef)||void 0===s||null===(s=s.formattedTableParams)||void 0===s||null===(s=s.filters)||void 0===s||!s.length),E=b>1&&!C||!!C,S=zo(e.autoQLConfig);(t={showFilterButton:("table"===u||ca(u))&&!v&&E,showCopyButton:p&&!v,showSaveAsPNGButton:m,showHideColumnsButton:S.enableColumnVisibilityManager&&y&&("table"===u||"text"===u&&v),showHiddenColsBadge:h,showSQLButton:g&&S.debug,showSaveAsCSVButton:p&&E&&S.enableCSVDownload,showDeleteButton:e.enableDeleteBtn,showReportProblemButton:S.enableReportProblem&&!(null==f||null===(c=f.data)||void 0===c||null===(c=c.data)||void 0===c||!c.query_id),showCreateNotificationIcon:!Pe&&(g&&S.enableNotifications&&!a.isDrilldownResponse(e)),showRefreshDataButton:!1}).showMoreOptionsButton=(t.showCopyButton||t.showSQLButton||t.showCreateNotificationIcon||t.showSaveAsCSVButton||t.showSaveAsPNGButton)&&!Pe}catch(e){console.error(e)}return t})),mn(Cn(a),"render",(function(){var e=a.getShouldShowButtonObj(a.props);return Object.values(e).find((function(e){return!0===e}))?f.createElement(Rn,null,a.renderToolbar(e),e.showHideColumnsButton&&a.renderHideColumnsModal(),e.showReportProblemButton&&a.renderReportProblemModal(),e.showCreateNotificationIcon&&a.renderDataAlertModal(),e.showSQLButton&&a.renderSQLModal(),!a.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800})):null})),a.COMPONENT_KEY=C(),a.TOOLTIP_ID="react-autoql-options-toolbar-tooltip-".concat(a.COMPONENT_KEY),a.state={isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1,isFiltering:!(null===(o=e.responseRef)||void 0===o||!o.isFilteringTable())},a}return pn(n)}();mn(Zl,"propTypes",{authentication:nr,autoQLConfig:ar,enableDeleteBtn:b.bool,shouldRender:b.bool,onSuccessAlert:b.func,onErrorCallback:b.func,onNewNotificationCallback:b.func,deleteMessageCallback:b.func,createDataAlertCallback:b.func,onCSVDownloadStart:b.func,onCSVDownloadFinish:b.func,onCSVDownloadProgress:b.func}),mn(Zl,"defaultProps",{authentication:Mo,autoQLConfig:Vo,enableDeleteBtn:!1,shouldRender:!0,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},createDataAlertCallback:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var $l=f.forwardRef((function(e,t){var n=fn({},(bn(e),e));return f.createElement(Zl,fn({},n,{ref:t}))})),es=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidMount",(function(){e.setState({isMounted:!0})})),mn(Cn(e),"renderVisualization",(function(){var t=e.props.queryResponse;return f.createElement("div",{className:"react-autoql-notification-chart-container"},f.createElement("div",{ref:function(t){return e.dataContainer=t},className:"react-autoql-notification-query-data-container"},t?f.createElement(bl,{ref:function(t){return e.OUTPUT_REF=t},vizToolbarRef:e.vizToolbarRef,optionsToolbarRef:e.optionsToolbarRef,authentication:e.props.authentication,autoQLConfig:e.props.autoQLConfig,dataFormatting:e.props.dataFormatting,queryResponse:t,autoChartAggregations:e.props.autoChartAggregations,enableAjaxTableData:e.props.enableAjaxTableData,isResizing:e.props.isResizing||!e.props.shouldRender,popoverParentElement:e.props.popoverParentElement,showSingleValueResponseTitle:!0}):f.createElement("div",{style:{position:"absolute",top:0},className:"loading-container-centered"},f.createElement(Xa,null))))})),mn(Cn(e),"renderToolbar",(function(){return e.props.shouldRender?f.createElement("div",{className:"react-autoql-notification-toolbar-container"},f.createElement("div",null,f.createElement(Cl,{autoQLConfig:e.props.autoQLConfig,ref:function(t){return e.vizToolbarRef=t},responseRef:e.OUTPUT_REF})),f.createElement("div",null,f.createElement($l,{authentication:e.props.authentication,autoQLConfig:e.props.autoQLConfig,ref:function(t){return e.optionsToolbarRef=t},responseRef:e.OUTPUT_REF,onSuccessAlert:e.props.onSuccessCallback,onErrorCallback:e.props.onErrorCallback,popoverPositions:["top","left","bottom","right"],popoverAlign:"end"}))):null})),mn(Cn(e),"render",(function(){return f.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},e.renderVisualization(),e.renderToolbar())})),e}return pn(n)}();mn(es,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tooltipID:b.string,chartTooltipID:b.string,reportProblemCallback:b.func,onSuccessCallback:b.func,onErrorCallback:b.func}),mn(es,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tooltipID:null,chartTooltipID:null,reportProblemCallback:function(){},onSuccessCallback:function(){},onErrorCallback:function(){}});var ts,ns=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidUpdate",(function(e,t){a.state.expanded&&!t.expanded&&(a.props.updateScrollbars(500),a.state.queryResponse||a.fetchNotification())})),mn(Cn(a),"componentWillUnmount",(function(){clearTimeout(a.initialCollapseTimer)})),mn(Cn(a),"isError",(function(){var e;return"ERROR"===(null===(e=a.props.notification)||void 0===e?void 0:e.outcome)})),mn(Cn(a),"isUnread",(function(){var e;return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(null===(e=a.props.notification)||void 0===e?void 0:e.state)})),mn(Cn(a),"fetchNotification",(function(){(function(e){var t=e.id,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.get(i).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.query_result;return n?Promise.resolve({data:n}):Promise.reject({response:{data:{message:"Uh oh, Our system is experiencing an unexpected error. We're aware of this issue and are working to fix it as soon as possible."}}})})).catch((function(e){var t;return Promise.reject({data:null==e||null===(t=e.response)||void 0===t?void 0:t.data})}))})(an({id:a.props.notification.id},_o(a.props.authentication))).then((function(e){a.setState({queryResponse:e})})).catch((function(e){a.setState({queryResponse:e})}))})),mn(Cn(a),"expand",(function(){a.setState({expanded:!0}),a.isUnread()&&a.markAsRead()})),mn(Cn(a),"collapse",(function(){a.setState({expanded:!1,isMoreOptionsMenuOpen:!1})})),mn(Cn(a),"onClick",(function(e){a.state.expanded?(a.collapse(),a.props.onCollapseCallback(e)):(a.expand(),a.props.onExpandCallback(e))})),mn(Cn(a),"markAsUnread",(function(){a.props.onUnreadCallback(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.put(i,{state:"ACKNOWLEDGED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDismissSuccessCallback).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"markAsRead",(function(){a.props.onDismissCallback(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.put(i,{state:"DISMISSED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDismissSuccessCallback).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"delete",(function(){a.props.onDeleteClick(a.props.notification),function(e){var t=e.notificationId,n=e.domain,o=e.apiKey,a=e.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));if(!t)return Promise.reject(new Error("No ID provided"));var r=E.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications/").concat(t,"?key=").concat(o);return r.delete(i).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an(an({},_o(a.props.authentication)),{},{notificationId:a.props.notification.id})).then(a.props.onDeleteSuccessCallback).catch(a.props.onErrorCallback).finally(a.props.onDeleteEnd)})),mn(Cn(a),"changeDataAlertStatus",(function(e){hr(an({dataAlertId:a.props.notification.data_alert_id,type:a.props.notification.data_alert_type,status:e},_o(a.props.authentication))).then((function(){a.setState({dataAlertStatus:e});var t="ACTIVE"===e?"Data Alert reactivated! You will start receiving notifications for this Data Alert again.":"You will no longer receive notifications like this.";a.props.onSuccessCallback(t),a.props.onDataAlertChange()})).catch((function(e){console.error(e),a.props.onErrorCallback(e)}))})),mn(Cn(a),"getFormattedTimestamp",(function(){var e,t=a.props.notification.created_at,n=(e=na(t)?o.unix(t):o(t)).format("h:mma"),r=e.format("MM-DD-YY"),i=o().format("MM-DD-YY"),l=o().subtract(1,"d").format("MM-DD-YY");return r===i?"Today at ".concat(n):r===l?"Yesterday at ".concat(n):o().isSame(e,"year")?"".concat(e.format("MMMM Do")," at ").concat(n):"".concat(e.format("MMMM Do, YYYY")," at ").concat(n)})),mn(Cn(a),"renderAlertColorStrip",(function(){return f.createElement("div",{className:"react-autoql-notification-alert-strip"})})),mn(Cn(a),"isDataAlertInErrorState",(function(){var e=a.props.dataAlert;return"GENERAL_ERROR"===(null==e?void 0:e.status)||"EVALUATION_ERROR"===(null==e?void 0:e.status)||"DATA_RETURN_ERROR"===(null==e?void 0:e.status)})),mn(Cn(a),"renderNotificationTitle",(function(){return a.isError()?f.createElement("span",null,f.createElement(Wn,{type:"warning-triangle"})," Data Alert Error"):f.createElement("span",null,a.props.notification.title)})),mn(Cn(a),"renderNotificationMessage",(function(){return a.isError()?'Your Data Alert "'.concat(a.props.notification.title,'" encountered a problem. Click for more information.'):a.props.notification.message})),mn(Cn(a),"renderNotificationHeader",(function(){return f.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){return a.onClick(a.props.notification)}},f.createElement("div",{className:"react-autoql-notification-display-name-container"},f.createElement("div",{className:"react-autoql-notification-display-name"},a.renderNotificationTitle()),f.createElement("div",{className:"react-autoql-notification-description"},a.renderNotificationMessage()),f.createElement("div",{className:"react-autoql-notification-timestamp-container"},f.createElement("span",{className:"react-autoql-notification-timestamp"},f.createElement(Wn,{type:"calendar"})," ",a.getFormattedTimestamp()))),a.moreOptionsButton(),a.renderExpandArrow())})),mn(Cn(a),"renderExpandArrow",(function(){return f.createElement("div",{className:"react-autoql-notification-item-expand-arrow"},f.createElement(Wn,{type:"caret-down"}))})),mn(Cn(a),"moreOptionsButton",(function(){var e;return f.createElement("div",{className:"react-autoql-notification-options-btn-container",onClick:function(){return a.setState({isMoreOptionsMenuOpen:!a.state.isMoreOptionsMenuOpen})}},f.createElement(Xn,{align:"start",positions:["left","bottom","top","right"],containerClassName:"react-autoql-notification-options-popover",content:a.moreOptionsMenu(),isOpen:a.state.isMoreOptionsMenuOpen,onClickOutside:function(){return a.setState({isMoreOptionsMenuOpen:!1})}},f.createElement("div",null,f.createElement(Wn,{type:"more-vertical",className:"react-autoql-notification-options-btn","data-tip":"Options","data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:"react-autoql-notification-tooltip",onClick:function(e){e.stopPropagation(),a.setState({isMoreOptionsMenuOpen:!0})}}))))})),mn(Cn(a),"onOptionClick",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};Eo(),a.setState({isMoreOptionsMenuOpen:!1}),e()})),mn(Cn(a),"moreOptionsMenu",(function(){var e,t,n=a.isUnread(),o=null!==(e=a.state.dataAlertStatus)&&void 0!==e?e:null===(t=a.props.dataAlert)||void 0===t?void 0:t.status,r="ACTIVE"===o||"WAITING"===o;return f.createElement(Do,null,!!a.props.dataAlert&&!Pe&&f.createElement(To,{"data-test":"react-autoql-toolbar-more-options-notification",title:"Settings",subtitle:"View and edit this Data Alert",icon:"settings",onClick:function(e){return a.onOptionClick((function(){return a.props.onEditClick(a.props.dataAlert)}))}}),!!o&&f.createElement(To,{onClick:function(){return a.onOptionClick((function(){return a.changeDataAlertStatus(r?"INACTIVE":"ACTIVE")}))},icon:r?"notification-off":"notification",title:"Turn ".concat(r?"off":"on"),subtitle:r?"Stop receiving notifications for this Data Alert":"Start receiving notifications for this Data Alert again"}),f.createElement(To,{onClick:function(){return a.onOptionClick(n?a.markAsRead:a.markAsUnread)},icon:n?"mark-read":"mark-unread",title:"Mark as ".concat(n?"read":"unread")}),f.createElement(To,{onClick:function(){return a.onOptionClick(a.delete)},icon:"trash",title:"Delete"}))})),mn(Cn(a),"renderLoader",(function(){return f.createElement("div",{style:{position:"absolute",top:0},className:"loading-container-centered"},f.createElement(Xa,null))})),mn(Cn(a),"renderSummarySection",(function(){var e=a.props.notification;if(null==e||!e.expression)return null;var t={data:null==e?void 0:e.query_result};return f.createElement("div",{className:"react-autoql-notification-condition-statement"},f.createElement("span",null,"Summary: "),f.createElement(ei,{key:"expression-builder-".concat(a.COMPONENT_KEY),expression:null==e?void 0:e.expression,queryResponse:t,conditionStatementOnly:!0,conditionTense:"past",sentenceCase:!0,useRT:!0}))})),mn(Cn(a),"restartAlert",(function(){var e;a.setState({isInitializing:!0}),gr(an({id:null===(e=a.props.dataAlert)||void 0===e?void 0:e.id},_o(a.props.authentication))).then((function(){a.setState({initializeSuccess:!0}),a.props.onSuccessCallback("Restart successful! Your Data Alert is now active.")})).catch((function(e){console.error(e),a.setState({initializeError:!0}),a.props.onErrorCallback("Data Alert restart unsuccessful. Please try again in a few minutes.")})).finally((function(){a.setState({isInitializing:!1}),a.props.onDataAlertChange()}))})),mn(Cn(a),"renderErrorDetails",(function(){var e,t,n;if(null!==(e=a.props.dataAlert)&&void 0!==e&&e.id&&!a.isDataAlertInErrorState()){var o,r=null===(o=a.props.notification)||void 0===o?void 0:o.data_return_query;return f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("span",null,"To resolve this issue, try restarting the Alert by clicking the button below."),f.createElement("br",null),f.createElement(wo,{type:"primary",icon:a.state.initializeSuccess?"check":"refresh",loading:a.state.isInitializing,className:"notification-error-reinitialize-btn ".concat(a.state.initializeSuccess?"restart-success":""),onClick:a.restartAlert},a.state.initializeSuccess?"Restarted":"Restart Alert"),f.createElement("br",null),f.createElement("span",null,"If the problem persists, you may need to create a new Data Alert",r?f.createElement("span",null," ","from the query"," ",a.props.onQueryClick?f.createElement("a",{onClick:function(){return a.props.onQueryClick(r)},"data-tip":"Click to run this query in Data Messenger","data-for":a.props.tooltipID},'"',r,'"'):f.createElement("span",null,f.createElement("em",null,'"',r,'"'))):f.createElement("span",null,".")))}return f.createElement("span",null,"It has since been"," ",null!==(t=a.props.dataAlert)&&void 0!==t&&t.id?"restarted and is no longer in an error state. ":"deleted and no longer triggering notifications."," ","Feel free to"," ",f.createElement(Jr,{className:"notification-delete-confirm-popover",popoverParentElement:null!==(n=a.props.popoverParentElement)&&void 0!==n?n:a.notificationItemRef,title:"Delete this Notification?",onConfirm:a.delete,confirmText:"Delete",backText:"Cancel",positions:["top","bottom","left","right"],align:"end"},f.createElement("a",null,"delete"))," ","this notification.")})),mn(Cn(a),"renderErrorMessage",(function(){var e=a.getFormattedTimestamp();return e.includes("today")||(e="on ".concat(e)),f.createElement("div",{className:"notification-error-message-container"},f.createElement("div",null,"This Data Alert encountered an error ",e,". ",a.renderErrorDetails()))})),mn(Cn(a),"renderNotificationContent",(function(){var e,t;return f.createElement("div",{ref:function(e){return a.contentRef=e},className:"react-autoql-notification-expanded-content\n ".concat(a.state.expanded?"expanded":"collapsed","\n ").concat(a.state.queryResponse?"":"loading")},f.createElement(f.Fragment,null,!a.state.queryResponse&&a.renderLoader(),f.createElement("div",{className:"react-autoql-notification-content-container"},a.isError()?a.renderErrorMessage():f.createElement(f.Fragment,null,a.renderSummarySection(),f.createElement(es,{key:null===(e=a.state.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.query_id,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,dataFormatting:a.props.dataFormatting,queryResponse:a.state.queryResponse,autoChartAggregations:a.props.autoChartAggregations,enableAjaxTableData:a.props.enableAjaxTableData,onSuccessCallback:a.props.onSuccessCallback,onErrorCallback:a.props.onErrorCallback,popoverParentElement:null!==(t=a.props.popoverParentElement)&&void 0!==t?t:a.notificationItemRef,isResizing:a.props.isResizing,shouldRender:a.state.expanded})))))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement("div",{id:"react-autoql-notification-item-".concat(a.COMPONENT_KEY),key:"react-autoql-notification-item-".concat(a.COMPONENT_KEY),ref:function(e){return a.notificationItemRef=e},className:"react-autoql-notification-list-item\n ".concat(a.state.expanded?"expanded":"collapsed","\n ").concat(a.isUnread()?"unread":"","\n ").concat(a.isError()?"is-error":"","\n ").concat(a.state.isMoreOptionsMenuOpen?"menu-open":"")},a.renderNotificationHeader(),a.renderNotificationContent(),a.renderAlertColorStrip(),f.createElement("div",{className:"react-autoql-notification-item-hover-overlay"})))})),a.COMPONENT_KEY=C(),a.state={expanded:!1,dataAlertStatus:void 0,queryResponse:void 0,isMoreOptionsMenuOpen:!1},a}return pn(n)}();mn(ns,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,notification:b.shape({}).isRequired,onRuleFetchCallback:b.func,onExpandCallback:b.func,onCollapseCallback:b.func,onDismissCallback:b.func,onDeleteClick:b.func,onDeleteEnd:b.func,onDeleteSuccessCallback:b.func,onDismissSuccessCallback:b.func,onErrorCallback:b.func,autoChartAggregations:b.bool,enableAjaxTableData:b.bool,onClick:b.func,onDataAlertChange:b.func,onSuccessCallback:b.func,onQueryClick:b.func}),mn(ns,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,autoChartAggregations:!1,onQueryClick:void 0,onRuleFetchCallback:function(){},updateScrollbars:function(){},onExpandCallback:function(){},onCollapseCallback:function(){},onDismissCallback:function(){},onDeleteClick:function(){},onDeleteEnd:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onUnreadCallback:function(){},onErrorCallback:function(){},onClick:function(){},onDataAlertChange:function(){},onSuccessCallback:function(){}});var os=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.props.shouldRender&&(o.getNotifications(),o.getDataAlerts())})),mn(Cn(o),"componentDidUpdate",(function(e,t){var n,a;!o.props.shouldRender&&e.shouldRender?o.collapseActive():!o.props.shouldRender||e.shouldRender||o.hasFetchedNotifications||(o.getNotifications(),o.getDataAlerts()),o.props.shouldRender&&o.state.unFetchedNotifications&&!t.unFetchedNotifications&&o.refreshNotifications(),(null===(n=t.notificationList)||void 0===n?void 0:n.length)!==(null===(a=o.state.notificationList)||void 0===a?void 0:a.length)&&o.updateScrollbars(1e3)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1})),mn(Cn(o),"closeDataAlertModal",(function(){o.setState({isEditModalVisible:!1})})),mn(Cn(o),"getDataAlerts",(function(){fr(an({},_o(o.props.authentication))).then((function(e){var t,n,a,r,i=null!==(t=null==e||null===(n=e.data)||void 0===n?void 0:n.custom_alerts)&&void 0!==t?t:[],l=null!==(a=null==e||null===(r=e.data)||void 0===r?void 0:r.project_alerts)&&void 0!==a?a:[],s=[].concat(Tn(i),Tn(l));o.setState({dataAlerts:s})}))})),mn(Cn(o),"getNotifications",(function(){var e,t;if(o.props.shouldRender&&!o.state.isFetching&&!o.state.isDeleting&&!o.state.unFetchedNotifications){o.hasFetchedNotifications=!0;var n=null!==(e=null===(t=o.state.notificationList)||void 0===t?void 0:t.length)&&void 0!==e?e:0;if(!(o.state.pagination&&o.state.pagination.total_items<=n))return o.setState({isFetching:!0}),mr(an(an({},_o(o.props.authentication)),{},{limit:o.NOTIFICATION_FETCH_LIMIT,offset:n})).then((function(e){var t,n;if(null!=e&&null!==(t=e.items)&&void 0!==t&&t.length){var a=null!==(n=e.items.filter((function(e){return!o.state.notificationList.find((function(t){return t.id===e.id}))})))&&void 0!==n?n:[],r=0;a.length!==e.items.length&&(r=e.items.length-a.length);var i={isFetchingFirstNotifications:!1,fetchNotificationsError:null,unFetchedNotifications:r,isFetching:!1};null!=a&&a.length&&o._isMounted&&(i.notificationList=[].concat(Tn(o.state.notificationList),Tn(a)),i.pagination=e.pagination),o.setState(i)}else o.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:null,isFetching:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o._isMounted&&o.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e,isFetching:!1})}))}})),mn(Cn(o),"getNewNotifications",(function(){var e,t,n=((null===(e=o.state.notificationList)||void 0===e?void 0:e.length)||o.NOTIFICATION_FETCH_LIMIT)+(null!==(t=o.state.unFetchedNotifications)&&void 0!==t?t:0);mr(an(an({},_o(o.props.authentication)),{},{offset:0,limit:n})).then((function(e){var t,n,a,r,i,l=null==e?void 0:e.items,s=o.state.notificationList,c=(null===(t=e.items)||void 0===t?void 0:t.length)-1;(null==l||null===(n=l[0])||void 0===n?void 0:n.id)!==(null==s||null===(a=s[0])||void 0===a?void 0:a.id)||(null==l||null===(r=l[c])||void 0===r?void 0:r.id)!==(null==s||null===(i=s[c])||void 0===i?void 0:i.id)?o.setState({notificationList:e.items,pagination:e.pagination,unFetchedNotifications:0}):o.setState({unFetchedNotifications:0})}))})),mn(Cn(o),"refreshNotifications",(function(){return o.getDataAlerts(),o.hasFetchedNotifications?o.getNewNotifications():o.getNotifications()})),mn(Cn(o),"getNewNotificationsFromResponse",(function(e){var t=[];return e.every((function(e){return!o.state.notificationList.find((function(t){return t.id===e.id}))&&(t.push(e),!0)})),t})),mn(Cn(o),"onDeleteAllClick",(function(){})),mn(Cn(o),"onMarkAllAsReadClick",(function(){var e=o.state.notificationList.map((function(e){return an(an({},e),{},{state:"DISMISSED"})}));return o.setState({notificationList:e}),function(e){var t=e.domain,n=e.apiKey,o=e.token;if(!o||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var a=E.create({headers:{Authorization:"Bearer ".concat(o)}}),r="".concat(t,"/autoql/api/v1/data-alerts/notifications?key=").concat(n);return a.put(r,{state:"DISMISSED"}).catch((function(e){var t;return Promise.reject(null==e||null===(t=e.response)||void 0===t?void 0:t.data)}))}(an({},_o(o.props.authentication))).then((function(){o.props.onDismissCallback(e),o.props.onChange(e)})).catch((function(e){console.error(e),o.props.onErrorCallback(e)}))})),mn(Cn(o),"onUnreadClick",(function(e){var t=o.state.notificationList.map((function(t){return e.id===t.id?an(an({},t),{},{state:"ACKNOWLEDGED"}):t}));o.setState({notificationList:t},(function(){o.props.onUnreadCallback(t)}))})),mn(Cn(o),"onDismissClick",(function(e){var t=o.state.notificationList.map((function(t){return e.id===t.id?an(an({},t),{},{state:"DISMISSED"}):t}));o.setState({notificationList:t},(function(){o.props.onDismissCallback(t)}))})),mn(Cn(o),"onDeleteClick",(function(e){var t,n=o.state.notificationList.filter((function(t){return t.id!==e.id})),a=null!==(t=o.state.pagination)&&void 0!==t?t:{};a&&(a=an(an({},a),{},{total_items:a.total_items>0?a.total_items-1:0})),o.setState({notificationList:n,pagination:a,isDeleting:!0})})),mn(Cn(o),"onDeleteEnd",(function(){o.setState({isDeleting:!1},(function(){var e;o.hasMoreNotifications()&&(null===(e=o.state.notificationList)||void 0===e?void 0:e.length)<o.NOTIFICATION_FETCH_LIMIT&&o.getNotifications()}))})),mn(Cn(o),"onDataAlertSave",(function(){o.setState({isEditModalVisible:!1})})),mn(Cn(o),"renderTopOptions",(function(){return f.createElement("div",{className:"notification-feed-top-options-container"},o.renderDeleteAllButton(),o.renderDataAlertsManagerButton(),o.renderMarkAllAsReadButton())})),mn(Cn(o),"renderDataAlertsManagerButton",(function(){return o.props.showDataAlertsManager?f.createElement("div",{onClick:function(){o.setState({isDataAlertsManagerOpen:!0})},className:"react-autoql-notification-mark-all"},f.createElement(Wn,{type:"list-settings"})," ",f.createElement("span",null,"Data Alerts")):f.createElement("div",null)})),mn(Cn(o),"renderDeleteAllButton",(function(){return null})),mn(Cn(o),"renderMarkAllAsReadButton",(function(){var e;return f.createElement(Jr,{onConfirm:o.onMarkAllAsReadClick,title:"Mark all as read?",confirmText:"Yes",backText:"Cancel",popoverParentElement:null!==(e=o.props.popoverParentElement)&&void 0!==e?e:o.feedContainer,positions:["bottom","left","right","top"],align:"end"},f.createElement("div",{className:"react-autoql-notification-mark-all"},f.createElement(Wn,{type:"mark-read"})," ",f.createElement("span",null,"Mark all as read")))})),mn(Cn(o),"showEditDataAlertModal",(function(e){o.setState({isEditModalVisible:!0,activeDataAlert:e})})),mn(Cn(o),"renderDataAlertsManagerModal",(function(){return o.props.showDataAlertsManager?f.createElement(Sl,{contentClassName:"react-autoql-data-alert-manager-modal",overlayStyle:{zIndex:"9998"},title:"Data Alerts",titleIcon:f.createElement(Wn,{type:"list-settings"}),isVisible:o.state.isDataAlertsManagerOpen,onOpened:o.props.onModalOpen,onClosed:o.props.onModalClose,onClose:function(){o.setState({isDataAlertsManagerOpen:!1})},enableBodyScroll:!0,showFooter:!1},f.createElement(Xl,{authentication:o.props.authentication,onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessCallback})):null})),mn(Cn(o),"renderEditDataAlertModal",(function(){var e;return f.createElement(Ul,{key:o.MODAL_COMPONENT_KEY,authentication:o.props.authentication,isVisible:o.state.isEditModalVisible,onClose:o.closeDataAlertModal,onOpened:o.props.onModalOpen,onClosed:o.props.onModalClose,currentDataAlert:o.state.activeDataAlert,onSave:o.onDataAlertSave,onErrorCallback:o.props.onErrorCallback,allowDelete:"CUSTOM"===(null===(e=o.state.activeDataAlert)||void 0===e?void 0:e.type),tooltipID:o.props.tooltipID,editView:!0})})),mn(Cn(o),"collapseActive",(function(){var e,t=o.state.expandedNotificationID;null===(e=o.notificationRefs[t])||void 0===e||e.collapse(),o.setState({expandedNotificationID:void 0})})),mn(Cn(o),"onNotificationExpand",(function(e){var t,n=o.state.expandedNotificationID;n&&n!==e.id&&(null===(t=o.notificationRefs[n])||void 0===t||t.collapse());o.setState({expandedNotificationID:e.id})})),mn(Cn(o),"updateScrollbars",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;setTimeout(null===(e=o.infiniteScroll)||void 0===e?void 0:e.updateScrollbars,t)})),mn(Cn(o),"hasMoreNotifications",(function(){var e,t;return!o.state.isFetching&&(null===(e=o.state.pagination)||void 0===e?void 0:e.total_items)>(null===(t=o.state.notificationList)||void 0===t?void 0:t.length)})),mn(Cn(o),"render",(function(){var e,t={};return o.props.shouldRender||(t.visibility="hidden",t.opacity="0"),o.state.isFetchingFirstNotifications?f.createElement("div",{style:t,className:"notification-list-loading-container","data-test":"notification-list"},f.createElement(Xa,null)):o.state.fetchNotificationsError?f.createElement("div",{style:t,className:"notification-list-loading-container","data-test":"notification-list"},"Oh no! Something went wrong while accessing your notifications.",f.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},f.createElement(wo,{onClick:o.getInitialNotifications},"Try Again"))):f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.feedContainer=e},style:t,className:"react-autoql-notification-list-container ".concat(Pe?"react-autoql-notification-list-container-mobile":""),"data-test":"notification-list"},o.props.tooltipID!==o.TOOLTIP_ID&&f.createElement(So,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),null!==(e=o.state.notificationList)&&void 0!==e&&e.length?f.createElement(h,null,o.renderTopOptions(),f.createElement(Lo,{ref:function(e){return o.infiniteScroll=e},pageStart:0,useWindow:!1,initialLoad:!1,loadMore:o.getNotifications,hasMore:o.hasMoreNotifications()},f.createElement("div",{className:"notification-feed-list"},o.state.notificationList.map((function(e,t){var n,a=null===(n=o.state.dataAlerts)||void 0===n?void 0:n.find((function(t){return t.id===e.data_alert_id}));return f.createElement(ns,{ref:function(t){return o.notificationRefs[e.id]=t},key:e.id,authentication:o.props.authentication,autoQLConfig:an(an({},zo(o.props.autoQLConfig)),{},{enableColumnVisibilityManager:!1,enableNotifications:!1,enableCSVDownload:!1,enableDrilldowns:!1,enableReportProblem:!1}),notification:e,dataAlert:a,expanded:!!e.expanded,onDismissCallback:o.onDismissClick,onUnreadCallback:o.onUnreadClick,onQueryClick:o.props.onQueryClick,popoverParentElement:o.props.popoverParentElement,onDismissSuccessCallback:function(){o.props.onChange(o.state.notificationList)},onDeleteClick:o.onDeleteClick,onDeleteEnd:o.onDeleteEnd,onDeleteSuccessCallback:function(){o.props.onChange(o.state.notificationList)},onExpandCallback:o.onNotificationExpand,onCollapseCallback:o.onNotificationCollapse,autoChartAggregations:o.props.autoChartAggregations,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,onDataAlertChange:o.props.onDataAlertChange,onEditClick:function(e){o.showEditDataAlertModal(e)},enableAjaxTableData:o.props.enableAjaxTableData,isResizing:o.props.isResizing,updateScrollbars:o.updateScrollbars,tooltipID:o.props.tooltipID})})),o.state.isFetching&&f.createElement("div",{className:"react-autoql-spinner-centered"},f.createElement(Ro,null))))):f.createElement("div",{className:"empty-notifications-message"},f.createElement("img",{className:"empty-notifications-img",src:Wl}),f.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),f.createElement("div",null,"Stay tuned!"),f.createElement("br",null),o.props.showCreateAlertBtn&&f.createElement(wo,{style:{marginTop:"10px"},type:"primary",onClick:o.showEditDataAlertModal},"Create Data Alert")),o.renderEditDataAlertModal(),o.renderDataAlertsManagerModal()))})),o.COMPONENT_KEY=C(),o.MODAL_COMPONENT_KEY=C(),o.NOTIFICATION_FETCH_LIMIT=10,o.TOOLTIP_ID="react-autoql-notification-tooltip",o.notificationRefs={},o.state={isFetchingFirstNotifications:!0,isDataAlertsManagerOpen:!1,unFetchedNotifications:0,notificationList:[],isFetching:!1,isDeleting:!1,pagination:{}},o}return pn(n)}();ts=os,mn(os,"propTypes",{authentication:nr,onCollapseCallback:b.func,onExpandCallback:b.func,showNotificationDetails:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,onDismissCallback:b.func,onDeleteCallback:b.func,onChange:b.func,autoChartAggregations:b.bool,showCreateAlertBtn:b.bool,enableAjaxTableData:b.bool,onModalOpen:b.func,shouldRender:b.bool,onDataAlertChange:b.func,tooltipID:b.string}),mn(os,"defaultProps",{authentication:Mo,showDataAlertsManager:!1,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,enableAjaxTableData:!1,shouldRender:!0,tooltipID:ts.TOOLTIP_ID,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onModalOpen:function(){},onUnreadCallback:function(){},onDataAlertChange:function(){},onChange:function(){}});var as=Ga(os),rs=new Yt({en:{introPrompt:"Some things you can ask me: ",use:"Use",dataExplorer:"Data Explorer",exploreQueries:"Explore Queries",explorePrompt:"to further explore the possibilities.",run:"We run on AutoQL by Chata.ai",queryPrompt:"Type your queries here ",seeMore:"See more",dataMessengerOptions:"Options menu",openFilterLocking:"Manage Filters",closeFilterLocking:"Close filter menu",filterLockingTitle:"Filter Locking",noFiltersLocked:"No Filters are locked yet",clearQueriesTooltip:"Clear queries",clearDataResponses:"Clear all queries & responses?",closeDataMessenger:"Close Data Messenger",maximizeDataMessenger:"Full Screen",minimizeDataMessenger:"Exit Full Screen",searchQueries:"Search relevant queries by topic",discoverPrompt:"Discover what you can ask by entering a topic in the search bar above. Simply click on any of the returned options to run the query in Data Messenger.",reportAProblem:"Report a problem",deleteDataResponse:"Delete data response",table:"Table",barChart:"Bar Chart",columnChart:"Column Chart",lineChart:"Line Chart",pieChart:"Pie Chart",heatMap:"Heat Map",bubbleChart:"Bubble Chart",stackedColumnChart:"Stacked Column Chart",stackedBarChart:"Stacked Bar Chart",stackedAreaChart:"Stacked Area Chart",downloadAsPNG:"Download as a PNG",filterTable:"Filter table",showHideColumns:"Show/hide columns",downloadAsCSV:"Download as a CSV",copyTableToClipboard:"Copy table to clipboard",notifications:"Notifications",filterColumn:"Filter column",columnName:"Column Name",visibility:"Visibility",cancel:"Cancel",apply:"Apply",education:"Education"},sp:{introPrompt:"Cosas que puedes preguntarme:",use:"Utiliza",dataExplorer:"Explorador de datos",exploreQueries:"Explorar Consultas",explorePrompt:"para ampliar las posibilidades.",run:"Corremos en AutoQL de Chata.ai",queryPrompt:"Escribe tus consultas aquí",seeMore:"Ver más",dataMessengerOptions:"Menú de opciones",openFilterLocking:"Administrar filtros",closeFilterLocking:"Cerrar menú de filtrar",filterLockingTitle:"Menú de Filtro",noFiltersLocked:"Ningún filtro está bloqueado todavía",clearQueriesTooltip:"Borrar todas las consultas",clearDataResponses:"¿Borrar todas las consultas y respuestas?",closeDataMessenger:"Cerrar Data mesenger",maximizeDataMessenger:"Pantalla completa",minimizeDataMessenger:"Salir de pantalla completa",searchQueries:"Buscar consultas relevantes por tema",discoverPrompt:"Descubre lo que puede preguntar ingresando un tema en la barra de búsqueda de arriba. Da clic en cualquiera de las opciones devueltas para ejecutar la consulta en Data Messenger.",reportAProblem:"Informar de un problema",deleteDataResponse:"Eliminar respuesta de datos",table:"Tabla",barChart:"Gráfico de barras",columnChart:"Gráfico de columnas",lineChart:"Gráfico de linea",pieChart:"Gráfico circular",heatMap:"Mapa de calor",bubbleChart:"Gráfico de burbujas",stackedColumnChart:"Gráfico de columnas apiladas",stackedBarChart:"Gráfico de barras apiladas",stackedAreaChart:"Gráfico de área apilada",downloadAsPNG:"Descargar como PNG",filterTable:"Tabla de filtros",showHideColumns:"Mostrar/ocultar columnas",downloadAsCSV:"Descargar como CSV",copyTableToClipboard:"Copiar tabla al portapapelas",notifications:"Notificaciones",filterColumn:"Columna de filtro",columnName:"Nombre de columna",visibility:"Visibilidad",cancel:"Cancelar",apply:"Aplicar",education:"Educación"}}),is=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.state.filters&&a.props.onChange(a.state.filters),a.props.isOpen&&a.props.insertedFilter&&a.insertFilter(a.props.insertedFilter),Co()})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.initialFilters&&!e.initialFilters&&(a.setState({filters:a.props.initialFilters}),Co()),n(a.state.filters,t.filters)||(a.props.onChange(a.state.filters),Co()),!a.props.isOpen&&e.isOpen?a.setState({inputValue:""}):a.props.isOpen&&!e.isOpen&&Co(),(a.props.isOpen&&!e.isOpen&&a.props.insertedFilter||a.props.insertedFilter&&!e.insertedFilter)&&a.insertFilter(a.props.insertedFilter)})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.focusInputTimeout),clearTimeout(a.highlightFilterEndTimeout),clearTimeout(a.highlightFilterStartTimeout),clearTimeout(a.savingIndicatorTimeout),clearTimeout(a.autocompleteTimer)})),mn(Cn(a),"showSavingIndicator",(function(){a.savingIndicatorTimeout&&clearTimeout(a.savingIndicatorTimeout),a.setState({isSaving:!0}),a.savingIndicatorTimeout=setTimeout((function(){a.setState({isSaving:!1})}),1500)})),mn(Cn(a),"animateInputTextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length)for(var t=500/e.length,n=function(n){setTimeout((function(){a._isMounted&&(a.setState({inputValue:e.slice(0,n+1)}),n===e.length-1&&(a.focusInputTimeout=setTimeout((function(){var e;a.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=a.inputElement)||void 0===e||e.focus()}),300)))}),n*t)},o=0;o<e.length;o++)n(o)})),mn(Cn(a),"insertFilter",(function(e){var t=a.findFilter({filterText:e});e&&t?a.handleHighlightFilterRow(a.getKey(t)):a.animateInputTextAndSubmit(e)})),mn(Cn(a),"getAllFilters",(function(){return a.state.filters})),mn(Cn(a),"getPersistedFilters",(function(){return S(a.state.filters.filter((function(e){return!e.isSession})))})),mn(Cn(a),"findFilter",(function(e){var t=e.filterText,n=e.value,o=e.key,r=a.state.filters;return n&&o?r.find((function(e){return e.key===o&&e.value===n})):t?r.find((function(e){return e.value===t})):void 0})),mn(Cn(a),"getTimeLeft",(function(e){return e?Math.ceil((e._idleStart+e._idleTimeout-Date.now())/1e3):0})),mn(Cn(a),"fetchSuggestions",(function(e){var t,n=e.value;a.axiosSource&&a.axiosSource.cancel(lr.CANCELLED),a.axiosSource=null===(t=E.CancelToken)||void 0===t?void 0:t.source(),Ye(an(an({},_o(a.props.authentication)),{},{suggestion:n,cancelToken:a.axiosSource.token})).then((function(e){var t,n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,r=[];a.autoCompleteArray=[],n=o.matches;for(var i=0;i<n.length;i++)r.push(n[i]);r.sort((function(e,t){var n,o,a=null!==(n=e.format_txt)&&void 0!==n?n:e.keyword,r=null!==(o=t.format_txt)&&void 0!==o?o:t.keyword;return a.toUpperCase()<r.toUpperCase()?-1:a>r?1:0}));for(var l=0;l<r.length;l++){var s={name:r[l]};a.autoCompleteArray.push(s)}a.setState({suggestions:a.autoCompleteArray,isLoadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED&&console.error(e),a.setState({isLoadingAutocomplete:!1})}))})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;a.setState({isLoadingAutocomplete:!0}),a.axiosSource?(clearTimeout(a.autocompleteTimer),a.autocompleteStart=Date.now(),a.autocompleteTimer=setTimeout((function(){a.fetchSuggestions({value:t})}),a.autocompleteDelay)):a.fetchSuggestions({value:t})})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),mn(Cn(a),"createNewFilterFromSuggestion",(function(e){var t="include",n=a.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,format_txt:e.format_txt,show_message:e.show_message,key:e.canonical,filter_type:t}})),mn(Cn(a),"setFilterTypes",(function(e,t){var n=_o(a.props.authentication),o=e.filter((function(e){return!e.isSession}));return null!=o&&o.length?(a.showSavingIndicator(),ft(an(an({},n),{},{filters:o})).then((function(e){var t,n=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.data,o=a.state.filters.map((function(e){var t=n.find((function(t){return a.getKey(e)===a.getKey(t)}));return t||e}));return a.setState({filters:o}),Promise.resolve(e)})).catch((function(e){return console.error(e),a.setState({filters:t,isSaving:!1}),jt.error("Something went wrong. Please try again."),Promise.reject()}))):Promise.resolve()})),mn(Cn(a),"setFilter",(function(e){var t;if(null!=e&&e.value){var n=null!==(t=a.props.authentication)&&void 0!==t?t:{};return a.showSavingIndicator(),ft(an(an({},n),{},{filters:[e]})).then((function(t){var n,o=null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.data;if(null==o||!o.length)throw new Error("No filters in the api response");var r=o.find((function(t){return a.getKey(t)===a.getKey(e)}));if(!r)throw new Error("Filter not found in the api response");if(a.findFilter(e)){var i=a.state.filters.map((function(e){return a.getKey(e)===a.getKey(r)?r:e}));a.setState({filters:i})}else a.setState({filters:[].concat(Tn(a.state.filters),[r]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),jt.error("Something went wrong. Please try again."),Promise.reject()}))}})),mn(Cn(a),"unsetFilter",(function(e){try{a.showSavingIndicator();var t=_o(a.props.authentication);return gt(an(an({},t),{},{filter:e}))}catch(e){return console.error(e),jt.error("Something went wrong. Please try again."),Promise.reject(e)}})),mn(Cn(a),"getSuggestionValue",(function(e){var t=e.name;return a.createNewFilterFromSuggestion(t)})),mn(Cn(a),"handlePersistToggle",function(){var e=cn(rn().mark((function e(t){var n,o,r;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.state.filters,o=an(an({},t),{},{isSession:!t.isSession,id:void 0}),r=a.state.filters.map((function(e){return a.getKey(e)===a.getKey(t)?o:e})),a.setState({filters:r}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,a.setFilter(o);case 8:e.next=12;break;case 10:return e.next=12,a.unsetFilter(t);case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),a.setState({filters:n});case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(a),"handleExcludeToggle",(function(e,t){var n;if(t){var o=null===(n=a.state.filters)||void 0===n||null===(n=n.find((function(t){return t.show_message===e})))||void 0===n||null===(n=n.filter_type)||void 0===n?void 0:n.toUpperCase();if(t!==o)try{var r=a.state.filters.map((function(n){return n.show_message===e?an(an({},n),{},{filter_type:t.toLowerCase()}):n})),i=r.filter((function(t){return t.show_message===e}));a.setFilterTypes(i,S(a.state.filters)),a.setState({filters:r})}catch(e){console.error(e)}}})),mn(Cn(a),"removeFilter",function(){var e=cn(rn().mark((function e(t){var n,o;return rn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.state.filters,o=a.state.filters.filter((function(e){return a.getKey(e)!==a.getKey(t)})),a.setState({filters:o}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,a.unsetFilter(t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),a.setState({filters:n});case 13:Eo();case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),mn(Cn(a),"onInputChange",(function(e,t){var n,o=t.newValue,r=t.method;"up"!==r&&"down"!==r&&("enter"!==r&&"click"!==r||(a.findFilter(o)?a.handleHighlightFilterRow(a.getKey(o)):a.setFilter(o)),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&a.setState({inputValue:e.target.value}))})),mn(Cn(a),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),mn(Cn(a),"renderSavingIndicator",(function(){return f.createElement("div",{className:"filter-locking-saving-indicator ".concat(a.state.isSaving?"visible":"hidden"),"data-test":"filter-locking-saving-indicator"},"Saving...")})),mn(Cn(a),"renderTitle",(function(){var e;return f.createElement("div",{className:"react-autoql-filter-locking-title"},f.createElement("h3",null,f.createElement("span",null,rs.filterLockingTitle),f.createElement(Wn,{type:"info","data-place":"bottom","data-for":null!==(e=a.props.tooltipID)&&void 0!==e?e:a.TOOLTIP_ID,"data-tip":"Filters can be applied to narrow down your query results. Locking a filter ensures that only the specific data you wish to see is returned."})))})),mn(Cn(a),"renderHeader",(function(){return f.createElement("div",{className:"filter-lock-menu-header"},a.renderTitle(),a.renderCloseBtn())})),mn(Cn(a),"renderCloseBtn",(function(){return f.createElement("div",{className:"filter-locking-close-and-saving-container"},a.renderSavingIndicator(),f.createElement(wo,{onClick:a.props.onClose,className:"filter-locking-close-btn",border:!1,size:"small"},f.createElement(Wn,{type:"close"})))})),mn(Cn(a),"renderSuggestion",(function(e){var t,n,o=e.name,r=null!==(t=o.format_txt)&&void 0!==t?t:o.keyword;return r?f.createElement("ul",{className:"filter-lock-suggestion-item","data-for":null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-delay-show":800,"data-tip":"".concat(r," <em>(").concat(o.show_message,")</em>")},f.createElement("span",null,r," ",f.createElement("em",null,"(",o.show_message,")"))):null})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children;e.query;var r=150,i=null===(t=a.filterListContainerRef)||void 0===t?void 0:t.clientHeight;return isNaN(i)||(r=i-20),f.createElement("div",n,f.createElement("div",{className:"react-autoql-filter-suggestion-container"},f.createElement(Po,{autoHeight:!0,autoHeightMin:0,maxHeight:r},o)))})),mn(Cn(a),"getSuggestions",(function(){var e,t,n=[],o=!a.state.isLoadingAutocomplete,r=!(null===(e=a.state.suggestions)||void 0===e||!e.length)&&o,i=!(null!==(t=a.state.suggestions)&&void 0!==t&&t.length)&&o;return r?n.push({title:'Related to "'.concat(a.state.inputValue,'"'),suggestions:a.state.suggestions}):i&&n.push({title:'Related to "'.concat(a.state.inputValue,'"'),suggestions:[{name:""}],emptyState:!0}),n})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title),e.emptyState?f.createElement("div",{className:"filter-locking-no-suggestions-text"},f.createElement("em",null,"No results")):null)})),mn(Cn(a),"renderVLInput",(function(){var e;return f.createElement(Kt,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:a.getSuggestions(),renderSuggestion:a.renderSuggestion,getSuggestionValue:a.getSuggestionValue,onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,renderSuggestionsContainer:a.renderSuggestionsContainer,getSectionSuggestions:function(e){return e.suggestions},renderSectionTitle:a.renderSectionTitle,multiSection:!0,inputProps:(e={onChange:a.onInputChange,value:a.state.inputValue,disabled:a.props.isFetchingFilters||a.state.isFetchingFilters,placeholder:"Search & select a filter"},mn(e,"data-test","react-autoql-filter-locking-input"),mn(e,"className","react-autoql-filter-locking-input"),mn(e,"id","react-autoql-filter-menu-input"),e)})})),mn(Cn(a),"renderFilterListCategory",(function(e,t){return f.createElement("div",{key:e,className:"react-autoql-filter-list-item-container"},a.renderFilterListCategoryHeader(e,t),f.createElement("div",{className:"react-autoql-filter-list"},a.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return a.renderFilterListItem(e)}))))})),mn(Cn(a),"renderFilterListCategoryHeader",(function(e,t){var n,o,r,i,l=null===(n=a.state.filters.find((function(t){return t.show_message===e})).filter_type)||void 0===n?void 0:n.trim().toUpperCase();return f.createElement("div",{className:"react-autoql-filter-list-title"},f.createElement("div",{className:"filter-name-column"},f.createElement("h4",{className:"filter-lock-category-title","data-for":null!==(o=a.props.tooltipID)&&void 0!==o?o:a.TOOLTIP_ID,"data-delay-show":800,"data-tip":e},e),f.createElement(Dl,{className:"include-exclude-toggle-group",options:["INCLUDE","EXCLUDE"],"data-test":"include-exclude-toggle-group",tooltips:["Only show results <strong>with</strong> these values","Show results <strong>without</strong> these values"],tooltipId:null!==(r=a.props.tooltipID)&&void 0!==r?r:a.TOOLTIP_ID,value:l,type:"button",onChange:function(t){return a.handleExcludeToggle(e,t)}})),0===t?f.createElement("div",{className:"persist-toggle-column"},f.createElement("h4",null,"Persist"),f.createElement(Wn,{type:"info","data-place":"left","data-for":null!==(i=a.props.tooltipID)&&void 0!==i?i:a.TOOLTIP_ID,"data-tip":" Persistent filters remain locked at all<br /> times, unless the filter is removed. If<br /> unchecked, the filter will be locked<br /> until you end your browser session."})):null)})),mn(Cn(a),"renderFilterListItem",(function(e){var t,n,o=a.getKey(e);return f.createElement("div",{key:o,"data-test":"react-autoql-filter-list-item",className:"react-autoql-filter-list-item ".concat(a.state.highlightedFilter===o?"react-autoql-highlight-row":""," ").concat(Pe?"mobile":"")},f.createElement("div",{className:"react-autoql-filter-list-item-filter"},null!==(t=e.format_txt)&&void 0!==t?t:e.value),f.createElement("div",{className:"react-autoql-filter-list-item-actions"},f.createElement(Ii,{className:"persist-toggle","data-test":"react-autoql-filter-lock-persist-toggle",type:"switch",checked:!e.isSession,onChange:function(){return a.handlePersistToggle(e)}}),f.createElement(Wn,{className:"react-autoql-remove-filter-icon","data-test":"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":null!==(n=a.props.tooltipID)&&void 0!==n?n:a.TOOLTIP_ID,"data-delay-show":500,type:"trash",onClick:function(){return a.removeFilter(e)}})))})),mn(Cn(a),"renderFilterList",(function(){var e;if(a.props.isFetchingFilters||a.state.isFetchingFilters)return f.createElement("div",{className:"react-autoql-filter-lock-list-loading-container"},f.createElement(Xa,null));if(null===(e=a.state.filters)||void 0===e||!e.length)return f.createElement("div",{className:"react-autoql-empty-filter-list"},f.createElement("i",null,rs.noFiltersLocked));var t=Tn(new Set(a.state.filters.map((function(e){return e.show_message}))));return f.createElement("div",{ref:function(e){return a.filterListContainerRef=e},className:"react-autoql-filter-list-container"},f.createElement(Po,null,t.map((function(e,t){return a.renderFilterListCategory(e,t)}))))})),mn(Cn(a),"render",(function(){return f.createElement(Rn,null,f.createElement(Wt,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:Gt,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1}),!a.props.tooltipID&&f.createElement(So,{afterShow:function(e){return handleTooltipBoundaryCollision(e,Cn(a))},className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),f.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},a.renderHeader(),a.renderVLInput(),a.renderFilterList()))})),a.contentKey=C(),a.autoCompleteArray=[],a.autocompleteDelay=100,a.TOOLTIP_ID="filter-locking-tooltip",a.state={filters:a.props.initialFilters||[],suggestions:[],inputValue:""},a}return pn(o,[{key:"handleHighlightFilterRow",value:function(e){var t=this;jt.info("This filter has already been applied.");this.highlightFilterStartTimeout=setTimeout((function(){t.setState({highlightedFilter:e})}),0),this.highlightFilterEndTimeout=setTimeout((function(){t.setState({highlightedFilter:void 0})}),1300)}}]),o}();mn(is,"propTypes",{authentication:nr,isOpen:b.bool,onClose:b.func,onChange:b.func,insertedFilter:b.string}),mn(is,"defaultProps",{authentication:Mo,insertedFilter:null,isOpen:!1,onClose:function(){},onChange:function(){}});var ls=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{insertedFilter:null}),mn(Cn(e),"componentDidMount",(function(){e._isMounted=!0,e.initialize()})),mn(Cn(e),"componentDidUpdate",(function(t){!e.props.isOpen&&t.isOpen?e.setState({insertedFilter:null}):e.props.isOpen&&!t.isOpen&&Co()})),mn(Cn(e),"componentWillUnmount",(function(){e._isMounted=!1})),mn(Cn(e),"initialize",(function(){e.setState({isFetchingFilters:!0}),vt(_o(e.props.authentication)).then((function(t){var n,o=(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.data)||[];e.props.onChange(o),e._isMounted&&e.setState({initialFilters:o,isFetchingFilters:!1})})).catch((function(t){console.error(t),e._isMounted&&e.setState({isFetchingFilters:!1})}))})),mn(Cn(e),"onChange",(function(t){e.props.onChange(t),e.setState({initialFilters:t})})),mn(Cn(e),"insertFilter",(function(t){e.setState({insertedFilter:t})})),mn(Cn(e),"renderContent",(function(){var t;return f.createElement(is,{authentication:e.props.authentication,isOpen:e.props.isOpen,onClose:e.props.onClose,onChange:e.onChange,containerRef:e.containerRef,insertedFilter:e.state.insertedFilter,initialFilters:e.state.initialFilters,isFetchingFilters:e.state.isFetchingFilters,tooltipID:null!==(t=e.props.tooltipID)&&void 0!==t?t:e.TOOLTIP_ID})})),mn(Cn(e),"render",(function(){return f.createElement(Xn,{containerClassName:"filter-lock-popover".concat(Pe?" filter-lock-popover-mobile":""),onClickOutside:e.props.onClose,positions:e.props.positions,isOpen:e.props.isOpen,align:e.props.align,parentElement:e.props.parentElement,boundaryElement:e.props.boundaryElement,content:e.renderContent(),boundaryInset:10,showArrow:!0},e.props.children||f.createElement("div",{style:{display:"none"}}))})),e}return pn(n)}();mn(ls,"propTypes",{authentication:nr,isOpen:b.bool,position:b.string,align:b.string,onClose:b.func,onChange:b.func}),mn(ls,"defaultProps",{authentication:Mo,isOpen:!1,position:"bottom",align:"center",onClose:function(){},onChange:function(){}});var ss=Ga(ls),cs=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidUpdate",(function(t){e.props.finalTranscript!==t.finalTranscript?e.props.onFinalTranscript(e.props.finalTranscript):e.props.transcript!==t.transcript?e.props.onTranscriptChange(e.props.transcript):e.props.interimTranscript!==t.interimTranscript&&e.props.onTranscriptChange(e.props.interimTranscript)})),mn(Cn(e),"onMouseDown",(function(){Eo(),e.props.onTranscriptStart(),e.props.startListening()})),mn(Cn(e),"render",(function(){var t,n=e.props;n.transcript,n.interimTranscript,n.resetTranscript;var o=n.browserSupportsSpeechRecognition;n.startListening;var a=n.stopListening,r=n.listening;return o?f.createElement(Rn,null,f.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(r?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:a,onMouseLeave:e.props.listening?a:void 0,"data-tip":"Hold for voice-to-text","data-for":null!==(t=e.props.tooltipID)&&void 0!==t?t:"react-autoql-speech-to-text-tooltip","data-tip-disable":e.props.listening},f.createElement(Wn,{type:"microphone"})),!e.props.tooltipID&&f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return pn(n)}();mn(cs,"propTypes",{transcript:b.string,interimTranscript:b.string,finalTranscript:b.string,resetTranscript:b.func,browserSupportsSpeechRecognition:b.bool,startListening:b.func,stopListening:b.func,listening:b.bool,onTranscriptChange:b.func,onFinalTranscript:b.func,onTranscriptStart:b.func}),mn(cs,"defaultProps",{onTranscriptStart:function(){},onTranscriptChange:function(){},onFinalTranscript:function(){}});var us=Jt({autoStart:!1,continuous:!1})(cs),ds=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a;return un(this,n),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,document.addEventListener("keydown",a.onEscKeypress)})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){return(!a.props.isResizing||!e.isResizing)&&(!Ma(a.props,e)||!Ma(a.state,t))})),mn(Cn(a),"componentDidUpdate",(function(e,t){a.props.inputValue!==e.inputValue&&a.setState({inputValue:a.props.inputValue}),!a.state.inputValue||t.inputValue||a.userSelectedSuggestion||a.setState({suggestions:[]})})),mn(Cn(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.queryValidationTimer),clearTimeout(a.caretMoveTimeout),document.removeEventListener("keydown",a.onEscKeypress)})),mn(Cn(a),"onEscKeypress",(function(e){"Escape"===e.key&&(!(e.ctrlKey||e.altKey||e.shiftKey)&&a.cancelQuery())})),mn(Cn(a),"animateInputTextAndSubmit",(function(e){var t=e.query,n=e.userSelection,o=e.source,r=e.skipQueryValidation,i=e.scope;Pa({text:t,inputRef:a.inputRef,callback:function(){a.submitQuery({queryText:t,userSelection:n,skipQueryValidation:null==r||r,source:o,scope:i})}})})),mn(Cn(a),"submitDprQuery",(function(e,t){var n,o;(function(e){var t,n=e.query,o=e.dprKey,a=e.dprDomain,r=e.sessionId,i="".concat(a||"https://autoae-api-staging.chata.io","/api/v1/query?key=").concat(o),l={query:n};r||console.warn("No session ID was supplied to DPR. Using a randomly generated UUID instead");var s={headers:(t={},mn(t,"AutoAE-Referer-URL",window.location.origin),mn(t,"AutoAE-Session-ID",r||C()),t)};return E.post(i,l,s)})({dprKey:null===(n=a.props.authentication)||void 0===n?void 0:n.dprKey,dprDomain:null===(o=a.props.authentication)||void 0===o?void 0:o.dprDomain,query:e,sessionId:a.props.sessionId}).then((function(n){return a.onResponse(n,e,t)})).catch((function(n){console.error(n),a.onResponse(n,e,t)}))})),mn(Cn(a),"onResponse",(function(e,t,n){var o;a.props.onResponseCallback(e,t,n);var r={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(o=a.state)||void 0===o?void 0:o.lastQuery)};a._isMounted&&a.setState(r)})),mn(Cn(a),"cancelQuery",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(lr.CANCELLED)})),mn(Cn(a),"submitQuery",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryText,o=t.userSelection,r=t.skipQueryValidation,i=t.source,l=n||a.state.inputValue;if(l){a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer);var s={isQueryRunning:!0,suggestions:[],queryHistoryIndex:-1,queryValidationResponse:void 0,queryValidationComponentId:C()};a.props.clearQueryOnSubmit&&(s.inputValue=""),a._isMounted&&a.setState(s),a.axiosSource=null===(e=E.CancelToken)||void 0===e?void 0:e.source();var c=an(an(an({query:l,userSelection:o},_o(a.props.authentication)),zo(a.props.autoQLConfig)),{},{source:Va(a.props.source,null!=i?i:"user"),scope:a.props.scope,AutoAEId:a.props.AutoAEId,filters:a.props.queryFilters,pageSize:a.props.dataPageSize,cancelToken:a.axiosSource.token});if(l.trim()){var u,d,p=C();a.props.onSubmit(l,p),a.addQueryToHistory(l),null!==(u=a.props.authentication)&&void 0!==u&&u.token||null===(d=a.props.authentication)||void 0===d||!d.dprKey?r?je(c).then((function(e){return a.onResponse(e,l,p)})).catch((function(e){var t=e||{error:ir.GENERAL_QUERY};a.onResponse(t,l,p)})):ht(c).then((function(e){return a.onResponse(e,l,p)})).catch((function(e){var t=e||{error:ir.GENERAL_QUERY};a.onResponse(t,l,p)})):a.submitDprQuery(l,p)}}})),mn(Cn(a),"onTranscriptStart",(function(){a.setState({listeningForTranscript:!0})})),mn(Cn(a),"onTranscriptChange",(function(e){a.setState({inputValue:e})})),mn(Cn(a),"onFinalTranscript",(function(e){a.setState({inputValue:e,listeningForTranscript:!1},(function(){a.focus(),Eo()}))})),mn(Cn(a),"setInputRef",(function(e){a.inputRef=e})),mn(Cn(a),"getQueryHistory",(function(){try{var e=localStorage.getItem(a.queryHistoryId);if(!e)return[];var t=JSON.parse(e);return(null==t?void 0:t.constructor)!==Array|!(null!=t&&t.length)?[]:t}catch(e){return console.error(e),[]}})),mn(Cn(a),"addQueryToHistory",(function(e){try{var t=a.getQueryHistory().filter((function(t){return t!==e}));t.unshift(e),t.length>a.MAX_QUERY_HISTORY&&(t=t.slice(0,a.MAX_QUERY_HISTORY)),localStorage.setItem(a.queryHistoryId,JSON.stringify(t))}catch(e){console.error(e)}})),mn(Cn(a),"onKeyDown",(function(e){if("ArrowUp"===e.key||"ArrowDown"===e.key){var t;if(a.userSelectedSuggestion||null!==(t=a.state.suggestions)&&void 0!==t&&t.length)return e;var n="",o=a.getQueryHistory(),r=a.state.queryHistoryIndex;"ArrowUp"===e.key&&o[r+1]?r+=1:"ArrowDown"===e.key&&r>=0&&(r-=1),-1!==r&&(n=o[r]),void 0!==n&&n!==a.state.inputValue?a.setState({inputValue:n,queryHistoryIndex:r},a.moveCaretAtEnd):a.moveCaretAtEnd()}else a.userSelectedSuggestion=!1;return e})),mn(Cn(a),"onKeyPress",(function(e){"Enter"==e.key&&a.submitQuery()})),mn(Cn(a),"focus",(function(){var e;null!==(e=a.inputRef)&&void 0!==e&&e.focus&&a.inputRef.focus()})),mn(Cn(a),"userSelectedSuggestionHandler",(function(e){e&&a._isMounted&&e.name&&(a.userSelectedValue=e.name,a.userSelectedSuggestion=!0,a.setState({inputValue:e.name}))})),mn(Cn(a),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&(a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer),a.autoCompleteTimer=setTimeout((function(){Ke(an({suggestion:t},_o(a.props.authentication))).then((function(e){var t;if(a.state.inputValue){var n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,r=[];a.autoCompleteArray=[],n=o.matches;for(var i=0;i<n.length&&(r.push(n[i]),4!==i);i++);r.sort((function(e,t){return t.length-e.length}));for(var l=0;l<r.length;l++){var s={name:r[l]};a.autoCompleteArray.push(s)}a.setState({suggestions:a.autoCompleteArray})}})).catch((function(e){console.error(e)}))}),300))})),mn(Cn(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),mn(Cn(a),"renderSuggestionsContainer",(function(e){var t=e.containerProps,n=e.children;return f.createElement("div",t,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},n))})),mn(Cn(a),"renderSectionTitle",(function(e){return f.createElement(f.Fragment,null,f.createElement("strong",null,e.title))})),mn(Cn(a),"getSectionSuggestions",(function(e){return e.suggestions})),mn(Cn(a),"getSuggestions",(function(){var e;return[{title:(null===(e=a.state.suggestions)||void 0===e?void 0:e.find((function(e){return e.fromHistory})))?"Recent":"",suggestions:a.state.suggestions}]})),mn(Cn(a),"onInputChange",(function(e){var t,n;if(a.state.listeningForTranscript)e.stopPropagation();else{var o=null==e||null===(t=e.target)||void 0===t?void 0:t.value;if(zo(a.props.autoQLConfig).enableAutocomplete){if(!(a.userSelectedSuggestion||null!==(n=a.state.suggestions)&&void 0!==n&&n.length)||"ArrowUp"!==e.key&&"ArrowDown"!==e.key)if("Enter"!==e.key){var r={};a.props.isBackButtonClicked?r.inputValue="":r.inputValue=o||""===o?o:a.userSelectedValue,o||"Backspace"!==e.key&&"Delete"!==e.key||(r.suggestions=a.getQueryHistory()),a.setState(r)}else a.setState({inputValue:o},(function(){return a.submitQuery()}))}else a.setState({inputValue:o})}})),mn(Cn(a),"showQueryHistorySuggestions",(function(){if(!a.state.inputValue){var e,t=null===(e=a.getQueryHistory())||void 0===e?void 0:e.map((function(e){return{name:e,fromHistory:!0}})).reverse();a.setState({suggestions:t})}})),mn(Cn(a),"moveCaretAtEnd",(function(e){clearTimeout(a.caretMoveTimeout),a.caretMoveTimeout=setTimeout((function(){try{var e,t,n=null===(e=a.inputRef)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.length;null===(t=a.inputRef)||void 0===t||t.setSelectionRange(n,n)}catch(e){}}),0)})),mn(Cn(a),"render",(function(){var e={ref:a.setInputRef,id:a.UNIQUE_ID,className:"".concat(a.UNIQUE_ID," react-autoql-query-input react-autoql-chatbar-input").concat(a.props.showChataIcon?" left-padding":""),placeholder:a.props.placeholder,disabled:a.props.isDisabled,onChange:a.onInputChange,onKeyPress:a.onKeyPress,onKeyDown:a.onKeyDown,value:a.state.inputValue,onFocus:a.moveCaretAtEnd,onBlur:function(){return a.setState({suggestions:[]})},onClick:a.showQueryHistorySuggestions,spellCheck:!1,autoFocus:!0,autoComplete:"one-time-code"};return f.createElement(Rn,null,f.createElement("div",{className:"react-autoql-bar-container ".concat(a.props.className," ").concat("below"===a.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},f.createElement("div",{className:"react-autoql-chatbar-input-container"},zo(a.props.autoQLConfig).enableAutocomplete?f.createElement(Kt,{onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,renderSuggestionsContainer:a.renderSuggestionsContainer,getSuggestionValue:a.userSelectedSuggestionHandler,getSectionSuggestions:a.getSectionSuggestions,renderSectionTitle:a.renderSectionTitle,suggestions:a.getSuggestions(),multiSection:!0,shouldRenderSuggestions:function(){return!a.props.isDisabled},ref:function(e){return a.autoSuggest=e},renderSuggestion:function(e){return f.createElement(h,null,null==e?void 0:e.name)},inputProps:e}):f.createElement("input",e)),a.props.showChataIcon&&f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})),a.props.showLoadingDots&&a.state.isQueryRunning&&f.createElement("div",{className:"input-response-loading-container"},f.createElement(Xa,null)),!Pe&&a.props.enableVoiceRecord&&f.createElement(us,{onTranscriptStart:a.onTranscriptStart,onTranscriptChange:a.onTranscriptChange,onFinalTranscript:a.onFinalTranscript,authentication:a.props.authentication,tooltipID:a.props.tooltipID})))})),a.UNIQUE_ID=C(),a.MAX_QUERY_HISTORY=5,a.queryHistoryId="query-history-".concat(null===(o=e.authentication)||void 0===o?void 0:o.domain),a.autoCompleteTimer=void 0,a.autoCompleteArray=[],a.state={inputValue:"",lastQuery:"",queryHistoryIndex:-1,wasInputClicked:!1,suggestions:[],isQueryRunning:!1,listeningForTranscript:!1},a}return pn(n)}();mn(ds,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,enableVoiceRecord:b.bool,isDisabled:b.bool,onSubmit:b.func,onResponseCallback:b.func,className:b.string,autoCompletePlacement:b.string,showLoadingDots:b.bool,showChataIcon:b.bool,inputValue:b.string,queryFilters:b.arrayOf(b.shape({})),placeholder:b.string,clearQueryOnSubmit:b.bool,sessionId:b.string,dataPageSize:b.number,shouldRender:b.bool}),mn(ds,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:null,queryFilters:void 0,clearQueryOnSubmit:!0,placeholder:"Type your queries here",dataPageSize:void 0,shouldRender:!0,onSubmit:function(){},onResponseCallback:function(){}});var ps,ms=Ga(ds),fs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.props.scrollToBottom(),o.scrollToBottomTimeout=setTimeout((function(){o.props.scrollToBottom()}),100),o.setIsAnimating()})),mn(Cn(o),"shouldComponentUpdate",(function(e,t){return(!o.props.isResizing||!e.isResizing)&&(!Ma(o.props,e)||!Ma(o.state,t))})),mn(Cn(o),"getSnapshotBeforeUpdate",(function(e,t){var n,a=!1;return o.ref&&(!o.props.isResizing&&e.isResizing&&(a=!0,n=o.ref.clientWidth),o.props.isResizing&&!e.isResizing&&(a=!0,n="")),{messageWidth:n,shouldUpdateWidth:a}})),mn(Cn(o),"componentDidUpdate",(function(e,t,n){var a,r=n.messageWidth;n.shouldUpdateWidth&&null!==(a=o.ref)&&void 0!==a&&a.style&&(o.ref.style.width=r)})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.scrollToBottomTimeout),clearTimeout(o.animationTimeout)})),mn(Cn(o),"setIsAnimating",(function(){if(!o.state.isAnimatingMessageBubble)return o.setState({isAnimatingMessageBubble:!0},(function(){o.clearIsAnimatingIn500ms()}));o.clearIsAnimatingIn500ms()})),mn(Cn(o),"clearIsAnimatingIn500ms",(function(){clearTimeout(o.animationTimeout),o.animationTimeout=setTimeout((function(){o.setState({isAnimatingMessageBubble:!1}),o.props.scrollToBottom()}),500)})),mn(Cn(o),"onCSVDownloadFinish",(function(e){var t,n=e.error,a=e.exportLimit,r=e.limitReached;if(n)return o.props.addMessageToDM({response:n});var i=null===(t=o.props.response)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.text;o.props.addMessageToDM({content:f.createElement(f.Fragment,null,"Your file has successfully been downloaded with the query"," ",f.createElement("b",null,f.createElement("i",null,i)),".",r?f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("p",null,f.createElement("br",null),"WARNING: The file you’ve requested is larger than ",a,"MB. This exceeds the maximum download size and you will only receive partial data.")):null)})})),mn(Cn(o),"isScrolledIntoView",(function(e){if(o.props.scrollContainerRef){var t=o.props.scrollContainerRef.getScrollTop(),n=t+o.props.scrollContainerRef.getClientHeight(),a=e.offsetTop;return a+e.offsetHeight<=n&&a>=t}return!1})),mn(Cn(o),"scrollIntoView",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.delay,n=void 0===t?0:t,a=e.block,r=void 0===a?"end":a,i=e.inline,l=void 0===i?"nearest":i;e.behavior,setTimeout((function(){o.messageAndRTContainerRef&&!o.isScrolledIntoView(o.messageAndRTContainerRef)&&o.messageAndRTContainerRef.scrollIntoView({block:r,inline:l})}),n)})),mn(Cn(o),"updateDataConfig",(function(e){o.setState({dataConfig:e})})),mn(Cn(o),"renderFetchingFileMessage",(function(){return f.createElement("div",null,"Fetching your file ",f.createElement(Ro,null))})),mn(Cn(o),"renderCSVProgressMessage",(function(){return isNaN(o.state.csvDownloadProgress)?o.renderFetchingFileMessage():"Downloading your file ... ".concat(o.state.csvDownloadProgress,"%")})),mn(Cn(o),"renderContent",(function(){var e;return o.props.isCSVProgressMessage||void 0!==o.state.csvDownloadProgress?o.renderCSVProgressMessage():o.props.content?o.props.content:401===(null===(e=o.props.response)||void 0===e?void 0:e.status)?ir.UNAUTHENTICATED:o.props.response?f.createElement(bl,{ref:function(e){return o.responseRef=e},optionsToolbarRef:o.optionsToolbarRef,vizToolbarRef:o.vizToolbarRef,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,queryResponse:o.props.response,onSuggestionClick:o.props.onSuggestionClick,isQueryRunning:o.props.isChataThinking,copyToClipboard:o.copyToClipboard,tableOptions:o.props.tableOptions,dataFormatting:o.props.dataFormatting,appliedFilters:o.props.appliedFilters,onDrilldownStart:o.props.onDrilldownStart,onDrilldownEnd:o.props.onDrilldownEnd,demo:_o(o.props.authentication).demo,enableAjaxTableData:o.props.enableAjaxTableData,originalQueryID:o.props.originalQueryID,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),onErrorCallback:o.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isAnimating:o.state.isAnimatingMessageBubble,isResizing:o.props.isResizing,enableDynamicCharting:o.props.enableDynamicCharting,initialTableConfigs:o.state.dataConfig,onTableConfigChange:o.updateDataConfig,onNoneOfTheseClick:o.props.onNoneOfTheseClick,autoChartAggregations:o.props.autoChartAggregations,showQueryInterpretation:!1,enableFilterLocking:o.props.enableFilterLocking,onRTValueLabelClick:o.props.onRTValueLabelClick,source:o.props.source,scope:o.props.scope,onRowChange:o.scrollIntoView,onDisplayTypeChange:o.scrollIntoView,mutable:!1,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,showSuggestionPrefix:!1,dataPageSize:o.props.dataPageSize,popoverParentElement:o.props.popoverParentElement,reportProblemCallback:function(){var e,t;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=o.optionsToolbarRef)||void 0===t||t.openReportProblemModal())}}):ir.GENERAL_QUERY})),mn(Cn(o),"onCSVDownloadStart",(function(e){var t=e.id,n=e.queryId,a=e.query;o.props.addMessageToDM({id:t,query:a,queryId:n,content:o.renderFetchingFileMessage(),isCSVProgressMessage:!0})})),mn(Cn(o),"onDeleteMessage",(function(){return o.props.deleteMessageCallback(o.props.id)})),mn(Cn(o),"renderRightToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar right"},o.props.isResponse?f.createElement($l,{ref:function(e){return o.optionsToolbarRef=e},responseRef:o.responseRef,className:"chat-message-toolbar right",shouldRender:!o.props.isResizing&&o.props.shouldRender,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadFinish:o.onCSVDownloadFinish,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onSuccessAlert:o.props.onSuccessAlert,onErrorCallback:o.props.onErrorCallback,enableDeleteBtn:!o.props.isIntroMessage,popoverParentElement:o.props.popoverParentElement,deleteMessageCallback:o.onDeleteMessage,tooltipID:o.props.tooltipID,createDataAlertCallback:o.props.createDataAlertCallback,popoverAlign:"end"}):null)})),mn(Cn(o),"renderLeftToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar left"},o.props.isResponse&&"text"!==o.props.type?f.createElement(Cl,{ref:function(e){return o.vizToolbarRef=e},responseRef:o.responseRef,className:"chat-message-toolbar left",tooltipID:o.props.tooltipID,shouldRender:!o.props.isResizing&&o.props.shouldRender}):null)})),mn(Cn(o),"render",(function(){var e,t=!(null===(e=o.responseRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e||!e.parsed_interpretation);return f.createElement(Rn,null,f.createElement("div",{className:"chat-message-and-rt-container\n ".concat(o.props.isResponse?"response":"request","\n\t\t\t").concat(Pe?"pwa":"","\n ").concat("text"===o.props.type?"text":"","\n ").concat(o.props.isActive?"active":"","\n ").concat(o.props.disableMaxHeight||o.props.isIntroMessage?" no-max-height":""),ref:function(e){return o.messageAndRTContainerRef=e}},f.createElement("div",{id:"message-".concat(o.props.id),ref:function(e){return o.messageContainerRef=e},"data-test":"chat-message",className:"chat-single-message-container"},f.createElement("div",{ref:function(e){return o.ref=e},className:"chat-message-bubble"},f.createElement("div",{className:"chat-message-toolbars-container"},o.renderLeftToolbar(),o.renderRightToolbar()),o.renderContent())),t?f.createElement("div",{className:"chat-message-rt-container"},f.createElement(Xr,{authentication:o.props.authentication,onValueLabelClick:o.props.onRTValueLabelClick,queryResponse:o.responseRef.queryResponse,isResizing:o.props.isResizing,tooltipID:o.props.tooltipID})):null))})),o.filtering=!1,o.PIE_CHART_HEIGHT=330,o.MESSAGE_HEIGHT_MARGINS=40,o.MESSAGE_WIDTH_MARGINS=40,o.ORIGINAL_TABLE_MESSAGE_HEIGHT=void 0,o.state={csvDownloadProgress:o.props.initialCSVDownloadProgress,isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},o}return pn(n)}();mn(fs,"propTypes",(mn(ps={authentication:nr,autoQLConfig:ar,dataFormatting:or,isResponse:b.bool.isRequired,isIntroMessage:b.bool,isActive:b.bool,type:b.string,text:b.string,id:b.string.isRequired,onSuggestionClick:b.func,response:b.shape({}),content:b.oneOfType([b.string,b.shape({})]),enableColumnVisibilityManager:b.bool},"dataFormatting",or),mn(ps,"onErrorCallback",b.func),mn(ps,"onSuccessAlert",b.func),mn(ps,"isResizing",b.bool),mn(ps,"enableDynamicCharting",b.bool),mn(ps,"scrollToBottom",b.func),mn(ps,"onNoneOfTheseClick",b.func),mn(ps,"autoChartAggregations",b.bool),mn(ps,"onConditionClickCallback",b.func),mn(ps,"addMessageToDM",b.func),mn(ps,"csvDownloadProgress",b.number),mn(ps,"onRTValueLabelClick",b.func),mn(ps,"enableAjaxTableData",b.bool),mn(ps,"source",b.oneOfType([b.array,b.string])),mn(ps,"scope",b.string),mn(ps,"isVisibleInDOM",b.bool),ps)),mn(fs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,enableAjaxTableData:!1,isIntroMessage:!1,source:null,scope:void 0,response:void 0,content:void 0,isActive:!1,type:"text",text:null,enableColumnVisibilityManager:!0,isResizing:!1,enableDynamicCharting:!0,autoChartAggregations:!0,csvDownloadProgress:void 0,onRTValueLabelClick:void 0,isVisibleInDOM:!0,onSuggestionClick:function(){},onErrorCallback:function(){},onSuccessAlert:function(){},onConditionClickCallback:function(){},scrollToBottom:function(){},onNoneOfTheseClick:function(){}});var gs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidMount",(function(){var e;o._isMounted=!0,null!==(e=o.props.introMessages)&&void 0!==e&&e.length&&o.addIntroMessages(o.props.introMessages),o.props.shouldRender&&!Pe&&o.focusInput()})),mn(Cn(o),"componentDidUpdate",(function(e,t){var n;!o.props.shouldRender||e.shouldRender||Pe||o.focusInput(),null===(n=o.messengerScrollComponent)||void 0===n||n.update()})),mn(Cn(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.feedbackTimeout),clearTimeout(o.responseDelayTimeout)})),mn(Cn(o),"focusInput",(function(){var e;null!==(e=o.queryInputRef)&&void 0!==e&&e._isMounted&&o.queryInputRef.focus()})),mn(Cn(o),"scrollToBottom",(function(){var e;null===(e=o.messengerScrollComponent)||void 0===e||e.scrollToBottom()})),mn(Cn(o),"onCSVDownloadProgress",(function(e){var t,n=e.id,a=e.progress;o.csvProgressLog[n]=a,o.messageRefs[n]&&null!==(t=o.messageRefs[n])&&void 0!==t&&t._isMounted&&o.messageRefs[n].setState({csvDownloadProgress:a})})),mn(Cn(o),"clearMessages",(function(){var e;null===(e=o.queryInputRef)||void 0===e||e.cancelQuery(),o._isMounted&&o.setState({messages:o.getIntroMessages(o.props.introMessages),isClearingAllMessages:!0})})),mn(Cn(o),"animateInputTextAndSubmit",(function(){var e;if(null!==(e=o.queryInputRef)&&void 0!==e&&e._isMounted){for(var t,n=arguments.length,a=new Array(n),r=0;r<n;r++)a[r]=arguments[r];null===(t=o.queryInputRef)||void 0===t||t.animateInputTextAndSubmit.apply(t,a)}})),mn(Cn(o),"onNoneOfTheseClick",(function(){o.addRequestMessage("None of these"),o.setState({isQueryRunning:!0}),clearTimeout(o.feedbackTimeout),o.feedbackTimeout=setTimeout((function(){o._isMounted&&(clearTimeout(o.responseDelayTimeout),o.setState({isQueryRunning:!1,isInputDisabled:!1}),o.addResponseMessage({content:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")}))}),1e3)})),mn(Cn(o),"onDrilldownStart",(function(){o.state.isDrilldownRunning&&(o.keepLoading=!0),o.setState({isDrilldownRunning:!0,isInputDisabled:!0})})),mn(Cn(o),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error,a=e.originalQueryID;o._isMounted&&(o.keepLoading?o.keepLoading=!1:(clearTimeout(o.responseDelayTimeout),o.setState({isDrilldownRunning:!1,isInputDisabled:!1}),t?o.addResponseMessage({response:t,originalQueryID:a}):n&&o.addResponseMessage({content:n})))})),mn(Cn(o),"getIsSuggestionResponse",(function(e){var t;return!(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t||!t.items)})),mn(Cn(o),"deleteMessage",(function(e){var t,n=o.state.messages.findIndex((function(t){return e===t.id})),a=o.state.messages[n],r=[e];null!=a&&a.queryMessageID&&(r=null===(t=o.state.messages)||void 0===t?void 0:t.filter((function(e){return e.queryMessageID===a.queryMessageID})).map((function(e){return e.id})));var i=o.state.messages.filter((function(e){return!r.includes(e.id)}));o.setState({messages:i})})),mn(Cn(o),"getIntroMessages",(function(e){return e.map((function(e){return o.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),mn(Cn(o),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&o.addMessages(o.getIntroMessages(e))})),mn(Cn(o),"addMessage",(function(e){o.addMessages([e])})),mn(Cn(o),"addMessages",(function(e){var t=[].concat(Tn(o.state.messages),Tn(e));t.length>o.props.maxMessages&&(t=t.slice(-o.props.maxMessages)),o._isMounted&&o.setState({messages:t})})),mn(Cn(o),"addRequestMessage",(function(e,t){o.addMessage(o.createMessage({content:e,isResponse:!1,queryMessageID:t}))})),mn(Cn(o),"addResponseMessage",(function(){var e,t,n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a.isResponse=!0,"Unauthenticated"===(null==a||null===(e=a.response)||void 0===e?void 0:e.error))n=o.createErrorMessage(ir.UNAUTHENTICATED);else if("Parse error"===(null==a||null===(t=a.response)||void 0===t?void 0:t.error))n=o.createErrorMessage(ir.GENERAL_QUERY);else if(null!=a&&a.response||null!=a&&a.content){var r=o.getAppliedFilters(null==a?void 0:a.response);n=o.createMessage(an(an({},a),{},{appliedFilters:r}))}else n=o.createErrorMessage();n&&o.addMessage(n)})),mn(Cn(o),"onInputSubmit",(function(e,t){o.addRequestMessage(e,t),o.setState({isInputDisabled:!0}),o.responseDelayTimeout=setTimeout((function(){o.setState({isQueryRunning:!0})}),600)})),mn(Cn(o),"onResponse",(function(e,t,n){if(o._isMounted){var a,r;if(o.setState({isQueryRunning:!1,isInputDisabled:!1}),(null==e||null===(a=e.data)||void 0===a?void 0:a.message)===lr.CANCELLED&&o.state.isClearingAllMessages)return void o.setState({isClearingAllMessages:!1,isQueryRunning:!1,isDrilldownRunning:!1,isInputDisabled:!1});o.getIsSuggestionResponse(e)&&o.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:",queryMessageID:n}),Xt(null==e||null===(r=e.data)||void 0===r?void 0:r.data,"authorization_url")?o.addResponseMessage({content:f.createElement("span",null,"Looks like you’re trying to query a Microsoft Dynamics data source.",f.createElement("a",{href:e.data.data.authorization_url,target:"_blank",rel:"noreferrer"},"Click here to authorize access then try querying again.")),queryMessageID:n}):o.addResponseMessage({response:e,query:t,queryMessageID:n}),clearTimeout(o.responseDelayTimeout),!Pe&&o.focusInput()}})),mn(Cn(o),"createMessage",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.id||C();return an({id:n,type:null===(e=t.response)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.display_type},t)})),mn(Cn(o),"createErrorMessage",(function(e,t){return o.createMessage({content:e||ir.GENERAL_QUERY,isResponse:!0,type:"error",queryMessageID:t})})),mn(Cn(o),"getAppliedFilters",(function(e){try{var t,n,o=null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.fe_req)||void 0===t?void 0:t.persistent_filter_locks,a=null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.fe_req)||void 0===n?void 0:n.session_filter_locks;return Array.isArray(o)||(o=[]),Array.isArray(a)||(a=[]),[].concat(Tn(o),Tn(a))}catch(e){return[]}})),mn(Cn(o),"isChataThinking",(function(){return o.state.isQueryRunning||o.state.isDrilldownRunning})),mn(Cn(o),"render",(function(){var e,t;return o.props.shouldRender||(e="hidden",t="0"),f.createElement(Rn,null,f.createElement("div",{ref:function(e){return o.chatContentRef=e},className:"chat-content-scroll-container ".concat(o.props.shouldRender?"":"react-autoql-content-hidden"),style:{visibility:e,opacity:t}},f.createElement(Po,{ref:function(e){return o.messengerScrollComponent=e},className:"chat-content-scrollbars-container"},f.createElement("div",{className:"chat-content-container"},o.state.messages.map((function(e){return f.createElement(fs,{key:e.id,id:e.id,ref:function(t){return o.messageRefs[e.id]=t},isIntroMessage:e.isIntroMessage,authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,isCSVProgressMessage:e.isCSVProgressMessage,initialCSVDownloadProgress:o.csvProgressLog[e.id],onCSVDownloadProgress:o.onCSVDownloadProgress,queryId:e.queryId,queryText:e.query,originalQueryID:e.originalQueryID,isDataMessengerOpen:o.props.isDataMessengerOpen,isActive:o.state.activeMessageId===e.id,addMessageToDM:o.addResponseMessage,onDrilldownStart:o.onDrilldownStart,onDrilldownEnd:o.onDrilldownEnd,isResponse:e.isResponse,isChataThinking:o.isChataThinking(),onSuggestionClick:o.animateInputTextAndSubmit,content:e.content,scrollToBottom:o.scrollToBottom,dataFormatting:o.props.dataFormatting,response:e.response,type:e.type,onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessAlert,deleteMessageCallback:o.deleteMessage,createDataAlertCallback:o.props.createDataAlertCallback,scrollContainerRef:o.messengerScrollComponent,isResizing:o.props.isResizing,enableDynamicCharting:o.props.enableDynamicCharting,onNoneOfTheseClick:o.onNoneOfTheseClick,autoChartAggregations:o.props.autoChartAggregations,onRTValueLabelClick:o.props.onRTValueLabelClick,appliedFilters:e.appliedFilters,disableMaxHeight:o.props.disableMaxMessageHeight,enableAjaxTableData:o.props.enableAjaxTableData,queryRequestData:e.queryRequestData,popoverParentElement:o.chatContentRef,isVisibleInDOM:o.props.shouldRender,dataPageSize:o.props.dataPageSize,shouldRender:o.props.shouldRender,source:o.props.source,scope:o.props.scope,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID})})))),o.isChataThinking()&&f.createElement("div",{className:"response-loading-container"},f.createElement(Xa,null))),f.createElement("div",{style:{visibility:e,opacity:t},className:"chat-bar-container ".concat(o.props.shouldRender?"":"react-autoql-content-hidden")},f.createElement("div",{className:"watermark"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"}),rs.run),f.createElement(ms,{ref:function(e){return o.queryInputRef=e},className:"chat-drawer-chat-bar",authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,onSubmit:o.onInputSubmit,onResponseCallback:o.onResponse,isDisabled:o.state.isInputDisabled,enableVoiceRecord:o.props.enableVoiceRecord,autoCompletePlacement:"above",showChataIcon:!1,showLoadingDots:!1,placeholder:o.props.inputPlaceholder,onErrorCallback:o.props.onErrorCallback,hideInput:o.props.hideInput,source:o.props.source,scope:o.props.scope,queryFilters:o.props.queryFilters,sessionId:o.props.sessionId,dataPageSize:o.props.dataPageSize,isResizing:o.props.isResizing,shouldRender:o.props.shouldRender,tooltipID:o.props.tooltipID})))})),o.messageRefs={},o.csvProgressLog={},o.keepLoading=!1,o.state={messages:[]},o}return pn(n)}();mn(gs,"propTypes",{authentication:nr.isRequired,autoQLConfig:ar.isRequired,dataFormatting:or.isRequired,clearOnClose:b.bool.isRequired,enableVoiceRecord:b.bool.isRequired,maxMessages:b.number.isRequired,introMessage:b.string.isRequired,inputPlaceholder:b.string.isRequired,enableDynamicCharting:b.bool.isRequired,autoChartAggregations:b.bool.isRequired,enableFilterLocking:b.bool.isRequired,onErrorCallback:b.func.isRequired,onSuccessAlert:b.func.isRequired,onRTValueLabelClick:b.func,disableMaxMessageHeight:b.bool,enableAjaxTableData:b.bool,dataPageSize:b.number,sessionId:b.string,isResizing:b.bool,source:b.oneOfType([b.arrayOf(b.string),b.string]),scope:b.string,shouldRender:b.bool}),mn(gs,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isResizing:!1,dataPageSize:void 0,source:null,scope:void 0,onRTValueLabelClick:void 0,shouldRender:!0});var vs=function(t){gn(o,f.Component);var n=Sn(o);function o(t){var a;return un(this,o),mn(Cn(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0;try{window.addEventListener("resize",a.onWindowResize)}catch(e){console.error(e),a.setState({hasError:!0})}a.props.defaultOpen&&!a.isOpen()&&a.openDataMessenger(),setTimeout(Co,1e3)})),mn(Cn(a),"componentDidUpdate",(function(e,t){try{var n={};a.props.placement!==e.placement&&(n.placement=a.getPlacementProp(a.props.placement)),a.state.isSizeMaximum!==t.isSizeMaximum&&a.forceUpdate(),"number"==typeof a.props.notificationCount&&a.props.notificationCount!==e.notificationCount&&a.refreshNotifications(),!a.state.isVisible&&t.isVisible&&a.props.clearOnClose&&a.setState({dataMessengerId:C()}),a.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),_e(n)||a.setState(an({},n))}catch(e){console.error(e),a.setState({hasError:!0})}})),mn(Cn(a),"onError",(function(){return a.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")})),mn(Cn(a),"onSave",(function(){a.props.onSuccessAlert("Notification created!"),a.setState({isDataAlertModalVisible:!1})})),mn(Cn(a),"onClose",(function(){a.setState({isDataAlertModalVisible:!1})})),mn(Cn(a),"refreshNotifications",(function(){var e;null===(e=a.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),mn(Cn(a),"getMaxWidthAndHeightFromDocument",(function(){return{maxWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-a.TAB_THICKNESS,maxHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-a.TAB_THICKNESS}})),mn(Cn(a),"onWindowResize",(function(){a.state.isWindowResizing||a.setState({isWindowResizing:!0}),clearTimeout(a.windowResizeTimer),a.windowResizeTimer=setTimeout((function(){a.setState({isWindowResizing:!1})}),300)})),mn(Cn(a),"openDataMessenger",(function(e){Pe&&a.state.isVisible?a.setState({activePage:e}):(e?a.setState({activePage:e}):Pe&&"data-messenger"===a.props.mobileActivePage&&a.setState({activePage:"data-messenger"}),a.isOpen()||a.dmRef.setState({open:!0}))})),mn(Cn(a),"closeDataMessenger",(function(){a.dmRef.setState({open:!1}),a.setState({isVisible:!1})})),mn(Cn(a),"openExploreQueries",(function(e){a.setState({activePage:"explore-queries"},(function(){var t,n;e&&null!==(t=a.exploreQueriesRef)&&void 0!==t&&t.animateQITextAndSubmit&&(null===(n=a.exploreQueriesRef)||void 0===n||n.animateQITextAndSubmit(e))}))})),mn(Cn(a),"openDataExplorer",(function(e){Pe&&a.props.setMobileActivePage("data-explorer"),a.setState({activePage:"data-explorer"},(function(){var t,n;e&&null!==(t=a.dataExplorerRef)&&void 0!==t&&t.animateDETextAndSubmit&&(null===(n=a.dataExplorerRef)||void 0===n||n.animateDETextAndSubmit(e))}))})),mn(Cn(a),"openNotificationFeed",(function(){Pe&&a.props.setMobileActivePage("notification-feed"),a.notificationBadgeRef&&a.notificationBadgeRef.resetCount(),a.setState({activePage:"notifications"})})),mn(Cn(a),"toggleFullScreen",(function(e,t,n){a.setState({width:e?a.props.width:t,height:e?a.props.height:n,isSizeMaximum:!e,isResizing:!0},(function(){a.setState({isResizing:!1})})),Eo()})),mn(Cn(a),"getHandleProp",(function(){return void 0!==a.props.customHandle?a.props.customHandle:!!a.props.showHandle&&f.createElement("div",{ref:function(e){return a.drawerHandle=e},className:"drawer-handle\n ".concat(a.state.isVisible?" hide":"","\n ").concat(a.props.handleImage?"":" default-logo"),style:a.props.handleStyles,"data-test":"data-messenger-handle"},a.props.handleImage?f.createElement("img",{src:a.props.handleImage,height:"22px",width:"22px",draggable:"false"}):f.createElement(Wn,{type:"react-autoql-bubbles-outlined",size:26}))})),mn(Cn(a),"getDrawerHeight",(function(){return"right"===a.state.placement||"left"===a.state.placement?Pe?"calc(100% - 80px)":"100vh":a.state.height})),mn(Cn(a),"getDrawerWidth",(function(){return"top"===a.state.placement||"bottom"===a.state.placement?"100vw":a.state.width})),mn(Cn(a),"getPlacementProp",(function(){var e,t=a.props.placement;return"string"!=typeof t||"right"!==(e=t.trim().toLowerCase())&&"left"!==e&&"bottom"!==e&&"top"!==e?"right":e})),mn(Cn(a),"onDrawerChange",(function(e){e?a.setState({isVisible:!0}):a.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),mn(Cn(a),"onTopicClick",(function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];null===(e=a.dataMessengerContentRef)||void 0===e||e.animateInputTextAndSubmit.apply(e,n)})),mn(Cn(a),"handleClearQueriesDropdown",(function(){a.clearQueriesDropdown&&("block"===a.clearQueriesDropdown.style.display?a.clearQueriesDropdown.style.display="none":a.clearQueriesDropdown.style.display="block")})),mn(Cn(a),"onRTValueLabelClick",(function(e){a.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=a.filterLockRef)||void 0===t||t.insertFilter(e)}))})),mn(Cn(a),"clearMessages",(function(){var e;if("data-messenger"===a.state.activePage)null===(e=a.dataMessengerContentRef)||void 0===e||e.clearMessages();else if("dpr"===a.state.activePage){var t;null===(t=a.dprMessengerContentRef)||void 0===t||t.clearMessages()}a.setState({isOptionsDropdownOpen:!1})})),mn(Cn(a),"renderTabs",(function(){if(!(a.props.enableExploreQueriesTab||a.props.enableNotificationsTab||a.props.enableDPRTab||a.props.enableDataExplorerTab))return null;var e=a.state.activePage;return f.createElement("div",{className:"data-messenger-tab-container ".concat(a.props.placement," ").concat(a.state.isVisible?"visible":"hidden")},f.createElement("div",{className:"page-switcher-shadow-container ".concat(a.props.placement)},f.createElement("div",{className:"page-switcher-container ".concat(a.props.placement)},f.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return a.setState({activePage:"data-messenger"})},"data-tip":"Home","data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"})),a.props.enableExploreQueriesTab&&f.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return a.setState({activePage:"explore-queries"})},"data-tip":rs.exploreQueries,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"light-bulb",size:22})),a.props.enableDataExplorerTab&&f.createElement("div",{className:"tab".concat("data-explorer"===e?" active":""," react-autoql-data-explorer"),onClick:function(){return a.setState({activePage:"data-explorer"})},"data-tip":rs.dataExplorer,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"data-search",size:22})),a.props.enableNotificationsTab&&zo(a.props.autoQLConfig).enableNotifications&&f.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){a.notificationBadgeRef&&a.notificationBadgeRef.resetCount(),a.setState({activePage:"notifications"})},"data-tip":"Notifications","data-for":a.TOOLTIP_ID},f.createElement("div",{className:"data-messenger-notification-btn"},f.createElement(yr,{ref:function(e){return a.notificationBadgeRef=e},authentication:a.props.authentication,clearCountOnClick:!1,style:{fontSize:"19px"},overflowCount:9,count:a.props.notificationCount,useDot:!0,onCount:a.props.onNotificationCount,onErrorCallback:a.props.onErrorCallback,onNewNotification:function(e){a.props.onNewNotification(e)}}))),a.props.enableDPRTab&&f.createElement("div",{className:"tab".concat("dpr"===e?" active":""," react-autoql-dpr"),onClick:function(){return a.setState({activePage:"dpr"})},"data-tip":"Education","data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"grad-cap",size:22})))))})),mn(Cn(a),"renderRightHeaderContent",(function(){return f.createElement(f.Fragment,null,Oe?zo(a.props.autoQLConfig).enableFilterLocking&&a.renderFilterLockPopover():null,f.createElement(Jr,{className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===a.state.activePage||"dpr"===a.state.activePage?"visible":"hidden"),popoverParentElement:a.messengerDrawerRef,title:rs.clearDataResponses,onConfirm:a.clearMessages,confirmText:"Clear",backText:"Cancel",positions:["bottom","left","top","right"],align:"end"},f.createElement("button",{"data-tip":rs.clearQueriesTooltip,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"trash"}))))})),mn(Cn(a),"renderHeaderTitle",(function(){var e="";switch(a.state.activePage){case"data-messenger":e=a.props.title;break;case"explore-queries":e=rs.exploreQueries;break;case"data-explorer":e=rs.dataExplorer;break;case"notifications":e=rs.notifications;break;case"dpr":e=rs.education}return f.createElement("div",{className:"header-title"},e)})),mn(Cn(a),"openFilterLockMenu",(function(){a.state.isFilterLockMenuOpen||a.setState({isFilterLockMenuOpen:!0})})),mn(Cn(a),"closeFilterLockMenu",(function(){a.state.isFilterLockMenuOpen&&a.setState({isFilterLockMenuOpen:!1})})),mn(Cn(a),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));a.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),mn(Cn(a),"isOpen",(function(){var e;return!(null===(e=a.dmRef)||void 0===e||null===(e=e.state)||void 0===e||!e.open)})),mn(Cn(a),"shouldRenderPage",(function(e){return a.state.activePage===e&&a.isOpen()})),mn(Cn(a),"renderFilterLockPopover",(function(){return f.createElement(ss,{ref:function(e){return a.filterLockRef=e},authentication:a.props.authentication,isOpen:a.state.isFilterLockMenuOpen,onChange:a.onFilterChange,onClose:a.closeFilterLockMenu,parentElement:a.messengerDrawerRef,boundaryElement:a.messengerDrawerRef,tooltipID:a.TOOLTIP_ID,positions:["bottom","left","top","right"],align:"center"},f.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===a.state.activePage?"visible":"hidden"),"data-tip":rs.openFilterLocking,"data-for":a.TOOLTIP_ID,onClick:a.state.isFilterLockMenuOpen?a.closeFilterLockMenu:a.openFilterLockMenu},f.createElement("span",{className:"react-autoql-filter-lock-icon-container"},f.createElement(Wn,{type:a.state.hasFilters?"lock":"unlock"}),a.state.hasFilters?f.createElement("div",{className:"react-autoql-filter-lock-icon-badge"}):null)))})),mn(Cn(a),"renderHeaderContent",(function(){var e=a.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,o=a.state.width===t;return f.createElement(h,null,f.createElement("div",{className:"react-autoql-header-left-container ".concat("data-messenger"===a.state.activePage?"visible":"hidden")},Oe?f.createElement(f.Fragment,null,f.createElement("button",{onClick:a.closeDataMessenger,className:"react-autoql-drawer-header-btn","data-tip":rs.closeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:"close"})),f.createElement("button",{onClick:function(){return a.toggleFullScreen(o,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":o?rs.minimizeDataMessenger:rs.maximizeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(Wn,{type:o?"minimize":"maximize"}))):zo(a.props.autoQLConfig).enableFilterLocking&&a.renderFilterLockPopover()),f.createElement("div",{className:"react-autoql-header-center-container"},a.renderHeaderTitle()),f.createElement("div",{className:"react-autoql-header-right-container ".concat("data-messenger"===a.state.activePage?"visible":"hidden")},a.renderRightHeaderContent()))})),mn(Cn(a),"renderBodyContent",(function(){return f.createElement(f.Fragment,null,a.renderDataMessengerContent(),a.renderExploreQueriesContent(),a.renderDataExplorerContent(),a.renderNotificationsContent(),a.renderDPRContent())})),mn(Cn(a),"renderDataMessengerContent",(function(){var e=zo(a.props.autoQLConfig).enableFilterLocking?a.onRTValueLabelClick:void 0;return f.createElement(Rn,null,f.createElement(gs,fn({},a.props,{"data-test":"data-messenger-chat-content",shouldRender:a.shouldRenderPage("data-messenger"),key:a.state.dataMessengerId,ref:function(e){return a.dataMessengerContentRef=e},authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,isResizing:a.state.isResizing||a.state.isWindowResizing,source:a.SOURCE,onRTValueLabelClick:e,queryFilters:a.state.sessionFilters,introMessages:a.dataMessengerIntroMessages,inputPlaceholder:a.props.inputPlaceholder,enableAjaxTableData:a.props.enableAjaxTableData,autoChartAggregations:a.props.autoChartAggregations,popoverParentElement:a.messengerDrawerRef,dataPageSize:a.props.dataPageSize,createDataAlertCallback:a.closeDataMessenger,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,scope:a.props.scope})))})),mn(Cn(a),"renderDPRContent",(function(){var e,t;return a.props.enableDPRTab?f.createElement(Rn,null,f.createElement(gs,fn({},a.props,{shouldRender:a.shouldRenderPage("dpr"),key:a.state.dataMessengerId,ref:function(e){return a.dprMessengerContentRef=e},authentication:{dprKey:null===(e=a.props.authentication)||void 0===e?void 0:e.dprKey,dprDomain:null===(t=a.props.authentication)||void 0===t?void 0:t.dprDomain},isResizing:a.state.isResizing||a.state.isWindowResizing,source:a.SOURCE,introMessages:a.dprMessengerIntroMessages,disableMaxMessageHeight:!0,inputPlaceholder:"Type your questions here",sessionId:a.COMPONENT_KEY,autoQLConfig:{enableAutocomplete:!1,enableQueryValidation:!1,enableQuerySuggestions:!1,enableColumnVisibilityManager:!1,enableQueryInterpretation:!1,enableDrilldowns:!1,enableReportProblem:!1},createDataAlertCallback:a.closeDataMessenger,tooltipID:a.TOOLTIP_ID}))):null})),mn(Cn(a),"renderDataExplorerContent",(function(){return a.props.enableDataExplorerTab?f.createElement(Rn,null,f.createElement(dr,{ref:function(e){return a.dataExplorerRef=e},authentication:a.props.authentication,dataFormatting:a.props.dataFormatting,shouldRender:a.shouldRenderPage("data-explorer"),tooltipID:a.TOOLTIP_ID,scope:a.props.scope,executeQuery:function(e){Pe&&a.props.setMobileActivePage("data-messenger"),a.setState({activePage:"data-messenger"}),clearTimeout(a.executeQueryTimeout),a.executeQueryTimeout=setTimeout((function(){var t;null===(t=a.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["data_explorer"]})}),500)}})):null})),mn(Cn(a),"renderExploreQueriesContent",(function(){return a.props.enableExploreQueriesTab?f.createElement(Rn,null,f.createElement(Za,{ref:function(e){return a.exploreQueriesRef=e},authentication:a.props.authentication,shouldRender:a.shouldRenderPage("explore-queries"),tooltipID:a.TOOLTIP_ID,executeQuery:function(e){a.setState({activePage:"data-messenger"}),clearTimeout(a.executeQueryTimeout),a.executeQueryTimeout=setTimeout((function(){var t;null===(t=a.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["explore_queries"]})}),500)}})):null})),mn(Cn(a),"onDataAlertModalOpen",(function(){a.closeDataMessenger(),a.shouldOpenDataMessengerFromDA=!0})),mn(Cn(a),"onDataAlertModalClose",(function(){a.shouldOpenDataMessengerFromDA&&(a.shouldOpenDataMessengerFromDA=!1,a.openDataMessenger())})),mn(Cn(a),"renderNotificationsContent",(function(){return a.props.enableNotificationsTab?f.createElement(Rn,null,f.createElement(as,{ref:function(e){return a.notificationListRef=e},authentication:a.props.authentication,onExpandCallback:a.props.onNotificationExpandCallback,onCollapseCallback:a.props.onNotificationCollapseCallback,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessAlert,onModalOpen:a.onDataAlertModalOpen,onModalClose:a.onDataAlertModalClose,shouldRender:a.isOpen()&&"notifications"===a.state.activePage,tooltipID:a.TOOLTIP_ID,isResizing:a.state.isResizing||a.state.isWindowResizing,popoverParentElement:a.props.popoverParentElement})):null})),mn(Cn(a),"resizeDrawer",(function(t){var n=a.state.placement,o=a.getMaxWidthAndHeightFromDocument(),r=o.maxWidth,i=o.maxHeight;if("right"===n){var l=e(a.state.startingResizePosition,"x")-t.pageX,s=e(a.state.startingResizePosition,"width")+l;s>r&&(s=r),s<a.minWidth&&(s=a.minWidth),Number(s)&&a.setState({width:s,isSizeMaximum:!1})}else if("left"===n){var c=t.pageX-e(a.state.startingResizePosition,"x"),u=e(a.state.startingResizePosition,"width")+c;u>r&&(u=r),u<a.minWidth&&(u=a.minWidth),Number(u)&&a.setState({width:u,isSizeMaximum:!1})}else if("bottom"===n){var d=e(a.state.startingResizePosition,"y")-t.pageY,p=e(a.state.startingResizePosition,"height")+d;p>i&&(p=i),p<a.minHeight&&(p=a.minHeight),Number(p)&&a.setState({height:p,isSizeMaximum:!1})}else if("top"===n){var m=t.pageY-e(a.state.startingResizePosition,"y"),f=e(a.state.startingResizePosition,"height")+m;f>a.maxHeight&&(f=a.maxHeight),f<a.minHeight&&(f=a.minHeight),Number(f)&&a.setState({height:f,isSizeMaximum:!1})}})),mn(Cn(a),"stopResizingDrawer",(function(){"right"===a.state.placement||"left"===a.state.placement?a.setState({isResizing:!1}):"top"!==a.state.placement&&"bottom"!==a.state.placement||a.setState({isResizing:!1}),document.removeEventListener("mousemove",a.resizeDrawer),document.removeEventListener("mouseup",a.stopResizingDrawer),document.removeEventListener("mouseleave",a.stopResizingDrawer)})),mn(Cn(a),"renderResizeHandle",(function(){var e=Cn(a);if(a.state.isVisible){var t=a.getPlacementProp();return f.createElement("div",{className:"react-autoql-drawer-resize-handle ".concat(t),onMouseDown:function(t){a.setState({isResizing:!0,startingResizePosition:{x:t.pageX,y:t.pageY,width:a.state.width,height:a.state.height}}),document.addEventListener("mousemove",e.resizeDrawer),document.addEventListener("mouseup",e.stopResizingDrawer),document.addEventListener("mouseleave",e.stopResizingDrawer)}})}return null})),mn(Cn(a),"renderTooltips",(function(){return f.createElement(h,null,f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800,place:"top",html:!0}),f.createElement(So,{className:"react-autoql-chart-tooltip",id:a.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),mn(Cn(a),"render",(function(){return a.state.hasError?null:f.createElement(Rn,null,void((navigator.language||navigator.userLanguage).includes("sp")?rs.setLanguage("sp"):rs.setLanguage("en")),f.createElement(Ut,{ref:function(e){return a.dmRef=e},id:"react-autoql-drawer-".concat(a.COMPONENT_KEY),"data-test":"react-autoql-drawer-test",className:"react-autoql-drawer\n ".concat(a.state.isResizing?" disable-selection":"","\n ").concat(a.state.isVisible?" open":" closed","\n ","drawer-".concat(a.state.placement)),showMask:a.props.showMask,placement:a.getPlacementProp(),width:a.getDrawerWidth(),height:a.getDrawerHeight(),onChange:a.onDrawerChange,maskClosable:!0,handler:a.getHandleProp(),level:a.props.shiftScreen?"all":null,keyboard:!1},a.props.resizable&&Oe&&a.renderResizeHandle(),Oe?a.renderTabs():null,f.createElement("div",{ref:function(e){return a.messengerDrawerRef=e},className:Pe?"react-autoql-mobile-drawer-content-container":"react-autoql-drawer-content-container"},f.createElement("div",{className:"chat-header-container"},a.renderHeaderContent()),a.renderBodyContent())),a.renderTooltips())})),a.minWidth=400,a.minHeight=400,a.COMPONENT_KEY=C(),a.HEADER_THICKNESS=70,a.TAB_THICKNESS=45,a.SOURCE=Va(t.source,"data_messenger"),a.TOOLTIP_ID="react-autoql-data-messenger-tooltip-".concat(a.COMPONENT_KEY),a.CHART_TOOLTIP_ID="react-autoql-dm-chart-tooltip-".concat(a.COMPONENT_KEY),a.dataMessengerIntroMessages=[t.introMessage?"".concat(t.introMessage):f.createElement(f.Fragment,null,f.createElement("span",null,"Hi ",t.userDisplayName||"there","! Let’s dive into your data."),f.createElement("br",null),f.createElement("br",null),f.createElement("span",null,"Get started by asking a query below, or use "),f.createElement("span",{className:"intro-qi-link",onClick:a.openDataExplorer},f.createElement(Wn,{type:"data-search"})," ",rs.dataExplorer),f.createElement("span",null," to discover what data is available to you!"))],a.dprMessengerIntroMessages=[f.createElement(f.Fragment,null,f.createElement("span",null,"Ask questions, get answers."),f.createElement("br",null),f.createElement("br",null),f.createElement("span",null,"Get helpful information about trading and investing, simply by asking a question in your own words. Results are returned from content on"," ",f.createElement("a",{href:"https://www.investopedia.com/",target:"_blank",rel:"noopener noreferrer"},"Investopedia®"),", including applicable reference links."))],a.state={dataMessengerId:C(),hasError:!1,activePage:t.defaultTab,width:Oe?t.width:"100vw",height:t.height,isResizing:!1,isWindowResizing:!1,placement:a.getPlacementProp(t.placement),isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isSizeMaximum:!1},a}return pn(o,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.executeQueryTimeout)}catch(e){}}}]),o}();mn(vs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,placement:b.string,maskClosable:b.bool,width:b.oneOfType([b.string,b.number]),height:b.oneOfType([b.string,b.number]),showHandle:b.bool,handleImage:b.string,handleStyles:b.shape({}),shiftScreen:b.bool,userDisplayName:b.string,clearOnClose:b.bool,enableVoiceRecord:b.bool,title:b.string,maxMessages:b.number,introMessage:b.string,enableExploreQueriesTab:b.bool,enableNotificationsTab:b.bool,resizable:b.bool,inputPlaceholder:b.string,enableDPRTab:b.bool,dataPageSize:b.number,notificationCount:b.number,defaultOpen:b.bool,popoverParentElement:b.element,enableDynamicCharting:b.bool,defaultTab:b.string,autoChartAggregations:b.bool,enableFilterLocking:b.bool,enableQueryQuickStartTopics:b.bool,enableAjaxTableData:b.bool,onNotificationExpandCallback:b.func,onNewNotification:b.func,onNotificationCount:b.func,onVisibleChange:b.func,onErrorCallback:b.func,onSuccessAlert:b.func,setMobileActivePage:b.func}),mn(vs,"defaultProps",{authentication:{},autoQLConfig:Vo,dataFormatting:qo,placement:"right",maskClosable:!0,isVisible:!0,width:500,height:350,showHandle:!0,handleImage:void 0,handleStyles:void 0,shiftScreen:!1,userDisplayName:"there",clearOnClose:!1,enableVoiceRecord:!0,title:"Data Messenger",maxMessages:20,introMessage:"",enableExploreQueriesTab:!1,enableNotificationsTab:!1,resizable:!0,inputPlaceholder:"Type your queries here",dataPageSize:void 0,notificationCount:void 0,defaultOpen:!1,popoverParentElement:void 0,enableDynamicCharting:!0,defaultTab:"data-messenger",autoChartAggregations:!0,enableFilterLocking:!1,enableQueryQuickStartTopics:!0,enableAjaxTableData:!1,enableDPRTab:!1,mobileActivePage:"data-messenger",setMobileActivePage:function(){},onNotificationExpandCallback:function(){},onNewNotification:function(){},onNotificationCount:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var hs=Ga(vs),bs=["style","className","key"],ys=[],Cs=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o,a,r;un(this,n),mn(Cn(r=t.call(this,e)),"componentDidMount",(function(){r._isMounted=!0})),mn(Cn(r),"shouldComponentUpdate",(function(e,t){if(e.isDragging&&r.props.isDragging)return!1;var n=r.getFilteredProps(r.props),o=r.getFilteredProps(e);return!Ma(n,o)||!Ma(r.state,t)})),mn(Cn(r),"componentDidUpdate",(function(e,t){var n,o,a,i,l,s,c,u,d,p,m,f;(e.tile!==r.props.tile&&r.setState({isTitleOverFlow:r.isTitleOverFlow()}),(null===(n=r.props.tile)||void 0===n?void 0:n.title)!==(null===(o=e.tile)||void 0===o?void 0:o.title))&&r.setState({title:null===(p=r.props.tile)||void 0===p?void 0:p.title});(null===(a=r.props.tile)||void 0===a?void 0:a.query)!==(null===(i=e.tile)||void 0===i?void 0:i.query)&&r.setState({query:null===(m=r.props.tile)||void 0===m?void 0:m.query});(null===(l=r.props.tile)||void 0===l?void 0:l.secondQuery)!==(null===(s=e.tile)||void 0===s?void 0:s.secondQuery)&&r.setState({secondQuery:null===(f=r.props.tile)||void 0===f?void 0:f.secondQuery});null!==(c=r.responseRef)&&void 0!==c&&c._isMounted&&null!==(u=r.props.tile)&&void 0!==u&&u.displayType&&r.props.tile.displayType!==(null===(d=e.tile)||void 0===d?void 0:d.displayType)&&r.props.tile.displayType!==r.responseRef.state.displayType&&r.responseRef.changeDisplayType(r.props.tile.displayType)})),mn(Cn(r),"componentWillUnmount",(function(){try{r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.dragEndTimeout),clearTimeout(r.setParamsForTileTimeout),clearTimeout(r.queryInputTimer),clearTimeout(r.secondQueryInputTimer),r.props.cancelQueriesOnUnmount&&r.cancelAllQueries()}catch(e){console.error(e)}})),mn(Cn(r),"refreshLayout",(function(){var e,t;null===(e=r.state.responseRef)||void 0===e||e.refreshLayout(),null===(t=r.state.secondResponseRef)||void 0===t||t.refreshLayout()})),mn(Cn(r),"cancelAllQueries",(function(){var e,t;null===(e=r.axiosSource)||void 0===e||e.cancel(lr.CANCELLED),null===(t=r.secondAxiosSource)||void 0===t||t.cancel(lr.CANCELLED)})),mn(Cn(r),"debouncedSetParamsForTile",(function(e,t){r._isMounted?(r.paramsToSet=an(an({},r.paramsToSet),e),"function"==typeof t&&(r.callbackArray=[].concat(Tn(r.callbackArray),[t])),clearTimeout(r.setParamsForTileTimeout),r.setParamsForTileTimeout=setTimeout((function(){r.props.setParamsForTile(r.paramsToSet,r.props.tile.i,S(r.callbackArray)),r.paramsToSet={},r.callbackArray=[]}),r.debounceTime)):clearTimeout(r.setParamsForTileTimeout)})),mn(Cn(r),"getFilteredProps",(function(e){return an(an({},e),{},{children:void 0,tileRef:void 0})})),mn(Cn(r),"isQueryValid",(function(e){return!!e&&!!e.trim()})),mn(Cn(r),"setTopExecuted",(function(){r._isMounted&&r.setState({isTopExecuting:!1,isTopExecuted:!0})})),mn(Cn(r),"endTopQuery",(function(e){var t,n=e.response;return(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==lr.CANCELLED?(r.debouncedSetParamsForTile({queryResponse:n,defaultSelectedSuggestion:void 0},r.setTopExecuted),n):Promise.reject(lr.CANCELLED)})),mn(Cn(r),"setBottomExecuted",(function(){r._isMounted&&r.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),mn(Cn(r),"endBottomQuery",(function(e){var t,n=e.response;return(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==lr.CANCELLED?(r.debouncedSetParamsForTile({secondQueryResponse:n,secondDefaultSelectedSuggestion:void 0},r.setBottomExecuted),n):Promise.reject(lr.CANCELLED)})),mn(Cn(r),"processQuery",(function(e){var t=e.query,n=e.userSelection,o=e.skipQueryValidation;e.source;var a=e.isSecondHalf;if(r.isQueryValid(t)){var i,l,s,c;if(a&&ca(r.props.tile.secondDisplayType))s=null!==(c=r.props.tile.secondPageSize)&&void 0!==c?c:r.props.dataPageSize;else if(ca(r.props.tile.displayType)){var u;s=null!==(u=r.props.tile.pageSize)&&void 0!==u?u:r.props.dataPageSize}var d=a&&!r.areTopAndBottomSameQuery()?null===(i=r.secondAxiosSource)||void 0===i?void 0:i.token:null===(l=r.axiosSource)||void 0===l?void 0:l.token,p=an(an(an({},_o(r.props.authentication)),zo(r.props.autoQLConfig)),{},{enableQueryValidation:!!r.props.isEditing&&zo(r.props.autoQLConfig).enableQueryValidation,skipQueryValidation:o,source:"dashboards.user",scope:"dashboards",userSelection:n,cancelToken:d,pageSize:s,query:t});return ht(p).then((function(e){return a?r.bottomRequestData=p:r.topRequestData=p,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),mn(Cn(r),"processTileTop",(function(e){var t,n=e.query,o=e.userSelection,a=e.skipQueryValidation,i=e.source,l=e.pageSize;r.setState({isTopExecuting:!0,queryResponse:null});var s=r.props.tile.query!==n,c=a||r.props.tile.skipQueryValidation&&!s,u=o||(s||null===(t=r.props.tile)||void 0===t?void 0:t.queryValidationSelections);return r.debouncedSetParamsForTile({query:n,dataConfig:s?void 0:r.props.tile.dataConfig,skipQueryValidation:c,columns:s?void 0:r.props.tile.columns,defaultSelectedSuggestion:void 0,queryValidationSelections:u}),r.processQuery({query:n,userSelection:u,skipQueryValidation:a,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){return r.endTopQuery({response:e})})).catch((function(e){var t;if((null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED)return r.endTopQuery({response:e})}))})),mn(Cn(r),"processTileBottom",(function(e){var t,n=e.query,o=e.userSelection,a=e.skipQueryValidation,i=e.source;r.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1,secondQueryResponse:null});var l=r.props.tile.secondQuery!==n,s=a||r.props.tile.secondskipQueryValidation&&!l,c=o||(l||null===(t=r.props.tile)||void 0===t?void 0:t.secondQueryValidationSelections);return r.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:l?void 0:r.props.tile.secondDataConfig,secondskipQueryValidation:s,secondColumns:l?void 0:r.props.tile.secondColumns,secondDefaultSelectedSuggestion:void 0,secondQueryValidationSelections:c}),r.processQuery({query:n,userSelection:c,skipQueryValidation:a,source:i,isSecondHalf:!0}).then((function(e){return r.endBottomQuery({response:e})})).catch((function(e){var t;if((null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==lr.CANCELLED)return r.endBottomQuery({response:e})}))})),mn(Cn(r),"clearTopQueryResponse",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.setState(an({isTopExecuting:!1,isTopExecuted:!1,userSelection:void 0},e)),r.debouncedSetParamsForTile({queryResponse:void 0})})),mn(Cn(r),"clearBottomQueryResponse",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.setState(an({isBottomExecuted:!1,isBottomExecuting:!1,secondUserSelection:void 0},e)),r.debouncedSetParamsForTile({secondQueryResponse:void 0})})),mn(Cn(r),"processTile",(function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=o.query,i=o.secondQuery,l=o.skipQueryValidation,s=o.secondskipQueryValidation,c=o.source;null===(e=r.axiosSource)||void 0===e||e.cancel(lr.CANCELLED),null===(t=r.secondAxiosSource)||void 0===t||t.cancel(lr.CANCELLED),r.axiosSource=null===(n=E.CancelToken)||void 0===n?void 0:n.source(),r.secondAxiosSource=E.CancelToken.source();var u=a||r.props.tile.defaultSelectedSuggestion||r.state.query,d=i||r.props.tile.secondDefaultSelectedSuggestion||r.state.secondQuery,p=[];return r.getIsSplitView()&&d&&u!==d&&(p[1]=r.processTileBottom({query:d,skipQueryValidation:s,source:c})),p[0]=r.processTileTop({query:u,skipQueryValidation:l,source:c}),Promise.all(p).then((function(e){return an(an({},r.props.tile),{},{queryResponse:null==e?void 0:e[0],secondQueryResponse:null==e?void 0:e[1],defaultSelectedSuggestion:void 0,secondDefaultSelectedSuggestion:void 0})})).catch((function(){return Promise.reject()}))})),mn(Cn(r),"debounceQueryInputChange",(function(e){if(e!==r.state.query){var t={query:e,queryValidationSelections:void 0};r.clearTopQueryResponse(t),clearTimeout(r.queryInputTimer),r.queryInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({query:e,pageSize:void 0,aggConfig:void 0,dataConfig:void 0,queryValidationSelections:void 0})}),600)}})),mn(Cn(r),"debounceSecondQueryInputChange",(function(e){if(e!==r.state.secondQuery){var t={secondQuery:e};r.clearBottomQueryResponse(t),clearTimeout(r.secondQueryInputTimer),r.secondQueryInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({secondQuery:e,secondPageSize:void 0,secondAggConfig:void 0,secondDataConfig:void 0,secondQueryValidationSelections:void 0})}),600)}})),mn(Cn(r),"debounceTitleInputChange",(function(e){r.setState({title:e}),clearTimeout(r.titleInputTimer),r.titleInputTimer=setTimeout((function(){r.debouncedSetParamsForTile({title:e})}),600)})),mn(Cn(r),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(r.processTile({query:e.target.value}),e.target.blur())})),mn(Cn(r),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(r.processTileBottom({query:e.target.value}),e.target.blur())})),mn(Cn(r),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,a=e.source;r.setState({query:t}),o?r.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:a}):r.debouncedSetParamsForTile({defaultSelectedSuggestion:t})})),mn(Cn(r),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,a=e.source;r.setState({secondQuery:t}),o?(r.debouncedSetParamsForTile({secondQuery:t,secondQueryValidationSelections:n}),r.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:a})):r.debouncedSetParamsForTile({secondQuery:t})})),mn(Cn(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){Ke(an({suggestion:t},_o(r.props.authentication))).then((function(e){if(r._isMounted){var t,n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,a=[];ys=[],n=o.matches;for(var i=0;i<n.length&&(a.push(n[i]),4!==i);i++);a.sort((function(e,t){return t.length-e.length}));for(var l=0;l<a.length;l++){var s={name:a[l]};ys.push(s)}r.setState({suggestions:ys})}})).catch((function(e){console.error(e)}))}),300)})),mn(Cn(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),mn(Cn(r),"userSelectedSuggestionHandler",(function(e){if(e&&e.name&&r._isMounted){var t=e.name;r.userSelectedValue=t,r.userSelectedSuggestion=!0,r.setState({query:t}),r.debouncedSetParamsForTile({query:t})}})),mn(Cn(r),"onQueryInputChange",(function(e){var t,n;r.props.tile.skipQueryValidation&&r.debouncedSetParamsForTile({skipQueryValidation:!1}),(!r.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(null!=e&&null!==(t=e.target)&&void 0!==t&&t.value||""===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)?r.debounceQueryInputChange(e.target.value):r.processTile({query:r.userSelectedValue}))})),mn(Cn(r),"onSecondQueryInputChange",(function(e){r.setState({secondQuery:e.target.value}),r.debouncedSetParamsForTile({secondSkipQueryValidation:!1})})),mn(Cn(r),"getIsSplitView",(function(){var e;return null===(e=r.props.tile)||void 0===e?void 0:e.splitView})),mn(Cn(r),"toggleSecondQueryInput",(function(){r.setState({isSecondQueryInputOpen:!r.state.isSecondQueryInputOpen})})),mn(Cn(r),"isTitleOverFlow",(function(){var e=r.dashboardTileTitleRef;return!!e&&e.getBoundingClientRect().width>e.parentElement.getBoundingClientRect().width})),mn(Cn(r),"onQueryValidationSelectOption",(function(e,t){r.setState({query:e}),r.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),mn(Cn(r),"onSecondQueryValidationSelectOption",(function(e,t){r.setState({secondQuery:e}),r.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),mn(Cn(r),"onPageSizeChange",(function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=null!==(t=r.props.tile)&&void 0!==t&&null!==(t=t.queryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.rows?S(r.props.tile.queryResponse):void 0;o.data.data.rows=n,r.debouncedSetParamsForTile({pageSize:e,queryResponse:o})})),mn(Cn(r),"onSecondPageSizeChange",(function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=null!==(t=r.props.tile)&&void 0!==t&&null!==(t=t.secondQueryResponse)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&null!==(t=t.data)&&void 0!==t&&t.rows?S(r.props.tile.secondQueryResponse):void 0,a=r.props.tile.defaultSelectedSuggestion||r.state.query,i=r.props.tile.secondDefaultSelectedSuggestion||r.state.secondQuery;r.getIsSplitView()&&i&&a===i&&(o=r.props.tile.queryResponse),o.data.data.rows=n,r.debouncedSetParamsForTile({secondPageSize:e,secondQueryResponse:o})})),mn(Cn(r),"onAggConfigChange",(function(e){return r.debouncedSetParamsForTile({aggConfig:e})})),mn(Cn(r),"onDataConfigChange",(function(e){return r.debouncedSetParamsForTile({dataConfig:e})})),mn(Cn(r),"onDisplayTypeChange",(function(e){return r.debouncedSetParamsForTile({displayType:e})})),mn(Cn(r),"onBucketSizeChange",(function(e){return r.debouncedSetParamsForTile({bucketSize:e})})),mn(Cn(r),"onSecondAggConfigChange",(function(e){return r.debouncedSetParamsForTile({secondAggConfig:e})})),mn(Cn(r),"onSecondDataConfigChange",(function(e){return r.debouncedSetParamsForTile({secondDataConfig:e})})),mn(Cn(r),"onSecondDisplayTypeChange",(function(e){return r.debouncedSetParamsForTile({secondDisplayType:e})})),mn(Cn(r),"onSecondBucketSizeChange",(function(e){return r.debouncedSetParamsForTile({secondBucketSize:e})})),mn(Cn(r),"reportProblemCallback",(function(){var e,t;null!==(e=r.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=r.optionsToolbarRef)||void 0===t||t.openReportProblemModal())})),mn(Cn(r),"secondReportProblemCallback",(function(){var e;null!==(e=r.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&r.secondOptionsToolbarRef.openReportProblemModal()})),mn(Cn(r),"onSplitViewClick",(function(){var e,t,n=!(null!==(e=r.props.tile)&&void 0!==e&&e.splitView),o=null===(t=r.props.tile)||void 0===t?void 0:t.secondQuery;n&&!o&&(o=r.state.query),r.debouncedSetParamsForTile({splitView:n,secondQuery:o}),Eo()})),mn(Cn(r),"renderSplitResponse",(function(){return f.createElement(en,{key:"dashboard-tile-splitter-layout-".concat(r.COMPONENT_KEY),vertical:!0,percentage:!0,primaryMinSize:30,secondaryMinSize:30,secondaryInitialSize:r.props.secondDisplayPercentage||50,onDragStart:function(){r.setState({isDraggingSplitter:!0})},onDragEnd:function(){r.dragEndTimeout=setTimeout((function(){var e,t,n=null!==(e=null===(t=r.tileInnerDiv)||void 0===t||null===(t=t.style)||void 0===t?void 0:t.height)&&void 0!==e?e:"",o=Number(n.substring(0,n.length-1));isNaN(o)||r.debouncedSetParamsForTile({secondDisplayPercentage:o}),r.setState({isDraggingSplitter:!1})}),1e3)}},f.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderTopResponse()),f.createElement("div",{className:"dashboard-tile-split-pane-container"},r.renderBottomResponse(),r.props.isEditing&&f.createElement("div",{className:"split-view-query-btn-container ".concat(r.state.isSecondQueryInputOpen?"open":"")},f.createElement("div",{className:"react-autoql-toolbar viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},f.createElement(wo,{onClick:function(){r.toggleSecondQueryInput(),Eo()},className:"react-autoql-toolbar-btn",tooltip:"Query",tooltipID:r.props.tooltipID},f.createElement("div",{className:"split-view-query-btn-icon-container"},f.createElement(Wn,{type:"react-autoql-bubbles-outlined"}),f.createElement(Wn,{type:r.state.isSecondQueryInputOpen?"caret-left":"caret-right"}))),f.createElement("input",{className:"dashboard-tile-input query second",value:r.state.secondQuery,spellCheck:!1,onChange:r.onSecondQueryInputChange,onKeyDown:r.onSecondQueryTextKeyDown,placeholder:r.props.tile.query||"Type a query"})))))})),mn(Cn(r),"renderHeader",(function(){return r.props.isEditing?f.createElement("div",{className:"dashboard-tile-edit-wrapper"},f.createElement("div",{className:"dashboard-tile-input-container\n ".concat(r.state.isQueryInputFocused?"query-focused":"","\n ").concat(r.state.isTitleInputFocused?"title-focused":"")},f.createElement("div",{className:"dashboard-tile-left-input-container"},f.createElement(Wn,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),zo(r.props.autoQLConfig).enableAutocomplete?f.createElement(Kt,{onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,suggestions:r.state.suggestions,ref:function(e){r.autoSuggest=e},renderSuggestion:function(e){return f.createElement(h,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":r.props.tooltipID,"data-place":"bottom",onFocus:function(e){e.stopPropagation(),r.setState({isQueryInputFocused:!0})},onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onBlur:function(){return r.setState({isQueryInputFocused:!1})}}}):f.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:r.state.query,"data-tip":"Query","data-for":r.props.tooltipID,"data-place":"bottom",spellCheck:!1,onChange:r.onQueryInputChange,onKeyDown:r.onQueryTextKeyDown,onFocus:function(){return r.setState({isQueryInputFocused:!0})},onBlur:function(){return r.setState({isQueryInputFocused:!1})}})),f.createElement("div",{className:"dashboard-tile-right-input-container"},f.createElement(Wn,{className:"title-input-icon",type:"title"}),f.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)","data-tip":"Title","data-for":r.props.tooltipID,"data-place":"bottom",value:r.state.title,onChange:function(e){return r.debounceTitleInputChange(e.target.value)},onFocus:function(){return r.setState({isTitleInputFocused:!0})},onBlur:function(){return r.setState({isTitleInputFocused:!1})}}))),f.createElement("div",{className:"dashboard-tile-play-button".concat(r.isQueryValid(r.state.query)?"":" disabled")},f.createElement(Wn,{type:"play",onClick:function(){return r.processTile()},"data-tip":"Run tile","data-place":"left"}))):f.createElement("div",{className:"dashboard-tile-title-container"},f.createElement("span",{ref:function(e){return r.dashboardTileTitleRef=e},className:"dashboard-tile-title",id:"dashboard-tile-title-".concat(r.COMPONENT_KEY),"data-tip":r.state.isTitleOverFlow?r.props.tile.title||r.props.tile.query||"Untitled":null,"data-for":"react-autoql-dashboard-tile-title-tooltip"},r.props.tile.title||r.props.tile.query||"Untitled"),f.createElement("div",{className:"dashboard-tile-title-divider"}))})),mn(Cn(r),"renderContentPlaceholder",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting;return t.isExecuted,n?f.createElement("div",{className:"loading-container-centered"},f.createElement(Xa,null)):null!==(e=r.state.query)&&void 0!==e&&e.trim()?f.createElement("div",{className:"loading-container-centered"},f.createElement("div",{className:"dashboard-tile-placeholder-text"},r.props.isEditing?f.createElement("span",null,"Hit ",f.createElement(Wn,{className:"edit-mode-placeholder-icon",type:"play"})," to run this tile"):f.createElement("span",null,r.props.notExecutedText))):f.createElement("div",{className:"loading-container-centered"},f.createElement("div",{className:"dashboard-tile-placeholder-text"},r.props.isEditing?f.createElement("span",null,"To get started, enter a query and click ",f.createElement(Wn,{className:"play-icon",type:"play"})):f.createElement("span",null,"No query was supplied for this tile.")))})),mn(Cn(r),"renderSplitViewBtn",(function(){return f.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},f.createElement(wo,{onClick:r.onSplitViewClick,className:"react-autoql-toolbar-btn ".concat(r.getIsSplitView()?"active":""),tooltip:r.props.tile.splitView?"Split View On":"Split View Off",tooltipID:r.props.tooltipID,"data-test":"viz-toolbar-button"},f.createElement(Wn,{type:"split-view"})))})),mn(Cn(r),"onCSVDownloadStart",(function(e){return r.props.onCSVDownloadStart(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onCSVDownloadProgress",(function(e){return r.props.onCSVDownloadProgress(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onCSVDownloadFinish",(function(e){return r.props.onCSVDownloadFinish(an(an({},e),{},{tileId:r.props.tile.i}))})),mn(Cn(r),"onDrilldownStart",(function(e){return r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!1,activeKey:e,queryOutputRef:r.state.responseRef})})),mn(Cn(r),"renderToolbars",(function(e){e.queryOutputProps;var t=e.vizToolbarProps,n=e.optionsToolbarProps,o=e.isSecondHalf;return f.createElement("div",{className:"dashboard-tile-toolbars-container"},f.createElement("div",{className:"dashboard-tile-toolbars-left-container"},r.props.isEditing&&(o||!r.getIsSplitView())&&r.renderSplitViewBtn(),r.props.isEditing&&f.createElement(Cl,fn({},t,{shouldRender:!r.props.isDragging,tooltipID:r.props.tooltipID}))),f.createElement("div",{className:"dashboard-tile-toolbars-right-container"},f.createElement($l,fn({authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,onErrorCallback:r.props.onErrorCallback,onSuccessAlert:r.props.onSuccessCallback,onCSVDownloadStart:r.onCSVDownloadStart,onCSVDownloadProgress:r.onCSVDownloadProgress,onCSVDownloadFinish:r.onCSVDownloadFinish,shouldRender:!r.props.isDragging,tooltipID:r.props.tooltipID,popoverPositions:["top","left","bottom","right"],popoverAlign:"end"},n))))})),mn(Cn(r),"renderResponseContent",(function(e){var t,n=e.queryOutputProps,o=e.isExecuting,a=e.isExecuted;return e.renderPlaceholder?r.renderContentPlaceholder({isExecuting:o,isExecuted:a}):f.createElement(bl,fn({key:"".concat(null===(t=r.props.tile)||void 0===t?void 0:t.key).concat(r.props.isEditing?"-editing":"-notediting"),authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,dataFormatting:r.props.dataFormatting,renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:r.props.autoChartAggregations,isResizing:r.props.isDragging||r.state.isDraggingSplitter,renderSuggestionsAsDropdown:r.props.tile.h<4,enableDynamicCharting:r.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),enableAjaxTableData:r.props.enableAjaxTableData,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",tooltipID:r.props.tooltipID,chartTooltipID:r.props.chartTooltipID,shouldRender:!r.props.isDragging,source:"dashboards.user",scope:"dashboards",autoHeight:!1,height:"100%",width:"100%"},n))})),mn(Cn(r),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,o=e.vizToolbarProps,a=void 0===o?{}:o,i=e.optionsToolbarProps,l=void 0===i?{}:i,s=e.isSecondHalf,c=e.isExecuting,u=e.isExecuted,d=e.renderPlaceholder;return f.createElement("div",{className:"loading-container-centered",id:n.key},r.renderResponseContent({queryOutputProps:n,isExecuting:c,isExecuted:u,renderPlaceholder:d,isSecondHalf:s}),r.renderToolbars({queryOutputProps:n,vizToolbarProps:a,optionsToolbarProps:l,isSecondHalf:s}))})),mn(Cn(r),"renderTopResponse",(function(){var e,t,n,o,a=r.state.isTopExecuting,i=r.state.isTopExecuted,l=!(null!==(e=r.props.tile)&&void 0!==e&&e.queryResponse)||a||!i,s=null===(t=r.props)||void 0===t?void 0:t.displayType;return r.renderResponse({renderPlaceholder:l,isExecuting:a,isExecuted:i,queryOutputProps:{ref:function(e){return e&&e!==r.state.responseRef&&r._isMounted&&r.setState({responseRef:e})},optionsToolbarRef:r.optionsToolbarRef,vizToolbarRef:r.vizToolbarRef,key:"dashboard-tile-query-top-".concat(r.FIRST_QUERY_RESPONSE_KEY),initialDisplayType:s,queryResponse:null===(n=r.props.tile)||void 0===n?void 0:n.queryResponse,initialTableConfigs:r.props.tile.dataConfig,initialAggConfig:r.props.tile.aggConfig,onTableConfigChange:r.onDataConfigChange,onAggConfigChange:r.onAggConfigChange,queryValidationSelections:r.props.tile.queryValidationSelections,onSuggestionClick:r.onSuggestionClick,defaultSelectedSuggestion:null===(o=r.props.tile)||void 0===o?void 0:o.defaultSelectedSuggestion,onNoneOfTheseClick:r.onNoneOfTheseClick,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onQueryValidationSelectOption,reportProblemCallback:r.reportProblemCallback,queryRequestData:r.topRequestData,onDisplayTypeChange:r.onDisplayTypeChange,dataPageSize:r.props.tile.pageSize,onPageSizeChange:r.onPageSizeChange,onBucketSizeChange:r.onBucketSizeChange,bucketSize:r.props.tile.bucketSize},vizToolbarProps:{ref:function(e){return r.vizToolbarRef=e},responseRef:r.state.responseRef},optionsToolbarProps:{ref:function(e){return r.optionsToolbarRef=e},responseRef:r.state.responseRef}})})),mn(Cn(r),"areTopAndBottomSameQuery",(function(){var e,t,n=null===(e=r.props)||void 0===e||null===(e=e.tile)||void 0===e?void 0:e.query,o=null===(t=r.props)||void 0===t||null===(t=t.tile)||void 0===t?void 0:t.secondQuery;return!o||n===o})),mn(Cn(r),"renderBottomResponse",(function(){var e,t,n,o,a,i,l=r.areTopAndBottomSameQuery(),s=r.state.isBottomExecuting,c=r.state.isBottomExecuted,u=r.bottomRequestData;l&&(s=r.state.isTopExecuting,c=r.state.isTopExecuted,u=r.topRequestData);var d=!l&&!(null!==(e=r.props.tile)&&void 0!==e&&e.secondQueryResponse)||l&&!(null!==(t=r.props.tile)&&void 0!==t&&t.queryResponse)||s||!c,p=null===(n=r.props)||void 0===n?void 0:n.secondDisplayType;return r.renderResponse({renderPlaceholder:d,isExecuting:s,isExecuted:c,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(r.SECOND_QUERY_RESPONSE_KEY),ref:function(e){return e&&e!==r.state.secondResponseRef&&r._isMounted&&r.setState({secondResponseRef:e})},optionsToolbarRef:r.secondOptionsToolbarRef,vizToolbarRef:r.secondVizToolbarRef,initialDisplayType:p,queryResponse:(null===(o=r.props.tile)||void 0===o?void 0:o.secondQueryResponse)||(null===(a=r.props.tile)||void 0===a?void 0:a.queryResponse),initialTableConfigs:r.props.tile.secondDataConfig,initialAggConfig:r.props.tile.secondAggConfig,onTableConfigChange:r.onSecondDataConfigChange,onAggConfigChange:r.onSecondAggConfigChange,queryValidationSelections:r.props.tile.secondQueryValidationSelections,onSuggestionClick:r.onSecondSuggestionClick,defaultSelectedSuggestion:null===(i=r.props.tile)||void 0===i?void 0:i.secondDefaultSelectedSuggestion,reportProblemCallback:r.secondReportProblemCallback,onNoneOfTheseClick:r.secondOnNoneOfTheseClick,onDrilldownStart:function(e){r.props.onDrilldownStart({tileId:r.props.tile.i,isSecondHalf:!0,activeKey:e,queryOutputRef:r.state.secondResponseRef})},onDrilldownEnd:r.props.onDrilldownEnd,onQueryValidationSelectOption:r.onSecondQueryValidationSelectOption,queryRequestData:u,onDisplayTypeChange:r.onSecondDisplayTypeChange,dataPageSize:r.props.tile.secondPageSize,onPageSizeChange:r.onSecondPageSizeChange,onBucketSizeChange:r.onSecondBucketSizeChange,bucketSize:r.props.tile.secondBucketSize},vizToolbarProps:{ref:function(e){return r.secondVizToolbarRef=e},responseRef:r.state.secondResponseRef},optionsToolbarProps:{ref:function(e){return r.secondOptionsToolbarRef=e},responseRef:r.state.secondResponseRef},isSecondHalf:!0})})),mn(Cn(r),"renderContent",(function(){return f.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(r.props.isEditing?" editing":"","\n ").concat(r.props.tile.h<4?" small":"")},f.createElement("div",{className:"dashboard-tile-response-container"},r.getIsSplitView()?r.renderSplitResponse():r.renderTopResponse()))})),mn(Cn(r),"renderDragHandle",(function(e,t){return f.createElement("div",fn({},e,{className:"react-autoql-dashboard-tile-drag-handle ".concat(t)}))})),mn(Cn(r),"renderDragHandles",(function(){var e={onMouseDown:function(e){return e.stopPropagation(),r.props.onMouseDown(e)},onMouseUp:function(e){return e.stopPropagation(),r.props.onMouseUp(e)},onTouchStart:function(e){return e.stopPropagation(),r.props.onTouchStart(e)},onTouchEnd:function(e){return e.stopPropagation(),r.props.onTouchEnd(e)}};return f.createElement(h,null,r.renderDragHandle(e,"top"),r.renderDragHandle(e,"bottom"),r.renderDragHandle(e,"left"),r.renderDragHandle(e,"right"))})),mn(Cn(r),"renderDeleteBtn",(function(){return f.createElement("div",{className:"dashboard-tile-delete-button",onClick:function(){return r.props.deleteTile(r.props.tile.i)}},f.createElement(Wn,{style:{fontSize:"18px"},type:"close"}))})),mn(Cn(r),"render",(function(){var e={};return r.props.isDragging&&(e.pointerEvents="none"),f.createElement(Rn,null,f.createElement("div",{ref:function(e){return r.ref=e},className:r.props.className,style:an({},r.props.style),"data-grid":r.props.tile,"data-test":"react-autoql-dashboard-tile"},r.props.children,f.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(r.COMPONENT_KEY),ref:function(e){return r.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(r.getIsSplitView()?"split":""),style:e},f.createElement(h,null,r.renderHeader(),r.renderContent())),r.props.isEditing&&r.renderDragHandles(),r.props.isEditing&&r.renderDeleteBtn()))})),r.dashboardTileTitleRef=void 0,r.optionsToolbarRef=void 0,r.secondOptionsToolbarRef=void 0,r.COMPONENT_KEY=C(),r.FIRST_QUERY_RESPONSE_KEY=C(),r.SECOND_QUERY_RESPONSE_KEY=C(),r.DEFAULT_AJAX_PAGE_SIZE=50,r.autoCompleteTimer=void 0,r.debounceTime=50,r.paramsToSet={},r.callbackArray=[];var i=e.tile,l={};(null==i?void 0:i.aggConfig)&&(null===(o=Object.keys(i.aggConfig))||void 0===o||o.forEach((function(e){var t;null!==(t=i.aggConfig)&&void 0!==t&&t[e]&&(l[e]=i.aggConfig[e].toUpperCase())})));var s={};return(null==i?void 0:i.secondAggConfig)&&(null===(a=Object.keys(i.secondAggConfig))||void 0===a||a.forEach((function(e){var t;null!==(t=i.secondAggConfig)&&void 0!==t&&t[e]&&(s[e]=i.secondAggConfig[e].toUpperCase())}))),e.setParamsForTile({aggConfig:l,secondAggConfig:s},i.i),r.state={query:i.query,secondQuery:i.secondQuery||i.query,title:i.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,isTitleOverFlow:!1,isTopExecuted:!!i.queryResponse,isBottomExecuted:i.splitView&&(r.areTopAndBottomSameQuery()?!!i.queryResponse:!!i.secondQueryResponse)},r}return pn(n)}();mn(Cs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tile:b.shape({}).isRequired,isEditing:b.bool,deleteTile:b.func,dataPageSize:b.number,queryResponse:b.shape({}),notExecutedText:b.oneOfType([b.string,b.element]),onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool,setParamsForTile:b.func}),mn(Cs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,query:"",title:"",isEditing:!1,displayType:"table",dataPageSize:void 0,queryValidationSelections:void 0,defaultSelectedSuggestion:void 0,notExecutedText:'Hit "Execute" to run this dashboard',autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!0,deleteTile:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){},onTouchStart:function(){},onTouchEnd:function(){},setParamsForTile:function(){}});var Es=f.forwardRef((function(e,t){var n=e.style,o=e.className;e.key;var a=yn(e,bs);return f.createElement("div",{style:an({},n),className:o,ref:t},f.createElement(Cs,fn({},a,{rglRef:t,ref:a.tileRef,className:"".concat(a.innerDivClass," ").concat(a.isEditing?"editing":"")})))})),Ss=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"componentDidMount",(function(){e.setState({isMounted:!0})})),mn(Cn(e),"render",(function(){var t;return f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},f.createElement("div",{className:"dashboard-drilldown-table-and-toolbars-container"},f.createElement(bl,{ref:function(t){return e.responseRef=t},vizToolbarRef:e.vizToolbarRef,optionsToolbarRef:e.optionsToolbarRef,initialDisplayType:"table",isResizing:e.props.isResizing,authentication:e.props.authentication,autoQLConfig:an(an({},zo(e.props.autoQLConfig)),{},{enableDrilldowns:!1}),originalQueryID:null===(t=e.props.queryResponse)||void 0===t||null===(t=t.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.query_id,dataFormatting:e.props.dataFormatting,queryResponse:e.props.queryResponse,renderTooltips:!1,reportProblemCallback:e.props.reportProblemCallback,enableAjaxTableData:e.props.enableAjaxTableData,showQueryInterpretation:e.props.showQueryInterpretation,reverseTranslationPlacement:"top",tooltipID:e.props.tooltipID,chartTooltipID:e.props.chartTooltipID,allowDisplayTypeChange:!0,height:"100%",width:"100%"}),f.createElement("div",{className:"drilldown-modal-toolbars"},f.createElement("div",{className:"drilldown-modal-viz-toolbar"},f.createElement(Cl,{ref:function(t){return e.vizToolbarRef=t},autoQLConfig:e.props.autoQLConfig,responseRef:e.responseRef,tooltipID:e.props.tooltipID})),f.createElement("div",{className:"drilldown-modal-options-toolbar"},f.createElement($l,{authentication:e.props.authentication,autoQLConfig:an(an({},zo(e.props.autoQLConfig)),{},{enableNotifications:!1}),ref:function(t){return e.optionsToolbarRef=t},responseRef:e.responseRef,tooltipID:e.props.tooltipID,onErrorCallback:e.props.onErrorCallback,onSuccessAlert:e.props.onSuccessCallback,popoverPositions:["top","left","right","bottom"],onCSVDownloadStart:e.props.onCSVDownloadStart,onCSVDownloadProgress:e.props.onCSVDownloadProgress,onCSVDownloadFinish:e.props.onCSVDownloadFinish,popoverAlign:"end"})))))})),e}return pn(n)}();mn(Ss,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tooltipID:b.string,chartTooltipID:b.string,reportProblemCallback:b.func}),mn(Ss,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tooltipID:null,chartTooltipID:null,reportProblemCallback:function(){}});var Ts=function(e){gn(n,f.Component);var t=Sn(n);function n(e){var o;return un(this,n),mn(Cn(o=t.call(this,e)),"componentDidUpdate",(function(e,t){var n;null!==(n=o.splitterLayoutRef)&&void 0!==n&&n.splitter&&o.renderSplitterCollapseBtn(),t.isDrilldownChartHidden!==o.state.isDrilldownChartHidden&&Co()})),mn(Cn(o),"renderSplitterCollapseBtn",(function(){var e=document.querySelector("#splitter-btn-".concat(o.COMPONENT_KEY));if(e)e.setAttribute("data-tip",o.state.isDrilldownChartHidden?"Show chart":"Hide chart");else{var t=document.createElement("div");t.innerHTML="&#94;",t.className="splitter-collapse-btn",t.id="splitter-btn-".concat(o.COMPONENT_KEY),t.setAttribute("data-for",o.props.tooltipID),t.addEventListener("click",(function(){o.setState({isDrilldownChartHidden:!o.state.isDrilldownChartHidden,isResizingDrilldown:!0},(function(){o.setState({isResizingDrilldown:!1})}))})),o.splitterLayoutRef.splitter.parentNode.insertBefore(t,o.splitterLayoutRef.splitter.nextSibling)}})),mn(Cn(o),"shouldShowOriginalQuery",(function(){var e,t=null===(e=o.props.activeDrilldownRef)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.displayType;return!!t&&$n.includes(t)})),mn(Cn(o),"reportProblemCallback",(function(){o.setState({isReportProblemOpen:!0})})),mn(Cn(o),"renderDrilldownTable",(function(){return o.props.isDrilldownRunning?f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},f.createElement("div",{className:"dashboard-tile-loading-container"},f.createElement(Xa,null))):f.createElement(Ss,{authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,dataFormatting:o.props.dataFormatting,isResizing:o.props.isAnimating||o.state.isResizingDrilldown,isLoading:o.props.isDrilldownRunning,queryResponse:o.props.drilldownResponse,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,reportProblemCallback:o.reportProblemCallback,enableAjaxTableData:o.props.enableAjaxTableData,showQueryInterpretation:o.props.showQueryInterpretation,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,onCSVDownloadStart:o.props.onCSVDownloadStart,onCSVDownloadProgress:o.props.onCSVDownloadProgress,onCSVDownloadFinish:o.props.onCSVDownloadFinish})})),mn(Cn(o),"renderReportProblemModal",(function(){return f.createElement(Jl,{authentication:o.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:o.closeReportProblemModal,onReportProblem:o.onReportProblem,responseRef:o.drilldownTableRef,isVisible:o.state.isReportProblemOpen})})),mn(Cn(o),"closeReportProblemModal",(function(){o.setState({isReportProblemOpen:!1})})),mn(Cn(o),"onReportProblem",(function(e){var t=e.successMessage,n=e.error;t?(o.props.onSuccessCallback(t),o._isMounted&&o.setState({isReportProblemOpen:!1})):n&&o.props.onErrorCallback(n)})),mn(Cn(o),"render",(function(){var e,t,n,a,r,i,l,s;o.props.isOpen&&((i=null===(l=o.props.activeDrilldownRef)||void 0===l?void 0:l.queryResponse)&&(i.data.data.columns=null===(s=o.props.activeDrilldownRef)||void 0===s||null===(s=s.state)||void 0===s?void 0:s.columns));var c=!o.state.isDrilldownChartHidden&&o.shouldShowOriginalQuery();return f.createElement(Rn,null,f.createElement(Sl,{className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(o.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(o.shouldShowOriginalQuery()?"":"table-only"),title:null===(e=o.props.activeDrilldownRef)||void 0===e||null===(e=e.queryResponse)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.text,isVisible:o.props.isOpen,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,shouldRender:o.props.shouldRender,onClose:o.props.onClose},f.createElement(f.Fragment,null,!(null===(t=o.props.activeDrilldownRef)||void 0===t||!t.queryResponse)&&f.createElement(en,{ref:function(e){return o.splitterLayoutRef=e},vertical:!0,percentage:!0,primaryMinSize:c?35:0,secondaryMinSize:25,secondaryInitialSize:50,onDragStart:function(){return o.setState({isResizingDrilldown:!0})},onDragEnd:function(){return o.setState({isResizingDrilldown:!1})}},f.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},o.shouldShowOriginalQuery()&&f.createElement(f.Fragment,null,!(null===(n=o.props.activeDrilldownRef)||void 0===n||!n.queryResponse)&&f.createElement(bl,fn({},o.props.activeDrilldownRef.props,{ref:function(e){return o.drilldownTopRef=e},queryResponse:i,isDrilldownChartHidden:o.state.isDrilldownChartHidden,key:"dashboard-drilldown-chart-".concat(null===(a=o.props.activeDrilldownRef)||void 0===a||null===(a=a.queryResponse)||void 0===a?void 0:a.query_id),activeChartElementKey:o.props.activeDrilldownChartElementKey,initialDisplayType:null===(r=o.props.activeDrilldownRef)||void 0===r||null===(r=r.state)||void 0===r?void 0:r.displayType,initialTableConfigs:{tableConfig:o.props.activeDrilldownRef.tableConfig,pivotTableConfig:o.props.activeDrilldownRef.pivotTableConfig},isAnimating:o.props.isAnimating,isResizing:o.state.isResizingDrilldown||!o.props.isOpen,showQueryInterpretation:o.props.showQueryInterpretation,reverseTranslationPlacement:"top",allowDisplayTypeChange:!1,source:o.props.source,height:"100%",width:"100%"})))),o.renderDrilldownTable()))),o.renderReportProblemModal())})),o.COMPONENT_KEY=C(),o.state={isReportProblemOpen:!1,isResizingDrilldown:!1},o}return pn(n)}();mn(Ts,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tiles:b.arrayOf(b.shape({})),executeOnMount:b.bool,dataPageSize:b.number,executeOnStopEditing:b.bool,isEditing:b.bool,isEditable:b.bool,notExecutedText:b.string,onChange:b.func,enableDynamicCharting:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool}),mn(Ts,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Ds=$t(Zt),xs=function(e){gn(o,f.Component);var t=Sn(o);function o(e){var a;return un(this,o),mn(Cn(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.executeOnMount&&a.executeDashboard(),window.addEventListener("resize",a.onWindowResize)})),mn(Cn(a),"shouldComponentUpdate",(function(e,t){return!Ma(a.props,e)||!Ma(a.state,t)})),mn(Cn(a),"componentDidUpdate",(function(e,t){e.isEditing&&!a.props.isEditing&&a.props.executeOnStopEditing&&a.executeDashboard(),!e.isEditing&&a.props.isEditing&&a.refreshTileLayouts(),a.props.isEditing!==e.isEditing&&(a.resetTileStateLog(),a.setState({isDragging:!0},(function(){a.setState({isDragging:!1})}))),a.state.isDrilldownModalVisible!==t.isDrilldownModalVisible&&Eo()})),mn(Cn(a),"componentWillUnmount",(function(){try{a._isMounted=!1,window.removeEventListener("resize",a.onWindowResize),clearTimeout(a.scrollToNewTileTimeout),clearTimeout(a.stopDraggingTimeout),clearTimeout(a.animationTimeout)}catch(e){console.error(e)}})),mn(Cn(a),"resetTileStateLog",(function(){var e;null!==(e=a.tileLog)&&void 0!==e&&e[0]?a.tileLog=[a.tileLog[0]]:a.tileLog=[a.getMostRecentTiles()],a.currentLogIndex=0})),mn(Cn(a),"getMostRecentTiles",(function(){return a.onChangeTiles?a.onChangeTiles:a.props.tiles})),mn(Cn(a),"subscribeToCallback",(function(e){a.callbackSubsciptions=[].concat(Tn(a.callbackSubsciptions),Tn(e))})),mn(Cn(a),"debouncedOnChange",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];a.onChangeTiles=S(e);var o=new Promise((function(e,o){try{a.subscribeToCallback([e]),null!=n&&n.length&&a.subscribeToCallback(n),t&&a.addTileStateToLog(a.onChangeTiles),a.onChangeTimer&&clearTimeout(a.onChangeTimer),a.onChangeTimer=setTimeout((function(){if(a.onChangeTiles){var t;if(a.props.onChange(a.onChangeTiles),a.onChangeTiles=null,null!==(t=a.callbackSubsciptions)&&void 0!==t&&t.length){var n=S(a.callbackSubsciptions);return a.callbackSubsciptions=[],void n.forEach((function(e,t){a.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(t+1))}))}return e()}return e()}),a.debounceTime)}catch(e){return console.error(e),a.callbackSubsciptions=[],o()}}));return o})),mn(Cn(a),"onWindowResize",(function(e){a.currentWindowWidth||(a.currentWindowWidth=window.innerWidth);var t=e.target.innerWidth!==a.currentWindowWidth;t&&a._isMounted&&(a.state.isWindowResizing||(a.currentWindowWidth=window.innerWidth,a.setState({isWindowResizing:!0})),t&&(a.windowResizeTimer=setTimeout((function(){t&&a._isMounted&&(a.currentWindowWidth=void 0,a.setState({isWindowResizing:!1}))}),500)))})),mn(Cn(a),"refreshTileLayouts",(function(){try{for(var e in a.tileRefs)a.tileRefs[e]&&a.tileRefs[e].refreshLayout()}catch(e){console.error(e)}})),mn(Cn(a),"executeDashboard",(function(){try{var e=[];for(var t in a.tileRefs)a.tileRefs[t]&&e.push(a.tileRefs[t].processTile());return Promise.all(e).catch((function(){return Promise.reject(new Error("There was an error processing this dashboard. Please try again."))}))}catch(e){return void console.error(e)}})),mn(Cn(a),"unExecuteDashboard",(function(){try{for(var e in a.tileRefs)a.tileRefs[e]&&a.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),mn(Cn(a),"getChangeDetection",(function(e,t,o){return!n(a.getChangeDetectionTileStructure(e,o),a.getChangeDetectionTileStructure(t,o))})),mn(Cn(a),"getChangeDetectionTileStructure",(function(e,t){try{if(null!=e&&e.length)return e.map((function(e){if(e)return{query:!t&&e.query,title:!t&&e.title,i:e.i,w:e.w,h:e.h,x:e.x,y:e.y}}))}catch(e){console.error(e)}return e})),mn(Cn(a),"scrollToNewTile",(function(e){a.scrollToNewTileTimeout=setTimeout((function(){try{var t,n=null===(t=a.tileRefs)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.ref;if(n){var o,r=null===(o=a.ref)||void 0===o||null===(o=o.parentElement)||void 0===o?void 0:o.getBoundingClientRect(),i=r.y,l=i+r.height,s=null==n?void 0:n.getBoundingClientRect(),c=s.y;c+s.height>l?n.scrollIntoView(!1):c<i&&n.scrollIntoView(!0)}}catch(e){}}),200)})),mn(Cn(a),"refreshLayout",(function(){window.dispatchEvent(new Event("resize")),a.setState({isWindowResizing:!0},(function(){a.setState({isWindowResizing:!1})}))})),mn(Cn(a),"onMoveStart",(function(e,t,n,o,r,i){a.setIsDragging(!0)})),mn(Cn(a),"onDrag",(function(e,t,n,o,a,r){a.stopPropagation()})),mn(Cn(a),"setIsDragging",(function(e){a._isMounted&&e!==a.state.isDragging&&a.isDragging!==e&&(a.isDragging=e,a.setState({isDragging:e}))})),mn(Cn(a),"addTileStateToLog",(function(e){a.props.isEditing&&e&&a.getChangeDetection(e,a.tileLog[a.currentLogIndex],!0)&&a.tileLog.unshift(S(e))})),mn(Cn(a),"onMoveEnd",(function(e,t,n,o,r,i){try{var l=a.getMostRecentTiles();a.getChangeDetection(l,e,!0)&&a.addTileStateToLog(l),clearTimeout(a.stopDraggingTimeout),a.stopDraggingTimeout=setTimeout((function(){a.setIsDragging(!1)}),0)}catch(e){console.error(e)}})),mn(Cn(a),"updateTileLayout",(function(e){try{var t=a.getMostRecentTiles().map((function(t,n){return an(an({},t),e[n])}));a.debouncedOnChange(t,!1)}catch(e){console.error(e)}})),mn(Cn(a),"addTile",(function(){try{var e=S(a.getMostRecentTiles()),t=C();e.push({key:t,i:t,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),a.debouncedOnChange(e).then((function(){a.scrollToNewTile(t)})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),mn(Cn(a),"changeCurrentTileState",(function(e){try{var t=S(a.tileLog[e]);t&&(a.currentLogIndex=e,a.debouncedOnChange(t,!1))}catch(e){console.error(e)}})),mn(Cn(a),"undo",(function(){a.props.isEditing?a.changeCurrentTileState(a.currentLogIndex+1):console.warn('Unable perform "undo" action outside of edit mode. Set the isEditing prop to true to enable edit mode.')})),mn(Cn(a),"redo",(function(){a.props.isEditing?a.changeCurrentTileState(a.currentLogIndex-1):console.warn('Unable perform "redo" action outside of edit mode. Set the isEditing prop to true to enable edit mode.')})),mn(Cn(a),"deleteTile",(function(e){try{var t=S(a.getMostRecentTiles()),n=t.map((function(e){return e.i})).indexOf(e);~n&&t.splice(n,1),a.debouncedOnChange(t)}catch(e){console.error(e)}})),mn(Cn(a),"setParamsForTile",(function(e,t,n){try{var o,r,i=a.getMostRecentTiles(),l=S(a.getMostRecentTiles()),s=l.map((function(e){return e.i})).indexOf(t);l[s]=an(an({},l[s]),e),Object.keys(e).includes("query")&&e.query!==(null===(o=i[s])||void 0===o?void 0:o.query)?(l[s].dataConfig=void 0,l[s].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==(null===(r=i[s])||void 0===r?void 0:r.secondQuery)&&(l[s].secondDataConfig=void 0,l[s].secondskipQueryValidation=!1),a.debouncedOnChange(l,!0,n)}catch(e){console.error(e)}})),mn(Cn(a),"onDrilldownStart",(function(e){var t=e.tileId,n=e.activeKey,o=e.isSecondHalf,r=e.queryOutputRef;zo(a.props.autoQLConfig).enableDrilldowns&&(a.activeDrilldownRef=r,a.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:o,activeDrilldownTile:t||a.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:n,isAnimatingModal:!a.state.isDrilldownModalVisible}),a.animationTimeout=setTimeout((function(){a._isMounted&&a.setState({isAnimatingModal:!1})}),500))})),mn(Cn(a),"onDrilldownEnd",(function(e){var t=e.response,n=e.error;t?a._isMounted&&a.setState({activeDrilldownResponse:t,isDrilldownRunning:!1}):n&&(console.error(n),a._isMounted&&a.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),mn(Cn(a),"closeDrilldownModal",(function(){a.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})})),mn(Cn(a),"renderEmptyDashboardMessage",(function(){return a.props.isEditable&&!a.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:a.props.startEditingCallback},"New Dashboard")):a.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:a.addTile},"New Tile")," ","to get started"):f.createElement("div",{className:"empty-dashboard-message-container"},"This dashboard doesn't have any tiles. Please contact your administrator to add tiles to this dashboard")})),mn(Cn(a),"renderTiles",(function(){var e=a.getMostRecentTiles().map((function(e){return an(an({},e),{},{i:e.key,h:e.h>10?10:e.h,maxH:10,minH:2,minW:3})})),t=a.props.dataPageSize;return a.props.enableAjaxTableData&&!t&&(t=a.DEFAULT_AJAX_PAGE_SIZE),f.createElement(Ds,{ref:function(e){return a.rglRef=e},onLayoutChange:function(e){a.updateTileLayout(e),a.setState({layout:e})},onDrag:a.onDrag,onDragStart:a.onMoveStart,onResizeStart:a.onMoveStart,onDragStop:a.onMoveEnd,onResizeStop:a.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:a.props.isEditing,isResizable:a.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return f.createElement(Es,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(t){return a.tileRefs[e.key]=t},key:e.key,dashboardRef:a.ref,authentication:a.props.authentication,cancelQueriesOnUnmount:a.props.cancelQueriesOnUnmount,autoQLConfig:a.props.autoQLConfig,tile:an(an({},e),{},{i:e.key,maxH:10,minH:2,minW:3}),displayType:e.displayType,secondDisplayType:e.secondDisplayType,secondDisplayPercentage:e.secondDisplayPercentage,isEditing:a.props.isEditing,isDragging:a.state.isDragging||a.state.isWindowResizing,isWindowResizing:a.state.isWindowResizing,setParamsForTile:a.setParamsForTile,deleteTile:a.deleteTile,dataFormatting:a.props.dataFormatting,notExecutedText:a.props.notExecutedText,enableDynamicCharting:a.props.enableDynamicCharting,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessCallback,autoChartAggregations:a.props.autoChartAggregations,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.onDrilldownEnd,onCSVDownloadStart:a.props.onCSVDownloadStart,onCSVDownloadProgress:a.props.onCSVDownloadProgress,onCSVDownloadFinish:a.props.onCSVDownloadFinish,enableAjaxTableData:a.props.enableAjaxTableData,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,source:a.SOURCE,scope:a.props.scope})})))})),mn(Cn(a),"render",(function(){var e=a.getMostRecentTiles();return f.createElement(Rn,null,f.createElement(h,null,f.createElement("div",{ref:function(e){return a.ref=e},className:"react-autoql-dashboard-container".concat(a.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?a.renderTiles():a.renderEmptyDashboardMessage()),f.createElement(Ts,{authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,dataFormatting:a.props.dataFormatting,isOpen:a.state.isDrilldownModalVisible,onClose:a.closeDrilldownModal,drilldownResponse:a.state.activeDrilldownResponse,shouldRender:a.state.isDrilldownModalVisible&&!a.state.isDragging&&!a.state.isWindowResizing,activeDrilldownChartElementKey:a.state.activeDrilldownChartElementKey,isAnimating:a.state.isAnimatingModal,tooltipID:a.TOOLTIP_ID,chartTooltipID:a.CHART_TOOLTIP_ID,showQueryInterpretation:a.props.isEditing,isDrilldownRunning:a.state.isDrilldownRunning,enableAjaxTableData:a.props.enableAjaxTableData,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessCallback,activeDrilldownRef:a.activeDrilldownRef,onCSVDownloadStart:a.props.onCSVDownloadStart,onCSVDownloadProgress:a.props.onCSVDownloadProgress,onCSVDownloadFinish:a.props.onCSVDownloadFinish,source:a.SOURCE}),f.createElement(So,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),f.createElement(So,{className:"react-autoql-chart-tooltip",id:a.CHART_TOOLTIP_ID,effect:"solid",place:"top",html:!0})))})),a.COMPONENT_KEY=C(),a.SOURCE=Va(e.source,"dashboards"),a.TOOLTIP_ID="react-autoql-dashboard-toolbar-btn-tooltip-".concat(a.COMPONENT_KEY),a.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(a.COMPONENT_KEY),a.tileRefs={},a.debounceTime=50,a.onChangeTiles=null,a.callbackSubsciptions=[],a.tileLog=[e.tiles],a.currentLogIndex=0,a.state={isDragging:!1,isReportProblemOpen:!1,isResizingDrilldown:!1},a}return pn(o)}();mn(xs,"propTypes",{authentication:nr,autoQLConfig:ar,dataFormatting:or,tiles:b.arrayOf(b.shape({})),executeOnMount:b.bool,dataPageSize:b.number,executeOnStopEditing:b.bool,isEditing:b.bool,isEditable:b.bool,notExecutedText:b.oneOfType([b.string,b.element]),onChange:b.func,enableDynamicCharting:b.bool,onErrorCallback:b.func,onSuccessCallback:b.func,autoChartAggregations:b.bool,onCSVDownloadStart:b.func,onCSVDownloadProgress:b.func,onCSVDownloadFinish:b.func,enableAjaxTableData:b.bool,cancelQueriesOnUnmount:b.bool,startEditingCallback:b.func}),mn(xs,"defaultProps",{authentication:Mo,autoQLConfig:Vo,dataFormatting:qo,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,cancelQueriesOnUnmount:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){},startEditingCallback:function(){}});var Rs=Ga(xs),Is=function(e){gn(n,f.Component);var t=Sn(n);function n(){var e;un(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return mn(Cn(e=t.call.apply(t,[this].concat(a))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),mn(Cn(e),"componentDidUpdate",(function(t){e.props.finalTranscript!==t.finalTranscript?e.props.onFinalTranscript(e.props.finalTranscript):e.props.transcript!==t.transcript?e.props.onTranscriptChange(e.props.transcript):e.props.interimTranscript!==t.interimTranscript&&e.props.onTranscriptChange(e.props.interimTranscript)})),mn(Cn(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=tn(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:nn,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),mn(Cn(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),mn(Cn(e),"stopRecording",(function(){e.setState({isRecording:!1}),e.recordAudio.stopRecording((function(){var t=e.recordAudio.getBlob();e.onRecordStop(e.blobToFile(t),t);try{e.stream.getTracks().forEach((function(e){return e.stop()}))}catch(e){console.error(e)}}))})),mn(Cn(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),mn(Cn(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),mn(Cn(e),"onMouseDown",(function(){Eo(),e.startRecording()})),mn(Cn(e),"sendWavFile",(function(t){var n="".concat(e.props.authentication.domain,"/autoql/api/v1/query/speech-to-text?key=").concat(e.props.authentication.apiKey),o=new FormData;o.append("file",t,"speech.wav");var a={headers:{Authorization:"Bearer ".concat(e.props.authentication.token)},timeout:3e4};E.post(n,o,a).then((function(t){e.props.onTranscriptChange(t.data.data.transcription)})).catch((function(t){404===t.response.status?e.setState({errorMessage:"Oops! Speech-to-text has not been enabled. Try typing a query instead."},(function(){e.setState({showPopoverMessage:!0})})):e.setState({errorMessage:"Oops! Something wrong with your account"},(function(){e.setState({showPopoverMessage:!0})}))}))})),mn(Cn(e),"render",(function(){return f.createElement(Rn,null,f.createElement(Xn,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return f.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},f.createElement(Wn,{type:"warning-triangle"})," ",e.state.errorMessage)},onClickOutside:function(){return e.setState({showPopoverMessage:!1})}},f.createElement("button",{id:"react-autoql-voice-record-button","data-test":"speech-to-text-btn",className:"chat-voice-record-button".concat(e.state.isRecording?" listening":""),onMouseDown:e.onMouseDown,onMouseUp:e.stopRecording,onMouseLeave:e.state.isRecording?e.stopRecording:void 0,"data-tip":"Hold for voice-to-text","data-for":"react-autoql-speech-to-text-tooltip","data-tip-disable":e.state.isRecording},f.createElement(Wn,{type:"microphone"}))),f.createElement(So,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return pn(n)}();mn(Is,"propTypes",{authentication:nr,transcript:b.string,interimTranscript:b.string,finalTranscript:b.string,resetTranscript:b.func,onTranscriptChange:b.func,onFinalTranscript:b.func}),mn(Is,"defaultProps",{authentication:Mo});export{ei as ConditionBuilder,Rs as Dashboard,Es as DashboardTile,Ul as DataAlertModal,Xl as DataAlerts,dr as DataExplorer,hs as DataMessenger,Za as ExploreQueries,Nl as ExpressionBuilder,ss as FilterLockPopover,Wn as Icon,Xa as LoadingDots,as as NotificationFeed,yr as NotificationIcon,ns as NotificationItem,$l as OptionsToolbar,ms as QueryInput,bl as QueryOutput,$a as QuerySuggestionList,Jl as ReportProblemModal,Xr as ReverseTranslation,Ol as ScheduleBuilder,Is as SpeechToTextButton,us as SpeechToTextButtonBrowser,Cl as VizToolbar,Wa as configureTheme,Da as getDefaultDisplayType,Ea as getSupportedDisplayTypes,Sa as isDisplayTypeValid};