react-autoql 7.2.1 → 7.2.2

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 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"axios";import f,{useEffect as g,Fragment as v,Component as h}from"react";import y from"prop-types";import{v4 as b}from"uuid";import C from"lodash.clonedeep";import{AiFillCaretDown as E}from"@react-icons/all-files/ai/AiFillCaretDown";import{AiFillCaretLeft as S}from"@react-icons/all-files/ai/AiFillCaretLeft";import{AiFillCaretRight as T}from"@react-icons/all-files/ai/AiFillCaretRight";import{AiFillCaretUp as D}from"@react-icons/all-files/ai/AiFillCaretUp";import{AiOutlineBook as x}from"@react-icons/all-files/ai/AiOutlineBook";import{AiOutlineBulb as R}from"@react-icons/all-files/ai/AiOutlineBulb";import{AiOutlineDashboard as w}from"@react-icons/all-files/ai/AiOutlineDashboard";import{AiOutlineEdit as N}from"@react-icons/all-files/ai/AiOutlineEdit";import{AiOutlineFileText as A}from"@react-icons/all-files/ai/AiOutlineFileText";import{AiOutlineMenu as k}from"@react-icons/all-files/ai/AiOutlineMenu";import{AiOutlineQuestionCircle as I}from"@react-icons/all-files/ai/AiOutlineQuestionCircle";import{AiOutlineTag as P}from"@react-icons/all-files/ai/AiOutlineTag";import{AiOutlineFileSearch as O}from"@react-icons/all-files/ai/AiOutlineFileSearch";import{BiLineChart as M}from"@react-icons/all-files/bi/BiLineChart";import{BiSearchAlt as L}from"@react-icons/all-files/bi/BiSearchAlt";import{BiBookmark as q}from"@react-icons/all-files/bi/BiBookmark";import{BiBook as V}from"@react-icons/all-files/bi/BiBook";import{BiNote as _}from"@react-icons/all-files/bi/BiNote";import{BiAbacus as F}from"@react-icons/all-files/bi/BiAbacus";import{BsArrowBarDown as B}from"@react-icons/all-files/bs/BsArrowBarDown";import{BsArrowBarUp as H}from"@react-icons/all-files/bs/BsArrowBarUp";import{FaMicrophoneAlt as Q}from"@react-icons/all-files/fa/FaMicrophoneAlt";import{FiAlertTriangle as z}from"@react-icons/all-files/fi/FiAlertTriangle";import{FiArrowLeft as U}from"@react-icons/all-files/fi/FiArrowLeft";import{FiBell as j}from"@react-icons/all-files/fi/FiBell";import{FiBellOff as K}from"@react-icons/all-files/fi/FiBellOff";import{FiCalendar as Y}from"@react-icons/all-files/fi/FiCalendar";import{FiCheck as W}from"@react-icons/all-files/fi/FiCheck";import{FiDatabase as G}from"@react-icons/all-files/fi/FiDatabase";import{FiDownload as X}from"@react-icons/all-files/fi/FiDownload";import{FiEye as J}from"@react-icons/all-files/fi/FiEye";import{RiFilterLine as Z}from"@react-icons/all-files/ri/RiFilterLine";import{RiFilterOffLine as $}from"@react-icons/all-files/ri/RiFilterOffLine";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{GoReport as ue}from"@react-icons/all-files/go/GoReport";import{IoIosCloseCircleOutline as de}from"@react-icons/all-files/io/IoIosCloseCircleOutline";import{IoIosGlobe as pe}from"@react-icons/all-files/io/IoIosGlobe";import{IoIosHourglass as me}from"@react-icons/all-files/io/IoIosHourglass";import{IoIosSearch as fe}from"@react-icons/all-files/io/IoIosSearch";import{MdClose as ge}from"@react-icons/all-files/md/MdClose";import{MdContentCopy as ve}from"@react-icons/all-files/md/MdContentCopy";import{MdError as he}from"@react-icons/all-files/md/MdError";import{MdInfoOutline as ye}from"@react-icons/all-files/md/MdInfoOutline";import{MdLock as be}from"@react-icons/all-files/md/MdLock";import{MdLockOpen as Ce}from"@react-icons/all-files/md/MdLockOpen";import{MdPlayCircleOutline as Ee}from"@react-icons/all-files/md/MdPlayCircleOutline";import{MdAttachMoney as Se}from"@react-icons/all-files/md/MdAttachMoney";import Te from"react-infinite-scroller";import De from"lodash.isempty";import xe from"parse-num";import{Popover as Re,ArrowContainer as we}from"react-tiny-popover";import Ne from"react-tooltip";import Ae from"moment-timezone";import ke from"react-select";import Ie from"react-modal";import{Scrollbars as Pe}from"react-custom-scrollbars-2";import Oe from"html-react-parser";import{TabulatorFull as Me}from"tabulator-tables";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import{DateRange as Le}from"react-date-range";import"react-date-range/dist/styles.css";import"react-date-range/dist/theme/default.css";import{scaleBand as qe,scaleLinear as Ve,scaleOrdinal as _e}from"d3-scale";import{max as Fe,min as Be,sum as He,count as Qe,variance as ze,deviation as Ue,median as je,mean as Ke}from"d3-array";import{select as Ye}from"d3-selection";import We from"lodash.sortby";import{axisTop as Ge,axisRight as Xe,axisLeft as Je,axisBottom as Ze}from"d3-axis";import{symbol as $e,symbolCircle as et,symbolSquare as tt,arc as nt,pie as ot}from"d3-shape";import{format as at,formatPrefix as rt,formatLocale as it,formatSpecifier as lt}from"d3-format";import{dispatch as st}from"d3-dispatch";import{entries as ct}from"d3-collection";import"d3-transition";import ut from"rc-drawer";import dt from"lodash.has";import pt from"react-localization";import"rc-drawer/assets/index.css";import mt from"react-autosuggest";import{toast as ft,ToastContainer as gt,Slide as vt}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import{format as ht}from"sql-formatter";import yt from"react-speech-recognition";import bt,{WidthProvider as Ct}from"react-grid-layout";import Et from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import St,{StereoAudioRecorder as Tt}from"recordrtc";function Dt(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 xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach((function(t){Ot(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rt(){Rt=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},r=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,a){var r=t&&t.prototype instanceof p?t:p,i=Object.create(r.prototype),l=new x(a||[]);return o(i,"_invoke",{value:E(e,n,l)}),i}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function p(){}function m(){}function f(){}var g={};s(g,r,(function(){return this}));var v=Object.getPrototypeOf,h=v&&v(v(R([])));h&&h!==t&&n.call(h,r)&&(g=h);var y=f.prototype=p.prototype=Object.create(g);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){var a;o(this,"_invoke",{value:function(o,r){function i(){return new t((function(a,i){!function o(a,r,i,l){var s=u(e[a],e,r);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,i,l)}),(function(e){o("throw",e,i,l)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return o("throw",e,i,l)}))}l(s.arg)}(o,r,a,i)}))}return a=a?a.then(i,i):i()}})}function E(e,t,n){var o="suspendedStart";return function(a,r){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===a)throw r;return w()}for(n.method=a,n.arg=r;;){var i=n.delegate;if(i){var l=S(i,n);if(l){if(l===d)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=u(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function S(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=u(o,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,d;var r=a.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function T(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 D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function t(){for(;++o<e.length;)if(n.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:w}}function w(){return{value:void 0,done:!0}}return m.prototype=f,o(y,"constructor",{value:f,configurable:!0}),o(f,"constructor",{value:m,configurable:!0}),m.displayName=s(f,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(C.prototype),s(C.prototype,i,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,o,a,r){void 0===r&&(r=Promise);var i=new C(c(t,n,o,a),r);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,l,"Generator"),s(y,r,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.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}},e.values=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function o(n,o){return i.type="throw",i.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a],i=r.completion;if("root"===r.tryLoc)return o("end");if(r.tryLoc<=this.prev){var l=n.call(r,"catchLoc"),s=n.call(r,"finallyLoc");if(l&&s){if(this.prev<r.catchLoc)return o(r.catchLoc,!0);if(this.prev<r.finallyLoc)return o(r.finallyLoc)}else if(l){if(this.prev<r.catchLoc)return o(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return o(r.finallyLoc)}}}},abrupt:function(e,t){for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o];if(a.tryLoc<=this.prev&&n.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,d):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),d},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),D(n),d}},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;D(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function wt(e){return(wt="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 Nt(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 At(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var r=e.apply(t,n);function i(e){Nt(r,o,a,i,l,"next",e)}function l(e){Nt(r,o,a,i,l,"throw",e)}i(void 0)}))}}function kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(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,jt(o.key),o)}}function Pt(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t,n){return(t=jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(){return(Mt=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 Lt(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&&Vt(e,t)}function qt(e){return(qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vt(e,t){return(Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function Ft(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 Bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ht(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 Bt(e)}function Qt(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=qt(e);if(t){var a=qt(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return Ht(this,n)}}function zt(e){return function(e){if(Array.isArray(e))return Ut(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 Ut(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 Ut(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 Ut(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 jt(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 Kt=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{hasError:!1}),Ot(Bt(e),"componentDidCatch",(function(t,n){console.error("Error HOC caught error:",t),e.setState({hasError:!0}),console.error(t),console.error(n)})),Ot(Bt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),Ot(Bt(e),"render",(function(){return e.state.hasError?f.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return Pt(n)}();Ot(Kt,"propTypes",{message:y.string}),Ot(Kt,"defaultProps",{message:null});var Yt={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.")},Wt={CANCELLED:"Request cancelled"},Gt=y.shape({token:y.string,apiKey:y.string,domain:y.string}),Xt=y.shape({currencyCode:y.string,languageCode:y.string,currencyDecimals:y.number,quantityDecimals:y.number,comparisonDisplay:y.string,monthYearFormat:y.string,dayMonthYearFormat:y.string}),Jt=y.shape({debug:y.bool,test:y.bool,enableAutocomplete:y.bool,enableQueryValidation:y.bool,enableDrilldowns:y.bool,enableQuerySuggestions:y.bool,enableColumnVisibilityManager:y.bool,enableNotifications:y.bool});y.shape({stringColumnIndices:y.arrayOf(y.number),numberColumnIndices:y.arrayOf(y.number),stringColumnIndex:y.number,legendColumnIndex:y.number,numberColumnIndex:y.number});var Zt=new pt({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",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",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"}}),$t=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"}))),en=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"})),tn=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"}))))),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:"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"})))),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:"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"})),an=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"})),rn=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"})),sn=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 "})),cn=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"})),un=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"})))),dn=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"}))),pn=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"})),mn=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 "})),fn=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"})),gn=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"})),vn=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"}))),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:"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=["type","size","showBadge","warning","danger"],bn=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger;var n=Ft(t,yn),o=null;if(!e.props.type)return null;switch(e.props.type){case"back":o=f.createElement(U,null);break;case"bar-chart":o=ln;break;case"book":o=f.createElement(V,null);break;case"bookmark":o=f.createElement(q,null);break;case"stacked-bar-chart":o=un;break;case"bubble-chart":o=fn;break;case"calendar":o=f.createElement(Y,null);break;case"caret-right":o=f.createElement(T,null);break;case"caret-left":o=f.createElement(S,null);break;case"caret-down":o=f.createElement(E,null);break;case"caret-up":o=f.createElement(D,null);break;case"react-autoql-bubbles-outlined":o=en;break;case"react-autoql-bubbles-filled":o=nn;break;case"react-autoql-bubbles-filled-alt":o=tn;break;case"chart":o=f.createElement(M,null);break;case"check":o=f.createElement(W,null);break;case"close":o=f.createElement(ge,null);break;case"maximize":o=f.createElement(le,null);break;case"minimize":o=f.createElement(se,null);break;case"money":o=f.createElement(Se,null);break;case"close-circle":o=f.createElement(de,null);break;case"collapse":o=f.createElement(H,null);break;case"column-chart":o=rn;break;case"column-line-chart":o=gn;break;case"stacked-column-chart":o=dn;break;case"copy":o=f.createElement(ve,null);break;case"dashboard":o=f.createElement(w,null);break;case"database":o=f.createElement(G,null);break;case"description":o=f.createElement(A,null);break;case"download":o=f.createElement(X,null);break;case"edit":o=f.createElement(N,null);break;case"expand":o=f.createElement(B,null);break;case"eye":o=f.createElement(J,null);break;case"filter":o=f.createElement(Z,null);break;case"filter-off":o=f.createElement($,null);break;case"grad-cap":o=$t;break;case"globe":o=f.createElement(pe,null);break;case"heatmap":o=mn;break;case"hour-glass":o=f.createElement(me,null);break;case"info":o=f.createElement(ye,null);break;case"light-bulb":o=f.createElement(R,null);break;case"line-chart":o=sn;break;case"lock":o=f.createElement(be,null);break;case"stacked-line-chart":o=pn;break;case"menu":o=f.createElement(k,null);break;case"microphone":o=f.createElement(Q,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(_,null);break;case"notification":o=f.createElement(j,null);break;case"notification-off":o=f.createElement(K,null);break;case"notification-pause":o=f.createElement(ne,null);break;case"abacus":o=f.createElement(F,null);break;case"pie-chart":o=cn;break;case"play":o=f.createElement(Ee,null);break;case"pivot-table":o=an;break;case"plus":o=f.createElement(oe,null);break;case"preview":o=f.createElement(O,null);break;case"question":o=f.createElement(I,null);break;case"refresh":o=f.createElement(ce,null);break;case"report":o=f.createElement(ue,null);break;case"search":o=f.createElement(fe,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=vn;break;case"single-view":o=hn;break;case"table":o=on;break;case"tag":o=f.createElement(P,null);break;case"title":o=f.createElement(x,null);break;case"trash":o=f.createElement(ie,null);break;case"unlock":o=f.createElement(Ce,null);break;case"warning":o=f.createElement(he,null);break;case"warning-triangle":o=f.createElement(z,null)}return f.createElement(Kt,null,f.createElement("span",Mt({},n,{"data-test":"react-autoql-icon",className:"react-autoql-icon\n ".concat(e.props.className||"","\n ").concat(e.props.type,"\n ").concat(e.props.warning?" warning":"","\n ").concat(e.props.danger?" danger":""),style:xt({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 Pt(n)}();Ot(bn,"propTypes",{type:y.string,size:y.number,showBadge:y.bool,color:y.string,warning:y.bool,danger:y.bool}),Ot(bn,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var Cn=function(){Ne.rebuild()},En=function(){Ne.hide()};function Sn(e){return f.createElement(Ne,e)}var Tn=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],Dn=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line","column_line"],xn=["line","stacked_line"],Rn=["column_line"],wn=["January","February","March","April","May","June","July","August","September","October","November","December"],Nn={CURRENCY:"DOLLAR_AMT",QUANTITY:"QUANTITY",RATIO:"RATIO",PERCENT:"PERCENT"},An={DOLLAR_AMT:"Currency",QUANTITY:"Quantity",RATIO:"Ratio",PERCENT:"Percent"},kn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],In=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Pn=["SP","SU","FA","HO"],On="DAY",Mn="MONTH",Ln="YEAR",qn="WEEK",Vn="QUARTER",_n="DATE_HOUR",Fn="DATE_MINUTE",Bn="HOUR",Hn="MINUTE",Qn={DAY:"ll",MONTH:"MMMM YYYY",YEAR:"YYYY",DATE_HOUR:"ll h:00A",DATE_MINUTE:"ll h:mmA"},zn=[{displayName:"Sum",value:"sum",unit:"inherit",tooltip:"<strong>Sum:</strong> Values that have the same chart axis label will be added up."},{displayName:"Avg",value:"avg",unit:"inherit",tooltip:"<strong>Average:</strong> Values that have the same chart axis label will be averaged."},{displayName:"Count",value:"count",unit:"none",tooltip:"<strong>Count:</strong> The total number of non-blank values will be shown for all data points with the same label."}],Un={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},jn={timestampFormat:"ISO8601",currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMMM YYYY",dayMonthYearFormat:"ll"},Kn={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableCSVDownload:!1,enableReportProblem:!0},Yn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Un),e)},Wn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},jn),e)},Gn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Kn),e)},Xn="subject",Jn="VL",Zn=function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response"))},$n=function(e){try{return e.join(".")}catch(e){return}},eo=function(e){if(e&&e.length){var t=[];return e.forEach((function(e){e.hidden||t.push({start:e.start,end:e.end,value:e.text||e.value,value_label:e.value_label||"ORIGINAL_TEXT",canonical:e.canonical||"ORIGINAL_TEXT"})})),t}},to=function(e){try{var t=null==e?void 0:e.split("."),n=Number(null==t?void 0:t[2]);if(n>=500&&n<600)return!0}catch(e){console.error(e)}return!1},no=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,o=t.queryId,a=t.domain,r=t.apiKey,i=t.token,l=t.cancelToken;if(!n)return Promise.reject(new Error("No query supplied"));if(!a||!i||!r)return Promise.reject(new Error("Unauthenticated"));var s="".concat(a,"/autoql/api/v1/query/related-queries?key=").concat(r,"&search=").concat(encodeURIComponent(n),"&scope=narrow");o&&(s="".concat(s,"&query_id=").concat(o));var c={headers:{Authorization:"Bearer ".concat(i)},cancelToken:l};return m.get(s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},oo=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,o=t.userSelection,a=t.userSelectionFinal,r=t.debug,i=t.test,l=t.domain,s=t.apiKey,c=t.token,u=t.source,d=t.filters,p=t.orders,f=t.tableFilters,g=t.pageSize,v=void 0===g?100:g,h=t.cancelToken,y="".concat(l,"/autoql/api/v1/query?key=").concat(s),b=a||eo(o),C={text:n,source:$n(u),translation:r?"include":"exclude",user_selection:b,test:i,session_filter_locks:d,orders:p,filters:f,page_size:v,date_format:"ISO8601"};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!s||!l||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var E={headers:{Authorization:"Bearer ".concat(c)},cancelToken:h};return m.post(y,C,E).then((function(e){var t;if(null==e||null===(t=e.data)||void 0===t||!t.data)throw new Error("Parse error");return Promise.resolve(e)})).catch((function(t){var o,a,r;if((null==t?void 0:t.message)===Wt.CANCELLED)return Promise.reject({data:{message:Wt.CANCELLED}});if(console.error(t),"Parse error"===(null==t?void 0:t.message))return Promise.reject({error:"Parse error"});if(401===(null==t?void 0:t.response)||null==t||null===(o=t.response)||void 0===o||!o.data)return Promise.reject({error:"Unauthenticated"});var i=null==t||null===(a=t.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.reference_id;if(!((null==f?void 0:f.length)||(null==p?void 0:p.length))&&("1.1.430"===i||"1.1.431"===i||to(i))){var u,d,m,g=null==t||null===(u=t.response)||void 0===u||null===(d=u.data)||void 0===d||null===(m=d.data)||void 0===m?void 0:m.query_id;return no({query:n,queryId:g,domain:l,apiKey:s,token:c,cancelToken:h})}return Promise.reject(e(t,"response"))}))},ao=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.text,o=t.domain,a=t.apiKey,r=t.token;if(!n)return Promise.reject(new Error("No text supplied"));if(!r||!o||!a)return Promise.reject(new Error("Unauthenticated"));var i="".concat(o,"/autoql/api/v1/query/validate?text=").concat(encodeURIComponent(n),"&key=").concat(a),l={headers:{Authorization:"Bearer ".concat(r)}};return m.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},ro=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?oo(t):ao({text:null==t?void 0:t.query,domain:null==t?void 0:t.domain,apiKey:null==t?void 0:t.apiKey,token:null==t?void 0:t.token}).then((function(n){return function(t){return e(t,"data.data.replacements.length")>0}(n)?Promise.resolve(n):oo(t)})).catch((function(e){var t;return(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&console.error(e),Promise.reject(e)}))},io=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.queryID,n=e.groupBys,o=e.debug,a=e.test,r=e.domain,i=e.apiKey,l=e.token,s=e.orders,c=e.tableFilters,u=e.cancelToken,d=e.pageSize,p=void 0===d?100:d;if(!t)return console.error("No query ID supplied to drilldown function"),Promise.reject(new Error("Query ID not supplied"));if(!l||!r||!i)return console.error("Unauthenticated"),Promise.reject(new Error("Unauthenticated"));var f={translation:o?"include":"exclude",columns:n,filters:c,orders:s,test:a,page_size:p,date_format:"ISO8601"},g={headers:{Authorization:"Bearer ".concat(l)},cancelToken:u},v="".concat(r,"/autoql/api/v1/query/").concat(t,"/drilldown?key=").concat(i);return m.post(v,f,g).then((function(e){return Promise.resolve(e)})).catch(Zn)},lo=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,o=t.domain,a=t.apiKey,r=t.token;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!o||!a||!r)return Promise.reject(new Error("Unauthenticated"));var i="".concat(o,"/autoql/api/v1/query/autocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(a),l={headers:{Authorization:"Bearer ".concat(r)}};return m.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},so=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,o=t.domain,a=t.token,r=t.apiKey,i=t.cancelToken;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!o||!r||!a)return Promise.reject(new Error("Unauthenticated"));var l="".concat(o,"/autoql/api/v1/query/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(a)},cancelToken:i};return m.get(l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response.data"))}))},co=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,o=t.token,a=t.domain;if(!a||!n||!o)return Promise.reject(new Error("Unauthenticated"));var r="".concat(a,"/autoql/api/v1/query/filter-locking?key=").concat(n),i={headers:{Authorization:"Bearer ".concat(o)}};return m.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},uo=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,o=t.token,a=t.domain,r=t.filters;if(!a||!n||!o)return Promise.reject(new Error("Unauthenticated"));if(null==r||!r.length)return Promise.reject(new Error("No filters provided"));var i="".concat(a,"/autoql/api/v1/query/filter-locking?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(o)}},s={columns:r};return m.put(i,s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},po=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.keywords,o=t.pageSize,a=t.pageNumber,r=t.domain,i=t.apiKey,l=t.token,s=t.skipQueryValidation,c=n?n.split(" "):[],u="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(c),"&page_size=").concat(o,"&page=").concat(a,"&enable_history=false");if(!l||!r||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(l)}};return s?m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):ao({text:n,domain:r,apiKey:i,token:l}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}))},mo=function(e){return{name:e.keyword,alias_name:e.show_message,canonical:e.canonical}},fo=function(){var t=At(Rt().mark((function t(){var n,o,a,r,i,l,s,c,u,d,p,f,g,v,h,y,b,C,E,S,T,D=arguments;return Rt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=D.length>0&&void 0!==D[0]?D[0]:{},o=n.pageSize,a=n.pageNumber,r=n.domain,i=n.apiKey,l=n.token,s=n.text,c=n.context,u=n.selectedVL,d=n.userVLSelection,p=void 0===d?[]:d,f=n.skipQueryValidation,l&&r&&i){t.next=3;break}return t.abrupt("return",Promise.reject(new Error("Unauthenticated")));case 3:if(f){t.next=9;break}return t.next=6,ao({text:s,domain:r,apiKey:i,token:l});case 6:if(!((null==(y=t.sent)||null===(g=y.data)||void 0===g||null===(v=g.data)||void 0===v||null===(h=v.replacements)||void 0===h?void 0:h.length)>0)){t.next=9;break}return t.abrupt("return",Promise.resolve(y));case 9:return b="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i),C={headers:{Authorization:"Bearer ".concat(l)}},E=[],u&&E.push(mo(u)),p&&(S=p.map((function(e){return mo(e)})),E=[].concat(zt(E),zt(S))),T={page:a,page_size:o,search_terms:s,context:c,value_label_info:E},t.abrupt("return",m.post(b,T,C).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})));case 16:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),go=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.message,o=t.queryId,a=t.domain,r=t.apiKey,i=t.token;if(!o)return Promise.reject(new Error("No query ID supplied"));if(!i||!a||!r)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/").concat(o,"?key=").concat(r),s={headers:{Authorization:"Bearer ".concat(i)}},c={is_correct:!1,message:n};return m.put(l,c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},vo=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(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)})),Ot(Bt(e),"onMouseDown",(function(){En(),e.props.onTranscriptStart(),e.props.startListening()})),Ot(Bt(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(Kt,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(bn,{type:"microphone"})),!e.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return Pt(n)}();Ot(vo,"propTypes",{transcript:y.string,interimTranscript:y.string,finalTranscript:y.string,resetTranscript:y.func,browserSupportsSpeechRecognition:y.bool,startListening:y.func,stopListening:y.func,listening:y.bool,onTranscriptChange:y.func,onFinalTranscript:y.func,onTranscriptStart:y.func}),Ot(vo,"defaultProps",{onTranscriptStart:function(){},onTranscriptChange:function(){},onFinalTranscript:function(){}});var ho=yt({autoStart:!1,continuous:!1})(vo),yo={"accent-color":"#28a8e0","background-color-primary":"#F1F3F5","background-color-secondary":"#ffffff","background-color-tertiary":"#cccccc","background-color-disabled":"#ededed","background-color-disabled-dark":"#857d83","background-color-checkbox":"#ffffff","border-color":"#e6e6e6","hover-color":"#f6f7f9","text-color-primary":"#4f4f4f","text-color-accent":"#ffffff","text-color-placeholder":"#0000005e","dashboard-title-color":"#28a8e0","font-family":"sans-serif","highlight-color":"#000000","danger-color":"#ca0b00","warning-color":"#ffcc00","success-color":"#2aca4d","info-color":"#28a8e0","box-shadow-color":"#00000026","mask-color":"#0000000f"},bo={"accent-color":"#193a48","background-color-primary":"#20252A","background-color-secondary":"#3B3F46","background-color-tertiary":"#292929","background-color-disabled":"#5d6167","background-color-disabled-dark":"#857d83","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#ececec","text-color-accent":"#ffffff","text-color-placeholder":"#ffffff9c","dashboard-title-color":"#193a48","font-family":"sans-serif","highlight-color":"#ffffff","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#2aca4d","info-color":"#28a8e0","box-shadow-color":"#00000066","mask-color":"#0000000f"},Co={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},Eo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Co),e)},So=function(e){return document.documentElement.style.getPropertyValue("--react-autoql-".concat(e))},To=function(){try{for(var e=[],t=[],n=0;n<100;){try{var o,a=So("chart-color-".concat(n)),r=null!==(o=So("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),[]}},Do=function(e,t){var n=function(e){var t=e;return"#"===t.slice(0,1)&&(t=t.slice(1)),3===t.length&&(t=t.split("").map((function(e){return e+e})).join("")),(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3}(e);t["text-color-accent"]=n>=140?"black":"white"},xo=function(e,t){var n=e||Co.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")},Ro=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Eo(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?yo:bo;for(var p in o&&(d["text-color-primary"]=o),l?d["text-color-accent"]=l:Do(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),xo(r,d),d)document.documentElement.style.setProperty("--react-autoql-".concat(p),d[p])},wo=function(e){var t=f.forwardRef((function(t,n){var o=Mt({},(_t(t),t));return g((function(){!!So("accent-color")||Ro()}),[]),f.createElement(e,Mt({ref:n},o))}));return t.displayName="ThemeProvider",t};var No=wo((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))}));o.extend(i),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 Ao=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},ko=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Io=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t||"UNKNOWN"===t},Po=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Oo=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],"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])),{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]}},Mo=function(e){if(e&&function(e){return!Ao(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}))},Lo=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},qo=function(e,t){if(e){var n=[],o=Mo(e),a=Lo(e);e.forEach((function(e,t){(Io(e)||e.groupable)&&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=n[0];if(t)l=(null===(i=e[a])||void 0===i?void 0:i.groupable)?a:e.findIndex((function(e){return e.groupable}));else a>=0?l=a:n[1]>=0&&(l=n[1]);return{stringColumnIndex:l,stringColumnIndices:n}}},Vo=function(e){var t=0,n=0;return e.forEach((function(e){ko(e)&&e.is_visible?n+=1:Io(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},_o={dataFormatting:Xt,data:y.arrayOf(y.array).isRequired,columns:y.arrayOf(y.shape({})).isRequired,numberColumnIndices:y.arrayOf(y.number).isRequired,stringColumnIndices:y.arrayOf(y.number).isRequired,stringColumnIndex:y.number.isRequired,numberColumnIndex:y.number.isRequired,legendColumnIndex:y.number,enableDynamicCharting:y.bool,isResizing:y.bool,onLegendClick:y.func,onLabelChange:y.func,onXAxisClick:y.func,onYAxisClick:y.func},Fo={dataFormatting:jn,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){},rebuildTooltips:function(){}},Bo=xt(xt({},_o),{},{visibleSeriesIndices:y.arrayOf(y.number).isRequired,height:y.number.isRequired,width:y.number.isRequired,deltaX:y.number,deltaY:y.number}),Ho=xt(xt({},Fo),{},{deltaX:0,deltaY:0}),Qo=xt(xt({},Bo),{},{xScale:y.func.isRequired,yScale:y.func.isRequired,hasRightLegend:y.bool,hasBottomLegend:y.bool,innerHeight:y.number,innerWidth:y.number,onLabelRotation:y.func}),zo=xt(xt({},Ho),{},{hasRightLegend:!1,hasBottomLegend:!1,innerHeight:0,innerWidth:0,onLabelRotation:function(){}}),Uo=xt(xt({},Bo),{},{xScale:y.func.isRequired,yScale:y.func.isRequired}),jo={activeKey:void 0,onChartClick:function(){}},Ko=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)},Yo=function(e,t){return"".concat(e,"-").concat(t)},Wo=function(e){var t=e.row,n=e.columns,o=e.colIndex,a=e.stringColumnIndex,r=e.legendColumn,i=e.dataFormatting;try{var l,s,c,u,d,p,m=n[a],f=n[o],g=null!==(l=m.tooltipTitle)&&void 0!==l?l:m.title,v=f.origColumn?null!==(s=f.origColumn.tooltipTitle)&&void 0!==s?s:f.origColumn.title:null!==(c=f.tooltipTitle)&&void 0!==c?c:f.title,h=null===(u=zn.find((function(e){return e.value===f.aggType})))||void 0===u?void 0:u.displayName;h&&(v="".concat(v," (").concat(h,")"));var y=Sa({element:t[a],column:m,config:i,isChart:!0}),b=Sa({element:t[o]||0,column:n[o],config:i,isChart:!0}),C=n[o],E=r&&null!=C&&C.origColumn?"<div><strong>".concat(null!==(d=r.tooltipTitle)&&void 0!==d?d:r.title,":</strong> ").concat(null!==(p=C.tooltipTitle)&&void 0!==p?p:C.title,"</div>"):"",S="<div><strong>".concat(g,":</strong> ").concat(y,"</div>"),T="<div><strong>".concat(v,":</strong> ").concat(b,"</div>");return"<div>\n ".concat(E,"\n ").concat(S,"\n ").concat(T,"\n </div>")}catch(e){return console.error(e),null}},Go=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];try{if(n.length<1)return[];var o=n.map((function(t){return e[t]})),a=o.every((function(e){return e.aggType===o[0].aggType})),r=n.map((function(n,o){var r=e[n],i=r.title;if(!a){var l,s=null===(l=zn.find((function(e){return e.value===(null==r?void 0:r.aggType)})))||void 0===l?void 0:l.displayName;s&&(i="".concat(i," (").concat(s,")"))}return{label:i,color:t(n),hidden:r.isSeriesHidden,columnIndex:n,column:r}}));return r}catch(e){return console.error(e),[]}},Xo=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return console.error(e),0}},Jo=function(e){if("object"===wt(e))return Object.keys(e).length},Zo=function(e){var t=Jo(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var o=zt(Object.values(e)).filter((function(e){return!isNaN(Number(e))}));n=Math.max.apply(Math,zt(o))}return n},$o=function(e){var t=Jo(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var o=zt(Object.values(e)).filter((function(e){return!isNaN(Number(e))}));n=Math.min.apply(Math,zt(o))}return n},ea=function(e,t,n,o,a){if(o)return function(e,t,n,o){var a={},r={};e.forEach((function(e){var o=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?a[o]?a[o]+=i:a[o]=i:i<0&&(r[o]?r[o]-=i:r[o]=i)}))}));var i=Zo(a),l=$o(r);return(!o||i>0&&l<0||i/l>1e3)&&(i>0&&l>0?l=0:i<0&&l<0&&(i=0)),{maxValue:i,minValue:l}}(e,a,t,n);try{var r=[],i=[];t.forEach((function(t,n){r.push(Fe(e,(function(e){return Xo(e[t])}))),i.push(Be(e,(function(e){return Xo(e[t])})))}));var l=Fe(r),s=Be(i);return l===s&&(s>0?s=0:l<0&&(l=0)),(!n||l>0&&s<0||l/s>1e3)&&(l>0&&s>0?s=0:l<0&&s<0&&(l=0)),{minValue:s,maxValue:l}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},ta=function(e,t){var n,o;if("x"===t)(o=(n=0)+e.width)<n&&(o=n);else if("y"===t){(n=e.height)<(o=0)&&(n=o)}return[n,o]},na=function(e){var t,n,o,a=e.props,r=e.columnIndex,i=e.axis,l=e.outerPadding,s=void 0===l?.5:l,c=e.innerPadding,u=void 0===c?.2:c,d=e.domain,p=ta(a,i),m=null!=d?d:a.data.map((function(e){return e[r]})),f=null===(t=a.stringColumnIndices)||void 0===t?void 0:t.map((function(e){return a.columns[e]})),g=qe().domain(m).range(p).paddingInner(u).paddingOuter(s);return g.type="BAND",g.dataFormatting=a.dataFormatting,g.column=a.columns[r],g.title=null===(n=g.column)||void 0===n?void 0:n.display_name,g.fields=f,g.tickSize=g.bandwidth(),g.hasDropdown=a.enableAxisDropdown&&(null===(o=a.stringColumnIndices)||void 0===o?void 0:o.length)>1,g.getValue=function(e){return g(e)},g.tickLabels=ca({scale:g,props:a,initialTicks:m,innerPadding:u,outerPadding:s}),g},oa=function(e){var t=e.numberColumns;e.dataFormatting;try{if(null==t||!t.length)return;var n="Amount";!t.find((function(e){return e.display_name!==t[0].display_name}))&&(n=t[0].display_name);var o=t.map((function(e){return e.aggType}));if(!o.find((function(e){return e!==o[0]}))){var a,r=null===(a=zn.find((function(e){return e.value===o[0]})))||void 0===a?void 0:a.displayName;r&&(n="".concat(n," (").concat(r,")"))}return n}catch(e){return console.error(e),title}},aa=function(e){var t=e.map((function(e){return function(e){var t,n;e.aggType&&(t=null===(n=zn.find((function(t){return t.value===e.aggType})))||void 0===n?void 0:n.unit);switch(t){case"none":return"none"}return e.type===Nn.CURRENCY?"currency":e.type===Nn.QUANTITY||e.type===Nn.RATIO?"none":e.type===Nn.PERCENT?"percent":void 0}(e)}));return!t.find((function(e){return e!==t[0]}))?t[0]:"none"},ra=function(e){var t,n=e.props,o=e.minValue,a=e.maxValue,r=e.axis,i=e.range,l=e.tickValues,s=e.numTicks,c=e.stacked,u=e.isScaled,d=e.columnIndex,p=e.columnIndices,m=null!=o?o:null==l?void 0:l[0],f=null!=a?a:null==l?void 0:l[(null==l?void 0:l.length)-1];isNaN(m)&&(m=0),isNaN(f)&&(f=m);var g=[m,f],v=null!=i?i:ta(n,r),h=null!==(t=null==p?void 0:p.map((function(e){return n.columns[e]})))&&void 0!==t?t:[],y=aa(h),b=oa({numberColumns:h,dataFormatting:n.dataFormatting}),C=Ve().domain(g).range(v);return C.minValue=m,C.maxValue=f,C.column=n.columns[d],C.fields=h,C.dataFormatting=n.dataFormatting,C.hasDropdown=n.enableAxisDropdown,C.stacked=!!c,C.type="LINEAR",C.units=y,C.title=b,C.tickSize=0,C.isScaled=u,C.getValue=function(e){return C(e)},C.tickLabels=null!=l?l:ca({props:n,scale:C,numTicks:s,isScaled:u}),C},ia=function(e){var t,n,o=e.props,a=e.columnIndices1,r=void 0===a?[]:a,i=e.columnIndices2,l=void 0===i?[]:i,s=e.axis,c=e.stacked,u=e.isScaled,d=ea(o.data,r,u,c,o.stringColumnIndex),p=d.minValue,m=d.maxValue,f=ra({props:o,minValue:p,maxValue:m,axis:s,stacked:c,isScaled:u,columnIndex:r[0],columnIndices:r});if(null==l||!l.length)return{scale:f};var g=ea(o.data,l,u,c,o.stringColumnIndex),v=g.minValue,h=g.maxValue,y=ra({props:o,minValue:v,maxValue:h,range:f.range(),numTicks:null!==(t=null===(n=f.tickLabels)||void 0===n?void 0:n.length)&&void 0!==t?t:void 0,stacked:c,isScaled:u,columnIndex:l[0],columnIndices:l}),b=f.tickLabels||[],C=y.tickLabels||[],E=b.length,S=C.length,T=zt(b),D=zt(C);if(E===S);else if(S<E)for(var x=E-S,R=C[1]-C[0],w=C[S-1],N=0;N<x;N++){var A=w+N*R;D.push(A)}else if(S>E)for(var k=S-E,I=b[1]-b[0],P=b[E-1],O=1;O<=k;O++){var M=P+O*I;T.push(M)}var L=ra({props:o,axis:s,tickValues:T,stacked:c,isScaled:u,columnIndex:r[0],columnIndices:r}),q=ra({props:o,range:L.range(),tickValues:D,stacked:c,isScaled:u,columnIndex:l[0],columnIndices:l});return{scale:L,scale2:q}},la=function(e,t,n){if(null!=e&&e.getTime)return t&&"start"===n?o(e).utc().startOf(t).valueOf():t&&"end"===n?o(e).utc().endOf(t).valueOf():e.getTime()},sa=function(e){var t=new Date(e);return t.setTime(t.getTime()+60*t.getTimezoneOffset()*1e3),t},ca=function(e){var t=e.scale,n=e.initialTicks,o=e.props,a=e.numTicks,r=e.innerPadding,i=e.outerPadding;try{var l,s,c,u,d=t.tickLabels;n?d=zt(n):"function"==typeof(null==t?void 0:t.ticks)&&(d=t.ticks(a));var p=function(e){var t,n,o,a,r=e.scale,i=e.numTicks,l=e.innerPadding,s=void 0===l?.2:l,c=e.outerPadding,u=void 0===c?.5:c,d=null!==(t=null==r||null===(n=r.range())||void 0===n?void 0:n[1])&&void 0!==t?t:0,p=null!==(o=null==r||null===(a=r.range())||void 0===a?void 0:a[0])&&void 0!==o?o:0,m=Math.abs(p-d)+12;if("BAND"!==r.type)return m/i;var f=m/(2*u+i+(i+1)*s);return f+s*f}({scale:t,numTicks:null===(l=d)||void 0===l?void 0:l.length,innerPadding:r,outerPadding:i});if(!d)return void console.error("Unable to set tick labels for scale. tickValues is undefined");var m=(null!==(s=Math.abs((null==t||null===(c=t.range())||void 0===c?void 0:c[1])-(null==t||null===(u=t.range())||void 0===u?void 0:u[0])))&&void 0!==s?s:1)+12,f=Math.ceil(20*d.length/m),g=zt(d);return p<20&&(g=[],d.forEach((function(e,t){t%f==0&&g.push(e)}))),"LINEAR"===(null==t?void 0:t.type)?function(e){var t=e.tickValues,n=e.scale,o=n.minValue,a=n.maxValue;if(void 0===o||void 0===a)return console.warn("Tried to make nice labels but max/min values were not provided"),t;if((null==t?void 0:t.length)<2)return t;var r=zt(t);try{var i=t[0],l=t[t.length-1],s=Math.abs(t[1]-t[0]),c=i,u=l;o<i&&(c=i-s,r.unshift(c)),a>l&&(u=l+s,r.push(u)),n.domain([r[0],r[r.length-1]])}catch(e){console.error(e)}return r}({tickValues:g,scale:t,props:o}):"TIME"===(null==t?void 0:t.type)?function(e){var t=e.tickValues,n=e.scale;try{var o;if((null==t?void 0:t.length)<2)return t;var a=n.minValue,r=n.maxValue;if(void 0===a||void 0===r)throw new Error("Tried to make nice labels but max/min values were not provided");var i=la(a),l=la(r);if(!i||!l)throw new Error("Tried to make nice labels but could not convert min and max dates to epoch");var s=zt(t),c=la(t[1])-la(t[0]),u=Qn[null==n||null===(o=n.column)||void 0===o?void 0:o.precision],d=la(t[0],u,"start"),p=la(t[t.length-1],u,"end");if(!c||isNaN(d)||isNaN(p))throw new Error("Tried to make nice labels but could not convert tick values to epoch");var m=d,f=p;return i<d&&(m=d-c,s.unshift(sa(m))),l>p&&(f=p+c,s.push(sa(f))),n.domain([sa(s[0]),sa(s[s.length-1])]),s}catch(e){return console.error(e),t}}({tickValues:g,scale:t,props:o}):g}catch(e){console.error(e)}return n||[]},ua=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;isNaN(t)||isNaN(i)||isNaN(l)||isNaN(s)||((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)}},da=function(e,t,n){return n.indexOf(e)===t},pa=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},ma=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ca(e)?va(e,t,n):ga(e,t,n)},fa=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?ha(e,t):ya(e,n)},ga=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||jn.dayMonthYearFormat,i=o.utc(e).utc();if(!i.isValid())return e;var l=i.format(r);try{switch(a){case On:break;case qn: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 Mn:var p=n.monthYearFormat||jn.monthYearFormat;l=i.format(p);break;case Vn:var m=i.quarter(),f=i.format("YYYY");l="".concat(f,"-Q").concat(m);break;case Ln:l=i.format("YYYY");break;case _n:l=i.format("".concat(r," h:00A"));break;case Fn:l=i.format("".concat(r," h:mmA"))}return l}catch(e){console.error(e)}}},va=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||jn.monthYearFormat,c=i||jn.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}},ha=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=kn[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=In[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=kn[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=In[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=kn.find((function(t){return t.toLowerCase().includes(e.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}}},ya=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||jn.monthYearFormat,p=u||jn.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}},ba=function(e){var t,n=e.d,o=e.scale,a=e.column,r=e.dataFormatting,i=e.maxLabelWidth,l=void 0===i?20:i;if(null===n)return{fullWidthLabel:"Untitled Category",formattedLabel:"Untitled Category"};var s=null!=a?a:null==o?void 0:o.column;if(!s||!s.type)return{fullWidthLabel:n,formattedLabel:n};var c=null!==(t=null!=r?r:null==o?void 0:o.dataFormatting)&&void 0!==t?t:Wn(),u=c.currencyCode,d=c.languageCode,p=s.type;"none"===(null==o?void 0:o.units)&&(p="QUANTITY");var m=n;switch(p){case"STRING":break;case"DOLLAR_AMT":if(Number(n)||0===Number(n)){var f=u||"USD";try{m=new Intl.NumberFormat(d,{style:"currency",currency:"".concat(f),minimumFractionDigits:0,maximumFractionDigits:0}).format(n)}catch(e){console.error(e),m=new Intl.NumberFormat(d,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(n)}}break;case"QUANTITY":isNaN(parseFloat(n))||(m=new Intl.NumberFormat(d).format(n));break;case"DATE":var g="TIME"===(null==o?void 0:o.type);m=ma(n,s,c,g);break;case"DATE_STRING":m=fa(n,s,c,o);break;case"PERCENT":if(Number(n)){var v=Number(n)/100;m=new Intl.NumberFormat(d,{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(v)}}var h=m;return"string"==typeof m&&m.length>l&&(m="".concat(m.substring(0,l),"...")),{fullWidthLabel:h,formattedLabel:m}},Ca=function(e){return/^\d+$/.test(e)},Ea=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):Ca(t)?o.unix(t).utc():o.utc(t).utc()},Sa=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=null==n?void 0:n.type;if(i&&["count","deviation","variance"].includes(null==n?void 0:n.aggType)&&(p="QUANTITY"),n)switch(p){case"STRING":break;case"DOLLAR_AMT":if(!isNaN(parseFloat(t))){var m=s||"USD",f=u||0===u?u:void 0;try{l=new Intl.NumberFormat(c,{style:"currency",currency:"".concat(m),minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(c,{style:"currency",currency:"USD",minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}}break;case"QUANTITY":var g=d||0===d?d:1;if(!isNaN(parseFloat(t))){var v=parseFloat(t)%1!=0?g:0;l=new Intl.NumberFormat(c,{minimumFractionDigits:v,maximumFractionDigits:v}).format(t)}break;case"DATE":l=ma(t,n,a);break;case"DATE_STRING":l=fa(t,n,a);break;case"RATIO":isNaN(parseFloat(t))||(l=new Intl.NumberFormat(c,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(!isNaN(parseFloat(t))){var h=parseFloat(t)/100;l=new Intl.NumberFormat(c,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(h),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}},Ta=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,"+n}catch(e){return}},Da=function(e){if(e&&e.getBBox)return e.getBBox()},xa=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return new Promise((function(o,a){try{var r=Ta(e),i=e.getBoundingClientRect(),l=2*i.width,s=2*i.height,c=document.createElement("canvas");c.width=l+t,c.height=s+t;var u=c.getContext("2d"),d=new Image;d.onload=function(){if(u.drawImage(this,t,t,l,s),n){var e=document.createElement("canvas");e.width=c.width,e.height=c.height;var a=e.getContext("2d");a.save(),a.fillStyle=n,a.fillRect(0,0,c.width,c.height),a.strokeRect(0,0,c.width,c.height),a.restore(),a.drawImage(c,0,0),c=e}o(c.toDataURL("image/png",1))},d.onerror=function(){a("failed to load image")},d.src=r}catch(e){console.error(e),a("failed to convert svg to png "+e)}}))},Ra=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},wa=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t},Na=function(e){return Dn.includes(e)},Aa=function(e){return Tn.includes(e)},ka=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)},Ia=function(e,t,n){var o,a,r,i,l,s;if(t<=1)return!1;var c=wa(e);if(!(2===(null==c?void 0:c.length)))return!1;var u=Ma(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(da))||void 0===i?void 0:i.length)&&void 0!==r?r:0,v=null!==(l=null==f||null===(s=f.filter(da))||void 0===s?void 0:s.length)&&void 0!==l?l:0;return g>20&&v>20?(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):Po(d)&&v>20?(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The legend would have ".concat(v," fields")),!1):!(Po(p)&&g>20)||(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The legend would have ".concat(g," fields")),!1)},Pa=function(e){var t,n=!(null===(t=e.filter((function(e){return Po(e)})))||void 0===t||!t.length);return n},Oa=function(e,t){if(t<=1)return!1;var n=Vo(e),o=n.amountOfNumberColumns,a=n.amountOfStringColumns;return o>0&&a>0},Ma=function(e){return t(e,(function(e){return e.is_visible}))},La=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},qa=function(e){var t=Ma(e);return(null==e?void 0:e.length)&&!t.length},Va=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},_a=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,p,m,f,g;if(null==n||null===(l=n.data)||void 0===l||null===(s=l.data)||void 0===s||!s.display_type)return[];var v=n.data.data.display_type;if("suggestion"===v||"help"===v||"html"===v)return[v];var h=null!==(c=null==n||null===(u=n.data)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.rows)&&void 0!==c?c:[],y=o||(null==n||null===(p=n.data)||void 0===p||null===(m=p.data)||void 0===m?void 0:m.columns),b=Ma(y);if(null==b||!b.length)return["text"];if(null==h||!h.length)return["table"];if(Va(n))return["single-value"];var C=10,E=null!=a?a:h.length,S=!0,T=null!=r;if(T&&(S=!!r),Ia(b,E,null==n||null===(f=n.data)||void 0===f||null===(g=f.data)||void 0===g?void 0:g.rows)){var D=["table"];return i||D.push("pivot_table"),S&&(D.push("stacked_column","stacked_bar","column","bar","bubble","heatmap"),Pa(b)&&D.push("stacked_line","line")),D}if(Oa(b,E)){var x=["table","column","bar"];Pa(b)&&x.push("line"),E>1&&E<=C&&x.push("pie");var R=Vo(b),w=R.amountOfNumberColumns;if(w>1&&x.push("column_line"),!i&&ka(b)){var N=b.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),A=b[N],k=e(n,"data.data.rows"),I=[];k.forEach((function(e){var t=Sa({element:e[N],column:A,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});I.includes(t)||I.push(t)})),I.length>1&&x.push("pivot_table")}return x}return["table"]}catch(e){return console.error(e),["table"]}},Fa=function(e,t,n,o,a,r){var i,l,s=_a({response:e,columns:null!=a?a:null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.columns,dataLength:n,pivotDataLength:o,isDataLimited:r});return t&&s.includes(t)},Ba=function(e,t){var n=e.find((function(e){return Na(e)}));return n||t},Ha=function(t,n,o,a,r,i,l){var s,c,u=_a({response:t,columns:null!=o?o:null==t||null===(s=t.data)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.columns,dataLength:a,pivotDataLength:r,isDataLimited:l});if(i&&u.includes(i))return i;var d=e(t,"data.data.display_type");if(u.includes(i))return i;if("suggestion"===d||"help"===d||"html"===d)return d;if(1===u.length)return u[0];if(u.includes("pivot_table")){var p="pivot_table";return n&&(p=Ao(e(t,"data.data.columns"))?Ba(u,"pivot_table"):"pivot_table"),p}if(!d&&function(t){return!!t&&(e(t,"data.data.rows.length")&&e(t,"data.data.rows.length"))}(t)||"data"===d){var m="table";return n&&(m=Ao(e(t,"data.data.columns"))?Ba(u,"table"):"table"),m}return"text"},Qa=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},za=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},Ua=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)}},ja=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(kn.includes(e.trim())){var a=kn.findIndex((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())})),r=kn.findIndex((function(e){return e.toLowerCase().includes(t.trim().toLowerCase())})),i=e-t;return a>=0&&r>=0&&(i=a-r),i}if(wn.includes(e.trim())){var l=wn.findIndex((function(t){return t===e.trim()})),s=wn.findIndex((function(e){return e===t.trim()}));return l>=0&&s>=0?s-l:e-t}if(Pn.includes(e.substr(0,2))){var c=Pn.findIndex((function(t){return t===e.substr(0,2)})),u=Pn.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},Ka=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(n.precision){case"DOW":var a,r=null!==(a=n.dow_style)&&void 0!==a?a:"ALPHA_MON",i=kn.findIndex((function(t){return t.toLowerCase().includes(e.toLowerCase())})),l=kn.findIndex((function(e){return e.toLowerCase().includes(t.toLowerCase())}));return"ALPHA_SUN"===r&&(i=In.findIndex((function(t){return t.toLowerCase().includes(e.toLowerCase())})),l=In.findIndex((function(e){return e.toLowerCase().includes(t.toLowerCase())}))),i-l;case"HOUR":case"MINUTE":var s=o.utc(e,"THH:mm:ss.SSSZ").utc(),c=o.utc(t,"THH:mm:ss.SSSZ").utc();return s.unix()-c.unix();case"MONTH":var u=wn.findIndex((function(t){return t.toLowerCase()===e.trim().toLowerCase()})),d=wn.findIndex((function(e){return e.toLowerCase()===t.trim().toLowerCase()}));return u-d;default:return ja(e,t)}return e-t},Ya=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?Ka(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}},Wa=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"!==wt(e))throw new Error("Could not sort data by date - no data supplied");var a=Lo(t),r=t[a];if(a>=0){var i="desc"===n?-1:1,l=zt(e).sort((function(e,t){return i*Ya(e[a],t[a],r,o)}));return l}}catch(e){console.error(e)}return e},Ga=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()},Xa=function(){return new Promise((function(e){setTimeout(e,0)}))},Ja=function(e){return"object"===wt(e)&&!Array.isArray(e)&&null!=e},Za=function(e,t){var o=n(e,t);if(o)return!0;var a=Ja(e),r=Ja(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},$a=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0,document.addEventListener("keydown",a.onEscKeypress)})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){return(!a.props.isResizing||!e.isResizing)&&(!Za(a.props,e)||!Za(a.state,t))})),Ot(Bt(a),"componentDidUpdate",(function(e){a.props.inputValue!==e.inputValue&&a.setState({inputValue:a.props.inputValue})})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.queryValidationTimer),clearTimeout(a.caretMoveTimeout),document.removeEventListener("keydown",a.onEscKeypress)})),Ot(Bt(a),"onEscKeypress",(function(e){"Escape"===e.key&&(!(e.ctrlKey||e.altKey||e.shiftKey)&&a.cancelQuery())})),Ot(Bt(a),"animateInputTextAndSubmit",(function(e){var t=e.query,n=e.userSelection,o=e.source,r=e.skipQueryValidation;Ga({text:t,inputRef:a.inputRef,callback:function(){a.submitQuery({queryText:t,userSelection:n,skipQueryValidation:null==r||r,source:o})}})})),Ot(Bt(a),"submitDprQuery",(function(e){var t,n;(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={},Ot(t,"AutoAE-Referer-URL",window.location.origin),Ot(t,"AutoAE-Session-ID",r||b()),t)};return m.post(i,l,s)})({dprKey:null===(t=a.props.authentication)||void 0===t?void 0:t.dprKey,dprDomain:null===(n=a.props.authentication)||void 0===n?void 0:n.dprDomain,query:e,sessionId:a.props.sessionId}).then((function(t){return a.onResponse(t,e)})).catch((function(t){console.error(t),a.onResponse(t,e)}))})),Ot(Bt(a),"onResponse",(function(e,t){var n;a.props.onResponseCallback(e,t);var o={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(n=a.state)||void 0===n?void 0:n.lastQuery)};a._isMounted&&a.setState(o)})),Ot(Bt(a),"cancelQuery",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(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:[],queryValidationResponse:void 0,queryValidationComponentId:b()};a.props.clearQueryOnSubmit&&(s.inputValue=""),a._isMounted&&a.setState(s);var c=a.props.source;null!=i&&i.length?c=[].concat(zt(a.props.source),zt(i)):i&&c.push("user"),a.axiosSource=null===(e=m.CancelToken)||void 0===e?void 0:e.source();var u,d,p=xt(xt(xt({query:l,userSelection:o},Yn(a.props.authentication)),Gn(a.props.autoQLConfig)),{},{source:c,AutoAEId:a.props.AutoAEId,filters:a.props.queryFilters,pageSize:a.props.dataPageSize,cancelToken:a.axiosSource.token});if(l.trim())a.props.onSubmit(l),localStorage.setItem("inputValue",l),null!==(u=a.props.authentication)&&void 0!==u&&u.token||null===(d=a.props.authentication)||void 0===d||!d.dprKey?r?oo(p).then((function(e){return a.onResponse(e,l)})).catch((function(e){var t=e||{error:Yt.GENERAL_QUERY};a.onResponse(t,l)})):ro(p).then((function(e){return a.onResponse(e,l)})).catch((function(e){var t=e||{error:Yt.GENERAL_QUERY};a.onResponse(t,l)})):a.submitDprQuery(l)}})),Ot(Bt(a),"onTranscriptStart",(function(){a.setState({listeningForTranscript:!0})})),Ot(Bt(a),"onTranscriptChange",(function(e){a.setState({inputValue:e})})),Ot(Bt(a),"onFinalTranscript",(function(e){a.setState({inputValue:e,listeningForTranscript:!1},(function(){a.focus(),En()}))})),Ot(Bt(a),"setInputRef",(function(e){a.inputRef=e})),Ot(Bt(a),"onKeyDown",(function(t){if("ArrowUp"!==t.key||e(a.state.suggestions,"length")){if(a.userSelectedSuggestion&&("ArrowUp"===t.key||"ArrowDown"===t.key))return t}else{var n=localStorage.getItem("inputValue");n&&"undefined"!==n&&a.setState({inputValue:n},a.moveCaretAtEnd)}return t})),Ot(Bt(a),"onKeyPress",(function(e){"Enter"==e.key&&a.submitQuery()})),Ot(Bt(a),"focus",(function(){var e;null!==(e=a.inputRef)&&void 0!==e&&e.focus&&a.inputRef.focus()})),Ot(Bt(a),"userSelectedSuggestionHandler",(function(e){e&&e.name&&a._isMounted&&(a.userSelectedValue=e.name,a.userSelectedSuggestion=!0,a.setState({inputValue:e.name}))})),Ot(Bt(a),"onSuggestionsFetchRequested",(function(t){var n=t.value;a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer),a.autoCompleteTimer=setTimeout((function(){lo(xt({suggestion:n},Yn(a.props.authentication))).then((function(t){var n,o=e(t,"data.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)})),Ot(Bt(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),Ot(Bt(a),"onInputChange",(function(e){a.state.listeningForTranscript?e.stopPropagation():Gn(a.props.autoQLConfig).enableAutocomplete?(!a.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(e&&e.target&&(e.target.value||""===e.target.value)?a.setState({inputValue:e.target.value}):a.submitQuery({queryText:a.userSelectedValue}),a.props.isBackButtonClicked&&a.setState({inputValue:""})):a.setState({inputValue:e.target.value})})),Ot(Bt(a),"moveCaretAtEnd",(function(e){clearTimeout(a.caretMoveTimeout),a.caretMoveTimeout=setTimeout((function(){try{var e,t,n,o=null===(e=a.inputRef)||void 0===e||null===(t=e.value)||void 0===t?void 0:t.length;null===(n=a.inputRef)||void 0===n||n.setSelectionRange(o,o)}catch(e){}}),0)})),Ot(Bt(a),"render",(function(){var e={ref:a.setInputRef,className:"".concat(a.UNIQUE_ID," 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,spellCheck:!1,autoFocus:!0};return f.createElement(Kt,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"},Gn(a.props.autoQLConfig).enableAutocomplete?f.createElement(mt,{onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,getSuggestionValue:a.userSelectedSuggestionHandler,suggestions:a.state.suggestions,ref:function(e){a.autoSuggest=e},renderSuggestion:function(e){return f.createElement(v,null,e.name)},inputProps:e}):f.createElement("input",e)),a.props.showChataIcon&&f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(bn,{type:"react-autoql-bubbles-outlined"})),a.props.showLoadingDots&&a.state.isQueryRunning&&f.createElement("div",{className:"input-response-loading-container"},f.createElement(No,null)),a.props.enableVoiceRecord&&f.createElement(ho,{onTranscriptStart:a.onTranscriptStart,onTranscriptChange:a.onTranscriptChange,onFinalTranscript:a.onFinalTranscript,authentication:a.props.authentication,tooltipID:a.props.tooltipID})))})),a.UNIQUE_ID=b(),a.autoCompleteTimer=void 0,a.autoCompleteArray=[],a.state={inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1,listeningForTranscript:!1},a}return Pt(o)}();Ot($a,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,enableVoiceRecord:y.bool,isDisabled:y.bool,onSubmit:y.func,onResponseCallback:y.func,className:y.string,autoCompletePlacement:y.string,showLoadingDots:y.bool,showChataIcon:y.bool,inputValue:y.string,queryFilters:y.arrayOf(y.shape({})),placeholder:y.string,clearQueryOnSubmit:y.bool,sessionId:y.string,dataPageSize:y.number,shouldRender:y.bool}),Ot($a,"defaultProps",{authentication:Un,autoQLConfig:Kn,dataFormatting:jn,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,placeholder:"Type your queries here",dataPageSize:void 0,shouldRender:!0,onSubmit:function(){},onResponseCallback:function(){}});var er=wo($a),tr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",At(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o._isMounted=!0,o.instantiateTabulator();case 2:case"end":return e.stop()}}),e)})))),Ot(Bt(o),"shouldComponentUpdate",(function(){return!1})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.isInitialized=!1,setTimeout((function(){o.tabulator.destroy()}),1e3)})),Ot(Bt(o),"instantiateTabulator",(function(){var e;o.tabulator=new Me(o.tableRef,xt(xt({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",At(Rt().mark((function e(){var t;return Rt().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)}))))})),Ot(Bt(o),"blockRedraw",(function(e){var t;o.isInitialized&&(o.redrawRestored=!1,null===(t=o.tabulator)||void 0===t||t.blockRedraw())})),Ot(Bt(o),"restoreRedraw",(function(e){o.tabulator&&o.isInitialized&&!o.redrawRestored&&o._isMounted&&(o.redrawRestored=!0,o.tabulator.restoreRedraw())})),Ot(Bt(o),"updateData",(function(e){var t,n;o.props.hidden?setTimeout((function(){var t,n;null===(t=o.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setData(e)}),0):null===(t=o.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setData(e)})),Ot(Bt(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=b(),o.tableRef=f.createRef(),o.tabulator=null,o.redrawRestored=!0,o.defaultOptions={height:o.props.height||"100%",reactiveData:!1,autoResize:!1,rowHeight:25,layout:"fitDataFill",clipboard:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1}},o}return Pt(n)}();Ot(tr,"propTypes",{tableKey:y.string,options:y.shape({}),onDataLoadError:y.func,onTableBuilt:y.func,onCellClick:y.func,onDataSorting:y.func,onDataSorted:y.func,onDataFiltering:y.func,onDataFiltered:y.func}),Ot(tr,"defaultProps",{tableKey:void 0,options:{},onDataLoadError:function(){},onTableBuilt:function(){},onCellClick:function(){},onDataSorting:function(){},onDataSorted:function(){},onDataFiltering:function(){},onDataFiltered:function(){}});var nr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.precision;return t===Mn||t===Ln?t:On},or=function(e){switch(e){case On:return"day";case Mn:return"month";case Ln:return"year";case qn:return"week";case Vn:return"quarter";case Bn:case _n:return"hour";case Hn:case Fn:return"minute";default:return"day"}},ar=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 function(e){if(!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(e))return!1;var t=new Date(e);return t instanceof Date&&!isNaN(t)&&t.toISOString()===e}(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]=xt(xt({},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:[]},rr=function(e,t,n){return{sorters:ir(e,t,n),filters:lr(e,t,n),page:null==e?void 0:e.page}},ir=function(e,t,n){var o,a=[];return(null==e||null===(o=e.sort)||void 0===o?void 0:o.length)>0&&t&&e.sort.forEach((function(e){try{var t=null==n?void 0:n[Number(e.field)];if(t){var o=t.name,r=e.dir.toUpperCase();o&&r&&a.push({name:o,sort:r})}}catch(e){console.error(e)}})),a},lr=function(e,t,n){var a,r=[];return(null==e||null===(a=e.filter)||void 0===a?void 0:a.length)>0&&t&&e.filter.forEach((function(e){try{var t=null==n?void 0:n[Number(e.field)];if(t){var a={name:t.name,value:e.value,operator:"like"};if(ko(t)){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);a.operator=i.operator,a.value=i.value}else if("DATE"===t.type){var l,s=e.value.split(" to "),c=or(t.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();a.value="".concat(u,",").concat(d),a.operator="between"}r.push(a)}}catch(e){console.warn(e)}})),r};function sr(e){return f.createElement(Kt,null,f.createElement("div",Mt({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}var cr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;kt(this,n),Ot(Bt(a=t.call(this,e)),"selectedRangeIncludesMonth",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"month")})),Ot(Bt(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})})),Ot(Bt(a),"handleMonthClick",(function(e){"start"===a.state.focusedDateDisplay?a.onMonthStartSelection(e):a.onMonthEndSelection(e)})),Ot(Bt(a),"incrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)+1)})})),Ot(Bt(a),"decrementYear",(function(){a.setState({visibleYear:"".concat(Number(a.state.visibleYear)-1)})})),Ot(Bt(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()})})),Ot(Bt(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)}})),Ot(Bt(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:"rdrDateInput 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:"rdrDateInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),Ot(Bt(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)))})),Ot(Bt(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}})),Ot(Bt(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}})),Ot(Bt(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})),Ot(Bt(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))))})))})))})),Ot(Bt(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=b();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 Pt(n)}();Ot(cr,"propTypes",{minDate:y.instanceOf(Date),maxDate:y.instanceOf(Date),initialRange:y.shape({startDate:y.instanceOf(Date),endDate:y.instanceOf(Date)}),onRangeSelection:y.func}),Ot(cr,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var ur=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;kt(this,n),Ot(Bt(a=t.call(this,e)),"getDecade",(function(e){var t=e-e%10;return[t,t+9]})),Ot(Bt(a),"isInDecade",(function(e,t){return e>=t[0]&&e<=t[1]})),Ot(Bt(a),"selectedRangeIncludesYear",(function(e){return!(!a.state.selectedStart||!a.state.selectedEnd)&&e.isBetween(a.state.selectedStart,a.state.selectedEnd,"year")})),Ot(Bt(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})})),Ot(Bt(a),"handleYearClick",(function(e){"start"===a.state.focusedDateDisplay?a.onYearStartSelection(e):a.onYearEndSelection(e)})),Ot(Bt(a),"incrementDecade",(function(){var e=a.state.visibleDecade[1];a.setState({visibleDecade:[e+1,e+10]})})),Ot(Bt(a),"decrementDecade",(function(){var e=a.state.visibleDecade[0];a.setState({visibleDecade:[e-10,e-1]})})),Ot(Bt(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()})})),Ot(Bt(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)}})),Ot(Bt(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:"rdrDateInput 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:"rdrDateInput rdrDateDisplayItem ".concat("end"===a.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return a.setState({focusedDateDisplay:"end"})}}))))})),Ot(Bt(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;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)))})),Ot(Bt(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}})),Ot(Bt(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}})),Ot(Bt(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})),Ot(Bt(a),"renderYearGrid",(function(){var e=a.state.visibleDecade,t=new Array(10).fill(e[0]).map((function(e,t){return e+t})),n=[zt(t.slice(0,3)),zt(t.slice(3,6)),zt(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))))})))})))})),Ot(Bt(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=b();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 Pt(n)}();Ot(ur,"propTypes",{minDate:y.instanceOf(Date),maxDate:y.instanceOf(Date),initialRange:y.shape({startDate:y.instanceOf(Date),endDate:y.instanceOf(Date)}),onRangeSelection:y.func}),Ot(ur,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var dr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o,a,r,i,l,s,c,u,d;return kt(this,n),Ot(Bt(d=t.call(this,e)),"handleSelect",(function(e){d.setState({selectedRange:e.selection},(function(){d.props.onSelection(e.selection)}))})),Ot(Bt(d),"renderDatePicker",(function(){switch(d.props.type){case Mn:var e,t;return f.createElement(cr,{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 Ln:var n,o;return f.createElement(ur,{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(Le,{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})}})),Ot(Bt(d),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker"},d.renderDatePicker())})),d.accentColor=So("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 Pt(n)}();Ot(dr,"propTypes",{initialRange:y.shape({}),validRange:y.shape({}),type:y.string}),Ot(dr,"defaultProps",{initialRange:void 0,validRange:void 0,type:On});var pr=["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"],mr=["default","primary","danger"],fr=["small","large"],gr=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"COMPONENT_KEY","react-autoql-btn-".concat(b())),Ot(Bt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(mr.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),Ot(Bt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(fr.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),Ot(Bt(e),"render",(function(){var t,n=e.getType(),o=e.getSize(),a=e.props.loading||e.props.disabled;return f.createElement(Kt,null,f.createElement("button",{className:"react-autoql-btn\n ".concat(e.props.className||"","\n ").concat(n,"\n ").concat(o,"\n ").concat(a?" disabled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:xt({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":null!==(t=e.props.tooltipID)&&void 0!==t?t:e.COMPONENT_KEY},e.props.loading&&f.createElement(sr,{"data-test":"react-autoql-btn-loading"}),e.props.children))})),e}return Pt(n)}();Ot(gr,"propTypes",{type:y.oneOf(mr),size:y.oneOf(fr),onClick:y.func,loading:y.bool,disabled:y.bool,multiline:y.bool,tooltip:y.string}),Ot(gr,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var vr=function(t){Lt(r,f.Component);var a=Qt(r);function r(t){var i,l,s,c,u;return kt(this,r),Ot(Bt(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})})),Ot(Bt(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||Za(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)&&(!Za(u.props,e)||!Za(u.state,t))))))})),Ot(Bt(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}})),Ot(Bt(u),"componentDidUpdate",(function(e,t,n){var o,a,r,i,l=n.shouldSetTableHeight,s=n.newTableHeight;(l&&u.setTableHeight(s),!u.props.hidden&&e.hidden)&&(u.state.subscribedData?(null===(o=u.ref)||void 0===o||o.updateData(u.state.subscribedData),u.setState({subscribedData:void 0})):null===(a=u.ref)||void 0===a||a.restoreRedraw());u.props.columns&&!Za(u.props.columns,e.columns)&&(null===(r=u.ref)||void 0===r||null===(i=r.tabulator)||void 0===i||i.setColumns(u.getFilteredTabulatorColumnDefinitions()),u.setHeaderInputClickListeners());if(u.state.tabulatorMounted&&!t.tabulatorMounted&&(u.setFilterTags(),u.setHeaderInputClickListeners(),u.props.hidden||u.setTableHeight(),u.hasSetInitialParams=!0),!u.state.isFiltering&&t.isFiltering)try{u.setFilterTags()}catch(e){console.error(e),u.props.onErrorCallback(e)}})),Ot(Bt(u),"componentWillUnmount",(function(){try{u._isMounted=!1,clearTimeout(u.clickListenerTimeout),clearTimeout(u.setDimensionsTimeout),clearTimeout(u.setStateTimeout),u.cancelCurrentRequest(),u.resetFilterTags(),u.existingFilterTag=void 0,u.filterTagElements=void 0}catch(e){console.error(e)}})),Ot(Bt(u),"updateData",(function(e){var t;null===(t=u.ref)||void 0===t||t.updateData(e)})),Ot(Bt(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))}})),Ot(Bt(u),"onDataSorted",(function(e,t){u.isSorting&&(u.isSorting=!1,!u.supportsInfiniteScroll&&u.ref&&u.props.onSorterCallback(e),u.setLoading(!1))})),Ot(Bt(u),"onDataFiltering",(function(){if(u._isMounted&&u.state.tabulatorMounted){var e,t,o,a=null===(e=u.ref)||void 0===e||null===(t=e.tabulator)||void 0===t?void 0:t.getHeaderFilters();a&&!n(a,null===(o=u.tableParams)||void 0===o?void 0:o.filter)&&(u.isFiltering=!0,u.setLoading(!0))}})),Ot(Bt(u),"onDataFiltered",(function(e,t){if(u.isFiltering&&u.state.tabulatorMounted){var n,o;u.isFiltering=!1;var a=null===(n=u.ref)||void 0===n||null===(o=n.tabulator)||void 0===o?void 0:o.getHeaderFilters();u.supportsInfiniteScroll||(u.tableParams.filter=C(a),u.props.onFilterCallback(a,t)),setTimeout((function(){u.setState({loading:!1})}),0)}})),Ot(Bt(u),"setLoading",(function(e){e!==u.state.loading&&u.setState({loading:e})})),Ot(Bt(u),"isLoading",(function(){return u.state.loading||u.state.firstRender||u.state.pageLoading||u.state.scrollLoading||u.isFiltering||u.isSorting||!u.hasSetInitialParams})),Ot(Bt(u),"onTableBuilt",At(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u.setState({tabulatorMounted:!0,pageLoading:!1});case 1:case"end":return e.stop()}}),e)})))),Ot(Bt(u),"setTableHeight",(function(e){if(u.state.tabulatorMounted&&u.tabulatorContainer&&!u.props.isAnimating&&!u.props.isResizing&&!u.props.hidden){var t,n,o=null!=e?e:u.tabulatorContainer.clientHeight;if(o&&o!==u.lockedTableHeight)null===(t=u.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setHeight(o),u.lockedTableHeight=o,"100%"!==e&&(u.hasSetTableHeight=!0)}})),Ot(Bt(u),"cancelCurrentRequest",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(u),"ajaxRequesting",(function(e,t){})),Ot(Bt(u),"ajaxRequestFunc",function(){var t=At(Rt().mark((function t(o,a){var r,i,l,s,c,d,p,f,g,v,h;return Rt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,u.hasSetInitialData){t.next=4;break}return u.hasSetInitialData=!0,t.abrupt("return",xt(xt({},e(u.props.response,"data.data",{})),{},{page:1}));case 4:if(s=rr(u.tableParams,null===(r=u.ref)||void 0===r?void 0:r.tabulator,o.columns),c=rr(a,null===(i=u.ref)||void 0===i?void 0:i.tabulator,o.columns),!n(s,c)){t.next=8;break}return t.abrupt("return");case 8:if(u.tableParams=a,o.queryRequestData){t.next=12;break}return console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),t.abrupt("return");case 12:if(u.cancelCurrentRequest(),u.axiosSource=null===(l=m.CancelToken)||void 0===l?void 0:l.source(),!((null==a?void 0:a.page)>1)){t.next=22;break}return u.setState({scrollLoading:!0}),t.next=18,u.getNewPage(o,c);case 18:d=t.sent,u.props.onNewPage(null===(p=d)||void 0===p?void 0:p.rows),t.next=32;break;case 22:return u.setState({pageLoading:!0}),t.next=25,o.queryFn({tableFilters:null==c?void 0:c.filters,orders:null==c?void 0:c.sorters});case 25:return v=t.sent,u.queryID=null==v||null===(f=v.data)||void 0===f||null===(g=f.data)||void 0===g?void 0:g.query_id,d=xt(xt({},e(v,"data.data",{})),{},{page:1}),t.next=30,Xa();case 30:u.props.onTableParamsChange(a,c),u.props.onNewData(v);case 32:return u.clearLoadingIndicators(),t.abrupt("return",d);case 36:if(t.prev=36,t.t0=t.catch(0),(null===t.t0||void 0===t.t0||null===(h=t.t0.data)||void 0===h?void 0:h.message)!==Wt.CANCELLED){t.next=40;break}return t.abrupt("return");case 40:return console.error(t.t0),u.clearLoadingIndicators(),t.abrupt("return");case 43:case"end":return t.stop()}}),t,null,[[0,36]])})));return function(e,n){return t.apply(this,arguments)}}()),Ot(Bt(u),"clearLoadingIndicators",At(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xa();case 2:u._isMounted&&u.setState({loading:!1,scrollLoading:!1,pageLoading:!1});case 3:case"end":return e.stop()}}),e)})))),Ot(Bt(u),"getNewPage",(function(t,n){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,o=t.domain,a=t.apiKey,r=t.token,i=t.page,l=t.cancelToken,s="".concat(o,"/autoql/api/v1/query/").concat(n,"/page?key=").concat(a,"&page=").concat(i);if(!n)return Promise.reject({error:"No query ID supplied"});if(!a||!o||!r)return Promise.reject({error:"Unauthenticated"});var c={date_format:"ISO8601"},u={headers:{Authorization:"Bearer ".concat(r)},cancelToken:l};return m.post(s,c,u).then((function(t){if(t.data&&"string"==typeof t.data)throw new Error("Parse error");return Promise.resolve(xt(xt({},e(t,"data.data",{})),{},{page:i}))})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):"Parse error"===t.message?Promise.reject({error:"Parse error"}):401!==t.response&&e(t,"response.data")?Promise.reject(e(t,"response")):Promise.reject({error:"Unauthenticated"})}))}(xt(xt(xt({},Yn(t.authentication)),n),{},{queryId:u.queryID,cancelToken:u.axiosSource.token}))})),Ot(Bt(u),"ajaxResponseFunc",(function(t,n){var o;if(null===(o=u.ref)||void 0===o||o.restoreRedraw(),n){u.currentPage=n.page;var a=e(n,"rows.length",0)<t.pageSize;u.lastPage=a?u.currentPage:u.currentPage+1,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}})),Ot(Bt(u),"cellClick",(function(e,t){u.props.onCellClick(t)})),Ot(Bt(u),"copyToClipboard",(function(){var e;u._isMounted&&null!==(e=u.ref)&&void 0!==e&&e.tabulator&&u.ref.tabulator.copyToClipboard("active",!0)})),Ot(Bt(u),"saveAsCSV",(function(e){try{var t;if(u._isMounted&&null!==(t=u.ref)&&void 0!==t&&t.tabulator){var n=C(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()})),Ot(Bt(u),"debounceSetState",(function(e){u.stateToSet=xt(xt({},u.stateToSet),e),clearTimeout(u.setStateTimeout),u.setStateTimeout=setTimeout((function(){u.setState(u.stateToSet),u.stateToSet={}}),50)})),Ot(Bt(u),"inputKeydownListener",(function(){var e;u.supportsInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),Ot(Bt(u),"inputSearchListener",(function(){var e;u.supportsInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),Ot(Bt(u),"inputDateSearchListener",(function(){u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0})})),Ot(Bt(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})})),Ot(Bt(u),"inputDateKeypressListener",(function(e){e.stopPropagation(),e.preventDefault()})),Ot(Bt(u),"setHeaderInputClickListeners",(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),t.removeEventListener("search",u.inputSearchListener),t.addEventListener("search",u.inputSearchListener),"DATE"===e.type&&!e.pivot)){t.removeEventListener("search",u.inputDateSearchListener),t.addEventListener("search",u.inputDateSearchListener),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)}))}}))})),Ot(Bt(u),"resetFilterTags",(function(){var e,t=null===(e=u.tableContainer)||void 0===e?void 0:e.querySelectorAll("#react-autoql-table-container-".concat(u.TABLE_ID," .filter-tag"));null!=t&&t.length&&t.forEach((function(e){try{e.parentNode&&u._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),Ot(Bt(u),"setFilterTags",(function(){var e;u.resetFilterTags();var t=null===(e=u.tableParams)||void 0===e?void 0:e.filter;t&&t.forEach((function(e,t){try{var n=document.createElement("span");n.innerText="F",n.setAttribute("class","filter-tag");var o=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-title'));o.insertBefore(n,o.firstChild)}catch(e){console.error(e),u.props.onErrorCallback(e)}}))})),Ot(Bt(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,a,r;if(null===(n=u.ref)||void 0===n||null===(o=n.tabulator)||void 0===o||o.setHeaderFilterValue(e.field,e.value),!u.supportsInfiniteScroll)null===(a=u.ref)||void 0===a||null===(r=a.tabulator)||void 0===r||r.setFilter(e.field,e.type,e.value)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingFilterInputs=!1})),Ot(Bt(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,c=nr(e),d=Qn[c],p=o(r).format(d),m=o.utc(p).toISOString(),f=o(m).utc().format(d),g=o(i).format(d),v=o.utc(g).toISOString(),h=o(v).utc().format(d),y="".concat(f," to ").concat(h);f===h&&(y=f),l.focus(),null===(s=u.ref)||void 0===s||s.restoreRedraw(),l.value=y,l.title=y,l.blur(),u.currentDateRangeSelections=Ot({},e.field,u.state.dateRangeSelection)}}}})),Ot(Bt(u),"onDateRangeSelection",(function(e){u.setState({dateRangeSelection:e})})),Ot(Bt(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,o;null===(n=u.ref)||void 0===n||null===(o=n.tabulator)||void 0===o||o.setSort(e.field,e.dir)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingSorters=!1})),Ot(Bt(u),"toggleIsFiltering",(function(){var e=!u.state.isFiltering;return u.setState({isFiltering:e}),e})),Ot(Bt(u),"renderEmptyPlaceholderText",(function(){return f.createElement("div",{className:"table-loader table-page-loader table-placeholder"},f.createElement("div",null,"No results"))})),Ot(Bt(u),"renderPageLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(sr,null)))})),Ot(Bt(u),"renderScrollLoader",(function(){return f.createElement("div",{className:"table-loader table-scroll-loader"},f.createElement(sr,null))})),Ot(Bt(u),"renderDatePickerPopover",(function(){var e,t,n;return u.state.datePickerColumn?f.createElement(Re,{isOpen:!!u.state.datePickerColumn,align:"start",positions:["bottom","right","left","top"],onClickOutside:function(e){e.stopPropagation(),u.setState({datePickerColumn:void 0})},content:f.createElement("div",{className:"react-autoql-table-date-picker"},f.createElement("h3",null,u.state.datePickerColumn.display_name),f.createElement(dr,{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(gr,{type:"primary",onClick:u.onDateRangeSelectionApplied,tooltipID:u.props.tooltipID},"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})),Ot(Bt(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){pr.includes(n)&&(t[n]=e[n])})),t}))}catch(e){console.error(e)}return[]})),Ot(Bt(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.props.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")))})),Ot(Bt(u),"getTabulatorRowCount",(function(){var e,t;return null===(e=u.ref)||void 0===e||null===(t=e.tabulator)||void 0===t?void 0:t.getDataCount("active")})),Ot(Bt(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)})),Ot(Bt(u),"render",(function(){var e=u.isTableEmpty();return f.createElement(Kt,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.supportsInfiniteScroll?"infinite":"limited","\n ").concat(u.supportsInfiniteScroll&&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(tr,{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.renderDatePickerPopover(),!e&&u.renderTableRowCount()))})),u.TABLE_ID=b(),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.supportsInfiniteScroll=t.useInfiniteScroll&&!!t.pageSize,u.isFiltering=!1,u.isSorting=!1,u.tableParams=null!==(l=C(t.initialParams))&&void 0!==l?l:{filter:[],sort:[]},u.tableOptions={selectableCheck:function(){return!1},initialSort:u.supportsInfiniteScroll||null===(s=u.tableParams)||void 0===s?void 0:s.sort,initialFilter:u.supportsInfiniteScroll||null===(c=u.tableParams)||void 0===c?void 0:c.filter,progressiveLoadScrollMargin:100,downloadEncoder:function(e,t){return new Blob([e],{type:t})}},u.supportsInfiniteScroll&&(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 Pt(r)}();Ot(vr,"propTypes",{data:y.arrayOf(y.array),columns:y.arrayOf(y.shape({})),shouldRender:y.bool,onFilterCallback:y.func,onSorterCallback:y.func,onTableParamsChange:y.func,isResizing:y.bool,pageSize:y.number,useInfiniteScroll:y.bool,onSetTableHeight:y.func}),Ot(vr,"defaultProps",{queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:void 0,useInfiniteScroll:!0,source:[],shouldRender:!0,autoHeight:!0,onFilterCallback:function(){},onSorterCallback:function(){},onTableParamsChange:function(){},onCellClick:function(){},onErrorCallback:function(){},onSetTableHeight:function(){}});var hr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"render",(function(){return f.createElement("rect",Mt({},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 Pt(n)}(),yr=["label","type","indeterminate","hasError","style","onChange","checked"],br=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"ID",b()),Ot(Bt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),Ot(Bt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),Ot(Bt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),Ot(Bt(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=Ft(t,yr),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(Kt,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",Mt({},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(bn,{type:"check"})),n&&f.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return Pt(n)}();Ot(br,"propTypes",{hasError:y.bool,indeterminate:y.bool,label:y.string,type:y.oneOf(["default","switch"]),checked:y.bool,onChange:y.func}),Ot(br,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Cr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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})})),Ot(Bt(o),"unselectAll",(function(){o.setState({selected:[]})})),Ot(Bt(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})),Ot(Bt(o),"handleShiftSelect",(function(e,t){if(o.state.selected.length){var n=Math.min.apply(Math,zt(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 xt({},o.props.items[e])}));o.props.onSelect(a,r),o.setState({selected:a})}else o.props.onSelect([e],[t]),o.setState({selected:[e]})})),Ot(Bt(o),"handleCtrlSelect",(function(e){var t=[];t=o.state.selected.includes(e)?o.state.selected.filter((function(t){return t!==e})):[].concat(zt(o.state.selected),[e]),o.props.onSelect(t),o.setState({selected:t})})),Ot(Bt(o),"checkAll",(function(){var e=o.props.items.map((function(e){return xt(xt({},e),{},{checked:!e.disabled||e.checked})}));o.props.onChange(e,e,!0)})),Ot(Bt(o),"unCheckAll",(function(){var e=o.props.items.map((function(e){return xt(xt({},e),{},{checked:!!e.disabled&&e.checked})}));o.props.onChange(e,e,!1)})),Ot(Bt(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,xt(xt({},e),{},{checked:!1})):t.includes(o)?xt(xt({},e),{},{checked:!0}):e}));o.props.onChange(r,t,a)})),Ot(Bt(o),"render",(function(){var e,t=o.props.items;return f.createElement(Kt,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(br,{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",null,e.content),f.createElement("div",null,f.createElement(br,{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?xt(xt({},e),{},{checked:!e.checked}):e}));o.props.onChange(a,[e],!e.checked)}}})))}))))})),o.KEY=b(),o.state={selected:[]},o}return Pt(n)}();Ot(Cr,"propTypes",{columns:y.arrayOf(y.shape({})),items:y.arrayOf(y.shape({}))}),Ot(Cr,"defaultProps",{onChange:function(){},onSelect:function(){},columns:[],items:[]});var Er=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1})),Ot(Bt(o),"getView",(function(){var e;return null===(e=o.ref)||void 0===e?void 0:e.view})),Ot(Bt(o),"getClassName",(function(){return"react-autoql-custom-scrollbars ".concat(o.props.className||"")})),Ot(Bt(o),"renderThumbHorizontal",(function(e){return f.createElement("div",Mt({},e,{className:"thumb-horizontal"}))})),Ot(Bt(o),"renderThumbVertical",(function(e){return f.createElement("div",Mt({},e,{className:"thumb-vertical"}))})),Ot(Bt(o),"renderView",(function(e){return f.createElement("div",Mt({},e,{className:"custom-scrollbar-view"}))})),Ot(Bt(o),"render",(function(){var e,t;return f.createElement(Pe,{ref:function(e){return o.ref=e},className:o.getClassName(),style:o.props.style,renderView:o.renderView,autoHide:o.props.autoHide,autoHeight:o.props.autoHeight,autoHeightMin:null!==(e=o.props.autoHeightMin)&&void 0!==e?e:100,autoHeightMax:null!==(t=o.props.autoHeightMax)&&void 0!==t?t:"100%",renderThumbVertical:o.renderThumbVertical,renderThumbHorizontal:o.renderThumbHorizontal},o.props.children)})),o.viewRef=f.createRef(),o}return Pt(n)}();Ot(Er,"propTypes",{autoHeight:y.bool,autoHide:y.bool,style:y.shape({})}),Ot(Er,"defaultProps",{autoHeight:!1,autoHide:!0,style:{}});var Sr=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"ID",b()),Ot(Bt(t),"state",{isOpen:!1}),Ot(Bt(t),"componentDidMount",(function(){t.props.rebuildTooltips()})),Ot(Bt(t),"componentDidUpdate",(function(e,n){t.state.isOpen!==n.isOpen&&(En(),t.props.rebuildTooltips()),t.props.value!==e.value&&t.props.rebuildTooltips()})),Ot(Bt(t),"renderSelect",(function(){return f.createElement("div",{className:"react-autoql-select ".concat(t.props.className),"data-test":"react-autoql-select",onClick:function(e){t.setState({isOpen:!t.state.isOpen})},style:t.props.style,"data-tip":t.props.tooltip,"data-for":t.props.tooltipID,"data-offset":10,"data-delay-show":500},e(t.props.options.find((function(e){return e.value===t.props.value})),"label")||e(t.props.options.find((function(e){return e.value===t.props.value})),"value",f.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item")))})),Ot(Bt(t),"renderPopoverContent",(function(){return f.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},!t.props.tooltipID&&f.createElement(Sn,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-tooltip",effect:"solid",delayShow:500}),f.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){var n;return f.createElement("li",{key:"select-option-".concat(t.ID,"-").concat(e.value),className:"react-autoql-select-option".concat(e.value===t.props.value?" active":""),onClick:function(){t.setState({isOpen:!1}),t.props.onChange(e.value)},"data-tip":e.tooltip||null,"data-for":null!==(n=t.props.tooltipID)&&void 0!==n?n:"select-tooltip-".concat(t.ID),"data-offset":10},e.listLabel||e.label)}))))})),Ot(Bt(t),"render",(function(){var e;return t.props.options?f.createElement(Kt,null,f.createElement(Re,{id:"select-popover-".concat(t.ID),key:"select-popover-".concat(t.ID),isOpen:t.state.isOpen,positions:null!==(e=t.props.positions)&&void 0!==e?e:["bottom","top","left","right"],align:t.props.align,padding:0,parentElement:t.props.popoverParentElement,boundaryElement:t.props.popoverBoundaryElement,onClickOutside:function(){return t.setState({isOpen:!1})},content:t.renderPopoverContent()},t.renderSelect())):null})),t}return Pt(o)}();Ot(Sr,"propTypes",{onChange:y.func,options:y.arrayOf(y.shape({})),popupClassname:y.string,value:y.string,label:y.string,size:y.string,rebuildTooltips:y.func}),Ot(Sr,"defaultProps",{onChange:function(){},options:[],popupClassname:null,value:null,label:null,size:"large",style:{},rebuildTooltips:function(){}});var Tr={sum:f.createElement(f.Fragment,null,"Σ"),avg:f.createElement(f.Fragment,null,"μ"),count:f.createElement(f.Fragment,null,"#")},Dr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.props.hidden||o.props.rebuildTooltips()})),Ot(Bt(o),"componentDidUpdate",(function(e,t){!t.isOpen&&o.state.isOpen&&o.setState({selectedColumns:[],checkedColumns:o.getCheckedFromNumberColumnIndices(o.props),columns:o.props.columns})})),Ot(Bt(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:[]})),Ot(Bt(o),"onAggTypeSelect",(function(e,t){var n=o.state.columns.map((function(n){return n.field===t.field?xt(xt({},n),{},{aggType:e}):n}));o.setState({columns:n})})),Ot(Bt(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}))})),Ot(Bt(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=zn.find((function(e){return e.value===t.aggType})),c={key:"selectable-list-item-".concat(o.COMPONENT_KEY,"-").concat(e,"-").concat(r),content:f.createElement("div",{key:"column-agg-type-symbol-".concat(o.COMPONENT_KEY)},!o.props.isAggregation&&t.aggType&&f.createElement(Sr,{className:"agg-type-symbol",popupClassname:"agg-type-symbol-select",popoverParentElement:o.popoverContentRef,popoverBoundaryElement:o.props.popoverParentElement,rebuildTooltips:o.props.rebuildTooltips,tooltipID:o.props.tooltipID,tooltip:s.tooltip,value:t.aggType,align:"start",size:"small",options:zn.map((function(e){return{value:e.value,label:Tr[e.value],listLabel:f.createElement("span",null,f.createElement("span",{className:"agg-select-list-symbol"},Tr[e.value]),e.displayName),tooltip:e.tooltip}})),onChange:function(e){o.onAggTypeSelect(e,t)}}),t.title),disabled:l,checked:i,columnIndex:r};n.push(c)}})),n})),Ot(Bt(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:[]:[]})),Ot(Bt(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)})),Ot(Bt(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)}))})),Ot(Bt(o),"onColumnSelection",(function(e,t){var n=t.map((function(e){return e.columnIndex}));o.setState({selectedColumns:n})})),Ot(Bt(o),"onColumnCheck",(function(e){var t=zt(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})})),Ot(Bt(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()))})),Ot(Bt(o),"renderSeriesSelector",(function(e){var t=o.getColumnsOfType(e);if(null==t||!t.length)return null;var n=An[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(br,{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(Er,{autoHide:!1,autoHeight:!0,autoHeightMin:100,autoHeightMax:250},f.createElement(Cr,{ref:function(t){return o.listRefs[e]=t},items:a,onSelect:o.onColumnSelection,onChange:o.onColumnCheck}))))})),Ot(Bt(o),"renderSeriesSelectors",(function(){return f.createElement("div",{className:"axis-series-selector"},f.createElement("div",{className:"number-selector-field-group-container"},Object.keys(Nn).map((function(e){return o.renderSeriesSelector(Nn[e])}))))})),Ot(Bt(o),"renderApplyButton",(function(){var e;return f.createElement("div",{className:"axis-selector-apply-btn-container"},f.createElement(gr,{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"))})),Ot(Bt(o),"render",(function(){return o.props.children?f.createElement(Re,{id:"number-axis-selector-".concat(o.COMPONENT_KEY),isOpen:o.props.isOpen,content:o.renderSelectorContent,ref:o.props.axisSelectorRef,onClickOutside:function(e){e.stopPropagation(),e.preventDefault(),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=b(),o.listRefs={};var a=o.getCheckedFromNumberColumnIndices(e);return o.state={aggType:void 0,selectedColumns:[],checkedColumns:a,columns:e.columns},o}return Pt(n)}();Ot(Dr,"propTypes",{rebuildTooltips:y.func,changeNumberColumnIndices:y.func}),Ot(Dr,"defaultProps",{rebuildTooltips:function(){},changeNumberColumnIndices:function(){}});var xr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"getAllStringColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Io(t)&&t.is_visible&&e.push(n)})),e})),Ot(Bt(o),"getDateColumnIndices",(function(){var e=[];return o.props.columns.forEach((function(t,n){Po(t)&&t.is_visible&&e.push(n)})),e})),Ot(Bt(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:"string-axis-selector-popover-content"},f.createElement(Er,{autoHide:!1,autoHeight:!0,autoHeightMin:35,autoHeightMax: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,a;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===(a=n[e])||void 0===a?void 0:a.display_name)}))))))})),Ot(Bt(o),"render",(function(){return o.props.children?f.createElement(Re,{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=b(),o}return Pt(n)}(),Rr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"render",(function(){var e,t,n;return"LINEAR"===(null===(e=o.props.scale)||void 0===e?void 0:e.type)?f.createElement(Dr,Mt({},o.props,{key:o.KEY,"data-test":"number-axis-selector",ref:function(e){return o.ref=e}}),o.props.children):"BAND"===(null===(t=o.props.scale)||void 0===t?void 0:t.type)||"TIME"===(null===(n=o.props.scale)||void 0===n?void 0:n.type)?f.createElement(xr,Mt({},o.props,{key:o.KEY,"data-test":"string-axis-selector",ref:function(e){return o.ref=e}}),o.props.children):null})),o.KEY=b(),o}return Pt(n)}(),wr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"openSelector",(function(){o.setState({isOpen:!0})})),Ot(Bt(o),"closeSelector",(function(){o.state.isOpen&&o.setState({isOpen:!1})})),Ot(Bt(o),"axiosSource",m.CancelToken.source()),Ot(Bt(o),"getNewChartData",(function(e){var t,n,a,r,i,l,s,c,u,d,p,m,f,g,v,h,y;return o.props.setIsLoadingMoreRows(!0),o.props.isDrilldown?io(xt(xt({},Yn(o.props.authentication)),{},{source:null===(t=o.props.queryRequestData)||void 0===t?void 0:t.source,debug:"include"===(null===(n=o.props.queryRequestData)||void 0===n?void 0:n.translation),formattedUserSelection:null===(a=o.props.queryRequestData)||void 0===a?void 0:a.user_selection,filters:null===(r=o.props.queryRequestData)||void 0===r?void 0:r.session_filter_locks,test:null===(i=o.props.queryRequestData)||void 0===i?void 0:i.test,groupBys:null===(l=o.props.queryRequestData)||void 0===l?void 0:l.columns,queryID:null===(s=o.props.queryRequestData)||void 0===s?void 0:s.original_query_id,orders:null===(c=o.props.formattedTableParams)||void 0===c?void 0:c.sorters,tableFilters:null===(u=o.props.formattedTableParams)||void 0===u?void 0:u.filters,cancelToken:o.axiosSource.token,pageSize:e})):oo(xt(xt({},Yn(o.props.authentication)),{},{query:null===(d=o.props.queryRequestData)||void 0===d?void 0:d.text,source:null===(p=o.props.queryRequestData)||void 0===p?void 0:p.source,debug:"include"===(null===(m=o.props.queryRequestData)||void 0===m?void 0:m.translation),formattedUserSelection:null===(f=o.props.queryRequestData)||void 0===f?void 0:f.user_selection,filters:null===(g=o.props.queryRequestData)||void 0===g?void 0:g.session_filter_locks,test:null===(v=o.props.queryRequestData)||void 0===v?void 0:v.test,pageSize:e,orders:null===(h=o.props.formattedTableParams)||void 0===h?void 0:h.sorters,tableFilters:null===(y=o.props.formattedTableParams)||void 0===y?void 0:y.filters,cancelToken:o.axiosSource.token}))})),Ot(Bt(o),"loadMoreChartData",function(){var e=At(Rt().mark((function e(t,n){var a,r,i;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?5e3:t,o.props.setCurrentRowNumber(t),e.next=5,o.getNewChartData(r);case 5:a=e.sent,o.props.setIsLoadingMoreRows(!1),o.props.onNewData(a,r),e.next=16;break;case 10:if(e.prev=10,e.t0=e.catch(0),(null===e.t0||void 0===e.t0||null===(i=e.t0.data)||void 0===i?void 0:i.message)!==Wt.CANCELLED){e.next=14;break}return e.abrupt("return",Promise.resolve());case 14:return console.error(e.t0),e.abrupt("return",Promise.resolve());case 16:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}()),Ot(Bt(o),"rowNumberListConstructor",(function(e){for(var t=100,n=[];t<e&&t<5e3;)n.push(t),t*=10;return e>5e3?n.push(5e3):n.push(e),n})),Ot(Bt(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(Er,{autoHide:!1,autoHeight:!0,autoHeightMin:35,autoHeightMax: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)"):100!==e&&1e3!==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)})))))})),Ot(Bt(o),"render",(function(){return f.createElement(Re,{isOpen:o.state.isOpen,ref: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,reposition:!0,padding:10},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 Pt(n)}();Ot(wr,"propTypes",Qo),Ot(wr,"defaultProps",zo);var Nr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.applyStyles()})),Ot(Bt(o),"componentDidUpdate",(function(e,t){o.state.currentRowNumber!==t.currentRowNumber&&o.forceUpdate(),o.applyStyles()})),Ot(Bt(o),"applyStyles",(function(){var e,t,n,a,r=Da(o.currentRowNumber),i=null!==(e=null==r?void 0:r.width)&&void 0!==e?e:0,l=null!==(t=null==r?void 0:r.height)&&void 0!==t?t:0;Ye(null===(n=o.rowNumberSelector)||void 0===n?void 0:n.popoverRef).attr("x",(null==r?void 0:r.x)-o.BUTTON_PADDING_LEFT).attr("y",(null==r?void 0:r.y)-o.BUTTON_PADDING_TOP).attr("width",i+2*o.BUTTON_PADDING_LEFT).attr("height",l+2*o.BUTTON_PADDING_TOP);var s=Da(o.allText),c=null!==(a=null==s?void 0:s.width)&&void 0!==a?a:0,u=(null==s?void 0:s.x)+c+5;Ye(o.warningIcon).attr("x",u).attr("y",-5)})),Ot(Bt(o),"renderRowCountText",(function(){var e={};return o.props.totalRowCount>o.initialRowNumber&&(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},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",{id:"visualizing-span-".concat(o.COMPONENT_ID)},"Visualizing "),f.createElement("tspan",{ref:function(e){return o.currentRowNumber=e},style:e,id:"row-number-span-".concat(o.COMPONENT_ID)},o.state.currentRowNumber)," / ".concat(o.props.totalRowCount," rows")))})),Ot(Bt(o),"renderRowDropdownButton",(function(){return o.props.totalRowCount>o.initialRowNumber?f.createElement(wr,Mt({},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})),Ot(Bt(o),"renderMaxRowWarningIcon",(function(){return o.props.totalRowCount>o.maxRows?f.createElement("svg",{ref:function(e){return o.warningIcon=e},stroke:"currentColor",fill:"#ffcc00",strokeWidth:"0",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"})):null})),Ot(Bt(o),"render",(function(){return f.createElement("g",{ref:function(e){return o.LoadMoreDropdownRef=e}},o.renderRowCountText(),o.renderRowDropdownButton(),o.renderMaxRowWarningIcon())})),o.maxRows=5e3,o.initialRowNumber=50,o.fontSize=12,o.BUTTON_PADDING_TOP=2,o.BUTTON_PADDING_LEFT=4,o.state={currentRowNumber:o.props.dataLength},o}return Pt(n)}();Ot(Nr,"propTypes",xt({},Qo)),Ot(Nr,"defaultProps",xt({},zo));var Ar=function(e){Lt(o,h);var t=Qt(o);function o(e){var a;return kt(this,o),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.renderAxis(),a.setState({axisRenderComplete:!0})})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){if(a.state.isAxisSelectorOpen&&t.isAxisSelectorOpen)return!1;var o=n(a.props,e),r=n(a.state,t);return!o||!r})),Ot(Bt(a),"componentDidUpdate",(function(e,t){var n=a.state.axisRenderComplete&&!t.axisRenderComplete;a.state.isAxisSelectorOpen||a.renderAxis(n)})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1})),Ot(Bt(a),"setScale",(function(){a.axis.scale(a.props.scale)})),Ot(Bt(a),"getMaxTickLabelWidth",(function(){var e=a.props,t=e.orient,n=e.outerHeight,o=e.outerWidth;return function(e){if(!e)return 20;var t=20,n=Math.floor(.5*e/10);return n<6?t=6:n<20&&(t=n),t}("Left"===t||"Right"===t?o:n)})),Ot(Bt(a),"setTickValues",(function(){var e,t,n=a.props.scale,o=a.maxLabelWidth;a.axis.tickFormat((function(e){var t=ba({d:e,scale:n,maxLabelWidth:o});return null!=t&&t.formattedLabel?t.formattedLabel:e})),null!==(e=a.props.scale)&&void 0!==e&&null!==(t=e.tickLabels)&&void 0!==t&&t.length&&a.axis.tickValues(a.props.scale.tickLabels),a.setTickSize()})),Ot(Bt(a),"setTickSize",(function(){a.axis.tickSizeOuter(0),"Left"===a.props.orient&&a.props.innerWidth?a.axis.tickSizeInner(-a.props.innerWidth):"Bottom"===a.props.orient&&a.props.innerHeight?a.axis.tickSizeInner(a.props.innerHeight):a.axis.tickSizeInner(0)})),Ot(Bt(a),"applyAxis",(function(){a.axisElement&&Ye(a.axisElement).call(a.axis)})),Ot(Bt(a),"styleAxisLabels",(function(){"Bottom"===a.props.orient?Ye(a.axisElement).selectAll(".tick text").attr("transform","translate(0, 10)"):"Top"===a.props.orient?Ye(a.axisElement).selectAll(".tick text").attr("transform","translate(0, -5)"):"Left"===a.props.orient?Ye(a.axisElement).selectAll(".tick text").attr("transform","translate(-5, 0)"):"Right"===a.props.orient&&Ye(a.axisElement).selectAll(".tick text").attr("transform","translate(5, 0)")})),Ot(Bt(a),"rotateLabelsIfNeeded",(function(){if("Bottom"===a.props.orient||"Top"===a.props.orient){var e=(t=a.axisElement,o=!1,Ye(t).selectAll("g.tick text").each((function(){if(!o){var e=Ye(this).node().getBoundingClientRect();n&&e.x<n.x+n.width+10&&(o=!0),n=e}})),o);e&&("Bottom"===a.props.orient?Ye(a.axisElement).selectAll(".tick text").style("text-anchor","end").attr("dominant-baseline","text-top").attr("transform","rotate(-45, 0, ".concat(a.props.innerHeight,") translate(-10, 0)")):"Top"===a.props.orient&&Ye(a.axisElement).selectAll(".tick text").style("text-anchor","start").attr("dominant-baseline","auto").attr("transform","rotate(-45, 0, 0) translate(5, 0)")),a.prevLabelsShouldRotate=a.labelsShouldRotate,a.labelsShouldRotate=e}var t,n,o})),Ot(Bt(a),"addTooltipsToLabels",(function(){var e=a.props.scale,t=a.maxLabelWidth;Ye(a.axisElement).selectAll(".axis .tick text").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").attr("data-for",a.props.chartTooltipID).attr("data-effect","float").attr("data-tip",(function(n){var o;if("..."===(null===(o=Ye(this).text())||void 0===o?void 0:o.slice(-3))){var a=ba({d:n,scale:e,maxLabelWidth:t}).fullWidthLabel;if(a)return a}return null})),a.prevMaxLabelWidth=a.maxLabelWidth})),Ot(Bt(a),"renderAxis",(function(e){var t;switch(a.props.orient){case"Bottom":a.axis=Ze();break;case"Left":a.axis=Je();break;case"Right":a.axis=Xe();break;case"Top":a.axis=Ge()}if(a.maxLabelWidth=a.getMaxTickLabelWidth(),a.setScale(),a.setTickValues(),a.applyAxis(),a.styleAxisLabels(),a.rotateLabelsIfNeeded(),a.addTooltipsToLabels(),Ye(a.axisElement).selectAll(".axis path").style("display","none"),"LINEAR"!==(null===(t=a.props.scale)||void 0===t?void 0:t.type)?Ye(a.axisElement).selectAll("g.tick").select("line").style("opacity",0):(Ye(a.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.08").style("shape-rendering","crispedges"),Ye(a.axisElement).selectAll("g.tick").select("line").style("opacity",.1),Ye(a.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.3)),a.axisElement){var n=a.axisElement.getBBox?a.axisElement.getBBox():void 0,o=a.axisElement.getBoundingClientRect?a.axisElement.getBoundingClientRect():void 0,r=0,i=0;n&&o&&(r=(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(Ye(a.axisElement).selectAll("g.tick text").each((function(){var e=Ye(this).node().getBoundingClientRect();l.push({left:e.left-r,bottom:e.bottom-i,right:e.right-r,top:e.top-i})})),l){var s=ua(l);a.labelBBox=xt({},s)}}a.adjustTitleToFit(),a.adjustAxisSelectorBorder(),a.adjustAxisScalerBorder(),e?a.props.onAxisRenderComplete(a.props.orient):!a.state.axisRenderComplete||a.prevLabelsShouldRotate===a.labelsShouldRotate&&a.prevMaxLabelWidth===a.maxLabelWidth||a.props.onLabelRotation()})),Ot(Bt(a),"getTitleTextHeight",(function(){var e,t,n=parseInt(null===(e=a.titleRef)||void 0===e||null===(t=e.style)||void 0===t?void 0:t.fontSize,10);return isNaN(n)?12:n})),Ot(Bt(a),"openSelector",(function(){a.setState({isAxisSelectorOpen:!0})})),Ot(Bt(a),"closeSelector",(function(){a.setState({isAxisSelectorOpen:!1})})),Ot(Bt(a),"renderAxisSelector",(function(e){var t=e.positions,n=e.isSecondAxis,o=e.childProps,r=void 0===o?{}:o;return f.createElement(Rr,{chartContainerRef:a.props.chartContainerRef,changeNumberColumnIndices:a.props.changeNumberColumnIndices,changeStringColumnIndex:a.props.changeStringColumnIndex,legendColumn:a.props.legendColumn,popoverParentElement:a.props.popoverParentElement,rebuildTooltips:a.props.rebuildTooltips,numberColumnIndices:a.props.numberColumnIndices,numberColumnIndices2:a.props.numberColumnIndices2,stringColumnIndices:a.props.stringColumnIndices,stringColumnIndex:a.props.stringColumnIndex,dateColumnsOnly:a.props.dateColumnsOnly,isAggregation:a.props.isAggregation,tooltipID:a.props.tooltipID,hidden:!a.shouldRenderAxisSelector(),columns:a.props.columns,scale:a.props.scale,align:"center",position:"right",positions:t,childProps:r,hasSecondAxis:a.props.hasSecondAxis,axisSelectorRef:function(e){return a.axisSelector=e},isOpen:a.state.isAxisSelectorOpen,closeSelector:a.closeSelector,isSecondAxis:n},f.createElement("rect",{className:"axis-label-border ".concat(a.shouldRenderAxisSelector()?"":"hidden"),"data-test":"axis-label-border",onClick:a.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),Ot(Bt(a),"renderAxisTitleText",(function(){var e,t=a.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":a.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 a.titleText=e}},n),a.shouldRenderAxisSelector()&&f.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),Ot(Bt(a),"renderBottomAxisTitle",(function(){var e,t,n,o,r=(null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(o=a.labelBBox)||void 0===o?void 0:o.height)&&void 0!==n?n:0),i=a.props.innerWidth/2,l=r+a.AXIS_TITLE_PADDING;return f.createElement("g",null,f.createElement("text",{ref:function(e){return a.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:i,y:l,style:a.labelInlineStyles},a.renderAxisTitleText()),a.renderAxisSelector({positions:["top","bottom","right","left"]}))})),Ot(Bt(a),"renderLeftAxisTitle",(function(){var e,t,n=(null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-a.AXIS_TITLE_PADDING,o=-.5*a.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return a.titleRef=e},id:"left-axis-title-".concat(a.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:10,lengthAdjust:"spacingAndGlyphs",style:a.labelInlineStyles},a.renderAxisTitleText()),a.renderAxisSelector({positions:["right","bottom","left","top"]}))})),Ot(Bt(a),"renderRightAxisTitle",(function(){var e,t,n,o,r=(null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)+(null!==(n=null===(o=a.labelBBox)||void 0===o?void 0:o.width)&&void 0!==n?n:0)+a.AXIS_TITLE_PADDING,i=-.5*a.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return a.titleRef=e},id:"right-axis-title-".concat(a.AXIS_KEY),className:"right-axis-title","data-test":"right-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:i,y:r,textLength:10,lengthAdjust:"spacingAndGlyphs",style:a.labelInlineStyles},a.renderAxisTitleText()),a.renderAxisSelector({isSecondAxis:!0,positions:["left","top","bottom","right"]}))})),Ot(Bt(a),"renderTopAxisTitle",(function(){var e,t,n=null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,o=a.props.innerWidth/2,r=n-a.AXIS_TITLE_PADDING;return f.createElement("g",null,f.createElement("text",{ref:function(e){return a.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:o,y:r,style:a.labelInlineStyles},a.renderAxisTitleText()),a.renderAxisSelector({isSecondAxis:!0,positions:["bottom","top","left","right"]}))})),Ot(Bt(a),"adjustAxisSelectorBorder",(function(){var e,t,n;if(a.titleRef){var o=Da(a.titleRef),r=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;Ye(a.axisSelector).attr("transform",null===(n=a.titleRef)||void 0===n?void 0:n.getAttribute("transform")).attr("width",Math.round(i+2*a.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("height",Math.round(r+2*a.AXIS_TITLE_BORDER_PADDING_TOP)).attr("x",Math.round((null==o?void 0:o.x)-a.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("y",Math.round((null==o?void 0:o.y)-a.AXIS_TITLE_BORDER_PADDING_TOP))}})),Ot(Bt(a),"adjustAxisScalerBorder",(function(){var e,t,n,o,r,i,l,s;a.axisScaler&&Ye(a.axisScaler).attr("x",Math.round((null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-a.BUTTON_PADDING)).attr("y",Math.round((null!==(n=null===(o=a.labelBBox)||void 0===o?void 0:o.y)&&void 0!==n?n:0)-a.BUTTON_PADDING)).attr("width",Math.round((null!==(r=null===(i=a.labelBBox)||void 0===i?void 0:i.width)&&void 0!==r?r:0)+2*a.BUTTON_PADDING)).attr("height",Math.round((null!==(l=null===(s=a.labelBBox)||void 0===s?void 0:s.height)&&void 0!==l?l:0)+2*a.BUTTON_PADDING))})),Ot(Bt(a),"adjustTitleToFit",(function(){if(a.titleRef)if("Bottom"===a.props.orient){var e,t,n,o,r=(null!==(e=null===(t=a.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(o=a.labelBBox)||void 0===o?void 0:o.height)&&void 0!==n?n:0),i=a.props.innerWidth/2,l=r+a.AXIS_TITLE_PADDING;Ye(a.titleRef).attr("x",i).attr("y",l),Ye(a.loadMoreDropdown).attr("transform","translate(".concat(i,", ").concat(l+15,")"))}else if("Top"===a.props.orient){var s,c,u=null!==(s=null===(c=a.labelBBox)||void 0===c?void 0:c.y)&&void 0!==s?s:0,d=a.props.innerWidth/2,p=u-a.AXIS_TITLE_PADDING;Ye(a.titleRef).attr("x",d).attr("y",p)}else if(("Left"===a.props.orient||"Right"===a.props.orient)&&a.props.chartRef){var m,f=a.props.outerHeight-2*a.props.chartPadding;if(Ye(a.titleRef).attr("textLength",null),(null!==(m=a.titleRef.getBBox().width)&&void 0!==m?m:0)+2*a.AXIS_TITLE_BORDER_PADDING_LEFT>f){var g=Math.floor(f)-2*a.AXIS_TITLE_BORDER_PADDING_LEFT;g<0&&(g=10),Ye(a.titleRef).attr("textLength",g)}var v=a.titleRef.getBBox(),h=-1*(v.x+v.width)+a.props.deltaY-a.AXIS_TITLE_BORDER_PADDING_LEFT;if(h<0){var y=-h;Ye(a.titleRef).attr("transform","rotate(-90) translate(".concat(-y,", 0)"))}}})),Ot(Bt(a),"renderAxisTitle",(function(){switch(a.props.orient){case"Left":return a.renderLeftAxisTitle();case"Right":return a.renderRightAxisTitle();case"Bottom":return a.renderBottomAxisTitle();case"Top":return a.renderTopAxisTitle();default:return null}})),Ot(Bt(a),"renderLoadMoreDropdown",(function(){return"Bottom"===a.props.orient&&a.props.enableAjaxTableData?f.createElement("g",{ref:function(e){return a.loadMoreDropdown=e}},f.createElement(Nr,Mt({},a.props,{style:a.labelInlineStyles}))):null})),Ot(Bt(a),"shouldRenderAxisSelector",(function(){var e;return null===(e=a.props.scale)||void 0===e?void 0:e.hasDropdown})),Ot(Bt(a),"shouldRenderAxisScaler",(function(){var e,t;return!!a.labelBBox&&"LINEAR"===(null===(e=a.props.scale)||void 0===e?void 0:e.type)&&1!==(null===(t=a.props.scale)||void 0===t?void 0:t.domain().length)})),Ot(Bt(a),"renderAxisScaler",(function(){return a.shouldRenderAxisScaler()?f.createElement(hr,{toggleChartScale:a.props.toggleChartScale,labelBBox:a.labelBBox,childProps:{ref:function(e){return a.axisScaler=e}}}):null})),Ot(Bt(a),"render",(function(){return f.createElement("g",{"data-test":"axis",ref:function(e){return a.ref=e},transform:"translate(".concat(a.props.translateX,", ").concat(a.props.translateY,")"),style:a.labelInlineStyles},f.createElement("g",{className:"axis axis-".concat(a.props.orient),ref:function(e){return a.axisElement=e}}),a.renderAxisTitle(),a.renderLoadMoreDropdown(),a.renderAxisScaler())})),a.AXIS_KEY=b(),a.LEGEND_ID="axis-".concat(b()),a.BUTTON_PADDING=5,a.AXIS_TITLE_PADDING=20,a.AXIS_TITLE_BORDER_PADDING_LEFT=10,a.AXIS_TITLE_BORDER_PADDING_TOP=5,a.swatchElements=[],a.maxRows=5e3,a.initialRowNumber=50,a.prevMaxLabelWidth=20,a.labelInlineStyles={fontSize:"12px",fontFamily:"inherit",fill:"currentColor",fillOpacity:.9,cursor:"default"},a.labelsShouldRotate=!1,a.prevLabelsShouldRotate=!1,a.state={currentRowNumber:a.props.dataLength},a}return Pt(o)}();Ot(Ar,"propTypes",xt(xt({},Qo),{},{scale:y.func.isRequired,orient:y.string,translateX:y.number,translateY:y.number})),Ot(Ar,"defaultProps",xt(xt({},zo),{},{orient:"Bottom",translate:void 0,translateX:0,translateY:0,onAxisRenderComplete:function(){}}));var kr=function(e){return e},Ir=function(e){for(var t=[],n=0,o=e.length;n<o;n++)t[n]=e[o-n-1];return t},Pr=function(e,t){e.each((function(){var e,n=Ye(this),o=n.text().split(/\s+/).reverse(),a=[];n.attr("y");for(var r=parseFloat(n.attr("dy"))||0,i=n.text(null).append("tspan").attr("x",0).attr("dy",r+"em");e=o.pop();)a.push(e),i.text(a.join(" ")),i.node().getComputedTextLength()>t&&a.length>1&&(a.pop(),i.text(a.join(" ")),a=[e],i=n.append("tspan").attr("x",0).attr("dy",1.2+r+"em").text(e))}))},Or={d3_drawShapes:function(e,t,n,o,a,r){"rect"===e?t.attr("height",n).attr("width",o):"circle"===e?t.attr("r",a):"line"===e?t.attr("x1",0).attr("x2",o).attr("y1",0).attr("y2",0):"path"===e&&t.attr("d",r)},d3_addText:function(e,t,n,o,a){t.append("text").attr("class",o+"label");var r=e.selectAll("g.".concat(o,"cell text.").concat(o,"label")).data(n).text(kr);return a&&e.selectAll("g.".concat(o,"cell text.").concat(o,"label")).call(Pr,a),r},d3_calcType:function(e,t,n,o,a,r){var i=e.invertExtent?function(e,t,n){var o=e.range().map((function(o){var a=e.invertExtent(o);return t(a[0])+" "+n+" "+t(a[1])}));return{data:e.range(),labels:o,feature:kr}}(e,a,r):e.ticks?function(e,t,n){var o=[];if(t.length>1)o=t;else for(var a=e.domain(),r=(a[a.length-1]-a[0])/(t-1),i=0;i<t;i++)o.push(a[0]+i*r);var l=o.map(n);return{data:o,labels:l,feature:function(t){return e(t)}}}(e,n,a):function(e){return{data:e.domain(),labels:e.domain(),feature:function(t){return e(t)}}}(e),l=e.range&&e.range()||e.domain();return i.labels=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("object"===wt(t)){if(0===t.length)return e;for(var r=t.length;r<e.length;r++)t.push(e[r]);return t}if("function"==typeof t){for(var i=[],l=e.length,s=0;s<l;s++)i.push(t({i:s,genLength:l,generatedLabels:e,domain:n,range:o,labelDelimiter:a}));return i}return e}(i.labels,o,e.domain(),l,r),t&&(i.labels=Ir(i.labels),i.data=Ir(i.data)),i},d3_filterCells:function(e,t){var n=e.data.map((function(t,n){return{data:t,label:e.labels[n]}})).filter(t),o=n.map((function(e){return e.data})),a=n.map((function(e){return e.label}));return e.data=e.data.filter((function(e){return-1!==o.indexOf(e)})),e.labels=e.labels.filter((function(e){return-1!==a.indexOf(e)})),e},d3_placement:function(e,t,n,o,a,r){t.attr("transform",n),o.attr("transform",a),"horizontal"===e&&o.style("text-anchor",r)},d3_addEvents:function(e,t){e.on("mouseover.legend",(function(e){!function(e,t,n){e.call("cellover",n,t)}(t,e,this)})).on("mouseout.legend",(function(e){!function(e,t,n){e.call("cellout",n,t)}(t,e,this)})).on("click.legend",(function(e){!function(e,t,n){e.call("cellclick",n,t)}(t,e,this)}))},d3_title:function(e,t,n,o){if(""!==t){e.selectAll("text."+n+"legendTitle").data([t]).enter().append("text").attr("class",n+"legendTitle"),e.selectAll("text."+n+"legendTitle").text(t),o&&e.selectAll("text."+n+"legendTitle").call(Pr,o);var a=e.select("."+n+"legendCells"),r=e.select("."+n+"legendTitle").nodes().map((function(e){return e.getBBox().height}))[0],i=-a.nodes().map((function(e){return e.getBBox().x}))[0];a.attr("transform","translate("+i+","+r+")")}},d3_defaultLocale:{format:at,formatPrefix:rt},d3_defaultFormatSpecifier:".01f",d3_defaultDelimiter:"to"};function Mr(){var e,t,n,o=Ve(),a="path",r=15,i=15,l=10,s=2,c=[5],u=[],d="",p=!1,m="",f=Or.d3_defaultLocale,g=Or.d3_defaultFormatSpecifier,v=20,h="middle",y=Or.d3_defaultDelimiter,b="vertical",C=!1,E=$e().type(et).size(75)(),S=st("cellover","cellout","cellclick");function T(T){var D=Or.d3_calcType(o,C,c,u,f.format(g),y);T.selectAll("g").data([o]).enter().append("g").attr("class",d+"legendCells"),e&&Or.d3_filterCells(D,e);var x=T.select("."+d+"legendCells").selectAll("."+d+"cell").data(D.data),R=x.enter().append("g").attr("class",d+"cell");R.append(a).attr("class",d+"swatch");var w=T.selectAll("g."+d+"cell "+a+"."+d+"swatch").data(D.data);Or.d3_addEvents(R,S),x.exit().transition().style("opacity",0).remove(),w.exit().transition().style("opacity",0).remove(),w=w.merge(w),Or.d3_drawShapes(a,w,i,r,l,E);var N=Or.d3_addText(T,R,D.labels,d,t);x=R.merge(x);var A=N.nodes().map((function(e){return e.getBBox()})),k=w.nodes().map((function(e){return e.getBBox()}));p?w.attr("class",(function(e){return"".concat(d,"swatch ").concat(D.feature(e))})):"line"==a?w.style("stroke",D.feature):w.style("fill",D.feature);var I,P,O="start"==h?0:"middle"==h?.5:1;if("vertical"===b){var M=A.map((function(e,t){return Math.max(e.height,k[t].height)}));I=function(e,t){var n=He(M.slice(0,t));return"translate(0, ".concat(n+t*s,")")},P=function(e,t){return"translate( ".concat(k[t].width+k[t].x+v,", ").concat(k[t].y+k[t].height/2+4,")")}}else"horizontal"===b&&(I=function(e,t){return"translate(".concat(t*(k[t].width+s),",0)")},P=function(e,t){return"translate(".concat(k[t].width*O+k[t].x,",\n ").concat(k[t].height+k[t].y+v+8,")")});Or.d3_placement(b,x,I,N,P,h),Or.d3_title(T,m,d,n),x.transition().style("opacity",1)}return T.scale=function(e){return arguments.length?(o=e,T):o},T.cells=function(e){return arguments.length?((e.length>1||e>=2)&&(c=e),T):c},T.cellFilter=function(t){return arguments.length?(e=t,T):e},T.shape=function(e){return arguments.length?(a=e,T):a},T.path=function(e){return arguments.length?(E=e,T):E},T.shapeWidth=function(e){return arguments.length?(r=+e,T):r},T.shapeHeight=function(e){return arguments.length?(i=+e,T):i},T.shapeRadius=function(e){return arguments.length?(l=+e,T):l},T.shapePadding=function(e){return arguments.length?(s=+e,T):s},T.labels=function(e){return arguments.length?(u=e,T):u},T.labelAlign=function(e){return arguments.length?("start"!=e&&"end"!=e&&"middle"!=e||(h=e),T):h},T.locale=function(e){return arguments.length?(f=it(e),T):f},T.labelFormat=function(e){return arguments.length?(g=lt(e),T):T.locale().format(g)},T.labelOffset=function(e){return arguments.length?(v=+e,T):v},T.labelDelimiter=function(e){return arguments.length?(y=e,T):y},T.labelWrap=function(e){return arguments.length?(t=e,T):t},T.useClass=function(e){return arguments.length?(!0!==e&&!1!==e||(p=e),T):p},T.orient=function(e){return arguments.length?("horizontal"!=(e=e.toLowerCase())&&"vertical"!=e||(b=e),T):b},T.ascending=function(e){return arguments.length?(C=!!e,T):C},T.classPrefix=function(e){return arguments.length?(d=e,T):d},T.title=function(e){return arguments.length?(m=e,T):m},T.titleWidth=function(e){return arguments.length?(n=e,T):n},T.textWrap=function(e){return arguments.length?(textWrap=e,T):textWrap},T.on=function(){var e=S.on.apply(S,arguments);return e===S?T:e},T}var Lr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.renderAllLegends()})),Ot(Bt(o),"shouldComponentUpdate",(function(e){return!Za(o.props.columns,e.columns)||(o.props.height!==e.height||o.props.outerHeight!==e.outerHeight)})),Ot(Bt(o),"componentDidUpdate",(function(){o.renderAllLegends()})),Ot(Bt(o),"componentWillUnmount",(function(){Ua(o.rightLegendElement),Ua(o.rightLegendElement2)})),Ot(Bt(o),"renderAllLegends",(function(){if(o.renderLegend(o.rightLegendElement,o.props.legendColumnIndices,o.props.colorScale),o.props.hasSecondAxis){o.renderLegend(o.rightLegendElement2,o.props.numberColumnIndices2,o.props.colorScale2,!0)}o.justMounted&&(o.justMounted=!1,o.props.onRenderComplete())})),Ot(Bt(o),"removeHiddenLegendLabels",(function(e){var t,n,a,r=null===(t=o.legendClippingContainer)||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),l=!1,s=void 0,c=void 0;if(Ye(e).selectAll(".cell").each((function(e){if(l)Ye(this).remove();else{var t,n,o=this.getBoundingClientRect();(null!==(t=null==o?void 0:o.y)&&void 0!==t?t:0)+(null!==(n=null==o?void 0:o.height)&&void 0!==n?n:0)>i&&(s=Ye(this).attr("y"),c=Ye(this).attr("transform"),Ye(this).remove(),l=!0)}})),l&&c){var u=o.props.chartTooltipID;Ye(e).select(".legend-hidden-field-arrow").remove(),Ye(e).append("text").html("&#9660 ...").attr("class","legend-hidden-field-arrow").attr("y",s+20).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","12px").style("color","red").style("font-weight","bold").style("cursor","default")}})),Ot(Bt(o),"styleLegendTitleNoBorder",(function(e){Ye(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).attr("transform","translate(0,-3)")})),Ot(Bt(o),"styleLegendTitleWithBorder",(function(e){Ye(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=Ye(e).select(".legendTitle").node().getBBox()}catch(e){console.error(e)}})),Ot(Bt(o),"onClick",(function(e,t){var n=null==t?void 0:t.find((function(t){return t.label===e})),a=!(null!=n&&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)})),Ot(Bt(o),"getLegendTitleFromColumns",(function(e){var t="Fields",n=e.map((function(e){return o.props.columns[e]})),a=e.map((function(e){return o.props.columns[e].type}));if(!a.find((function(e){return e!==a[0]}))){var r=An[a[0]];r&&(t="".concat(r," ").concat(t))}var i=n.map((function(e){return e.aggType}));if(!i.find((function(e){return e!==i[0]}))){var l,s=null===(l=zn.find((function(e){return e.value===i[0]})))||void 0===l?void 0:l.displayName;s&&(t="".concat(t," (").concat(s,")"))}return t})),Ot(Bt(o),"renderLegend",(function(e,t,n,a){try{var r=Bt(o),i=Go(o.props.columns,n,t);if(!i)return;var l=o.getLegendTitleFromColumns(t),s=o.getLegendScale(i);if("right"===o.props.placement){var c,u,d,p;Ye(e).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","10px");var m=Mr().orient("vertical").path($e().type(tt).size(100)()).shapePadding(8).labelWrap(100).labelOffset(10).scale(s).on("cellclick",(function(e){r.onClick(e,i)}));if(a?m.shape("line"):o.props.shape&&m.shape(o.props.shape),l&&m.title(l).titleWidth(o.MAX_LEGEND_WIDTH),Ye(e).call(m).style("font-family","inherit"),a){var f,g,v=null===(f=o.rightLegendElement)||void 0===f?void 0:f.getBoundingClientRect(),h=null!==(g=null==v?void 0:v.height)&&void 0!==g?g:0;Ye(e).attr("transform","translate(".concat(o.LEFT_PADDING,", ").concat(h+30,")"))}l&&(o.props.onLegendTitleClick?o.styleLegendTitleWithBorder(e):o.styleLegendTitleNoBorder(e));var y=(null===(c=Ye(e).node())||void 0===c||null===(u=c.getBBox())||void 0===u?void 0:u.width)||0;y>o.MAX_LEGEND_WIDTH&&(y=o.MAX_LEGEND_WIDTH);var b=null===(d=o.rightLegendElement)||void 0===d?void 0:d.getBoundingClientRect(),C=null===(p=o.rightLegendElement2)||void 0===p?void 0:p.getBoundingClientRect(),E=ua([b,C]),S=isNaN(null==E?void 0:E.width)?0:null==E?void 0:E.width;S>o.MAX_LEGEND_WIDTH&&(S=o.MAX_LEGEND_WIDTH);var T=o.props.height+10;Ye(o.legendClippingContainer).attr("height",T+o.BOTTOM_PADDING).attr("width",S+o.LEFT_PADDING),o.removeHiddenLegendLabels(e)}else if("bottom"===o.props.placement){Ye(o.bottomLegendElement).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","10px");m=Mr().orient("horizontal").shapePadding(r.LEGEND_WIDTH).labelWrap(o.MAX_LEGEND_WIDTH).labelAlign("left").scale(s).on("cellclick",(function(e){r.onClick(e,i)}));Ye(o.bottomLegendElement).call(m).style("font-family","inherit")}o.applyStylesForHiddenSeries(e,i)}catch(e){console.error(e)}})),Ot(Bt(o),"applyStylesForHiddenSeries",(function(e,t){try{Ye(e).selectAll(".cell").each((function(e){var n=t.find((function(t){return t.label===e}));n&&(Ye(this).select(".swatch").attr("stroke",n.color).attr("stroke-location","outside"),n.hidden?Ye(this).attr("class","cell hidden"):Ye(this).attr("class","cell visible"))}))}catch(e){console.error(e)}})),Ot(Bt(o),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return _e().domain(e.map((function(e){return e.label}))).range(t)})),Ot(Bt(o),"render",(function(){return f.createElement("g",{"data-test":"legend"},"right"===o.props.placement&&f.createElement(f.Fragment,null,f.createElement("g",{ref:function(e){return o.rightLegendElement=e},id:o.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(o.LEFT_PADDING,", 8)")}),o.props.hasSecondAxis&&f.createElement("g",{ref:function(e){return o.rightLegendElement2=e},id:o.LEGEND_ID,"data-test":"right-legend-2",className:"legendOrdinal right-legend-2"})),f.createElement("rect",{ref:function(e){return o.legendClippingContainer=e},width:0,height:o.props.height,transform:"translate(0,-15)",style:{stroke:"transparent",fill:"transparent",pointerEvents:"none"}}),"bottom"===o.props.placement&&f.createElement("g",{ref:function(e){return o.bottomLegendElement=e},"data-test":"bottom-legend",id:o.LEGEND_ID,className:"legendOrdinal"}))})),o.MAX_LEGEND_WIDTH=200,o.LEGEND_ID="axis-".concat(b()),o.BUTTON_PADDING=5,o.LEFT_PADDING=20,o.BOTTOM_PADDING=10,o.justMounted=!0,o}return Pt(n)}();Ot(Lr,"propTypes",{title:y.string,legendColumn:y.shape({}),placement:y.string,onLabelChange:y.func,onLegendClick:y.func,onLegendTitleClick:y.func,numberColumnIndices:y.arrayOf(y.number),topMargin:y.number,bottomMargin:y.number,scale:y.func,translate:y.string,height:y.number,width:y.number,onRenderComplete:y.func}),Ot(Lr,"defaultProps",{title:void 0,onLabelChange:function(){},onLegendClick:function(){},onRenderComplete:function(){},translate:void 0,placement:"right"});var qr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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;break;case"Legend":o.legendComplete=!0}o.shouldRenderRightAxis()||o.rightAxisComplete||(o.rightAxisComplete=!0),o.shouldRenderTopAxis()||o.topAxisComplete||(o.topAxisComplete=!0),o.shouldRenderLegend()||o.legendComplete||(o.legendComplete=!0),o.topAxisComplete&&o.bottomAxisComplete&&o.leftAxisComplete&&o.rightAxisComplete&&o.legendComplete&&o.forceUpdate((function(){o.props.onAxesRenderComplete()}))})),Ot(Bt(o),"renderBottomAxis",(function(e,t){return f.createElement(Ar,Mt({},o.props,{ref:function(e){return o.bottomAxis=e},key:o.BOTTOM_AXIS_KEY,orient:"Bottom",scale:o.props.xScale,translateY:0,translateX:0,innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()}))})),Ot(Bt(o),"renderLeftAxis",(function(e,t){return f.createElement(Ar,Mt({},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()}))})),Ot(Bt(o),"shouldRenderTopAxis",(function(){return!!o.props.xScale2})),Ot(Bt(o),"renderTopAxis",(function(e,t){return o.shouldRenderTopAxis()?f.createElement(Ar,Mt({},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})),Ot(Bt(o),"shouldRenderRightAxis",(function(){return!!o.props.yCol2&&!!o.props.yScale2})),Ot(Bt(o),"shouldRenderLegend",(function(){return!!o.props.legendLocation})),Ot(Bt(o),"renderRightAxis",(function(e,t){var n=o.shouldRenderRightAxis(),a=o.shouldRenderLegend();return n||a?f.createElement("g",{ref:function(e){return o.rightAxis=e},transform:"translate(".concat(e,", 0)")},n&&f.createElement(Ar,Mt({},o.props,{ref:function(e){return o.rightAxisWithoutLegend=e},key:o.RIGHT_AXIS_KEY,orient:"Right",scale:o.props.yScale2,showGridLines:!1,hasRightLegend:!1,hasBottomLegend:!1,innerWidth:e,innerHeight:t,onAxisRenderComplete:o.onAxisRenderComplete,hasSecondAxis:o.hasSecondAxis()})),a&&o.renderRightLegend()):null})),Ot(Bt(o),"hasSecondAxis",(function(){return o.shouldRenderRightAxis()||o.shouldRenderTopAxis()})),Ot(Bt(o),"renderRightLegend",(function(){var e,t,n,a,r=0;null!==(e=o.rightAxisWithoutLegend)&&void 0!==e&&e.ref&&(r=null!==(t=null===(n=Da(null===(a=o.rightAxisWithoutLegend)||void 0===a?void 0:a.ref))||void 0===n?void 0:n.width)&&void 0!==t?t:0);var i=o.shouldRenderTopAxis()?10:0;return f.createElement("g",{transform:"translate(".concat(r,",").concat(i,")")},f.createElement(Lr,Mt({},o.props,{ref:function(e){return o.legendRef=e},legendColumnIndices:o.props.numberColumnIndices,legendColumnIndices2:o.props.numberColumnIndices2,placement:o.props.legendLocation,onRenderComplete:function(){return o.onAxisRenderComplete("Legend")},hasSecondAxis:o.hasSecondAxis(),shape:o.props.legendShape})))})),Ot(Bt(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=b(),o.LEFT_AXIS_KEY=b(),o.RIGHT_AXIS_KEY=b(),o.TOP_AXIS_KEY=b(),o}return Pt(n)}();Ot(qr,"propTypes",xt(xt({},Qo),{},{onAxesRenderComplete:y.func})),Ot(qr,"defaultProps",xt(xt({},zo),{},{onAxesRenderComplete:function(){}}));var Vr=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Cn()})),Ot(Bt(e),"onColumnClick",(function(t,n,o){var a=Yo(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})})),Ot(Bt(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?Ko(n):n(m),v=Math.abs(n(m)-Ko(n));if((isNaN(v)||isNaN(m))&&(g=Ko(n),v=0),v<.05)return null;var h=c.getValue(d[l])+u*e.barWidth,y=Wo({row:d,columns:r,colIndex:t,stringColumnIndex:l,legendColumn:i,dataFormatting:s}),b=Yo(t,p);return f.createElement("rect",{key:b,className:"bar".concat(e.state.activeKey===b?" 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":y,"data-for":e.props.chartTooltipID,style:{fill:a,fillOpacity:.7}})}))),u+=1}})),d})),Ot(Bt(e),"render",(function(){var t,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 Pt(n)}();Ot(Vr,"propTypes",Uo),Ot(Vr,"defaultProps",jo);var _r=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Za(o.props,e),a=Za(o.state,t);return!n||!a})),Ot(Bt(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=na({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var r=ia({props: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})),Ot(Bt(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),Ot(Bt(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(qr,Mt({},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",hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,toggleChartScale:o.toggleChartScale,yGridLines:!0}),o.props.marginAdjustmentFinished&&f.createElement(Vr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.setChartData(e),o.state={isChartScaled:!0},o}return Pt(n)}();Ot(_r,"propTypes",Bo),Ot(_r,"defaultProps",Ho);var Fr=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"shouldComponentUpdate",(function(){return!0})),Ot(Bt(e),"onBarClick",(function(t,n,o){var a=Yo(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})})),Ot(Bt(e),"render",(function(){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)-Ko(s));if(isNaN(v)&&(v=0),v<.05)return null;var h=l(u[r])+p*d,y=Wo({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:Yo(t,m),className:"bar".concat(e.state.activeKey===Yo(t,m)?" active":""),"data-test":"bar-".concat(a,"-").concat(m),y:h,x:g>0?Ko(s):s(g),width:v,height:d,onClick:function(){return e.onBarClick(u,t,m)},"data-tip":y,"data-for":e.props.chartTooltipID,style:{fill:c,fillOpacity:.7}})}))),p+=1}})),f.createElement("g",{"data-test":"bars"},u)})),e}return Pt(n)}();Ot(Fr,"propTypes",Uo),Ot(Fr,"defaultProps",jo);var Br=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Za(o.props,e),a=Za(o.state,t);return!n||!a})),Ot(Bt(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.yScale=na({props:e,columnIndex:e.stringColumnIndex,axis:"y"});var r=ia({props:e,columnIndices1:a,axis:"x",isScaled:null===(n=o.state)||void 0===n?void 0:n.isChartScaled});o.xScale=r.scale,o.xTickValues=o.xScale.tickLabels})),Ot(Bt(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),Ot(Bt(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(qr,Mt({},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",hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,toggleChartScale:o.toggleChartScale}),o.props.marginAdjustmentFinished&&f.createElement(Fr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale}))))})),o.setChartData(e),o.state={isChartScaled:!0},o}return Pt(n)}();Ot(Br,"propTypes",Bo),Ot(Br,"defaultProps",Ho);var Hr=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)}},Qr=function(e,t,n,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2,r=t,i=n;t&&n||(r=e,i=e);var l=Hr(r,i),s=l.angle+(o?Math.PI:0),c=l.length*a,u=e[0]+Math.cos(s)*c,d=e[1]+Math.sin(s)*c;return[u,d]},zr=function(e,t,n,o){var a=Qr(n[t-1],n[t-2],e,!1,o),r=Qr(e,n[t-1],n[t+1],!0,o);return"C ".concat(a.join(",")," ").concat(r.join(",")," ").concat(e.join(","))},Ur=function(e){return"L ".concat(e.join(","))},jr=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))}),"")},Kr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"onDotClick",(function(e,t,n){var a=Yo(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})})),Ot(Bt(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=So("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){var h=c.tickSize/2,y=c.getValue(t[i])+h,b=s.domain()[0],C=s(v||b),E=[y,C];r.push(E);var S=Wo({row:t,columns:n,colIndex:e,stringColumnIndex:i,legendColumn:a,dataFormatting:l});if(!isNaN(C)){var T=Yo(e,m),D=f.createElement("circle",{key:"hover-circle-".concat(T),cx:y,cy:C,r:6,style:{stroke:"transparent",fill:"transparent",cursor:"pointer"}}),x=f.createElement("circle",{className:"line-dot-inner-circle",key:T,cx:y,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,h,y=(v=r,(h=o.PATH_SMOOTHING)?jr(v,zr,h):jr(v,Ur)),b=f.createElement("path",{key:"line-".concat(Yo(0,t)),className:"line",d:y,fill:"none",stroke:g,strokeWidth:2});m.push(b)})),{paths:m,innerCircles:p}})),Ot(Bt(o),"render",(function(){if(!o.props.numberColumnIndices.filter((function(e){return!o.props.columns[e].isSeriesHidden})).length)return null;var e=o.makeChartElements(),t=e.paths,n=e.innerCircles;return f.createElement("g",{"data-test":"line"},t,n)})),o.PATH_SMOOTHING=.2,o.state={activeKey:o.props.activeChartElementKey},o}return Pt(n)}();Ot(Kr,"propTypes",Uo),Ot(Kr,"defaultProps",jo);var Yr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"state",{isChartScaled:!0}),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){var n=Za(o.props,e),a=Za(o.state,t);return!n||!a})),Ot(Bt(o),"setChartData",(function(e){var t,n,a=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(a=e.visibleSeriesIndices),o.xScale=na({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var r=ia({props: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})),Ot(Bt(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement(Kr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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,hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,toggleChartScale:o.toggleChartScale,legendShape:"line",dateColumnsOnly:!0,yGridLines:!0})))})),o.setChartData(e),o}return Pt(n)}();Ot(Yr,"propTypes",Bo),Ot(Yr,"defaultProps",Ho);var Wr=function(t){Lt(o,h);var n=Qt(o);function o(t){var a;kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a.renderPie()})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){if(a.props.isResizing&&e.isResizing)return!1;var n=Za(a.props,e),o=Za(a.state,t);return!n||!o})),Ot(Bt(a),"componentDidUpdate",(function(){a.renderPie()})),Ot(Bt(a),"componentWillUnmount",(function(){Ua(a.legend),Ua(a.pieChartContainer)})),Ot(Bt(a),"renderPie",(function(){Ua(a.pieChartContainer);var e=Bt(a);a.setPieRadius(),a.outerArc=nt().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=ot().value((function(t,n){return t.value[e.props.numberColumnIndex]}));a.dataReady=t(ct(e.sortedData.filter((function(e,t){var n,o;return!(null!==(n=a.state.legendLabels)&&void 0!==n&&null!==(o=n[t])&&void 0!==o&&o.hidden)})))),a.renderPieContainer(),a.renderPieSlices(),a.renderLegend(),a.centerVisualization(),a.renderComplete||(a.renderComplete=!0,a.props.onAxesRenderComplete())})),Ot(Bt(a),"renderPieContainer",(function(){var e=a.props,t=e.width,n=e.height;a.pieChartContainer=Ye(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,")"))})),Ot(Bt(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}))})),Ot(Bt(a),"renderPieSlices",(function(){var e=Bt(a);a.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",nt().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 Wo({row:t.data.value,columns:e.props.columns,colIndex:e.props.numberColumnIndex,stringColumnIndex: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){Ye(this).style("fill-opacity",1)})).on("mouseout",(function(e){Ye(this).style("fill-opacity",.85)})).on("click",a.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){Ye(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)+")"}}))}))})),Ot(Bt(a),"centerVisualization",(function(){var t,n=Ye("#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;Ye("#pie-chart-container-".concat(a.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),Ot(Bt(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=C(a.state.legendLabels);i[o].hidden=!a.state.legendLabels[o].hidden,a.setState({legendLabels:i},(function(){a.props.rebuildTooltips()}))}})),Ot(Bt(a),"renderLegend",(function(){var t,n=Bt(a),o=a.props.height,r=To().chartColors;if(a.state.legendLabels){t=_e().domain(a.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(r);var i=a.props.width/2-70;a.legend=Ye(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 l,s=Mr().orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).labelOffset(10).scale(t).on("cellclick",a.onLegendClick);a.legend.select(".legendOrdinal").call(s);var c=a.legend.select(".legendOrdinal").node();c&&(l=c.getBBox());var u=e(l,"height",0),d=e(l,"width",0),p=a.props.width/2-d-20,m=u<o-20?(o-u)/2:15;a.legend.select(".legendOrdinal").attr("transform","translate(".concat(p,", ").concat(m,")")),a.applyStylesForHiddenSeries()}})),Ot(Bt(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}))})),Ot(Bt(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})),Ot(Bt(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=b(),a.LEGEND_ID="react-autoql-pie-legend-".concat(b()),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=To().chartColors;a.colorScale=_e().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(Sa({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(a=t.columns)||void 0===a?void 0:a[t.stringColumnIndex]}),": ").concat(Sa({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 Pt(o)}();Ot(Wr,"propTypes",xt(xt({},Bo),{},{onAxesRenderComplete:y.func,backgroundColor:y.string,margin:y.number})),Ot(Wr,"defaultProps",xt(xt({},Ho),{},{onAxesRenderComplete:function(){},backgroundColor:"transparent",margin:40}));var Gr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;kt(this,n),Ot(Bt(o=t.call(this,e)),"onSquareClick",(function(e,t,n){var a=Yo(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})})),Ot(Bt(o),"render",(function(){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],y=l[p].label,b=To().chartColors,C=b[0],E=v>=0?C:"rgb(221, 106, 106)",S=b[1],T=Wo({row:e,columns:t,colIndex:a,stringColumnIndex:r,legendColumn:n,dataFormatting:i});u.push(f.createElement("rect",{key:Yo(a,d),"data-test":"squares",className:"square".concat(o.state.activeKey===Yo(a,d)?" active":""),x:c(h),y:s(y),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=Fe(e.data.map((function(t){return Fe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Be(e.data.map((function(t){return Be(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return o.opacityScale=Ve().domain([r,a]).range([0,1]),o.state={activeKey:o.props.activeChartElementKey},o}return Pt(n)}();Ot(Gr,"propTypes",Uo),Ot(Gr,"defaultProps",jo);var Xr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"setChartData",(function(e){o.xScale=na({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:0}),o.yScale=na({props:e,domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:0})})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement(Gr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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.setChartData(e),o}return Pt(n)}();Ot(Xr,"propTypes",Bo),Ot(Xr,"defaultProps",Ho);var Jr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;kt(this,n),Ot(Bt(o=t.call(this,e)),"state",{activeKey:o.props.activeChartElementKey}),Ot(Bt(o),"onCircleClick",(function(e,t,n){var a=Yo(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})})),Ot(Bt(o),"render",(function(){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=To().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 y=e[a],b=Number(y),C=isNaN(b)?0:b,E=e[r],S=l[h].label,T=Wo({row:e,columns:t,colIndex:a,stringColumnIndex:r,legendColumn:n,dataFormatting:i}),D=c(E),x=s(S);u.push(f.createElement("circle",{key:Yo(a,m),"data-test":"circles",className:"circle".concat(o.state.activeKey===Yo(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===Yo(a,m)?v:g,fillOpacity:.7}}))}}))})),f.createElement("g",null,u)}));var a=Fe(e.data.map((function(t){return Fe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))}))),r=Be(e.data.map((function(t){return Be(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))})));return o.radiusScale=Ve().domain([r,a]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),o}return Pt(n)}();Ot(Jr,"propTypes",Uo),Ot(Jr,"defaultProps",jo);var Zr=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"setChartData",(function(e){o.xScale=na({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:.1}),o.yScale=na({props:e,domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:.1})})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement(Jr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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.setChartData(e),o}return Pt(n)}();Ot(Zr,"propTypes",Bo),Ot(Zr,"defaultProps",Ho);var $r=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"onColumnClick",(function(t,n,o){var a=Yo(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})})),Ot(Bt(e),"render",(function(){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),y=isNaN(h)?0:h,b=e.props.colorScale(a);if(!y)return null;if(y>=0){var C=u+y;g=Math.abs(s(y)-s(0)-.5),m=s(u),u=C}else{var E=d+y;g=Math.abs(s(Math.abs(y))-s(0)-.5),m=s(E),d=E}if(g<.05)return null;var S=Wo({row:t,columns:n,colIndex:a,stringColumnIndex:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:Yo(a,c),className:"column".concat(e.state.activeKey===Yo(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:b,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-bars"},c)})),e}return Pt(n)}();Ot($r,"propTypes",Uo),Ot($r,"defaultProps",jo);var ei=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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=na({props:e,columnIndex:e.stringColumnIndex,axis:"y"});var r=ia({props: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})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement($r,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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",hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation})))})),o.setChartData(e),o}return Pt(n)}();Ot(ei,"propTypes",Bo),Ot(ei,"defaultProps",Ho);var ti=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"onColumnClick",(function(t,n,o){var a=Yo(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})})),Ot(Bt(e),"render",(function(){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),y=isNaN(h)?0:h,b=e.props.colorScale(a);if(!y)return null;if(y>=0){var C=u+y;g=Math.abs(l(y)-l(0))-.5,m=l(C)+.5,u=C}else{var E=d+y;g=Math.abs(l(y)-l(0))-.5,m=l(d)+.5,d=E}if(g<.05)return null;var S=Wo({row:t,columns:n,colIndex:a,stringColumnIndex:r,legendColumn:o,dataFormatting:i});return f.createElement("rect",{key:Yo(a,c),className:"bar".concat(e.state.activeKey===Yo(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:b,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-columns"},c)})),e}return Pt(n)}();Ot(ti,"propTypes",Uo),Ot(ti,"defaultProps",jo);var ni=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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=na({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var a=ia({props:e,columnIndices1:n,axis:"y",stacked:!0});o.yScale=a.scale})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement(ti,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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",hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,yGridLines:!0})))})),o.setChartData(e),o}return Pt(n)}();Ot(ni,"propTypes",Bo),Ot(ni,"defaultProps",Ho);var oi=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"onDotClick",(function(t,n,o){var a=Yo(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})})),Ot(Bt(e),"createPolygonVertexDot",(function(t,n,o,a,r,i,l){var s=Wo({row:t,columns:e.props.columns,colIndex:r,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return f.createElement("circle",{key:"dot-".concat(Yo(r,i)),className:"vertex-dot".concat(e.state.activeKey===Yo(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===Yo(r,i)?1:0,cursor:"pointer",stroke:l,strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),Ot(Bt(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(Yo(a,t)),className:"stacked-area".concat(e.state.activeKey===Yo(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}})})),Ot(Bt(e),"render",(function(){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,y=r(h);if(c[l]=h,p.push([v,y]),0!==g){var b=e.createPolygonVertexDot(n,o,v,y,t,l,m);s.push(b)}}));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 Pt(n)}();Ot(oi,"propTypes",Uo),Ot(oi,"defaultProps",jo);var ai=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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=na({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:1,outerPadding:0});var a=ia({props:e,columnIndices1:n,axis:"y",stacked:!0});o.yScale=a.scale,o.yTickValues=o.yScale.tickLabels})),Ot(Bt(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"},o.props.marginAdjustmentFinished&&f.createElement(oi,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),f.createElement(qr,Mt({},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,hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,dateColumnsOnly:!0,yGridLines:!0})))})),o.setChartData(e),o}return Pt(n)}();Ot(ai,"propTypes",Bo),Ot(ai,"defaultProps",Ho);var ri=function(e){Lt(n,h);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=Za(o.props,e),a=Za(o.state,t);return!n||!a})),Ot(Bt(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=na({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var s=ia({props: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})),Ot(Bt(o),"toggleChartScale",(function(){o.setState({isChartScaled:!o.state.isChartScaled})})),Ot(Bt(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(qr,Mt({},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",hasRightLegend:"right"===o.props.legendLocation,hasBottomLegend:"bottom"===o.props.legendLocation,toggleChartScale:o.toggleChartScale,yGridLines:!0}),o.props.marginAdjustmentFinished&&f.createElement(f.Fragment,null,f.createElement(Vr,Mt({},o.props,{xScale:o.xScale,yScale:o.yScale})),!!o.yScale2&&f.createElement(Kr,Mt({},o.props,{numberColumnIndices:o.props.numberColumnIndices2,xScale:o.xScale,yScale:o.yScale2,colorScale:o.props.colorScale2}))))):null})),o.setChartData(e),o.state={isChartScaled:!0},o}return Pt(n)}();Ot(ri,"propTypes",Bo),Ot(ri,"defaultProps",Ho);var ii=function(e){var t,n,o,a=e.row,r=e.index,i=e.columns,l=e.dataFormatting,s=i[r];a&&(t=null!==(n=null===(o=ba({d:a[r],column:s,dataFormatting:l}))||void 0===o?void 0:o.fullWidthLabel)&&void 0!==n?n:a[r]);return t},li=function(e,t,n){var o=C(e);return Object.keys(t).forEach((function(e){var a=n[e].aggType||"sum";o[e]=function(e,t){switch(t){case"avg":return Ke(e);case"median":return je(e);case"min":return Be(e);case"max":return Fe(e);case"deviation":return Ue(e);case"variance":return ze(e);case"count":return Qe(e);case"count-distinct":var n=e.filter(da);return Qe(n);default:return He(e)}}(t[e],a)})),o},si=function(e){var t=e.data,n=e.aggIndex,o=e.columns,a=e.numberIndices,r=e.dataFormatting;if(!((null==t?void 0:t.length)>1))return t;var i,l=[],s=We(t,(function(e){return null==e?void 0:e[n]})),c={};return s.forEach((function(e,t){var u=C(e),d=t===s.length-1,p=ii({row:u,index:n,columns:o,dataFormatting:r}),m=ii({row:i,index:n,columns:o,dataFormatting:r});if(p&&m&&p!==m){var f=li(i,c,o);l.push(f),c={}}if(function(e){var t=e.numberIndices,n=e.columns,o=e.datasetsToAggregate,a=e.row;t.forEach((function(e){if(n[e].visible){var t=Number(a[e]);o[e]?o[e].push(t):o[e]=[t]}}))}({numberIndices:a,columns:o,datasetsToAggregate:c,row:u}),d){var g=li(u,c,o);l.push(g)}else i=u})),l},ci=function(e){Lt(o,h);var t=Qt(o);function o(e){var a;kt(this,o),Ot(Bt(a=t.call(this,e)),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),Ot(Bt(a),"componentDidMount",(function(){a.props.isResizing||a.props.hidden||(a.firstRender=!1,a.forceUpdate())})),Ot(Bt(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=Za(a.props,e),o=Za(a.state,t);return!n||!o})),Ot(Bt(a),"componentDidUpdate",(function(e){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:b(),deltaX:0,deltaY:0,isLoading:!0})),a.props.type!==e.type&&xn.includes(a.props.type)&&!Po(a.props.columns[a.props.stringColumnIndex])){var t=Lo(a.props.columns);a.props.changeStringColumnIndex(t)}else if(a.props.type!==e.type&&Rn.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.props.isDrilldownChartHidden&&e.isDrilldownChartHidden||e.type&&a.props.type!==e.type)&&a.setState({chartID:b(),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);return a.setState({data:i,chartID:b(),deltaX:0,deltaY:0,isLoading:!0}),!0}})),Ot(Bt(a),"componentWillUnmount",(function(){clearTimeout(a.adjustVerticalPositionTimeout)})),Ot(Bt(a),"getColorScales",(function(){var e,t,n=a.props,o=n.numberColumnIndices,r=n.numberColumnIndices2,i=To(),l=i.chartColors,s=function(e,t){var n=zt(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=_e().range(l).domain(o);return null!=r&&r.length&&(t=_e().range(s).domain(r)),{colorScale:c,colorScale2:t}})),Ot(Bt(a),"getData",(function(e){return e.isDataAggregated?Wa(e.data,e.columns,"asc"):si({data:e.data,aggIndex:e.stringColumnIndex,columns:e.columns,numberIndices:e.numberColumnIndices,dataFormatting:e.dataFormatting})})),Ot(Bt(a),"setFinishedLoading",(function(){clearTimeout(a.loadingTimeout),a.loadingTimeout=setTimeout((function(){a.setState({isLoading:!1})}),0)})),Ot(Bt(a),"adjustVerticalPosition",(function(){a.props.hidden||(clearTimeout(a.adjustVerticalPositionTimeout),a.adjustVerticalPositionTimeout=setTimeout((function(){var e=a.getDeltas().deltaY,t=a.getInnerDimensions().innerHeight;a.setState({deltaY:e,innerHeight:t},(function(){a.setFinishedLoading()}))}),0))})),Ot(Bt(a),"adjustChartPosition",(function(){a.props.hidden||(clearTimeout(a.adjustPositionTimeout),a.adjustPositionTimeout=setTimeout((function(){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))})),Ot(Bt(a),"getDeltas",(function(){var e,t,n;if("pie"===a.props.type)return{deltaX:0,deltaY:0};var o=Da(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}})),Ot(Bt(a),"getRenderedChartDimensions",(function(){var e,t,n,o,r,i,l,s,c,u,d,p,m,f,g,v,h,y,b,C,E,S,T,D,x=null===(e=a.innerChartRef)||void 0===e||null===(t=e.axesRef)||void 0===t||null===(n=t.leftAxis)||void 0===n||null===(o=n.ref)||void 0===o?void 0:o.getBoundingClientRect(),R=null===(r=a.innerChartRef)||void 0===r||null===(i=r.axesRef)||void 0===i||null===(l=i.bottomAxis)||void 0===l||null===(s=l.ref)||void 0===s?void 0:s.getBoundingClientRect(),w=null===(c=a.innerChartRef)||void 0===c||null===(u=c.axesRef)||void 0===u||null===(d=u.rightAxis)||void 0===d||null===(p=d.ref)||void 0===p?void 0:p.getBoundingClientRect(),N=null===(m=a.innerChartRef)||void 0===m||null===(f=m.axesRef)||void 0===f||null===(g=f.topAxis)||void 0===g||null===(v=g.ref)||void 0===v?void 0:v.getBoundingClientRect(),A=null===(h=a.innerChartRef)||void 0===h||null===(y=h.axesRef)||void 0===y||null===(b=y.legendRef)||void 0===b||null===(C=b.legendClippingContainer)||void 0===C?void 0:C.getBoundingClientRect(),k=ua([x,R,w,N,A]),I=null!==(E=null==k?void 0:k.width)&&void 0!==E?E:0;return{chartHeight:null!==(S=null==k?void 0:k.height)&&void 0!==S?S:0,chartWidth:I,chartX:null!==(T=null==k?void 0:k.x)&&void 0!==T?T:0,chartY:null!==(D=null==k?void 0:k.y)&&void 0!==D?D:0}})),Ot(Bt(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}})),Ot(Bt(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})),Ot(Bt(a),"getLegendLabels",(function(){var e;return Go(a.props.columns,null===(e=a.getColorScales())||void 0===e?void 0:e.colorScale,a.props.numberColumnIndices)})),Ot(Bt(a),"getBase64Data",(function(){var e=a.chartRef;return e?xa(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),Ot(Bt(a),"saveAsPNG",(function(){var e=a.chartRef;e&&xa(e,20).then((function(e){var t=e;t=(t=t.replace(/^data:image\/[^;]*/,"data:application/octet-stream")).replace(/^data:application\/octet-stream/,"data:application/octet-stream;headers=Content-Disposition%3A%20attachment%3B%20filename=Canvas.png");var n=document.createElement("a");n.setAttribute("href",t),n.setAttribute("download","Chart.png"),n.setAttribute("target","_blank"),n.style.display="none",document.body.appendChild(n),n.click()})).catch((function(e){console.error(e)}))})),Ot(Bt(a),"getCommonChartProps",(function(){var e,t,n,o,r=a.state,i=r.deltaX,l=r.deltaY,s=a.props,c=s.numberColumnIndices,u=s.numberColumnIndices2,d=s.columns,p=s.enableDynamicCharting,m=c.filter((function(e){return(null==d?void 0:d[e])&&!d[e].isSeriesHidden})),f=null==u?void 0:u.filter((function(e){return(null==d?void 0:d[e])&&!d[e].isSeriesHidden})),g=a.getInnerDimensions(),v=g.innerHeight,h=g.innerWidth,y=a.getOuterDimensions(),b=y.outerHeight,C=y.outerWidth,E=a.getColorScales(),S=E.colorScale,T=E.colorScale2;return xt(xt({},a.props),{},{setIsLoadingMoreRows:function(e){return a.setState({isLoadingMoreRows:e})},ref:function(e){return a.innerChartRef=e},innerChartRef:null===(e=a.innerChartRef)||void 0===e?void 0:e.chartRef,key:void 0,data:a.state.data||a.props.data,disableTimeScale:a.disableTimeScale,colorScale:S,colorScale2:T,dataLength:null===(t=a.props.data)||void 0===t?void 0:t.length,height:v,width:h,outerHeight:b,outerWidth:C,deltaX:i,deltaY:l,chartPadding:a.PADDING,enableAxisDropdown:p&&!a.props.isPivot,marginAdjustmentFinished:!0,legendLocation:(n=c,o=a.props.type,"column_line"===o?"right":(null==n?void 0:n.length)<2||"pie"===o||"heatmap"===o||"bubble"===o?void 0:"stacked_column"===o||"stacked_bar"===o||"stacked_line"===o||(null==n?void 0:n.length)>2||(null==n?void 0:n.length)>1?"right":void 0),legendLabels:a.getLegendLabels(),onLabelRotation:a.adjustVerticalPosition,visibleSeriesIndices:m,visibleSeriesIndices2:f,tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID,chartContainerRef:a.chartContainerRef,popoverParentElement:a.props.popoverParentElement,totalRowCount:a.props.totalRowCount,chartID:a.state.chartID,rebuildTooltips:a.props.rebuildTooltips,onAxesRenderComplete:a.adjustChartPosition})})),Ot(Bt(a),"renderChartLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(sr,null)))})),Ot(Bt(a),"renderColumnChart",(function(){return f.createElement(_r,a.getCommonChartProps())})),Ot(Bt(a),"renderBarChart",(function(){return f.createElement(Br,a.getCommonChartProps())})),Ot(Bt(a),"renderLineChart",(function(){return f.createElement(Yr,a.getCommonChartProps())})),Ot(Bt(a),"renderPieChart",(function(){return f.createElement(Wr,a.getCommonChartProps())})),Ot(Bt(a),"renderHeatmapChart",(function(){return f.createElement(Xr,a.getCommonChartProps())})),Ot(Bt(a),"renderBubbleChart",(function(){return f.createElement(Zr,a.getCommonChartProps())})),Ot(Bt(a),"renderStackedColumnChart",(function(){return f.createElement(ni,a.getCommonChartProps())})),Ot(Bt(a),"renderStackedBarChart",(function(){return f.createElement(ei,a.getCommonChartProps())})),Ot(Bt(a),"renderStackedLineChart",(function(){return f.createElement(ai,a.getCommonChartProps())})),Ot(Bt(a),"renderColumnLineChart",(function(){return f.createElement(ri,a.getCommonChartProps())})),Ot(Bt(a),"renderChart",(function(){switch(a.props.type){case"column":return a.renderColumnChart();case"bar":return a.renderBarChart();case"line":return a.renderLineChart();case"pie":return a.renderPieChart();case"bubble":return a.renderBubbleChart();case"heatmap":return a.renderHeatmapChart();case"stacked_column":return a.renderStackedColumnChart();case"stacked_bar":return a.renderStackedBarChart();case"stacked_line":return a.renderStackedLineChart();case"column_line":return a.renderColumnLineChart();default:return"Unknown Display Type"}})),Ot(Bt(a),"render",(function(){var e=So("font-family"),t=So("text-color-primary"),n=So("background-color-secondary");return f.createElement(Kt,null,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(v,null,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:e,color:t,background:n}},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=10,a.FONT_SIZE=12,a.firstRender=!0,a.shouldRecalculateDimensions=!1,a.state={chartID:b(),data:r,deltaX:0,deltaY:0,isLoading:!0,isLoadingMoreRows:!1},a}return Pt(o)}();Ot(ci,"propTypes",xt(xt({},_o),{},{rebuildTooltips:y.func,type:y.string.isRequired})),Ot(ci,"defaultProps",Fo);var ui=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),Ot(Bt(t),"suggestionLists",[]),Ot(Bt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),Ot(Bt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),Ot(Bt(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 xt({id:b(),hidden:!1},e)})),r=[].concat(zt(a),[{id:b(),text:o}]);n.push(r)})),n})),Ot(Bt(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})),Ot(Bt(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})),Ot(Bt(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)}}))}})),Ot(Bt(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||b()})),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:C(e)})})),Ot(Bt(t),"initializeQueryValidationOptions",(function(e){var n=e.data,o=n.replacements,a=n.query;if(!o||!a)return[];t.suggestionLists=t.getSuggestionLists(a,o),t.plainTextList=t.getPlainTextList(a,o),t.setInitialSelections()})),Ot(Bt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var o=t.suggestionLists[n].find((function(t){return t.id===e})),a=C(t.state.selectedSuggestions);a[n]=o,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(a),a),t.updateStartAndEndIndexes(a),t.setState({selectedSuggestions:C(a)})}else t.deleteQueryValidationSuggestion(n)})),Ot(Bt(t),"deleteQueryValidationSuggestion",(function(e){var n=C(t.state.selectedSuggestions.map((function(t,n){return n===e?xt(xt({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:C(n)})})),Ot(Bt(t),"renderWordSelector",(function(e){var n=C(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(bn,{type:"trash"})," Remove term")}),f.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},f.createElement(Sr,{options:a,key:b(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),Ot(Bt(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:b()},o,a)})))})),Ot(Bt(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})),Ot(Bt(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("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},f.createElement(bn,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return Pt(o)}();Ot(ui,"propTypes",{response:y.shape({}),onSuggestionClick:y.func,autoSelectSuggestion:y.bool,isQueryRunning:y.bool,initialSelections:y.arrayOf(y.shape({})),onQueryValidationSelectOption:y.func,message:y.string}),Ot(ui,"defaultProps",{response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var di=function(e){try{return{c_type:"DATE",eng:e.eng.split(" ").map((function(e){if(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}}(e)){var t=o(e).utc().format("ll");if("Invalid Date"!==t)return t}return e})).join(" ")}}catch(t){return{c_type:"TEXT",eng:e.eng}}},pi=function(t){try{if(!t)return;var n=[];return e(t,"length")&&t.forEach((function(e){"FILTER"===e.c_type||"SEED"===e.c_type?function(e){try{for(var t,n=/'(''|[^'])*'/g,o=e.eng,a=[];null!==(t=n.exec(o));)a.push(t);return a.length?function(e,t,n){var o=0,a=[];return t.forEach((function(r,i){if(r.index>o){var l=e.substring(o,r.index);a.push({c_type:"TEXT",eng:l})}var s,c=r[0].length+r.index,u=e.substring(r.index,c),d=(s=u).substring(1,s.length-1).replace("''","'");if(o=c,a.push({c_type:n,eng:d}),i===t.length-1&&c<e.length){var p=e.substring(c,e.length);a.push({c_type:"TEXT",eng:p})}})),a}(o,a,"VALUE_LABEL"):[di(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}}(e).forEach((function(e){n.push(e)})):n.push(e)})),n}catch(e){return void console.error(e)}},mi=function(n){Lt(a,f.Component);var o=Qt(a);function a(n){var r;return kt(this,a),Ot(Bt(r=o.call(this,n)),"componentDidMount",(function(){var e;r._isMounted=!0,r.props.onValueLabelClick&&null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length&&r.validateAndUpdateValueLabels()})),Ot(Bt(r),"shouldComponentUpdate",(function(e,t){var n,o;return!(null===(n=e.reverseTranslation)||void 0===n||!n.length||null!==(o=r.props.reverseTranslation)&&void 0!==o&&o.length)||(!e.isResizing||!r.props.isResizing)&&(!Za(r.props,e)||!Za(r.state,t))})),Ot(Bt(r),"componentDidUpdate",(function(e,t){var n,o,a,i;null!==(n=e.reverseTranslation)&&void 0!==n&&n.length||null===(o=r.props.reverseTranslation)||void 0===o||!o.length||r.setState({reverseTranslationArray:pi(r.props.reverseTranslation)}),null!==(a=t.reverseTranslationArray)&&void 0!==a&&a.length||null===(i=r.state.reverseTranslationArray)||void 0===i||!i.length||r.validateAndUpdateValueLabels()})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1})),Ot(Bt(r),"validateAndUpdateValueLabels",(function(){if(r.state.reverseTranslationArray.length){var n=[],o=t(r.state.reverseTranslationArray);r.state.reverseTranslationArray.forEach((function(t,a){"VALUE_LABEL"===t.c_type&&n.push(so(xt({suggestion:t.eng},Yn(r.props.authentication))).then((function(t){e(t,"data.data.matches.length")&&(o[a].c_type="VALIDATED_VALUE_LABEL")})))})),Promise.all(n).then((function(){r._isMounted&&r.setState({isValidated:!0,reverseTranslationArray:o})}))}})),Ot(Bt(r),"renderFilterLockLink",(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)}}," ",r.props.appliedFilters.includes(e)&&f.createElement(bn,{type:"lock"})," ",f.createElement("span",null,e))})),Ot(Bt(r),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return r.props.onValueLabelClick?r.renderFilterLockLink(e.eng):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),Ot(Bt(r),"render",(function(){var t;return e(r.state.reverseTranslationArray,"length")?f.createElement(Kt,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(bn,{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(Sn,{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=b(),r.state={isValidated:!1,reverseTranslationArray:pi(n.reverseTranslation)},r}return Pt(a)}();Ot(mi,"propTypes",{authentication:Gt,interpretation:y.array,onValueLabelClick:y.func,appliedFilters:y.array,reverseTranslation:y.array}),Ot(mi,"defaultProps",{authentication:Un,interpretation:[],appliedFilters:[],reverseTranslation:[],onValueLabelClick:void 0});var fi=function(t){Lt(r,f.Component);var a=Qt(r);function r(t){var i,l,s,c,u,d,p,g,h,y,E,S,T,D,x,R,w;kt(this,r),Ot(Bt(w=a.call(this,t)),"componentDidMount",(function(){try{w._isMounted=!0,w.updateToolbars()}catch(e){console.error(e),w.props.onErrorCallback(e)}})),Ot(Bt(w),"shouldComponentUpdate",(function(e,t){return!(!w.props.shouldRender&&!e.shouldRender)&&((!w.props.isResizing||!e.isResizing)&&(!(!w.props.queryResponse&&!w.queryResponse)&&(!Za(w.props,e)||!Za(w.state,t))))})),Ot(Bt(w),"componentDidUpdate",(function(e,t){try{var o,a,r={},i=!1;!n(w.props.initialTableConfigs,{tableConfig:w.tableConfig,pivotTableConfig:w.pivotTableConfig})&&w.props.onTableConfigChange&&w.onTableConfigChange(),t.displayType!==w.state.displayType&&w.rebuildTooltips(),((null===(o=w.state.visibleRows)||void 0===o?void 0:o.length)!==(null===(a=t.visibleRows)||void 0===a?void 0:a.length)||"table"===w.state.displayType&&"text"===t.displayType)&&setTimeout((function(){w.props.onRowChange()}),0);var l=w.state.columnChangeCount!==t.columnChangeCount,s=w.state.visibleRowChangeCount!==t.visibleRowChangeCount;if(l||s){l&&w.props.onColumnChange(w.state.columns),w.shouldGeneratePivotData()&&(w.generatePivotData({isFirstGeneration:!0,newTableData:w.state.visibleRows}),i=!0);var c=w.getCurrentSupportedDisplayTypes();n(c,w.state.supportedDisplayTypes)||(r.supportedDisplayTypes=c)}n(w.state.supportedDisplayTypes,t.supportedDisplayTypes)||w.isCurrentDisplayTypeValid()||(r.displayType=w.getUpdatedDefaultDisplayType("table")),w.updateToolbars(),De(r)?i&&w.forceUpdate():w.setState(r)}catch(e){console.error(e)}})),Ot(Bt(w),"componentWillUnmount",(function(){try{w._isMounted=!1,En(),clearTimeout(w.rebuildTooltipsTimer)}catch(e){console.error(e)}})),Ot(Bt(w),"refreshLayout",(function(){var e;w.chartRef&&(null===(e=w.chartRef)||void 0===e||e.adjustChartPosition())})),Ot(Bt(w),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;w.props.shouldRender&&(w.props.rebuildTooltips?w.props.rebuildTooltips(e):(clearTimeout(w.rebuildTooltipsTimer),w.rebuildTooltipsTimer=setTimeout((function(){Cn()}),e)))})),Ot(Bt(w),"onTableConfigChange",(function(){w.props.onTableConfigChange({tableConfig:w.tableConfig,pivotTableConfig:w.pivotTableConfig})})),Ot(Bt(w),"changeDisplayType",(function(e){w.props.onDisplayTypeChange&&w.props.onDisplayTypeChange(e),w.setState({displayType:e})})),Ot(Bt(w),"displayTypeInvalidWarning",(function(e){console.warn('Initial display type "'.concat(w.props.initialDisplayType,'" provided is not valid for this dataset. Using ').concat(e||w.state.displayType," instead."))})),Ot(Bt(w),"getDataLength",(function(){var e,t,n,o;return null!==(e=w.state)&&void 0!==e&&e.visibleRows?null===(t=w.state)||void 0===t||null===(n=t.visibleRows)||void 0===n?void 0:n.length:null===(o=w.tableData)||void 0===o?void 0:o.length})),Ot(Bt(w),"getPivotDataLength",(function(){var e,t,n,o;return null!==(e=w.state)&&void 0!==e&&e.visiblePivotRows?null===(t=w.state)||void 0===t||null===(n=t.visiblePivotRows)||void 0===n?void 0:n.length:null===(o=w.pivotTableData)||void 0===o?void 0:o.length})),Ot(Bt(w),"getUpdatedDefaultDisplayType",(function(e){return Ha(w.props.queryResponse,w.props.autoChartAggregations,w.getColumns(),w.getDataLength(),w.getPivotDataLength(),e,w.isDataLimited())})),Ot(Bt(w),"getDisplayTypeFromInitial",(function(e){var t,n,o=e.initialDisplayType,a=w.getUpdatedDefaultDisplayType(w.props.preferredDisplayType);return o&&Fa(e.queryResponse,o,null===(t=w.tableData)||void 0===t?void 0:t.length,null===(n=w.pivotTableData)||void 0===n?void 0:n.length,w.getColumns(),w.isDataLimited())||(o=a),o})),Ot(Bt(w),"hasError",(function(e){try{var t=Number(e.data.reference_id.split(".")[2]);if(t>=200&&t<300)return!1}catch(e){console.warn("Invalid reference ID provided for error")}return!0})),Ot(Bt(w),"getColumns",(function(){var e,t,n;return w._isMounted?w.state.columns:w.formatColumnsForTable(null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.columns)})),Ot(Bt(w),"supportsPivot",(function(){var e=w.getPotentialDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),Ot(Bt(w),"supportsDatePivot",(function(){var e=w.getColumns();return w.supportsPivot()&&2===(null==e?void 0:e.length)})),Ot(Bt(w),"usePivotDataForChart",(function(){return w.supportsPivot()&&!w.supportsDatePivot()})),Ot(Bt(w),"areColumnsValid",(function(e){var t,n,o,a=null===(t=w.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.columns;return!(null==e||!e.length||null==a||!a.length)&&e.every((function(e){return a.find((function(t){e.name,t.name}))}))})),Ot(Bt(w),"isTableConfigValid",(function(e,t,n){try{if(!e||!e.numberColumnIndices||!e.stringColumnIndices||isNaN(Number(e.numberColumnIndex))||isNaN(Number(e.stringColumnIndex)))return console.debug("Table config provided was incomplete"),!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(!t[e.stringColumnIndex].is_visible||!t[e.numberColumnIndex].is_visible||void 0!==e.numberColumnIndices.find((function(e){return!t[e].is_visible}))||void 0!==e.stringColumnIndices.find((function(e){return!t[e].is_visible})))return console.debug("Some of the table config indices were hidden columns"),!1;if("column_line"===n){if(!isNaN(e.numberColumnIndex)&&!isNaN(e.numberColumnIndex2)&&e.numberColumnIndex===e.numberColumnIndex2)return console.debug("Both axes reference the same number column index"),!1;if(e.numberColumnIndices.length&&e.numberColumnIndices2.length&&e.numberColumnIndices.filter((function(t){return e.numberColumnIndices2.includes(t)})).length)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]&&ko(t[e])})))return console.debug("Saved number indices are not number columns"),!1;if(!e.stringColumnIndices.every((function(e){return t[e]&&Io(t[e])})))return console.debug("Saved string indices are not string columns"),!1;if(!e.numberColumnIndices2){var o=Oo(t,w.usePivotDataForChart()),a=o.numberColumnIndices2,r=o.numberColumnIndex2;e.numberColumnIndices2=a,e.numberColumnIndex2=r}return!0}catch(e){return console.debug("Saved table config was not valid for dashboard tile response:",null==e?void 0:e.message),!1}})),Ot(Bt(w),"updateColumns",(function(e){if(e&&w._isMounted){var t=w.formatColumnsForTable(e);w.isTableConfigValid(w.tableConfig,t,w.state.displayType)||(w.tableConfig=void 0,w.setTableConfig(t),w.chartID=b()),w.setState({columns:t,columnChangeCount:w.state.columnChangeCount+1})}})),Ot(Bt(w),"generateAllData",(function(){var e,t;null!==(e=w.queryResponse)&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.data&&w.shouldGenerateTableData()&&(w.generateTableData(),w.shouldGeneratePivotData()&&w.generatePivotData({isFirstGeneration:!0}))})),Ot(Bt(w),"shouldGeneratePivotData",(function(){var e;return((null===(e=w.state)||void 0===e?void 0:e.visibleRows)||w.tableData)&&w.supportsPivot()})),Ot(Bt(w),"shouldGenerateTableData",(function(){var e,t,n;return!(null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||!n.rows)})),Ot(Bt(w),"generateTableData",(function(e,t){if(t)w.tableData=t;else{var n,o,a,r,i,l,s=e||w.getColumns();if(w.isDataLimited())w.tableData=null===(n=w.queryResponse)||void 0===n||null===(o=n.data)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.rows;else w.tableData=Wa(null===(r=w.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.rows,s,"desc","isTable");w.setTableConfig(),w._isMounted&&w.setState({columns:s})}})),Ot(Bt(w),"generatePivotData",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var o;w.pivotTableID=b();var a=(null===(o=w.state)||void 0===o?void 0:o.visibleRows)||w.tableData,r=w.getColumns();2===r.length?w.generateDatePivotData(a):w.generatePivotTableData({isFirstGeneration:n})}catch(e){console.error(e),w.props.onErrorCallback(e),w.pivotTableData=void 0}w.props.allowDisplayTypeChange&&(null===(e=w.pivotTableRef)||void 0===e||e.updateData(w.pivotTableData))})),Ot(Bt(w),"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"},w.props.showSuggestionPrefix&&f.createElement("div",{className:"react-autoql-suggestion-message-prefix"},"I want to make sure I understood your query. Did you mean:"),w.props.renderSuggestionsAsDropdown?f.createElement("select",{key:b(),onChange:function(e){w._isMounted&&(w.setState({selectedSuggestion:e.target.value}),w.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:w.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return f.createElement("option",{key:b(),value:e},e)}))):e.map((function(e){return f.createElement("div",{key:b(),"data-test":"suggestion-list-button"},f.createElement("button",{onClick:function(){return w.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t})},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 w.props.renderFullSuggestionMessage?f.createElement("div",{style:{textAlign:"center"}},w.renderError(w.queryResponse),n):n})),Ot(Bt(w),"renderSingleValueResponse",(function(){var t;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(Gn(w.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){w.processDrilldown({groupBys:[],supportedByAPI:!0})}},Sa({element:e(w.queryResponse,"data.data.rows[0][0]"),column:null===(t=w.state.columns)||void 0===t?void 0:t[0],config:Wn(w.props.dataFormatting)}))))})),Ot(Bt(w),"copyTableToClipboard",(function(){var e,t;"table"===w.state.displayType&&null!==(e=w.tableRef)&&void 0!==e&&e._isMounted?w.tableRef.copyToClipboard():"pivot_table"===w.state.displayType&&null!==(t=w.pivotTableRef)&&void 0!==t&&t._isMounted&&w.pivotTableRef.copyToClipboard()})),Ot(Bt(w),"getBase64Data",(function(){var e,t;if(w.chartRef&&Na(w.state.displayType))return w.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=w.tableRef)&&void 0!==e&&e._isMounted&&"table"===w.state.displayType){var n=w.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=w.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===w.state.displayType){var o=w.pivotTableRef.getBase64Data();return Promise.resolve(o)}})),Ot(Bt(w),"saveChartAsPNG",(function(){w.chartRef&&w.chartRef.saveAsPNG()})),Ot(Bt(w),"queryFn",(function(){var e,t,n,o,a,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.fe_req,s=w.getCombinedFilters();return w.cancelCurrentRequest(),w.axiosSource=null===(o=m.CancelToken)||void 0===o?void 0:o.source(),w.isDrilldown()?io(xt(xt(xt({},Yn(w.props.authentication)),Gn(w.props.autoQLConfig)),{},{source:null==l?void 0:l.source,debug:"include"===(null==l?void 0:l.translation),filters:null==l?void 0:l.session_filter_locks,pageSize:null==l?void 0:l.page_size,test:null==l?void 0:l.test,groupBys:null==l?void 0:l.columns,queryID:w.props.originalQueryID,orders:null===(r=w.formattedTableParams)||void 0===r?void 0:r.sorters,tableFilters:s,cancelToken:w.axiosSource.token},i)):oo(xt(xt(xt({},Yn(w.props.authentication)),Gn(w.props.autoQLConfig)),{},{query:null==l?void 0:l.text,source:null==l?void 0:l.source,debug:"include"===(null==l?void 0:l.translation),userSelection:null==l?void 0:l.disambiguation,filters:null==l?void 0:l.session_filter_locks,test:null==l?void 0:l.test,pageSize:null==l?void 0:l.page_size,orders:null===(a=w.formattedTableParams)||void 0===a?void 0:a.sorters,tableFilters:s,cancelToken:w.axiosSource.token},i))})),Ot(Bt(w),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var o,a=null===(o=w.tableData)||void 0===o?void 0:o.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=C(w.queryResponse);return r.data.data.rows=a,r.data.data.count_rows=a.length,r}catch(e){console.error(e)}})),Ot(Bt(w),"cancelCurrentRequest",(function(){var e;null===(e=w.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(w),"processDrilldown",function(){var e=At(Rt().mark((function e(t){var n,o,a,r,i,l,s,c,u,d,p,m,f;return Rt().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,!Gn(w.props.autoQLConfig).enableDrilldowns){e.next=45;break}if(e.prev=2,l=w.getDefaultQueryPageSize(),s=w.getColumns(),c=s[i],!o){e.next=20;break}return w.props.onDrilldownStart(r),e.prev=8,e.next=11,io(xt(xt(xt({},Yn(w.props.authentication)),Gn(w.props.autoQLConfig)),{},{queryID:w.queryID,groupBys:n,pageSize:l}));case 11:u=e.sent,w.props.onDrilldownEnd({response:u,originalQueryID:w.queryID}),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(8),w.props.onDrilldownEnd({response:e.t0});case 18:e.next=39;break;case 20:if(isNaN(i)||null==a||!a.length){e.next=39;break}if(w.props.onDrilldownStart(r),w.isDataLimited()||Po(c)){e.next=27;break}d=w.getFilterDrilldown({stringColumnIndex:i,row:a}),setTimeout((function(){w.props.onDrilldownEnd({response:d})}),1500),e.next=39;break;case 27:return p=w.constructFilter({column:w.state.columns[i],value:a[i]}),m=w.getCombinedFilters(p),e.prev=29,e.next=32,w.queryFn({tableFilters:m,pageSize:l});case 32:f=e.sent,e.next=38;break;case 35:e.prev=35,e.t1=e.catch(29),f=e.t1;case 38:w.props.onDrilldownEnd({response:f,originalQueryID:w.queryID});case 39:e.next=45;break;case 41:e.prev=41,e.t2=e.catch(2),console.error(e.t2),w.props.onDrilldownEnd({error:"Error processing drilldown"});case 45:case"end":return e.stop()}}),e,null,[[2,41],[8,15],[29,35]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(w),"constructFilter",(function(e){var t=e.column,n=e.value,o=n,a="=";if(null===o)o="NULL",a="is";else if("DATE"===t.type){var r=Ea({value:n,column:t,config:w.props.dataFormatting}),i=or(t.precision),l=r.startOf(i).toISOString(),s=r.endOf(i).toISOString();o="".concat(l,",").concat(s),a="between"}return{name:t.name,operator:a,value:o}})),Ot(Bt(w),"getCombinedFilters",(function(e){var t,n,o,a,r=null===(t=w.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.fe_req,i=(null==r?void 0:r.filters)||[],l=(null===(a=w.formattedTableParams)||void 0===a?void 0:a.filters)||[],s=[];if(l.forEach((function(e){var t=i.find((function(t){return t.name===e.name}));s.push(null!=t?t:e)})),i.forEach((function(e){s.find((function(t){return t.name===e.name}))||s.push(e)})),e){var c=s.findIndex((function(t){return t.name===e.name}));c>=0?s[c]=e:s.push(e)}return s})),Ot(Bt(w),"onTableCellClick",(function(e){var t,n;if(null==e||null===(t=e.getColumn())||void 0===t||null===(n=t.getDefinition())||void 0===n||!n.pivot){var o=w.getColumns();if(o){var a={};if(w.pivotTableColumns&&"pivot_table"===w.state.displayType)if(w.supportsDatePivot()){var r,i,l,s,c,u,d=Lo(o),p=null===(r=e.getColumn())||void 0===r||null===(i=r.getDefinition())||void 0===i?void 0:i.title,m=null===(l=e.getData())||void 0===l?void 0:l[0],f=null===(s=w.pivotOriginalColumnData)||void 0===s||null===(c=s[p])||void 0===c?void 0:c[m];a=[{name:null===(u=o[d])||void 0===u?void 0:u.name,value:f}]}else{var g=o[w.tableConfig.legendColumnIndex],v=o[w.tableConfig.stringColumnIndex];a=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=Qa(o,s),u=a.name,d=(null==t||null===(i=t.getRow())||void 0===i?void 0:i.getPosition())-1,p=Qa(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:w.pivotRowHeaders,columnHeaders:w.pivotColumnHeaders,rowHeaderDefinition:v,columnHeaderDefinition:g})}else a=function(e,t){if(e&&t){var n=wa(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,o);w.processDrilldown({groupBys:a,supportedByAPI:!!a})}}})),Ot(Bt(w),"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=[],u=r[a],d=(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 p,m,f,g=Number(null==r||null===(p=r[a])||void 0===p?void 0:p.name),v=null==o?void 0:o[i],h="".concat(null===(m=w.pivotOriginalColumnData)||void 0===m||null===(f=m[g])||void 0===f?void 0:f[v]);c.push({name:d.name,value:h})}else null!=d&&d.groupable&&c.push({name:d.name,value:"".concat(null==o?void 0:o[i])});null!=l&&l.groupable&&u.origColumn&&c.push({name:l.name,value:"".concat(null==u?void 0:u.name)}),c.length,w.processDrilldown({groupBys:c,supportedByAPI:!!c.length,row:o,activeKey:s,stringColumnIndex:i})})),Ot(Bt(w),"updateToolbars",(function(){w.updateVizToolbar(),w.updateOptionsToolbar()})),Ot(Bt(w),"updateVizToolbar",(function(){var e;null!==(e=w.props.vizToolbarRef)&&void 0!==e&&e._isMounted&&w.props.vizToolbarRef.forceUpdate()})),Ot(Bt(w),"updateOptionsToolbar",(function(){var e;null!==(e=w.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&w.props.optionsToolbarRef.forceUpdate()})),Ot(Bt(w),"toggleTableFilter",(function(){var e,t;return"table"===w.state.displayType?(null===(e=w.tableRef)||void 0===e?void 0:e._isMounted)&&w.tableRef.toggleIsFiltering():"pivot_table"===w.state.displayType?(null===(t=w.pivotTableRef)||void 0===t?void 0:t._isMounted)&&w.pivotTableRef.toggleIsFiltering():void 0})),Ot(Bt(w),"onNewPage",(function(e){if(null!=e&&e.length)try{w.tableData=[].concat(zt(w.tableData),zt(e)),w.setState({visibleRowChangeCount:w.state.visibleRowChangeCount+1,visibleRows:w.tableData})}catch(e){console.error(e)}})),Ot(Bt(w),"onTableParamsChange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};w.tableParams=C(e),w.formattedTableParams=t})),Ot(Bt(w),"onNewData",(function(e,t){var n,o,a,r;w.isOriginalData=!1,w.queryResponse=e;var i,l=null==e||null===(n=e.data)||void 0===n?void 0:n.data;(w.tableData=(null==l?void 0:l.rows)||[],"table"!==w.state.displayType&&w.props.allowDisplayTypeChange)&&(w.tableData.length>=(null==l?void 0:l.count_rows)?w.tableID=b():null===(i=w.tableRef)||void 0===i||i.updateData(w.tableData));w.setState({visibleRows:e.data.data.rows,visibleRowChangeCount:w.state.visibleRowChangeCount+1});var s=null!=t?t:null==e||null===(o=e.data)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.fe_req)||void 0===r?void 0:r.page_size;w.props.onPageSizeChange(s)})),Ot(Bt(w),"onTableFilter",function(){var e=At(Rt().mark((function e(t,o){var a,r;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!n(t,null===(a=w.tableParams)||void 0===a?void 0:a.filters)){e.next=2;break}return e.abrupt("return");case 2:w.tableParams.filters=C(t),r=[],o.forEach((function(e){r.push(e.getData())})),w.setState({visibleRows:r,visibleRowChangeCount:w.state.visibleRowChangeCount+1});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),Ot(Bt(w),"onTableSort",(function(e){w.tableParams.sorters=C(e)})),Ot(Bt(w),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex,n=w.usePivotDataForChart(),o=C(n?w.pivotTableColumns:w.state.columns);if(null!=o&&o.length)if(o[t].isSeriesHidden=!o[t].isSeriesHidden,n)w.pivotTableColumns=o,w.forceUpdate();else{var a=w.formatColumnsForTable(o);w.setState({columns:a})}})),Ot(Bt(w),"onChangeStringColumnIndex",(function(e){w.usePivotDataForChart()?(w.pivotTableConfig.legendColumnIndex===e&&(w.pivotTableConfig.legendColumnIndex=void 0),w.pivotTableConfig.stringColumnIndex=e,w.generatePivotTableData()):(w.tableConfig.legendColumnIndex===e&&(w.tableConfig.legendColumnIndex=void 0),w.tableConfig.stringColumnIndex=e),w.forceUpdate()})),Ot(Bt(w),"onChangeLegendColumnIndex",(function(e){w.usePivotDataForChart()?(w.pivotTableConfig.stringColumnIndex===e&&(w.pivotTableConfig.stringColumnIndex=void 0),w.pivotTableConfig.legendColumnIndex=e,w.generatePivotTableData()):(w.tableConfig.stringColumnIndex===e&&(w.tableConfig.stringColumnIndex=void 0),w.tableConfig.legendColumnIndex=e),w.forceUpdate()})),Ot(Bt(w),"onChangeNumberColumnIndices",(function(e,t,n){if(e)if(w.usePivotDataForChart())w.pivotTableConfig.numberColumnIndices=e,w.pivotTableConfig.numberColumnIndex=e[0],t&&(w.pivotTableConfig.numberColumnIndices2=t,w.pivotTableConfig.numberColumnIndex2=t[0]),n&&(w.pivotTableColumns=n),w.forceUpdate();else{w.tableConfig.numberColumnIndices=e,w.tableConfig.numberColumnIndex=e[0],t&&(w.tableConfig.numberColumnIndices2=t,w.tableConfig.numberColumnIndex2=t[0]);var o=null!=n?n:w.state.columns;w.updateColumns(o)}})),Ot(Bt(w),"setPivotTableConfig",(function(e){var t=w.pivotTableColumns;if(t){var o=C(w.pivotTableConfig);if(w.pivotTableConfig||(w.pivotTableConfig={}),e||!w.pivotTableConfig.stringColumnIndices||!(w.pivotTableConfig.stringColumnIndex>=0)){var a=qo(t,"supportsPivot"),r=a.stringColumnIndices,i=a.stringColumnIndex;w.pivotTableConfig.stringColumnIndices=r,w.pivotTableConfig.stringColumnIndex=i}if(e||!w.pivotTableConfig.numberColumnIndices){var l=Oo(t,w.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;w.pivotTableConfig.numberColumnIndices=c,w.pivotTableConfig.numberColumnIndex=s,w.pivotTableConfig.numberColumnIndices2=d,w.pivotTableConfig.numberColumnIndex2=u,w.pivotTableConfig.currencyColumnIndices=p,w.pivotTableConfig.quantityColumnIndices=m,w.pivotTableConfig.ratioColumnIndices=f}n(o,w.pivotTableConfig)||w.onTableConfigChange()}})),Ot(Bt(w),"setTableConfig",(function(e){var t=null!=e?e:w.getColumns();if(t){var o=C(w.tableConfig);if(w.tableConfig||(w.tableConfig={}),!(w.tableConfig.stringColumnIndices&&w.tableConfig.stringColumnIndex>=0)){var a=qo(t),r=a.stringColumnIndices,i=a.stringColumnIndex;w.tableConfig.stringColumnIndices=r,w.tableConfig.stringColumnIndex=i}if(!(w.tableConfig.numberColumnIndices&&w.tableConfig.numberColumnIndex>=0)){var l=Oo(t,w.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;w.tableConfig.numberColumnIndices=c,w.tableConfig.numberColumnIndex=s,w.tableConfig.numberColumnIndices2=d,w.tableConfig.numberColumnIndex2=u,w.tableConfig.currencyColumnIndices=p,w.tableConfig.quantityColumnIndices=m,w.tableConfig.ratioColumnIndices=f}var g=t.findIndex((function(e,t){return e.groupable&&t!==w.tableConfig.stringColumnIndex}));g>=0&&(w.tableConfig.legendColumnIndex=g),n(o,w.tableConfig)||w.onTableConfigChange()}})),Ot(Bt(w),"getPotentialDisplayTypes",(function(){var e,t,n,o;return _a({response:w.queryResponse,columns:null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.columns)||void 0===o?void 0:o.map((function(e){return xt({},e)}))})})),Ot(Bt(w),"isCurrentDisplayTypeValid",(function(){return Fa(w.queryResponse,w.state.displayType,w.getDataLength(),w.getPivotDataLength(),w.getColumns(),w.isDataLimited())})),Ot(Bt(w),"getCurrentSupportedDisplayTypes",(function(){return _a({response:w.queryResponse,columns:w.getColumns(),dataLength:w.getDataLength(),pivotDataLength:w.getPivotDataLength(),isDataLimited:w.isDataLimited()})})),Ot(Bt(w),"setFilterFunction",(function(e){var t=Bt(w);return"DATE"===e.type?function(t,n,a,r){try{var i;if(!n)return!1;var l=Ea({value:n,column:e,config:w.props.dataFormatting}),s=t.split(" to "),c=or(nr(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),w.props.onErrorCallback(e),!1}}:"DATE_STRING"===e.type?function(n,o,a,r){try{if(!o)return!1;var i=Sa({element:o,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),w.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),w.props.onErrorCallback(e),!1}}:void 0})),Ot(Bt(w),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(t,n){return Ya(t,n,e,"isTable")}:(e.type,"alphanum")})),Ot(Bt(w),"setHeaderFilterPlaceholder",(function(e){return"DATE"!==e.type||e.pivot?"Filter":"Pick range"})),Ot(Bt(w),"formatColumnsForTable",(function(e){if(!e)return null;var t=0===Ra(e);return e.map((function(e,n){var o,a,r,i,l,s=C(e);s.id=b(),s.field="".concat(n),s.title=e.display_name,s.visible=e.is_visible,s.download=e.is_visible,s.minWidth="90px","DATE"===s.type&&(s.minWidth="125px"),"DOLLAR_AMT"===s.type||"RATIO"===s.type||"NUMBER"===s.type?s.hozAlign="right":s.hozAlign="center",s.cssClass="".concat(s.type," ").concat(c?"DRILLDOWN":null),s.formatter=function(e,t,n){return Sa({element:e.getValue(),column:s,config:Wn(w.props.dataFormatting),htmlElement:e.getElement()})},s.headerFilter="input",s.headerFilterPlaceholder=w.setHeaderFilterPlaceholder(s),s.headerFilterFunc=w.setFilterFunction(s),s.sorter=w.setSorterFunction(s),s.headerSort=!!w.props.enableTableSorting,s.headerSortStartingDir="desc",s.headerClick=function(){var e,t;null===(e=w.tableRef)||void 0===e||null===(t=e.ref)||void 0===t||t.restoreRedraw()};var c=null===(o=w.queryResponse)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.data)||void 0===r||null===(i=r.fe_req)||void 0===i||null===(l=i.columns)||void 0===l?void 0:l.find((function(e){return s.name===e.name}));c&&(s.isDrilldownColumn=!0,s.tooltipTitle=s.title,s.title="".concat(s.title,' <em>(Clicked: "').concat(c.value,'")</em>')),t&&ko(e)&&(s.aggType=e.aggType||"sum");var u=w.columnDateRanges.find((function(e){return"DATE"===s.type&&(e.columnName===s.display_name||!!s.groupable)}));return u&&(s.dateRange=u),s}))})),Ot(Bt(w),"formatDatePivotYear",(function(e,t){var n=w.getColumns();return"DATE"===n[t].type?Ea({value:e[t],column:n[t],config:w.props.dataFormatting}).year().toString():o(e[t]).format("YYYY")})),Ot(Bt(w),"formatDatePivotMonth",(function(e,t){var n=w.getColumns();return"DATE"===n[t].type?Ea({value:e[t],column:n[t],config:w.props.dataFormatting}).format("MMMM"):o(e[t]).format("MMMM")})),Ot(Bt(w),"generateDatePivotData",(function(t){try{var n=w.getColumns(),a=Lo(n),r=w.tableConfig.numberColumnIndex;r>=0||(r=n.findIndex((function(e,t){return t!==a&&ko(e)})));var i=t||e(w.queryResponse,"data.data.rows"),l=zt(i.map((function(e){return"DATE"===n[a].type?Ea({value:e[a],column:n[a],config:w.props.dataFormatting}).year():Number(o(e[a]).format("YYYY"))}))).filter(da).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),s=n[a],c=xt(xt({},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 Ya(e,t,s,"isTable")},headerFilter:!1,headerFilterPlaceholder:"filter..."}),u=[xt(xt({},c),{},{formatter:function(e){return Sa({element:e.getValue(),column:c,config:Wn(w.props.dataFormatting),htmlElement:e.getElement()})}})];Object.keys(l).forEach((function(e,t){u.push(xt(xt({},n[r]),{},{origColumn:n[r],origValues:{},name:e,title:e,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var d=pa(Object.keys(l).length,12),p={};wn.forEach((function(e,t){d[t][0]=e})),i.forEach((function(e){var t,o=w.formatDatePivotYear(e,a),i=w.formatDatePivotMonth(e,a),s=l[o],c=wn.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]=xt(xt({},p[o]),{},Ot({},i,e[a])),u[m].origValues[i]={name:null===(t=n[a])||void 0===t?void 0:t.name,value:e[a]||""})})),w.pivotOriginalColumnData=p,w.pivotTableColumns=u,w.pivotTableData=d,w.numberOfPivotTableRows=12,w.setPivotTableConfig()}catch(e){console.error(e);var m=w.getCurrentSupportedDisplayTypes();w.setState({displayType:"table",supportedDisplayTypes:m.filter((function(e){return"pivot_table"!==e}))})}})),Ot(Bt(w),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var o,a=(null===(o=w.state)||void 0===o?void 0:o.visibleRows)||w.tableData||e(w.queryResponse,"data.data.rows");a=a.filter((function(e){return null!==e[0]}));var r=w.getColumns(),i=w.tableConfig,l=i.legendColumnIndex,s=i.stringColumnIndex,c=i.numberColumnIndex,u=Wa(a,r,"desc","isTable").map((function(e){return e[s]})).filter(da).reduce((function(e,t,n){return e[t]=n,e}),{}),d=Wa(a,r,"desc","isTable").map((function(e){return e[l]})).filter(da).reduce((function(e,t,n){return e[t]=n,e}),{}),p=s,m=l;if(n&&Object.keys(d).length>Object.keys(u).length&&!Po(r[s])){p=l,m=s;var f=C(u);u=C(d),d=C(f)}w.pivotColumnHeaders=d,w.pivotRowHeaders=u,w.tableConfig.legendColumnIndex=m,w.tableConfig.stringColumnIndex=p;var g=[xt(xt({},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=Sa({element:e,column:r[m],config:Wn(w.props.dataFormatting)});g.push(xt(xt({},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 v=pa(Object.keys(d).length+1,Object.keys(u).length);a.forEach((function(e){var t,n=u[e[p]],o=e[p];v[n][0]=o;var a=d[e[m]]+1,i=Number(e[c]);v[n][a]=i,g[a].origValues[o]={name:null===(t=r[p])||void 0===t?void 0:t.name,value:o}})),w.pivotTableColumns=g,w.pivotTableData=v,w.numberOfPivotTableRows=e(w.pivotTableData,"length",0),w.setPivotTableConfig(n)}catch(e){console.error(e),w.props.onErrorCallback(e)}})),Ot(Bt(w),"onSuggestionClick",(function(t){var n,o,a=t.query,r=t.queryId,i=t.userSelection,l=t.isButtonClick,s=t.skipQueryValidation,c=t.source;(i||function(t){var n=t.queryId,o=t.suggestion,a=t.apiKey,r=t.domain,i=t.token,l="".concat(r,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(a),s={suggestion:o};if(!i||!r||!a)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(i)}};m.put(l,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},Yn(w.props.authentication)),{},{queryId:r,suggestion:a})),"None of these"===a)?(w.props.onNoneOfTheseClick&&w.props.onNoneOfTheseClick(),w.props.mutable&&w.setState({customResponse:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")})):(w.props.onSuggestionClick&&w.props.onSuggestionClick({query:a,userSelection:i,isButtonClick:l,skipQueryValidation:s,source:c}),null!==(n=w.props.queryInputRef)&&void 0!==n&&n._isMounted&&(null===(o=w.props.queryInputRef)||void 0===o||o.animateInputTextAndSubmit({queryText:a,userSelection:i,skipQueryValidation:!0,source:c})))})),Ot(Bt(w),"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(w.COMPONENT_KEY,"-").concat(n)},f.createElement("span",null,e),n!==t.length-1&&f.createElement("button",{className:"report-like-text-button",onClick:w.props.reportProblemCallback},"report"))})))}catch(t){return f.createElement("span",null,e)}})),Ot(Bt(w),"isDrilldown",(function(){try{var e,t,n;return"Drilldown"===((null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.text)||"").split(":")[0]}catch(e){return!1}})),Ot(Bt(w),"renderAllColumnsHiddenMessage",(function(){return f.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},f.createElement("div",null,f.createElement(bn,{className:"warning-icon",type:"warning-triangle"}),f.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",f.createElement(bn,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),Ot(Bt(w),"getDefaultQueryPageSize",(function(){var e;return null!==(e=w.props.dataPageSize)&&void 0!==e?e:100})),Ot(Bt(w),"getQueryPageSize",(function(){var e,t,n,o,a,r;return null!==(e=null!==(t=w.props.dataPageSize)&&void 0!==t?t:null===(n=w.queryResponse)||void 0===n||null===(o=n.data)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.fe_req)||void 0===r?void 0:r.page_size)&&void 0!==e?e:100})),Ot(Bt(w),"renderTable",(function(){var e,t,n,o,a,r,i,l,s;return qa(w.getColumns())?w.renderAllColumnsHiddenMessage():w.tableData?f.createElement(Kt,null,f.createElement(vr,{key:w.tableID,autoHeight:w.props.autoHeight,authentication:w.props.authentication,dataFormatting:w.props.dataFormatting,rowChangeCount:w.state.visibleRowChangeCount,ref:function(e){return w.tableRef=e},columns:w.state.columns,response:w.queryResponse,data:w.tableData,columnDateRanges:w.columnDateRanges,onCellClick:w.onTableCellClick,queryID:w.queryID,initialParams:w.tableParams,onFilterCallback:w.onTableFilter,onSorterCallback:w.onTableSort,onTableParamsChange:w.onTableParamsChange,onNewPage:w.onNewPage,onNewData:w.onNewData,isAnimating:w.props.isAnimating,isResizing:w.props.isResizing,pageSize:w.getQueryPageSize(),useInfiniteScroll:w.props.enableAjaxTableData&&w.isDataLimited(),enableAjaxTableData:w.props.enableAjaxTableData,queryRequestData:null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.fe_req,queryText:null===(o=w.queryResponse)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.text,originalQueryID:w.props.originalQueryID,isDrilldown:w.isDrilldown(),isQueryOutputMounted:w._isMounted,popoverParentElement:w.props.popoverParentElement,hidden:"table"!==w.state.displayType,totalRows:null===(i=w.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.count_rows,supportsDrilldowns:Ao(w.state.columns)&&Gn(w.props.autoQLConfig).enableDrilldowns,queryFn:w.queryFn})):w.renderMessage("Error: There was no data supplied for this table")})),Ot(Bt(w),"renderPivotTable",(function(){return qa(w.getColumns())?w.renderAllColumnsHiddenMessage():"pivot_table"!==w.state.displayType||w.pivotTableData?f.createElement(Kt,null,f.createElement(vr,{ref:function(e){return w.pivotTableRef=e},columns:w.pivotTableColumns,rowChangeCount:w.state.visibleRowChangeCount,data:w.pivotTableData,onCellClick:w.onTableCellClick,isAnimating:w.props.isAnimating,isResizing:w.props.isResizing,hidden:"pivot_table"!==w.state.displayType,useInfiniteScroll:!1,supportsDrilldowns:!0,autoHeight:w.props.autoHeight,pivot:!0})):w.renderMessage("Error: There was no data supplied for this table")})),Ot(Bt(w),"renderChart",(function(){var t,n,o,a,r,i,l,s,c,u;if(!w.tableData||!w.state.columns||!w.tableConfig)return console.error("Required table data was missing for chart"),w.renderMessage("Error: There was no data supplied for this chart");var d=w.usePivotDataForChart();if(d&&(!w.pivotTableData||!w.pivotTableColumns||!w.pivotTableConfig))return w.renderMessage("Error: There was no data supplied for this chart");var p=d?w.pivotTableConfig:w.tableConfig,m=w.getCombinedFilters(),g=xt(xt({},w.formattedTableParams),{},{filters:m}),v=!1,h=Ra(w.state.columns);(1===h||h>=2&&d)&&(v=!0);var y,b=d?w.state.visiblePivotRows||w.pivotTableData:w.state.visibleRows||w.tableData,C=null===(t=w.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.count_rows;!w.isDataLimited()&&w.state.visibleRows&&(null===(a=w.state.visibleRows)||void 0===a?void 0:a.length)<5e3&&(C=null===(y=w.state.visibleRows)||void 0===y?void 0:y.length);return f.createElement(Kt,null,f.createElement(ci,Mt({key:w.chartID,hidden:!Na(w.state.displayType),formattedTableParams:g,authentication:w.props.authentication,queryRequestData:null===(r=w.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.fe_req,pageSize:e(w.queryResponse,"data.data.row_limit"),ref:function(e){return w.chartRef=e},type:w.state.displayType,isDataAggregated:v,popoverParentElement:w.props.popoverParentElement},p,{data:b,dataChangeCount:d?w.state.visiblePivotRowChangeCount:w.state.visibleRowChangeCount,columns:d?w.pivotTableColumns:w.state.columns,isPivot:d,dataFormatting:w.props.dataFormatting,activeChartElementKey:w.props.activeChartElementKey,onLegendClick:w.onLegendClick,legendColumn:w.state.columns[null===(s=w.tableConfig)||void 0===s?void 0:s.legendColumnIndex],changeStringColumnIndex:w.onChangeStringColumnIndex,changeLegendColumnIndex:w.onChangeLegendColumnIndex,changeNumberColumnIndices:w.onChangeNumberColumnIndices,onChartClick:w.onChartClick,isResizing:w.props.isResizing,isAnimating:w.props.isAnimating,isDrilldownChartHidden:w.props.isDrilldownChartHidden,enableDynamicCharting:w.props.enableDynamicCharting,enableAjaxTableData:w.props.enableAjaxTableData,tooltipID:null!==(c=w.props.tooltipID)&&void 0!==c?c:w.TOOLTIP_ID,chartTooltipID:null!==(u=w.props.chartTooltipID)&&void 0!==u?u:w.CHART_TOOLTIP_ID,rebuildTooltips:w.rebuildTooltips,height:w.props.height,width:w.props.width,onNewData:w.onNewData,isDrilldown:w.isDrilldown(),totalRowCount:C,updateColumns:w.updateColumns})))})),Ot(Bt(w),"renderHelpResponse",(function(){var t=e(w.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(v,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(bn,{type:"globe",className:"react-autoql-help-link-icon"}),o))})),Ot(Bt(w),"renderError",(function(t){return t?e(t,"data.message")?w.renderMessage(t.data):w.renderMessage():(console.warn("Warning: No response object supplied"),w.renderMessage("No response supplied"))})),Ot(Bt(w),"isDataLimited",(function(){var e,t,n,o,a,r,i,l,s,c=null!==(e=null===(t=w.tableData)||void 0===t?void 0:t.length)&&void 0!==e?e:null===(n=w.queryResponse)||void 0===n||null===(o=n.data)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.rows)||void 0===r?void 0:r.length,u=null===(i=w.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.count_rows;return!(!c||!u)&&c<u})),Ot(Bt(w),"noDataFound",(function(){var e,t,n,o;return 0===(null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.rows)||void 0===o?void 0:o.length)&&w.isOriginalData})),Ot(Bt(w),"renderMessage",(function(e){try{if("object"===wt(e)){var t,n=Yt.GENERAL_QUERY;if((null==e?void 0:e.message)===(null==Wt?void 0:Wt.CANCELLED))n=f.createElement("span",null,"Query cancelled"," ",f.createElement(bn,{"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=w.props.tooltipID)&&void 0!==t?t:w.TOOLTIP_ID,type:"question"}));else null!=e&&e.message&&(n=e.message,n=w.props.reportProblemCallback?w.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(v,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",e.reference_id)))}var o=e||Yt.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"},Yt.GENERAL_QUERY)}})),Ot(Bt(w),"renderHTMLMessage",(function(){var e,t,n,o=null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.answer;return o?Oe(o,{}):f.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),Ot(Bt(w),"renderTextResponse",(function(){return qa(w.getColumns())?w.renderAllColumnsHiddenMessage():null})),Ot(Bt(w),"renderResponse",(function(){var t=w.state.displayType;if(w.hasError(w.queryResponse))return w.renderError(w.queryResponse);if("html"===t)return w.renderHTMLMessage();if(w.state.customResponse)return w.state.customResponse;if(!!e(w.queryResponse,"data.data.items"))return w.renderSuggestionMessage(w.queryResponse.data.data.items,w.queryResponse.data.data.query_id);if(e(w.queryResponse,"data.data.replacements"))return f.createElement(ui,{key:w.QUERY_VALIDATION_KEY,response:w.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return w.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"]})},onQueryValidationSelectOption:w.props.onQueryValidationSelectOption,initialSelections:w.props.queryValidationSelections,autoSelectSuggestion:w.props.autoSelectQueryValidationSuggestion});if(t&&e(w.queryResponse,"data.data.rows")){if("help"===t)return w.renderHelpResponse();if("text"===t)return w.renderTextResponse();if("single-value"===t)return w.renderSingleValueResponse();if(!Aa(t)&&!Na(t))return console.warn("display type not recognized: ".concat(w.state.displayType," - rendering as plain text")),w.renderMessage("display type not recognized: ".concat(w.state.displayType))}var n=Na(w.state.displayType),o=Aa(w.state.displayType),a="pivot_table"===w.state.displayType,r=w.props.allowDisplayTypeChange,i=w.getPotentialDisplayTypes().filter((function(e){return Dn.includes(e)})),l=!(null==i||!i.length),s=w.getCurrentSupportedDisplayTypes().includes("pivot_table"),c=(r||n)&&l,u=r||o,d=(r||a)&&s;return f.createElement(f.Fragment,null,u&&w.renderTable(),c&&w.renderChart(),d&&w.renderPivotTable())})),Ot(Bt(w),"shouldRenderReverseTranslation",(function(){var e,t,n;return Gn(w.props.autoQLConfig).enableQueryInterpretation&&w.props.showQueryInterpretation&&(null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.parsed_interpretation)})),Ot(Bt(w),"renderReverseTranslation",(function(){return f.createElement(mi,{authentication:w.props.authentication,onValueLabelClick:w.props.onRTValueLabelClick,appliedFilters:w.props.appliedFilters,isResizing:w.props.isResizing,reverseTranslation:e(w.queryResponse,"data.data.parsed_interpretation"),tooltipID:w.props.tooltipID})})),Ot(Bt(w),"shouldRenderDataLimitWarning",(function(){var e=!w.props.enableAjaxTableData&&"table"===w.state.displayType,t=!w.props.enableAjaxTableData&&Na(w.state.displayType);return w.isDataLimited()&&!qa(w.getColumns())&&(e||t)})),Ot(Bt(w),"renderDataLimitWarning",(function(){var e,t,n,o,a=Gn(w.props.autoQLConfig).enableQueryInterpretation&&w.props.showQueryInterpretation;return f.createElement("div",{className:"dashboard-data-limit-warning-icon"},f.createElement(bn,{type:"warning","data-tip":"The display limit of ".concat(null===(e=w.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.row_limit," rows has been reached. Try querying a smaller time-frame to ensure all your data is displayed."),"data-for":null!==(o=w.props.tooltipID)&&void 0!==o?o:w.TOOLTIP_ID,"data-place":a?"left":"right"}))})),Ot(Bt(w),"renderFooter",(function(){var e=w.shouldRenderReverseTranslation(),t=w.shouldRenderDataLimitWarning(),n="query-output-footer ".concat(e?"":"no-margin"," ").concat(w.props.reverseTranslationPlacement);return f.createElement("div",{className:n},e&&w.renderReverseTranslation(),t&&w.renderDataLimitWarning())})),Ot(Bt(w),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{key:w.COMPONENT_KEY,ref:function(e){return w.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(w.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(Aa(w.state.displayType)?"table":"","\n ").concat(Na(w.state.displayType)?"chart":"")},"top"===w.props.reverseTranslationPlacement&&w.renderFooter(),w.renderResponse(),"top"!==w.props.reverseTranslationPlacement&&w.renderFooter()),!w.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:w.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),!w.props.chartTooltipID&&f.createElement(Sn,{className:"react-autoql-chart-tooltip",id:w.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),w.COMPONENT_KEY=b(),w.QUERY_VALIDATION_KEY=b(),w.TOOLTIP_ID="react-autoql-query-output-tooltip-".concat(w.COMPONENT_KEY),w.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(w.COMPONENT_KEY),w.queryResponse=C(t.queryResponse),w.columnDateRanges=function(e){var t,n,o=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.parsed_interpretation;if(!o)return[];var a=ar(o);return null!=a&&a.length?a:[]}(t.queryResponse),w.queryID=e(w.queryResponse,"data.data.query_id"),w.interpretation=e(w.queryResponse,"data.data.parsed_interpretation"),w.tableParams={},w.chartID=b(),w.tableID=b(),w.pivotTableID=b(),w.initialSupportedDisplayTypes=w.getCurrentSupportedDisplayTypes(),w.isOriginalData=!0;var N=w.formatColumnsForTable(null===(i=w.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.columns);t.initialColumns&&w.areColumnsValid(t.initialColumns)&&(N=t.initialColumns),w.generateAllData(),w.initialSupportedDisplayTypes=w.getCurrentSupportedDisplayTypes();var A=w.getDisplayTypeFromInitial(t);if(t.onDisplayTypeChange&&t.onDisplayTypeChange(A),null!==(c=t.initialTableConfigs)&&void 0!==c&&c.tableConfig&&w.isTableConfigValid(null===(u=t.initialTableConfigs)||void 0===u?void 0:u.tableConfig,N,A)){var k=t.initialTableConfigs,I=k.tableConfig,P=k.pivotTableConfig;w.tableConfig=C(I),w.pivotTableConfig=C(P)}return w.formattedTableParams={filters:(null===(d=w.queryResponse)||void 0===d||null===(p=d.data)||void 0===p||null===(g=p.data)||void 0===g||null===(h=g.fe_req)||void 0===h?void 0:h.filters)||[],sorters:(null===(y=w.queryResponse)||void 0===y||null===(E=y.data)||void 0===E||null===(S=E.data)||void 0===S||null===(T=S.fe_req)||void 0===T?void 0:T.sorters)||[]},w.state={displayType:A,supportedDisplayTypes:w.initialSupportedDisplayTypes,columns:N,selectedSuggestion:t.defaultSelectedSuggestion,visiblerows:null===(D=w.queryResponse)||void 0===D||null===(x=D.data)||void 0===x||null===(R=x.data)||void 0===R?void 0:R.rows,visibleRowChangeCount:0,visiblePivotRowChangeCount:0,columnChangeCount:0},w}return Pt(r)}();Ot(fi,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,initialTableConfigs:y.shape({}),queryResponse:y.shape({}),onSuggestionClick:y.func,initialDisplayType:y.string,onQueryValidationSelectOption:y.func,autoSelectQueryValidationSuggestion:y.bool,queryValidationSelections:y.arrayOf(y.shape({})),renderSuggestionsAsDropdown:y.bool,defaultSelectedSuggestion:y.string,reverseTranslationPlacement:y.string,activeChartElementKey:y.string,preferredDisplayType:y.string,isResizing:y.bool,enableDynamicCharting:y.bool,onTableConfigChange:y.func,onNoneOfTheseClick:y.func,autoChartAggregations:y.bool,onRTValueLabelClick:y.func,isTaskModule:y.bool,onDrilldownStart:y.func,onDrilldownEnd:y.func,enableAjaxTableData:y.bool,enableTableSorting:y.bool,rebuildTooltips:y.func,onRowChange:y.func,mutable:y.bool,showSuggestionPrefix:y.bool,onDisplayTypeChange:y.func,onColumnChange:y.func,shouldRender:y.bool,dataPageSize:y.number,onPageSizeChange:y.func,allowDisplayTypeChange:y.bool}),Ot(fi,"defaultProps",{authentication:Un,autoQLConfig:Kn,dataFormatting:jn,initialTableConfigs: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,onRowChange:function(){},onTableConfigChange:function(){},onQueryValidationSelectOption:function(){},onErrorCallback:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){},onColumnChange:function(){},onPageSizeChange:function(){}});var gi=wo(fi),vi=function(e){Lt(o,f.Component);var t=Qt(o);function o(){var e;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(e),"componentDidMount",(function(){e._isMounted=!0,e.rebuildTooltips()})),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!!t.shouldRender&&(!Za(e.props,t)||!Za(e.state,n))})),Ot(Bt(e),"componentDidUpdate",(function(t){n(e.getCurrentSupportedDisplayTypes(e.props),e.getCurrentSupportedDisplayTypes(t))||e.rebuildTooltips()})),Ot(Bt(e),"componentWillUnmount",(function(){e._isMounted=!1})),Ot(Bt(e),"rebuildTooltips",(function(){e.props.shouldRender&&(e.props.rebuildTooltips?e.props.rebuildTooltips():Cn())})),Ot(Bt(e),"showDisplayTypeButton",(function(t){if(e.props.disableCharts&&Dn.includes(t))return!1;var n=e.getCurrentSupportedDisplayTypes(e.props);return n&&n.includes(t)})),Ot(Bt(e),"onDisplayTypeChange",(function(t){var n,o;null!==(n=e.props.responseRef)&&void 0!==n&&n._isMounted&&(null===(o=e.props.responseRef)||void 0===o||o.changeDisplayType(t))})),Ot(Bt(e),"getCurrentDisplayType",(function(){var t,n;return null===(t=e.props.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.displayType})),Ot(Bt(e),"getCurrentSupportedDisplayTypes",(function(e){var t,n;return null===(t=e.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.supportedDisplayTypes})),Ot(Bt(e),"createVisButton",(function(t,n,o){if(e.showDisplayTypeButton(t)){var a,r=e.getCurrentDisplayType();return f.createElement("button",{onClick:function(){return e.onDisplayTypeChange(t)},className:"react-autoql-toolbar-btn ".concat(t===r?"selected":""),"data-tip":n,"data-for":null!==(a=e.props.tooltipID)&&void 0!==a?a:"react-autoql-viz-toolbar-tooltip-".concat(e.COMPONENT_KEY),"data-test":"viz-toolbar-button"},o)}return null})),Ot(Bt(e),"render",(function(){var t=e.getCurrentDisplayType(),n=e.getCurrentSupportedDisplayTypes(e.props);return!n||n.length<=1||!n.includes("pivot_table")&&e.props.disableCharts?null:Tn.includes(t)||Dn.includes(t)?f.createElement(Kt,null,f.createElement("div",{className:"".concat(e.props.className||""," react-autoql-toolbar viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",f.createElement(bn,{type:"table"})),e.createVisButton("pivot_table","Pivot View",f.createElement(bn,{type:"pivot-table"})),e.createVisButton("column","Column Chart",f.createElement(bn,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",f.createElement(bn,{type:"bar-chart"})),e.createVisButton("line","Line Chart",f.createElement(bn,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",f.createElement(bn,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",f.createElement(bn,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",f.createElement(bn,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",f.createElement(bn,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",f.createElement(bn,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",f.createElement(bn,{type:"stacked-line-chart"})),e.createVisButton("column_line","Column Line Combo Chart",f.createElement(bn,{type:"column-line-chart"}))),!e.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-viz-toolbar-tooltip-".concat(e.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),e}return Pt(o)}();Ot(vi,"propTypes",{onDisplayTypeChange:y.func,shouldRender:y.bool,disableCharts:y.bool,vertical:y.bool}),Ot(vi,"defaultProps",{onDisplayTypeChange:function(){},shouldRender:!0,disableCharts:!1,vertical:!1});var hi=vi,yi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),Ot(Bt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",null,f.createElement(gr,{type:"default",onClick:e.props.onClose,tooltipID:e.props.tooltipID},"Back"),f.createElement(gr,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading,tooltipID:e.props.tooltipID},e.props.confirmText||"Continue"))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(Ie,{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:xt(xt({},e.props.style),{},{bottom:"auto",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 Pt(n)}();Ot(yi,"propTypes",{isVisible:y.bool,onClose:y.func,onConfirm:y.func,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),confirmLoading:y.bool,confirmText:y.string,footer:y.element}),Ot(yi,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var bi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{isConfirmCloseModalVisible:!1}),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!(!t.shouldRender&&!e.props.shouldRender)&&(!Za(e.props,t)||!Za(e.state,n))})),Ot(Bt(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()})),Ot(Bt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",null,e.props.showCancelButton&&f.createElement(gr,{type:"default",onClick:e.onClose},"Cancel"),f.createElement(gr,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(Ie,{ref:function(t){return e.ref=t},isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),className:e.props.contentClassName,ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:xt(xt({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height}),overlay:xt({},e.props.overlayStyle)}},f.createElement("div",{className:"react-autoql-modal-content",ref:function(t){return e.modalContent=t}},f.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,f.createElement(bn,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),f.createElement("div",{className:"react-autoql-modal-body",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(yi,{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 Pt(n)}();Ot(bi,"propTypes",{title:y.oneOfType([y.element,y.string]),titleIcon:y.oneOfType([y.element,y.instanceOf(bn)]),isVisible:y.bool,onClose:y.func,onConfirm:y.func,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),showCancelButton:y.bool,showFooter:y.bool,enableBodyScroll:y.bool,confirmLoading:y.bool,confirmText:y.string,confirmDisabled:y.bool,footer:y.element,confirmOnClose:y.bool,shouldRender:y.bool}),Ot(bi,"defaultProps",{title:"",titleIcon:void 0,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(){}});var Ci=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{columns:e.props.columns}),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!Za(e.props,t)||!Za(e.state,n)})),Ot(Bt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),Ot(Bt(e),"onListChange",(function(t){e.setState({columns:t})})),Ot(Bt(e),"onConfirm",(function(){return e.props.onConfirm(e.state.columns)})),Ot(Bt(e),"render",(function(){return f.createElement(bi,{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(Cr,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:e.onListChange})))})),e}return Pt(n)}();Ot(Ci,"propTypes",{isSettingColumns:y.bool}),Ot(Ci,"defaultProps",{isSettingColumns:!1});var Ei=function(e){var t=e.query,n=e.domain,o=e.apiKey,a=e.token,r="".concat(n,"/autoql/api/v1/query?key=").concat(o),i={text:t,translation:"exclude"};if(!t||!t.trim())return Promise.reject({error:"No query supplied"});if(!o||!n||!a)return Promise.reject({error:"Unauthenticated"});var l={headers:{Authorization:"Bearer ".concat(a)}};return m.post(r,i,l)},Si=function(t){var n=t.domain,o=t.apiKey,a=t.token,r=t.offset,i=t.limit;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var l=m.create({headers:{Authorization:"Bearer ".concat(a)}}),s="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(o,"&offset=").concat(r,"&limit=").concat(i);return l.get(s).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ti=function(t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(o);return r.get(i).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Di=function(t){var n=t.domain,o=t.apiKey,a=t.token,r=t.dataAlertId;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(a)}}),l="".concat(n,"/autoql/api/v1/data-alerts/").concat(r,"?key=").concat(o);return i.get(l).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},xi=function(t){var n=t.notificationId,o=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(o,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(a);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ri=function(t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(o);return r.put(i,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},wi=function(t){var n=t.notificationId,o=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(o,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(a);return i.put(l,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ni=function(t){var n=t.dataAlertId,o=t.status,a=t.token,r=t.domain,i=t.apiKey;return"INACTIVE"===o?function(t){var n=t.dataAlertId,o=t.token,a=t.domain,r=t.apiKey,i={headers:{Authorization:"Bearer ".concat(o)}},l="".concat(a,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return m.delete(l,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:a,domain:r,apiKey:i}):function(t){var n=t.dataAlertId,o=t.token,a=t.domain,r=t.apiKey,i={headers:{Authorization:"Bearer ".concat(o)}},l="".concat(a,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return m.post(l,{},i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:a,domain:r,apiKey:i})},Ai=function(t){var n=t.dataAlertId,o=t.status,a=t.type,r=t.domain,i=t.apiKey,l=t.token;return l&&i&&r?n?"PROJECT"===a?Ni({dataAlertId:n,status:o,token:l,domain:r,apiKey:i}):function(t){var n=t.dataAlertId,o=t.status,a=t.token,r=t.domain,i=t.apiKey,l={status:o},s={headers:{Authorization:"Bearer ".concat(a)}},c="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return m.put(c,l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}({dataAlertId:n,status:o,token:l,domain:r,apiKey:i}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},ki=function(t){var n=t.expression,o=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l={expression:n},s="".concat(o,"/autoql/api/v1/data-alerts/validate?key=").concat(a);return i.post(s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ii=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",At(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a._isMounted=!0,a.getNotificationCount(),a.clearPollingComponent(),a.subscribeToNotificationCount();case 4:case"end":return e.stop()}}),e)})))),Ot(Bt(a),"componentDidUpdate",(function(e,t){a.state.count!==t.count&&a.props.onCount(a.state.count)})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,a.clearPollingComponent(),clearInterval(a.pollInterval)})),Ot(Bt(a),"getNotificationCount",(function(t){var n=t||a.state.count;return a.props.pausePolling?Promise.resolve(n):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=m.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}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}(xt(xt({},Yn(a.props.authentication)),{},{unacknowledged:n})).then((function(t){var n=e(t,"data.data.unacknowledged");return n&&n!==a.state.count&&(a.setState({count:n}),a.HAS_FETCHED_COUNT&&a.props.onNewNotification(n)),a.HAS_FETCHED_COUNT=!0,Promise.resolve(n)})).catch((function(e){return console.error(e),a.props.onErrorCallback(e)}))})),Ot(Bt(a),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),Ot(Bt(a),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",a.COMPONENT_KEY)})),Ot(Bt(a),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),Ot(Bt(a),"subscribeToNotificationCount",(function(t){var n=a.getPollingComponent(),o=!n||n===a.COMPONENT_KEY;a._isMounted&&o&&(clearInterval(a.pollInterval),a.setPollingComponent(),a.pollInterval=setInterval((function(){a.getNotificationCount(t).then((function(e){a.subscribeToNotificationCount(e),a.FAILED_POLL_ATTEMPTS=0})).catch((function(t){if(5===a.FAILED_POLL_ATTEMPTS){var n=new Error("There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.");return console.error(n),a.props.onErrorCallback(n),void clearInterval(a.pollInterval)}504==e(t,"response.status")?a.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){a.subscribeToNotificationCount()})),a.FAILED_POLL_ATTEMPTS+=1}))}),a.INTERVAL_LENGTH))})),Ot(Bt(a),"resetCount",(function(){(function(t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!o||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(a)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(o);return r.put(i,{notification_id:null,state:"ACKNOWLEDGED"}).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(xt({},Yn(a.props.authentication))).catch((function(e){console.error(e)})).finally((function(){a.setState({count:0})}))})),Ot(Bt(a),"getCurrentCount",(function(){return"number"==typeof a.props.count?a.props.count:a.state.count})),Ot(Bt(a),"renderBadge",(function(){var e=a.props.overflowCount,t=a.getCurrentCount();if(!t)return null;if(a.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)})),Ot(Bt(a),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notifications-button-container ".concat(a.props.useDot?"dot":"","\n ").concat(a.props.className||"","\n ").concat(a.state.count||a.props.count?"":"no-badge"),"data-test":"notification-button",style:xt({},a.props.style),onClick:function(){a.props.clearCountOnClick&&a.resetCount()}},f.createElement(bn,{type:"notification",className:"react-autoql-notifications-button"}),a.renderBadge()))})),a.NUMBER_OF_NOTIFICATIONS_TO_FETCH=10,a.INTERVAL_LENGTH=9e4,a.FAILED_POLL_ATTEMPTS=0,a.COMPONENT_KEY=b(),a.HAS_FETCHED_COUNT=!1,a.pollInterval=void 0,a.state={count:0},a}return Pt(o)}();Ot(Ii,"propTypes",{authentication:Gt,overflowCount:y.number,style:y.shape({}),size:y.number,useDot:y.bool,clearCountOnClick:y.bool,onNewNotification:y.func,onErrorCallback:y.func,pausePolling:y.bool,count:y.number,onCount:y.func}),Ot(Ii,"defaultProps",{authentication:Un,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var Pi=wo(Ii),Oi=["icon","type"],Mi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{focused:!1}),Ot(Bt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),Ot(Bt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),Ot(Bt(e),"focus",(function(){var t;null===(t=e.inputRef)||void 0===t||t.focus()})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var o=Ft(t,Oi),a=o.className;return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(a," "),"data-test":"react-autoql-input"},"multi"===e.props.type?f.createElement("textarea",Mt({},o,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):f.createElement(v,null,f.createElement("input",Mt({},o,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&f.createElement(bn,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return Pt(n)}();Ot(Mi,"propTypes",{icon:y.string,type:y.string}),Ot(Mi,"defaultProps",{icon:void 0,type:"single"});var Li=function(t){Lt(a,f.Component);var o=Qt(a);function a(t){var r;kt(this,a),Ot(Bt(r=o.call(this,t)),"autoCompleteTimer",void 0),Ot(Bt(r),"state",xt({input1Value:"",input2Value:"",conditionSelectValue:"EXISTS",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"),userSelection:t[0].user_selection};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"),userSelection:t[0].user_selection}}return{}}(r.props.initialData))),Ot(Bt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),Ot(Bt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=b(),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}))})),Ot(Bt(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,user_selection:r.state.userSelection}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value,user_selection:r.state.userSelection},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?xe(e):e,user_selection:r.state.userSelection}]})),Ot(Bt(r),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=xe(e);return!isNaN(Number(n))})),Ot(Bt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),Ot(Bt(r),"isValid",(function(){return!0})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){lo(xt(xt(xt({},Yn(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)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),Ot(Bt(r),"renderReadOnlyRule",(function(){return f.createElement(Kt,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(za(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"},za(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),Ot(Bt(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(bn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),Ot(Bt(r),"renderCompareBtn",(function(){return"EXISTS"===r.state.conditionSelectValue?f.createElement(gr,{onClick:function(){r.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),Ot(Bt(r),"renderConditionSelector",(function(){return f.createElement(Sr,{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:"Exists",tooltip:"No Comparison"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}})})),Ot(Bt(r),"renderRule",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-first-input-container"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Mi,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})}}),!r.state.isFirstTermValid&&r.renderValidationError()),r.renderCompareBtn()),f.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},r.renderConditionSelector(),f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Mi,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})}}),!r.state.isSecondTermValid&&r.renderValidationError()),f.createElement(bn,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return r.setState({conditionSelectValue:"EXISTS"})}}))))})),Ot(Bt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=b(),r.TERM_ID_2=b();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=b()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return Pt(a)}();Ot(Li,"propTypes",{authentication:Gt,ruleId:y.string,onUpdate:y.func,initialData:y.arrayOf(y.shape({})),readOnly:y.bool}),Ot(Li,"defaultProps",{authentication:Un,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var qi=function(t){var n=void 0,o=!1;return Array.isArray(t)&&"query"===e(t,"[0].term_type")?n=t:"query"===e(t,"term_value[0].term_type")?n=t.term_value:"group"===e(t,"[0].term_type")&&(e(t.length>1)||e(t,"[0].term_value.length")>1?o=!0:"query"===e(t,"[0].term_value[0].term_value[0].term_type")?n=C(t[0].term_value[0].term_value):o=!0),{expression:n,expressionError:o}},Vi=function(t){Lt(a,f.Component);var o=Qt(a);function a(){var t;kt(this,a);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=o.call.apply(o,[this].concat(i))),"ruleRef",void 0),Ot(Bt(t),"state",xt({},qi(t.props.expression))),Ot(Bt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"componentDidUpdate",(function(e,o){n(e.expression,t.props.expression)||t.setState(xt({},qi(t.props.expression))),n(o,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),Ot(Bt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),Ot(Bt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),Ot(Bt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),Ot(Bt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"getFirstQuery",(function(n){var o;if(n?o=n:t.ruleRef&&(o=t.ruleRef.getJSON()),o)return Array.isArray(o)&&(o=o[0]),"group"===o.term_type?t.getFirstQuery(e(o,"term_value[0]")):"query"===o.term_type?o.term_value:void 0})),Ot(Bt(t),"renderExpressionErrorMessage",(function(){return f.createElement("div",{className:"expression-error-message"},f.createElement(bn,{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:t.resetConditions},"Reset Conditions"))})),Ot(Bt(t),"renderReadOnlyRule",(function(){return f.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():f.createElement(Li,{ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",b()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),Ot(Bt(t),"renderRule",(function(){return f.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():f.createElement(Li,{authentication:t.props.authentication,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",b()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),f.createElement(Sn,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return Pt(a)}();Ot(Vi,"propTypes",{authentication:Gt,expression:y.oneOfType([y.shape({}),y.array]),readOnly:y.bool,onChange:y.func}),Ot(Vi,"defaultProps",{authentication:Un,expression:void 0,readOnly:!1,onChange:function(){}}),o.extend(a);var _i=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=n.call.apply(n,[this].concat(i))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),Ot(Bt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),Ot(Bt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),Di(xt({dataAlertId:n.data_alert_id},Yn(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),Ot(Bt(t),"onClick",(function(e){e.expanded?(t.setState({fullyExpanded:!1}),t.props.onCollapseCallback(e)):(t.fetchRuleDetails(e),t.props.onExpandCallback(e),setTimeout((function(){t.setState({fullyExpanded:!0})}),500)),t.props.onClick(e)})),Ot(Bt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),wi(xt(xt({},Yn(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDismissSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),xi(xt(xt({},Yn(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"changeRuleStatus",(function(e,n){Ai(xt({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Yn(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"formatTimestamp",(function(e){var t=o.unix(e).format("h:mma"),n=o.unix(e).format("MM-DD-YY"),a=o().format("MM-DD-YY"),r=o().subtract(1,"d").format("MM-DD-YY");return n===a?"Today at ".concat(t):n===r?"Yesterday at ".concat(t):o().isSame(e,"year")?"".concat(o.unix(e).format("MMMM Do")," at ").concat(t):"".concat(o.unix(e).format("MMMM Do, YYYY")," at ").concat(t)})),Ot(Bt(t),"renderAlertColorStrip",(function(){return f.createElement("div",{className:"react-autoql-notification-alert-strip"})})),Ot(Bt(t),"renderNotificationHeader",(function(e){var n,o;return f.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},f.createElement("div",{className:"react-autoql-notification-display-name-container"},f.createElement("div",{className:"react-autoql-notification-display-name"},e.title),f.createElement("div",{className:"react-autoql-notification-description"},e.message),f.createElement("div",{className:"react-autoql-notification-timestamp"},f.createElement(bn,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?f.createElement("div",{className:"react-autoql-notification-dismiss-btn"},f.createElement(bn,{type:"notification-off",className:"react-autoql-notification-dismiss-icon","data-tip":"Dismiss","data-for":null!==(n=t.props.tooltipID)&&void 0!==n?n:"react-autoql-notification-tooltip",onClick:function(n){t.onDismissClick(n,e),En()}})):f.createElement("div",{className:"react-autoql-notification-dismiss-btn"},f.createElement(bn,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":null!==(o=t.props.tooltipID)&&void 0!==o?o:"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),En()}})))})),Ot(Bt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?f.createElement(gr,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},f.createElement(bn,{type:"notification-off"})," Turn Data Alert Off"):f.createElement(gr,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},f.createElement(bn,{type:"notification"})," Turn Data Alert On"):f.createElement("div",null)})),Ot(Bt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?De(t.state.ruleDetails)?f.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):f.createElement(gr,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},f.createElement(bn,{type:"edit"})," Edit Data Alert"):f.createElement("div",null)})),Ot(Bt(t),"renderNotificationFooter",(function(e){return f.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),Ot(Bt(t),"renderNotificationContent",(function(n){var o,a,r,i,l,s,c=n.data_return_query,u=za(c);return s=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},f.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},f.createElement("div",{className:"react-autoql-notification-details-container"},f.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},f.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?f.createElement(v,null,f.createElement("div",{className:"react-autoql-notification-query-title"},u),f.createElement(gi,{style:{flex:"1"},authentication:t.props.authentication,ref:function(e){return t.OUTPUT_REF=e},key:null===(o=s)||void 0===o||null===(a=o.data)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.query_id,queryResponse:s,autoQLConfig:{enableDrilldowns:!1},autoChartAggregations:t.props.autoChartAggregations,enableAjaxTableData:t.props.enableAjaxTableData})):f.createElement("div",{className:"loading-container-centered"},f.createElement(No,null))),(null===(i=t.OUTPUT_REF)||void 0===i||null===(l=i.supportedDisplayTypes)||void 0===l?void 0:l.length)>1&&f.createElement("div",{className:"react-autoql-notification-viz-switcher"},f.createElement(hi,{ref:function(e){return t.vizToolbarRef=e},responseRef:t.OUTPUT_REF,vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&f.createElement("div",{className:"react-autoql-notification-details"},f.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),f.createElement(Vi,{authentication:t.props.authentication,key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),Ot(Bt(t),"render",(function(){var e=t.props.notification;return f.createElement(Kt,null,f.createElement("div",{id:"react-autoql-notification-item-".concat(t.COMPONENT_KEY),key:"react-autoql-notification-item-".concat(t.COMPONENT_KEY),className:"react-autoql-notification-list-item\n ".concat(t.getIsTriggered(e.state)?" triggered":"","\n ").concat(e.expanded?" expanded":"","\n ").concat(t.state.fullyExpanded?" animation-complete":"")},t.renderNotificationHeader(e),t.renderNotificationContent(e),t.renderAlertColorStrip()))})),t}return Pt(a)}();Ot(_i,"propTypes",{authentication:Gt,notification:y.shape({}).isRequired,activeNotificationData:y.shape({}),showNotificationDetails:y.bool,onRuleFetchCallback:y.func,onExpandCallback:y.func,onDismissCallback:y.func,onDeleteCallback:y.func,onDeleteSuccessCallback:y.func,onDismissSuccessCallback:y.func,onErrorCallback:y.func,autoChartAggregations:y.bool,enableAjaxTableData:y.bool.isRequired}),Ot(_i,"defaultProps",{authentication:Un,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onErrorCallback:function(){}});var Fi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"COMPONENT_KEY",b()),Ot(Bt(e),"state",{activeStep:e.props.initialActiveStep||0}),Ot(Bt(e),"componentDidMount",(function(){var t;e.props.steps&&e.props.steps.length?null==e.props.initialActiveStep||isNaN(e.props.initialActiveStep)||null!==(t=e.props.steps)&&void 0!==t&&t[e.props.initialActiveStep]||(console.error(new Error("Initial active step provided is invalid")),e.setState({activeStep:0})):console.error(new Error("No steps were provided"))})),Ot(Bt(e),"prevStep",(function(){e.state.activeStep>=1&&e.onStepTitleClick(e.state.activeStep-1)})),Ot(Bt(e),"nextStep",(function(){var t=isNaN(e.state.activeStep)?0:e.state.activeStep+1;e.onStepTitleClick(t)})),Ot(Bt(e),"setStep",(function(t){e.setState({activeStep:t})})),Ot(Bt(e),"getHeightOfStepContent",(function(t){if(e.props.collapsible){var n=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));if(n)return n.scrollHeight+15}})),Ot(Bt(e),"onStepTitleClick",(function(t,n){try{var o,a,r=t;if(!e.props.isEditMode&&r>0&&(null===(o=e.props.steps)||void 0===o||null===(a=o[r-1])||void 0===a||!a.complete))return;n&&n.onClick&&n.onClick(),e.autoHideTimeout&&clearTimeout(e.autoHideTimeout);var i=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(e.state.activeStep));if(i&&(i.style.height="".concat(e.getHeightOfStepContent(e.state.activeStep),"px"),setTimeout((function(){i.style.height="10px"}),0)),t!==e.state.activeStep){var l=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));l&&(l.style.height="".concat(e.getHeightOfStepContent(t),"px"),clearTimeout(e.autoHideTimeout),e.autoHideTimeout=setTimeout((function(){var n=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));n&&(n.style.height="auto")}),500))}else r=void 0;e.setState({activeStep:r})}catch(e){console.error(e)}})),Ot(Bt(e),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),Ot(Bt(e),"getIsStepTitleDisabled",(function(t,n){var o,a,r;return 0===t||t===(null===(o=e.state)||void 0===o?void 0:o.activeStep)||null!=n&&n.complete||null!==(a=e.props.steps)&&void 0!==a&&null!==(r=a[t-1])&&void 0!==r&&r.complete?"":" disabled"})),Ot(Bt(e),"render",(function(){return e.props.steps&&e.props.steps.length?f.createElement(Kt,null,f.createElement("div",{id:"react-autoql-steps-".concat(e.COMPONENT_KEY),className:"react-autoql-steps-container","data-test":"react-autoql-steps"},e.props.steps.map((function(t,n){return f.createElement("div",{key:"react-autoql-steps-".concat(e.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},f.createElement("div",{className:"react-autoql-step-container\n ".concat(e.getStepStatus(t),"\n ").concat(e.props.collapsible&&n===e.state.activeStep?" active":""),"data-test":"react-autoql-step-container-".concat(n)},f.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return e.onStepTitleClick(n,t)}},f.createElement("div",{className:"react-autoql-step-title".concat(e.getIsStepTitleDisabled(n,t))},t.title)),f.createElement("div",{id:"react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},f.createElement("div",{className:"react-autoql-step-subtitle"},t.subtitle||null),f.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},t.content)),f.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),e}return Pt(n)}();Ot(Fi,"propTypes",{steps:y.arrayOf(y.shape({})),initialActiveStep:y.number,collapsible:y.bool,isEditMode:y.bool}),Ot(Fi,"defaultProps",{steps:void 0,initialActiveStep:void 0,collapsible:!0,isEditMode:!1});var Bi=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(t),"renderButtonType",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-radio-btn-container react-autoql-radio-btn-container-buttons ".concat(t.props.className),"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))}))))})),Ot(Bt(t),"renderOriginalType",(function(){return f.createElement(Kt,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))}))))})),Ot(Bt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return Pt(o)}();Ot(Bi,"propTypes",{options:y.arrayOf(y.string),onChange:y.func,value:y.string,multiSelect:y.bool,type:y.string,tooltips:y.arrayOf(y.string),tooltipId:y.string}),Ot(Bi,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var Hi=["onChange","options","selectedOption","className"],Qi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"ID",b()),Ot(Bt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),Ot(Bt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),Ot(Bt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=Ft(t,Hi);return f.createElement(Kt,null,f.createElement(ke,Mt({className:"".concat(e.props.className||""," react-autoql-select-with-arrow"),classNamePrefix:"react-autoql-select-with-arrow",value:e.state.selected,onChange:e.handleChange,options:e.props.options},n)))})),e}return Pt(n)}();Ot(Qi,"propTypes",{onChange:y.func,options:y.arrayOf(y.shape({})),selectedOption:y.shape({})}),Ot(Qi,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var zi=Ae.tz.guess(),Ui=Ae.tz.names().map((function(e){return{value:e,label:e}})),ji=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),Ot(Bt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||zi;return Ui.find((function(e){return e.label===t}))})),Ot(Bt(e),"render",(function(){var t=e.getSelectedOption();return f.createElement(Qi,{className:"react-autoql-timezone-select",options:Ui,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return Pt(n)}();Ot(ji,"propTypes",{onChange:y.func,defaultSelection:y.string}),Ot(ji,"defaultProps",{onChange:function(){},defaultSelection:void 0});var Ki=function(e){if(e){var t=e.notification_type,n=e.reset_period,o=void 0;return"CONTINUOUS"===t?o="Every time this happens":"DAY"===n?o="Only once per day":"WEEK"===n?o="Only once per week":"MONTH"===n&&(o="Only once per month"),o}},Yi=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{frequencySelectValue:Ki(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),Ot(Bt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),Ot(Bt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),Ot(Bt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),Ot(Bt(t),"getData",(function(){var e=t.state,n=e.frequencySelectValue,o="PERIODIC",a=null;return"Every time this happens"===n?o="CONTINUOUS":"Only once per day"===n?a="DAY":"Only once per week"===n?a="WEEK":"Only once per month"===n&&(a="MONTH"),{notificationType:o,resetPeriod:a,timezone:e.timezone}})),Ot(Bt(t),"getResetPeriod",(function(e){return"Only once per day"===e?"DAY":"Only once per month"===e?"MONTH":"Only once per week"===e?"WEEK":"Every time this happens"===e?"CONTINUOUS":void 0})),Ot(Bt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),Ot(Bt(t),"renderTimezoneComponent",(function(){return f.createElement("div",null,f.createElement("span",null,"Time zone: "),f.createElement(ji,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},f.createElement("div",{className:"frequency-settings-container"},f.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),f.createElement(Bi,{options:["Every time this happens","Only once per day","Only once per week","Only once per month"],selectionPlaceholder:"Select a frequency",value:t.state.frequencySelectValue,type:"original",onChange:function(e){return t.setState({frequencySelectValue:e})}}))),f.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return Pt(o)}();Ot(Yi,"propTypes",{dataAlert:y.shape({}),onChange:y.func,onCompletedChange:y.func,onErrorCallback:y.func}),Ot(Yi,"defaultProps",{dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var Wi=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a.initializeFields()})),Ot(Bt(a),"componentDidUpdate",(function(e,t){if(!a.props.isVisible&&e.isVisible&&(setTimeout(a.resetFields,500),a.props.onClosed()),a.props.isVisible&&!e.isVisible&&(a.initializeFields(),a.props.onOpened()),a.props.initialQuery&&a.props.initialQuery!==e.initialQuery){a.resetFields();var n=a.createExpressionJSONFromQuery(a.props.initialQuery,a.props.userSelection);a.setState({isExpressionSectionComplete:!0,expressionJSON:n})}a.state.frequencyCategorySelectValue!==t.frequencyCategorySelectValue&&a.setState({everyCheckboxValue:!1,frequencySelectValue:"MONTH",weekSelectValue:[2],monthSelectValue:[1],yearSelectValue:[1]})})),Ot(Bt(a),"resetFields",(function(){a.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),Ot(Bt(a),"initializeFields",(function(){if(De(a.props.currentDataAlert)){if(a.props.initialQuery&&"string"==typeof a.props.initialQuery){var t=a.createExpressionJSONFromQuery(a.props.initialQuery,a.props.userSelection);a.setState({isExpressionSectionComplete:!0,expressionJSON:t})}}else{var n=a.props.currentDataAlert;a.setState({titleInput:n.title,messageInput:n.message,dataReturnQuery:n.data_return_query,isDataReturnDirty:!0,expressionJSON:e(a.props.currentDataAlert,"expression")})}})),Ot(Bt(a),"createExpressionJSONFromQuery",(function(e,t){return[{condition:"TERMINATOR",id:b(),term_type:"group",term_value:[{id:b(),term_type:"group",condition:"TERMINATOR",term_value:[{id:b(),condition:"EXISTS",term_type:"query",term_value:e,user_selection:t}]}]}]})),Ot(Bt(a),"getDataAlertData",(function(){try{var t,n=a.state,o=n.titleInput,r=n.messageInput,i=C(a.state.expressionJSON);a.expressionRef&&(i=a.expressionRef.getJSON(),t=a.expressionRef.getFirstQuery());var l={};return a.scheduleBuilderRef&&(l=a.scheduleBuilderRef.getData()),{id:e(a.props.currentDataAlert,"id"),title:o,data_return_query:t,message:r,expression:i,notification_type:l.notificationType,reset_period:l.resetPeriod,time_zone:l.timezone}}catch(e){console.error(e)}})),Ot(Bt(a),"onExpressionChange",(function(e,t,n){a.setState({isExpressionSectionComplete:e,isFirstSectionComplete:a.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:n})})),Ot(Bt(a),"isFirstSectionComplete",(function(){var e=!1;return a.expressionRef&&(e=a.expressionRef.isComplete()),a.props.enableQueryValidation?e&&!!a.state.titleInput&&a.state.isExpressionValidated&&a.state.isExpressionValid:e&&!!a.state.titleInput})),Ot(Bt(a),"onDataAlertSave",(function(){a.setState({isSavingDataAlert:!0});var t=xt(xt({},a.getDataAlertData()),{},{project_id:a.props.selectedDemoProjectId}),n=xt({dataAlert:t},Yn(a.props.authentication));a.props.isManagement?(a.props.onManagementCreateDataAlert(t),a.setState({isSavingDataAlert:!1})):t.id?function(t){var n=t.dataAlert,o=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No rule to update"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(o,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(a);return i.put(l,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt({},n)).then((function(e){a.props.onSave(e),a.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a.setState({isSavingDataAlert:!1})})):function(t){var n=t.dataAlert,o=t.domain,a=t.apiKey,r=t.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l=C(n);delete l.id;var s="".concat(o,"/autoql/api/v1/data-alerts?key=").concat(a);return i.post(s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt({},n)).then((function(e){a.props.onSave(e),a.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a.setState({isSavingDataAlert:!1})}))})),Ot(Bt(a),"validateFn",a.props.onValidate||ki),Ot(Bt(a),"validateExpression",(function(){try{if(a.setState({isValidating:!0,isExpressionValidated:!1}),a.expressionRef){var t=a.expressionRef.getJSON();a.validateFn(xt(xt({},a.props.authentication),{},{expression:t})).then((function(){a.setState({isValidating:!1,isExpressionValid:!0,isExpressionValidated:!0}),a.stepsRef&&setTimeout((function(){return a.stepsRef.nextStep()}),500)})).catch((function(t){a.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0,expressionError:e(t,"message")})}))}else a.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}catch(e){console.error(e),a.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}})),Ot(Bt(a),"renderValidateBtn",(function(){return a.expressionRef&&a.expressionRef.state.expressionError?null:f.createElement(v,null,a.state.isExpressionValidated&&a.state.isExpressionValid&&f.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},f.createElement(bn,{className:"expression-valid-checkmark",type:"check","data-for":"react-autoql-data-alert-modal-tooltip","data-tip":"Expression is valid"})),a.state.isExpressionValidated&&!a.state.isExpressionValid&&!!a.state.expressionError&&f.createElement("div",{className:"expression-invalid-message-container"},f.createElement("span",{className:"expression-invalid-message"},f.createElement(bn,{type:"warning-triangle"}))," ",f.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},a.state.expressionError)),f.createElement(gr,{onClick:a.validateExpression,loading:a.state.isValidating,tooltipID:a.props.tooltipID,type:"primary",disabled:!a.state.titleInput||!e(a.expressionRef,"state.expression[0].term_value"),style:{position:"absolute",right:0}},"Check Alert & continue"))})),Ot(Bt(a),"setStep",(function(e){a.stepsRef&&a.stepsRef.setStep(e)})),Ot(Bt(a),"renderNextBtn",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=arguments.length>3?arguments[3]:void 0;return f.createElement(gr,{className:e,onClick:function(){n(),a.stepsRef&&a.stepsRef.nextStep()},disabled:t,type:"primary",tooltipID:a.props.tooltipID},o||"Continue")})),Ot(Bt(a),"renderBackBtn",(function(e){return f.createElement(gr,{className:e,tooltipID:a.props.tooltipID,onClick:function(){a.stepsRef&&a.stepsRef.prevStep()}},"Back")})),Ot(Bt(a),"renderSetUpDataAlertStep",(function(){var t,n;return f.createElement("div",null,f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{width:"80%"}},f.createElement("p",null,"Name your Data Alert:"),f.createElement(Mi,{className:"react-autoql-notification-display-name-input",placeholder:"Add an Alert Name",icon:"title",maxLength:"50",value:a.state.titleInput,onChange:function(e){var t=a.state.isExpressionSectionComplete&&!!e.target.value;a.setState({titleInput:e.target.value,isFirstSectionComplete:t})}})),f.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},f.createElement(bn,{className:"react-autoql-data-alert-query-name-tooltip-icon","data-for":null!==(t=a.props.tooltipID)&&void 0!==t?t:"react-autoql-data-alert-query-name-tooltip","data-tip":"This will be visible to anyone who gets notified when this Alert is triggered.",type:"info",size:24}))),f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{width:"80%"}},f.createElement("p",null,"Notify me when:"),f.createElement(Vi,{authentication:a.props.authentication,ref:function(e){return a.expressionRef=e},key:"expression-".concat(a.NEW_NOTIFICATION_MODAL_ID),onChange:a.onExpressionChange,enableQueryValidation:a.props.enableQueryValidation,expression:e(a.props.currentDataAlert,"expression",a.state.expressionJSON)})),f.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},f.createElement(bn,{className:"react-autoql-data-alert-query-name-tooltip-icon","data-for":null!==(n=a.props.tooltipID)&&void 0!==n?n:"react-autoql-data-alert-query-name-tooltip","data-tip":"Your query should describe the result you wish to be alerted about.",type:"info",size:24}))),f.createElement("div",{className:"step-btn-container"},a.props.enableQueryValidation?a.renderValidateBtn():a.renderNextBtn("first-step-next-btn",a.props.enableQueryValidation&&(!a.state.isExpressionValidated||!a.state.isExpressionValid))))})),Ot(Bt(a),"renderFrequencyStep",(function(){return f.createElement("div",null,f.createElement(Yi,{ref:function(e){return a.scheduleBuilderRef=e},key:"schedule-".concat(a.NEW_NOTIFICATION_MODAL_ID),dataAlert:a.props.currentDataAlert,onCompletedChange:function(e){a.setState({isScheduleSectionComplete:e})},onErrorCallback:a.props.onErrorCallback}),f.createElement("div",{className:"step-btn-container"},a.renderBackBtn("second-step-back-btn"),a.renderNextBtn("second-step-next-btn",!a.state.isScheduleSectionComplete,(function(){return a.setState({isThirdSectionDirty:!0})}))))})),Ot(Bt(a),"renderAlertPreferencesStep",(function(){return f.createElement("div",null,f.createElement("p",null,"Optional:"),f.createElement(Mi,{className:"react-autoql-notification-message-input",placeholder:"This message will be visible when a notification is sent.",type:"multi",maxLength:"200",value:a.state.messageInput,onChange:function(e){return a.setState({messageInput:e.target.value})}}),f.createElement("div",{className:"step-btn-container"},a.renderBackBtn("second-step-back-btn")))})),Ot(Bt(a),"onDataAlertDelete",(function(){var t=e(a.props.currentDataAlert,"id");t&&(a.setState({isDeletingDataAlert:!0}),function(t,n){var o=n.domain,a=n.apiKey,r=n.token;if(!r||!a||!o)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(o,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(a);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(t,Yn(a.props.authentication)).then((function(){a.setState({isDeletingDataAlert:!1,isConfirmDeleteModalVisible:!1}),a.props.onDelete(t),a.props.onClose(!1)})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a.setState({isDeletingDataAlert:!1})})))})),Ot(Bt(a),"getModalContent",(function(){return a.props.isVisible?[{title:"Set Up Your Alert",content:a.renderSetUpDataAlertStep(),complete:a.isFirstSectionComplete(),error:a.props.enableQueryValidation&&a.state.isExpressionValidated&&!a.state.isExpressionValid},{title:"Set Notification Preferences",content:a.renderFrequencyStep(),complete:a.state.isScheduleSectionComplete},{title:"Compose Notification Message",content:a.renderAlertPreferencesStep(),complete:a.state.isThirdSectionDirty||!!a.props.currentDataAlert,onClick:function(){a.setState({isThirdSectionDirty:!0})}}]:null})),Ot(Bt(a),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),Ot(Bt(a),"render",(function(){var e,t,n=a.getModalContent();return f.createElement(Kt,null,f.createElement(bi,{overlayStyle:{zIndex:"9998"},title:a.props.title,titleIcon:De(a.props.currentDataAlert)?f.createElement("span",{key:"title-icon-".concat(a.COMPONENT_KEY)}):f.createElement(bn,{key:"title-icon-".concat(a.COMPONENT_KEY),type:"edit"}),ref:function(e){return a.modalRef=e},isVisible:a.props.isVisible,onClose:a.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:f.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},f.createElement("div",null,a.props.currentDataAlert&&a.props.allowDelete&&f.createElement(gr,{type:"danger",onClick:function(){a.setState({isConfirmDeleteModalVisible:!0})},loading:a.state.isDeletingDataAlert,tooltipID:a.props.tooltipID},"Delete Data Alert")),f.createElement("div",null,f.createElement(gr,{tooltipID:a.props.tooltipID,onClick:function(e){e.stopPropagation(),a.modalRef&&a.modalRef.onClose()}},"Cancel"),f.createElement(gr,{type:"primary",loading:a.state.isSavingDataAlert,onClick:a.onDataAlertSave,disabled:a.isSaveButtonDisabled(n),tooltipID:a.props.tooltipID},"Finish & Save")))},!a.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),a.props.isVisible&&f.createElement("div",{className:"notification-modal-content"},f.createElement(Fi,{ref:function(e){return a.stepsRef=e},steps:n,isEditMode:!(null===(e=a.props)||void 0===e||null===(t=e.currentDataAlert)||void 0===t||!t.id)}))),f.createElement(yi,{isVisible:a.state.isConfirmDeleteModalVisible,onConfirm:a.onDataAlertDelete,confirmLoading:a.state.isDeletingDataAlert,onClose:function(){a.setState({isConfirmDeleteModalVisible:!1})},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.")))})),a.COMPONENT_KEY=b(),a.NEW_NOTIFICATION_MODAL_ID=b(),a.state={titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1},a}return Pt(o)}();Ot(Wi,"propTypes",{authentication:Gt,onErrorCallback:y.func,onSave:y.func,initialQuery:y.string,userSelection:y.array,currentDataAlert:y.shape({}),isVisible:y.bool,allowDelete:y.bool,onClose:y.func,isManagement:y.bool,onManagementCreateDataAlert:y.func,onManagementDeleteDataAlert:y.func,title:y.string,titleIcon:y.oneOfType([y.element,y.instanceOf(bn)]),enableQueryValidation:y.bool,onValidate:y.func,onClosed:y.func,onOpened:y.func}),Ot(Wi,"defaultProps",{authentication:Un,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,userSelection:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},onClosed:function(){},onOpened:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var Gi=wo(Wi),Xi="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==",Ji=function(t){Lt(a,f.Component);var o=Qt(a);function a(){var t;kt(this,a);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=o.call.apply(o,[this].concat(i))),"MODAL_COMPONENT_KEY",b()),Ot(Bt(t),"NOTIFICATION_FETCH_LIMIT",10),Ot(Bt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0,hasMore:!0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0,t.getNotifications()})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(t),"closeDataAlertModal",(function(){t.setState({isEditModalVisible:!1})})),Ot(Bt(t),"getNotifications",(function(){Si(xt(xt({},t.props.authentication),{},{offset:t.state.nextOffset,limit:t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var o,a,r,i=C(t.state.notificationList),l=t.state.nextOffset,s=t.state.pagination;e(n,"items.length")&&(i=[].concat(zt(i),zt(n.items)),l=t.state.nextOffset+t.NOTIFICATION_FETCH_LIMIT,s=n.pagination);var c=!(null!=n&&null!==(o=n.items)&&void 0!==o&&o.length)||(null===(a=i)||void 0===a?void 0:a.length)===(null==n||null===(r=n.pagination)||void 0===r?void 0:r.total_items);t._isMounted&&t.setState({notificationList:i,pagination:s,nextOffset:l,hasMore:c,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t._isMounted&&t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),Ot(Bt(t),"refreshNotifications",(function(){Si(xt(xt({},Yn(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var o=t.detectNewNotifications(e.items);if(!n(e.items,t.state.notificationList))if(null!=o&&o.length&&10!==(null==o?void 0:o.length)){var a=[].concat(zt(o),zt(t.state.notificationList));t.setState({notificationList:a,pagination:xt({},e.pagination),nextOffset:a.length-1})}else t.setState({notificationList:e.items,pagination:e.pagination})}))})),Ot(Bt(t),"detectNewNotifications",(function(e){var n=[];return e.every((function(e){return!t.state.notificationList.find((function(t){return t.id===e.id}))&&(n.push(e),!0)})),n})),Ot(Bt(t),"onItemClick",(function(e){var n=void 0,o=t.state.notificationList.map((function(t){return e.id===t.id?(t.expanded||(n=e.id),xt(xt({},t),{},{expanded:!t.expanded})):xt(xt({},t),{},{expanded:!1})}));t.setState({notificationList:o,activeNotificationId:n})})),Ot(Bt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return xt(xt({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Ri(xt({},Yn(t.props.authentication))).then((function(){t.props.onDismissCallback(e),t.props.onChange(e)})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?xt(xt({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n},(function(){t.props.onDismissCallback(n)}))})),Ot(Bt(t),"onDeleteClick",(function(e){var n=t.state.notificationList.filter((function(t){return t.id!==e.id}));t.setState({notificationList:n,nextOffset:t.state.nextOffset>0?t.state.nextOffset-1:0},(function(){t.props.onDeleteCallback(n)}))})),Ot(Bt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),Ot(Bt(t),"renderDismissAllButton",(function(){return f.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},f.createElement("span",{onClick:t.onDismissAllClick},f.createElement(bn,{type:"notification-off",style:{verticalAlign:"middle"}})," Dismiss All"))})),Ot(Bt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),Ot(Bt(t),"renderEditDataAlertModal",(function(){return f.createElement(Gi,{key:t.MODAL_COMPONENT_KEY,authentication:t.props.authentication,isVisible:t.state.isEditModalVisible,onClose:t.closeDataAlertModal,onOpened:t.props.onDataAlertModalOpen,onClosed:t.props.onDataAlertModalClose,currentDataAlert:t.state.activeDataAlert,onSave:t.onDataAlertSave,onErrorCallback:t.props.onErrorCallback,allowDelete:!1,title:t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert",titleIcon:t.state.activeDataAlert?f.createElement(bn,{type:"edit"}):f.createElement("span",null)})})),Ot(Bt(t),"render",(function(){var n={};return t.props.shouldRender||(n.visibility="hidden",n.opacity="0"),t.state.isFetchingFirstNotifications?f.createElement("div",{style:n,className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?f.createElement("div",{style:n,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(gr,{onClick:t.getInitialNotifications},"Try Again"))):f.createElement(Kt,null,f.createElement("div",{style:n,className:"react-autoql-notification-list-container","data-test":"notification-list"},!t.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?f.createElement(v,null,t.renderDismissAllButton(),f.createElement(Er,null,f.createElement(Te,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(sr,null)),useWindow:!1},f.createElement("div",{className:"notification-feed-list"},t.state.notificationList.map((function(e,n){return f.createElement(_i,{key:"notification-item-".concat(n),authentication:t.props.authentication,notification:e,onClick:t.onItemClick,onDismissCallback:t.onDismissClick,onDismissSuccessCallback:function(){t.props.onChange(t.state.notificationList)},onDeleteCallback:t.onDeleteClick,onDeleteSuccessCallback:function(){t.props.onChange(t.state.notificationList),t.getNotifications()},onExpandCallback:function(e){t.props.onExpandCallback(e),t.setState({activeNotificationId:e.id})},onCollapseCallback:t.props.onCollapseCallback,activeNotificationData:t.props.activeNotificationData,autoChartAggregations:t.props.autoChartAggregations,showNotificationDetails:t.props.showNotificationDetails,onErrorCallback:t.props.onErrorCallback,onEditClick:function(e){t.setState({activeDataAlert:e}),t.showEditDataAlertModal()},enableAjaxTableData:t.props.enableAjaxTableData})})))))):f.createElement("div",{className:"empty-notifications-message"},f.createElement("img",{className:"empty-notifications-img",src:Xi}),f.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),f.createElement("div",null,"Stay tuned!"),f.createElement("br",null),t.props.showCreateAlertBtn&&f.createElement(gr,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal()))})),t}return Pt(a)}();Ot(Ji,"propTypes",{authentication:Gt,onCollapseCallback:y.func,onExpandCallback:y.func,activeNotificationData:y.shape({}),showNotificationDetails:y.bool,onErrorCallback:y.func,onSuccessCallback:y.func,onDismissCallback:y.func,onDeleteCallback:y.func,onChange:y.func,autoChartAggregations:y.bool,showCreateAlertBtn:y.bool,enableAjaxTableData:y.bool,onDataAlertModalOpen:y.func,shouldRender:y.bool}),Ot(Ji,"defaultProps",{authentication:Un,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,enableAjaxTableData:!1,shouldRender:!0,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDataAlertModalOpen:function(){},onChange:function(){}});var Zi=wo(Ji),$i=function(e){var t=o(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},el=function(t){Lt(a,f.Component);var o=Qt(a);function a(){var t;kt(this,a);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=o.call.apply(o,[this].concat(i))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts()})),Ot(Bt(t),"componentDidUpdate",(function(e,o){n(Yn(t.props.authentication),Yn(e.authentication))||t.getDataAlerts()})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(t),"getDataAlerts",(function(n){Ti(xt(xt({},Yn(t.props.authentication)),{},{type:n})).then((function(n){t._isMounted&&t.setState({customAlertsList:e(n,"data.custom_alerts"),projectAlertsList:e(n,"data.project_alerts")})})).catch((function(e){console.error(e)}))})),Ot(Bt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),Ot(Bt(t),"onDataAlertSave",(function(){t.getDataAlerts(),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1})})),Ot(Bt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),Ot(Bt(t),"onEnableSwitchChange",(function(e,n){var o=e.target.checked?"ACTIVE":"INACTIVE",a="CUSTOM"===n.type?"customAlertsList":"projectAlertsList",r=t.state[a].map((function(e){return n.id===e.id?xt(xt({},e),{},{status:o}):e}));t.setState(Ot({},"".concat(a),r)),Ai(xt({dataAlertId:n.id,type:n.type,status:o},Yn(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.getDataAlerts()}))})),Ot(Bt(t),"renderNotificationEditModal",(function(){return f.createElement(Gi,{ref:function(e){return t.editModalRef=e},key:t.COMPONENT_KEY,authentication:t.props.authentication,isVisible:t.state.isEditModalVisible,onClose:function(){return t.setState({isEditModalVisible:!1})},currentDataAlert:t.state.activeDataAlert,onSave:t.onDataAlertSave,onErrorCallback:t.props.onErrorCallback,onDelete:t.onDataAlertDelete,title:t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert",titleIcon:t.state.activeDataAlert?f.createElement(bn,{type:"edit"}):f.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),Ot(Bt(t),"renderNotificationGroupTitle",(function(e,t){return f.createElement("div",{className:"react-autoql-notification-title-container"},f.createElement("div",{style:{paddingLeft:"10px"}},f.createElement("div",{style:{fontSize:"17px"}},e),f.createElement("div",{style:{fontSize:"11px",opacity:.6}},t)))})),Ot(Bt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),Ot(Bt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),Ot(Bt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),Ot(Bt(t),"renderNotificationlist",(function(e,n){return"project"!==e||null!=n&&n.length?f.createElement("div",{className:"data-alerts-list-container"},"custom"===e&&null!=n&&n.length?t.renderNotificationGroupTitle("Custom Data Alerts","View and manage your custom Data Alerts"):null,"custom"===e&&!(null!=n&&n.length)&&t.renderEmptyListMessage(),"project"===e&&t.renderNotificationGroupTitle("Subscribe to a Data Alert","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(e,n){return f.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},f.createElement("div",{className:"react-autoql-notification-setting-item-header"},f.createElement("div",{className:"react-autoql-notification-setting-display-name"},f.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},f.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?f.createElement(bn,{type:"warning-triangle",className:"react-autoql-notification-error-status-icon",onClick:function(){return t.goToErrorFeedback(e)},"data-for":"react-autoql-notification-settings-tooltip","data-tip":"There was a problem with this Data Alert. Click for more information.",warning:!0}):f.createElement(bn,{type:"warning-triangle",id:"react-autoql-notification-error-status-icon-PROJECT","data-for":"react-autoql-notification-settings-tooltip","data-tip":"There was a problem with this Data Alert. For more information, please contact your system administrator.",warning:!0})),e.title)),f.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&f.createElement("span",null," - ",e.message))),f.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&f.createElement(bn,{className:"react-autoql-notification-action-btn",type:"edit","data-for":"react-autoql-notification-settings-tooltip","data-tip":"Edit Data Alert",onClick:function(n){"CUSTOM"===e.type&&t.onEditClick(n,e)}}),e.reset_date&&f.createElement(bn,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat($i(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?f.createElement(f.Fragment,null,"CUSTOM"===e.type&&f.createElement(gr,{type:"primary",tooltip:"This Alert is no longer active. <br /> Click to re-initialze it.",multiline:!0,className:"react-autoql-re-initialize-btn",onClick:function(){t.props.onAlertInitializationCallback(e,t.props.selectedDemoProjectId,t.props.authentication),t.getDataAlerts()}},f.createElement("span",{className:"react-autoql-re-initialize-btn-text"},f.createElement(bn,{type:"warning-triangle"})," Resend")),f.createElement(br,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):f.createElement(br,{type:"switch",checked:"ACTIVE"===e.status||"WAITING"===e.status,className:"react-autoql-notification-enable-checkbox",onClick:function(e){return e.stopPropagation()},"data-tip":"ACTIVE"===e.status||"WAITING"===e.status,"data-for":"react-autoql-notification-settings-tooltip",onChange:function(n){t.onEnableSwitchChange(n,e),En()}}))))})))):null})),Ot(Bt(t),"renderEmptyListMessage",(function(){return f.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},f.createElement("div",{className:"empty-list-message"},f.createElement("img",{className:"empty-list-img",src:Xi})),f.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),f.createElement("br",null),f.createElement("span",{style:{opacity:.6,width:"350px",display:"inline-block"}},"To create one, select the “Create a Data Alert” option from a data response in Data Messenger."),f.createElement("br",null))})),Ot(Bt(t),"render",(function(){if(!t.state.customAlertsList)return f.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},f.createElement(No,null));var n=e(t.state,"projectAlertsList",[]),o=e(t.state,"customAlertsList",[]);return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",o),t.renderNotificationEditModal(),f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return Pt(a)}();Ot(el,"propTypes",{authentication:Gt,onErrorCallback:y.func,onSuccessAlert:y.func}),Ot(el,"defaultProps",{authentication:Un,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var tl=wo(el),nl=function(t){Lt(a,f.Component);var o=Qt(a);function a(t){var r;kt(this,a),Ot(Bt(r=o.call(this,t)),"autoCompleteTimer",void 0),Ot(Bt(r),"state",xt({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))),Ot(Bt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),Ot(Bt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=b(),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}))})),Ot(Bt(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}]})),Ot(Bt(r),"isNumerical",(function(e){return!isNaN(Number(e))})),Ot(Bt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),Ot(Bt(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),Ot(Bt(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}),Ei(xt({query:r.state.input1Value},Yn(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),Ot(Bt(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}),Ei(xt({query:r.state.input2Value},Yn(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})})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){lo(xt(xt(xt({},Yn(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)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),Ot(Bt(r),"renderReadOnlyRule",(function(){return f.createElement(Kt,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(za(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"},za(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),Ot(Bt(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(bn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),Ot(Bt(r),"renderRule",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Mi,{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(Sr,{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(Mi,{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(bn,{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)}})))})),Ot(Bt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=b(),r.TERM_ID_2=b();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=b()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return Pt(a)}();Ot(nl,"propTypes",{authentication:Gt,ruleId:y.string,onAdd:y.func,onDelete:y.func,onUpdate:y.func,initialData:y.arrayOf(y.shape({})),readOnly:y.bool,enableQueryValidation:y.bool}),Ot(nl,"defaultProps",{authentication:Un,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var ol=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,o=e.id||b();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:b(),type:"rule",isComplete:!1}),t={rules:n}),t},al=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"ID",b()),Ot(Bt(e),"ruleRefs",[]),Ot(Bt(e),"state",xt({rules:[],andOrSelectValue:"ALL"},ol(e.props.initialData))),Ot(Bt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),Ot(Bt(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||b(),term_type:"group",condition:o,term_value:r}}))})),Ot(Bt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isComplete()}))})),Ot(Bt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var o=e.ruleRefs[n];return!!o&&o.isValid()}))})),Ot(Bt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),Ot(Bt(e),"onRuleUpdate",(function(t,n,o){var a=e.state.rules.map((function(e){return e.id===t?xt(xt({},e),{},{isComplete:n,termValue:o}):e}));e.setState({rules:a}),e.props.onUpdate(e.props.groupId,e.isComplete())})),Ot(Bt(e),"addRule",(function(){var t=b(),n=[].concat(zt(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),Ot(Bt(e),"addGroup",(function(){var t=b(),n=[].concat(zt(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),Ot(Bt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),Ot(Bt(e),"renderAllAnySelect",(function(){return f.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",f.createElement(Bi,{options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),Ot(Bt(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(bn,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),Ot(Bt(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(bn,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),Ot(Bt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return f.createElement(Kt,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(nl,{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())))})),Ot(Bt(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(Kt,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(nl,{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}))))})),Ot(Bt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return Pt(n)}();Ot(al,"propTypes",{authentication:Gt,groupId:y.string,onDelete:y.func,onUpdate:y.func,disableAddGroupBtn:y.bool,hideTopCondition:y.bool,readOnly:y.bool,enableQueryValidation:y.bool}),Ot(al,"defaultProps",{authentication:Un,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var rl=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:b(),isComplete:!1}),n={groups:o}),n},il=function(e){Lt(o,f.Component);var t=Qt(o);function o(){var e;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),Ot(Bt(e),"state",xt({groups:[],andOrValue:"ALL"},rl(e.props.expression))),Ot(Bt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(e),"componentDidUpdate",(function(t,o){n(t.expression,e.props.expression)||e.setState(xt({},rl(e.props.expression))),n(o,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isComplete()}))})),Ot(Bt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var o=e.groupRefs[n];return!!o&&o.isValid()}))})),Ot(Bt(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||b(),term_type:"group",condition:o,term_value:r}}))})),Ot(Bt(e),"addGroup",(function(t){var n=t.initialData,o=t.isComplete,a=t.id||b(),r=[].concat(zt(e.state.groups),[{initialData:n,isComplete:o,id:a}]);e.setState({groups:r})})),Ot(Bt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),Ot(Bt(e),"getAndOrValue",(function(){return e.state.andOrValue})),Ot(Bt(e),"onGroupUpdate",(function(t,n){var o=e.state.groups.map((function(e){return e.id===t?xt(xt({},e),{},{isComplete:n}):e}));e.setState({groups:o}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(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(al,{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)))})))})),Ot(Bt(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(Bi,{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(al,{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(bn,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),!e.props.tooltipID&&f.createElement(Sn,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return Pt(o)}();Ot(il,"propTypes",{authentication:Gt,expression:y.arrayOf(y.shape({})),readOnly:y.bool,onChange:y.func}),Ot(il,"defaultProps",{authentication:Un,expression:void 0,readOnly:!1,onChange:function(){}});var ll=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0,problemType:void 0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0})),Ot(Bt(t),"shouldComponentUpdate",(function(e,n){return!Za(t.props,e)||!Za(t.state,n)})),Ot(Bt(t),"componentDidUpdate",(function(e){!t.props.isVisible&&e.isVisible&&t.setState({problemType:void 0,reportProblemMessage:void 0})})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(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}),go(xt({message:n,queryId:o},Yn(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})}))})),Ot(Bt(t),"onConfirm",(function(){t.reportQueryProblem(),t.setState({reportProblemMessage:void 0})})),Ot(Bt(t),"onClose",(function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement(bi,{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(Bi,{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 Pt(o)}();Ot(ll,"propTypes",{authentication:Gt,onReportProblem:y.func,isVisible:y.bool}),Ot(ll,"defaultProps",{authentication:Un,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var sl=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0,a.rebuildTooltips()})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){if(a.state.activeMenu!==t.activeMenu)return!0;if(!a.props.shouldRender&&!e.shouldRender)return!1;var n=Za(a.props,e),o=Za(a.state,t);return!n||!o})),Ot(Bt(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}),a.rebuildTooltips())})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.temporaryStateTimeout),clearTimeout(a.pivotTableCSVDownloadTimeout)})),Ot(Bt(a),"rebuildTooltips",(function(){a.props.shouldRender&&(a.props.rebuildTooltips?a.props.rebuildTooltips():Cn())})),Ot(Bt(a),"onTableFilter",(function(e){var t,n;"table"===(null===(t=a.props.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.displayType)&&a.setState({disableChartingOptions:(null==e?void 0:e.length)<2})})),Ot(Bt(a),"setTemporaryState",(function(e,t,n){a.setState(Ot({},e,t)),a.temporaryStateTimeout=setTimeout((function(){a.setState(Ot({},e,void 0))}),n)})),Ot(Bt(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),En()):a.setTemporaryState("copiedTable",!1,1e3)})),Ot(Bt(a),"fetchCSVAndExport",(function(){var t,n,o,r,i,l,s,c,u=null===(t=a.props.responseRef)||void 0===t||null===(n=t.queryResponse)||void 0===n||null===(o=n.data)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.query_id,d=null===(i=a.props.responseRef)||void 0===i||null===(l=i.queryResponse)||void 0===l||null===(s=l.data)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.text,p=b();a.props.onCSVDownloadStart({id:p,queryId:u,query:d}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,o=t.domain,a=t.apiKey,r=t.token,i=t.csvProgressCallback;if(!r||!o||!a)return Promise.reject(new Error("Unauthenticated"));var l="".concat(o,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(a),s={headers:{Authorization:"Bearer ".concat(r)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return m.post(l,{},s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))}(xt(xt({queryId:u},Yn(a.props.authentication)),{},{csvProgressCallback:function(e){return a.props.onCSVDownloadProgress({id:p,progress:e})}})).then((function(e){var t,n,o,r=window.URL.createObjectURL(new Blob([e.data])),i=document.createElement("a");i.href=r,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===(o=n.limit_reached)||void 0===o?void 0:o.toLowerCase());a.props.onCSVDownloadFinish({id:p,exportLimit:l,limitReached:s})})).catch((function(e){a.props.onCSVDownloadFinish({id:p,error:e}),console.error(e)}))})),Ot(Bt(a),"onCSVMenuButtonClick",(function(){var e,t;a.setState({activeMenu:void 0});var n,o,r,i,l="pivot_table"===(null===(e=a.props.responseRef)||void 0===e||null===(t=e.state)||void 0===t?void 0:t.displayType),s=b();l?null!==(n=a.props.responseRef)&&void 0!==n&&null!==(o=n.pivotTableRef)&&void 0!==o&&o._isMounted&&(a.props.onCSVDownloadStart({id:s}),null===(r=a.props.responseRef)||void 0===r||null===(i=r.pivotTableRef)||void 0===i||i.saveAsCSV(2e3).then((function(){a.props.onCSVDownloadProgress({id:s,progress:100}),a.props.onCSVDownloadFinish({id:s})})).catch((function(e){console.error(e),a.props.onCSVDownloadFinish({id:s})}))):a.fetchCSVAndExport()})),Ot(Bt(a),"saveChartAsPNG",(function(){var e;null===(e=a.props.responseRef)||void 0===e||e.saveChartAsPNG()})),Ot(Bt(a),"deleteMessage",(function(){En(),a.props.deleteMessageCallback()})),Ot(Bt(a),"copySQL",(function(){var e,t,n,o,r=null===(e=a.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.sql,i=document.createElement("textarea");i.value=r,document.body.appendChild(i),i.select(),document.execCommand("copy"),a.setTemporaryState("copiedSQL",!0,1e3),a.props.onSuccessAlert("Successfully copied generated query to clipboard!"),a.setState({sqlCopySuccess:!0}),En()})),Ot(Bt(a),"showHideColumnsModal",(function(){return a.setState({isHideColumnsModalVisible:!0})})),Ot(Bt(a),"closeColumnVisibilityModal",(function(){return a.setState({isHideColumnsModalVisible:!1})})),Ot(Bt(a),"closeDataAlertModal",(function(){a.setState({activeMenu:void 0})})),Ot(Bt(a),"onColumnVisibilitySave",(function(t){var n=a.props.authentication,o=t.map((function(e){var t=xt(xt({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));a.setState({isSettingColumnVisibility:!0}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,o=t.token,a=t.domain,r=t.columns,i="".concat(a,"/autoql/api/v1/query/column-visibility?key=").concat(n),l={columns:r};if(!o||!a||!n)return Promise.reject(new Error("Unauthenticated"));var s={headers:{Authorization:"Bearer ".concat(o)}};return m.put(i,l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},n),{},{columns:o})).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(o));a.props.onColumnVisibilitySave(o)})).catch((function(e){console.error(e),a.props.onErrorCallback(e),a._isMounted&&a.setState({isSettingColumnVisibility:!1})}))})),Ot(Bt(a),"renderHideColumnsModal",(function(){var e,t=null===(e=a.props.responseRef)||void 0===e?void 0:e.getColumns();if(!t||!t.length)return null;var n=t.map((function(e){return xt(xt({},e),{},{content:e.display_name,checked:e.is_visible})}));return f.createElement(Kt,null,f.createElement(Ci,{columns:n,isVisible:a.state.isHideColumnsModalVisible,onClose:a.closeColumnVisibilityModal,isSettingColumns:a.state.isSettingColumnVisibility,onConfirm:a.onColumnVisibilitySave}))})),Ot(Bt(a),"onDataAlertSave",(function(){a.props.onSuccessAlert("Successfully created a notification"),a.setState({activeMenu:void 0})})),Ot(Bt(a),"renderDataAlertModal",(function(){var e,t,n,o,r,i,l,s,c,u=null===(e=a.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.text,d=null===(r=a.props.responseRef)||void 0===r||null===(i=r.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s||null===(c=s.fe_req)||void 0===c?void 0:c.disambiguation;return f.createElement(Kt,null,f.createElement(Gi,{authentication:a.props.authentication,isVisible:"notification"===a.state.activeMenu,initialQuery:u,userSelection:d,onClose:a.closeDataAlertModal,onErrorCallback:a.props.onErrorCallback,onSave:a.onDataAlertSave,tooltipID:a.props.tooltipID}))})),Ot(Bt(a),"renderReportProblemModal",(function(){return f.createElement(ll,{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})})),Ot(Bt(a),"reportQueryProblem",(function(e){var t;null!==(t=a.reportProblemRef)&&void 0!==t&&t._isMounted&&a.reportProblemRef.reportQueryProblem(e)})),Ot(Bt(a),"refreshData",(function(){})),Ot(Bt(a),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn ".concat(null!=e?e:"")})),Ot(Bt(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(bn,{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(bn,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),t.showCopyButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:void 0}),a.copyTableToClipboard()}},f.createElement(bn,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),t.showSQLButton&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"sql"})}},f.createElement(bn,{type:"database"})," View generated SQL"),t.showCreateNotificationIcon&&f.createElement("li",{onClick:function(){a.setState({activeMenu:"notification"}),a.props.createDataAlertCallback()}},f.createElement(bn,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert...")))})),Ot(Bt(a),"isDrilldownResponse",(function(e){try{var t,n,o,a;return"Drilldown:"===(null===(t=e.responseRef)||void 0===t||null===(n=t.queryResponse)||void 0===n||null===(o=n.data)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.text).split(" ")[0]}catch(e){return!1}})),Ot(Bt(a),"openReportProblemModal",(function(){a.setState({activeMenu:"report-problem"})})),Ot(Bt(a),"renderSQLModal",(function(){var e,t,n,o,r,i=null===(e=a.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o||null===(r=o.sql)||void 0===r?void 0:r[0];return i?f.createElement(Kt,null,f.createElement(bi,{isVisible:"sql"===a.state.activeMenu,footer:f.createElement("div",null,f.createElement(gr,{type:"primary",onClick:function(){return a.setState({activeMenu:void 0})},tooltipID:a.props.tooltipID},"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(ht(i)),disabled:!0}),f.createElement(gr,{className:"copy-sql-btn ".concat(a.state.sqlCopySuccess?"sql-copied":""),onClick:a.copySQL,tooltip:"Copy to Clipboard",tooltipID:a.props.tooltipID},f.createElement(bn,{type:"copy"}),a.state.sqlCopySuccess&&f.createElement(bn,{type:"check",className:"sql-copied"}))))):null})),Ot(Bt(a),"renderToolbar",(function(e){var t,n,o,r,i,l,s,c,u;return null!==(t=a.props.responseRef)&&void 0!==t&&null!==(n=t.tableParams)&&void 0!==n&&null!==(o=n.filters)&&void 0!==o&&o.length,f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-toolbar options-toolbar\n ".concat(a.state.activeMenu?"active":"","\n ").concat(a.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&f.createElement("button",{onClick:function(){var e,t=null===(e=a.props.responseRef)||void 0===e?void 0:e.toggleTableFilter();a.setState({isFiltering:t})},className:a.getMenuItemClass("filter-btn"),"data-tip":"Filter table","data-for":null!==(r=a.props.tooltipID)&&void 0!==r?r:a.TOOLTIP_ID,"data-test":"react-autoql-filter-button"},f.createElement(bn,{type:"filter",showBadge:!1})),e.showHideColumnsButton&&f.createElement("button",{onClick:a.showHideColumnsModal,className:a.getMenuItemClass(e.showHideColumnsButton),"data-tip":"Show/hide columns","data-for":null!==(i=a.props.tooltipID)&&void 0!==i?i:a.TOOLTIP_ID,"data-test":"options-toolbar-col-vis"},f.createElement(bn,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&f.createElement("button",{onClick:a.openReportProblemModal,className:a.getMenuItemClass(e.showReportProblemButton),"data-tip":"Report a problem","data-for":null!==(l=a.props.tooltipID)&&void 0!==l?l:a.TOOLTIP_ID},f.createElement(bn,{type:"warning-triangle"})),e.showRefreshDataButton&&f.createElement("button",{onClick:a.refreshData,className:a.getMenuItemClass(e.showRefreshDataButton),"data-tip":"Re-run query","data-for":null!==(s=a.props.tooltipID)&&void 0!==s?s:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(bn,{type:"refresh"})),e.showDeleteButton&&f.createElement("button",{onClick:a.deleteMessage,className:a.getMenuItemClass(e.showDeleteButton),"data-tip":"Delete data response","data-for":null!==(c=a.props.tooltipID)&&void 0!==c?c:a.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(bn,{type:"trash"})),e.showMoreOptionsButton&&f.createElement(Re,{key:"more-options-button-".concat(a.COMPONENT_KEY),isOpen:"more-options"===a.state.activeMenu,positions:["bottom","top","left","right"],padding:8,onClickOutside:function(){a.setState({activeMenu:void 0})},content:function(t){return a.renderMoreOptionsMenu(t,e)},parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement},f.createElement("button",{onClick:function(){En(),a.setState({activeMenu:"more-options"})},className:a.getMenuItemClass(e.showMoreOptionsButton),"data-tip":"More options","data-for":null!==(u=a.props.tooltipID)&&void 0!==u?u:a.TOOLTIP_ID,"data-test":"react-autoql-toolbar-more-options-btn"},f.createElement(bn,{type:"more-vertical"})))))})),Ot(Bt(a),"getShouldShowButtonObj",(function(e){var t={};try{var n,o,r,i,l,s,c,u,d,p,m,f,g,v,h=null===(n=e.responseRef)||void 0===n||null===(o=n.state)||void 0===o?void 0:o.displayType,y=null===(r=e.responseRef)||void 0===r?void 0:r.getColumns(),b=Aa(h),C=Na(h),E="pivot_table"===h,S=null===(i=e.responseRef)||void 0===i?void 0:i.queryResponse,T="data"===(null==S||null===(l=S.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.display_type),D=qa(y),x=La(y),R=null==S||null===(c=S.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.rows)||void 0===d?void 0:d.length,w=R>0,N=!(null===(p=e.responseRef)||void 0===p||null===(m=p.tableParams)||void 0===m||null===(f=m.filters)||void 0===f||!f.length),A=R>1&&!N||!!N,k=Gn(e.autoQLConfig);(t={showFilterButton:b&&!E&&!D&&A,showCopyButton:b&&!D,showSaveAsPNGButton:C,showHideColumnsButton:k.enableColumnVisibilityManager&&w&&("table"===h||"text"===h&&D),showHiddenColsBadge:x,showSQLButton:T&&k.debug,showSaveAsCSVButton:b&&A&&k.enableCSVDownload,showDeleteButton:e.enableDeleteBtn,showReportProblemButton:k.enableReportProblem&&!(null==S||null===(g=S.data)||void 0===g||null===(v=g.data)||void 0===v||!v.query_id),showCreateNotificationIcon:T&&k.enableNotifications&&!a.isDrilldownResponse(e),showRefreshDataButton:!1}).showMoreOptionsButton=t.showCopyButton||t.showSQLButton||t.showCreateNotificationIcon||t.showSaveAsCSVButton||t.showSaveAsPNGButton}catch(e){console.error(e)}return t})),Ot(Bt(a),"render",(function(){var e=a.getShouldShowButtonObj(a.props);return Object.values(e).find((function(e){return!0===e}))?f.createElement(Kt,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(Sn,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800})):null})),a.COMPONENT_KEY=b(),a.TOOLTIP_ID="react-autoql-options-toolbar-tooltip-".concat(a.COMPONENT_KEY),a.state={isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1},a}return Pt(o)}();Ot(sl,"propTypes",{authentication:Gt,autoQLConfig:Jt,enableDeleteBtn:y.bool,shouldRender:y.bool,onSuccessAlert:y.func,onErrorCallback:y.func,onNewNotificationCallback:y.func,deleteMessageCallback:y.func,createDataAlertCallback:y.func,onCSVDownloadStart:y.func,onCSVDownloadFinish:y.func,onCSVDownloadProgress:y.func,rebuildTooltips:y.func}),Ot(sl,"defaultProps",{authentication:Un,autoQLConfig:Kn,enableDeleteBtn:!1,shouldRender:!0,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},createDataAlertCallback:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var cl,ul=f.forwardRef((function(e,t){var n=Mt({},(_t(e),e));return f.createElement(sl,Mt({},n,{ref:t}))})),dl=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0,a.props.scrollToBottom(),a.scrollToBottomTimeout=setTimeout((function(){a.props.scrollToBottom()}),100),a.setIsAnimating()})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){return(!a.props.isResizing||!e.isResizing)&&(!Za(a.props,e)||!Za(a.state,t))})),Ot(Bt(a),"getSnapshotBeforeUpdate",(function(e,t){var n,o=!1;return a.ref&&(!a.props.isResizing&&e.isResizing&&(o=!0,n=a.ref.clientWidth),a.props.isResizing&&!e.isResizing&&(o=!0,n="")),{messageWidth:n,shouldUpdateWidth:o}})),Ot(Bt(a),"componentDidUpdate",(function(e,t,n){var o,r=n.messageWidth;n.shouldUpdateWidth&&null!==(o=a.ref)&&void 0!==o&&o.style&&(a.ref.style.width=r)})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.scrollToBottomTimeout),clearTimeout(a.animationTimeout)})),Ot(Bt(a),"setIsAnimating",(function(){if(!a.state.isAnimatingMessageBubble)return a.setState({isAnimatingMessageBubble:!0},(function(){a.clearIsAnimatingIn500ms()}));a.clearIsAnimatingIn500ms()})),Ot(Bt(a),"clearIsAnimatingIn500ms",(function(){clearTimeout(a.animationTimeout),a.animationTimeout=setTimeout((function(){a.setState({isAnimatingMessageBubble:!1}),a.props.scrollToBottom()}),500)})),Ot(Bt(a),"onCSVDownloadFinish",(function(e){var t,n,o,r=e.error,i=e.exportLimit,l=e.limitReached;if(r)return a.props.addMessageToDM({response:r});var s=null===(t=a.props.response)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.text;a.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,s)),".",l?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 ",i,"MB. This exceeds the maximum download size and you will only receive partial data.")):null)})})),Ot(Bt(a),"isScrolledIntoView",(function(e){if(a.props.scrollContainerRef){var t=a.props.scrollContainerRef.getScrollTop(),n=t+a.props.scrollContainerRef.getClientHeight(),o=e.offsetTop;return o+e.offsetHeight<=n&&o>=t}return!1})),Ot(Bt(a),"scrollIntoView",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.block,n=void 0===t?"end":t,o=e.inline,r=void 0===o?"nearest":o,i=e.behavior,l=void 0===i?"smooth":i;setTimeout((function(){a.messageContainerRef&&!a.isScrolledIntoView(a.messageContainerRef)&&a.messageContainerRef.scrollIntoView({block:n,inline:r,behavior:l})}),0),setTimeout((function(){a.messageContainerRef&&!a.isScrolledIntoView(a.messageContainerRef)&&a.messageContainerRef.scrollIntoView({block:n,inline:r,behavior:l})}),100)})),Ot(Bt(a),"updateDataConfig",(function(e){a.setState({dataConfig:e})})),Ot(Bt(a),"renderFetchingFileMessage",(function(){return f.createElement("div",null,"Fetching your file ",f.createElement(sr,null))})),Ot(Bt(a),"renderCSVProgressMessage",(function(){return isNaN(a.state.csvDownloadProgress)?a.renderFetchingFileMessage():"Downloading your file ... ".concat(a.state.csvDownloadProgress,"%")})),Ot(Bt(a),"renderContent",(function(){return a.props.isCSVProgressMessage||void 0!==a.state.csvDownloadProgress?a.renderCSVProgressMessage():a.props.content?a.props.content:401===e(a.props.response,"status")?Yt.UNAUTHENTICATED:a.props.response?f.createElement(gi,{ref:function(e){return a.responseRef=e},optionsToolbarRef:a.optionsToolbarRef,vizToolbarRef:a.vizToolbarRef,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,queryResponse:a.props.response,onSuggestionClick:a.props.onSuggestionClick,isQueryRunning:a.props.isChataThinking,copyToClipboard:a.copyToClipboard,tableOptions:a.props.tableOptions,dataFormatting:a.props.dataFormatting,appliedFilters:a.props.appliedFilters,onDrilldownStart:a.props.onDrilldownStart,onDrilldownEnd:a.props.onDrilldownEnd,demo:Yn(a.props.authentication).demo,enableAjaxTableData:a.props.enableAjaxTableData,originalQueryID:a.props.originalQueryID,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),onErrorCallback:a.props.onErrorCallback,enableColumnHeaderContextMenu:!0,isAnimating:a.state.isAnimatingMessageBubble,isResizing:a.props.isResizing,enableDynamicCharting:a.props.enableDynamicCharting,initialTableConfigs:a.state.dataConfig,onTableConfigChange:a.updateDataConfig,onNoneOfTheseClick:a.props.onNoneOfTheseClick,autoChartAggregations:a.props.autoChartAggregations,showQueryInterpretation:!1,enableFilterLocking:a.props.enableFilterLocking,onRTValueLabelClick:a.props.onRTValueLabelClick,rebuildTooltips:a.props.rebuildTooltips,source:a.props.source,onRowChange:a.scrollIntoView,onDisplayTypeChange:a.scrollIntoView,mutable:!1,tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID,showSuggestionPrefix:!1,dataPageSize:a.props.dataPageSize,popoverParentElement:a.props.popoverParentElement,reportProblemCallback:function(){var e,t;null!==(e=a.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=a.optionsToolbarRef)||void 0===t||t.openReportProblemModal())}}):Yt.GENERAL_QUERY})),Ot(Bt(a),"onCSVDownloadStart",(function(e){var t=e.id,n=e.queryId,o=e.query;a.props.addMessageToDM({id:t,query:o,queryId:n,content:a.renderFetchingFileMessage(),isCSVProgressMessage:!0})})),Ot(Bt(a),"onDeleteMessage",(function(){return a.props.deleteMessageCallback(a.props.id)})),Ot(Bt(a),"renderRightToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar right"},a.props.isResponse?f.createElement(ul,{ref:function(e){return a.optionsToolbarRef=e},responseRef:a.responseRef,className:"chat-message-toolbar right",shouldRender:!a.props.isResizing&&a.props.shouldRender,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,onCSVDownloadStart:a.onCSVDownloadStart,onCSVDownloadFinish:a.onCSVDownloadFinish,onCSVDownloadProgress:a.props.onCSVDownloadProgress,onSuccessAlert:a.props.onSuccessAlert,onErrorCallback:a.props.onErrorCallback,enableDeleteBtn:!a.props.isIntroMessage,rebuildTooltips:a.props.rebuildTooltips,popoverParentElement:a.props.popoverParentElement,deleteMessageCallback:a.onDeleteMessage,tooltipID:a.props.tooltipID,createDataAlertCallback:a.props.createDataAlertCallback}):null)})),Ot(Bt(a),"renderLeftToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar left"},a.props.isResponse&&"text"!==a.props.type?f.createElement(hi,{ref:function(e){return a.vizToolbarRef=e},responseRef:a.responseRef,className:"chat-message-toolbar left",tooltipID:a.props.tooltipID,shouldRender:!a.props.isResizing&&a.props.shouldRender}):null)})),Ot(Bt(a),"render",(function(){var e,t,n,o,r=!(null===(e=a.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o||!o.parsed_interpretation);return f.createElement(Kt,null,f.createElement("div",{id:"message-".concat(a.props.id),ref:function(e){return a.messageContainerRef=e},"data-test":"chat-message",className:"chat-single-message-container\n ".concat(a.props.isResponse?" response":" request","\n ").concat(a.props.disableMaxHeight||a.props.isIntroMessage?" no-max-height":"","\n ")},f.createElement("div",{ref:function(e){return a.ref=e},className:"chat-message-bubble\n ".concat("text"===a.props.type?" text":"","\n ").concat(a.props.isActive?" active":"")},a.renderContent(),f.createElement("div",{className:"chat-message-toolbars-container"},a.renderLeftToolbar(),a.renderRightToolbar()))),r?f.createElement("div",{className:"chat-message-rt-container"},f.createElement(mi,{authentication:a.props.authentication,onValueLabelClick:a.props.onRTValueLabelClick,appliedFilters:a.props.appliedFilters,isResizing:a.props.isResizing,reverseTranslation:a.responseRef.queryResponse.data.data.parsed_interpretation,tooltipID:a.props.tooltipID})):null)})),a.filtering=!1,a.PIE_CHART_HEIGHT=330,a.MESSAGE_HEIGHT_MARGINS=40,a.MESSAGE_WIDTH_MARGINS=40,a.ORIGINAL_TABLE_MESSAGE_HEIGHT=void 0,a.state={csvDownloadProgress:a.props.initialCSVDownloadProgress,isAnimatingMessageBubble:!0,isSettingColumnVisibility:!1,activeMenu:void 0},a}return Pt(o)}();Ot(dl,"propTypes",(Ot(cl={authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,isResponse:y.bool.isRequired,isIntroMessage:y.bool,isActive:y.bool,type:y.string,text:y.string,id:y.string.isRequired,onSuggestionClick:y.func,response:y.shape({}),content:y.oneOfType([y.string,y.shape({})]),enableColumnVisibilityManager:y.bool},"dataFormatting",Xt),Ot(cl,"onErrorCallback",y.func),Ot(cl,"onSuccessAlert",y.func),Ot(cl,"isResizing",y.bool),Ot(cl,"enableDynamicCharting",y.bool),Ot(cl,"scrollToBottom",y.func),Ot(cl,"onNoneOfTheseClick",y.func),Ot(cl,"autoChartAggregations",y.bool),Ot(cl,"onConditionClickCallback",y.func),Ot(cl,"addMessageToDM",y.func),Ot(cl,"csvDownloadProgress",y.number),Ot(cl,"onRTValueLabelClick",y.func),Ot(cl,"enableAjaxTableData",y.bool),Ot(cl,"source",y.arrayOf(y.string)),Ot(cl,"isVisibleInDOM",y.bool),cl)),Ot(dl,"defaultProps",{authentication:Un,autoQLConfig:Kn,dataFormatting:jn,enableAjaxTableData:!1,isIntroMessage:!1,source:[],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 pl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(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&&o.focusInput()})),Ot(Bt(o),"componentDidUpdate",(function(e){o.props.shouldRender&&!e.shouldRender&&o.focusInput()})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.feedbackTimeout),clearTimeout(o.responseDelayTimeout)})),Ot(Bt(o),"focusInput",(function(){var e;null!==(e=o.queryInputRef)&&void 0!==e&&e._isMounted&&o.queryInputRef.focus()})),Ot(Bt(o),"scrollToBottom",(function(){var e,t;null===(e=o.messengerScrollComponent)||void 0===e||null===(t=e.ref)||void 0===t||t.scrollToBottom()})),Ot(Bt(o),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;o.csvProgressLog[t]=n,o.messageRefs[t]&&o.messageRefs[t].setState({csvDownloadProgress:n})})),Ot(Bt(o),"clearMessages",(function(){var e;null===(e=o.queryInputRef)||void 0===e||e.cancelQuery(),o.setState({messages:o.getIntroMessages(o.props.introMessages)})})),Ot(Bt(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)}})),Ot(Bt(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)})),Ot(Bt(o),"onDrilldownStart",(function(){o.state.isDrilldownRunning&&(o.keepLoading=!0),o.setState({isDrilldownRunning:!0,isInputDisabled:!0})})),Ot(Bt(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})))})),Ot(Bt(o),"getIsSuggestionResponse",(function(e){var t,n;return!(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||!n.items)})),Ot(Bt(o),"deleteMessage",(function(e){var t=[e],n=o.state.messages.findIndex((function(t){return e===t.id})),a=o.state.messages[n-1];a&&(a.isResponse||t.push(a.id));var r=o.state.messages.filter((function(e){return!t.includes(e.id)}));o.setState({messages:r})})),Ot(Bt(o),"getIntroMessages",(function(e){return e.map((function(e){return o.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),Ot(Bt(o),"addIntroMessage",(function(e){o.addIntroMessages([e])})),Ot(Bt(o),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&o.addMessages(o.getIntroMessages(e))})),Ot(Bt(o),"addMessage",(function(e){o.addMessages([e])})),Ot(Bt(o),"addMessages",(function(e){var t=[].concat(zt(o.state.messages),zt(e));t.length>o.props.maxMessages&&(t=t.slice(-o.props.maxMessages)),o.setState({messages:t})})),Ot(Bt(o),"addRequestMessage",(function(e){o.addMessage(o.createMessage({content:e,isResponse:!1}))})),Ot(Bt(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(Yt.UNAUTHENTICATED);else if("Parse error"===(null==a||null===(t=a.response)||void 0===t?void 0:t.error))n=o.createErrorMessage(Yt.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(xt(xt({},a),{},{appliedFilters:r}))}else n=o.createErrorMessage();n&&o.addMessage(n)})),Ot(Bt(o),"onInputSubmit",(function(e){o.addRequestMessage(e),o.setState({isInputDisabled:!0}),o.responseDelayTimeout=setTimeout((function(){o.setState({isQueryRunning:!0})}),600)})),Ot(Bt(o),"onResponse",(function(e,t){var n;o._isMounted&&(o.getIsSuggestionResponse(e)&&o.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),dt(null==e||null===(n=e.data)||void 0===n?void 0:n.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."))}):o.addResponseMessage({response:e,query:t}),clearTimeout(o.responseDelayTimeout),o.setState({isQueryRunning:!1,isInputDisabled:!1}),o.focusInput())})),Ot(Bt(o),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:b(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),Ot(Bt(o),"createMessage",(function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=o.id||b();return xt({id:a,type:null===(e=o.response)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.display_type},o)})),Ot(Bt(o),"createErrorMessage",(function(e){return o.createMessage({content:e||Yt.GENERAL_QUERY,isResponse:!0,type:"error"})})),Ot(Bt(o),"getAppliedFilters",(function(e){try{var t,n,o,a,r=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.persistent_locked_conditions,i=null==e||null===(o=e.data)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.session_locked_conditions;return Array.isArray(r)||(r=[]),Array.isArray(i)||(i=[]),[].concat(zt(r),zt(i))}catch(e){return[]}})),Ot(Bt(o),"isChataThinking",(function(){return o.state.isQueryRunning||o.state.isDrilldownRunning})),Ot(Bt(o),"render",(function(){var e,t;return o.props.shouldRender||(e="hidden",t="0"),f.createElement(Kt,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(Er,{ref:function(e){return o.messengerScrollComponent=e}},o.state.messages.map((function(e){var t;return f.createElement(dl,{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:null===(t=o.messengerScrollComponent)||void 0===t?void 0:t.ref,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,rebuildTooltips:o.props.rebuildTooltips,queryRequestData:e.queryRequestData,popoverParentElement:o.chatContentRef,isVisibleInDOM:o.props.shouldRender,dataPageSize:o.props.dataPageSize,shouldRender:o.props.shouldRender,source:o.props.source,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID})}))),o.isChataThinking()&&f.createElement("div",{className:"response-loading-container"},f.createElement(No,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(bn,{type:"react-autoql-bubbles-outlined"}),Zt.run),f.createElement(er,{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,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 Pt(n)}();Ot(pl,"propTypes",{authentication:Gt.isRequired,autoQLConfig:Jt.isRequired,dataFormatting:Xt.isRequired,clearOnClose:y.bool.isRequired,enableVoiceRecord:y.bool.isRequired,maxMessages:y.number.isRequired,introMessage:y.string.isRequired,inputPlaceholder:y.string.isRequired,enableDynamicCharting:y.bool.isRequired,autoChartAggregations:y.bool.isRequired,enableFilterLocking:y.bool.isRequired,onErrorCallback:y.func.isRequired,onSuccessAlert:y.func.isRequired,onRTValueLabelClick:y.func,disableMaxMessageHeight:y.bool,enableAjaxTableData:y.bool,dataPageSize:y.number,sessionId:y.string,isResizing:y.bool,source:y.arrayOf(y.string),shouldRender:y.bool}),Ot(pl,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isResizing:!1,dataPageSize:void 0,source:[],onRTValueLabelClick:void 0,shouldRender:!0});var ml=["scrollbarProps","className"],fl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"render",(function(){var e=o.props,t=e.scrollbarProps,n=void 0===t?{}:t,a=e.className,r=Ft(e,ml);return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-infinite-scroll-container"},f.createElement(Er,Mt({},n,{ref:o.scrollComponent}),f.createElement(Te,Mt({},r,{className:"react-autoql-infinite-scroll ".concat(a||""),getScrollParent:function(){var e,t;return null===(e=o.scrollComponent)||void 0===e||null===(t=e.current)||void 0===t?void 0:t.getView()}}),o.props.children))))})),o.COMPONENT_KEY=b(),o.scrollComponent=f.createRef(),o}return Pt(n)}(),gl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.props.shouldRender&&o.focusInput()})),Ot(Bt(o),"componentDidUpdate",(function(e){o.props.shouldRender&&!e.shouldRender&&o.focusInput()})),Ot(Bt(o),"componentWillUnmount",(function(){clearTimeout(o.animateTextDelay),clearTimeout(o.animateTextTimeout)})),Ot(Bt(o),"focusInput",(function(){var e;null===(e=o.inputRef)||void 0===e||e.focus()})),Ot(Bt(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),po(xt(xt({},o.props.authentication),{},{keywords:a,pageSize:o.pageSize,pageNumber:e,skipQueryValidation:t})).then((function(e){var t,n,r={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&n.replacements)r.validationResponse=e;else{var i,l,s,c,u,d,p,m,f,g,v;((null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.pagination)||void 0===s?void 0:s.current_page)>=(null==e||null===(c=e.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.pagination)||void 0===d?void 0:d.total_pages)||null==e||null===(p=e.data)||void 0===p||null===(m=p.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var h=(null==e||null===(g=e.data)||void 0===g||null===(v=g.data)||void 0===v?void 0:v.items)||[];if(o.state.queryList){var y=o.state.queryList.concat(h);r.queryList=y}else r.queryList=h;r.keywords=a}return o.setState(r),Promise.resolve()})).catch((function(e){return o.setState({loading:!1,initialLoading:!1}),console.error(e),Promise.reject()}))})),Ot(Bt(o),"onInputChange",(function(e){o.setState({inputValue:e.target.value})})),Ot(Bt(o),"onKeyPress",(function(e){"Enter"==e.key&&o.loadMore(1)})),Ot(Bt(o),"onValidationSuggestionClick",(function(e){var t=e.query;o.animateQITextAndSubmit(t,!0)})),Ot(Bt(o),"animateQITextAndSubmit",(function(e,t){return Ga({text:e,inputRef:o.inputRef,callback:function(){o.setState({inputValue:e},(function(){return o.loadMore(1,t)}))}})})),Ot(Bt(o),"clearExploreQueries",(function(){o.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){o.focusInput()}))})),Ot(Bt(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.")))})),Ot(Bt(o),"renderQueryList",(function(){var e;return o.state.initialLoading?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(No,null)):o.state.validationResponse?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(ui,{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(fl,{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(sr,{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()})),Ot(Bt(o),"render",(function(){var e,t;return o.props.shouldRender?f.createElement(Kt,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(bn,{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(bn,{type:"close",onClick:o.clearExploreQueries}))),f.createElement("div",{className:"query-tips-result-container"},o.renderQueryList())),!o.props.tooltipID&&f.createElement(Sn,{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 Pt(n)}();Ot(gl,"propTypes",{shouldRender:y.bool,executeQuery:y.func,inputPlaceholder:y.string}),Ot(gl,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var vl=wo(gl),hl=function(e){Lt(o,f.Component);var t=Qt(o);function o(e){var a;return kt(this,o),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.loadMore(1)})),Ot(Bt(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)}))})),Ot(Bt(a),"loadMore",(function(e){if(!a.state.loading&&(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;n!==a.state.keywords&&(t.queryList=void 0),a.setState(t),fo(xt(xt({},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,o;a.props.onSuggestionListResponse({response:e});var r={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(o=t.data)&&void 0!==o&&o.replacements)r.validationResponse=e;else{var i,l,s,c,u,d,p,m,f,g,v;((null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.pagination)||void 0===s?void 0:s.current_page)>=(null==e||null===(c=e.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.pagination)||void 0===d?void 0:d.total_pages)||null==e||null===(p=e.data)||void 0===p||null===(m=p.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var h=(null==e||null===(g=e.data)||void 0===g||null===(v=g.data)||void 0===v?void 0:v.items)||[];if(a.state.queryList){var y=a.state.queryList.concat(h);r.queryList=y}else r.queryList=h;r.keywords=n}a.setState(r)})).catch((function(e){a.props.onSuggestionListResponse({error:e}),a.setState({loading:!1,initialLoading:!1}),console.error(e)}))}})),Ot(Bt(a),"onValidationSuggestionClick",(function(e){a.props.onValidationSuggestionClick(e)})),Ot(Bt(a),"clearQueryList",(function(){a.setState({queryList:void 0,validationResponse:void 0})})),Ot(Bt(a),"render",(function(){var e;return a.state.initialLoading?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(No,null)):a.state.validationResponse?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(ui,{response:a.state.validationResponse,onSuggestionClick:a.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"})):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(Pe,{autoHeight:!0,autoHeightMin:0,autoHeightMax:800,className:"query-suggestion-list-scroll-component",renderView:function(e){return f.createElement("div",Mt({},e,{ref:function(e){return a.scrollbarRef=e},className:"data-preview-scroll-container"}))}},f.createElement(Te,{pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(sr,{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(bn,{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 Pt(o)}();Ot(hl,"propTypes",{searchText:y.string,subject:y.shape({}),valueLabel:y.shape({}),skipQueryValidation:y.bool,onSuggestionListResponse:y.func,executeQuery:y.func}),Ot(hl,"defaultProps",{searchText:"",subject:void 0,valueLabel:void 0,skipQueryValidation:!1,onSuggestionListResponse:function(){},executeQuery:function(){}});var yl=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===Xn?n="book":t.type===Jn&&(n="bookmark"),f.createElement(Kt,null,f.createElement("span",null,f.createElement(bn,{className:"data-explorer-topic-icon",type:n}),t.display_name))},bl=function(t){Lt(a,f.Component);var o=Qt(a);function a(t){var r;return kt(this,a),Ot(Bt(r=o.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.fetchAllSubjects()})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.inputAnimationTimeout)})),Ot(Bt(r),"fetchAllSubjects",(function(){(function(t){var n=t.domain,o=t.apiKey,a=t.token;if(!a||!n||!o)return Promise.reject(new Error("Unauthenticated"));var r="".concat(n,"/autoql/api/v1/query/subjects?key=").concat(o),i={headers:{Authorization:"Bearer ".concat(a)}};return m.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(xt({},r.props.authentication)).then((function(e){var t,n,o=(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.subjects)||[],a=[];o.length&&(a=o.map((function(e){return xt(xt({},e),{},{type:Xn})})).filter((function(e){return!r.isAggSeed(e)})).sort((function(e,t){return e.display_name.localeCompare(t.display_name)}))),r._isMounted&&r.setState({allSubjects:a})})).catch((function(e){return console.error(e)}))})),Ot(Bt(r),"blurInput",(function(){var e,t;null===(e=r.autoSuggest)||void 0===e||null===(t=e.input)||void 0===t||t.blur()})),Ot(Bt(r),"getNewRecentSuggestions",(function(e){var t=C(r.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})),Ot(Bt(r),"selectSubject",(function(e){r._isMounted&&(r.userSelectedValue=null,r.setState({inputValue:e.display_name,recentSuggestions:r.getNewRecentSuggestions(e)}),r.props.onSelection(e))})),Ot(Bt(r),"submitRawText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=r.state.allSubjects.find((function(t){return t.display_name.toLowerCase().trim()===e.toLowerCase().trim()}));n?r.selectSubject(n):n={type:"text",display_name:e},r.props.onSelection(n,t),r.setState({recentSuggestions:r.getNewRecentSuggestions(n),inputValue:n.display_name})})),Ot(Bt(r),"animateTextAndSubmit",(function(e){Ga({text:e,inputRef:r.inputRef,callback:function(){return r.submitRawText(e,!0)}})})),Ot(Bt(r),"onInputChange",(function(e){if(r._isMounted){var t,n;if(r.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?(r.userSelectedValue=null,r.userTypedValue=e.target.value,r.isDirty=!0,r.setState({inputValue:e.target.value})):r.selectSubject(r.userSelectedValue)}})),Ot(Bt(r),"onInputFocus",(function(){r._isMounted&&r.setState({inputFocused:!0})})),Ot(Bt(r),"onInputBlur",(function(){r._isMounted&&r.setState({inputFocused:!1})})),Ot(Bt(r),"onKeyPress",(function(e){"Enter"==e.key&&(r.userSelectedValue?r.selectSubject(r.userSelectedValue):r.state.inputValue&&r.submitRawText(r.state.inputValue),r.blurInput())})),Ot(Bt(r),"clearInput",(function(){r._isMounted&&(r.setState({inputValue:""}),r.userTypedValue=null,r.userSelectedValue=null,r.props.onClearInputClick())})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){r.userSelectedValue=e,null!=e&&e.display_name&&r._isMounted&&r.setState({inputValue:e.display_name})})),Ot(Bt(r),"cancelCurrentRequest",(function(){var e;null===(e=r.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(r),"requestSuggestions",(function(t){var n;r.setState({loadingAutocomplete:!0,loadingAutocompleteText:t}),clearTimeout(r.autoCompleteTimer),r.cancelCurrentRequest(),r.axiosSource=null===(n=m.CancelToken)||void 0===n?void 0:n.source(),r.autoCompleteTimer=setTimeout((function(){var n;(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,o=t.domain,a=t.token,r=t.apiKey,i=t.cancelToken;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!o||!r||!a)return Promise.reject(new Error("Unauthenticated"));var l="".concat(o,"/autoql/api/v1/query/vlsubjects?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(a)},cancelToken:i};return m.get(l,s).then((function(e){var t,n,o,a,r,i,l,s,c=[];null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(o=n.suggestions)&&void 0!==o&&null!==(a=o.value_labels)&&void 0!==a&&a.length&&(c=e.data.data.suggestions.value_labels.slice(0,10).map((function(e){return xt(xt({},e),{},{display_name:"".concat(e.keyword," (").concat(e.show_message,")"),type:Jn})})));var u=[];null!=e&&null!==(r=e.data)&&void 0!==r&&null!==(i=r.data)&&void 0!==i&&null!==(l=i.suggestions)&&void 0!==l&&null!==(s=l.subjects)&&void 0!==s&&s.length&&(u=e.data.data.suggestions.subjects.map((function(e){return xt(xt({},e),{},{type:Xn})})));var d=[].concat(zt(u),zt(c));return Promise.resolve(d)})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response.data"))}))})(xt(xt({suggestion:t},r.props.authentication),{},{cancelToken:null===(n=r.axiosSource)||void 0===n?void 0:n.token})).then((function(e){r.setState({suggestions:e,loadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&(console.error(e),r.setState({suggestions:[],loadingAutocomplete:!1}))}))}),100)})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&r.isDirty&&r._isMounted&&r.requestSuggestions(t)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r._isMounted&&r.setState({suggestions:[]})})),Ot(Bt(r),"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)})),Ot(Bt(r),"getSectionSuggestions",(function(e){return e.suggestions})),Ot(Bt(r),"hasNoSuggestions",(function(){var e;return!(null!==(e=r.state.suggestions)&&void 0!==e&&e.length||r.state.loadingAutocomplete||!r.userTypedValue)})),Ot(Bt(r),"getSuggestions",(function(){var e,t,n,o=[],a=!(null===(e=r.state.recentSuggestions)||void 0===e||!e.length),i=!r.userTypedValue,l=!r.state.loadingAutocomplete,s=!(null===(t=r.state.suggestions)||void 0===t||!t.length),c=!(null!==(n=r.state.suggestions)&&void 0!==n&&n.length)&&l;return a&&o.push({title:"Recent",suggestions:r.state.recentSuggestions}),i?o.push({title:"All Topics",suggestions:r.state.allSubjects}):s?o.push({title:'Related to "'.concat(r.state.loadingAutocompleteText,'"'),suggestions:r.state.suggestions}):c&&o.push({title:'Related to "'.concat(r.state.loadingAutocompleteText,'"'),suggestions:[{name:""}],emptyState:!0}),o})),Ot(Bt(r),"renderSuggestion",(function(e){return f.createElement(yl,{topic:e})})),Ot(Bt(r),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children,a=250,i=(null===(t=r.props.dataExplorerRef)||void 0===t?void 0:t.clientHeight)-200;return!isNaN(i)&&i>250&&(a=i),f.createElement("div",n,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},f.createElement(Er,{autoHeight:!0,autoHeightMin:0,autoHeightMax:a,autoHide:!1},o)))})),Ot(Bt(r),"renderInputIcon",(function(){return f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(bn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}}))})),Ot(Bt(r),"renderClearInputBtn",(function(){var e;return f.createElement("div",{className:"chat-bar-clear-btn ".concat(r.state.inputValue?"visible":""),"data-for":null!==(e=r.props.tooltipID)&&void 0!==e?e:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(bn,{type:"close",onClick:r.clearInput}))})),Ot(Bt(r),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-chatbar-input-container data-explorer ".concat(r.hasNoSuggestions()?"no-suggestions":""),"data-test":"data-explorer-autocomplete"},f.createElement(mt,{id:"data-explorer-autosuggest-".concat(r.componentKey),className:"react-autoql-data-explorer-autosuggest",onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,renderSuggestionsContainer:r.renderSuggestionsContainer,suggestions:r.getSuggestions(),multiSection:!0,renderSectionTitle:r.renderSectionTitle,getSectionSuggestions:r.getSectionSuggestions,shouldRenderSuggestions:function(){return!0},ref:function(e){return r.autoSuggest=e},renderSuggestion:r.renderSuggestion,focusInputOnSuggestionClick:!1,inputProps:{ref:function(e){return r.inputRef=e},className:"react-autoql-chatbar-input",placeholder:r.props.inputPlaceholder,"data-test":"data-explorer-input-component",value:r.state.inputValue,onChange:r.onInputChange,onKeyPress:r.onKeyPress,onFocus:r.onInputFocus,onBlur:r.onInputBlur}}),r.renderInputIcon(),r.renderClearInputBtn()))})),r.componentKey=b(),r.userTypedValue=null,r.userSelectedValue=null,r.isDirty=!1,r.state={inputValue:"",loadingAutocomplete:!1,recentSuggestions:[],suggestions:[],allSubjects:[]},r}return Pt(a,[{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")}}]),a}();Ot(bl,"propTypes",{authentication:Gt,inputPlaceholder:y.string,onClearInputClick:y.func,onSelection:y.func}),Ot(bl,"defaultProps",{authentication:{},inputPlaceholder:"Search terms or topics",onClearInputClick:function(){},onSelection:function(){}});var Cl,El=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.initialCollapseTimer=setTimeout((function(){o.saveCurrentCardHeight()}),400)})),Ot(Bt(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())}})),Ot(Bt(o),"componentWillUnmount",(function(){clearTimeout(o.collapseTimer),clearTimeout(o.initialCollapseTimer)})),Ot(Bt(o),"getIsCSSCollapsed",(function(){var e;if(null!==(e=o.contentRef)&&void 0!==e&&e.style)return"hidden"===o.contentRef.style.visibility})),Ot(Bt(o),"getIsCollapsed",(function(){return"boolean"==typeof o.props.isCollapsed?o.props.isCollapsed:o.state.isCollapsed})),Ot(Bt(o),"handleClick",(function(){o.setIsCollapsedCSS(!o.getIsCSSCollapsed())})),Ot(Bt(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"}})),Ot(Bt(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})}})),Ot(Bt(o),"render",(function(){return f.createElement(Kt,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(bn,{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=b(),o.state={isCollapsed:e.defaultCollapsed},o}return Pt(n)}();Ot(El,"propTypes",{title:y.oneOfType([y.string,y.element]),subtitle:y.oneOfType([y.string,y.element]),defaultCollapsed:y.bool,isCollapsed:y.bool,onIsCollapsedChange:y.func}),Ot(El,"defaultProps",{title:null,subtitle:null,defaultCollapsed:!1,isCollapsed:void 0,onIsCollapsedChange:function(){}});var Sl=function(e){Lt(o,f.Component);var t=Qt(o);function o(e){var a;return kt(this,o),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0,a.props.subject&&a.getDataPreview()})),Ot(Bt(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)&&a.props.rebuildTooltips()})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1})),Ot(Bt(a),"cancelCurrentRequest",(function(){var e;null===(e=a.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(a),"getDataPreview",(function(){var e,t;a.cancelCurrentRequest(),a.axiosSource=null===(e=m.CancelToken)||void 0===e?void 0:e.source(),a.setState({loading:!0,error:void 0,dataPreview:void 0}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.subject,n=e.domain,o=e.apiKey,a=e.token,r=e.source,i=void 0===r?"data_explorer.user":r,l=e.numRows,s=void 0===l?10:l,c=e.cancelToken;if(!t)return Promise.reject(new Error("No subject supplied for data preview"));if(!a||!n||!o)return Promise.reject(new Error("Unauthenticated"));var u="".concat(n,"/autoql/api/v1/query/preview?key=").concat(o),d={headers:{Authorization:"Bearer ".concat(a)},cancelToken:c},p={subject:t,page_size:s,source:i,date_format:"ISO8601"};return m.post(u,p,d).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}(xt(xt({},a.props.authentication),{},{subject:null===(t=a.props.subject)||void 0===t?void 0:t.name,numRows:a.DATA_PREVIEW_ROWS,cancelToken:a.axiosSource.token})).then((function(e){a.setState({dataPreview:e,loading:!1})})).catch((function(e){var t;(null==e?void 0:e.message)!==Wt.CANCELLED&&(console.error(e),a.setState({loading:!1,error:null==e||null===(t=e.response)||void 0===t?void 0:t.data}))}))})),Ot(Bt(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","data-tip":JSON.stringify(e)},null==e?void 0:e.display_name)})),Ot(Bt(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"}},Sa({element:t,column:n,config:o}))})),Ot(Bt(a),"renderDataPreviewGrid",(function(){var e,t,n,o,r,i,l,s=null===(e=a.state.dataPreview)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.rows,c=null===(o=a.state.dataPreview)||void 0===o||null===(r=o.data)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.columns;if(!(a.state.error||c&&s))return null;var u=Wn(a.props.dataFormatting);return null===(l=a.props.dataExplorerRef)||void 0===l||l.clientHeight,f.createElement("div",{className:"data-preview"},f.createElement(Er,{autoHide:!1,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,c.map((function(e,t){return f.createElement("th",{key:"col-header-".concat(t)},a.formatColumnHeader(e))})))),f.createElement("tbody",null,s.map((function(e,t){return f.createElement("tr",{key:"row-".concat(t),className:"data-preview-row"},e.map((function(e,t){var n=c[t];return f.createElement("td",{key:"cell-".concat(t)},a.formatCell({cell:e,column:n,config:u}))})))}))))))})),Ot(Bt(a),"renderLoadingContainer",(function(){return f.createElement("div",{className:"data-explorer-card-placeholder data-preview"},f.createElement(No,null))})),Ot(Bt(a),"renderDataPreviewTitle",(function(){var e;return f.createElement("div",null,f.createElement(bn,{style:{fontSize:"20px"},type:"table"}),' Data Preview - "',null===(e=a.props.subject)||void 0===e?void 0:e.query,'"')})),Ot(Bt(a),"render",(function(){return a.props.shouldRender?f.createElement(Kt,null,f.createElement(El,{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 Pt(o)}();Ot(Sl,"propTypes",{dataFormatting:Xt,authentication:Gt,shouldRender:y.bool,subject:y.shape({}),rebuildTooltips:y.func,isCollapsed:y.bool,onIsCollapsedChange:y.func,defaultCollapsed:y.bool}),Ot(Sl,"defaultProps",(Ot(Cl={dataFormatting:jn,authentication:{},shouldRender:!0,subject:null,rebuildTooltips:void 0,isCollapsed:void 0,onIsCollapsedChange:function(){}},"rebuildTooltips",(function(){})),Ot(Cl,"defaultCollapsed",!1),Cl));var Tl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;return kt(this,n),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1})),Ot(Bt(o),"onInputSelection",(function(e,t){var n;(null==e?void 0:e.type)===Xn?o.setState({selectedSubject:e,selectedKeywords:null,selectedVL:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):(null==e?void 0:e.type)===Jn?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()})),Ot(Bt(o),"renderIntroMessage",(function(){return f.createElement("div",{className:"data-explorer-intro-message"},f.createElement("h2",null,"Welcome to ",f.createElement(bn,{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(bn,{type:"table"})," Preview available data in a snapshot"),f.createElement("p",null,f.createElement(bn,{type:"abacus"})," Explore data structure and column types"),f.createElement("p",null,f.createElement(bn,{type:"react-autoql-bubbles-outlined"})," View a variety of query suggestions")))))})),Ot(Bt(o),"animateDETextAndSubmit",(function(e){var t;null!==(t=o.inputRef)&&void 0!==t&&t._isMounted&&o.inputRef.animateTextAndSubmit(e)})),Ot(Bt(o),"onValidationSuggestionClick",(function(e){var t=e.query,n=e.userSelection;o.querySuggestionsKey=b(),o.animateDETextAndSubmit(t),o.setState({userSelection:n})})),Ot(Bt(o),"renderDataPreview",(function(){return o.state.selectedSubject&&o.state.activeTopicType===Xn?f.createElement("div",{className:"data-explorer-section data-preview-section"},f.createElement(Sl,{authentication:o.props.authentication,dataFormatting:o.props.dataFormatting,subject:o.state.selectedSubject,shouldRender:o.props.shouldRender,rebuildTooltips:o.props.rebuildTooltips,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})),Ot(Bt(o),"renderVLSubjectList",(function(){return o.state.selectedVL&&o.activeTopicType===Jn?f.createElement("div",null,f.createElement("h2",null,"List of subjects for VL"),f.createElement("p",null,"list of subjects goes here")):null})),Ot(Bt(o),"renderQuerySuggestionCardTitle",(function(e){return f.createElement("div",null,f.createElement(bn,{style:{fontSize:"20px"},type:"react-autoql-bubbles-outlined"}),' Query Suggestions for "',null==e?void 0:e.display_name,'"')})),Ot(Bt(o),"renderQuerySuggestions",(function(){var e,t,n=o.getSelectedTopic();if(!n)return null;var a=!(!o.state.selectedSubject||o.state.activeTopicType!==Xn);return f.createElement("div",{className:"data-explorer-section query-suggestions"},f.createElement(El,{title:o.renderQuerySuggestionCardTitle(n),defaultCollapsed:o.props.isSmallScreen?a:void 0,isCollapsed:o.props.isSmallScreen?o.state.isQuerySuggestionCollapsed:void 0,onIsCollapsedChange:function(e){o.setState({isQuerySuggestionCollapsed:e,isDataPreviewCollapsed:!e||o.state.isDataPreviewCollapsed})}},f.createElement("div",{className:"data-explorer-query-suggestion-list"},f.createElement(hl,{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(){return o.setState({querySuggestionContentKey:b(),skipQueryValidation:!1})}}))))})),Ot(Bt(o),"getSelectedTopic",(function(){var e=o.state.activeTopicType;return e===Xn?o.state.selectedSubject:e===Jn?o.state.selectedVL:"text"===e?o.state.selectedKeywords:null})),Ot(Bt(o),"clearContent",(function(){o.setState({activeTopicType:null,selectedSubject:null,selectedVL:null,selectedKeywords:null})})),Ot(Bt(o),"renderDataExplorerContent",(function(){var e;return o.getSelectedTopic()?f.createElement("div",{className:"data-explorer-result-container"},f.createElement(Er,{autoHide:!1},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()})),Ot(Bt(o),"formatColumnType",(function(e){switch(e){case"DATE":case"DATE_STRING":return f.createElement("span",null,f.createElement(bn,{type:"calendar"})," Date");case"STRING":return f.createElement("span",null,f.createElement(bn,{type:"note"})," Description");case"DOLLAR_AMT":return f.createElement("span",null,f.createElement(bn,{type:"money"})," Currency");case"QUANTITY":return f.createElement("span",null,f.createElement(bn,{type:"abacus"})," Quantity")}})),Ot(Bt(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(bn,{type:"react-autoql-bubbles-outlined"})," ",e)})))})),Ot(Bt(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))})),Ot(Bt(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(Kt,null,f.createElement(bl,{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(Sn,{className:"data-preview-tooltip",id:"data-preview-tooltip",place:"right",delayHide:200,delayUpdate:200,effect:"solid",getContent:o.renderHeaderTooltipContent,clickable:!0})))})),o.querySuggestionsKey=b(),o.state={activeTopicType:null,selectedSubject:null,selectedVL:null,isQuerySuggestionSectionVisible:!0,isQuerySuggestionCollapsed:!0,isDataPreviewCollapsed:!1},o}return Pt(n)}();Ot(Tl,"propTypes",{authentication:Gt,dataFormatting:Xt,shouldRender:y.bool,inputPlaceholder:y.string,introMessage:y.oneOfType([y.string,y.element]),rebuildTooltips:y.func,executeQuery:y.func,isSmallScreen:y.bool}),Ot(Tl,"defaultProps",{authentication:{},dataFormatting:jn,shouldRender:!0,inputPlaceholder:void 0,introMessage:void 0,rebuildTooltips:void 0,executeQuery:function(){},isSmallScreen:!1});var Dl=function(t){Lt(a,f.Component);var o=Qt(a);function a(t){var r;return kt(this,a),Ot(Bt(r=o.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.state.filters&&r.props.onChange(r.state.filters),r.props.isOpen&&r.props.insertedFilter&&r.insertFilter(r.props.insertedFilter)})),Ot(Bt(r),"componentDidUpdate",(function(e,t){r.props.initialFilters&&!e.initialFilters&&r.setState({filters:r.props.initialFilters}),n(r.state.filters,t.filters)||(r.props.onChange(r.state.filters),r.rebuildTooltips()),!r.props.isOpen&&e.isOpen&&r.setState({inputValue:""}),(r.props.isOpen&&!e.isOpen&&r.props.insertedFilter||r.props.insertedFilter&&!e.insertedFilter)&&r.insertFilter(r.props.insertedFilter)})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.focusInputTimeout),clearTimeout(r.highlightFilterEndTimeout),clearTimeout(r.highlightFilterStartTimeout),clearTimeout(r.savingIndicatorTimeout),clearTimeout(r.autocompleteTimer)})),Ot(Bt(r),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;r.props.isOpen&&(r.props.rebuildTooltips?r.props.rebuildTooltips(e):(clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){Cn()}),e)))})),Ot(Bt(r),"showSavingIndicator",(function(){r.savingIndicatorTimeout&&clearTimeout(r.savingIndicatorTimeout),r.setState({isSaving:!0}),r.savingIndicatorTimeout=setTimeout((function(){r.setState({isSaving:!1})}),1500)})),Ot(Bt(r),"animateInputTextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length)for(var t=500/e.length,n=function(n){setTimeout((function(){r._isMounted&&(r.setState({inputValue:e.slice(0,n+1)}),n===e.length-1&&(r.focusInputTimeout=setTimeout((function(){var e;r.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=r.inputElement)||void 0===e||e.focus()}),300)))}),n*t)},o=0;o<e.length;o++)n(o)})),Ot(Bt(r),"insertFilter",(function(e){var t=r.findFilter({filterText:e});e&&t?r.handleHighlightFilterRow(r.getKey(t)):r.animateInputTextAndSubmit(e)})),Ot(Bt(r),"getAllFilters",(function(){return r.state.filters})),Ot(Bt(r),"getPersistedFilters",(function(){return C(r.state.filters.filter((function(e){return!e.isSession})))})),Ot(Bt(r),"findFilter",(function(e){var t=e.filterText,n=e.value,o=e.key,a=r.state.filters;return n&&o?a.find((function(e){return e.key===o&&e.value===n})):t?a.find((function(e){return e.value===t})):void 0})),Ot(Bt(r),"getTimeLeft",(function(e){return e?Math.ceil((e._idleStart+e._idleTimeout-Date.now())/1e3):0})),Ot(Bt(r),"fetchSuggestions",(function(e){var t,n=e.value;r.axiosSource&&r.axiosSource.cancel(Wt.CANCELLED),r.axiosSource=null===(t=m.CancelToken)||void 0===t?void 0:t.source(),so(xt(xt({},Yn(r.props.authentication)),{},{suggestion:n,cancelToken:r.axiosSource.token})).then((function(e){var t,n,o=null==e||null===(t=e.data)||void 0===t?void 0:t.data,a=[];r.autoCompleteArray=[],n=o.matches;for(var i=0;i<n.length;i++)a.push(n[i]);a.sort((function(e,t){var n,o;return(null===(n=e.keyword)||void 0===n?void 0:n.toUpperCase())<(null===(o=t.keyword)||void 0===o?void 0:o.toUpperCase())?-1:e.keyword>t.keyword?1:0}));for(var l=0;l<a.length;l++){var s={name:a[l]};r.autoCompleteArray.push(s)}r.setState({suggestions:r.autoCompleteArray,isLoadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&console.error(e),r.setState({isLoadingAutocomplete:!1})}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.setState({isLoadingAutocomplete:!0}),r.axiosSource?(clearTimeout(r.autocompleteTimer),r.autocompleteStart=Date.now(),r.autocompleteTimer=setTimeout((function(){r.fetchSuggestions({value:t})}),r.autocompleteDelay)):r.fetchSuggestions({value:t})})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"createNewFilterFromSuggestion",(function(e){var t="include",n=r.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,show_message:e.show_message,key:e.canonical,filter_type:t}})),Ot(Bt(r),"setFilterTypes",(function(e,t){var n=Yn(r.props.authentication),o=e.filter((function(e){return!e.isSession}));return null!=o&&o.length?(r.showSavingIndicator(),uo(xt(xt({},n),{},{filters:o})).then((function(e){var t,n,o=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data,a=r.state.filters.map((function(e){var t=o.find((function(t){return r.getKey(e)===r.getKey(t)}));return t||e}));return r.setState({filters:a}),Promise.resolve(e)})).catch((function(e){return console.error(e),r.setState({filters:t,isSaving:!1}),ft.error("Something went wrong. Please try again."),Promise.reject()}))):Promise.resolve()})),Ot(Bt(r),"setFilter",(function(e){if(null!=e&&e.value){var t=Yn(r.props.authentication);return r.showSavingIndicator(),uo(xt(xt({},t),{},{filters:[e]})).then((function(t){var n,o,a=null==t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.data;if(null==a||!a.length)throw new Error("No filters in the api response");var i=a.find((function(t){return r.getKey(t)===r.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(r.findFilter(e)){var l=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(i)?i:e}));r.setState({filters:l})}else r.setState({filters:[].concat(zt(r.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),ft.error("Something went wrong. Please try again."),Promise.reject()}))}})),Ot(Bt(r),"unsetFilter",(function(t){try{return r.showSavingIndicator(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,o=t.token,a=t.domain,r=t.filter;if(!a||!n||!o)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/filter-locking/").concat(r.id,"?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(o)}};return m.delete(i,l,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},Yn(r.props.authentication)),{},{filter:t}))}catch(e){return console.error(e),ft.error("Something went wrong. Please try again."),Promise.reject(e)}})),Ot(Bt(r),"getSuggestionValue",(function(e){var t=e.name;return r.createNewFilterFromSuggestion(t)})),Ot(Bt(r),"handlePersistToggle",function(){var e=At(Rt().mark((function e(t){var n,o,a;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,o=xt(xt({},t),{},{isSession:!t.isSession,id:void 0}),a=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(t)?o:e})),r.setState({filters:a}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,r.setFilter(o);case 8:e.next=12;break;case 10:return e.next=12,r.unsetFilter(t);case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),r.setState({filters:n});case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(r),"handleExcludeToggle",(function(e,t){var n,o,a;if(t){var i=null===(n=r.state.filters)||void 0===n||null===(o=n.find((function(t){return t.show_message===e})))||void 0===o||null===(a=o.filter_type)||void 0===a?void 0:a.toUpperCase();if(t!==i)try{var l=r.state.filters.map((function(n){return n.show_message===e?xt(xt({},n),{},{filter_type:t.toLowerCase()}):n})),s=l.filter((function(t){return t.show_message===e}));r.setFilterTypes(s,C(r.state.filters)),r.setState({filters:l})}catch(e){console.error(e)}}})),Ot(Bt(r),"removeFilter",function(){var e=At(Rt().mark((function e(t){var n,o;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,o=r.state.filters.filter((function(e){return r.getKey(e)!==r.getKey(t)})),r.setState({filters:o}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,r.unsetFilter(t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),r.setState({filters:n});case 13:En();case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(r),"onInputChange",(function(e,t){var n,o=t.newValue,a=t.method;"up"!==a&&"down"!==a&&("enter"!==a&&"click"!==a||(r.findFilter(o)?r.handleHighlightFilterRow(r.getKey(o)):r.setFilter(o)),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&r.setState({inputValue:e.target.value}))})),Ot(Bt(r),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),Ot(Bt(r),"renderSavingIndicator",(function(){return r.state.isSaving?f.createElement("div",{className:"filter-locking-saving-indicator","data-test":"filter-locking-saving-indicator"},"Saving..."):null})),Ot(Bt(r),"renderTitle",(function(){return f.createElement("div",{className:"react-autoql-filter-locking-title"},f.createElement("h3",null,Zt.filterLockingTitle," ",f.createElement(bn,{type:"info","data-place":"right","data-for":"filter-locking-tooltip","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."})))})),Ot(Bt(r),"renderHeader",(function(){return f.createElement("div",{className:"filter-lock-menu-header"},r.renderTitle(),r.renderCloseBtn())})),Ot(Bt(r),"renderCloseBtn",(function(){return f.createElement("div",null,r.renderSavingIndicator(),f.createElement(gr,{onClick:r.props.onClose,className:"filter-locking-close-btn","data-tip":Zt.closeFilterLocking,"data-for":"filter-locking-tooltip",tooltipID:r.props.tooltipID,size:"small"},f.createElement(bn,{type:"close"})))})),Ot(Bt(r),"renderSuggestion",(function(e){var t=e.name;return t.keyword?f.createElement("ul",{className:"filter-lock-suggestion-item","data-for":"filter-locking-tooltip","data-delay-show":800,"data-tip":"".concat(t.keyword," <em>(").concat(t.show_message,")</em>")},f.createElement("span",null,t.keyword," ",f.createElement("em",null,"(",t.show_message,")"))):null})),Ot(Bt(r),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,o=e.children;e.query;var a=150,i=null===(t=r.filterListContainerRef)||void 0===t?void 0:t.clientHeight;return isNaN(i)||(a=i-20),f.createElement("div",n,f.createElement("div",{className:"react-autoql-filter-suggestion-container"},f.createElement(Er,{autoHeight:!0,autoHeightMin:0,autoHeightMax:a,autoHide:!1},o)))})),Ot(Bt(r),"getSuggestions",(function(){var e,t,n=[],o=!r.state.isLoadingAutocomplete,a=!(null===(e=r.state.suggestions)||void 0===e||!e.length)&&o,i=!(null!==(t=r.state.suggestions)&&void 0!==t&&t.length)&&o;return a?n.push({title:'Related to "'.concat(r.state.inputValue,'"'),suggestions:r.state.suggestions}):i&&n.push({title:'Related to "'.concat(r.state.inputValue,'"'),suggestions:[{name:""}],emptyState:!0}),n})),Ot(Bt(r),"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)})),Ot(Bt(r),"renderVLInput",(function(){var e;return f.createElement(mt,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:r.getSuggestions(),renderSuggestion:r.renderSuggestion,getSuggestionValue:r.getSuggestionValue,onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,renderSuggestionsContainer:r.renderSuggestionsContainer,getSectionSuggestions:function(e){return e.suggestions},renderSectionTitle:r.renderSectionTitle,multiSection:!0,inputProps:(e={onChange:r.onInputChange,value:r.state.inputValue,disabled:r.props.isFetchingFilters||r.state.isFetchingFilters,placeholder:"Search & select a filter"},Ot(e,"data-test","react-autoql-filter-locking-input"),Ot(e,"className","react-autoql-filter-locking-input"),Ot(e,"id","react-autoql-filter-menu-input"),e)})})),Ot(Bt(r),"renderFilterListCategory",(function(e,t){return f.createElement("div",{key:e,className:"react-autoql-filter-list-item-container"},r.renderFilterListCategoryHeader(e,t),f.createElement("div",{className:"react-autoql-filter-list"},r.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return r.renderFilterListItem(e)}))))})),Ot(Bt(r),"renderFilterListCategoryHeader",(function(e,t){var n,o=null===(n=r.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":"filter-locking-tooltip","data-delay-show":800,"data-tip":e},e),f.createElement(Bi,{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:"filter-locking-tooltip",value:o,type:"button",onChange:function(t){return r.handleExcludeToggle(e,t)}})),0===t?f.createElement("div",{className:"persist-toggle-column"},f.createElement("h4",null,f.createElement("span",null,"Persist ")),f.createElement(bn,{type:"info","data-place":"left","data-for":"filter-locking-tooltip","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)})),Ot(Bt(r),"renderFilterListItem",(function(e){var t=r.getKey(e);return f.createElement("div",{key:t,"data-test":"react-autoql-filter-list-item",className:"react-autoql-filter-list-item ".concat(r.state.highlightedFilter===t?"react-autoql-highlight-row":"")},f.createElement("div",{className:"react-autoql-filter-list-item-filter"},e.value),f.createElement("div",{className:"react-autoql-filter-list-item-actions"},f.createElement(br,{className:"persist-toggle","data-test":"react-autoql-filter-lock-persist-toggle",type:"switch",checked:!e.isSession,onChange:function(){return r.handlePersistToggle(e)}}),f.createElement(bn,{className:"react-autoql-remove-filter-icon","data-test":"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return r.removeFilter(e)}})))})),Ot(Bt(r),"renderFilterList",(function(){var e;if(r.props.isFetchingFilters||r.state.isFetchingFilters)return f.createElement("div",{className:"react-autoql-filter-lock-list-loading-container"},f.createElement(No,null));if(null===(e=r.state.filters)||void 0===e||!e.length)return f.createElement("div",{className:"react-autoql-empty-filter-list"},f.createElement("i",null,Zt.noFiltersLocked));var t=zt(new Set(r.state.filters.map((function(e){return e.show_message}))));return f.createElement("div",{ref:function(e){return r.filterListContainerRef=e},className:"react-autoql-filter-list-container"},f.createElement(Er,{autoHide:!1},t.map((function(e,t){return r.renderFilterListCategory(e,t)}))))})),Ot(Bt(r),"render",(function(){return r.props.isOpen?f.createElement(Kt,null,f.createElement(gt,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:vt,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1}),f.createElement(Sn,{afterShow:function(e){return function(e,t){var n=t.reactTooltipRef.tooltipRef;if(n){var o=n.getBoundingClientRect(),a=o.left<0,r=o.right>window.innerWidth;a?(n.style.setProperty("left","10px"),n.style.setProperty("right","auto")):r&&(n.style.setProperty("left","auto"),n.style.setProperty("right","10px"))}}(0,Bt(r))},ref:function(e){return r.reactTooltipRef=e},className:"react-autoql-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0}),f.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},r.renderHeader(),r.renderVLInput(),r.renderFilterList())):null})),r.contentKey=b(),r.autoCompleteArray=[],r.autocompleteDelay=100,r.state={filters:r.props.initialFilters||[],suggestions:[],inputValue:""},r}return Pt(a,[{key:"handleHighlightFilterRow",value:function(e){var t=this;ft.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)}}]),a}();Ot(Dl,"propTypes",{authentication:Gt,isOpen:y.bool,onClose:y.func,onChange:y.func,insertedFilter:y.string,rebuildTooltips:y.func}),Ot(Dl,"defaultProps",{authentication:Un,insertedFilter:null,isOpen:!1,onClose:function(){},onChange:function(){}});var xl=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{insertedFilter:null}),Ot(Bt(e),"componentDidMount",(function(){e._isMounted=!0,e.initialize()})),Ot(Bt(e),"componentDidUpdate",(function(t){!e.props.isOpen&&t.isOpen&&e.setState({insertedFilter:null})})),Ot(Bt(e),"componentWillUnmount",(function(){e._isMounted=!1})),Ot(Bt(e),"initialize",(function(){e.setState({isFetchingFilters:!0}),co(Yn(e.props.authentication)).then((function(t){var n,o,a=(null==t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.data)||[];e.props.onChange(a),e._isMounted&&e.setState({initialFilters:a,isFetchingFilters:!1})})).catch((function(t){console.error(t),e._isMounted&&e.setState({isFetchingFilters:!1})}))})),Ot(Bt(e),"onChange",(function(t){e.props.onChange(t),e.setState({initialFilters:t})})),Ot(Bt(e),"insertFilter",(function(t){e.setState({insertedFilter:t})})),Ot(Bt(e),"renderContent",(function(t){var n=t.position,o=t.childRect,a=t.popoverRect;return f.createElement(we,{className:"filter-lock-menu-content-container",arrowClassName:"filter-lock-menu-popover-arrow",position:n,childRect:o,popoverRect:a,arrowSize:10},f.createElement(Dl,{authentication:e.props.authentication,isOpen:e.props.isOpen,onClose:e.props.onClose,onChange:e.onChange,rebuildTooltips:e.props.rebuildTooltips,containerRef:e.containerRef,insertedFilter:e.state.insertedFilter,initialFilters:e.state.initialFilters,isFetchingFilters:e.state.isFetchingFilters}))})),Ot(Bt(e),"render",(function(){return f.createElement(Re,{containerClassName:"filter-lock-menu",onClickOutside:e.props.onClose,positions:e.props.positions,isOpen:e.props.isOpen,align:e.props.align,ref:function(t){return e.containerRef=t},parentElement:e.props.parentElement,boundaryElement:e.props.boundaryElement,content:e.renderContent,boundaryInset:10},e.props.children||f.createElement("div",{style:{display:"none"}}))})),e}return Pt(n)}();Ot(xl,"propTypes",{authentication:Gt,isOpen:y.bool,position:y.string,align:y.string,onClose:y.func,onChange:y.func,rebuildTooltips:y.func}),Ot(xl,"defaultProps",{authentication:Un,isOpen:!1,position:"bottom",align:"center",onClose:function(){},onChange:function(){}});var Rl=wo(xl),wl=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(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(a.rebuildTooltips,1e3)})),Ot(Bt(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:b()}),a.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),De(n)||a.setState(xt({},n))}catch(e){console.error(e),a.setState({hasError:!0})}})),Ot(Bt(a),"onError",(function(){return a.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")})),Ot(Bt(a),"onSave",(function(){a.props.onSuccessAlert("Notification created!"),a.setState({isDataAlertModalVisible:!1})})),Ot(Bt(a),"onClose",(function(){a.setState({isDataAlertModalVisible:!1})})),Ot(Bt(a),"rebuildTooltips",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;a.state.isVisible&&(clearTimeout(a.rebuildTooltipsTimer),a.rebuildTooltipsTimer=setTimeout((function(){Cn()}),e))})),Ot(Bt(a),"refreshNotifications",(function(){var e;null===(e=a.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),Ot(Bt(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}})),Ot(Bt(a),"onWindowResize",(function(){a.state.isWindowResizing||a.setState({isWindowResizing:!0}),clearTimeout(a.windowResizeTimer),a.windowResizeTimer=setTimeout((function(){a.setState({isWindowResizing:!1})}),300)})),Ot(Bt(a),"openDataMessenger",(function(){var e=document.getElementById("".concat(a.COMPONENT_KEY,"-drawer-handle"));e&&e.click()})),Ot(Bt(a),"closeDataMessenger",(function(){a.dmRef.setState({open:!1}),a.setState({isVisible:!1})})),Ot(Bt(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))}))})),Ot(Bt(a),"openDataExplorer",(function(e){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))}))})),Ot(Bt(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})})),En()})),Ot(Bt(a),"getHandleProp",(function(){return void 0!==a.props.customHandle?a.props.customHandle:!!a.props.showHandle&&f.createElement("div",{id:"".concat(a.COMPONENT_KEY,"-drawer-handle"),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(bn,{type:"react-autoql-bubbles-outlined",size:26}))})),Ot(Bt(a),"getDrawerHeight",(function(){return"right"===a.state.placement||"left"===a.state.placement?null:a.state.height})),Ot(Bt(a),"getDrawerWidth",(function(){return"right"===a.state.placement||"left"===a.state.placement?a.state.width:null})),Ot(Bt(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})),Ot(Bt(a),"onDrawerChange",(function(e){e?a.setState({isVisible:!0}):a.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),Ot(Bt(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)})),Ot(Bt(a),"handleClearQueriesDropdown",(function(){a.clearQueriesDropdown&&("block"===a.clearQueriesDropdown.style.display?a.clearQueriesDropdown.style.display="none":a.clearQueriesDropdown.style.display="block")})),Ot(Bt(a),"onRTValueLabelClick",(function(e){a.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=a.filterLockRef)||void 0===t||t.insertFilter(e)}))})),Ot(Bt(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})})),Ot(Bt(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(bn,{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":Zt.exploreQueries,"data-for":a.TOOLTIP_ID},f.createElement(bn,{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":Zt.dataExplorer,"data-for":a.TOOLTIP_ID},f.createElement(bn,{type:"data-search",size:22})),a.props.enableNotificationsTab&&Gn(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(Pi,{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(bn,{type:"grad-cap",size:22})))))})),Ot(Bt(a),"renderRightHeaderContent",(function(){return f.createElement(f.Fragment,null,Gn(a.props.autoQLConfig).enableFilterLocking&&a.renderFilterLockPopover(),f.createElement(Re,{isOpen:a.state.isOptionsDropdownOpen,onClickOutside:function(){a.setState({isOptionsDropdownOpen:!1})},parentElement:a.messengerDrawerRef,boundaryElement:a.messengerDrawerRef,positions:["bottom","left","top","right"],content:f.createElement("div",null,f.createElement("div",{className:"clear-messages-confirm-popover"},f.createElement("div",{className:"react-autoql-menu-text",onClick:a.handleClearQueriesDropdown},f.createElement(bn,{type:"trash"}),f.createElement("span",{style:{marginLeft:5}},Zt.clearDataResponses)),f.createElement("div",{ref:function(e){return a.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},f.createElement(gr,{type:"default",size:"small",onClick:function(){return a.setState({isOptionsDropdownOpen:!1})},tooltipID:a.TOOLTIP_ID},"Cancel"),f.createElement(gr,{type:"primary",size:"small",onClick:function(){return a.clearMessages()},tooltipID:a.TOOLTIP_ID},"Clear"))))},f.createElement("button",{onClick:function(){return a.setState({isOptionsDropdownOpen:!a.state.isOptionsDropdownOpen})},className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===a.state.activePage||"dpr"===a.state.activePage?"visible":"hidden"),"data-tip":Zt.clearDataResponses,"data-for":a.TOOLTIP_ID},f.createElement(bn,{type:"trash"}))))})),Ot(Bt(a),"renderHeaderTitle",(function(){var e="";switch(a.state.activePage){case"data-messenger":e=a.props.title;break;case"explore-queries":e=Zt.exploreQueries;break;case"data-explorer":e=Zt.dataExplorer;break;case"notifications":e=Zt.notifications;break;case"dpr":e=Zt.education}return f.createElement("div",{className:"header-title"},e)})),Ot(Bt(a),"openFilterLockMenu",(function(){a.state.isFilterLockMenuOpen||a.setState({isFilterLockMenuOpen:!0})})),Ot(Bt(a),"closeFilterLockMenu",(function(){a.state.isFilterLockMenuOpen&&a.setState({isFilterLockMenuOpen:!1})})),Ot(Bt(a),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));a.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),Ot(Bt(a),"isOpen",(function(){var e,t;return!(null===(e=a.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open)})),Ot(Bt(a),"shouldRenderPage",(function(e){return a.state.activePage===e&&a.isOpen()})),Ot(Bt(a),"renderFilterLockPopover",(function(){return f.createElement(Rl,{ref:function(e){return a.filterLockRef=e},authentication:a.props.authentication,isOpen:a.state.isFilterLockMenuOpen,onChange:a.onFilterChange,onClose:a.closeFilterLockMenu,rebuildTooltips:a.rebuildTooltips,parentElement:a.messengerDrawerRef,boundaryElement:a.messengerDrawerRef,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":Zt.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(bn,{type:a.state.hasFilters?"lock":"unlock"}),a.state.hasFilters?f.createElement("div",{className:"react-autoql-filter-lock-icon-badge"}):null)))})),Ot(Bt(a),"renderHeaderContent",(function(){var e=a.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,o=a.state.width===t;return f.createElement(v,null,f.createElement("div",{className:"react-autoql-header-left-container"},f.createElement("button",{onClick:a.closeDataMessenger,className:"react-autoql-drawer-header-btn close","data-tip":Zt.closeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(bn,{type:"close"})),f.createElement("button",{onClick:function(){return a.toggleFullScreen(o,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":o?Zt.minimizeDataMessenger:Zt.maximizeDataMessenger,"data-for":a.TOOLTIP_ID},f.createElement(bn,{type:o?"minimize":"maximize"}))),f.createElement("div",{className:"react-autoql-header-center-container"},a.renderHeaderTitle()),f.createElement("div",{className:"react-autoql-header-right-container"},a.renderRightHeaderContent()))})),Ot(Bt(a),"renderBodyContent",(function(){return f.createElement(f.Fragment,null,a.renderDataMessengerContent(),a.renderExploreQueriesContent(),a.renderDataExplorerContent(),a.renderNotificationsContent(),a.renderDPRContent())})),Ot(Bt(a),"renderDataMessengerContent",(function(){var e=Gn(a.props.autoQLConfig).enableFilterLocking?a.onRTValueLabelClick:void 0;return f.createElement(Kt,null,f.createElement(pl,Mt({},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:["data_messenger"],rebuildTooltips:a.rebuildTooltips,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})))})),Ot(Bt(a),"renderDPRContent",(function(){var e,t;return a.props.enableDPRTab?f.createElement(Kt,null,f.createElement(pl,Mt({},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:["data_messenger"],rebuildTooltips:a.rebuildTooltips,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})),Ot(Bt(a),"renderDataExplorerContent",(function(){return a.props.enableDataExplorerTab?f.createElement(Kt,null,f.createElement(Tl,{ref:function(e){return a.dataExplorerRef=e},authentication:a.props.authentication,dataFormatting:a.props.dataFormatting,rebuildTooltips:a.rebuildTooltips,shouldRender:a.shouldRenderPage("data-explorer"),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:["data_explorer"]})}),500)}})):null})),Ot(Bt(a),"renderExploreQueriesContent",(function(){return a.props.enableExploreQueriesTab?f.createElement(Kt,null,f.createElement(vl,{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})),Ot(Bt(a),"onDataAlertModalOpen",(function(){a.closeDataMessenger(),a.shouldOpenDataMessengerFromDA=!0})),Ot(Bt(a),"onDataAlertModalClose",(function(){a.shouldOpenDataMessengerFromDA&&(a.shouldOpenDataMessengerFromDA=!1,a.openDataMessenger())})),Ot(Bt(a),"renderNotificationsContent",(function(){return a.props.enableNotificationsTab?f.createElement(Kt,null,f.createElement(Zi,{ref:function(e){return a.notificationListRef=e},authentication:a.props.authentication,onExpandCallback:a.props.onNotificationExpandCallback,onCollapseCallback:a.props.onNotificationCollapseCallback,activeNotificationData:a.props.activeNotificationData,onErrorCallback:a.props.onErrorCallback,onSuccessCallback:a.props.onSuccessCallback,onDataAlertModalOpen:a.onDataAlertModalOpen,onDataAlertModalClose:a.onDataAlertModalClose,showNotificationDetails:!1,shouldRender:a.isOpen()&&"notifications"===a.state.activePage})):null})),Ot(Bt(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})}})),Ot(Bt(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)})),Ot(Bt(a),"renderResizeHandle",(function(){var e=Bt(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})),Ot(Bt(a),"renderTooltips",(function(){return f.createElement(v,null,f.createElement(Sn,{className:"react-autoql-tooltip",id:a.TOOLTIP_ID,effect:"solid",delayShow:800,place:"top",html:!0}),f.createElement(Sn,{className:"react-autoql-chart-tooltip",id:a.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),Ot(Bt(a),"renderDataAlertModal",(function(){return f.createElement(Gi,{authentication:a.props.authentication,isVisible:a.state.isDataAlertModalVisible,onClose:a.onClose,onSave:a.onSave,onErrorCallback:a.onError,initialQuery:a.state.activeQuery,tooltipID:a.TOOLTIP_ID})})),Ot(Bt(a),"render",(function(){return a.state.hasError?null:f.createElement(Kt,null,void((navigator.language||navigator.userLanguage).includes("sp")?Zt.setLanguage("sp"):Zt.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"),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&&a.renderResizeHandle(),a.renderTabs(),f.createElement("div",{ref:function(e){return a.messengerDrawerRef=e},className:"react-autoql-drawer-content-container"},f.createElement("div",{className:"chat-header-container"},a.renderHeaderContent()),a.renderBodyContent())),a.renderDataAlertModal(),a.renderTooltips())})),a.minWidth=400,a.minHeight=400,a.COMPONENT_KEY=b(),a.HEADER_THICKNESS=70,a.TAB_THICKNESS=45,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(bn,{type:"data-search",style:{marginRight:"-3px"}})," ",Zt.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:b(),hasError:!1,activePage:t.defaultTab,width:t.width,height:t.height,isResizing:!1,isWindowResizing:!1,placement:a.getPlacementProp(t.placement),isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isSizeMaximum:!1},a}return Pt(o,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.executeQueryTimeout),clearTimeout(this.rebuildTooltipsTimer)}catch(e){}}}]),o}();Ot(wl,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,placement:y.string,maskClosable:y.bool,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),showHandle:y.bool,handleImage:y.string,handleStyles:y.shape({}),shiftScreen:y.bool,userDisplayName:y.string,clearOnClose:y.bool,enableVoiceRecord:y.bool,title:y.string,maxMessages:y.number,introMessage:y.string,enableExploreQueriesTab:y.bool,enableNotificationsTab:y.bool,resizable:y.bool,inputPlaceholder:y.string,enableDPRTab:y.bool,dataPageSize:y.number,notificationCount:y.number,defaultOpen:y.bool,popoverParentElement:y.element,enableDynamicCharting:y.bool,defaultTab:y.string,autoChartAggregations:y.bool,enableFilterLocking:y.bool,enableQueryQuickStartTopics:y.bool,enableAjaxTableData:y.bool,onNotificationExpandCallback:y.func,onNewNotification:y.func,onNotificationCount:y.func,onVisibleChange:y.func,onErrorCallback:y.func,onSuccessAlert:y.func}),Ot(wl,"defaultProps",{authentication:{},autoQLConfig:Kn,dataFormatting:jn,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:!0,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,onNotificationExpandCallback:function(){},onNewNotification:function(){},onNotificationCount:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var Nl=wo(wl),Al=["style","className","key"],kl=[],Il=function(t){Lt(o,f.Component);var n=Qt(o);function o(t){var a;return kt(this,o),Ot(Bt(a=n.call(this,t)),"componentDidMount",(function(){a._isMounted=!0})),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){if(e.isDragging&&a.props.isDragging)return!1;var n=a.getFilteredProps(a.props),o=a.getFilteredProps(e);return!Za(n,o)||!Za(a.state,t)})),Ot(Bt(a),"componentDidUpdate",(function(t,n){t.tile!==a.props.tile&&a.setState({isTitleOverFlow:a.isTitleOverFlow()}),e(a.props,"tile.title")!==e(t,"tile.title")&&a.setState({title:e(a.props,"tile.title")})})),Ot(Bt(a),"componentWillUnmount",(function(){try{a._isMounted=!1,clearTimeout(a.autoCompleteTimer),clearTimeout(a.dragEndTimeout),clearTimeout(a.setParamsForTileTimeout),a.cancelAllQueries()}catch(e){console.error(e)}})),Ot(Bt(a),"refreshLayout",(function(){var e,t;null===(e=a.state.responseRef)||void 0===e||e.refreshLayout(),null===(t=a.state.secondResponseRef)||void 0===t||t.refreshLayout()})),Ot(Bt(a),"cancelAllQueries",(function(){var e,t;null===(e=a.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED),null===(t=a.secondAxiosSource)||void 0===t||t.cancel(Wt.CANCELLED)})),Ot(Bt(a),"debouncedSetParamsForTile",(function(e,t){a.paramsToSet=xt(xt({},a.paramsToSet),e),"function"==typeof t&&(a.callbackArray=[].concat(zt(a.callbackArray),[t])),clearTimeout(a.setParamsForTileTimeout),a.setParamsForTileTimeout=setTimeout((function(){a.props.setParamsForTile(a.paramsToSet,a.props.tile.i,C(a.callbackArray)),a.paramsToSet={},a.callbackArray=[]}),a.debounceTime)})),Ot(Bt(a),"getFilteredProps",(function(e){return xt(xt({},e),{},{children:void 0,tileRef:void 0})})),Ot(Bt(a),"isQueryValid",(function(e){return!!e&&!!e.trim()})),Ot(Bt(a),"setTopExecuted",(function(){a._isMounted&&a.setState({isTopExecuting:!1,isTopExecuted:!0})})),Ot(Bt(a),"endTopQuery",(function(e){var t,n=e.response;(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&a.debouncedSetParamsForTile({queryResponse:n,defaultSelectedSuggestion:void 0},a.setTopExecuted)})),Ot(Bt(a),"setBottomExecuted",(function(){a._isMounted&&a.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),Ot(Bt(a),"endBottomQuery",(function(e){var t,n=e.response;(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&a.debouncedSetParamsForTile({secondQueryResponse:n,secondDefaultSelectedSuggestion:void 0},a.setBottomExecuted)})),Ot(Bt(a),"processQuery",(function(e){var t=e.query,n=e.userSelection,o=e.skipQueryValidation,r=e.source,i=e.isSecondHalf;if(a.isQueryValid(t)){var l,s,c=["dashboards"];if(null!=r&&r.length?c=[].concat(zt(c),zt(r)):c.push("user"),i&&Na(a.props.tile.secondDisplayType))l=null!==(s=a.props.tile.secondPageSize)&&void 0!==s?s:a.props.dataPageSize;else if(Na(a.props.tile.displayType)){var u;l=null!==(u=a.props.tile.pageSize)&&void 0!==u?u:a.props.dataPageSize}var d=xt(xt(xt({},Yn(a.props.authentication)),Gn(a.props.autoQLConfig)),{},{enableQueryValidation:!!a.props.isEditing&&Gn(a.props.autoQLConfig).enableQueryValidation,cancelToken:i?a.secondAxiosSource.token:a.axiosSource.token,skipQueryValidation:o,source:c,userSelection:n,pageSize:l,query:t});return ro(d).then((function(e){return i?a.bottomRequestData=d:a.topRequestData=d,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),Ot(Bt(a),"processTileTop",(function(t){var n=t.query,o=t.userSelection,r=t.skipQueryValidation,i=t.source,l=t.pageSize;a.setState({isTopExecuting:!0});var s=a.props.tile.query!==n,c=r||a.props.tile.skipQueryValidation&&!s,u=o||(s?void 0:e(a.props.tile,"queryValidationSelections"));a.debouncedSetParamsForTile({query:n,dataConfig:s?void 0:a.props.tile.dataConfig,skipQueryValidation:c,queryResponse:null,columns:s?void 0:a.props.tile.columns,defaultSelectedSuggestion:void 0,queryValidationSelections:u}),a.processQuery({query:n,userSelection:u,skipQueryValidation:r,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){a.endTopQuery({response:e})})).catch((function(e){a.endTopQuery({response:e})}))})),Ot(Bt(a),"processTileBottom",(function(t){var n=t.query,o=t.userSelection,r=t.skipQueryValidation,i=t.source;a.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1});var l=a.props.tile.secondQuery!==n,s=r||a.props.tile.secondskipQueryValidation&&!l,c=o||(l?void 0:e(a.props.tile,"secondQueryValidationSelections"));a.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:l?void 0:a.props.tile.secondDataConfig,secondskipQueryValidation:s,secondQueryResponse:null,secondColumns:l?void 0:a.props.tile.secondColumns,secondDefaultSelectedSuggestion:void 0,secondQueryValidationSelections:c}),a.processQuery({query:n,userSelection:c,skipQueryValidation:r,source:i,isSecondHalf:!0}).then((function(e){a.endBottomQuery({response:e})})).catch((function(e){a.endBottomQuery({response:e})}))})),Ot(Bt(a),"clearQueryResponses",(function(){a.setState({isTopExecuting:!1,isTopExecuted:!1}),a.debouncedSetParamsForTile({queryResponse:void 0,secondQueryResponse:void 0})})),Ot(Bt(a),"processTile",(function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=o.query,i=o.secondQuery,l=o.skipQueryValidation,s=o.secondskipQueryValidation,c=o.source;null===(e=a.secondAxiosSource)||void 0===e||e.cancel(Wt.CANCELLED),null===(t=a.axiosSource)||void 0===t||t.cancel(Wt.CANCELLED),a.axiosSource=null===(n=m.CancelToken)||void 0===n?void 0:n.source(),a.secondAxiosSource=m.CancelToken.source();var u=r||a.props.tile.defaultSelectedSuggestion||a.state.query,d=i||a.props.tile.secondDefaultSelectedSuggestion||a.state.secondQuery;a.processTileTop({query:u,skipQueryValidation:l,source:c}),a.getIsSplitView()&&d&&u!==d&&a.processTileBottom({query:d,skipQueryValidation:s,source:c})})),Ot(Bt(a),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(a.processTile({query:e.target.value}),e.target.blur())})),Ot(Bt(a),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(a.processTileBottom({query:e.target.value}),e.target.blur())})),Ot(Bt(a),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,r=e.source;a.setState({query:t}),o?a.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:r}):a.debouncedSetParamsForTile({defaultSelectedSuggestion:t})})),Ot(Bt(a),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,o=e.isButtonClick,r=e.source;a.setState({secondQuery:t}),o?(a.debouncedSetParamsForTile({secondQuery:t,secondQueryValidationSelections:n}),a.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:r})):a.debouncedSetParamsForTile({secondQuery:t})})),Ot(Bt(a),"onSuggestionsFetchRequested",(function(t){var n=t.value;a.autoCompleteTimer&&clearTimeout(a.autoCompleteTimer),a.autoCompleteTimer=setTimeout((function(){lo(xt({suggestion:n},Yn(a.props.authentication))).then((function(t){if(a._isMounted){var n,o=e(t,"data.data"),r=[];kl=[],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]};kl.push(s)}a.setState({suggestions:kl})}})).catch((function(e){console.error(e)}))}),300)})),Ot(Bt(a),"onSuggestionsClearRequested",(function(){a.setState({suggestions:[]})})),Ot(Bt(a),"userSelectedSuggestionHandler",(function(e){if(e&&e.name&&a._isMounted){var t=e.name;a.userSelectedValue=t,a.userSelectedSuggestion=!0,a.setState({query:t}),a.debouncedSetParamsForTile({query:t})}})),Ot(Bt(a),"onQueryInputChange",(function(e){var t,n;a.debouncedSetParamsForTile({skipQueryValidation:!1}),(!a.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)?a.setState({query:e.target.value}):a.processTile({query:a.userSelectedValue}))})),Ot(Bt(a),"onSecondQueryInputChange",(function(e){a.setState({secondQuery:e.target.value}),a.debouncedSetParamsForTile({secondSkipQueryValidation:!1})})),Ot(Bt(a),"onColumnChange",(function(e){var t={columns:e};a.areTopAndBottomSameQuery()&&(a.SECOND_QUERY_RESPONSE_KEY=b(),t.secondColumns=e),a.debouncedSetParamsForTile(t)})),Ot(Bt(a),"onSecondColumnChange",(function(e){var t={secondColumns:e};a.areTopAndBottomSameQuery()&&(a.FIRST_QUERY_RESPONSE_KEY=b(),t.columns=e),a.debouncedSetParamsForTile(t)})),Ot(Bt(a),"onPageSizeChange",(function(e){a.debouncedSetParamsForTile({pageSize:e})})),Ot(Bt(a),"onSecondPageSizeChange",(function(e){a.debouncedSetParamsForTile({secondPageSize:e})})),Ot(Bt(a),"onDisplayTypeChange",(function(e){a.debouncedSetParamsForTile({displayType:e})})),Ot(Bt(a),"onSecondDisplayTypeChange",(function(e){a.debouncedSetParamsForTile({secondDisplayType:e})})),Ot(Bt(a),"getIsSplitView",(function(){return e(a.props.tile,"splitView")})),Ot(Bt(a),"toggleSecondQueryInput",(function(){a.setState({isSecondQueryInputOpen:!a.state.isSecondQueryInputOpen})})),Ot(Bt(a),"isTitleOverFlow",(function(){var e=a.dashboardTileTitleRef;return!!e&&e.getBoundingClientRect().width>e.parentElement.getBoundingClientRect().width})),Ot(Bt(a),"renderHeader",(function(){return a.props.isEditing?f.createElement("div",{className:"dashboard-tile-edit-wrapper"},f.createElement("div",{className:"dashboard-tile-input-container\n ".concat(a.state.isQueryInputFocused?"query-focused":"","\n ").concat(a.state.isTitleInputFocused?"title-focused":"")},f.createElement("div",{className:"dashboard-tile-left-input-container"},f.createElement(bn,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),Gn(a.props.autoQLConfig).enableAutocomplete?f.createElement(mt,{onSuggestionsFetchRequested:a.onSuggestionsFetchRequested,onSuggestionsClearRequested:a.onSuggestionsClearRequested,getSuggestionValue:a.userSelectedSuggestionHandler,suggestions:a.state.suggestions,ref:function(e){a.autoSuggest=e},renderSuggestion:function(e){return f.createElement(v,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:a.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onFocus:function(e){e.stopPropagation(),a.setState({isQueryInputFocused:!0})},onChange:a.onQueryInputChange,onKeyDown:a.onQueryTextKeyDown,onBlur:function(t){t.stopPropagation(),e(a.props,"tile.query")!==t.target.value&&a.debouncedSetParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0}),a.setState({isQueryInputFocused:!1})}}}):f.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:a.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",spellCheck:!1,onChange:a.onQueryInputChange,onKeyDown:a.onQueryTextKeyDown,onFocus:function(){a.setState({isQueryInputFocused:!0})},onBlur:function(t){e(a.props,"tile.query")!==t.target.value&&a.debouncedSetParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0}),a.setState({isQueryInputFocused:!1})}})),f.createElement("div",{className:"dashboard-tile-right-input-container"},f.createElement(bn,{className:"title-input-icon",type:"title"}),f.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)","data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",value:a.state.title,onChange:function(e){return a.setState({title:e.target.value})},onFocus:function(){a.setState({isTitleInputFocused:!0})},onBlur:function(e){a.debouncedSetParamsForTile({title:e.target.value}),a.setState({isTitleInputFocused:!1})}}))),f.createElement("div",{className:"dashboard-tile-play-button".concat(a.isQueryValid(a.state.query)?"":" disabled")},f.createElement(bn,{type:"play",onClick:function(){return a.processTile()},"data-tip":"Run tile","data-place":"left"}))):f.createElement("div",{className:"dashboard-tile-title-container"},f.createElement("span",{ref:function(e){return a.dashboardTileTitleRef=e},className:"dashboard-tile-title",id:"dashboard-tile-title-".concat(a.COMPONENT_KEY),"data-tip":a.state.isTitleOverFlow?a.props.tile.title||a.props.tile.query||"Untitled":null,"data-for":"react-autoql-dashboard-tile-title-tooltip"},a.props.tile.title||a.props.tile.query||"Untitled"),f.createElement("div",{className:"dashboard-tile-title-divider"}))})),Ot(Bt(a),"renderContentPlaceholder",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting,o=t.isExecuted,r=null;return r=n?f.createElement(No,null):!a.props.isEditing&&o?f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,"No query was supplied for this tile.")):a.props.isEditing&&!e(a.state.query,"trim()")?f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,"To get started, enter a query and click ",f.createElement(bn,{className:"play-icon",type:"play"}))):f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,a.props.isEditing?f.createElement("span",null,"Hit ",f.createElement(bn,{className:"edit-mode-placeholder-icon",type:"play"})," to run this tile"):f.createElement("span",null,a.props.notExecutedText))),f.createElement("div",{className:"loading-container-centered"},r)})),Ot(Bt(a),"onQueryValidationSelectOption",(function(e,t){a.setState({query:e}),a.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),Ot(Bt(a),"onSecondQueryValidationSelectOption",(function(e,t){a.setState({secondQuery:e}),a.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),Ot(Bt(a),"getIsSuggestionResponse",(function(t){return!!e(t,"data.data.items")})),Ot(Bt(a),"onDataConfigChange",(function(e){a.debouncedSetParamsForTile({dataConfig:e})})),Ot(Bt(a),"onSecondDataConfigChange",(function(e){a.debouncedSetParamsForTile({secondDataConfig:e})})),Ot(Bt(a),"reportProblemCallback",(function(){var e;null!==(e=a.optionsToolbarRef)&&void 0!==e&&e._isMounted&&a.optionsToolbarRef.openReportProblemModal()})),Ot(Bt(a),"secondReportProblemCallback",(function(){var e;null!==(e=a.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&a.secondOptionsToolbarRef.openReportProblemModal()})),Ot(Bt(a),"renderSplitResponse",(function(){var t=e(a.tileInnerDiv,"clientWidth")?"".concat(a.tileInnerDiv.clientWidth-70,"px"):"0px";return f.createElement(Et,{key:"dashboard-tile-splitter-layout-".concat(a.COMPONENT_KEY),vertical:!0,percentage:!0,primaryMinSize:30,secondaryMinSize:30,secondaryInitialSize:a.props.secondDisplayPercentage||50,onDragStart:function(){a.setState({isDraggingSplitter:!0})},onDragEnd:function(){a.dragEndTimeout=setTimeout((function(){var t=e(a.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));isNaN(n)||a.debouncedSetParamsForTile({secondDisplayPercentage:n}),a.setState({isDraggingSplitter:!1})}),1e3)}},f.createElement("div",{className:"dashboard-tile-split-pane-container"},a.renderTopResponse()),f.createElement("div",{className:"dashboard-tile-split-pane-container"},a.renderBottomResponse(),a.props.isEditing&&f.createElement("div",{className:"react-autoql-toolbar viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},f.createElement("button",{onClick:function(){a.toggleSecondQueryInput(),En()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},f.createElement(bn,{type:"react-autoql-bubbles-outlined"}),f.createElement(bn,{type:a.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),f.createElement("input",{className:"dashboard-tile-input query second ".concat(a.state.isSecondQueryInputOpen?"open":""),value:a.state.secondQuery,spellCheck:!1,onChange:a.onSecondQueryInputChange,onKeyDown:a.onSecondQueryTextKeyDown,onBlur:function(t){e(a.props,"tile.secondQuery")!==t.target.value&&a.debouncedSetParamsForTile({secondQuery:t.target.value,secondDataConfig:void 0,secondQueryValidationSelections:void 0})},placeholder:a.props.tile.query||"Type a query in your own words",style:{width:a.state.isSecondQueryInputOpen?t:"0px"}}))))})),Ot(Bt(a),"onSplitViewClick",(function(){var e,t,n,o=!(null!==(e=a.props.tile)&&void 0!==e&&e.splitView),r=null===(t=a.props.tile)||void 0===t?void 0:t.secondQuery;o&&!r&&(r=null===(n=a.props.tile)||void 0===n?void 0:n.query);a.debouncedSetParamsForTile({splitView:o,secondQuery:r}),En()})),Ot(Bt(a),"renderSplitViewBtn",(function(){return f.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},f.createElement("button",{onClick:a.onSplitViewClick,className:"react-autoql-toolbar-btn ".concat(a.getIsSplitView()?"active":""),"data-tip":a.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},f.createElement(bn,{type:a.getIsSplitView()?"single-view":"split-view"})))})),Ot(Bt(a),"onCSVDownloadStart",(function(e){return a.props.onCSVDownloadStart(xt(xt({},e),{},{tileId:a.props.tile.i}))})),Ot(Bt(a),"onCSVDownloadProgress",(function(e){return a.props.onCSVDownloadProgress(xt(xt({},e),{},{tileId:a.props.tile.i}))})),Ot(Bt(a),"onCSVDownloadFinish",(function(e){return a.props.onCSVDownloadFinish(xt(xt({},e),{},{tileId:a.props.tile.i}))})),Ot(Bt(a),"onDrilldownStart",(function(e){return a.props.onDrilldownStart({tileId:a.props.tile.i,isSecondHalf:!1,activeKey:e,queryOutputRef:a.state.responseRef})})),Ot(Bt(a),"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"},a.props.isEditing&&(o||!a.getIsSplitView())&&a.renderSplitViewBtn(),a.props.isEditing&&f.createElement(hi,Mt({},t,{shouldRender:!a.props.isDragging,rebuildTooltips:a.props.rebuildTooltips,tooltipID:a.props.tooltipID}))),f.createElement("div",{className:"dashboard-tile-toolbars-right-container"},f.createElement(ul,Mt({authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessCallback,onCSVDownloadStart:a.onCSVDownloadStart,onCSVDownloadProgress:a.onCSVDownloadProgress,onCSVDownloadFinish:a.onCSVDownloadFinish,rebuildTooltips:a.props.rebuildTooltips,shouldRender:!a.props.isDragging,tooltipID:a.props.tooltipID},n))))})),Ot(Bt(a),"renderResponseContent",(function(e){var t=e.queryOutputProps,n=e.isExecuting,o=e.isExecuted;return e.renderPlaceholder?a.renderContentPlaceholder({isExecuting:n,isExecuted:o}):f.createElement(gi,Mt({authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,dataFormatting:a.props.dataFormatting,renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:a.props.autoChartAggregations,isResizing:a.props.isDragging||a.state.isDraggingSplitter,renderSuggestionsAsDropdown:a.props.tile.h<4,enableDynamicCharting:a.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),enableAjaxTableData:a.props.enableAjaxTableData,rebuildTooltips:a.props.rebuildTooltips,showQueryInterpretation:a.props.isEditing,reverseTranslationPlacement:"top",tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID,shouldRender:!a.props.isDragging,autoHeight:!1,height:"100%",width:"100%"},t))})),Ot(Bt(a),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,o=e.vizToolbarProps,r=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},a.renderResponseContent({queryOutputProps:n,isExecuting:c,isExecuted:u,renderPlaceholder:d,isSecondHalf:s}),a.renderToolbars({queryOutputProps:n,vizToolbarProps:r,optionsToolbarProps:l,isSecondHalf:s}))})),Ot(Bt(a),"renderTopResponse",(function(){var t,n=a.state.isTopExecuting,o=a.state.isTopExecuted,r=!a.props.queryResponse||n||!o,i=null===(t=a.props)||void 0===t?void 0:t.displayType;return a.renderResponse({renderPlaceholder:r,isExecuting:n,isExecuted:o,queryOutputProps:{ref:function(e){return e&&e!==a.state.responseRef&&a.setState({responseRef:e})},optionsToolbarRef:a.optionsToolbarRef,vizToolbarRef:a.vizToolbarRef,key:"dashboard-tile-query-top-".concat(a.FIRST_QUERY_RESPONSE_KEY),initialDisplayType:i,queryResponse:a.props.queryResponse,initialTableConfigs:a.props.tile.dataConfig,onTableConfigChange:a.onDataConfigChange,queryValidationSelections:a.props.tile.queryValidationSelections,onSuggestionClick:a.onSuggestionClick,defaultSelectedSuggestion:e(a.props.tile,"defaultSelectedSuggestion"),onNoneOfTheseClick:a.onNoneOfTheseClick,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.props.onDrilldownEnd,onQueryValidationSelectOption:a.onQueryValidationSelectOption,reportProblemCallback:a.reportProblemCallback,queryRequestData:a.topRequestData,onDisplayTypeChange:a.onDisplayTypeChange,initialColumns:a.props.tile.columns,onColumnChange:a.onColumnChange,pageSize:a.props.tile.pageSize,onPageSizeChange:a.onPageSizeChange},vizToolbarProps:{ref:function(e){return a.vizToolbarRef=e},responseRef:a.state.responseRef},optionsToolbarProps:{ref:function(e){return a.optionsToolbarRef=e},responseRef:a.state.responseRef}})})),Ot(Bt(a),"areTopAndBottomSameQuery",(function(){var e,t,n,o,r=null===(e=a.props)||void 0===e||null===(t=e.tile)||void 0===t?void 0:t.query,i=null===(n=a.props)||void 0===n||null===(o=n.tile)||void 0===o?void 0:o.secondQuery;return!i||r===i})),Ot(Bt(a),"renderBottomResponse",(function(){var t,n,o=a.areTopAndBottomSameQuery(),r=a.state.isBottomExecuting,i=a.state.isBottomExecuted,l=a.bottomRequestData;o&&(r=a.state.isTopExecuting,i=a.state.isTopExecuted,l=a.topRequestData);var s=!o&&!a.props.secondQueryResponse||o&&!a.props.queryResponse||r||!i,c=null===(t=a.props)||void 0===t?void 0:t.secondDisplayType,u=o?null===(n=a.props.tile)||void 0===n?void 0:n.columns:a.props.tile.secondColumns;return a.renderResponse({renderPlaceholder:s,isExecuting:r,isExecuted:i,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(a.SECOND_QUERY_RESPONSE_KEY),ref:function(e){return e&&e!==a.state.secondResponseRef&&a.setState({secondResponseRef:e})},optionsToolbarRef:a.secondOptionsToolbarRef,vizToolbarRef:a.secondVizToolbarRef,initialDisplayType:c,queryResponse:a.props.secondQueryResponse||a.props.queryResponse,initialTableConfigs:a.props.tile.secondDataConfig,onTableConfigChange:a.onSecondDataConfigChange,queryValidationSelections:a.props.tile.secondqueryValidationSelections,onSuggestionClick:a.onSecondSuggestionClick,defaultSelectedSuggestion:e(a.props.tile,"secondDefaultSelectedSuggestion"),reportProblemCallback:a.secondReportProblemCallback,onNoneOfTheseClick:a.secondOnNoneOfTheseClick,onDrilldownStart:function(e){a.props.onDrilldownStart({tileId:a.props.tile.i,isSecondHalf:!0,activeKey:e,queryOutputRef:a.state.secondResponseRef})},onDrilldownEnd:a.props.onDrilldownEnd,onQueryValidationSelectOption:a.onSecondQueryValidationSelectOption,queryRequestData:l,onDisplayTypeChange:a.onSecondDisplayTypeChange,initialColumns:u,onColumnChange:a.onSecondColumnChange,pageSize:a.props.tile.secondPageSize,onPageSizeChange:a.onSecondPageSizeChange},vizToolbarProps:{ref:function(e){return a.secondVizToolbarRef=e},responseRef:a.state.secondResponseRef},optionsToolbarProps:{ref:function(e){return a.secondOptionsToolbarRef=e},responseRef:a.state.secondResponseRef},isSecondHalf:!0})})),Ot(Bt(a),"renderContent",(function(){return f.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(a.props.isEditing?" editing":"","\n ").concat(a.props.tile.h<4?" small":"")},f.createElement("div",{className:"dashboard-tile-response-container"},a.getIsSplitView()?a.renderSplitResponse():a.renderTopResponse()))})),Ot(Bt(a),"renderDragHandle",(function(e,t){return f.createElement("div",Mt({},e,{className:"react-autoql-dashboard-tile-drag-handle ".concat(t)}))})),Ot(Bt(a),"renderDragHandles",(function(){var e={onMouseDown:function(e){return e.stopPropagation(),a.props.onMouseDown(e)},onMouseUp:function(e){return e.stopPropagation(),a.props.onMouseUp(e)},onTouchStart:function(e){return e.stopPropagation(),a.props.onTouchStart(e)},onTouchEnd:function(e){return e.stopPropagation(),a.props.onTouchEnd(e)}};return f.createElement(v,null,a.renderDragHandle(e,"top"),a.renderDragHandle(e,"bottom"),a.renderDragHandle(e,"left"),a.renderDragHandle(e,"right"))})),Ot(Bt(a),"renderDeleteBtn",(function(){return f.createElement("div",{className:"dashboard-tile-delete-button",onClick:function(){return a.props.deleteTile(a.props.tile.i)}},f.createElement(bn,{style:{fontSize:"18px"},type:"close"}))})),Ot(Bt(a),"render",(function(){var e={};return a.props.isDragging&&(e.pointerEvents="none"),f.createElement(Kt,null,f.createElement("div",{ref:function(e){return a.ref=e},className:a.props.className,style:xt({},a.props.style),"data-grid":a.props.tile,"data-test":"react-autoql-dashboard-tile"},a.props.children,f.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(a.COMPONENT_KEY),ref:function(e){return a.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(a.getIsSplitView()?"split":""),style:e},f.createElement(v,null,a.renderHeader(),a.renderContent())),a.props.isEditing&&a.renderDragHandles(),a.props.isEditing&&a.renderDeleteBtn()))})),a.dashboardTileTitleRef=void 0,a.optionsToolbarRef=void 0,a.secondOptionsToolbarRef=void 0,a.COMPONENT_KEY=b(),a.FIRST_QUERY_RESPONSE_KEY=b(),a.SECOND_QUERY_RESPONSE_KEY=b(),a.DEFAULT_AJAX_PAGE_SIZE=50,a.autoCompleteTimer=void 0,a.debounceTime=50,a.paramsToSet={},a.callbackArray=[],a.state={query:t.tile.query,secondQuery:t.tile.secondQuery||a.props.tile.query,title:t.tile.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,isTitleOverFlow:!1},a}return Pt(o)}();Ot(Il,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,tile:y.shape({}).isRequired,isEditing:y.bool,deleteTile:y.func,dataPageSize:y.number,queryResponse:y.shape({}),notExecutedText:y.string,onErrorCallback:y.func,onSuccessCallback:y.func,autoChartAggregations:y.bool,onCSVDownloadStart:y.func,onCSVDownloadProgress:y.func,onCSVDownloadFinish:y.func,enableAjaxTableData:y.bool}),Ot(Il,"defaultProps",{authentication:Un,autoQLConfig:Kn,dataFormatting:jn,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,deleteTile:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Pl=f.forwardRef((function(e,t){var n=e.style,o=e.className;e.key;var a=Ft(e,Al);return f.createElement("div",{style:xt({},n),className:o,ref:t},f.createElement(Il,Mt({},a,{rglRef:t,ref:a.tileRef,className:"".concat(a.innerDivClass," ").concat(a.isEditing?"editing":"")})))})),Ol=Ct(bt),Ml=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},Ll=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},ql=function(t){Lt(a,f.Component);var o=Qt(a);function a(t){var r;return kt(this,a),Ot(Bt(r=o.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.props.executeOnMount&&r.executeDashboard(),window.addEventListener("resize",r.onWindowResize)})),Ot(Bt(r),"shouldComponentUpdate",(function(e,t){return!Za(r.props,e)||!Za(r.state,t)})),Ot(Bt(r),"componentDidUpdate",(function(t,n){t.isEditing&&!r.props.isEditing&&r.props.executeOnStopEditing&&r.executeDashboard(),!t.isEditing&&r.props.isEditing&&r.refreshTileLayouts(),r.getChangeDetection(r.props.tiles,t.tiles)&&e(t,"tiles[".concat(t.tiles.length," - 1].y"))!==Number.MAX_VALUE&&r.setState({justPerformedUndo:!1}),r.props.isEditing!==t.isEditing&&r.setState({isDragging:!0},(function(){r.setState({isDragging:!1})}))})),Ot(Bt(r),"componentWillUnmount",(function(){try{r._isMounted=!1,window.removeEventListener("resize",r.onWindowResize),clearTimeout(r.scrollToNewTileTimeout),clearTimeout(r.rebuildTooltipsTimer),clearTimeout(r.stopDraggingTimeout),clearTimeout(r.drillingDownTimeout),clearTimeout(r.animationTimeout)}catch(e){console.error(e)}})),Ot(Bt(r),"getMostRecentTiles",(function(){return r.onChangeTiles?r.onChangeTiles:r.props.tiles})),Ot(Bt(r),"rebuildTooltips",(function(){clearTimeout(r.rebuildTooltipsTimer),r.rebuildTooltipsTimer=setTimeout((function(){Cn()}),500)})),Ot(Bt(r),"subscribeToCallback",(function(e){r.callbackSubsciptions=[].concat(zt(r.callbackSubsciptions),zt(e))})),Ot(Bt(r),"debouncedOnChange",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t&&(r.previousTileState=C(r.getMostRecentTiles())),r.onChangeTiles=C(e);var o=new Promise((function(e,t){try{r.subscribeToCallback([e]),null!=n&&n.length&&r.subscribeToCallback(n),r.onChangeTimer&&clearTimeout(r.onChangeTimer),r.onChangeTimer=setTimeout((function(){if(r.onChangeTiles){var t;if(r.props.onChange(r.onChangeTiles),r.onChangeTiles=null,null!==(t=r.callbackSubsciptions)&&void 0!==t&&t.length){var n=C(r.callbackSubsciptions);return r.callbackSubsciptions=[],void n.forEach((function(e,t){r.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(t+1))}))}return e()}return e()}),r.debounceTime)}catch(e){return console.error(e),r.callbackSubsciptions=[],t()}}));return o})),Ot(Bt(r),"onWindowResize",(function(e){r.currentWindowWidth||(r.currentWindowWidth=window.innerWidth);var t=e.target.innerWidth!==r.currentWindowWidth;t&&r._isMounted&&(r.state.isWindowResizing||(r.currentWindowWidth=window.innerWidth,r.setState({isWindowResizing:!0})),t&&(r.windowResizeTimer=setTimeout((function(){t&&r._isMounted&&(r.currentWindowWidth=void 0,r.setState({isWindowResizing:!1}))}),500)))})),Ot(Bt(r),"refreshTileLayouts",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].refreshLayout()}catch(e){console.error(e)}})),Ot(Bt(r),"executeDashboard",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].processTile()}catch(e){console.error(e)}})),Ot(Bt(r),"unExecuteDashboard",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),Ot(Bt(r),"getChangeDetection",(function(e,t,o){return!n(r.getChangeDetectionTileStructure(e,o),r.getChangeDetectionTileStructure(t,o))})),Ot(Bt(r),"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})),Ot(Bt(r),"scrollToNewTile",(function(e){r.scrollToNewTileTimeout=setTimeout((function(){try{var t,n,o=null===(t=r.tileRefs)||void 0===t||null===(n=t[e])||void 0===n?void 0:n.ref;if(o){var a,i,l=null===(a=r.ref)||void 0===a||null===(i=a.parentElement)||void 0===i?void 0:i.getBoundingClientRect(),s=l.y,c=s+l.height,u=null==o?void 0:o.getBoundingClientRect(),d=u.y;d+u.height>c?o.scrollIntoView(!1):d<s&&o.scrollIntoView(!0)}}catch(e){}}),200)})),Ot(Bt(r),"refreshLayout",(function(){window.dispatchEvent(new Event("resize")),r.setState({isWindowResizing:!0},(function(){r.setState({isWindowResizing:!1})}))})),Ot(Bt(r),"debounceSetState",(function(e){r.stateToSet=xt(xt({},r.stateToSet),e),clearTimeout(r.setStateTimeout),r.setStateTimeout=setTimeout((function(){r.setState(r.stateToSet),r.stateToSet={}}),50)})),Ot(Bt(r),"onMoveStart",(function(e,t,n,o,a,i){r.setIsDragging(!0)})),Ot(Bt(r),"onDrag",(function(e,t,n,o,a,r){a.stopPropagation()})),Ot(Bt(r),"setIsDragging",(function(e){r._isMounted&&e!==r.state.isDragging&&r.isDragging!==e&&(r.isDragging=e,r.setState({isDragging:e}))})),Ot(Bt(r),"onMoveEnd",(function(e,t,n,o,a,i){try{var l=r.getMostRecentTiles();r.getChangeDetection(l,e,!0)&&(r.previousTileState=l),clearTimeout(r.stopDraggingTimeout),r.stopDraggingTimeout=setTimeout((function(){r.setIsDragging(!1)}),0)}catch(e){console.error(e)}})),Ot(Bt(r),"updateTileLayout",(function(e){try{var t=r.getMostRecentTiles().map((function(t,n){return xt(xt({},t),e[n])}));r.debouncedOnChange(t,!1)}catch(e){console.error(e)}})),Ot(Bt(r),"addTile",(function(){try{var e=C(r.getMostRecentTiles()),t=b();e.push({key:t,i:t,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),r.debouncedOnChange(e).then((function(){r.scrollToNewTile(t)})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),Ot(Bt(r),"undo",(function(){try{r.debouncedOnChange(r.previousTileState,!1),r.setState({justPerformedUndo:!0})}catch(e){console.error(e)}})),Ot(Bt(r),"deleteTile",(function(e){try{var t=C(r.getMostRecentTiles()),n=t.map((function(e){return e.i})).indexOf(e);~n&&t.splice(n,1),r.debouncedOnChange(t)}catch(e){console.error(e)}})),Ot(Bt(r),"setParamsForTile",(function(e,t,n){try{var o=r.getMostRecentTiles(),a=C(r.getMostRecentTiles()),i=a.map((function(e){return e.i})).indexOf(t);a[i]=xt(xt({},a[i]),e),Object.keys(e).includes("query")&&e.query!==o[i].query?(a[i].dataConfig=void 0,a[i].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==o[i].secondQuery&&(a[i].secondDataConfig=void 0,a[i].secondskipQueryValidation=!1),r.debouncedOnChange(a,void 0,n)}catch(e){console.error(e)}})),Ot(Bt(r),"onDrilldownStart",(function(e){var t=e.tileId,n=e.activeKey,o=e.isSecondHalf,a=e.queryOutputRef;Gn(r.props.autoQLConfig).enableDrilldowns&&(r.activeDrilldownRef=a,r.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:o,activeDrilldownTile:t||r.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:n,isAnimatingModal:!r.state.isDrilldownModalVisible}),r.animationTimeout=setTimeout((function(){r._isMounted&&r.setState({isAnimatingModal:!1})}),500))})),Ot(Bt(r),"onDrilldownEnd",(function(e){var t=e.response,n=e.error;t?r._isMounted&&r.setState({activeDrilldownResponse:t,isDrilldownRunning:!1}):n&&(console.error(n),r._isMounted&&r.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),Ot(Bt(r),"shouldShowOriginalQuery",(function(){var e,t,n=null===(e=r.activeDrilldownRef)||void 0===e||null===(t=e.state)||void 0===t?void 0:t.displayType;return!!n&&Dn.includes(n)})),Ot(Bt(r),"reportProblemCallback",(function(){r.setState({isReportProblemOpen:!0})})),Ot(Bt(r),"renderDrilldownTable",(function(){return f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},r.state.isDrilldownRunning?f.createElement("div",{className:"dashboard-tile-loading-container"},f.createElement(No,null)):f.createElement(gi,{ref:function(e){return r.drilldownTableRef=e},initialDisplayType:"table",isResizing:r.state.isAnimatingModal,authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,dataFormatting:r.props.dataFormatting,queryResponse:r.state.activeDrilldownResponse,renderTooltips:!1,reportProblemCallback:r.reportProblemCallback,enableAjaxTableData:r.props.enableAjaxTableData,rebuildTooltips:r.rebuildTooltips,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",tooltipID:r.TOOLTIP_ID,chartTooltipID:r.CHART_TOOLTIP_ID,allowDisplayTypeChange:!1,height:"100%",width:"100%"}))})),Ot(Bt(r),"renderChartCollapseBtn",(function(e){return f.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},f.createElement(gr,{onClick:function(){r.setState({isDrilldownChartHidden:!r.state.isDrilldownChartHidden})},tooltip:r.state.isDrilldownChartHidden?"Show Chart":"Hide Chart",tooltipID:r.TOOLTIP_ID},f.createElement(bn,{type:"chart"}),f.createElement(bn,{type:r.state.isDrilldownChartHidden?"expand":"collapse"})))})),Ot(Bt(r),"renderReportProblemModal",(function(){return f.createElement(ll,{authentication:r.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:r.closeReportProblemModal,onReportProblem:r.onReportProblem,responseRef:r.drilldownTableRef,isVisible:r.state.isReportProblemOpen})})),Ot(Bt(r),"closeDrilldownModal",(function(){r.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})})),Ot(Bt(r),"closeReportProblemModal",(function(){r.setState({isReportProblemOpen:!1})})),Ot(Bt(r),"onReportProblem",(function(e){var t=e.successMessage,n=e.error;t?(r.props.onSuccessCallback(t),r._isMounted&&r.setState({isReportProblemOpen:!1})):n&&r.props.onErrorCallback(n)})),Ot(Bt(r),"renderDrilldownModal",(function(){try{var e,t,n,o,a,i;if(r.state.isDrilldownModalVisible)(a=C(null===(i=r.activeDrilldownRef)||void 0===i?void 0:i.queryResponse))&&(a.data.data.columns=r.activeDrilldownRef.state.columns);var l=!r.state.isDrilldownChartHidden&&r.shouldShowOriginalQuery();return f.createElement(bi,{className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(r.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(r.shouldShowOriginalQuery()?"":"top-hidden"),title:null===(e=r.activeDrilldownRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.text,isVisible:r.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,shouldRender:r.state.isDrilldownModalVisible&&!r.state.isDragging&&!r.state.isWindowResizing,onClose:r.closeDrilldownModal},f.createElement(v,null,r.activeDrilldownRef&&f.createElement(Et,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:l?35:0,onDragStart:function(){r.setState({isResizingDrilldown:!0})},onDragEnd:function(){r.setState({isResizingDrilldown:!1})}},f.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},r.shouldShowOriginalQuery()&&f.createElement(f.Fragment,null,r.activeDrilldownRef&&f.createElement(gi,Mt({},r.activeDrilldownRef.props,{queryResponse:a,isDrilldownChartHidden:r.state.isDrilldownChartHidden,key:"dashboard-drilldown-chart-".concat(r.state.activeDrilldownTile),activeChartElementKey:r.state.activeDrilldownChartElementKey,initialDisplayType:r.activeDrilldownRef.state.displayType,initialTableConfigs:{tableConfig:r.activeDrilldownRef.tableConfig,pivotTableConfig:r.activeDrilldownRef.pivotTableConfig},isAnimating:r.state.isAnimatingModal,isResizing:r.state.isResizingDrilldown||!r.state.isDrilldownModalVisible,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",allowDisplayTypeChange:!1,height:"100%",width:"100%"})),r.renderChartCollapseBtn("bottom"))),r.renderDrilldownTable()),r.shouldShowOriginalQuery()&&r.state.isDrilldownChartHidden&&r.renderChartCollapseBtn("top")))}catch(e){console.error(e),r.props.onErrorCallback(e)}})),Ot(Bt(r),"renderEmptyDashboardMessage",(function(){return r.props.isEditable&&!r.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){r.props.startEditingCallback()}},"New Dashboard")):r.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){r.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")})),Ot(Bt(r),"renderTiles",(function(){var e=r.getMostRecentTiles().map((function(e){return xt(xt({},e),{},{i:e.key,maxH:12,minH:2,minW:3})})),t=r.props.dataPageSize;return r.props.enableAjaxTableData&&!t&&(t=r.DEFAULT_AJAX_PAGE_SIZE),f.createElement(Ol,{ref:function(e){return r.rglRef=e},onLayoutChange:function(e){r.updateTileLayout(e),r.setState({layout:e})},onDrag:r.onDrag,onDragStart:r.onMoveStart,onResizeStart:r.onMoveStart,onDragStop:r.onMoveEnd,onResizeStop:r.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:r.props.isEditing,isResizable:r.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return f.createElement(Pl,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(t){return r.tileRefs[e.key]=t},key:e.key,dashboardRef:r.ref,authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,tile:xt(xt({},e),{},{i:e.key,maxH:12,minH:2,minW:3}),displayType:e.displayType,secondDisplayType:e.secondDisplayType,secondDisplayPercentage:e.secondDisplayPercentage,queryResponse:e.queryResponse,secondQueryResponse:e.secondQueryResponse,isEditing:r.props.isEditing,isDragging:r.state.isDragging||r.state.isWindowResizing,isWindowResizing:r.state.isWindowResizing,setParamsForTile:r.setParamsForTile,deleteTile:r.deleteTile,dataFormatting:r.props.dataFormatting,notExecutedText:r.props.notExecutedText,enableDynamicCharting:r.props.enableDynamicCharting,onErrorCallback:r.props.onErrorCallback,onSuccessCallback:r.props.onSuccessCallback,autoChartAggregations:r.props.autoChartAggregations,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.onDrilldownEnd,onCSVDownloadStart:r.props.onCSVDownloadStart,onCSVDownloadProgress:r.props.onCSVDownloadProgress,onCSVDownloadFinish:r.props.onCSVDownloadFinish,enableAjaxTableData:r.props.enableAjaxTableData,rebuildTooltips:r.rebuildTooltips,tooltipID:r.TOOLTIP_ID,chartTooltipID:r.CHART_TOOLTIP_ID})})))})),Ot(Bt(r),"render",(function(){var e=r.getMostRecentTiles();return f.createElement(Kt,null,f.createElement(v,null,f.createElement("div",{ref:function(e){return r.ref=e},className:"react-autoql-dashboard-container".concat(r.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?r.renderTiles():r.renderEmptyDashboardMessage()),r.renderDrilldownModal(),r.renderReportProblemModal(),f.createElement(Sn,{className:"react-autoql-tooltip",id:r.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),f.createElement(Sn,{className:"react-autoql-chart-tooltip",id:r.CHART_TOOLTIP_ID,effect:"solid",place:"top",html:!0})))})),r.COMPONENT_KEY=b(),r.TOOLTIP_ID="react-autoql-dashboard-toolbar-btn-tooltip-".concat(r.COMPONENT_KEY),r.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(r.COMPONENT_KEY),r.tileRefs={},r.debounceTime=50,r.onChangeTiles=null,r.callbackSubsciptions=[],r.state={isDragging:!1,isReportProblemOpen:!1,isResizingDrilldown:!1},r}return Pt(a)}();Ot(ql,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,tiles:y.arrayOf(y.shape({})),executeOnMount:y.bool,dataPageSize:y.number,executeOnStopEditing:y.bool,isEditing:y.bool,isEditable:y.bool,notExecutedText:y.string,onChange:y.func,enableDynamicCharting:y.bool,onErrorCallback:y.func,onSuccessCallback:y.func,autoChartAggregations:y.bool,onCSVDownloadStart:y.func,onCSVDownloadProgress:y.func,onCSVDownloadFinish:y.func,enableAjaxTableData:y.bool}),Ot(ql,"defaultProps",{authentication:Un,autoQLConfig:Kn,dataFormatting:jn,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Vl=wo(ql),_l=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(a))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),Ot(Bt(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)})),Ot(Bt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=St(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:Tt,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),Ot(Bt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),Ot(Bt(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)}}))})),Ot(Bt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),Ot(Bt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),Ot(Bt(e),"onMouseDown",(function(){En(),e.startRecording()})),Ot(Bt(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};m.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})}))}))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(Re,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return f.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},f.createElement(bn,{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(bn,{type:"microphone"}))),f.createElement(Sn,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return Pt(n)}();Ot(_l,"propTypes",{authentication:Gt,transcript:y.string,interimTranscript:y.string,finalTranscript:y.string,resetTranscript:y.func,onTranscriptChange:y.func,onFinalTranscript:y.func}),Ot(_l,"defaultProps",{authentication:Un});export{Vl as Dashboard,Pl as DashboardTile,Gi as DataAlertModal,tl as DataAlerts,Tl as DataExplorer,Nl as DataMessenger,vl as ExploreQueries,il as ExpressionBuilder,Vi as ExpressionBuilderSimple,Rl as FilterLockPopover,bn as Icon,No as LoadingDots,Zi as NotificationFeed,Pi as NotificationIcon,_i as NotificationItem,ul as OptionsToolbar,er as QueryInput,gi as QueryOutput,hl as QuerySuggestionList,ll as ReportProblemModal,mi as ReverseTranslation,Yi as ScheduleBuilder,_l as SpeechToTextButton,ho as SpeechToTextButtonBrowser,hi as VizToolbar,Ro as configureTheme,Ml as executeDashboard,po as fetchExploreQueries,Ha as getDefaultDisplayType,_a as getSupportedDisplayTypes,Fa as isDisplayTypeValid,Ll as unExecuteDashboard};
1
+ import e from"lodash.get";import t from"lodash.filter";import n from"lodash.isequal";import a from"dayjs";import o 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"axios";import f,{useEffect as g,Fragment as v,Component as h}from"react";import y from"prop-types";import{v4 as b}from"uuid";import C from"lodash.clonedeep";import{AiFillCaretDown as E}from"@react-icons/all-files/ai/AiFillCaretDown";import{AiFillCaretLeft as S}from"@react-icons/all-files/ai/AiFillCaretLeft";import{AiFillCaretRight as T}from"@react-icons/all-files/ai/AiFillCaretRight";import{AiFillCaretUp as D}from"@react-icons/all-files/ai/AiFillCaretUp";import{AiOutlineBook as x}from"@react-icons/all-files/ai/AiOutlineBook";import{AiOutlineBulb as w}from"@react-icons/all-files/ai/AiOutlineBulb";import{AiOutlineDashboard as R}from"@react-icons/all-files/ai/AiOutlineDashboard";import{AiOutlineEdit as A}from"@react-icons/all-files/ai/AiOutlineEdit";import{AiOutlineFileText as N}from"@react-icons/all-files/ai/AiOutlineFileText";import{AiOutlineMenu as k}from"@react-icons/all-files/ai/AiOutlineMenu";import{AiOutlineQuestionCircle as I}from"@react-icons/all-files/ai/AiOutlineQuestionCircle";import{AiOutlineTag as P}from"@react-icons/all-files/ai/AiOutlineTag";import{AiOutlineFileSearch as O}from"@react-icons/all-files/ai/AiOutlineFileSearch";import{BiLineChart as M}from"@react-icons/all-files/bi/BiLineChart";import{BiSearchAlt as L}from"@react-icons/all-files/bi/BiSearchAlt";import{BiBookmark as q}from"@react-icons/all-files/bi/BiBookmark";import{BiBook as V}from"@react-icons/all-files/bi/BiBook";import{BiNote as _}from"@react-icons/all-files/bi/BiNote";import{BiAbacus as F}from"@react-icons/all-files/bi/BiAbacus";import{BsArrowBarDown as B}from"@react-icons/all-files/bs/BsArrowBarDown";import{BsArrowBarUp as H}from"@react-icons/all-files/bs/BsArrowBarUp";import{FaMicrophoneAlt as Q}from"@react-icons/all-files/fa/FaMicrophoneAlt";import{FiAlertTriangle as z}from"@react-icons/all-files/fi/FiAlertTriangle";import{FiArrowLeft as U}from"@react-icons/all-files/fi/FiArrowLeft";import{FiBell as j}from"@react-icons/all-files/fi/FiBell";import{FiBellOff as K}from"@react-icons/all-files/fi/FiBellOff";import{FiCalendar as Y}from"@react-icons/all-files/fi/FiCalendar";import{FiCheck as W}from"@react-icons/all-files/fi/FiCheck";import{FiDatabase as G}from"@react-icons/all-files/fi/FiDatabase";import{FiDownload as X}from"@react-icons/all-files/fi/FiDownload";import{FiEye as J}from"@react-icons/all-files/fi/FiEye";import{RiFilterLine as Z}from"@react-icons/all-files/ri/RiFilterLine";import{RiFilterOffLine as $}from"@react-icons/all-files/ri/RiFilterOffLine";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 ae}from"@react-icons/all-files/fi/FiPlus";import{FiSend as oe}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{GoReport as ue}from"@react-icons/all-files/go/GoReport";import{IoIosCloseCircleOutline as de}from"@react-icons/all-files/io/IoIosCloseCircleOutline";import{IoIosGlobe as pe}from"@react-icons/all-files/io/IoIosGlobe";import{IoIosHourglass as me}from"@react-icons/all-files/io/IoIosHourglass";import{IoIosSearch as fe}from"@react-icons/all-files/io/IoIosSearch";import{MdClose as ge}from"@react-icons/all-files/md/MdClose";import{MdContentCopy as ve}from"@react-icons/all-files/md/MdContentCopy";import{MdError as he}from"@react-icons/all-files/md/MdError";import{MdInfoOutline as ye}from"@react-icons/all-files/md/MdInfoOutline";import{MdLock as be}from"@react-icons/all-files/md/MdLock";import{MdLockOpen as Ce}from"@react-icons/all-files/md/MdLockOpen";import{MdPlayCircleOutline as Ee}from"@react-icons/all-files/md/MdPlayCircleOutline";import{MdAttachMoney as Se}from"@react-icons/all-files/md/MdAttachMoney";import Te from"react-infinite-scroller";import De from"lodash.isempty";import xe from"parse-num";import{Popover as we,ArrowContainer as Re}from"react-tiny-popover";import Ae from"react-tooltip";import Ne from"moment-timezone";import ke from"react-select";import Ie from"react-modal";import{Scrollbars as Pe}from"react-custom-scrollbars-2";import Oe from"html-react-parser";import{TabulatorFull as Me}from"tabulator-tables";import"tabulator-tables/dist/css/tabulator.min.css";import"tabulator-tables/dist/css/tabulator_bootstrap3.min.css";import{DateRange as Le}from"react-date-range";import"react-date-range/dist/styles.css";import"react-date-range/dist/theme/default.css";import{scaleBand as qe,scaleLinear as Ve,scaleOrdinal as _e}from"d3-scale";import{max as Fe,min as Be,sum as He,count as Qe,variance as ze,deviation as Ue,median as je,mean as Ke}from"d3-array";import{select as Ye}from"d3-selection";import We from"lodash.sortby";import{axisTop as Ge,axisRight as Xe,axisLeft as Je,axisBottom as Ze}from"d3-axis";import{symbol as $e,symbolCircle as et,symbolSquare as tt,arc as nt,pie as at}from"d3-shape";import{format as ot,formatPrefix as rt,formatLocale as it,formatSpecifier as lt}from"d3-format";import{dispatch as st}from"d3-dispatch";import{entries as ct}from"d3-collection";import"d3-transition";import ut from"rc-drawer";import dt from"lodash.has";import pt from"react-localization";import"rc-drawer/assets/index.css";import mt from"react-autosuggest";import{toast as ft,ToastContainer as gt,Slide as vt}from"react-toastify";import"react-toastify/dist/ReactToastify.css";import{format as ht}from"sql-formatter";import yt from"react-speech-recognition";import bt,{WidthProvider as Ct}from"react-grid-layout";import Et from"react-splitter-layout";import"react-grid-layout/css/styles.css";import"react-splitter-layout/lib/index.css";import St,{StereoAudioRecorder as Tt}from"recordrtc";function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach((function(t){Ot(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wt(){wt=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,o){var r=t&&t.prototype instanceof p?t:p,i=Object.create(r.prototype),l=new x(o||[]);return a(i,"_invoke",{value:E(e,n,l)}),i}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function p(){}function m(){}function f(){}var g={};s(g,r,(function(){return this}));var v=Object.getPrototypeOf,h=v&&v(v(w([])));h&&h!==t&&n.call(h,r)&&(g=h);var y=f.prototype=p.prototype=Object.create(g);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){var o;a(this,"_invoke",{value:function(a,r){function i(){return new t((function(o,i){!function a(o,r,i,l){var s=u(e[o],e,r);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){a("next",e,i,l)}),(function(e){a("throw",e,i,l)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return a("throw",e,i,l)}))}l(s.arg)}(a,r,o,i)}))}return o=o?o.then(i,i):i()}})}function E(e,t,n){var a="suspendedStart";return function(o,r){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===o)throw r;return R()}for(n.method=o,n.arg=r;;){var i=n.delegate;if(i){var l=S(i,n);if(l){if(l===d)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var s=u(e,t,n);if("normal"===s.type){if(a=n.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a="completed",n.method="throw",n.arg=s.arg)}}}function S(e,t){var n=t.method,a=e.iterator[n];if(void 0===a)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=u(a,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var r=o.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function T(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 D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function w(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function t(){for(;++a<e.length;)if(n.call(e,a))return t.value=e[a],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:R}}function R(){return{value:void 0,done:!0}}return m.prototype=f,a(y,"constructor",{value:f,configurable:!0}),a(f,"constructor",{value:m,configurable:!0}),m.displayName=s(f,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(C.prototype),s(C.prototype,i,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,a,o,r){void 0===r&&(r=Promise);var i=new C(c(t,n,a,o),r);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),s(y,l,"Generator"),s(y,r,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var a in t)n.push(a);return n.reverse(),function e(){for(;n.length;){var a=n.pop();if(a in t)return e.value=a,e.done=!1,e}return e.done=!0,e}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(D),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function a(n,a){return i.type="throw",i.arg=e,t.next=n,a&&(t.method="next",t.arg=void 0),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],i=r.completion;if("root"===r.tryLoc)return a("end");if(r.tryLoc<=this.prev){var l=n.call(r,"catchLoc"),s=n.call(r,"finallyLoc");if(l&&s){if(this.prev<r.catchLoc)return a(r.catchLoc,!0);if(this.prev<r.finallyLoc)return a(r.finallyLoc)}else if(l){if(this.prev<r.catchLoc)return a(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return a(r.finallyLoc)}}}},abrupt:function(e,t){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;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,d):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),d},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),D(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if("throw"===a.type){var o=a.arg;D(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function Rt(e){return(Rt="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 At(e,t,n,a,o,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(a,o)}function Nt(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var r=e.apply(t,n);function i(e){At(r,a,o,i,l,"next",e)}function l(e){At(r,a,o,i,l,"throw",e)}i(void 0)}))}}function kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,jt(a.key),a)}}function Pt(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t,n){return(t=jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(){return(Mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function Lt(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&&Vt(e,t)}function qt(e){return(qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vt(e,t){return(Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function Ft(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Bt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ht(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 Bt(e)}function Qt(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,a=qt(e);if(t){var o=qt(this).constructor;n=Reflect.construct(a,arguments,o)}else n=a.apply(this,arguments);return Ht(this,n)}}function zt(e){return function(e){if(Array.isArray(e))return Ut(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 Ut(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 Ut(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 Ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function jt(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;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 Kt=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{hasError:!1}),Ot(Bt(e),"componentDidCatch",(function(t,n){console.error("Error HOC caught error:",t),e.setState({hasError:!0}),console.error(t),console.error(n)})),Ot(Bt(e),"getErrorMessage",(function(){return e.props.message&&"string"==typeof e.props.message?e.props.message:null})),Ot(Bt(e),"render",(function(){return e.state.hasError?f.createElement("div",{"data-test":"error-container"},e.getErrorMessage()):e.props.children})),e}return Pt(n)}();Ot(Kt,"propTypes",{message:y.string}),Ot(Kt,"defaultProps",{message:null});var Yt={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.")},Wt={CANCELLED:"Request cancelled"},Gt=y.shape({token:y.string,apiKey:y.string,domain:y.string}),Xt=y.shape({currencyCode:y.string,languageCode:y.string,currencyDecimals:y.number,quantityDecimals:y.number,comparisonDisplay:y.string,monthYearFormat:y.string,dayMonthYearFormat:y.string}),Jt=y.shape({debug:y.bool,test:y.bool,enableAutocomplete:y.bool,enableQueryValidation:y.bool,enableDrilldowns:y.bool,enableQuerySuggestions:y.bool,enableColumnVisibilityManager:y.bool,enableNotifications:y.bool});y.shape({stringColumnIndices:y.arrayOf(y.number),numberColumnIndices:y.arrayOf(y.number),stringColumnIndex:y.number,legendColumnIndex:y.number,numberColumnIndex:y.number});var Zt=new pt({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",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",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"}}),$t=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"}))),en=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"})),tn=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"}))))),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:"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"})))),an=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"})),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:"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"})),rn=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"})),sn=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 "})),cn=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"})),un=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"})))),dn=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"}))),pn=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"})),mn=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 "})),fn=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"})),gn=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"})),vn=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"}))),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:"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=["type","size","showBadge","warning","danger"],bn=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"render",(function(){var t=e.props;t.type,t.size,t.showBadge,t.warning,t.danger;var n=Ft(t,yn),a=null;if(!e.props.type)return null;switch(e.props.type){case"back":a=f.createElement(U,null);break;case"bar-chart":a=ln;break;case"book":a=f.createElement(V,null);break;case"bookmark":a=f.createElement(q,null);break;case"stacked-bar-chart":a=un;break;case"bubble-chart":a=fn;break;case"calendar":a=f.createElement(Y,null);break;case"caret-right":a=f.createElement(T,null);break;case"caret-left":a=f.createElement(S,null);break;case"caret-down":a=f.createElement(E,null);break;case"caret-up":a=f.createElement(D,null);break;case"react-autoql-bubbles-outlined":a=en;break;case"react-autoql-bubbles-filled":a=nn;break;case"react-autoql-bubbles-filled-alt":a=tn;break;case"chart":a=f.createElement(M,null);break;case"check":a=f.createElement(W,null);break;case"close":a=f.createElement(ge,null);break;case"maximize":a=f.createElement(le,null);break;case"minimize":a=f.createElement(se,null);break;case"money":a=f.createElement(Se,null);break;case"close-circle":a=f.createElement(de,null);break;case"collapse":a=f.createElement(H,null);break;case"column-chart":a=rn;break;case"column-line-chart":a=gn;break;case"stacked-column-chart":a=dn;break;case"copy":a=f.createElement(ve,null);break;case"dashboard":a=f.createElement(R,null);break;case"database":a=f.createElement(G,null);break;case"description":a=f.createElement(N,null);break;case"download":a=f.createElement(X,null);break;case"edit":a=f.createElement(A,null);break;case"expand":a=f.createElement(B,null);break;case"eye":a=f.createElement(J,null);break;case"filter":a=f.createElement(Z,null);break;case"filter-off":a=f.createElement($,null);break;case"grad-cap":a=$t;break;case"globe":a=f.createElement(pe,null);break;case"heatmap":a=mn;break;case"hour-glass":a=f.createElement(me,null);break;case"info":a=f.createElement(ye,null);break;case"light-bulb":a=f.createElement(w,null);break;case"line-chart":a=sn;break;case"lock":a=f.createElement(be,null);break;case"stacked-line-chart":a=pn;break;case"menu":a=f.createElement(k,null);break;case"microphone":a=f.createElement(Q,null);break;case"more-vertical":a=f.createElement(te,null);break;case"more-horizontal":a=f.createElement(ee,null);break;case"note":a=f.createElement(_,null);break;case"notification":a=f.createElement(j,null);break;case"notification-off":a=f.createElement(K,null);break;case"notification-pause":a=f.createElement(ne,null);break;case"abacus":a=f.createElement(F,null);break;case"pie-chart":a=cn;break;case"play":a=f.createElement(Ee,null);break;case"pivot-table":a=on;break;case"plus":a=f.createElement(ae,null);break;case"preview":a=f.createElement(O,null);break;case"question":a=f.createElement(I,null);break;case"refresh":a=f.createElement(ce,null);break;case"report":a=f.createElement(ue,null);break;case"search":a=f.createElement(fe,null);break;case"data-search":a=f.createElement(L,null);break;case"send":a=f.createElement(oe,null);break;case"settings":a=f.createElement(re,null);break;case"split-view":a=vn;break;case"single-view":a=hn;break;case"table":a=an;break;case"tag":a=f.createElement(P,null);break;case"title":a=f.createElement(x,null);break;case"trash":a=f.createElement(ie,null);break;case"unlock":a=f.createElement(Ce,null);break;case"warning":a=f.createElement(he,null);break;case"warning-triangle":a=f.createElement(z,null)}return f.createElement(Kt,null,f.createElement("span",Mt({},n,{"data-test":"react-autoql-icon",className:"react-autoql-icon\n ".concat(e.props.className||"","\n ").concat(e.props.type,"\n ").concat(e.props.warning?" warning":"","\n ").concat(e.props.danger?" danger":""),style:xt({color:e.props.color,fontSize:"".concat(e.props.size,"px")},e.props.style)}),a,e.props.showBadge&&f.createElement("div",{className:"react-autoql-badge"})))})),e}return Pt(n)}();Ot(bn,"propTypes",{type:y.string,size:y.number,showBadge:y.bool,color:y.string,warning:y.bool,danger:y.bool}),Ot(bn,"defaultProps",{size:void 0,showBadge:!1,color:void 0,warning:!1,danger:!1});var Cn="react-autoql-tooltip-rebuild-timer",En=["pivot_table","pivot_column","date_pivot","table","compare_table","compare_table_budget"],Sn=["bar","bubble","chart","column","heatmap","line","pie","stacked_bar","stacked_column","stacked_line","column_line"],Tn=["line","stacked_line"],Dn=["column_line"],xn=["January","February","March","April","May","June","July","August","September","October","November","December"],wn={CURRENCY:"DOLLAR_AMT",QUANTITY:"QUANTITY",RATIO:"RATIO",PERCENT:"PERCENT"},Rn={DOLLAR_AMT:"Currency",QUANTITY:"Quantity",RATIO:"Ratio",PERCENT:"Percent"},An=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Nn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],kn=["SP","SU","FA","HO"],In="DAY",Pn="MONTH",On="YEAR",Mn="WEEK",Ln="QUARTER",qn="DATE_HOUR",Vn="DATE_MINUTE",_n="HOUR",Fn="MINUTE",Bn={DAY:"ll",MONTH:"MMMM YYYY",YEAR:"YYYY",DATE_HOUR:"ll h:00A",DATE_MINUTE:"ll h:mmA"},Hn=[{displayName:"Sum",value:"sum",unit:"inherit",tooltip:"<strong>Sum:</strong> Values that have the same chart axis label will be added up."},{displayName:"Avg",value:"avg",unit:"inherit",tooltip:"<strong>Average:</strong> Values that have the same chart axis label will be averaged."},{displayName:"Count",value:"count",unit:"none",tooltip:"<strong>Count:</strong> The total number of non-blank values will be shown for all data points with the same label."}],Qn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,t=sessionStorage.getItem(Cn);t||Ae.rebuild(),clearTimeout(t),sessionStorage.setItem(Cn,setTimeout((function(){sessionStorage.removeItem(Cn),t&&Ae.rebuild()}),e))},zn=function(){Ae.hide()},Un=function(e){return f.createElement(Ae,e)},jn={token:void 0,apiKey:void 0,domain:void 0,dprKey:void 0,dprDomain:void 0},Kn={timestampFormat:"ISO8601",currencyCode:"USD",languageCode:"en-US",currencyDecimals:2,quantityDecimals:1,comparisonDisplay:"PERCENT",monthYearFormat:"MMMM YYYY",dayMonthYearFormat:"ll"},Yn={debug:!1,test:!1,enableAutocomplete:!0,enableQueryInterpretation:!0,enableQueryValidation:!0,enableQuerySuggestions:!0,enableColumnVisibilityManager:!0,enableDrilldowns:!0,enableNotifications:!1,enableCSVDownload:!1,enableReportProblem:!0},Wn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},jn),e)},Gn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Kn),e)},Xn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Yn),e)},Jn="subject",Zn="VL",$n=function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response"))},ea=function(e){try{return e.join(".")}catch(e){return}},ta=function(e){if(e&&e.length){var t=[];return e.forEach((function(e){e.hidden||t.push({start:e.start,end:e.end,value:e.text||e.value,value_label:e.value_label||"ORIGINAL_TEXT",canonical:e.canonical||"ORIGINAL_TEXT"})})),t}},na=function(e){try{var t=null==e?void 0:e.split("."),n=Number(null==t?void 0:t[2]);if(n>=500&&n<600)return!0}catch(e){console.error(e)}return!1},aa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.queryId,o=t.domain,r=t.apiKey,i=t.token,l=t.cancelToken;if(!n)return Promise.reject(new Error("No query supplied"));if(!o||!i||!r)return Promise.reject(new Error("Unauthenticated"));var s="".concat(o,"/autoql/api/v1/query/related-queries?key=").concat(r,"&search=").concat(encodeURIComponent(n),"&scope=narrow");a&&(s="".concat(s,"&query_id=").concat(a));var c={headers:{Authorization:"Bearer ".concat(i)},cancelToken:l};return m.get(s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},oa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.query,a=t.userSelection,o=t.userSelectionFinal,r=t.debug,i=t.test,l=t.domain,s=t.apiKey,c=t.token,u=t.source,d=t.filters,p=t.orders,f=t.tableFilters,g=t.pageSize,v=void 0===g?100:g,h=t.cancelToken,y="".concat(l,"/autoql/api/v1/query?key=").concat(s),b=o||ta(a),C={text:n,source:ea(u),translation:r?"include":"exclude",user_selection:b,test:i,session_filter_locks:d,orders:p,filters:f,page_size:v,date_format:"ISO8601"};if(!n||!n.trim())return console.error("No query supplied in request"),Promise.reject({error:"No query supplied"});if(!s||!l||!c)return console.error("authentication invalid for request"),Promise.reject({error:"Unauthenticated"});var E={headers:{Authorization:"Bearer ".concat(c)},cancelToken:h};return m.post(y,C,E).then((function(e){var t;if(null==e||null===(t=e.data)||void 0===t||!t.data)throw new Error("Parse error");return Promise.resolve(e)})).catch((function(t){var a,o,r;if((null==t?void 0:t.message)===Wt.CANCELLED)return Promise.reject({data:{message:Wt.CANCELLED}});if(console.error(t),"Parse error"===(null==t?void 0:t.message))return Promise.reject({error:"Parse error"});if(401===(null==t?void 0:t.response)||null==t||null===(a=t.response)||void 0===a||!a.data)return Promise.reject({error:"Unauthenticated"});var i=null==t||null===(o=t.response)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.reference_id;if(!((null==f?void 0:f.length)||(null==p?void 0:p.length))&&("1.1.430"===i||"1.1.431"===i||na(i))){var u,d,m,g=null==t||null===(u=t.response)||void 0===u||null===(d=u.data)||void 0===d||null===(m=d.data)||void 0===m?void 0:m.query_id;return aa({query:n,queryId:g,domain:l,apiKey:s,token:c,cancelToken:h})}return Promise.reject(e(t,"response"))}))},ra=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.text,a=t.domain,o=t.apiKey,r=t.token;if(!n)return Promise.reject(new Error("No text supplied"));if(!r||!a||!o)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/validate?text=").concat(encodeURIComponent(n),"&key=").concat(o),l={headers:{Authorization:"Bearer ".concat(r)}};return m.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))},ia=function(t){return null==t||!t.enableQueryValidation||null!=t&&t.skipQueryValidation?oa(t):ra({text:null==t?void 0:t.query,domain:null==t?void 0:t.domain,apiKey:null==t?void 0:t.apiKey,token:null==t?void 0:t.token}).then((function(n){return function(t){return e(t,"data.data.replacements.length")>0}(n)?Promise.resolve(n):oa(t)})).catch((function(e){var t;return(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&console.error(e),Promise.reject(e)}))},la=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.queryID,n=e.groupBys,a=e.debug,o=e.test,r=e.domain,i=e.apiKey,l=e.token,s=e.orders,c=e.tableFilters,u=e.cancelToken,d=e.pageSize,p=void 0===d?100:d;if(!t)return console.error("No query ID supplied to drilldown function"),Promise.reject(new Error("Query ID not supplied"));if(!l||!r||!i)return console.error("Unauthenticated"),Promise.reject(new Error("Unauthenticated"));var f={translation:a?"include":"exclude",columns:n,filters:c,orders:s,test:o,page_size:p,date_format:"ISO8601"},g={headers:{Authorization:"Bearer ".concat(l)},cancelToken:u},v="".concat(r,"/autoql/api/v1/query/").concat(t,"/drilldown?key=").concat(i);return m.post(v,f,g).then((function(e){return Promise.resolve(e)})).catch($n)},sa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,o=t.apiKey,r=t.token;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!a||!o||!r)return Promise.reject(new Error("Unauthenticated"));var i="".concat(a,"/autoql/api/v1/query/autocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(o),l={headers:{Authorization:"Bearer ".concat(r)}};return m.get(i,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},ca=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,o=t.token,r=t.apiKey,i=t.cancelToken;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!a||!r||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/vlautocomplete?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(o)},cancelToken:i};return m.get(l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response.data"))}))},ua=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,o=t.domain;if(!o||!n||!a)return Promise.reject(new Error("Unauthenticated"));var r="".concat(o,"/autoql/api/v1/query/filter-locking?key=").concat(n),i={headers:{Authorization:"Bearer ".concat(a)}};return m.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},da=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,o=t.domain,r=t.filters;if(!o||!n||!a)return Promise.reject(new Error("Unauthenticated"));if(null==r||!r.length)return Promise.reject(new Error("No filters provided"));var i="".concat(o,"/autoql/api/v1/query/filter-locking?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}},s={columns:r};return m.put(i,s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},pa=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.keywords,a=t.pageSize,o=t.pageNumber,r=t.domain,i=t.apiKey,l=t.token,s=t.skipQueryValidation,c=n?n.split(" "):[],u="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i,"&search=").concat(encodeURIComponent(c),"&page_size=").concat(a,"&page=").concat(o,"&enable_history=false");if(!l||!r||!i)return Promise.reject(new Error("Unauthenticated"));var d={headers:{Authorization:"Bearer ".concat(l)}};return s?m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})):ra({text:n,domain:r,apiKey:i,token:l}).then((function(t){return e(t,"data.data.replacements.length")>0?Promise.resolve(t):m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})).catch((function(){return m.get(u,d).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}))},ma=function(e){return{name:e.keyword,alias_name:e.show_message,canonical:e.canonical}},fa=function(){var t=Nt(wt().mark((function t(){var n,a,o,r,i,l,s,c,u,d,p,f,g,v,h,y,b,C,E,S,T,D=arguments;return wt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=D.length>0&&void 0!==D[0]?D[0]:{},a=n.pageSize,o=n.pageNumber,r=n.domain,i=n.apiKey,l=n.token,s=n.text,c=n.context,u=n.selectedVL,d=n.userVLSelection,p=void 0===d?[]:d,f=n.skipQueryValidation,l&&r&&i){t.next=3;break}return t.abrupt("return",Promise.reject(new Error("Unauthenticated")));case 3:if(f){t.next=9;break}return t.next=6,ra({text:s,domain:r,apiKey:i,token:l});case 6:if(!((null==(y=t.sent)||null===(g=y.data)||void 0===g||null===(v=g.data)||void 0===v||null===(h=v.replacements)||void 0===h?void 0:h.length)>0)){t.next=9;break}return t.abrupt("return",Promise.resolve(y));case 9:return b="".concat(r,"/autoql/api/v1/query/related-queries?key=").concat(i),C={headers:{Authorization:"Bearer ".concat(l)}},E=[],u&&E.push(ma(u)),p&&(S=p.map((function(e){return ma(e)})),E=[].concat(zt(E),zt(S))),T={page:o,page_size:a,search_terms:s,context:c,value_label_info:E},t.abrupt("return",m.post(b,T,C).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))})));case 16:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ga=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.message,a=t.queryId,o=t.domain,r=t.apiKey,i=t.token;if(!a)return Promise.reject(new Error("No query ID supplied"));if(!i||!o||!r)return Promise.reject(new Error("Unauthenticated"));var l="".concat(o,"/autoql/api/v1/query/").concat(a,"?key=").concat(r),s={headers:{Authorization:"Bearer ".concat(i)}},c={is_correct:!1,message:n};return m.put(l,c,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},va=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"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)})),Ot(Bt(e),"onMouseDown",(function(){zn(),e.props.onTranscriptStart(),e.props.startListening()})),Ot(Bt(e),"render",(function(){var t,n=e.props;n.transcript,n.interimTranscript,n.resetTranscript;var a=n.browserSupportsSpeechRecognition;n.startListening;var o=n.stopListening,r=n.listening;return a?f.createElement(Kt,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:o,onMouseLeave:e.props.listening?o: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(bn,{type:"microphone"})),!e.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800})):null})),e}return Pt(n)}();Ot(va,"propTypes",{transcript:y.string,interimTranscript:y.string,finalTranscript:y.string,resetTranscript:y.func,browserSupportsSpeechRecognition:y.bool,startListening:y.func,stopListening:y.func,listening:y.bool,onTranscriptChange:y.func,onFinalTranscript:y.func,onTranscriptStart:y.func}),Ot(va,"defaultProps",{onTranscriptStart:function(){},onTranscriptChange:function(){},onFinalTranscript:function(){}});var ha=yt({autoStart:!1,continuous:!1})(va),ya={"accent-color":"#28a8e0","background-color-primary":"#F1F3F5","background-color-secondary":"#ffffff","background-color-tertiary":"#cccccc","background-color-disabled":"#ededed","background-color-disabled-dark":"#857d83","background-color-checkbox":"#ffffff","border-color":"#e6e6e6","hover-color":"#f6f7f9","text-color-primary":"#4f4f4f","text-color-accent":"#ffffff","text-color-placeholder":"#0000005e","dashboard-title-color":"#28a8e0","font-family":"sans-serif","highlight-color":"#000000","danger-color":"#ca0b00","warning-color":"#ffcc00","success-color":"#2aca4d","info-color":"#28a8e0","box-shadow-color":"#00000026","mask-color":"#0000000f"},ba={"accent-color":"#193a48","background-color-primary":"#20252A","background-color-secondary":"#3B3F46","background-color-tertiary":"#292929","background-color-disabled":"#5d6167","background-color-disabled-dark":"#857d83","border-color":"#53565c","hover-color":"#4a4f56","text-color-primary":"#ececec","text-color-accent":"#ffffff","text-color-placeholder":"#ffffff9c","dashboard-title-color":"#193a48","font-family":"sans-serif","highlight-color":"#ffffff","danger-color":"#ff584e","warning-color":"#ffcc00","success-color":"#2aca4d","info-color":"#28a8e0","box-shadow-color":"#00000066","mask-color":"#0000000f"},Ca={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},Ea=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(xt({},Ca),e)},Sa=function(e){return document.documentElement.style.getPropertyValue("--react-autoql-".concat(e))},Ta=function(){try{for(var e=[],t=[],n=0;n<100;){try{var a,o=Sa("chart-color-".concat(n)),r=null!==(a=Sa("chart-color-dark-".concat(n)))&&void 0!==a?a:o;if(!o)return{chartColors:e,chartColorsDark:t};e.push(o),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),[]}},Da=function(e,t){var n=function(e){var t=e;return"#"===t.slice(0,1)&&(t=t.slice(1)),3===t.length&&(t=t.split("").map((function(e){return e+e})).join("")),(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3}(e);t["text-color-accent"]=n>=140?"black":"white"},xa=function(e,t){var n=e||Ca.chartColors;Array.isArray(n)?n.length?n.forEach((function(e,n){t["chart-color-".concat(n)]=e;var a=function(e,t){var n=!1;"#"==e[0]&&(e=e.slice(1),n=!0);var a=parseInt(e,16),o=(a>>16)+t;o>255?o=255:o<0&&(o=0);var r=(a>>8&255)+t;r>255?r=255:r<0&&(r=0);var i=(255&a)+t;i>255?i=255:i<0&&(i=0);var l="000000"+(i|r<<8|o<<16).toString(16);return(n?"#":"")+l.substring(l.length-6)}(e,-10);t["chart-color-dark-".concat(n)]=a})):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=Ea(e),n=t.theme,a=t.textColor,o=t.fontFamily,r=t.chartColors,i=t.accentColor,l=t.accentTextColor,s=t.dashboardTitleColor,c=t.backgroundColorPrimary,u=t.backgroundColorSecondary,d="light"===n?ya:ba;for(var p in a&&(d["text-color-primary"]=a),l?d["text-color-accent"]=l:Da(i,d),o&&(d["font-family"]=o),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),xa(r,d),d)document.documentElement.style.setProperty("--react-autoql-".concat(p),d[p])},Ra=function(e){var t=f.forwardRef((function(t,n){var a=Mt({},(_t(t),t));return g((function(){!!Sa("accent-color")||wa()}),[]),f.createElement(e,Mt({ref:n},a))}));return t.displayName="ThemeProvider",t};var Aa=Ra((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))}));a.extend(i),a.extend(l),a.extend(s),a.extend(c),a.extend(u),a.extend(o),a.extend(p),a.extend(r),a.extend(d),function(){var e=window.navigator.language||"en",t=e.split("-")[0];try{require("dayjs/locale/".concat(e,".js")),a.locale(e)}catch(e){try{require("dayjs/locale/".concat(t,".js")),a.locale(t)}catch(e){}}}();var Na=function(e){try{var t=!1;return e&&(t=!!e.find((function(e){return e.groupable}))),t}catch(e){return console.error(e),!1}},ka=function(e){var t=null==e?void 0:e.type;return"DOLLAR_AMT"===t||"QUANTITY"===t||"PERCENT"===t||"RATIO"===t},Ia=function(e){var t=null==e?void 0:e.type;return"STRING"===t||"DATE_STRING"===t||"DATE"===t||"UNKNOWN"===t},Pa=function(e){try{return"DATE"===e.type||"DATE_STRING"===e.type}catch(e){return!1}},Oa=function(e,t){var n,a=[],o=[],r=[];e.forEach((function(e,t){var n=e.type;e.is_visible&&!e.pivot&&("DOLLAR_AMT"===n?a.push(t):"QUANTITY"===n?o.push(t):"PERCENT"!==n&&"RATIO"!==n||r.push(t))}));var i,l,s=[],c=[];return a.length?(n=a[0],s=a,l="currency"):o.length?(n=o[0],s=o,l="quantity"):r.length&&(n=r[0],s=r,l="ratio"),t||(s=n>=0?[n]:[],"currency"===l?o.length?i=o[0]:r.length?i=r[0]:a.length>1&&(i=a[1]):"quantity"===l?r.length?i=r[0]:o.length>1&&(i=o[1]):"ratio"===l&&o.length>1&&(i=r[1]),isNaN(i)||(c=i>=0?[i]:[])),{numberColumnIndex:n,numberColumnIndices:s,numberColumnIndices2:c,numberColumnIndex2:i,currencyColumnIndices:null!=a?a:[],currencyColumnIndex:a[0],quantityColumnIndices:null!=o?o:[],quantityColumnIndex:o[0],ratioColumnIndices:null!=r?r:[],ratioColumnIndex:r[0]}},Ma=function(e){if(e&&function(e){return!Na(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}))},La=function(e){return e.findIndex((function(e){return e.is_visible&&("DATE"===e.type||"DATE_STRING"===e.type)}))},qa=function(e,t){if(e){var n=[],a=Ma(e),o=La(e);e.forEach((function(e,t){(Ia(e)||e.groupable)&&t!==a&&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=n[0];if(t)l=(null===(i=e[o])||void 0===i?void 0:i.groupable)?o:e.findIndex((function(e){return e.groupable}));else o>=0?l=o:n[1]>=0&&(l=n[1]);return{stringColumnIndex:l,stringColumnIndices:n}}},Va=function(e){var t=0,n=0;return e.forEach((function(e){ka(e)&&e.is_visible?n+=1:Ia(e)&&e.is_visible&&(t+=1)})),{amountOfNumberColumns:n,amountOfStringColumns:t}},_a={dataFormatting:Xt,data:y.arrayOf(y.array).isRequired,columns:y.arrayOf(y.shape({})).isRequired,numberColumnIndices:y.arrayOf(y.number).isRequired,stringColumnIndices:y.arrayOf(y.number).isRequired,stringColumnIndex:y.number.isRequired,numberColumnIndex:y.number.isRequired,legendColumnIndex:y.number,enableDynamicCharting:y.bool,isResizing:y.bool,onLegendClick:y.func,onLabelChange:y.func,onXAxisClick:y.func,onYAxisClick:y.func},Fa={dataFormatting:Kn,enableDynamicCharting:!0,legendColumnIndex:void 0,isResizing:!1,onLegendClick:function(){},onXAxisClick:function(){},onYAxisClick:function(){},onLabelChange:function(){}},Ba=xt(xt({},_a),{},{visibleSeriesIndices:y.arrayOf(y.number).isRequired,height:y.number.isRequired,width:y.number.isRequired,deltaX:y.number,deltaY:y.number}),Ha=xt(xt({},Fa),{},{deltaX:0,deltaY:0}),Qa=xt(xt({},Ba),{},{xScale:y.func.isRequired,yScale:y.func.isRequired,hasRightLegend:y.bool,hasBottomLegend:y.bool,innerHeight:y.number,innerWidth:y.number,onLabelRotation:y.func}),za=xt(xt({},Ha),{},{hasRightLegend:!1,hasBottomLegend:!1,innerHeight:0,innerWidth:0,onLabelRotation:function(){}}),Ua=xt(xt({},Ba),{},{xScale:y.func.isRequired,yScale:y.func.isRequired}),ja={activeKey:void 0,onChartClick:function(){}},Ka=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],a=t[(null==t?void 0:t.length)-1];return e(n>0&&a>0?n:n<0&&a<0?a:0)},Ya=function(e,t){return"".concat(e,"-").concat(t)},Wa=function(e){var t=e.row,n=e.columns,a=e.colIndex,o=e.stringColumnIndex,r=e.legendColumn,i=e.dataFormatting;try{var l,s,c,u,d,p,m=n[o],f=n[a],g=null!==(l=m.tooltipTitle)&&void 0!==l?l:m.title,v=f.origColumn?null!==(s=f.origColumn.tooltipTitle)&&void 0!==s?s:f.origColumn.title:null!==(c=f.tooltipTitle)&&void 0!==c?c:f.title,h=null===(u=Hn.find((function(e){return e.value===f.aggType})))||void 0===u?void 0:u.displayName;h&&(v="".concat(v," (").concat(h,")"));var y=To({element:t[o],column:m,config:i,isChart:!0}),b=To({element:t[a]||0,column:n[a],config:i,isChart:!0}),C=n[a],E=r&&null!=C&&C.origColumn?"<div><strong>".concat(null!==(d=r.tooltipTitle)&&void 0!==d?d:r.title,":</strong> ").concat(null!==(p=C.tooltipTitle)&&void 0!==p?p:C.title,"</div>"):"",S="<div><strong>".concat(g,":</strong> ").concat(y,"</div>"),T="<div><strong>".concat(v,":</strong> ").concat(b,"</div>");return"<div>\n ".concat(E,"\n ").concat(S,"\n ").concat(T,"\n </div>")}catch(e){return console.error(e),null}},Ga=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];try{if(n.length<1)return[];var a=n.map((function(t){return e[t]})),o=a.every((function(e){return e.aggType===a[0].aggType})),r=n.map((function(n,a){var r=e[n],i=r.title;if(!o){var l,s=null===(l=Hn.find((function(e){return e.value===(null==r?void 0:r.aggType)})))||void 0===l?void 0:l.displayName;s&&(i="".concat(i," (").concat(s,")"))}return{label:i,color:t(n),hidden:r.isSeriesHidden,columnIndex:n,column:r}}));return r}catch(e){return console.error(e),[]}},Xa=function(e){try{var t=Number(e);return isNaN(t)?0:t}catch(e){return console.error(e),0}},Ja=function(e){if("object"===Rt(e))return Object.keys(e).length},Za=function(e){var t=Ja(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=zt(Object.values(e)).filter((function(e){return!isNaN(Number(e))}));n=Math.max.apply(Math,zt(a))}return n},$a=function(e){var t=Ja(e),n=0;if(1===t)n=e[Object.keys(e)[0]];else if(t>1){var a=zt(Object.values(e)).filter((function(e){return!isNaN(Number(e))}));n=Math.min.apply(Math,zt(a))}return n},eo=function(e,t,n,a,o){if(a)return function(e,t,n,a){var o={},r={};e.forEach((function(e){var a=e[t];n.forEach((function(t){var n=e[t],i=Number(n);isNaN(i)&&(i=0),i>=0?o[a]?o[a]+=i:o[a]=i:i<0&&(r[a]?r[a]-=i:r[a]=i)}))}));var i=Za(o),l=$a(r);return(!a||i>0&&l<0||i/l>1e3)&&(i>0&&l>0?l=0:i<0&&l<0&&(i=0)),{maxValue:i,minValue:l}}(e,o,t,n);try{var r=[],i=[];t.forEach((function(t,n){r.push(Fe(e,(function(e){return Xa(e[t])}))),i.push(Be(e,(function(e){return Xa(e[t])})))}));var l=Fe(r),s=Be(i);return l===s&&(s>0?s=0:l<0&&(l=0)),(!n||l>0&&s<0||l/s>1e3)&&(l>0&&s>0?s=0:l<0&&s<0&&(l=0)),{minValue:s,maxValue:l}}catch(e){return console.error(e),{minValue:0,maxValue:0}}},to=function(e,t){var n,a;if("x"===t)(a=(n=0)+e.width)<n&&(a=n);else if("y"===t){(n=e.height)<(a=0)&&(n=a)}return[n,a]},no=function(e){var t,n,a,o=e.props,r=e.columnIndex,i=e.axis,l=e.outerPadding,s=void 0===l?.5:l,c=e.innerPadding,u=void 0===c?.2:c,d=e.domain,p=to(o,i),m=null!=d?d:o.data.map((function(e){return e[r]})),f=null===(t=o.stringColumnIndices)||void 0===t?void 0:t.map((function(e){return o.columns[e]})),g=qe().domain(m).range(p).paddingInner(u).paddingOuter(s);return g.type="BAND",g.dataFormatting=o.dataFormatting,g.column=o.columns[r],g.title=null===(n=g.column)||void 0===n?void 0:n.display_name,g.fields=f,g.tickSize=g.bandwidth(),g.hasDropdown=o.enableAxisDropdown&&(null===(a=o.stringColumnIndices)||void 0===a?void 0:a.length)>1,g.getValue=function(e){return g(e)},g.tickLabels=co({scale:g,props:o,initialTicks:m,innerPadding:u,outerPadding:s}),g},ao=function(e){var t=e.numberColumns;e.dataFormatting;try{if(null==t||!t.length)return;var n="Amount";!t.find((function(e){return e.display_name!==t[0].display_name}))&&(n=t[0].display_name);var a=t.map((function(e){return e.aggType}));if(!a.find((function(e){return e!==a[0]}))){var o,r=null===(o=Hn.find((function(e){return e.value===a[0]})))||void 0===o?void 0:o.displayName;r&&(n="".concat(n," (").concat(r,")"))}return n}catch(e){return console.error(e),title}},oo=function(e){var t=e.map((function(e){return function(e){var t,n;e.aggType&&(t=null===(n=Hn.find((function(t){return t.value===e.aggType})))||void 0===n?void 0:n.unit);switch(t){case"none":return"none"}return e.type===wn.CURRENCY?"currency":e.type===wn.QUANTITY||e.type===wn.RATIO?"none":e.type===wn.PERCENT?"percent":void 0}(e)}));return!t.find((function(e){return e!==t[0]}))?t[0]:"none"},ro=function(e){var t,n=e.props,a=e.minValue,o=e.maxValue,r=e.axis,i=e.range,l=e.tickValues,s=e.numTicks,c=e.stacked,u=e.isScaled,d=e.columnIndex,p=e.columnIndices,m=null!=a?a:null==l?void 0:l[0],f=null!=o?o:null==l?void 0:l[(null==l?void 0:l.length)-1];isNaN(m)&&(m=0),isNaN(f)&&(f=m);var g=[m,f],v=null!=i?i:to(n,r),h=null!==(t=null==p?void 0:p.map((function(e){return n.columns[e]})))&&void 0!==t?t:[],y=oo(h),b=ao({numberColumns:h,dataFormatting:n.dataFormatting}),C=Ve().domain(g).range(v);return C.minValue=m,C.maxValue=f,C.column=n.columns[d],C.fields=h,C.dataFormatting=n.dataFormatting,C.hasDropdown=n.enableAxisDropdown,C.stacked=!!c,C.type="LINEAR",C.units=y,C.title=b,C.tickSize=0,C.isScaled=u,C.getValue=function(e){return C(e)},C.tickLabels=null!=l?l:co({props:n,scale:C,numTicks:s,isScaled:u}),C},io=function(e){var t,n,a=e.props,o=e.columnIndices1,r=void 0===o?[]:o,i=e.columnIndices2,l=void 0===i?[]:i,s=e.axis,c=e.stacked,u=e.isScaled,d=eo(a.data,r,u,c,a.stringColumnIndex),p=d.minValue,m=d.maxValue,f=ro({props:a,minValue:p,maxValue:m,axis:s,stacked:c,isScaled:u,columnIndex:r[0],columnIndices:r});if(null==l||!l.length)return{scale:f};var g=eo(a.data,l,u,c,a.stringColumnIndex),v=g.minValue,h=g.maxValue,y=ro({props:a,minValue:v,maxValue:h,range:f.range(),numTicks:null!==(t=null===(n=f.tickLabels)||void 0===n?void 0:n.length)&&void 0!==t?t:void 0,stacked:c,isScaled:u,columnIndex:l[0],columnIndices:l}),b=f.tickLabels||[],C=y.tickLabels||[],E=b.length,S=C.length,T=zt(b),D=zt(C);if(E===S);else if(S<E)for(var x=E-S,w=C[1]-C[0],R=C[S-1],A=0;A<x;A++){var N=R+A*w;D.push(N)}else if(S>E)for(var k=S-E,I=b[1]-b[0],P=b[E-1],O=1;O<=k;O++){var M=P+O*I;T.push(M)}var L=ro({props:a,axis:s,tickValues:T,stacked:c,isScaled:u,columnIndex:r[0],columnIndices:r}),q=ro({props:a,range:L.range(),tickValues:D,stacked:c,isScaled:u,columnIndex:l[0],columnIndices:l});return{scale:L,scale2:q}},lo=function(e,t,n){if(null!=e&&e.getTime)return t&&"start"===n?a(e).utc().startOf(t).valueOf():t&&"end"===n?a(e).utc().endOf(t).valueOf():e.getTime()},so=function(e){var t=new Date(e);return t.setTime(t.getTime()+60*t.getTimezoneOffset()*1e3),t},co=function(e){var t=e.scale,n=e.initialTicks,a=e.props,o=e.numTicks,r=e.innerPadding,i=e.outerPadding;try{var l,s,c,u,d=t.tickLabels;n?d=zt(n):"function"==typeof(null==t?void 0:t.ticks)&&(d=t.ticks(o));var p=function(e){var t,n,a,o,r=e.scale,i=e.numTicks,l=e.innerPadding,s=void 0===l?.2:l,c=e.outerPadding,u=void 0===c?.5:c,d=null!==(t=null==r||null===(n=r.range())||void 0===n?void 0:n[1])&&void 0!==t?t:0,p=null!==(a=null==r||null===(o=r.range())||void 0===o?void 0:o[0])&&void 0!==a?a:0,m=Math.abs(p-d)+12;if("BAND"!==r.type)return m/i;var f=m/(2*u+i+(i+1)*s);return f+s*f}({scale:t,numTicks:null===(l=d)||void 0===l?void 0:l.length,innerPadding:r,outerPadding:i});if(!d)return void console.error("Unable to set tick labels for scale. tickValues is undefined");var m=(null!==(s=Math.abs((null==t||null===(c=t.range())||void 0===c?void 0:c[1])-(null==t||null===(u=t.range())||void 0===u?void 0:u[0])))&&void 0!==s?s:1)+12,f=Math.ceil(20*d.length/m),g=zt(d);return p<20&&(g=[],d.forEach((function(e,t){t%f==0&&g.push(e)}))),"LINEAR"===(null==t?void 0:t.type)?function(e){var t=e.tickValues,n=e.scale,a=n.minValue,o=n.maxValue;if(void 0===a||void 0===o)return console.warn("Tried to make nice labels but max/min values were not provided"),t;if((null==t?void 0:t.length)<2)return t;var r=zt(t);try{var i=t[0],l=t[t.length-1],s=Math.abs(t[1]-t[0]),c=i,u=l;a<i&&(c=i-s,r.unshift(c)),o>l&&(u=l+s,r.push(u)),n.domain([r[0],r[r.length-1]])}catch(e){console.error(e)}return r}({tickValues:g,scale:t,props:a}):"TIME"===(null==t?void 0:t.type)?function(e){var t=e.tickValues,n=e.scale;try{var a;if((null==t?void 0:t.length)<2)return t;var o=n.minValue,r=n.maxValue;if(void 0===o||void 0===r)throw new Error("Tried to make nice labels but max/min values were not provided");var i=lo(o),l=lo(r);if(!i||!l)throw new Error("Tried to make nice labels but could not convert min and max dates to epoch");var s=zt(t),c=lo(t[1])-lo(t[0]),u=Bn[null==n||null===(a=n.column)||void 0===a?void 0:a.precision],d=lo(t[0],u,"start"),p=lo(t[t.length-1],u,"end");if(!c||isNaN(d)||isNaN(p))throw new Error("Tried to make nice labels but could not convert tick values to epoch");var m=d,f=p;return i<d&&(m=d-c,s.unshift(so(m))),l>p&&(f=p+c,s.push(so(f))),n.domain([so(s[0]),so(s[s.length-1])]),s}catch(e){return console.error(e),t}}({tickValues:g,scale:t,props:a}):g}catch(e){console.error(e)}return n||[]},uo=function(e){var t=e.filter((function(e){return!!e}));if(null!=t&&t.length)try{var n,a,o,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;isNaN(t)||isNaN(i)||isNaN(l)||isNaN(s)||((void 0===n||t<n)&&(n=t),(void 0===a||i>a)&&(a=i),(void 0===o||l>o)&&(o=l),(void 0===r||s<r)&&(r=s))})),{x:n,y:r,height:Math.abs(a-r),width:Math.abs(o-n)}}catch(e){return void console.error(e)}},po=function(e,t,n){return n.indexOf(e)===t},mo=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=[],o=0;o<t;o++){a[o]=[];for(var r=0;r<e;r++)a[o][r]=n}return a},fo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Eo(e)?ho(e,t,n):vo(e,t,n)},go=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?yo(e,t):bo(e,n)},vo=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 o=t.precision,r=n.dayMonthYearFormat||Kn.dayMonthYearFormat,i=a.utc(e).utc();if(!i.isValid())return e;var l=i.format(r);try{switch(o){case In:break;case Mn: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 Pn:var p=n.monthYearFormat||Kn.monthYearFormat;l=i.format(p);break;case Ln:var m=i.quarter(),f=i.format("YYYY");l="".concat(f,"-Q").concat(m);break;case On:l=i.format("YYYY");break;case qn:l=i.format("".concat(r," h:00A"));break;case Vn:l=i.format("".concat(r," h:mmA"))}return l}catch(e){console.error(e)}}},ho=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 o,r=n.monthYearFormat,i=n.dayMonthYearFormat,l="YYYY",s=r||Kn.monthYearFormat,c=i||Kn.dayMonthYearFormat,u=t.title;if(!(o=isNaN(parseFloat(e))?a.utc(e).utc():a.unix(e).utc()).isValid())return e;var d=o.format(c);return isNaN(parseFloat(e))?(u&&u.toLowerCase().includes("year")?d=o.format(l):u&&u.toLowerCase().includes("month")&&(d=o.format(s)),d=o.format(c)):u&&u.toLowerCase().includes("year")?d=o.format(l):u&&u.toLowerCase().includes("month")&&(d=o.format(s)),d}catch(t){return console.error(t),e}},yo=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 a=e,o=Number(e);switch(n){case"NUM_1_MON":var r=o-1;r>=0?a=An[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=o-1;i>=0?a=Nn[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":o>=0?a=An[o]: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":o>=0?a=Nn[o]: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=An.find((function(t){return t.toLowerCase().includes(e.toLowerCase())}));l?a=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 a}(e,t);break;case"HOUR":var o=a.utc(e,"THH:mm:ss.SSSZ").utc();o.isValid()&&(n=o.format("h:00A"));break;case"MINUTE":var r=a.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}}},bo=function(t,n){if(t){if(t&&"string"==typeof t){var o,r,i=t.split("-"),l=e(i,"[0]"),s=e(i,"[2]");e(i,"[1]","").includes("W")?r=e(i,"[1]"):o=e(i,"[1]");var c=n.monthYearFormat,u=n.dayMonthYearFormat,d=c||Kn.monthYearFormat,p=u||Kn.dayMonthYearFormat,m=a.utc(t).utc();if(!m.isValid())return t;var f=t;return s?f=m.format(p):o?f=m.format(d):r||l&&(f=l),f}return t}},Co=function(e){var t,n=e.d,a=e.scale,o=e.column,r=e.dataFormatting,i=e.maxLabelWidth,l=void 0===i?20:i;if(null===n)return{fullWidthLabel:"Untitled Category",formattedLabel:"Untitled Category"};var s=null!=o?o:null==a?void 0:a.column;if(!s||!s.type)return{fullWidthLabel:n,formattedLabel:n};var c=null!==(t=null!=r?r:null==a?void 0:a.dataFormatting)&&void 0!==t?t:Gn(),u=c.currencyCode,d=c.languageCode,p=s.type;"none"===(null==a?void 0:a.units)&&(p="QUANTITY");var m=n;switch(p){case"STRING":break;case"DOLLAR_AMT":if(Number(n)||0===Number(n)){var f=u||"USD";try{m=new Intl.NumberFormat(d,{style:"currency",currency:"".concat(f),minimumFractionDigits:0,maximumFractionDigits:0}).format(n)}catch(e){console.error(e),m=new Intl.NumberFormat(d,{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(n)}}break;case"QUANTITY":isNaN(parseFloat(n))||(m=new Intl.NumberFormat(d).format(n));break;case"DATE":var g="TIME"===(null==a?void 0:a.type);m=fo(n,s,c,g);break;case"DATE_STRING":m=go(n,s,c,a);break;case"PERCENT":if(Number(n)){var v=Number(n)/100;m=new Intl.NumberFormat(d,{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(v)}}var h=m;return"string"==typeof m&&m.length>l&&(m="".concat(m.substring(0,l),"...")),{fullWidthLabel:h,formattedLabel:m}},Eo=function(e){return/^\d+$/.test(e)},So=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 a.utc(e,"THH:mm:ss.SSSZ").utc();case"MONTH":default:return}}catch(e){return void console.error(e)}}(t,n):Eo(t)?a.unix(t).utc():a.utc(t).utc()},To=function(e){var t=e.element,n=e.column,a=e.config,o=void 0===a?{}:a,r=e.htmlElement,i=e.isChart;try{var l=t,s=o.currencyCode,c=o.languageCode,u=o.currencyDecimals,d=o.quantityDecimals,p=null==n?void 0:n.type;if(i&&["count","deviation","variance"].includes(null==n?void 0:n.aggType)&&(p="QUANTITY"),n)switch(p){case"STRING":break;case"DOLLAR_AMT":if(!isNaN(parseFloat(t))){var m=s||"USD",f=u||0===u?u:void 0;try{l=new Intl.NumberFormat(c,{style:"currency",currency:"".concat(m),minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}catch(e){console.error(e),l=new Intl.NumberFormat(c,{style:"currency",currency:"USD",minimumFractionDigits:f,maximumFractionDigits:f}).format(t)}}break;case"QUANTITY":var g=d||0===d?d:1;if(!isNaN(parseFloat(t))){var v=parseFloat(t)%1!=0?g:0;l=new Intl.NumberFormat(c,{minimumFractionDigits:v,maximumFractionDigits:v}).format(t)}break;case"DATE":l=fo(t,n,o);break;case"DATE_STRING":l=go(t,n,o);break;case"RATIO":isNaN(parseFloat(t))||(l=new Intl.NumberFormat(c,{minimumFractionDigits:4,maximumFractionDigits:4}).format(t));break;case"PERCENT":if(!isNaN(parseFloat(t))){var h=parseFloat(t)/100;l=new Intl.NumberFormat(c,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).format(h),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}},Do=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,"+n}catch(e){return}},xo=function(e){if(e&&e.getBBox)return e.getBBox()},wo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return new Promise((function(a,o){try{var r=Do(e),i=e.getBoundingClientRect(),l=2*i.width,s=2*i.height,c=document.createElement("canvas");c.width=l+t,c.height=s+t;var u=c.getContext("2d"),d=new Image;d.onload=function(){if(u.drawImage(this,t,t,l,s),n){var e=document.createElement("canvas");e.width=c.width,e.height=c.height;var o=e.getContext("2d");o.save(),o.fillStyle=n,o.fillRect(0,0,c.width,c.height),o.strokeRect(0,0,c.width,c.height),o.restore(),o.drawImage(c,0,0),c=e}a(c.toDataURL("image/png",1))},d.onerror=function(){o("failed to load image")},d.src=r}catch(e){console.error(e),o("failed to convert svg to png "+e)}}))},Ro=function(e){var t=0;return e&&e.forEach((function(e){e.groupable&&(t+=1)})),t},Ao=function(e){var t=[];return e&&e.forEach((function(e,n){e.groupable&&t.push(n)})),t},No=function(e){return Sn.includes(e)},ko=function(e){return En.includes(e)},Io=function(e){var t,n=e.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),a=e[n];return a&&(null==a||null===(t=a.display_name)||void 0===t?void 0:t.toLowerCase().includes("month"))&&2===(null==e?void 0:e.length)},Po=function(e,t,n){var a,o,r,i,l,s;if(t<=1)return!1;var c=Ao(e);if(!(2===(null==c?void 0:c.length)))return!1;var u=Lo(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!==(a=null==n?void 0:n.map((function(e){return e[c[0]]})))&&void 0!==a?a:[],f=null!==(o=null==n?void 0:n.map((function(e){return e[c[1]]})))&&void 0!==o?o:[],g=null!==(r=null==m||null===(i=m.filter(po))||void 0===i?void 0:i.length)&&void 0!==r?r:0,v=null!==(l=null==f||null===(s=f.filter(po))||void 0===s?void 0:s.length)&&void 0!==l?l:0;return g>20&&v>20?(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):Pa(d)&&v>20?(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The legend would have ".concat(v," fields")),!1):!(Pa(p)&&g>20)||(console.debug("Info: Pivot table will not be supported since there are too many unique fields. The legend would have ".concat(g," fields")),!1)},Oo=function(e){var t,n=!(null===(t=e.filter((function(e){return Pa(e)})))||void 0===t||!t.length);return n},Mo=function(e,t){if(t<=1)return!1;var n=Va(e),a=n.amountOfNumberColumns,o=n.amountOfStringColumns;return a>0&&o>0},Lo=function(e){return t(e,(function(e){return e.is_visible}))},qo=function(e){var n=null==e?void 0:e.length,a=function(e){return t(e,(function(e){return!e.is_visible}))}(e);return n&&!!a.length},Vo=function(e){var t=Lo(e);return(null==e?void 0:e.length)&&!t.length},_o=function(t){return!!t&&(1===e(t,"data.data.rows.length")&&1===e(t,"data.data.rows[0].length"))},Fo=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.response,a=t.columns,o=t.dataLength,r=t.pivotDataLength,i=t.isDataLimited;try{var l,s,c,u,d,p,m,f,g;if(null==n||null===(l=n.data)||void 0===l||null===(s=l.data)||void 0===s||!s.display_type)return[];var v=n.data.data.display_type;if("suggestion"===v||"help"===v||"html"===v)return[v];var h=null!==(c=null==n||null===(u=n.data)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.rows)&&void 0!==c?c:[],y=a||(null==n||null===(p=n.data)||void 0===p||null===(m=p.data)||void 0===m?void 0:m.columns),b=Lo(y);if(null==b||!b.length)return["text"];if(null==h||!h.length)return["table"];if(_o(n))return["single-value"];var C=10,E=null!=o?o:h.length,S=!0,T=null!=r;if(T&&(S=!!r),Po(b,E,null==n||null===(f=n.data)||void 0===f||null===(g=f.data)||void 0===g?void 0:g.rows)){var D=["table"];return i||D.push("pivot_table"),S&&(D.push("stacked_column","stacked_bar","column","bar","bubble","heatmap"),Oo(b)&&D.push("stacked_line","line")),D}if(Mo(b,E)){var x=["table","column","bar"];Oo(b)&&x.push("line"),E>1&&E<=C&&x.push("pie");var w=Va(b),R=w.amountOfNumberColumns;if(R>1&&x.push("column_line"),!i&&Io(b)){var A=b.findIndex((function(e){return"DATE"===e.type||"DATE_STRING"===e.type})),N=b[A],k=e(n,"data.data.rows"),I=[];k.forEach((function(e){var t=To({element:e[A],column:N,config:{monthYearFormat:"YYYY",dayMonthYearFormat:"YYYY"}});I.includes(t)||I.push(t)})),I.length>1&&x.push("pivot_table")}return x}return["table"]}catch(e){return console.error(e),["table"]}},Bo=function(e,t,n,a,o,r){var i,l,s=Fo({response:e,columns:null!=o?o:null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.columns,dataLength:n,pivotDataLength:a,isDataLimited:r});return t&&s.includes(t)},Ho=function(e,t){var n=e.find((function(e){return No(e)}));return n||t},Qo=function(t,n,a,o,r,i,l){var s,c,u=Fo({response:t,columns:null!=a?a:null==t||null===(s=t.data)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.columns,dataLength:o,pivotDataLength:r,isDataLimited:l});if(i&&u.includes(i))return i;var d=e(t,"data.data.display_type");if(u.includes(i))return i;if("suggestion"===d||"help"===d||"html"===d)return d;if(1===u.length)return u[0];if(u.includes("pivot_table")){var p="pivot_table";return n&&(p=Na(e(t,"data.data.columns"))?Ho(u,"pivot_table"):"pivot_table"),p}if(!d&&function(t){return!!t&&(e(t,"data.data.rows.length")&&e(t,"data.data.rows.length"))}(t)||"data"===d){var m="table";return n&&(m=Na(e(t,"data.data.columns"))?Ho(u,"table"):"table"),m}return"text"},zo=function(e,t){return Object.keys(e).find((function(n){return e[n]===t}))},Uo=function(e){var t=e;try{t=e.charAt(0).toUpperCase()+e.slice(1)}catch(e){console.error(e)}return t},jo=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)}},Ko=function(e,t){if(e.includes("-W")){var n=e.substring(0,4),a=t.substring(0,4);return n!==a?n-a:e.substring(6,8)-t.substring(6,8)}if(An.includes(e.trim())){var o=An.findIndex((function(t){return t.toLowerCase().includes(e.trim().toLowerCase())})),r=An.findIndex((function(e){return e.toLowerCase().includes(t.trim().toLowerCase())})),i=e-t;return o>=0&&r>=0&&(i=o-r),i}if(xn.includes(e.trim())){var l=xn.findIndex((function(t){return t===e.trim()})),s=xn.findIndex((function(e){return e===t.trim()}));return l>=0&&s>=0?s-l:e-t}if(kn.includes(e.substr(0,2))){var c=kn.findIndex((function(t){return t===e.substr(0,2)})),u=kn.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},Yo=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(n.precision){case"DOW":var o,r=null!==(o=n.dow_style)&&void 0!==o?o:"ALPHA_MON",i=An.findIndex((function(t){return t.toLowerCase().includes(e.toLowerCase())})),l=An.findIndex((function(e){return e.toLowerCase().includes(t.toLowerCase())}));return"ALPHA_SUN"===r&&(i=Nn.findIndex((function(t){return t.toLowerCase().includes(e.toLowerCase())})),l=Nn.findIndex((function(e){return e.toLowerCase().includes(t.toLowerCase())}))),i-l;case"HOUR":case"MINUTE":var s=a.utc(e,"THH:mm:ss.SSSZ").utc(),c=a.utc(t,"THH:mm:ss.SSSZ").utc();return s.unix()-c.unix();case"MONTH":var u=xn.findIndex((function(t){return t.toLowerCase()===e.trim().toLowerCase()})),d=xn.findIndex((function(e){return e.toLowerCase()===t.trim().toLowerCase()}));return u-d;default:return Ko(e,t)}return e-t},Wo=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=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?Yo(e,t,n):a.utc(e).unix()-a.utc(t).unix()),o&&"DOW"===n.precision&&(l*=-1),l}catch(e){return console.error(e),-1}},Go=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desc",a=arguments.length>3?arguments[3]:void 0;try{if(!e||"object"!==Rt(e))throw new Error("Could not sort data by date - no data supplied");var o=La(t),r=t[o];if(o>=0){var i="desc"===n?-1:1,l=zt(e).sort((function(e,t){return i*Wo(e[o],t[o],r,a)}));return l}}catch(e){console.error(e)}return e},Xo=function(e){var t=e.text,n=void 0===t?"":t,a=e.inputRef,o=e.callback,r=void 0===o?function(){}:o,i=e.totalAnimationTime,l=void 0===i?1e3:i;return n.length&&a&&"string"==typeof n?new Promise((function(e){for(var t=Math.round(l/n.length),o=function(o){setTimeout((function(){a.value=n.slice(0,o),o===n.length&&setTimeout((function(){r(),e()}),300)}),o*t)},i=1;i<=n.length;i++)o(i)})):Promise.resolve()},Jo=function(){return new Promise((function(e){setTimeout(e,0)}))},Zo=function(e){return"object"===Rt(e)&&!Array.isArray(e)&&null!=e},$o=function(e,t){var a=n(e,t);if(a)return!0;var o=Zo(e),r=Zo(t);if(!o||!r)return a;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},er=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,document.addEventListener("keydown",o.onEscKeypress)})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){return(!o.props.isResizing||!e.isResizing)&&(!$o(o.props,e)||!$o(o.state,t))})),Ot(Bt(o),"componentDidUpdate",(function(e){o.props.inputValue!==e.inputValue&&o.setState({inputValue:o.props.inputValue})})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.autoCompleteTimer),clearTimeout(o.queryValidationTimer),clearTimeout(o.caretMoveTimeout),document.removeEventListener("keydown",o.onEscKeypress)})),Ot(Bt(o),"onEscKeypress",(function(e){"Escape"===e.key&&(!(e.ctrlKey||e.altKey||e.shiftKey)&&o.cancelQuery())})),Ot(Bt(o),"animateInputTextAndSubmit",(function(e){var t=e.query,n=e.userSelection,a=e.source,r=e.skipQueryValidation;Xo({text:t,inputRef:o.inputRef,callback:function(){o.submitQuery({queryText:t,userSelection:n,skipQueryValidation:null==r||r,source:a})}})})),Ot(Bt(o),"submitDprQuery",(function(e){var t,n;(function(e){var t,n=e.query,a=e.dprKey,o=e.dprDomain,r=e.sessionId,i="".concat(o||"https://autoae-api-staging.chata.io","/api/v1/query?key=").concat(a),l={query:n};r||console.warn("No session ID was supplied to DPR. Using a randomly generated UUID instead");var s={headers:(t={},Ot(t,"AutoAE-Referer-URL",window.location.origin),Ot(t,"AutoAE-Session-ID",r||b()),t)};return m.post(i,l,s)})({dprKey:null===(t=o.props.authentication)||void 0===t?void 0:t.dprKey,dprDomain:null===(n=o.props.authentication)||void 0===n?void 0:n.dprDomain,query:e,sessionId:o.props.sessionId}).then((function(t){return o.onResponse(t,e)})).catch((function(t){console.error(t),o.onResponse(t,e)}))})),Ot(Bt(o),"onResponse",(function(e,t){var n;o.props.onResponseCallback(e,t);var a={isQueryRunning:!1,suggestions:[],lastQuery:t||(null===(n=o.state)||void 0===n?void 0:n.lastQuery)};o._isMounted&&o.setState(a)})),Ot(Bt(o),"cancelQuery",(function(){var e;null===(e=o.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(o),"submitQuery",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryText,a=t.userSelection,r=t.skipQueryValidation,i=t.source,l=n||o.state.inputValue;if(l){o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer);var s={isQueryRunning:!0,suggestions:[],queryValidationResponse:void 0,queryValidationComponentId:b()};o.props.clearQueryOnSubmit&&(s.inputValue=""),o._isMounted&&o.setState(s);var c=o.props.source;null!=i&&i.length?c=[].concat(zt(o.props.source),zt(i)):i&&c.push("user"),o.axiosSource=null===(e=m.CancelToken)||void 0===e?void 0:e.source();var u,d,p=xt(xt(xt({query:l,userSelection:a},Wn(o.props.authentication)),Xn(o.props.autoQLConfig)),{},{source:c,AutoAEId:o.props.AutoAEId,filters:o.props.queryFilters,pageSize:o.props.dataPageSize,cancelToken:o.axiosSource.token});if(l.trim())o.props.onSubmit(l),localStorage.setItem("inputValue",l),null!==(u=o.props.authentication)&&void 0!==u&&u.token||null===(d=o.props.authentication)||void 0===d||!d.dprKey?r?oa(p).then((function(e){return o.onResponse(e,l)})).catch((function(e){var t=e||{error:Yt.GENERAL_QUERY};o.onResponse(t,l)})):ia(p).then((function(e){return o.onResponse(e,l)})).catch((function(e){var t=e||{error:Yt.GENERAL_QUERY};o.onResponse(t,l)})):o.submitDprQuery(l)}})),Ot(Bt(o),"onTranscriptStart",(function(){o.setState({listeningForTranscript:!0})})),Ot(Bt(o),"onTranscriptChange",(function(e){o.setState({inputValue:e})})),Ot(Bt(o),"onFinalTranscript",(function(e){o.setState({inputValue:e,listeningForTranscript:!1},(function(){o.focus(),zn()}))})),Ot(Bt(o),"setInputRef",(function(e){o.inputRef=e})),Ot(Bt(o),"onKeyDown",(function(t){if("ArrowUp"!==t.key||e(o.state.suggestions,"length")){if(o.userSelectedSuggestion&&("ArrowUp"===t.key||"ArrowDown"===t.key))return t}else{var n=localStorage.getItem("inputValue");n&&"undefined"!==n&&o.setState({inputValue:n},o.moveCaretAtEnd)}return t})),Ot(Bt(o),"onKeyPress",(function(e){"Enter"==e.key&&o.submitQuery()})),Ot(Bt(o),"focus",(function(){var e;null!==(e=o.inputRef)&&void 0!==e&&e.focus&&o.inputRef.focus()})),Ot(Bt(o),"userSelectedSuggestionHandler",(function(e){e&&e.name&&o._isMounted&&(o.userSelectedValue=e.name,o.userSelectedSuggestion=!0,o.setState({inputValue:e.name}))})),Ot(Bt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){sa(xt({suggestion:n},Wn(o.props.authentication))).then((function(t){var n,a=e(t,"data.data"),r=[];o.autoCompleteArray=[],n=a.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]};o.autoCompleteArray.push(s)}o.setState({suggestions:o.autoCompleteArray})})).catch((function(e){console.error(e)}))}),300)})),Ot(Bt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),Ot(Bt(o),"onInputChange",(function(e){o.state.listeningForTranscript?e.stopPropagation():Xn(o.props.autoQLConfig).enableAutocomplete?(!o.userSelectedSuggestion||38!==e.keyCode&&40!==e.keyCode)&&(e&&e.target&&(e.target.value||""===e.target.value)?o.setState({inputValue:e.target.value}):o.submitQuery({queryText:o.userSelectedValue}),o.props.isBackButtonClicked&&o.setState({inputValue:""})):o.setState({inputValue:e.target.value})})),Ot(Bt(o),"moveCaretAtEnd",(function(e){clearTimeout(o.caretMoveTimeout),o.caretMoveTimeout=setTimeout((function(){try{var e,t,n,a=null===(e=o.inputRef)||void 0===e||null===(t=e.value)||void 0===t?void 0:t.length;null===(n=o.inputRef)||void 0===n||n.setSelectionRange(a,a)}catch(e){}}),0)})),Ot(Bt(o),"render",(function(){var e={ref:o.setInputRef,className:"".concat(o.UNIQUE_ID," react-autoql-chatbar-input").concat(o.props.showChataIcon?" left-padding":""),placeholder:o.props.placeholder,disabled:o.props.isDisabled,onChange:o.onInputChange,onKeyPress:o.onKeyPress,onKeyDown:o.onKeyDown,value:o.state.inputValue,onFocus:o.moveCaretAtEnd,spellCheck:!1,autoFocus:!0};return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-bar-container ".concat(o.props.className," ").concat("below"===o.props.autoCompletePlacement?"autosuggest-bottom":"autosuggest-top"),"data-test":"chat-bar"},f.createElement("div",{className:"react-autoql-chatbar-input-container"},Xn(o.props.autoQLConfig).enableAutocomplete?f.createElement(mt,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return f.createElement(v,null,e.name)},inputProps:e}):f.createElement("input",e)),o.props.showChataIcon&&f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(bn,{type:"react-autoql-bubbles-outlined"})),o.props.showLoadingDots&&o.state.isQueryRunning&&f.createElement("div",{className:"input-response-loading-container"},f.createElement(Aa,null)),o.props.enableVoiceRecord&&f.createElement(ha,{onTranscriptStart:o.onTranscriptStart,onTranscriptChange:o.onTranscriptChange,onFinalTranscript:o.onFinalTranscript,authentication:o.props.authentication,tooltipID:o.props.tooltipID})))})),o.UNIQUE_ID=b(),o.autoCompleteTimer=void 0,o.autoCompleteArray=[],o.state={inputValue:"",lastQuery:"",suggestions:[],isQueryRunning:!1,listeningForTranscript:!1},o}return Pt(a)}();Ot(er,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,enableVoiceRecord:y.bool,isDisabled:y.bool,onSubmit:y.func,onResponseCallback:y.func,className:y.string,autoCompletePlacement:y.string,showLoadingDots:y.bool,showChataIcon:y.bool,inputValue:y.string,queryFilters:y.arrayOf(y.shape({})),placeholder:y.string,clearQueryOnSubmit:y.bool,sessionId:y.string,dataPageSize:y.number,shouldRender:y.bool}),Ot(er,"defaultProps",{authentication:jn,autoQLConfig:Yn,dataFormatting:Kn,enableVoiceRecord:!1,isDisabled:!1,autoCompletePlacement:"above",className:null,showLoadingDots:!0,showChataIcon:!0,isBackButtonClicked:!1,inputValue:void 0,source:[],queryFilters:void 0,clearQueryOnSubmit:!0,placeholder:"Type your queries here",dataPageSize:void 0,shouldRender:!0,onSubmit:function(){},onResponseCallback:function(){}});var tr=Ra(er),nr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",Nt(wt().mark((function e(){return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a._isMounted=!0,a.instantiateTabulator();case 2:case"end":return e.stop()}}),e)})))),Ot(Bt(a),"shouldComponentUpdate",(function(){return!1})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,a.isInitialized=!1,setTimeout((function(){a.tabulator.destroy()}),1e3)})),Ot(Bt(a),"instantiateTabulator",(function(){var e;a.tabulator=new Me(a.tableRef,xt(xt({columns:a.props.columns,data:null!==(e=a.props.options)&&void 0!==e&&e.ajaxRequestFunc?[]:a.props.data},a.defaultOptions),a.props.options)),a.tabulator.on("renderComplete",(function(){setTimeout((function(){a.blockRedraw()}),1e3)})),a.tabulator.on("dataLoadError",a.props.onDataLoadError),a.tabulator.on("cellClick",a.props.onCellClick),a.tabulator.on("dataSorting",a.props.onDataSorting),a.tabulator.on("dataSorted",a.props.onDataSorted),a.tabulator.on("dataFiltering",a.props.onDataFiltering),a.tabulator.on("dataFiltered",a.props.onDataFiltered),a.tabulator.on("tableBuilt",Nt(wt().mark((function e(){var t;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.isInitialized=!0,null===(t=a.props.options)||void 0===t||!t.ajaxRequestFunc){e.next=4;break}return e.next=4,a.tabulator.setData();case 4:a.props.onTableBuilt();case 5:case"end":return e.stop()}}),e)}))))})),Ot(Bt(a),"blockRedraw",(function(e){var t;a.isInitialized&&(a.redrawRestored=!1,null===(t=a.tabulator)||void 0===t||t.blockRedraw())})),Ot(Bt(a),"restoreRedraw",(function(e){a.tabulator&&a.isInitialized&&!a.redrawRestored&&a._isMounted&&(a.redrawRestored=!0,a.tabulator.restoreRedraw())})),Ot(Bt(a),"updateData",(function(e){var t,n;a.props.hidden?setTimeout((function(){var t,n;null===(t=a.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setData(e)}),0):null===(t=a.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setData(e)})),Ot(Bt(a),"render",(function(){return f.createElement("div",{ref:function(e){return a.tableRef=e},className:"table-condensed ".concat(a.props.className),id:"react-tabulator-id-".concat(a.COMPONENT_KEY),key:a.COMPONENT_KEY})})),a.COMPONENT_KEY=b(),a.tableRef=f.createRef(),a.tabulator=null,a.redrawRestored=!0,a.defaultOptions={height:a.props.height||"100%",reactiveData:!1,autoResize:!1,rowHeight:25,layout:"fitDataFill",clipboard:!0,downloadConfig:{columnGroups:!1,rowGroups:!1,columnCalcs:!1}},a}return Pt(n)}();Ot(nr,"propTypes",{tableKey:y.string,options:y.shape({}),onDataLoadError:y.func,onTableBuilt:y.func,onCellClick:y.func,onDataSorting:y.func,onDataSorted:y.func,onDataFiltering:y.func,onDataFiltered:y.func}),Ot(nr,"defaultProps",{tableKey:void 0,options:{},onDataLoadError:function(){},onTableBuilt:function(){},onCellClick:function(){},onDataSorting:function(){},onDataSorted:function(){},onDataFiltering:function(){},onDataFiltered:function(){}});var ar=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.precision;return t===Pn||t===On?t:In},or=function(e){switch(e){case In:return"day";case Pn:return"month";case On:return"year";case Mn:return"week";case Ln:return"quarter";case _n:case qn:return"hour";case Fn:case Vn:return"minute";default:return"day"}},rr=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 function(e){if(!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(e))return!1;var t=new Date(e);return t instanceof Date&&!isNaN(t)&&t.toISOString()===e}(e)}));if(t.length){var o=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(o){var r=function(e){var t=a(e[0]),n=e[1]?a(e[1]):t;if(n.isBefore(t)){var o=t;t=n,n=o}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:o,startDate:i,endDate:l},c=n.findIndex((function(e){return e.columnName===o}));if(c>=0){var u=n[c];n[c]=xt(xt({},n[c]),function(e,t){try{var n=e.startDate,o=e.endDate,r=t.startDate,i=t.endDate,l=a(n).isAfter(a(r))?n:r,s=a(o).isBefore(a(i))?o:i;return a(l).isAfter(a(s))?null:{startDate:l,endDate:s}}catch(e){return console.error(e),null}}(s,u))}else n.push(s)}}})),null!=n&&n.length?n:[]},ir=function(e,t,n){return{sorters:lr(e,t,n),filters:sr(e,t,n),page:null==e?void 0:e.page}},lr=function(e,t,n){var a,o=[];return(null==e||null===(a=e.sort)||void 0===a?void 0:a.length)>0&&t&&e.sort.forEach((function(e){try{var t=null==n?void 0:n[Number(e.field)];if(t){var a=t.name,r=e.dir.toUpperCase();a&&r&&o.push({name:a,sort:r})}}catch(e){console.error(e)}})),o},sr=function(e,t,n){var o,r=[];return(null==e||null===(o=e.filter)||void 0===o?void 0:o.length)>0&&t&&e.filter.forEach((function(e){try{var t=null==n?void 0:n[Number(e.field)];if(t){var o={name:t.name,value:e.value,operator:"like"};if(ka(t)){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 a="=",o=e.trim();return o.length>=2&&(["<=",">=","!="].includes(o.substring(0,2))?a=o.substring(0,2):["=","<",">"].includes(o.substring(0,1))&&(a=o.substring(0,1))),{value:t,operator:a}}(e.value);o.operator=i.operator,o.value=i.value}else if("DATE"===t.type){var l,s=e.value.split(" to "),c=or(t.precision),u=a.utc(s[0]).startOf(c).toISOString(),d=a.utc(null!==(l=s[1])&&void 0!==l?l:s[0]).endOf(c).toISOString();o.value="".concat(u,",").concat(d),o.operator="between"}r.push(o)}}catch(e){console.warn(e)}})),r};function cr(e){return f.createElement(Kt,null,f.createElement("div",Mt({className:"spinner-loader","data-test":"react-autoql-spinner"},e)))}var ur=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;kt(this,n),Ot(Bt(o=t.call(this,e)),"selectedRangeIncludesMonth",(function(e){return!(!o.state.selectedStart||!o.state.selectedEnd)&&e.isBetween(o.state.selectedStart,o.state.selectedEnd,"month")})),Ot(Bt(o),"handleMonthHover",(function(e){var t=o.state.selectedStart,n=e.startOf("month"),a=e.endOf("month");t&&"end"===o.state.focusedDateDisplay&&(a.isBefore(t)?a=t.endOf("month"):t.isBefore(n)&&(n=t.startOf("month"))),o.setState({previewStart:n,previewEnd:a})})),Ot(Bt(o),"handleMonthClick",(function(e){"start"===o.state.focusedDateDisplay?o.onMonthStartSelection(e):o.onMonthEndSelection(e)})),Ot(Bt(o),"incrementYear",(function(){o.setState({visibleYear:"".concat(Number(o.state.visibleYear)+1)})})),Ot(Bt(o),"decrementYear",(function(){o.setState({visibleYear:"".concat(Number(o.state.visibleYear)-1)})})),Ot(Bt(o),"onMonthStartSelection",(function(e){o.setState({selectedStart:e.startOf("month"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("month"),e],n=t[0].startOf("month"),a=t[1].endOf("month");o.props.onRangeSelection({startDate:n.toDate(),endDate:a.toDate()})})),Ot(Bt(o),"onMonthEndSelection",(function(e){try{var t=o.state.selectedStart;t||o.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var a=n[0].startOf("month"),r=n[1].endOf("month");o.setState({selectedStart:a,selectedEnd:r}),o.props.onRangeSelection({startDate:a.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),Ot(Bt(o),"renderDateDisplay",(function(){var e,t,n,a,r,i=null!==(e=null===(t=o.state.selectedStart)||void 0===t?void 0:t.startOf("month").format("MMM YYYY"))&&void 0!==e?e:"",l=null!==(n=null!==(a=null===(r=o.state.selectedEnd)||void 0===r?void 0:r.startOf("month").format("MMM YYYY"))&&void 0!==a?a:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDateInput rdrDateDisplayItem\n ".concat("start"===o.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return o.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDateInput rdrDateDisplayItem ".concat("end"===o.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return o.setState({focusedDateDisplay:"end"})}}))))})),Ot(Bt(o),"renderYearPicker",(function(){var e=o.props.minDate?a(o.props.minDate).year():a(new Date).add(-100,"year").year(),t=o.props.maxDate?a(o.props.maxDate).year():a(new Date).add(20,"year").year();return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:o.decrementYear,disabled:o.state.visibleYear===e},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:o.state.visibleYear,onChange:function(e){return o.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:o.incrementYear,disabled:o.state.visibleYear===t},f.createElement("i",null)))})),Ot(Bt(o),"isSelected",(function(e){var t=o.state,n=t.selectedStart,a=t.selectedEnd,r=e.startOf("month").isSame(null==n?void 0:n.startOf("month")),i=r&&!a||e.endOf("month").isSame(null==a?void 0:a.endOf("month"));return{isSelected:r||i||o.selectedRangeIncludesMonth(e),isSelectedStart:r,isSelectedEnd:i}})),Ot(Bt(o),"isPreview",(function(e){var t=o.state,n=t.previewStart,a=t.previewEnd,r=e.startOf("month").isSame(n),i=e.endOf("month").isSame(a);return{isPreview:r||i||e.isBetween(n,a,"month"),isPreviewStart:r,isPreviewEnd:i}})),Ot(Bt(o),"isDisabled",(function(e){var t=o.props.minDate&&e.isBefore(a(o.props.minDate).startOf("month")),n=o.props.maxDate&&e.isAfter(a(o.props.maxDate).endOf("month"));return t||n})),Ot(Bt(o),"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=a("".concat(o.state.visibleYear,"-").concat(e+1,"-15")),n=a("2021-".concat(e+1,"-15")).format("MMM"),r=o.isSelected(t),i=r.isSelected,l=r.isSelectedStart,s=r.isSelectedEnd,c=o.isPreview(t),u=c.isPreview,d=c.isPreviewStart,p=c.isPreviewEnd,m=o.isDisabled(t),g=e===a().month()&&o.state.visibleYear==a().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 o.handleMonthClick(t)},onMouseEnter:function(){return!m&&o.handleMonthHover(t)},onMouseLeave:function(){return!m&&o.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))))})))})))})),Ot(Bt(o),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},o.renderDateDisplay(),o.renderYearPicker(),o.renderMonthGrid())})),o.COMPONENT_KEY=b();var r=a(),i=r.year(),l=r.startOf("month"),s=r.endOf("month");return e.initialRange?(l=a(o.props.initialRange.startDate).startOf("month"),i=(s=a(o.props.initialRange.endDate).endOf("month")).year()):e.minDate&&e.maxDate&&(r.isBefore(a(e.minDate))||r.isAfter(a(e.maxDate)))&&(l=a(e.minDate).startOf("month"),s=a(e.maxDate).endOf("month")),o.state={selectedRange:o.props.initialRange,visibleYear:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},o}return Pt(n)}();Ot(ur,"propTypes",{minDate:y.instanceOf(Date),maxDate:y.instanceOf(Date),initialRange:y.shape({startDate:y.instanceOf(Date),endDate:y.instanceOf(Date)}),onRangeSelection:y.func}),Ot(ur,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var dr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var o;kt(this,n),Ot(Bt(o=t.call(this,e)),"getDecade",(function(e){var t=e-e%10;return[t,t+9]})),Ot(Bt(o),"isInDecade",(function(e,t){return e>=t[0]&&e<=t[1]})),Ot(Bt(o),"selectedRangeIncludesYear",(function(e){return!(!o.state.selectedStart||!o.state.selectedEnd)&&e.isBetween(o.state.selectedStart,o.state.selectedEnd,"year")})),Ot(Bt(o),"handleYearHover",(function(e){var t=o.state.selectedStart,n=e.startOf("year"),a=e.endOf("year");t&&"end"===o.state.focusedDateDisplay&&(a.isBefore(t)?a=t.endOf("year"):t.isBefore(n)&&(n=t.startOf("year"))),o.setState({previewStart:n,previewEnd:a})})),Ot(Bt(o),"handleYearClick",(function(e){"start"===o.state.focusedDateDisplay?o.onYearStartSelection(e):o.onYearEndSelection(e)})),Ot(Bt(o),"incrementDecade",(function(){var e=o.state.visibleDecade[1];o.setState({visibleDecade:[e+1,e+10]})})),Ot(Bt(o),"decrementDecade",(function(){var e=o.state.visibleDecade[0];o.setState({visibleDecade:[e-10,e-1]})})),Ot(Bt(o),"onYearStartSelection",(function(e){o.setState({selectedStart:e.startOf("year"),selectedEnd:void 0,focusedDateDisplay:"end"});var t=[e.startOf("year"),e],n=t[0].startOf("year"),a=t[1].endOf("year");o.props.onRangeSelection({startDate:n.toDate(),endDate:a.toDate()})})),Ot(Bt(o),"onYearEndSelection",(function(e){try{var t=o.state.selectedStart;t||o.setState({selectedEnd:e,focusedDateDisplay:"start"});var n=[t,e];t.isAfter(e)&&n.reverse();var a=n[0].startOf("year"),r=n[1].endOf("year");o.setState({selectedStart:a,selectedEnd:r}),o.props.onRangeSelection({startDate:a.toDate(),endDate:r.toDate()})}catch(e){console.error(e)}})),Ot(Bt(o),"renderDateDisplay",(function(){var e,t,n,a,r,i=null!==(e=null===(t=o.state.selectedStart)||void 0===t?void 0:t.year())&&void 0!==e?e:"",l=null!==(n=null!==(a=null===(r=o.state.selectedEnd)||void 0===r?void 0:r.year())&&void 0!==a?a:i)&&void 0!==n?n:"";return f.createElement("div",{className:"rdrDateDisplayWrapper"},f.createElement("div",{className:"rdrDateDisplay"},f.createElement("span",{className:"rdrDateInput rdrDateDisplayItem\n ".concat("start"===o.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Early",value:i,onClick:function(){return o.setState({focusedDateDisplay:"start"})}})),f.createElement("span",{className:"rdrDateInput rdrDateDisplayItem ".concat("end"===o.state.focusedDateDisplay?"rdrDateDisplayItemActive":"")},f.createElement("input",{readOnly:!0,placeholder:"Continuous",value:l,onClick:function(){return o.setState({focusedDateDisplay:"end"})}}))))})),Ot(Bt(o),"renderDecadePicker",(function(){var e=o.props.minDate?o.getDecade(a(o.props.minDate).year()):o.getDecade(a(new Date).add(-100,"year").year()),t=o.props.maxDate?o.getDecade(a(o.props.maxDate).year()):o.getDecade(a(new Date).add(20,"year").year()),n=(t[0]-e[0])/10;return f.createElement("div",{className:"react-autoql-month-picker-year"},f.createElement("button",{className:"rdrNextPrevButton rdrPprevButton rdrPrevButton",onClick:o.decrementDecade,disabled:o.state.visibleDecade[0]===e[0]},f.createElement("i",null)),f.createElement("select",{className:"year-picker",value:"".concat(o.state.visibleDecade[0]," - ").concat(o.state.visibleDecade[1]),onChange:function(e){var t=e.target.value.split(" - ").map((function(e){return Number(e)}));o.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:o.incrementDecade,disabled:o.state.visibleDecade[0]===t[0]},f.createElement("i",null)))})),Ot(Bt(o),"isSelected",(function(e){var t=o.state,n=t.selectedStart,a=t.selectedEnd,r=e.startOf("year").isSame(null==n?void 0:n.startOf("year")),i=r&&!a||e.endOf("year").isSame(null==a?void 0:a.endOf("year"));return{isSelected:r||i||o.selectedRangeIncludesYear(e),isSelectedStart:r,isSelectedEnd:i}})),Ot(Bt(o),"isPreview",(function(e){var t=o.state,n=t.previewStart,a=t.previewEnd,r=e.startOf("year").isSame(n),i=e.endOf("year").isSame(a);return{isPreview:r||i||e.isBetween(n,a,"year"),isPreviewStart:r,isPreviewEnd:i}})),Ot(Bt(o),"isDisabled",(function(e){var t=o.props.minDate&&e.isBefore(a(o.props.minDate).startOf("year")),n=o.props.maxDate&&e.isAfter(a(o.props.maxDate).endOf("year"));return t||n})),Ot(Bt(o),"renderYearGrid",(function(){var e=o.state.visibleDecade,t=new Array(10).fill(e[0]).map((function(e,t){return e+t})),n=[zt(t.slice(0,3)),zt(t.slice(3,6)),zt(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=a("".concat(e,"-01-15")),n=o.isSelected(t),r=n.isSelected,i=n.isSelectedStart,l=n.isSelectedEnd,s=o.isPreview(t),c=s.isPreview,u=s.isPreviewStart,d=s.isPreviewEnd,p=o.isDisabled(t),m=e===a().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 o.handleYearClick(t)},onMouseEnter:function(){return!p&&o.handleYearHover(t)},onMouseLeave:function(){return!p&&o.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))))})))})))})),Ot(Bt(o),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker react-autoql-month-range-picker"},o.renderDateDisplay(),o.renderDecadePicker(),o.renderYearGrid())})),o.COMPONENT_KEY=b();var r=a(),i=o.getDecade(r.year()),l=r.startOf("year"),s=r.endOf("year");return e.initialRange?(l=a(o.props.initialRange.startDate).startOf("year"),s=a(o.props.initialRange.endDate).endOf("year"),i=o.getDecade(s.year())):e.minDate&&e.maxDate&&(r.isBefore(a(e.minDate))||r.isAfter(a(e.maxDate)))&&(l=a(e.minDate).startOf("year"),s=a(e.maxDate).endOf("year")),o.state={selectedRange:o.props.initialRange,visibleDecade:i,selectedStart:l,selectedEnd:s,previewStart:void 0,previewEnd:void 0,focusedDateDisplay:"start"},o}return Pt(n)}();Ot(dr,"propTypes",{minDate:y.instanceOf(Date),maxDate:y.instanceOf(Date),initialRange:y.shape({startDate:y.instanceOf(Date),endDate:y.instanceOf(Date)}),onRangeSelection:y.func}),Ot(dr,"defaultProps",{minDate:void 0,maxDate:void 0,initialRange:void 0,onRangeSelection:function(){}});var pr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a,o,r,i,l,s,c,u,d;return kt(this,n),Ot(Bt(d=t.call(this,e)),"handleSelect",(function(e){d.setState({selectedRange:e.selection},(function(){d.props.onSelection(e.selection)}))})),Ot(Bt(d),"renderDatePicker",(function(){switch(d.props.type){case Pn:var e,t;return f.createElement(ur,{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 On:var n,a;return f.createElement(dr,{onRangeSelection:function(e){return d.props.onSelection(e)},minDate:null===(n=d.props.validRange)||void 0===n?void 0:n.startDate,maxDate:null===(a=d.props.validRange)||void 0===a?void 0:a.endDate,initialRange:d.state.selectedRange});default:var o,r;return f.createElement(Le,{ref:function(e){return d.datePicker=e},ranges:[d.state.selectedRange],onChange:d.handleSelect,minDate:null===(o=d.props.validRange)||void 0===o?void 0:o.startDate,maxDate:null===(r=d.props.validRange)||void 0===r?void 0:r.endDate,dragSelectionEnabled:!1,rangeColors:[d.accentColor],showMonthAndYearPickers:!0})}})),Ot(Bt(d),"render",(function(){return f.createElement("div",{className:"react-autoql-date-picker"},d.renderDatePicker())})),d.accentColor=Sa("accent-color"),d.state={selectedRange:{startDate:null!==(a=null!==(o=null===(r=e.initialRange)||void 0===r?void 0:r.startDate)&&void 0!==o?o:null===(i=e.validRange)||void 0===i?void 0:i.startDate)&&void 0!==a?a: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 Pt(n)}();Ot(pr,"propTypes",{initialRange:y.shape({}),validRange:y.shape({}),type:y.string}),Ot(pr,"defaultProps",{initialRange:void 0,validRange:void 0,type:In});var mr=["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"],fr=["default","primary","danger"],gr=["small","large"],vr=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"COMPONENT_KEY","react-autoql-btn-".concat(b())),Ot(Bt(e),"getType",(function(){try{var t=e.props.type.trim().toLowerCase();if(fr.includes(t))return t}catch(e){return console.warn('Warning: The type provided was invalid, using "default" instead'),"default"}return"default"})),Ot(Bt(e),"getSize",(function(){try{var t=e.props.size.trim().toLowerCase();if(gr.includes(t))return t}catch(e){return console.warn('Warning: The size provided was invalid, using "large" instead'),"large"}return"large"})),Ot(Bt(e),"render",(function(){var t,n=e.getType(),a=e.getSize(),o=e.props.loading||e.props.disabled;return f.createElement(Kt,null,f.createElement("button",{className:"react-autoql-btn\n ".concat(e.props.className||"","\n ").concat(n,"\n ").concat(a,"\n ").concat(o?" disabled":""),"data-test":"react-autoql-btn","data-multiline":e.props.multiline,style:xt({},e.props.style),onClick:e.props.onClick,"data-tip":e.props.tooltip,"data-for":null!==(t=e.props.tooltipID)&&void 0!==t?t:e.COMPONENT_KEY},e.props.loading&&f.createElement(cr,{"data-test":"react-autoql-btn-loading"}),e.props.children))})),e}return Pt(n)}();Ot(vr,"propTypes",{type:y.oneOf(fr),size:y.oneOf(gr),onClick:y.func,loading:y.bool,disabled:y.bool,multiline:y.bool,tooltip:y.string}),Ot(vr,"defaultProps",{type:"default",loading:!1,size:"large",disabled:!1,multiline:!1,tooltip:void 0,onClick:function(){}});var hr=function(t){Lt(r,f.Component);var o=Qt(r);function r(t){var i,l,s,c,u;return kt(this,r),Ot(Bt(u=o.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})})),Ot(Bt(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||$o(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)&&(!$o(u.props,e)||!$o(u.state,t))))))})),Ot(Bt(u),"getSnapshotBeforeUpdate",(function(e,t){var n,a;return(!u.props.isResizing&&e.isResizing||!u.props.isAnimating&&e.isAnimating||!u.state.firstRender&&t.firstRender||!u.props.hidden&&e.hidden&&!u.hasSetTableHeight)&&(a=!0),u.props.isResizing&&!e.isResizing&&(a=!0,n="100%"),{shouldSetTableHeight:a,newTableHeight:n}})),Ot(Bt(u),"componentDidUpdate",(function(e,t,n){var a,o,r,i,l=n.shouldSetTableHeight,s=n.newTableHeight;(l&&u.setTableHeight(s),!u.props.hidden&&e.hidden)&&(u.state.subscribedData?(null===(a=u.ref)||void 0===a||a.updateData(u.state.subscribedData),u.setState({subscribedData:void 0})):null===(o=u.ref)||void 0===o||o.restoreRedraw());u.props.columns&&!$o(u.props.columns,e.columns)&&(null===(r=u.ref)||void 0===r||null===(i=r.tabulator)||void 0===i||i.setColumns(u.getFilteredTabulatorColumnDefinitions()),u.setHeaderInputClickListeners());if(u.state.tabulatorMounted&&!t.tabulatorMounted&&(u.setFilterTags(),u.setHeaderInputClickListeners(),u.props.hidden||u.setTableHeight(),u.hasSetInitialParams=!0),!u.state.isFiltering&&t.isFiltering)try{u.setFilterTags()}catch(e){console.error(e),u.props.onErrorCallback(e)}})),Ot(Bt(u),"componentWillUnmount",(function(){try{u._isMounted=!1,clearTimeout(u.clickListenerTimeout),clearTimeout(u.setDimensionsTimeout),clearTimeout(u.setStateTimeout),u.cancelCurrentRequest(),u.resetFilterTags(),u.existingFilterTag=void 0,u.filterTagElements=void 0}catch(e){console.error(e)}})),Ot(Bt(u),"updateData",(function(e){var t;null===(t=u.ref)||void 0===t||t.updateData(e)})),Ot(Bt(u),"onDataSorting",(function(e){if(u._isMounted){var t,a,o=e.map((function(e){return{dir:e.dir,field:e.field}}));null!==(t=u.tableParams)&&void 0!==t&&t.sort&&!n(o,null===(a=u.tableParams)||void 0===a?void 0:a.sort)&&(u.isSorting=!0,u.setLoading(!0))}})),Ot(Bt(u),"onDataSorted",(function(e,t){u.isSorting&&(u.isSorting=!1,!u.supportsInfiniteScroll&&u.ref&&u.props.onSorterCallback(e),u.setLoading(!1))})),Ot(Bt(u),"onDataFiltering",(function(){if(u._isMounted&&u.state.tabulatorMounted){var e,t,a,o=null===(e=u.ref)||void 0===e||null===(t=e.tabulator)||void 0===t?void 0:t.getHeaderFilters();o&&!n(o,null===(a=u.tableParams)||void 0===a?void 0:a.filter)&&(u.isFiltering=!0,u.setLoading(!0))}})),Ot(Bt(u),"onDataFiltered",(function(e,t){if(u.isFiltering&&u.state.tabulatorMounted){var n,a;u.isFiltering=!1;var o=null===(n=u.ref)||void 0===n||null===(a=n.tabulator)||void 0===a?void 0:a.getHeaderFilters();u.supportsInfiniteScroll||(u.tableParams.filter=C(o),u.props.onFilterCallback(o,t)),setTimeout((function(){u.setState({loading:!1})}),0)}})),Ot(Bt(u),"setLoading",(function(e){e!==u.state.loading&&u.setState({loading:e})})),Ot(Bt(u),"isLoading",(function(){return u.state.loading||u.state.firstRender||u.state.pageLoading||u.state.scrollLoading||u.isFiltering||u.isSorting||!u.hasSetInitialParams})),Ot(Bt(u),"onTableBuilt",Nt(wt().mark((function e(){return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u.setState({tabulatorMounted:!0,pageLoading:!1});case 1:case"end":return e.stop()}}),e)})))),Ot(Bt(u),"setTableHeight",(function(e){if(u.state.tabulatorMounted&&u.tabulatorContainer&&!u.props.isAnimating&&!u.props.isResizing&&!u.props.hidden){var t,n,a=null!=e?e:u.tabulatorContainer.clientHeight;if(a&&a!==u.lockedTableHeight)null===(t=u.ref)||void 0===t||null===(n=t.tabulator)||void 0===n||n.setHeight(a),u.lockedTableHeight=a,"100%"!==e&&(u.hasSetTableHeight=!0)}})),Ot(Bt(u),"cancelCurrentRequest",(function(){var e;null===(e=u.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(u),"ajaxRequesting",(function(e,t){})),Ot(Bt(u),"ajaxRequestFunc",function(){var t=Nt(wt().mark((function t(a,o){var r,i,l,s,c,d,p,f,g,v,h;return wt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,u.hasSetInitialData){t.next=4;break}return u.hasSetInitialData=!0,t.abrupt("return",xt(xt({},e(u.props.response,"data.data",{})),{},{page:1}));case 4:if(s=ir(u.tableParams,null===(r=u.ref)||void 0===r?void 0:r.tabulator,a.columns),c=ir(o,null===(i=u.ref)||void 0===i?void 0:i.tabulator,a.columns),!n(s,c)){t.next=8;break}return t.abrupt("return");case 8:if(u.tableParams=o,a.queryRequestData){t.next=12;break}return console.warn("Original request data was not provided to ChataTable, unable to filter or sort table"),t.abrupt("return");case 12:if(u.cancelCurrentRequest(),u.axiosSource=null===(l=m.CancelToken)||void 0===l?void 0:l.source(),!((null==o?void 0:o.page)>1)){t.next=22;break}return u.setState({scrollLoading:!0}),t.next=18,u.getNewPage(a,c);case 18:d=t.sent,u.props.onNewPage(null===(p=d)||void 0===p?void 0:p.rows),t.next=32;break;case 22:return u.setState({pageLoading:!0}),t.next=25,a.queryFn({tableFilters:null==c?void 0:c.filters,orders:null==c?void 0:c.sorters});case 25:return v=t.sent,u.queryID=null==v||null===(f=v.data)||void 0===f||null===(g=f.data)||void 0===g?void 0:g.query_id,d=xt(xt({},e(v,"data.data",{})),{},{page:1}),t.next=30,Jo();case 30:u.props.onTableParamsChange(o,c),u.props.onNewData(v);case 32:return u.clearLoadingIndicators(),t.abrupt("return",d);case 36:if(t.prev=36,t.t0=t.catch(0),(null===t.t0||void 0===t.t0||null===(h=t.t0.data)||void 0===h?void 0:h.message)!==Wt.CANCELLED){t.next=40;break}return t.abrupt("return");case 40:return console.error(t.t0),u.clearLoadingIndicators(),t.abrupt("return");case 43:case"end":return t.stop()}}),t,null,[[0,36]])})));return function(e,n){return t.apply(this,arguments)}}()),Ot(Bt(u),"clearLoadingIndicators",Nt(wt().mark((function e(){return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jo();case 2:u._isMounted&&u.setState({loading:!1,scrollLoading:!1,pageLoading:!1});case 3:case"end":return e.stop()}}),e)})))),Ot(Bt(u),"getNewPage",(function(t,n){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,a=t.domain,o=t.apiKey,r=t.token,i=t.page,l=t.cancelToken,s="".concat(a,"/autoql/api/v1/query/").concat(n,"/page?key=").concat(o,"&page=").concat(i);if(!n)return Promise.reject({error:"No query ID supplied"});if(!o||!a||!r)return Promise.reject({error:"Unauthenticated"});var c={date_format:"ISO8601"},u={headers:{Authorization:"Bearer ".concat(r)},cancelToken:l};return m.post(s,c,u).then((function(t){if(t.data&&"string"==typeof t.data)throw new Error("Parse error");return Promise.resolve(xt(xt({},e(t,"data.data",{})),{},{page:i}))})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):"Parse error"===t.message?Promise.reject({error:"Parse error"}):401!==t.response&&e(t,"response.data")?Promise.reject(e(t,"response")):Promise.reject({error:"Unauthenticated"})}))}(xt(xt(xt({},Wn(t.authentication)),n),{},{queryId:u.queryID,cancelToken:u.axiosSource.token}))})),Ot(Bt(u),"ajaxResponseFunc",(function(t,n){var a;if(null===(a=u.ref)||void 0===a||a.restoreRedraw(),n){u.currentPage=n.page;var o=e(n,"rows.length",0)<t.pageSize;u.lastPage=o?u.currentPage:u.currentPage+1,o&&!u.state.isLastPage?u.setState({isLastPage:!0}):!o&&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}})),Ot(Bt(u),"cellClick",(function(e,t){u.props.onCellClick(t)})),Ot(Bt(u),"copyToClipboard",(function(){var e;u._isMounted&&null!==(e=u.ref)&&void 0!==e&&e.tabulator&&u.ref.tabulator.copyToClipboard("active",!0)})),Ot(Bt(u),"saveAsCSV",(function(e){try{var t;if(u._isMounted&&null!==(t=u.ref)&&void 0!==t&&t.tabulator){var n=C(u.ref.tabulator);return new Promise((function(t,a){setTimeout((function(){n.download("csv","export.csv",{delimiter:","}),n=void 0,t()}),e)}))}}catch(e){console.error(e)}return Promise.reject()})),Ot(Bt(u),"debounceSetState",(function(e){u.stateToSet=xt(xt({},u.stateToSet),e),clearTimeout(u.setStateTimeout),u.setStateTimeout=setTimeout((function(){u.setState(u.stateToSet),u.stateToSet={}}),50)})),Ot(Bt(u),"inputKeydownListener",(function(){var e;u.supportsInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),Ot(Bt(u),"inputSearchListener",(function(){var e;u.supportsInfiniteScroll||(null===(e=u.ref)||void 0===e||e.restoreRedraw())})),Ot(Bt(u),"inputDateSearchListener",(function(){u.currentDateRangeSelections={},u.debounceSetState({datePickerColumn:void 0})})),Ot(Bt(u),"inputDateClickListener",(function(e,t){var n=e.target.getBoundingClientRect(),a=u.tableContainer.getBoundingClientRect();null!=n&&n.top&&null!=n&&n.left&&u.debounceSetState({datePickerLocation:{top:n.top-a.top+n.height+5,left:n.left-a.left},datePickerColumn:t})})),Ot(Bt(u),"inputDateKeypressListener",(function(e){e.stopPropagation(),e.preventDefault()})),Ot(Bt(u),"setHeaderInputClickListeners",(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),t.removeEventListener("search",u.inputSearchListener),t.addEventListener("search",u.inputSearchListener),"DATE"===e.type&&!e.pivot)){t.removeEventListener("search",u.inputDateSearchListener),t.addEventListener("search",u.inputDateSearchListener),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)}))}}))})),Ot(Bt(u),"resetFilterTags",(function(){var e,t=null===(e=u.tableContainer)||void 0===e?void 0:e.querySelectorAll("#react-autoql-table-container-".concat(u.TABLE_ID," .filter-tag"));null!=t&&t.length&&t.forEach((function(e){try{e.parentNode&&u._isMounted&&e.parentNode.removeChild(e)}catch(e){}}))})),Ot(Bt(u),"setFilterTags",(function(){var e;u.resetFilterTags();var t=null===(e=u.tableParams)||void 0===e?void 0:e.filter;t&&t.forEach((function(e,t){try{var n=document.createElement("span");n.innerText="F",n.setAttribute("class","filter-tag");var a=document.querySelector("#react-autoql-table-container-".concat(u.TABLE_ID,' .tabulator-col[tabulator-field="').concat(e.field,'"] .tabulator-col-title'));a.insertBefore(n,a.firstChild)}catch(e){console.error(e),u.props.onErrorCallback(e)}}))})),Ot(Bt(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,a,o,r;if(null===(n=u.ref)||void 0===n||null===(a=n.tabulator)||void 0===a||a.setHeaderFilterValue(e.field,e.value),!u.supportsInfiniteScroll)null===(o=u.ref)||void 0===o||null===(r=o.tabulator)||void 0===r||r.setFilter(e.field,e.type,e.value)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingFilterInputs=!1})),Ot(Bt(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,o=t.endDate;if(e){var r=n,i=o;n&&!o?i=r:!n&&o&&(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,c=ar(e),d=Bn[c],p=a(r).format(d),m=a.utc(p).toISOString(),f=a(m).utc().format(d),g=a(i).format(d),v=a.utc(g).toISOString(),h=a(v).utc().format(d),y="".concat(f," to ").concat(h);f===h&&(y=f),l.focus(),null===(s=u.ref)||void 0===s||s.restoreRedraw(),l.value=y,l.title=y,l.blur(),u.currentDateRangeSelections=Ot({},e.field,u.state.dateRangeSelection)}}}})),Ot(Bt(u),"onDateRangeSelection",(function(e){u.setState({dateRangeSelection:e})})),Ot(Bt(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,a;null===(n=u.ref)||void 0===n||null===(a=n.tabulator)||void 0===a||a.setSort(e.field,e.dir)}catch(e){console.error(e),u.props.onErrorCallback(e)}})),u.settingSorters=!1})),Ot(Bt(u),"toggleIsFiltering",(function(){var e=!u.state.isFiltering;return u.setState({isFiltering:e}),e})),Ot(Bt(u),"renderEmptyPlaceholderText",(function(){return f.createElement("div",{className:"table-loader table-page-loader table-placeholder"},f.createElement("div",null,"No results"))})),Ot(Bt(u),"renderPageLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(cr,null)))})),Ot(Bt(u),"renderScrollLoader",(function(){return f.createElement("div",{className:"table-loader table-scroll-loader"},f.createElement(cr,null))})),Ot(Bt(u),"renderDatePickerPopover",(function(){var e,t,n;return u.state.datePickerColumn?f.createElement(we,{isOpen:!!u.state.datePickerColumn,align:"start",positions:["bottom","right","left","top"],onClickOutside:function(e){e.stopPropagation(),u.setState({datePickerColumn:void 0})},content:f.createElement("div",{className:"react-autoql-table-date-picker"},f.createElement("h3",null,u.state.datePickerColumn.display_name),f.createElement(pr,{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(vr,{type:"primary",onClick:u.onDateRangeSelectionApplied,tooltipID:u.props.tooltipID},"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})),Ot(Bt(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){mr.includes(n)&&(t[n]=e[n])})),t}))}catch(e){console.error(e)}return[]})),Ot(Bt(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 a=u.getTabulatorRowCount();return u.props.useInfiniteScroll||void 0===a||(t=a,n=a),f.createElement("div",{className:"table-row-count"},f.createElement("span",null,"Scrolled ".concat(t," / ").concat(n," rows")))})),Ot(Bt(u),"getTabulatorRowCount",(function(){var e,t;return null===(e=u.ref)||void 0===e||null===(t=e.tabulator)||void 0===t?void 0:t.getDataCount("active")})),Ot(Bt(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)})),Ot(Bt(u),"render",(function(){var e=u.isTableEmpty();return f.createElement(Kt,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.supportsInfiniteScroll?"infinite":"limited","\n ").concat(u.supportsInfiniteScroll&&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(nr,{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.renderDatePickerPopover(),!e&&u.renderTableRowCount()))})),u.TABLE_ID=b(),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.supportsInfiniteScroll=t.useInfiniteScroll&&!!t.pageSize,u.isFiltering=!1,u.isSorting=!1,u.tableParams=null!==(l=C(t.initialParams))&&void 0!==l?l:{filter:[],sort:[]},u.tableOptions={selectableCheck:function(){return!1},initialSort:u.supportsInfiniteScroll||null===(s=u.tableParams)||void 0===s?void 0:s.sort,initialFilter:u.supportsInfiniteScroll||null===(c=u.tableParams)||void 0===c?void 0:c.filter,progressiveLoadScrollMargin:100,downloadEncoder:function(e,t){return new Blob([e],{type:t})}},u.supportsInfiniteScroll&&(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,a){return u.ajaxRequestFunc(t,a)},u.tableOptions.ajaxResponse=function(e,n,a){return u.ajaxResponseFunc(t,a)}),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 Pt(r)}();Ot(hr,"propTypes",{data:y.arrayOf(y.array),columns:y.arrayOf(y.shape({})),shouldRender:y.bool,onFilterCallback:y.func,onSorterCallback:y.func,onTableParamsChange:y.func,isResizing:y.bool,pageSize:y.number,useInfiniteScroll:y.bool,onSetTableHeight:y.func}),Ot(hr,"defaultProps",{queryRequestData:{},data:void 0,columns:void 0,isResizing:!1,pageSize:void 0,useInfiniteScroll:!0,source:[],shouldRender:!0,autoHeight:!0,onFilterCallback:function(){},onSorterCallback:function(){},onTableParamsChange:function(){},onCellClick:function(){},onErrorCallback:function(){},onSetTableHeight:function(){}});var yr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"render",(function(){return f.createElement("rect",Mt({},a.props.childProps,{className:"axis-scaler-border","data-test":"axis-scaler-border",fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4",onClick:a.props.toggleChartScale}))})),a}return Pt(n)}(),br=["label","type","indeterminate","hasError","style","onChange","checked"],Cr=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"ID",b()),Ot(Bt(e),"componentDidMount",(function(){e.selector&&(e.selector.indeterminate=e.props.indeterminate)})),Ot(Bt(e),"componentDidUpdate",(function(t){t.indeterminate!==e.props.indeterminate&&(e.selector.indeterminate=e.props.indeterminate)})),Ot(Bt(e),"onCheckedChange",(function(t){e.props.onChange(t)})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.label,a=t.type;t.indeterminate;var o=t.hasError;t.style,t.onChange,t.checked;var r=Ft(t,br),i="\n react-autoql-checkbox\n ".concat("switch"===a&&"react-autoql-checkbox--switch","\n ").concat(o&&"react-autoql-checkbox--has-error","\n "),l="\n react-autoql-checkbox__input\n ".concat("switch"===a?"react-autoql-checkbox--switch__input":"react-autoql-checkbox--checkbox__input","\n ").concat(o?"react-autoql-checkbox--has-error__input":"","\n ");return f.createElement(Kt,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",Mt({},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(bn,{type:"check"})),n&&f.createElement("div",{className:"react-autoql-checkbox-label",onClick:function(t){e.selector.click()}},n))))})),e}return Pt(n)}();Ot(Cr,"propTypes",{hasError:y.bool,indeterminate:y.bool,label:y.string,type:y.oneOf(["default","switch"]),checked:y.bool,onChange:y.func}),Ot(Cr,"defaultProps",{hasError:!1,indeterminate:void 0,type:"default",label:"",checked:!1,onChange:function(){}});var Er=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"selectAll",(function(){var e=[];a.props.items.forEach((function(t,n){t.disabled||e.push(n)})),a.setState({selected:e})})),Ot(Bt(a),"unselectAll",(function(){a.setState({selected:[]})})),Ot(Bt(a),"interpolateArray",(function(e,t){for(var n=Math.min(e,t),a=Math.max(e,t),o=[],r=n;r<=a;r++)o.push(r);return o})),Ot(Bt(a),"handleShiftSelect",(function(e,t){if(a.state.selected.length){var n=Math.min.apply(Math,zt(a.state.selected)),o=[e];e<n?o=a.interpolateArray(e,n):e>n&&(o=a.interpolateArray(n,e));var r=(o=o.filter((function(e){return!a.props.items[e].disabled}))).map((function(e){return xt({},a.props.items[e])}));a.props.onSelect(o,r),a.setState({selected:o})}else a.props.onSelect([e],[t]),a.setState({selected:[e]})})),Ot(Bt(a),"handleCtrlSelect",(function(e){var t=[];t=a.state.selected.includes(e)?a.state.selected.filter((function(t){return t!==e})):[].concat(zt(a.state.selected),[e]),a.props.onSelect(t),a.setState({selected:t})})),Ot(Bt(a),"checkAll",(function(){var e=a.props.items.map((function(e){return xt(xt({},e),{},{checked:!e.disabled||e.checked})}));a.props.onChange(e,e,!0)})),Ot(Bt(a),"unCheckAll",(function(){var e=a.props.items.map((function(e){return xt(xt({},e),{},{checked:!!e.disabled&&e.checked})}));a.props.onChange(e,e,!1)})),Ot(Bt(a),"handleMultipleCheck",(function(e){var t=a.state.selected,n=t.every((function(t){return e[t].checked})),o=!0,r=a.props.items.map((function(e,a){return n&&t.includes(a)?(o=!1,xt(xt({},e),{},{checked:!1})):t.includes(a)?xt(xt({},e),{},{checked:!0}):e}));a.props.onChange(r,t,o)})),Ot(Bt(a),"render",(function(){var e,t=a.props.items;return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-selectable-list","data-test":"selectable-list"},!(null===(e=a.props.columns)||void 0===e||!e.length)&&f.createElement("div",{className:"col-visibility-header"},a.props.columns.map((function(e,n){if(n===a.props.columns.length-1){var o=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(Cr,{checked:o,disabled:t.every((function(e){return e.disabled})),style:{marginLeft:"10px"},onChange:function(e){o?a.unCheckAll():a.checkAll()}}))}return f.createElement("div",{key:"list-header-".concat(n)},e.name)}))),!(null==t||!t.length)&&t.map((function(e,n){var o;return f.createElement("div",{key:null!==(o=e.key)&&void 0!==o?o:"list-item-".concat(n,"-").concat(a.KEY),className:"react-autoql-list-item\n ".concat(a.state.selected.includes(n)?"selected":"","\n ").concat(e.disabled?"disabled":"","\n ").concat(e.checked?"checked":""),onClick:function(t){t.shiftKey?a.handleShiftSelect(n,e):t.ctrlKey||t.metaKey?a.handleCtrlSelect(n,e):(a.props.onSelect([n],[e]),a.setState({selected:[n]}))}},f.createElement("div",null,e.content),f.createElement("div",null,f.createElement(Cr,{checked:e.checked,disabled:e.disabled,onChange:function(){if(a.state.selected.length>1&&a.state.selected.includes(n))a.handleMultipleCheck(t);else{var o=t.map((function(e,t){return n===t?xt(xt({},e),{},{checked:!e.checked}):e}));a.props.onChange(o,[e],!e.checked)}}})))}))))})),a.KEY=b(),a.state={selected:[]},a}return Pt(n)}();Ot(Er,"propTypes",{columns:y.arrayOf(y.shape({})),items:y.arrayOf(y.shape({}))}),Ot(Er,"defaultProps",{onChange:function(){},onSelect:function(){},columns:[],items:[]});var Sr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1})),Ot(Bt(a),"getView",(function(){var e;return null===(e=a.ref)||void 0===e?void 0:e.view})),Ot(Bt(a),"getClassName",(function(){return"react-autoql-custom-scrollbars ".concat(a.props.className||"")})),Ot(Bt(a),"renderThumbHorizontal",(function(e){return f.createElement("div",Mt({},e,{className:"thumb-horizontal"}))})),Ot(Bt(a),"renderThumbVertical",(function(e){return f.createElement("div",Mt({},e,{className:"thumb-vertical"}))})),Ot(Bt(a),"renderView",(function(e){return f.createElement("div",Mt({},e,{className:"custom-scrollbar-view"}))})),Ot(Bt(a),"render",(function(){var e,t;return f.createElement(Pe,{ref:function(e){return a.ref=e},className:a.getClassName(),style:a.props.style,renderView:a.renderView,autoHide:a.props.autoHide,autoHeight:a.props.autoHeight,autoHeightMin:null!==(e=a.props.autoHeightMin)&&void 0!==e?e:100,autoHeightMax:null!==(t=a.props.autoHeightMax)&&void 0!==t?t:"100%",renderThumbVertical:a.renderThumbVertical,renderThumbHorizontal:a.renderThumbHorizontal},a.props.children)})),a.viewRef=f.createRef(),a}return Pt(n)}();Ot(Sr,"propTypes",{autoHeight:y.bool,autoHide:y.bool,style:y.shape({})}),Ot(Sr,"defaultProps",{autoHeight:!1,autoHide:!0,style:{}});var Tr=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"ID",b()),Ot(Bt(t),"state",{isOpen:!1}),Ot(Bt(t),"componentDidMount",(function(){Qn()})),Ot(Bt(t),"componentDidUpdate",(function(e,n){t.state.isOpen!==n.isOpen&&(zn(),Qn()),t.props.value!==e.value&&Qn()})),Ot(Bt(t),"renderSelect",(function(){return f.createElement("div",{className:"react-autoql-select ".concat(t.props.className),"data-test":"react-autoql-select",onClick:function(e){t.setState({isOpen:!t.state.isOpen})},style:t.props.style,"data-tip":t.props.tooltip,"data-for":t.props.tooltipID,"data-offset":10,"data-delay-show":500},e(t.props.options.find((function(e){return e.value===t.props.value})),"label")||e(t.props.options.find((function(e){return e.value===t.props.value})),"value",f.createElement("span",{style:{color:"rgba(0,0,0,0.4)",fontStyle:"italic"}},t.props.selectionPlaceholder||"Select an item")))})),Ot(Bt(t),"renderPopoverContent",(function(){return f.createElement("div",{className:"react-autoql-select-popup-container ".concat(t.props.popupClassname||""),style:{width:t.props.style.width}},!t.props.tooltipID&&f.createElement(Un,{id:"select-tooltip-".concat(t.ID),className:"react-autoql-tooltip",effect:"solid",delayShow:500}),f.createElement("ul",{className:"react-autoql-select-popup"},t.props.options.map((function(e){var n;return f.createElement("li",{key:"select-option-".concat(t.ID,"-").concat(e.value),className:"react-autoql-select-option".concat(e.value===t.props.value?" active":""),onClick:function(){t.setState({isOpen:!1}),t.props.onChange(e.value)},"data-tip":e.tooltip||null,"data-for":null!==(n=t.props.tooltipID)&&void 0!==n?n:"select-tooltip-".concat(t.ID),"data-offset":10},e.listLabel||e.label)}))))})),Ot(Bt(t),"render",(function(){var e;return t.props.options?f.createElement(Kt,null,f.createElement(we,{id:"select-popover-".concat(t.ID),key:"select-popover-".concat(t.ID),isOpen:t.state.isOpen,positions:null!==(e=t.props.positions)&&void 0!==e?e:["bottom","top","left","right"],align:t.props.align,padding:0,parentElement:t.props.popoverParentElement,boundaryElement:t.props.popoverBoundaryElement,onClickOutside:function(){return t.setState({isOpen:!1})},content:t.renderPopoverContent()},t.renderSelect())):null})),t}return Pt(a)}();Ot(Tr,"propTypes",{onChange:y.func,options:y.arrayOf(y.shape({})),popupClassname:y.string,value:y.string,label:y.string,size:y.string}),Ot(Tr,"defaultProps",{onChange:function(){},options:[],popupClassname:null,value:null,label:null,size:"large",style:{}});var Dr={sum:f.createElement(f.Fragment,null,"Σ"),avg:f.createElement(f.Fragment,null,"μ"),count:f.createElement(f.Fragment,null,"#")},xr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.props.hidden||Qn()})),Ot(Bt(a),"componentDidUpdate",(function(e,t){!t.isOpen&&a.state.isOpen&&a.setState({selectedColumns:[],checkedColumns:a.getCheckedFromNumberColumnIndices(a.props),columns:a.props.columns})})),Ot(Bt(a),"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:[]})),Ot(Bt(a),"onAggTypeSelect",(function(e,t){var n=a.state.columns.map((function(n){return n.field===t.field?xt(xt({},n),{},{aggType:e}):n}));a.setState({columns:n})})),Ot(Bt(a),"getColumnsOfType",(function(e){var t;return null===(t=a.state.columns)||void 0===t?void 0:t.filter((function(t){return t.type===e}))})),Ot(Bt(a),"getSelectableListItems",(function(e){var t=a.state.columns,n=[],o=a.getOtherAxisColumns();return t.forEach((function(t,r){if(t.type===e&&t.is_visible&&!t.pivot){var i=a.state.checkedColumns.includes(r),l=o.includes(r),s=Hn.find((function(e){return e.value===t.aggType})),c={key:"selectable-list-item-".concat(a.COMPONENT_KEY,"-").concat(e,"-").concat(r),content:f.createElement("div",{key:"column-agg-type-symbol-".concat(a.COMPONENT_KEY)},!a.props.isAggregation&&t.aggType&&f.createElement(Tr,{className:"agg-type-symbol",popupClassname:"agg-type-symbol-select",popoverParentElement:a.popoverContentRef,popoverBoundaryElement:a.popoverContentRef,tooltipID:a.props.tooltipID,tooltip:s.tooltip,value:t.aggType,align:"start",size:"small",options:Hn.map((function(e){return{value:e.value,label:Dr[e.value],listLabel:f.createElement("span",null,f.createElement("span",{className:"agg-select-list-symbol"},Dr[e.value]),e.displayName),tooltip:e.tooltip}})),onChange:function(e){a.onAggTypeSelect(e,t)}}),t.title),disabled:l,checked:i,columnIndex:r};n.push(c)}})),n})),Ot(Bt(a),"getOtherAxisColumns",(function(){var e,t;return a.props.hasSecondAxis?a.props.isSecondAxis?null!==(e=a.props.numberColumnIndices)&&void 0!==e?e:[]:null!==(t=a.props.numberColumnIndices2)&&void 0!==t?t:[]:[]})),Ot(Bt(a),"areAllDisabled",(function(e){var t,n=null===(t=a.getOtherAxisColumns())||void 0===t?void 0:t.filter((function(t){return a.state.columns[t].type===e})),o=a.getColumnsOfType(e);return(null==n?void 0:n.length)===(null==o?void 0:o.length)})),Ot(Bt(a),"getAllChecked",(function(e){var t=a.getOtherAxisColumns();return!a.areAllDisabled(e)&&a.state.columns.every((function(n,o){return e!==n.type||a.state.checkedColumns.includes(o)||t.includes(o)}))})),Ot(Bt(a),"onColumnSelection",(function(e,t){var n=t.map((function(e){return e.columnIndex}));a.setState({selectedColumns:n})})),Ot(Bt(a),"onColumnCheck",(function(e){var t=zt(a.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)})),a.setState({checkedColumns:t})})),Ot(Bt(a),"renderSelectorContent",(function(e){return e.position,e.nudgedLeft,e.nudgedTop,a.props.hidden?null:f.createElement("div",{ref:function(e){return a.popoverContentRef=e},className:"number-axis-selector-popover"},f.createElement("div",{className:"number-axis-selector-popover-content"},a.renderSeriesSelectors(),a.renderApplyButton()))})),Ot(Bt(a),"renderSeriesSelector",(function(e){var t=a.getColumnsOfType(e);if(null==t||!t.length)return null;var n=Rn[e],o=a.getSelectableListItems(e),r=a.getAllChecked(e),i=a.areAllDisabled(e);return f.createElement("div",{className:"number-selector-field-group",key:"series-selector-group-".concat(e,"-").concat(a.COMPONENT_KEY)},f.createElement("div",{className:"number-selector-header"},f.createElement("div",{className:"number-selector-header-title"},a.state.columns&&void 0!==a.props.legendColumn?f.createElement("span",null,a.props.legendColumn.display_name):f.createElement("span",null,n," Fields")),f.createElement("div",null,f.createElement(Cr,{checked:r,disabled:i,className:"number-selector-list-checkbox",onChange:function(){var t,n;r?null===(t=a.listRefs[e])||void 0===t||t.unCheckAll():null===(n=a.listRefs[e])||void 0===n||n.checkAll()}}))),f.createElement("div",{className:"react-autoql-custom-scrollbars"},f.createElement(Sr,{autoHide:!1,autoHeight:!0,autoHeightMin:100,autoHeightMax:250},f.createElement(Er,{ref:function(t){return a.listRefs[e]=t},items:o,onSelect:a.onColumnSelection,onChange:a.onColumnCheck}))))})),Ot(Bt(a),"renderSeriesSelectors",(function(){return f.createElement("div",{className:"axis-series-selector"},f.createElement("div",{className:"number-selector-field-group-container"},Object.keys(wn).map((function(e){return a.renderSeriesSelector(wn[e])}))))})),Ot(Bt(a),"renderApplyButton",(function(){var e;return f.createElement("div",{className:"axis-selector-apply-btn-container"},f.createElement(vr,{className:"axis-selector-apply-btn",type:"primary",disabled:!(null!==(e=a.state.checkedColumns)&&void 0!==e&&e.length),tooltipID:a.props.tooltipID,onClick:function(){var e=a.state.checkedColumns;a.props.isSecondAxis?a.props.changeNumberColumnIndices(a.props.numberColumnIndices,e,a.state.columns):a.props.changeNumberColumnIndices(e,a.props.numberColumnIndices2,a.state.columns),a.props.closeSelector()}},"Apply"))})),Ot(Bt(a),"render",(function(){return a.props.children?f.createElement(we,{id:"number-axis-selector-".concat(a.COMPONENT_KEY),isOpen:a.props.isOpen,content:a.renderSelectorContent,ref:a.props.axisSelectorRef,onClickOutside:function(e){e.stopPropagation(),e.preventDefault(),a.props.closeSelector()},parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement,positions:a.props.positions,align:a.props.align,reposition:!0,padding:10},a.props.children):null})),a.COMPONENT_KEY=b(),a.listRefs={};var o=a.getCheckedFromNumberColumnIndices(e);return a.state={aggType:void 0,selectedColumns:[],checkedColumns:o,columns:e.columns},a}return Pt(n)}();Ot(xr,"propTypes",{changeNumberColumnIndices:y.func}),Ot(xr,"defaultProps",{changeNumberColumnIndices:function(){}});var wr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"getAllStringColumnIndices",(function(){var e=[];return a.props.columns.forEach((function(t,n){Ia(t)&&t.is_visible&&e.push(n)})),e})),Ot(Bt(a),"getDateColumnIndices",(function(){var e=[];return a.props.columns.forEach((function(t,n){Pa(t)&&t.is_visible&&e.push(n)})),e})),Ot(Bt(a),"renderSelectorContent",(function(e){var t;if(e.position,e.childRect,e.popoverRect,a.props.hidden)return null;var n=300,o=null===(t=a.props.chartContainerRef)||void 0===t?void 0:t.clientHeight;o&&o>85?n=o-50:o&&o<85&&(n=35),n>Window.innerHeight&&(n=Window.innerHeight);var r=[];return r=a.props.dateColumnsOnly?a.getDateColumnIndices():a.getAllStringColumnIndices(),f.createElement("div",{className:"string-axis-selector-popover-content"},f.createElement(Sr,{autoHide:!1,autoHeight:!0,autoHeightMin:35,autoHeightMax: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,o;return f.createElement("li",{className:"string-select-list-item ".concat(e===a.props.stringColumnIndex?"active":""),key:"string-column-select-".concat(t),onClick:function(){a.props.closeSelector(),a.props.changeStringColumnIndex(e)}},null===(n=a.props.columns)||void 0===n||null===(o=n[e])||void 0===o?void 0:o.display_name)}))))))})),Ot(Bt(a),"render",(function(){return a.props.children?f.createElement(we,{id:"string-axis-selector-".concat(a.COMPONENT_KEY),ref:a.props.axisSelectorRef,isOpen:a.props.isOpen,content:a.renderSelectorContent,onClickOutside:a.props.closeSelector,parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement,positions:a.props.positions,align:a.props.align,reposition:!0,padding:10},a.props.children):null})),a.COMPONENT_KEY=b(),a}return Pt(n)}(),Rr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"render",(function(){var e,t,n;return"LINEAR"===(null===(e=a.props.scale)||void 0===e?void 0:e.type)?f.createElement(xr,Mt({},a.props,{key:a.KEY,"data-test":"number-axis-selector",ref:function(e){return a.ref=e}}),a.props.children):"BAND"===(null===(t=a.props.scale)||void 0===t?void 0:t.type)||"TIME"===(null===(n=a.props.scale)||void 0===n?void 0:n.type)?f.createElement(wr,Mt({},a.props,{key:a.KEY,"data-test":"string-axis-selector",ref:function(e){return a.ref=e}}),a.props.children):null})),a.KEY=b(),a}return Pt(n)}(),Ar=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"openSelector",(function(){a.setState({isOpen:!0})})),Ot(Bt(a),"closeSelector",(function(){a.state.isOpen&&a.setState({isOpen:!1})})),Ot(Bt(a),"axiosSource",m.CancelToken.source()),Ot(Bt(a),"getNewChartData",(function(e){var t,n,o,r,i,l,s,c,u,d,p,m,f,g,v,h,y;return a.props.setIsLoadingMoreRows(!0),a.props.isDrilldown?la(xt(xt({},Wn(a.props.authentication)),{},{source:null===(t=a.props.queryRequestData)||void 0===t?void 0:t.source,debug:"include"===(null===(n=a.props.queryRequestData)||void 0===n?void 0:n.translation),formattedUserSelection:null===(o=a.props.queryRequestData)||void 0===o?void 0:o.user_selection,filters:null===(r=a.props.queryRequestData)||void 0===r?void 0:r.session_filter_locks,test:null===(i=a.props.queryRequestData)||void 0===i?void 0:i.test,groupBys:null===(l=a.props.queryRequestData)||void 0===l?void 0:l.columns,queryID:null===(s=a.props.queryRequestData)||void 0===s?void 0:s.original_query_id,orders:null===(c=a.props.formattedTableParams)||void 0===c?void 0:c.sorters,tableFilters:null===(u=a.props.formattedTableParams)||void 0===u?void 0:u.filters,cancelToken:a.axiosSource.token,pageSize:e})):oa(xt(xt({},Wn(a.props.authentication)),{},{query:null===(d=a.props.queryRequestData)||void 0===d?void 0:d.text,source:null===(p=a.props.queryRequestData)||void 0===p?void 0:p.source,debug:"include"===(null===(m=a.props.queryRequestData)||void 0===m?void 0:m.translation),formattedUserSelection:null===(f=a.props.queryRequestData)||void 0===f?void 0:f.user_selection,filters:null===(g=a.props.queryRequestData)||void 0===g?void 0:g.session_filter_locks,test:null===(v=a.props.queryRequestData)||void 0===v?void 0:v.test,pageSize:e,orders:null===(h=a.props.formattedTableParams)||void 0===h?void 0:h.sorters,tableFilters:null===(y=a.props.formattedTableParams)||void 0===y?void 0:y.filters,cancelToken:a.axiosSource.token}))})),Ot(Bt(a),"loadMoreChartData",function(){var e=Nt(wt().mark((function e(t,n){var o,r,i;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=n?5e3:t,a.props.setCurrentRowNumber(t),e.next=5,a.getNewChartData(r);case 5:o=e.sent,a.props.setIsLoadingMoreRows(!1),a.props.onNewData(o,r),e.next=16;break;case 10:if(e.prev=10,e.t0=e.catch(0),(null===e.t0||void 0===e.t0||null===(i=e.t0.data)||void 0===i?void 0:i.message)!==Wt.CANCELLED){e.next=14;break}return e.abrupt("return",Promise.resolve());case 14:return console.error(e.t0),e.abrupt("return",Promise.resolve());case 16:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n){return e.apply(this,arguments)}}()),Ot(Bt(a),"rowNumberListConstructor",(function(e){for(var t=100,n=[];t<e&&t<5e3;)n.push(t),t*=10;return e>5e3?n.push(5e3):n.push(e),n})),Ot(Bt(a),"renderSelectorContent",(function(){var e,t=300,n=null===(e=a.props.chartContainerRef)||void 0===e?void 0:e.clientHeight;n&&n>85?t=n-50:n&&n<85&&(t=35);var o=a.rowNumberListConstructor(a.props.totalRowCount);return f.createElement(Sr,{autoHide:!1,autoHeight:!0,autoHeightMin:35,autoHeightMax: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"},o.map((function(e,t){var n=e;5e3===e?n="".concat(5e3," (Maximum)"):100!==e&&1e3!==e&&(n="".concat(e," (All)"));var r=t===o.length-1;return f.createElement("li",{className:"string-select-list-item ".concat(e===a.props.currentRowNumber?"active":""),key:"string-column-select-".concat(t),onClick:function(){a.closeSelector(),a.loadMoreChartData(e,r)}},n)})))))})),Ot(Bt(a),"render",(function(){return f.createElement(we,{isOpen:a.state.isOpen,ref:function(e){return a.popoverRef=e},content:a.renderSelectorContent,onClickOutside:a.closeSelector,parentElement:a.props.popoverParentElement,boundaryElement:a.props.popoverParentElement,positions:a.props.positions,align:a.props.align,reposition:!0,padding:10},f.createElement("rect",{className:"axis-label-border","data-test":"axis-label-border",onClick:a.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),a.state={isOpen:!1},a}return Pt(n)}();Ot(Ar,"propTypes",Qa),Ot(Ar,"defaultProps",za);var Nr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.applyStyles()})),Ot(Bt(a),"componentDidUpdate",(function(e,t){a.state.currentRowNumber!==t.currentRowNumber&&a.forceUpdate(),a.applyStyles()})),Ot(Bt(a),"applyStyles",(function(){var e,t,n,o,r=xo(a.currentRowNumber),i=null!==(e=null==r?void 0:r.width)&&void 0!==e?e:0,l=null!==(t=null==r?void 0:r.height)&&void 0!==t?t:0;Ye(null===(n=a.rowNumberSelector)||void 0===n?void 0:n.popoverRef).attr("x",(null==r?void 0:r.x)-a.BUTTON_PADDING_LEFT).attr("y",(null==r?void 0:r.y)-a.BUTTON_PADDING_TOP).attr("width",i+2*a.BUTTON_PADDING_LEFT).attr("height",l+2*a.BUTTON_PADDING_TOP);var s=xo(a.allText),c=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:0,u=(null==s?void 0:s.x)+c+5;Ye(a.warningIcon).attr("x",u).attr("y",-5)})),Ot(Bt(a),"renderRowCountText",(function(){var e={};return a.props.totalRowCount>a.initialRowNumber&&(e.textDecoration="underline"),f.createElement("text",{ref:function(e){return a.ref=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"hanging",textAnchor:"middle",style:a.props.style},f.createElement("tspan",{ref:function(e){return a.allText=e},className:"load-more-drop-down-span",id:"load-more-drop-down-span-".concat(a.COMPONENT_ID)},f.createElement("tspan",{id:"visualizing-span-".concat(a.COMPONENT_ID)},"Visualizing "),f.createElement("tspan",{ref:function(e){return a.currentRowNumber=e},style:e,id:"row-number-span-".concat(a.COMPONENT_ID)},a.state.currentRowNumber)," / ".concat(a.props.totalRowCount," rows")))})),Ot(Bt(a),"renderRowDropdownButton",(function(){return a.props.totalRowCount>a.initialRowNumber?f.createElement(Ar,Mt({},a.props,{ref:function(e){return a.rowNumberSelector=e},column:a.props.xCol,positions:["top","bottom","right","left"],align:"center",totalRowCount:a.props.totalRowCount,currentRowNumber:a.state.currentRowNumber,setCurrentRowNumber:function(e){a.setState({currentRowNumber:e})}})):null})),Ot(Bt(a),"renderMaxRowWarningIcon",(function(){return a.props.totalRowCount>a.maxRows?f.createElement("svg",{ref:function(e){return a.warningIcon=e},stroke:"currentColor",fill:"#ffcc00",strokeWidth:"0",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":a.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"})):null})),Ot(Bt(a),"render",(function(){return f.createElement("g",{ref:function(e){return a.LoadMoreDropdownRef=e}},a.renderRowCountText(),a.renderRowDropdownButton(),a.renderMaxRowWarningIcon())})),a.maxRows=5e3,a.initialRowNumber=50,a.fontSize=12,a.BUTTON_PADDING_TOP=2,a.BUTTON_PADDING_LEFT=4,a.state={currentRowNumber:a.props.dataLength},a}return Pt(n)}();Ot(Nr,"propTypes",xt({},Qa)),Ot(Nr,"defaultProps",xt({},za));var kr=function(e){Lt(a,h);var t=Qt(a);function a(e){var o;return kt(this,a),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.renderAxis(),o.setState({axisRenderComplete:!0})})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){if(o.state.isAxisSelectorOpen&&t.isAxisSelectorOpen)return!1;var a=n(o.props,e),r=n(o.state,t);return!a||!r})),Ot(Bt(o),"componentDidUpdate",(function(e,t){var n=o.state.axisRenderComplete&&!t.axisRenderComplete;o.state.isAxisSelectorOpen||o.renderAxis(n)})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1})),Ot(Bt(o),"setScale",(function(){o.axis.scale(o.props.scale)})),Ot(Bt(o),"getMaxTickLabelWidth",(function(){var e=o.props,t=e.orient,n=e.outerHeight,a=e.outerWidth;return function(e){if(!e)return 20;var t=20,n=Math.floor(.5*e/10);return n<6?t=6:n<20&&(t=n),t}("Left"===t||"Right"===t?a:n)})),Ot(Bt(o),"setTickValues",(function(){var e,t,n=o.props.scale,a=o.maxLabelWidth;o.axis.tickFormat((function(e){var t=Co({d:e,scale:n,maxLabelWidth:a});return null!=t&&t.formattedLabel?t.formattedLabel:e})),null!==(e=o.props.scale)&&void 0!==e&&null!==(t=e.tickLabels)&&void 0!==t&&t.length&&o.axis.tickValues(o.props.scale.tickLabels),o.setTickSize()})),Ot(Bt(o),"setTickSize",(function(){o.axis.tickSizeOuter(0),"Left"===o.props.orient&&o.props.innerWidth?o.axis.tickSizeInner(-o.props.innerWidth):"Bottom"===o.props.orient&&o.props.innerHeight?o.axis.tickSizeInner(o.props.innerHeight):o.axis.tickSizeInner(0)})),Ot(Bt(o),"applyAxis",(function(){o.axisElement&&Ye(o.axisElement).call(o.axis)})),Ot(Bt(o),"styleAxisLabels",(function(){"Bottom"===o.props.orient?Ye(o.axisElement).selectAll(".tick text").attr("transform","translate(0, 10)"):"Top"===o.props.orient?Ye(o.axisElement).selectAll(".tick text").attr("transform","translate(0, -5)"):"Left"===o.props.orient?Ye(o.axisElement).selectAll(".tick text").attr("transform","translate(-5, 0)"):"Right"===o.props.orient&&Ye(o.axisElement).selectAll(".tick text").attr("transform","translate(5, 0)")})),Ot(Bt(o),"rotateLabelsIfNeeded",(function(){if("Bottom"===o.props.orient||"Top"===o.props.orient){var e=(t=o.axisElement,a=!1,Ye(t).selectAll("g.tick text").each((function(){if(!a){var e=Ye(this).node().getBoundingClientRect();n&&e.x<n.x+n.width+10&&(a=!0),n=e}})),a);e&&("Bottom"===o.props.orient?Ye(o.axisElement).selectAll(".tick text").style("text-anchor","end").attr("dominant-baseline","text-top").attr("transform","rotate(-45, 0, ".concat(o.props.innerHeight,") translate(-10, 0)")):"Top"===o.props.orient&&Ye(o.axisElement).selectAll(".tick text").style("text-anchor","start").attr("dominant-baseline","auto").attr("transform","rotate(-45, 0, 0) translate(5, 0)")),o.prevLabelsShouldRotate=o.labelsShouldRotate,o.labelsShouldRotate=e}var t,n,a})),Ot(Bt(o),"addTooltipsToLabels",(function(){var e=o.props.scale,t=o.maxLabelWidth;Ye(o.axisElement).selectAll(".axis .tick text").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").attr("data-for",o.props.chartTooltipID).attr("data-effect","float").attr("data-tip",(function(n){var a;if("..."===(null===(a=Ye(this).text())||void 0===a?void 0:a.slice(-3))){var o=Co({d:n,scale:e,maxLabelWidth:t}).fullWidthLabel;if(o)return o}return null})),o.prevMaxLabelWidth=o.maxLabelWidth})),Ot(Bt(o),"renderAxis",(function(e){var t;switch(o.props.orient){case"Bottom":o.axis=Ze();break;case"Left":o.axis=Je();break;case"Right":o.axis=Xe();break;case"Top":o.axis=Ge()}if(o.maxLabelWidth=o.getMaxTickLabelWidth(),o.setScale(),o.setTickValues(),o.applyAxis(),o.styleAxisLabels(),o.rotateLabelsIfNeeded(),o.addTooltipsToLabels(),Ye(o.axisElement).selectAll(".axis path").style("display","none"),"LINEAR"!==(null===(t=o.props.scale)||void 0===t?void 0:t.type)?Ye(o.axisElement).selectAll("g.tick").select("line").style("opacity",0):(Ye(o.axisElement).selectAll(".axis line").style("stroke-width","1px").style("stroke","currentColor").style("opacity","0.08").style("shape-rendering","crispedges"),Ye(o.axisElement).selectAll("g.tick").select("line").style("opacity",.1),Ye(o.axisElement).selectAll("g.tick").filter((function(e){return 0==e})).select("line").style("opacity",.3)),o.axisElement){var n=o.axisElement.getBBox?o.axisElement.getBBox():void 0,a=o.axisElement.getBoundingClientRect?o.axisElement.getBoundingClientRect():void 0,r=0,i=0;n&&a&&(r=(null==a?void 0:a.x)-(null==n?void 0:n.x),i=(null==a?void 0:a.y)-(null==n?void 0:n.y));var l=[];if(Ye(o.axisElement).selectAll("g.tick text").each((function(){var e=Ye(this).node().getBoundingClientRect();l.push({left:e.left-r,bottom:e.bottom-i,right:e.right-r,top:e.top-i})})),l){var s=uo(l);o.labelBBox=xt({},s)}}o.adjustTitleToFit(),o.adjustAxisSelectorBorder(),o.adjustAxisScalerBorder(),e?o.props.onAxisRenderComplete(o.props.orient):!o.state.axisRenderComplete||o.prevLabelsShouldRotate===o.labelsShouldRotate&&o.prevMaxLabelWidth===o.maxLabelWidth||o.props.onLabelRotation()})),Ot(Bt(o),"getTitleTextHeight",(function(){var e,t,n=parseInt(null===(e=o.titleRef)||void 0===e||null===(t=e.style)||void 0===t?void 0:t.fontSize,10);return isNaN(n)?12:n})),Ot(Bt(o),"openSelector",(function(){o.setState({isAxisSelectorOpen:!0})})),Ot(Bt(o),"closeSelector",(function(){o.setState({isAxisSelectorOpen:!1})})),Ot(Bt(o),"renderAxisSelector",(function(e){var t=e.positions,n=e.isSecondAxis,a=e.childProps,r=void 0===a?{}:a;return f.createElement(Rr,{chartContainerRef:o.props.chartContainerRef,changeNumberColumnIndices:o.props.changeNumberColumnIndices,changeStringColumnIndex:o.props.changeStringColumnIndex,legendColumn:o.props.legendColumn,popoverParentElement:o.props.popoverParentElement,numberColumnIndices:o.props.numberColumnIndices,numberColumnIndices2:o.props.numberColumnIndices2,stringColumnIndices:o.props.stringColumnIndices,stringColumnIndex:o.props.stringColumnIndex,dateColumnsOnly:o.props.dateColumnsOnly,isAggregation:o.props.isAggregation,tooltipID:o.props.tooltipID,hidden:!o.shouldRenderAxisSelector(),columns:o.props.columns,scale:o.props.scale,align:"center",position:"right",positions:t,childProps:r,hasSecondAxis:o.props.hasSecondAxis,axisSelectorRef:function(e){return o.axisSelector=e},isOpen:o.state.isAxisSelectorOpen,closeSelector:o.closeSelector,isSecondAxis:n},f.createElement("rect",{className:"axis-label-border ".concat(o.shouldRenderAxisSelector()?"":"hidden"),"data-test":"axis-label-border",onClick:o.openSelector,fill:"transparent",stroke:"transparent",strokeWidth:"1px",rx:"4"}))})),Ot(Bt(o),"renderAxisTitleText",(function(){var e,t=o.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":o.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 o.titleText=e}},n),o.shouldRenderAxisSelector()&&f.createElement("tspan",{className:"react-autoql-axis-selector-arrow","data-test":"dropdown-arrow",opacity:"0",fontSize:"8px"}," ","▼"))})),Ot(Bt(o),"renderBottomAxisTitle",(function(){var e,t,n,a,r=(null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(a=o.labelBBox)||void 0===a?void 0:a.height)&&void 0!==n?n:0),i=o.props.innerWidth/2,l=r+o.AXIS_TITLE_PADDING;return f.createElement("g",null,f.createElement("text",{ref:function(e){return o.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:i,y:l,style:o.labelInlineStyles},o.renderAxisTitleText()),o.renderAxisSelector({positions:["top","bottom","right","left"]}))})),Ot(Bt(o),"renderLeftAxisTitle",(function(){var e,t,n=(null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-o.AXIS_TITLE_PADDING,a=-.5*o.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return o.titleRef=e},id:"left-axis-title-".concat(o.AXIS_KEY),className:"left-axis-title","data-test":"left-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:a,y:n,textLength:10,lengthAdjust:"spacingAndGlyphs",style:o.labelInlineStyles},o.renderAxisTitleText()),o.renderAxisSelector({positions:["right","bottom","left","top"]}))})),Ot(Bt(o),"renderRightAxisTitle",(function(){var e,t,n,a,r=(null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)+(null!==(n=null===(a=o.labelBBox)||void 0===a?void 0:a.width)&&void 0!==n?n:0)+o.AXIS_TITLE_PADDING,i=-.5*o.props.innerHeight;return f.createElement("g",null,f.createElement("text",{ref:function(e){return o.titleRef=e},id:"right-axis-title-".concat(o.AXIS_KEY),className:"right-axis-title","data-test":"right-axis-title",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",transform:"rotate(-90)",x:i,y:r,textLength:10,lengthAdjust:"spacingAndGlyphs",style:o.labelInlineStyles},o.renderAxisTitleText()),o.renderAxisSelector({isSecondAxis:!0,positions:["left","top","bottom","right"]}))})),Ot(Bt(o),"renderTopAxisTitle",(function(){var e,t,n=null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0,a=o.props.innerWidth/2,r=n-o.AXIS_TITLE_PADDING;return f.createElement("g",null,f.createElement("text",{ref:function(e){return o.titleRef=e},className:"x-axis-label","data-test":"x-axis-label",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",x:a,y:r,style:o.labelInlineStyles},o.renderAxisTitleText()),o.renderAxisSelector({isSecondAxis:!0,positions:["bottom","top","left","right"]}))})),Ot(Bt(o),"adjustAxisSelectorBorder",(function(){var e,t,n;if(o.titleRef){var a=xo(o.titleRef),r=null!==(e=null==a?void 0:a.height)&&void 0!==e?e:0,i=null!==(t=null==a?void 0:a.width)&&void 0!==t?t:0;Ye(o.axisSelector).attr("transform",null===(n=o.titleRef)||void 0===n?void 0:n.getAttribute("transform")).attr("width",Math.round(i+2*o.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("height",Math.round(r+2*o.AXIS_TITLE_BORDER_PADDING_TOP)).attr("x",Math.round((null==a?void 0:a.x)-o.AXIS_TITLE_BORDER_PADDING_LEFT)).attr("y",Math.round((null==a?void 0:a.y)-o.AXIS_TITLE_BORDER_PADDING_TOP))}})),Ot(Bt(o),"adjustAxisScalerBorder",(function(){var e,t,n,a,r,i,l,s;o.axisScaler&&Ye(o.axisScaler).attr("x",Math.round((null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.x)&&void 0!==e?e:0)-o.BUTTON_PADDING)).attr("y",Math.round((null!==(n=null===(a=o.labelBBox)||void 0===a?void 0:a.y)&&void 0!==n?n:0)-o.BUTTON_PADDING)).attr("width",Math.round((null!==(r=null===(i=o.labelBBox)||void 0===i?void 0:i.width)&&void 0!==r?r:0)+2*o.BUTTON_PADDING)).attr("height",Math.round((null!==(l=null===(s=o.labelBBox)||void 0===s?void 0:s.height)&&void 0!==l?l:0)+2*o.BUTTON_PADDING))})),Ot(Bt(o),"adjustTitleToFit",(function(){if(o.titleRef)if("Bottom"===o.props.orient){var e,t,n,a,r=(null!==(e=null===(t=o.labelBBox)||void 0===t?void 0:t.y)&&void 0!==e?e:0)+(null!==(n=null===(a=o.labelBBox)||void 0===a?void 0:a.height)&&void 0!==n?n:0),i=o.props.innerWidth/2,l=r+o.AXIS_TITLE_PADDING;Ye(o.titleRef).attr("x",i).attr("y",l),Ye(o.loadMoreDropdown).attr("transform","translate(".concat(i,", ").concat(l+15,")"))}else if("Top"===o.props.orient){var s,c,u=null!==(s=null===(c=o.labelBBox)||void 0===c?void 0:c.y)&&void 0!==s?s:0,d=o.props.innerWidth/2,p=u-o.AXIS_TITLE_PADDING;Ye(o.titleRef).attr("x",d).attr("y",p)}else if(("Left"===o.props.orient||"Right"===o.props.orient)&&o.props.chartRef){var m,f=o.props.outerHeight-2*o.props.chartPadding;if(Ye(o.titleRef).attr("textLength",null),(null!==(m=o.titleRef.getBBox().width)&&void 0!==m?m:0)+2*o.AXIS_TITLE_BORDER_PADDING_LEFT>f){var g=Math.floor(f)-2*o.AXIS_TITLE_BORDER_PADDING_LEFT;g<0&&(g=10),Ye(o.titleRef).attr("textLength",g)}var v=o.titleRef.getBBox(),h=-1*(v.x+v.width)+o.props.deltaY-o.AXIS_TITLE_BORDER_PADDING_LEFT;if(h<0){var y=-h;Ye(o.titleRef).attr("transform","rotate(-90) translate(".concat(-y,", 0)"))}}})),Ot(Bt(o),"renderAxisTitle",(function(){switch(o.props.orient){case"Left":return o.renderLeftAxisTitle();case"Right":return o.renderRightAxisTitle();case"Bottom":return o.renderBottomAxisTitle();case"Top":return o.renderTopAxisTitle();default:return null}})),Ot(Bt(o),"renderLoadMoreDropdown",(function(){return"Bottom"===o.props.orient&&o.props.enableAjaxTableData?f.createElement("g",{ref:function(e){return o.loadMoreDropdown=e}},f.createElement(Nr,Mt({},o.props,{style:o.labelInlineStyles}))):null})),Ot(Bt(o),"shouldRenderAxisSelector",(function(){var e;return null===(e=o.props.scale)||void 0===e?void 0:e.hasDropdown})),Ot(Bt(o),"shouldRenderAxisScaler",(function(){var e,t;return!!o.labelBBox&&"LINEAR"===(null===(e=o.props.scale)||void 0===e?void 0:e.type)&&1!==(null===(t=o.props.scale)||void 0===t?void 0:t.domain().length)})),Ot(Bt(o),"renderAxisScaler",(function(){return o.shouldRenderAxisScaler()?f.createElement(yr,{toggleChartScale:o.props.toggleChartScale,labelBBox:o.labelBBox,childProps:{ref:function(e){return o.axisScaler=e}}}):null})),Ot(Bt(o),"render",(function(){return f.createElement("g",{"data-test":"axis",ref:function(e){return o.ref=e},transform:"translate(".concat(o.props.translateX,", ").concat(o.props.translateY,")"),style:o.labelInlineStyles},f.createElement("g",{className:"axis axis-".concat(o.props.orient),ref:function(e){return o.axisElement=e}}),o.renderAxisTitle(),o.renderLoadMoreDropdown(),o.renderAxisScaler())})),o.AXIS_KEY=b(),o.LEGEND_ID="axis-".concat(b()),o.BUTTON_PADDING=5,o.AXIS_TITLE_PADDING=20,o.AXIS_TITLE_BORDER_PADDING_LEFT=10,o.AXIS_TITLE_BORDER_PADDING_TOP=5,o.swatchElements=[],o.maxRows=5e3,o.initialRowNumber=50,o.prevMaxLabelWidth=20,o.labelInlineStyles={fontSize:"12px",fontFamily:"inherit",fill:"currentColor",fillOpacity:.9,cursor:"default"},o.labelsShouldRotate=!1,o.prevLabelsShouldRotate=!1,o.state={currentRowNumber:o.props.dataLength},o}return Pt(a)}();Ot(kr,"propTypes",xt(xt({},Qa),{},{scale:y.func.isRequired,orient:y.string,translateX:y.number,translateY:y.number})),Ot(kr,"defaultProps",xt(xt({},za),{},{orient:"Bottom",translate:void 0,translateX:0,translateY:0,onAxisRenderComplete:function(){}}));var Ir=function(e){return e},Pr=function(e){for(var t=[],n=0,a=e.length;n<a;n++)t[n]=e[a-n-1];return t},Or=function(e,t){e.each((function(){var e,n=Ye(this),a=n.text().split(/\s+/).reverse(),o=[];n.attr("y");for(var r=parseFloat(n.attr("dy"))||0,i=n.text(null).append("tspan").attr("x",0).attr("dy",r+"em");e=a.pop();)o.push(e),i.text(o.join(" ")),i.node().getComputedTextLength()>t&&o.length>1&&(o.pop(),i.text(o.join(" ")),o=[e],i=n.append("tspan").attr("x",0).attr("dy",1.2+r+"em").text(e))}))},Mr={d3_drawShapes:function(e,t,n,a,o,r){"rect"===e?t.attr("height",n).attr("width",a):"circle"===e?t.attr("r",o):"line"===e?t.attr("x1",0).attr("x2",a).attr("y1",0).attr("y2",0):"path"===e&&t.attr("d",r)},d3_addText:function(e,t,n,a,o){t.append("text").attr("class",a+"label");var r=e.selectAll("g.".concat(a,"cell text.").concat(a,"label")).data(n).text(Ir);return o&&e.selectAll("g.".concat(a,"cell text.").concat(a,"label")).call(Or,o),r},d3_calcType:function(e,t,n,a,o,r){var i=e.invertExtent?function(e,t,n){var a=e.range().map((function(a){var o=e.invertExtent(a);return t(o[0])+" "+n+" "+t(o[1])}));return{data:e.range(),labels:a,feature:Ir}}(e,o,r):e.ticks?function(e,t,n){var a=[];if(t.length>1)a=t;else for(var o=e.domain(),r=(o[o.length-1]-o[0])/(t-1),i=0;i<t;i++)a.push(o[0]+i*r);var l=a.map(n);return{data:a,labels:l,feature:function(t){return e(t)}}}(e,n,o):function(e){return{data:e.domain(),labels:e.domain(),feature:function(t){return e(t)}}}(e),l=e.range&&e.range()||e.domain();return i.labels=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if("object"===Rt(t)){if(0===t.length)return e;for(var r=t.length;r<e.length;r++)t.push(e[r]);return t}if("function"==typeof t){for(var i=[],l=e.length,s=0;s<l;s++)i.push(t({i:s,genLength:l,generatedLabels:e,domain:n,range:a,labelDelimiter:o}));return i}return e}(i.labels,a,e.domain(),l,r),t&&(i.labels=Pr(i.labels),i.data=Pr(i.data)),i},d3_filterCells:function(e,t){var n=e.data.map((function(t,n){return{data:t,label:e.labels[n]}})).filter(t),a=n.map((function(e){return e.data})),o=n.map((function(e){return e.label}));return e.data=e.data.filter((function(e){return-1!==a.indexOf(e)})),e.labels=e.labels.filter((function(e){return-1!==o.indexOf(e)})),e},d3_placement:function(e,t,n,a,o,r){t.attr("transform",n),a.attr("transform",o),"horizontal"===e&&a.style("text-anchor",r)},d3_addEvents:function(e,t){e.on("mouseover.legend",(function(e){!function(e,t,n){e.call("cellover",n,t)}(t,e,this)})).on("mouseout.legend",(function(e){!function(e,t,n){e.call("cellout",n,t)}(t,e,this)})).on("click.legend",(function(e){!function(e,t,n){e.call("cellclick",n,t)}(t,e,this)}))},d3_title:function(e,t,n,a){if(""!==t){e.selectAll("text."+n+"legendTitle").data([t]).enter().append("text").attr("class",n+"legendTitle"),e.selectAll("text."+n+"legendTitle").text(t),a&&e.selectAll("text."+n+"legendTitle").call(Or,a);var o=e.select("."+n+"legendCells"),r=e.select("."+n+"legendTitle").nodes().map((function(e){return e.getBBox().height}))[0],i=-o.nodes().map((function(e){return e.getBBox().x}))[0];o.attr("transform","translate("+i+","+r+")")}},d3_defaultLocale:{format:ot,formatPrefix:rt},d3_defaultFormatSpecifier:".01f",d3_defaultDelimiter:"to"};function Lr(){var e,t,n,a=Ve(),o="path",r=15,i=15,l=10,s=2,c=[5],u=[],d="",p=!1,m="",f=Mr.d3_defaultLocale,g=Mr.d3_defaultFormatSpecifier,v=20,h="middle",y=Mr.d3_defaultDelimiter,b="vertical",C=!1,E=$e().type(et).size(75)(),S=st("cellover","cellout","cellclick");function T(T){var D=Mr.d3_calcType(a,C,c,u,f.format(g),y);T.selectAll("g").data([a]).enter().append("g").attr("class",d+"legendCells"),e&&Mr.d3_filterCells(D,e);var x=T.select("."+d+"legendCells").selectAll("."+d+"cell").data(D.data),w=x.enter().append("g").attr("class",d+"cell");w.append(o).attr("class",d+"swatch");var R=T.selectAll("g."+d+"cell "+o+"."+d+"swatch").data(D.data);Mr.d3_addEvents(w,S),x.exit().transition().style("opacity",0).remove(),R.exit().transition().style("opacity",0).remove(),R=R.merge(R),Mr.d3_drawShapes(o,R,i,r,l,E);var A=Mr.d3_addText(T,w,D.labels,d,t);x=w.merge(x);var N=A.nodes().map((function(e){return e.getBBox()})),k=R.nodes().map((function(e){return e.getBBox()}));p?R.attr("class",(function(e){return"".concat(d,"swatch ").concat(D.feature(e))})):"line"==o?R.style("stroke",D.feature):R.style("fill",D.feature);var I,P,O="start"==h?0:"middle"==h?.5:1;if("vertical"===b){var M=N.map((function(e,t){return Math.max(e.height,k[t].height)}));I=function(e,t){var n=He(M.slice(0,t));return"translate(0, ".concat(n+t*s,")")},P=function(e,t){return"translate( ".concat(k[t].width+k[t].x+v,", ").concat(k[t].y+k[t].height/2+4,")")}}else"horizontal"===b&&(I=function(e,t){return"translate(".concat(t*(k[t].width+s),",0)")},P=function(e,t){return"translate(".concat(k[t].width*O+k[t].x,",\n ").concat(k[t].height+k[t].y+v+8,")")});Mr.d3_placement(b,x,I,A,P,h),Mr.d3_title(T,m,d,n),x.transition().style("opacity",1)}return T.scale=function(e){return arguments.length?(a=e,T):a},T.cells=function(e){return arguments.length?((e.length>1||e>=2)&&(c=e),T):c},T.cellFilter=function(t){return arguments.length?(e=t,T):e},T.shape=function(e){return arguments.length?(o=e,T):o},T.path=function(e){return arguments.length?(E=e,T):E},T.shapeWidth=function(e){return arguments.length?(r=+e,T):r},T.shapeHeight=function(e){return arguments.length?(i=+e,T):i},T.shapeRadius=function(e){return arguments.length?(l=+e,T):l},T.shapePadding=function(e){return arguments.length?(s=+e,T):s},T.labels=function(e){return arguments.length?(u=e,T):u},T.labelAlign=function(e){return arguments.length?("start"!=e&&"end"!=e&&"middle"!=e||(h=e),T):h},T.locale=function(e){return arguments.length?(f=it(e),T):f},T.labelFormat=function(e){return arguments.length?(g=lt(e),T):T.locale().format(g)},T.labelOffset=function(e){return arguments.length?(v=+e,T):v},T.labelDelimiter=function(e){return arguments.length?(y=e,T):y},T.labelWrap=function(e){return arguments.length?(t=e,T):t},T.useClass=function(e){return arguments.length?(!0!==e&&!1!==e||(p=e),T):p},T.orient=function(e){return arguments.length?("horizontal"!=(e=e.toLowerCase())&&"vertical"!=e||(b=e),T):b},T.ascending=function(e){return arguments.length?(C=!!e,T):C},T.classPrefix=function(e){return arguments.length?(d=e,T):d},T.title=function(e){return arguments.length?(m=e,T):m},T.titleWidth=function(e){return arguments.length?(n=e,T):n},T.textWrap=function(e){return arguments.length?(textWrap=e,T):textWrap},T.on=function(){var e=S.on.apply(S,arguments);return e===S?T:e},T}var qr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.renderAllLegends()})),Ot(Bt(a),"shouldComponentUpdate",(function(e){return!$o(a.props.columns,e.columns)||(a.props.height!==e.height||a.props.outerHeight!==e.outerHeight)})),Ot(Bt(a),"componentDidUpdate",(function(){a.renderAllLegends()})),Ot(Bt(a),"componentWillUnmount",(function(){jo(a.rightLegendElement),jo(a.rightLegendElement2)})),Ot(Bt(a),"renderAllLegends",(function(){if(a.renderLegend(a.rightLegendElement,a.props.legendColumnIndices,a.props.colorScale),a.props.hasSecondAxis){a.renderLegend(a.rightLegendElement2,a.props.numberColumnIndices2,a.props.colorScale2,!0)}a.justMounted&&(a.justMounted=!1,a.props.onRenderComplete())})),Ot(Bt(a),"removeHiddenLegendLabels",(function(e){var t,n,o,r=null===(t=a.legendClippingContainer)||void 0===t?void 0:t.getBoundingClientRect(),i=(null!==(n=null==r?void 0:r.y)&&void 0!==n?n:0)+(null!==(o=null==r?void 0:r.height)&&void 0!==o?o:0),l=!1,s=void 0,c=void 0;if(Ye(e).selectAll(".cell").each((function(e){if(l)Ye(this).remove();else{var t,n,a=this.getBoundingClientRect();(null!==(t=null==a?void 0:a.y)&&void 0!==t?t:0)+(null!==(n=null==a?void 0:a.height)&&void 0!==n?n:0)>i&&(s=Ye(this).attr("y"),c=Ye(this).attr("transform"),Ye(this).remove(),l=!0)}})),l&&c){var u=a.props.chartTooltipID;Ye(e).select(".legend-hidden-field-arrow").remove(),Ye(e).append("text").html("&#9660 ...").attr("class","legend-hidden-field-arrow").attr("y",s+20).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","12px").style("color","red").style("font-weight","bold").style("cursor","default")}})),Ot(Bt(a),"styleLegendTitleNoBorder",(function(e){Ye(e).select(".legendTitle").style("font-weight","bold").attr("data-test","legend-title").attr("fill-opacity",.9).attr("transform","translate(0,-3)")})),Ot(Bt(a),"styleLegendTitleWithBorder",(function(e){Ye(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"),a.titleBBox={};try{a.titleBBox=Ye(e).select(".legendTitle").node().getBBox()}catch(e){console.error(e)}})),Ot(Bt(a),"onClick",(function(e,t){var n=null==t?void 0:t.find((function(t){return t.label===e})),o=!(null!=n&&n.hidden),r=null==t?void 0:t.filter((function(e){return!e.hidden}));(!o||(null==r?void 0:r.length)>1)&&a.props.onLegendClick(n)})),Ot(Bt(a),"getLegendTitleFromColumns",(function(e){var t,n;if(Na(a.props.columns))return null!==(t=null===(n=a.props.legendColumn)||void 0===n?void 0:n.display_name)&&void 0!==t?t:"Legend";var o="Fields",r=e.map((function(e){return a.props.columns[e]})),i=e.map((function(e){return a.props.columns[e].type})),l=!i.find((function(e){return e!==i[0]}));if(a.props.hasSecondAxis&&l){var s=Rn[i[0]];s&&(o="".concat(s," ").concat(o))}var c=r.map((function(e){return e.aggType}));if(!c.find((function(e){return e!==c[0]}))){var u,d=null===(u=Hn.find((function(e){return e.value===c[0]})))||void 0===u?void 0:u.displayName;d&&(o="".concat(o," (").concat(d,")"))}return o})),Ot(Bt(a),"renderLegend",(function(e,t,n,o){try{var r=Bt(a),i=Ga(a.props.columns,n,t);if(!i)return;var l=a.getLegendTitleFromColumns(t),s=a.getLegendScale(i);if("right"===a.props.placement){var c,u,d,p;Ye(e).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","10px");var m=Lr().orient("vertical").path($e().type(tt).size(100)()).shapePadding(8).labelWrap(100).labelOffset(10).scale(s).on("cellclick",(function(e){r.onClick(e,i)}));if(o?m.shape("line"):a.props.shape&&m.shape(a.props.shape),l&&m.title(l).titleWidth(a.MAX_LEGEND_WIDTH),Ye(e).call(m).style("font-family","inherit"),o){var f,g,v=null===(f=a.rightLegendElement)||void 0===f?void 0:f.getBoundingClientRect(),h=null!==(g=null==v?void 0:v.height)&&void 0!==g?g:0;Ye(e).attr("transform","translate(".concat(a.LEFT_PADDING,", ").concat(h+30,")"))}l&&(a.props.onLegendTitleClick?a.styleLegendTitleWithBorder(e):a.styleLegendTitleNoBorder(e));var y=(null===(c=Ye(e).node())||void 0===c||null===(u=c.getBBox())||void 0===u?void 0:u.width)||0;y>a.MAX_LEGEND_WIDTH&&(y=a.MAX_LEGEND_WIDTH);var b=null===(d=a.rightLegendElement)||void 0===d?void 0:d.getBoundingClientRect(),C=null===(p=a.rightLegendElement2)||void 0===p?void 0:p.getBoundingClientRect(),E=uo([b,C]),S=isNaN(null==E?void 0:E.width)?0:null==E?void 0:E.width;S>a.MAX_LEGEND_WIDTH&&(S=a.MAX_LEGEND_WIDTH);var T=a.props.height+10;Ye(a.legendClippingContainer).attr("height",T+a.BOTTOM_PADDING).attr("width",S+a.LEFT_PADDING),a.removeHiddenLegendLabels(e)}else if("bottom"===a.props.placement){Ye(a.bottomLegendElement).attr("class","legendOrdinal").style("fill","currentColor").style("fill-opacity","1").style("font-family","inherit").style("font-size","10px");m=Lr().orient("horizontal").shapePadding(r.LEGEND_WIDTH).labelWrap(a.MAX_LEGEND_WIDTH).labelAlign("left").scale(s).on("cellclick",(function(e){r.onClick(e,i)}));Ye(a.bottomLegendElement).call(m).style("font-family","inherit")}a.applyStylesForHiddenSeries(e,i)}catch(e){console.error(e)}})),Ot(Bt(a),"applyStylesForHiddenSeries",(function(e,t){try{Ye(e).selectAll(".cell").each((function(e){var n=t.find((function(t){return t.label===e}));n&&(Ye(this).select(".swatch").attr("stroke",n.color).attr("stroke-location","outside"),n.hidden?Ye(this).attr("class","cell hidden"):Ye(this).attr("class","cell visible"))}))}catch(e){console.error(e)}})),Ot(Bt(a),"getLegendScale",(function(e){var t=e.map((function(e){return e.color}));return _e().domain(e.map((function(e){return e.label}))).range(t)})),Ot(Bt(a),"render",(function(){return f.createElement("g",{"data-test":"legend"},"right"===a.props.placement&&f.createElement(f.Fragment,null,f.createElement("g",{ref:function(e){return a.rightLegendElement=e},id:a.LEGEND_ID,"data-test":"right-legend",className:"legendOrdinal right-legend",transform:"translate(".concat(a.LEFT_PADDING,", 8)")}),a.props.hasSecondAxis&&f.createElement("g",{ref:function(e){return a.rightLegendElement2=e},id:a.LEGEND_ID,"data-test":"right-legend-2",className:"legendOrdinal right-legend-2"})),f.createElement("rect",{ref:function(e){return a.legendClippingContainer=e},width:0,height:a.props.height,transform:"translate(0,-15)",style:{stroke:"transparent",fill:"transparent",pointerEvents:"none"}}),"bottom"===a.props.placement&&f.createElement("g",{ref:function(e){return a.bottomLegendElement=e},"data-test":"bottom-legend",id:a.LEGEND_ID,className:"legendOrdinal"}))})),a.MAX_LEGEND_WIDTH=200,a.LEGEND_ID="axis-".concat(b()),a.BUTTON_PADDING=5,a.LEFT_PADDING=20,a.BOTTOM_PADDING=10,a.justMounted=!0,a}return Pt(n)}();Ot(qr,"propTypes",{title:y.string,legendColumn:y.shape({}),placement:y.string,onLabelChange:y.func,onLegendClick:y.func,onLegendTitleClick:y.func,numberColumnIndices:y.arrayOf(y.number),topMargin:y.number,bottomMargin:y.number,scale:y.func,translate:y.string,height:y.number,width:y.number,onRenderComplete:y.func}),Ot(qr,"defaultProps",{title:void 0,onLabelChange:function(){},onLegendClick:function(){},onRenderComplete:function(){},translate:void 0,placement:"right"});var Vr=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"onAxisRenderComplete",(function(e){switch(e){case"Right":a.rightAxisComplete=!0;break;case"Left":a.leftAxisComplete=!0;break;case"Bottom":a.bottomAxisComplete=!0;break;case"Top":a.topAxisComplete=!0;break;case"Legend":a.legendComplete=!0}a.shouldRenderRightAxis()||a.rightAxisComplete||(a.rightAxisComplete=!0),a.shouldRenderTopAxis()||a.topAxisComplete||(a.topAxisComplete=!0),a.shouldRenderLegend()||a.legendComplete||(a.legendComplete=!0),a.topAxisComplete&&a.bottomAxisComplete&&a.leftAxisComplete&&a.rightAxisComplete&&a.legendComplete&&a.forceUpdate((function(){a.props.onAxesRenderComplete()}))})),Ot(Bt(a),"renderBottomAxis",(function(e,t){return f.createElement(kr,Mt({},a.props,{ref:function(e){return a.bottomAxis=e},key:a.BOTTOM_AXIS_KEY,orient:"Bottom",scale:a.props.xScale,translateY:0,translateX:0,innerWidth:e,innerHeight:t,onAxisRenderComplete:a.onAxisRenderComplete,hasSecondAxis:a.hasSecondAxis()}))})),Ot(Bt(a),"renderLeftAxis",(function(e,t){return f.createElement(kr,Mt({},a.props,{key:a.LEFT_AXIS_KEY,ref:function(e){return a.leftAxis=e},orient:"Left",scale:a.props.yScale,showGridLines:a.props.yGridLines,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:a.onAxisRenderComplete,hasSecondAxis:a.hasSecondAxis()}))})),Ot(Bt(a),"shouldRenderTopAxis",(function(){return!!a.props.xScale2})),Ot(Bt(a),"renderTopAxis",(function(e,t){return a.shouldRenderTopAxis()?f.createElement(kr,Mt({},a.props,{key:a.TOP_AXIS_KEY,ref:function(e){return a.topAxis=e},orient:"Top",scale:a.props.xScale2,showGridLines:!1,innerWidth:e,innerHeight:t,translateY:0,translateX:0,onAxisRenderComplete:a.onAxisRenderComplete,hasSecondAxis:a.hasSecondAxis()})):null})),Ot(Bt(a),"shouldRenderRightAxis",(function(){return!!a.props.yCol2&&!!a.props.yScale2})),Ot(Bt(a),"shouldRenderLegend",(function(){return!!a.props.legendLocation})),Ot(Bt(a),"renderRightAxis",(function(e,t){var n=a.shouldRenderRightAxis(),o=a.shouldRenderLegend();return n||o?f.createElement("g",{ref:function(e){return a.rightAxis=e},transform:"translate(".concat(e,", 0)")},n&&f.createElement(kr,Mt({},a.props,{ref:function(e){return a.rightAxisWithoutLegend=e},key:a.RIGHT_AXIS_KEY,orient:"Right",scale:a.props.yScale2,showGridLines:!1,hasRightLegend:!1,hasBottomLegend:!1,innerWidth:e,innerHeight:t,onAxisRenderComplete:a.onAxisRenderComplete,hasSecondAxis:a.hasSecondAxis()})),o&&a.renderRightLegend()):null})),Ot(Bt(a),"hasSecondAxis",(function(){return a.shouldRenderRightAxis()||a.shouldRenderTopAxis()})),Ot(Bt(a),"renderRightLegend",(function(){var e,t,n,o,r=0;null!==(e=a.rightAxisWithoutLegend)&&void 0!==e&&e.ref&&(r=null!==(t=null===(n=xo(null===(o=a.rightAxisWithoutLegend)||void 0===o?void 0:o.ref))||void 0===n?void 0:n.width)&&void 0!==t?t:0);var i=a.shouldRenderTopAxis()?10:0;return f.createElement("g",{transform:"translate(".concat(r,",").concat(i,")")},f.createElement(qr,Mt({},a.props,{ref:function(e){return a.legendRef=e},legendColumnIndices:a.props.numberColumnIndices,legendColumnIndices2:a.props.numberColumnIndices2,placement:a.props.legendLocation,onRenderComplete:function(){return a.onAxisRenderComplete("Legend")},hasSecondAxis:a.hasSecondAxis(),shape:a.props.legendShape})))})),Ot(Bt(a),"render",(function(){var e,t,n;if(!(a.props.yScale&&a.props.xScale&&a.props.height&&a.props.width))return null;var o=(null===(e=a.props.xScale)||void 0===e?void 0:e.range())||[0,0],r=(null===(t=a.props.yScale)||void 0===t?void 0:t.range())||[0,0],i=o[1]-o[0],l=r[0]-r[1];return f.createElement("g",{ref:function(e){return a.ref=e}},null!==(n=a.props.children)&&void 0!==n?n:null,f.createElement("g",{className:"react-autoql-axes","data-test":"react-autoql-axes"},a.renderBottomAxis(i,l),a.renderLeftAxis(i,l),a.renderRightAxis(i,l),a.renderTopAxis(i,l)))})),a.LEGEND_PADDING=20,a.BOTTOM_AXIS_KEY=b(),a.LEFT_AXIS_KEY=b(),a.RIGHT_AXIS_KEY=b(),a.TOP_AXIS_KEY=b(),a}return Pt(n)}();Ot(Vr,"propTypes",xt(xt({},Qa),{},{onAxesRenderComplete:y.func})),Ot(Vr,"defaultProps",xt(xt({},za),{},{onAxesRenderComplete:function(){}}));var _r=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Qn()})),Ot(Bt(e),"onColumnClick",(function(t,n,a){var o=Ya(n,a);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:o}),e.setState({activeKey:o})})),Ot(Bt(e),"getBars",(function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e.props,r=o.columns,i=o.legendColumn,l=o.stringColumnIndex,s=o.dataFormatting,c=o.xScale;if(null==t||!t.length||!n||!e.barWidth)return null;var u=a,d=[];return t.forEach((function(t,a){if(!r[t].isSeriesHidden){var o=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?Ka(n):n(m),v=Math.abs(n(m)-Ka(n));if((isNaN(v)||isNaN(m))&&(g=Ka(n),v=0),v<.05)return null;var h=c.getValue(d[l])+u*e.barWidth,y=Wa({row:d,columns:r,colIndex:t,stringColumnIndex:l,legendColumn:i,dataFormatting:s}),b=Ya(t,p);return f.createElement("rect",{key:b,className:"bar".concat(e.state.activeKey===b?" active":""),"data-test":"bar-".concat(a,"-").concat(p),x:h,y:g,height:v,width:e.barWidth,onClick:function(){return e.onColumnClick(d,t,p)},"data-tip":y,"data-for":e.props.chartTooltipID,style:{fill:o,fillOpacity:.7}})}))),u+=1}})),d})),Ot(Bt(e),"render",(function(){var t,n=e.props,a=n.columns,o=n.numberColumnIndices,r=n.numberColumnIndices2,i=n.xScale,l=n.yScale,s=n.yScale2,c=o.filter((function(e){return!a[e].isSeriesHidden})),u=null==r?void 0:r.filter((function(e){return!a[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(o,l);return f.createElement("g",{"data-test":"columns"},p)})),e}return Pt(n)}();Ot(_r,"propTypes",Ua),Ot(_r,"defaultProps",ja);var Fr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=$o(a.props,e),o=$o(a.state,t);return!n||!o})),Ot(Bt(a),"setChartData",(function(e){var t,n,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices),a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var r=io({props:e,columnIndices1:o,axis:"y",isScaled:null===(n=a.state)||void 0===n?void 0:n.isChartScaled});a.yScale=r.scale,a.yTickValues=a.yScale.tickLabels})),Ot(Bt(a),"toggleChartScale",(function(){a.setState({isChartScaled:!a.state.isChartScaled})})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-chart"},f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:e,linearAxis:"y",hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,toggleChartScale:a.toggleChartScale,yGridLines:!0}),a.props.marginAdjustmentFinished&&f.createElement(_r,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale}))))})),a.setChartData(e),a.state={isChartScaled:!0},a}return Pt(n)}();Ot(Fr,"propTypes",Ba),Ot(Fr,"defaultProps",Ha);var Br=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Qn()})),Ot(Bt(e),"shouldComponentUpdate",(function(){return!0})),Ot(Bt(e),"onBarClick",(function(t,n,a){var o=Ya(n,a);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:o}),e.setState({activeKey:o})})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,o=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale,c=o.filter((function(e){return!n[e].isSeriesHidden}));if(!c.length)return null;var u=[],d=l.tickSize/c.length,p=0;return o.forEach((function(t,o){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)-Ka(s));if(isNaN(v)&&(v=0),v<.05)return null;var h=l(u[r])+p*d,y=Wa({row:u,columns:n,colIndex:t,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return f.createElement("rect",{key:Ya(t,m),className:"bar".concat(e.state.activeKey===Ya(t,m)?" active":""),"data-test":"bar-".concat(o,"-").concat(m),y:h,x:g>0?Ka(s):s(g),width:v,height:d,onClick:function(){return e.onBarClick(u,t,m)},"data-tip":y,"data-for":e.props.chartTooltipID,style:{fill:c,fillOpacity:.7}})}))),p+=1}})),f.createElement("g",{"data-test":"bars"},u)})),e}return Pt(n)}();Ot(Br,"propTypes",Ua),Ot(Br,"defaultProps",ja);var Hr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=$o(a.props,e),o=$o(a.state,t);return!n||!o})),Ot(Bt(a),"setChartData",(function(e){var t,n,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices),a.yScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"y"});var r=io({props:e,columnIndices1:o,axis:"x",isScaled:null===(n=a.state)||void 0===n?void 0:n.isChartScaled});a.xScale=r.scale,a.xTickValues=a.xScale.tickLabels})),Ot(Bt(a),"toggleChartScale",(function(){a.setState({isChartScaled:!a.state.isChartScaled})})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-bar-chart"},f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:e,yCol:a.props.columns[a.props.stringColumnIndex],linearAxis:"x",hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,toggleChartScale:a.toggleChartScale}),a.props.marginAdjustmentFinished&&f.createElement(Br,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale}))))})),a.setChartData(e),a.state={isChartScaled:!0},a}return Pt(n)}();Ot(Hr,"propTypes",Ba),Ot(Hr,"defaultProps",Ha);var Qr=function(e,t){var n=t[0]-e[0],a=t[1]-e[1];return{length:Math.sqrt(Math.pow(n,2)+Math.pow(a,2)),angle:Math.atan2(a,n)}},zr=function(e,t,n,a){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2,r=t,i=n;t&&n||(r=e,i=e);var l=Qr(r,i),s=l.angle+(a?Math.PI:0),c=l.length*o,u=e[0]+Math.cos(s)*c,d=e[1]+Math.sin(s)*c;return[u,d]},Ur=function(e,t,n,a){var o=zr(n[t-1],n[t-2],e,!1,a),r=zr(e,n[t-1],n[t+1],!0,a);return"C ".concat(o.join(",")," ").concat(r.join(",")," ").concat(e.join(","))},jr=function(e){return"L ".concat(e.join(","))},Kr=function(e,t,n){return e.reduce((function(e,a,o,r){return 0===o?"M ".concat(a.join(",")):"".concat(e," ").concat(t(a,o,r,n))}),"")},Yr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){Qn()})),Ot(Bt(a),"onDotClick",(function(e,t,n){var o=Ya(t,n);a.props.onChartClick({row:e,columnIndex:t,columns:a.props.columns,stringColumnIndex:a.props.stringColumnIndex,legendColumn:a.props.legendColumn,activeKey:o}),a.setState({activeKey:o})})),Ot(Bt(a),"makeChartElements",(function(){var e,t=a.props,n=t.columns,o=t.legendColumn,r=t.numberColumnIndices,i=t.stringColumnIndex,l=t.dataFormatting,s=t.yScale,c=t.xScale,u=Sa("background-color-secondary"),d=a.props.width/(null===(e=a.props.data)||void 0===e?void 0:e.length)<10,p=[],m=[];return r.forEach((function(e,t){var r=[],g=a.props.colorScale(e);n[e].isSeriesHidden||a.props.data.forEach((function(t,m){var v=t[e];if(v){var h=c.tickSize/2,y=c.getValue(t[i])+h,b=s.domain()[0],C=s(v||b),E=[y,C];r.push(E);var S=Wa({row:t,columns:n,colIndex:e,stringColumnIndex:i,legendColumn:o,dataFormatting:l});if(!isNaN(C)){var T=Ya(e,m),D=f.createElement("circle",{key:"hover-circle-".concat(T),cx:y,cy:C,r:6,style:{stroke:"transparent",fill:"transparent",cursor:"pointer"}}),x=f.createElement("circle",{className:"line-dot-inner-circle",key:T,cx:y,cy:C,r:2.5,style:{pointerEvents:"none",stroke:g,strokeWidth:4,paintOrder:"stroke",color:g,opacity:d?0:1,fill:a.state.activeKey===T?g:u||"#fff"}});p.push(f.createElement("g",{className:"line-dot".concat(a.state.activeKey===T?" active":"").concat(d?" hidden-dot":""),key:"circle-group-".concat(T),onClick:function(){return a.onDotClick(t,e,m)},"data-tip":S,"data-for":a.props.chartTooltipID},x,D))}}}));var v,h,y=(v=r,(h=a.PATH_SMOOTHING)?Kr(v,Ur,h):Kr(v,jr)),b=f.createElement("path",{key:"line-".concat(Ya(0,t)),className:"line",d:y,fill:"none",stroke:g,strokeWidth:2});m.push(b)})),{paths:m,innerCircles:p}})),Ot(Bt(a),"render",(function(){if(!a.props.numberColumnIndices.filter((function(e){return!a.props.columns[e].isSeriesHidden})).length)return null;var e=a.makeChartElements(),t=e.paths,n=e.innerCircles;return f.createElement("g",{"data-test":"line"},t,n)})),a.PATH_SMOOTHING=.2,a.state={activeKey:a.props.activeChartElementKey},a}return Pt(n)}();Ot(Yr,"propTypes",Ua),Ot(Yr,"defaultProps",ja);var Wr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"state",{isChartScaled:!0}),Ot(Bt(a),"shouldComponentUpdate",(function(e,t){var n=$o(a.props,e),o=$o(a.state,t);return!n||!o})),Ot(Bt(a),"setChartData",(function(e){var t,n,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices),a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var r=io({props:e,columnIndices1:o,axis:"y",isScaled:null===(n=a.state)||void 0===n?void 0:n.isChartScaled});a.yScale=r.scale,a.yTickValues=a.yScale.tickLabels})),Ot(Bt(a),"toggleChartScale",(function(){a.setState({isChartScaled:!a.state.isChartScaled})})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-line-chart"},a.props.marginAdjustmentFinished&&f.createElement(Yr,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:e,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,toggleChartScale:a.toggleChartScale,legendShape:"line",dateColumnsOnly:!0,yGridLines:!0})))})),a.setChartData(e),a}return Pt(n)}();Ot(Wr,"propTypes",Ba),Ot(Wr,"defaultProps",Ha);var Gr=function(t){Lt(a,h);var n=Qt(a);function a(t){var o;kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o.renderPie(),Qn()})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){if(o.props.isResizing&&e.isResizing)return!1;var n=$o(o.props,e),a=$o(o.state,t);return!n||!a})),Ot(Bt(o),"componentDidUpdate",(function(){o.renderPie()})),Ot(Bt(o),"componentWillUnmount",(function(){jo(o.legend),jo(o.pieChartContainer)})),Ot(Bt(o),"renderPie",(function(){jo(o.pieChartContainer);var e=Bt(o);o.setPieRadius(),o.outerArc=nt().innerRadius(1.1*e.outerRadius).outerRadius(1.1*e.outerRadius);var t=at().value((function(t,n){return t.value[e.props.numberColumnIndex]}));o.dataReady=t(ct(e.sortedData.filter((function(e,t){var n,a;return!(null!==(n=o.state.legendLabels)&&void 0!==n&&null!==(a=n[t])&&void 0!==a&&a.hidden)})))),o.renderPieContainer(),o.renderPieSlices(),o.renderLegend(),o.centerVisualization(),o.renderComplete||(o.renderComplete=!0,o.props.onAxesRenderComplete())})),Ot(Bt(o),"renderPieContainer",(function(){var e=o.props,t=e.width,n=e.height;o.pieChartContainer=Ye(o.chartElement).append("svg").attr("width",t).attr("height",n).append("g").attr("class","slices").attr("transform","translate(".concat(t/2+o.outerRadius,",").concat(n/2,")"))})),Ot(Bt(o),"onSliceClick",(function(e){var t=e.data.key;t===o.state.activeKey?o.setState({activeKey:null}):(o.props.onChartClick({row:e.data.value,columnIndex:o.props.numberColumnIndex,columns:o.props.columns,stringColumnIndex:o.props.stringColumnIndex,legendColumn:o.props.legendColumn,activeKey:t}),o.setState({activeKey:t}))})),Ot(Bt(o),"renderPieSlices",(function(){var e=Bt(o);o.pieChartContainer.selectAll(".slices").data(e.dataReady).enter().append("path").attr("class","slice").attr("d",nt().innerRadius(e.innerRadius).outerRadius(e.outerRadius)).attr("fill",(function(t){return e.colorScale(t.data.value[e.props.stringColumnIndex])})).attr("data-for",o.props.chartTooltipID).attr("data-tip",(function(t){return Wa({row:t.data.value,columns:e.props.columns,colIndex:e.props.numberColumnIndex,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting})})).style("fill-opacity",.85).attr("stroke-width","0.5px").attr("stroke",o.props.backgroundColor).on("mouseover",(function(e){Ye(this).style("fill-opacity",1)})).on("mouseout",(function(e){Ye(this).style("fill-opacity",.85)})).on("click",o.onSliceClick),e.pieChartContainer.selectAll("path.slice").each((function(t){Ye(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)+")"}}))}))})),Ot(Bt(o),"centerVisualization",(function(){var t,n=Ye("#pie-chart-container-".concat(o.CHART_ID)).node();n&&(t=n.getBBox());var a=e(t,"width",0),r=e(t,"x",0),i=(o.props.width-a)/2-r;Ye("#pie-chart-container-".concat(o.CHART_ID)).attr("transform","translate(".concat(i,",0)"))})),Ot(Bt(o),"onLegendClick",(function(e){var t,n=JSON.parse(e),a=null==n?void 0:n.dataIndex,r=null===(t=o.state.legendLabels)||void 0===t?void 0:t[a];if(r&&!o.state.legendLabels.every((function(e){return e.label===r.label||e.hidden}))){var i=C(o.state.legendLabels);i[a].hidden=!o.state.legendLabels[a].hidden,o.setState({legendLabels:i},(function(){Qn()}))}})),Ot(Bt(o),"renderLegend",(function(){var t,n=Bt(o),a=o.props.height,r=Ta().chartColors;if(o.state.legendLabels){t=_e().domain(o.state.legendLabels.map((function(e){return JSON.stringify(e)}))).range(r);var i=o.props.width/2-70;o.legend=Ye(o.legendElement),o.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 l,s=Lr().orient("vertical").shapePadding(5).labels(n.state.legendLabels.map((function(e){return e.label}))).labelWrap(i).labelOffset(10).scale(t).on("cellclick",o.onLegendClick);o.legend.select(".legendOrdinal").call(s);var c=o.legend.select(".legendOrdinal").node();c&&(l=c.getBBox());var u=e(l,"height",0),d=e(l,"width",0),p=o.props.width/2-d-20,m=u<a-20?(a-u)/2:15;o.legend.select(".legendOrdinal").attr("transform","translate(".concat(p,", ").concat(m,")")),o.applyStylesForHiddenSeries()}})),Ot(Bt(o),"applyStylesForHiddenSeries",(function(){var e=o.state.legendLabels.filter((function(e){return e.hidden})).map((function(e){return e.label}));o.legendSwatchElements=document.querySelectorAll("#".concat(o.LEGEND_ID," .label tspan")),o.legendSwatchElements&&o.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}))})),Ot(Bt(o),"setPieRadius",(function(){var e,t=o.props,n=t.width,a=t.height,r=t.margin;e=n<a?n/2-r:2*a<n?a-r:n/2-r,o.outerRadius=e/2,o.innerRadius=o.outerRadius-50>15?o.outerRadius-50:0})),Ot(Bt(o),"render",(function(){return f.createElement("g",{id:"pie-chart-container-".concat(o.CHART_ID),"data-test":"react-autoql-pie-chart"},f.createElement("svg",{className:"pie-chart",ref:function(e){o.chartElement=e},width:o.props.width,height:o.props.height}),f.createElement("g",{ref:function(e){o.legendElement=e},id:o.LEGEND_ID,className:"legendOrdinal"}))})),o.CHART_ID=b(),o.LEGEND_ID="react-autoql-pie-legend-".concat(b()),o.sortedData=t.data.concat().sort((function(e,n){var a=e[t.numberColumnIndex]||0,o=n[t.numberColumnIndex]||0;return parseFloat(o)-parseFloat(a)}));var r=Ta().chartColors;o.colorScale=_e().domain(o.sortedData.map((function(e){return e[t.stringColumnIndex]}))).range(r);var i=o.sortedData.map((function(n,a){var o,r;return{label:"".concat(To({element:n[t.stringColumnIndex]||"Untitled Category",column:null===(o=t.columns)||void 0===o?void 0:o[t.stringColumnIndex]}),": ").concat(To({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:a}}));return o.state={activeKey:o.props.activeChartElementKey,legendLabels:i},o}return Pt(a)}();Ot(Gr,"propTypes",xt(xt({},Ba),{},{onAxesRenderComplete:y.func,backgroundColor:y.string,margin:y.number})),Ot(Gr,"defaultProps",xt(xt({},Ha),{},{onAxesRenderComplete:function(){},backgroundColor:"transparent",margin:40}));var Xr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){Qn()})),Ot(Bt(a),"onSquareClick",(function(e,t,n){var o=Ya(t,n);a.props.onChartClick({row:e,columnIndex:t,columns:a.props.columns,stringColumnIndex:a.props.stringColumnIndex,legendColumn:a.props.legendColumn,activeKey:o}),a.setState({activeKey:o})})),Ot(Bt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,o=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!o.length)return null;var u=[];return a.props.data.forEach((function(e,d){o.forEach((function(o,p){var m=e[o],g=Number(m),v=isNaN(g)?0:g,h=e[r],y=l[p].label,b=Ta().chartColors,C=b[0],E=v>=0?C:"rgb(221, 106, 106)",S=b[1],T=Wa({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i});u.push(f.createElement("rect",{key:Ya(o,d),"data-test":"squares",className:"square".concat(a.state.activeKey===Ya(o,d)?" active":""),x:c(h),y:s(y),width:c.bandwidth(),height:s.bandwidth(),onClick:function(){return a.onSquareClick(e,o,d)},"data-tip":T,"data-for":a.props.chartTooltipID,style:{color:S},fill:E,fillOpacity:a.opacityScale(Math.abs(v))}))}))})),f.createElement("g",null,u)}));var o=Fe(e.data.map((function(t){return Fe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))}))),r=Be(e.data.map((function(t){return Be(t.filter((function(t,n){return e.numberColumnIndices.includes(n)})))})));return a.opacityScale=Ve().domain([r,o]).range([0,1]),a.state={activeKey:a.props.activeChartElementKey},a}return Pt(n)}();Ot(Xr,"propTypes",Ua),Ot(Xr,"defaultProps",ja);var Jr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"setChartData",(function(e){a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:0}),a.yScale=no({props:e,domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:0})})),Ot(Bt(a),"render",(function(){return a.setChartData(a.props),f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart react-autoql-heatmap-chart","data-test":"react-autoql-heatmap-chart"},a.props.marginAdjustmentFinished&&f.createElement(Xr,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn})))})),a.setChartData(e),a}return Pt(n)}();Ot(Jr,"propTypes",Ba),Ot(Jr,"defaultProps",Ha);var Zr=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;kt(this,n),Ot(Bt(a=t.call(this,e)),"state",{activeKey:a.props.activeChartElementKey}),Ot(Bt(a),"componentDidMount",(function(){Qn()})),Ot(Bt(a),"onCircleClick",(function(e,t,n){var o=Ya(t,n);a.props.onChartClick({row:e,columnIndex:t,columns:a.props.columns,stringColumnIndex:a.props.stringColumnIndex,legendColumn:a.props.legendColumn,activeKey:o}),a.setState({activeKey:o})})),Ot(Bt(a),"render",(function(){var e=a.props,t=e.columns,n=e.legendColumn,o=e.numberColumnIndices,r=e.stringColumnIndex,i=e.dataFormatting,l=e.legendLabels,s=e.yScale,c=e.xScale;if(!o.filter((function(e){return!t[e].isSeriesHidden})).length)return null;var u=[],d=s.bandwidth()||0,p=c.bandwidth()||0,m=Ta().chartColors,g=m[0],v=m[1];return a.props.data.forEach((function(e,m){o.forEach((function(o,h){if(!t[o].isSeriesHidden){var y=e[o],b=Number(y),C=isNaN(b)?0:b,E=e[r],S=l[h].label,T=Wa({row:e,columns:t,colIndex:o,stringColumnIndex:r,legendColumn:n,dataFormatting:i}),D=c(E),x=s(S);u.push(f.createElement("circle",{key:Ya(o,m),"data-test":"circles",className:"circle".concat(a.state.activeKey===Ya(o,m)?" active":""),cx:D+p/2,cy:x+d/2,r:C<0?0:a.radiusScale(C)/2,onClick:function(){return a.onCircleClick(e,o,m)},"data-tip":T,"data-for":a.props.chartTooltipID,style:{stroke:"transparent",strokeWidth:10,fill:a.state.activeKey===Ya(o,m)?v:g,fillOpacity:.7}}))}}))})),f.createElement("g",null,u)}));var o=Fe(e.data.map((function(t){return Fe(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))}))),r=Be(e.data.map((function(t){return Be(t.filter((function(t,n){return e.numberColumnIndices.includes(n)&&!isNaN(t)})))})));return a.radiusScale=Ve().domain([r,o]).range([0,Math.min(e.xScale.bandwidth(),e.yScale.bandwidth())]),a}return Pt(n)}();Ot(Zr,"propTypes",Ua),Ot(Zr,"defaultProps",ja);var $r=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"setChartData",(function(e){a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:.01,outerPadding:.1}),a.yScale=no({props:e,domain:e.legendLabels.map((function(e){return e.label})),axis:"y",innerPadding:.01,outerPadding:.1})})),Ot(Bt(a),"render",(function(){return a.setChartData(a.props),f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart react-autoql-bubble-chart","data-test":"react-autoql-bubble-chart"},a.props.marginAdjustmentFinished&&f.createElement(Zr,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:a.props.legendColumn})))})),a.setChartData(e),a}return Pt(n)}();Ot($r,"propTypes",Ba),Ot($r,"defaultProps",Ha);var ei=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Qn()})),Ot(Bt(e),"onColumnClick",(function(t,n,a){var o=Ya(n,a);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:o}),e.setState({activeKey:o})})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,o=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!o.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 o.map((function(o,p){if(!n[o].isSeriesHidden){var m,g,v=t[o],h=Number(v),y=isNaN(h)?0:h,b=e.props.colorScale(o);if(!y)return null;if(y>=0){var C=u+y;g=Math.abs(s(y)-s(0)-.5),m=s(u),u=C}else{var E=d+y;g=Math.abs(s(Math.abs(y))-s(0)-.5),m=s(E),d=E}if(g<.05)return null;var S=Wa({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return f.createElement("rect",{key:Ya(o,c),className:"column".concat(e.state.activeKey===Ya(o,c)?" active":""),x:m,y:l(t[r]),width:g,height:l.bandwidth(),onClick:function(){return e.onColumnClick(t,o,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:b,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-bars"},c)})),e}return Pt(n)}();Ot(ei,"propTypes",Ua),Ot(ei,"defaultProps",ja);var ti=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"setChartData",(function(e){var t,n,o=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(o=e.visibleSeriesIndices),a.yScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"y"});var r=io({props:e,columnIndices1:o,axis:"x",stacked:!0});a.xScale=r.scale,a.xTickValues=a.xScale.tickLabels,a.xScale2=r.scale2,a.xTickValues2=null===(n=a.xScale2)||void 0===n?void 0:n.tickLabels})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex],t=a.props.columns[a.props.numberColumnIndex2];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-bar-chart"},a.props.marginAdjustmentFinished&&f.createElement(ei,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,xScale2:a.xScale2,yScale:a.yScale,xCol:e,xCol2:t,yCol:a.props.columns[a.props.stringColumnIndex],linearAxis:"x",hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation})))})),a.setChartData(e),a}return Pt(n)}();Ot(ti,"propTypes",Ba),Ot(ti,"defaultProps",Ha);var ni=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Qn()})),Ot(Bt(e),"onColumnClick",(function(t,n,a){var o=Ya(n,a);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:o}),e.setState({activeKey:o})})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.columns,a=t.legendColumn,o=t.numberColumnIndices,r=t.stringColumnIndex,i=t.dataFormatting,l=t.yScale,s=t.xScale;if(!o.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 o.map((function(o,p){if(!n[o].isSeriesHidden){var m,g,v=t[o],h=Number(v),y=isNaN(h)?0:h,b=e.props.colorScale(o);if(!y)return null;if(y>=0){var C=u+y;g=Math.abs(l(y)-l(0))-.5,m=l(C)+.5,u=C}else{var E=d+y;g=Math.abs(l(y)-l(0))-.5,m=l(d)+.5,d=E}if(g<.05)return null;var S=Wa({row:t,columns:n,colIndex:o,stringColumnIndex:r,legendColumn:a,dataFormatting:i});return f.createElement("rect",{key:Ya(o,c),className:"bar".concat(e.state.activeKey===Ya(o,c)?" active":""),x:s(t[r]),y:m,width:s.bandwidth(),height:Math.abs(g),onClick:function(){return e.onColumnClick(t,o,c)},"data-tip":S,"data-for":e.props.chartTooltipID,style:{fill:b,fillOpacity:.7}})}}))}));return f.createElement("g",{"data-test":"stacked-columns"},c)})),e}return Pt(n)}();Ot(ni,"propTypes",Ua),Ot(ni,"defaultProps",ja);var ai=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var o=io({props:e,columnIndices1:n,axis:"y",stacked:!0});a.yScale=o.scale})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-column-chart"},a.props.marginAdjustmentFinished&&f.createElement(ni,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:e,linearAxis:"y",hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,yGridLines:!0})))})),a.setChartData(e),a}return Pt(n)}();Ot(ai,"propTypes",Ba),Ot(ai,"defaultProps",Ha);var oi=function(e){Lt(n,h);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{activeKey:e.props.activeChartElementKey}),Ot(Bt(e),"componentDidMount",(function(){Qn()})),Ot(Bt(e),"onDotClick",(function(t,n,a){var o=Ya(n,a);e.props.onChartClick({row:t,columnIndex:n,columns:e.props.columns,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,activeKey:o}),e.setState({activeKey:o})})),Ot(Bt(e),"createPolygonVertexDot",(function(t,n,a,o,r,i,l){var s=Wa({row:t,columns:e.props.columns,colIndex:r,stringColumnIndex:e.props.stringColumnIndex,legendColumn:e.props.legendColumn,dataFormatting:e.props.dataFormatting});return f.createElement("circle",{key:"dot-".concat(Ya(r,i)),className:"vertex-dot".concat(e.state.activeKey===Ya(r,i)?" active":""),cy:o,cx:a,r:4,onClick:function(){return e.onDotClick(t,r,n)},"data-tip":s,"data-for":e.props.chartTooltipID,style:{opacity:e.state.activeKey===Ya(r,i)?1:0,cursor:"pointer",stroke:l,strokeWidth:3,strokeOpacity:.7,fillOpacity:1,fill:e.props.backgroundColor||"#fff"}})})),Ot(Bt(e),"createPolygon",(function(t,n,a){var o=e.props.stringColumnIndex,r=n.map((function(e){return e.join(",")})).join(" ");return f.createElement("polygon",{key:"polygon-".concat(Ya(o,t)),className:"stacked-area".concat(e.state.activeKey===Ya(o,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:a,fillOpacity:.7}})})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.columns,a=t.numberColumnIndices,o=t.stringColumnIndex,r=t.yScale,i=t.xScale;if(!a.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)])})),a.forEach((function(t,a){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[o]),h=u[l]+g,y=r(h);if(c[l]=h,p.push([v,y]),0!==g){var b=e.createPolygonVertexDot(n,a,v,y,t,l,m);s.push(b)}}));var f=d.reverse().concat(p);l.push(e.createPolygon(a,f,m)),u=c,d=p}})),f.createElement("g",{"data-test":"stacked-lines"},l,s)})),e}return Pt(n)}();Ot(oi,"propTypes",Ua),Ot(oi,"defaultProps",ja);var ri=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"setChartData",(function(e){var t,n=e.numberColumnIndices;null!==(t=e.visibleSeriesIndices)&&void 0!==t&&t.length&&(n=e.visibleSeriesIndices),a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x",innerPadding:1,outerPadding:0});var o=io({props:e,columnIndices1:n,axis:"y",stacked:!0});a.yScale=o.scale,a.yTickValues=a.yScale.tickLabels})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex];return f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-stacked-line-chart"},a.props.marginAdjustmentFinished&&f.createElement(oi,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,xCol:a.props.columns[a.props.stringColumnIndex],yCol:e,hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,dateColumnsOnly:!0,yGridLines:!0})))})),a.setChartData(e),a}return Pt(n)}();Ot(ri,"propTypes",Ba),Ot(ri,"defaultProps",Ha);var ii=function(e){Lt(n,h);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"shouldComponentUpdate",(function(e,t){var n=$o(a.props,e),o=$o(a.state,t);return!n||!o})),Ot(Bt(a),"setChartData",(function(e){var t,n,o,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),a.xScale=no({props:e,columnIndex:e.stringColumnIndex,axis:"x"});var s=io({props:e,columnIndices1:i,columnIndices2:l,axis:"y",isScaled:null===(o=a.state)||void 0===o?void 0:o.isChartScaled});a.yScale=s.scale,a.yTickValues=a.yScale.tickLabels,a.yScale2=s.scale2,a.yTickValues2=null===(r=a.yScale2)||void 0===r?void 0:r.tickLabels})),Ot(Bt(a),"toggleChartScale",(function(){a.setState({isChartScaled:!a.state.isChartScaled})})),Ot(Bt(a),"render",(function(){a.setChartData(a.props);var e=a.props.columns[a.props.numberColumnIndex],t=a.props.columns[a.props.numberColumnIndex2];return a.props.height&&a.props.width?f.createElement("g",{ref:function(e){return a.chartRef=e},className:"react-autoql-axes-chart","data-test":"react-autoql-column-line-chart"},f.createElement(Vr,Mt({},a.props,{ref:function(e){return a.axesRef=e},chartRef:a.chartRef,xScale:a.xScale,yScale:a.yScale,yScale2:a.yScale2,xCol:a.props.columns[a.props.stringColumnIndex],yCol:e,yCol2:t,linearAxis:"y",hasRightLegend:"right"===a.props.legendLocation,hasBottomLegend:"bottom"===a.props.legendLocation,toggleChartScale:a.toggleChartScale,yGridLines:!0}),a.props.marginAdjustmentFinished&&f.createElement(f.Fragment,null,f.createElement(_r,Mt({},a.props,{xScale:a.xScale,yScale:a.yScale})),!!a.yScale2&&f.createElement(Yr,Mt({},a.props,{numberColumnIndices:a.props.numberColumnIndices2,xScale:a.xScale,yScale:a.yScale2,colorScale:a.props.colorScale2}))))):null})),a.setChartData(e),a.state={isChartScaled:!0},a}return Pt(n)}();Ot(ii,"propTypes",Ba),Ot(ii,"defaultProps",Ha);var li=function(e){var t,n,a,o=e.row,r=e.index,i=e.columns,l=e.dataFormatting,s=i[r];o&&(t=null!==(n=null===(a=Co({d:o[r],column:s,dataFormatting:l}))||void 0===a?void 0:a.fullWidthLabel)&&void 0!==n?n:o[r]);return t},si=function(e,t,n){var a=C(e);return Object.keys(t).forEach((function(e){var o=n[e].aggType||"sum";a[e]=function(e,t){switch(t){case"avg":return Ke(e);case"median":return je(e);case"min":return Be(e);case"max":return Fe(e);case"deviation":return Ue(e);case"variance":return ze(e);case"count":return Qe(e);case"count-distinct":var n=e.filter(po);return Qe(n);default:return He(e)}}(t[e],o)})),a},ci=function(e){var t=e.data,n=e.aggColIndex,a=e.columns,o=e.numberIndices,r=e.dataFormatting;if(null==t||!t.length)return t;var i,l=[],s=We(t,(function(e){return null==e?void 0:e[n]})),c={};return s.forEach((function(e,t){var u=C(e),d=t===s.length-1,p=li({row:u,index:n,columns:a,dataFormatting:r}),m=li({row:i,index:n,columns:a,dataFormatting:r});if(p&&m&&p!==m){var f=si(i,c,a);l.push(f),c={}}if(function(e){var t=e.numberIndices,n=e.columns,a=e.datasetsToAggregate,o=e.row;t.forEach((function(e){if(n[e].visible){var t=Number(o[e]);a[e]?a[e].push(t):a[e]=[t]}}))}({numberIndices:o,columns:a,datasetsToAggregate:c,row:u}),d){var g=si(u,c,a);l.push(g)}else i=u})),l},ui=function(e){Lt(a,h);var t=Qt(a);function a(e){var o;kt(this,a),Ot(Bt(o=t.call(this,e)),"DEFAULT_MARGINS",{left:50,right:10,bottom:100,top:10}),Ot(Bt(o),"componentDidMount",(function(){o.props.isResizing||o.props.hidden||(o.firstRender=!1,o.forceUpdate())})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){if(o.props.isResizing&&!e.isResizing)return o.shouldRecalculateDimensions=!0,!0;if(o.props.dataChangeCount!==e.dataChangeCount)return!0;if(e.isResizing&&o.props.isResizing||e.hidden&&o.props.hidden)return!1;var n=$o(o.props,e),a=$o(o.state,t);return!n||!a})),Ot(Bt(o),"componentDidUpdate",(function(e){if(!0!==o.firstRender||o.props.hidden||(o.firstRender=!1),o.props.hidden&&!e.hidden&&(o.firstRender=!0),(!o.props.isResizing&&e.isResizing&&!o.props.hidden||!o.props.hidden&&e.hidden)&&(o.chartContainerRef&&(o.chartContainerRef.style.flexBasis="100vh"),o.setState({chartID:b(),deltaX:0,deltaY:0,isLoading:!0})),o.props.type!==e.type&&Tn.includes(o.props.type)&&!Pa(o.props.columns[o.props.stringColumnIndex])){var t=La(o.props.columns);o.props.changeStringColumnIndex(t)}else if(o.props.type!==e.type&&Dn.includes(o.props.type)){var a=o.props.numberColumnIndices.filter((function(e){return o.props.numberColumnIndices2.includes(e)}));if(!(null==a||!a.length)){console.debug("Selected columns already exist on the other axis. Exiting");var r=o.props.numberColumnIndices.filter((function(e){return!o.props.numberColumnIndices2.includes(e)}));o.props.changeNumberColumnIndices(r,o.props.numberColumnIndices2)}}if((!o.props.isDrilldownChartHidden&&e.isDrilldownChartHidden||e.type&&o.props.type!==e.type)&&o.setState({chartID:b(),deltaX:0,deltaY:0,isLoading:!0}),function(e,t){var a,o;return(null===(a=e.data)||void 0===a?void 0:a.length)!==(null===(o=t.data)||void 0===o?void 0:o.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)}(o.props,e)||o.props.dataChangeCount!==e.dataChangeCount){var i=o.getData(o.props);return o.setState({data:i,chartID:b(),deltaX:0,deltaY:0,isLoading:!0}),!0}})),Ot(Bt(o),"componentWillUnmount",(function(){clearTimeout(o.adjustVerticalPositionTimeout)})),Ot(Bt(o),"getColorScales",(function(){var e,t,n=o.props,a=n.numberColumnIndices,r=n.numberColumnIndices2,i=Ta(),l=i.chartColors,s=function(e,t){var n=zt(e);(t%=e.length)<0&&(t=e.length+t);for(var a=0;a<t;a++)n.unshift(n.pop());return n}(i.chartColorsDark,-1*(null!==(e=null==a?void 0:a.length)&&void 0!==e?e:1)),c=_e().range(l).domain(a);return null!=r&&r.length&&(t=_e().range(s).domain(r)),{colorScale:c,colorScale2:t}})),Ot(Bt(o),"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 Go(e.data,e.columns,"asc");var a,o,r=null!==(a=e.numberColumnIndices)&&void 0!==a?a:[],i=null!==(o=e.numberColumnIndices2)&&void 0!==o?o:[],l=[].concat(zt(r),zt(i));if(l.length)return ci({data:e.data,aggColIndex:e.stringColumnIndex,columns:e.columns,numberIndices:l,dataFormatting:e.dataFormatting})}})),Ot(Bt(o),"setFinishedLoading",(function(){clearTimeout(o.loadingTimeout),o.loadingTimeout=setTimeout((function(){o.setState({isLoading:!1})}),0)})),Ot(Bt(o),"adjustVerticalPosition",(function(){o.props.hidden||(clearTimeout(o.adjustVerticalPositionTimeout),o.adjustVerticalPositionTimeout=setTimeout((function(){var e=o.getDeltas().deltaY,t=o.getInnerDimensions().innerHeight;o.setState({deltaY:e,innerHeight:t},(function(){o.setFinishedLoading()}))}),0))})),Ot(Bt(o),"adjustChartPosition",(function(){o.props.hidden||(clearTimeout(o.adjustPositionTimeout),o.adjustPositionTimeout=setTimeout((function(){var e=o.getDeltas(),t=e.deltaX,n=e.deltaY,a=o.getInnerDimensions(),r=a.innerHeight,i=a.innerWidth;o.setState({deltaX:t,deltaY:n,innerHeight:r,innerWidth:i},(function(){o.adjustVerticalPosition()}))}),0))})),Ot(Bt(o),"getDeltas",(function(){var e,t,n;if("pie"===o.props.type)return{deltaX:0,deltaY:0};var a=xo(null===(e=o.innerChartRef)||void 0===e?void 0:e.chartRef);return{deltaX:-1*Math.ceil(null!==(t=null==a?void 0:a.x)&&void 0!==t?t:0)+o.PADDING,deltaY:-1*Math.ceil(null!==(n=null==a?void 0:a.y)&&void 0!==n?n:0)+o.PADDING}})),Ot(Bt(o),"getRenderedChartDimensions",(function(){var e,t,n,a,r,i,l,s,c,u,d,p,m,f,g,v,h,y,b,C,E,S,T,D,x=null===(e=o.innerChartRef)||void 0===e||null===(t=e.axesRef)||void 0===t||null===(n=t.leftAxis)||void 0===n||null===(a=n.ref)||void 0===a?void 0:a.getBoundingClientRect(),w=null===(r=o.innerChartRef)||void 0===r||null===(i=r.axesRef)||void 0===i||null===(l=i.bottomAxis)||void 0===l||null===(s=l.ref)||void 0===s?void 0:s.getBoundingClientRect(),R=null===(c=o.innerChartRef)||void 0===c||null===(u=c.axesRef)||void 0===u||null===(d=u.rightAxis)||void 0===d||null===(p=d.ref)||void 0===p?void 0:p.getBoundingClientRect(),A=null===(m=o.innerChartRef)||void 0===m||null===(f=m.axesRef)||void 0===f||null===(g=f.topAxis)||void 0===g||null===(v=g.ref)||void 0===v?void 0:v.getBoundingClientRect(),N=null===(h=o.innerChartRef)||void 0===h||null===(y=h.axesRef)||void 0===y||null===(b=y.legendRef)||void 0===b||null===(C=b.legendClippingContainer)||void 0===C?void 0:C.getBoundingClientRect(),k=uo([x,w,R,A,N]),I=null!==(E=null==k?void 0:k.width)&&void 0!==E?E:0;return{chartHeight:null!==(S=null==k?void 0:k.height)&&void 0!==S?S:0,chartWidth:I,chartX:null!==(T=null==k?void 0:k.x)&&void 0!==T?T:0,chartY:null!==(D=null==k?void 0:k.y)&&void 0!==D?D:0}})),Ot(Bt(o),"getInnerDimensions",(function(){var e,t,n,a,r,i,l=o.getRenderedChartDimensions(),s=l.chartWidth,c=l.chartHeight,u="number"==typeof o.props.width?o.props.width:void 0,d="number"==typeof o.props.height?o.props.height:void 0,p=null!==(e=null!=u?u:null===(t=o.chartContainerRef)||void 0===t?void 0:t.clientWidth)&&void 0!==e?e:0,m=null!==(n=null!=d?d:null===(a=o.chartContainerRef)||void 0===a?void 0:a.clientHeight)&&void 0!==n?n:0,f=p-2*o.PADDING;null!==(r=o.innerChartRef)&&void 0!==r&&r.xScale&&s&&(f=p-(s-(o.innerChartRef.xScale.range()[1]-o.innerChartRef.xScale.range()[0]))-2*o.PADDING);var g=m-2*o.PADDING;null!==(i=o.innerChartRef)&&void 0!==i&&i.yScale&&c&&(g=m-(c-(o.innerChartRef.yScale.range()[0]-o.innerChartRef.yScale.range()[1]))-2*o.PADDING);return f<1&&(f=1),g<1&&(g=1),{innerWidth:f,innerHeight:g}})),Ot(Bt(o),"getOuterDimensions",(function(){var e={outerHeight:o.outerHeight,outerWidth:o.outerWidth};if(o.props.hidden||o.props.isAnimating||o.firstRender)return e;if(!o.outerWidth||!o.outerHeight||o.shouldRecalculateDimensions){var t,n,a;o.shouldRecalculateDimensions=!1;var r=null===(t=o.chartContainerRef)||void 0===t?void 0:t.getBoundingClientRect(),i=null!==(n=null==r?void 0:r.width)&&void 0!==n?n:0,l=null!==(a=null==r?void 0:r.height)&&void 0!==a?a:0,s=Math.ceil(i),c=Math.ceil(l);return o.outerWidth=s,o.outerHeight=c,{outerHeight:c,outerWidth:s}}return e})),Ot(Bt(o),"getLegendLabels",(function(){var e;return Ga(o.props.columns,null===(e=o.getColorScales())||void 0===e?void 0:e.colorScale,o.props.numberColumnIndices)})),Ot(Bt(o),"getBase64Data",(function(){var e=o.chartRef;return e?wo(e,20).then((function(e){return Promise.resolve(e)})).catch((function(){return Promise.reject()})):Promise.reject()})),Ot(Bt(o),"saveAsPNG",(function(){var e=o.chartRef;e&&wo(e,20).then((function(e){var t=e;t=(t=t.replace(/^data:image\/[^;]*/,"data:application/octet-stream")).replace(/^data:application\/octet-stream/,"data:application/octet-stream;headers=Content-Disposition%3A%20attachment%3B%20filename=Canvas.png");var n=document.createElement("a");n.setAttribute("href",t),n.setAttribute("download","Chart.png"),n.setAttribute("target","_blank"),n.style.display="none",document.body.appendChild(n),n.click()})).catch((function(e){console.error(e)}))})),Ot(Bt(o),"getCommonChartProps",(function(){var e,t,n,a,r=o.state,i=r.deltaX,l=r.deltaY,s=o.props,c=s.numberColumnIndices,u=s.numberColumnIndices2,d=s.columns,p=s.enableDynamicCharting,m=c.filter((function(e){return(null==d?void 0:d[e])&&!d[e].isSeriesHidden})),f=null==u?void 0:u.filter((function(e){return(null==d?void 0:d[e])&&!d[e].isSeriesHidden})),g=o.getInnerDimensions(),v=g.innerHeight,h=g.innerWidth,y=o.getOuterDimensions(),b=y.outerHeight,C=y.outerWidth,E=o.getColorScales(),S=E.colorScale,T=E.colorScale2;return xt(xt({},o.props),{},{setIsLoadingMoreRows:function(e){return o.setState({isLoadingMoreRows:e})},ref:function(e){return o.innerChartRef=e},innerChartRef:null===(e=o.innerChartRef)||void 0===e?void 0:e.chartRef,key:void 0,data:o.state.data||o.props.data,disableTimeScale:o.disableTimeScale,colorScale:S,colorScale2:T,dataLength:null===(t=o.props.data)||void 0===t?void 0:t.length,height:v,width:h,outerHeight:b,outerWidth:C,deltaX:i,deltaY:l,chartPadding:o.PADDING,enableAxisDropdown:p&&!o.props.isPivot,marginAdjustmentFinished:!0,legendLocation:(n=c,a=o.props.type,"column_line"===a?"right":(null==n?void 0:n.length)<2||"pie"===a||"heatmap"===a||"bubble"===a?void 0:"stacked_column"===a||"stacked_bar"===a||"stacked_line"===a||(null==n?void 0:n.length)>2||(null==n?void 0:n.length)>1?"right":void 0),legendLabels:o.getLegendLabels(),onLabelRotation:o.adjustVerticalPosition,visibleSeriesIndices:m,visibleSeriesIndices2:f,tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,chartContainerRef:o.chartContainerRef,popoverParentElement:o.props.popoverParentElement,totalRowCount:o.props.totalRowCount,chartID:o.state.chartID,onAxesRenderComplete:o.adjustChartPosition})})),Ot(Bt(o),"renderChartLoader",(function(){return f.createElement("div",{className:"table-loader table-page-loader"},f.createElement("div",{className:"page-loader-spinner"},f.createElement(cr,null)))})),Ot(Bt(o),"renderColumnChart",(function(){return f.createElement(Fr,o.getCommonChartProps())})),Ot(Bt(o),"renderBarChart",(function(){return f.createElement(Hr,o.getCommonChartProps())})),Ot(Bt(o),"renderLineChart",(function(){return f.createElement(Wr,o.getCommonChartProps())})),Ot(Bt(o),"renderPieChart",(function(){return f.createElement(Gr,o.getCommonChartProps())})),Ot(Bt(o),"renderHeatmapChart",(function(){return f.createElement(Jr,o.getCommonChartProps())})),Ot(Bt(o),"renderBubbleChart",(function(){return f.createElement($r,o.getCommonChartProps())})),Ot(Bt(o),"renderStackedColumnChart",(function(){return f.createElement(ai,o.getCommonChartProps())})),Ot(Bt(o),"renderStackedBarChart",(function(){return f.createElement(ti,o.getCommonChartProps())})),Ot(Bt(o),"renderStackedLineChart",(function(){return f.createElement(ri,o.getCommonChartProps())})),Ot(Bt(o),"renderColumnLineChart",(function(){return f.createElement(ii,o.getCommonChartProps())})),Ot(Bt(o),"renderChart",(function(){switch(o.props.type){case"column":return o.renderColumnChart();case"bar":return o.renderBarChart();case"line":return o.renderLineChart();case"pie":return o.renderPieChart();case"bubble":return o.renderBubbleChart();case"heatmap":return o.renderHeatmapChart();case"stacked_column":return o.renderStackedColumnChart();case"stacked_bar":return o.renderStackedBarChart();case"stacked_line":return o.renderStackedLineChart();case"column_line":return o.renderColumnLineChart();default:return"Unknown Display Type"}})),Ot(Bt(o),"render",(function(){var e;if(null===(e=o.state.data)||void 0===e||!e.length)return null;var t=Sa("font-family"),n=Sa("text-color-primary"),a=Sa("background-color-secondary");return f.createElement(Kt,null,f.createElement("div",{id:"react-autoql-chart-".concat(o.state.chartID),key:"react-autoql-chart-".concat(o.state.chartID),ref:function(e){return o.chartContainerRef=e},"data-test":"react-autoql-chart",className:"react-autoql-chart-container\n ".concat(o.state.isLoading||o.props.isResizing?"loading":"","\n ").concat(o.state.isLoadingMoreRows?"loading-rows":"","\n ").concat(o.props.hidden?"hidden":"")},!o.firstRender&&!o.props.isResizing&&!o.props.isAnimating&&f.createElement(v,null,f.createElement("svg",{ref:function(e){return o.chartRef=e},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",style:{fontSize:"12px",fontFamily:t,color:n,background:a}},f.createElement("g",{transform:"translate(".concat(o.state.deltaX,", ").concat(o.state.deltaY,")"),className:"react-autoql-chart-content-container"},o.renderChart()))),o.state.isLoadingMoreRows&&o.renderChartLoader()))}));var r=o.getData(e);return o.PADDING=10,o.FONT_SIZE=12,o.firstRender=!0,o.shouldRecalculateDimensions=!1,o.state={chartID:b(),data:r,deltaX:0,deltaY:0,isLoading:!0,isLoadingMoreRows:!1},o}return Pt(a)}();Ot(ui,"propTypes",xt(xt({},_a),{},{type:y.string.isRequired})),Ot(ui,"defaultProps",Fa);var di=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"originalReplaceWords",[]),Ot(Bt(t),"suggestionLists",[]),Ot(Bt(t),"state",{queryValidationQueryArray:[],selectedSuggestions:void 0}),Ot(Bt(t),"componentDidMount",(function(){e(t.props,"response.data")&&t.initializeQueryValidationOptions(t.props.response.data)})),Ot(Bt(t),"getSuggestionLists",(function(e,t){var n=[];return t.length&&t.forEach((function(t){var a=e.slice(t.start,t.end),o=t.suggestions.map((function(e){return xt({id:b(),hidden:!1},e)})),r=[].concat(zt(o),[{id:b(),text:a}]);n.push(r)})),n})),Ot(Bt(t),"getPlainTextList",(function(e,t){var n=[],a=0;return t.forEach((function(o,r){n.push(e.slice(a,o.start)),r===t.length-1&&n.push(e.slice(o.end,e.length)),a=o.end})),n})),Ot(Bt(t),"isInitialSelectionValid",(function(){var e=!0;return t.props.initialSelections.length!==t.suggestionLists.length&&(e=!1),t.props.initialSelections.forEach((function(n,a){t.suggestionLists[a]&&t.suggestionLists[a].find((function(e){return e.text===n.text}))||(e=!1)})),e})),Ot(Bt(t),"updateStartAndEndIndexes",(function(n){if(e(n,"length")){var a="";t.plainTextList.forEach((function(e,t){a=a.concat(e);var o=n[t];if(o&&!o.hidden){var r=a.length;o.start=r,o.end=r+o.text.length,a=a.concat(o.text)}}))}})),Ot(Bt(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||b()})),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:C(e)})})),Ot(Bt(t),"initializeQueryValidationOptions",(function(e){var n=e.data,a=n.replacements,o=n.query;if(!a||!o)return[];t.suggestionLists=t.getSuggestionLists(o,a),t.plainTextList=t.getPlainTextList(o,a),t.setInitialSelections()})),Ot(Bt(t),"onChangeQueryValidationSelectOption",(function(e,n){if("remove-word"!==e){var a=t.suggestionLists[n].find((function(t){return t.id===e})),o=C(t.state.selectedSuggestions);o[n]=a,t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(o),o),t.updateStartAndEndIndexes(o),t.setState({selectedSuggestions:C(o)})}else t.deleteQueryValidationSuggestion(n)})),Ot(Bt(t),"deleteQueryValidationSuggestion",(function(e){var n=C(t.state.selectedSuggestions.map((function(t,n){return n===e?xt(xt({},t),{},{hidden:!0}):t})));t.props.onQueryValidationSelectOption(t.getQueryValidationQueryText(n),n),t.updateStartAndEndIndexes(n),t.setState({selectedSuggestions:C(n)})})),Ot(Bt(t),"renderWordSelector",(function(e){var n=C(t.state.selectedSuggestions[e]);if(!n||n.hidden)return null;var a=t.suggestionLists[e],o=[];return a.forEach((function(e,t){if(null!=e&&e.text){var n={value:e.id,label:e.text};t===a.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),o.push(n)}})),o.push({value:"remove-word",label:f.createElement("span",null,f.createElement(bn,{type:"trash"})," Remove term")}),f.createElement("div",{className:"react-autoql-query-validation-selector-container",key:"query-element-".concat(n.id)},f.createElement(Tr,{options:o,key:b(),value:n.id,className:"react-autoql-query-validation-select",popupClassname:"query-validation-select",onChange:function(n){return t.onChangeQueryValidationSelectOption(n,e)}}))})),Ot(Bt(t),"renderQueryValidationQuery",(function(){return f.createElement("div",{className:"react-autoql-query-validation-query"},t.plainTextList.map((function(e,n){var a=f.createElement("span",{key:"query-element-".concat(n)},e),o=t.renderWordSelector(n);return f.createElement("span",{key:b()},a,o)})))})),Ot(Bt(t),"getQueryValidationQueryText",(function(e){var n="";return t.plainTextList.forEach((function(t,a){n=n.concat(t);var o=e[a];o&&!o.hidden&&(n=n.concat(o.text))})),n})),Ot(Bt(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("button",{className:"react-autoql-query-validation-execute-btn",onClick:function(){t.props.onSuggestionClick({query:t.getQueryValidationQueryText(t.state.selectedSuggestions),userSelection:t.state.selectedSuggestions})}},f.createElement(bn,{type:t.props.submitIcon||"play",className:"react-autoql-execute-query-icon"}),t.props.submitText||"Run Query"))):null})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-response-content-container"},t.renderResponse()))})),t}return Pt(a)}();Ot(di,"propTypes",{response:y.shape({}),onSuggestionClick:y.func,autoSelectSuggestion:y.bool,isQueryRunning:y.bool,initialSelections:y.arrayOf(y.shape({})),onQueryValidationSelectOption:y.func,message:y.string}),Ot(di,"defaultProps",{response:void 0,autoSelectSuggestion:!0,initialSelections:void 0,isQueryRunning:!1,message:void 0,onSuggestionClick:function(){},onQueryValidationSelectOption:function(){}});var pi=function(e){try{return{c_type:"DATE",eng:e.eng.split(" ").map((function(e){if(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}}(e)){var t=a(e).utc().format("ll");if("Invalid Date"!==t)return t}return e})).join(" ")}}catch(t){return{c_type:"TEXT",eng:e.eng}}},mi=function(t){try{if(!t)return;var n=[];return e(t,"length")&&t.forEach((function(e){"FILTER"===e.c_type||"SEED"===e.c_type?function(e){try{for(var t,n=/'(''|[^'])*'/g,a=e.eng,o=[];null!==(t=n.exec(a));)o.push(t);return o.length?function(e,t,n){var a=0,o=[];return t.forEach((function(r,i){if(r.index>a){var l=e.substring(a,r.index);o.push({c_type:"TEXT",eng:l})}var s,c=r[0].length+r.index,u=e.substring(r.index,c),d=(s=u).substring(1,s.length-1).replace("''","'");if(a=c,o.push({c_type:n,eng:d}),i===t.length-1&&c<e.length){var p=e.substring(c,e.length);o.push({c_type:"TEXT",eng:p})}})),o}(a,o,"VALUE_LABEL"):[pi(e)]}catch(t){return[{c_type:"TEXT",eng:e.eng}]}}(e).forEach((function(e){n.push(e)})):n.push(e)})),n}catch(e){return void console.error(e)}},fi=function(n){Lt(o,f.Component);var a=Qt(o);function o(n){var r;return kt(this,o),Ot(Bt(r=a.call(this,n)),"componentDidMount",(function(){var e;r._isMounted=!0,r.props.onValueLabelClick&&null!==(e=r.state.reverseTranslationArray)&&void 0!==e&&e.length&&r.validateAndUpdateValueLabels()})),Ot(Bt(r),"shouldComponentUpdate",(function(e,t){var n,a;return!(null===(n=e.reverseTranslation)||void 0===n||!n.length||null!==(a=r.props.reverseTranslation)&&void 0!==a&&a.length)||(!e.isResizing||!r.props.isResizing)&&(!$o(r.props,e)||!$o(r.state,t))})),Ot(Bt(r),"componentDidUpdate",(function(e,t){var n,a,o,i;null!==(n=e.reverseTranslation)&&void 0!==n&&n.length||null===(a=r.props.reverseTranslation)||void 0===a||!a.length||r.setState({reverseTranslationArray:mi(r.props.reverseTranslation)}),null!==(o=t.reverseTranslationArray)&&void 0!==o&&o.length||null===(i=r.state.reverseTranslationArray)||void 0===i||!i.length||r.validateAndUpdateValueLabels()})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1})),Ot(Bt(r),"validateAndUpdateValueLabels",(function(){if(r.state.reverseTranslationArray.length){var n=[],a=t(r.state.reverseTranslationArray);r.state.reverseTranslationArray.forEach((function(t,o){"VALUE_LABEL"===t.c_type&&n.push(ca(xt({suggestion:t.eng},Wn(r.props.authentication))).then((function(t){e(t,"data.data.matches.length")&&(a[o].c_type="VALIDATED_VALUE_LABEL")})))})),Promise.all(n).then((function(){r._isMounted&&r.setState({isValidated:!0,reverseTranslationArray:a})}))}})),Ot(Bt(r),"renderFilterLockLink",(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)}}," ",r.props.appliedFilters.includes(e)&&f.createElement(bn,{type:"lock"})," ",f.createElement("span",null,e))})),Ot(Bt(r),"renderInterpretationChunk",(function(e){switch(e.c_type){case"VALIDATED_VALUE_LABEL":return r.props.onValueLabelClick?r.renderFilterLockLink(e.eng):" ".concat(e.eng);case"VALUE_LABEL":return" ".concat(e.eng);case"DELIM":return"".concat(e.eng);default:return" ".concat(e.eng)}})),Ot(Bt(r),"render",(function(){var t;return e(r.state.reverseTranslationArray,"length")?f.createElement(Kt,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(bn,{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(Un,{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=b(),r.state={isValidated:!1,reverseTranslationArray:mi(n.reverseTranslation)},r}return Pt(o)}();Ot(fi,"propTypes",{authentication:Gt,interpretation:y.array,onValueLabelClick:y.func,appliedFilters:y.array,reverseTranslation:y.array}),Ot(fi,"defaultProps",{authentication:jn,interpretation:[],appliedFilters:[],reverseTranslation:[],onValueLabelClick:void 0});var gi=function(t){Lt(r,f.Component);var o=Qt(r);function r(t){var i,l,s,c,u,d,p,g,h,y,E,S,T,D,x,w,R;kt(this,r),Ot(Bt(R=o.call(this,t)),"componentDidMount",(function(){try{R._isMounted=!0,R.updateToolbars()}catch(e){console.error(e),R.props.onErrorCallback(e)}})),Ot(Bt(R),"shouldComponentUpdate",(function(e,t){return!(!R.props.shouldRender&&!e.shouldRender)&&((!R.props.isResizing||!e.isResizing)&&(!(!R.props.queryResponse&&!R.queryResponse)&&(!$o(R.props,e)||!$o(R.state,t))))})),Ot(Bt(R),"componentDidUpdate",(function(e,t){try{var a,o,r={},i=!1;!n(R.props.initialTableConfigs,{tableConfig:R.tableConfig,pivotTableConfig:R.pivotTableConfig})&&R.props.onTableConfigChange&&R.onTableConfigChange(),n(R.state.aggConfig,t.aggConfig)||R.props.onAggConfigChange(R.state.aggConfig),t.displayType!==R.state.displayType&&Qn(),((null===(a=R.state.visibleRows)||void 0===a?void 0:a.length)!==(null===(o=t.visibleRows)||void 0===o?void 0:o.length)||"table"===R.state.displayType&&"text"===t.displayType)&&setTimeout((function(){R.props.onRowChange()}),0);var l=R.state.columnChangeCount!==t.columnChangeCount,s=R.state.visibleRowChangeCount!==t.visibleRowChangeCount;if(l||s){l&&R.props.onColumnChange(R.state.columns),R.shouldGeneratePivotData()&&(R.generatePivotData({isFirstGeneration:!0,newTableData:R.state.visibleRows}),i=!0);var c=R.getCurrentSupportedDisplayTypes();n(c,R.state.supportedDisplayTypes)||(r.supportedDisplayTypes=c)}n(R.state.supportedDisplayTypes,t.supportedDisplayTypes)||R.isCurrentDisplayTypeValid()||(r.displayType=R.getUpdatedDefaultDisplayType("table")),R.updateToolbars(),De(r)?i&&R.forceUpdate():R.setState(r)}catch(e){console.error(e)}})),Ot(Bt(R),"componentWillUnmount",(function(){try{R._isMounted=!1,zn()}catch(e){console.error(e)}})),Ot(Bt(R),"refreshLayout",(function(){var e;R.chartRef&&(null===(e=R.chartRef)||void 0===e||e.adjustChartPosition())})),Ot(Bt(R),"onTableConfigChange",(function(){R.props.onTableConfigChange({tableConfig:R.tableConfig,pivotTableConfig:R.pivotTableConfig})})),Ot(Bt(R),"changeDisplayType",(function(e){R.props.onDisplayTypeChange&&R.props.onDisplayTypeChange(e),R.setState({displayType:e})})),Ot(Bt(R),"displayTypeInvalidWarning",(function(e){console.warn('Initial display type "'.concat(R.props.initialDisplayType,'" provided is not valid for this dataset. Using ').concat(e||R.state.displayType," instead."))})),Ot(Bt(R),"getDataLength",(function(){var e,t,n,a;return null!==(e=R.state)&&void 0!==e&&e.visibleRows?null===(t=R.state)||void 0===t||null===(n=t.visibleRows)||void 0===n?void 0:n.length:null===(a=R.tableData)||void 0===a?void 0:a.length})),Ot(Bt(R),"getPivotDataLength",(function(){var e,t,n,a;return null!==(e=R.state)&&void 0!==e&&e.visiblePivotRows?null===(t=R.state)||void 0===t||null===(n=t.visiblePivotRows)||void 0===n?void 0:n.length:null===(a=R.pivotTableData)||void 0===a?void 0:a.length})),Ot(Bt(R),"getUpdatedDefaultDisplayType",(function(e){return Qo(R.props.queryResponse,R.props.autoChartAggregations,R.getColumns(),R.getDataLength(),R.getPivotDataLength(),e,R.isDataLimited())})),Ot(Bt(R),"getDisplayTypeFromInitial",(function(e){var t,n,a=e.initialDisplayType,o=R.getUpdatedDefaultDisplayType(R.props.preferredDisplayType);return a&&Bo(e.queryResponse,a,null===(t=R.tableData)||void 0===t?void 0:t.length,null===(n=R.pivotTableData)||void 0===n?void 0:n.length,R.getColumns(),R.isDataLimited())||(a=o),a})),Ot(Bt(R),"hasError",(function(e){try{var t=Number(e.data.reference_id.split(".")[2]);if(t>=200&&t<300)return!1}catch(e){}return!0})),Ot(Bt(R),"getColumns",(function(){var e,t,n;return R._isMounted?R.state.columns:R.formatColumnsForTable(null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.columns)})),Ot(Bt(R),"currentlySupportsCharts",(function(){var e=R.getCurrentSupportedDisplayTypes().filter((function(e){return Sn.includes(e)}));return!(null==e||!e.length)})),Ot(Bt(R),"currentlySupportsPivot",(function(){var e=R.getCurrentSupportedDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),Ot(Bt(R),"potentiallySupportsPivot",(function(){var e=R.getPotentialDisplayTypes();return null==e?void 0:e.includes("pivot_table")})),Ot(Bt(R),"potentiallySupportsDatePivot",(function(){var e=R.getColumns();return R.potentiallySupportsPivot()&&2===(null==e?void 0:e.length)})),Ot(Bt(R),"usePivotDataForChart",(function(){return R.potentiallySupportsPivot()&&!R.potentiallySupportsDatePivot()})),Ot(Bt(R),"areColumnsValid",(function(e){var t,n,a,o=null===(t=R.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.columns;return!(null==e||!e.length||null==o||!o.length)&&e.every((function(e){return o.find((function(t){e.name,t.name}))}))})),Ot(Bt(R),"isTableConfigValid",(function(e,t,n){try{if(!e||!e.numberColumnIndices||!e.stringColumnIndices||isNaN(Number(e.numberColumnIndex))||isNaN(Number(e.stringColumnIndex)))return console.debug("Table config provided was incomplete"),!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(!t[e.stringColumnIndex].is_visible||!t[e.numberColumnIndex].is_visible||void 0!==e.numberColumnIndices.find((function(e){return!t[e].is_visible}))||void 0!==e.stringColumnIndices.find((function(e){return!t[e].is_visible})))return console.debug("Some of the table config indices were hidden columns"),!1;if("column_line"===n){if(!isNaN(e.numberColumnIndex)&&!isNaN(e.numberColumnIndex2)&&e.numberColumnIndex===e.numberColumnIndex2)return console.debug("Both axes reference the same number column index"),!1;if(e.numberColumnIndices.length&&e.numberColumnIndices2.length&&e.numberColumnIndices.filter((function(t){return e.numberColumnIndices2.includes(t)})).length)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]&&ka(t[e])})))return console.debug("Saved number indices are not number columns"),!1;if(!e.stringColumnIndices.every((function(e){return t[e]&&Ia(t[e])})))return console.debug("Saved string indices are not string columns"),!1;if(!e.numberColumnIndices2){var a=Oa(t,R.usePivotDataForChart()),o=a.numberColumnIndices2,r=a.numberColumnIndex2;e.numberColumnIndices2=o,e.numberColumnIndex2=r}return!0}catch(e){return console.debug("Saved table config was not valid for dashboard tile response:",null==e?void 0:e.message),!1}})),Ot(Bt(R),"updateColumns",(function(e){if(e&&R._isMounted){var t=R.formatColumnsForTable(e);R.isTableConfigValid(R.tableConfig,t,R.state.displayType)||(R.tableConfig=void 0,R.setTableConfig(t),R.chartID=b()),R.setState({columns:t,aggConfig:R.getAggConfig(e),columnChangeCount:R.state.columnChangeCount+1})}})),Ot(Bt(R),"generateAllData",(function(){var e,t;null!==(e=R.queryResponse)&&void 0!==e&&null!==(t=e.data)&&void 0!==t&&t.data&&R.shouldGenerateTableData()&&(R.generateTableData(),R.shouldGeneratePivotData()&&R.generatePivotData({isFirstGeneration:!0}))})),Ot(Bt(R),"shouldGeneratePivotData",(function(){var e;return((null===(e=R.state)||void 0===e?void 0:e.visibleRows)||R.tableData)&&R.potentiallySupportsPivot()})),Ot(Bt(R),"shouldGenerateTableData",(function(){var e,t,n;return!(null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||!n.rows)})),Ot(Bt(R),"generateTableData",(function(e,t){if(t)R.tableData=t;else{var n,a,o,r,i,l,s=e||R.getColumns();if(R.isDataLimited())R.tableData=null===(n=R.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.rows;else R.tableData=Go(null===(r=R.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.rows,s,"desc","isTable");R.setTableConfig(),R._isMounted&&R.setState({columns:s})}})),Ot(Bt(R),"generatePivotData",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var a;R.pivotTableID=b();var o=(null===(a=R.state)||void 0===a?void 0:a.visibleRows)||R.tableData,r=R.getColumns();2===r.length?R.generateDatePivotData(o):R.generatePivotTableData({isFirstGeneration:n})}catch(e){console.error(e),R.props.onErrorCallback(e),R.pivotTableData=void 0}R.props.allowDisplayTypeChange&&(null===(e=R.pivotTableRef)||void 0===e||e.updateData(R.pivotTableData))})),Ot(Bt(R),"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"},R.props.showSuggestionPrefix&&f.createElement("div",{className:"react-autoql-suggestion-message-prefix"},"I want to make sure I understood your query. Did you mean:"),R.props.renderSuggestionsAsDropdown?f.createElement("select",{key:b(),onChange:function(e){R._isMounted&&(R.setState({selectedSuggestion:e.target.value}),R.onSuggestionClick({query:e.target.value,source:["suggestion"],queryId:t}))},value:R.state.selectedSuggestion,className:"react-autoql-suggestions-select"},e.map((function(e,t){return f.createElement("option",{key:b(),value:e},e)}))):e.map((function(e){return f.createElement("div",{key:b(),"data-test":"suggestion-list-button"},f.createElement("button",{onClick:function(){return R.onSuggestionClick({query:e,isButtonClick:!0,source:["suggestion"],queryId:t})},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 R.props.renderFullSuggestionMessage?f.createElement("div",{style:{textAlign:"center"}},R.renderError(R.queryResponse),n):n})),Ot(Bt(R),"renderSingleValueResponse",(function(){var t;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(Xn(R.props.autoQLConfig).enableDrilldowns?" with-drilldown":""),onClick:function(){R.processDrilldown({groupBys:[],supportedByAPI:!0})}},To({element:e(R.queryResponse,"data.data.rows[0][0]"),column:null===(t=R.state.columns)||void 0===t?void 0:t[0],config:Gn(R.props.dataFormatting)}))))})),Ot(Bt(R),"copyTableToClipboard",(function(){var e,t;"table"===R.state.displayType&&null!==(e=R.tableRef)&&void 0!==e&&e._isMounted?R.tableRef.copyToClipboard():"pivot_table"===R.state.displayType&&null!==(t=R.pivotTableRef)&&void 0!==t&&t._isMounted&&R.pivotTableRef.copyToClipboard()})),Ot(Bt(R),"getBase64Data",(function(){var e,t;if(R.chartRef&&No(R.state.displayType))return R.chartRef.getBase64Data().then((function(e){var t=e.split(",")[1];return Promise.resolve(t)}));if(null!==(e=R.tableRef)&&void 0!==e&&e._isMounted&&"table"===R.state.displayType){var n=R.tableRef.getBase64Data();return Promise.resolve(n)}if(null!==(t=R.pivotTableRef)&&void 0!==t&&t._isMounted&&"pivot_table"===R.state.displayType){var a=R.pivotTableRef.getBase64Data();return Promise.resolve(a)}})),Ot(Bt(R),"saveChartAsPNG",(function(){R.chartRef&&R.chartRef.saveAsPNG()})),Ot(Bt(R),"queryFn",(function(){var e,t,n,a,o,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.fe_req,s=R.getCombinedFilters();return R.cancelCurrentRequest(),R.axiosSource=null===(a=m.CancelToken)||void 0===a?void 0:a.source(),R.isDrilldown()?la(xt(xt(xt({},Wn(R.props.authentication)),Xn(R.props.autoQLConfig)),{},{source:null==l?void 0:l.source,debug:"include"===(null==l?void 0:l.translation),filters:null==l?void 0:l.session_filter_locks,pageSize:null==l?void 0:l.page_size,test:null==l?void 0:l.test,groupBys:null==l?void 0:l.columns,queryID:R.props.originalQueryID,orders:null===(r=R.formattedTableParams)||void 0===r?void 0:r.sorters,tableFilters:s,cancelToken:R.axiosSource.token},i)):oa(xt(xt(xt({},Wn(R.props.authentication)),Xn(R.props.autoQLConfig)),{},{query:null==l?void 0:l.text,source:null==l?void 0:l.source,debug:"include"===(null==l?void 0:l.translation),userSelection:null==l?void 0:l.disambiguation,filters:null==l?void 0:l.session_filter_locks,test:null==l?void 0:l.test,pageSize:null==l?void 0:l.page_size,orders:null===(o=R.formattedTableParams)||void 0===o?void 0:o.sorters,tableFilters:s,cancelToken:R.axiosSource.token},i))})),Ot(Bt(R),"getFilterDrilldown",(function(e){var t=e.stringColumnIndex,n=e.row;try{var a,o=null===(a=R.tableData)||void 0===a?void 0:a.filter((function(e){return"".concat(e[t])==="".concat(n[t])})),r=C(R.queryResponse);return r.data.data.rows=o,r.data.data.count_rows=o.length,r}catch(e){console.error(e)}})),Ot(Bt(R),"cancelCurrentRequest",(function(){var e;null===(e=R.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(R),"processDrilldown",function(){var e=Nt(wt().mark((function e(t){var n,a,o,r,i,l,s,c,u,d,p,m,f;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.groupBys,a=t.supportedByAPI,o=t.row,r=t.activeKey,i=t.stringColumnIndex,!Xn(R.props.autoQLConfig).enableDrilldowns){e.next=45;break}if(e.prev=2,l=R.getDefaultQueryPageSize(),s=R.getColumns(),c=s[i],!a){e.next=20;break}return R.props.onDrilldownStart(r),e.prev=8,e.next=11,la(xt(xt(xt({},Wn(R.props.authentication)),Xn(R.props.autoQLConfig)),{},{queryID:R.queryID,groupBys:n,pageSize:l}));case 11:u=e.sent,R.props.onDrilldownEnd({response:u,originalQueryID:R.queryID}),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(8),R.props.onDrilldownEnd({response:e.t0});case 18:e.next=39;break;case 20:if(isNaN(i)||null==o||!o.length){e.next=39;break}if(R.props.onDrilldownStart(r),R.isDataLimited()||Pa(c)){e.next=27;break}d=R.getFilterDrilldown({stringColumnIndex:i,row:o}),setTimeout((function(){R.props.onDrilldownEnd({response:d})}),1500),e.next=39;break;case 27:return p=R.constructFilter({column:R.state.columns[i],value:o[i]}),m=R.getCombinedFilters(p),e.prev=29,e.next=32,R.queryFn({tableFilters:m,pageSize:l});case 32:f=e.sent,e.next=38;break;case 35:e.prev=35,e.t1=e.catch(29),f=e.t1;case 38:R.props.onDrilldownEnd({response:f,originalQueryID:R.queryID});case 39:e.next=45;break;case 41:e.prev=41,e.t2=e.catch(2),console.error(e.t2),R.props.onDrilldownEnd({error:"Error processing drilldown"});case 45:case"end":return e.stop()}}),e,null,[[2,41],[8,15],[29,35]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(R),"constructFilter",(function(e){var t=e.column,n=e.value,a=n,o="=";if(null===a)a="NULL",o="is";else if("DATE"===t.type){var r=So({value:n,column:t,config:R.props.dataFormatting}),i=or(t.precision),l=r.startOf(i).toISOString(),s=r.endOf(i).toISOString();a="".concat(l,",").concat(s),o="between"}return{name:t.name,operator:o,value:a}})),Ot(Bt(R),"getCombinedFilters",(function(e){var t,n,a,o,r=null===(t=R.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.fe_req,i=(null==r?void 0:r.filters)||[],l=(null===(o=R.formattedTableParams)||void 0===o?void 0:o.filters)||[],s=[];if(l.forEach((function(e){var t=i.find((function(t){return t.name===e.name}));s.push(null!=t?t:e)})),i.forEach((function(e){s.find((function(t){return t.name===e.name}))||s.push(e)})),e){var c=s.findIndex((function(t){return t.name===e.name}));c>=0?s[c]=e:s.push(e)}return s})),Ot(Bt(R),"onTableCellClick",(function(e){var t,n;if(null==e||null===(t=e.getColumn())||void 0===t||null===(n=t.getDefinition())||void 0===n||!n.pivot){var a=R.getColumns();if(a){var o={};if(R.pivotTableColumns&&"pivot_table"===R.state.displayType)if(R.potentiallySupportsDatePivot()){var r,i,l,s,c,u,d=La(a),p=null===(r=e.getColumn())||void 0===r||null===(i=r.getDefinition())||void 0===i?void 0:i.title,m=null===(l=e.getData())||void 0===l?void 0:l[0],f=null===(s=R.pivotOriginalColumnData)||void 0===s||null===(c=s[p])||void 0===c?void 0:c[m];o=[{name:null===(u=a[d])||void 0===u?void 0:u.name,value:f}]}else{var g=a[R.tableConfig.legendColumnIndex],v=a[R.tableConfig.stringColumnIndex];o=function(e){var t=e.cell,n=e.rowHeaders,a=e.columnHeaders,o=e.rowHeaderDefinition,r=e.columnHeaderDefinition;try{var i,l=r.name,s=Number(t.getField())-1,c=zo(a,s),u=o.name,d=(null==t||null===(i=t.getRow())||void 0===i?void 0:i.getPosition())-1,p=zo(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:R.pivotRowHeaders,columnHeaders:R.pivotColumnHeaders,rowHeaderDefinition:v,columnHeaderDefinition:g})}else o=function(e,t){if(e&&t){var n=Ao(t);if(n.length){var a=e.getData(),o=[];return n.forEach((function(e){var n=t[e].name,r="".concat(a[e]);o.push({name:n,value:r})})),o}}}(e,a);R.processDrilldown({groupBys:o,supportedByAPI:!!o})}}})),Ot(Bt(R),"onChartClick",(function(e){var t,n,a=e.row,o=e.columnIndex,r=e.columns,i=e.stringColumnIndex,l=e.legendColumn,s=e.activeKey,c=[],u=r[o],d=(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 p,m,f,g=Number(null==r||null===(p=r[o])||void 0===p?void 0:p.name),v=null==a?void 0:a[i],h="".concat(null===(m=R.pivotOriginalColumnData)||void 0===m||null===(f=m[g])||void 0===f?void 0:f[v]);c.push({name:d.name,value:h})}else null!=d&&d.groupable&&c.push({name:d.name,value:"".concat(null==a?void 0:a[i])});null!=l&&l.groupable&&u.origColumn&&c.push({name:l.name,value:"".concat(null==u?void 0:u.name)}),c.length,R.processDrilldown({groupBys:c,supportedByAPI:!!c.length,row:a,activeKey:s,stringColumnIndex:i})})),Ot(Bt(R),"updateToolbars",(function(){R.updateVizToolbar(),R.updateOptionsToolbar()})),Ot(Bt(R),"updateVizToolbar",(function(){var e;null!==(e=R.props.vizToolbarRef)&&void 0!==e&&e._isMounted&&R.props.vizToolbarRef.forceUpdate()})),Ot(Bt(R),"updateOptionsToolbar",(function(){var e;null!==(e=R.props.optionsToolbarRef)&&void 0!==e&&e._isMounted&&R.props.optionsToolbarRef.forceUpdate()})),Ot(Bt(R),"toggleTableFilter",(function(){var e,t;return"table"===R.state.displayType?(null===(e=R.tableRef)||void 0===e?void 0:e._isMounted)&&R.tableRef.toggleIsFiltering():"pivot_table"===R.state.displayType?(null===(t=R.pivotTableRef)||void 0===t?void 0:t._isMounted)&&R.pivotTableRef.toggleIsFiltering():void 0})),Ot(Bt(R),"onNewPage",(function(e){if(null!=e&&e.length)try{R.tableData=[].concat(zt(R.tableData),zt(e)),R.setState({visibleRowChangeCount:R.state.visibleRowChangeCount+1,visibleRows:R.tableData})}catch(e){console.error(e)}})),Ot(Bt(R),"onTableParamsChange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};R.tableParams=C(e),R.formattedTableParams=t})),Ot(Bt(R),"onNewData",(function(e,t){var n,a,o,r;R.isOriginalData=!1,R.queryResponse=e;var i,l=null==e||null===(n=e.data)||void 0===n?void 0:n.data;(R.tableData=(null==l?void 0:l.rows)||[],"table"!==R.state.displayType&&R.props.allowDisplayTypeChange)&&(R.tableData.length>=(null==l?void 0:l.count_rows)?R.tableID=b():null===(i=R.tableRef)||void 0===i||i.updateData(R.tableData));R.setState({visibleRows:e.data.data.rows,visibleRowChangeCount:R.state.visibleRowChangeCount+1});var s=null!=t?t:null==e||null===(a=e.data)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.fe_req)||void 0===r?void 0:r.page_size;R.props.onPageSizeChange(s)})),Ot(Bt(R),"onTableFilter",function(){var e=Nt(wt().mark((function e(t,a){var o,r;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!n(t,null===(o=R.tableParams)||void 0===o?void 0:o.filters)){e.next=2;break}return e.abrupt("return");case 2:R.tableParams.filters=C(t),r=[],a.forEach((function(e){r.push(e.getData())})),R.setState({visibleRows:r,visibleRowChangeCount:R.state.visibleRowChangeCount+1});case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),Ot(Bt(R),"onTableSort",(function(e){R.tableParams.sorters=C(e)})),Ot(Bt(R),"onLegendClick",(function(e){var t=null==e?void 0:e.columnIndex,n=R.usePivotDataForChart(),a=C(n?R.pivotTableColumns:R.state.columns);if(null!=a&&a.length)if(a[t].isSeriesHidden=!a[t].isSeriesHidden,n)R.pivotTableColumns=a,R.forceUpdate();else{var o=R.formatColumnsForTable(a);R.setState({columns:o})}})),Ot(Bt(R),"onChangeStringColumnIndex",(function(e){R.usePivotDataForChart()?(R.pivotTableConfig.legendColumnIndex===e&&(R.pivotTableConfig.legendColumnIndex=void 0),R.pivotTableConfig.stringColumnIndex=e,R.generatePivotTableData()):(R.tableConfig.legendColumnIndex===e&&(R.tableConfig.legendColumnIndex=void 0),R.tableConfig.stringColumnIndex=e),R.forceUpdate()})),Ot(Bt(R),"onChangeLegendColumnIndex",(function(e){R.usePivotDataForChart()?(R.pivotTableConfig.stringColumnIndex===e&&(R.pivotTableConfig.stringColumnIndex=void 0),R.pivotTableConfig.legendColumnIndex=e,R.generatePivotTableData()):(R.tableConfig.stringColumnIndex===e&&(R.tableConfig.stringColumnIndex=void 0),R.tableConfig.legendColumnIndex=e),R.forceUpdate()})),Ot(Bt(R),"onChangeNumberColumnIndices",(function(e,t,n){if(e)if(R.usePivotDataForChart())R.pivotTableConfig.numberColumnIndices=e,R.pivotTableConfig.numberColumnIndex=e[0],t&&(R.pivotTableConfig.numberColumnIndices2=t,R.pivotTableConfig.numberColumnIndex2=t[0]),n&&(R.pivotTableColumns=n),R.forceUpdate();else{R.tableConfig.numberColumnIndices=e,R.tableConfig.numberColumnIndex=e[0],t&&(R.tableConfig.numberColumnIndices2=t,R.tableConfig.numberColumnIndex2=t[0]);var a=null!=n?n:R.state.columns;R.updateColumns(a)}})),Ot(Bt(R),"setPivotTableConfig",(function(e){var t=R.pivotTableColumns;if(t){var a=C(R.pivotTableConfig);if(R.pivotTableConfig||(R.pivotTableConfig={}),e||!R.pivotTableConfig.stringColumnIndices||!(R.pivotTableConfig.stringColumnIndex>=0)){var o=qa(t,"supportsPivot"),r=o.stringColumnIndices,i=o.stringColumnIndex;R.pivotTableConfig.stringColumnIndices=r,R.pivotTableConfig.stringColumnIndex=i}if(e||!R.pivotTableConfig.numberColumnIndices){var l=Oa(t,R.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;R.pivotTableConfig.numberColumnIndices=c,R.pivotTableConfig.numberColumnIndex=s,R.pivotTableConfig.numberColumnIndices2=d,R.pivotTableConfig.numberColumnIndex2=u,R.pivotTableConfig.currencyColumnIndices=p,R.pivotTableConfig.quantityColumnIndices=m,R.pivotTableConfig.ratioColumnIndices=f}n(a,R.pivotTableConfig)||R.onTableConfigChange()}})),Ot(Bt(R),"setTableConfig",(function(e){var t=null!=e?e:R.getColumns();if(t){var a=C(R.tableConfig);if(R.tableConfig||(R.tableConfig={}),!(R.tableConfig.stringColumnIndices&&R.tableConfig.stringColumnIndex>=0)){var o=qa(t),r=o.stringColumnIndices,i=o.stringColumnIndex;R.tableConfig.stringColumnIndices=r,R.tableConfig.stringColumnIndex=i}if(!(R.tableConfig.numberColumnIndices&&R.tableConfig.numberColumnIndex>=0)){var l=Oa(t,R.usePivotDataForChart()),s=l.numberColumnIndex,c=l.numberColumnIndices,u=l.numberColumnIndex2,d=l.numberColumnIndices2,p=l.currencyColumnIndices,m=l.quantityColumnIndices,f=l.ratioColumnIndices;R.tableConfig.numberColumnIndices=c,R.tableConfig.numberColumnIndex=s,R.tableConfig.numberColumnIndices2=d,R.tableConfig.numberColumnIndex2=u,R.tableConfig.currencyColumnIndices=p,R.tableConfig.quantityColumnIndices=m,R.tableConfig.ratioColumnIndices=f}var g=t.findIndex((function(e,t){return e.groupable&&t!==R.tableConfig.stringColumnIndex}));g>=0&&(R.tableConfig.legendColumnIndex=g),n(a,R.tableConfig)||R.onTableConfigChange()}})),Ot(Bt(R),"getPotentialDisplayTypes",(function(){var e,t,n,a;return Fo({response:R.queryResponse,columns:null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.columns)||void 0===a?void 0:a.map((function(e){return xt({},e)}))})})),Ot(Bt(R),"isCurrentDisplayTypeValid",(function(){return Bo(R.queryResponse,R.state.displayType,R.getDataLength(),R.getPivotDataLength(),R.getColumns(),R.isDataLimited())})),Ot(Bt(R),"getCurrentSupportedDisplayTypes",(function(){return Fo({response:R.queryResponse,columns:R.getColumns(),dataLength:R.getDataLength(),pivotDataLength:R.getPivotDataLength(),isDataLimited:R.isDataLimited()})})),Ot(Bt(R),"setFilterFunction",(function(e){var t=Bt(R);return"DATE"===e.type?function(t,n,o,r){try{var i;if(!n)return!1;var l=So({value:n,column:e,config:R.props.dataFormatting}),s=t.split(" to "),c=or(ar(e.precision)),u=a.utc(s[0]).startOf(c),d=a.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),R.props.onErrorCallback(e),!1}}:"DATE_STRING"===e.type?function(n,a,o,r){try{if(!a)return!1;var i=To({element:a,column:e,config:t.props.dataFormatting});return"".concat(i).toLowerCase().includes("".concat(n).toLowerCase())}catch(e){return console.error(e),R.props.onErrorCallback(e),!1}}:"DOLLAR_AMT"===e.type||"QUANTITY"===e.type||"PERCENT"===e.type||"RATIO"===e.type?function(e,t,n,a){try{if(!t)return!1;var o=e.trim();if(o.length>=2){var r=Number(o.substr(1).replace(/[^0-9.]/g,""));if(">"===o[0]&&"="===o[1])return t>=r;if(">"===o[0])return t>r;if("<"===o[0]&&"="===o[1])return t<=r;if("<"===o[0])return t<r;if("!"===o[0]&&"="===o[1])return t!==r;if("="===o[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),R.props.onErrorCallback(e),!1}}:void 0})),Ot(Bt(R),"setSorterFunction",(function(e){return"DATE"===e.type||"DATE_STRING"===e.type?function(t,n){return Wo(t,n,e,"isTable")}:(e.type,"alphanum")})),Ot(Bt(R),"setHeaderFilterPlaceholder",(function(e){return"DATE"!==e.type||e.pivot?"Filter":"Pick range"})),Ot(Bt(R),"getAggConfig",(function(e){if(!e)return null;var t={};return e.forEach((function(e){t[e.name]=e.aggType})),t})),Ot(Bt(R),"formatColumnsForTable",(function(e,t){if(!e)return null;var n=0===Ro(e);return e.map((function(e,a){var o,r,i,l,s,c=C(e);c.id=b(),c.field="".concat(a),c.title=e.display_name,c.visible=e.is_visible,c.download=e.is_visible,c.minWidth="90px","DATE"===c.type&&(c.minWidth="125px"),"DOLLAR_AMT"===c.type||"RATIO"===c.type||"NUMBER"===c.type?c.hozAlign="right":c.hozAlign="center",c.cssClass="".concat(c.type," ").concat(u?"DRILLDOWN":null),c.formatter=function(e,t,n){return To({element:e.getValue(),column:c,config:Gn(R.props.dataFormatting),htmlElement:e.getElement()})},c.headerFilter="input",c.headerFilterPlaceholder=R.setHeaderFilterPlaceholder(c),c.headerFilterFunc=R.setFilterFunction(c),c.sorter=R.setSorterFunction(c),c.headerSort=!!R.props.enableTableSorting,c.headerSortStartingDir="desc",c.headerClick=function(){var e,t;null===(e=R.tableRef)||void 0===e||null===(t=e.ref)||void 0===t||t.restoreRedraw()};var u=null===(o=R.queryResponse)||void 0===o||null===(r=o.data)||void 0===r||null===(i=r.data)||void 0===i||null===(l=i.fe_req)||void 0===l||null===(s=l.columns)||void 0===s?void 0:s.find((function(e){return c.name===e.name}));u&&(c.isDrilldownColumn=!0,c.tooltipTitle=c.title,c.title="".concat(c.title,' <em>(Clicked: "').concat(u.value,'")</em>'));var d=e.aggType;t&&(d=t[e.name]),n&&ka(e)&&(c.aggType=d||"sum");var p=R.columnDateRanges.find((function(e){return"DATE"===c.type&&(e.columnName===c.display_name||!!c.groupable)}));return p&&(c.dateRange=p),c}))})),Ot(Bt(R),"formatDatePivotYear",(function(e,t){var n=R.getColumns();return"DATE"===n[t].type?So({value:e[t],column:n[t],config:R.props.dataFormatting}).year().toString():a(e[t]).format("YYYY")})),Ot(Bt(R),"formatDatePivotMonth",(function(e,t){var n=R.getColumns();return"DATE"===n[t].type?So({value:e[t],column:n[t],config:R.props.dataFormatting}).format("MMMM"):a(e[t]).format("MMMM")})),Ot(Bt(R),"generateDatePivotData",(function(t){try{var n=R.getColumns(),o=La(n),r=R.tableConfig.numberColumnIndex;r>=0||(r=n.findIndex((function(e,t){return t!==o&&ka(e)})));var i=t||e(R.queryResponse,"data.data.rows"),l=zt(i.map((function(e){return"DATE"===n[o].type?So({value:e[o],column:n[o],config:R.props.dataFormatting}).year():Number(a(e[o]).format("YYYY"))}))).filter(po).sort().reduce((function(e,t,n){return e[t]=n+1,e}),{}),s=n[o],c=xt(xt({},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 Wo(e,t,s,"isTable")},headerFilter:!1,headerFilterPlaceholder:"filter..."}),u=[xt(xt({},c),{},{formatter:function(e){return To({element:e.getValue(),column:c,config:Gn(R.props.dataFormatting),htmlElement:e.getElement()})}})];Object.keys(l).forEach((function(e,t){u.push(xt(xt({},n[r]),{},{origColumn:n[r],origValues:{},name:e,title:e,field:"".concat(t+1),visible:!0,is_visible:!0,headerFilter:!1}))}));var d=mo(Object.keys(l).length,12),p={};xn.forEach((function(e,t){d[t][0]=e})),i.forEach((function(e){var t,a=R.formatDatePivotYear(e,o),i=R.formatDatePivotMonth(e,o),s=l[a],c=xn.findIndex((function(e){return i===e})),m=u.findIndex((function(e){return e.name===a}));c>=0&&s&&(d[c][s]=e[r],p[a]=xt(xt({},p[a]),{},Ot({},i,e[o])),u[m].origValues[i]={name:null===(t=n[o])||void 0===t?void 0:t.name,value:e[o]||""})})),R.pivotOriginalColumnData=p,R.pivotTableColumns=u,R.pivotTableData=d,R.numberOfPivotTableRows=12,R.setPivotTableConfig()}catch(e){console.error(e);var m=R.getCurrentSupportedDisplayTypes();R.setState({displayType:"table",supportedDisplayTypes:m.filter((function(e){return"pivot_table"!==e}))})}})),Ot(Bt(R),"generatePivotTableData",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isFirstGeneration;try{var a,o=(null===(a=R.state)||void 0===a?void 0:a.visibleRows)||R.tableData||e(R.queryResponse,"data.data.rows");o=o.filter((function(e){return null!==e[0]}));var r=R.getColumns(),i=R.tableConfig,l=i.legendColumnIndex,s=i.stringColumnIndex,c=i.numberColumnIndex,u=Go(o,r,"desc","isTable").map((function(e){return e[s]})).filter(po).reduce((function(e,t,n){return e[t]=n,e}),{}),d=Go(o,r,"desc","isTable").map((function(e){return e[l]})).filter(po).reduce((function(e,t,n){return e[t]=n,e}),{}),p=s,m=l;if(n&&Object.keys(d).length>Object.keys(u).length&&!Pa(r[s])){p=l,m=s;var f=C(u);u=C(d),d=C(f)}R.pivotColumnHeaders=d,R.pivotRowHeaders=u,R.tableConfig.legendColumnIndex=m,R.tableConfig.stringColumnIndex=p;var g=[xt(xt({},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=To({element:e,column:r[m],config:Gn(R.props.dataFormatting)});g.push(xt(xt({},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 v=mo(Object.keys(d).length+1,Object.keys(u).length);o.forEach((function(e){var t,n=u[e[p]],a=e[p];v[n][0]=a;var o=d[e[m]]+1,i=Number(e[c]);v[n][o]=i,g[o].origValues[a]={name:null===(t=r[p])||void 0===t?void 0:t.name,value:a}})),R.pivotTableColumns=g,R.pivotTableData=v,R.numberOfPivotTableRows=e(R.pivotTableData,"length",0),R.setPivotTableConfig(n)}catch(e){console.error(e),R.props.onErrorCallback(e)}})),Ot(Bt(R),"onSuggestionClick",(function(t){var n,a,o=t.query,r=t.queryId,i=t.userSelection,l=t.isButtonClick,s=t.skipQueryValidation,c=t.source;(i||function(t){var n=t.queryId,a=t.suggestion,o=t.apiKey,r=t.domain,i=t.token,l="".concat(r,"/autoql/api/v1/query/").concat(n,"/suggestions?key=").concat(o),s={suggestion:a};if(!i||!r||!o)return Promise.reject(new Error("Unauthenticated"));var c={headers:{Authorization:"Bearer ".concat(i)}};m.put(l,s,c).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},Wn(R.props.authentication)),{},{queryId:r,suggestion:o})),"None of these"===o)?(R.props.onNoneOfTheseClick&&R.props.onNoneOfTheseClick(),R.props.mutable&&R.setState({customResponse:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")})):(R.props.onSuggestionClick&&R.props.onSuggestionClick({query:o,userSelection:i,isButtonClick:l,skipQueryValidation:s,source:c}),null!==(n=R.props.queryInputRef)&&void 0!==n&&n._isMounted&&(null===(a=R.props.queryInputRef)||void 0===a||a.animateInputTextAndSubmit({queryText:o,userSelection:i,skipQueryValidation:!0,source:c})))})),Ot(Bt(R),"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(R.COMPONENT_KEY,"-").concat(n)},f.createElement("span",null,e),n!==t.length-1&&f.createElement("button",{className:"report-like-text-button",onClick:R.props.reportProblemCallback},"report"))})))}catch(t){return f.createElement("span",null,e)}})),Ot(Bt(R),"isDrilldown",(function(){try{var e,t,n;return"Drilldown"===((null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.text)||"").split(":")[0]}catch(e){return!1}})),Ot(Bt(R),"renderAllColumnsHiddenMessage",(function(){return f.createElement("div",{className:"no-columns-error-message","data-test":"columns-hidden-message"},f.createElement("div",null,f.createElement(bn,{className:"warning-icon",type:"warning-triangle"}),f.createElement("br",null)," All columns in this table are currently hidden. You can adjust your column visibility preferences using the Column Visibility Manager (",f.createElement(bn,{className:"eye-icon",type:"eye"}),") in the Options Toolbar."))})),Ot(Bt(R),"getDefaultQueryPageSize",(function(){var e;return null!==(e=R.props.dataPageSize)&&void 0!==e?e:100})),Ot(Bt(R),"getQueryPageSize",(function(){var e,t,n,a,o,r;return null!==(e=null!==(t=R.props.dataPageSize)&&void 0!==t?t:null===(n=R.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.fe_req)||void 0===r?void 0:r.page_size)&&void 0!==e?e:100})),Ot(Bt(R),"renderTable",(function(){var e,t,n,a,o,r,i,l,s;return Vo(R.getColumns())?R.renderAllColumnsHiddenMessage():R.tableData?f.createElement(Kt,null,f.createElement(hr,{key:R.tableID,autoHeight:R.props.autoHeight,authentication:R.props.authentication,dataFormatting:R.props.dataFormatting,rowChangeCount:R.state.visibleRowChangeCount,ref:function(e){return R.tableRef=e},columns:R.state.columns,response:R.queryResponse,data:R.tableData,columnDateRanges:R.columnDateRanges,onCellClick:R.onTableCellClick,queryID:R.queryID,initialParams:R.tableParams,onFilterCallback:R.onTableFilter,onSorterCallback:R.onTableSort,onTableParamsChange:R.onTableParamsChange,onNewPage:R.onNewPage,onNewData:R.onNewData,isAnimating:R.props.isAnimating,isResizing:R.props.isResizing,pageSize:R.getQueryPageSize(),useInfiniteScroll:R.props.enableAjaxTableData&&R.isDataLimited(),enableAjaxTableData:R.props.enableAjaxTableData,queryRequestData:null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.fe_req,queryText:null===(a=R.queryResponse)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.text,originalQueryID:R.props.originalQueryID,isDrilldown:R.isDrilldown(),isQueryOutputMounted:R._isMounted,popoverParentElement:R.props.popoverParentElement,hidden:"table"!==R.state.displayType,totalRows:null===(i=R.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.count_rows,supportsDrilldowns:Na(R.state.columns)&&Xn(R.props.autoQLConfig).enableDrilldowns,queryFn:R.queryFn})):R.renderMessage("Error: There was no data supplied for this table")})),Ot(Bt(R),"renderPivotTable",(function(){return Vo(R.getColumns())?R.renderAllColumnsHiddenMessage():"pivot_table"!==R.state.displayType||R.pivotTableData?f.createElement(Kt,null,f.createElement(hr,{ref:function(e){return R.pivotTableRef=e},columns:R.pivotTableColumns,rowChangeCount:R.state.visibleRowChangeCount,data:R.pivotTableData,onCellClick:R.onTableCellClick,isAnimating:R.props.isAnimating,isResizing:R.props.isResizing,hidden:"pivot_table"!==R.state.displayType,useInfiniteScroll:!1,supportsDrilldowns:!0,autoHeight:R.props.autoHeight,pivot:!0})):R.renderMessage("Error: There was no data supplied for this table")})),Ot(Bt(R),"renderChart",(function(){var t,n,a,o,r,i,l,s,c,u;if(!R.tableData||!R.state.columns||!R.tableConfig)return console.error("Required table data was missing for chart"),R.renderMessage("Error: There was no data supplied for this chart");var d=R.usePivotDataForChart();if(d&&(!R.pivotTableData||!R.pivotTableColumns||!R.pivotTableConfig))return R.renderMessage("Error: There was no data supplied for this chart");var p=d?R.pivotTableConfig:R.tableConfig,m=R.getCombinedFilters(),g=xt(xt({},R.formattedTableParams),{},{filters:m}),v=!1,h=Ro(R.state.columns);(1===h||h>=2&&d)&&(v=!0);var y,b=d?R.state.visiblePivotRows||R.pivotTableData:R.state.visibleRows||R.tableData,C=null===(t=R.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.count_rows;!R.isDataLimited()&&R.state.visibleRows&&(null===(o=R.state.visibleRows)||void 0===o?void 0:o.length)<5e3&&(C=null===(y=R.state.visibleRows)||void 0===y?void 0:y.length);return f.createElement(Kt,null,f.createElement(ui,Mt({key:R.chartID,hidden:!No(R.state.displayType),formattedTableParams:g,authentication:R.props.authentication,queryRequestData:null===(r=R.queryResponse)||void 0===r||null===(i=r.data)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.fe_req,pageSize:e(R.queryResponse,"data.data.row_limit"),ref:function(e){return R.chartRef=e},type:R.state.displayType,isDataAggregated:v,popoverParentElement:R.props.popoverParentElement},p,{data:b,dataChangeCount:d?R.state.visiblePivotRowChangeCount:R.state.visibleRowChangeCount,columns:d?R.pivotTableColumns:R.state.columns,isPivot:d,dataFormatting:R.props.dataFormatting,activeChartElementKey:R.props.activeChartElementKey,onLegendClick:R.onLegendClick,legendColumn:R.state.columns[null===(s=R.tableConfig)||void 0===s?void 0:s.legendColumnIndex],changeStringColumnIndex:R.onChangeStringColumnIndex,changeLegendColumnIndex:R.onChangeLegendColumnIndex,changeNumberColumnIndices:R.onChangeNumberColumnIndices,onChartClick:R.onChartClick,isResizing:R.props.isResizing,isAnimating:R.props.isAnimating,isDrilldownChartHidden:R.props.isDrilldownChartHidden,enableDynamicCharting:R.props.enableDynamicCharting,enableAjaxTableData:R.props.enableAjaxTableData,tooltipID:null!==(c=R.props.tooltipID)&&void 0!==c?c:R.TOOLTIP_ID,chartTooltipID:null!==(u=R.props.chartTooltipID)&&void 0!==u?u:R.CHART_TOOLTIP_ID,height:R.props.height,width:R.props.width,onNewData:R.onNewData,isDrilldown:R.isDrilldown(),totalRowCount:C,updateColumns:R.updateColumns})))})),Ot(Bt(R),"renderHelpResponse",(function(){var t=e(R.queryResponse,"data.data.rows[0]");if(!t)return null;var n=t.includes("#"),a=t;if(n){var o=t.split("#")[1].replace(/-/g," ");a=o.charAt(0).toUpperCase()+o.substr(1)}return f.createElement(v,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(bn,{type:"globe",className:"react-autoql-help-link-icon"}),a))})),Ot(Bt(R),"renderError",(function(t){return t?e(t,"data.message")?R.renderMessage(t.data):R.renderMessage():(console.warn("Warning: No response object supplied"),R.renderMessage("No response supplied"))})),Ot(Bt(R),"isDataLimited",(function(){var e,t,n,a,o,r,i,l,s,c=null!==(e=null===(t=R.tableData)||void 0===t?void 0:t.length)&&void 0!==e?e:null===(n=R.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.rows)||void 0===r?void 0:r.length,u=null===(i=R.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.count_rows;return!(!c||!u)&&c<u})),Ot(Bt(R),"noDataFound",(function(){var e,t,n,a;return 0===(null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.rows)||void 0===a?void 0:a.length)&&R.isOriginalData})),Ot(Bt(R),"renderMessage",(function(e){try{if("object"===Rt(e)){var t,n=Yt.GENERAL_QUERY;if((null==e?void 0:e.message)===(null==Wt?void 0:Wt.CANCELLED))n=f.createElement("span",null,"Query cancelled"," ",f.createElement(bn,{"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=R.props.tooltipID)&&void 0!==t?t:R.TOOLTIP_ID,type:"question"}));else null!=e&&e.message&&(n=e.message,n=R.props.reportProblemCallback?R.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(v,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",e.reference_id)))}var a=e||Yt.GENERAL_QUERY;return f.createElement("div",{className:"query-output-error-message"},a)}catch(e){return console.warn(e),f.createElement("div",{className:"query-output-error-message"},Yt.GENERAL_QUERY)}})),Ot(Bt(R),"renderHTMLMessage",(function(){var e,t,n,a=null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.answer;return a?Oe(a,{}):f.createElement("span",null,"I'm not sure I understood your question. Please try asking again in a different way.")})),Ot(Bt(R),"renderTextResponse",(function(){return Vo(R.getColumns())?R.renderAllColumnsHiddenMessage():null})),Ot(Bt(R),"renderResponse",(function(){var t=R.state.displayType;if(R.hasError(R.queryResponse))return R.renderError(R.queryResponse);if("html"===t)return R.renderHTMLMessage();if(R.state.customResponse)return R.state.customResponse;if(!!e(R.queryResponse,"data.data.items"))return R.renderSuggestionMessage(R.queryResponse.data.data.items,R.queryResponse.data.data.query_id);if(e(R.queryResponse,"data.data.replacements"))return f.createElement(di,{key:R.QUERY_VALIDATION_KEY,response:R.queryResponse,onSuggestionClick:function(e){var t=e.query,n=e.userSelection;return R.onSuggestionClick({query:t,userSelection:n,isButtonClick:!0,skipQueryValidation:!0,source:["validation"]})},onQueryValidationSelectOption:R.props.onQueryValidationSelectOption,initialSelections:R.props.queryValidationSelections,autoSelectSuggestion:R.props.autoSelectQueryValidationSuggestion});if(t&&e(R.queryResponse,"data.data.rows")){if("help"===t)return R.renderHelpResponse();if("text"===t)return R.renderTextResponse();if("single-value"===t)return R.renderSingleValueResponse();if(!ko(t)&&!No(t))return console.warn("display type not recognized: ".concat(R.state.displayType," - rendering as plain text")),R.renderMessage("display type not recognized: ".concat(R.state.displayType))}var n=No(R.state.displayType),a=ko(R.state.displayType),o="pivot_table"===R.state.displayType,r=R.props.allowDisplayTypeChange,i=R.currentlySupportsCharts(),l=R.currentlySupportsPivot(),s=l?R.pivotTableConfig:R.tableConfig,c=l?R.pivotTableColumns:R.getColumns(),u=R.isTableConfigValid(s,c,R.state.displayType),d=(r||n)&&i&&u,p=r||a,m=(r||o)&&l;return f.createElement(f.Fragment,null,p&&R.renderTable(),d&&R.renderChart(),m&&R.renderPivotTable())})),Ot(Bt(R),"shouldRenderReverseTranslation",(function(){var e,t,n;return Xn(R.props.autoQLConfig).enableQueryInterpretation&&R.props.showQueryInterpretation&&(null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.parsed_interpretation)})),Ot(Bt(R),"renderReverseTranslation",(function(){return f.createElement(fi,{authentication:R.props.authentication,onValueLabelClick:R.props.onRTValueLabelClick,appliedFilters:R.props.appliedFilters,isResizing:R.props.isResizing,reverseTranslation:e(R.queryResponse,"data.data.parsed_interpretation"),tooltipID:R.props.tooltipID})})),Ot(Bt(R),"shouldRenderDataLimitWarning",(function(){var e=!R.props.enableAjaxTableData&&"table"===R.state.displayType,t=!R.props.enableAjaxTableData&&No(R.state.displayType);return R.isDataLimited()&&!Vo(R.getColumns())&&(e||t)})),Ot(Bt(R),"renderDataLimitWarning",(function(){var e,t,n,a,o=Xn(R.props.autoQLConfig).enableQueryInterpretation&&R.props.showQueryInterpretation;return f.createElement("div",{className:"dashboard-data-limit-warning-icon"},f.createElement(bn,{type:"warning","data-tip":"The display limit of ".concat(null===(e=R.queryResponse)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.row_limit," rows has been reached. Try querying a smaller time-frame to ensure all your data is displayed."),"data-for":null!==(a=R.props.tooltipID)&&void 0!==a?a:R.TOOLTIP_ID,"data-place":o?"left":"right"}))})),Ot(Bt(R),"renderFooter",(function(){var e=R.shouldRenderReverseTranslation(),t=R.shouldRenderDataLimitWarning(),n="query-output-footer ".concat(e?"":"no-margin"," ").concat(R.props.reverseTranslationPlacement);return f.createElement("div",{className:n},e&&R.renderReverseTranslation(),t&&R.renderDataLimitWarning())})),Ot(Bt(R),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{key:R.COMPONENT_KEY,ref:function(e){return R.responseContainerRef=e},id:"react-autoql-response-content-container-".concat(R.COMPONENT_KEY),"data-test":"query-response-wrapper",className:"react-autoql-response-content-container\n ".concat(ko(R.state.displayType)?"table":"","\n ").concat(No(R.state.displayType)?"chart":"")},"top"===R.props.reverseTranslationPlacement&&R.renderFooter(),R.renderResponse(),"top"!==R.props.reverseTranslationPlacement&&R.renderFooter()),!R.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:R.TOOLTIP_ID,effect:"solid",place:"top",html:!0}),!R.props.chartTooltipID&&f.createElement(Un,{className:"react-autoql-chart-tooltip",id:R.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),R.COMPONENT_KEY=b(),R.QUERY_VALIDATION_KEY=b(),R.TOOLTIP_ID="react-autoql-query-output-tooltip-".concat(R.COMPONENT_KEY),R.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(R.COMPONENT_KEY),R.queryResponse=C(t.queryResponse),R.columnDateRanges=function(e){var t,n,a=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.parsed_interpretation;if(!a)return[];var o=rr(a);return null!=o&&o.length?o:[]}(t.queryResponse),R.queryID=e(R.queryResponse,"data.data.query_id"),R.interpretation=e(R.queryResponse,"data.data.parsed_interpretation"),R.tableParams={},R.chartID=b(),R.tableID=b(),R.pivotTableID=b(),R.initialSupportedDisplayTypes=R.getCurrentSupportedDisplayTypes(),R.isOriginalData=!0;var A=R.formatColumnsForTable(null===(i=R.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.columns,t.initialAggConfig);t.initialColumns&&R.areColumnsValid(t.initialColumns)&&(A=t.initialColumns),R.generateAllData(),R.initialSupportedDisplayTypes=R.getCurrentSupportedDisplayTypes();var N=R.getDisplayTypeFromInitial(t);if(t.onDisplayTypeChange&&t.onDisplayTypeChange(N),null!==(c=t.initialTableConfigs)&&void 0!==c&&c.tableConfig&&R.isTableConfigValid(null===(u=t.initialTableConfigs)||void 0===u?void 0:u.tableConfig,A,N)){var k=t.initialTableConfigs,I=k.tableConfig,P=k.pivotTableConfig;R.tableConfig=C(I),R.pivotTableConfig=C(P)}return R.formattedTableParams={filters:(null===(d=R.queryResponse)||void 0===d||null===(p=d.data)||void 0===p||null===(g=p.data)||void 0===g||null===(h=g.fe_req)||void 0===h?void 0:h.filters)||[],sorters:(null===(y=R.queryResponse)||void 0===y||null===(E=y.data)||void 0===E||null===(S=E.data)||void 0===S||null===(T=S.fe_req)||void 0===T?void 0:T.sorters)||[]},R.state={displayType:N,aggConfig:t.initialAggConfig,supportedDisplayTypes:R.initialSupportedDisplayTypes,columns:A,selectedSuggestion:t.defaultSelectedSuggestion,visiblerows:null===(D=R.queryResponse)||void 0===D||null===(x=D.data)||void 0===x||null===(w=x.data)||void 0===w?void 0:w.rows,visibleRowChangeCount:0,visiblePivotRowChangeCount:0,columnChangeCount:0},R}return Pt(r)}();Ot(gi,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,initialTableConfigs:y.shape({}),initialAggConfig:y.shape({}),queryResponse:y.shape({}),onSuggestionClick:y.func,initialDisplayType:y.string,onQueryValidationSelectOption:y.func,autoSelectQueryValidationSuggestion:y.bool,queryValidationSelections:y.arrayOf(y.shape({})),renderSuggestionsAsDropdown:y.bool,defaultSelectedSuggestion:y.string,reverseTranslationPlacement:y.string,activeChartElementKey:y.string,preferredDisplayType:y.string,isResizing:y.bool,enableDynamicCharting:y.bool,onTableConfigChange:y.func,onAggConfigChange:y.func,onNoneOfTheseClick:y.func,autoChartAggregations:y.bool,onRTValueLabelClick:y.func,isTaskModule:y.bool,onDrilldownStart:y.func,onDrilldownEnd:y.func,enableAjaxTableData:y.bool,enableTableSorting:y.bool,onRowChange:y.func,mutable:y.bool,showSuggestionPrefix:y.bool,onDisplayTypeChange:y.func,onColumnChange:y.func,shouldRender:y.bool,dataPageSize:y.number,onPageSizeChange:y.func,allowDisplayTypeChange:y.bool}),Ot(gi,"defaultProps",{authentication:jn,autoQLConfig:Yn,dataFormatting:Kn,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,onRowChange:function(){},onTableConfigChange:function(){},onAggConfigChange:function(){},onQueryValidationSelectOption:function(){},onErrorCallback:function(){},onDrilldownStart:function(){},onDrilldownEnd:function(){},onColumnChange:function(){},onPageSizeChange:function(){}});var vi=Ra(gi),hi=function(e){Lt(a,f.Component);var t=Qt(a);function a(){var e;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(e=t.call.apply(t,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(e),"componentDidMount",(function(){e._isMounted=!0,Qn()})),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!!t.shouldRender&&(!$o(e.props,t)||!$o(e.state,n))})),Ot(Bt(e),"componentDidUpdate",(function(t){n(e.getCurrentSupportedDisplayTypes(e.props),e.getCurrentSupportedDisplayTypes(t))||Qn()})),Ot(Bt(e),"componentWillUnmount",(function(){e._isMounted=!1})),Ot(Bt(e),"showDisplayTypeButton",(function(t){if(e.props.disableCharts&&Sn.includes(t))return!1;var n=e.getCurrentSupportedDisplayTypes(e.props);return n&&n.includes(t)})),Ot(Bt(e),"onDisplayTypeChange",(function(t){var n,a;null!==(n=e.props.responseRef)&&void 0!==n&&n._isMounted&&(null===(a=e.props.responseRef)||void 0===a||a.changeDisplayType(t))})),Ot(Bt(e),"getCurrentDisplayType",(function(){var t,n;return null===(t=e.props.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.displayType})),Ot(Bt(e),"getCurrentSupportedDisplayTypes",(function(e){var t,n;return null===(t=e.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.supportedDisplayTypes})),Ot(Bt(e),"createVisButton",(function(t,n,a){if(e.showDisplayTypeButton(t)){var o,r=e.getCurrentDisplayType();return f.createElement("button",{onClick:function(){return e.onDisplayTypeChange(t)},className:"react-autoql-toolbar-btn ".concat(t===r?"selected":""),"data-tip":n,"data-for":null!==(o=e.props.tooltipID)&&void 0!==o?o:"react-autoql-viz-toolbar-tooltip-".concat(e.COMPONENT_KEY),"data-test":"viz-toolbar-button"},a)}return null})),Ot(Bt(e),"render",(function(){var t=e.getCurrentDisplayType(),n=e.getCurrentSupportedDisplayTypes(e.props);return!n||n.length<=1||!n.includes("pivot_table")&&e.props.disableCharts?null:En.includes(t)||Sn.includes(t)?f.createElement(Kt,null,f.createElement("div",{className:"".concat(e.props.className||""," react-autoql-toolbar viz-toolbar ").concat(e.props.vertical?"vertical":""),"data-test":"viz-toolbar"},e.createVisButton("table","Table",f.createElement(bn,{type:"table"})),e.createVisButton("pivot_table","Pivot View",f.createElement(bn,{type:"pivot-table"})),e.createVisButton("column","Column Chart",f.createElement(bn,{type:"column-chart"})),e.createVisButton("bar","Bar Chart",f.createElement(bn,{type:"bar-chart"})),e.createVisButton("line","Line Chart",f.createElement(bn,{type:"line-chart"})),e.createVisButton("pie","Pie Chart",f.createElement(bn,{type:"pie-chart"})),e.createVisButton("heatmap","Heatmap",f.createElement(bn,{type:"heatmap"})),e.createVisButton("bubble","Bubble Chart",f.createElement(bn,{type:"bubble-chart"})),e.createVisButton("stacked_bar","Stacked Bar Chart",f.createElement(bn,{type:"stacked-bar-chart"})),e.createVisButton("stacked_column","Stacked Column Chart",f.createElement(bn,{type:"stacked-column-chart"})),e.createVisButton("stacked_line","Stacked Area Chart",f.createElement(bn,{type:"stacked-line-chart"})),e.createVisButton("column_line","Column Line Combo Chart",f.createElement(bn,{type:"column-line-chart"}))),!e.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-viz-toolbar-tooltip-".concat(e.COMPONENT_KEY),effect:"solid",delayShow:800})):null})),e}return Pt(a)}();Ot(hi,"propTypes",{onDisplayTypeChange:y.func,shouldRender:y.bool,disableCharts:y.bool,vertical:y.bool}),Ot(hi,"defaultProps",{onDisplayTypeChange:function(){},shouldRender:!0,disableCharts:!1,vertical:!1});var yi=hi,bi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),Ot(Bt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",null,f.createElement(vr,{type:"default",onClick:e.props.onClose,tooltipID:e.props.tooltipID},"Back"),f.createElement(vr,{type:"danger",onClick:e.props.onConfirm,loading:e.props.confirmLoading,tooltipID:e.props.tooltipID},e.props.confirmText||"Continue"))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(Ie,{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:xt(xt({},e.props.style),{},{bottom:"auto",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 Pt(n)}();Ot(bi,"propTypes",{isVisible:y.bool,onClose:y.func,onConfirm:y.func,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),confirmLoading:y.bool,confirmText:y.string,footer:y.element}),Ot(bi,"defaultProps",{title:"",isVisible:!1,width:"400px",height:void 0,confirmLoading:!1,confirmText:void 0,footer:void 0,onClose:function(){},onConfirm:function(){}});var Ci=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{isConfirmCloseModalVisible:!1}),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!(!t.shouldRender&&!e.props.shouldRender)&&(!$o(e.props,t)||!$o(e.state,n))})),Ot(Bt(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()})),Ot(Bt(e),"renderFooter",(function(){return e.props.footer?e.props.footer:f.createElement("div",null,e.props.showCancelButton&&f.createElement(vr,{type:"default",onClick:e.onClose},"Cancel"),f.createElement(vr,{type:"primary",onClick:e.props.onConfirm,loading:e.props.confirmLoading,disabled:e.props.confirmDisabled},e.props.confirmText||"Ok"))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(Ie,{ref:function(t){return e.ref=t},isOpen:e.props.isVisible,bodyOpenClassName:"react-autoql-modal-container".concat(e.props.className?" ".concat(e.props.className):""),className:e.props.contentClassName,ariaHideApp:!1,contentLocation:{top:0,left:0},closeTimeoutMS:200,"data-test":"react-autoql-modal",style:{content:xt(xt({},e.props.style),{},{bottom:"auto",width:e.props.width,height:e.props.height}),overlay:xt({},e.props.overlayStyle)}},f.createElement("div",{className:"react-autoql-modal-content",ref:function(t){return e.modalContent=t}},f.createElement("div",{className:"react-autoql-modal-header"},e.props.titleIcon," ",e.props.title,f.createElement(bn,{type:"close",className:"react-autoql-modal-close-btn",onClick:e.onClose})),f.createElement("div",{className:"react-autoql-modal-body",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(bi,{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 Pt(n)}();Ot(Ci,"propTypes",{title:y.oneOfType([y.element,y.string]),titleIcon:y.oneOfType([y.element,y.instanceOf(bn)]),isVisible:y.bool,onClose:y.func,onConfirm:y.func,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),showCancelButton:y.bool,showFooter:y.bool,enableBodyScroll:y.bool,confirmLoading:y.bool,confirmText:y.string,confirmDisabled:y.bool,footer:y.element,confirmOnClose:y.bool,shouldRender:y.bool}),Ot(Ci,"defaultProps",{title:"",titleIcon:void 0,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(){}});var Ei=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{columns:e.props.columns}),Ot(Bt(e),"shouldComponentUpdate",(function(t,n){return!$o(e.props,t)||!$o(e.state,n)})),Ot(Bt(e),"componentDidUpdate",(function(t){e.props.isVisible&&!t.isVisible&&e.setState({columns:e.props.columns})})),Ot(Bt(e),"onListChange",(function(t){e.setState({columns:t})})),Ot(Bt(e),"onConfirm",(function(){return e.props.onConfirm(e.state.columns)})),Ot(Bt(e),"render",(function(){return f.createElement(Ci,{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(Er,{columns:[{name:"Column Name"},{name:"Visibility "}],items:e.state.columns,onChange:e.onListChange})))})),e}return Pt(n)}();Ot(Ei,"propTypes",{isSettingColumns:y.bool}),Ot(Ei,"defaultProps",{isSettingColumns:!1});var Si=function(e){var t=e.query,n=e.domain,a=e.apiKey,o=e.token,r="".concat(n,"/autoql/api/v1/query?key=").concat(a),i={text:t,translation:"exclude"};if(!t||!t.trim())return Promise.reject({error:"No query supplied"});if(!a||!n||!o)return Promise.reject({error:"Unauthenticated"});var l={headers:{Authorization:"Bearer ".concat(o)}};return m.post(r,i,l)},Ti=function(t){var n=t.domain,a=t.apiKey,o=t.token,r=t.offset,i=t.limit;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var l=m.create({headers:{Authorization:"Bearer ".concat(o)}}),s="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a,"&offset=").concat(r,"&limit=").concat(i);return l.get(s).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Di=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(o)}}),i="".concat(n,"/autoql/api/v1/data-alerts?key=").concat(a);return r.get(i).then((function(t){return Promise.resolve(e(t,"data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},xi=function(t){var n=t.domain,a=t.apiKey,o=t.token,r=t.dataAlertId;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(o)}}),l="".concat(n,"/autoql/api/v1/data-alerts/").concat(r,"?key=").concat(a);return i.get(l).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},wi=function(t){var n=t.notificationId,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ri=function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(o)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return r.put(i,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ai=function(t){var n=t.notificationId,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No ID provided"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(a,"/autoql/api/v1/data-alerts/notifications/").concat(n,"?key=").concat(o);return i.put(l,{state:"DISMISSED"}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Ni=function(t){var n=t.dataAlertId,a=t.status,o=t.token,r=t.domain,i=t.apiKey;return"INACTIVE"===a?function(t){var n=t.dataAlertId,a=t.token,o=t.domain,r=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return m.delete(l,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:o,domain:r,apiKey:i}):function(t){var n=t.dataAlertId,a=t.token,o=t.domain,r=t.apiKey,i={headers:{Authorization:"Bearer ".concat(a)}},l="".concat(o,"/autoql/api/v1/data-alerts/").concat(n,"/user?key=").concat(r);return m.post(l,{},i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"),new Error("Something went wrong. Please try again."))}))}({dataAlertId:n,token:o,domain:r,apiKey:i})},ki=function(t){var n=t.dataAlertId,a=t.status,o=t.type,r=t.domain,i=t.apiKey,l=t.token;return l&&i&&r?n?"PROJECT"===o?Ni({dataAlertId:n,status:a,token:l,domain:r,apiKey:i}):function(t){var n=t.dataAlertId,a=t.status,o=t.token,r=t.domain,i=t.apiKey,l={status:a},s={headers:{Authorization:"Bearer ".concat(o)}},c="".concat(r,"/autoql/api/v1/data-alerts/").concat(n,"?key=").concat(i);return m.put(c,l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}({dataAlertId:n,status:a,token:l,domain:r,apiKey:i}):Promise.reject(new Error("No rule to update")):Promise.reject(new Error("UNAUTHORIZED"))},Ii=function(t){var n=t.expression,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l={expression:n},s="".concat(a,"/autoql/api/v1/data-alerts/validate?key=").concat(o);return i.post(s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))},Pi=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",Nt(wt().mark((function e(){return wt().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)})))),Ot(Bt(o),"componentDidUpdate",(function(e,t){o.state.count!==t.count&&o.props.onCount(o.state.count)})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,o.clearPollingComponent(),clearInterval(o.pollInterval)})),Ot(Bt(o),"getNotificationCount",(function(t){var n=t||o.state.count;return o.props.pausePolling?Promise.resolve(n):function(e){var t=e.domain,n=e.apiKey,a=e.token,o=e.unacknowledged,r=void 0===o?0:o;if(!a||!n||!t)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(a)}}),l="".concat(t,"/autoql/api/v1/data-alerts/notifications/summary?key=").concat(n,"&unacknowledged=").concat(r);return i.get(l,{timeout:18e4}).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}(xt(xt({},Wn(o.props.authentication)),{},{unacknowledged:n})).then((function(t){var n=e(t,"data.data.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)}))})),Ot(Bt(o),"clearPollingComponent",(function(){sessionStorage.setItem("pollingComponent","")})),Ot(Bt(o),"setPollingComponent",(function(){sessionStorage.setItem("pollingComponent",o.COMPONENT_KEY)})),Ot(Bt(o),"getPollingComponent",(function(){return sessionStorage.getItem("pollingComponent")})),Ot(Bt(o),"subscribeToNotificationCount",(function(t){var n=o.getPollingComponent(),a=!n||n===o.COMPONENT_KEY;o._isMounted&&a&&(clearInterval(o.pollInterval),o.setPollingComponent(),o.pollInterval=setInterval((function(){o.getNotificationCount(t).then((function(e){o.subscribeToNotificationCount(e),o.FAILED_POLL_ATTEMPTS=0})).catch((function(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==e(t,"response.status")?o.subscribeToNotificationCount():new Promise((function(e){return setTimeout(e,1e3)})).then((function(){o.subscribeToNotificationCount()})),o.FAILED_POLL_ATTEMPTS+=1}))}),o.INTERVAL_LENGTH))})),Ot(Bt(o),"resetCount",(function(){(function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!a||!n)return Promise.reject(new Error("UNAUTHORIZED"));var r=m.create({headers:{Authorization:"Bearer ".concat(o)}}),i="".concat(n,"/autoql/api/v1/data-alerts/notifications?key=").concat(a);return r.put(i,{notification_id:null,state:"ACKNOWLEDGED"}).then((function(t){return Promise.resolve(e(t,"data.data"))})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(xt({},Wn(o.props.authentication))).catch((function(e){console.error(e)})).finally((function(){o.setState({count:0})}))})),Ot(Bt(o),"getCurrentCount",(function(){return"number"==typeof o.props.count?o.props.count:o.state.count})),Ot(Bt(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)})),Ot(Bt(o),"render",(function(){return f.createElement(Kt,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:xt({},o.props.style),onClick:function(){o.props.clearCountOnClick&&o.resetCount()}},f.createElement(bn,{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=b(),o.HAS_FETCHED_COUNT=!1,o.pollInterval=void 0,o.state={count:0},o}return Pt(a)}();Ot(Pi,"propTypes",{authentication:Gt,overflowCount:y.number,style:y.shape({}),size:y.number,useDot:y.bool,clearCountOnClick:y.bool,onNewNotification:y.func,onErrorCallback:y.func,pausePolling:y.bool,count:y.number,onCount:y.func}),Ot(Pi,"defaultProps",{authentication:jn,overflowCount:99,useDot:!1,style:{},clearCountOnClick:!0,onNewNotification:function(){},onErrorCallback:function(){},pausePolling:!1,count:void 0,onCount:function(){}});var Oi=Ra(Pi),Mi=["icon","type"],Li=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{focused:!1}),Ot(Bt(e),"onFocus",(function(){e.setState({focused:!0}),e.props.onFocus&&e.props.onFocus()})),Ot(Bt(e),"onBlur",(function(){e.setState({focused:!1}),e.props.onBlur&&e.props.onBlur()})),Ot(Bt(e),"focus",(function(){var t;null===(t=e.inputRef)||void 0===t||t.focus()})),Ot(Bt(e),"render",(function(){var t=e.props,n=t.icon;t.type;var a=Ft(t,Mi),o=a.className;return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-input-container".concat(e.state.focused?" focus":""," ").concat(o," "),"data-test":"react-autoql-input"},"multi"===e.props.type?f.createElement("textarea",Mt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input area",onFocus:e.onFocus,onBlur:e.onBlur})):f.createElement(v,null,f.createElement("input",Mt({},a,{ref:function(t){return e.inputRef=t},className:"react-autoql-input ".concat(n?"with-icon":""),onFocus:e.onFocus,onBlur:e.onBlur})),n&&f.createElement(bn,{className:"react-autoql-input-icon ".concat(e.state.focused?" focus":""),type:n}))))})),e}return Pt(n)}();Ot(Li,"propTypes",{icon:y.string,type:y.string}),Ot(Li,"defaultProps",{icon:void 0,type:"single"});var qi=function(t){Lt(o,f.Component);var a=Qt(o);function o(t){var r;kt(this,o),Ot(Bt(r=a.call(this,t)),"autoCompleteTimer",void 0),Ot(Bt(r),"state",xt({input1Value:"",input2Value:"",conditionSelectValue:"EXISTS",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"),userSelection:t[0].user_selection};if(t&&t.length>1){var n="".concat(e(t,"[0].term_value","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length"),userSelection:t[0].user_selection}}return{}}(r.props.initialData))),Ot(Bt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),Ot(Bt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=b(),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}))})),Ot(Bt(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,user_selection:r.state.userSelection}];var e=r.state.input2Value;return[{id:r.TERM_ID_1,term_type:"query",condition:r.state.conditionSelectValue,term_value:r.state.input1Value,user_selection:r.state.userSelection},{id:r.TERM_ID_2,term_type:r.isNumerical(e)?"constant":"query",condition:"TERMINATOR",term_value:r.isNumerical(e)?xe(e):e,user_selection:r.state.userSelection}]})),Ot(Bt(r),"isNumerical",(function(e){if(!e)return!1;var t=e.split(" ");if(t&&t.length>1)return!1;var n=xe(e);return!isNaN(Number(n))})),Ot(Bt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),Ot(Bt(r),"isValid",(function(){return!0})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){sa(xt(xt(xt({},Wn(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var l={name:n[i]};a.push(l)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),Ot(Bt(r),"renderReadOnlyRule",(function(){return f.createElement(Kt,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(Uo(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"},Uo(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),Ot(Bt(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(bn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),Ot(Bt(r),"renderCompareBtn",(function(){return"EXISTS"===r.state.conditionSelectValue?f.createElement(vr,{onClick:function(){r.setState({conditionSelectValue:"GREATER_THAN"})}},"Compare"):null})),Ot(Bt(r),"renderConditionSelector",(function(){return f.createElement(Tr,{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:"Exists",tooltip:"No Comparison"}],value:r.state.conditionSelectValue,className:"react-autoql-rule-condition-select",onChange:function(e){r.setState({conditionSelectValue:e})}})})),Ot(Bt(r),"renderRule",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-first-input-container"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Li,{placeholder:"Type a query",value:r.state.input1Value,onChange:function(e){return r.setState({input1Value:e.target.value})}}),!r.state.isFirstTermValid&&r.renderValidationError()),r.renderCompareBtn()),f.createElement("div",{className:"react-autoql-rule-second-input-container".concat("EXISTS"===r.state.conditionSelectValue?" hidden":"")},r.renderConditionSelector(),f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Li,{placeholder:"Type a query or number",value:r.state.input2Value,onChange:function(e){return r.setState({input2Value:e.target.value})}}),!r.state.isSecondTermValid&&r.renderValidationError()),f.createElement(bn,{className:"react-autoql-delete-compare-btn",type:"close",onClick:function(){return r.setState({conditionSelectValue:"EXISTS"})}}))))})),Ot(Bt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=b(),r.TERM_ID_2=b();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=b()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return Pt(o)}();Ot(qi,"propTypes",{authentication:Gt,ruleId:y.string,onUpdate:y.func,initialData:y.arrayOf(y.shape({})),readOnly:y.bool}),Ot(qi,"defaultProps",{authentication:jn,ruleId:void 0,onUpdate:function(){},initialData:void 0,readOnly:!1});var Vi=function(t){var n=void 0,a=!1;return Array.isArray(t)&&"query"===e(t,"[0].term_type")?n=t:"query"===e(t,"term_value[0].term_type")?n=t.term_value:"group"===e(t,"[0].term_type")&&(e(t.length>1)||e(t,"[0].term_value.length")>1?a=!0:"query"===e(t,"[0].term_value[0].term_value[0].term_type")?n=C(t[0].term_value[0].term_value):a=!0),{expression:n,expressionError:a}},_i=function(t){Lt(o,f.Component);var a=Qt(o);function o(){var t;kt(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=a.call.apply(a,[this].concat(i))),"ruleRef",void 0),Ot(Bt(t),"state",xt({},Vi(t.props.expression))),Ot(Bt(t),"componentDidMount",(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"componentDidUpdate",(function(e,a){n(e.expression,t.props.expression)||t.setState(xt({},Vi(t.props.expression))),n(a,t.state)||t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"isComplete",(function(){return!!t.state.expressionError||(t.ruleRef?t.ruleRef.isComplete():void 0)})),Ot(Bt(t),"isValid",(function(){return!t.state.expressionError&&(t.ruleRef?t.ruleRef.isValid():void 0)})),Ot(Bt(t),"getJSON",(function(){var e;return t.ruleRef&&(e=t.ruleRef.getJSON()),e})),Ot(Bt(t),"resetConditions",(function(){t.setState({expression:void 0,expressionError:!1},(function(){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())}))})),Ot(Bt(t),"onRuleUpdate",(function(e,n){t.props.onChange(t.isComplete(),t.isValid(),t.getJSON())})),Ot(Bt(t),"getFirstQuery",(function(n){var a;if(n?a=n:t.ruleRef&&(a=t.ruleRef.getJSON()),a)return Array.isArray(a)&&(a=a[0]),"group"===a.term_type?t.getFirstQuery(e(a,"term_value[0]")):"query"===a.term_type?a.term_value:void 0})),Ot(Bt(t),"renderExpressionErrorMessage",(function(){return f.createElement("div",{className:"expression-error-message"},f.createElement(bn,{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:t.resetConditions},"Reset Conditions"))})),Ot(Bt(t),"renderReadOnlyRule",(function(){return f.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},t.state.expressionError?t.renderExpressionErrorMessage():f.createElement(qi,{ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",b()),onUpdate:t.onRuleUpdate,initialData:t.state.expression,readOnly:!0}))})),Ot(Bt(t),"renderRule",(function(){return f.createElement("div",{className:"data-alerts-container ".concat(t.props.readOnly?"read-only":"")},f.createElement("div",{className:"notification-rule-outer-container","data-test":"notification-rules"},t.state.expressionError?t.renderExpressionErrorMessage():f.createElement(qi,{authentication:t.props.authentication,ref:function(e){return t.ruleRef=e},ruleId:e(t.state.expression,"id",b()),onUpdate:t.onRuleUpdate,initialData:t.state.expression})))})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,t.props.readOnly?t.renderReadOnlyRule():t.renderRule(),f.createElement(Un,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),t}return Pt(o)}();Ot(_i,"propTypes",{authentication:Gt,expression:y.oneOfType([y.shape({}),y.array]),readOnly:y.bool,onChange:y.func}),Ot(_i,"defaultProps",{authentication:jn,expression:void 0,readOnly:!1,onChange:function(){}}),a.extend(o);var Fi=function(t){Lt(o,f.Component);var n=Qt(o);function o(){var t;kt(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=n.call.apply(n,[this].concat(i))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{ruleStatus:void 0,ruleDetails:void 0,fullyExpanded:!1}),Ot(Bt(t),"getIsTriggered",(function(e){return["ACKNOWLEDGED","UNACKNOWLEDGED"].includes(e)})),Ot(Bt(t),"fetchRuleDetails",(function(n){t.setState({ruleDetails:void 0,dataAlertStatus:void 0}),xi(xt({dataAlertId:n.data_alert_id},Wn(t.props.authentication))).then((function(n){t.props.onRuleFetchCallback(n),t.setState({ruleDetails:n,ruleStatus:e(n,"status")})})).catch((function(e){t.setState({ruleDetails:{}})}))})),Ot(Bt(t),"onClick",(function(e){e.expanded?(t.setState({fullyExpanded:!1}),t.props.onCollapseCallback(e)):(t.fetchRuleDetails(e),t.props.onExpandCallback(e),setTimeout((function(){t.setState({fullyExpanded:!0})}),500)),t.props.onClick(e)})),Ot(Bt(t),"onDismissClick",(function(e,n){e.stopPropagation(),t.props.onDismissCallback(n),Ai(xt(xt({},Wn(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDismissSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"onDeleteClick",(function(e,n){e.stopPropagation(),t.props.onDeleteCallback(n),wi(xt(xt({},Wn(t.props.authentication)),{},{notificationId:n.id})).then((function(){t.props.onDeleteSuccessCallback()})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"changeRuleStatus",(function(e,n){ki(xt({dataAlertId:e.data_alert_id,type:e.data_alert_type,status:n},Wn(t.props.authentication))).then((function(){t.setState({ruleStatus:n})})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"formatTimestamp",(function(e){var t=a.unix(e).format("h:mma"),n=a.unix(e).format("MM-DD-YY"),o=a().format("MM-DD-YY"),r=a().subtract(1,"d").format("MM-DD-YY");return n===o?"Today at ".concat(t):n===r?"Yesterday at ".concat(t):a().isSame(e,"year")?"".concat(a.unix(e).format("MMMM Do")," at ").concat(t):"".concat(a.unix(e).format("MMMM Do, YYYY")," at ").concat(t)})),Ot(Bt(t),"renderAlertColorStrip",(function(){return f.createElement("div",{className:"react-autoql-notification-alert-strip"})})),Ot(Bt(t),"renderNotificationHeader",(function(e){var n,a;return f.createElement("div",{className:"react-autoql-notification-list-item-header",onClick:function(){t.onClick(e)}},f.createElement("div",{className:"react-autoql-notification-display-name-container"},f.createElement("div",{className:"react-autoql-notification-display-name"},e.title),f.createElement("div",{className:"react-autoql-notification-description"},e.message),f.createElement("div",{className:"react-autoql-notification-timestamp"},f.createElement(bn,{type:"calendar"})," ",t.formatTimestamp(e.created_at))),t.getIsTriggered(e.state)?f.createElement("div",{className:"react-autoql-notification-dismiss-btn"},f.createElement(bn,{type:"notification-off",className:"react-autoql-notification-dismiss-icon","data-tip":"Dismiss","data-for":null!==(n=t.props.tooltipID)&&void 0!==n?n:"react-autoql-notification-tooltip",onClick:function(n){t.onDismissClick(n,e),zn()}})):f.createElement("div",{className:"react-autoql-notification-dismiss-btn"},f.createElement(bn,{type:"close",className:"react-autoql-notification-delete-icon","data-tip":"Delete","data-for":null!==(a=t.props.tooltipID)&&void 0!==a?a:"react-autoql-notification-tooltip",onClick:function(n){t.onDeleteClick(n,e),zn()}})))})),Ot(Bt(t),"renderTurnOnNotificationIcon",(function(e){var n=t.state.ruleStatus;return n?"ACTIVE"===n||"WAITING"===n?f.createElement(vr,{onClick:function(){return t.changeRuleStatus(e,"INACTIVE")},type:"default"},f.createElement(bn,{type:"notification-off"})," Turn Data Alert Off"):f.createElement(vr,{onClick:function(){return t.changeRuleStatus(e,"ACTIVE")},type:"default"},f.createElement(bn,{type:"notification"})," Turn Data Alert On"):f.createElement("div",null)})),Ot(Bt(t),"renderEditNotificationIcon",(function(){return t.state.ruleDetails&&"PROJECT"!==t.state.ruleDetails.type?De(t.state.ruleDetails)?f.createElement("div",{className:"notification-deleted-text"},"This Data Alert no longer exists."):f.createElement(vr,{onClick:function(){return t.props.onEditClick(t.state.ruleDetails)},type:"default"},f.createElement(bn,{type:"edit"})," Edit Data Alert"):f.createElement("div",null)})),Ot(Bt(t),"renderNotificationFooter",(function(e){return f.createElement("div",{className:"react-autoql-notification-extra-content",style:{display:"flex",justifyContent:"space-between"}},t.renderTurnOnNotificationIcon(e),t.renderEditNotificationIcon())})),Ot(Bt(t),"renderNotificationContent",(function(n){var a,o,r,i,l,s,c=n.data_return_query,u=Uo(c);return s=e(t.props.activeNotificationData,"error")?t.props.activeNotificationData.error:{data:t.props.activeNotificationData},f.createElement("div",{className:"react-autoql-notification-expanded-content ".concat(n.expanded?" visible":"")},f.createElement("div",{className:"react-autoql-notification-details-container"},f.createElement("div",{className:"react-autoql-notification-data-container",onClick:function(e){return e.stopPropagation()}},f.createElement("div",{className:"react-autoql-notificaton-chart-container"},t.props.activeNotificationData&&n.expanded?f.createElement(v,null,f.createElement("div",{className:"react-autoql-notification-query-title"},u),f.createElement(vi,{style:{flex:"1"},authentication:t.props.authentication,ref:function(e){return t.OUTPUT_REF=e},key:null===(a=s)||void 0===a||null===(o=a.data)||void 0===o||null===(r=o.data)||void 0===r?void 0:r.query_id,queryResponse:s,autoQLConfig:{enableDrilldowns:!1},autoChartAggregations:t.props.autoChartAggregations,enableAjaxTableData:t.props.enableAjaxTableData})):f.createElement("div",{className:"loading-container-centered"},f.createElement(Aa,null))),(null===(i=t.OUTPUT_REF)||void 0===i||null===(l=i.supportedDisplayTypes)||void 0===l?void 0:l.length)>1&&f.createElement("div",{className:"react-autoql-notification-viz-switcher"},f.createElement(yi,{ref:function(e){return t.vizToolbarRef=e},responseRef:t.OUTPUT_REF,vertical:!0}))),t.props.showNotificationDetails&&n.expanded&&f.createElement("div",{className:"react-autoql-notification-details"},f.createElement("div",{className:"react-autoql-notification-details-title"},"Conditions:"),f.createElement(_i,{authentication:t.props.authentication,key:"expression-builder-".concat(t.COMPONENT_KEY),expression:e(n,"expression"),readOnly:!0}))),t.renderNotificationFooter(n))})),Ot(Bt(t),"render",(function(){var e=t.props.notification;return f.createElement(Kt,null,f.createElement("div",{id:"react-autoql-notification-item-".concat(t.COMPONENT_KEY),key:"react-autoql-notification-item-".concat(t.COMPONENT_KEY),className:"react-autoql-notification-list-item\n ".concat(t.getIsTriggered(e.state)?" triggered":"","\n ").concat(e.expanded?" expanded":"","\n ").concat(t.state.fullyExpanded?" animation-complete":"")},t.renderNotificationHeader(e),t.renderNotificationContent(e),t.renderAlertColorStrip()))})),t}return Pt(o)}();Ot(Fi,"propTypes",{authentication:Gt,notification:y.shape({}).isRequired,activeNotificationData:y.shape({}),showNotificationDetails:y.bool,onRuleFetchCallback:y.func,onExpandCallback:y.func,onDismissCallback:y.func,onDeleteCallback:y.func,onDeleteSuccessCallback:y.func,onDismissSuccessCallback:y.func,onErrorCallback:y.func,autoChartAggregations:y.bool,enableAjaxTableData:y.bool.isRequired}),Ot(Fi,"defaultProps",{authentication:jn,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,onRuleFetchCallback:function(){},onExpandCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDeleteSuccessCallback:function(){},onDismissSuccessCallback:function(){},onErrorCallback:function(){}});var Bi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"COMPONENT_KEY",b()),Ot(Bt(e),"state",{activeStep:e.props.initialActiveStep||0}),Ot(Bt(e),"componentDidMount",(function(){var t;e.props.steps&&e.props.steps.length?null==e.props.initialActiveStep||isNaN(e.props.initialActiveStep)||null!==(t=e.props.steps)&&void 0!==t&&t[e.props.initialActiveStep]||(console.error(new Error("Initial active step provided is invalid")),e.setState({activeStep:0})):console.error(new Error("No steps were provided"))})),Ot(Bt(e),"prevStep",(function(){e.state.activeStep>=1&&e.onStepTitleClick(e.state.activeStep-1)})),Ot(Bt(e),"nextStep",(function(){var t=isNaN(e.state.activeStep)?0:e.state.activeStep+1;e.onStepTitleClick(t)})),Ot(Bt(e),"setStep",(function(t){e.setState({activeStep:t})})),Ot(Bt(e),"getHeightOfStepContent",(function(t){if(e.props.collapsible){var n=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));if(n)return n.scrollHeight+15}})),Ot(Bt(e),"onStepTitleClick",(function(t,n){try{var a,o,r=t;if(!e.props.isEditMode&&r>0&&(null===(a=e.props.steps)||void 0===a||null===(o=a[r-1])||void 0===o||!o.complete))return;n&&n.onClick&&n.onClick(),e.autoHideTimeout&&clearTimeout(e.autoHideTimeout);var i=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(e.state.activeStep));if(i&&(i.style.height="".concat(e.getHeightOfStepContent(e.state.activeStep),"px"),setTimeout((function(){i.style.height="10px"}),0)),t!==e.state.activeStep){var l=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));l&&(l.style.height="".concat(e.getHeightOfStepContent(t),"px"),clearTimeout(e.autoHideTimeout),e.autoHideTimeout=setTimeout((function(){var n=document.querySelector("#react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(t));n&&(n.style.height="auto")}),500))}else r=void 0;e.setState({activeStep:r})}catch(e){console.error(e)}})),Ot(Bt(e),"getStepStatus",(function(e){return e.error?"error":e.complete?"complete":""})),Ot(Bt(e),"getIsStepTitleDisabled",(function(t,n){var a,o,r;return 0===t||t===(null===(a=e.state)||void 0===a?void 0:a.activeStep)||null!=n&&n.complete||null!==(o=e.props.steps)&&void 0!==o&&null!==(r=o[t-1])&&void 0!==r&&r.complete?"":" disabled"})),Ot(Bt(e),"render",(function(){return e.props.steps&&e.props.steps.length?f.createElement(Kt,null,f.createElement("div",{id:"react-autoql-steps-".concat(e.COMPONENT_KEY),className:"react-autoql-steps-container","data-test":"react-autoql-steps"},e.props.steps.map((function(t,n){return f.createElement("div",{key:"react-autoql-steps-".concat(e.COMPONENT_KEY,"-").concat(n),style:{overflow:"hidden"}},f.createElement("div",{className:"react-autoql-step-container\n ".concat(e.getStepStatus(t),"\n ").concat(e.props.collapsible&&n===e.state.activeStep?" active":""),"data-test":"react-autoql-step-container-".concat(n)},f.createElement("div",{className:"react-autoql-step-title-container","data-test":"react-autoql-step-title-".concat(n),onClick:function(){return e.onStepTitleClick(n,t)}},f.createElement("div",{className:"react-autoql-step-title".concat(e.getIsStepTitleDisabled(n,t))},t.title)),f.createElement("div",{id:"react-autoql-step-content-".concat(e.COMPONENT_KEY,"-").concat(n),className:"react-autoql-step-content-container"},f.createElement("div",{className:"react-autoql-step-subtitle"},t.subtitle||null),f.createElement("div",{className:"react-autoql-step-content","data-test":"react-autoql-step-content-".concat(n)},t.content)),f.createElement("div",{className:"react-autoql-step-dot"},n+1)))})))):null})),e}return Pt(n)}();Ot(Bi,"propTypes",{steps:y.arrayOf(y.shape({})),initialActiveStep:y.number,collapsible:y.bool,isEditMode:y.bool}),Ot(Bi,"defaultProps",{steps:void 0,initialActiveStep:void 0,collapsible:!0,isEditMode:!1});var Hi=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(t),"renderButtonType",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-radio-btn-container react-autoql-radio-btn-container-buttons ".concat(t.props.className),"data-test":"react-autoql-radio"},t.props.options.map((function(e,n){var a,o=t.props.value===e;return t.props.multiSelect&&(o=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(o?" active":""),"data-test":"react-autoql-radio-btn",onClick:function(){return t.props.onChange(e)},"data-tip":null===(a=t.props.tooltips)||void 0===a?void 0:a[n],"data-for":t.props.tooltipID,"data-delay-show":500},f.createElement("div",null,e))}))))})),Ot(Bt(t),"renderOriginalType",(function(){return f.createElement(Kt,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 a=t.props.value===e;return t.props.multiSelect&&(a=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:a}),f.createElement("label",{htmlFor:"react-autoql-radio-".concat(t.COMPONENT_KEY,"-").concat(n),onClick:function(){return t.props.onChange(e)}},e))}))))})),Ot(Bt(t),"render",(function(){return e(t.props.options,"length")?"button"===t.props.type?t.renderButtonType():t.renderOriginalType():null})),t}return Pt(a)}();Ot(Hi,"propTypes",{options:y.arrayOf(y.string),onChange:y.func,value:y.string,multiSelect:y.bool,type:y.string,tooltips:y.arrayOf(y.string),tooltipId:y.string}),Ot(Hi,"defaultProps",{options:[],multiSelect:!1,value:void 0,type:"original",tooltips:[],tooltipId:null,onChange:function(){}});var Qi=["onChange","options","selectedOption","className"],zi=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"ID",b()),Ot(Bt(e),"state",{selected:e.props.selectedOption,isOpen:!1}),Ot(Bt(e),"handleChange",(function(t){e.props.onChange&&e.props.onChange(t),e.setState({selected:t})})),Ot(Bt(e),"render",(function(){if(!e.props.options)return null;var t=e.props;t.onChange,t.options,t.selectedOption,t.className;var n=Ft(t,Qi);return f.createElement(Kt,null,f.createElement(ke,Mt({className:"".concat(e.props.className||""," react-autoql-select-with-arrow"),classNamePrefix:"react-autoql-select-with-arrow",value:e.state.selected,onChange:e.handleChange,options:e.props.options},n)))})),e}return Pt(n)}();Ot(zi,"propTypes",{onChange:y.func,options:y.arrayOf(y.shape({})),selectedOption:y.shape({})}),Ot(zi,"defaultProps",{onChange:void 0,options:[],selectedOption:void 0,style:{}});var Ui=Ne.tz.guess(),ji=Ne.tz.names().map((function(e){return{value:e,label:e}})),Ki=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"componentDidMount",(function(){var t=e.getSelectedOption();e.props.onChange(t)})),Ot(Bt(e),"getSelectedOption",(function(){var t=e.props.defaultSelection||Ui;return ji.find((function(e){return e.label===t}))})),Ot(Bt(e),"render",(function(){var t=e.getSelectedOption();return f.createElement(zi,{className:"react-autoql-timezone-select",options:ji,selectedOption:t,onChange:e.props.onChange,menuPlacement:"top",maxMenuHeight:180,isSearchable:!0})})),e}return Pt(n)}();Ot(Ki,"propTypes",{onChange:y.func,defaultSelection:y.string}),Ot(Ki,"defaultProps",{onChange:function(){},defaultSelection:void 0});var Yi=function(e){if(e){var t=e.notification_type,n=e.reset_period,a=void 0;return"CONTINUOUS"===t?a="Every time this happens":"DAY"===n?a="Only once per day":"WEEK"===n?a="Only once per week":"MONTH"===n&&(a="Only once per month"),a}},Wi=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{frequencySelectValue:Yi(t.props.dataAlert),timezone:e(t.props.dataAlert,"time_zone")}),Ot(Bt(t),"componentDidMount",(function(){t.props.onCompletedChange(t.isComplete())})),Ot(Bt(t),"componentDidUpdate",(function(e,n){t.isComplete()!==t.isComplete(n)&&t.props.onCompletedChange(t.isComplete())})),Ot(Bt(t),"isComplete",(function(e){return e?!!e.frequencySelectValue:!!t.state.frequencySelectValue})),Ot(Bt(t),"getData",(function(){var e=t.state,n=e.frequencySelectValue,a="PERIODIC",o=null;return"Every time this happens"===n?a="CONTINUOUS":"Only once per day"===n?o="DAY":"Only once per week"===n?o="WEEK":"Only once per month"===n&&(o="MONTH"),{notificationType:a,resetPeriod:o,timezone:e.timezone}})),Ot(Bt(t),"getResetPeriod",(function(e){return"Only once per day"===e?"DAY":"Only once per month"===e?"MONTH":"Only once per week"===e?"WEEK":"Every time this happens"===e?"CONTINUOUS":void 0})),Ot(Bt(t),"onTimezoneChange",(function(e){t.setState({timezone:e.value})})),Ot(Bt(t),"renderTimezoneComponent",(function(){return f.createElement("div",null,f.createElement("span",null,"Time zone: "),f.createElement(Ki,{onChange:t.onTimezoneChange,defaultSelection:t.state.timezone}))})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"notification-frequency-step","data-test":"schedule-builder"},f.createElement("div",{className:"frequency-settings-container"},f.createElement("p",null,"When the conditions of this Data Alert are met, how often do you want to be notified?"),f.createElement(Hi,{options:["Every time this happens","Only once per day","Only once per week","Only once per month"],selectionPlaceholder:"Select a frequency",value:t.state.frequencySelectValue,type:"original",onChange:function(e){return t.setState({frequencySelectValue:e})}}))),f.createElement("div",{className:"schedule-builder-timezone-section"},t.renderTimezoneComponent()))})),t}return Pt(a)}();Ot(Wi,"propTypes",{dataAlert:y.shape({}),onChange:y.func,onCompletedChange:y.func,onErrorCallback:y.func}),Ot(Wi,"defaultProps",{dataAlert:void 0,onChange:function(){},onCompletedChange:function(){},onErrorCallback:function(){}});var Gi=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o.initializeFields()})),Ot(Bt(o),"componentDidUpdate",(function(e,t){if(!o.props.isVisible&&e.isVisible&&(setTimeout(o.resetFields,500),o.props.onClosed()),o.props.isVisible&&!e.isVisible&&(o.initializeFields(),o.props.onOpened()),o.props.initialQuery&&o.props.initialQuery!==e.initialQuery){o.resetFields();var n=o.createExpressionJSONFromQuery(o.props.initialQuery,o.props.userSelection);o.setState({isExpressionSectionComplete:!0,expressionJSON:n})}o.state.frequencyCategorySelectValue!==t.frequencyCategorySelectValue&&o.setState({everyCheckboxValue:!1,frequencySelectValue:"MONTH",weekSelectValue:[2],monthSelectValue:[1],yearSelectValue:[1]})})),Ot(Bt(o),"resetFields",(function(){o.setState({isExpressionSectionComplete:!1,isScheduleSectionComplete:!1,expressionJSON:[],isDataReturnDirty:!1,titleInput:"",messageInput:""})})),Ot(Bt(o),"initializeFields",(function(){if(De(o.props.currentDataAlert)){if(o.props.initialQuery&&"string"==typeof o.props.initialQuery){var t=o.createExpressionJSONFromQuery(o.props.initialQuery,o.props.userSelection);o.setState({isExpressionSectionComplete:!0,expressionJSON:t})}}else{var n=o.props.currentDataAlert;o.setState({titleInput:n.title,messageInput:n.message,dataReturnQuery:n.data_return_query,isDataReturnDirty:!0,expressionJSON:e(o.props.currentDataAlert,"expression")})}})),Ot(Bt(o),"createExpressionJSONFromQuery",(function(e,t){return[{condition:"TERMINATOR",id:b(),term_type:"group",term_value:[{id:b(),term_type:"group",condition:"TERMINATOR",term_value:[{id:b(),condition:"EXISTS",term_type:"query",term_value:e,user_selection:t}]}]}]})),Ot(Bt(o),"getDataAlertData",(function(){try{var t,n=o.state,a=n.titleInput,r=n.messageInput,i=C(o.state.expressionJSON);o.expressionRef&&(i=o.expressionRef.getJSON(),t=o.expressionRef.getFirstQuery());var l={};return o.scheduleBuilderRef&&(l=o.scheduleBuilderRef.getData()),{id:e(o.props.currentDataAlert,"id"),title:a,data_return_query:t,message:r,expression:i,notification_type:l.notificationType,reset_period:l.resetPeriod,time_zone:l.timezone}}catch(e){console.error(e)}})),Ot(Bt(o),"onExpressionChange",(function(e,t,n){o.setState({isExpressionSectionComplete:e,isFirstSectionComplete:o.isFirstSectionComplete(),isExpressionValidated:!1,expressionJSON:n})})),Ot(Bt(o),"isFirstSectionComplete",(function(){var e=!1;return o.expressionRef&&(e=o.expressionRef.isComplete()),o.props.enableQueryValidation?e&&!!o.state.titleInput&&o.state.isExpressionValidated&&o.state.isExpressionValid:e&&!!o.state.titleInput})),Ot(Bt(o),"onDataAlertSave",(function(){o.setState({isSavingDataAlert:!0});var t=xt(xt({},o.getDataAlertData()),{},{project_id:o.props.selectedDemoProjectId}),n=xt({dataAlert:t},Wn(o.props.authentication));o.props.isManagement?(o.props.onManagementCreateDataAlert(t),o.setState({isSavingDataAlert:!1})):t.id?function(t){var n=t.dataAlert,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));if(!n)return Promise.reject(new Error("No rule to update"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(n.id,"?key=").concat(o);return i.put(l,n).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt({},n)).then((function(e){o.props.onSave(e),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o.setState({isSavingDataAlert:!1})})):function(t){var n=t.dataAlert,a=t.domain,o=t.apiKey,r=t.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l=C(n);delete l.id;var s="".concat(a,"/autoql/api/v1/data-alerts?key=").concat(o);return i.post(s,l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt({},n)).then((function(e){o.props.onSave(e),o.setState({isSavingDataAlert:!1})})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o.setState({isSavingDataAlert:!1})}))})),Ot(Bt(o),"validateFn",o.props.onValidate||Ii),Ot(Bt(o),"validateExpression",(function(){try{if(o.setState({isValidating:!0,isExpressionValidated:!1}),o.expressionRef){var t=o.expressionRef.getJSON();o.validateFn(xt(xt({},o.props.authentication),{},{expression:t})).then((function(){o.setState({isValidating:!1,isExpressionValid:!0,isExpressionValidated:!0}),o.stepsRef&&setTimeout((function(){return o.stepsRef.nextStep()}),500)})).catch((function(t){o.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0,expressionError:e(t,"message")})}))}else o.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}catch(e){console.error(e),o.setState({isValidating:!1,isExpressionValid:!1,isExpressionValidated:!0})}})),Ot(Bt(o),"renderValidateBtn",(function(){return o.expressionRef&&o.expressionRef.state.expressionError?null:f.createElement(v,null,o.state.isExpressionValidated&&o.state.isExpressionValid&&f.createElement("span",{style:{display:"inline-block",position:"absolute",right:"210px"}},f.createElement(bn,{className:"expression-valid-checkmark",type:"check","data-for":"react-autoql-data-alert-modal-tooltip","data-tip":"Expression is valid"})),o.state.isExpressionValidated&&!o.state.isExpressionValid&&!!o.state.expressionError&&f.createElement("div",{className:"expression-invalid-message-container"},f.createElement("span",{className:"expression-invalid-message"},f.createElement(bn,{type:"warning-triangle"}))," ",f.createElement("p",{className:"expression-invalid-message",style:{maxWidth:"80%",marginTop:0,marginRight:0}},o.state.expressionError)),f.createElement(vr,{onClick:o.validateExpression,loading:o.state.isValidating,tooltipID:o.props.tooltipID,type:"primary",disabled:!o.state.titleInput||!e(o.expressionRef,"state.expression[0].term_value"),style:{position:"absolute",right:0}},"Check Alert & continue"))})),Ot(Bt(o),"setStep",(function(e){o.stepsRef&&o.stepsRef.setStep(e)})),Ot(Bt(o),"renderNextBtn",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},a=arguments.length>3?arguments[3]:void 0;return f.createElement(vr,{className:e,onClick:function(){n(),o.stepsRef&&o.stepsRef.nextStep()},disabled:t,type:"primary",tooltipID:o.props.tooltipID},a||"Continue")})),Ot(Bt(o),"renderBackBtn",(function(e){return f.createElement(vr,{className:e,tooltipID:o.props.tooltipID,onClick:function(){o.stepsRef&&o.stepsRef.prevStep()}},"Back")})),Ot(Bt(o),"renderSetUpDataAlertStep",(function(){var t,n;return f.createElement("div",null,f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{width:"80%"}},f.createElement("p",null,"Name your Data Alert:"),f.createElement(Li,{className:"react-autoql-notification-display-name-input",placeholder:"Add an Alert Name",icon:"title",maxLength:"50",value:o.state.titleInput,onChange:function(e){var t=o.state.isExpressionSectionComplete&&!!e.target.value;o.setState({titleInput:e.target.value,isFirstSectionComplete:t})}})),f.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},f.createElement(bn,{className:"react-autoql-data-alert-query-name-tooltip-icon","data-for":null!==(t=o.props.tooltipID)&&void 0!==t?t:"react-autoql-data-alert-query-name-tooltip","data-tip":"This will be visible to anyone who gets notified when this Alert is triggered.",type:"info",size:24}))),f.createElement("div",{style:{display:"flex"}},f.createElement("div",{style:{width:"80%"}},f.createElement("p",null,"Notify me when:"),f.createElement(_i,{authentication:o.props.authentication,ref:function(e){return o.expressionRef=e},key:"expression-".concat(o.NEW_NOTIFICATION_MODAL_ID),onChange:o.onExpressionChange,enableQueryValidation:o.props.enableQueryValidation,expression:e(o.props.currentDataAlert,"expression",o.state.expressionJSON)})),f.createElement("div",{style:{width:"20%",marginLeft:10,marginTop:35}},f.createElement(bn,{className:"react-autoql-data-alert-query-name-tooltip-icon","data-for":null!==(n=o.props.tooltipID)&&void 0!==n?n:"react-autoql-data-alert-query-name-tooltip","data-tip":"Your query should describe the result you wish to be alerted about.",type:"info",size:24}))),f.createElement("div",{className:"step-btn-container"},o.props.enableQueryValidation?o.renderValidateBtn():o.renderNextBtn("first-step-next-btn",o.props.enableQueryValidation&&(!o.state.isExpressionValidated||!o.state.isExpressionValid))))})),Ot(Bt(o),"renderFrequencyStep",(function(){return f.createElement("div",null,f.createElement(Wi,{ref:function(e){return o.scheduleBuilderRef=e},key:"schedule-".concat(o.NEW_NOTIFICATION_MODAL_ID),dataAlert:o.props.currentDataAlert,onCompletedChange:function(e){o.setState({isScheduleSectionComplete:e})},onErrorCallback:o.props.onErrorCallback}),f.createElement("div",{className:"step-btn-container"},o.renderBackBtn("second-step-back-btn"),o.renderNextBtn("second-step-next-btn",!o.state.isScheduleSectionComplete,(function(){return o.setState({isThirdSectionDirty:!0})}))))})),Ot(Bt(o),"renderAlertPreferencesStep",(function(){return f.createElement("div",null,f.createElement("p",null,"Optional:"),f.createElement(Li,{className:"react-autoql-notification-message-input",placeholder:"This message will be visible when a notification is sent.",type:"multi",maxLength:"200",value:o.state.messageInput,onChange:function(e){return o.setState({messageInput:e.target.value})}}),f.createElement("div",{className:"step-btn-container"},o.renderBackBtn("second-step-back-btn")))})),Ot(Bt(o),"onDataAlertDelete",(function(){var t=e(o.props.currentDataAlert,"id");t&&(o.setState({isDeletingDataAlert:!0}),function(t,n){var a=n.domain,o=n.apiKey,r=n.token;if(!r||!o||!a)return Promise.reject(new Error("UNAUTHORIZED"));var i=m.create({headers:{Authorization:"Bearer ".concat(r)}}),l="".concat(a,"/autoql/api/v1/data-alerts/").concat(t,"?key=").concat(o);return i.delete(l).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(t,Wn(o.props.authentication)).then((function(){o.setState({isDeletingDataAlert:!1,isConfirmDeleteModalVisible:!1}),o.props.onDelete(t),o.props.onClose(!1)})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o.setState({isDeletingDataAlert:!1})})))})),Ot(Bt(o),"getModalContent",(function(){return o.props.isVisible?[{title:"Set Up Your Alert",content:o.renderSetUpDataAlertStep(),complete:o.isFirstSectionComplete(),error:o.props.enableQueryValidation&&o.state.isExpressionValidated&&!o.state.isExpressionValid},{title:"Set Notification Preferences",content:o.renderFrequencyStep(),complete:o.state.isScheduleSectionComplete},{title:"Compose Notification Message",content:o.renderAlertPreferencesStep(),complete:o.state.isThirdSectionDirty||!!o.props.currentDataAlert,onClick:function(){o.setState({isThirdSectionDirty:!0})}}]:null})),Ot(Bt(o),"isSaveButtonDisabled",(function(e){return e&&!!e.find((function(e){return!e.complete||e.error}))})),Ot(Bt(o),"render",(function(){var e,t,n=o.getModalContent();return f.createElement(Kt,null,f.createElement(Ci,{overlayStyle:{zIndex:"9998"},title:o.props.title,titleIcon:De(o.props.currentDataAlert)?f.createElement("span",{key:"title-icon-".concat(o.COMPONENT_KEY)}):f.createElement(bn,{key:"title-icon-".concat(o.COMPONENT_KEY),type:"edit"}),ref:function(e){return o.modalRef=e},isVisible:o.props.isVisible,onClose:o.props.onClose,confirmOnClose:!0,enableBodyScroll:!0,footer:f.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},f.createElement("div",null,o.props.currentDataAlert&&o.props.allowDelete&&f.createElement(vr,{type:"danger",onClick:function(){o.setState({isConfirmDeleteModalVisible:!0})},loading:o.state.isDeletingDataAlert,tooltipID:o.props.tooltipID},"Delete Data Alert")),f.createElement("div",null,f.createElement(vr,{tooltipID:o.props.tooltipID,onClick:function(e){e.stopPropagation(),o.modalRef&&o.modalRef.onClose()}},"Cancel"),f.createElement(vr,{type:"primary",loading:o.state.isSavingDataAlert,onClick:o.onDataAlertSave,disabled:o.isSaveButtonDisabled(n),tooltipID:o.props.tooltipID},"Finish & Save")))},!o.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-data-alert-query-name-tooltip",effect:"solid",delayShow:500,place:"top"}),o.props.isVisible&&f.createElement("div",{className:"notification-modal-content"},f.createElement(Bi,{ref:function(e){return o.stepsRef=e},steps:n,isEditMode:!(null===(e=o.props)||void 0===e||null===(t=e.currentDataAlert)||void 0===t||!t.id)}))),f.createElement(bi,{isVisible:o.state.isConfirmDeleteModalVisible,onConfirm:o.onDataAlertDelete,confirmLoading:o.state.isDeletingDataAlert,onClose:function(){o.setState({isConfirmDeleteModalVisible:!1})},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.COMPONENT_KEY=b(),o.NEW_NOTIFICATION_MODAL_ID=b(),o.state={titleInput:"",messageInput:"",isExpressionSectionComplete:!1,expressionJSON:[],isExpressionValidated:!1,isScheduleSectionComplete:!1,isDataReturnDirty:!1,isConfirmDeleteModalVisible:!1},o}return Pt(a)}();Ot(Gi,"propTypes",{authentication:Gt,onErrorCallback:y.func,onSave:y.func,initialQuery:y.string,userSelection:y.array,currentDataAlert:y.shape({}),isVisible:y.bool,allowDelete:y.bool,onClose:y.func,isManagement:y.bool,onManagementCreateDataAlert:y.func,onManagementDeleteDataAlert:y.func,title:y.string,titleIcon:y.oneOfType([y.element,y.instanceOf(bn)]),enableQueryValidation:y.bool,onValidate:y.func,onClosed:y.func,onOpened:y.func}),Ot(Gi,"defaultProps",{authentication:jn,onSave:function(){},onErrorCallback:function(){},initialQuery:void 0,userSelection:void 0,currentDataAlert:void 0,isVisible:!1,allowDelete:!0,onClose:function(){},isManagement:!1,onManagementCreateDataAlert:function(){},onManagementDeleteDataAlert:function(){},onClosed:function(){},onOpened:function(){},title:"Create Data Alert",titleIcon:void 0,enableQueryValidation:!0,onValidate:void 0});var Xi=Ra(Gi),Ji="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==",Zi=function(t){Lt(o,f.Component);var a=Qt(o);function o(){var t;kt(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=a.call.apply(a,[this].concat(i))),"MODAL_COMPONENT_KEY",b()),Ot(Bt(t),"NOTIFICATION_FETCH_LIMIT",10),Ot(Bt(t),"state",{isFetchingFirstNotifications:!0,notificationList:[],pagination:{},nextOffset:0,hasMore:!0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0,t.getNotifications()})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(t),"closeDataAlertModal",(function(){t.setState({isEditModalVisible:!1})})),Ot(Bt(t),"getNotifications",(function(){Ti(xt(xt({},t.props.authentication),{},{offset:t.state.nextOffset,limit:t.NOTIFICATION_FETCH_LIMIT})).then((function(n){var a,o,r,i=C(t.state.notificationList),l=t.state.nextOffset,s=t.state.pagination;e(n,"items.length")&&(i=[].concat(zt(i),zt(n.items)),l=t.state.nextOffset+t.NOTIFICATION_FETCH_LIMIT,s=n.pagination);var c=!(null!=n&&null!==(a=n.items)&&void 0!==a&&a.length)||(null===(o=i)||void 0===o?void 0:o.length)===(null==n||null===(r=n.pagination)||void 0===r?void 0:r.total_items);t._isMounted&&t.setState({notificationList:i,pagination:s,nextOffset:l,hasMore:c,isFetchingFirstNotifications:!1,fetchNotificationsError:null})})).catch((function(e){console.error(e),t.props.onErrorCallback(e),t._isMounted&&t.setState({isFetchingFirstNotifications:!1,fetchNotificationsError:e})}))})),Ot(Bt(t),"refreshNotifications",(function(){Ti(xt(xt({},Wn(t.props.authentication)),{},{offset:0,limit:10})).then((function(e){var a=t.detectNewNotifications(e.items);if(!n(e.items,t.state.notificationList))if(null!=a&&a.length&&10!==(null==a?void 0:a.length)){var o=[].concat(zt(a),zt(t.state.notificationList));t.setState({notificationList:o,pagination:xt({},e.pagination),nextOffset:o.length-1})}else t.setState({notificationList:e.items,pagination:e.pagination})}))})),Ot(Bt(t),"detectNewNotifications",(function(e){var n=[];return e.every((function(e){return!t.state.notificationList.find((function(t){return t.id===e.id}))&&(n.push(e),!0)})),n})),Ot(Bt(t),"onItemClick",(function(e){var n=void 0,a=t.state.notificationList.map((function(t){return e.id===t.id?(t.expanded||(n=e.id),xt(xt({},t),{},{expanded:!t.expanded})):xt(xt({},t),{},{expanded:!1})}));t.setState({notificationList:a,activeNotificationId:n})})),Ot(Bt(t),"onDismissAllClick",(function(){var e=t.state.notificationList.map((function(e){return xt(xt({},e),{},{state:"DISMISSED"})}));t.setState({notificationList:e}),Ri(xt({},Wn(t.props.authentication))).then((function(){t.props.onDismissCallback(e),t.props.onChange(e)})).catch((function(e){console.error(e),t.props.onErrorCallback(e)}))})),Ot(Bt(t),"onDismissClick",(function(e){var n=t.state.notificationList.map((function(t){return e.id===t.id?xt(xt({},t),{},{state:"DISMISSED"}):t}));t.setState({notificationList:n},(function(){t.props.onDismissCallback(n)}))})),Ot(Bt(t),"onDeleteClick",(function(e){var n=t.state.notificationList.filter((function(t){return t.id!==e.id}));t.setState({notificationList:n,nextOffset:t.state.nextOffset>0?t.state.nextOffset-1:0},(function(){t.props.onDeleteCallback(n)}))})),Ot(Bt(t),"onDataAlertSave",(function(){t.setState({isEditModalVisible:!1}),t.props.onSuccessCallback("Notification successfully updated.")})),Ot(Bt(t),"renderDismissAllButton",(function(){return f.createElement("div",{key:"dismiss-all-btn",className:"react-autoql-notification-dismiss-all"},f.createElement("span",{onClick:t.onDismissAllClick},f.createElement(bn,{type:"notification-off",style:{verticalAlign:"middle"}})," Dismiss All"))})),Ot(Bt(t),"showEditDataAlertModal",(function(e){t.setState({isEditModalVisible:!0,activeNotificationId:e})})),Ot(Bt(t),"renderEditDataAlertModal",(function(){return f.createElement(Xi,{key:t.MODAL_COMPONENT_KEY,authentication:t.props.authentication,isVisible:t.state.isEditModalVisible,onClose:t.closeDataAlertModal,onOpened:t.props.onDataAlertModalOpen,onClosed:t.props.onDataAlertModalClose,currentDataAlert:t.state.activeDataAlert,onSave:t.onDataAlertSave,onErrorCallback:t.props.onErrorCallback,allowDelete:!1,title:t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert",titleIcon:t.state.activeDataAlert?f.createElement(bn,{type:"edit"}):f.createElement("span",null)})})),Ot(Bt(t),"render",(function(){var n={};return t.props.shouldRender||(n.visibility="hidden",n.opacity="0"),t.state.isFetchingFirstNotifications?f.createElement("div",{style:n,className:"notification-list-loading-container","data-test":"notification-list"},"Loading..."):t.state.fetchNotificationsError?f.createElement("div",{style:n,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(vr,{onClick:t.getInitialNotifications},"Try Again"))):f.createElement(Kt,null,f.createElement("div",{style:n,className:"react-autoql-notification-list-container","data-test":"notification-list"},!t.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-notification-tooltip",effect:"solid",delayShow:500,html:!0}),e(t.state.notificationList,"length")?f.createElement(v,null,t.renderDismissAllButton(),f.createElement(Sr,null,f.createElement(Te,{initialLoad:!1,pageStart:0,loadMore:t.getNotifications,hasMore:t.state.pagination.total_items>t.state.notificationList.length,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(cr,null)),useWindow:!1},f.createElement("div",{className:"notification-feed-list"},t.state.notificationList.map((function(e,n){return f.createElement(Fi,{key:"notification-item-".concat(n),authentication:t.props.authentication,notification:e,onClick:t.onItemClick,onDismissCallback:t.onDismissClick,onDismissSuccessCallback:function(){t.props.onChange(t.state.notificationList)},onDeleteCallback:t.onDeleteClick,onDeleteSuccessCallback:function(){t.props.onChange(t.state.notificationList),t.getNotifications()},onExpandCallback:function(e){t.props.onExpandCallback(e),t.setState({activeNotificationId:e.id})},onCollapseCallback:t.props.onCollapseCallback,activeNotificationData:t.props.activeNotificationData,autoChartAggregations:t.props.autoChartAggregations,showNotificationDetails:t.props.showNotificationDetails,onErrorCallback:t.props.onErrorCallback,onEditClick:function(e){t.setState({activeDataAlert:e}),t.showEditDataAlertModal()},enableAjaxTableData:t.props.enableAjaxTableData})})))))):f.createElement("div",{className:"empty-notifications-message"},f.createElement("img",{className:"empty-notifications-img",src:Ji}),f.createElement("div",{className:"empty-notifications-title"},"No notifications yet."),f.createElement("div",null,"Stay tuned!"),f.createElement("br",null),t.props.showCreateAlertBtn&&f.createElement(vr,{style:{marginTop:"10px"},type:"primary",onClick:t.showEditDataAlertModal},"Create Data Alert")),t.renderEditDataAlertModal()))})),t}return Pt(o)}();Ot(Zi,"propTypes",{authentication:Gt,onCollapseCallback:y.func,onExpandCallback:y.func,activeNotificationData:y.shape({}),showNotificationDetails:y.bool,onErrorCallback:y.func,onSuccessCallback:y.func,onDismissCallback:y.func,onDeleteCallback:y.func,onChange:y.func,autoChartAggregations:y.bool,showCreateAlertBtn:y.bool,enableAjaxTableData:y.bool,onDataAlertModalOpen:y.func,shouldRender:y.bool}),Ot(Zi,"defaultProps",{authentication:jn,activeNotificationData:void 0,showNotificationDetails:!0,autoChartAggregations:!1,showCreateAlertBtn:!1,enableAjaxTableData:!1,shouldRender:!0,onCollapseCallback:function(){},onExpandCallback:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onDismissCallback:function(){},onDeleteCallback:function(){},onDataAlertModalOpen:function(){},onChange:function(){}});var $i=Ra(Zi),el=function(e){var t=a(e.reset_date);return"".concat(t.format("MMMM DD, YYYY")," at ").concat(t.format("hh:mma"))},tl=function(t){Lt(o,f.Component);var a=Qt(o);function o(){var t;kt(this,o);for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return Ot(Bt(t=a.call.apply(a,[this].concat(i))),"COMPONENT_KEY",b()),Ot(Bt(t),"state",{isFetchingList:!0,isEditModalVisible:!1,activeDataAlert:void 0,customAlertsList:void 0,projectAlertsList:void 0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0,t._isMounted&&t.getDataAlerts()})),Ot(Bt(t),"componentDidUpdate",(function(e,a){n(Wn(t.props.authentication),Wn(e.authentication))||t.getDataAlerts()})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(t),"getDataAlerts",(function(n){Di(xt(xt({},Wn(t.props.authentication)),{},{type:n})).then((function(n){t._isMounted&&t.setState({customAlertsList:e(n,"data.custom_alerts"),projectAlertsList:e(n,"data.project_alerts")})})).catch((function(e){console.error(e)}))})),Ot(Bt(t),"onEditClick",(function(e,n){e.stopPropagation(),t.setState({isEditModalVisible:!0,activeDataAlert:n})})),Ot(Bt(t),"onDataAlertSave",(function(){t.getDataAlerts(),t.props.onSuccessAlert("Notification created!"),t.setState({isEditModalVisible:!1})})),Ot(Bt(t),"onDataAlertDelete",(function(e){var n=t.state.customAlertsList.filter((function(t){return t.id!==e}));t.setState({customAlertsList:n,isEditModalVisible:!1})})),Ot(Bt(t),"onEnableSwitchChange",(function(e,n){var a=e.target.checked?"ACTIVE":"INACTIVE",o="CUSTOM"===n.type?"customAlertsList":"projectAlertsList",r=t.state[o].map((function(e){return n.id===e.id?xt(xt({},e),{},{status:a}):e}));t.setState(Ot({},"".concat(o),r)),ki(xt({dataAlertId:n.id,type:n.type,status:a},Wn(t.props.authentication))).catch((function(e){console.error(e),t.props.onErrorCallback(new Error("Something went wrong. Please try again.")),t.getDataAlerts()}))})),Ot(Bt(t),"renderNotificationEditModal",(function(){return f.createElement(Xi,{ref:function(e){return t.editModalRef=e},key:t.COMPONENT_KEY,authentication:t.props.authentication,isVisible:t.state.isEditModalVisible,onClose:function(){return t.setState({isEditModalVisible:!1})},currentDataAlert:t.state.activeDataAlert,onSave:t.onDataAlertSave,onErrorCallback:t.props.onErrorCallback,onDelete:t.onDataAlertDelete,title:t.state.activeDataAlert?"Edit Data Alert":"Create Data Alert",titleIcon:t.state.activeDataAlert?f.createElement(bn,{type:"edit"}):f.createElement("span",null),selectedDemoProjectId:t.props.selectedDemoProjectId})})),Ot(Bt(t),"renderNotificationGroupTitle",(function(e,t){return f.createElement("div",{className:"react-autoql-notification-title-container"},f.createElement("div",{style:{paddingLeft:"10px"}},f.createElement("div",{style:{fontSize:"17px"}},e),f.createElement("div",{style:{fontSize:"11px",opacity:.6}},t)))})),Ot(Bt(t),"goToScheduleStep",(function(e){t.setState({isEditModalVisible:!0,activeDataAlert:e}),setTimeout((function(){t.editModalRef&&t.editModalRef.setStep(1)}),0)})),Ot(Bt(t),"goToErrorFeedback",(function(e){t.setState({activeDataAlert:e,isEditModalVisible:!0})})),Ot(Bt(t),"hasError",(function(e){return"GENERAL_ERROR"===e.status||"EVALUATION_ERROR"===e.status||"DATA_RETURN_ERROR"===e.status})),Ot(Bt(t),"renderNotificationlist",(function(e,n){return"project"!==e||null!=n&&n.length?f.createElement("div",{className:"data-alerts-list-container"},"custom"===e&&null!=n&&n.length?t.renderNotificationGroupTitle("Custom Data Alerts","View and manage your custom Data Alerts"):null,"custom"===e&&!(null!=n&&n.length)&&t.renderEmptyListMessage(),"project"===e&&t.renderNotificationGroupTitle("Subscribe to a Data Alert","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(e,n){return f.createElement("div",{key:"react-autoql-notification-setting-item-".concat(n),className:"react-autoql-notification-setting-item ".concat(e.type)},f.createElement("div",{className:"react-autoql-notification-setting-item-header"},f.createElement("div",{className:"react-autoql-notification-setting-display-name"},f.createElement("span",{className:"react-autoql-notification-setting-display-name-title"},f.createElement("span",null,t.hasError(e)&&("CUSTOM"===e.type?f.createElement(bn,{type:"warning-triangle",className:"react-autoql-notification-error-status-icon",onClick:function(){return t.goToErrorFeedback(e)},"data-for":"react-autoql-notification-settings-tooltip","data-tip":"There was a problem with this Data Alert. Click for more information.",warning:!0}):f.createElement(bn,{type:"warning-triangle",id:"react-autoql-notification-error-status-icon-PROJECT","data-for":"react-autoql-notification-settings-tooltip","data-tip":"There was a problem with this Data Alert. For more information, please contact your system administrator.",warning:!0})),e.title)),f.createElement("span",{className:"react-autoql-notification-setting-display-name-message"},e.message&&f.createElement("span",null," - ",e.message))),f.createElement("div",{className:"react-autoql-notification-setting-actions"},"CUSTOM"===e.type&&f.createElement(bn,{className:"react-autoql-notification-action-btn",type:"edit","data-for":"react-autoql-notification-settings-tooltip","data-tip":"Edit Data Alert",onClick:function(n){"CUSTOM"===e.type&&t.onEditClick(n,e)}}),e.reset_date&&f.createElement(bn,{className:"reset-period-info-icon","data-tip":"This Alert has been triggered. Scanning will resume on ".concat(el(e)," (").concat(e.time_zone,")"),"data-for":"react-autoql-notification-settings-tooltip",onClick:function(){return t.goToScheduleStep(e)},type:"hour-glass"}),t.hasError(e)?f.createElement(f.Fragment,null,"CUSTOM"===e.type&&f.createElement(vr,{type:"primary",tooltip:"This Alert is no longer active. <br /> Click to re-initialze it.",multiline:!0,className:"react-autoql-re-initialize-btn",onClick:function(){t.props.onAlertInitializationCallback(e,t.props.selectedDemoProjectId,t.props.authentication),t.getDataAlerts()}},f.createElement("span",{className:"react-autoql-re-initialize-btn-text"},f.createElement(bn,{type:"warning-triangle"})," Resend")),f.createElement(Cr,{type:"switch",className:"react-autoql-notification-disable-checkbox"})):f.createElement(Cr,{type:"switch",checked:"ACTIVE"===e.status||"WAITING"===e.status,className:"react-autoql-notification-enable-checkbox",onClick:function(e){return e.stopPropagation()},"data-tip":"ACTIVE"===e.status||"WAITING"===e.status,"data-for":"react-autoql-notification-settings-tooltip",onChange:function(n){t.onEnableSwitchChange(n,e),zn()}}))))})))):null})),Ot(Bt(t),"renderEmptyListMessage",(function(){return f.createElement("div",{style:{textAlign:"center",marginTop:"100px"}},f.createElement("div",{className:"empty-list-message"},f.createElement("img",{className:"empty-list-img",src:Ji})),f.createElement("span",{style:{opacity:.6}},"No Alerts are set up yet."),f.createElement("br",null),f.createElement("span",{style:{opacity:.6,width:"350px",display:"inline-block"}},"To create one, select the “Create a Data Alert” option from a data response in Data Messenger."),f.createElement("br",null))})),Ot(Bt(t),"render",(function(){if(!t.state.customAlertsList)return f.createElement("div",{"data-test":"notification-settings",style:{textAlign:"center",marginTop:"100px"}},f.createElement(Aa,null));var n=e(t.state,"projectAlertsList",[]),a=e(t.state,"customAlertsList",[]);return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-settings","data-test":"notification-settings"},t.renderNotificationlist("project",n),t.renderNotificationlist("custom",a),t.renderNotificationEditModal(),f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-notification-settings-tooltip",effect:"solid",delayShow:500,html:!0})))})),t}return Pt(o)}();Ot(tl,"propTypes",{authentication:Gt,onErrorCallback:y.func,onSuccessAlert:y.func}),Ot(tl,"defaultProps",{authentication:jn,onErrorCallback:function(){},onAlertInitializationCallback:function(){},onSuccessAlert:function(){}});var nl=Ra(tl),al=function(t){Lt(o,f.Component);var a=Qt(o);function o(t){var r;kt(this,o),Ot(Bt(r=a.call(this,t)),"autoCompleteTimer",void 0),Ot(Bt(r),"state",xt({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","")),a="".concat(e(t,"[1].term_value",""));return{input1Value:n,input2Value:a,conditionSelectValue:t[0].condition,secondTermType:t[1].term_type,isComplete:!!e(n,"length")&&!!e(a,"length")}}return{}}(r.props.initialData))),Ot(Bt(r),"componentDidMount",(function(){r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentDidUpdate",(function(e,t){n(r.state,t)||r.props.onUpdate(r.props.ruleId,r.isComplete(),r.isValid())})),Ot(Bt(r),"componentWillUnmount",(function(){r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer)})),Ot(Bt(r),"parseJSON",(function(e){1===e.length?(r.TERM_ID_1=e[0].id,r.TERM_ID_2=b(),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}))})),Ot(Bt(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}]})),Ot(Bt(r),"isNumerical",(function(e){return!isNaN(Number(e))})),Ot(Bt(r),"isComplete",(function(){return"EXISTS"===r.state.conditionSelectValue?!!r.state.input1Value:!!e(r.state.input1Value,"length")&&!!e(r.state.input2Value,"length")})),Ot(Bt(r),"isValid",(function(){return!r.props.enableQueryValidation||("EXISTS"===r.state.conditionSelectValue?r.state.isFirstTermValid:r.state.isFirstTermValid&&r.state.isSecondTermValid)})),Ot(Bt(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}),Si(xt({query:r.state.input1Value},Wn(r.props.authentication))).then((function(){r.setState({isFirstTermValid:!0,isValidatingFirstTerm:!1})})).catch((function(){r.setState({isFirstTermValid:!1,isValidatingFirstTerm:!1})}))):r.setState({isFirstTermValid:!0})})),Ot(Bt(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}),Si(xt({query:r.state.input2Value},Wn(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})})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){e&&e.name&&(r.userSelectedValue=e.name,r.userSelectedSuggestion=!0,r.setState({inputValue:e.name}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.autoCompleteTimer&&clearTimeout(r.autoCompleteTimer),r.autoCompleteTimer=setTimeout((function(){sa(xt(xt(xt({},Wn(r.props.authentication)),getAutoQLConfig(r.props.autoQLConfig)),{},{suggestion:t})).then((function(e){var t,n=[],a=[];t=e.data.matches;for(var o=0;o<t.length&&(n.push(t[o]),4!==o);o++);n.sort((function(e,t){return t.length-e.length}));for(var i=0;i<n.length;i++){var l={name:n[i]};a.push(l)}r.setState({suggestions:a})})).catch((function(e){console.error(e)}))}),500)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"renderConditionOperator",(function(e){switch(e){case"GREATER_THAN":return">";case"LESS_THAN":return"<";case"EQUAL_TO":return"=";case"EXISTS":return"Exists"}})),Ot(Bt(r),"renderReadOnlyRule",(function(){return f.createElement(Kt,null,f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},"".concat(Uo(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"},Uo(r.state.input2Value)),r.props.andOrValue&&f.createElement("span",{className:"read-only-rule-term"},r.props.andOrValue)))})),Ot(Bt(r),"renderValidationError",(function(){return f.createElement("div",{className:"expression-term-validation-error"},f.createElement(bn,{type:"warning-triangle"})," That query is invalid. Try entering a different query.")})),Ot(Bt(r),"renderRule",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-notification-rule-container","data-test":"rule"},f.createElement("div",{className:"react-autoql-rule-input"},f.createElement(Li,{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(Tr,{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(Li,{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(bn,{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)}})))})),Ot(Bt(r),"render",(function(){return r.props.readOnly?r.renderReadOnlyRule():r.renderRule()})),r.initialData={},r.TERM_ID_1=b(),r.TERM_ID_2=b();var i=t.initialData;return i&&1===i.length?(r.TERM_ID_1=i[0].id,r.TERM_ID_2=b()):i&&i.length>1&&(r.TERM_ID_1=i[0].id,r.TERM_ID_2=i[1].id),r}return Pt(o)}();Ot(al,"propTypes",{authentication:Gt,ruleId:y.string,onAdd:y.func,onDelete:y.func,onUpdate:y.func,initialData:y.arrayOf(y.shape({})),readOnly:y.bool,enableQueryValidation:y.bool}),Ot(al,"defaultProps",{authentication:jn,ruleId:void 0,onAdd:function(){},onDelete:function(){},onUpdate:function(){},initialData:void 0,readOnly:!1,enableQueryValidation:!0});var ol=function(e){var t={},n=[];return e&&e.length?(e.forEach((function(e){var t,a=e.id||b();n.push({id:a,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:b(),type:"rule",isComplete:!1}),t={rules:n}),t},rl=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"ID",b()),Ot(Bt(e),"ruleRefs",[]),Ot(Bt(e),"state",xt({rules:[],andOrSelectValue:"ALL"},ol(e.props.initialData))),Ot(Bt(e),"componentDidMount",(function(){e.props.onUpdate(e.props.groupId,e.isComplete())})),Ot(Bt(e),"getJSON",(function(){return e.state.rules.map((function(t,n){var a="ALL"===e.state.andOrSelectValue?"AND":"OR";n===e.state.rules.length-1&&(a="TERMINATOR");var o=e.ruleRefs[n],r=[];return o&&(r=o.getJSON()),{id:t.id||b(),term_type:"group",condition:a,term_value:r}}))})),Ot(Bt(e),"isComplete",(function(){return e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isComplete()}))})),Ot(Bt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.rules.every((function(t,n){var a=e.ruleRefs[n];return!!a&&a.isValid()}))})),Ot(Bt(e),"deleteRuleOrGroup",(function(t){var n=e.state.rules.filter((function(e){return e.id!==t}));e.setState({rules:n})})),Ot(Bt(e),"onRuleUpdate",(function(t,n,a){var o=e.state.rules.map((function(e){return e.id===t?xt(xt({},e),{},{isComplete:n,termValue:a}):e}));e.setState({rules:o}),e.props.onUpdate(e.props.groupId,e.isComplete())})),Ot(Bt(e),"addRule",(function(){var t=b(),n=[].concat(zt(e.state.rules),[{id:t,type:"rule",isComplete:!1}]);e.setState({rules:n})})),Ot(Bt(e),"addGroup",(function(){var t=b(),n=[].concat(zt(e.state.rules),[{id:t,type:"group",isComplete:!1}]);e.setState({rules:n})})),Ot(Bt(e),"shouldDisableRuleDeleteBtn",(function(){return e.state.rules.filter((function(e){return"rule"===e.type})).length<=1})),Ot(Bt(e),"renderAllAnySelect",(function(){return f.createElement("div",{className:"notification-rule-and-or-select"},"Notify me when"," ",f.createElement(Hi,{options:["ALL","ANY"],value:e.state.andOrSelectValue,type:"button",onChange:function(t){return e.setState({andOrSelectValue:t})}})," ","of the following conditions are met:")})),Ot(Bt(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(bn,{type:"close","data-tip":"Remove Condition Group","data-for":"notification-expression-tooltip"}))})),Ot(Bt(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(bn,{type:"plus",className:"react-autoql-notification-add-icon","data-tip":"Add Condition","data-for":"notification-expression-tooltip"})))})),Ot(Bt(e),"renderGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1;return f.createElement(Kt,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,a){return"rule"===t.type?f.createElement(al,{authentication:e.props.authentication,ref:function(t){return e.ruleRefs[a]=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())))})),Ot(Bt(e),"renderReadOnlyGroup",(function(){var t=e.state.rules.filter((function(e){return"rule"===e.type})).length<=1,a=null;return"ALL"===e.state.andOrSelectValue?a="AND":"ANY"===e.state.andOrSelectValue&&(a="OR"),f.createElement(Kt,null,f.createElement("div",{className:"notification-read-only-group ".concat(t?" no-border":"")},e.state.rules.map((function(t,o){return"rule"===t.type?f.createElement(al,{key:"rule-readonly-".concat(t.id),ref:function(t){return e.ruleRefs[o]=t},ruleId:t.id,initialData:t.termValue,andOrValue:o!==e.state.rules.length-1?a: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}),o!==e.state.rules.length-1&&f.createElement("div",null,f.createElement("span",{className:"read-only-rule-term"},a))):void 0}))))})),Ot(Bt(e),"render",(function(){return e.props.readOnly?e.renderReadOnlyGroup():e.renderGroup()})),e}return Pt(n)}();Ot(rl,"propTypes",{authentication:Gt,groupId:y.string,onDelete:y.func,onUpdate:y.func,disableAddGroupBtn:y.bool,hideTopCondition:y.bool,readOnly:y.bool,enableQueryValidation:y.bool}),Ot(rl,"defaultProps",{authentication:jn,groupId:void 0,disableAddGroupBtn:!1,hideTopCondition:!1,readOnly:!1,onDelete:function(){},onUpdate:function(){},enableQueryValidation:!0});var il=function(t){var n={},a=[];return e(t,"length")?(t.map((function(e){a.push({initialData:e.term_value,isComplete:!0,type:"group",id:e.id})})),n={groups:a,andOrValue:"OR"===t[0].condition?"ANY":"ALL"}):(a.push({id:b(),isComplete:!1}),n={groups:a}),n},ll=function(e){Lt(a,f.Component);var t=Qt(a);function a(){var e;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(e=t.call.apply(t,[this].concat(r))),"groupRefs",[]),Ot(Bt(e),"state",xt({groups:[],andOrValue:"ALL"},il(e.props.expression))),Ot(Bt(e),"componentDidMount",(function(){e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(e),"componentDidUpdate",(function(t,a){n(t.expression,e.props.expression)||e.setState(xt({},il(e.props.expression))),n(a,e.state)||e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(e),"isComplete",(function(){return e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isComplete()}))})),Ot(Bt(e),"isValid",(function(){return!e.props.enableQueryValidation||e.state.groups.every((function(t,n){var a=e.groupRefs[n];return!!a&&a.isValid()}))})),Ot(Bt(e),"getJSON",(function(){return e.state.groups.map((function(t,n){var a="ALL"===e.state.andOrValue?"AND":"OR";n===e.state.groups.length-1&&(a="TERMINATOR");var o=e.groupRefs[n],r=[];return o&&(r=o.getJSON()),{id:t.id||b(),term_type:"group",condition:a,term_value:r}}))})),Ot(Bt(e),"addGroup",(function(t){var n=t.initialData,a=t.isComplete,o=t.id||b(),r=[].concat(zt(e.state.groups),[{initialData:n,isComplete:a,id:o}]);e.setState({groups:r})})),Ot(Bt(e),"onDeleteGroup",(function(t){var n=e.state.groups.filter((function(e){return e.id!==t}));e.setState({groups:n})})),Ot(Bt(e),"getAndOrValue",(function(){return e.state.andOrValue})),Ot(Bt(e),"onGroupUpdate",(function(t,n){var a=e.state.groups.map((function(e){return e.id===t?xt(xt({},e),{},{isComplete:n}):e}));e.setState({groups:a}),e.props.onChange(e.isComplete(),e.isValid(),e.getJSON())})),Ot(Bt(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(a,o){return f.createElement("div",{key:"expression-group-readonly-".concat(a.id,"-").concat(o)},f.createElement(rl,{ref:function(t){return e.groupRefs[o]=t},groupId:a.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===o,topCondition:e.state.andOrValue,onlyGroup:t,initialData:a.initialData,readOnly:e.props.readOnly,enableQueryValidation:!1}),o!==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)))})))})),Ot(Bt(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(Hi,{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,a){return f.createElement(rl,{authentication:e.props.authentication,ref:function(t){return e.groupRefs[a]=t},key:"group-".concat(n.id,"-").concat(a),groupId:n.id,disableAddGroupBtn:!0,onDelete:e.onDeleteGroup,onUpdate:e.onGroupUpdate,hideTopCondition:0===a,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(bn,{type:"plus",className:"react-autoql-notification-add-icon"}))))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,e.props.readOnly?e.renderReadOnlyRules():e.renderRules(),!e.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"notification-expression-tooltip",effect:"solid",delayShow:500,html:!0}))})),e}return Pt(a)}();Ot(ll,"propTypes",{authentication:Gt,expression:y.arrayOf(y.shape({})),readOnly:y.bool,onChange:y.func}),Ot(ll,"defaultProps",{authentication:jn,expression:void 0,readOnly:!1,onChange:function(){}});var sl=function(t){Lt(a,f.Component);var n=Qt(a);function a(){var t;kt(this,a);for(var o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return Ot(Bt(t=n.call.apply(n,[this].concat(r))),"state",{reportProblemMessage:void 0,problemType:void 0}),Ot(Bt(t),"componentDidMount",(function(){t._isMounted=!0})),Ot(Bt(t),"shouldComponentUpdate",(function(e,n){return!$o(t.props,e)||!$o(t.state,n)})),Ot(Bt(t),"componentDidUpdate",(function(e){!t.props.isVisible&&e.isVisible&&t.setState({problemType:void 0,reportProblemMessage:void 0})})),Ot(Bt(t),"componentWillUnmount",(function(){t._isMounted=!1})),Ot(Bt(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 a=e(t.props.responseRef,"queryResponse.data.data.query_id");t.setState({isReportingProblem:!0}),ga(xt({message:n,queryId:a},Wn(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})}))})),Ot(Bt(t),"onConfirm",(function(){t.reportQueryProblem(),t.setState({reportProblemMessage:void 0})})),Ot(Bt(t),"onClose",(function(){t.props.onClose(),t.setState({reportProblemMessage:void 0})})),Ot(Bt(t),"render",(function(){return f.createElement(Kt,null,f.createElement(Ci,{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(Hi,{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 Pt(a)}();Ot(sl,"propTypes",{authentication:Gt,onReportProblem:y.func,isVisible:y.bool}),Ot(sl,"defaultProps",{authentication:jn,responseRef:void 0,isVisible:!1,onReportProblem:function(){}});var cl=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,Qn()})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){if(o.state.activeMenu!==t.activeMenu)return!0;if(!o.props.shouldRender&&!e.shouldRender)return!1;var n=$o(o.props,e),a=$o(o.state,t);return!n||!a})),Ot(Bt(o),"componentDidUpdate",(function(e,t){"sql"===t.activeMenu&&"sql"!==o.state.activeMenu&&o.setState({sqlCopySuccess:!1}),e.displayType!==o.props.displayType&&(o.setState({activeMenu:void 0}),Qn())})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.temporaryStateTimeout),clearTimeout(o.pivotTableCSVDownloadTimeout)})),Ot(Bt(o),"onTableFilter",(function(e){var t,n;"table"===(null===(t=o.props.responseRef)||void 0===t||null===(n=t.state)||void 0===n?void 0:n.displayType)&&o.setState({disableChartingOptions:(null==e?void 0:e.length)<2})})),Ot(Bt(o),"setTemporaryState",(function(e,t,n){o.setState(Ot({},e,t)),o.temporaryStateTimeout=setTimeout((function(){o.setState(Ot({},e,void 0))}),n)})),Ot(Bt(o),"copyTableToClipboard",(function(){var e;o.props.responseRef?(null===(e=o.props.responseRef)||void 0===e||e.copyTableToClipboard(),o.props.onSuccessAlert("Successfully copied table to clipboard!"),o.setTemporaryState("copiedTable",!0,1e3),zn()):o.setTemporaryState("copiedTable",!1,1e3)})),Ot(Bt(o),"fetchCSVAndExport",(function(){var t,n,a,r,i,l,s,c,u=null===(t=o.props.responseRef)||void 0===t||null===(n=t.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.query_id,d=null===(i=o.props.responseRef)||void 0===i||null===(l=i.queryResponse)||void 0===l||null===(s=l.data)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.text,p=b();o.props.onCSVDownloadStart({id:p,queryId:u,query:d}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.queryId,a=t.domain,o=t.apiKey,r=t.token,i=t.csvProgressCallback;if(!r||!a||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/").concat(n,"/export?key=").concat(o),s={headers:{Authorization:"Bearer ".concat(r)},responseType:"blob",onDownloadProgress:function(e){if(i){var t=Math.round(100*e.loaded/e.total);i(t)}}};return m.post(l,{},s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response"))}))}(xt(xt({queryId:u},Wn(o.props.authentication)),{},{csvProgressCallback:function(e){return o.props.onCSVDownloadProgress({id:p,progress:e})}})).then((function(e){var t,n,a,r=window.URL.createObjectURL(new Blob([e.data])),i=document.createElement("a");i.href=r,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===(a=n.limit_reached)||void 0===a?void 0:a.toLowerCase());o.props.onCSVDownloadFinish({id:p,exportLimit:l,limitReached:s})})).catch((function(e){o.props.onCSVDownloadFinish({id:p,error:e}),console.error(e)}))})),Ot(Bt(o),"onCSVMenuButtonClick",(function(){var e,t;o.setState({activeMenu:void 0});var n,a,r,i,l="pivot_table"===(null===(e=o.props.responseRef)||void 0===e||null===(t=e.state)||void 0===t?void 0:t.displayType),s=b();l?null!==(n=o.props.responseRef)&&void 0!==n&&null!==(a=n.pivotTableRef)&&void 0!==a&&a._isMounted&&(o.props.onCSVDownloadStart({id:s}),null===(r=o.props.responseRef)||void 0===r||null===(i=r.pivotTableRef)||void 0===i||i.saveAsCSV(2e3).then((function(){o.props.onCSVDownloadProgress({id:s,progress:100}),o.props.onCSVDownloadFinish({id:s})})).catch((function(e){console.error(e),o.props.onCSVDownloadFinish({id:s})}))):o.fetchCSVAndExport()})),Ot(Bt(o),"saveChartAsPNG",(function(){var e;null===(e=o.props.responseRef)||void 0===e||e.saveChartAsPNG()})),Ot(Bt(o),"deleteMessage",(function(){zn(),o.props.deleteMessageCallback()})),Ot(Bt(o),"copySQL",(function(){var e,t,n,a,r=null===(e=o.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.sql,i=document.createElement("textarea");i.value=r,document.body.appendChild(i),i.select(),document.execCommand("copy"),o.setTemporaryState("copiedSQL",!0,1e3),o.props.onSuccessAlert("Successfully copied generated query to clipboard!"),o.setState({sqlCopySuccess:!0}),zn()})),Ot(Bt(o),"showHideColumnsModal",(function(){return o.setState({isHideColumnsModalVisible:!0})})),Ot(Bt(o),"closeColumnVisibilityModal",(function(){return o.setState({isHideColumnsModalVisible:!1})})),Ot(Bt(o),"closeDataAlertModal",(function(){o.setState({activeMenu:void 0})})),Ot(Bt(o),"onColumnVisibilitySave",(function(t){var n=o.props.authentication,a=t.map((function(e){var t=xt(xt({},e),{},{is_visible:e.checked});return delete t.content,delete t.checked,t}));o.setState({isSettingColumnVisibility:!0}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,o=t.domain,r=t.columns,i="".concat(o,"/autoql/api/v1/query/column-visibility?key=").concat(n),l={columns:r};if(!a||!o||!n)return Promise.reject(new Error("Unauthenticated"));var s={headers:{Authorization:"Bearer ".concat(a)}};return m.put(i,l,s).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},n),{},{columns:a})).then((function(){var e;(o._isMounted&&o.setState({isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1}),o.props.responseRef)&&(null===(e=o.props.responseRef)||void 0===e||e.updateColumns(a));o.props.onColumnVisibilitySave(a)})).catch((function(e){console.error(e),o.props.onErrorCallback(e),o._isMounted&&o.setState({isSettingColumnVisibility:!1})}))})),Ot(Bt(o),"renderHideColumnsModal",(function(){var e,t=null===(e=o.props.responseRef)||void 0===e?void 0:e.getColumns();if(!t||!t.length)return null;var n=t.map((function(e){return xt(xt({},e),{},{content:e.display_name,checked:e.is_visible})}));return f.createElement(Kt,null,f.createElement(Ei,{columns:n,isVisible:o.state.isHideColumnsModalVisible,onClose:o.closeColumnVisibilityModal,isSettingColumns:o.state.isSettingColumnVisibility,onConfirm:o.onColumnVisibilitySave}))})),Ot(Bt(o),"onDataAlertSave",(function(){o.props.onSuccessAlert("Successfully created a notification"),o.setState({activeMenu:void 0})})),Ot(Bt(o),"renderDataAlertModal",(function(){var e,t,n,a,r,i,l,s,c,u=null===(e=o.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.text,d=null===(r=o.props.responseRef)||void 0===r||null===(i=r.queryResponse)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.data)||void 0===s||null===(c=s.fe_req)||void 0===c?void 0:c.disambiguation;return f.createElement(Kt,null,f.createElement(Xi,{authentication:o.props.authentication,isVisible:"notification"===o.state.activeMenu,initialQuery:u,userSelection:d,onClose:o.closeDataAlertModal,onErrorCallback:o.props.onErrorCallback,onSave:o.onDataAlertSave,tooltipID:o.props.tooltipID}))})),Ot(Bt(o),"renderReportProblemModal",(function(){return f.createElement(sl,{ref:function(e){return o.reportProblemRef=e},authentication:o.props.authentication,onClose:function(){o.setState({activeMenu:void 0})},onReportProblem:function(e){var t=e.successMessage,n=e.error;t?(o.props.onSuccessAlert(t),o._isMounted&&o.setState({activeMenu:void 0})):n&&o.props.onErrorCallback(n)},responseRef:o.props.responseRef,isVisible:"report-problem"===o.state.activeMenu})})),Ot(Bt(o),"reportQueryProblem",(function(e){var t;null!==(t=o.reportProblemRef)&&void 0!==t&&t._isMounted&&o.reportProblemRef.reportQueryProblem(e)})),Ot(Bt(o),"refreshData",(function(){})),Ot(Bt(o),"getMenuItemClass",(function(e){return"react-autoql-toolbar-btn ".concat(null!=e?e:"")})),Ot(Bt(o),"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:o.onCSVMenuButtonClick,style:o.state.isCSVDownloading?{pointerEvents:"none",opacity:.6}:null},f.createElement(bn,{type:"download",style:{marginRight:"7px"}}),o.state.isCSVDownloading?"CSV file downloading...":"Download as CSV"),t.showSaveAsPNGButton&&f.createElement("li",{onClick:function(){o.setState({activeMenu:void 0}),o.saveChartAsPNG()}},f.createElement(bn,{type:"download",style:{marginRight:"7px"}}),"Download as PNG"),t.showCopyButton&&f.createElement("li",{onClick:function(){o.setState({activeMenu:void 0}),o.copyTableToClipboard()}},f.createElement(bn,{type:"copy",style:{marginRight:"7px"}}),"Copy table to clipboard"),t.showSQLButton&&f.createElement("li",{onClick:function(){o.setState({activeMenu:"sql"})}},f.createElement(bn,{type:"database"})," View generated SQL"),t.showCreateNotificationIcon&&f.createElement("li",{onClick:function(){o.setState({activeMenu:"notification"}),o.props.createDataAlertCallback()}},f.createElement(bn,{style:{verticalAlign:"middle",marginRight:"7px"},type:"notification"}),"Create a Data Alert...")))})),Ot(Bt(o),"isDrilldownResponse",(function(e){try{var t,n,a,o;return"Drilldown:"===(null===(t=e.responseRef)||void 0===t||null===(n=t.queryResponse)||void 0===n||null===(a=n.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.text).split(" ")[0]}catch(e){return!1}})),Ot(Bt(o),"openReportProblemModal",(function(){o.setState({activeMenu:"report-problem"})})),Ot(Bt(o),"renderSQLModal",(function(){var e,t,n,a,r,i=null===(e=o.props.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a||null===(r=a.sql)||void 0===r?void 0:r[0];return i?f.createElement(Kt,null,f.createElement(Ci,{isVisible:"sql"===o.state.activeMenu,footer:f.createElement("div",null,f.createElement(vr,{type:"primary",onClick:function(){return o.setState({activeMenu:void 0})},tooltipID:o.props.tooltipID},"Ok")),onClose:function(){return o.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(ht(i)),disabled:!0}),f.createElement(vr,{className:"copy-sql-btn ".concat(o.state.sqlCopySuccess?"sql-copied":""),onClick:o.copySQL,tooltip:"Copy to Clipboard",tooltipID:o.props.tooltipID},f.createElement(bn,{type:"copy"}),o.state.sqlCopySuccess&&f.createElement(bn,{type:"check",className:"sql-copied"}))))):null})),Ot(Bt(o),"renderToolbar",(function(e){var t,n,a,r,i,l,s,c,u;return null!==(t=o.props.responseRef)&&void 0!==t&&null!==(n=t.tableParams)&&void 0!==n&&null!==(a=n.filters)&&void 0!==a&&a.length,f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-toolbar options-toolbar\n ".concat(o.state.activeMenu?"active":"","\n ").concat(o.props.className||""),"data-test":"autoql-options-toolbar"},e.showFilterButton&&f.createElement("button",{onClick:function(){var e,t=null===(e=o.props.responseRef)||void 0===e?void 0:e.toggleTableFilter();o.setState({isFiltering:t})},className:o.getMenuItemClass("filter-btn"),"data-tip":"Filter table","data-for":null!==(r=o.props.tooltipID)&&void 0!==r?r:o.TOOLTIP_ID,"data-test":"react-autoql-filter-button"},f.createElement(bn,{type:"filter",showBadge:!1})),e.showHideColumnsButton&&f.createElement("button",{onClick:o.showHideColumnsModal,className:o.getMenuItemClass(e.showHideColumnsButton),"data-tip":"Show/hide columns","data-for":null!==(i=o.props.tooltipID)&&void 0!==i?i:o.TOOLTIP_ID,"data-test":"options-toolbar-col-vis"},f.createElement(bn,{type:"eye",showBadge:e.showHiddenColsBadge})),e.showReportProblemButton&&f.createElement("button",{onClick:o.openReportProblemModal,className:o.getMenuItemClass(e.showReportProblemButton),"data-tip":"Report a problem","data-for":null!==(l=o.props.tooltipID)&&void 0!==l?l:o.TOOLTIP_ID},f.createElement(bn,{type:"warning-triangle"})),e.showRefreshDataButton&&f.createElement("button",{onClick:o.refreshData,className:o.getMenuItemClass(e.showRefreshDataButton),"data-tip":"Re-run query","data-for":null!==(s=o.props.tooltipID)&&void 0!==s?s:o.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(bn,{type:"refresh"})),e.showDeleteButton&&f.createElement("button",{onClick:o.deleteMessage,className:o.getMenuItemClass(e.showDeleteButton),"data-tip":"Delete data response","data-for":null!==(c=o.props.tooltipID)&&void 0!==c?c:o.TOOLTIP_ID,"data-test":"options-toolbar-trash-btn"},f.createElement(bn,{type:"trash"})),e.showMoreOptionsButton&&f.createElement(we,{key:"more-options-button-".concat(o.COMPONENT_KEY),isOpen:"more-options"===o.state.activeMenu,positions:["bottom","top","left","right"],padding:8,onClickOutside:function(){o.setState({activeMenu:void 0})},content:function(t){return o.renderMoreOptionsMenu(t,e)},parentElement:o.props.popoverParentElement,boundaryElement:o.props.popoverParentElement},f.createElement("button",{onClick:function(){zn(),o.setState({activeMenu:"more-options"})},className:o.getMenuItemClass(e.showMoreOptionsButton),"data-tip":"More options","data-for":null!==(u=o.props.tooltipID)&&void 0!==u?u:o.TOOLTIP_ID,"data-test":"react-autoql-toolbar-more-options-btn"},f.createElement(bn,{type:"more-vertical"})))))})),Ot(Bt(o),"getShouldShowButtonObj",(function(e){var t={};try{var n,a,r,i,l,s,c,u,d,p,m,f,g,v,h=null===(n=e.responseRef)||void 0===n||null===(a=n.state)||void 0===a?void 0:a.displayType,y=null===(r=e.responseRef)||void 0===r?void 0:r.getColumns(),b=ko(h),C=No(h),E="pivot_table"===h,S=null===(i=e.responseRef)||void 0===i?void 0:i.queryResponse,T="data"===(null==S||null===(l=S.data)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.display_type),D=Vo(y),x=qo(y),w=null==S||null===(c=S.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.rows)||void 0===d?void 0:d.length,R=w>0,A=!(null===(p=e.responseRef)||void 0===p||null===(m=p.tableParams)||void 0===m||null===(f=m.filters)||void 0===f||!f.length),N=w>1&&!A||!!A,k=Xn(e.autoQLConfig);(t={showFilterButton:b&&!E&&!D&&N,showCopyButton:b&&!D,showSaveAsPNGButton:C,showHideColumnsButton:k.enableColumnVisibilityManager&&R&&("table"===h||"text"===h&&D),showHiddenColsBadge:x,showSQLButton:T&&k.debug,showSaveAsCSVButton:b&&N&&k.enableCSVDownload,showDeleteButton:e.enableDeleteBtn,showReportProblemButton:k.enableReportProblem&&!(null==S||null===(g=S.data)||void 0===g||null===(v=g.data)||void 0===v||!v.query_id),showCreateNotificationIcon:T&&k.enableNotifications&&!o.isDrilldownResponse(e),showRefreshDataButton:!1}).showMoreOptionsButton=t.showCopyButton||t.showSQLButton||t.showCreateNotificationIcon||t.showSaveAsCSVButton||t.showSaveAsPNGButton}catch(e){console.error(e)}return t})),Ot(Bt(o),"render",(function(){var e=o.getShouldShowButtonObj(o.props);return Object.values(e).find((function(e){return!0===e}))?f.createElement(Kt,null,o.renderToolbar(e),e.showHideColumnsButton&&o.renderHideColumnsModal(),e.showReportProblemButton&&o.renderReportProblemModal(),e.showCreateNotificationIcon&&o.renderDataAlertModal(),e.showSQLButton&&o.renderSQLModal(),!o.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:800})):null})),o.COMPONENT_KEY=b(),o.TOOLTIP_ID="react-autoql-options-toolbar-tooltip-".concat(o.COMPONENT_KEY),o.state={isHideColumnsModalVisible:!1,isSettingColumnVisibility:!1,reportProblemMessage:void 0,isCSVDownloading:!1},o}return Pt(a)}();Ot(cl,"propTypes",{authentication:Gt,autoQLConfig:Jt,enableDeleteBtn:y.bool,shouldRender:y.bool,onSuccessAlert:y.func,onErrorCallback:y.func,onNewNotificationCallback:y.func,deleteMessageCallback:y.func,createDataAlertCallback:y.func,onCSVDownloadStart:y.func,onCSVDownloadFinish:y.func,onCSVDownloadProgress:y.func}),Ot(cl,"defaultProps",{authentication:jn,autoQLConfig:Yn,enableDeleteBtn:!1,shouldRender:!0,onSuccessAlert:function(){},onErrorCallback:function(){},onNewNotificationCallback:function(){},deleteMessageCallback:function(){},createDataAlertCallback:function(){},onColumnVisibilitySave:function(){},onCSVDownloadStart:function(){},onCSVDownloadFinish:function(){},onCSVDownloadProgress:function(){}});var ul,dl=f.forwardRef((function(e,t){var n=Mt({},(_t(e),e));return f.createElement(cl,Mt({},n,{ref:t}))})),pl=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0,o.props.scrollToBottom(),o.scrollToBottomTimeout=setTimeout((function(){o.props.scrollToBottom()}),100),o.setIsAnimating()})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){return(!o.props.isResizing||!e.isResizing)&&(!$o(o.props,e)||!$o(o.state,t))})),Ot(Bt(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}})),Ot(Bt(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)})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1,clearTimeout(o.scrollToBottomTimeout),clearTimeout(o.animationTimeout)})),Ot(Bt(o),"setIsAnimating",(function(){if(!o.state.isAnimatingMessageBubble)return o.setState({isAnimatingMessageBubble:!0},(function(){o.clearIsAnimatingIn500ms()}));o.clearIsAnimatingIn500ms()})),Ot(Bt(o),"clearIsAnimatingIn500ms",(function(){clearTimeout(o.animationTimeout),o.animationTimeout=setTimeout((function(){o.setState({isAnimatingMessageBubble:!1}),o.props.scrollToBottom()}),500)})),Ot(Bt(o),"onCSVDownloadFinish",(function(e){var t,n,a,r=e.error,i=e.exportLimit,l=e.limitReached;if(r)return o.props.addMessageToDM({response:r});var s=null===(t=o.props.response)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.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,s)),".",l?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 ",i,"MB. This exceeds the maximum download size and you will only receive partial data.")):null)})})),Ot(Bt(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})),Ot(Bt(o),"scrollIntoView",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.block,n=void 0===t?"end":t,a=e.inline,r=void 0===a?"nearest":a,i=e.behavior,l=void 0===i?"smooth":i;setTimeout((function(){o.messageContainerRef&&!o.isScrolledIntoView(o.messageContainerRef)&&o.messageContainerRef.scrollIntoView({block:n,inline:r,behavior:l})}),0),setTimeout((function(){o.messageContainerRef&&!o.isScrolledIntoView(o.messageContainerRef)&&o.messageContainerRef.scrollIntoView({block:n,inline:r,behavior:l})}),100)})),Ot(Bt(o),"updateDataConfig",(function(e){o.setState({dataConfig:e})})),Ot(Bt(o),"renderFetchingFileMessage",(function(){return f.createElement("div",null,"Fetching your file ",f.createElement(cr,null))})),Ot(Bt(o),"renderCSVProgressMessage",(function(){return isNaN(o.state.csvDownloadProgress)?o.renderFetchingFileMessage():"Downloading your file ... ".concat(o.state.csvDownloadProgress,"%")})),Ot(Bt(o),"renderContent",(function(){return o.props.isCSVProgressMessage||void 0!==o.state.csvDownloadProgress?o.renderCSVProgressMessage():o.props.content?o.props.content:401===e(o.props.response,"status")?Yt.UNAUTHENTICATED:o.props.response?f.createElement(vi,{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:Wn(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,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())}}):Yt.GENERAL_QUERY})),Ot(Bt(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})})),Ot(Bt(o),"onDeleteMessage",(function(){return o.props.deleteMessageCallback(o.props.id)})),Ot(Bt(o),"renderRightToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar right"},o.props.isResponse?f.createElement(dl,{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}):null)})),Ot(Bt(o),"renderLeftToolbar",(function(){return f.createElement("div",{className:"chat-message-toolbar left"},o.props.isResponse&&"text"!==o.props.type?f.createElement(yi,{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)})),Ot(Bt(o),"render",(function(){var e,t,n,a,r=!(null===(e=o.responseRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a||!a.parsed_interpretation);return f.createElement(Kt,null,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\n ".concat(o.props.isResponse?" response":" request","\n ").concat(o.props.disableMaxHeight||o.props.isIntroMessage?" no-max-height":"","\n ")},f.createElement("div",{ref:function(e){return o.ref=e},className:"chat-message-bubble\n ".concat("text"===o.props.type?" text":"","\n ").concat(o.props.isActive?" active":"")},o.renderContent(),f.createElement("div",{className:"chat-message-toolbars-container"},o.renderLeftToolbar(),o.renderRightToolbar()))),r?f.createElement("div",{className:"chat-message-rt-container"},f.createElement(fi,{authentication:o.props.authentication,onValueLabelClick:o.props.onRTValueLabelClick,appliedFilters:o.props.appliedFilters,isResizing:o.props.isResizing,reverseTranslation:o.responseRef.queryResponse.data.data.parsed_interpretation,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 Pt(a)}();Ot(pl,"propTypes",(Ot(ul={authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,isResponse:y.bool.isRequired,isIntroMessage:y.bool,isActive:y.bool,type:y.string,text:y.string,id:y.string.isRequired,onSuggestionClick:y.func,response:y.shape({}),content:y.oneOfType([y.string,y.shape({})]),enableColumnVisibilityManager:y.bool},"dataFormatting",Xt),Ot(ul,"onErrorCallback",y.func),Ot(ul,"onSuccessAlert",y.func),Ot(ul,"isResizing",y.bool),Ot(ul,"enableDynamicCharting",y.bool),Ot(ul,"scrollToBottom",y.func),Ot(ul,"onNoneOfTheseClick",y.func),Ot(ul,"autoChartAggregations",y.bool),Ot(ul,"onConditionClickCallback",y.func),Ot(ul,"addMessageToDM",y.func),Ot(ul,"csvDownloadProgress",y.number),Ot(ul,"onRTValueLabelClick",y.func),Ot(ul,"enableAjaxTableData",y.bool),Ot(ul,"source",y.arrayOf(y.string)),Ot(ul,"isVisibleInDOM",y.bool),ul)),Ot(pl,"defaultProps",{authentication:jn,autoQLConfig:Yn,dataFormatting:Kn,enableAjaxTableData:!1,isIntroMessage:!1,source:[],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 ml=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){var e;a._isMounted=!0,null!==(e=a.props.introMessages)&&void 0!==e&&e.length&&a.addIntroMessages(a.props.introMessages),a.props.shouldRender&&a.focusInput()})),Ot(Bt(a),"componentDidUpdate",(function(e){a.props.shouldRender&&!e.shouldRender&&a.focusInput()})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1,clearTimeout(a.feedbackTimeout),clearTimeout(a.responseDelayTimeout)})),Ot(Bt(a),"focusInput",(function(){var e;null!==(e=a.queryInputRef)&&void 0!==e&&e._isMounted&&a.queryInputRef.focus()})),Ot(Bt(a),"scrollToBottom",(function(){var e,t;null===(e=a.messengerScrollComponent)||void 0===e||null===(t=e.ref)||void 0===t||t.scrollToBottom()})),Ot(Bt(a),"onCSVDownloadProgress",(function(e){var t=e.id,n=e.progress;a.csvProgressLog[t]=n,a.messageRefs[t]&&a.messageRefs[t].setState({csvDownloadProgress:n})})),Ot(Bt(a),"clearMessages",(function(){var e;null===(e=a.queryInputRef)||void 0===e||e.cancelQuery(),a.setState({messages:a.getIntroMessages(a.props.introMessages)})})),Ot(Bt(a),"animateInputTextAndSubmit",(function(){var e;if(null!==(e=a.queryInputRef)&&void 0!==e&&e._isMounted){for(var t,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];null===(t=a.queryInputRef)||void 0===t||t.animateInputTextAndSubmit.apply(t,o)}})),Ot(Bt(a),"onNoneOfTheseClick",(function(){a.addRequestMessage("None of these"),a.setState({isQueryRunning:!0}),clearTimeout(a.feedbackTimeout),a.feedbackTimeout=setTimeout((function(){a._isMounted&&(clearTimeout(a.responseDelayTimeout),a.setState({isQueryRunning:!1,isInputDisabled:!1}),a.addResponseMessage({content:f.createElement("div",{className:"feedback-message"},"Thank you for your feedback!",f.createElement("br",null),"To continue, try asking another query.")}))}),1e3)})),Ot(Bt(a),"onDrilldownStart",(function(){a.state.isDrilldownRunning&&(a.keepLoading=!0),a.setState({isDrilldownRunning:!0,isInputDisabled:!0})})),Ot(Bt(a),"onDrilldownEnd",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.response,n=e.error,o=e.originalQueryID;a._isMounted&&(a.keepLoading?a.keepLoading=!1:(clearTimeout(a.responseDelayTimeout),a.setState({isDrilldownRunning:!1,isInputDisabled:!1}),t?a.addResponseMessage({response:t,originalQueryID:o}):n&&a.addResponseMessage({content:n})))})),Ot(Bt(a),"getIsSuggestionResponse",(function(e){var t,n;return!(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n||!n.items)})),Ot(Bt(a),"deleteMessage",(function(e){var t=[e],n=a.state.messages.findIndex((function(t){return e===t.id})),o=a.state.messages[n-1];o&&(o.isResponse||t.push(o.id));var r=a.state.messages.filter((function(e){return!t.includes(e.id)}));a.setState({messages:r})})),Ot(Bt(a),"getIntroMessages",(function(e){return e.map((function(e){return a.createMessage({isResponse:!0,content:e||"",isIntroMessage:!0})}))})),Ot(Bt(a),"addIntroMessage",(function(e){a.addIntroMessages([e])})),Ot(Bt(a),"addIntroMessages",(function(e){Array.isArray(e)&&e.length&&a.addMessages(a.getIntroMessages(e))})),Ot(Bt(a),"addMessage",(function(e){a.addMessages([e])})),Ot(Bt(a),"addMessages",(function(e){var t=[].concat(zt(a.state.messages),zt(e));t.length>a.props.maxMessages&&(t=t.slice(-a.props.maxMessages)),a.setState({messages:t})})),Ot(Bt(a),"addRequestMessage",(function(e){a.addMessage(a.createMessage({content:e,isResponse:!1}))})),Ot(Bt(a),"addResponseMessage",(function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(o.isResponse=!0,"Unauthenticated"===(null==o||null===(e=o.response)||void 0===e?void 0:e.error))n=a.createErrorMessage(Yt.UNAUTHENTICATED);else if("Parse error"===(null==o||null===(t=o.response)||void 0===t?void 0:t.error))n=a.createErrorMessage(Yt.GENERAL_QUERY);else if(null!=o&&o.response||null!=o&&o.content){var r=a.getAppliedFilters(null==o?void 0:o.response);n=a.createMessage(xt(xt({},o),{},{appliedFilters:r}))}else n=a.createErrorMessage();n&&a.addMessage(n)})),Ot(Bt(a),"onInputSubmit",(function(e){a.addRequestMessage(e),a.setState({isInputDisabled:!0}),a.responseDelayTimeout=setTimeout((function(){a.setState({isQueryRunning:!0})}),600)})),Ot(Bt(a),"onResponse",(function(e,t){var n;a._isMounted&&(a.getIsSuggestionResponse(e)&&a.addResponseMessage({content:"I want to make sure I understood your query. Did you mean:"}),dt(null==e||null===(n=e.data)||void 0===n?void 0:n.data,"authorization_url")?a.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."))}):a.addResponseMessage({response:e,query:t}),clearTimeout(a.responseDelayTimeout),a.setState({isQueryRunning:!1,isInputDisabled:!1}),a.focusInput())})),Ot(Bt(a),"createIntroMessage",(function(e){var t=e.type,n=e.content;return{id:b(),isResponse:!0,type:t||"text",content:n||"",isIntroMessage:!0}})),Ot(Bt(a),"createMessage",(function(){var e,t,n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=a.id||b();return xt({id:o,type:null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.display_type},a)})),Ot(Bt(a),"createErrorMessage",(function(e){return a.createMessage({content:e||Yt.GENERAL_QUERY,isResponse:!0,type:"error"})})),Ot(Bt(a),"getAppliedFilters",(function(e){try{var t,n,a,o,r=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.persistent_locked_conditions,i=null==e||null===(a=e.data)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.session_locked_conditions;return Array.isArray(r)||(r=[]),Array.isArray(i)||(i=[]),[].concat(zt(r),zt(i))}catch(e){return[]}})),Ot(Bt(a),"isChataThinking",(function(){return a.state.isQueryRunning||a.state.isDrilldownRunning})),Ot(Bt(a),"render",(function(){var e,t;return a.props.shouldRender||(e="hidden",t="0"),f.createElement(Kt,null,f.createElement("div",{ref:function(e){return a.chatContentRef=e},className:"chat-content-scroll-container ".concat(a.props.shouldRender?"":"react-autoql-content-hidden"),style:{visibility:e,opacity:t}},f.createElement(Sr,{ref:function(e){return a.messengerScrollComponent=e}},a.state.messages.map((function(e){var t;return f.createElement(pl,{key:e.id,id:e.id,ref:function(t){return a.messageRefs[e.id]=t},isIntroMessage:e.isIntroMessage,authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,isCSVProgressMessage:e.isCSVProgressMessage,initialCSVDownloadProgress:a.csvProgressLog[e.id],onCSVDownloadProgress:a.onCSVDownloadProgress,queryId:e.queryId,queryText:e.query,originalQueryID:e.originalQueryID,isDataMessengerOpen:a.props.isDataMessengerOpen,isActive:a.state.activeMessageId===e.id,addMessageToDM:a.addResponseMessage,onDrilldownStart:a.onDrilldownStart,onDrilldownEnd:a.onDrilldownEnd,isResponse:e.isResponse,isChataThinking:a.isChataThinking(),onSuggestionClick:a.animateInputTextAndSubmit,content:e.content,scrollToBottom:a.scrollToBottom,dataFormatting:a.props.dataFormatting,response:e.response,type:e.type,onErrorCallback:a.props.onErrorCallback,onSuccessAlert:a.props.onSuccessAlert,deleteMessageCallback:a.deleteMessage,createDataAlertCallback:a.props.createDataAlertCallback,scrollContainerRef:null===(t=a.messengerScrollComponent)||void 0===t?void 0:t.ref,isResizing:a.props.isResizing,enableDynamicCharting:a.props.enableDynamicCharting,onNoneOfTheseClick:a.onNoneOfTheseClick,autoChartAggregations:a.props.autoChartAggregations,onRTValueLabelClick:a.props.onRTValueLabelClick,appliedFilters:e.appliedFilters,disableMaxHeight:a.props.disableMaxMessageHeight,enableAjaxTableData:a.props.enableAjaxTableData,queryRequestData:e.queryRequestData,popoverParentElement:a.chatContentRef,isVisibleInDOM:a.props.shouldRender,dataPageSize:a.props.dataPageSize,shouldRender:a.props.shouldRender,source:a.props.source,tooltipID:a.props.tooltipID,chartTooltipID:a.props.chartTooltipID})}))),a.isChataThinking()&&f.createElement("div",{className:"response-loading-container"},f.createElement(Aa,null))),f.createElement("div",{style:{visibility:e,opacity:t},className:"chat-bar-container ".concat(a.props.shouldRender?"":"react-autoql-content-hidden")},f.createElement("div",{className:"watermark"},f.createElement(bn,{type:"react-autoql-bubbles-outlined"}),Zt.run),f.createElement(tr,{ref:function(e){return a.queryInputRef=e},className:"chat-drawer-chat-bar",authentication:a.props.authentication,autoQLConfig:a.props.autoQLConfig,onSubmit:a.onInputSubmit,onResponseCallback:a.onResponse,isDisabled:a.state.isInputDisabled,enableVoiceRecord:a.props.enableVoiceRecord,autoCompletePlacement:"above",showChataIcon:!1,showLoadingDots:!1,placeholder:a.props.inputPlaceholder,onErrorCallback:a.props.onErrorCallback,hideInput:a.props.hideInput,source:a.props.source,queryFilters:a.props.queryFilters,sessionId:a.props.sessionId,dataPageSize:a.props.dataPageSize,isResizing:a.props.isResizing,shouldRender:a.props.shouldRender,tooltipID:a.props.tooltipID})))})),a.messageRefs={},a.csvProgressLog={},a.keepLoading=!1,a.state={messages:[]},a}return Pt(n)}();Ot(ml,"propTypes",{authentication:Gt.isRequired,autoQLConfig:Jt.isRequired,dataFormatting:Xt.isRequired,clearOnClose:y.bool.isRequired,enableVoiceRecord:y.bool.isRequired,maxMessages:y.number.isRequired,introMessage:y.string.isRequired,inputPlaceholder:y.string.isRequired,enableDynamicCharting:y.bool.isRequired,autoChartAggregations:y.bool.isRequired,enableFilterLocking:y.bool.isRequired,onErrorCallback:y.func.isRequired,onSuccessAlert:y.func.isRequired,onRTValueLabelClick:y.func,disableMaxMessageHeight:y.bool,enableAjaxTableData:y.bool,dataPageSize:y.number,sessionId:y.string,isResizing:y.bool,source:y.arrayOf(y.string),shouldRender:y.bool}),Ot(ml,"defaultProps",{disableMaxMessageHeight:!1,enableAjaxTableData:!1,isResizing:!1,dataPageSize:void 0,source:[],onRTValueLabelClick:void 0,shouldRender:!0});var fl=["scrollbarProps","className"],gl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"render",(function(){var e=a.props,t=e.scrollbarProps,n=void 0===t?{}:t,o=e.className,r=Ft(e,fl);return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-infinite-scroll-container"},f.createElement(Sr,Mt({},n,{ref:a.scrollComponent}),f.createElement(Te,Mt({},r,{className:"react-autoql-infinite-scroll ".concat(o||""),getScrollParent:function(){var e,t;return null===(e=a.scrollComponent)||void 0===e||null===(t=e.current)||void 0===t?void 0:t.getView()}}),a.props.children))))})),a.COMPONENT_KEY=b(),a.scrollComponent=f.createRef(),a}return Pt(n)}(),vl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.props.shouldRender&&a.focusInput()})),Ot(Bt(a),"componentDidUpdate",(function(e){a.props.shouldRender&&!e.shouldRender&&a.focusInput()})),Ot(Bt(a),"componentWillUnmount",(function(){clearTimeout(a.animateTextDelay),clearTimeout(a.animateTextTimeout)})),Ot(Bt(a),"focusInput",(function(){var e;null===(e=a.inputRef)||void 0===e||e.focus()})),Ot(Bt(a),"loadMore",(function(e,t){if(a.state.loading)return Promise.resolve();var n={validationResponse:void 0};1===e?(n.initialLoading=!0,n.hasMore=!0):n.loading=!0;var o=a.state.inputValue;return o!==a.state.keywords&&(n.queryList=void 0),a.setState(n),pa(xt(xt({},a.props.authentication),{},{keywords:o,pageSize:a.pageSize,pageNumber:e,skipQueryValidation:t})).then((function(e){var t,n,r={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&n.replacements)r.validationResponse=e;else{var i,l,s,c,u,d,p,m,f,g,v;((null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.pagination)||void 0===s?void 0:s.current_page)>=(null==e||null===(c=e.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.pagination)||void 0===d?void 0:d.total_pages)||null==e||null===(p=e.data)||void 0===p||null===(m=p.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var h=(null==e||null===(g=e.data)||void 0===g||null===(v=g.data)||void 0===v?void 0:v.items)||[];if(a.state.queryList){var y=a.state.queryList.concat(h);r.queryList=y}else r.queryList=h;r.keywords=o}return a.setState(r),Promise.resolve()})).catch((function(e){return a.setState({loading:!1,initialLoading:!1}),console.error(e),Promise.reject()}))})),Ot(Bt(a),"onInputChange",(function(e){a.setState({inputValue:e.target.value})})),Ot(Bt(a),"onKeyPress",(function(e){"Enter"==e.key&&a.loadMore(1)})),Ot(Bt(a),"onValidationSuggestionClick",(function(e){var t=e.query;a.animateQITextAndSubmit(t,!0)})),Ot(Bt(a),"animateQITextAndSubmit",(function(e,t){return Xo({text:e,inputRef:a.inputRef,callback:function(){a.setState({inputValue:e},(function(){return a.loadMore(1,t)}))}})})),Ot(Bt(a),"clearExploreQueries",(function(){a.setState({keywords:"",inputValue:"",queryList:void 0,validationResponse:void 0},(function(){a.focusInput()}))})),Ot(Bt(a),"renderIntroMessage",(function(){return f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement("h2",null,"Welcome to Explore Queries"),a.props.introMessage?f.createElement("p",null,a.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.")))})),Ot(Bt(a),"renderQueryList",(function(){var e;return a.state.initialLoading?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(Aa,null)):a.state.validationResponse?f.createElement("div",{className:"query-tips-result-placeholder"},f.createElement(di,{response:a.state.validationResponse,onSuggestionClick:a.onValidationSuggestionClick,autoSelectSuggestion:!0,submitText:"Search",submitIcon:"search"})):a.state.queryList?0===(null===(e=a.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(gl,{pageStart:1,loadMore:a.loadMore,hasMore:a.state.hasMore,useWindow:!1,initialLoad:!1,threshold:100,loader:f.createElement("div",{className:"react-autoql-spinner-centered",key:0},f.createElement(cr,{style:{width:"19px",height:"20px",color:"#999"}}))},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),style:{display:"block"}},e)}))):a.renderIntroMessage()})),Ot(Bt(a),"render",(function(){var e,t;return a.props.shouldRender?f.createElement(Kt,null,f.createElement("div",{ref:function(e){return a.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:a.props.inputPlaceholder,value:a.state.inputValue,onChange:a.onInputChange,onKeyPress:a.onKeyPress,spellCheck:!1,ref:function(e){return a.inputRef=e},"data-test":"explore-queries-input-bar",autoFocus:!0}),f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(bn,{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=a.state.queryList)&&void 0!==e&&e.length||a.state.inputValue?"visible":""),"data-for":null!==(t=a.props.tooltipID)&&void 0!==t?t:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(bn,{type:"close",onClick:a.clearExploreQueries}))),f.createElement("div",{className:"query-tips-result-container"},a.renderQueryList())),!a.props.tooltipID&&f.createElement(Un,{className:"react-autoql-tooltip",id:"explore-queries-tooltips",delayShow:800,effect:"solid"})):null})),a.pageSize=25,a.state={inputValue:"",keywords:"",queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},a}return Pt(n)}();Ot(vl,"propTypes",{shouldRender:y.bool,executeQuery:y.func,inputPlaceholder:y.string}),Ot(vl,"defaultProps",{shouldRender:!0,executeQuery:function(){},inputPlaceholder:"Search relevant queries by topic"});var hl=Ra(vl),yl=function(e){Lt(a,f.Component);var t=Qt(a);function a(e){var o;return kt(this,a),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o.loadMore(1)})),Ot(Bt(o),"componentDidUpdate",(function(e){(o.props.searchText&&o.props.searchText!==e.searchText||o.props.context!==e.context||!n(o.props.valueLabel,e.valueLabel))&&o.setState({queryList:void 0},(function(){o.loadMore(1)}))})),Ot(Bt(o),"loadMore",(function(e){if(!o.state.loading&&(o.props.searchText||o.props.context||o.props.valueLabel)){var t={validationResponse:void 0};1===e?(t.initialLoading=!0,t.hasMore=!0):t.loading=!0;var n=o.props.searchText;n!==o.state.keywords&&(t.queryList=void 0),o.setState(t),fa(xt(xt({},o.props.authentication),{},{pageSize:o.pageSize,pageNumber:e,text:o.props.searchText,selectedVL:o.props.valueLabel,userVLSelection:o.props.userSelection,context:o.props.context,skipQueryValidation:o.props.skipQueryValidation||e>1})).then((function(e){var t,a;o.props.onSuggestionListResponse({response:e});var r={initialLoading:!1,loading:!1};if(null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(a=t.data)&&void 0!==a&&a.replacements)r.validationResponse=e;else{var i,l,s,c,u,d,p,m,f,g,v;((null==e||null===(i=e.data)||void 0===i||null===(l=i.data)||void 0===l||null===(s=l.pagination)||void 0===s?void 0:s.current_page)>=(null==e||null===(c=e.data)||void 0===c||null===(u=c.data)||void 0===u||null===(d=u.pagination)||void 0===d?void 0:d.total_pages)||null==e||null===(p=e.data)||void 0===p||null===(m=p.data)||void 0===m||null===(f=m.items)||void 0===f||!f.length)&&(r.hasMore=!1);var h=(null==e||null===(g=e.data)||void 0===g||null===(v=g.data)||void 0===v?void 0:v.items)||[];if(o.state.queryList){var y=o.state.queryList.concat(h);r.queryList=y}else r.queryList=h;r.keywords=n}o.setState(r)})).catch((function(e){o.props.onSuggestionListResponse({error:e}),o.setState({loading:!1,initialLoading:!1}),console.error(e)}))}})),Ot(Bt(o),"onValidationSuggestionClick",(function(e){o.props.onValidationSuggestionClick(e)})),Ot(Bt(o),"clearQueryList",(function(){o.setState({queryList:void 0,validationResponse:void 0})})),Ot(Bt(o),"render",(function(){var e;return o.state.initialLoading?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(Aa,null)):o.state.validationResponse?f.createElement("div",{className:"data-explorer-card-placeholder"},f.createElement(di,{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:"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(Pe,{autoHeight:!0,autoHeightMin:0,autoHeightMax:800,className:"query-suggestion-list-scroll-component",renderView:function(e){return f.createElement("div",Mt({},e,{ref:function(e){return o.scrollbarRef=e},className:"data-preview-scroll-container"}))}},f.createElement(Te,{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(cr,{style:{width:"19px",height:"20px",color:"#999"}}))},f.createElement("div",{className:"query-suggestion-list"},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)},f.createElement("div",{className:"query-suggestion-text"},f.createElement(bn,{type:"react-autoql-bubbles-outlined"})," ",e))}))))):null})),o.pageSize=25,o.state={queryList:void 0,initialLoading:!1,loading:!1,error:!1,hasMore:!0},o}return Pt(a)}();Ot(yl,"propTypes",{searchText:y.string,subject:y.shape({}),valueLabel:y.shape({}),skipQueryValidation:y.bool,onSuggestionListResponse:y.func,executeQuery:y.func}),Ot(yl,"defaultProps",{searchText:"",subject:void 0,valueLabel:void 0,skipQueryValidation:!1,onSuggestionListResponse:function(){},executeQuery:function(){}});var bl=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===Jn?n="book":t.type===Zn&&(n="bookmark"),f.createElement(Kt,null,f.createElement("span",null,f.createElement(bn,{className:"data-explorer-topic-icon",type:n}),t.display_name))},Cl=function(t){Lt(o,f.Component);var a=Qt(o);function o(t){var r;return kt(this,o),Ot(Bt(r=a.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.fetchAllSubjects()})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.autoCompleteTimer),clearTimeout(r.inputAnimationTimeout)})),Ot(Bt(r),"fetchAllSubjects",(function(){(function(t){var n=t.domain,a=t.apiKey,o=t.token;if(!o||!n||!a)return Promise.reject(new Error("Unauthenticated"));var r="".concat(n,"/autoql/api/v1/query/subjects?key=").concat(a),i={headers:{Authorization:"Bearer ".concat(o)}};return m.get(r,i).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))})(xt({},r.props.authentication)).then((function(e){var t,n,a=(null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.subjects)||[],o=[];a.length&&(o=a.map((function(e){return xt(xt({},e),{},{type:Jn})})).filter((function(e){return!r.isAggSeed(e)})).sort((function(e,t){return e.display_name.localeCompare(t.display_name)}))),r._isMounted&&r.setState({allSubjects:o})})).catch((function(e){return console.error(e)}))})),Ot(Bt(r),"blurInput",(function(){var e,t;null===(e=r.autoSuggest)||void 0===e||null===(t=e.input)||void 0===t||t.blur()})),Ot(Bt(r),"getNewRecentSuggestions",(function(e){var t=C(r.state.recentSuggestions),a=t.findIndex((function(t){return n(t,e)}));return a>-1&&t.splice(a,1),5===t.length&&t.splice(-1),t.unshift(e),t})),Ot(Bt(r),"selectSubject",(function(e){r._isMounted&&(r.userSelectedValue=null,r.setState({inputValue:e.display_name,recentSuggestions:r.getNewRecentSuggestions(e)}),r.props.onSelection(e))})),Ot(Bt(r),"submitRawText",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=r.state.allSubjects.find((function(t){return t.display_name.toLowerCase().trim()===e.toLowerCase().trim()}));n?r.selectSubject(n):n={type:"text",display_name:e},r.props.onSelection(n,t),r.setState({recentSuggestions:r.getNewRecentSuggestions(n),inputValue:n.display_name})})),Ot(Bt(r),"animateTextAndSubmit",(function(e){Xo({text:e,inputRef:r.inputRef,callback:function(){return r.submitRawText(e,!0)}})})),Ot(Bt(r),"onInputChange",(function(e){if(r._isMounted){var t,n;if(r.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?(r.userSelectedValue=null,r.userTypedValue=e.target.value,r.isDirty=!0,r.setState({inputValue:e.target.value})):r.selectSubject(r.userSelectedValue)}})),Ot(Bt(r),"onInputFocus",(function(){r._isMounted&&r.setState({inputFocused:!0})})),Ot(Bt(r),"onInputBlur",(function(){r._isMounted&&r.setState({inputFocused:!1})})),Ot(Bt(r),"onKeyPress",(function(e){"Enter"==e.key&&(r.userSelectedValue?r.selectSubject(r.userSelectedValue):r.state.inputValue&&r.submitRawText(r.state.inputValue),r.blurInput())})),Ot(Bt(r),"clearInput",(function(){r._isMounted&&(r.setState({inputValue:""}),r.userTypedValue=null,r.userSelectedValue=null,r.props.onClearInputClick())})),Ot(Bt(r),"userSelectedSuggestionHandler",(function(e){r.userSelectedValue=e,null!=e&&e.display_name&&r._isMounted&&r.setState({inputValue:e.display_name})})),Ot(Bt(r),"cancelCurrentRequest",(function(){var e;null===(e=r.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(r),"requestSuggestions",(function(t){var n;r.setState({loadingAutocomplete:!0,loadingAutocompleteText:t}),clearTimeout(r.autoCompleteTimer),r.cancelCurrentRequest(),r.axiosSource=null===(n=m.CancelToken)||void 0===n?void 0:n.source(),r.autoCompleteTimer=setTimeout((function(){var n;(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.suggestion,a=t.domain,o=t.token,r=t.apiKey,i=t.cancelToken;if(!n||!n.trim())return Promise.reject(new Error("No query supplied"));if(!a||!r||!o)return Promise.reject(new Error("Unauthenticated"));var l="".concat(a,"/autoql/api/v1/query/vlsubjects?text=").concat(encodeURIComponent(n),"&key=").concat(r),s={headers:{Authorization:"Bearer ".concat(o)},cancelToken:i};return m.get(l,s).then((function(e){var t,n,a,o,r,i,l,s,c=[];null!=e&&null!==(t=e.data)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.suggestions)&&void 0!==a&&null!==(o=a.value_labels)&&void 0!==o&&o.length&&(c=e.data.data.suggestions.value_labels.slice(0,10).map((function(e){return xt(xt({},e),{},{display_name:"".concat(e.keyword," (").concat(e.show_message,")"),type:Zn})})));var u=[];null!=e&&null!==(r=e.data)&&void 0!==r&&null!==(i=r.data)&&void 0!==i&&null!==(l=i.suggestions)&&void 0!==l&&null!==(s=l.subjects)&&void 0!==s&&s.length&&(u=e.data.data.suggestions.subjects.map((function(e){return xt(xt({},e),{},{type:Jn})})));var d=[].concat(zt(u),zt(c));return Promise.resolve(d)})).catch((function(t){return(null==t?void 0:t.message)===Wt.CANCELLED?Promise.reject({data:{message:Wt.CANCELLED}}):Promise.reject(e(t,"response.data"))}))})(xt(xt({suggestion:t},r.props.authentication),{},{cancelToken:null===(n=r.axiosSource)||void 0===n?void 0:n.token})).then((function(e){r.setState({suggestions:e,loadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&(console.error(e),r.setState({suggestions:[],loadingAutocomplete:!1}))}))}),100)})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;t&&r.isDirty&&r._isMounted&&r.requestSuggestions(t)})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r._isMounted&&r.setState({suggestions:[]})})),Ot(Bt(r),"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)})),Ot(Bt(r),"getSectionSuggestions",(function(e){return e.suggestions})),Ot(Bt(r),"hasNoSuggestions",(function(){var e;return!(null!==(e=r.state.suggestions)&&void 0!==e&&e.length||r.state.loadingAutocomplete||!r.userTypedValue)})),Ot(Bt(r),"getSuggestions",(function(){var e,t,n,a=[],o=!(null===(e=r.state.recentSuggestions)||void 0===e||!e.length),i=!r.userTypedValue,l=!r.state.loadingAutocomplete,s=!(null===(t=r.state.suggestions)||void 0===t||!t.length),c=!(null!==(n=r.state.suggestions)&&void 0!==n&&n.length)&&l;return o&&a.push({title:"Recent",suggestions:r.state.recentSuggestions}),i?a.push({title:"All Topics",suggestions:r.state.allSubjects}):s?a.push({title:'Related to "'.concat(r.state.loadingAutocompleteText,'"'),suggestions:r.state.suggestions}):c&&a.push({title:'Related to "'.concat(r.state.loadingAutocompleteText,'"'),suggestions:[{name:""}],emptyState:!0}),a})),Ot(Bt(r),"renderSuggestion",(function(e){return f.createElement(bl,{topic:e})})),Ot(Bt(r),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,a=e.children,o=250,i=(null===(t=r.props.dataExplorerRef)||void 0===t?void 0:t.clientHeight)-200;return!isNaN(i)&&i>250&&(o=i),f.createElement("div",n,f.createElement("div",{className:"react-autoql-data-explorer-suggestion-container"},f.createElement(Sr,{autoHeight:!0,autoHeightMin:0,autoHeightMax:o,autoHide:!1},a)))})),Ot(Bt(r),"renderInputIcon",(function(){return f.createElement("div",{className:"chat-bar-input-icon"},f.createElement(bn,{type:"search",style:{width:"19px",height:"20px",color:"var(--react-autoql-text-color-placeholder)"}}))})),Ot(Bt(r),"renderClearInputBtn",(function(){var e;return f.createElement("div",{className:"chat-bar-clear-btn ".concat(r.state.inputValue?"visible":""),"data-for":null!==(e=r.props.tooltipID)&&void 0!==e?e:"explore-queries-tooltips","data-tip":"Clear Search"},f.createElement(bn,{type:"close",onClick:r.clearInput}))})),Ot(Bt(r),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-chatbar-input-container data-explorer ".concat(r.hasNoSuggestions()?"no-suggestions":""),"data-test":"data-explorer-autocomplete"},f.createElement(mt,{id:"data-explorer-autosuggest-".concat(r.componentKey),className:"react-autoql-data-explorer-autosuggest",onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,getSuggestionValue:r.userSelectedSuggestionHandler,renderSuggestionsContainer:r.renderSuggestionsContainer,suggestions:r.getSuggestions(),multiSection:!0,renderSectionTitle:r.renderSectionTitle,getSectionSuggestions:r.getSectionSuggestions,shouldRenderSuggestions:function(){return!0},ref:function(e){return r.autoSuggest=e},renderSuggestion:r.renderSuggestion,focusInputOnSuggestionClick:!1,inputProps:{ref:function(e){return r.inputRef=e},className:"react-autoql-chatbar-input",placeholder:r.props.inputPlaceholder,"data-test":"data-explorer-input-component",value:r.state.inputValue,onChange:r.onInputChange,onKeyPress:r.onKeyPress,onFocus:r.onInputFocus,onBlur:r.onInputBlur}}),r.renderInputIcon(),r.renderClearInputBtn()))})),r.componentKey=b(),r.userTypedValue=null,r.userSelectedValue=null,r.isDirty=!1,r.state={inputValue:"",loadingAutocomplete:!1,recentSuggestions:[],suggestions:[],allSubjects:[]},r}return Pt(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}();Ot(Cl,"propTypes",{authentication:Gt,inputPlaceholder:y.string,onClearInputClick:y.func,onSelection:y.func}),Ot(Cl,"defaultProps",{authentication:{},inputPlaceholder:"Search terms or topics",onClearInputClick:function(){},onSelection:function(){}});var El=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a.initialCollapseTimer=setTimeout((function(){a.saveCurrentCardHeight()}),400)})),Ot(Bt(a),"componentDidUpdate",(function(e){if(a.props.isCollapsed!==e.isCollapsed){var t=a.getIsCSSCollapsed();"boolean"==typeof t&&t!==a.props.isCollapsed&&(a.setIsCollapsedCSS(a.props.isCollapsed),a.forceUpdate())}})),Ot(Bt(a),"componentWillUnmount",(function(){clearTimeout(a.collapseTimer),clearTimeout(a.initialCollapseTimer)})),Ot(Bt(a),"getIsCSSCollapsed",(function(){var e;if(null!==(e=a.contentRef)&&void 0!==e&&e.style)return"hidden"===a.contentRef.style.visibility})),Ot(Bt(a),"getIsCollapsed",(function(){return"boolean"==typeof a.props.isCollapsed?a.props.isCollapsed:a.state.isCollapsed})),Ot(Bt(a),"handleClick",(function(){a.setIsCollapsedCSS(!a.getIsCSSCollapsed())})),Ot(Bt(a),"saveCurrentCardHeight",(function(){if(a.contentRef)if(a.getIsCollapsed())a.contentRef.style.maxHeight="0px",a.contentRef.style.visibility="hidden",a.contentRef.style.position="absolute";else{var e=a.contentRef.offsetHeight||0;a.contentRef.style.maxHeight="".concat(e,"px"),a.contentRef.style.position="relative",a.contentRef.style.visibility="visible"}})),Ot(Bt(a),"setIsCollapsedCSS",(function(e){var t=a.getIsCSSCollapsed();if(!(e&&t||!e&&!t)){if(a.contentRef){var n=a.contentRef.offsetHeight;e?(clearTimeout(a.collapseTimer),a.contentRef.style.maxHeight="unset",a.contentRef.style.maxHeight="".concat(n,"px"),setTimeout((function(){a.contentRef.style.maxHeight="0px"}),0),a.collapseTimer=setTimeout((function(){a.contentRef.style.visibility="hidden",a.contentRef.style.position="absolute"}),300)):(a.collapseTimer&&(clearTimeout(a.collapseTimer),a.contentRef.style.visibility="hidden",a.contentRef.style.position="absolute"),a.contentRef.style.maxHeight="unset",n=a.contentRef.offsetHeight,a.contentRef.style.maxHeight="0px",a.contentRef.style.position="relative",a.contentRef.style.visibility="visible",setTimeout((function(){a.contentRef.style.maxHeight="".concat(n,"px")}),0))}a.props.onIsCollapsedChange(e),a.setState({isCollapsed:e})}})),Ot(Bt(a),"render",(function(){return f.createElement(Kt,null,f.createElement("div",{className:"react-autoql-card\n ".concat(a.getIsCollapsed()?" collapsed":"","\n ").concat(a.props.className?a.props.className:""),style:a.props.style},f.createElement("div",{className:"react-autoql-card-title",onClick:a.handleClick},f.createElement("div",null,a.props.title),f.createElement(bn,{type:a.getIsCollapsed()?"caret-left":"caret-down"})),f.createElement("div",{ref:function(e){return a.contentRef=e},className:"react-autoql-card-content"},!!a.props.subtitle&&f.createElement("div",{className:"react-autoql-card-subtitle"},a.props.subtitle),f.createElement("div",{className:"react-autoql-card-user-content"},a.props.children))))})),a.COMPONENT_ID=b(),a.state={isCollapsed:e.defaultCollapsed},a}return Pt(n)}();Ot(El,"propTypes",{title:y.oneOfType([y.string,y.element]),subtitle:y.oneOfType([y.string,y.element]),defaultCollapsed:y.bool,isCollapsed:y.bool,onIsCollapsedChange:y.func}),Ot(El,"defaultProps",{title:null,subtitle:null,defaultCollapsed:!1,isCollapsed:void 0,onIsCollapsedChange:function(){}});var Sl=function(e){Lt(a,f.Component);var t=Qt(a);function a(e){var o;return kt(this,a),Ot(Bt(o=t.call(this,e)),"componentDidMount",(function(){o._isMounted=!0,o.props.subject&&o.getDataPreview()})),Ot(Bt(o),"componentDidUpdate",(function(e,t){o.props.subject&&!n(o.props.subject,e.subject)&&o.getDataPreview(),o.state.dataPreview&&!n(o.state.dataPreview,t.dataPreview)&&Qn()})),Ot(Bt(o),"componentWillUnmount",(function(){o._isMounted=!1})),Ot(Bt(o),"cancelCurrentRequest",(function(){var e;null===(e=o.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED)})),Ot(Bt(o),"getDataPreview",(function(){var e,t;o.cancelCurrentRequest(),o.axiosSource=null===(e=m.CancelToken)||void 0===e?void 0:e.source(),o.setState({loading:!0,error:void 0,dataPreview:void 0}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.subject,n=e.domain,a=e.apiKey,o=e.token,r=e.source,i=void 0===r?"data_explorer.user":r,l=e.numRows,s=void 0===l?10:l,c=e.cancelToken;if(!t)return Promise.reject(new Error("No subject supplied for data preview"));if(!o||!n||!a)return Promise.reject(new Error("Unauthenticated"));var u="".concat(n,"/autoql/api/v1/query/preview?key=").concat(a),d={headers:{Authorization:"Bearer ".concat(o)},cancelToken:c},p={subject:t,page_size:s,source:i,date_format:"ISO8601"};return m.post(u,p,d).then((function(e){return Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}(xt(xt({},o.props.authentication),{},{subject:null===(t=o.props.subject)||void 0===t?void 0:t.name,numRows:o.DATA_PREVIEW_ROWS,cancelToken:o.axiosSource.token})).then((function(e){o.setState({dataPreview:e,loading:!1})})).catch((function(e){var t;(null==e?void 0:e.message)!==Wt.CANCELLED&&(console.error(e),o.setState({loading:!1,error:null==e||null===(t=e.response)||void 0===t?void 0:t.data}))}))})),Ot(Bt(o),"formatColumnHeader",(function(e){var t;return f.createElement("div",{className:"data-preview-col-header","data-for":null!==(t=o.props.tooltipID)&&void 0!==t?t:"data-preview-tooltip"},null==e?void 0:e.display_name)})),Ot(Bt(o),"formatCell",(function(e){var t=e.cell,n=e.column,a=e.config;return f.createElement("div",{className:"data-preview-cell",style:{textAlign:"DOLLAR_AMT"===n.type?"right":"center"}},To({element:t,column:n,config:a}))})),Ot(Bt(o),"renderDataPreviewGrid",(function(){var e,t,n,a,r,i,l,s=null===(e=o.state.dataPreview)||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.rows,c=null===(a=o.state.dataPreview)||void 0===a||null===(r=a.data)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.columns;if(!(o.state.error||c&&s))return null;var u=Gn(o.props.dataFormatting);return null===(l=o.props.dataExplorerRef)||void 0===l||l.clientHeight,f.createElement("div",{className:"data-preview"},f.createElement(Sr,{autoHide:!1,style:{height:"165px"}},o.state.error?f.createElement("div",{className:"data-preview-error-message"},f.createElement("div",null,o.state.error.message),o.state.error.reference_id&&f.createElement(f.Fragment,null,f.createElement("br",null),f.createElement("div",null,"Error ID: ",o.state.error.reference_id))):f.createElement("table",null,f.createElement("thead",null,f.createElement("tr",null,c.map((function(e,t){return f.createElement("th",{key:"col-header-".concat(t)},o.formatColumnHeader(e))})))),f.createElement("tbody",null,s.map((function(e,t){return f.createElement("tr",{key:"row-".concat(t),className:"data-preview-row"},e.map((function(e,t){var n=c[t];return f.createElement("td",{key:"cell-".concat(t)},o.formatCell({cell:e,column:n,config:u}))})))}))))))})),Ot(Bt(o),"renderLoadingContainer",(function(){return f.createElement("div",{className:"data-explorer-card-placeholder data-preview"},f.createElement(Aa,null))})),Ot(Bt(o),"renderDataPreviewTitle",(function(){var e;return f.createElement("div",null,f.createElement(bn,{style:{fontSize:"20px"},type:"table"}),' Data Preview - "',null===(e=o.props.subject)||void 0===e?void 0:e.query,'"')})),Ot(Bt(o),"render",(function(){return o.props.shouldRender?f.createElement(Kt,null,f.createElement(El,{className:"data-explorer-data-preview","data-test":"data-explorer-data-preview",title:o.renderDataPreviewTitle(),isCollapsed:o.props.isCollapsed,onIsCollapsedChange:o.props.onIsCollapsedChange,defaultCollapsed:o.props.defaultCollapsed},o.state.loading?o.renderLoadingContainer():o.renderDataPreviewGrid())):null})),o.DATA_PREVIEW_ROWS=5,o.state={dataPreview:null},o}return Pt(a)}();Ot(Sl,"propTypes",{dataFormatting:Xt,authentication:Gt,shouldRender:y.bool,subject:y.shape({}),isCollapsed:y.bool,onIsCollapsedChange:y.func,defaultCollapsed:y.bool}),Ot(Sl,"defaultProps",{dataFormatting:Kn,authentication:{},shouldRender:!0,subject:null,rebuildTooltips:void 0,isCollapsed:void 0,onIsCollapsedChange:function(){},defaultCollapsed:!1});var Tl=function(e){Lt(n,f.Component);var t=Qt(n);function n(e){var a;return kt(this,n),Ot(Bt(a=t.call(this,e)),"componentDidMount",(function(){a._isMounted=!0})),Ot(Bt(a),"componentWillUnmount",(function(){a._isMounted=!1})),Ot(Bt(a),"onInputSelection",(function(e,t){var n;(null==e?void 0:e.type)===Jn?a.setState({selectedSubject:e,selectedKeywords:null,selectedVL:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):(null==e?void 0:e.type)===Zn?a.setState({selectedVL:e,selectedKeywords:null,activeTopicType:null==e?void 0:e.type,skipQueryValidation:!0}):"text"===(null==e?void 0:e.type)&&a.setState({selectedSubject:null,selectedVL:null,selectedKeywords:e,activeTopicType:null==e?void 0:e.type,skipQueryValidation:t}),null===(n=a.inputRef)||void 0===n||n.blurInput()})),Ot(Bt(a),"renderIntroMessage",(function(){return f.createElement("div",{className:"data-explorer-intro-message"},f.createElement("h2",null,"Welcome to ",f.createElement(bn,{type:"data-search"}),"Data Explorer"),a.props.introMessage?f.createElement("p",null,a.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(bn,{type:"table"})," Preview available data in a snapshot"),f.createElement("p",null,f.createElement(bn,{type:"abacus"})," Explore data structure and column types"),f.createElement("p",null,f.createElement(bn,{type:"react-autoql-bubbles-outlined"})," View a variety of query suggestions")))))})),Ot(Bt(a),"animateDETextAndSubmit",(function(e){var t;null!==(t=a.inputRef)&&void 0!==t&&t._isMounted&&a.inputRef.animateTextAndSubmit(e)})),Ot(Bt(a),"onValidationSuggestionClick",(function(e){var t=e.query,n=e.userSelection;a.querySuggestionsKey=b(),a.animateDETextAndSubmit(t),a.setState({userSelection:n})})),Ot(Bt(a),"renderDataPreview",(function(){return a.state.selectedSubject&&a.state.activeTopicType===Jn?f.createElement("div",{className:"data-explorer-section data-preview-section"},f.createElement(Sl,{authentication:a.props.authentication,dataFormatting:a.props.dataFormatting,subject:a.state.selectedSubject,shouldRender:a.props.shouldRender,dataExplorerRef:a.dataExplorerPage,isCollapsed:a.props.isSmallScreen?a.state.isDataPreviewCollapsed:void 0,tooltipID:a.props.tooltipID,onIsCollapsedChange:function(e){a.setState({isDataPreviewCollapsed:e,isQuerySuggestionCollapsed:!e||a.state.isQuerySuggestionCollapsed})},defaultCollapsed:!a.props.isSmallScreen&&void 0})):null})),Ot(Bt(a),"renderVLSubjectList",(function(){return a.state.selectedVL&&a.activeTopicType===Zn?f.createElement("div",null,f.createElement("h2",null,"List of subjects for VL"),f.createElement("p",null,"list of subjects goes here")):null})),Ot(Bt(a),"renderQuerySuggestionCardTitle",(function(e){return f.createElement("div",null,f.createElement(bn,{style:{fontSize:"20px"},type:"react-autoql-bubbles-outlined"}),' Query Suggestions for "',null==e?void 0:e.display_name,'"')})),Ot(Bt(a),"renderQuerySuggestions",(function(){var e,t,n=a.getSelectedTopic();if(!n)return null;var o=!(!a.state.selectedSubject||a.state.activeTopicType!==Jn);return f.createElement("div",{className:"data-explorer-section query-suggestions"},f.createElement(El,{title:a.renderQuerySuggestionCardTitle(n),defaultCollapsed:a.props.isSmallScreen?o:void 0,isCollapsed:a.props.isSmallScreen?a.state.isQuerySuggestionCollapsed:void 0,onIsCollapsedChange:function(e){a.setState({isQuerySuggestionCollapsed:e,isDataPreviewCollapsed:!e||a.state.isDataPreviewCollapsed})}},f.createElement("div",{className:"data-explorer-query-suggestion-list"},f.createElement(yl,{key:a.querySuggestionsKey,authentication:a.props.authentication,context:null===(e=a.state.selectedSubject)||void 0===e?void 0:e.name,valueLabel:a.state.selectedVL,searchText:null===(t=a.state.selectedKeywords)||void 0===t?void 0:t.display_name,selectedType:a.state.activeTopicType,executeQuery:a.props.executeQuery,skipQueryValidation:a.state.skipQueryValidation,userSelection:a.state.userSelection,onValidationSuggestionClick:a.onValidationSuggestionClick,onSuggestionListResponse:function(){return a.setState({querySuggestionContentKey:b(),skipQueryValidation:!1})}}))))})),Ot(Bt(a),"getSelectedTopic",(function(){var e=a.state.activeTopicType;return e===Jn?a.state.selectedSubject:e===Zn?a.state.selectedVL:"text"===e?a.state.selectedKeywords:null})),Ot(Bt(a),"clearContent",(function(){a.setState({activeTopicType:null,selectedSubject:null,selectedVL:null,selectedKeywords:null})})),Ot(Bt(a),"renderDataExplorerContent",(function(){var e;return a.getSelectedTopic()?f.createElement("div",{className:"data-explorer-result-container"},f.createElement(Sr,{autoHide:!1},f.createElement("div",{key:"data-explorer-sections-container-".concat(null===(e=a.state.selectedSubject)||void 0===e?void 0:e.name),className:"data-explorer-sections-container"},a.renderDataPreview(),a.renderQuerySuggestions()))):a.renderIntroMessage()})),Ot(Bt(a),"formatColumnType",(function(e){switch(e){case"DATE":case"DATE_STRING":return f.createElement("span",null,f.createElement(bn,{type:"calendar"})," Date");case"STRING":return f.createElement("span",null,f.createElement(bn,{type:"note"})," Description");case"DOLLAR_AMT":return f.createElement("span",null,f.createElement(bn,{type:"money"})," Currency");case"QUANTITY":return f.createElement("span",null,f.createElement(bn,{type:"abacus"})," Quantity")}})),Ot(Bt(a),"renderColumnQuerySuggestions",(function(e){var t,n,o=(null===(t=a.state.selectedSubject)||void 0===t?void 0:t.display_name)||"";if(!o)return null;var r=o.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 a.props.executeQuery(e)},className:"data-explorer-tooltip-query"},f.createElement(bn,{type:"react-autoql-bubbles-outlined"})," ",e)})))})),Ot(Bt(a),"renderHeaderTooltipContent",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=JSON.parse(e);if(!t)return null;var n=a.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))})),Ot(Bt(a),"render",(function(){var e;return a.props.shouldRender||(e="none"),f.createElement("div",{ref:function(e){return a.dataExplorerPage=e},className:"data-explorer-page-container","data-test":"data-explorer-tab",style:{display:e}},f.createElement(Kt,null,f.createElement(Cl,{ref:function(e){return a.inputRef=e},authentication:a.props.authentication,inputPlaceholder:a.props.inputPlaceholder,onSelection:a.onInputSelection,dataExplorerRef:a.dataExplorerPage,onClearInputClick:a.clearContent,tooltipID:a.props.tooltipID}),a.renderDataExplorerContent(),!a.props.tooltipID&&f.createElement(Un,{className:"data-preview-tooltip",id:"data-preview-tooltip",place:"right",delayHide:200,delayUpdate:200,effect:"solid",getContent:a.renderHeaderTooltipContent,clickable:!0})))})),a.querySuggestionsKey=b(),a.state={activeTopicType:null,selectedSubject:null,selectedVL:null,isQuerySuggestionSectionVisible:!0,isQuerySuggestionCollapsed:!0,isDataPreviewCollapsed:!1},a}return Pt(n)}();Ot(Tl,"propTypes",{authentication:Gt,dataFormatting:Xt,shouldRender:y.bool,inputPlaceholder:y.string,introMessage:y.oneOfType([y.string,y.element]),executeQuery:y.func,isSmallScreen:y.bool}),Ot(Tl,"defaultProps",{authentication:{},dataFormatting:Kn,shouldRender:!0,inputPlaceholder:void 0,introMessage:void 0,rebuildTooltips:void 0,executeQuery:function(){},isSmallScreen:!1});var Dl=function(t){Lt(o,f.Component);var a=Qt(o);function o(t){var r;return kt(this,o),Ot(Bt(r=a.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.state.filters&&r.props.onChange(r.state.filters),r.props.isOpen&&r.props.insertedFilter&&r.insertFilter(r.props.insertedFilter)})),Ot(Bt(r),"componentDidUpdate",(function(e,t){r.props.initialFilters&&!e.initialFilters&&r.setState({filters:r.props.initialFilters}),n(r.state.filters,t.filters)||(r.props.onChange(r.state.filters),Qn()),!r.props.isOpen&&e.isOpen&&r.setState({inputValue:""}),(r.props.isOpen&&!e.isOpen&&r.props.insertedFilter||r.props.insertedFilter&&!e.insertedFilter)&&r.insertFilter(r.props.insertedFilter)})),Ot(Bt(r),"componentWillUnmount",(function(){r._isMounted=!1,clearTimeout(r.focusInputTimeout),clearTimeout(r.highlightFilterEndTimeout),clearTimeout(r.highlightFilterStartTimeout),clearTimeout(r.savingIndicatorTimeout),clearTimeout(r.autocompleteTimer)})),Ot(Bt(r),"showSavingIndicator",(function(){r.savingIndicatorTimeout&&clearTimeout(r.savingIndicatorTimeout),r.setState({isSaving:!0}),r.savingIndicatorTimeout=setTimeout((function(){r.setState({isSaving:!1})}),1500)})),Ot(Bt(r),"animateInputTextAndSubmit",(function(e){if("string"==typeof e&&null!=e&&e.length)for(var t=500/e.length,n=function(n){setTimeout((function(){r._isMounted&&(r.setState({inputValue:e.slice(0,n+1)}),n===e.length-1&&(r.focusInputTimeout=setTimeout((function(){var e;r.inputElement=document.querySelector("#react-autoql-filter-menu-input"),null===(e=r.inputElement)||void 0===e||e.focus()}),300)))}),n*t)},a=0;a<e.length;a++)n(a)})),Ot(Bt(r),"insertFilter",(function(e){var t=r.findFilter({filterText:e});e&&t?r.handleHighlightFilterRow(r.getKey(t)):r.animateInputTextAndSubmit(e)})),Ot(Bt(r),"getAllFilters",(function(){return r.state.filters})),Ot(Bt(r),"getPersistedFilters",(function(){return C(r.state.filters.filter((function(e){return!e.isSession})))})),Ot(Bt(r),"findFilter",(function(e){var t=e.filterText,n=e.value,a=e.key,o=r.state.filters;return n&&a?o.find((function(e){return e.key===a&&e.value===n})):t?o.find((function(e){return e.value===t})):void 0})),Ot(Bt(r),"getTimeLeft",(function(e){return e?Math.ceil((e._idleStart+e._idleTimeout-Date.now())/1e3):0})),Ot(Bt(r),"fetchSuggestions",(function(e){var t,n=e.value;r.axiosSource&&r.axiosSource.cancel(Wt.CANCELLED),r.axiosSource=null===(t=m.CancelToken)||void 0===t?void 0:t.source(),ca(xt(xt({},Wn(r.props.authentication)),{},{suggestion:n,cancelToken:r.axiosSource.token})).then((function(e){var t,n,a=null==e||null===(t=e.data)||void 0===t?void 0:t.data,o=[];r.autoCompleteArray=[],n=a.matches;for(var i=0;i<n.length;i++)o.push(n[i]);o.sort((function(e,t){var n,a;return(null===(n=e.keyword)||void 0===n?void 0:n.toUpperCase())<(null===(a=t.keyword)||void 0===a?void 0:a.toUpperCase())?-1:e.keyword>t.keyword?1:0}));for(var l=0;l<o.length;l++){var s={name:o[l]};r.autoCompleteArray.push(s)}r.setState({suggestions:r.autoCompleteArray,isLoadingAutocomplete:!1})})).catch((function(e){var t;(null==e||null===(t=e.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&console.error(e),r.setState({isLoadingAutocomplete:!1})}))})),Ot(Bt(r),"onSuggestionsFetchRequested",(function(e){var t=e.value;r.setState({isLoadingAutocomplete:!0}),r.axiosSource?(clearTimeout(r.autocompleteTimer),r.autocompleteStart=Date.now(),r.autocompleteTimer=setTimeout((function(){r.fetchSuggestions({value:t})}),r.autocompleteDelay)):r.fetchSuggestions({value:t})})),Ot(Bt(r),"onSuggestionsClearRequested",(function(){r.setState({suggestions:[]})})),Ot(Bt(r),"createNewFilterFromSuggestion",(function(e){var t="include",n=r.state.filters.find((function(t){return t.show_message===e.show_message}));return n&&(t=n.filter_type),{value:e.keyword,show_message:e.show_message,key:e.canonical,filter_type:t}})),Ot(Bt(r),"setFilterTypes",(function(e,t){var n=Wn(r.props.authentication),a=e.filter((function(e){return!e.isSession}));return null!=a&&a.length?(r.showSavingIndicator(),da(xt(xt({},n),{},{filters:a})).then((function(e){var t,n,a=null==e||null===(t=e.data)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.data,o=r.state.filters.map((function(e){var t=a.find((function(t){return r.getKey(e)===r.getKey(t)}));return t||e}));return r.setState({filters:o}),Promise.resolve(e)})).catch((function(e){return console.error(e),r.setState({filters:t,isSaving:!1}),ft.error("Something went wrong. Please try again."),Promise.reject()}))):Promise.resolve()})),Ot(Bt(r),"setFilter",(function(e){if(null!=e&&e.value){var t=Wn(r.props.authentication);return r.showSavingIndicator(),da(xt(xt({},t),{},{filters:[e]})).then((function(t){var n,a,o=null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.data;if(null==o||!o.length)throw new Error("No filters in the api response");var i=o.find((function(t){return r.getKey(t)===r.getKey(e)}));if(!i)throw new Error("Filter not found in the api response");if(r.findFilter(e)){var l=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(i)?i:e}));r.setState({filters:l})}else r.setState({filters:[].concat(zt(r.state.filters),[i]),inputValue:""});return Promise.resolve()})).catch((function(e){return console.error(e),ft.error("Something went wrong. Please try again."),Promise.reject()}))}})),Ot(Bt(r),"unsetFilter",(function(t){try{return r.showSavingIndicator(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiKey,a=t.token,o=t.domain,r=t.filter;if(!o||!n||!a)return Promise.reject(new Error("Unauthenticated"));var i="".concat(o,"/autoql/api/v1/query/filter-locking/").concat(r.id,"?key=").concat(n),l={headers:{Authorization:"Bearer ".concat(a)}};return m.delete(i,l,{}).then((function(e){return Promise.resolve(e)})).catch((function(t){return Promise.reject(e(t,"response.data"))}))}(xt(xt({},Wn(r.props.authentication)),{},{filter:t}))}catch(e){return console.error(e),ft.error("Something went wrong. Please try again."),Promise.reject(e)}})),Ot(Bt(r),"getSuggestionValue",(function(e){var t=e.name;return r.createNewFilterFromSuggestion(t)})),Ot(Bt(r),"handlePersistToggle",function(){var e=Nt(wt().mark((function e(t){var n,a,o;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=xt(xt({},t),{},{isSession:!t.isSession,id:void 0}),o=r.state.filters.map((function(e){return r.getKey(e)===r.getKey(t)?a:e})),r.setState({filters:o}),e.prev=4,!t.isSession){e.next=10;break}return e.next=8,r.setFilter(a);case 8:e.next=12;break;case 10:return e.next=12,r.unsetFilter(t);case 12:e.next=18;break;case 14:e.prev=14,e.t0=e.catch(4),console.error(e.t0),r.setState({filters:n});case 18:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(r),"handleExcludeToggle",(function(e,t){var n,a,o;if(t){var i=null===(n=r.state.filters)||void 0===n||null===(a=n.find((function(t){return t.show_message===e})))||void 0===a||null===(o=a.filter_type)||void 0===o?void 0:o.toUpperCase();if(t!==i)try{var l=r.state.filters.map((function(n){return n.show_message===e?xt(xt({},n),{},{filter_type:t.toLowerCase()}):n})),s=l.filter((function(t){return t.show_message===e}));r.setFilterTypes(s,C(r.state.filters)),r.setState({filters:l})}catch(e){console.error(e)}}})),Ot(Bt(r),"removeFilter",function(){var e=Nt(wt().mark((function e(t){var n,a;return wt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.state.filters,a=r.state.filters.filter((function(e){return r.getKey(e)!==r.getKey(t)})),r.setState({filters:a}),e.prev=3,t.isSession){e.next=7;break}return e.next=7,r.unsetFilter(t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0),r.setState({filters:n});case 13:zn();case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(t){return e.apply(this,arguments)}}()),Ot(Bt(r),"onInputChange",(function(e,t){var n,a=t.newValue,o=t.method;"up"!==o&&"down"!==o&&("enter"!==o&&"click"!==o||(r.findFilter(a)?r.handleHighlightFilterRow(r.getKey(a)):r.setFilter(a)),"string"==typeof(null==e||null===(n=e.target)||void 0===n?void 0:n.value)&&r.setState({inputValue:e.target.value}))})),Ot(Bt(r),"getKey",(function(e){var t=e.key||e.canonical,n=e.value||e.keyword;return"".concat(t,"-").concat(n)})),Ot(Bt(r),"renderSavingIndicator",(function(){return r.state.isSaving?f.createElement("div",{className:"filter-locking-saving-indicator","data-test":"filter-locking-saving-indicator"},"Saving..."):null})),Ot(Bt(r),"renderTitle",(function(){return f.createElement("div",{className:"react-autoql-filter-locking-title"},f.createElement("h3",null,Zt.filterLockingTitle," ",f.createElement(bn,{type:"info","data-place":"right","data-for":"filter-locking-tooltip","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."})))})),Ot(Bt(r),"renderHeader",(function(){return f.createElement("div",{className:"filter-lock-menu-header"},r.renderTitle(),r.renderCloseBtn())})),Ot(Bt(r),"renderCloseBtn",(function(){return f.createElement("div",null,r.renderSavingIndicator(),f.createElement(vr,{onClick:r.props.onClose,className:"filter-locking-close-btn","data-tip":Zt.closeFilterLocking,"data-for":"filter-locking-tooltip",tooltipID:r.props.tooltipID,size:"small"},f.createElement(bn,{type:"close"})))})),Ot(Bt(r),"renderSuggestion",(function(e){var t=e.name;return t.keyword?f.createElement("ul",{className:"filter-lock-suggestion-item","data-for":"filter-locking-tooltip","data-delay-show":800,"data-tip":"".concat(t.keyword," <em>(").concat(t.show_message,")</em>")},f.createElement("span",null,t.keyword," ",f.createElement("em",null,"(",t.show_message,")"))):null})),Ot(Bt(r),"renderSuggestionsContainer",(function(e){var t,n=e.containerProps,a=e.children;e.query;var o=150,i=null===(t=r.filterListContainerRef)||void 0===t?void 0:t.clientHeight;return isNaN(i)||(o=i-20),f.createElement("div",n,f.createElement("div",{className:"react-autoql-filter-suggestion-container"},f.createElement(Sr,{autoHeight:!0,autoHeightMin:0,autoHeightMax:o,autoHide:!1},a)))})),Ot(Bt(r),"getSuggestions",(function(){var e,t,n=[],a=!r.state.isLoadingAutocomplete,o=!(null===(e=r.state.suggestions)||void 0===e||!e.length)&&a,i=!(null!==(t=r.state.suggestions)&&void 0!==t&&t.length)&&a;return o?n.push({title:'Related to "'.concat(r.state.inputValue,'"'),suggestions:r.state.suggestions}):i&&n.push({title:'Related to "'.concat(r.state.inputValue,'"'),suggestions:[{name:""}],emptyState:!0}),n})),Ot(Bt(r),"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)})),Ot(Bt(r),"renderVLInput",(function(){var e;return f.createElement(mt,{id:"react-autoql-filter-menu-input",highlightFirstSuggestion:!0,suggestions:r.getSuggestions(),renderSuggestion:r.renderSuggestion,getSuggestionValue:r.getSuggestionValue,onSuggestionsFetchRequested:r.onSuggestionsFetchRequested,onSuggestionsClearRequested:r.onSuggestionsClearRequested,renderSuggestionsContainer:r.renderSuggestionsContainer,getSectionSuggestions:function(e){return e.suggestions},renderSectionTitle:r.renderSectionTitle,multiSection:!0,inputProps:(e={onChange:r.onInputChange,value:r.state.inputValue,disabled:r.props.isFetchingFilters||r.state.isFetchingFilters,placeholder:"Search & select a filter"},Ot(e,"data-test","react-autoql-filter-locking-input"),Ot(e,"className","react-autoql-filter-locking-input"),Ot(e,"id","react-autoql-filter-menu-input"),e)})})),Ot(Bt(r),"renderFilterListCategory",(function(e,t){return f.createElement("div",{key:e,className:"react-autoql-filter-list-item-container"},r.renderFilterListCategoryHeader(e,t),f.createElement("div",{className:"react-autoql-filter-list"},r.state.filters.filter((function(t){return t.show_message===e})).map((function(e){return r.renderFilterListItem(e)}))))})),Ot(Bt(r),"renderFilterListCategoryHeader",(function(e,t){var n,a=null===(n=r.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":"filter-locking-tooltip","data-delay-show":800,"data-tip":e},e),f.createElement(Hi,{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:"filter-locking-tooltip",value:a,type:"button",onChange:function(t){return r.handleExcludeToggle(e,t)}})),0===t?f.createElement("div",{className:"persist-toggle-column"},f.createElement("h4",null,f.createElement("span",null,"Persist ")),f.createElement(bn,{type:"info","data-place":"left","data-for":"filter-locking-tooltip","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)})),Ot(Bt(r),"renderFilterListItem",(function(e){var t=r.getKey(e);return f.createElement("div",{key:t,"data-test":"react-autoql-filter-list-item",className:"react-autoql-filter-list-item ".concat(r.state.highlightedFilter===t?"react-autoql-highlight-row":"")},f.createElement("div",{className:"react-autoql-filter-list-item-filter"},e.value),f.createElement("div",{className:"react-autoql-filter-list-item-actions"},f.createElement(Cr,{className:"persist-toggle","data-test":"react-autoql-filter-lock-persist-toggle",type:"switch",checked:!e.isSession,onChange:function(){return r.handlePersistToggle(e)}}),f.createElement(bn,{className:"react-autoql-remove-filter-icon","data-test":"react-autoql-remove-filter-icon","data-tip":"Remove filter","data-for":"filter-locking-tooltip","data-delay-show":500,type:"trash",onClick:function(){return r.removeFilter(e)}})))})),Ot(Bt(r),"renderFilterList",(function(){var e;if(r.props.isFetchingFilters||r.state.isFetchingFilters)return f.createElement("div",{className:"react-autoql-filter-lock-list-loading-container"},f.createElement(Aa,null));if(null===(e=r.state.filters)||void 0===e||!e.length)return f.createElement("div",{className:"react-autoql-empty-filter-list"},f.createElement("i",null,Zt.noFiltersLocked));var t=zt(new Set(r.state.filters.map((function(e){return e.show_message}))));return f.createElement("div",{ref:function(e){return r.filterListContainerRef=e},className:"react-autoql-filter-list-container"},f.createElement(Sr,{autoHide:!1},t.map((function(e,t){return r.renderFilterListCategory(e,t)}))))})),Ot(Bt(r),"render",(function(){return r.props.isOpen?f.createElement(Kt,null,f.createElement(gt,{className:"filter-lock-toast-container",position:"top-center",autoClose:800,transition:vt,hideProgressBar:!0,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,closeButton:!1,limit:1}),f.createElement(Un,{afterShow:function(e){return function(e,t){var n=t.reactTooltipRef.tooltipRef;if(n){var a=n.getBoundingClientRect(),o=a.left<0,r=a.right>window.innerWidth;o?(n.style.setProperty("left","10px"),n.style.setProperty("right","auto")):r&&(n.style.setProperty("left","auto"),n.style.setProperty("right","10px"))}}(0,Bt(r))},ref:function(e){return r.reactTooltipRef=e},className:"react-autoql-tooltip",id:"filter-locking-tooltip",effect:"solid",place:"top",html:!0}),f.createElement("div",{className:"filter-lock-menu-content",onClick:function(e){return e.stopPropagation()}},r.renderHeader(),r.renderVLInput(),r.renderFilterList())):null})),r.contentKey=b(),r.autoCompleteArray=[],r.autocompleteDelay=100,r.state={filters:r.props.initialFilters||[],suggestions:[],inputValue:""},r}return Pt(o,[{key:"handleHighlightFilterRow",value:function(e){var t=this;ft.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}();Ot(Dl,"propTypes",{authentication:Gt,isOpen:y.bool,onClose:y.func,onChange:y.func,insertedFilter:y.string}),Ot(Dl,"defaultProps",{authentication:jn,insertedFilter:null,isOpen:!1,onClose:function(){},onChange:function(){}});var xl=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{insertedFilter:null}),Ot(Bt(e),"componentDidMount",(function(){e._isMounted=!0,e.initialize()})),Ot(Bt(e),"componentDidUpdate",(function(t){!e.props.isOpen&&t.isOpen&&e.setState({insertedFilter:null})})),Ot(Bt(e),"componentWillUnmount",(function(){e._isMounted=!1})),Ot(Bt(e),"initialize",(function(){e.setState({isFetchingFilters:!0}),ua(Wn(e.props.authentication)).then((function(t){var n,a,o=(null==t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.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})}))})),Ot(Bt(e),"onChange",(function(t){e.props.onChange(t),e.setState({initialFilters:t})})),Ot(Bt(e),"insertFilter",(function(t){e.setState({insertedFilter:t})})),Ot(Bt(e),"renderContent",(function(t){var n=t.position,a=t.childRect,o=t.popoverRect;return f.createElement(Re,{className:"filter-lock-menu-content-container",arrowClassName:"filter-lock-menu-popover-arrow",position:n,childRect:a,popoverRect:o,arrowSize:10},f.createElement(Dl,{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}))})),Ot(Bt(e),"render",(function(){return f.createElement(we,{containerClassName:"filter-lock-menu",onClickOutside:e.props.onClose,positions:e.props.positions,isOpen:e.props.isOpen,align:e.props.align,ref:function(t){return e.containerRef=t},parentElement:e.props.parentElement,boundaryElement:e.props.boundaryElement,content:e.renderContent,boundaryInset:10},e.props.children||f.createElement("div",{style:{display:"none"}}))})),e}return Pt(n)}();Ot(xl,"propTypes",{authentication:Gt,isOpen:y.bool,position:y.string,align:y.string,onClose:y.func,onChange:y.func}),Ot(xl,"defaultProps",{authentication:jn,isOpen:!1,position:"bottom",align:"center",onClose:function(){},onChange:function(){}});var wl=Ra(xl),Rl=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0;try{window.addEventListener("resize",o.onWindowResize)}catch(e){console.error(e),o.setState({hasError:!0})}o.props.defaultOpen&&!o.isOpen()&&o.openDataMessenger(),setTimeout(Qn,1e3)})),Ot(Bt(o),"componentDidUpdate",(function(e,t){try{var n={};o.props.placement!==e.placement&&(n.placement=o.getPlacementProp(o.props.placement)),o.state.isSizeMaximum!==t.isSizeMaximum&&o.forceUpdate(),"number"==typeof o.props.notificationCount&&o.props.notificationCount!==e.notificationCount&&o.refreshNotifications(),!o.state.isVisible&&t.isVisible&&o.props.clearOnClose&&o.setState({dataMessengerId:b()}),o.state.activePage!==t.activePage&&(n.isFilterLockMenuOpen=!1,n.selectedValueLabel=void 0),De(n)||o.setState(xt({},n))}catch(e){console.error(e),o.setState({hasError:!0})}})),Ot(Bt(o),"onError",(function(){return o.props.onErrorCallback("Something went wrong when creating this notification. Please try again.")})),Ot(Bt(o),"onSave",(function(){o.props.onSuccessAlert("Notification created!"),o.setState({isDataAlertModalVisible:!1})})),Ot(Bt(o),"onClose",(function(){o.setState({isDataAlertModalVisible:!1})})),Ot(Bt(o),"refreshNotifications",(function(){var e;null===(e=o.notificationListRef)||void 0===e||e.refreshNotifications("dm")})),Ot(Bt(o),"getMaxWidthAndHeightFromDocument",(function(){return{maxWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-o.TAB_THICKNESS,maxHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-o.TAB_THICKNESS}})),Ot(Bt(o),"onWindowResize",(function(){o.state.isWindowResizing||o.setState({isWindowResizing:!0}),clearTimeout(o.windowResizeTimer),o.windowResizeTimer=setTimeout((function(){o.setState({isWindowResizing:!1})}),300)})),Ot(Bt(o),"openDataMessenger",(function(){var e=document.getElementById("".concat(o.COMPONENT_KEY,"-drawer-handle"));e&&e.click()})),Ot(Bt(o),"closeDataMessenger",(function(){o.dmRef.setState({open:!1}),o.setState({isVisible:!1})})),Ot(Bt(o),"openExploreQueries",(function(e){o.setState({activePage:"explore-queries"},(function(){var t,n;e&&null!==(t=o.exploreQueriesRef)&&void 0!==t&&t.animateQITextAndSubmit&&(null===(n=o.exploreQueriesRef)||void 0===n||n.animateQITextAndSubmit(e))}))})),Ot(Bt(o),"openDataExplorer",(function(e){o.setState({activePage:"data-explorer"},(function(){var t,n;e&&null!==(t=o.dataExplorerRef)&&void 0!==t&&t.animateDETextAndSubmit&&(null===(n=o.dataExplorerRef)||void 0===n||n.animateDETextAndSubmit(e))}))})),Ot(Bt(o),"toggleFullScreen",(function(e,t,n){o.setState({width:e?o.props.width:t,height:e?o.props.height:n,isSizeMaximum:!e,isResizing:!0},(function(){o.setState({isResizing:!1})})),zn()})),Ot(Bt(o),"getHandleProp",(function(){return void 0!==o.props.customHandle?o.props.customHandle:!!o.props.showHandle&&f.createElement("div",{id:"".concat(o.COMPONENT_KEY,"-drawer-handle"),className:"drawer-handle\n ".concat(o.state.isVisible?" hide":"","\n ").concat(o.props.handleImage?"":" default-logo"),style:o.props.handleStyles,"data-test":"data-messenger-handle"},o.props.handleImage?f.createElement("img",{src:o.props.handleImage,height:"22px",width:"22px",draggable:"false"}):f.createElement(bn,{type:"react-autoql-bubbles-outlined",size:26}))})),Ot(Bt(o),"getDrawerHeight",(function(){return"right"===o.state.placement||"left"===o.state.placement?null:o.state.height})),Ot(Bt(o),"getDrawerWidth",(function(){return"right"===o.state.placement||"left"===o.state.placement?o.state.width:null})),Ot(Bt(o),"getPlacementProp",(function(){var e,t=o.props.placement;return"string"!=typeof t||"right"!==(e=t.trim().toLowerCase())&&"left"!==e&&"bottom"!==e&&"top"!==e?"right":e})),Ot(Bt(o),"onDrawerChange",(function(e){e?o.setState({isVisible:!0}):o.setState({isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isVisible:!1})})),Ot(Bt(o),"onTopicClick",(function(){for(var e,t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];null===(e=o.dataMessengerContentRef)||void 0===e||e.animateInputTextAndSubmit.apply(e,n)})),Ot(Bt(o),"handleClearQueriesDropdown",(function(){o.clearQueriesDropdown&&("block"===o.clearQueriesDropdown.style.display?o.clearQueriesDropdown.style.display="none":o.clearQueriesDropdown.style.display="block")})),Ot(Bt(o),"onRTValueLabelClick",(function(e){o.setState({isFilterLockMenuOpen:!0},(function(){var t;null===(t=o.filterLockRef)||void 0===t||t.insertFilter(e)}))})),Ot(Bt(o),"clearMessages",(function(){var e;if("data-messenger"===o.state.activePage)null===(e=o.dataMessengerContentRef)||void 0===e||e.clearMessages();else if("dpr"===o.state.activePage){var t;null===(t=o.dprMessengerContentRef)||void 0===t||t.clearMessages()}o.setState({isOptionsDropdownOpen:!1})})),Ot(Bt(o),"renderTabs",(function(){if(!(o.props.enableExploreQueriesTab||o.props.enableNotificationsTab||o.props.enableDPRTab||o.props.enableDataExplorerTab))return null;var e=o.state.activePage;return f.createElement("div",{className:"data-messenger-tab-container ".concat(o.props.placement," ").concat(o.state.isVisible?"visible":"hidden")},f.createElement("div",{className:"page-switcher-shadow-container ".concat(o.props.placement)},f.createElement("div",{className:"page-switcher-container ".concat(o.props.placement)},f.createElement("div",{className:"tab".concat("data-messenger"===e?" active":""),onClick:function(){return o.setState({activePage:"data-messenger"})},"data-tip":"Home","data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"react-autoql-bubbles-outlined"})),o.props.enableExploreQueriesTab&&f.createElement("div",{className:"tab".concat("explore-queries"===e?" active":""," react-autoql-explore-queries"),onClick:function(){return o.setState({activePage:"explore-queries"})},"data-tip":Zt.exploreQueries,"data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"light-bulb",size:22})),o.props.enableDataExplorerTab&&f.createElement("div",{className:"tab".concat("data-explorer"===e?" active":""," react-autoql-data-explorer"),onClick:function(){return o.setState({activePage:"data-explorer"})},"data-tip":Zt.dataExplorer,"data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"data-search",size:22})),o.props.enableNotificationsTab&&Xn(o.props.autoQLConfig).enableNotifications&&f.createElement("div",{className:"tab".concat("notifications"===e?" active":""," react-autoql-notifications"),onClick:function(){o.notificationBadgeRef&&o.notificationBadgeRef.resetCount(),o.setState({activePage:"notifications"})},"data-tip":"Notifications","data-for":o.TOOLTIP_ID},f.createElement("div",{className:"data-messenger-notification-btn"},f.createElement(Oi,{ref:function(e){return o.notificationBadgeRef=e},authentication:o.props.authentication,clearCountOnClick:!1,style:{fontSize:"19px"},overflowCount:9,count:o.props.notificationCount,useDot:!0,onCount:o.props.onNotificationCount,onErrorCallback:o.props.onErrorCallback,onNewNotification:function(e){o.props.onNewNotification(e)}}))),o.props.enableDPRTab&&f.createElement("div",{className:"tab".concat("dpr"===e?" active":""," react-autoql-dpr"),onClick:function(){return o.setState({activePage:"dpr"})},"data-tip":"Education","data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"grad-cap",size:22})))))})),Ot(Bt(o),"renderRightHeaderContent",(function(){return f.createElement(f.Fragment,null,Xn(o.props.autoQLConfig).enableFilterLocking&&o.renderFilterLockPopover(),f.createElement(we,{isOpen:o.state.isOptionsDropdownOpen,onClickOutside:function(){o.setState({isOptionsDropdownOpen:!1})},parentElement:o.messengerDrawerRef,boundaryElement:o.messengerDrawerRef,positions:["bottom","left","top","right"],content:f.createElement("div",null,f.createElement("div",{className:"clear-messages-confirm-popover"},f.createElement("div",{className:"react-autoql-menu-text",onClick:o.handleClearQueriesDropdown},f.createElement(bn,{type:"trash"}),f.createElement("span",{style:{marginLeft:5}},Zt.clearDataResponses)),f.createElement("div",{ref:function(e){return o.clearQueriesDropdown=e},id:"clear-queries-dropdown",style:{display:"none"}},f.createElement(vr,{type:"default",size:"small",onClick:function(){return o.setState({isOptionsDropdownOpen:!1})},tooltipID:o.TOOLTIP_ID},"Cancel"),f.createElement(vr,{type:"primary",size:"small",onClick:function(){return o.clearMessages()},tooltipID:o.TOOLTIP_ID},"Clear"))))},f.createElement("button",{onClick:function(){return o.setState({isOptionsDropdownOpen:!o.state.isOptionsDropdownOpen})},className:"react-autoql-drawer-header-btn clear-all ".concat("data-messenger"===o.state.activePage||"dpr"===o.state.activePage?"visible":"hidden"),"data-tip":Zt.clearDataResponses,"data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"trash"}))))})),Ot(Bt(o),"renderHeaderTitle",(function(){var e="";switch(o.state.activePage){case"data-messenger":e=o.props.title;break;case"explore-queries":e=Zt.exploreQueries;break;case"data-explorer":e=Zt.dataExplorer;break;case"notifications":e=Zt.notifications;break;case"dpr":e=Zt.education}return f.createElement("div",{className:"header-title"},e)})),Ot(Bt(o),"openFilterLockMenu",(function(){o.state.isFilterLockMenuOpen||o.setState({isFilterLockMenuOpen:!0})})),Ot(Bt(o),"closeFilterLockMenu",(function(){o.state.isFilterLockMenuOpen&&o.setState({isFilterLockMenuOpen:!1})})),Ot(Bt(o),"onFilterChange",(function(e){var t=e.filter((function(e){return e.isSession}));o.setState({sessionFilters:t,hasFilters:!(null==e||!e.length)})})),Ot(Bt(o),"isOpen",(function(){var e,t;return!(null===(e=o.dmRef)||void 0===e||null===(t=e.state)||void 0===t||!t.open)})),Ot(Bt(o),"shouldRenderPage",(function(e){return o.state.activePage===e&&o.isOpen()})),Ot(Bt(o),"renderFilterLockPopover",(function(){return f.createElement(wl,{ref:function(e){return o.filterLockRef=e},authentication:o.props.authentication,isOpen:o.state.isFilterLockMenuOpen,onChange:o.onFilterChange,onClose:o.closeFilterLockMenu,parentElement:o.messengerDrawerRef,boundaryElement:o.messengerDrawerRef,positions:["bottom","left","top","right"],align:"center"},f.createElement("button",{className:"react-autoql-drawer-header-btn filter-locking ".concat("data-messenger"===o.state.activePage?"visible":"hidden"),"data-tip":Zt.openFilterLocking,"data-for":o.TOOLTIP_ID,onClick:o.state.isFilterLockMenuOpen?o.closeFilterLockMenu:o.openFilterLockMenu},f.createElement("span",{className:"react-autoql-filter-lock-icon-container"},f.createElement(bn,{type:o.state.hasFilters?"lock":"unlock"}),o.state.hasFilters?f.createElement("div",{className:"react-autoql-filter-lock-icon-badge"}):null)))})),Ot(Bt(o),"renderHeaderContent",(function(){var e=o.getMaxWidthAndHeightFromDocument(),t=e.maxWidth,n=e.maxHeight,a=o.state.width===t;return f.createElement(v,null,f.createElement("div",{className:"react-autoql-header-left-container"},f.createElement("button",{onClick:o.closeDataMessenger,className:"react-autoql-drawer-header-btn close","data-tip":Zt.closeDataMessenger,"data-for":o.TOOLTIP_ID},f.createElement(bn,{type:"close"})),f.createElement("button",{onClick:function(){return o.toggleFullScreen(a,t,n)},className:"react-autoql-drawer-header-btn screen-mode","data-tip":a?Zt.minimizeDataMessenger:Zt.maximizeDataMessenger,"data-for":o.TOOLTIP_ID},f.createElement(bn,{type:a?"minimize":"maximize"}))),f.createElement("div",{className:"react-autoql-header-center-container"},o.renderHeaderTitle()),f.createElement("div",{className:"react-autoql-header-right-container"},o.renderRightHeaderContent()))})),Ot(Bt(o),"renderBodyContent",(function(){return f.createElement(f.Fragment,null,o.renderDataMessengerContent(),o.renderExploreQueriesContent(),o.renderDataExplorerContent(),o.renderNotificationsContent(),o.renderDPRContent())})),Ot(Bt(o),"renderDataMessengerContent",(function(){var e=Xn(o.props.autoQLConfig).enableFilterLocking?o.onRTValueLabelClick:void 0;return f.createElement(Kt,null,f.createElement(ml,Mt({},o.props,{"data-test":"data-messenger-chat-content",shouldRender:o.shouldRenderPage("data-messenger"),key:o.state.dataMessengerId,ref:function(e){return o.dataMessengerContentRef=e},authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],onRTValueLabelClick:e,queryFilters:o.state.sessionFilters,introMessages:o.dataMessengerIntroMessages,inputPlaceholder:o.props.inputPlaceholder,enableAjaxTableData:o.props.enableAjaxTableData,autoChartAggregations:o.props.autoChartAggregations,popoverParentElement:o.messengerDrawerRef,dataPageSize:o.props.dataPageSize,createDataAlertCallback:o.closeDataMessenger,tooltipID:o.TOOLTIP_ID,chartTooltipID:o.CHART_TOOLTIP_ID})))})),Ot(Bt(o),"renderDPRContent",(function(){var e,t;return o.props.enableDPRTab?f.createElement(Kt,null,f.createElement(ml,Mt({},o.props,{shouldRender:o.shouldRenderPage("dpr"),key:o.state.dataMessengerId,ref:function(e){return o.dprMessengerContentRef=e},authentication:{dprKey:null===(e=o.props.authentication)||void 0===e?void 0:e.dprKey,dprDomain:null===(t=o.props.authentication)||void 0===t?void 0:t.dprDomain},isResizing:o.state.isResizing||o.state.isWindowResizing,source:["data_messenger"],introMessages:o.dprMessengerIntroMessages,disableMaxMessageHeight:!0,inputPlaceholder:"Type your questions here",sessionId:o.COMPONENT_KEY,autoQLConfig:{enableAutocomplete:!1,enableQueryValidation:!1,enableQuerySuggestions:!1,enableColumnVisibilityManager:!1,enableQueryInterpretation:!1,enableDrilldowns:!1,enableReportProblem:!1},createDataAlertCallback:o.closeDataMessenger,tooltipID:o.TOOLTIP_ID}))):null})),Ot(Bt(o),"renderDataExplorerContent",(function(){return o.props.enableDataExplorerTab?f.createElement(Kt,null,f.createElement(Tl,{ref:function(e){return o.dataExplorerRef=e},authentication:o.props.authentication,dataFormatting:o.props.dataFormatting,shouldRender:o.shouldRenderPage("data-explorer"),tooltipID:o.TOOLTIP_ID,executeQuery:function(e){o.setState({activePage:"data-messenger"}),clearTimeout(o.executeQueryTimeout),o.executeQueryTimeout=setTimeout((function(){var t;null===(t=o.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["data_explorer"]})}),500)}})):null})),Ot(Bt(o),"renderExploreQueriesContent",(function(){return o.props.enableExploreQueriesTab?f.createElement(Kt,null,f.createElement(hl,{ref:function(e){return o.exploreQueriesRef=e},authentication:o.props.authentication,shouldRender:o.shouldRenderPage("explore-queries"),tooltipID:o.TOOLTIP_ID,executeQuery:function(e){o.setState({activePage:"data-messenger"}),clearTimeout(o.executeQueryTimeout),o.executeQueryTimeout=setTimeout((function(){var t;null===(t=o.dataMessengerContentRef)||void 0===t||t.animateInputTextAndSubmit({query:e,source:["explore_queries"]})}),500)}})):null})),Ot(Bt(o),"onDataAlertModalOpen",(function(){o.closeDataMessenger(),o.shouldOpenDataMessengerFromDA=!0})),Ot(Bt(o),"onDataAlertModalClose",(function(){o.shouldOpenDataMessengerFromDA&&(o.shouldOpenDataMessengerFromDA=!1,o.openDataMessenger())})),Ot(Bt(o),"renderNotificationsContent",(function(){return o.props.enableNotificationsTab?f.createElement(Kt,null,f.createElement($i,{ref:function(e){return o.notificationListRef=e},authentication:o.props.authentication,onExpandCallback:o.props.onNotificationExpandCallback,onCollapseCallback:o.props.onNotificationCollapseCallback,activeNotificationData:o.props.activeNotificationData,onErrorCallback:o.props.onErrorCallback,onSuccessCallback:o.props.onSuccessCallback,onDataAlertModalOpen:o.onDataAlertModalOpen,onDataAlertModalClose:o.onDataAlertModalClose,showNotificationDetails:!1,shouldRender:o.isOpen()&&"notifications"===o.state.activePage})):null})),Ot(Bt(o),"resizeDrawer",(function(t){var n=o.state.placement,a=o.getMaxWidthAndHeightFromDocument(),r=a.maxWidth,i=a.maxHeight;if("right"===n){var l=e(o.state.startingResizePosition,"x")-t.pageX,s=e(o.state.startingResizePosition,"width")+l;s>r&&(s=r),s<o.minWidth&&(s=o.minWidth),Number(s)&&o.setState({width:s,isSizeMaximum:!1})}else if("left"===n){var c=t.pageX-e(o.state.startingResizePosition,"x"),u=e(o.state.startingResizePosition,"width")+c;u>r&&(u=r),u<o.minWidth&&(u=o.minWidth),Number(u)&&o.setState({width:u,isSizeMaximum:!1})}else if("bottom"===n){var d=e(o.state.startingResizePosition,"y")-t.pageY,p=e(o.state.startingResizePosition,"height")+d;p>i&&(p=i),p<o.minHeight&&(p=o.minHeight),Number(p)&&o.setState({height:p,isSizeMaximum:!1})}else if("top"===n){var m=t.pageY-e(o.state.startingResizePosition,"y"),f=e(o.state.startingResizePosition,"height")+m;f>o.maxHeight&&(f=o.maxHeight),f<o.minHeight&&(f=o.minHeight),Number(f)&&o.setState({height:f,isSizeMaximum:!1})}})),Ot(Bt(o),"stopResizingDrawer",(function(){"right"===o.state.placement||"left"===o.state.placement?o.setState({isResizing:!1}):"top"!==o.state.placement&&"bottom"!==o.state.placement||o.setState({isResizing:!1}),document.removeEventListener("mousemove",o.resizeDrawer),document.removeEventListener("mouseup",o.stopResizingDrawer),document.removeEventListener("mouseleave",o.stopResizingDrawer)})),Ot(Bt(o),"renderResizeHandle",(function(){var e=Bt(o);if(o.state.isVisible){var t=o.getPlacementProp();return f.createElement("div",{className:"react-autoql-drawer-resize-handle ".concat(t),onMouseDown:function(t){o.setState({isResizing:!0,startingResizePosition:{x:t.pageX,y:t.pageY,width:o.state.width,height:o.state.height}}),document.addEventListener("mousemove",e.resizeDrawer),document.addEventListener("mouseup",e.stopResizingDrawer),document.addEventListener("mouseleave",e.stopResizingDrawer)}})}return null})),Ot(Bt(o),"renderTooltips",(function(){return f.createElement(v,null,f.createElement(Un,{className:"react-autoql-tooltip",id:o.TOOLTIP_ID,effect:"solid",delayShow:800,place:"top",html:!0}),f.createElement(Un,{className:"react-autoql-chart-tooltip",id:o.CHART_TOOLTIP_ID,effect:"solid",html:!0}))})),Ot(Bt(o),"renderDataAlertModal",(function(){return f.createElement(Xi,{authentication:o.props.authentication,isVisible:o.state.isDataAlertModalVisible,onClose:o.onClose,onSave:o.onSave,onErrorCallback:o.onError,initialQuery:o.state.activeQuery,tooltipID:o.TOOLTIP_ID})})),Ot(Bt(o),"render",(function(){return o.state.hasError?null:f.createElement(Kt,null,void((navigator.language||navigator.userLanguage).includes("sp")?Zt.setLanguage("sp"):Zt.setLanguage("en")),f.createElement(ut,{ref:function(e){return o.dmRef=e},id:"react-autoql-drawer-".concat(o.COMPONENT_KEY),"data-test":"react-autoql-drawer-test",className:"react-autoql-drawer\n ".concat(o.state.isResizing?" disable-selection":"","\n ").concat(o.state.isVisible?" open":" closed"),showMask:o.props.showMask,placement:o.getPlacementProp(),width:o.getDrawerWidth(),height:o.getDrawerHeight(),onChange:o.onDrawerChange,maskClosable:!0,handler:o.getHandleProp(),level:o.props.shiftScreen?"all":null,keyboard:!1},o.props.resizable&&o.renderResizeHandle(),o.renderTabs(),f.createElement("div",{ref:function(e){return o.messengerDrawerRef=e},className:"react-autoql-drawer-content-container"},f.createElement("div",{className:"chat-header-container"},o.renderHeaderContent()),o.renderBodyContent())),o.renderDataAlertModal(),o.renderTooltips())})),o.minWidth=400,o.minHeight=400,o.COMPONENT_KEY=b(),o.HEADER_THICKNESS=70,o.TAB_THICKNESS=45,o.TOOLTIP_ID="react-autoql-data-messenger-tooltip-".concat(o.COMPONENT_KEY),o.CHART_TOOLTIP_ID="react-autoql-dm-chart-tooltip-".concat(o.COMPONENT_KEY),o.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:o.openDataExplorer},f.createElement(bn,{type:"data-search",style:{marginRight:"-3px"}})," ",Zt.dataExplorer),f.createElement("span",null," to discover what data is available to you!"))],o.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."))],o.state={dataMessengerId:b(),hasError:!1,activePage:t.defaultTab,width:t.width,height:t.height,isResizing:!1,isWindowResizing:!1,placement:o.getPlacementProp(t.placement),isOptionsDropdownOpen:!1,isFilterLockMenuOpen:!1,selectedValueLabel:void 0,isSizeMaximum:!1},o}return Pt(a,[{key:"componentWillUnmount",value:function(){try{this._isMounted=!1,window.removeEventListener("resize",this.onWindowResize),clearTimeout(this.windowResizeTimer),clearTimeout(this.executeQueryTimeout)}catch(e){}}}]),a}();Ot(Rl,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,placement:y.string,maskClosable:y.bool,width:y.oneOfType([y.string,y.number]),height:y.oneOfType([y.string,y.number]),showHandle:y.bool,handleImage:y.string,handleStyles:y.shape({}),shiftScreen:y.bool,userDisplayName:y.string,clearOnClose:y.bool,enableVoiceRecord:y.bool,title:y.string,maxMessages:y.number,introMessage:y.string,enableExploreQueriesTab:y.bool,enableNotificationsTab:y.bool,resizable:y.bool,inputPlaceholder:y.string,enableDPRTab:y.bool,dataPageSize:y.number,notificationCount:y.number,defaultOpen:y.bool,popoverParentElement:y.element,enableDynamicCharting:y.bool,defaultTab:y.string,autoChartAggregations:y.bool,enableFilterLocking:y.bool,enableQueryQuickStartTopics:y.bool,enableAjaxTableData:y.bool,onNotificationExpandCallback:y.func,onNewNotification:y.func,onNotificationCount:y.func,onVisibleChange:y.func,onErrorCallback:y.func,onSuccessAlert:y.func}),Ot(Rl,"defaultProps",{authentication:{},autoQLConfig:Yn,dataFormatting:Kn,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:!0,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,onNotificationExpandCallback:function(){},onNewNotification:function(){},onNotificationCount:function(){},onVisibleChange:function(){},onErrorCallback:function(){},onSuccessAlert:function(){}});var Al=Ra(Rl),Nl=["style","className","key"],kl=[],Il=function(t){Lt(a,f.Component);var n=Qt(a);function a(t){var o;return kt(this,a),Ot(Bt(o=n.call(this,t)),"componentDidMount",(function(){o._isMounted=!0})),Ot(Bt(o),"shouldComponentUpdate",(function(e,t){if(e.isDragging&&o.props.isDragging)return!1;var n=o.getFilteredProps(o.props),a=o.getFilteredProps(e);return!$o(n,a)||!$o(o.state,t)})),Ot(Bt(o),"componentDidUpdate",(function(t,n){t.tile!==o.props.tile&&o.setState({isTitleOverFlow:o.isTitleOverFlow()}),e(o.props,"tile.title")!==e(t,"tile.title")&&o.setState({title:e(o.props,"tile.title")})})),Ot(Bt(o),"componentWillUnmount",(function(){try{o._isMounted=!1,clearTimeout(o.autoCompleteTimer),clearTimeout(o.dragEndTimeout),clearTimeout(o.setParamsForTileTimeout),o.cancelAllQueries()}catch(e){console.error(e)}})),Ot(Bt(o),"refreshLayout",(function(){var e,t;null===(e=o.state.responseRef)||void 0===e||e.refreshLayout(),null===(t=o.state.secondResponseRef)||void 0===t||t.refreshLayout()})),Ot(Bt(o),"cancelAllQueries",(function(){var e,t;null===(e=o.axiosSource)||void 0===e||e.cancel(Wt.CANCELLED),null===(t=o.secondAxiosSource)||void 0===t||t.cancel(Wt.CANCELLED)})),Ot(Bt(o),"debouncedSetParamsForTile",(function(e,t){o.paramsToSet=xt(xt({},o.paramsToSet),e),"function"==typeof t&&(o.callbackArray=[].concat(zt(o.callbackArray),[t])),clearTimeout(o.setParamsForTileTimeout),o.setParamsForTileTimeout=setTimeout((function(){o.props.setParamsForTile(o.paramsToSet,o.props.tile.i,C(o.callbackArray)),o.paramsToSet={},o.callbackArray=[]}),o.debounceTime)})),Ot(Bt(o),"getFilteredProps",(function(e){return xt(xt({},e),{},{children:void 0,tileRef:void 0})})),Ot(Bt(o),"isQueryValid",(function(e){return!!e&&!!e.trim()})),Ot(Bt(o),"setTopExecuted",(function(){o._isMounted&&o.setState({isTopExecuting:!1,isTopExecuted:!0})})),Ot(Bt(o),"endTopQuery",(function(e){var t,n=e.response;(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&o.debouncedSetParamsForTile({queryResponse:n,defaultSelectedSuggestion:void 0},o.setTopExecuted)})),Ot(Bt(o),"setBottomExecuted",(function(){o._isMounted&&o.setState({isBottomExecuting:!1,isBottomExecuted:!0})})),Ot(Bt(o),"endBottomQuery",(function(e){var t,n=e.response;(null==n||null===(t=n.data)||void 0===t?void 0:t.message)!==Wt.CANCELLED&&o.debouncedSetParamsForTile({secondQueryResponse:n,secondDefaultSelectedSuggestion:void 0},o.setBottomExecuted)})),Ot(Bt(o),"processQuery",(function(e){var t=e.query,n=e.userSelection,a=e.skipQueryValidation,r=e.source,i=e.isSecondHalf;if(o.isQueryValid(t)){var l,s,c=["dashboards"];if(null!=r&&r.length?c=[].concat(zt(c),zt(r)):c.push("user"),i&&No(o.props.tile.secondDisplayType))l=null!==(s=o.props.tile.secondPageSize)&&void 0!==s?s:o.props.dataPageSize;else if(No(o.props.tile.displayType)){var u;l=null!==(u=o.props.tile.pageSize)&&void 0!==u?u:o.props.dataPageSize}var d=xt(xt(xt({},Wn(o.props.authentication)),Xn(o.props.autoQLConfig)),{},{enableQueryValidation:!!o.props.isEditing&&Xn(o.props.autoQLConfig).enableQueryValidation,cancelToken:i?o.secondAxiosSource.token:o.axiosSource.token,skipQueryValidation:a,source:c,userSelection:n,pageSize:l,query:t});return ia(d).then((function(e){return i?o.bottomRequestData=d:o.topRequestData=d,Promise.resolve(e)})).catch((function(e){return Promise.reject(e)}))}return Promise.reject()})),Ot(Bt(o),"processTileTop",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source,l=t.pageSize;o.setState({isTopExecuting:!0});var s=o.props.tile.query!==n,c=r||o.props.tile.skipQueryValidation&&!s,u=a||(s?void 0:e(o.props.tile,"queryValidationSelections"));o.debouncedSetParamsForTile({query:n,dataConfig:s?void 0:o.props.tile.dataConfig,skipQueryValidation:c,queryResponse:null,columns:s?void 0:o.props.tile.columns,defaultSelectedSuggestion:void 0,queryValidationSelections:u}),o.processQuery({query:n,userSelection:u,skipQueryValidation:r,source:i,pageSize:l,isSecondHalf:!1}).then((function(e){o.endTopQuery({response:e})})).catch((function(e){o.endTopQuery({response:e})}))})),Ot(Bt(o),"processTileBottom",(function(t){var n=t.query,a=t.userSelection,r=t.skipQueryValidation,i=t.source;o.setState({isBottomExecuting:!0,isSecondQueryInputOpen:!1});var l=o.props.tile.secondQuery!==n,s=r||o.props.tile.secondskipQueryValidation&&!l,c=a||(l?void 0:e(o.props.tile,"secondQueryValidationSelections"));o.debouncedSetParamsForTile({secondQuery:n,secondDataConfig:l?void 0:o.props.tile.secondDataConfig,secondskipQueryValidation:s,secondQueryResponse:null,secondColumns:l?void 0:o.props.tile.secondColumns,secondDefaultSelectedSuggestion:void 0,secondQueryValidationSelections:c}),o.processQuery({query:n,userSelection:c,skipQueryValidation:r,source:i,isSecondHalf:!0}).then((function(e){o.endBottomQuery({response:e})})).catch((function(e){o.endBottomQuery({response:e})}))})),Ot(Bt(o),"clearQueryResponses",(function(){o.setState({isTopExecuting:!1,isTopExecuted:!1}),o.debouncedSetParamsForTile({queryResponse:void 0,secondQueryResponse:void 0})})),Ot(Bt(o),"processTile",(function(){var e,t,n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=a.query,i=a.secondQuery,l=a.skipQueryValidation,s=a.secondskipQueryValidation,c=a.source;null===(e=o.secondAxiosSource)||void 0===e||e.cancel(Wt.CANCELLED),null===(t=o.axiosSource)||void 0===t||t.cancel(Wt.CANCELLED),o.axiosSource=null===(n=m.CancelToken)||void 0===n?void 0:n.source(),o.secondAxiosSource=m.CancelToken.source();var u=r||o.props.tile.defaultSelectedSuggestion||o.state.query,d=i||o.props.tile.secondDefaultSelectedSuggestion||o.state.secondQuery;o.processTileTop({query:u,skipQueryValidation:l,source:c}),o.getIsSplitView()&&d&&u!==d&&o.processTileBottom({query:d,skipQueryValidation:s,source:c})})),Ot(Bt(o),"onQueryTextKeyDown",(function(e){"Enter"===e.key&&e.target.value&&(o.processTile({query:e.target.value}),e.target.blur())})),Ot(Bt(o),"onSecondQueryTextKeyDown",(function(e){"Enter"===e.key&&(o.processTileBottom({query:e.target.value}),e.target.blur())})),Ot(Bt(o),"onSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,r=e.source;o.setState({query:t}),a?o.processTileTop({query:t,userSelection:n,skipQueryValidation:!0,source:r}):o.debouncedSetParamsForTile({defaultSelectedSuggestion:t})})),Ot(Bt(o),"onSecondSuggestionClick",(function(e){var t=e.query,n=e.userSelection,a=e.isButtonClick,r=e.source;o.setState({secondQuery:t}),a?(o.debouncedSetParamsForTile({secondQuery:t,secondQueryValidationSelections:n}),o.processTileBottom({query:t,userSelection:n,skipQueryValidation:!0,source:r})):o.debouncedSetParamsForTile({secondQuery:t})})),Ot(Bt(o),"onSuggestionsFetchRequested",(function(t){var n=t.value;o.autoCompleteTimer&&clearTimeout(o.autoCompleteTimer),o.autoCompleteTimer=setTimeout((function(){sa(xt({suggestion:n},Wn(o.props.authentication))).then((function(t){if(o._isMounted){var n,a=e(t,"data.data"),r=[];kl=[],n=a.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]};kl.push(s)}o.setState({suggestions:kl})}})).catch((function(e){console.error(e)}))}),300)})),Ot(Bt(o),"onSuggestionsClearRequested",(function(){o.setState({suggestions:[]})})),Ot(Bt(o),"userSelectedSuggestionHandler",(function(e){if(e&&e.name&&o._isMounted){var t=e.name;o.userSelectedValue=t,o.userSelectedSuggestion=!0,o.setState({query:t}),o.debouncedSetParamsForTile({query:t})}})),Ot(Bt(o),"onQueryInputChange",(function(e){var t,n;o.debouncedSetParamsForTile({skipQueryValidation:!1}),(!o.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)?o.setState({query:e.target.value}):o.processTile({query:o.userSelectedValue}))})),Ot(Bt(o),"onSecondQueryInputChange",(function(e){o.setState({secondQuery:e.target.value}),o.debouncedSetParamsForTile({secondSkipQueryValidation:!1})})),Ot(Bt(o),"getIsSplitView",(function(){var e;return null===(e=o.props.tile)||void 0===e?void 0:e.splitView})),Ot(Bt(o),"toggleSecondQueryInput",(function(){o.setState({isSecondQueryInputOpen:!o.state.isSecondQueryInputOpen})})),Ot(Bt(o),"isTitleOverFlow",(function(){var e=o.dashboardTileTitleRef;return!!e&&e.getBoundingClientRect().width>e.parentElement.getBoundingClientRect().width})),Ot(Bt(o),"onQueryValidationSelectOption",(function(e,t){o.setState({query:e}),o.debouncedSetParamsForTile({query:e,queryValidationSelections:t})})),Ot(Bt(o),"onSecondQueryValidationSelectOption",(function(e,t){o.setState({secondQuery:e}),o.debouncedSetParamsForTile({secondQuery:e,secondqueryValidationSelections:t})})),Ot(Bt(o),"onPageSizeChange",(function(e){return o.debouncedSetParamsForTile({pageSize:e})})),Ot(Bt(o),"onAggConfigChange",(function(e){return o.debouncedSetParamsForTile({aggConfig:e})})),Ot(Bt(o),"onDataConfigChange",(function(e){return o.debouncedSetParamsForTile({dataConfig:e})})),Ot(Bt(o),"onDisplayTypeChange",(function(e){return o.debouncedSetParamsForTile({displayType:e})})),Ot(Bt(o),"onSecondPageSizeChange",(function(e){return o.debouncedSetParamsForTile({secondPageSize:e})})),Ot(Bt(o),"onSecondAggConfigChange",(function(e){return o.debouncedSetParamsForTile({secondAggConfig:e})})),Ot(Bt(o),"onSecondDataConfigChange",(function(e){return o.debouncedSetParamsForTile({secondDataConfig:e})})),Ot(Bt(o),"onSecondDisplayTypeChange",(function(e){return o.debouncedSetParamsForTile({secondDisplayType:e})})),Ot(Bt(o),"reportProblemCallback",(function(){var e,t;null!==(e=o.optionsToolbarRef)&&void 0!==e&&e._isMounted&&(null===(t=o.optionsToolbarRef)||void 0===t||t.openReportProblemModal())})),Ot(Bt(o),"secondReportProblemCallback",(function(){var e;null!==(e=o.secondOptionsToolbarRef)&&void 0!==e&&e._isMounted&&o.secondOptionsToolbarRef.openReportProblemModal()})),Ot(Bt(o),"onSplitViewClick",(function(){var e,t,n,a=!(null!==(e=o.props.tile)&&void 0!==e&&e.splitView),r=null===(t=o.props.tile)||void 0===t?void 0:t.secondQuery;a&&!r&&(r=null===(n=o.props.tile)||void 0===n?void 0:n.query);o.debouncedSetParamsForTile({splitView:a,secondQuery:r}),zn()})),Ot(Bt(o),"renderSplitResponse",(function(){var t=e(o.tileInnerDiv,"clientWidth")?"".concat(o.tileInnerDiv.clientWidth-70,"px"):"0px";return f.createElement(Et,{key:"dashboard-tile-splitter-layout-".concat(o.COMPONENT_KEY),vertical:!0,percentage:!0,primaryMinSize:30,secondaryMinSize:30,secondaryInitialSize:o.props.secondDisplayPercentage||50,onDragStart:function(){o.setState({isDraggingSplitter:!0})},onDragEnd:function(){o.dragEndTimeout=setTimeout((function(){var t=e(o.tileInnerDiv,"style.height",""),n=Number(t.substring(0,t.length-1));isNaN(n)||o.debouncedSetParamsForTile({secondDisplayPercentage:n}),o.setState({isDraggingSplitter:!1})}),1e3)}},f.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderTopResponse()),f.createElement("div",{className:"dashboard-tile-split-pane-container"},o.renderBottomResponse(),o.props.isEditing&&f.createElement("div",{className:"react-autoql-toolbar viz-toolbar split-view-btn split-view-query-btn","data-test":"split-view-query-btn"},f.createElement("button",{onClick:function(){o.toggleSecondQueryInput(),zn()},className:"react-autoql-toolbar-btn","data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip",style:{paddingLeft:"3px",marginRight:"10px"}},f.createElement(bn,{type:"react-autoql-bubbles-outlined"}),f.createElement(bn,{type:o.state.isSecondQueryInputOpen?"caret-left":"caret-right",style:{position:"absolute",top:"5px",left:"31px",fontSize:"10px"}})),f.createElement("input",{className:"dashboard-tile-input query second ".concat(o.state.isSecondQueryInputOpen?"open":""),value:o.state.secondQuery,spellCheck:!1,onChange:o.onSecondQueryInputChange,onKeyDown:o.onSecondQueryTextKeyDown,onBlur:function(t){e(o.props,"tile.secondQuery")!==t.target.value&&o.debouncedSetParamsForTile({secondQuery:t.target.value,secondDataConfig:void 0,secondQueryValidationSelections:void 0})},placeholder:o.props.tile.query||"Type a query in your own words",style:{width:o.state.isSecondQueryInputOpen?t:"0px"}}))))})),Ot(Bt(o),"renderHeader",(function(){return o.props.isEditing?f.createElement("div",{className:"dashboard-tile-edit-wrapper"},f.createElement("div",{className:"dashboard-tile-input-container\n ".concat(o.state.isQueryInputFocused?"query-focused":"","\n ").concat(o.state.isTitleInputFocused?"title-focused":"")},f.createElement("div",{className:"dashboard-tile-left-input-container"},f.createElement(bn,{className:"query-input-icon",type:"react-autoql-bubbles-outlined"}),Xn(o.props.autoQLConfig).enableAutocomplete?f.createElement(mt,{onSuggestionsFetchRequested:o.onSuggestionsFetchRequested,onSuggestionsClearRequested:o.onSuggestionsClearRequested,getSuggestionValue:o.userSelectedSuggestionHandler,suggestions:o.state.suggestions,ref:function(e){o.autoSuggest=e},renderSuggestion:function(e){return f.createElement(v,null,e.name)},inputProps:{className:"dashboard-tile-autocomplete-input",placeholder:"Type a query in your own words",value:o.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",onFocus:function(e){e.stopPropagation(),o.setState({isQueryInputFocused:!0})},onChange:o.onQueryInputChange,onKeyDown:o.onQueryTextKeyDown,onBlur:function(t){t.stopPropagation(),e(o.props,"tile.query")!==t.target.value&&o.debouncedSetParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0}),o.setState({isQueryInputFocused:!1})}}}):f.createElement("input",{className:"dashboard-tile-input query",placeholder:"Type a query in your own words",value:o.state.query,"data-tip":"Query","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",spellCheck:!1,onChange:o.onQueryInputChange,onKeyDown:o.onQueryTextKeyDown,onFocus:function(){o.setState({isQueryInputFocused:!0})},onBlur:function(t){e(o.props,"tile.query")!==t.target.value&&o.debouncedSetParamsForTile({query:t.target.value,dataConfig:void 0,queryValidationSelections:void 0}),o.setState({isQueryInputFocused:!1})}})),f.createElement("div",{className:"dashboard-tile-right-input-container"},f.createElement(bn,{className:"title-input-icon",type:"title"}),f.createElement("input",{className:"dashboard-tile-input title",placeholder:"Add descriptive title (optional)","data-tip":"Title","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-place":"bottom",value:o.state.title,onChange:function(e){return o.setState({title:e.target.value})},onFocus:function(){o.setState({isTitleInputFocused:!0})},onBlur:function(e){o.debouncedSetParamsForTile({title:e.target.value}),o.setState({isTitleInputFocused:!1})}}))),f.createElement("div",{className:"dashboard-tile-play-button".concat(o.isQueryValid(o.state.query)?"":" disabled")},f.createElement(bn,{type:"play",onClick:function(){return o.processTile()},"data-tip":"Run tile","data-place":"left"}))):f.createElement("div",{className:"dashboard-tile-title-container"},f.createElement("span",{ref:function(e){return o.dashboardTileTitleRef=e},className:"dashboard-tile-title",id:"dashboard-tile-title-".concat(o.COMPONENT_KEY),"data-tip":o.state.isTitleOverFlow?o.props.tile.title||o.props.tile.query||"Untitled":null,"data-for":"react-autoql-dashboard-tile-title-tooltip"},o.props.tile.title||o.props.tile.query||"Untitled"),f.createElement("div",{className:"dashboard-tile-title-divider"}))})),Ot(Bt(o),"renderContentPlaceholder",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isExecuting,a=t.isExecuted,r=null;return r=n?f.createElement(Aa,null):!o.props.isEditing&&a?f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,"No query was supplied for this tile.")):o.props.isEditing&&!e(o.state.query,"trim()")?f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,"To get started, enter a query and click ",f.createElement(bn,{className:"play-icon",type:"play"}))):f.createElement("div",{className:"dashboard-tile-placeholder-text"},f.createElement("em",null,o.props.isEditing?f.createElement("span",null,"Hit ",f.createElement(bn,{className:"edit-mode-placeholder-icon",type:"play"})," to run this tile"):f.createElement("span",null,o.props.notExecutedText))),f.createElement("div",{className:"loading-container-centered"},r)})),Ot(Bt(o),"renderSplitViewBtn",(function(){return f.createElement("div",{className:"viz-toolbar split-view-btn","data-test":"split-view-btn"},f.createElement("button",{onClick:o.onSplitViewClick,className:"react-autoql-toolbar-btn ".concat(o.getIsSplitView()?"active":""),"data-tip":o.props.tile.splitView?"Single View":"Split View","data-for":"react-autoql-dashboard-toolbar-btn-tooltip","data-test":"viz-toolbar-button"},f.createElement(bn,{type:o.getIsSplitView()?"single-view":"split-view"})))})),Ot(Bt(o),"onCSVDownloadStart",(function(e){return o.props.onCSVDownloadStart(xt(xt({},e),{},{tileId:o.props.tile.i}))})),Ot(Bt(o),"onCSVDownloadProgress",(function(e){return o.props.onCSVDownloadProgress(xt(xt({},e),{},{tileId:o.props.tile.i}))})),Ot(Bt(o),"onCSVDownloadFinish",(function(e){return o.props.onCSVDownloadFinish(xt(xt({},e),{},{tileId:o.props.tile.i}))})),Ot(Bt(o),"onDrilldownStart",(function(e){return o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!1,activeKey:e,queryOutputRef:o.state.responseRef})})),Ot(Bt(o),"renderToolbars",(function(e){e.queryOutputProps;var t=e.vizToolbarProps,n=e.optionsToolbarProps,a=e.isSecondHalf;return f.createElement("div",{className:"dashboard-tile-toolbars-container"},f.createElement("div",{className:"dashboard-tile-toolbars-left-container"},o.props.isEditing&&(a||!o.getIsSplitView())&&o.renderSplitViewBtn(),o.props.isEditing&&f.createElement(yi,Mt({},t,{shouldRender:!o.props.isDragging,tooltipID:o.props.tooltipID}))),f.createElement("div",{className:"dashboard-tile-toolbars-right-container"},f.createElement(dl,Mt({authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,onErrorCallback:o.props.onErrorCallback,onSuccessAlert:o.props.onSuccessCallback,onCSVDownloadStart:o.onCSVDownloadStart,onCSVDownloadProgress:o.onCSVDownloadProgress,onCSVDownloadFinish:o.onCSVDownloadFinish,shouldRender:!o.props.isDragging,tooltipID:o.props.tooltipID},n))))})),Ot(Bt(o),"renderResponseContent",(function(e){var t=e.queryOutputProps,n=e.isExecuting,a=e.isExecuted;return e.renderPlaceholder?o.renderContentPlaceholder({isExecuting:n,isExecuted:a}):f.createElement(vi,Mt({authentication:o.props.authentication,autoQLConfig:o.props.autoQLConfig,dataFormatting:o.props.dataFormatting,renderTooltips:!1,autoSelectQueryValidationSuggestion:!1,autoChartAggregations:o.props.autoChartAggregations,isResizing:o.props.isDragging||o.state.isDraggingSplitter,renderSuggestionsAsDropdown:o.props.tile.h<4,enableDynamicCharting:o.props.enableDynamicCharting,backgroundColor:document.documentElement.style.getPropertyValue("--react-autoql-background-color-secondary"),enableAjaxTableData:o.props.enableAjaxTableData,showQueryInterpretation:o.props.isEditing,reverseTranslationPlacement:"top",tooltipID:o.props.tooltipID,chartTooltipID:o.props.chartTooltipID,shouldRender:!o.props.isDragging,autoHeight:!1,height:"100%",width:"100%"},t))})),Ot(Bt(o),"renderResponse",(function(e){var t=e.queryOutputProps,n=void 0===t?{}:t,a=e.vizToolbarProps,r=void 0===a?{}:a,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},o.renderResponseContent({queryOutputProps:n,isExecuting:c,isExecuted:u,renderPlaceholder:d,isSecondHalf:s}),o.renderToolbars({queryOutputProps:n,vizToolbarProps:r,optionsToolbarProps:l,isSecondHalf:s}))})),Ot(Bt(o),"renderTopResponse",(function(){var t,n=o.state.isTopExecuting,a=o.state.isTopExecuted,r=!o.props.queryResponse||n||!a,i=null===(t=o.props)||void 0===t?void 0:t.displayType;return o.renderResponse({renderPlaceholder:r,isExecuting:n,isExecuted:a,queryOutputProps:{ref:function(e){return e&&e!==o.state.responseRef&&o.setState({responseRef:e})},optionsToolbarRef:o.optionsToolbarRef,vizToolbarRef:o.vizToolbarRef,key:"dashboard-tile-query-top-".concat(o.FIRST_QUERY_RESPONSE_KEY),initialDisplayType:i,queryResponse:o.props.queryResponse,initialTableConfigs:o.props.tile.dataConfig,initialAggConfig:o.props.tile.aggConfig,onTableConfigChange:o.onDataConfigChange,onAggConfigChange:o.onAggConfigChange,queryValidationSelections:o.props.tile.queryValidationSelections,onSuggestionClick:o.onSuggestionClick,defaultSelectedSuggestion:e(o.props.tile,"defaultSelectedSuggestion"),onNoneOfTheseClick:o.onNoneOfTheseClick,onDrilldownStart:o.onDrilldownStart,onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onQueryValidationSelectOption,reportProblemCallback:o.reportProblemCallback,queryRequestData:o.topRequestData,onDisplayTypeChange:o.onDisplayTypeChange,pageSize:o.props.tile.pageSize,onPageSizeChange:o.onPageSizeChange},vizToolbarProps:{ref:function(e){return o.vizToolbarRef=e},responseRef:o.state.responseRef},optionsToolbarProps:{ref:function(e){return o.optionsToolbarRef=e},responseRef:o.state.responseRef}})})),Ot(Bt(o),"areTopAndBottomSameQuery",(function(){var e,t,n,a,r=null===(e=o.props)||void 0===e||null===(t=e.tile)||void 0===t?void 0:t.query,i=null===(n=o.props)||void 0===n||null===(a=n.tile)||void 0===a?void 0:a.secondQuery;return!i||r===i})),Ot(Bt(o),"renderBottomResponse",(function(){var t,n=o.areTopAndBottomSameQuery(),a=o.state.isBottomExecuting,r=o.state.isBottomExecuted,i=o.bottomRequestData;n&&(a=o.state.isTopExecuting,r=o.state.isTopExecuted,i=o.topRequestData);var l=!n&&!o.props.secondQueryResponse||n&&!o.props.queryResponse||a||!r,s=null===(t=o.props)||void 0===t?void 0:t.secondDisplayType;return o.renderResponse({renderPlaceholder:l,isExecuting:a,isExecuted:r,queryOutputProps:{key:"dashboard-tile-query-bottom-".concat(o.SECOND_QUERY_RESPONSE_KEY),ref:function(e){return e&&e!==o.state.secondResponseRef&&o.setState({secondResponseRef:e})},optionsToolbarRef:o.secondOptionsToolbarRef,vizToolbarRef:o.secondVizToolbarRef,initialDisplayType:s,queryResponse:o.props.secondQueryResponse||o.props.queryResponse,initialTableConfigs:o.props.tile.secondDataConfig,initialAggConfig:o.props.tile.secondAggConfig,onTableConfigChange:o.onSecondDataConfigChange,onAggConfigChange:o.onSecondAggConfigChange,queryValidationSelections:o.props.tile.secondqueryValidationSelections,onSuggestionClick:o.onSecondSuggestionClick,defaultSelectedSuggestion:e(o.props.tile,"secondDefaultSelectedSuggestion"),reportProblemCallback:o.secondReportProblemCallback,onNoneOfTheseClick:o.secondOnNoneOfTheseClick,onDrilldownStart:function(e){o.props.onDrilldownStart({tileId:o.props.tile.i,isSecondHalf:!0,activeKey:e,queryOutputRef:o.state.secondResponseRef})},onDrilldownEnd:o.props.onDrilldownEnd,onQueryValidationSelectOption:o.onSecondQueryValidationSelectOption,queryRequestData:i,onDisplayTypeChange:o.onSecondDisplayTypeChange,pageSize:o.props.tile.secondPageSize,onPageSizeChange:o.onSecondPageSizeChange},vizToolbarProps:{ref:function(e){return o.secondVizToolbarRef=e},responseRef:o.state.secondResponseRef},optionsToolbarProps:{ref:function(e){return o.secondOptionsToolbarRef=e},responseRef:o.state.secondResponseRef},isSecondHalf:!0})})),Ot(Bt(o),"renderContent",(function(){return f.createElement("div",{className:"dashboard-tile-response-wrapper\n ".concat(o.props.isEditing?" editing":"","\n ").concat(o.props.tile.h<4?" small":"")},f.createElement("div",{className:"dashboard-tile-response-container"},o.getIsSplitView()?o.renderSplitResponse():o.renderTopResponse()))})),Ot(Bt(o),"renderDragHandle",(function(e,t){return f.createElement("div",Mt({},e,{className:"react-autoql-dashboard-tile-drag-handle ".concat(t)}))})),Ot(Bt(o),"renderDragHandles",(function(){var e={onMouseDown:function(e){return e.stopPropagation(),o.props.onMouseDown(e)},onMouseUp:function(e){return e.stopPropagation(),o.props.onMouseUp(e)},onTouchStart:function(e){return e.stopPropagation(),o.props.onTouchStart(e)},onTouchEnd:function(e){return e.stopPropagation(),o.props.onTouchEnd(e)}};return f.createElement(v,null,o.renderDragHandle(e,"top"),o.renderDragHandle(e,"bottom"),o.renderDragHandle(e,"left"),o.renderDragHandle(e,"right"))})),Ot(Bt(o),"renderDeleteBtn",(function(){return f.createElement("div",{className:"dashboard-tile-delete-button",onClick:function(){return o.props.deleteTile(o.props.tile.i)}},f.createElement(bn,{style:{fontSize:"18px"},type:"close"}))})),Ot(Bt(o),"render",(function(){var e={};return o.props.isDragging&&(e.pointerEvents="none"),f.createElement(Kt,null,f.createElement("div",{ref:function(e){return o.ref=e},className:o.props.className,style:xt({},o.props.style),"data-grid":o.props.tile,"data-test":"react-autoql-dashboard-tile"},o.props.children,f.createElement("div",{id:"react-autoql-dashboard-tile-inner-div-".concat(o.COMPONENT_KEY),ref:function(e){return o.tileInnerDiv=e},className:"react-autoql-dashboard-tile-inner-div\n ".concat(o.getIsSplitView()?"split":""),style:e},f.createElement(v,null,o.renderHeader(),o.renderContent())),o.props.isEditing&&o.renderDragHandles(),o.props.isEditing&&o.renderDeleteBtn()))})),o.dashboardTileTitleRef=void 0,o.optionsToolbarRef=void 0,o.secondOptionsToolbarRef=void 0,o.COMPONENT_KEY=b(),o.FIRST_QUERY_RESPONSE_KEY=b(),o.SECOND_QUERY_RESPONSE_KEY=b(),o.DEFAULT_AJAX_PAGE_SIZE=50,o.autoCompleteTimer=void 0,o.debounceTime=50,o.paramsToSet={},o.callbackArray=[],o.state={query:t.tile.query,secondQuery:t.tile.secondQuery||o.props.tile.query,title:t.tile.title,isTopExecuting:!1,isBottomExecuting:!1,suggestions:[],isSecondQueryInputOpen:!1,isTitleOverFlow:!1},o}return Pt(a)}();Ot(Il,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,tile:y.shape({}).isRequired,isEditing:y.bool,deleteTile:y.func,dataPageSize:y.number,queryResponse:y.shape({}),notExecutedText:y.string,onErrorCallback:y.func,onSuccessCallback:y.func,autoChartAggregations:y.bool,onCSVDownloadStart:y.func,onCSVDownloadProgress:y.func,onCSVDownloadFinish:y.func,enableAjaxTableData:y.bool}),Ot(Il,"defaultProps",{authentication:jn,autoQLConfig:Yn,dataFormatting:Kn,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,deleteTile:function(){},onErrorCallback:function(){},onSuccessCallback:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Pl=f.forwardRef((function(e,t){var n=e.style,a=e.className;e.key;var o=Ft(e,Nl);return f.createElement("div",{style:xt({},n),className:a,ref:t},f.createElement(Il,Mt({},o,{rglRef:t,ref:o.tileRef,className:"".concat(o.innerDivClass," ").concat(o.isEditing?"editing":"")})))})),Ol=Ct(bt),Ml=function(e){if(e)try{e.executeDashboard()}catch(e){console.error(e)}},Ll=function(e){if(e)try{e.unExecuteDashboard()}catch(e){console.error(e)}},ql=function(t){Lt(o,f.Component);var a=Qt(o);function o(t){var r;return kt(this,o),Ot(Bt(r=a.call(this,t)),"componentDidMount",(function(){r._isMounted=!0,r.props.executeOnMount&&r.executeDashboard(),window.addEventListener("resize",r.onWindowResize)})),Ot(Bt(r),"shouldComponentUpdate",(function(e,t){return!$o(r.props,e)||!$o(r.state,t)})),Ot(Bt(r),"componentDidUpdate",(function(t,n){t.isEditing&&!r.props.isEditing&&r.props.executeOnStopEditing&&r.executeDashboard(),!t.isEditing&&r.props.isEditing&&r.refreshTileLayouts(),r.getChangeDetection(r.props.tiles,t.tiles)&&e(t,"tiles[".concat(t.tiles.length," - 1].y"))!==Number.MAX_VALUE&&r.setState({justPerformedUndo:!1}),r.props.isEditing!==t.isEditing&&r.setState({isDragging:!0},(function(){r.setState({isDragging:!1})}))})),Ot(Bt(r),"componentWillUnmount",(function(){try{r._isMounted=!1,window.removeEventListener("resize",r.onWindowResize),clearTimeout(r.scrollToNewTileTimeout),clearTimeout(r.stopDraggingTimeout),clearTimeout(r.drillingDownTimeout),clearTimeout(r.animationTimeout)}catch(e){console.error(e)}})),Ot(Bt(r),"getMostRecentTiles",(function(){return r.onChangeTiles?r.onChangeTiles:r.props.tiles})),Ot(Bt(r),"subscribeToCallback",(function(e){r.callbackSubsciptions=[].concat(zt(r.callbackSubsciptions),zt(e))})),Ot(Bt(r),"debouncedOnChange",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t&&(r.previousTileState=C(r.getMostRecentTiles())),r.onChangeTiles=C(e);var a=new Promise((function(e,t){try{r.subscribeToCallback([e]),null!=n&&n.length&&r.subscribeToCallback(n),r.onChangeTimer&&clearTimeout(r.onChangeTimer),r.onChangeTimer=setTimeout((function(){if(r.onChangeTiles){var t;if(r.props.onChange(r.onChangeTiles),r.onChangeTiles=null,null!==(t=r.callbackSubsciptions)&&void 0!==t&&t.length){var n=C(r.callbackSubsciptions);return r.callbackSubsciptions=[],void n.forEach((function(e,t){r.callbackSubsciptionTimer=setTimeout((function(){e()}),50*(t+1))}))}return e()}return e()}),r.debounceTime)}catch(e){return console.error(e),r.callbackSubsciptions=[],t()}}));return a})),Ot(Bt(r),"onWindowResize",(function(e){r.currentWindowWidth||(r.currentWindowWidth=window.innerWidth);var t=e.target.innerWidth!==r.currentWindowWidth;t&&r._isMounted&&(r.state.isWindowResizing||(r.currentWindowWidth=window.innerWidth,r.setState({isWindowResizing:!0})),t&&(r.windowResizeTimer=setTimeout((function(){t&&r._isMounted&&(r.currentWindowWidth=void 0,r.setState({isWindowResizing:!1}))}),500)))})),Ot(Bt(r),"refreshTileLayouts",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].refreshLayout()}catch(e){console.error(e)}})),Ot(Bt(r),"executeDashboard",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].processTile()}catch(e){console.error(e)}})),Ot(Bt(r),"unExecuteDashboard",(function(){try{for(var e in r.tileRefs)r.tileRefs[e]&&r.tileRefs[e].clearQueryResponses()}catch(e){console.error(e)}})),Ot(Bt(r),"getChangeDetection",(function(e,t,a){return!n(r.getChangeDetectionTileStructure(e,a),r.getChangeDetectionTileStructure(t,a))})),Ot(Bt(r),"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})),Ot(Bt(r),"scrollToNewTile",(function(e){r.scrollToNewTileTimeout=setTimeout((function(){try{var t,n,a=null===(t=r.tileRefs)||void 0===t||null===(n=t[e])||void 0===n?void 0:n.ref;if(a){var o,i,l=null===(o=r.ref)||void 0===o||null===(i=o.parentElement)||void 0===i?void 0:i.getBoundingClientRect(),s=l.y,c=s+l.height,u=null==a?void 0:a.getBoundingClientRect(),d=u.y;d+u.height>c?a.scrollIntoView(!1):d<s&&a.scrollIntoView(!0)}}catch(e){}}),200)})),Ot(Bt(r),"refreshLayout",(function(){window.dispatchEvent(new Event("resize")),r.setState({isWindowResizing:!0},(function(){r.setState({isWindowResizing:!1})}))})),Ot(Bt(r),"debounceSetState",(function(e){r.stateToSet=xt(xt({},r.stateToSet),e),clearTimeout(r.setStateTimeout),r.setStateTimeout=setTimeout((function(){r.setState(r.stateToSet),r.stateToSet={}}),50)})),Ot(Bt(r),"onMoveStart",(function(e,t,n,a,o,i){r.setIsDragging(!0)})),Ot(Bt(r),"onDrag",(function(e,t,n,a,o,r){o.stopPropagation()})),Ot(Bt(r),"setIsDragging",(function(e){r._isMounted&&e!==r.state.isDragging&&r.isDragging!==e&&(r.isDragging=e,r.setState({isDragging:e}))})),Ot(Bt(r),"onMoveEnd",(function(e,t,n,a,o,i){try{var l=r.getMostRecentTiles();r.getChangeDetection(l,e,!0)&&(r.previousTileState=l),clearTimeout(r.stopDraggingTimeout),r.stopDraggingTimeout=setTimeout((function(){r.setIsDragging(!1)}),0)}catch(e){console.error(e)}})),Ot(Bt(r),"updateTileLayout",(function(e){try{var t=r.getMostRecentTiles().map((function(t,n){return xt(xt({},t),e[n])}));r.debouncedOnChange(t,!1)}catch(e){console.error(e)}})),Ot(Bt(r),"addTile",(function(){try{var e=C(r.getMostRecentTiles()),t=b();e.push({key:t,i:t,w:6,h:5,x:6*Object.keys(e).length%12,y:Number.MAX_VALUE,query:"",title:""}),r.debouncedOnChange(e).then((function(){r.scrollToNewTile(t)})).catch((function(e){console.error(e)}))}catch(e){console.error(e)}})),Ot(Bt(r),"undo",(function(){try{r.debouncedOnChange(r.previousTileState,!1),r.setState({justPerformedUndo:!0})}catch(e){console.error(e)}})),Ot(Bt(r),"deleteTile",(function(e){try{var t=C(r.getMostRecentTiles()),n=t.map((function(e){return e.i})).indexOf(e);~n&&t.splice(n,1),r.debouncedOnChange(t)}catch(e){console.error(e)}})),Ot(Bt(r),"setParamsForTile",(function(e,t,n){try{var a=r.getMostRecentTiles(),o=C(r.getMostRecentTiles()),i=o.map((function(e){return e.i})).indexOf(t);o[i]=xt(xt({},o[i]),e),Object.keys(e).includes("query")&&e.query!==a[i].query?(o[i].dataConfig=void 0,o[i].skipQueryValidation=!1):Object.keys(e).includes("secondQuery")&&e.secondQuery!==a[i].secondQuery&&(o[i].secondDataConfig=void 0,o[i].secondskipQueryValidation=!1),r.debouncedOnChange(o,void 0,n)}catch(e){console.error(e)}})),Ot(Bt(r),"onDrilldownStart",(function(e){var t=e.tileId,n=e.activeKey,a=e.isSecondHalf,o=e.queryOutputRef;Xn(r.props.autoQLConfig).enableDrilldowns&&(r.activeDrilldownRef=o,r.setState({isDrilldownRunning:!0,isDrilldownChartHidden:!1,isDrilldownModalVisible:!0,isDrilldownSecondHalf:a,activeDrilldownTile:t||r.state.activeDrilldownTile,activeDrilldownResponse:null,activeDrilldownChartElementKey:n,isAnimatingModal:!r.state.isDrilldownModalVisible}),r.animationTimeout=setTimeout((function(){r._isMounted&&r.setState({isAnimatingModal:!1})}),500))})),Ot(Bt(r),"onDrilldownEnd",(function(e){var t=e.response,n=e.error;t?r._isMounted&&r.setState({activeDrilldownResponse:t,isDrilldownRunning:!1}):n&&(console.error(n),r._isMounted&&r.setState({isDrilldownRunning:!1,activeDrilldownResponse:void 0}))})),Ot(Bt(r),"shouldShowOriginalQuery",(function(){var e,t,n=null===(e=r.activeDrilldownRef)||void 0===e||null===(t=e.state)||void 0===t?void 0:t.displayType;return!!n&&Sn.includes(n)})),Ot(Bt(r),"reportProblemCallback",(function(){r.setState({isReportProblemOpen:!0})})),Ot(Bt(r),"renderDrilldownTable",(function(){return f.createElement("div",{className:"react-autoql-dashboard-drilldown-table"},r.state.isDrilldownRunning?f.createElement("div",{className:"dashboard-tile-loading-container"},f.createElement(Aa,null)):f.createElement(vi,{ref:function(e){return r.drilldownTableRef=e},initialDisplayType:"table",isResizing:r.state.isAnimatingModal,authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,dataFormatting:r.props.dataFormatting,queryResponse:r.state.activeDrilldownResponse,renderTooltips:!1,reportProblemCallback:r.reportProblemCallback,enableAjaxTableData:r.props.enableAjaxTableData,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",tooltipID:r.TOOLTIP_ID,chartTooltipID:r.CHART_TOOLTIP_ID,allowDisplayTypeChange:!1,height:"100%",width:"100%"}))})),Ot(Bt(r),"renderChartCollapseBtn",(function(e){return f.createElement("div",{className:"drilldown-hide-chart-btn ".concat(e)},f.createElement(vr,{onClick:function(){r.setState({isDrilldownChartHidden:!r.state.isDrilldownChartHidden})},tooltip:r.state.isDrilldownChartHidden?"Show Chart":"Hide Chart",tooltipID:r.TOOLTIP_ID},f.createElement(bn,{type:"chart"}),f.createElement(bn,{type:r.state.isDrilldownChartHidden?"expand":"collapse"})))})),Ot(Bt(r),"renderReportProblemModal",(function(){return f.createElement(sl,{authentication:r.props.authentication,contentClassName:"dashboard-drilldown-report-problem-modal",onClose:r.closeReportProblemModal,onReportProblem:r.onReportProblem,responseRef:r.drilldownTableRef,isVisible:r.state.isReportProblemOpen})})),Ot(Bt(r),"closeDrilldownModal",(function(){r.setState({isDrilldownModalVisible:!1,activeDrilldownTile:null})})),Ot(Bt(r),"closeReportProblemModal",(function(){r.setState({isReportProblemOpen:!1})})),Ot(Bt(r),"onReportProblem",(function(e){var t=e.successMessage,n=e.error;t?(r.props.onSuccessCallback(t),r._isMounted&&r.setState({isReportProblemOpen:!1})):n&&r.props.onErrorCallback(n)})),Ot(Bt(r),"renderDrilldownModal",(function(){try{var e,t,n,a,o,i;if(r.state.isDrilldownModalVisible)(o=C(null===(i=r.activeDrilldownRef)||void 0===i?void 0:i.queryResponse))&&(o.data.data.columns=r.activeDrilldownRef.state.columns);var l=!r.state.isDrilldownChartHidden&&r.shouldShowOriginalQuery();return f.createElement(Ci,{className:"dashboard-drilldown-modal",contentClassName:"dashboard-drilldown-modal-content\n ".concat(r.state.isDrilldownChartHidden?"chart-hidden":"","\n ").concat(r.shouldShowOriginalQuery()?"":"top-hidden"),title:null===(e=r.activeDrilldownRef)||void 0===e||null===(t=e.queryResponse)||void 0===t||null===(n=t.data)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.text,isVisible:r.state.isDrilldownModalVisible,width:"90vw",height:"100vh",confirmText:"Done",showFooter:!1,shouldRender:r.state.isDrilldownModalVisible&&!r.state.isDragging&&!r.state.isWindowResizing,onClose:r.closeDrilldownModal},f.createElement(v,null,r.activeDrilldownRef&&f.createElement(Et,{vertical:!0,percentage:!0,secondaryInitialSize:50,primaryMinSize:l?35:0,onDragStart:function(){r.setState({isResizingDrilldown:!0})},onDragEnd:function(){r.setState({isResizingDrilldown:!1})}},f.createElement("div",{className:"react-autoql-dashboard-drilldown-original"},r.shouldShowOriginalQuery()&&f.createElement(f.Fragment,null,r.activeDrilldownRef&&f.createElement(vi,Mt({},r.activeDrilldownRef.props,{queryResponse:o,isDrilldownChartHidden:r.state.isDrilldownChartHidden,key:"dashboard-drilldown-chart-".concat(r.state.activeDrilldownTile),activeChartElementKey:r.state.activeDrilldownChartElementKey,initialDisplayType:r.activeDrilldownRef.state.displayType,initialTableConfigs:{tableConfig:r.activeDrilldownRef.tableConfig,pivotTableConfig:r.activeDrilldownRef.pivotTableConfig},isAnimating:r.state.isAnimatingModal,isResizing:r.state.isResizingDrilldown||!r.state.isDrilldownModalVisible,showQueryInterpretation:r.props.isEditing,reverseTranslationPlacement:"top",allowDisplayTypeChange:!1,height:"100%",width:"100%"})),r.renderChartCollapseBtn("bottom"))),r.renderDrilldownTable()),r.shouldShowOriginalQuery()&&r.state.isDrilldownChartHidden&&r.renderChartCollapseBtn("top")))}catch(e){console.error(e),r.props.onErrorCallback(e)}})),Ot(Bt(r),"renderEmptyDashboardMessage",(function(){return r.props.isEditable&&!r.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Start building a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){r.props.startEditingCallback()}},"New Dashboard")):r.props.isEditing?f.createElement("div",{className:"empty-dashboard-message-container"},"Add a"," ",f.createElement("span",{className:"empty-dashboard-new-tile-btn",onClick:function(){r.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")})),Ot(Bt(r),"renderTiles",(function(){var e=r.getMostRecentTiles().map((function(e){return xt(xt({},e),{},{i:e.key,maxH:12,minH:2,minW:3})})),t=r.props.dataPageSize;return r.props.enableAjaxTableData&&!t&&(t=r.DEFAULT_AJAX_PAGE_SIZE),f.createElement(Ol,{ref:function(e){return r.rglRef=e},onLayoutChange:function(e){r.updateTileLayout(e),r.setState({layout:e})},onDrag:r.onDrag,onDragStart:r.onMoveStart,onResizeStart:r.onMoveStart,onDragStop:r.onMoveEnd,onResizeStop:r.onMoveEnd,className:"react-autoql-dashboard",rowHeight:60,cols:12,isDraggable:r.props.isEditing,isResizable:r.props.isEditing,draggableHandle:".react-autoql-dashboard-tile-drag-handle",layout:e,margin:[20,20]},e.map((function(e){return f.createElement(Pl,{innerDivClass:"react-autoql-dashboard-tile ".concat(e.i),tileRef:function(t){return r.tileRefs[e.key]=t},key:e.key,dashboardRef:r.ref,authentication:r.props.authentication,autoQLConfig:r.props.autoQLConfig,tile:xt(xt({},e),{},{i:e.key,maxH:12,minH:2,minW:3}),displayType:e.displayType,secondDisplayType:e.secondDisplayType,secondDisplayPercentage:e.secondDisplayPercentage,queryResponse:e.queryResponse,secondQueryResponse:e.secondQueryResponse,isEditing:r.props.isEditing,isDragging:r.state.isDragging||r.state.isWindowResizing,isWindowResizing:r.state.isWindowResizing,setParamsForTile:r.setParamsForTile,deleteTile:r.deleteTile,dataFormatting:r.props.dataFormatting,notExecutedText:r.props.notExecutedText,enableDynamicCharting:r.props.enableDynamicCharting,onErrorCallback:r.props.onErrorCallback,onSuccessCallback:r.props.onSuccessCallback,autoChartAggregations:r.props.autoChartAggregations,onDrilldownStart:r.onDrilldownStart,onDrilldownEnd:r.onDrilldownEnd,onCSVDownloadStart:r.props.onCSVDownloadStart,onCSVDownloadProgress:r.props.onCSVDownloadProgress,onCSVDownloadFinish:r.props.onCSVDownloadFinish,enableAjaxTableData:r.props.enableAjaxTableData,tooltipID:r.TOOLTIP_ID,chartTooltipID:r.CHART_TOOLTIP_ID})})))})),Ot(Bt(r),"render",(function(){var e=r.getMostRecentTiles();return f.createElement(Kt,null,f.createElement(v,null,f.createElement("div",{ref:function(e){return r.ref=e},className:"react-autoql-dashboard-container".concat(r.props.isEditing?" edit-mode":""),"data-test":"react-autoql-dashboard"},e.length?r.renderTiles():r.renderEmptyDashboardMessage()),r.renderDrilldownModal(),r.renderReportProblemModal(),f.createElement(Un,{className:"react-autoql-tooltip",id:r.TOOLTIP_ID,effect:"solid",delayShow:500,html:!0}),f.createElement(Un,{className:"react-autoql-chart-tooltip",id:r.CHART_TOOLTIP_ID,effect:"solid",place:"top",html:!0})))})),r.COMPONENT_KEY=b(),r.TOOLTIP_ID="react-autoql-dashboard-toolbar-btn-tooltip-".concat(r.COMPONENT_KEY),r.CHART_TOOLTIP_ID="react-autoql-chart-tooltip-".concat(r.COMPONENT_KEY),r.tileRefs={},r.debounceTime=50,r.onChangeTiles=null,r.callbackSubsciptions=[],r.state={isDragging:!1,isReportProblemOpen:!1,isResizingDrilldown:!1},r}return Pt(o)}();Ot(ql,"propTypes",{authentication:Gt,autoQLConfig:Jt,dataFormatting:Xt,tiles:y.arrayOf(y.shape({})),executeOnMount:y.bool,dataPageSize:y.number,executeOnStopEditing:y.bool,isEditing:y.bool,isEditable:y.bool,notExecutedText:y.string,onChange:y.func,enableDynamicCharting:y.bool,onErrorCallback:y.func,onSuccessCallback:y.func,autoChartAggregations:y.bool,onCSVDownloadStart:y.func,onCSVDownloadProgress:y.func,onCSVDownloadFinish:y.func,enableAjaxTableData:y.bool}),Ot(ql,"defaultProps",{authentication:jn,autoQLConfig:Yn,dataFormatting:Kn,tiles:[],executeOnMount:!0,dataPageSize:void 0,executeOnStopEditing:!0,isEditing:!1,isEditable:!0,notExecutedText:void 0,enableDynamicCharting:!0,autoChartAggregations:!0,enableAjaxTableData:!1,onErrorCallback:function(){},onSuccessCallback:function(){},onChange:function(){},onCSVDownloadStart:function(){},onCSVDownloadProgress:function(){},onCSVDownloadFinish:function(){}});var Vl=Ra(ql),_l=function(e){Lt(n,f.Component);var t=Qt(n);function n(){var e;kt(this,n);for(var a=arguments.length,o=new Array(a),r=0;r<a;r++)o[r]=arguments[r];return Ot(Bt(e=t.call.apply(t,[this].concat(o))),"state",{isRecording:!1,currentQuery:0,resultHistory:[],currentFile:"",currentBlob:"",showPopoverMessage:!1,errorMessage:""}),Ot(Bt(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)})),Ot(Bt(e),"startRecording",(function(){e.setState({isRecording:!0}),navigator.getUserMedia({audio:!0},(function(t){e.stream=t,e.recordAudio=St(e.stream,{type:"audio",mimeType:"audio/webm",desiredSampRate:16e3,recorderType:Tt,numberOfAudioChannels:1}),e.recordAudio.startRecording()}),(function(e){console.error(JSON.stringify(e))}))})),Ot(Bt(e),"onRecordStop",(function(t,n){e.setState({currentFile:t,currentBlob:n},(function(){e.sendWavFile(t)}))})),Ot(Bt(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)}}))})),Ot(Bt(e),"blobToFile",(function(e){return e.lastModifiedDate=new Date,e.name="speech.wav",e})),Ot(Bt(e),"getMediaPermissionStatus",(function(){return navigator.permissions.query({name:"microphone"}).then((function(e){return e.state}))})),Ot(Bt(e),"onMouseDown",(function(){zn(),e.startRecording()})),Ot(Bt(e),"sendWavFile",(function(t){var n="".concat(e.props.authentication.domain,"/autoql/api/v1/query/speech-to-text?key=").concat(e.props.authentication.apiKey),a=new FormData;a.append("file",t,"speech.wav");var o={headers:{Authorization:"Bearer ".concat(e.props.authentication.token)},timeout:3e4};m.post(n,a,o).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})}))}))})),Ot(Bt(e),"render",(function(){return f.createElement(Kt,null,f.createElement(we,{isOpen:e.state.showPopoverMessage,padding:20,content:function(){return f.createElement("div",{style:{backgroundColor:"#FFD2D2",opacity:1,paddingLeft:"10px",paddingRight:"10px"}},f.createElement(bn,{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(bn,{type:"microphone"}))),f.createElement(Un,{className:"react-autoql-tooltip",id:"react-autoql-speech-to-text-tooltip",effect:"solid",delayShow:800}))})),e}return Pt(n)}();Ot(_l,"propTypes",{authentication:Gt,transcript:y.string,interimTranscript:y.string,finalTranscript:y.string,resetTranscript:y.func,onTranscriptChange:y.func,onFinalTranscript:y.func}),Ot(_l,"defaultProps",{authentication:jn});export{Vl as Dashboard,Pl as DashboardTile,Xi as DataAlertModal,nl as DataAlerts,Tl as DataExplorer,Al as DataMessenger,hl as ExploreQueries,ll as ExpressionBuilder,_i as ExpressionBuilderSimple,wl as FilterLockPopover,bn as Icon,Aa as LoadingDots,$i as NotificationFeed,Oi as NotificationIcon,Fi as NotificationItem,dl as OptionsToolbar,tr as QueryInput,vi as QueryOutput,yl as QuerySuggestionList,sl as ReportProblemModal,fi as ReverseTranslation,Wi as ScheduleBuilder,_l as SpeechToTextButton,ha as SpeechToTextButtonBrowser,yi as VizToolbar,wa as configureTheme,Ml as executeDashboard,pa as fetchExploreQueries,Qo as getDefaultDisplayType,Fo as getSupportedDisplayTypes,Bo as isDisplayTypeValid,Ll as unExecuteDashboard};